diff --git a/src/add-ons/translators/bmp/BMPView.cpp b/src/add-ons/translators/bmp/BMPView.cpp index 827e28a7e8..c523cc5718 100644 --- a/src/add-ons/translators/bmp/BMPView.cpp +++ b/src/add-ons/translators/bmp/BMPView.cpp @@ -14,6 +14,7 @@ #include "BMPTranslator.h" #include +#include #include #include @@ -29,43 +30,25 @@ BMPView::BMPView(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("BMP image 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), B_TRANSLATE("Version %d.%d.%d, %s"), int(B_TRANSLATION_MAJOR_VERSION(BMP_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(BMP_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(BMP_TRANSLATOR_VERSION)), __DATE__); - stringView = new BStringView(rect, "version", version); - stringView->ResizeToPreferred(); - AddChild(stringView); + BStringView *versionView = new BStringView("version", version); + BStringView *copyrightView = new BStringView("Copyright", B_UTF8_COPYRIGHT "2002-2010 Haiku Inc."); - 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-2010 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(); } diff --git a/src/add-ons/translators/exr/ConfigView.cpp b/src/add-ons/translators/exr/ConfigView.cpp index 1c10472677..60fd78baa9 100644 --- a/src/add-ons/translators/exr/ConfigView.cpp +++ b/src/add-ons/translators/exr/ConfigView.cpp @@ -26,9 +26,9 @@ ConfigView::ConfigView(uint32 flags) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - BStringView *fTitle = new BStringView("title", + BStringView *titleView = new BStringView("title", B_TRANSLATE("EXR image translator")); - fTitle->SetFont(be_bold_font); + titleView->SetFont(be_bold_font); char version[256]; 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_REVISION_VERSION(EXR_TRANSLATOR_VERSION)), __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."); - BStringView *fCopyright2 = new BStringView("copyright2", + BStringView *copyrightView2 = new BStringView("copyright2", 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,"); - BStringView *fCopyright4 = new BStringView("copyright4", + BStringView *copyrightView4 = new BStringView("copyright4", B_TRANSLATE("a division of Lucasfilm Entertainment Company Ltd")); // Build the layout - BLayoutBuilder::Group<>(this, B_VERTICAL, 7) - .SetInsets(5) - .Add(fTitle) - .Add(fVersion) + BLayoutBuilder::Group<>(this, B_VERTICAL, 0) + .SetInsets(B_USE_DEFAULT_SPACING) + .Add(titleView) + .Add(versionView) + .Add(copyrightView) .AddGlue() - .Add(fCopyright) - .Add(fCopyright2) - .AddGlue() - .Add(fCopyright3) - .Add(fCopyright4) - .AddGlue(); + .Add(copyrightView2) + .Add(copyrightView3) + .Add(copyrightView4); BFont font; GetFont(&font); diff --git a/src/add-ons/translators/pcx/ConfigView.cpp b/src/add-ons/translators/pcx/ConfigView.cpp index d772689f29..39056f3844 100644 --- a/src/add-ons/translators/pcx/ConfigView.cpp +++ b/src/add-ons/translators/pcx/ConfigView.cpp @@ -9,8 +9,9 @@ #include "PCXTranslator.h" #include -#include #include +#include +#include #include #include @@ -25,35 +26,25 @@ ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags) { 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("PCX image translator")); - stringView->SetFont(be_bold_font); - stringView->ResizeToPreferred(); - AddChild(stringView); + titleView->SetFont(be_bold_font); - rect.OffsetBy(0, height + 10); char version[256]; sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"), int(B_TRANSLATION_MAJOR_VERSION(PCX_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(PCX_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(PCX_TRANSLATOR_VERSION)), __DATE__); - stringView = new BStringView(rect, "version", version); - stringView->ResizeToPreferred(); - AddChild(stringView); + BStringView *versionView = new BStringView("version", version); + BStringView *copyrightView = new BStringView("copyright", B_UTF8_COPYRIGHT "2008 Haiku Inc."); - GetFontHeight(&fontHeight); - height = fontHeight.descent + fontHeight.ascent + fontHeight.leading; - - rect.OffsetBy(0, height + 5); - stringView = new BStringView(rect, "copyright", B_UTF8_COPYRIGHT "2008 Haiku Inc."); - stringView->ResizeToPreferred(); - AddChild(stringView); + BLayoutBuilder::Group<>(this, B_VERTICAL, 0) + .SetInsets(B_USE_DEFAULT_SPACING) + .Add(titleView) + .Add(versionView) + .Add(copyrightView) + .AddGlue(); } diff --git a/src/add-ons/translators/raw/ConfigView.cpp b/src/add-ons/translators/raw/ConfigView.cpp index 060886604b..1d4056484f 100644 --- a/src/add-ons/translators/raw/ConfigView.cpp +++ b/src/add-ons/translators/raw/ConfigView.cpp @@ -48,16 +48,14 @@ ConfigView::ConfigView(uint32 flags) B_UTF8_COPYRIGHT "1997-2007 Dave Coffin"); // Build the layout - BLayoutBuilder::Group<>(this, B_VERTICAL, 7) - .SetInsets(5) + BLayoutBuilder::Group<>(this, B_VERTICAL, 0) + .SetInsets(B_USE_DEFAULT_SPACING) .Add(fTitle) - .AddGlue() .Add(fVersion) .Add(fCopyright) .AddGlue() .Add(fCopyright2) - .Add(fCopyright3) - .AddGlue(); + .Add(fCopyright3); BFont font; GetFont(&font); diff --git a/src/add-ons/translators/rtf/ConfigView.cpp b/src/add-ons/translators/rtf/ConfigView.cpp index 55d44ed2b2..4d80f27a78 100644 --- a/src/add-ons/translators/rtf/ConfigView.cpp +++ b/src/add-ons/translators/rtf/ConfigView.cpp @@ -8,6 +8,7 @@ #include "RTFTranslator.h" #include +#include #include #include @@ -21,44 +22,26 @@ ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags) { 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("Rich Text Format (RTF) 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), B_TRANSLATE("Version %d.%d.%d, %s"), static_cast(B_TRANSLATION_MAJOR_VERSION(RTF_TRANSLATOR_VERSION)), static_cast(B_TRANSLATION_MINOR_VERSION(RTF_TRANSLATOR_VERSION)), static_cast(B_TRANSLATION_REVISION_VERSION( RTF_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, + BStringView *versionView = new BStringView("version", version); + BStringView *copyrightView = new BStringView( "Copyright", B_UTF8_COPYRIGHT "2004-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(); }