hrev50174 adds 7 changesets to branch 'master'
old head: 8948853269b9641741d79905c86e578133bed237
new head: b90d36ccd650b99f5010c6637ec8ffe878bb2628
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=b90d36ccd650+%5E8948853269b9
----------------------------------------------------------------------------
613b939283c0: GIFTranslator: Make menu fields variable width
d712965dd0bd: PSDTranslator: Make menu fields variable width
d9975fafd8c2: WebPTranslator: Remove leading spaces
e465dcb609af: WebPTranslator: Make menu fields variable width
abfb31b6d0ee: WebPTranslator: style fixes only
571cffc10e1c: DataTranslation: Style fixes
b90d36ccd650: DataTranslations: Make window not resize
As you scroll through the list of translators keep the window width
constant by setting a minimum width. A little too narrow at 8pt,
and the window is too wide at 24pt, but at 12pt it is just right.
(at least for 1024x768).
The window width and height were not chosen arbitrarily, 598px
is just about 600px and almost exactly fits the width of our
widest translator (PNG translator). The height is 369px which comes
from the golden ratio of 1.62:1. The width of the translators are
set to exactly match this at 12pt font size. This way you don't get
any unexpected window resizing. At other font sizes the window does
resize, but, the contents still fit (mostly) nicely.
See screenshot for details:
http://insightfactory.tumblr.com/image/141980518317
[ John Scipione <jscipione@xxxxxxxxx> ]
----------------------------------------------------------------------------
5 files changed, 78 insertions(+), 44 deletions(-)
src/add-ons/translators/gif/GIFView.cpp | 12 +++-
src/add-ons/translators/psd/ConfigView.cpp | 10 +++-
src/add-ons/translators/webp/ConfigView.cpp | 15 +++--
src/add-ons/translators/webp/WebPTranslator.cpp | 27 ++++-----
.../datatranslations/DataTranslationsWindow.cpp | 58 ++++++++++++--------
############################################################################
Commit: 613b939283c0cf9bfc3b084fc91a6be94a047264
URL: http://cgit.haiku-os.org/haiku/commit/?id=613b939283c0
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Mon Mar 14 22:47:02 2016 UTC
GIFTranslator: Make menu fields variable width
----------------------------------------------------------------------------
diff --git a/src/add-ons/translators/gif/GIFView.cpp
b/src/add-ons/translators/gif/GIFView.cpp
index 8bd7c84..082af4b 100644
--- a/src/add-ons/translators/gif/GIFView.cpp
+++ b/src/add-ons/translators/gif/GIFView.cpp
@@ -163,10 +163,16 @@ GIFView::GIFView(TranslatorSettings* settings)
.AddGlue()
.AddGrid(10.0f, 5.0f)
.Add(fPaletteMF->CreateLabelLayoutItem(), 0, 0)
- .Add(fPaletteMF->CreateMenuBarLayoutItem(), 1, 0)
+ .AddGroup(B_HORIZONTAL, 0.0f, 1, 0)
+ .Add(fPaletteMF->CreateMenuBarLayoutItem(),
0.0f)
+ .AddGlue()
+ .End()
.Add(fColorCountMF->CreateLabelLayoutItem(), 0, 1)
- .Add(fColorCountMF->CreateMenuBarLayoutItem(), 1, 1)
- .End()
+ .AddGroup(B_HORIZONTAL, 0.0f, 1, 1)
+ .Add(fColorCountMF->CreateMenuBarLayoutItem(),
0.0f)
+ .AddGlue()
+ .End()
+ .End()
.AddStrut(B_USE_SMALL_SPACING)
.Add(fDitheringBox)
.Add(fInterlacedBox)
############################################################################
Commit: d712965dd0bd39e902de992e2bcd9860c69d200a
URL: http://cgit.haiku-os.org/haiku/commit/?id=d712965dd0bd
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Mon Mar 14 22:47:20 2016 UTC
PSDTranslator: Make menu fields variable width
----------------------------------------------------------------------------
diff --git a/src/add-ons/translators/psd/ConfigView.cpp
b/src/add-ons/translators/psd/ConfigView.cpp
index e380d46..3204bbf 100644
--- a/src/add-ons/translators/psd/ConfigView.cpp
+++ b/src/add-ons/translators/psd/ConfigView.cpp
@@ -80,9 +80,15 @@ ConfigView::ConfigView(TranslatorSettings *settings)
.AddGlue()
.AddGrid(10.0f, 5.0f)
.Add(fVersionField->CreateLabelLayoutItem(), 0, 0)
- .Add(fVersionField->CreateMenuBarLayoutItem(), 1, 0)
+ .AddGroup(B_HORIZONTAL, 0.0f, 1, 0)
+ .Add(fVersionField->CreateMenuBarLayoutItem(),
0.0f)
+ .AddGlue()
+ .End()
.Add(fCompressionField->CreateLabelLayoutItem(), 0, 1)
- .Add(fCompressionField->CreateMenuBarLayoutItem(), 1, 1)
+ .AddGroup(B_HORIZONTAL, 0.0f, 1, 1)
+
.Add(fCompressionField->CreateMenuBarLayoutItem(), 0.0f)
+ .AddGlue()
+ .End()
.End()
.AddGlue()
.Add(copyright2View);
############################################################################
Commit: d9975fafd8c2d78a28110ea2fc1df976ee425d43
URL: http://cgit.haiku-os.org/haiku/commit/?id=d9975fafd8c2
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Thu Mar 24 21:59:28 2016 UTC
WebPTranslator: Remove leading spaces
----------------------------------------------------------------------------
diff --git a/src/add-ons/translators/webp/WebPTranslator.cpp
b/src/add-ons/translators/webp/WebPTranslator.cpp
index d3592e8..5cc11a7 100644
--- a/src/add-ons/translators/webp/WebPTranslator.cpp
+++ b/src/add-ons/translators/webp/WebPTranslator.cpp
@@ -252,7 +252,7 @@ WebPTranslator::_TranslateFromBits(BPositionIO* stream,
BMessage* ioExtension,
if (!WebPPictureInit(&picture) || !WebPConfigInit(&config)) {
printf("Error! Version mismatch!\n");
- return B_ERROR;
+ return B_ERROR;
}
WebPPreset preset =
(WebPPreset)fSettings->SetGetInt32(WEBP_SETTING_PRESET);
@@ -268,7 +268,7 @@ WebPTranslator::_TranslateFromBits(BPositionIO* stream,
BMessage* ioExtension,
if (!WebPValidateConfig(&config)) {
printf("Error! Invalid configuration.\n");
- return B_ERROR;
+ return B_ERROR;
}
picture.width = bitsHeader.bounds.IntegerWidth() + 1;
############################################################################
Commit: e465dcb609af2ba845192d95b3f21ea89eab2893
URL: http://cgit.haiku-os.org/haiku/commit/?id=e465dcb609af
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Thu Mar 24 22:02:24 2016 UTC
WebPTranslator: Make menu fields variable width
----------------------------------------------------------------------------
diff --git a/src/add-ons/translators/webp/ConfigView.cpp
b/src/add-ons/translators/webp/ConfigView.cpp
index 45a1657..74a1040 100644
--- a/src/add-ons/translators/webp/ConfigView.cpp
+++ b/src/add-ons/translators/webp/ConfigView.cpp
@@ -124,7 +124,13 @@ ConfigView::ConfigView(TranslatorSettings* settings)
.Add(version)
.Add(copyrightView)
.AddGlue()
- .Add(presetsField)
+ .AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING)
+ .Add(presetsField->CreateLabelLayoutItem(), 0, 0)
+ .AddGroup(B_HORIZONTAL, 0.0f, 1, 0)
+ .Add(presetsField->CreateMenuBarLayoutItem(),
0.0f)
+ .AddGlue()
+ .End()
+ .End()
.Add(fQualitySlider)
.Add(fMethodSlider)
.Add(fPreprocessingCheckBox)
############################################################################
Commit: abfb31b6d0ee56c1165088f5a55f6953ddd75261
URL: http://cgit.haiku-os.org/haiku/commit/?id=abfb31b6d0ee
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Thu Mar 24 22:04:33 2016 UTC
WebPTranslator: style fixes only
----------------------------------------------------------------------------
diff --git a/src/add-ons/translators/webp/ConfigView.cpp
b/src/add-ons/translators/webp/ConfigView.cpp
index 74a1040..2f85ec8 100644
--- a/src/add-ons/translators/webp/ConfigView.cpp
+++ b/src/add-ons/translators/webp/ConfigView.cpp
@@ -52,7 +52,8 @@ static const struct preset_name {
ConfigView::ConfigView(TranslatorSettings* settings)
- : BGroupView(B_TRANSLATE("WebPTranslator Settings"), B_VERTICAL),
+ :
+ BGroupView(B_TRANSLATE("WebPTranslator Settings"), B_VERTICAL),
fSettings(settings)
{
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
@@ -140,8 +141,8 @@ ConfigView::ConfigView(TranslatorSettings* settings)
BFont font;
GetFont(&font);
- SetExplicitPreferredSize(BSize((font.Size() * 250)/12, (font.Size() *
350)/12));
-
+ SetExplicitPreferredSize(BSize((font.Size() * 250) / 12,
+ (font.Size() * 350) / 12));
}
diff --git a/src/add-ons/translators/webp/WebPTranslator.cpp
b/src/add-ons/translators/webp/WebPTranslator.cpp
index 5cc11a7..6f1f76e 100644
--- a/src/add-ons/translators/webp/WebPTranslator.cpp
+++ b/src/add-ons/translators/webp/WebPTranslator.cpp
@@ -110,13 +110,14 @@ const uint32 kNumDefaultSettings =
sizeof(sDefaultSettings) /
WebPTranslator::WebPTranslator()
- : BaseTranslator(B_TRANSLATE("WebP images"),
- B_TRANSLATE("WebP image translator"),
- WEBP_TRANSLATOR_VERSION,
- sInputFormats, kNumInputFormats,
- sOutputFormats, kNumOutputFormats,
- "WebPTranslator_Settings", sDefaultSettings,
kNumDefaultSettings,
- B_TRANSLATOR_BITMAP, WEBP_IMAGE_FORMAT)
+ :
+ BaseTranslator(B_TRANSLATE("WebP images"),
+ B_TRANSLATE("WebP image translator"),
+ WEBP_TRANSLATOR_VERSION,
+ sInputFormats, kNumInputFormats,
+ sOutputFormats, kNumOutputFormats,
+ "WebPTranslator_Settings", sDefaultSettings, kNumDefaultSettings,
+ B_TRANSLATOR_BITMAP, WEBP_IMAGE_FORMAT)
{
}
@@ -161,8 +162,8 @@ WebPTranslator::DerivedIdentify(BPositionIO* stream,
status_t
WebPTranslator::DerivedTranslate(BPositionIO* stream,
- const translator_info* info, BMessage* ioExtension,
- uint32 outType, BPositionIO* target, int32 baseType)
+ const translator_info* info, BMessage* ioExtension, uint32 outType,
+ BPositionIO* target, int32 baseType)
{
if (baseType == 1)
// if stream is in bits format
@@ -186,7 +187,7 @@ WebPTranslator::NewConfigView(TranslatorSettings* settings)
status_t
WebPTranslator::_TranslateFromBits(BPositionIO* stream, BMessage* ioExtension,
- uint32 outType, BPositionIO* target)
+ uint32 outType, BPositionIO* target)
{
if (!outType)
outType = WEBP_IMAGE_FORMAT;
@@ -309,7 +310,7 @@ WebPTranslator::_TranslateFromBits(BPositionIO* stream,
BMessage* ioExtension,
status_t
WebPTranslator::_TranslateFromWebP(BPositionIO* stream, BMessage* ioExtension,
- uint32 outType, BPositionIO* target)
+ uint32 outType, BPositionIO* target)
{
if (!outType)
outType = B_TRANSLATOR_BITMAP;
############################################################################
Commit: 571cffc10e1cb1356ab87ad45aa2ba20d3ff98c8
URL: http://cgit.haiku-os.org/haiku/commit/?id=571cffc10e1c
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Thu Mar 24 22:51:50 2016 UTC
DataTranslation: Style fixes
----------------------------------------------------------------------------
diff --git a/src/preferences/datatranslations/DataTranslationsWindow.cpp
b/src/preferences/datatranslations/DataTranslationsWindow.cpp
index 6382a11..bf00221 100644
--- a/src/preferences/datatranslations/DataTranslationsWindow.cpp
+++ b/src/preferences/datatranslations/DataTranslationsWindow.cpp
@@ -52,9 +52,10 @@ const uint32 kMsgSelectedTranslator = 'trsl';
DataTranslationsWindow::DataTranslationsWindow()
:
- BWindow(BRect(0, 0, 550, 350),
B_TRANSLATE_SYSTEM_NAME("DataTranslations"),
- B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
- | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS),
+ BWindow(BRect(0.0f, 0.0f, 550.0f, 350.0f),
+ B_TRANSLATE_SYSTEM_NAME("DataTranslations"),
+ B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE
+ | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
fRelease(NULL)
{
MoveTo(DataTranslationsSettings::Instance()->WindowCorner());
@@ -149,7 +150,7 @@ DataTranslationsWindow::_ShowConfigView(int32 id)
BTranslatorRoster* roster = BTranslatorRoster::Default();
- if (fConfigView) {
+ if (fConfigView != NULL) {
fRightBox->RemoveChild(fConfigView);
delete fConfigView;
fConfigView = NULL;
@@ -159,13 +160,13 @@ DataTranslationsWindow::_ShowConfigView(int32 id)
}
}
- BMessage emptyMsg;
- BRect rect(0, 0, 200, 233);
- status_t ret = roster->MakeConfigurationView(id, &emptyMsg,
+ BMessage emptyMessage;
+ BRect rect(0.0f, 0.0f, 200.0f, 233.0f);
+ status_t result = roster->MakeConfigurationView(id, &emptyMessage,
&fConfigView, &rect);
- if (ret != B_OK)
- return ret;
+ if (result != B_OK)
+ return result;
fConfigView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
// force config views to all have the same color
@@ -182,7 +183,7 @@ DataTranslationsWindow::_ShowConfigView(int32 id)
void
DataTranslationsWindow::_ShowInfoView()
{
- if (fConfigView) {
+ if (fConfigView != NULL) {
fRightBox->RemoveChild(fConfigView);
delete fConfigView;
fConfigView = NULL;
@@ -190,7 +191,6 @@ DataTranslationsWindow::_ShowInfoView()
fRelease->Release();
fRelease = NULL;
}
-
}
fInfoText = new BTextView("info text");
@@ -232,7 +232,7 @@ DataTranslationsWindow::_SetupViews()
// Box around the config and info panels
fRightBox = new BBox("Right_Side");
fRightBox->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
- B_ALIGN_USE_FULL_HEIGHT));
+ B_ALIGN_USE_FULL_HEIGHT));
// Add the translator icon view
fIconView = new IconView();
@@ -361,19 +361,21 @@ DataTranslationsWindow::MessageReceived(BMessage* message)
case B_COLORS_UPDATED:
{
- if (fInfoText == NULL
- || fInfoText->Parent() == NULL)
+ if (fInfoText == NULL || fInfoText->Parent() == NULL)
break;
rgb_color color;
- if
(message->FindColor(ui_color_name(B_PANEL_TEXT_COLOR), &color) == B_OK)
+ if
(message->FindColor(ui_color_name(B_PANEL_TEXT_COLOR), &color)
+ == B_OK) {
fInfoText->SetFontAndColor(be_plain_font,
B_FONT_ALL, &color);
+ }
break;
}
case B_TRANSLATOR_ADDED:
{
- int32 index = 0, id;
+ int32 index = 0;
+ int32 id;
while (message->FindInt32("translator_id", index++,
&id) == B_OK) {
const char* name;
const char* info;
@@ -389,7 +391,8 @@ DataTranslationsWindow::MessageReceived(BMessage* message)
case B_TRANSLATOR_REMOVED:
{
- int32 index = 0, id;
+ int32 index = 0;
+ int32 id;
while (message->FindInt32("translator_id", index++,
&id) == B_OK) {
for (int32 i = 0; i <
fTranslatorListView->CountItems(); i++) {
TranslatorItem* item =
fTranslatorListView->TranslatorAt(i);
############################################################################
Revision: hrev50174
Commit: b90d36ccd650b99f5010c6637ec8ffe878bb2628
URL: http://cgit.haiku-os.org/haiku/commit/?id=b90d36ccd650
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Thu Mar 24 23:01:31 2016 UTC
DataTranslations: Make window not resize
As you scroll through the list of translators keep the window width
constant by setting a minimum width. A little too narrow at 8pt,
and the window is too wide at 24pt, but at 12pt it is just right.
(at least for 1024x768).
The window width and height were not chosen arbitrarily, 598px
is just about 600px and almost exactly fits the width of our
widest translator (PNG translator). The height is 369px which comes
from the golden ratio of 1.62:1. The width of the translators are
set to exactly match this at 12pt font size. This way you don't get
any unexpected window resizing. At other font sizes the window does
resize, but, the contents still fit (mostly) nicely.
See screenshot for details:
http://insightfactory.tumblr.com/image/141980518317
----------------------------------------------------------------------------
diff --git a/src/preferences/datatranslations/DataTranslationsWindow.cpp
b/src/preferences/datatranslations/DataTranslationsWindow.cpp
index bf00221..0ba3615 100644
--- a/src/preferences/datatranslations/DataTranslationsWindow.cpp
+++ b/src/preferences/datatranslations/DataTranslationsWindow.cpp
@@ -13,6 +13,8 @@
#include "DataTranslationsWindow.h"
#include <algorithm>
+
+#include <math.h>
#include <stdio.h>
#include <Alert.h>
@@ -52,7 +54,7 @@ const uint32 kMsgSelectedTranslator = 'trsl';
DataTranslationsWindow::DataTranslationsWindow()
:
- BWindow(BRect(0.0f, 0.0f, 550.0f, 350.0f),
+ BWindow(BRect(0.0f, 0.0f, 597.0f, 368.0f),
B_TRANSLATE_SYSTEM_NAME("DataTranslations"),
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE
| B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
@@ -172,6 +174,11 @@ DataTranslationsWindow::_ShowConfigView(int32 id)
// force config views to all have the same color
fRightBox->AddChild(fConfigView);
+ // for default 12pt font size: 597 ≈ (0.85 * 12 * 49)
+ fConfigView->SetExplicitMinSize(
+ BSize(ceilf(be_control_look->DefaultItemSpacing() * 49)
+ - fTranslatorListView->Frame().Width(), B_SIZE_UNSET));
+
// Make sure the translator's image doesn't get unloaded while we are
still
// showing a config view whose code is in the image
fRelease = roster->AcquireTranslator(id);
@@ -250,11 +257,15 @@ DataTranslationsWindow::_SetupViews()
BLayoutBuilder::Group<>(this, B_HORIZONTAL)
.SetInsets(B_USE_WINDOW_SPACING)
.Add(scrollView, 3)
- .AddGrid(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, 6)
- .SetInsets(0, 0, 0, 0)
- .Add(fRightBox, 0, 0, 3, 1)
- .Add(fIconView, 0, 1)
- .Add(fButton, 2, 1);
+ .AddGroup(B_VERTICAL)
+ .Add(fRightBox)
+ .AddGroup(B_HORIZONTAL)
+ .Add(fIconView)
+ .AddGlue()
+ .Add(fButton)
+ .End()
+ .End()
+ .End();
fTranslatorListView->MakeFocus();
_ShowInfoView();