hrev45726 adds 6 changesets to branch 'master' old head: 14701d3ec941382b6c9543d9d15be7c5aecb1f6e new head: 19d9ad49ae52b561d8600ee27c73e9352d2f37b9 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=19d9ad4+%5E14701d3 ---------------------------------------------------------------------------- 44efd20: SGITranslator: style fixes for SGIView 16ccdab: TIFFTranslator: Style fixes to TIFFView 7f4dce0: TIFFTranslator: Sentence case Use compression dc674f5: SGITranslator: Resize menu field to preferred width ... when the window is first activated. Unfortunately the preferred width has not been set until after the window is shown so we can't do the work in AllAttached(). d9dae4d: TIFFTranslator: Resize menu field to preferred width. 19d9ad4: Backgrounds: Resize menu fields to preferred width. Also a few other related changes: * Update the copyright year in header and add my name. * Use font aware spacing units in layout constructor. * Align the fIconLabelOutline check box with the menu fields instead of the menu field labels. [ John Scipione <jscipione@xxxxxxxxx> ] ---------------------------------------------------------------------------- 6 files changed, 160 insertions(+), 202 deletions(-) src/add-ons/translators/sgi/SGIView.cpp | 100 +++++--------- src/add-ons/translators/sgi/SGIView.h | 27 ++-- src/add-ons/translators/tiff/TIFFView.cpp | 141 ++++++++------------ src/add-ons/translators/tiff/TIFFView.h | 32 ++--- src/preferences/backgrounds/BackgroundsView.cpp | 49 ++++--- src/preferences/backgrounds/BackgroundsView.h | 13 +- ############################################################################ Commit: 44efd205810cc1e126ebb4f328d8961853812368 URL: http://cgit.haiku-os.org/haiku/commit/?id=44efd20 Author: John Scipione <jscipione@xxxxxxxxx> Date: Thu May 30 21:19:44 2013 UTC SGITranslator: style fixes for SGIView ---------------------------------------------------------------------------- diff --git a/src/add-ons/translators/sgi/SGIView.cpp b/src/add-ons/translators/sgi/SGIView.cpp index aab1590..1c2a7ba 100644 --- a/src/add-ons/translators/sgi/SGIView.cpp +++ b/src/add-ons/translators/sgi/SGIView.cpp @@ -30,6 +30,9 @@ // DEALINGS IN THE SOFTWARE. /*****************************************************************************/ + +#include "SGIView.h" + #include <stdio.h> #include <string.h> @@ -46,13 +49,14 @@ #include "SGIImage.h" #include "SGITranslator.h" -#include "SGIView.h" + const char* author = "Stephan Aßmus, <stippi@xxxxxxxxxxxxxxx>"; #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "SGIView" + // add_menu_item void add_menu_item(BMenu* menu, @@ -67,19 +71,7 @@ add_menu_item(BMenu* menu, menu->AddItem(item); } -// --------------------------------------------------------------- -// Constructor -// -// Sets up the view settings -// -// Preconditions: -// -// Parameters: -// -// Postconditions: -// -// Returns: -// --------------------------------------------------------------- + SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings) : BView(name, flags, new BGroupLayout(B_VERTICAL)), @@ -92,16 +84,16 @@ SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings) // create the menu items with the various compression methods add_menu_item(menu, SGI_COMP_NONE, B_TRANSLATE("None"), currentCompression); -// menu->AddSeparatorItem(); + //menu->AddSeparatorItem(); add_menu_item(menu, SGI_COMP_RLE, B_TRANSLATE("RLE"), currentCompression); -// DON'T turn this on, it's so slow that I didn't wait long enough -// the one time I tested this. So I don't know if the code even works. -// Supposedly, this would look for an already written scanline, and -// modify the scanline tables so that the current row is not written -// at all... + // DON'T turn this on, it's so slow that I didn't wait long enough + // the one time I tested this. So I don't know if the code even works. + // Supposedly, this would look for an already written scanline, and + // modify the scanline tables so that the current row is not written + // at all... -// add_menu_item(menu, SGI_COMP_ARLE, "Agressive RLE", currentCompression); + //add_menu_item(menu, SGI_COMP_ARLE, "Agressive RLE", currentCompression); fCompressionMF = new BMenuField("compression", B_TRANSLATE("Use compression:"), menu); @@ -144,8 +136,8 @@ SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings) BFont font; GetFont(&font); - SetExplicitPreferredSize( - BSize((font.Size() * 390) / 12, (font.Size() * 180) / 12)); + SetExplicitPreferredSize(BSize((font.Size() * 390) / 12, + (font.Size() * 180) / 12)); // TODO: remove this workaround for ticket #4217 infoView->SetExplicitPreferredSize( @@ -155,37 +147,19 @@ SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings) } -// --------------------------------------------------------------- -// Destructor -// -// Does nothing -// -// Preconditions: -// -// Parameters: -// -// Postconditions: -// -// Returns: -// --------------------------------------------------------------- SGIView::~SGIView() { fSettings->Release(); } -// --------------------------------------------------------------- -// MessageReceived -// -// Handles state changes of the Compression menu field -// -// Preconditions: -// -// Parameters: area, not used -// -// Postconditions: -// -// Returns: -// --------------------------------------------------------------- + +void +SGIView::AllAttached() +{ + fCompressionMF->Menu()->SetTargetForItems(this); +} + + void SGIView::MessageReceived(BMessage* message) { @@ -203,23 +177,3 @@ SGIView::MessageReceived(BMessage* message) BView::MessageReceived(message); } } - -// --------------------------------------------------------------- -// AllAttached -// -// sets the target for the controls controlling the configuration -// -// Preconditions: -// -// Parameters: area, not used -// -// Postconditions: -// -// Returns: -// --------------------------------------------------------------- -void -SGIView::AllAttached() -{ - fCompressionMF->Menu()->SetTargetForItems(this); -} - diff --git a/src/add-ons/translators/sgi/SGIView.h b/src/add-ons/translators/sgi/SGIView.h index c90797d..c3ebda9 100644 --- a/src/add-ons/translators/sgi/SGIView.h +++ b/src/add-ons/translators/sgi/SGIView.h @@ -29,36 +29,38 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. /*****************************************************************************/ - #ifndef SGIVIEW_H #define SGIVIEW_H + #include <View.h> #include "TranslatorSettings.h" + class BMenuField; + class SGIView : public BView { public: - SGIView(const char* name, uint32 flags, TranslatorSettings* settings); - // sets up the view - - ~SGIView(); - // releases the SGITranslator settings + SGIView(const char* name, uint32 flags, TranslatorSettings* settings); + // sets up the view + + ~SGIView(); + // releases the SGITranslator settings - virtual void AllAttached(); - virtual void MessageReceived(BMessage* message); + virtual void AllAttached(); + virtual void MessageReceived(BMessage* message); enum { MSG_COMPRESSION_CHANGED = 'cmch', }; private: - BMenuField* fCompressionMF; + BMenuField* fCompressionMF; - TranslatorSettings* fSettings; - // the actual settings for the translator, - // shared with the translator + TranslatorSettings* fSettings; + // the actual settings for the translator, shared with the translator }; + #endif // #ifndef SGIVIEW_H ############################################################################ Commit: 16ccdab9c9b6bd1a6912abfda2d6e24af5efd005 URL: http://cgit.haiku-os.org/haiku/commit/?id=16ccdab Author: John Scipione <jscipione@xxxxxxxxx> Date: Thu May 30 21:24:37 2013 UTC TIFFTranslator: Style fixes to TIFFView ---------------------------------------------------------------------------- diff --git a/src/add-ons/translators/tiff/TIFFView.cpp b/src/add-ons/translators/tiff/TIFFView.cpp index 9b845ab..329dc93 100644 --- a/src/add-ons/translators/tiff/TIFFView.cpp +++ b/src/add-ons/translators/tiff/TIFFView.cpp @@ -30,6 +30,9 @@ // DEALINGS IN THE SOFTWARE. /*****************************************************************************/ + +#include "TIFFView.h" + #include <stdio.h> #include <string.h> @@ -46,7 +49,6 @@ #include "TIFFTranslator.h" #include "TranslatorSettings.h" -#include "TIFFView.h" #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "TIFFView" @@ -66,22 +68,11 @@ add_menu_item(BMenu* menu, menu->AddItem(item); } -// --------------------------------------------------------------- -// Constructor -// -// Sets up the view settings -// -// Preconditions: -// -// Parameters: -// -// Postconditions: -// -// Returns: -// --------------------------------------------------------------- -TIFFView::TIFFView(const char *name, uint32 flags, - TranslatorSettings *settings) - : BView(name, flags) + +TIFFView::TIFFView(const char* name, uint32 flags, + TranslatorSettings* settings) + : + BView(name, flags) { fSettings = settings; @@ -102,12 +93,12 @@ TIFFView::TIFFView(const char *name, uint32 flags, int16 i = 1; fLibTIFF[0] = new BStringView(NULL, B_TRANSLATE("TIFF Library:")); char libtiff[] = TIFFLIB_VERSION_STR; - char *tok = strtok(libtiff, "\n"); - while (i < 5 && tok) { + char* tok = strtok(libtiff, "\n"); + while (i < 5 && tok) { fLibTIFF[i] = new BStringView(NULL, tok); tok = strtok(NULL, "\n"); i++; - } + } BPopUpMenu* menu = new BPopUpMenu("pick compression"); @@ -123,66 +114,54 @@ TIFFView::TIFFView(const char *name, uint32 flags, add_menu_item(menu, COMPRESSION_LZW, B_TRANSLATE("LZW"), currentCompression); -// TODO: the disabled compression modes are not configured in libTIFF -// menu->AddSeparatorItem(); -// add_menu_item(menu, COMPRESSION_JPEG, "JPEG", currentCompression); -// TODO ? - strip encoding is not implemented in libTIFF for this compression -// add_menu_item(menu, COMPRESSION_JP2000, "JPEG2000", currentCompression); + // TODO: the disabled compression modes are not configured in libTIFF + // menu->AddSeparatorItem(); + // add_menu_item(menu, COMPRESSION_JPEG, "JPEG", currentCompression); + // TODO ? - strip encoding is not implemented in libTIFF for this compression + // add_menu_item(menu, COMPRESSION_JP2000, "JPEG2000", currentCompression); - fCompressionMF = new BMenuField(B_TRANSLATE("Use Compression:"), menu); + fCompressionMF = new BMenuField(B_TRANSLATE("Use Compression:"), menu); - // Build the layout + // Build the layout BLayoutBuilder::Group<>(this, B_VERTICAL, 7) .SetInsets(5) - .Add(fTitle) - .Add(fDetail) - .AddGlue() - .Add(fCompressionMF) - .AddGlue() - .Add(fLibTIFF[0]) - .Add(fLibTIFF[1]) - .Add(fLibTIFF[2]) - .Add(fLibTIFF[3]) - // Theses 4 adding above work because we know there are 4 strings - // but it's fragile: one string less in the library version and the application breaks + .Add(fTitle) + .Add(fDetail) + .AddGlue() + .Add(fCompressionMF) + .AddGlue() + .Add(fLibTIFF[0]) + .Add(fLibTIFF[1]) + .Add(fLibTIFF[2]) + .Add(fLibTIFF[3]) + // Theses 4 adding above work because we know there are 4 strings + // but it's fragile: one string less in the library version and the + // application breaks .AddGlue(); - BFont font; - GetFont(&font); - SetExplicitPreferredSize(BSize((font.Size() * 350)/12, (font.Size() * 200)/12)); + BFont font; + GetFont(&font); + SetExplicitPreferredSize( + BSize((font.Size() * 350)/12, (font.Size() * 200)/12)); } -// --------------------------------------------------------------- -// Destructor -// -// Does nothing -// -// Preconditions: -// -// Parameters: -// -// Postconditions: -// -// Returns: -// --------------------------------------------------------------- + TIFFView::~TIFFView() { fSettings->Release(); } -// --------------------------------------------------------------- -// MessageReceived -// -// Handles state changes of the Compression menu field -// -// Preconditions: -// -// Parameters: area, not used -// -// Postconditions: -// -// Returns: -// --------------------------------------------------------------- + +void +TIFFView::AllAttached() +{ + fCompressionMF->Menu()->SetTargetForItems(this); + fCompressionMF->SetDivider( + fCompressionMF->StringWidth(fCompressionMF->Label()) + 3); + fCompressionMF->ResizeToPreferred(); +} + + void TIFFView::MessageReceived(BMessage* message) { @@ -199,26 +178,3 @@ TIFFView::MessageReceived(BMessage* message) BView::MessageReceived(message); } } - -// --------------------------------------------------------------- -// AllAttached -// -// sets the target for the controls controlling the configuration -// -// Preconditions: -// -// Parameters: area, not used -// -// Postconditions: -// -// Returns: -// --------------------------------------------------------------- -void -TIFFView::AllAttached() -{ - fCompressionMF->Menu()->SetTargetForItems(this); - fCompressionMF->SetDivider(fCompressionMF->StringWidth(fCompressionMF->Label()) + 3); - fCompressionMF->ResizeToPreferred(); -} - - diff --git a/src/add-ons/translators/tiff/TIFFView.h b/src/add-ons/translators/tiff/TIFFView.h index 51e2c42..69754fe 100644 --- a/src/add-ons/translators/tiff/TIFFView.h +++ b/src/add-ons/translators/tiff/TIFFView.h @@ -28,39 +28,40 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. /*****************************************************************************/ - #ifndef TIFFVIEW_H #define TIFFVIEW_H + #include <View.h> #include <MenuField.h> #include <StringView.h> #include "TranslatorSettings.h" + class TIFFView : public BView { public: - TIFFView(const char *name, uint32 flags, TranslatorSettings *settings); - // sets up the view - - ~TIFFView(); - // releases the TIFFTranslator settings + TIFFView(const char* name, uint32 flags, TranslatorSettings* settings); + // sets up the view - virtual void AllAttached(); - virtual void MessageReceived(BMessage *message); + ~TIFFView(); + // releases the TIFFTranslator settings + + virtual void AllAttached(); + virtual void MessageReceived(BMessage* message); enum { MSG_COMPRESSION_CHANGED = 'cmch', }; private: - BStringView* fTitle; - BStringView* fDetail; - BStringView* fLibTIFF[5]; - BMenuField* fCompressionMF; + BStringView* fTitle; + BStringView* fDetail; + BStringView* fLibTIFF[5]; + BMenuField* fCompressionMF; - TranslatorSettings *fSettings; - // the actual settings for the translator, - // shared with the translator + TranslatorSettings* fSettings; + // the actual settings for the translator, shared with the translator }; + #endif // #ifndef TIFFVIEW_H ############################################################################ Commit: 7f4dce0c88f59ed5236a95d472356a03de453175 URL: http://cgit.haiku-os.org/haiku/commit/?id=7f4dce0 Author: John Scipione <jscipione@xxxxxxxxx> Date: Thu May 30 21:25:17 2013 UTC TIFFTranslator: Sentence case Use compression ---------------------------------------------------------------------------- diff --git a/src/add-ons/translators/tiff/TIFFView.cpp b/src/add-ons/translators/tiff/TIFFView.cpp index 329dc93..3a285fe 100644 --- a/src/add-ons/translators/tiff/TIFFView.cpp +++ b/src/add-ons/translators/tiff/TIFFView.cpp @@ -120,7 +120,7 @@ TIFFView::TIFFView(const char* name, uint32 flags, // TODO ? - strip encoding is not implemented in libTIFF for this compression // add_menu_item(menu, COMPRESSION_JP2000, "JPEG2000", currentCompression); - fCompressionMF = new BMenuField(B_TRANSLATE("Use Compression:"), menu); + fCompressionMF = new BMenuField(B_TRANSLATE("Use compression:"), menu); // Build the layout BLayoutBuilder::Group<>(this, B_VERTICAL, 7) ############################################################################ Commit: dc674f5d961fe92d691e6bae4def80ff6d14da3b URL: http://cgit.haiku-os.org/haiku/commit/?id=dc674f5 Author: John Scipione <jscipione@xxxxxxxxx> Date: Thu May 30 21:43:34 2013 UTC SGITranslator: Resize menu field to preferred width ... when the window is first activated. Unfortunately the preferred width has not been set until after the window is shown so we can't do the work in AllAttached(). ---------------------------------------------------------------------------- diff --git a/src/add-ons/translators/sgi/SGIView.cpp b/src/add-ons/translators/sgi/SGIView.cpp index 1c2a7ba..6c65c96 100644 --- a/src/add-ons/translators/sgi/SGIView.cpp +++ b/src/add-ons/translators/sgi/SGIView.cpp @@ -95,7 +95,7 @@ SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings) //add_menu_item(menu, SGI_COMP_ARLE, "Agressive RLE", currentCompression); - fCompressionMF = new BMenuField("compression", + fCompressionMF = new BMenuField("compression", B_TRANSLATE("Use compression:"), menu); BAlignment labelAlignment(B_ALIGN_LEFT, B_ALIGN_NO_VERTICAL); @@ -157,6 +157,8 @@ void SGIView::AllAttached() { fCompressionMF->Menu()->SetTargetForItems(this); + fCompressionMF->SetDivider( + fCompressionMF->StringWidth(fCompressionMF->Label()) + 3); } @@ -177,3 +179,15 @@ SGIView::MessageReceived(BMessage* message) BView::MessageReceived(message); } } + + +void +SGIView::WindowActivated(bool active) +{ + static bool firstRun = true; + + if (firstRun) { + firstRun = false; + fCompressionMF->ResizeToPreferred(); + } +} diff --git a/src/add-ons/translators/sgi/SGIView.h b/src/add-ons/translators/sgi/SGIView.h index c3ebda9..53a5628 100644 --- a/src/add-ons/translators/sgi/SGIView.h +++ b/src/add-ons/translators/sgi/SGIView.h @@ -50,6 +50,7 @@ public: virtual void AllAttached(); virtual void MessageReceived(BMessage* message); + virtual void WindowActivated(bool active); enum { MSG_COMPRESSION_CHANGED = 'cmch', ############################################################################ Commit: d9dae4d313e5d1ab96749c8a99f749c652e39ea0 URL: http://cgit.haiku-os.org/haiku/commit/?id=d9dae4d Author: John Scipione <jscipione@xxxxxxxxx> Date: Thu May 30 21:44:10 2013 UTC TIFFTranslator: Resize menu field to preferred width. ---------------------------------------------------------------------------- diff --git a/src/add-ons/translators/tiff/TIFFView.cpp b/src/add-ons/translators/tiff/TIFFView.cpp index 3a285fe..5e880fb 100644 --- a/src/add-ons/translators/tiff/TIFFView.cpp +++ b/src/add-ons/translators/tiff/TIFFView.cpp @@ -120,7 +120,8 @@ TIFFView::TIFFView(const char* name, uint32 flags, // TODO ? - strip encoding is not implemented in libTIFF for this compression // add_menu_item(menu, COMPRESSION_JP2000, "JPEG2000", currentCompression); - fCompressionMF = new BMenuField(B_TRANSLATE("Use compression:"), menu); + fCompressionMF = new BMenuField("compression", + B_TRANSLATE("Use compression:"), menu); // Build the layout BLayoutBuilder::Group<>(this, B_VERTICAL, 7) @@ -158,7 +159,6 @@ TIFFView::AllAttached() fCompressionMF->Menu()->SetTargetForItems(this); fCompressionMF->SetDivider( fCompressionMF->StringWidth(fCompressionMF->Label()) + 3); - fCompressionMF->ResizeToPreferred(); } @@ -172,9 +172,22 @@ TIFFView::MessageReceived(BMessage* message) fSettings->SetGetInt32(TIFF_SETTING_COMPRESSION, &value); fSettings->SaveSettings(); } + fCompressionMF->ResizeToPreferred(); break; } default: BView::MessageReceived(message); } } + + +void +TIFFView::WindowActivated(bool active) +{ + static bool firstRun = true; + + if (firstRun) { + firstRun = false; + fCompressionMF->ResizeToPreferred(); + } +} diff --git a/src/add-ons/translators/tiff/TIFFView.h b/src/add-ons/translators/tiff/TIFFView.h index 69754fe..e9bbd48 100644 --- a/src/add-ons/translators/tiff/TIFFView.h +++ b/src/add-ons/translators/tiff/TIFFView.h @@ -48,6 +48,7 @@ public: virtual void AllAttached(); virtual void MessageReceived(BMessage* message); + virtual void WindowActivated(bool active); enum { MSG_COMPRESSION_CHANGED = 'cmch', ############################################################################ Revision: hrev45726 Commit: 19d9ad49ae52b561d8600ee27c73e9352d2f37b9 URL: http://cgit.haiku-os.org/haiku/commit/?id=19d9ad4 Author: John Scipione <jscipione@xxxxxxxxx> Date: Thu May 30 21:47:26 2013 UTC Backgrounds: Resize menu fields to preferred width. Also a few other related changes: * Update the copyright year in header and add my name. * Use font aware spacing units in layout constructor. * Align the fIconLabelOutline check box with the menu fields instead of the menu field labels. ---------------------------------------------------------------------------- diff --git a/src/preferences/backgrounds/BackgroundsView.cpp b/src/preferences/backgrounds/BackgroundsView.cpp index 728d73e..f2052f9 100644 --- a/src/preferences/backgrounds/BackgroundsView.cpp +++ b/src/preferences/backgrounds/BackgroundsView.cpp @@ -1,10 +1,11 @@ /* - * Copyright 2002-2009, Haiku, Inc. All Rights Reserved. + * Copyright 2002-2013 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: - * Jerome Duval (jerome.duval@xxxxxxx) * Axel Dörfler, axeld@xxxxxxxxxxxxxxxx + * Jerome Duval, jerome.duval@xxxxxxx + * John Scipione, jscipione@xxxxxxxxx * Jonas Sundström, jonas@xxxxxxxxxx */ @@ -22,7 +23,6 @@ #include <FindDirectory.h> #include <LayoutBuilder.h> #include <Locale.h> -#include <MenuField.h> #include <Messenger.h> #include <MimeType.h> #include <Point.h> @@ -162,9 +162,8 @@ BackgroundsView::BackgroundsView() fImageMenu->AddItem(new BMenuItem(B_TRANSLATE("Other" B_UTF8_ELLIPSIS), new BMessage(kMsgOtherImage))); - BMenuField* imageMenuField = new BMenuField(NULL, fImageMenu); - imageMenuField->SetAlignment(B_ALIGN_RIGHT); - imageMenuField->ResizeToPreferred(); + fImageMenuField = new BMenuField(NULL, fImageMenu); + fImageMenuField->SetAlignment(B_ALIGN_RIGHT); fPlacementMenu = new BPopUpMenu(B_TRANSLATE("pick one")); fPlacementMenu->AddItem(new BMenuItem(B_TRANSLATE("Manual"), @@ -176,8 +175,8 @@ BackgroundsView::BackgroundsView() fPlacementMenu->AddItem(new BMenuItem(B_TRANSLATE("Tile"), new BMessage(kMsgTilePlacement))); - BMenuField* placementMenuField = new BMenuField(NULL, fPlacementMenu); - placementMenuField->SetAlignment(B_ALIGN_RIGHT); + fPlacementMenuField = new BMenuField(NULL, fPlacementMenu); + fPlacementMenuField->SetAlignment(B_ALIGN_RIGHT); fIconLabelOutline = new BCheckBox(B_TRANSLATE("Icon label outline"), new BMessage(kMsgIconLabelOutline)); @@ -197,18 +196,18 @@ BackgroundsView::BackgroundsView() B_ALIGN_NO_VERTICAL)); view = BLayoutBuilder::Group<>() - .AddGroup(B_VERTICAL, 10) - .AddGroup(B_VERTICAL, 10) - .AddGrid(10, 10) + .AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING) + .AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING) + .AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING) .Add(imageStringView, 0, 0) + .Add(fImageMenuField, 1, 0) .Add(placementStringView, 0, 1) - .Add(imageMenuField, 1, 0) - .Add(placementMenuField, 1, 1) + .Add(fPlacementMenuField, 1, 1) + .Add(fIconLabelOutline, 1, 2) .End() - .Add(fIconLabelOutline) .End() .Add(fPicker) - .SetInsets(10, 10, 10, 10) + .SetInsets(B_USE_DEFAULT_SPACING) .End() .View(); @@ -316,13 +315,10 @@ BackgroundsView::MessageReceived(BMessage* msg) } case kMsgManualPlacement: - _UpdatePreview(); - _UpdateButtons(); - break; - case kMsgTilePlacement: case kMsgScalePlacement: case kMsgCenterPlacement: + fPlacementMenuField->ResizeToPreferred(); _UpdatePreview(); _UpdateButtons(); break; @@ -388,6 +384,8 @@ BackgroundsView::MessageReceived(BMessage* msg) case kMsgNoImage: fLastImageIndex = ((BGImageMenuItem*)fImageMenu->FindMarked()) ->ImageIndex(); + fImageMenuField->ResizeToPreferred(); + fPlacementMenuField->ResizeToPreferred(); _UpdatePreview(); _UpdateButtons(); break; @@ -830,6 +828,19 @@ BackgroundsView::_LoadSettings() void +BackgroundsView::WindowActivated(bool active) +{ + static bool firstRun = true; + + if (firstRun) { + firstRun = false; + fImageMenuField->ResizeToPreferred(); + fPlacementMenuField->ResizeToPreferred(); + } +} + + +void BackgroundsView::WorkspaceActivated(uint32 oldWorkspaces, bool active) { _UpdateWithCurrent(); diff --git a/src/preferences/backgrounds/BackgroundsView.h b/src/preferences/backgrounds/BackgroundsView.h index 0c80d65..0392053 100644 --- a/src/preferences/backgrounds/BackgroundsView.h +++ b/src/preferences/backgrounds/BackgroundsView.h @@ -1,9 +1,10 @@ /* - * Copyright 2002-2009, Haiku, Inc. All Rights Reserved. + * Copyright 2002-2013 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: - * Jerome Duval (jerome.duval@xxxxxxx) + * Jerome Duval, jerome.duval@xxxxxxx + * John Scipione, jscipione@xxxxxxxxx */ #ifndef BACKGROUNDS_VIEW_H #define BACKGROUNDS_VIEW_H @@ -18,6 +19,7 @@ #include <Entry.h> #include <FilePanel.h> #include <Menu.h> +#include <MenuField.h> #include <MenuItem.h> #include <Message.h> #include <Picture.h> @@ -110,6 +112,7 @@ public: void RefsReceived(BMessage* msg); void SaveSettings(); + void WindowActivated(bool active); void WorkspaceActivated(uint32 oldWorkspaces, bool active); int32 AddImage(BPath path); @@ -142,10 +145,12 @@ protected: BColorControl* fPicker; BButton* fApply; BButton* fRevert; - BCheckBox* fIconLabelOutline; + BMenu* fWorkspaceMenu; BMenu* fPlacementMenu; + BMenuField* fPlacementMenuField; BMenu* fImageMenu; - BMenu* fWorkspaceMenu; + BMenuField* fImageMenuField; + BCheckBox* fIconLabelOutline; BTextControl* fXPlacementText; BTextControl* fYPlacementText; Preview* fPreview;