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)
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
SetLowColor(ViewColor());
|
||||
|
||||
mTitle = new BStringView("title",
|
||||
fTitle = new BStringView("title",
|
||||
B_TRANSLATE("PPM image translator"));
|
||||
mTitle->SetFont(be_bold_font);
|
||||
fTitle->SetFont(be_bold_font);
|
||||
|
||||
char detail[100];
|
||||
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 & 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"));
|
||||
|
||||
mCopyright = new BStringView("copyright",
|
||||
fCopyright = new BStringView("copyright",
|
||||
B_TRANSLATE("Sample code copyright 1999, Be Incorporated"));
|
||||
|
||||
mMenu = new BPopUpMenu("Color Space");
|
||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("None"),
|
||||
fMenu = new BPopUpMenu("Color Space");
|
||||
fMenu->AddItem(new BMenuItem(B_TRANSLATE("None"),
|
||||
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)));
|
||||
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)));
|
||||
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)));
|
||||
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)));
|
||||
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)));
|
||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("System palette 8 "
|
||||
fMenu->AddItem(new BMenuItem(B_TRANSLATE("System palette 8 "
|
||||
"bits"), CSMessage(B_CMAP8)));
|
||||
mMenu->AddSeparatorItem();
|
||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("Grayscale 8 bits"),
|
||||
fMenu->AddSeparatorItem();
|
||||
fMenu->AddItem(new BMenuItem(B_TRANSLATE("Grayscale 8 bits"),
|
||||
CSMessage(B_GRAY8)));
|
||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("Bitmap 1 bit"),
|
||||
fMenu->AddItem(new BMenuItem(B_TRANSLATE("Bitmap 1 bit"),
|
||||
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)));
|
||||
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)));
|
||||
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)));
|
||||
mMenu->AddSeparatorItem();
|
||||
mMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 8:8:8 32 bits "
|
||||
fMenu->AddSeparatorItem();
|
||||
fMenu->AddItem(new BMenuItem(B_TRANSLATE("RGB 8:8:8 32 bits "
|
||||
"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)));
|
||||
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)));
|
||||
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)));
|
||||
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)));
|
||||
mField = new BMenuField(B_TRANSLATE("Input Color Space"),
|
||||
mMenu);
|
||||
mField->SetViewColor(ViewColor());
|
||||
fField = new BMenuField(B_TRANSLATE("Input Color Space"),
|
||||
fMenu);
|
||||
fField->SetViewColor(ViewColor());
|
||||
SelectColorSpace(g_settings.out_space);
|
||||
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)
|
||||
mAscii->SetValue(1);
|
||||
mAscii->SetViewColor(ViewColor());
|
||||
fAscii->SetValue(1);
|
||||
fAscii->SetViewColor(ViewColor());
|
||||
|
||||
// Build the layout
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 7)
|
||||
.SetInsets(5)
|
||||
.Add(mTitle)
|
||||
.Add(mDetail)
|
||||
.AddGlue()
|
||||
.Add(mBasedOn)
|
||||
.Add(mCopyright)
|
||||
.AddGlue()
|
||||
// Build the layout
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||
.Add(fTitle)
|
||||
.Add(fDetail)
|
||||
.AddGlue()
|
||||
.AddGrid(10, 10)
|
||||
.Add(mField->CreateLabelLayoutItem(), 0, 0)
|
||||
.Add(mField->CreateMenuBarLayoutItem(), 1, 0)
|
||||
.Add(mAscii, 0, 1)
|
||||
.Add(fField->CreateLabelLayoutItem(), 0, 0)
|
||||
.Add(fField->CreateMenuBarLayoutItem(), 1, 0)
|
||||
.Add(fAscii, 0, 1)
|
||||
.End()
|
||||
.AddGlue();
|
||||
|
||||
.AddGlue()
|
||||
.Add(fBasedOn)
|
||||
.Add(fCopyright);
|
||||
|
||||
BFont font;
|
||||
GetFont(&font);
|
||||
SetExplicitPreferredSize(BSize((font.Size() * 350)/12, (font.Size() * 200)/12));
|
||||
@@ -556,7 +554,7 @@ virtual void MessageReceived(
|
||||
}
|
||||
else if (message->what == CHANGE_ASCII) {
|
||||
BMessage msg;
|
||||
msg.AddBool("ppm /ascii", mAscii->Value());
|
||||
msg.AddBool("ppm /ascii", fAscii->Value());
|
||||
SetSettings(&msg);
|
||||
}
|
||||
else {
|
||||
@@ -568,13 +566,13 @@ virtual void AllAttached()
|
||||
BView::AllAttached();
|
||||
BMessenger msgr(this);
|
||||
/* Tell all menu items we're the man. */
|
||||
for (int ix=0; ix<mMenu->CountItems(); ix++) {
|
||||
BMenuItem * i = mMenu->ItemAt(ix);
|
||||
for (int ix=0; ix<fMenu->CountItems(); ix++) {
|
||||
BMenuItem * i = fMenu->ItemAt(ix);
|
||||
if (i) {
|
||||
i->SetTarget(msgr);
|
||||
}
|
||||
}
|
||||
mAscii->SetTarget(msgr);
|
||||
fAscii->SetTarget(msgr);
|
||||
}
|
||||
|
||||
void SetSettings(
|
||||
@@ -596,13 +594,13 @@ virtual void AllAttached()
|
||||
}
|
||||
|
||||
private:
|
||||
BStringView * mTitle;
|
||||
BStringView * mDetail;
|
||||
BStringView * mBasedOn;
|
||||
BStringView * mCopyright;
|
||||
BPopUpMenu * mMenu;
|
||||
BMenuField * mField;
|
||||
BCheckBox * mAscii;
|
||||
BStringView * fTitle;
|
||||
BStringView * fDetail;
|
||||
BStringView * fBasedOn;
|
||||
BStringView * fCopyright;
|
||||
BPopUpMenu * fMenu;
|
||||
BMenuField * fField;
|
||||
BCheckBox * fAscii;
|
||||
|
||||
BMessage * CSMessage(
|
||||
color_space space)
|
||||
@@ -615,13 +613,13 @@ private:
|
||||
void SelectColorSpace(
|
||||
color_space space)
|
||||
{
|
||||
for (int ix=0; ix<mMenu->CountItems(); ix++) {
|
||||
for (int ix=0; ix<fMenu->CountItems(); ix++) {
|
||||
int32 s;
|
||||
BMenuItem * i = mMenu->ItemAt(ix);
|
||||
BMenuItem * i = fMenu->ItemAt(ix);
|
||||
if (i) {
|
||||
BMessage * m = i->Message();
|
||||
if (m && !m->FindInt32("space", &s) && (s == space)) {
|
||||
mMenu->Superitem()->SetLabel(i->Label());
|
||||
fMenu->Superitem()->SetLabel(i->Label());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings)
|
||||
titleView->SetExplicitAlignment(labelAlignment);
|
||||
|
||||
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_MINOR_VERSION(SGI_TRANSLATOR_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->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
float padding = 5.0f;
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, padding)
|
||||
.SetInsets(padding)
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||
.Add(titleView)
|
||||
.Add(detailView)
|
||||
.AddGlue()
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.Add(fCompressionMF)
|
||||
.AddGlue()
|
||||
.End()
|
||||
.Add(infoView)
|
||||
.AddGlue();
|
||||
.AddGlue()
|
||||
.Add(infoView);
|
||||
|
||||
BFont font;
|
||||
GetFont(&font);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "STXTTranslator.h"
|
||||
|
||||
#include <Catalog.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <StringView.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -30,44 +31,26 @@ STXTView::STXTView(const BRect &frame, const char *name, uint32 resizeMode,
|
||||
fSettings = settings;
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
font_height fontHeight;
|
||||
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",
|
||||
BStringView *titleView = new BStringView("title",
|
||||
B_TRANSLATE("StyledEdit file translator"));
|
||||
stringView->SetFont(be_bold_font);
|
||||
stringView->ResizeToPreferred();
|
||||
AddChild(stringView);
|
||||
titleView->SetFont(be_bold_font);
|
||||
|
||||
float maxWidth = stringView->Bounds().Width();
|
||||
|
||||
rect.OffsetBy(0, height + 10);
|
||||
char version[256];
|
||||
snprintf(version, sizeof(version), "Version %d.%d.%d, %s",
|
||||
int(B_TRANSLATION_MAJOR_VERSION(STXT_TRANSLATOR_VERSION)),
|
||||
int(B_TRANSLATION_MINOR_VERSION(STXT_TRANSLATOR_VERSION)),
|
||||
int(B_TRANSLATION_REVISION_VERSION(STXT_TRANSLATOR_VERSION)),
|
||||
__DATE__);
|
||||
stringView = new BStringView(rect, "version", version);
|
||||
stringView->ResizeToPreferred();
|
||||
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",
|
||||
BStringView *versionView = new BStringView("version", version);
|
||||
BStringView *copyrightView = new BStringView("Copyright",
|
||||
B_UTF8_COPYRIGHT "2002-2006 Haiku Inc.");
|
||||
stringView->ResizeToPreferred();
|
||||
AddChild(stringView);
|
||||
|
||||
if (maxWidth + 20 > Bounds().Width())
|
||||
ResizeTo(maxWidth + 20, Bounds().Height());
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||
.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);
|
||||
|
||||
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_MINOR_VERSION(TIFF_TRANSLATOR_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);
|
||||
|
||||
// Build the layout
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 7)
|
||||
.SetInsets(5)
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||
.Add(fTitle)
|
||||
.Add(fDetail)
|
||||
.AddGlue()
|
||||
@@ -136,11 +136,10 @@ TIFFView::TIFFView(const char* name, uint32 flags,
|
||||
.Add(fLibTIFF[0])
|
||||
.Add(fLibTIFF[1])
|
||||
.Add(fLibTIFF[2])
|
||||
.Add(fLibTIFF[3])
|
||||
.Add(fLibTIFF[3]);
|
||||
// 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
|
||||
// application breaks
|
||||
.AddGlue();
|
||||
|
||||
BFont font;
|
||||
GetFont(&font);
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <PopUpMenu.h>
|
||||
#include <Slider.h>
|
||||
#include <StringView.h>
|
||||
#include <TextView.h>
|
||||
|
||||
#include "webp/encode.h"
|
||||
|
||||
@@ -63,23 +62,22 @@ ConfigView::ConfigView(TranslatorSettings* settings)
|
||||
title->SetFont(be_bold_font);
|
||||
|
||||
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_MINOR_VERSION(WEBP_TRANSLATOR_VERSION)),
|
||||
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
|
||||
WEBP_TRANSLATOR_VERSION)));
|
||||
WEBP_TRANSLATOR_VERSION)),
|
||||
__DATE__);
|
||||
|
||||
BStringView* version = new BStringView("version", versionString);
|
||||
|
||||
BString copyrightsText;
|
||||
copyrightsText << B_TRANSLATE(B_UTF8_COPYRIGHT "2010-2011 Haiku Inc.")
|
||||
<< "\n" << B_TRANSLATE("Based on libwebp v0.1," )
|
||||
<< "\n" << B_TRANSLATE(B_UTF8_COPYRIGHT "2010-2011 Google Inc.");
|
||||
|
||||
BTextView* copyrights = new BTextView("copyrights");
|
||||
copyrights->SetText(copyrightsText);
|
||||
copyrights->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
copyrights->MakeEditable(false);
|
||||
BStringView *copyrightView = new BStringView("Copyright",
|
||||
B_TRANSLATE(B_UTF8_COPYRIGHT "2010-2011 Haiku Inc."));
|
||||
BStringView *copyright2View = new BStringView("Copyright2",
|
||||
B_TRANSLATE("Based on libwebp v0.1,"));
|
||||
BStringView *copyright3View = new BStringView("Copyright3",
|
||||
B_TRANSLATE(B_UTF8_COPYRIGHT "2010-2011 Google Inc."));
|
||||
|
||||
// output parameters
|
||||
|
||||
@@ -120,21 +118,23 @@ ConfigView::ConfigView(TranslatorSettings* settings)
|
||||
fPreprocessingCheckBox->SetValue(B_CONTROL_ON);
|
||||
|
||||
// Build the layout
|
||||
BLayoutBuilder::Group<> builder(GroupLayout());
|
||||
builder
|
||||
.SetInsets(5)
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.Add(title)
|
||||
.Add(version)
|
||||
.AddGlue()
|
||||
.End()
|
||||
.Add(copyrights)
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||
.Add(title)
|
||||
.Add(version)
|
||||
.Add(copyrightView)
|
||||
.AddGlue()
|
||||
|
||||
.Add(presetsField)
|
||||
.Add(fQualitySlider)
|
||||
.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 <Catalog.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <MenuBar.h>
|
||||
#include <MenuField.h>
|
||||
#include <MenuItem.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <StringView.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include "WonderBrushImage.h"
|
||||
@@ -27,7 +29,7 @@
|
||||
|
||||
|
||||
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
|
||||
@@ -50,9 +52,31 @@ WonderBrushView::WonderBrushView(const BRect &frame, const char *name,
|
||||
fSettings(settings)
|
||||
{
|
||||
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
|
||||
WonderBrushView::GetPreferredSize(float* width, float* height)
|
||||
{
|
||||
|
||||
@@ -26,8 +26,6 @@ public:
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
|
||||
virtual void Draw(BRect area);
|
||||
// draws information about the WonderBrushTranslator
|
||||
virtual void GetPreferredSize(float* width, float* height);
|
||||
|
||||
enum {
|
||||
|
||||
Reference in New Issue
Block a user