[haiku-commits] haiku: hrev54535 - src/apps/icon-o-matic

  • From: Adrien Destugues <pulkomandy@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 26 Aug 2020 12:55:24 -0400 (EDT)

hrev54535 adds 2 changesets to branch 'master'
old head: 058fca80b70bc2163bdc21a9674558d768e02dc2
new head: 27ae691c1f847b21d12cbfbceb7ed3f06a887e3c
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=27ae691c1f84+%5E058fca80b70b

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

c2151600ed58: Icon-O-Matic: use BMenuFied for secondary menus
  
  Fixes #8759
  
  Change-Id: Ie1c40e6e9ee21bc616119aaf49b3e46162fb82aa
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3122
  Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>

27ae691c1f84: Icon-O-Matic: fix the main menu bar
  
  Mentionned in #8759 as well.
  
  Change-Id: I90bb0529a6bf1dd18316a95f87947e142128d5db
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3123
  Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

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

2 files changed, 56 insertions(+), 51 deletions(-)
src/apps/icon-o-matic/MainWindow.cpp | 106 ++++++++++++++++---------------
src/apps/icon-o-matic/MainWindow.h   |   1 +

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

Commit:      c2151600ed58babf94de89e942a3b83a792488f7
URL:         https://git.haiku-os.org/haiku/commit/?id=c2151600ed58
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Aug  2 16:49:57 2020 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Wed Aug 26 16:55:21 2020 UTC

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

Icon-O-Matic: use BMenuFied for secondary menus

Fixes #8759

Change-Id: Ie1c40e6e9ee21bc616119aaf49b3e46162fb82aa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3122
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>

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

diff --git a/src/apps/icon-o-matic/MainWindow.cpp 
b/src/apps/icon-o-matic/MainWindow.cpp
index 1146a19204..11d137c6b8 100644
--- a/src/apps/icon-o-matic/MainWindow.cpp
+++ b/src/apps/icon-o-matic/MainWindow.cpp
@@ -18,9 +18,11 @@
 #include <Entry.h>
 #include <File.h>
 #include <fs_attr.h>
+#include <LayoutBuilder.h>
 #include <Locale.h>
 #include <Menu.h>
 #include <MenuBar.h>
+#include <MenuField.h>
 #include <MenuItem.h>
 #include <Message.h>
 #include <Screen.h>
@@ -1030,53 +1032,42 @@ MainWindow::_CreateGUI()
        layout->AddView(leftSideView, 0, 1);
        leftSideView->SetExplicitMaxSize(BSize(splitWidth, B_SIZE_UNSET));
 
-       // path menu and list view
-       BMenuBar* menuBar = new BMenuBar("path menu bar");
-       menuBar->AddItem(fPathMenu);
-       leftSideView->AddChild(menuBar);
-
        fPathListView = new PathListView(BRect(0, 0, splitWidth, 100),
                "path list view", new BMessage(MSG_PATH_SELECTED), this);
-
-       BView* scrollView = new BScrollView("path list scroll view",
-               fPathListView, B_FOLLOW_NONE, 0, false, true, B_NO_BORDER);
-       leftSideView->AddChild(scrollView);
-
-       // shape list view
-       menuBar = new BMenuBar("shape menu bar");
-       menuBar->AddItem(fShapeMenu);
-       leftSideView->AddChild(menuBar);
-
        fShapeListView = new ShapeListView(BRect(0, 0, splitWidth, 100),
                "shape list view", new BMessage(MSG_SHAPE_SELECTED), this);
-       scrollView = new BScrollView("shape list scroll view",
-               fShapeListView, B_FOLLOW_NONE, 0, false, true, B_NO_BORDER);
-       leftSideView->AddChild(scrollView);
-
-       // transformer list view
-       menuBar = new BMenuBar("transformer menu bar");
-       menuBar->AddItem(fTransformerMenu);
-       leftSideView->AddChild(menuBar);
-
        fTransformerListView = new TransformerListView(BRect(0, 0, splitWidth, 
100),
                "transformer list view");
-       scrollView = new BScrollView("transformer list scroll view",
-               fTransformerListView, B_FOLLOW_NONE, 0, false, true, 
B_NO_BORDER);
-       leftSideView->AddChild(scrollView);
-
-       // property list view
-       menuBar = new BMenuBar("property menu bar");
-       menuBar->AddItem(fPropertyMenu);
-       leftSideView->AddChild(menuBar);
-
        fPropertyListView = new IconObjectListView();
 
-       // scroll view around property list view
-       ScrollView* propScrollView = new ScrollView(fPropertyListView,
-               SCROLL_VERTICAL, BRect(0, 0, splitWidth, 100), "property scroll 
view",
-               B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER,
-               BORDER_RIGHT);
-       leftSideView->AddChild(propScrollView);
+       BLayoutBuilder::Group<>(leftSideView)
+               .AddGroup(B_VERTICAL, 0)
+                       .SetInsets(-2, -1, -1, -1)
+                       .Add(new BMenuField(NULL, fPathMenu))
+               .End()
+               .Add(new BScrollView("path scroll view", fPathListView,
+                       B_FOLLOW_NONE, 0, false, true, B_NO_BORDER))
+               .AddGroup(B_VERTICAL, 0)
+                       .SetInsets(-2, -2, -1, -1)
+                       .Add(new BMenuField(NULL, fShapeMenu))
+               .End()
+               .Add(new BScrollView("shape scroll view", fShapeListView,
+                       B_FOLLOW_NONE, 0, false, true, B_NO_BORDER))
+               .AddGroup(B_VERTICAL, 0)
+                       .SetInsets(-2, -2, -1, -1)
+                       .Add(new BMenuField(NULL, fTransformerMenu))
+               .End()
+               .Add(new BScrollView("transformer scroll view",
+                       fTransformerListView, B_FOLLOW_NONE, 0, false, true, 
B_NO_BORDER))
+               .AddGroup(B_VERTICAL, 0)
+                       .SetInsets(-2, -2, -1, -1)
+                       .Add(new BMenuField(NULL, fPropertyMenu))
+               .End()
+               .Add(new ScrollView(fPropertyListView, SCROLL_VERTICAL,
+                       BRect(0, 0, splitWidth, 100), "property scroll view",
+                       B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS, 
B_PLAIN_BORDER,
+                       BORDER_RIGHT))
+       .End();
 
        BGroupLayout* topSide = new BGroupLayout(B_HORIZONTAL);
        topSide->SetSpacing(0);
@@ -1098,21 +1089,23 @@ MainWindow::_CreateGUI()
 
        // views along the top
 
-       BGroupLayout* styleGroup = new BGroupLayout(B_VERTICAL, 0);
-       BView* styleGroupView = new BView("style group", 0, styleGroup);
+       BGroupView* styleGroupView = new BGroupView(B_VERTICAL, 0);
        topSide->AddView(styleGroupView);
 
-       // style list view
-       menuBar = new BMenuBar("style menu bar");
-       menuBar->AddItem(fStyleMenu);
-       styleGroup->AddView(menuBar);
-
        fStyleListView = new StyleListView(BRect(0, 0, splitWidth, 100),
                "style list view", new BMessage(MSG_STYLE_SELECTED), this);
-       scrollView = new BScrollView("style list scroll view", fStyleListView,
-               B_FOLLOW_NONE, 0, false, true, B_NO_BORDER);
+
+       BScrollView* scrollView = new BScrollView("style list scroll view",
+               fStyleListView, B_FOLLOW_NONE, 0, false, true, B_NO_BORDER);
        scrollView->SetExplicitMaxSize(BSize(splitWidth, B_SIZE_UNLIMITED));
-       styleGroup->AddView(scrollView);
+
+       BLayoutBuilder::Group<>(styleGroupView)
+               .AddGroup(B_VERTICAL, 0)
+                       .SetInsets(-2, -2, -1, -1)
+                       .Add(new BMenuField(NULL, fStyleMenu))
+               .End()
+               .Add(scrollView)
+       .End();
 
        // style view
        fStyleView = new StyleView(BRect(0, 0, 200, 100));
@@ -1124,7 +1117,7 @@ MainWindow::_CreateGUI()
        BView* swatchGroupView = new BView("swatch group", 0, swatchGroup);
        topSide->AddView(swatchGroupView);
 
-       menuBar = new BMenuBar("swatches menu bar");
+       BMenuBar* menuBar = new BMenuBar("swatches menu bar");
        menuBar->AddItem(fSwatchMenu);
        swatchGroup->AddView(menuBar);
 

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

Revision:    hrev54535
Commit:      27ae691c1f847b21d12cbfbceb7ed3f06a887e3c
URL:         https://git.haiku-os.org/haiku/commit/?id=27ae691c1f84
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Aug  2 17:15:37 2020 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Wed Aug 26 16:55:21 2020 UTC

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

Icon-O-Matic: fix the main menu bar

Mentionned in #8759 as well.

Change-Id: I90bb0529a6bf1dd18316a95f87947e142128d5db
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3123
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>

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

diff --git a/src/apps/icon-o-matic/MainWindow.cpp 
b/src/apps/icon-o-matic/MainWindow.cpp
index 11d137c6b8..70b14b1514 100644
--- a/src/apps/icon-o-matic/MainWindow.cpp
+++ b/src/apps/icon-o-matic/MainWindow.cpp
@@ -542,6 +542,15 @@ case MSG_SHAPE_SELECTED: {
 }
 
 
+void
+MainWindow::Show()
+{
+       BWindow::Show();
+       BMenuBar* bar = static_cast<BMenuBar*>(FindView("main menu"));
+       SetKeyMenuBar(bar);
+}
+
+
 bool
 MainWindow::QuitRequested()
 {
@@ -975,7 +984,8 @@ MainWindow::_CreateGUI()
        layout->AddView(leftTopView, 0, 0);
 
        // views along the left side
-       leftTopView->AddChild(_CreateMenuBar());
+       BMenuBar* mainMenuBar = _CreateMenuBar();
+       leftTopView->AddChild(mainMenuBar);
 
        float splitWidth = 13 * be_plain_font->Size();
        BSize minSize = leftTopView->MinSize();
@@ -1131,6 +1141,7 @@ MainWindow::_CreateGUI()
                swatchGroupView->MinSize().height));
 }
 
+
 BMenuBar*
 MainWindow::_CreateMenuBar()
 {
diff --git a/src/apps/icon-o-matic/MainWindow.h 
b/src/apps/icon-o-matic/MainWindow.h
index 432dd1eea7..32b8f866cb 100644
--- a/src/apps/icon-o-matic/MainWindow.h
+++ b/src/apps/icon-o-matic/MainWindow.h
@@ -55,6 +55,7 @@ public:
 
        // BWindow interface
        virtual void                            MessageReceived(BMessage* 
message);
+       virtual void                            Show();
        virtual bool                            QuitRequested();
        virtual void                            WorkspaceActivated(int32 
workspace,
                                                                        bool 
active);


Other related posts:

  • » [haiku-commits] haiku: hrev54535 - src/apps/icon-o-matic - Adrien Destugues