[haiku-commits] haiku: hrev48456 - src/preferences/mouse

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 8 Dec 2014 08:40:19 +0100 (CET)

hrev48456 adds 2 changesets to branch 'master'
old head: bc6db669fde437f4972e7bfa16906338d829a0ef
new head: f87c1cec88b3765f2bb9cc2621bdca363ee423a6
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=f87c1ce+%5Ebc6db66

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

ed35dbd: Mouse prefs: Layout improvements
  
  * Some spacing was uneven leaving items uncentered
  * Removed "slow/fast" labels from the sliders as they were not correct
  (a delay is short/long, not slow/fast, same for acceleration) and not
  very useful.
  
  Signed-off-by: Adrien Destugues <pulkomandy@xxxxxxxxx>

                                  [ Laurent Chea <contact@xxxxxxxxxxxxxxx> ]

f87c1ce: Mouse prefs: further layout fixes.
  
  * Use BSeparatorView instead of trying to replicate it with a BBox
  * Use B_USE_SMALL_SPACING instead of 7.
  
  Fixes #11528.

                                 [ Adrien Destugues <pulkomandy@xxxxxxxxx> ]

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

1 file changed, 38 insertions(+), 29 deletions(-)
src/preferences/mouse/SettingsView.cpp | 67 +++++++++++++++++-------------

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

Commit:      ed35dbde39ceec6888b764ab74b46784982ab7f0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ed35dbd
Author:      Laurent Chea <contact@xxxxxxxxxxxxxxx>
Date:        Sat Dec  6 17:32:24 2014 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Mon Dec  8 07:37:56 2014 UTC

Mouse prefs: Layout improvements

* Some spacing was uneven leaving items uncentered
* Removed "slow/fast" labels from the sliders as they were not correct
(a delay is short/long, not slow/fast, same for acceleration) and not
very useful.

Signed-off-by: Adrien Destugues <pulkomandy@xxxxxxxxx>

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

diff --git a/src/preferences/mouse/SettingsView.cpp 
b/src/preferences/mouse/SettingsView.cpp
index ca9205d..f4c5dc3 100644
--- a/src/preferences/mouse/SettingsView.cpp
+++ b/src/preferences/mouse/SettingsView.cpp
@@ -83,33 +83,27 @@ SettingsView::SettingsView(MouseSettings& settings)
 
        BMenuField* typeField = new BMenuField(B_TRANSLATE("Mouse type:"),
                fTypeMenu);
-       typeField->SetAlignment(B_ALIGN_RIGHT);
+       typeField->SetAlignment(B_ALIGN_LEFT);
 
        // Create the "Double-click speed slider...
        fClickSpeedSlider = new BSlider("double_click_speed",
                B_TRANSLATE("Double-click speed"), new 
BMessage(kMsgDoubleClickSpeed),
                0, 1000, B_HORIZONTAL);
        fClickSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
-       fClickSpeedSlider->SetHashMarkCount(5);
-       fClickSpeedSlider->SetLimitLabels(B_TRANSLATE("Slow"),
-               B_TRANSLATE("Fast"));
+       fClickSpeedSlider->SetHashMarkCount(7);
 
        // Create the "Mouse Speed" slider...
        fMouseSpeedSlider = new BSlider("mouse_speed", B_TRANSLATE("Mouse 
speed"),
                new BMessage(kMsgMouseSpeed), 0, 1000, B_HORIZONTAL);
        fMouseSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
        fMouseSpeedSlider->SetHashMarkCount(7);
-       fMouseSpeedSlider->SetLimitLabels(B_TRANSLATE("Slow"),
-               B_TRANSLATE("Fast"));
 
        // Create the "Mouse Acceleration" slider...
        fAccelerationSlider = new BSlider("mouse_acceleration",
                B_TRANSLATE("Mouse acceleration"),
                new BMessage(kMsgAccelerationFactor), 0, 1000, B_HORIZONTAL);
        fAccelerationSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
-       fAccelerationSlider->SetHashMarkCount(5);
-       fAccelerationSlider->SetLimitLabels(B_TRANSLATE("Slow"),
-               B_TRANSLATE("Fast"));
+       fAccelerationSlider->SetHashMarkCount(7);
 
        // Mouse image...
        fMouseView = new MouseView(fSettings);
@@ -170,29 +164,43 @@ SettingsView::SettingsView(MouseSettings& settings)
                new BMessage(kMsgAcceptFirstClick));
 
        // dividers
+       // This one is a vertical line for B_HORIZONTAL 
        BBox* hdivider = new BBox(
                BRect(0, 0, 1, 1), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES,
                        B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);
        hdivider->SetExplicitMaxSize(BSize(1, B_SIZE_UNLIMITED));
 
+       // This one is a horizontal line for B_VERTICAL
        BBox* vdivider = new BBox(
                BRect(0, 0, 1, 1), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES,
                        B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);
        vdivider->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1));
 
+       int globalInset = 7;
+
        // Build the layout
-       SetLayout(new BGroupLayout(B_HORIZONTAL));
+       SetLayout(new BGroupLayout(B_VERTICAL));
+
+       // Layout is :
+       // A | B
+       // -----
+       //   C
+
+       AddChild(BGroupLayoutBuilder(B_VERTICAL, globalInset)
+
+               // Horizontal : A|B
+               .AddGroup(B_HORIZONTAL, globalInset)
 
-       AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
-               .AddGroup(B_HORIZONTAL, 10)
-                       .AddGroup(B_VERTICAL, 10, 1)
-                               .AddGroup(B_HORIZONTAL, 10)
+                       // Vertical block A: mouse type/view/test
+                       .AddGroup(B_VERTICAL, 10) 
+                               .AddGroup(B_HORIZONTAL, 0)
                                        .AddGlue()
                                        .Add(typeField)
                                        .AddGlue()
                                .End()
                                .AddGlue()
-                               .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
+
+                               .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
                                        .AddGlue()
                                        .Add(fMouseView)
                                        .AddGlue()
@@ -200,8 +208,11 @@ SettingsView::SettingsView(MouseSettings& settings)
                                .AddGlue()
                                .Add(doubleClickTextControl)
                        .End()
+
                        .Add(hdivider)
-                       .AddGroup(B_VERTICAL, 5, 3)
+
+                       // Vertical block B: speed settings
+                       .AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING, 3)
                                .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
                                        .Add(fClickSpeedSlider)
                                )
@@ -213,15 +224,18 @@ SettingsView::SettingsView(MouseSettings& settings)
                                )
                        .End()
                .End()
+               
                .Add(vdivider)
-               .AddGroup(B_HORIZONTAL, 10)
+               
+               // Horizontal Block C: focus mode
+               .AddGroup(B_HORIZONTAL, globalInset)
                        .Add(focusField)
                        .AddGlue()
                        .AddGroup(B_VERTICAL, 0)
                                .Add(fAcceptFirstClickBox)
                        .End()
                .End()
-               .SetInsets(5, 5, 5, 5)
+               .SetInsets(globalInset,globalInset,globalInset,globalInset)
        );
 }
 

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

Revision:    hrev48456
Commit:      f87c1cec88b3765f2bb9cc2621bdca363ee423a6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f87c1ce
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Mon Dec  8 07:39:55 2014 UTC

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

Mouse prefs: further layout fixes.

* Use BSeparatorView instead of trying to replicate it with a BBox
* Use B_USE_SMALL_SPACING instead of 7.

Fixes #11528.

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

diff --git a/src/preferences/mouse/SettingsView.cpp 
b/src/preferences/mouse/SettingsView.cpp
index f4c5dc3..bc806db 100644
--- a/src/preferences/mouse/SettingsView.cpp
+++ b/src/preferences/mouse/SettingsView.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2011 Haiku Inc. All rights reserved.
+ * Copyright 2003-2014 Haiku Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -24,6 +24,7 @@
 #include <MenuField.h>
 #include <MenuItem.h>
 #include <PopUpMenu.h>
+#include <SeparatorView.h>
 #include <Slider.h>
 #include <TextControl.h>
 #include <TranslationUtils.h>
@@ -48,6 +49,7 @@ mouse_mode_to_index(mode_mouse mode)
        }
 }
 
+
 static int32
 focus_follows_mouse_mode_to_index(mode_focus_follows_mouse mode)
 {
@@ -142,8 +144,8 @@ SettingsView::SettingsView(MouseSettings& settings)
 
        const char *focusFollowsMouseLabels[] = {B_TRANSLATE_MARK("Normal"),
                B_TRANSLATE_MARK("Warp"), B_TRANSLATE_MARK("Instant warp")};
-       const mode_focus_follows_mouse focusFollowsMouseModes[] =
-               {B_NORMAL_FOCUS_FOLLOWS_MOUSE, B_WARP_FOCUS_FOLLOWS_MOUSE,
+       const mode_focus_follows_mouse focusFollowsMouseModes[]
+               = {B_NORMAL_FOCUS_FOLLOWS_MOUSE, B_WARP_FOCUS_FOLLOWS_MOUSE,
                        B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE};
 
        for (int i = 0; i < 3; i++) {
@@ -164,19 +166,11 @@ SettingsView::SettingsView(MouseSettings& settings)
                new BMessage(kMsgAcceptFirstClick));
 
        // dividers
-       // This one is a vertical line for B_HORIZONTAL 
-       BBox* hdivider = new BBox(
-               BRect(0, 0, 1, 1), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES,
-                       B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);
-       hdivider->SetExplicitMaxSize(BSize(1, B_SIZE_UNLIMITED));
+       // This one is a vertical line for B_HORIZONTAL
+       BSeparatorView* hdivider = new BSeparatorView(B_VERTICAL, 
B_FANCY_BORDER);
 
        // This one is a horizontal line for B_VERTICAL
-       BBox* vdivider = new BBox(
-               BRect(0, 0, 1, 1), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES,
-                       B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);
-       vdivider->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1));
-
-       int globalInset = 7;
+       BSeparatorView* vdivider = new BSeparatorView(B_HORIZONTAL, 
B_FANCY_BORDER);
 
        // Build the layout
        SetLayout(new BGroupLayout(B_VERTICAL));
@@ -186,13 +180,13 @@ SettingsView::SettingsView(MouseSettings& settings)
        // -----
        //   C
 
-       AddChild(BGroupLayoutBuilder(B_VERTICAL, globalInset)
+       AddChild(BGroupLayoutBuilder(B_VERTICAL, B_USE_SMALL_SPACING)
 
                // Horizontal : A|B
-               .AddGroup(B_HORIZONTAL, globalInset)
+               .AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING)
 
                        // Vertical block A: mouse type/view/test
-                       .AddGroup(B_VERTICAL, 10) 
+                       .AddGroup(B_VERTICAL, 10)
                                .AddGroup(B_HORIZONTAL, 0)
                                        .AddGlue()
                                        .Add(typeField)
@@ -224,18 +218,19 @@ SettingsView::SettingsView(MouseSettings& settings)
                                )
                        .End()
                .End()
-               
+
                .Add(vdivider)
-               
+
                // Horizontal Block C: focus mode
-               .AddGroup(B_HORIZONTAL, globalInset)
+               .AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING)
                        .Add(focusField)
                        .AddGlue()
                        .AddGroup(B_VERTICAL, 0)
                                .Add(fAcceptFirstClickBox)
                        .End()
                .End()
-               .SetInsets(globalInset,globalInset,globalInset,globalInset)
+               .SetInsets(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING,
+                       B_USE_SMALL_SPACING, B_USE_SMALL_SPACING)
        );
 }
 


Other related posts:

  • » [haiku-commits] haiku: hrev48456 - src/preferences/mouse - pulkomandy