Applied patchs from Karvjorm (tickets #7125, #7131, #7126, #7129): Localizations for PNG PCX HVIF and HPGS translators.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40262 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
500bb6305c
commit
8dca2efd62
@ -8,15 +8,19 @@
|
|||||||
#include "ConfigView.h"
|
#include "ConfigView.h"
|
||||||
#include "HPGSTranslator.h"
|
#include "HPGSTranslator.h"
|
||||||
|
|
||||||
#include <StringView.h>
|
#include <Catalog.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
|
#include <StringView.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "ConfigView"
|
||||||
|
|
||||||
|
|
||||||
ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
|
ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
|
||||||
: BView(frame, "HPGSTranslator Settings", resize, flags)
|
: BView(frame, B_TRANSLATE("HPGSTranslator Settings"), resize, flags)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
@ -25,14 +29,15 @@ ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
|
|||||||
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", "HPGS images");
|
BStringView *stringView = new BStringView(rect, "title",
|
||||||
|
B_TRANSLATE("HPGS images"));
|
||||||
stringView->SetFont(be_bold_font);
|
stringView->SetFont(be_bold_font);
|
||||||
stringView->ResizeToPreferred();
|
stringView->ResizeToPreferred();
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 10);
|
rect.OffsetBy(0, height + 10);
|
||||||
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(HPGS_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MAJOR_VERSION(HPGS_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_MINOR_VERSION(HPGS_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MINOR_VERSION(HPGS_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_REVISION_VERSION(HPGS_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_REVISION_VERSION(HPGS_TRANSLATOR_VERSION)),
|
||||||
@ -45,17 +50,20 @@ ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
|
|||||||
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 "2007 Haiku Inc.");
|
stringView = new BStringView(rect, "copyright", B_UTF8_COPYRIGHT
|
||||||
|
"2007 Haiku Inc.");
|
||||||
stringView->ResizeToPreferred();
|
stringView->ResizeToPreferred();
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 10);
|
rect.OffsetBy(0, height + 10);
|
||||||
stringView = new BStringView(rect, "copyright2", "Based on HPGS (http://hpgs.berlios.de)");
|
stringView = new BStringView(rect, "copyright2", B_TRANSLATE("Based on "
|
||||||
|
"HPGS (http://hpgs.berlios.de)"));
|
||||||
stringView->ResizeToPreferred();
|
stringView->ResizeToPreferred();
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 5);
|
rect.OffsetBy(0, height + 5);
|
||||||
stringView = new BStringView(rect, "copyright3", B_UTF8_COPYRIGHT "2004-2006 ev-i Informationstechnologie GmbH");
|
stringView = new BStringView(rect, "copyright3", B_UTF8_COPYRIGHT
|
||||||
|
"2004-2006 ev-i Informationstechnologie GmbH");
|
||||||
stringView->ResizeToPreferred();
|
stringView->ResizeToPreferred();
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "hpgsimage.h"
|
#include "hpgsimage.h"
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
#include <TranslatorRoster.h>
|
#include <TranslatorRoster.h>
|
||||||
|
|
||||||
@ -17,6 +18,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "HPGSTranslator"
|
||||||
|
|
||||||
|
|
||||||
typedef struct my_hpgs_png_image_st {
|
typedef struct my_hpgs_png_image_st {
|
||||||
hpgs_png_image image;
|
hpgs_png_image image;
|
||||||
BPositionIO *target;
|
BPositionIO *target;
|
||||||
@ -80,7 +85,8 @@ const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting
|
|||||||
|
|
||||||
|
|
||||||
HPGSTranslator::HPGSTranslator()
|
HPGSTranslator::HPGSTranslator()
|
||||||
: BaseTranslator("HPGS images", "HPGS image translator",
|
: BaseTranslator(B_TRANSLATE("HPGS images"),
|
||||||
|
B_TRANSLATE("HPGS image translator"),
|
||||||
HPGS_TRANSLATOR_VERSION,
|
HPGS_TRANSLATOR_VERSION,
|
||||||
sInputFormats, kNumInputFormats,
|
sInputFormats, kNumInputFormats,
|
||||||
sOutputFormats, kNumOutputFormats,
|
sOutputFormats, kNumOutputFormats,
|
||||||
@ -115,14 +121,16 @@ HPGSTranslator::DerivedIdentify(BPositionIO *stream,
|
|||||||
hpgs_bool multipage = HPGS_FALSE;
|
hpgs_bool multipage = HPGS_FALSE;
|
||||||
hpgs_bool ignore_ps = HPGS_FALSE;
|
hpgs_bool ignore_ps = HPGS_FALSE;
|
||||||
hpgs_bool do_linewidth = HPGS_TRUE;
|
hpgs_bool do_linewidth = HPGS_TRUE;
|
||||||
hpgs_device *size_dev = (hpgs_device *)hpgs_new_plotsize_device(ignore_ps, do_linewidth);
|
hpgs_device *size_dev = (hpgs_device *)hpgs_new_plotsize_device(ignore_ps,
|
||||||
hpgs_reader *reader = hpgs_new_reader(istream, size_dev, multipage, verbosity);
|
do_linewidth);
|
||||||
|
hpgs_reader *reader = hpgs_new_reader(istream, size_dev, multipage,
|
||||||
|
verbosity);
|
||||||
if (hpgs_read(reader, HPGS_FALSE) == B_OK) {
|
if (hpgs_read(reader, HPGS_FALSE) == B_OK) {
|
||||||
info->type = HPGS_IMAGE_FORMAT;
|
info->type = HPGS_IMAGE_FORMAT;
|
||||||
info->group = B_TRANSLATOR_BITMAP;
|
info->group = B_TRANSLATOR_BITMAP;
|
||||||
info->quality = HPGS_IN_QUALITY;
|
info->quality = HPGS_IN_QUALITY;
|
||||||
info->capability = HPGS_IN_CAPABILITY;
|
info->capability = HPGS_IN_CAPABILITY;
|
||||||
snprintf(info->name, sizeof(info->name), "HPGS image");
|
snprintf(info->name, sizeof(info->name), B_TRANSLATE("HPGS image"));
|
||||||
strcpy(info->MIME, "vector/x-hpgl2");
|
strcpy(info->MIME, "vector/x-hpgl2");
|
||||||
} else
|
} else
|
||||||
err = B_NO_TRANSLATOR;
|
err = B_NO_TRANSLATOR;
|
||||||
@ -175,13 +183,13 @@ HPGSTranslator::DerivedTranslate(BPositionIO* source,
|
|||||||
size_dev = (hpgs_device *)hpgs_new_plotsize_device(ignore_ps, do_linewidth);
|
size_dev = (hpgs_device *)hpgs_new_plotsize_device(ignore_ps, do_linewidth);
|
||||||
hpgs_reader *reader = hpgs_new_reader(istream, size_dev, multipage, verbosity);
|
hpgs_reader *reader = hpgs_new_reader(istream, size_dev, multipage, verbosity);
|
||||||
if (hpgs_read(reader, HPGS_FALSE)) {
|
if (hpgs_read(reader, HPGS_FALSE)) {
|
||||||
fprintf(stderr, "no hpgs\n");
|
fprintf(stderr, B_TRANSLATE("no hpgs\n"));
|
||||||
err = B_NO_TRANSLATOR;
|
err = B_NO_TRANSLATOR;
|
||||||
goto err1;
|
goto err1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hpgs_getplotsize(size_dev,1,&bbox)<0) {
|
if (hpgs_getplotsize(size_dev,1,&bbox)<0) {
|
||||||
fprintf(stderr, "no hpgs\n");
|
fprintf(stderr, B_TRANSLATE("no hpgs\n"));
|
||||||
err = B_NO_TRANSLATOR;
|
err = B_NO_TRANSLATOR;
|
||||||
goto err1;
|
goto err1;
|
||||||
}
|
}
|
||||||
@ -208,8 +216,8 @@ HPGSTranslator::DerivedTranslate(BPositionIO* source,
|
|||||||
|
|
||||||
plot_dev = (hpgs_device *)pdv;
|
plot_dev = (hpgs_device *)pdv;
|
||||||
if (hpgs_reader_imbue(reader, plot_dev)) {
|
if (hpgs_reader_imbue(reader, plot_dev)) {
|
||||||
fprintf(stderr, hpgs_i18n("Error: Cannot imbue plot device to reader: %s\n"),
|
fprintf(stderr, hpgs_i18n(B_TRANSLATE("Error: Cannot imbue plot "
|
||||||
hpgs_get_error());
|
"device to reader: %s\n")), hpgs_get_error());
|
||||||
err = B_NO_TRANSLATOR;
|
err = B_NO_TRANSLATOR;
|
||||||
goto err2;
|
goto err2;
|
||||||
}
|
}
|
||||||
@ -227,7 +235,8 @@ HPGSTranslator::DerivedTranslate(BPositionIO* source,
|
|||||||
B_SWAP_HOST_TO_BENDIAN);
|
B_SWAP_HOST_TO_BENDIAN);
|
||||||
bytesWritten = target->Write(&header, sizeof(TranslatorBitmap));
|
bytesWritten = target->Write(&header, sizeof(TranslatorBitmap));
|
||||||
if (bytesWritten < B_OK) {
|
if (bytesWritten < B_OK) {
|
||||||
fprintf(stderr, "Write error %s\n", strerror(bytesWritten));
|
fprintf(stderr, B_TRANSLATE("Write error %s\n"),
|
||||||
|
strerror(bytesWritten));
|
||||||
err = bytesWritten;
|
err = bytesWritten;
|
||||||
goto err2;
|
goto err2;
|
||||||
}
|
}
|
||||||
@ -238,7 +247,8 @@ HPGSTranslator::DerivedTranslate(BPositionIO* source,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (err == B_OK && hpgs_read(reader, HPGS_FALSE)) {
|
if (err == B_OK && hpgs_read(reader, HPGS_FALSE)) {
|
||||||
fprintf(stderr, hpgs_i18n("Error: Cannot process plot data %s\n"), hpgs_get_error());
|
fprintf(stderr, hpgs_i18n(B_TRANSLATE("Error: Cannot process plot "
|
||||||
|
"data %s\n")), hpgs_get_error());
|
||||||
err = B_NO_TRANSLATOR;
|
err = B_NO_TRANSLATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,4 +49,11 @@ Translator HPGSTranslator :
|
|||||||
: true
|
: true
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DoCatalogs HPGSTranslator :
|
||||||
|
x-vnd.Haiku-HPGSTranslator
|
||||||
|
:
|
||||||
|
ConfigView.cpp
|
||||||
|
HPGSTranslator.cpp
|
||||||
|
;
|
||||||
|
|
||||||
SEARCH on [ FGristFiles $(sources) ] = [ FDirName $(SUBDIR) lib ] ;
|
SEARCH on [ FGristFiles $(sources) ] = [ FDirName $(SUBDIR) lib ] ;
|
||||||
|
@ -90,7 +90,7 @@ positionio_read(void *ptr, size_t size, size_t nmemb, my_hpgs_istream *stream)
|
|||||||
unsigned char *iptr = (unsigned char *)ptr;
|
unsigned char *iptr = (unsigned char *)ptr;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (; i < nmemb; i++) {
|
for (; i < nmemb; i++) {
|
||||||
if (size != stream->buffer->Read(iptr, size))
|
if (size != (size_t)stream->buffer->Read(iptr, size))
|
||||||
break;
|
break;
|
||||||
iptr += size;
|
iptr += size;
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include "HVIFTranslator.h"
|
#include "HVIFTranslator.h"
|
||||||
#include "TranslatorWindow.h"
|
#include "TranslatorWindow.h"
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "HVIFMain"
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
BApplication application("application/x-vnd.Haiku.HVIFTranslator");
|
BApplication application("application/x-vnd.Haiku.HVIFTranslator");
|
||||||
if (LaunchTranslatorWindow(new HVIFTranslator, "HVIF Settings",
|
if (LaunchTranslatorWindow(new HVIFTranslator,
|
||||||
BRect(0, 0, 250, 150)) != B_OK)
|
B_TRANSLATE("HVIF Settings"), BRect(0, 0, 250, 150)) != B_OK)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
application.Run();
|
application.Run();
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <BitmapStream.h>
|
#include <BitmapStream.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <IconUtils.h>
|
#include <IconUtils.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -21,6 +22,10 @@
|
|||||||
#define HVIF_TRANSLATION_QUALITY 1.0
|
#define HVIF_TRANSLATION_QUALITY 1.0
|
||||||
#define HVIF_TRANSLATION_CAPABILITY 1.0
|
#define HVIF_TRANSLATION_CAPABILITY 1.0
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "HVIFTranslator"
|
||||||
|
|
||||||
|
|
||||||
static const translation_format sInputFormats[] = {
|
static const translation_format sInputFormats[] = {
|
||||||
{
|
{
|
||||||
HVIF_FORMAT_CODE,
|
HVIF_FORMAT_CODE,
|
||||||
@ -65,7 +70,8 @@ make_nth_translator(int32 n, image_id image, uint32 flags, ...)
|
|||||||
|
|
||||||
|
|
||||||
HVIFTranslator::HVIFTranslator()
|
HVIFTranslator::HVIFTranslator()
|
||||||
: BaseTranslator("HVIF icons", "Native Haiku vector icon translator",
|
: BaseTranslator(B_TRANSLATE("HVIF icons"),
|
||||||
|
B_TRANSLATE("Native Haiku vector icon translator"),
|
||||||
HVIF_TRANSLATOR_VERSION,
|
HVIF_TRANSLATOR_VERSION,
|
||||||
sInputFormats, kNumInputFormats,
|
sInputFormats, kNumInputFormats,
|
||||||
sOutputFormats, kNumOutputFormats,
|
sOutputFormats, kNumOutputFormats,
|
||||||
@ -174,5 +180,6 @@ HVIFTranslator::DerivedTranslate(BPositionIO *inSource,
|
|||||||
BView *
|
BView *
|
||||||
HVIFTranslator::NewConfigView(TranslatorSettings *settings)
|
HVIFTranslator::NewConfigView(TranslatorSettings *settings)
|
||||||
{
|
{
|
||||||
return new HVIFView("HVIFTranslator Settings", B_WILL_DRAW, settings);
|
return new HVIFView(B_TRANSLATE("HVIFTranslator Settings"),
|
||||||
|
B_WILL_DRAW, settings);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "HVIFView.h"
|
#include "HVIFView.h"
|
||||||
#include "HVIFTranslator.h"
|
#include "HVIFTranslator.h"
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <GroupLayoutBuilder.h>
|
#include <GroupLayoutBuilder.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
@ -17,6 +18,9 @@
|
|||||||
|
|
||||||
#define HVIF_SETTING_RENDER_SIZE_CHANGED 'rsch'
|
#define HVIF_SETTING_RENDER_SIZE_CHANGED 'rsch'
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "HVIFView"
|
||||||
|
|
||||||
|
|
||||||
HVIFView::HVIFView(const char* name, uint32 flags, TranslatorSettings *settings)
|
HVIFView::HVIFView(const char* name, uint32 flags, TranslatorSettings *settings)
|
||||||
:
|
:
|
||||||
@ -26,12 +30,13 @@ HVIFView::HVIFView(const char* name, uint32 flags, TranslatorSettings *settings)
|
|||||||
BAlignment labelAlignment(B_ALIGN_LEFT, B_ALIGN_NO_VERTICAL);
|
BAlignment labelAlignment(B_ALIGN_LEFT, B_ALIGN_NO_VERTICAL);
|
||||||
|
|
||||||
BStringView* title= new BStringView("title",
|
BStringView* title= new BStringView("title",
|
||||||
"Native Haiku icon format translator");
|
B_TRANSLATE("Native Haiku icon format translator"));
|
||||||
title->SetFont(be_bold_font);
|
title->SetFont(be_bold_font);
|
||||||
title->SetExplicitAlignment(labelAlignment);
|
title->SetExplicitAlignment(labelAlignment);
|
||||||
|
|
||||||
char versionString[256];
|
char versionString[256];
|
||||||
snprintf(versionString, sizeof(versionString), "Version %d.%d.%d, %s",
|
snprintf(versionString, sizeof(versionString),
|
||||||
|
B_TRANSLATE("Version %d.%d.%d, %s"),
|
||||||
int(B_TRANSLATION_MAJOR_VERSION(HVIF_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MAJOR_VERSION(HVIF_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_MINOR_VERSION(HVIF_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MINOR_VERSION(HVIF_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_REVISION_VERSION(HVIF_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_REVISION_VERSION(HVIF_TRANSLATOR_VERSION)),
|
||||||
@ -45,8 +50,8 @@ HVIFView::HVIFView(const char* name, uint32 flags, TranslatorSettings *settings)
|
|||||||
|
|
||||||
|
|
||||||
int32 renderSize = fSettings->SetGetInt32(HVIF_SETTING_RENDER_SIZE);
|
int32 renderSize = fSettings->SetGetInt32(HVIF_SETTING_RENDER_SIZE);
|
||||||
BString label = "Render size: ";
|
BString label = B_TRANSLATE("Render size:");
|
||||||
label << renderSize;
|
label << " " << renderSize;
|
||||||
|
|
||||||
fRenderSize = new BSlider("renderSize", label.String(),
|
fRenderSize = new BSlider("renderSize", label.String(),
|
||||||
NULL, 1, 32, B_HORIZONTAL);
|
NULL, 1, 32, B_HORIZONTAL);
|
||||||
@ -101,8 +106,8 @@ HVIFView::MessageReceived(BMessage *message)
|
|||||||
fSettings->SetGetInt32(HVIF_SETTING_RENDER_SIZE, &value);
|
fSettings->SetGetInt32(HVIF_SETTING_RENDER_SIZE, &value);
|
||||||
fSettings->SaveSettings();
|
fSettings->SaveSettings();
|
||||||
|
|
||||||
BString newLabel = "Render size: ";
|
BString newLabel = B_TRANSLATE("Render size:");
|
||||||
newLabel << value;
|
newLabel << " " << value;
|
||||||
fRenderSize->SetLabel(newLabel.String());
|
fRenderSize->SetLabel(newLabel.String());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,15 @@ Translator HVIFTranslator :
|
|||||||
HVIFTranslator.cpp
|
HVIFTranslator.cpp
|
||||||
HVIFView.cpp
|
HVIFView.cpp
|
||||||
: be translation libtranslatorsutils.a $(TARGET_LIBSUPC++)
|
: be translation libtranslatorsutils.a $(TARGET_LIBSUPC++)
|
||||||
|
$(HAIKU_LOCALE_LIBS)
|
||||||
$(HAIKU_LOCALE_LIBS)
|
$(HAIKU_LOCALE_LIBS)
|
||||||
: true
|
: true
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DoCatalogs HVIFTranslator :
|
||||||
|
x-vnd.Haiku-HVIFTranslator
|
||||||
|
:
|
||||||
|
HVIFMain.cpp
|
||||||
|
HVIFTranslator.cpp
|
||||||
|
HVIFView.cpp
|
||||||
|
;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "ConfigView.h"
|
#include "ConfigView.h"
|
||||||
#include "PCXTranslator.h"
|
#include "PCXTranslator.h"
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
|
|
||||||
@ -15,8 +16,12 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "ConfigView"
|
||||||
|
|
||||||
|
|
||||||
ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
|
ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
|
||||||
: BView(frame, "PCXTranslator Settings", resize, flags)
|
: BView(frame, B_TRANSLATE("PCXTranslator Settings"), resize, flags)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
@ -25,14 +30,15 @@ ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
|
|||||||
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", "PCX images");
|
BStringView *stringView = new BStringView(rect, "title",
|
||||||
|
B_TRANSLATE("PCX images"));
|
||||||
stringView->SetFont(be_bold_font);
|
stringView->SetFont(be_bold_font);
|
||||||
stringView->ResizeToPreferred();
|
stringView->ResizeToPreferred();
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 10);
|
rect.OffsetBy(0, height + 10);
|
||||||
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(PCX_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MAJOR_VERSION(PCX_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_MINOR_VERSION(PCX_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MINOR_VERSION(PCX_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_REVISION_VERSION(PCX_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_REVISION_VERSION(PCX_TRANSLATOR_VERSION)),
|
||||||
|
@ -10,11 +10,18 @@ Translator PCXTranslator :
|
|||||||
PCXTranslator.cpp
|
PCXTranslator.cpp
|
||||||
ConfigView.cpp
|
ConfigView.cpp
|
||||||
PCX.cpp
|
PCX.cpp
|
||||||
: be translation libtranslatorsutils.a $(TARGET_LIBSUPC++)
|
: be translation libtranslatorsutils.a $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
|
||||||
$(HAIKU_LOCALE_LIBS)
|
|
||||||
: true
|
: true
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DoCatalogs PCXTranslator :
|
||||||
|
x-vnd.Haiku-PCXTranslator
|
||||||
|
:
|
||||||
|
main.cpp
|
||||||
|
ConfigView.cpp
|
||||||
|
PCXTranslator.cpp
|
||||||
|
;
|
||||||
|
|
||||||
Package haiku-translationkit-cvs :
|
Package haiku-translationkit-cvs :
|
||||||
PCXTranslator
|
PCXTranslator
|
||||||
: boot home config add-ons Translators
|
: boot home config add-ons Translators
|
||||||
|
@ -9,10 +9,13 @@
|
|||||||
#include "ConfigView.h"
|
#include "ConfigView.h"
|
||||||
#include "PCX.h"
|
#include "PCX.h"
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "PCXTranslator"
|
||||||
|
|
||||||
#define kPCXMimeType "image/x-pcx"
|
#define kPCXMimeType "image/x-pcx"
|
||||||
|
|
||||||
@ -69,7 +72,7 @@ const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting
|
|||||||
|
|
||||||
|
|
||||||
PCXTranslator::PCXTranslator()
|
PCXTranslator::PCXTranslator()
|
||||||
: BaseTranslator("PCX images", "PCX translator",
|
: BaseTranslator(B_TRANSLATE("PCX images"), B_TRANSLATE("PCX translator"),
|
||||||
PCX_TRANSLATOR_VERSION,
|
PCX_TRANSLATOR_VERSION,
|
||||||
sInputFormats, kNumInputFormats,
|
sInputFormats, kNumInputFormats,
|
||||||
sOutputFormats, kNumOutputFormats,
|
sOutputFormats, kNumOutputFormats,
|
||||||
@ -104,7 +107,7 @@ PCXTranslator::DerivedIdentify(BPositionIO *stream,
|
|||||||
info->group = B_TRANSLATOR_BITMAP;
|
info->group = B_TRANSLATOR_BITMAP;
|
||||||
info->quality = PCX_IN_QUALITY;
|
info->quality = PCX_IN_QUALITY;
|
||||||
info->capability = PCX_IN_CAPABILITY;
|
info->capability = PCX_IN_CAPABILITY;
|
||||||
snprintf(info->name, sizeof(info->name), "PCX %lu bit image",
|
snprintf(info->name, sizeof(info->name), B_TRANSLATE("PCX %lu bit image"),
|
||||||
bitsPerPixel);
|
bitsPerPixel);
|
||||||
strcpy(info->MIME, kPCXMimeType);
|
strcpy(info->MIME, kPCXMimeType);
|
||||||
|
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
|
|
||||||
#include "TranslatorWindow.h"
|
#include "TranslatorWindow.h"
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "main"
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -18,7 +23,8 @@ main(int /*argc*/, char **/*argv*/)
|
|||||||
BApplication app("application/x-vnd.Haiku-PCXTranslator");
|
BApplication app("application/x-vnd.Haiku-PCXTranslator");
|
||||||
|
|
||||||
status_t result;
|
status_t result;
|
||||||
result = LaunchTranslatorWindow(new PCXTranslator, "PCX Settings", BRect(0, 0, 225, 175));
|
result = LaunchTranslatorWindow(new PCXTranslator,
|
||||||
|
B_TRANSLATE("PCX Settings"), BRect(0, 0, 225, 175));
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -14,11 +14,18 @@ Translator PNGTranslator :
|
|||||||
PNGTranslator.cpp
|
PNGTranslator.cpp
|
||||||
PNGView.cpp
|
PNGView.cpp
|
||||||
|
|
||||||
: be translation libpng.a z libtranslatorsutils.a $(TARGET_LIBSUPC++)
|
: be translation libpng.so z libtranslatorsutils.a $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
|
||||||
$(HAIKU_LOCALE_LIBS)
|
|
||||||
: true
|
: true
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DoCatalogs PNGTranslator :
|
||||||
|
x-vnd.Haiku-PNGTranslator
|
||||||
|
:
|
||||||
|
PNGMain.cpp
|
||||||
|
PNGTranslator.cpp
|
||||||
|
PNGView.cpp
|
||||||
|
;
|
||||||
|
|
||||||
Package haiku-translationkit-cvs :
|
Package haiku-translationkit-cvs :
|
||||||
PNGTranslator :
|
PNGTranslator :
|
||||||
boot home config add-ons Translators ;
|
boot home config add-ons Translators ;
|
||||||
|
@ -33,10 +33,14 @@
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include "PNGTranslator.h"
|
#include "PNGTranslator.h"
|
||||||
#include "PNGView.h"
|
#include "PNGView.h"
|
||||||
#include "TranslatorWindow.h"
|
#include "TranslatorWindow.h"
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "PNGTranslator"
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// main
|
// main
|
||||||
//
|
//
|
||||||
@ -56,7 +60,8 @@ main()
|
|||||||
BApplication app("application/x-vnd.Haiku-PNGTranslator");
|
BApplication app("application/x-vnd.Haiku-PNGTranslator");
|
||||||
status_t result;
|
status_t result;
|
||||||
result = LaunchTranslatorWindow(new PNGTranslator,
|
result = LaunchTranslatorWindow(new PNGTranslator,
|
||||||
"PNG Settings", BRect(0, 0, PNG_VIEW_WIDTH, PNG_VIEW_HEIGHT));
|
B_TRANSLATE("PNG Settings"), BRect(0, 0, PNG_VIEW_WIDTH,
|
||||||
|
PNG_VIEW_HEIGHT));
|
||||||
if (result == B_OK) {
|
if (result == B_OK) {
|
||||||
app.Run();
|
app.Run();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -30,14 +30,22 @@
|
|||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include "PNGTranslator.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#define PNG_NO_PEDANTIC_WARNINGS
|
#define PNG_NO_PEDANTIC_WARNINGS
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
#include "PNGTranslator.h"
|
|
||||||
#include "PNGView.h"
|
#include "PNGView.h"
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "PNGTranslator"
|
||||||
|
|
||||||
// The input formats that this translator supports.
|
// The input formats that this translator supports.
|
||||||
static const translation_format sInputFormats[] = {
|
static const translation_format sInputFormats[] = {
|
||||||
{
|
{
|
||||||
@ -185,7 +193,8 @@ pngcb_flush_data(png_structp ppng)
|
|||||||
// Returns:
|
// Returns:
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
PNGTranslator::PNGTranslator()
|
PNGTranslator::PNGTranslator()
|
||||||
: BaseTranslator("PNG images", "PNG image translator",
|
: BaseTranslator(B_TRANSLATE("PNG images"),
|
||||||
|
B_TRANSLATE("PNG image translator"),
|
||||||
PNG_TRANSLATOR_VERSION,
|
PNG_TRANSLATOR_VERSION,
|
||||||
sInputFormats, kNumInputFormats,
|
sInputFormats, kNumInputFormats,
|
||||||
sOutputFormats, kNumOutputFormats,
|
sOutputFormats, kNumOutputFormats,
|
||||||
@ -229,7 +238,7 @@ identify_png_header(BPositionIO *inSource, translator_info *outInfo)
|
|||||||
outInfo->quality = PNG_IN_QUALITY;
|
outInfo->quality = PNG_IN_QUALITY;
|
||||||
outInfo->capability = PNG_IN_CAPABILITY;
|
outInfo->capability = PNG_IN_CAPABILITY;
|
||||||
strcpy(outInfo->MIME, "image/png");
|
strcpy(outInfo->MIME, "image/png");
|
||||||
strcpy(outInfo->name, "PNG image");
|
strcpy(outInfo->name, B_TRANSLATE("PNG image"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@ -975,6 +984,7 @@ BView *
|
|||||||
PNGTranslator::NewConfigView(TranslatorSettings *settings)
|
PNGTranslator::NewConfigView(TranslatorSettings *settings)
|
||||||
{
|
{
|
||||||
return new PNGView(BRect(0, 0, PNG_VIEW_WIDTH, PNG_VIEW_HEIGHT),
|
return new PNGView(BRect(0, 0, PNG_VIEW_WIDTH, PNG_VIEW_HEIGHT),
|
||||||
"PNGTranslator Settings", B_FOLLOW_ALL, B_WILL_DRAW, settings);
|
B_TRANSLATE("PNGTranslator Settings"), B_FOLLOW_ALL,
|
||||||
|
B_WILL_DRAW, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "PNGTranslator.h"
|
#include "PNGTranslator.h"
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <PopUpMenu.h>
|
#include <PopUpMenu.h>
|
||||||
@ -22,6 +23,8 @@
|
|||||||
#define PNG_NO_PEDANTIC_WARNINGS
|
#define PNG_NO_PEDANTIC_WARNINGS
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "PNGTranslator"
|
||||||
|
|
||||||
PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode,
|
PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode,
|
||||||
uint32 flags, TranslatorSettings *settings)
|
uint32 flags, TranslatorSettings *settings)
|
||||||
@ -35,7 +38,8 @@ PNGView::PNGView(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", "PNG image translator");
|
BStringView *stringView = new BStringView(rect, "title",
|
||||||
|
B_TRANSLATE("PNG image translator"));
|
||||||
stringView->SetFont(be_bold_font);
|
stringView->SetFont(be_bold_font);
|
||||||
stringView->ResizeToPreferred();
|
stringView->ResizeToPreferred();
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
@ -44,7 +48,7 @@ PNGView::PNGView(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(PNG_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MAJOR_VERSION(PNG_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_MINOR_VERSION(PNG_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MINOR_VERSION(PNG_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_REVISION_VERSION(PNG_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_REVISION_VERSION(PNG_TRANSLATOR_VERSION)),
|
||||||
@ -60,14 +64,16 @@ PNGView::PNGView(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 "2003-2006 Haiku Inc.");
|
stringView = new BStringView(rect,
|
||||||
|
"Copyright", B_UTF8_COPYRIGHT "2003-2006 Haiku Inc.");
|
||||||
stringView->ResizeToPreferred();
|
stringView->ResizeToPreferred();
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
|
||||||
// setup PNG interlace options
|
// setup PNG interlace options
|
||||||
|
|
||||||
fInterlaceMenu = new BPopUpMenu("Interlace Option");
|
fInterlaceMenu = new BPopUpMenu(B_TRANSLATE("Interlace Option"));
|
||||||
BMenuItem* item = new BMenuItem("None", _InterlaceMessage(PNG_INTERLACE_NONE));
|
BMenuItem* item = new BMenuItem(B_TRANSLATE("None"),
|
||||||
|
_InterlaceMessage(PNG_INTERLACE_NONE));
|
||||||
if (fSettings->SetGetInt32(PNG_SETTING_INTERLACE) == PNG_INTERLACE_NONE)
|
if (fSettings->SetGetInt32(PNG_SETTING_INTERLACE) == PNG_INTERLACE_NONE)
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
fInterlaceMenu->AddItem(item);
|
fInterlaceMenu->AddItem(item);
|
||||||
@ -78,8 +84,9 @@ PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode,
|
|||||||
fInterlaceMenu->AddItem(item);
|
fInterlaceMenu->AddItem(item);
|
||||||
|
|
||||||
rect.OffsetBy(0, stringView->Frame().Height() + 20.0f);
|
rect.OffsetBy(0, stringView->Frame().Height() + 20.0f);
|
||||||
BMenuField* menuField = new BMenuField(rect, "PNG Interlace Menu",
|
BMenuField* menuField = new BMenuField(rect,
|
||||||
"Interlacing type:", fInterlaceMenu);
|
B_TRANSLATE("PNG Interlace Menu"),
|
||||||
|
B_TRANSLATE("Interlacing type:"), fInterlaceMenu);
|
||||||
menuField->SetDivider(menuField->StringWidth(menuField->Label()) + 7.0f);
|
menuField->SetDivider(menuField->StringWidth(menuField->Label()) + 7.0f);
|
||||||
menuField->ResizeToPreferred();
|
menuField->ResizeToPreferred();
|
||||||
AddChild(menuField);
|
AddChild(menuField);
|
||||||
@ -87,7 +94,8 @@ PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode,
|
|||||||
rect.OffsetBy(0, height + 15);
|
rect.OffsetBy(0, height + 15);
|
||||||
rect.right = Bounds().right;
|
rect.right = Bounds().right;
|
||||||
rect.bottom = Bounds().bottom;
|
rect.bottom = Bounds().bottom;
|
||||||
fCopyrightView = new BTextView(rect, "PNG copyright", rect.OffsetToCopy(B_ORIGIN),
|
fCopyrightView = new BTextView(rect, "PNG copyright",
|
||||||
|
rect.OffsetToCopy(B_ORIGIN),
|
||||||
B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS);
|
B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS);
|
||||||
fCopyrightView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
fCopyrightView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
fCopyrightView->SetLowColor(fCopyrightView->ViewColor());
|
fCopyrightView->SetLowColor(fCopyrightView->ViewColor());
|
||||||
@ -101,7 +109,8 @@ PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode,
|
|||||||
|
|
||||||
if (maxWidth + 20 > Bounds().Width())
|
if (maxWidth + 20 > Bounds().Width())
|
||||||
ResizeTo(maxWidth + 20, Bounds().Height());
|
ResizeTo(maxWidth + 20, Bounds().Height());
|
||||||
if (Bounds().Height() < rect.top + stringView->Bounds().Height() * 3.0f + 8.0f)
|
if (Bounds().Height() < rect.top + stringView->Bounds().Height()
|
||||||
|
* 3.0f + 8.0f)
|
||||||
ResizeTo(Bounds().Width(), rect.top + height * 3.0f + 8.0f);
|
ResizeTo(Bounds().Width(), rect.top + height * 3.0f + 8.0f);
|
||||||
|
|
||||||
fCopyrightView->SetTextRect(fCopyrightView->Bounds());
|
fCopyrightView->SetTextRect(fCopyrightView->Bounds());
|
||||||
|
Loading…
Reference in New Issue
Block a user