From 6c52db8e0c9dd2d17db299bc06f67df097f311f7 Mon Sep 17 00:00:00 2001
From: Laurent Chea <contact@laurentchea.com>
Date: Sat, 6 Dec 2014 18:32:24 +0100
Subject: [PATCH] Layout update, insets are more homogeneous, sliders have no
label anymore
---
src/preferences/mouse/SettingsView.cpp | 50 ++++++++++++++++++++++------------
1 file changed, 32 insertions(+), 18 deletions(-)
diff --git a/src/preferences/mouse/SettingsView.cpp b/src/preferences/mouse/SettingsView.cpp
index ca9205d..f4c5dc3 100644
a
|
b
|
SettingsView::SettingsView(MouseSettings& settings)
|
83 | 83 | |
84 | 84 | BMenuField* typeField = new BMenuField(B_TRANSLATE("Mouse type:"), |
85 | 85 | fTypeMenu); |
86 | | typeField->SetAlignment(B_ALIGN_RIGHT); |
| 86 | typeField->SetAlignment(B_ALIGN_LEFT); |
87 | 87 | |
88 | 88 | // Create the "Double-click speed slider... |
89 | 89 | fClickSpeedSlider = new BSlider("double_click_speed", |
90 | 90 | B_TRANSLATE("Double-click speed"), new BMessage(kMsgDoubleClickSpeed), |
91 | 91 | 0, 1000, B_HORIZONTAL); |
92 | 92 | fClickSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); |
93 | | fClickSpeedSlider->SetHashMarkCount(5); |
94 | | fClickSpeedSlider->SetLimitLabels(B_TRANSLATE("Slow"), |
95 | | B_TRANSLATE("Fast")); |
| 93 | fClickSpeedSlider->SetHashMarkCount(7); |
96 | 94 | |
97 | 95 | // Create the "Mouse Speed" slider... |
98 | 96 | fMouseSpeedSlider = new BSlider("mouse_speed", B_TRANSLATE("Mouse speed"), |
99 | 97 | new BMessage(kMsgMouseSpeed), 0, 1000, B_HORIZONTAL); |
100 | 98 | fMouseSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); |
101 | 99 | fMouseSpeedSlider->SetHashMarkCount(7); |
102 | | fMouseSpeedSlider->SetLimitLabels(B_TRANSLATE("Slow"), |
103 | | B_TRANSLATE("Fast")); |
104 | 100 | |
105 | 101 | // Create the "Mouse Acceleration" slider... |
106 | 102 | fAccelerationSlider = new BSlider("mouse_acceleration", |
107 | 103 | B_TRANSLATE("Mouse acceleration"), |
108 | 104 | new BMessage(kMsgAccelerationFactor), 0, 1000, B_HORIZONTAL); |
109 | 105 | fAccelerationSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); |
110 | | fAccelerationSlider->SetHashMarkCount(5); |
111 | | fAccelerationSlider->SetLimitLabels(B_TRANSLATE("Slow"), |
112 | | B_TRANSLATE("Fast")); |
| 106 | fAccelerationSlider->SetHashMarkCount(7); |
113 | 107 | |
114 | 108 | // Mouse image... |
115 | 109 | fMouseView = new MouseView(fSettings); |
… |
… |
SettingsView::SettingsView(MouseSettings& settings)
|
170 | 164 | new BMessage(kMsgAcceptFirstClick)); |
171 | 165 | |
172 | 166 | // dividers |
| 167 | // This one is a vertical line for B_HORIZONTAL |
173 | 168 | BBox* hdivider = new BBox( |
174 | 169 | BRect(0, 0, 1, 1), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES, |
175 | 170 | B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER); |
176 | 171 | hdivider->SetExplicitMaxSize(BSize(1, B_SIZE_UNLIMITED)); |
177 | 172 | |
| 173 | // This one is a horizontal line for B_VERTICAL |
178 | 174 | BBox* vdivider = new BBox( |
179 | 175 | BRect(0, 0, 1, 1), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES, |
180 | 176 | B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER); |
181 | 177 | vdivider->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1)); |
182 | 178 | |
| 179 | int globalInset = 7; |
| 180 | |
183 | 181 | // Build the layout |
184 | | SetLayout(new BGroupLayout(B_HORIZONTAL)); |
| 182 | SetLayout(new BGroupLayout(B_VERTICAL)); |
| 183 | |
| 184 | // Layout is : |
| 185 | // A | B |
| 186 | // ----- |
| 187 | // C |
| 188 | |
| 189 | AddChild(BGroupLayoutBuilder(B_VERTICAL, globalInset) |
| 190 | |
| 191 | // Horizontal : A|B |
| 192 | .AddGroup(B_HORIZONTAL, globalInset) |
185 | 193 | |
186 | | AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) |
187 | | .AddGroup(B_HORIZONTAL, 10) |
188 | | .AddGroup(B_VERTICAL, 10, 1) |
189 | | .AddGroup(B_HORIZONTAL, 10) |
| 194 | // Vertical block A: mouse type/view/test |
| 195 | .AddGroup(B_VERTICAL, 10) |
| 196 | .AddGroup(B_HORIZONTAL, 0) |
190 | 197 | .AddGlue() |
191 | 198 | .Add(typeField) |
192 | 199 | .AddGlue() |
193 | 200 | .End() |
194 | 201 | .AddGlue() |
195 | | .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) |
| 202 | |
| 203 | .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0) |
196 | 204 | .AddGlue() |
197 | 205 | .Add(fMouseView) |
198 | 206 | .AddGlue() |
… |
… |
SettingsView::SettingsView(MouseSettings& settings)
|
200 | 208 | .AddGlue() |
201 | 209 | .Add(doubleClickTextControl) |
202 | 210 | .End() |
| 211 | |
203 | 212 | .Add(hdivider) |
204 | | .AddGroup(B_VERTICAL, 5, 3) |
| 213 | |
| 214 | // Vertical block B: speed settings |
| 215 | .AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING, 3) |
205 | 216 | .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0) |
206 | 217 | .Add(fClickSpeedSlider) |
207 | 218 | ) |
… |
… |
SettingsView::SettingsView(MouseSettings& settings)
|
213 | 224 | ) |
214 | 225 | .End() |
215 | 226 | .End() |
| 227 | |
216 | 228 | .Add(vdivider) |
217 | | .AddGroup(B_HORIZONTAL, 10) |
| 229 | |
| 230 | // Horizontal Block C: focus mode |
| 231 | .AddGroup(B_HORIZONTAL, globalInset) |
218 | 232 | .Add(focusField) |
219 | 233 | .AddGlue() |
220 | 234 | .AddGroup(B_VERTICAL, 0) |
221 | 235 | .Add(fAcceptFirstClickBox) |
222 | 236 | .End() |
223 | 237 | .End() |
224 | | .SetInsets(5, 5, 5, 5) |
| 238 | .SetInsets(globalInset,globalInset,globalInset,globalInset) |
225 | 239 | ); |
226 | 240 | } |
227 | 241 | |