Applied patchs from Karvjorm (tickets #7118, #7128, #7137) with fixes by myself: Localizations for JPEG, BMP, ICO translators.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40298 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a0ad88e002
commit
03901b6cae
|
@ -32,9 +32,15 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
|
||||||
#include "BMPTranslator.h"
|
#include "BMPTranslator.h"
|
||||||
#include "TranslatorWindow.h"
|
#include "TranslatorWindow.h"
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "BMPMain"
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// main
|
// main
|
||||||
//
|
//
|
||||||
|
@ -53,8 +59,9 @@ main()
|
||||||
{
|
{
|
||||||
BApplication app("application/x-vnd.Haiku-BMPTranslator");
|
BApplication app("application/x-vnd.Haiku-BMPTranslator");
|
||||||
status_t result;
|
status_t result;
|
||||||
|
|
||||||
result = LaunchTranslatorWindow(new BMPTranslator,
|
result = LaunchTranslatorWindow(new BMPTranslator,
|
||||||
"BMP Settings", BRect(0, 0, 225, 175));
|
B_TRANSLATE("BMP Settings"), BRect(0, 0, 225, 175));
|
||||||
if (result == B_OK) {
|
if (result == B_OK) {
|
||||||
app.Run();
|
app.Run();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "BMPTranslator.h"
|
#include "BMPTranslator.h"
|
||||||
#include "BMPView.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
@ -15,15 +14,24 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
|
|
||||||
|
#include "BMPView.h"
|
||||||
|
|
||||||
|
|
||||||
using std::nothrow;
|
using std::nothrow;
|
||||||
using std::min;
|
using std::min;
|
||||||
|
|
||||||
|
|
||||||
//#define INFO(x) printf(x);
|
//#define INFO(x) printf(x);
|
||||||
#define INFO(x)
|
#define INFO(x)
|
||||||
//#define ERROR(x) printf(x);
|
//#define ERROR(x) printf(x);
|
||||||
#define ERROR(x)
|
#define ERROR(x)
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "BMPTranslator"
|
||||||
|
|
||||||
|
|
||||||
// The input formats that this translator supports.
|
// The input formats that this translator supports.
|
||||||
static const translation_format sInputFormats[] = {
|
static const translation_format sInputFormats[] = {
|
||||||
{
|
{
|
||||||
|
@ -121,7 +129,8 @@ make_nth_translator(int32 n, image_id you, uint32 flags, ...)
|
||||||
// Returns:
|
// Returns:
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
BMPTranslator::BMPTranslator()
|
BMPTranslator::BMPTranslator()
|
||||||
: BaseTranslator("BMP images", "BMP image translator",
|
: BaseTranslator(B_TRANSLATE("BMP images"),
|
||||||
|
B_TRANSLATE("BMP image translator"),
|
||||||
BMP_TRANSLATOR_VERSION,
|
BMP_TRANSLATOR_VERSION,
|
||||||
sInputFormats, kNumInputFormats,
|
sInputFormats, kNumInputFormats,
|
||||||
sOutputFormats, kNumOutputFormats,
|
sOutputFormats, kNumOutputFormats,
|
||||||
|
@ -362,7 +371,9 @@ identify_bmp_header(BPositionIO *inSource, translator_info *outInfo,
|
||||||
outInfo->group = B_TRANSLATOR_BITMAP;
|
outInfo->group = B_TRANSLATOR_BITMAP;
|
||||||
outInfo->quality = BMP_IN_QUALITY;
|
outInfo->quality = BMP_IN_QUALITY;
|
||||||
outInfo->capability = BMP_IN_CAPABILITY;
|
outInfo->capability = BMP_IN_CAPABILITY;
|
||||||
sprintf(outInfo->name, "BMP image (MS format, %d bits",
|
sprintf(outInfo->name,
|
||||||
|
B_TRANSLATE_COMMENT("BMP image (MS format, %d bits",
|
||||||
|
"Ignore missing closing round bracket"),
|
||||||
msheader.bitsperpixel);
|
msheader.bitsperpixel);
|
||||||
if (msheader.compression)
|
if (msheader.compression)
|
||||||
strcat(outInfo->name, ", RLE)");
|
strcat(outInfo->name, ", RLE)");
|
||||||
|
@ -431,8 +442,8 @@ identify_bmp_header(BPositionIO *inSource, translator_info *outInfo,
|
||||||
outInfo->group = B_TRANSLATOR_BITMAP;
|
outInfo->group = B_TRANSLATOR_BITMAP;
|
||||||
outInfo->quality = BMP_IN_QUALITY;
|
outInfo->quality = BMP_IN_QUALITY;
|
||||||
outInfo->capability = BMP_IN_CAPABILITY;
|
outInfo->capability = BMP_IN_CAPABILITY;
|
||||||
sprintf(outInfo->name, "BMP image (OS/2 format, %d bits)",
|
sprintf(outInfo->name, B_TRANSLATE("BMP image (OS/2 format, "
|
||||||
os2header.bitsperpixel);
|
"%d bits)"), os2header.bitsperpixel);
|
||||||
strcpy(outInfo->MIME, "image/x-bmp");
|
strcpy(outInfo->MIME, "image/x-bmp");
|
||||||
}
|
}
|
||||||
if (pfileheader && pmsheader) {
|
if (pfileheader && pmsheader) {
|
||||||
|
@ -1889,6 +1900,7 @@ BMPTranslator::DerivedTranslate(BPositionIO *inSource,
|
||||||
BView *
|
BView *
|
||||||
BMPTranslator::NewConfigView(TranslatorSettings *settings)
|
BMPTranslator::NewConfigView(TranslatorSettings *settings)
|
||||||
{
|
{
|
||||||
return new BMPView(BRect(0, 0, 225, 175), "BMPTranslator Settings",
|
return new BMPView(BRect(0, 0, 225, 175),
|
||||||
B_FOLLOW_ALL, B_WILL_DRAW, settings);
|
B_TRANSLATE("BMPTranslator Settings"), B_FOLLOW_ALL, B_WILL_DRAW,
|
||||||
|
settings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,13 +29,16 @@
|
||||||
#ifndef BMP_TRANSLATOR_H
|
#ifndef BMP_TRANSLATOR_H
|
||||||
#define BMP_TRANSLATOR_H
|
#define BMP_TRANSLATOR_H
|
||||||
|
|
||||||
|
#include <ByteOrder.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <DataIO.h>
|
||||||
|
#include <GraphicsDefs.h>
|
||||||
|
#include <InterfaceDefs.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <Translator.h>
|
#include <Translator.h>
|
||||||
#include <TranslatorFormats.h>
|
#include <TranslatorFormats.h>
|
||||||
#include <TranslationDefs.h>
|
#include <TranslationDefs.h>
|
||||||
#include <GraphicsDefs.h>
|
|
||||||
#include <InterfaceDefs.h>
|
|
||||||
#include <DataIO.h>
|
|
||||||
#include <ByteOrder.h>
|
|
||||||
#include "BaseTranslator.h"
|
#include "BaseTranslator.h"
|
||||||
|
|
||||||
#define BMP_NO_COMPRESS 0
|
#define BMP_NO_COMPRESS 0
|
||||||
|
|
|
@ -13,10 +13,14 @@
|
||||||
#include "BMPView.h"
|
#include "BMPView.h"
|
||||||
#include "BMPTranslator.h"
|
#include "BMPTranslator.h"
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "BMPView"
|
||||||
|
|
||||||
|
|
||||||
BMPView::BMPView(const BRect &frame, const char *name, uint32 resizeMode,
|
BMPView::BMPView(const BRect &frame, const char *name, uint32 resizeMode,
|
||||||
uint32 flags, TranslatorSettings *settings)
|
uint32 flags, TranslatorSettings *settings)
|
||||||
|
@ -30,7 +34,8 @@ BMPView::BMPView(const BRect &frame, const char *name, uint32 resizeMode,
|
||||||
float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
|
float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
|
||||||
|
|
||||||
BRect rect(10, 10, 200, 10 + height);
|
BRect rect(10, 10, 200, 10 + height);
|
||||||
BStringView *stringView = new BStringView(rect, "title", "BMP image translator");
|
BStringView *stringView = new BStringView(rect, "title",
|
||||||
|
B_TRANSLATE("BMP image translator"));
|
||||||
stringView->SetFont(be_bold_font);
|
stringView->SetFont(be_bold_font);
|
||||||
stringView->ResizeToPreferred();
|
stringView->ResizeToPreferred();
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
@ -39,7 +44,7 @@ BMPView::BMPView(const BRect &frame, const char *name, uint32 resizeMode,
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 10);
|
rect.OffsetBy(0, height + 10);
|
||||||
char version[256];
|
char version[256];
|
||||||
snprintf(version, sizeof(version), "Version %d.%d.%d, %s",
|
snprintf(version, sizeof(version), B_TRANSLATE("Version %d.%d.%d, %s"),
|
||||||
int(B_TRANSLATION_MAJOR_VERSION(BMP_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MAJOR_VERSION(BMP_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_MINOR_VERSION(BMP_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MINOR_VERSION(BMP_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_REVISION_VERSION(BMP_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_REVISION_VERSION(BMP_TRANSLATOR_VERSION)),
|
||||||
|
@ -55,7 +60,7 @@ BMPView::BMPView(const BRect &frame, const char *name, uint32 resizeMode,
|
||||||
height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
|
height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 5);
|
rect.OffsetBy(0, height + 5);
|
||||||
stringView = new BStringView(rect, "Copyright", B_UTF8_COPYRIGHT "2002-2006 Haiku Inc.");
|
stringView = new BStringView(rect, "Copyright", B_UTF8_COPYRIGHT "2002-2010 Haiku Inc.");
|
||||||
stringView->ResizeToPreferred();
|
stringView->ResizeToPreferred();
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,15 @@ Translator BMPTranslator :
|
||||||
: true
|
: true
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DoCatalogs BMPTranslator :
|
||||||
|
x-vnd.Haiku-BMPTranslator
|
||||||
|
:
|
||||||
|
BMPMain.cpp
|
||||||
|
BMPTranslator.cpp
|
||||||
|
BMPView.cpp
|
||||||
|
;
|
||||||
|
|
||||||
Package haiku-translationkit-cvs :
|
Package haiku-translationkit-cvs :
|
||||||
BMPTranslator :
|
BMPTranslator :
|
||||||
boot home config add-ons Translators ;
|
boot home config add-ons Translators ;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "ConfigView.h"
|
#include "ConfigView.h"
|
||||||
#include "ICOTranslator.h"
|
#include "ICOTranslator.h"
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
#include <SpaceLayoutItem.h>
|
#include <SpaceLayoutItem.h>
|
||||||
|
@ -15,14 +16,18 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "ConfigView"
|
||||||
|
|
||||||
|
|
||||||
ConfigView::ConfigView()
|
ConfigView::ConfigView()
|
||||||
:
|
:
|
||||||
BGroupView("ICOTranslator Settings", B_VERTICAL, 0)
|
BGroupView(B_TRANSLATE("ICOTranslator Settings"), B_VERTICAL, 0)
|
||||||
{
|
{
|
||||||
BAlignment leftAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET);
|
BAlignment leftAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET);
|
||||||
|
|
||||||
BStringView* stringView = new BStringView("title", "Windows icon images");
|
BStringView* stringView = new BStringView("title",
|
||||||
|
B_TRANSLATE("Windows icon images"));
|
||||||
stringView->SetFont(be_bold_font);
|
stringView->SetFont(be_bold_font);
|
||||||
stringView->SetExplicitAlignment(leftAlignment);
|
stringView->SetExplicitAlignment(leftAlignment);
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
@ -31,7 +36,7 @@ ConfigView::ConfigView()
|
||||||
AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
|
AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
|
||||||
|
|
||||||
char version[256];
|
char version[256];
|
||||||
sprintf(version, "Version %d.%d.%d, %s",
|
sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
|
||||||
int(B_TRANSLATION_MAJOR_VERSION(ICO_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MAJOR_VERSION(ICO_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_MINOR_VERSION(ICO_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MINOR_VERSION(ICO_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_REVISION_VERSION(ICO_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_REVISION_VERSION(ICO_TRANSLATOR_VERSION)),
|
||||||
|
@ -47,24 +52,26 @@ ConfigView::ConfigView()
|
||||||
|
|
||||||
AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
|
AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
|
||||||
|
|
||||||
BCheckBox *checkBox = new BCheckBox("color", "Write 32 bit images on"
|
BCheckBox *checkBox = new BCheckBox("color",
|
||||||
" true color input", NULL);
|
B_TRANSLATE("Write 32 bit images on true color input"), NULL);
|
||||||
checkBox->SetExplicitAlignment(leftAlignment);
|
checkBox->SetExplicitAlignment(leftAlignment);
|
||||||
AddChild(checkBox);
|
AddChild(checkBox);
|
||||||
|
|
||||||
checkBox = new BCheckBox("size", "Enforce valid icon sizes", NULL);
|
checkBox = new BCheckBox("size", B_TRANSLATE("Enforce valid icon sizes"),
|
||||||
|
NULL);
|
||||||
checkBox->SetValue(1);
|
checkBox->SetValue(1);
|
||||||
checkBox->SetExplicitAlignment(leftAlignment);
|
checkBox->SetExplicitAlignment(leftAlignment);
|
||||||
AddChild(checkBox);
|
AddChild(checkBox);
|
||||||
|
|
||||||
AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
|
AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
|
||||||
|
|
||||||
stringView = new BStringView("valid1", "Valid icon sizes are"
|
stringView = new BStringView("valid1",
|
||||||
" 16, 32, or 48");
|
B_TRANSLATE("Valid icon sizes are 16, 32, or 48"));
|
||||||
stringView->SetExplicitAlignment(leftAlignment);
|
stringView->SetExplicitAlignment(leftAlignment);
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
|
||||||
stringView = new BStringView("valid2", "pixel in either direction.");
|
stringView = new BStringView("valid2",
|
||||||
|
B_TRANSLATE("pixel in either direction."));
|
||||||
stringView->SetExplicitAlignment(leftAlignment);
|
stringView->SetExplicitAlignment(leftAlignment);
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,20 @@
|
||||||
|
|
||||||
|
|
||||||
#include "ICOTranslator.h"
|
#include "ICOTranslator.h"
|
||||||
#include "ConfigView.h"
|
|
||||||
#include "ICO.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
|
|
||||||
|
#include "ConfigView.h"
|
||||||
|
#include "ICO.h"
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "ICOTranslator"
|
||||||
|
|
||||||
|
|
||||||
const char *kDocumentCount = "/documentCount";
|
const char *kDocumentCount = "/documentCount";
|
||||||
const char *kDocumentIndex = "/documentIndex";
|
const char *kDocumentIndex = "/documentIndex";
|
||||||
|
@ -72,7 +79,8 @@ const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting
|
||||||
|
|
||||||
|
|
||||||
ICOTranslator::ICOTranslator()
|
ICOTranslator::ICOTranslator()
|
||||||
: BaseTranslator("Windows icon images", "Windows icon translator",
|
: BaseTranslator(B_TRANSLATE("Windows icon images"),
|
||||||
|
B_TRANSLATE("Windows icon translator"),
|
||||||
ICO_TRANSLATOR_VERSION,
|
ICO_TRANSLATOR_VERSION,
|
||||||
sInputFormats, kNumInputFormats,
|
sInputFormats, kNumInputFormats,
|
||||||
sOutputFormats, kNumOutputFormats,
|
sOutputFormats, kNumOutputFormats,
|
||||||
|
@ -107,8 +115,10 @@ ICOTranslator::DerivedIdentify(BPositionIO *stream,
|
||||||
info->group = B_TRANSLATOR_BITMAP;
|
info->group = B_TRANSLATOR_BITMAP;
|
||||||
info->quality = ICO_IN_QUALITY;
|
info->quality = ICO_IN_QUALITY;
|
||||||
info->capability = ICO_IN_CAPABILITY;
|
info->capability = ICO_IN_CAPABILITY;
|
||||||
snprintf(info->name, sizeof(info->name), "Windows %s %ld bit image",
|
snprintf(info->name, sizeof(info->name),
|
||||||
type == ICO::kTypeIcon ? "Icon" : "Cursor", bitsPerPixel);
|
B_TRANSLATE("Windows %s %ld bit image"),
|
||||||
|
type == ICO::kTypeIcon ? B_TRANSLATE("Icon") : B_TRANSLATE("Cursor"),
|
||||||
|
bitsPerPixel);
|
||||||
strcpy(info->MIME, kICOMimeType);
|
strcpy(info->MIME, kICOMimeType);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
|
@ -15,6 +15,13 @@ Translator ICOTranslator :
|
||||||
: true
|
: true
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DoCatalogs ICOTranslator :
|
||||||
|
x-vnd.Haiku-ICOTranslator
|
||||||
|
:
|
||||||
|
ConfigView.cpp
|
||||||
|
ICOTranslator.cpp
|
||||||
|
;
|
||||||
|
|
||||||
Package haiku-translationkit-cvs :
|
Package haiku-translationkit-cvs :
|
||||||
ICOTranslator
|
ICOTranslator
|
||||||
: boot home config add-ons Translators
|
: boot home config add-ons Translators
|
||||||
|
|
|
@ -4,11 +4,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
|
||||||
#include "ICOTranslator.h"
|
#include "ICOTranslator.h"
|
||||||
#include "ICO.h"
|
#include "ICO.h"
|
||||||
|
|
||||||
#include "TranslatorWindow.h"
|
#include "TranslatorWindow.h"
|
||||||
#include <Application.h>
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "main"
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -17,7 +22,8 @@ main(int /*argc*/, char **/*argv*/)
|
||||||
BApplication app("application/x-vnd.Haiku-ICOTranslator");
|
BApplication app("application/x-vnd.Haiku-ICOTranslator");
|
||||||
|
|
||||||
status_t result;
|
status_t result;
|
||||||
result = LaunchTranslatorWindow(new ICOTranslator, "ICO Settings", BRect(0, 0, 225, 175));
|
result = LaunchTranslatorWindow(new ICOTranslator,
|
||||||
|
B_TRANSLATE("ICO Settings"), BRect(0, 0, 225, 175));
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,14 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "exif_parser.h"
|
#include "exif_parser.h"
|
||||||
|
|
||||||
#include <Alignment.h>
|
#include <Alignment.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <GridLayoutBuilder.h>
|
#include <GridLayoutBuilder.h>
|
||||||
#include <GroupLayoutBuilder.h>
|
#include <GroupLayoutBuilder.h>
|
||||||
#include <TabView.h>
|
#include <TabView.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "JPEGTranslator"
|
||||||
|
|
||||||
#define MARKER_EXIF 0xe1
|
#define MARKER_EXIF 0xe1
|
||||||
|
|
||||||
|
@ -514,14 +517,14 @@ TranslatorWriteView::TranslatorWriteView(const char* name,
|
||||||
new BMessage(VIEW_MSG_SET_QUALITY), 0, 100);
|
new BMessage(VIEW_MSG_SET_QUALITY), 0, 100);
|
||||||
fQualitySlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
fQualitySlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
||||||
fQualitySlider->SetHashMarkCount(10);
|
fQualitySlider->SetHashMarkCount(10);
|
||||||
fQualitySlider->SetLimitLabels("Low", "High");
|
fQualitySlider->SetLimitLabels(B_TRANSLATE("Low"), B_TRANSLATE("High"));
|
||||||
fQualitySlider->SetValue(fSettings->SetGetInt32(JPEG_SET_QUALITY, NULL));
|
fQualitySlider->SetValue(fSettings->SetGetInt32(JPEG_SET_QUALITY, NULL));
|
||||||
|
|
||||||
fSmoothingSlider = new SSlider("smoothing", VIEW_LABEL_SMOOTHING,
|
fSmoothingSlider = new SSlider("smoothing", VIEW_LABEL_SMOOTHING,
|
||||||
new BMessage(VIEW_MSG_SET_SMOOTHING), 0, 100);
|
new BMessage(VIEW_MSG_SET_SMOOTHING), 0, 100);
|
||||||
fSmoothingSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
fSmoothingSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
||||||
fSmoothingSlider->SetHashMarkCount(10);
|
fSmoothingSlider->SetHashMarkCount(10);
|
||||||
fSmoothingSlider->SetLimitLabels("None", "High");
|
fSmoothingSlider->SetLimitLabels(B_TRANSLATE("None"), B_TRANSLATE("High"));
|
||||||
fSmoothingSlider->SetValue(
|
fSmoothingSlider->SetValue(
|
||||||
fSettings->SetGetInt32(JPEG_SET_SMOOTHING, NULL));
|
fSettings->SetGetInt32(JPEG_SET_SMOOTHING, NULL));
|
||||||
|
|
||||||
|
@ -785,8 +788,8 @@ JPEGTranslator::DerivedTranslate(BPositionIO* inSource,
|
||||||
&longJumpBuffer);
|
&longJumpBuffer);
|
||||||
}
|
}
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
fprintf(stderr, "libjpeg encoutered a critical error "
|
fprintf(stderr, B_TRANSLATE("libjpeg encountered a critical error "
|
||||||
"(caught C++ exception).\n");
|
"(caught C++ exception).\n"));
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -939,7 +942,8 @@ JPEGTranslator::Compress(BPositionIO* in, BPositionIO* out,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Wrong type: Color space not implemented.\n");
|
fprintf(stderr,
|
||||||
|
B_TRANSLATE("Wrong type: Color space not implemented.\n"));
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
out_row_bytes = jpg_input_components * width;
|
out_row_bytes = jpg_input_components * width;
|
||||||
|
@ -1093,7 +1097,8 @@ JPEGTranslator::Decompress(BPositionIO* in, BPositionIO* out,
|
||||||
if (cinfo.out_color_space != JCS_RGB) {
|
if (cinfo.out_color_space != JCS_RGB) {
|
||||||
switch (cinfo.out_color_space) {
|
switch (cinfo.out_color_space) {
|
||||||
case JCS_UNKNOWN: /* error/unspecified */
|
case JCS_UNKNOWN: /* error/unspecified */
|
||||||
fprintf(stderr, "From Type: Jpeg uses unknown color type\n");
|
fprintf(stderr,
|
||||||
|
B_TRANSLATE("From Type: Jpeg uses unknown color type\n"));
|
||||||
break;
|
break;
|
||||||
case JCS_GRAYSCALE: /* monochrome */
|
case JCS_GRAYSCALE: /* monochrome */
|
||||||
// Check if user wants to read only as RGB32 or not
|
// Check if user wants to read only as RGB32 or not
|
||||||
|
@ -1125,7 +1130,9 @@ JPEGTranslator::Decompress(BPositionIO* in, BPositionIO* out,
|
||||||
converter = convert_from_CMYK_to_32;
|
converter = convert_from_CMYK_to_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "From Type: Jpeg uses hmm... i don't know really :(\n");
|
fprintf(stderr,
|
||||||
|
B_TRANSLATE("From Type: Jpeg uses hmm... i don't know "
|
||||||
|
"really :(\n"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,14 @@ Translator JPEGTranslator :
|
||||||
: true
|
: true
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DoCatalogs JPEGTranslator :
|
||||||
|
x-vnd.Haiku-JPEGTranslator
|
||||||
|
:
|
||||||
|
JPEGTranslator.cpp
|
||||||
|
exif_parser.cpp
|
||||||
|
be_jerror.cpp
|
||||||
|
;
|
||||||
|
|
||||||
Package haiku-translationkit-cvs :
|
Package haiku-translationkit-cvs :
|
||||||
JPEGTranslator :
|
JPEGTranslator :
|
||||||
boot home config add-ons Translators ;
|
boot home config add-ons Translators ;
|
||||||
|
|
|
@ -39,6 +39,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Be headers
|
// Be headers
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
// JPEG headers
|
// JPEG headers
|
||||||
|
@ -50,6 +51,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "JPEGTranslator.h"
|
#include "JPEGTranslator.h"
|
||||||
#include "TranslatorSettings.h"
|
#include "TranslatorSettings.h"
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "be_jerror"
|
||||||
|
|
||||||
// Since Translator doesn't use it's own error table, we can use error_mgr's
|
// Since Translator doesn't use it's own error table, we can use error_mgr's
|
||||||
// variables to store some usefull data.
|
// variables to store some usefull data.
|
||||||
|
@ -68,7 +71,7 @@ be_error_exit (j_common_ptr cinfo)
|
||||||
/* Create the message */
|
/* Create the message */
|
||||||
(*cinfo->err->format_message) (cinfo, buffer);
|
(*cinfo->err->format_message) (cinfo, buffer);
|
||||||
|
|
||||||
fprintf(stderr, "JPEG Library Error: %s\n", buffer);
|
fprintf(stderr, B_TRANSLATE("JPEG Library Error: %s\n"), buffer);
|
||||||
|
|
||||||
jmp_buf longJumpBuffer;
|
jmp_buf longJumpBuffer;
|
||||||
memcpy(&longJumpBuffer, &(cinfo->err->long_jump_buffer), sizeof(jmp_buf));
|
memcpy(&longJumpBuffer, &(cinfo->err->long_jump_buffer), sizeof(jmp_buf));
|
||||||
|
@ -97,7 +100,7 @@ be_output_message (j_common_ptr cinfo)
|
||||||
/* If it's compressing or decompressing and user turned messages on */
|
/* If it's compressing or decompressing and user turned messages on */
|
||||||
if (!cinfo->is_decompressor || cinfo->err->ShowReadWarnings) {
|
if (!cinfo->is_decompressor || cinfo->err->ShowReadWarnings) {
|
||||||
/* show warning message */
|
/* show warning message */
|
||||||
fprintf(stderr, "JPEG Library Warning: %s\n", buffer);
|
fprintf(stderr, B_TRANSLATE("JPEG Library Warning: %s\n"), buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,15 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
|
|
||||||
#include <ReadHelper.h>
|
#include <ReadHelper.h>
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "exit_parser"
|
||||||
|
|
||||||
|
|
||||||
using std::set;
|
using std::set;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -29,11 +34,11 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const convert_tag kDefaultTags[] = {
|
static const convert_tag kDefaultTags[] = {
|
||||||
{TAG_MAKER, B_ANY_TYPE, "Maker"},
|
{TAG_MAKER, B_ANY_TYPE, B_TRANSLATE_MARK("Maker")},
|
||||||
{TAG_MODEL, B_ANY_TYPE, "Model"},
|
{TAG_MODEL, B_ANY_TYPE, B_TRANSLATE_MARK("Model")},
|
||||||
{TAG_ORIENTATION, B_INT32_TYPE, "Orientation"},
|
{TAG_ORIENTATION, B_INT32_TYPE, B_TRANSLATE_MARK("Orientation")},
|
||||||
{TAG_EXPOSURE_TIME, B_DOUBLE_TYPE, "ExposureTime"},
|
{TAG_EXPOSURE_TIME, B_DOUBLE_TYPE, B_TRANSLATE_MARK("ExposureTime")},
|
||||||
{TAG_ISO, B_INT32_TYPE, "ISO"},
|
{TAG_ISO, B_INT32_TYPE, B_TRANSLATE_MARK("ISO")},
|
||||||
};
|
};
|
||||||
static const size_t kNumDefaultTags = sizeof(kDefaultTags)
|
static const size_t kNumDefaultTags = sizeof(kDefaultTags)
|
||||||
/ sizeof(kDefaultTags[0]);
|
/ sizeof(kDefaultTags[0]);
|
||||||
|
|
Loading…
Reference in New Issue