Apply patch from Maxime Simon to make several translators use the Layout API.

There are a few small changes from myself, such as adding a copyright for
Maxime in files with bigger changes. Also because this patch was so old I had
to do some manual patching, and added back the title and description on the TGA
and TIFF translators.

I think this improves things a lot, though there is still some work to do to
improve the consistency of the translator settings views.

I think this mostly fixes #2117, though I may leave the ticket open until a few
more things are resolved.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35769 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ryan Leavengood
2010-03-06 04:45:43 +00:00
parent 5737a67d71
commit a76f629efa
25 changed files with 353 additions and 365 deletions
+38 -31
View File
@@ -1,6 +1,7 @@
/*
* Copyright 2008, Jérôme Duval. All rights reserved.
* Copyright 2005-2007, Axel Dörfler, [email protected]. All rights reserved.
* Copyright 2009, Maxime Simon, [email protected]. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@@ -10,57 +11,63 @@
#include <StringView.h>
#include <CheckBox.h>
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
#include <SpaceLayoutItem.h>
#include <stdio.h>
#include <string.h>
ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
: BView(frame, "EXRTranslator Settings", resize, flags)
ConfigView::ConfigView(uint32 flags)
: BView("EXRTranslator Settings", flags)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
font_height fontHeight;
be_bold_font->GetHeight(&fontHeight);
float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
BStringView *fTitle = new BStringView("title", "EXR Images");
fTitle->SetFont(be_bold_font);
BRect rect(10, 10, 200, 10 + height);
BStringView *stringView = new BStringView(rect, "title", "EXR images");
stringView->SetFont(be_bold_font);
stringView->ResizeToPreferred();
AddChild(stringView);
rect.OffsetBy(0, height + 10);
char version[256];
sprintf(version, "Version %d.%d.%d, %s",
int(B_TRANSLATION_MAJOR_VERSION(EXR_TRANSLATOR_VERSION)),
int(B_TRANSLATION_MINOR_VERSION(EXR_TRANSLATOR_VERSION)),
int(B_TRANSLATION_REVISION_VERSION(EXR_TRANSLATOR_VERSION)),
__DATE__);
stringView = new BStringView(rect, "version", version);
stringView->ResizeToPreferred();
AddChild(stringView);
BStringView *fVersion = new BStringView("version", version);
GetFontHeight(&fontHeight);
height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
BStringView *fCopyright = new BStringView("copyright",
B_UTF8_COPYRIGHT "2008 Haiku Inc.");
rect.OffsetBy(0, height + 5);
stringView = new BStringView(rect, "copyright", B_UTF8_COPYRIGHT "2008 Haiku Inc.");
stringView->ResizeToPreferred();
AddChild(stringView);
BStringView *fCopyright2 = new BStringView("copyright2",
"Based on OpenEXR (http://www.openexr.com)");
rect.OffsetBy(0, height + 10);
stringView = new BStringView(rect, "copyright2", "Based on OpenEXR (http://www.openexr.com)");
stringView->ResizeToPreferred();
AddChild(stringView);
BStringView *fCopyright3 = new BStringView("copyright3",
B_UTF8_COPYRIGHT "2006, Industrial Light & Magic,");
rect.OffsetBy(0, height + 5);
stringView = new BStringView(rect, "copyright3", B_UTF8_COPYRIGHT "2006, Industrial Light & Magic, a division of Lucasfilm "
"Entertainment Company Ltd");
stringView->ResizeToPreferred();
AddChild(stringView);
BStringView *fCopyright4 = new BStringView("copyright4",
"a division of Lucasfilm Entertainment Company Ltd");
// Build the layout
SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 7)
.Add(fTitle)
.Add(fVersion)
.AddGlue()
.Add(fCopyright)
.Add(fCopyright2)
.AddGlue()
.Add(fCopyright3)
.Add(fCopyright4)
.AddGlue()
.SetInsets(5, 5, 5, 5)
);
BFont font;
GetFont(&font);
SetExplicitPreferredSize(BSize((font.Size() * 400)/12, (font.Size() * 200)/12));
}
ConfigView::~ConfigView()
{