[haiku-development] BGroupLayoutBuilder to templated BLayoutBuilder

  • From: Humdinger <humdingerb@xxxxxxxxxxxxxx>
  • To: haiku-development <haiku-development@xxxxxxxxxxxxx>
  • Date: Wed, 1 Jan 2014 18:16:14 +0100

Hello there!

I just wanted to make a small improvement to the layout of the Keymap
preferences: reduce the upper inset of the views in that window.

Finding a BGroupLayoutBuilder contraption there, I wanted to give it
try to convert it to a templated BLayoutBuilder thingy. I almost
succeeded, only that now there's some space between the
DeadKeyMenuFieldder pop-up menu and the fSwitchShortcutsButton. That
means that the width of the window can't be decreased as much as
before.

Here is the code change:

Currently in master (KeymapWindow.cpp#99):

// controls pane
AddChild(BGroupLayoutBuilder(B_VERTICAL)
        .Add(_CreateMenu())
        .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
                .Add(_CreateMapLists(), 0.25)
                .Add(BGroupLayoutBuilder(B_VERTICAL, 10)
                        .Add(fKeyboardLayoutView)
                        //.Add(new BStringView("text label", "Sample and 
clipboard:"))
                        .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
                                .Add(_CreateDeadKeyMenuField(), 0.0)
                                .AddGlue()
                                .Add(fSwitchShortcutsButton))
                        .Add(fTextControl)
                        .AddGlue(0.0)
                        .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
                                .Add(fDefaultsButton = new 
BButton("defaultsButton",
                                        B_TRANSLATE("Defaults"),
                                                new 
BMessage(kMsgDefaultKeymap)))
                                .Add(fRevertButton = new BButton("revertButton",
                                        B_TRANSLATE("Revert"), new 
BMessage(kMsgRevertKeymap)))
                                .AddGlue()))
                .SetInsets(10, 10, 10, 10)));



My changed code:

// controls pane
BLayoutBuilder::Group<>(this, B_VERTICAL)
        .Add(_CreateMenu())
        .AddGroup(B_HORIZONTAL)
                .SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING,
                        B_USE_DEFAULT_SPACING)
                .Add(_CreateMapLists(), 0.25)
                .AddGroup(B_VERTICAL)
                        .Add(fKeyboardLayoutView)
                        //.Add(new BStringView("text label", "Sample and 
clipboard:"))
                        .AddGroup(B_HORIZONTAL)
                                .Add(_CreateDeadKeyMenuField(), 0.0)
                                .AddGlue()
                                .Add(fSwitchShortcutsButton)
                                .End()
                        .Add(fTextControl)
                        .AddGlue(0.0)
                        .AddGroup(B_HORIZONTAL)
                                .Add(fDefaultsButton = new 
BButton("defaultsButton",
                                        B_TRANSLATE("Defaults"),
                                                new 
BMessage(kMsgDefaultKeymap)))
                                .Add(fRevertButton = new BButton("revertButton",
                                        B_TRANSLATE("Revert"), new 
BMessage(kMsgRevertKeymap)))
                                .AddGlue();


Can anyone spot what's wrong, or does the code reveal some underlying problem?

Regards,
Humdinger

--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-
     Deutsche Haiku News  -  Haiku Gazette
       http://haiku-gazette.blogspot.com

Other related posts: