DataTranslations: use layout, standard format.
* Fix bmp, exr, pcx, raw. * Partialy fixes #11999.
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
#include "BMPTranslator.h"
|
#include "BMPTranslator.h"
|
||||||
|
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
|
#include <LayoutBuilder.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -29,43 +30,25 @@ BMPView::BMPView(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("BMP image translator"));
|
B_TRANSLATE("BMP image 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), B_TRANSLATE("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)),
|
||||||
__DATE__);
|
__DATE__);
|
||||||
stringView = new BStringView(rect, "version", version);
|
BStringView *versionView = new BStringView("version", version);
|
||||||
stringView->ResizeToPreferred();
|
BStringView *copyrightView = new BStringView("Copyright", B_UTF8_COPYRIGHT "2002-2010 Haiku Inc.");
|
||||||
AddChild(stringView);
|
|
||||||
|
|
||||||
if (stringView->Bounds().Width() > maxWidth)
|
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||||
maxWidth = stringView->Bounds().Width();
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||||
|
.Add(titleView)
|
||||||
GetFontHeight(&fontHeight);
|
.Add(versionView)
|
||||||
height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
|
.Add(copyrightView)
|
||||||
|
.AddGlue();
|
||||||
rect.OffsetBy(0, height + 5);
|
|
||||||
stringView = new BStringView(rect, "Copyright", B_UTF8_COPYRIGHT "2002-2010 Haiku Inc.");
|
|
||||||
stringView->ResizeToPreferred();
|
|
||||||
AddChild(stringView);
|
|
||||||
|
|
||||||
if (maxWidth + 20 > Bounds().Width())
|
|
||||||
ResizeTo(maxWidth + 20, Bounds().Height());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ ConfigView::ConfigView(uint32 flags)
|
|||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
BStringView *fTitle = new BStringView("title",
|
BStringView *titleView = new BStringView("title",
|
||||||
B_TRANSLATE("EXR image translator"));
|
B_TRANSLATE("EXR image translator"));
|
||||||
fTitle->SetFont(be_bold_font);
|
titleView->SetFont(be_bold_font);
|
||||||
|
|
||||||
char version[256];
|
char version[256];
|
||||||
sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
|
sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
|
||||||
@@ -36,32 +36,30 @@ ConfigView::ConfigView(uint32 flags)
|
|||||||
int(B_TRANSLATION_MINOR_VERSION(EXR_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MINOR_VERSION(EXR_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_REVISION_VERSION(EXR_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_REVISION_VERSION(EXR_TRANSLATOR_VERSION)),
|
||||||
__DATE__);
|
__DATE__);
|
||||||
BStringView *fVersion = new BStringView("version", version);
|
BStringView *versionView = new BStringView("version", version);
|
||||||
|
|
||||||
BStringView *fCopyright = new BStringView("copyright",
|
BStringView *copyrightView = new BStringView("copyright",
|
||||||
B_UTF8_COPYRIGHT "2008 Haiku Inc.");
|
B_UTF8_COPYRIGHT "2008 Haiku Inc.");
|
||||||
|
|
||||||
BStringView *fCopyright2 = new BStringView("copyright2",
|
BStringView *copyrightView2 = new BStringView("copyright2",
|
||||||
B_TRANSLATE("Based on OpenEXR (http://www.openexr.com)"));
|
B_TRANSLATE("Based on OpenEXR (http://www.openexr.com)"));
|
||||||
|
|
||||||
BStringView *fCopyright3 = new BStringView("copyright3",
|
BStringView *copyrightView3 = new BStringView("copyright3",
|
||||||
B_UTF8_COPYRIGHT "2006, Industrial Light & Magic,");
|
B_UTF8_COPYRIGHT "2006, Industrial Light & Magic,");
|
||||||
|
|
||||||
BStringView *fCopyright4 = new BStringView("copyright4",
|
BStringView *copyrightView4 = new BStringView("copyright4",
|
||||||
B_TRANSLATE("a division of Lucasfilm Entertainment Company Ltd"));
|
B_TRANSLATE("a division of Lucasfilm Entertainment Company Ltd"));
|
||||||
|
|
||||||
// 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(titleView)
|
||||||
.Add(fVersion)
|
.Add(versionView)
|
||||||
|
.Add(copyrightView)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.Add(fCopyright)
|
.Add(copyrightView2)
|
||||||
.Add(fCopyright2)
|
.Add(copyrightView3)
|
||||||
.AddGlue()
|
.Add(copyrightView4);
|
||||||
.Add(fCopyright3)
|
|
||||||
.Add(fCopyright4)
|
|
||||||
.AddGlue();
|
|
||||||
|
|
||||||
BFont font;
|
BFont font;
|
||||||
GetFont(&font);
|
GetFont(&font);
|
||||||
|
|||||||
@@ -9,8 +9,9 @@
|
|||||||
#include "PCXTranslator.h"
|
#include "PCXTranslator.h"
|
||||||
|
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <StringView.h>
|
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
|
#include <LayoutBuilder.h>
|
||||||
|
#include <StringView.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -25,35 +26,25 @@ ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
|
|||||||
{
|
{
|
||||||
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("PCX image translator"));
|
B_TRANSLATE("PCX image translator"));
|
||||||
stringView->SetFont(be_bold_font);
|
titleView->SetFont(be_bold_font);
|
||||||
stringView->ResizeToPreferred();
|
|
||||||
AddChild(stringView);
|
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 10);
|
|
||||||
char version[256];
|
char version[256];
|
||||||
sprintf(version, B_TRANSLATE("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)),
|
||||||
__DATE__);
|
__DATE__);
|
||||||
stringView = new BStringView(rect, "version", version);
|
BStringView *versionView = new BStringView("version", version);
|
||||||
stringView->ResizeToPreferred();
|
BStringView *copyrightView = new BStringView("copyright", B_UTF8_COPYRIGHT "2008 Haiku Inc.");
|
||||||
AddChild(stringView);
|
|
||||||
|
|
||||||
GetFontHeight(&fontHeight);
|
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||||
height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||||
|
.Add(titleView)
|
||||||
rect.OffsetBy(0, height + 5);
|
.Add(versionView)
|
||||||
stringView = new BStringView(rect, "copyright", B_UTF8_COPYRIGHT "2008 Haiku Inc.");
|
.Add(copyrightView)
|
||||||
stringView->ResizeToPreferred();
|
.AddGlue();
|
||||||
AddChild(stringView);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,16 +48,14 @@ ConfigView::ConfigView(uint32 flags)
|
|||||||
B_UTF8_COPYRIGHT "1997-2007 Dave Coffin");
|
B_UTF8_COPYRIGHT "1997-2007 Dave Coffin");
|
||||||
|
|
||||||
// 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)
|
||||||
.AddGlue()
|
|
||||||
.Add(fVersion)
|
.Add(fVersion)
|
||||||
.Add(fCopyright)
|
.Add(fCopyright)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.Add(fCopyright2)
|
.Add(fCopyright2)
|
||||||
.Add(fCopyright3)
|
.Add(fCopyright3);
|
||||||
.AddGlue();
|
|
||||||
|
|
||||||
BFont font;
|
BFont font;
|
||||||
GetFont(&font);
|
GetFont(&font);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "RTFTranslator.h"
|
#include "RTFTranslator.h"
|
||||||
|
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
|
#include <LayoutBuilder.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -21,44 +22,26 @@ ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
|
|||||||
{
|
{
|
||||||
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("Rich Text Format (RTF) translator"));
|
B_TRANSLATE("Rich Text Format (RTF) 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), B_TRANSLATE("Version %d.%d.%d, %s"),
|
snprintf(version, sizeof(version), B_TRANSLATE("Version %d.%d.%d, %s"),
|
||||||
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(RTF_TRANSLATOR_VERSION)),
|
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(RTF_TRANSLATOR_VERSION)),
|
||||||
static_cast<int>(B_TRANSLATION_MINOR_VERSION(RTF_TRANSLATOR_VERSION)),
|
static_cast<int>(B_TRANSLATION_MINOR_VERSION(RTF_TRANSLATOR_VERSION)),
|
||||||
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
|
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
|
||||||
RTF_TRANSLATOR_VERSION)), __DATE__);
|
RTF_TRANSLATOR_VERSION)), __DATE__);
|
||||||
stringView = new BStringView(rect, "version", version);
|
BStringView *versionView = new BStringView("version", version);
|
||||||
stringView->ResizeToPreferred();
|
BStringView *copyrightView = new BStringView(
|
||||||
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 "2004-2006 Haiku Inc.");
|
"Copyright", B_UTF8_COPYRIGHT "2004-2006 Haiku Inc.");
|
||||||
stringView->ResizeToPreferred();
|
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||||
AddChild(stringView);
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||||
|
.Add(titleView)
|
||||||
if (maxWidth + 20 > Bounds().Width())
|
.Add(versionView)
|
||||||
ResizeTo(maxWidth + 20, Bounds().Height());
|
.Add(copyrightView)
|
||||||
|
.AddGlue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user