[haiku-commits] haiku: hrev49089 - in src/add-ons/translators: bmp rtf exr pcx raw

  • From: janus2@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 22 Apr 2015 18:45:14 +0200 (CEST)

hrev49089 adds 2 changesets to branch 'master'
old head: 83b9ad27c9168e8703ad6e6ade66f1e1dc820b50
new head: b70b9a384db2834b972371b69cc7420637188453
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=b70b9a384db2+%5E83b9ad27c916

----------------------------------------------------------------------------

5871779df8f5: DataTranslations: sort translator list.

* Fixes #10353.

b70b9a384db2: DataTranslations: use layout, standard format.

* Fix bmp, exr, pcx, raw.
* Partialy fixes #11999.

[ Janus <janus2@xxxxxxxxx> ]

----------------------------------------------------------------------------

6 files changed, 56 insertions(+), 101 deletions(-)
src/add-ons/translators/bmp/BMPView.cpp | 41 ++++++--------------
src/add-ons/translators/exr/ConfigView.cpp | 32 +++++++--------
src/add-ons/translators/pcx/ConfigView.cpp | 35 +++++++----------
src/add-ons/translators/raw/ConfigView.cpp | 8 ++--
src/add-ons/translators/rtf/ConfigView.cpp | 39 ++++++-------------
.../datatranslations/DataTranslationsWindow.cpp | 2 +

############################################################################

Commit: 5871779df8f5441b410d4c25070184f99d1c6b34
URL: http://cgit.haiku-os.org/haiku/commit/?id=5871779df8f5
Author: Janus <janus2@xxxxxxxxx>
Date: Wed Apr 22 16:24:27 2015 UTC

Ticket: https://dev.haiku-os.org/ticket/10353

DataTranslations: sort translator list.

* Fixes #10353.

----------------------------------------------------------------------------

diff --git a/src/preferences/datatranslations/DataTranslationsWindow.cpp
b/src/preferences/datatranslations/DataTranslationsWindow.cpp
index ff61147..2d71c40 100644
--- a/src/preferences/datatranslations/DataTranslationsWindow.cpp
+++ b/src/preferences/datatranslations/DataTranslationsWindow.cpp
@@ -103,6 +103,8 @@ DataTranslationsWindow::_PopulateListView()
maxWidth = std::max(maxWidth,
fTranslatorListView->StringWidth(name));
}

+ fTranslatorListView->SortItems();
+
fTranslatorListView->SetExplicitSize(BSize(maxWidth + 20,
B_SIZE_UNSET));

delete[] translators;

############################################################################

Revision: hrev49089
Commit: b70b9a384db2834b972371b69cc7420637188453
URL: http://cgit.haiku-os.org/haiku/commit/?id=b70b9a384db2
Author: Janus <janus2@xxxxxxxxx>
Date: Wed Apr 22 16:36:27 2015 UTC

Ticket: https://dev.haiku-os.org/ticket/11999

DataTranslations: use layout, standard format.

* Fix bmp, exr, pcx, raw.
* Partialy fixes #11999.

----------------------------------------------------------------------------

diff --git a/src/add-ons/translators/bmp/BMPView.cpp
b/src/add-ons/translators/bmp/BMPView.cpp
index 827e28a..c523cc5 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 <Catalog.h>
+#include <LayoutBuilder.h>
#include <StringView.h>

#include <stdio.h>
@@ -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);
-
- float maxWidth = stringView->Bounds().Width();
+ titleView->SetFont(be_bold_font);

- 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);
-
- 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());
+ BStringView *versionView = new BStringView("version", version);
+ BStringView *copyrightView = new BStringView("Copyright",
B_UTF8_COPYRIGHT "2002-2010 Haiku Inc.");
+
+ 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 1c10472..60fd78b 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 d772689..39056f3 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 <Catalog.h>
-#include <StringView.h>
#include <CheckBox.h>
+#include <LayoutBuilder.h>
+#include <StringView.h>

#include <stdio.h>
#include <string.h>
@@ -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);
-
- 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);
+ BStringView *versionView = new BStringView("version", version);
+ BStringView *copyrightView = new BStringView("copyright",
B_UTF8_COPYRIGHT "2008 Haiku Inc.");
+
+ 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 0608866..1d40564 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 55d44ed..4d80f27 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 <Catalog.h>
+#include <LayoutBuilder.h>
#include <StringView.h>

#include <stdio.h>
@@ -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<int>(B_TRANSLATION_MAJOR_VERSION(RTF_TRANSLATOR_VERSION)),

static_cast<int>(B_TRANSLATION_MINOR_VERSION(RTF_TRANSLATOR_VERSION)),
static_cast<int>(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();
}




Other related posts:

  • » [haiku-commits] haiku: hrev49089 - in src/add-ons/translators: bmp rtf exr pcx raw - janus2