DataTranslations: use layout, standard format.
* Fix webP, ppm, sgi, tiff, wonderbrush. * Partialy fixes #11999.
This commit is contained in:
@@ -452,88 +452,86 @@ public:
|
|||||||
BView(name, flags)
|
BView(name, flags)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
SetLowColor(ViewColor());
|
|
||||||
|
|
||||||
mTitle = new BStringView("title",
|
fTitle = new BStringView("title",
|
||||||
B_TRANSLATE("PPM image translator"));
|
B_TRANSLATE("PPM image translator"));
|
||||||
mTitle->SetFont(be_bold_font);
|
fTitle->SetFont(be_bold_font);
|
||||||
|
|
||||||
char detail[100];
|
char detail[100];
|
||||||
int ver = static_cast<int>(translatorVersion);
|
int ver = static_cast<int>(translatorVersion);
|
||||||
sprintf(detail, B_TRANSLATE("Version %d.%d.%d %s"), ver >> 8,
|
sprintf(detail, B_TRANSLATE("Version %d.%d.%d, %s"), ver >> 8,
|
||||||
((ver >> 4) & 0xf),
|
((ver >> 4) & 0xf),
|
||||||
(ver & 0xf), __DATE__);
|
(ver & 0xf), __DATE__);
|
||||||
mDetail = new BStringView("detail", detail);
|
fDetail = new BStringView("detail", detail);
|
||||||
|
|
||||||
mBasedOn = new BStringView("basedOn",
|
fBasedOn = new BStringView("basedOn",
|
||||||
B_TRANSLATE("Based on PPMTranslator sample code"));
|
B_TRANSLATE("Based on PPMTranslator sample code"));
|
||||||
|
|
||||||
mCopyright = new BStringView("copyright",
|
fCopyright = new BStringView("copyright",
|
||||||
B_TRANSLATE("Sample code copyright 1999, Be Incorporated"));
|
B_TRANSLATE("Sample code copyright 1999, Be Incorporated"));
|
||||||
|
|
||||||
mMenu = new BPopUpMenu("Color Space");
|
fMenu = new BPopUpMenu("Color Space");
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("None"),
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("None"),
|
||||||
CSMessage(B_NO_COLOR_SPACE)));
|
CSMessage(B_NO_COLOR_SPACE)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 8:8:8 32 bits"),
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 8:8:8 32 bits"),
|
||||||
CSMessage(B_RGB32)));
|
CSMessage(B_RGB32)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("RGBA 8:8:8:8 32 "
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("RGBA 8:8:8:8 32 "
|
||||||
"bits"), CSMessage(B_RGBA32)));
|
"bits"), CSMessage(B_RGBA32)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 5:5:5 16 bits"),
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 5:5:5 16 bits"),
|
||||||
CSMessage(B_RGB15)));
|
CSMessage(B_RGB15)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("RGBA 5:5:5:1 16 "
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("RGBA 5:5:5:1 16 "
|
||||||
"bits"), CSMessage(B_RGBA15)));
|
"bits"), CSMessage(B_RGBA15)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 5:6:5 16 bits"),
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 5:6:5 16 bits"),
|
||||||
CSMessage(B_RGB16)));
|
CSMessage(B_RGB16)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("System palette 8 "
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("System palette 8 "
|
||||||
"bits"), CSMessage(B_CMAP8)));
|
"bits"), CSMessage(B_CMAP8)));
|
||||||
mMenu->AddSeparatorItem();
|
fMenu->AddSeparatorItem();
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("Grayscale 8 bits"),
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("Grayscale 8 bits"),
|
||||||
CSMessage(B_GRAY8)));
|
CSMessage(B_GRAY8)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("Bitmap 1 bit"),
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("Bitmap 1 bit"),
|
||||||
CSMessage(B_GRAY1)));
|
CSMessage(B_GRAY1)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("CMY 8:8:8 32 bits"),
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("CMY 8:8:8 32 bits"),
|
||||||
CSMessage(B_CMY32)));
|
CSMessage(B_CMY32)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("CMYA 8:8:8:8 32 "
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("CMYA 8:8:8:8 32 "
|
||||||
"bits"), CSMessage(B_CMYA32)));
|
"bits"), CSMessage(B_CMYA32)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("CMYK 8:8:8:8 32 "
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("CMYK 8:8:8:8 32 "
|
||||||
"bits"), CSMessage(B_CMYK32)));
|
"bits"), CSMessage(B_CMYK32)));
|
||||||
mMenu->AddSeparatorItem();
|
fMenu->AddSeparatorItem();
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 8:8:8 32 bits "
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 8:8:8 32 bits "
|
||||||
"big-endian"), CSMessage(B_RGB32_BIG)));
|
"big-endian"), CSMessage(B_RGB32_BIG)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("RGBA 8:8:8:8 32 "
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("RGBA 8:8:8:8 32 "
|
||||||
"bits big-endian"), CSMessage(B_RGBA32_BIG)));
|
"bits big-endian"), CSMessage(B_RGBA32_BIG)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 5:5:5 16 bits "
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 5:5:5 16 bits "
|
||||||
"big-endian"), CSMessage(B_RGB15_BIG)));
|
"big-endian"), CSMessage(B_RGB15_BIG)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("RGBA 5:5:5:1 16 "
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("RGBA 5:5:5:1 16 "
|
||||||
"bits big-endian"), CSMessage(B_RGBA15_BIG)));
|
"bits big-endian"), CSMessage(B_RGBA15_BIG)));
|
||||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 5:6:5 16 bits "
|
fMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 5:6:5 16 bits "
|
||||||
"big-endian"), CSMessage(B_RGB16)));
|
"big-endian"), CSMessage(B_RGB16)));
|
||||||
mField = new BMenuField(B_TRANSLATE("Input Color Space"),
|
fField = new BMenuField(B_TRANSLATE("Input Color Space"),
|
||||||
mMenu);
|
fMenu);
|
||||||
mField->SetViewColor(ViewColor());
|
fField->SetViewColor(ViewColor());
|
||||||
SelectColorSpace(g_settings.out_space);
|
SelectColorSpace(g_settings.out_space);
|
||||||
BMessage * msg = new BMessage(CHANGE_ASCII);
|
BMessage * msg = new BMessage(CHANGE_ASCII);
|
||||||
mAscii = new BCheckBox(B_TRANSLATE("Write ASCII"), msg);
|
fAscii = new BCheckBox(B_TRANSLATE("Write ASCII"), msg);
|
||||||
if (g_settings.write_ascii)
|
if (g_settings.write_ascii)
|
||||||
mAscii->SetValue(1);
|
fAscii->SetValue(1);
|
||||||
mAscii->SetViewColor(ViewColor());
|
fAscii->SetViewColor(ViewColor());
|
||||||
|
|
||||||
// Build the layout
|
// Build the layout
|
||||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 7)
|
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||||
.SetInsets(5)
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||||
.Add(mTitle)
|
.Add(fTitle)
|
||||||
.Add(mDetail)
|
.Add(fDetail)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.Add(mBasedOn)
|
|
||||||
.Add(mCopyright)
|
|
||||||
.AddGlue()
|
|
||||||
.AddGrid(10, 10)
|
.AddGrid(10, 10)
|
||||||
.Add(mField->CreateLabelLayoutItem(), 0, 0)
|
.Add(fField->CreateLabelLayoutItem(), 0, 0)
|
||||||
.Add(mField->CreateMenuBarLayoutItem(), 1, 0)
|
.Add(fField->CreateMenuBarLayoutItem(), 1, 0)
|
||||||
.Add(mAscii, 0, 1)
|
.Add(fAscii, 0, 1)
|
||||||
.End()
|
.End()
|
||||||
.AddGlue();
|
.AddGlue()
|
||||||
|
.Add(fBasedOn)
|
||||||
|
.Add(fCopyright);
|
||||||
|
|
||||||
BFont font;
|
BFont font;
|
||||||
GetFont(&font);
|
GetFont(&font);
|
||||||
SetExplicitPreferredSize(BSize((font.Size() * 350)/12, (font.Size() * 200)/12));
|
SetExplicitPreferredSize(BSize((font.Size() * 350)/12, (font.Size() * 200)/12));
|
||||||
@@ -556,7 +554,7 @@ virtual void MessageReceived(
|
|||||||
}
|
}
|
||||||
else if (message->what == CHANGE_ASCII) {
|
else if (message->what == CHANGE_ASCII) {
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
msg.AddBool("ppm /ascii", mAscii->Value());
|
msg.AddBool("ppm /ascii", fAscii->Value());
|
||||||
SetSettings(&msg);
|
SetSettings(&msg);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -568,13 +566,13 @@ virtual void AllAttached()
|
|||||||
BView::AllAttached();
|
BView::AllAttached();
|
||||||
BMessenger msgr(this);
|
BMessenger msgr(this);
|
||||||
/* Tell all menu items we're the man. */
|
/* Tell all menu items we're the man. */
|
||||||
for (int ix=0; ix<mMenu->CountItems(); ix++) {
|
for (int ix=0; ix<fMenu->CountItems(); ix++) {
|
||||||
BMenuItem * i = mMenu->ItemAt(ix);
|
BMenuItem * i = fMenu->ItemAt(ix);
|
||||||
if (i) {
|
if (i) {
|
||||||
i->SetTarget(msgr);
|
i->SetTarget(msgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mAscii->SetTarget(msgr);
|
fAscii->SetTarget(msgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSettings(
|
void SetSettings(
|
||||||
@@ -596,13 +594,13 @@ virtual void AllAttached()
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BStringView * mTitle;
|
BStringView * fTitle;
|
||||||
BStringView * mDetail;
|
BStringView * fDetail;
|
||||||
BStringView * mBasedOn;
|
BStringView * fBasedOn;
|
||||||
BStringView * mCopyright;
|
BStringView * fCopyright;
|
||||||
BPopUpMenu * mMenu;
|
BPopUpMenu * fMenu;
|
||||||
BMenuField * mField;
|
BMenuField * fField;
|
||||||
BCheckBox * mAscii;
|
BCheckBox * fAscii;
|
||||||
|
|
||||||
BMessage * CSMessage(
|
BMessage * CSMessage(
|
||||||
color_space space)
|
color_space space)
|
||||||
@@ -615,13 +613,13 @@ private:
|
|||||||
void SelectColorSpace(
|
void SelectColorSpace(
|
||||||
color_space space)
|
color_space space)
|
||||||
{
|
{
|
||||||
for (int ix=0; ix<mMenu->CountItems(); ix++) {
|
for (int ix=0; ix<fMenu->CountItems(); ix++) {
|
||||||
int32 s;
|
int32 s;
|
||||||
BMenuItem * i = mMenu->ItemAt(ix);
|
BMenuItem * i = fMenu->ItemAt(ix);
|
||||||
if (i) {
|
if (i) {
|
||||||
BMessage * m = i->Message();
|
BMessage * m = i->Message();
|
||||||
if (m && !m->FindInt32("space", &s) && (s == space)) {
|
if (m && !m->FindInt32("space", &s) && (s == space)) {
|
||||||
mMenu->Superitem()->SetLabel(i->Label());
|
fMenu->Superitem()->SetLabel(i->Label());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings)
|
|||||||
titleView->SetExplicitAlignment(labelAlignment);
|
titleView->SetExplicitAlignment(labelAlignment);
|
||||||
|
|
||||||
char detail[100];
|
char detail[100];
|
||||||
sprintf(detail, B_TRANSLATE("Version %d.%d.%d %s"),
|
sprintf(detail, B_TRANSLATE("Version %d.%d.%d, %s"),
|
||||||
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(SGI_TRANSLATOR_VERSION)),
|
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(SGI_TRANSLATOR_VERSION)),
|
||||||
static_cast<int>(B_TRANSLATION_MINOR_VERSION(SGI_TRANSLATOR_VERSION)),
|
static_cast<int>(B_TRANSLATION_MINOR_VERSION(SGI_TRANSLATOR_VERSION)),
|
||||||
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
|
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
|
||||||
@@ -125,17 +125,17 @@ SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings)
|
|||||||
infoView->MakeResizable(true);
|
infoView->MakeResizable(true);
|
||||||
infoView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
infoView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
float padding = 5.0f;
|
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||||
BLayoutBuilder::Group<>(this, B_VERTICAL, padding)
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||||
.SetInsets(padding)
|
|
||||||
.Add(titleView)
|
.Add(titleView)
|
||||||
.Add(detailView)
|
.Add(detailView)
|
||||||
|
.AddGlue()
|
||||||
.AddGroup(B_HORIZONTAL)
|
.AddGroup(B_HORIZONTAL)
|
||||||
.Add(fCompressionMF)
|
.Add(fCompressionMF)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.End()
|
.End()
|
||||||
.Add(infoView)
|
.AddGlue()
|
||||||
.AddGlue();
|
.Add(infoView);
|
||||||
|
|
||||||
BFont font;
|
BFont font;
|
||||||
GetFont(&font);
|
GetFont(&font);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "STXTTranslator.h"
|
#include "STXTTranslator.h"
|
||||||
|
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
|
#include <LayoutBuilder.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -30,44 +31,26 @@ STXTView::STXTView(const BRect &frame, const char *name, uint32 resizeMode,
|
|||||||
fSettings = settings;
|
fSettings = settings;
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
font_height fontHeight;
|
BStringView *titleView = new BStringView("title",
|
||||||
be_bold_font->GetHeight(&fontHeight);
|
|
||||||
float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
|
|
||||||
|
|
||||||
BRect rect(10, 10, 200, 10 + height);
|
|
||||||
BStringView *stringView = new BStringView(rect, "title",
|
|
||||||
B_TRANSLATE("StyledEdit file translator"));
|
B_TRANSLATE("StyledEdit file translator"));
|
||||||
stringView->SetFont(be_bold_font);
|
titleView->SetFont(be_bold_font);
|
||||||
stringView->ResizeToPreferred();
|
|
||||||
AddChild(stringView);
|
|
||||||
|
|
||||||
float maxWidth = stringView->Bounds().Width();
|
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 10);
|
|
||||||
char version[256];
|
char version[256];
|
||||||
snprintf(version, sizeof(version), "Version %d.%d.%d, %s",
|
snprintf(version, sizeof(version), "Version %d.%d.%d, %s",
|
||||||
int(B_TRANSLATION_MAJOR_VERSION(STXT_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MAJOR_VERSION(STXT_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_MINOR_VERSION(STXT_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MINOR_VERSION(STXT_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_REVISION_VERSION(STXT_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_REVISION_VERSION(STXT_TRANSLATOR_VERSION)),
|
||||||
__DATE__);
|
__DATE__);
|
||||||
stringView = new BStringView(rect, "version", version);
|
BStringView *versionView = new BStringView("version", version);
|
||||||
stringView->ResizeToPreferred();
|
BStringView *copyrightView = new BStringView("Copyright",
|
||||||
AddChild(stringView);
|
|
||||||
|
|
||||||
if (stringView->Bounds().Width() > maxWidth)
|
|
||||||
maxWidth = stringView->Bounds().Width();
|
|
||||||
|
|
||||||
GetFontHeight(&fontHeight);
|
|
||||||
height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
|
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 5);
|
|
||||||
stringView = new BStringView(rect, "Copyright",
|
|
||||||
B_UTF8_COPYRIGHT "2002-2006 Haiku Inc.");
|
B_UTF8_COPYRIGHT "2002-2006 Haiku Inc.");
|
||||||
stringView->ResizeToPreferred();
|
|
||||||
AddChild(stringView);
|
|
||||||
|
|
||||||
if (maxWidth + 20 > Bounds().Width())
|
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||||
ResizeTo(maxWidth + 20, Bounds().Height());
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||||
|
.Add(titleView)
|
||||||
|
.Add(versionView)
|
||||||
|
.Add(copyrightView)
|
||||||
|
.AddGlue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ TIFFView::TIFFView(const char* name, uint32 flags,
|
|||||||
fTitle->SetFont(be_bold_font);
|
fTitle->SetFont(be_bold_font);
|
||||||
|
|
||||||
char detail[100];
|
char detail[100];
|
||||||
sprintf(detail, B_TRANSLATE("Version %d.%d.%d %s"),
|
sprintf(detail, B_TRANSLATE("Version %d.%d.%d, %s"),
|
||||||
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TIFF_TRANSLATOR_VERSION)),
|
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TIFF_TRANSLATOR_VERSION)),
|
||||||
static_cast<int>(B_TRANSLATION_MINOR_VERSION(TIFF_TRANSLATOR_VERSION)),
|
static_cast<int>(B_TRANSLATION_MINOR_VERSION(TIFF_TRANSLATOR_VERSION)),
|
||||||
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
|
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
|
||||||
@@ -123,8 +123,8 @@ TIFFView::TIFFView(const char* name, uint32 flags,
|
|||||||
fCompressionMF = new BMenuField(B_TRANSLATE("Use compression:"), menu);
|
fCompressionMF = new BMenuField(B_TRANSLATE("Use compression:"), menu);
|
||||||
|
|
||||||
// Build the layout
|
// Build the layout
|
||||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 7)
|
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||||
.SetInsets(5)
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||||
.Add(fTitle)
|
.Add(fTitle)
|
||||||
.Add(fDetail)
|
.Add(fDetail)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
@@ -136,11 +136,10 @@ TIFFView::TIFFView(const char* name, uint32 flags,
|
|||||||
.Add(fLibTIFF[0])
|
.Add(fLibTIFF[0])
|
||||||
.Add(fLibTIFF[1])
|
.Add(fLibTIFF[1])
|
||||||
.Add(fLibTIFF[2])
|
.Add(fLibTIFF[2])
|
||||||
.Add(fLibTIFF[3])
|
.Add(fLibTIFF[3]);
|
||||||
// Theses 4 adding above work because we know there are 4 strings
|
// Theses 4 adding above work because we know there are 4 strings
|
||||||
// but it's fragile: one string less in the library version and the
|
// but it's fragile: one string less in the library version and the
|
||||||
// application breaks
|
// application breaks
|
||||||
.AddGlue();
|
|
||||||
|
|
||||||
BFont font;
|
BFont font;
|
||||||
GetFont(&font);
|
GetFont(&font);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#include <PopUpMenu.h>
|
#include <PopUpMenu.h>
|
||||||
#include <Slider.h>
|
#include <Slider.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
#include <TextView.h>
|
|
||||||
|
|
||||||
#include "webp/encode.h"
|
#include "webp/encode.h"
|
||||||
|
|
||||||
@@ -63,23 +62,22 @@ ConfigView::ConfigView(TranslatorSettings* settings)
|
|||||||
title->SetFont(be_bold_font);
|
title->SetFont(be_bold_font);
|
||||||
|
|
||||||
char versionString[256];
|
char versionString[256];
|
||||||
sprintf(versionString, "v%d.%d.%d",
|
sprintf(versionString, "v%d.%d.%d, %s",
|
||||||
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(WEBP_TRANSLATOR_VERSION)),
|
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(WEBP_TRANSLATOR_VERSION)),
|
||||||
static_cast<int>(B_TRANSLATION_MINOR_VERSION(WEBP_TRANSLATOR_VERSION)),
|
static_cast<int>(B_TRANSLATION_MINOR_VERSION(WEBP_TRANSLATOR_VERSION)),
|
||||||
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
|
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
|
||||||
WEBP_TRANSLATOR_VERSION)));
|
WEBP_TRANSLATOR_VERSION)),
|
||||||
|
__DATE__);
|
||||||
|
|
||||||
BStringView* version = new BStringView("version", versionString);
|
BStringView* version = new BStringView("version", versionString);
|
||||||
|
|
||||||
BString copyrightsText;
|
BString copyrightsText;
|
||||||
copyrightsText << B_TRANSLATE(B_UTF8_COPYRIGHT "2010-2011 Haiku Inc.")
|
BStringView *copyrightView = new BStringView("Copyright",
|
||||||
<< "\n" << B_TRANSLATE("Based on libwebp v0.1," )
|
B_TRANSLATE(B_UTF8_COPYRIGHT "2010-2011 Haiku Inc."));
|
||||||
<< "\n" << B_TRANSLATE(B_UTF8_COPYRIGHT "2010-2011 Google Inc.");
|
BStringView *copyright2View = new BStringView("Copyright2",
|
||||||
|
B_TRANSLATE("Based on libwebp v0.1,"));
|
||||||
BTextView* copyrights = new BTextView("copyrights");
|
BStringView *copyright3View = new BStringView("Copyright3",
|
||||||
copyrights->SetText(copyrightsText);
|
B_TRANSLATE(B_UTF8_COPYRIGHT "2010-2011 Google Inc."));
|
||||||
copyrights->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
||||||
copyrights->MakeEditable(false);
|
|
||||||
|
|
||||||
// output parameters
|
// output parameters
|
||||||
|
|
||||||
@@ -120,21 +118,23 @@ ConfigView::ConfigView(TranslatorSettings* settings)
|
|||||||
fPreprocessingCheckBox->SetValue(B_CONTROL_ON);
|
fPreprocessingCheckBox->SetValue(B_CONTROL_ON);
|
||||||
|
|
||||||
// Build the layout
|
// Build the layout
|
||||||
BLayoutBuilder::Group<> builder(GroupLayout());
|
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||||
builder
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||||
.SetInsets(5)
|
.Add(title)
|
||||||
.AddGroup(B_HORIZONTAL)
|
.Add(version)
|
||||||
.Add(title)
|
.Add(copyrightView)
|
||||||
.Add(version)
|
|
||||||
.AddGlue()
|
|
||||||
.End()
|
|
||||||
.Add(copyrights)
|
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
|
|
||||||
.Add(presetsField)
|
.Add(presetsField)
|
||||||
.Add(fQualitySlider)
|
.Add(fQualitySlider)
|
||||||
.Add(fMethodSlider)
|
.Add(fMethodSlider)
|
||||||
.Add(fPreprocessingCheckBox);
|
.Add(fPreprocessingCheckBox)
|
||||||
|
.AddGlue()
|
||||||
|
.Add(copyright2View)
|
||||||
|
.Add(copyright3View);
|
||||||
|
|
||||||
|
BFont font;
|
||||||
|
GetFont(&font);
|
||||||
|
SetExplicitPreferredSize(BSize((font.Size() * 1433)/12, (font.Size() * 200)/12));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,12 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
|
#include <LayoutBuilder.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <PopUpMenu.h>
|
#include <PopUpMenu.h>
|
||||||
|
#include <StringView.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include "WonderBrushImage.h"
|
#include "WonderBrushImage.h"
|
||||||
@@ -27,7 +29,7 @@
|
|||||||
|
|
||||||
|
|
||||||
const char* kAuthor = "Stephan Aßmus, <[email protected]>";
|
const char* kAuthor = "Stephan Aßmus, <[email protected]>";
|
||||||
const char* kWBICopyright = "Copyright " B_UTF8_COPYRIGHT " 2006 Haiku Inc.";
|
const char* kWBICopyright = B_UTF8_COPYRIGHT " 2006 Haiku Inc.";
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -50,9 +52,31 @@ WonderBrushView::WonderBrushView(const BRect &frame, const char *name,
|
|||||||
fSettings(settings)
|
fSettings(settings)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
SetLowColor(ViewColor());
|
|
||||||
|
|
||||||
ResizeToPreferred();
|
BStringView *titleView = new BStringView("title",
|
||||||
|
B_TRANSLATE("WonderBrush image translator"));
|
||||||
|
titleView->SetFont(be_bold_font);
|
||||||
|
|
||||||
|
char version[100];
|
||||||
|
sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
|
||||||
|
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(WBI_TRANSLATOR_VERSION)),
|
||||||
|
static_cast<int>(B_TRANSLATION_MINOR_VERSION(WBI_TRANSLATOR_VERSION)),
|
||||||
|
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
|
||||||
|
WBI_TRANSLATOR_VERSION)), __DATE__);
|
||||||
|
|
||||||
|
BStringView *versionView = new BStringView("version", version);
|
||||||
|
BStringView *copyrightView = new BStringView("copyright", kWBICopyright);
|
||||||
|
BStringView *copyright2View = new BStringView("copyright2", B_TRANSLATE("written by:"));
|
||||||
|
BStringView *copyright3View = new BStringView("copyright3", kAuthor);
|
||||||
|
|
||||||
|
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||||
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||||
|
.Add(titleView)
|
||||||
|
.Add(versionView)
|
||||||
|
.Add(copyrightView)
|
||||||
|
.AddGlue()
|
||||||
|
.Add(copyright2View)
|
||||||
|
.Add(copyright3View);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -111,49 +135,6 @@ WonderBrushView::AttachedToWindow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
WonderBrushView::Draw(BRect area)
|
|
||||||
{
|
|
||||||
SetFont(be_bold_font);
|
|
||||||
font_height fh;
|
|
||||||
GetFontHeight(&fh);
|
|
||||||
float xbold = fh.descent + 1;
|
|
||||||
float ybold = fh.ascent + fh.descent * 2 + fh.leading;
|
|
||||||
|
|
||||||
BPoint offset(xbold, ybold);
|
|
||||||
|
|
||||||
const char* text = B_TRANSLATE("WonderBrush image translator");
|
|
||||||
DrawString(text, offset);
|
|
||||||
|
|
||||||
SetFont(be_plain_font);
|
|
||||||
font_height plainh;
|
|
||||||
GetFontHeight(&plainh);
|
|
||||||
float yplain = plainh.ascent + plainh.descent * 2 + plainh.leading;
|
|
||||||
|
|
||||||
offset.y += yplain;
|
|
||||||
|
|
||||||
char detail[100];
|
|
||||||
sprintf(detail, B_TRANSLATE("Version %d.%d.%d %s"),
|
|
||||||
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(WBI_TRANSLATOR_VERSION)),
|
|
||||||
static_cast<int>(B_TRANSLATION_MINOR_VERSION(WBI_TRANSLATOR_VERSION)),
|
|
||||||
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
|
|
||||||
WBI_TRANSLATOR_VERSION)), __DATE__);
|
|
||||||
DrawString(detail, offset);
|
|
||||||
|
|
||||||
offset.y += 2 * ybold;
|
|
||||||
|
|
||||||
text = B_TRANSLATE("written by:");
|
|
||||||
DrawString(text, offset);
|
|
||||||
offset.y += ybold;
|
|
||||||
|
|
||||||
DrawString(kAuthor, offset);
|
|
||||||
offset.y += 2 * ybold;
|
|
||||||
|
|
||||||
DrawString(kWBICopyright, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WonderBrushView::GetPreferredSize(float* width, float* height)
|
WonderBrushView::GetPreferredSize(float* width, float* height)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ public:
|
|||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
|
||||||
virtual void Draw(BRect area);
|
|
||||||
// draws information about the WonderBrushTranslator
|
|
||||||
virtual void GetPreferredSize(float* width, float* height);
|
virtual void GetPreferredSize(float* width, float* height);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|||||||
Reference in New Issue
Block a user