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