Made local variables actually local.
Both JPEGTranslator and JPEG200Translator were "exporting" gSettings symbol, which when loaded within a app (like Paladin) exporting the same global symbol was leading to a symbol resolution error. See #7114 for details. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40245 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -25,7 +25,7 @@ using std::min;
|
||||
#define ERROR(x)
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format gInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -45,7 +45,7 @@ translation_format gInputFormats[] = {
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format gOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -65,11 +65,16 @@ translation_format gOutputFormats[] = {
|
||||
};
|
||||
|
||||
// Default settings for the Translator
|
||||
TranSetting gDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false}
|
||||
};
|
||||
|
||||
const uint32 kNumInputFormats = sizeof(sInputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumOutputFormats = sizeof(sOutputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// make_nth_translator
|
||||
//
|
||||
@@ -118,10 +123,10 @@ make_nth_translator(int32 n, image_id you, uint32 flags, ...)
|
||||
BMPTranslator::BMPTranslator()
|
||||
: BaseTranslator("BMP images", "BMP image translator",
|
||||
BMP_TRANSLATOR_VERSION,
|
||||
gInputFormats, sizeof(gInputFormats) / sizeof(translation_format),
|
||||
gOutputFormats, sizeof(gOutputFormats) / sizeof(translation_format),
|
||||
sInputFormats, kNumInputFormats,
|
||||
sOutputFormats, kNumOutputFormats,
|
||||
"BMPTranslator_Settings",
|
||||
gDefaultSettings, sizeof(gDefaultSettings) / sizeof(TranSetting),
|
||||
sDefaultSettings, kNumDefaultSettings,
|
||||
B_TRANSLATOR_BITMAP, B_BMP_FORMAT)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format sInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
EXR_IMAGE_FORMAT,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -33,7 +33,7 @@ translation_format sInputFormats[] = {
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format sOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -45,7 +45,7 @@ translation_format sOutputFormats[] = {
|
||||
};
|
||||
|
||||
// Default settings for the Translator
|
||||
static TranSetting sDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false}
|
||||
};
|
||||
|
||||
@@ -42,7 +42,7 @@ my_pim_write(hpgs_image *_this, const char *filename)
|
||||
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format sInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
HPGS_IMAGE_FORMAT,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -54,7 +54,7 @@ translation_format sInputFormats[] = {
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format sOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -66,7 +66,7 @@ translation_format sOutputFormats[] = {
|
||||
};
|
||||
|
||||
// Default settings for the Translator
|
||||
static TranSetting sDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#define HVIF_TRANSLATION_QUALITY 1.0
|
||||
#define HVIF_TRANSLATION_CAPABILITY 1.0
|
||||
|
||||
static translation_format sInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
HVIF_FORMAT_CODE,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -33,7 +33,7 @@ static translation_format sInputFormats[] = {
|
||||
};
|
||||
|
||||
|
||||
static translation_format sOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -45,10 +45,15 @@ static translation_format sOutputFormats[] = {
|
||||
};
|
||||
|
||||
|
||||
static TranSetting sDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{ HVIF_SETTING_RENDER_SIZE, TRAN_SETTING_INT32, 64 }
|
||||
};
|
||||
|
||||
const uint32 kNumInputFormats = sizeof(sInputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumOutputFormats = sizeof(sOutputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting);
|
||||
|
||||
|
||||
|
||||
BTranslator *
|
||||
make_nth_translator(int32 n, image_id image, uint32 flags, ...)
|
||||
@@ -61,11 +66,11 @@ make_nth_translator(int32 n, image_id image, uint32 flags, ...)
|
||||
|
||||
HVIFTranslator::HVIFTranslator()
|
||||
: BaseTranslator("HVIF icons", "Native Haiku vector icon translator",
|
||||
HVIF_TRANSLATOR_VERSION, sInputFormats,
|
||||
sizeof(sInputFormats) / sizeof(sInputFormats[0]), sOutputFormats,
|
||||
sizeof(sOutputFormats) / sizeof(sOutputFormats[0]),
|
||||
"HVIFTranslator_Settings", sDefaultSettings,
|
||||
sizeof(sDefaultSettings) / sizeof(sDefaultSettings[0]),
|
||||
HVIF_TRANSLATOR_VERSION,
|
||||
sInputFormats, kNumInputFormats,
|
||||
sOutputFormats, kNumOutputFormats,
|
||||
"HVIFTranslator_Settings",
|
||||
sDefaultSettings, kNumDefaultSettings,
|
||||
B_TRANSLATOR_BITMAP, HVIF_FORMAT_CODE)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ const char *kDocumentIndex = "/documentIndex";
|
||||
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format sInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
ICO_IMAGE_FORMAT,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -41,7 +41,7 @@ translation_format sInputFormats[] = {
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format sOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
ICO_IMAGE_FORMAT,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -61,7 +61,7 @@ translation_format sOutputFormats[] = {
|
||||
};
|
||||
|
||||
// Default settings for the Translator
|
||||
static TranSetting sDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false}
|
||||
};
|
||||
|
||||
@@ -55,8 +55,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
// Translation Kit required globals
|
||||
char gTranslatorName[] = "JPEG images";
|
||||
char gTranslatorInfo[] =
|
||||
static char sTranslatorName[] = "JPEG images";
|
||||
static char sTranslatorInfo[] =
|
||||
"©2002-2003, Marcin Konicki\n"
|
||||
"©2005-2007, Haiku\n"
|
||||
"\n"
|
||||
@@ -69,28 +69,26 @@ char gTranslatorInfo[] =
|
||||
"With some colorspace conversion routines by Magnus Hellman\n"
|
||||
" http://www.bebits.com/app/802\n";
|
||||
|
||||
int32 gTranslatorVersion = B_TRANSLATION_MAKE_VERSION(1, 2, 0);
|
||||
static const int32 sTranslatorVersion = B_TRANSLATION_MAKE_VERSION(1, 2, 0);
|
||||
|
||||
// Define the formats we know how to read
|
||||
const translation_format gInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{ JPEG_FORMAT, B_TRANSLATOR_BITMAP, 0.5, 0.5,
|
||||
JPEG_MIME_STRING, JPEG_DESCRIPTION },
|
||||
{ B_TRANSLATOR_BITMAP, B_TRANSLATOR_BITMAP, 0.5, 0.5,
|
||||
B_TRANSLATOR_BITMAP_MIME_STRING, B_TRANSLATOR_BITMAP_DESCRIPTION }
|
||||
};
|
||||
const int gInputFormatCount = sizeof(gInputFormats) / sizeof(translation_format);
|
||||
|
||||
// Define the formats we know how to write
|
||||
const translation_format gOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{ JPEG_FORMAT, B_TRANSLATOR_BITMAP, 0.5, 0.5,
|
||||
JPEG_MIME_STRING, JPEG_DESCRIPTION },
|
||||
{ B_TRANSLATOR_BITMAP, B_TRANSLATOR_BITMAP, 0.5, 0.5,
|
||||
B_TRANSLATOR_BITMAP_MIME_STRING, B_TRANSLATOR_BITMAP_DESCRIPTION }
|
||||
};
|
||||
const int gOutputFormatCount = sizeof(gOutputFormats) / sizeof(translation_format);
|
||||
|
||||
|
||||
TranSetting gSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{JPEG_SET_SMOOTHING, TRAN_SETTING_INT32, 0},
|
||||
{JPEG_SET_QUALITY, TRAN_SETTING_INT32, 95},
|
||||
{JPEG_SET_PROGRESSIVE, TRAN_SETTING_BOOL, true},
|
||||
@@ -101,7 +99,10 @@ TranSetting gSettings[] = {
|
||||
{JPEG_SET_PHOTOSHOP_CMYK, TRAN_SETTING_BOOL, true},
|
||||
{JPEG_SET_SHOWREADWARNING, TRAN_SETTING_BOOL, true}
|
||||
};
|
||||
const int gSettingsCount = sizeof(gSettings) / sizeof(TranSetting);
|
||||
|
||||
const uint32 kNumInputFormats = sizeof(sInputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumOutputFormats = sizeof(sOutputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting);
|
||||
|
||||
|
||||
namespace conversion {
|
||||
@@ -658,19 +659,19 @@ TranslatorAboutView::TranslatorAboutView(const char* name)
|
||||
BView(name, 0, new BGroupLayout(B_VERTICAL))
|
||||
{
|
||||
BAlignment labelAlignment = BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP);
|
||||
BStringView* title = new BStringView("Title", gTranslatorName);
|
||||
BStringView* title = new BStringView("Title", sTranslatorName);
|
||||
title->SetFont(be_bold_font);
|
||||
title->SetExplicitAlignment(labelAlignment);
|
||||
|
||||
char versionString[16];
|
||||
sprintf(versionString, "v%d.%d.%d", (int)(gTranslatorVersion >> 8),
|
||||
(int)((gTranslatorVersion >> 4) & 0xf), (int)(gTranslatorVersion & 0xf));
|
||||
sprintf(versionString, "v%d.%d.%d", (int)(sTranslatorVersion >> 8),
|
||||
(int)((sTranslatorVersion >> 4) & 0xf), (int)(sTranslatorVersion & 0xf));
|
||||
|
||||
BStringView* version = new BStringView("Version", versionString);
|
||||
version->SetExplicitAlignment(labelAlignment);
|
||||
|
||||
BTextView* infoView = new BTextView("info");
|
||||
infoView->SetText(gTranslatorInfo);
|
||||
infoView->SetText(sTranslatorInfo);
|
||||
infoView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
infoView->MakeEditable(false);
|
||||
|
||||
@@ -1293,10 +1294,11 @@ JPEGTranslator::Error(j_common_ptr cinfo, status_t error)
|
||||
|
||||
|
||||
JPEGTranslator::JPEGTranslator()
|
||||
:
|
||||
BaseTranslator(gTranslatorName, gTranslatorInfo, gTranslatorVersion,
|
||||
gInputFormats, gInputFormatCount, gOutputFormats, gOutputFormatCount,
|
||||
SETTINGS_FILE, gSettings, gSettingsCount,
|
||||
: BaseTranslator(sTranslatorName, sTranslatorInfo, sTranslatorVersion,
|
||||
sInputFormats, kNumInputFormats,
|
||||
sOutputFormats, kNumOutputFormats,
|
||||
SETTINGS_FILE,
|
||||
sDefaultSettings, kNumDefaultSettings,
|
||||
B_TRANSLATOR_BITMAP, JPEG_FORMAT)
|
||||
{}
|
||||
|
||||
@@ -1316,7 +1318,7 @@ main(int, char**)
|
||||
{
|
||||
BApplication app("application/x-vnd.Haiku-JPEGTranslator");
|
||||
JPEGTranslator* translator = new JPEGTranslator();
|
||||
if (LaunchTranslatorWindow(translator, gTranslatorName) == B_OK)
|
||||
if (LaunchTranslatorWindow(translator, sTranslatorName) == B_OK)
|
||||
app.Run();
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -50,8 +50,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define B_TRANSLATOR_BITMAP_MIME_STRING "image/x-be-bitmap"
|
||||
#define B_TRANSLATOR_BITMAP_DESCRIPTION "Be Bitmap Format (JPEG2000Translator)"
|
||||
|
||||
const char gTranslatorName[] = "JPEG2000 images";
|
||||
const char gTranslatorInfo[] = "©2002-2003, Shard\n"
|
||||
static const char sTranslatorName[] = "JPEG2000 images";
|
||||
static const char sTranslatorInfo[] = "©2002-2003, Shard\n"
|
||||
"©2005-2006, Haiku\n"
|
||||
"\n"
|
||||
"Based on JasPer library:\n"
|
||||
@@ -63,34 +63,33 @@ const char gTranslatorInfo[] = "©2002-2003, Shard\n"
|
||||
"ImageMagick's jp2 codec was used as \"tutorial\".\n"
|
||||
" http://www.imagemagick.org/\n";
|
||||
|
||||
int32 gTranslatorVersion = B_TRANSLATION_MAKE_VERSION(1, 0, 0);
|
||||
static int32 sTranslatorVersion = B_TRANSLATION_MAKE_VERSION(1, 0, 0);
|
||||
|
||||
translation_format gInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{ JP2_FORMAT, B_TRANSLATOR_BITMAP, 0.5, 0.5,
|
||||
JP2_MIME_STRING, JP2_DESCRIPTION },
|
||||
{ B_TRANSLATOR_BITMAP, B_TRANSLATOR_BITMAP, 0.5, 0.5,
|
||||
B_TRANSLATOR_BITMAP_MIME_STRING, B_TRANSLATOR_BITMAP_DESCRIPTION },
|
||||
};
|
||||
const int gInputFormatCount =
|
||||
sizeof(gInputFormats) / sizeof(translation_format);
|
||||
|
||||
translation_format gOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{ JP2_FORMAT, B_TRANSLATOR_BITMAP, 0.5, 0.5,
|
||||
JP2_MIME_STRING, JP2_DESCRIPTION },
|
||||
{ B_TRANSLATOR_BITMAP, B_TRANSLATOR_BITMAP, 0.5, 0.5,
|
||||
B_TRANSLATOR_BITMAP_MIME_STRING, B_TRANSLATOR_BITMAP_DESCRIPTION },
|
||||
};
|
||||
const int gOutputFormatCount =
|
||||
sizeof(gOutputFormats) / sizeof(translation_format);
|
||||
|
||||
|
||||
TranSetting gSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{JP2_SET_QUALITY, TRAN_SETTING_INT32, 25},
|
||||
{JP2_SET_JPC, TRAN_SETTING_BOOL, false},
|
||||
{JP2_SET_GRAY1_AS_B_RGB24, TRAN_SETTING_BOOL, false},
|
||||
{JP2_SET_GRAY8_AS_B_RGB32, TRAN_SETTING_BOOL, true}
|
||||
};
|
||||
const int gSettingsCount = sizeof(gSettings) / sizeof(TranSetting) ;
|
||||
|
||||
const uint32 kNumInputFormats = sizeof(sInputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumOutputFormats = sizeof(sOutputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting);
|
||||
|
||||
|
||||
namespace conversion{
|
||||
@@ -703,19 +702,19 @@ TranslatorAboutView::TranslatorAboutView(const char* name)
|
||||
BView(name, 0, new BGroupLayout(B_VERTICAL))
|
||||
{
|
||||
BAlignment labelAlignment = BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP);
|
||||
BStringView* title = new BStringView("Title", gTranslatorName);
|
||||
BStringView* title = new BStringView("Title", sTranslatorName);
|
||||
title->SetFont(be_bold_font);
|
||||
title->SetExplicitAlignment(labelAlignment);
|
||||
|
||||
char versionString[16];
|
||||
sprintf(versionString, "v%d.%d.%d", (int)(gTranslatorVersion >> 8),
|
||||
(int)((gTranslatorVersion >> 4) & 0xf), (int)(gTranslatorVersion & 0xf));
|
||||
sprintf(versionString, "v%d.%d.%d", (int)(sTranslatorVersion >> 8),
|
||||
(int)((sTranslatorVersion >> 4) & 0xf), (int)(sTranslatorVersion & 0xf));
|
||||
|
||||
BStringView* version = new BStringView("Version", versionString);
|
||||
version->SetExplicitAlignment(labelAlignment);
|
||||
|
||||
BTextView* infoView = new BTextView("info");
|
||||
infoView->SetText(gTranslatorInfo);
|
||||
infoView->SetText(sTranslatorInfo);
|
||||
infoView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
infoView->MakeEditable(false);
|
||||
|
||||
@@ -763,11 +762,12 @@ JP2Translator::NewConfigView(TranslatorSettings* settings)
|
||||
|
||||
|
||||
JP2Translator::JP2Translator()
|
||||
:
|
||||
BaseTranslator(gTranslatorName, gTranslatorInfo, gTranslatorVersion,
|
||||
gInputFormats, gInputFormatCount,
|
||||
gOutputFormats, gOutputFormatCount, JP2_SETTINGS_FILE,
|
||||
gSettings, gSettingsCount, B_TRANSLATOR_BITMAP, JP2_FORMAT)
|
||||
: BaseTranslator(sTranslatorName, sTranslatorInfo, sTranslatorVersion,
|
||||
sInputFormats, kNumInputFormats,
|
||||
sOutputFormats, kNumOutputFormats,
|
||||
JP2_SETTINGS_FILE,
|
||||
sDefaultSettings, kNumDefaultSettings,
|
||||
B_TRANSLATOR_BITMAP, JP2_FORMAT)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1287,7 +1287,7 @@ main()
|
||||
{
|
||||
BApplication app("application/x-vnd.Haiku-JPEG2000Translator");
|
||||
JP2Translator* translator = new JP2Translator();
|
||||
if (LaunchTranslatorWindow(translator, gTranslatorName) == B_OK)
|
||||
if (LaunchTranslatorWindow(translator, sTranslatorName) == B_OK)
|
||||
app.Run();
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format sInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
PCX_IMAGE_FORMAT,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -38,7 +38,7 @@ translation_format sInputFormats[] = {
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format sOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
/*{
|
||||
PCX_IMAGE_FORMAT,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -58,7 +58,7 @@ translation_format sOutputFormats[] = {
|
||||
};
|
||||
|
||||
// Default settings for the Translator
|
||||
static TranSetting sDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false}
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "PNGView.h"
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format gInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
B_PNG_FORMAT,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -67,7 +67,7 @@ translation_format gInputFormats[] = {
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format gOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
B_PNG_FORMAT,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -87,13 +87,18 @@ translation_format gOutputFormats[] = {
|
||||
};
|
||||
|
||||
// Default settings for the Translator
|
||||
TranSetting gDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{PNG_SETTING_INTERLACE, TRAN_SETTING_INT32, PNG_INTERLACE_NONE}
|
||||
// interlacing is off by default
|
||||
};
|
||||
|
||||
const uint32 kNumInputFormats = sizeof(sInputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumOutputFormats = sizeof(sOutputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// make_nth_translator
|
||||
//
|
||||
@@ -182,10 +187,10 @@ pngcb_flush_data(png_structp ppng)
|
||||
PNGTranslator::PNGTranslator()
|
||||
: BaseTranslator("PNG images", "PNG image translator",
|
||||
PNG_TRANSLATOR_VERSION,
|
||||
gInputFormats, sizeof(gInputFormats) / sizeof(translation_format),
|
||||
gOutputFormats, sizeof(gOutputFormats) / sizeof(translation_format),
|
||||
sInputFormats, kNumInputFormats,
|
||||
sOutputFormats, kNumOutputFormats,
|
||||
"PNGTranslator_Settings",
|
||||
gDefaultSettings, sizeof(gDefaultSettings) / sizeof(TranSetting),
|
||||
sDefaultSettings, kNumDefaultSettings,
|
||||
B_TRANSLATOR_BITMAP, B_PNG_FORMAT)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -90,8 +90,8 @@ struct ppm_settings {
|
||||
bool write_ascii;
|
||||
bool settings_touched;
|
||||
};
|
||||
BLocker g_settings_lock("PPM settings lock");
|
||||
ppm_settings g_settings;
|
||||
static BLocker g_settings_lock("PPM settings lock");
|
||||
static ppm_settings g_settings;
|
||||
|
||||
BPoint get_window_origin();
|
||||
void set_window_origin(BPoint pos);
|
||||
|
||||
@@ -46,7 +46,7 @@ const char* kProgressMonitor = "/progressMonitor";
|
||||
const char* kProgressMessage = "/progressMessage";
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format sInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
RAW_IMAGE_FORMAT,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -62,11 +62,11 @@ translation_format sInputFormats[] = {
|
||||
RAW_IN_CAPABILITY,
|
||||
"image/x-vnd.photo-raw",
|
||||
"Digital Photo RAW image"
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format sOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -74,11 +74,11 @@ translation_format sOutputFormats[] = {
|
||||
BITS_OUT_CAPABILITY,
|
||||
"image/x-be-bitmap",
|
||||
"Be Bitmap Format (RAWTranslator)"
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
// Default settings for the Translator
|
||||
static TranSetting sDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false}
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format sInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
RTF_TEXT_FORMAT,
|
||||
B_TRANSLATOR_TEXT,
|
||||
@@ -27,11 +27,11 @@ translation_format sInputFormats[] = {
|
||||
RTF_IN_CAPABILITY,
|
||||
"text/rtf",
|
||||
"RichTextFormat file"
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format sOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_TEXT,
|
||||
B_TRANSLATOR_TEXT,
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
using std::nothrow;
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format gInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -73,7 +73,7 @@ translation_format gInputFormats[] = {
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format gOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -93,13 +93,18 @@ translation_format gOutputFormats[] = {
|
||||
};
|
||||
|
||||
// Default settings for the Translator
|
||||
TranSetting gDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{SGI_SETTING_COMPRESSION, TRAN_SETTING_INT32, SGI_COMP_RLE}
|
||||
// compression is set to RLE by default
|
||||
};
|
||||
|
||||
const uint32 kNumInputFormats = sizeof(sInputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumOutputFormats = sizeof(sOutputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// make_nth_translator
|
||||
//
|
||||
@@ -149,10 +154,10 @@ SGITranslator::SGITranslator()
|
||||
:
|
||||
BaseTranslator("SGI images", "SGI image translator",
|
||||
SGI_TRANSLATOR_VERSION,
|
||||
gInputFormats, sizeof(gInputFormats) / sizeof(translation_format),
|
||||
gOutputFormats, sizeof(gOutputFormats) / sizeof(translation_format),
|
||||
sInputFormats, kNumInputFormats,
|
||||
sOutputFormats, kNumOutputFormats,
|
||||
"SGITranslator_Settings",
|
||||
gDefaultSettings, sizeof(gDefaultSettings) / sizeof(TranSetting),
|
||||
sDefaultSettings, kNumDefaultSettings,
|
||||
B_TRANSLATOR_BITMAP, SGI_FORMAT)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
BaseTranslator::BaseTranslator(const char *name, const char *info,
|
||||
const int32 version, const translation_format *inFormats,
|
||||
int32 inCount, const translation_format *outFormats, int32 outCount,
|
||||
const char *settingsFile, TranSetting *defaults, int32 defCount,
|
||||
const char *settingsFile, const TranSetting *defaults, int32 defCount,
|
||||
uint32 tranGroup, uint32 tranType)
|
||||
:
|
||||
BTranslator()
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
BaseTranslator(const char *name, const char *info,
|
||||
const int32 version, const translation_format *inFormats,
|
||||
int32 inCount, const translation_format *outFormats, int32 outCount,
|
||||
const char *settingsFile, TranSetting *defaults, int32 defCount,
|
||||
const char *settingsFile, const TranSetting *defaults, int32 defCount,
|
||||
uint32 tranGroup, uint32 tranType);
|
||||
|
||||
virtual const char *TranslatorName() const;
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
// Returns:
|
||||
// ---------------------------------------------------------------
|
||||
TranslatorSettings::TranslatorSettings(const char *settingsFile,
|
||||
TranSetting *defaults, int32 defCount)
|
||||
const TranSetting *defaults, int32 defCount)
|
||||
: fLock("TranslatorSettings Lock")
|
||||
{
|
||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &fSettingsPath))
|
||||
|
||||
@@ -49,7 +49,7 @@ struct TranSetting {
|
||||
|
||||
class TranslatorSettings {
|
||||
public:
|
||||
TranslatorSettings(const char *settingsFile, TranSetting *defaults,
|
||||
TranslatorSettings(const char *settingsFile, const TranSetting *defaults,
|
||||
int32 defCount);
|
||||
|
||||
TranslatorSettings *Acquire();
|
||||
|
||||
@@ -32,7 +32,7 @@ using namespace std;
|
||||
#define DATA_BUFFER_SIZE 256
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format gInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_TEXT,
|
||||
B_TRANSLATOR_TEXT,
|
||||
@@ -52,7 +52,7 @@ translation_format gInputFormats[] = {
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format gOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_TEXT,
|
||||
B_TRANSLATOR_TEXT,
|
||||
@@ -72,11 +72,15 @@ translation_format gOutputFormats[] = {
|
||||
};
|
||||
|
||||
// Default settings for the Translator
|
||||
TranSetting gDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false}
|
||||
};
|
||||
|
||||
const uint32 kNumInputFormats = sizeof(sInputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumOutputFormats = sizeof(sOutputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting);
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// make_nth_translator
|
||||
//
|
||||
@@ -1331,10 +1335,10 @@ translate_from_text(BPositionIO* source, const char* encoding, bool forceEncodin
|
||||
STXTTranslator::STXTTranslator()
|
||||
: BaseTranslator("StyledEdit files", "StyledEdit files translator",
|
||||
STXT_TRANSLATOR_VERSION,
|
||||
gInputFormats, sizeof(gInputFormats) / sizeof(translation_format),
|
||||
gOutputFormats, sizeof(gOutputFormats) / sizeof(translation_format),
|
||||
sInputFormats, kNumInputFormats,
|
||||
sOutputFormats, kNumOutputFormats,
|
||||
"STXTTranslator_Settings",
|
||||
gDefaultSettings, sizeof(gDefaultSettings) / sizeof(TranSetting),
|
||||
sDefaultSettings, kNumDefaultSettings,
|
||||
B_TRANSLATOR_TEXT, B_STYLED_TEXT_FORMAT)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "StreamBuffer.h"
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format gInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -55,7 +55,7 @@ translation_format gInputFormats[] = {
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format gOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -75,7 +75,7 @@ translation_format gOutputFormats[] = {
|
||||
};
|
||||
|
||||
// Default settings for the Translator
|
||||
TranSetting gDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{TGA_SETTING_RLE, TRAN_SETTING_BOOL, false},
|
||||
@@ -84,6 +84,11 @@ TranSetting gDefaultSettings[] = {
|
||||
// Don't ignore the alpha channel by default
|
||||
};
|
||||
|
||||
const uint32 kNumInputFormats = sizeof(sInputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumOutputFormats = sizeof(sOutputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// make_nth_translator
|
||||
//
|
||||
@@ -133,10 +138,10 @@ make_nth_translator(int32 n, image_id you, uint32 flags, ...)
|
||||
TGATranslator::TGATranslator()
|
||||
: BaseTranslator("TGA images", "TGA image translator",
|
||||
TGA_TRANSLATOR_VERSION,
|
||||
gInputFormats, sizeof(gInputFormats) / sizeof(translation_format),
|
||||
gOutputFormats, sizeof(gOutputFormats) / sizeof(translation_format),
|
||||
sInputFormats, kNumInputFormats,
|
||||
sOutputFormats, kNumOutputFormats,
|
||||
"TGATranslator_Settings",
|
||||
gDefaultSettings, sizeof(gDefaultSettings) / sizeof(TranSetting),
|
||||
sDefaultSettings, kNumDefaultSettings,
|
||||
B_TRANSLATOR_BITMAP, B_TGA_FORMAT)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format gInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -50,7 +50,7 @@ translation_format gInputFormats[] = {
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format gOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -70,13 +70,18 @@ translation_format gOutputFormats[] = {
|
||||
};
|
||||
|
||||
// Default settings for the Translator
|
||||
TranSetting gDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{TIFF_SETTING_COMPRESSION, TRAN_SETTING_INT32, COMPRESSION_LZW}
|
||||
// Compression is LZW by default
|
||||
};
|
||||
|
||||
const uint32 kNumInputFormats = sizeof(sInputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumOutputFormats = sizeof(sOutputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// make_nth_translator
|
||||
//
|
||||
@@ -593,10 +598,10 @@ write_tif_stream(TIFF* tif, BPositionIO* inSource, color_space format,
|
||||
TIFFTranslator::TIFFTranslator()
|
||||
: BaseTranslator("TIFF images", "TIFF image translator",
|
||||
TIFF_TRANSLATOR_VERSION,
|
||||
gInputFormats, sizeof(gInputFormats) / sizeof(translation_format),
|
||||
gOutputFormats, sizeof(gOutputFormats) / sizeof(translation_format),
|
||||
sInputFormats, kNumInputFormats,
|
||||
sOutputFormats, kNumOutputFormats,
|
||||
"TIFFTranslator_Settings",
|
||||
gDefaultSettings, sizeof(gDefaultSettings) / sizeof(TranSetting),
|
||||
sDefaultSettings, kNumDefaultSettings,
|
||||
B_TRANSLATOR_BITMAP, B_TIFF_FORMAT)
|
||||
{
|
||||
// TODO: for now!
|
||||
|
||||
@@ -41,7 +41,7 @@ class FreeAllocation {
|
||||
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format sInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
{
|
||||
WEBP_IMAGE_FORMAT,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -53,7 +53,7 @@ translation_format sInputFormats[] = {
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format sOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -65,7 +65,7 @@ translation_format sOutputFormats[] = {
|
||||
};
|
||||
|
||||
// Default settings for the Translator
|
||||
static TranSetting sDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false},
|
||||
{B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false}
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
using std::nothrow;
|
||||
|
||||
// The input formats that this translator supports.
|
||||
translation_format gInputFormats[] = {
|
||||
static const translation_format sInputFormats[] = {
|
||||
/*{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -43,7 +43,7 @@ translation_format gInputFormats[] = {
|
||||
};
|
||||
|
||||
// The output formats that this translator supports.
|
||||
translation_format gOutputFormats[] = {
|
||||
static const translation_format sOutputFormats[] = {
|
||||
{
|
||||
B_TRANSLATOR_BITMAP,
|
||||
B_TRANSLATOR_BITMAP,
|
||||
@@ -64,11 +64,15 @@ translation_format gOutputFormats[] = {
|
||||
|
||||
|
||||
// Default settings for the Translator
|
||||
TranSetting gDefaultSettings[] = {
|
||||
static const TranSetting sDefaultSettings[] = {
|
||||
{ B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false },
|
||||
{ B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false }
|
||||
};
|
||||
|
||||
const uint32 kNumInputFormats = sizeof(sInputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumOutputFormats = sizeof(sOutputFormats) / sizeof(translation_format);
|
||||
const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting);
|
||||
|
||||
|
||||
BTranslator*
|
||||
make_nth_translator(int32 n, image_id you, uint32 flags, ...)
|
||||
@@ -83,10 +87,10 @@ make_nth_translator(int32 n, image_id you, uint32 flags, ...)
|
||||
WonderBrushTranslator::WonderBrushTranslator()
|
||||
: BaseTranslator("WonderBrush images", "WonderBrush image translator",
|
||||
WBI_TRANSLATOR_VERSION,
|
||||
gInputFormats, sizeof(gInputFormats) / sizeof(translation_format),
|
||||
gOutputFormats, sizeof(gOutputFormats) / sizeof(translation_format),
|
||||
sInputFormats, kNumInputFormats,
|
||||
sOutputFormats, kNumOutputFormats,
|
||||
"WBITranslator_Settings",
|
||||
gDefaultSettings, sizeof(gDefaultSettings) / sizeof(TranSetting),
|
||||
sDefaultSettings, kNumDefaultSettings,
|
||||
B_TRANSLATOR_BITMAP, WBI_FORMAT)
|
||||
{
|
||||
#if GAMMA_BLEND
|
||||
|
||||
Reference in New Issue
Block a user