Merge lp:~azzar1/unity/dash-layout-2 into lp:unity
- dash-layout-2
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Andrea Cimitan |
Approved revision: | no longer in the source branch. |
Merge reported by: | Didier Roche-Tolomelli |
Merged at revision: | not available |
Proposed branch: | lp:~azzar1/unity/dash-layout-2 |
Merge into: | lp:unity |
Diff against target: |
2037 lines (+519/-304) 26 files modified
plugins/unityshell/src/AbstractPlacesGroup.cpp (+3/-3) plugins/unityshell/src/DashStyle.cpp (+134/-15) plugins/unityshell/src/DashStyle.h (+41/-0) plugins/unityshell/src/DashView.cpp (+36/-27) plugins/unityshell/src/DashView.h (+1/-0) plugins/unityshell/src/FilterBar.cpp (+30/-30) plugins/unityshell/src/FilterBar.h (+1/-0) plugins/unityshell/src/FilterBasicButton.cpp (+2/-2) plugins/unityshell/src/FilterExpanderLabel.cpp (+42/-30) plugins/unityshell/src/FilterExpanderLabel.h (+6/-0) plugins/unityshell/src/FilterGenreWidget.cpp (+9/-5) plugins/unityshell/src/FilterMultiRangeButton.cpp (+2/-2) plugins/unityshell/src/FilterMultiRangeWidget.cpp (+9/-11) plugins/unityshell/src/FilterRatingsWidget.cpp (+5/-2) plugins/unityshell/src/HudView.cpp (+4/-0) plugins/unityshell/src/LensView.cpp (+25/-21) plugins/unityshell/src/LensView.h (+1/-0) plugins/unityshell/src/LineSeparator.cpp (+9/-12) plugins/unityshell/src/LineSeparator.h (+1/-0) plugins/unityshell/src/OverlayRenderer.cpp (+46/-44) plugins/unityshell/src/PlacesGroup.cpp (+44/-32) plugins/unityshell/src/PlacesGroup.h (+6/-1) plugins/unityshell/src/PlacesVScrollBar.cpp (+10/-3) plugins/unityshell/src/ResultViewGrid.cpp (+21/-9) plugins/unityshell/src/ResultViewGrid.h (+2/-0) plugins/unityshell/src/SearchBar.cpp (+29/-55) |
To merge this branch: | bzr merge lp:~azzar1/unity/dash-layout-2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Cimitan (community) | design | Approve | |
Tim Penhey (community) | Approve | ||
John Lea | design | Pending | |
Review via email: mp+98531@code.launchpad.net |
Commit message
Fixing current dash layout which doesn't match the wanted design.
Moreover the dash code is full of magic number.
Description of the change
== Problem ==
The current dash layout doesn't match the wanted design. Moreover the dash code is full of magic numbers.
== Fix ==
Moves as many magic numbers as possible in dash::style.
== Test ==
Not applicable.
== Screenshots ==
Don't just rely on screenshots please.
http://
http://
http://
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Coode looks good (even if you forget there few debug comments or empty spaces :P)
Anyway I was looking at the screenshot, the line separator between the dash and the launcher shouldn't be just gray, but a gray blended with the background average color...
Andrea Cimitan (cimi) wrote : | # |
I agree with Marco.
Also, the separator line between the panel and the dash is still not fixed: https:/
Andrea Cimitan (cimi) wrote : | # |
Happy with the improvement so far, will file a bug for refinements and remaining issues.
Unity Merger (unity-merger) wrote : | # |
No commit message specified.
Unity Merger (unity-merger) wrote : | # |
Attempt to merge into lp:unity failed due to conflicts:
text conflict in plugins/
Didier Roche-Tolomelli (didrocks) wrote : | # |
see https:/
Andrea Azzarone (azzar1) wrote : | # |
> Anyway I was looking at the screenshot, the line separator between the dash and the launcher shouldn't be just gray, but a gray blended with the background average color...
I've just fixed the redrawing problem :)
Preview Diff
1 | === modified file 'plugins/unityshell/src/AbstractPlacesGroup.cpp' |
2 | --- plugins/unityshell/src/AbstractPlacesGroup.cpp 2012-03-09 21:52:23 +0000 |
3 | +++ plugins/unityshell/src/AbstractPlacesGroup.cpp 2012-03-20 23:22:18 +0000 |
4 | @@ -28,7 +28,7 @@ |
5 | |
6 | AbstractPlacesGroup::AbstractPlacesGroup() |
7 | : nux::View(NUX_TRACKER_LOCATION) |
8 | - , draw_separator(true) |
9 | + , draw_separator(false) |
10 | { |
11 | } |
12 | |
13 | @@ -40,5 +40,5 @@ |
14 | { |
15 | } |
16 | |
17 | -} |
18 | -} |
19 | +} // namespace dash |
20 | +} // namespace unity |
21 | |
22 | === modified file 'plugins/unityshell/src/DashStyle.cpp' |
23 | --- plugins/unityshell/src/DashStyle.cpp 2012-03-06 20:34:48 +0000 |
24 | +++ plugins/unityshell/src/DashStyle.cpp 2012-03-20 23:22:18 +0000 |
25 | @@ -1533,16 +1533,16 @@ |
26 | (double) (garnish) + 1.0, |
27 | (double) (garnish) + 1.0, |
28 | 7.0, |
29 | + w - (double) (2 * garnish) - 2.0, |
30 | + h - (double) (2 * garnish) - 2.0); |
31 | + else |
32 | + RoundedRect(cr, |
33 | + 1.0, |
34 | + (double) (garnish) + 0.5, |
35 | + (double) (garnish) + 0.5, |
36 | + 7.0, |
37 | w - (double) (2 * garnish) - 1.0, |
38 | h - (double) (2 * garnish) - 1.0); |
39 | - else |
40 | - RoundedRect(cr, |
41 | - 1.0, |
42 | - (double) (garnish), |
43 | - (double) (garnish), |
44 | - 7.0, |
45 | - w - (double) (2 * garnish), |
46 | - h - (double) (2 * garnish)); |
47 | |
48 | |
49 | if (pimpl->button_label_fill_color_[state].alpha != 0.0) |
50 | @@ -1728,8 +1728,6 @@ |
51 | if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE) |
52 | return false; |
53 | |
54 | - unsigned int garnish = GetButtonGarnishSize(); |
55 | - |
56 | double w = cairo_image_surface_get_width(cairo_get_target(cr)); |
57 | double h = cairo_image_surface_get_height(cairo_get_target(cr)); |
58 | |
59 | @@ -1739,12 +1737,12 @@ |
60 | |
61 | RoundedRect(cr, |
62 | 1.0, |
63 | - (double) (garnish), |
64 | - (double) (garnish), |
65 | + (double) 0.5, |
66 | + (double) 0.5, |
67 | 7.0, |
68 | - w - (double) (2 * garnish), |
69 | - h - (double) (2 * garnish)); |
70 | - |
71 | + w - 1.0, |
72 | + h - 1.0); |
73 | + |
74 | cairo_set_source_rgba(cr, color); |
75 | cairo_fill_preserve(cr); |
76 | cairo_stroke(cr); |
77 | @@ -2153,6 +2151,127 @@ |
78 | return pimpl->dash_shine_.texture(); |
79 | } |
80 | |
81 | +int Style::GetVSeparatorSize() const |
82 | +{ |
83 | + return 1; |
84 | +} |
85 | + |
86 | +int Style::GetHSeparatorSize() const |
87 | +{ |
88 | + return 1; |
89 | + |
90 | +} |
91 | + |
92 | +int Style::GetFilterBarWidth() const |
93 | +{ |
94 | + return 300; |
95 | +} |
96 | + |
97 | + |
98 | +int Style::GetFilterBarLeftPadding() const |
99 | +{ |
100 | + return 5; |
101 | +} |
102 | + |
103 | +int Style::GetFilterBarRightPadding() const |
104 | +{ |
105 | + return 5; |
106 | +} |
107 | + |
108 | +int Style::GetDashViewTopPadding() const |
109 | +{ |
110 | + return 10; |
111 | +} |
112 | + |
113 | +int Style::GetSearchBarLeftPadding() const |
114 | +{ |
115 | + return 10; |
116 | +} |
117 | + |
118 | +int Style::GetSearchBarRightPadding() const |
119 | +{ |
120 | + return 10; |
121 | +} |
122 | + |
123 | +int Style::GetSearchBarHeight() const |
124 | +{ |
125 | + return 42; |
126 | +} |
127 | + |
128 | +int Style::GetFilterResultsHighlightRightPadding() const |
129 | +{ |
130 | + return 5; |
131 | +} |
132 | + |
133 | +int Style::GetFilterResultsHighlightLeftPadding() const |
134 | +{ |
135 | + return 5; |
136 | +} |
137 | + |
138 | +int Style::GetFilterBarTopPadding() const |
139 | +{ |
140 | + return 10; |
141 | +} |
142 | + |
143 | +int Style::GetFilterHighlightPadding() const |
144 | +{ |
145 | + return 2; |
146 | +} |
147 | + |
148 | +int Style::GetSpaceBetweenFilterWidgets() const |
149 | +{ |
150 | + return 12; |
151 | +} |
152 | + |
153 | +int Style::GetAllButtonHeight() const |
154 | +{ |
155 | + return 30; |
156 | +} |
157 | + |
158 | +int Style::GetFilterButtonHeight() const |
159 | +{ |
160 | + return 30; |
161 | +} |
162 | + |
163 | +int Style::GetSpaceBetweenLensAndFilters() const |
164 | +{ |
165 | + return 9; |
166 | +} |
167 | + |
168 | +int Style::GetFilterViewRightPadding() const |
169 | +{ |
170 | + return 10; |
171 | +} |
172 | + |
173 | +int Style::GetScrollbarWidth() const |
174 | +{ |
175 | + return 3; |
176 | +} |
177 | + |
178 | +int Style::GetCategoryHighlightHeight() const |
179 | +{ |
180 | + return 24; |
181 | +} |
182 | + |
183 | +int Style::GetPlacesGroupTopSpace() const |
184 | +{ |
185 | + return 15; |
186 | +} |
187 | + |
188 | +int Style::GetCategoryHeaderLeftPadding() const |
189 | +{ |
190 | + return 20; |
191 | +} |
192 | + |
193 | +int Style::GetCategorySeparatorLeftPadding() const |
194 | +{ |
195 | + return 15; |
196 | +} |
197 | + |
198 | +int Style::GetCategorySeparatorRightPadding() const |
199 | +{ |
200 | + return 15; |
201 | +} |
202 | |
203 | namespace |
204 | { |
205 | |
206 | === modified file 'plugins/unityshell/src/DashStyle.h' |
207 | --- plugins/unityshell/src/DashStyle.h 2012-03-20 10:27:41 +0000 |
208 | +++ plugins/unityshell/src/DashStyle.h 2012-03-20 23:22:18 +0000 |
209 | @@ -189,6 +189,47 @@ |
210 | nux::BaseTexture* GetStarSelectedIcon(); |
211 | nux::BaseTexture* GetStarHighlightIcon(); |
212 | |
213 | + // Returns the width of the separator between the dash and the launcher. |
214 | + int GetVSeparatorSize() const; |
215 | + |
216 | + // Returns the height of the separator between the dash and the top panel. |
217 | + int GetHSeparatorSize() const; |
218 | + |
219 | + // Practically it is the space between the top border of the dash and the searchbar. |
220 | + int GetDashViewTopPadding() const; |
221 | + |
222 | + // Search bar |
223 | + int GetSearchBarLeftPadding() const; |
224 | + int GetSearchBarRightPadding() const; |
225 | + int GetSearchBarHeight() const; |
226 | + int GetFilterResultsHighlightRightPadding() const; |
227 | + int GetFilterResultsHighlightLeftPadding() const; |
228 | + |
229 | + // Filter bar |
230 | + int GetFilterBarTopPadding() const; |
231 | + int GetFilterHighlightPadding() const; |
232 | + int GetSpaceBetweenFilterWidgets() const; |
233 | + int GetAllButtonHeight() const; |
234 | + int GetFilterBarLeftPadding() const; |
235 | + int GetFilterBarRightPadding() const; |
236 | + int GetFilterBarWidth() const; |
237 | + int GetFilterButtonHeight() const; |
238 | + int GetFilterViewRightPadding() const; |
239 | + |
240 | + int GetSpaceBetweenLensAndFilters() const; |
241 | + |
242 | + // Scrollbars |
243 | + int GetScrollbarWidth() const; |
244 | + |
245 | + // Places Group |
246 | + int GetCategoryHighlightHeight() const; |
247 | + int GetPlacesGroupTopSpace() const; |
248 | + int GetCategoryHeaderLeftPadding() const; |
249 | + int GetCategorySeparatorLeftPadding() const; |
250 | + int GetCategorySeparatorRightPadding() const; |
251 | + |
252 | + const static int SEARCH_BAR_EXTRA_PADDING = 1; |
253 | + |
254 | sigc::signal<void> changed; |
255 | |
256 | private: |
257 | |
258 | === modified file 'plugins/unityshell/src/DashView.cpp' |
259 | --- plugins/unityshell/src/DashView.cpp 2012-03-15 12:39:16 +0000 |
260 | +++ plugins/unityshell/src/DashView.cpp 2012-03-20 23:22:18 +0000 |
261 | @@ -86,10 +86,10 @@ |
262 | , visible_(false) |
263 | { |
264 | renderer_.SetOwner(this); |
265 | - renderer_.need_redraw.connect([this] () { |
266 | + renderer_.need_redraw.connect([this] () { |
267 | QueueDraw(); |
268 | }); |
269 | - |
270 | + |
271 | SetupViews(); |
272 | SetupUBusConnections(); |
273 | |
274 | @@ -161,21 +161,30 @@ |
275 | |
276 | void DashView::SetupViews() |
277 | { |
278 | + dash::Style& style = dash::Style::Instance(); |
279 | + |
280 | layout_ = new nux::VLayout(); |
281 | + layout_->SetLeftAndRightPadding(style.GetVSeparatorSize(), 0); |
282 | + layout_->SetTopAndBottomPadding(style.GetHSeparatorSize(), 0); |
283 | SetLayout(layout_); |
284 | |
285 | content_layout_ = new DashLayout(NUX_TRACKER_LOCATION); |
286 | - content_layout_->SetHorizontalExternalMargin(0); |
287 | - content_layout_->SetVerticalExternalMargin(0); |
288 | - |
289 | + content_layout_->SetTopAndBottomPadding(style.GetDashViewTopPadding() - style.SEARCH_BAR_EXTRA_PADDING, 0); |
290 | layout_->AddLayout(content_layout_, 1, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL); |
291 | + |
292 | + search_bar_layout_ = new nux::HLayout(); |
293 | + search_bar_layout_->SetLeftAndRightPadding(style.GetSearchBarLeftPadding() - style.SEARCH_BAR_EXTRA_PADDING, style.GetSearchBarLeftPadding() - style.GetFilterResultsHighlightRightPadding() - style.SEARCH_BAR_EXTRA_PADDING); |
294 | + content_layout_->AddLayout(search_bar_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
295 | + |
296 | search_bar_ = new SearchBar(); |
297 | AddChild(search_bar_); |
298 | + search_bar_->SetMinimumHeight(style.GetSearchBarHeight() + style.SEARCH_BAR_EXTRA_PADDING * 2); |
299 | + search_bar_->SetMaximumHeight(style.GetSearchBarHeight() + style.SEARCH_BAR_EXTRA_PADDING * 2); |
300 | search_bar_->activated.connect(sigc::mem_fun(this, &DashView::OnEntryActivated)); |
301 | search_bar_->search_changed.connect(sigc::mem_fun(this, &DashView::OnSearchChanged)); |
302 | search_bar_->live_search_reached.connect(sigc::mem_fun(this, &DashView::OnLiveSearchReached)); |
303 | search_bar_->showing_filters.changed.connect([&] (bool showing) { if (active_lens_view_) active_lens_view_->filters_expanded = showing; QueueDraw(); }); |
304 | - content_layout_->AddView(search_bar_, 0, nux::MINOR_POSITION_LEFT); |
305 | + search_bar_layout_->AddView(search_bar_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
306 | content_layout_->SetSpecialArea(search_bar_->show_filters()); |
307 | |
308 | lenses_layout_ = new nux::VLayout(); |
309 | @@ -207,7 +216,7 @@ |
310 | |
311 | void DashView::Relayout() |
312 | { |
313 | - nux::Geometry geo = GetGeometry(); |
314 | + nux::Geometry const& geo = GetGeometry(); |
315 | content_geo_ = GetBestFitGeometry(geo); |
316 | |
317 | if (Settings::Instance().GetFormFactor() == FormFactor::NETBOOK) |
318 | @@ -216,16 +225,16 @@ |
319 | content_geo_ = geo; |
320 | } |
321 | |
322 | + dash::Style& style = dash::Style::Instance(); |
323 | + |
324 | // kinda hacky, but it makes sure the content isn't so big that it throws |
325 | // the bottom of the dash off the screen |
326 | // not hugely happy with this, so FIXME |
327 | - lenses_layout_->SetMaximumHeight (content_geo_.height - search_bar_->GetGeometry().height - lens_bar_->GetGeometry().height); |
328 | - lenses_layout_->SetMinimumHeight (content_geo_.height - search_bar_->GetGeometry().height - lens_bar_->GetGeometry().height); |
329 | + lenses_layout_->SetMaximumHeight (content_geo_.height - search_bar_->GetGeometry().height - lens_bar_->GetGeometry().height - style.GetDashViewTopPadding()); |
330 | + lenses_layout_->SetMinimumHeight (content_geo_.height - search_bar_->GetGeometry().height - lens_bar_->GetGeometry().height - style.GetDashViewTopPadding()); |
331 | |
332 | layout_->SetMinMaxSize(content_geo_.width, content_geo_.height); |
333 | |
334 | - dash::Style& style = dash::Style::Instance(); |
335 | - |
336 | // Minus the padding that gets added to the left |
337 | float tile_width = style.GetTileWidth(); |
338 | style.SetDefaultNColumns(floorf((content_geo_.width - 32) / tile_width)); |
339 | @@ -257,9 +266,8 @@ |
340 | |
341 | height = search_bar_->GetGeometry().height; |
342 | height += tile_height * 3; |
343 | - height += (24 + 15) * 3; // adding three group headers |
344 | - height += lens_bar_->GetGeometry().height; |
345 | - height += 6; // account for padding in PlacesGroup |
346 | + height += 46 * 3; // adding three group headers |
347 | + //height += lens_bar_->GetGeometry().height; |
348 | |
349 | if (for_geo.width > 800 && for_geo.height > 550) |
350 | { |
351 | @@ -267,7 +275,7 @@ |
352 | height = MIN(height, for_geo.height-24); |
353 | } |
354 | |
355 | - return nux::Geometry(0, 0, width-10, height); |
356 | + return nux::Geometry(0, 0, width, height); |
357 | } |
358 | |
359 | void DashView::Draw(nux::GraphicsEngine& gfx_context, bool force_draw) |
360 | @@ -278,7 +286,7 @@ |
361 | void DashView::DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw) |
362 | { |
363 | renderer_.DrawInner(gfx_context, content_geo_, GetAbsoluteGeometry(), GetGeometry()); |
364 | - |
365 | + |
366 | if (IsFullRedraw()) |
367 | { |
368 | nux::GetPainter().PushBackgroundStack(); |
369 | @@ -289,7 +297,7 @@ |
370 | { |
371 | layout_->ProcessDraw(gfx_context, force_draw); |
372 | } |
373 | - |
374 | + |
375 | renderer_.DrawInnerCleanup(gfx_context, content_geo_, GetAbsoluteGeometry(), GetGeometry()); |
376 | } |
377 | |
378 | @@ -403,8 +411,8 @@ |
379 | |
380 | // 250ms for the Search method call, rest for the actual search |
381 | searching_timeout_id_ = g_timeout_add (500, &DashView::ResetSearchStateCb, this); |
382 | - |
383 | - |
384 | + |
385 | + |
386 | if (hide_message_delay_id_) |
387 | { |
388 | g_source_remove(hide_message_delay_id_); |
389 | @@ -451,6 +459,7 @@ |
390 | } |
391 | |
392 | LensView* view = active_lens_view_ = lens_views_[id]; |
393 | + view->JumpToTop(); |
394 | |
395 | for (auto it: lens_views_) |
396 | { |
397 | @@ -494,8 +503,8 @@ |
398 | } |
399 | |
400 | active_lens_view_->CheckNoResults(hints); |
401 | + std::string const& search_string = search_bar_->search_string; |
402 | |
403 | - std::string search_string = search_bar_->search_string; |
404 | if (active_lens_view_ && active_lens_view_->search_string == search_string) |
405 | { |
406 | search_bar_->SearchFinished(); |
407 | @@ -690,14 +699,14 @@ |
408 | { |
409 | auto show_filters = search_bar_->show_filters(); |
410 | auto fscroll_view = active_lens_view_->fscroll_view(); |
411 | - |
412 | + |
413 | if (show_filters && show_filters->HasKeyFocus()) |
414 | { |
415 | if (fscroll_view->IsVisible() && fscroll_view) |
416 | return fscroll_view->KeyNavIteration(direction); |
417 | else |
418 | return active_lens_view_->KeyNavIteration(direction); |
419 | - } |
420 | + } |
421 | } |
422 | return this; |
423 | } |
424 | @@ -745,7 +754,7 @@ |
425 | direction = KEY_NAV_ENTER; |
426 | break; |
427 | case NUX_VK_F4: |
428 | - // Maybe we should not do it here, but it needs to be checked where |
429 | + // Maybe we should not do it here, but it needs to be checked where |
430 | // we are able to know if alt is pressed. |
431 | if (special_keys_state & NUX_STATE_ALT) |
432 | { |
433 | @@ -757,7 +766,7 @@ |
434 | break; |
435 | } |
436 | |
437 | - // We should not do it here, but I really don't want to make DashView |
438 | + // We should not do it here, but I really don't want to make DashView |
439 | // focusable and I'm not able to know if ctrl is pressed in |
440 | // DashView::KeyNavIteration. |
441 | nux::InputArea* focus_area = nux::GetWindowCompositor().GetKeyFocusArea(); |
442 | @@ -801,10 +810,10 @@ |
443 | for (auto tab = rbegin; tab != rend; ++tab) |
444 | { |
445 | const auto& tab_ptr = *tab; |
446 | - |
447 | + |
448 | if (use_the_prev) |
449 | return tab_ptr; |
450 | - |
451 | + |
452 | if (focus_area) |
453 | use_the_prev = focus_area->IsChildOf(tab_ptr); |
454 | } |
455 | @@ -826,7 +835,7 @@ |
456 | { |
457 | if (use_the_next) |
458 | return tab; |
459 | - |
460 | + |
461 | if (focus_area) |
462 | use_the_next = focus_area->IsChildOf(tab); |
463 | } |
464 | |
465 | === modified file 'plugins/unityshell/src/DashView.h' |
466 | --- plugins/unityshell/src/DashView.h 2012-03-01 08:46:06 +0000 |
467 | +++ plugins/unityshell/src/DashView.h 2012-03-20 23:22:18 +0000 |
468 | @@ -120,6 +120,7 @@ |
469 | // View related |
470 | nux::VLayout* layout_; |
471 | DashLayout* content_layout_; |
472 | + nux::HLayout* search_bar_layout_; |
473 | SearchBar* search_bar_; |
474 | nux::VLayout* lenses_layout_; |
475 | LensBar* lens_bar_; |
476 | |
477 | === modified file 'plugins/unityshell/src/FilterBar.cpp' |
478 | --- plugins/unityshell/src/FilterBar.cpp 2012-02-23 21:20:16 +0000 |
479 | +++ plugins/unityshell/src/FilterBar.cpp 2012-03-20 23:22:18 +0000 |
480 | @@ -23,6 +23,7 @@ |
481 | #include <Nux/VLayout.h> |
482 | #include <NuxCore/Logger.h> |
483 | |
484 | +#include "DashStyle.h" |
485 | #include "FilterBar.h" |
486 | #include "FilterExpanderLabel.h" |
487 | #include "FilterFactory.h" |
488 | @@ -36,9 +37,6 @@ |
489 | |
490 | nux::logging::Logger logger("unity.dash.filterbar"); |
491 | |
492 | -const int SEPARATOR_LEFT_PADDING = 5; |
493 | -const int SEPARATOR_WIDTH_SOTTRACTOR = 9; |
494 | - |
495 | } |
496 | |
497 | NUX_IMPLEMENT_OBJECT_TYPE(FilterBar); |
498 | @@ -59,8 +57,11 @@ |
499 | |
500 | void FilterBar::Init() |
501 | { |
502 | + dash::Style& style = dash::Style::Instance(); |
503 | + |
504 | nux::LinearLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION); |
505 | - layout->SetSpaceBetweenChildren(10); |
506 | + layout->SetTopAndBottomPadding(style.GetFilterBarTopPadding() - style.GetFilterHighlightPadding() - style.SEARCH_BAR_EXTRA_PADDING); |
507 | + layout->SetSpaceBetweenChildren(style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding()); |
508 | SetLayout(layout); |
509 | } |
510 | |
511 | @@ -81,6 +82,8 @@ |
512 | AddChild(filter_view); |
513 | filter_map_[filter] = filter_view; |
514 | GetLayout()->AddView(filter_view, 0, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL); |
515 | + |
516 | + UpdateDrawSeparators(); |
517 | } |
518 | |
519 | void FilterBar::RemoveFilter(Filter::Ptr const& filter) |
520 | @@ -96,6 +99,8 @@ |
521 | break; |
522 | } |
523 | } |
524 | + |
525 | + UpdateDrawSeparators(); |
526 | } |
527 | |
528 | void FilterBar::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) |
529 | @@ -112,36 +117,31 @@ |
530 | GfxContext.PushClippingRectangle(GetGeometry()); |
531 | GetLayout()->ProcessDraw(GfxContext, force_draw); |
532 | |
533 | - nux::Color col(0.13f, 0.13f, 0.13f, 0.13f); |
534 | - |
535 | - std::list<Area *>& layout_list = GetLayout()->GetChildren(); |
536 | - int i = 0; |
537 | - int num_separators = layout_list.size() - 1; |
538 | - |
539 | - for (auto iter : layout_list) |
540 | + GfxContext.PopClippingRectangle(); |
541 | +} |
542 | + |
543 | +void FilterBar::UpdateDrawSeparators() |
544 | +{ |
545 | + std::list<Area*> children = GetLayout()->GetChildren(); |
546 | + std::list<Area*>::reverse_iterator rit; |
547 | + bool found_one = false; |
548 | + |
549 | + for (rit = children.rbegin(); rit != children.rend(); ++rit) |
550 | { |
551 | - if (i != num_separators) |
552 | - { |
553 | - nux::Area* filter_view = iter; |
554 | - nux::Geometry const& geom = filter_view->GetGeometry(); |
555 | - |
556 | - unsigned int alpha = 0, src = 0, dest = 0; |
557 | - GfxContext.GetRenderStates().GetBlend(alpha, src, dest); |
558 | - |
559 | - GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
560 | - GfxContext.GetRenderStates().SetColorMask(true, true, true, false); |
561 | - nux::GetPainter().Draw2DLine(GfxContext, |
562 | - geom.x + SEPARATOR_LEFT_PADDING, geom.y + geom.height - 1, |
563 | - geom.x + geom.width - SEPARATOR_WIDTH_SOTTRACTOR, geom.y + geom.height - 1, |
564 | - col); |
565 | - GfxContext.GetRenderStates().SetBlend(alpha, src, dest); |
566 | - } |
567 | - ++i; |
568 | + FilterExpanderLabel* widget = dynamic_cast<FilterExpanderLabel*>(*rit); |
569 | + |
570 | + if (!widget) |
571 | + continue; |
572 | + |
573 | + widget->draw_separator = found_one; |
574 | + found_one = true; |
575 | } |
576 | - |
577 | - GfxContext.PopClippingRectangle(); |
578 | } |
579 | |
580 | +// |
581 | +// Key navigation |
582 | +// |
583 | + |
584 | bool FilterBar::AcceptKeyNavFocus() |
585 | { |
586 | return false; |
587 | |
588 | === modified file 'plugins/unityshell/src/FilterBar.h' |
589 | --- plugins/unityshell/src/FilterBar.h 2012-02-21 00:11:20 +0000 |
590 | +++ plugins/unityshell/src/FilterBar.h 2012-03-20 23:22:18 +0000 |
591 | @@ -60,6 +60,7 @@ |
592 | |
593 | private: |
594 | void Init(); |
595 | + void UpdateDrawSeparators(); |
596 | |
597 | FilterFactory factory_; |
598 | Filters::Ptr filters_; |
599 | |
600 | === modified file 'plugins/unityshell/src/FilterBasicButton.cpp' |
601 | --- plugins/unityshell/src/FilterBasicButton.cpp 2012-02-17 16:48:25 +0000 |
602 | +++ plugins/unityshell/src/FilterBasicButton.cpp 2012-03-20 23:22:18 +0000 |
603 | @@ -100,7 +100,7 @@ |
604 | |
605 | void FilterBasicButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state) |
606 | { |
607 | - Style::Instance().Button(cr, faked_state, label_); |
608 | + Style::Instance().Button(cr, faked_state, label_, -1, Alignment::CENTER, true); |
609 | } |
610 | |
611 | void FilterBasicButton::RedrawFocusOverlay(nux::Geometry const& geom, cairo_t* cr) |
612 | @@ -111,7 +111,7 @@ |
613 | long FilterBasicButton::ComputeContentSize() |
614 | { |
615 | long ret = nux::Button::ComputeContentSize(); |
616 | - |
617 | + |
618 | nux::Geometry const& geo = GetGeometry(); |
619 | |
620 | if (cached_geometry_ != geo) |
621 | |
622 | === modified file 'plugins/unityshell/src/FilterExpanderLabel.cpp' |
623 | --- plugins/unityshell/src/FilterExpanderLabel.cpp 2012-03-05 20:06:16 +0000 |
624 | +++ plugins/unityshell/src/FilterExpanderLabel.cpp 2012-03-20 23:22:18 +0000 |
625 | @@ -22,31 +22,16 @@ |
626 | |
627 | #include "DashStyle.h" |
628 | #include "FilterExpanderLabel.h" |
629 | +#include "LineSeparator.h" |
630 | |
631 | namespace |
632 | { |
633 | |
634 | const float EXPAND_DEFAULT_ICON_OPACITY = 1.0f; |
635 | |
636 | -// right_hand_contents_ |
637 | -const int RIGHT_HAND_CONTENTS_HEIGHT = 33; |
638 | - |
639 | -// layout_ |
640 | -const int LAYOUT_LEFT_PADDING = 3; |
641 | -const int LAYOUT_RIGHT_PADDING = 1; |
642 | - |
643 | -// top_bar_layout_ |
644 | -const int TOP_BAR_LAYOUT_LEFT_PADDING = 2; |
645 | -const int TOP_BAR_LAYOUT_RIGHT_PADDING = 0; |
646 | -const int TOP_BAR_LAYOUT_WIDTH_ADDER = 19; |
647 | - |
648 | // expander_layout_ |
649 | const int EXPANDER_LAYOUT_SPACE_BETWEEN_CHILDREN = 8; |
650 | |
651 | -// highlight |
652 | -const int HIGHLIGHT_HEIGHT = 34; |
653 | -const int HIGHLIGHT_WIDTH_SUBTRACTOR = 5; |
654 | - |
655 | // font |
656 | const char* const FONT_EXPANDER_LABEL = "Ubuntu Bold 13"; // 17px = 13 |
657 | |
658 | @@ -98,6 +83,7 @@ |
659 | FilterExpanderLabel::FilterExpanderLabel(std::string const& label, NUX_FILE_LINE_DECL) |
660 | : nux::View(NUX_FILE_LINE_PARAM) |
661 | , expanded(true) |
662 | + , draw_separator(false) |
663 | , layout_(nullptr) |
664 | , top_bar_layout_(nullptr) |
665 | , expander_view_(nullptr) |
666 | @@ -106,15 +92,44 @@ |
667 | , cairo_label_(nullptr) |
668 | , raw_label_(label) |
669 | , label_("label") |
670 | + , separator_(nullptr) |
671 | { |
672 | expanded.changed.connect(sigc::mem_fun(this, &FilterExpanderLabel::DoExpandChange)); |
673 | BuildLayout(); |
674 | - |
675 | SetAcceptKeyNavFocusOnMouseDown(false); |
676 | + |
677 | + separator_ = new HSeparator; |
678 | + separator_->SinkReference(); |
679 | + |
680 | + dash::Style& style = dash::Style::Instance(); |
681 | + int space_height = style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding(); |
682 | + |
683 | + space_ = new nux::SpaceLayout(space_height, space_height, space_height, space_height); |
684 | + space_->SinkReference(); |
685 | + |
686 | + draw_separator.changed.connect([&](bool value) |
687 | + { |
688 | + if (value and !separator_->IsChildOf(layout_)) |
689 | + { |
690 | + layout_->AddLayout(space_, 0); |
691 | + layout_->AddView(separator_, 0); |
692 | + } |
693 | + else if (!value and separator_->IsChildOf(layout_)) |
694 | + { |
695 | + layout_->AddLayout(space_, 0); |
696 | + layout_->RemoveChildObject(separator_); |
697 | + } |
698 | + QueueDraw(); |
699 | + }); |
700 | } |
701 | |
702 | FilterExpanderLabel::~FilterExpanderLabel() |
703 | { |
704 | + if (space_) |
705 | + space_->UnReference(); |
706 | + |
707 | + if (separator_) |
708 | + separator_->UnReference(); |
709 | } |
710 | |
711 | void FilterExpanderLabel::SetLabel(std::string const& label) |
712 | @@ -126,11 +141,12 @@ |
713 | |
714 | void FilterExpanderLabel::SetRightHandView(nux::View* view) |
715 | { |
716 | - view->SetMinimumHeight(RIGHT_HAND_CONTENTS_HEIGHT); |
717 | - view->SetMaximumHeight(RIGHT_HAND_CONTENTS_HEIGHT); |
718 | + dash::Style& style = dash::Style::Instance(); |
719 | |
720 | right_hand_contents_ = view; |
721 | - top_bar_layout_->AddView(right_hand_contents_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
722 | + right_hand_contents_->SetMinimumHeight(style.GetAllButtonHeight()); |
723 | + right_hand_contents_->SetMaximumHeight(style.GetAllButtonHeight()); |
724 | + top_bar_layout_->AddView(right_hand_contents_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); |
725 | } |
726 | |
727 | void FilterExpanderLabel::SetContents(nux::Layout* contents) |
728 | @@ -139,18 +155,19 @@ |
729 | contents_ = contents; |
730 | |
731 | layout_->AddLayout(contents_.GetPointer(), 1, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL); |
732 | - top_bar_layout_->SetTopAndBottomPadding(0); |
733 | |
734 | QueueDraw(); |
735 | } |
736 | |
737 | void FilterExpanderLabel::BuildLayout() |
738 | { |
739 | + dash::Style& style = dash::Style::Instance(); |
740 | + |
741 | layout_ = new nux::VLayout(NUX_TRACKER_LOCATION); |
742 | - layout_->SetLeftAndRightPadding(LAYOUT_LEFT_PADDING, LAYOUT_RIGHT_PADDING); |
743 | + layout_->SetLeftAndRightPadding(style.GetFilterBarLeftPadding(), style.GetFilterBarRightPadding()); |
744 | |
745 | top_bar_layout_ = new nux::HLayout(NUX_TRACKER_LOCATION); |
746 | - top_bar_layout_->SetLeftAndRightPadding(TOP_BAR_LAYOUT_LEFT_PADDING, TOP_BAR_LAYOUT_RIGHT_PADDING); |
747 | + top_bar_layout_->SetTopAndBottomPadding(style.GetFilterHighlightPadding()); |
748 | |
749 | expander_layout_ = new nux::HLayout(NUX_TRACKER_LOCATION); |
750 | expander_layout_->SetSpaceBetweenChildren(EXPANDER_LAYOUT_SPACE_BETWEEN_CHILDREN); |
751 | @@ -183,8 +200,6 @@ |
752 | expander_layout_->AddView(arrow_layout_, 0, nux::MINOR_POSITION_CENTER); |
753 | top_bar_layout_->AddSpace(1, 1); |
754 | |
755 | - top_bar_layout_->SetMaximumWidth((Style::Instance().GetTileWidth() - 12) * 2 + TOP_BAR_LAYOUT_WIDTH_ADDER); |
756 | - |
757 | layout_->AddLayout(top_bar_layout_, 0, nux::MINOR_POSITION_LEFT); |
758 | layout_->SetVerticalInternalMargin(0); |
759 | |
760 | @@ -232,13 +247,11 @@ |
761 | |
762 | if (change and contents_ and !contents_->IsChildOf(layout_)) |
763 | { |
764 | - layout_->AddLayout(contents_.GetPointer(), 1, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL); |
765 | - top_bar_layout_->SetTopAndBottomPadding(0); |
766 | + layout_->AddLayout(contents_.GetPointer(), 1, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL, 100.0f, nux::LayoutPosition(1)); |
767 | } |
768 | else if (!change and contents_ and contents_->IsChildOf(layout_)) |
769 | { |
770 | layout_->RemoveChildObject(contents_.GetPointer()); |
771 | - top_bar_layout_->SetTopAndBottomPadding(0, 10); |
772 | } |
773 | |
774 | layout_->ComputeContentSize(); |
775 | @@ -261,8 +274,7 @@ |
776 | { |
777 | nux::Geometry geo(top_bar_layout_->GetGeometry()); |
778 | geo.x = base.x; |
779 | - geo.height = HIGHLIGHT_HEIGHT; |
780 | - geo.width = base.width - HIGHLIGHT_WIDTH_SUBTRACTOR;; |
781 | + geo.width = base.width; |
782 | |
783 | if (!highlight_layer_) |
784 | highlight_layer_.reset(dash::Style::Instance().FocusOverlay(geo.width, geo.height)); |
785 | |
786 | === modified file 'plugins/unityshell/src/FilterExpanderLabel.h' |
787 | --- plugins/unityshell/src/FilterExpanderLabel.h 2012-03-01 15:52:33 +0000 |
788 | +++ plugins/unityshell/src/FilterExpanderLabel.h 2012-03-20 23:22:18 +0000 |
789 | @@ -43,6 +43,9 @@ |
790 | |
791 | namespace unity |
792 | { |
793 | + |
794 | +class HSeparator; |
795 | + |
796 | namespace dash |
797 | { |
798 | |
799 | @@ -61,6 +64,7 @@ |
800 | virtual std::string GetFilterType() = 0; |
801 | |
802 | nux::Property<bool> expanded; |
803 | + nux::Property<bool> draw_separator; |
804 | |
805 | protected: |
806 | virtual bool AcceptKeyNavFocus(); |
807 | @@ -88,6 +92,8 @@ |
808 | nux::SpaceLayout* arrow_top_space_; |
809 | nux::SpaceLayout* arrow_bottom_space_; |
810 | IconTexture* expand_icon_; |
811 | + HSeparator* separator_; |
812 | + nux::SpaceLayout* space_; |
813 | |
814 | nux::ObjectPtr<nux::Layout> contents_; |
815 | std::unique_ptr<nux::AbstractPaintLayer> highlight_layer_; |
816 | |
817 | === modified file 'plugins/unityshell/src/FilterGenreWidget.cpp' |
818 | --- plugins/unityshell/src/FilterGenreWidget.cpp 2012-02-09 20:19:30 +0000 |
819 | +++ plugins/unityshell/src/FilterGenreWidget.cpp 2012-03-20 23:22:18 +0000 |
820 | @@ -39,6 +39,8 @@ |
821 | FilterGenre::FilterGenre(int columns, NUX_FILE_LINE_DECL) |
822 | : FilterExpanderLabel(_("Categories"), NUX_FILE_LINE_PARAM) |
823 | { |
824 | + dash::Style& style = dash::Style::Instance(); |
825 | + |
826 | InitTheme(); |
827 | |
828 | all_button_ = new FilterAllButton(NUX_TRACKER_LOCATION); |
829 | @@ -46,16 +48,18 @@ |
830 | genre_layout_ = new nux::GridHLayout(NUX_TRACKER_LOCATION); |
831 | genre_layout_->ForceChildrenSize(true); |
832 | genre_layout_->MatchContentSize(true); |
833 | - genre_layout_->SetSpaceBetweenChildren (9, 9); |
834 | - genre_layout_->SetTopAndBottomPadding(9, 12); |
835 | + genre_layout_->SetTopAndBottomPadding(style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding(), style.GetFilterHighlightPadding()); |
836 | genre_layout_->EnablePartialVisibility(false); |
837 | + |
838 | if (columns == 3) |
839 | { |
840 | - genre_layout_->SetChildrenSize(92, 33); |
841 | + genre_layout_->SetChildrenSize((style.GetFilterBarWidth() - 12 * 2) / 3, style.GetFilterButtonHeight()); |
842 | + genre_layout_->SetSpaceBetweenChildren (12, 12); |
843 | } |
844 | else |
845 | { |
846 | - genre_layout_->SetChildrenSize(Style::Instance().GetTileWidth() - 7, 33); |
847 | + genre_layout_->SetChildrenSize((style.GetFilterBarWidth() - 10 ) / 2, style.GetFilterButtonHeight()); |
848 | + genre_layout_->SetSpaceBetweenChildren (10, 12); |
849 | } |
850 | |
851 | SetRightHandView(all_button_); |
852 | @@ -72,7 +76,7 @@ |
853 | |
854 | all_button_->SetFilter(filter_); |
855 | expanded = !filter_->collapsed(); |
856 | - |
857 | + |
858 | filter_->option_added.connect(sigc::mem_fun(this, &FilterGenre::OnOptionAdded)); |
859 | filter_->option_removed.connect(sigc::mem_fun(this, &FilterGenre::OnOptionRemoved)); |
860 | |
861 | |
862 | === modified file 'plugins/unityshell/src/FilterMultiRangeButton.cpp' |
863 | --- plugins/unityshell/src/FilterMultiRangeButton.cpp 2012-03-01 15:52:33 +0000 |
864 | +++ plugins/unityshell/src/FilterMultiRangeButton.cpp 2012-03-20 23:22:18 +0000 |
865 | @@ -148,7 +148,7 @@ |
866 | } |
867 | } |
868 | |
869 | - SetMinimumHeight(32); |
870 | + SetMinimumHeight(dash::Style::Instance().GetFilterButtonHeight() + 3); |
871 | } |
872 | |
873 | void FilterMultiRangeButton::RedrawTheme(nux::Geometry const& geom, |
874 | @@ -190,7 +190,7 @@ |
875 | cairo_t* cr, |
876 | MultiRangeArrow faked_arrow, |
877 | MultiRangeSide faked_side) |
878 | -{ |
879 | +{ |
880 | Arrow arrow; |
881 | if (faked_arrow == MultiRangeArrow::NONE) |
882 | arrow = Arrow::NONE; |
883 | |
884 | === modified file 'plugins/unityshell/src/FilterMultiRangeWidget.cpp' |
885 | --- plugins/unityshell/src/FilterMultiRangeWidget.cpp 2012-02-13 02:15:31 +0000 |
886 | +++ plugins/unityshell/src/FilterMultiRangeWidget.cpp 2012-03-20 23:22:18 +0000 |
887 | @@ -22,6 +22,7 @@ |
888 | |
889 | #include <Nux/Nux.h> |
890 | |
891 | +#include "DashStyle.h" |
892 | #include "FilterMultiRangeWidget.h" |
893 | #include "FilterMultiRangeButton.h" |
894 | #include "FilterBasicButton.h" |
895 | @@ -33,15 +34,6 @@ |
896 | { |
897 | namespace dash |
898 | { |
899 | -namespace |
900 | -{ |
901 | - |
902 | -const int TOP_PADDING = 9; |
903 | -const int RIGHT_PADDING = 8; |
904 | -const int BOTTOM_PADDING = 12; |
905 | -const int LEFT_PADDING = 0; |
906 | - |
907 | -} |
908 | |
909 | NUX_IMPLEMENT_OBJECT_TYPE(FilterMultiRange); |
910 | |
911 | @@ -50,11 +42,17 @@ |
912 | { |
913 | InitTheme(); |
914 | |
915 | + dash::Style& style = dash::Style::Instance(); |
916 | + const int left_padding = 0; |
917 | + const int right_padding = 0; |
918 | + const int top_padding = style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding() - 2; |
919 | + const int bottom_padding = style.GetFilterHighlightPadding() - 1; |
920 | + |
921 | all_button_ = new FilterAllButton(NUX_TRACKER_LOCATION); |
922 | |
923 | layout_ = new nux::HLayout(NUX_TRACKER_LOCATION); |
924 | - layout_->SetLeftAndRightPadding(LEFT_PADDING, RIGHT_PADDING); |
925 | - layout_->SetTopAndBottomPadding(TOP_PADDING, BOTTOM_PADDING); |
926 | + layout_->SetLeftAndRightPadding(left_padding, right_padding); |
927 | + layout_->SetTopAndBottomPadding(top_padding, bottom_padding); |
928 | |
929 | SetRightHandView(all_button_); |
930 | SetContents(layout_); |
931 | |
932 | === modified file 'plugins/unityshell/src/FilterRatingsWidget.cpp' |
933 | --- plugins/unityshell/src/FilterRatingsWidget.cpp 2012-02-20 11:59:12 +0000 |
934 | +++ plugins/unityshell/src/FilterRatingsWidget.cpp 2012-03-20 23:22:18 +0000 |
935 | @@ -24,6 +24,7 @@ |
936 | #include <glib.h> |
937 | #include <glib/gi18n-lib.h> |
938 | |
939 | +#include "DashStyle.h" |
940 | #include "FilterGenreWidget.h" |
941 | #include "FilterGenreButton.h" |
942 | #include "FilterBasicButton.h" |
943 | @@ -32,8 +33,6 @@ |
944 | |
945 | namespace |
946 | { |
947 | -const int top_padding = 11; |
948 | -const int bottom_padding = 12; |
949 | const int star_size = 28; |
950 | } |
951 | |
952 | @@ -49,6 +48,10 @@ |
953 | { |
954 | all_button_ = new FilterAllButton(NUX_TRACKER_LOCATION); |
955 | |
956 | + dash::Style& style = dash::Style::Instance(); |
957 | + const int top_padding = style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding() - 1; // -1 (PNGs have an 1px top padding) |
958 | + const int bottom_padding = style.GetFilterHighlightPadding(); |
959 | + |
960 | nux::VLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION); |
961 | layout->SetTopAndBottomPadding(top_padding, bottom_padding); |
962 | ratings_ = new FilterRatingsButton(NUX_TRACKER_LOCATION); |
963 | |
964 | === modified file 'plugins/unityshell/src/HudView.cpp' |
965 | --- plugins/unityshell/src/HudView.cpp 2012-03-20 15:15:18 +0000 |
966 | +++ plugins/unityshell/src/HudView.cpp 2012-03-20 23:22:18 +0000 |
967 | @@ -321,6 +321,8 @@ |
968 | |
969 | void View::SetupViews() |
970 | { |
971 | + dash::Style& style = dash::Style::Instance(); |
972 | + |
973 | nux::VLayout* super_layout = new nux::VLayout(); |
974 | layout_ = new nux::HLayout(); |
975 | { |
976 | @@ -348,6 +350,8 @@ |
977 | // add the search bar to the composite |
978 | search_bar_ = new unity::SearchBar(content_width, true); |
979 | search_bar_->disable_glow = true; |
980 | + search_bar_->SetMinimumHeight(style.GetSearchBarHeight() + style.SEARCH_BAR_EXTRA_PADDING * 2); |
981 | + search_bar_->SetMaximumHeight(style.GetSearchBarHeight() + style.SEARCH_BAR_EXTRA_PADDING * 2); |
982 | search_bar_->search_hint = default_text; |
983 | search_bar_->search_changed.connect(sigc::mem_fun(this, &View::OnSearchChanged)); |
984 | AddChild(search_bar_.GetPointer()); |
985 | |
986 | === modified file 'plugins/unityshell/src/LensView.cpp' |
987 | --- plugins/unityshell/src/LensView.cpp 2012-03-15 12:39:16 +0000 |
988 | +++ plugins/unityshell/src/LensView.cpp 2012-03-20 23:22:18 +0000 |
989 | @@ -37,12 +37,9 @@ |
990 | { |
991 | namespace dash |
992 | { |
993 | - |
994 | namespace |
995 | { |
996 | nux::logging::Logger logger("unity.dash.lensview"); |
997 | - |
998 | -const int FSCROLL_VIEW_WIDTH_ADDER = 11; |
999 | } |
1000 | |
1001 | // This is so we can access some protected members in scrollview. |
1002 | @@ -84,7 +81,7 @@ |
1003 | ScrollDown (1, size); |
1004 | } |
1005 | } |
1006 | - |
1007 | + |
1008 | void SetRightArea(nux::Area* area) |
1009 | { |
1010 | right_area_ = area; |
1011 | @@ -94,7 +91,7 @@ |
1012 | { |
1013 | up_area_ = area; |
1014 | } |
1015 | - |
1016 | + |
1017 | protected: |
1018 | |
1019 | // This is so we can break the natural key navigation path. |
1020 | @@ -163,7 +160,7 @@ |
1021 | auto expand_label = category->GetHeaderFocusableView(); |
1022 | auto child = category->GetChildView(); |
1023 | |
1024 | - if ((child && child->HasKeyFocus()) || |
1025 | + if ((child && child->HasKeyFocus()) || |
1026 | (expand_label && expand_label->HasKeyFocus())) |
1027 | { |
1028 | |
1029 | @@ -187,8 +184,11 @@ |
1030 | |
1031 | void LensView::SetupViews(nux::Area* show_filters) |
1032 | { |
1033 | + dash::Style& style = dash::Style::Instance(); |
1034 | + |
1035 | layout_ = new nux::HLayout(NUX_TRACKER_LOCATION); |
1036 | - layout_->SetHorizontalInternalMargin(10); |
1037 | + layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenLensAndFilters()); |
1038 | + |
1039 | scroll_view_ = new LensScrollView(new PlacesVScrollBar(NUX_TRACKER_LOCATION), |
1040 | NUX_TRACKER_LOCATION); |
1041 | scroll_view_->EnableVerticalScrollBar(true); |
1042 | @@ -203,8 +203,7 @@ |
1043 | no_results_->SetTextColor(nux::color::White); |
1044 | scroll_layout_->AddView(no_results_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); |
1045 | |
1046 | - fscroll_view_ = new LensScrollView(new PlacesVScrollBar(NUX_TRACKER_LOCATION), |
1047 | - NUX_TRACKER_LOCATION); |
1048 | + fscroll_view_ = new LensScrollView(new PlacesVScrollBar(NUX_TRACKER_LOCATION), NUX_TRACKER_LOCATION); |
1049 | fscroll_view_->EnableVerticalScrollBar(true); |
1050 | fscroll_view_->EnableHorizontalScrollBar(false); |
1051 | fscroll_view_->SetVisible(false); |
1052 | @@ -215,8 +214,16 @@ |
1053 | fscroll_view_->SetLayout(fscroll_layout_); |
1054 | |
1055 | filter_bar_ = new FilterBar(); |
1056 | + int width = style.GetFilterBarWidth() + |
1057 | + style.GetFilterBarLeftPadding() + |
1058 | + style.GetFilterBarRightPadding(); |
1059 | + |
1060 | + fscroll_view_->SetMinimumWidth(width + style.GetFilterViewRightPadding()); |
1061 | + fscroll_view_->SetMaximumWidth(width + style.GetFilterViewRightPadding()); |
1062 | + filter_bar_->SetMinimumWidth(width); |
1063 | + filter_bar_->SetMaximumWidth(width); |
1064 | AddChild(filter_bar_); |
1065 | - fscroll_layout_->AddView(filter_bar_); |
1066 | + fscroll_layout_->AddView(filter_bar_, 0); |
1067 | |
1068 | SetLayout(layout_); |
1069 | } |
1070 | @@ -393,14 +400,14 @@ |
1071 | |
1072 | LOG_DEBUG(logger) << "The no-result-hint is: " << markup.str(); |
1073 | |
1074 | - scroll_layout_->SetContentDistribution(nux::MAJOR_POSITION_CENTER); |
1075 | + scroll_layout_->SetContentDistribution(nux::MAJOR_POSITION_CENTER); |
1076 | |
1077 | no_results_active_ = true; |
1078 | no_results_->SetText(markup.str()); |
1079 | } |
1080 | else if (count && no_results_active_) |
1081 | { |
1082 | - scroll_layout_->SetContentDistribution(nux::MAJOR_POSITION_START); |
1083 | + scroll_layout_->SetContentDistribution(nux::MAJOR_POSITION_START); |
1084 | |
1085 | no_results_active_ = false; |
1086 | no_results_->SetText(""); |
1087 | @@ -411,7 +418,7 @@ |
1088 | { |
1089 | if (no_results_active_) |
1090 | { |
1091 | - scroll_layout_->SetContentDistribution(nux::MAJOR_POSITION_START); |
1092 | + scroll_layout_->SetContentDistribution(nux::MAJOR_POSITION_START); |
1093 | no_results_active_ = false; |
1094 | no_results_->SetText(""); |
1095 | } |
1096 | @@ -437,13 +444,7 @@ |
1097 | |
1098 | void LensView::OnFilterAdded(Filter::Ptr filter) |
1099 | { |
1100 | - std::string id = filter->id; |
1101 | filter_bar_->AddFilter(filter); |
1102 | - |
1103 | - int width = dash::Style::Instance().GetTileWidth(); |
1104 | - fscroll_view_->SetMinimumWidth(width * 2 + FSCROLL_VIEW_WIDTH_ADDER); |
1105 | - fscroll_view_->SetMaximumWidth(width * 2 + FSCROLL_VIEW_WIDTH_ADDER); |
1106 | - |
1107 | can_refine_search = true; |
1108 | } |
1109 | |
1110 | @@ -476,9 +477,7 @@ |
1111 | void LensView::DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw) |
1112 | { |
1113 | gfx_context.PushClippingRectangle(GetGeometry()); |
1114 | - |
1115 | layout_->ProcessDraw(gfx_context, force_draw); |
1116 | - |
1117 | gfx_context.PopClippingRectangle(); |
1118 | } |
1119 | |
1120 | @@ -514,6 +513,11 @@ |
1121 | return num_rows; |
1122 | } |
1123 | |
1124 | +void LensView::JumpToTop() |
1125 | +{ |
1126 | + scroll_view_->ScrollToPosition(nux::Geometry(0, 0, 0, 0)); |
1127 | +} |
1128 | + |
1129 | void LensView::ActivateFirst() |
1130 | { |
1131 | Results::Ptr results = lens_->results; |
1132 | |
1133 | === modified file 'plugins/unityshell/src/LensView.h' |
1134 | --- plugins/unityshell/src/LensView.h 2012-03-01 08:46:06 +0000 |
1135 | +++ plugins/unityshell/src/LensView.h 2012-03-20 23:22:18 +0000 |
1136 | @@ -59,6 +59,7 @@ |
1137 | nux::Area* fscroll_view() const; |
1138 | |
1139 | int GetNumRows(); |
1140 | + void JumpToTop(); |
1141 | |
1142 | virtual void ActivateFirst(); |
1143 | |
1144 | |
1145 | === modified file 'plugins/unityshell/src/LineSeparator.cpp' |
1146 | --- plugins/unityshell/src/LineSeparator.cpp 2011-12-13 22:53:29 +0000 |
1147 | +++ plugins/unityshell/src/LineSeparator.cpp 2012-03-20 23:22:18 +0000 |
1148 | @@ -23,7 +23,7 @@ |
1149 | |
1150 | namespace unity |
1151 | { |
1152 | - |
1153 | + |
1154 | HSeparator::HSeparator() |
1155 | { |
1156 | SetMinimumHeight(1); |
1157 | @@ -43,31 +43,28 @@ |
1158 | |
1159 | void HSeparator::Draw(nux::GraphicsEngine &GfxContext, bool force_draw) |
1160 | { |
1161 | - nux::Geometry base = GetGeometry(); |
1162 | - base.OffsetPosition(3, 0); |
1163 | - base.OffsetSize(-6, 0); |
1164 | + nux::Geometry const& base = GetGeometry(); |
1165 | int y0 = base.y + base.GetHeight() / 2; |
1166 | |
1167 | - nux::GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetBlend(TRUE, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
1168 | + unsigned int alpha = 0, src = 0, dest = 0; |
1169 | + GfxContext.GetRenderStates().GetBlend(alpha, src, dest); |
1170 | + nux::GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
1171 | |
1172 | if (base.GetWidth() - 2 * border_size_ > 0) |
1173 | { |
1174 | - nux::Color color0 = color_; |
1175 | - nux::Color color1 = color_; |
1176 | - color0.alpha = alpha0_; |
1177 | - color1.alpha = alpha1_; |
1178 | + nux::Color color0 = color_ * alpha0_; |
1179 | + nux::Color color1 = color_ * alpha1_; |
1180 | nux::GetPainter().Draw2DLine(GfxContext, base.x, y0, base.x + border_size_, y0, color0, color1); |
1181 | nux::GetPainter().Draw2DLine(GfxContext, base.x + border_size_, y0, base.x + base.GetWidth() - border_size_, y0, color1, color1); |
1182 | nux::GetPainter().Draw2DLine(GfxContext, base.x + base.GetWidth() - border_size_, y0, base.x + base.GetWidth(), y0, color1, color0); |
1183 | } |
1184 | else |
1185 | { |
1186 | - nux::Color color1 = color_; |
1187 | - color1.alpha = alpha1_; |
1188 | + nux::Color color1 = color_ * alpha1_; |
1189 | nux::GetPainter().Draw2DLine(GfxContext, base.x, y0, base.x + base.GetWidth(), y0, color1, color1); |
1190 | } |
1191 | |
1192 | - nux::GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetBlend(FALSE); |
1193 | + GfxContext.GetRenderStates().SetBlend(alpha, src, dest); |
1194 | } |
1195 | |
1196 | } // namespace unity |
1197 | |
1198 | === modified file 'plugins/unityshell/src/LineSeparator.h' |
1199 | --- plugins/unityshell/src/LineSeparator.h 2011-12-13 22:53:29 +0000 |
1200 | +++ plugins/unityshell/src/LineSeparator.h 2012-03-20 23:22:18 +0000 |
1201 | @@ -34,6 +34,7 @@ |
1202 | ~HSeparator(); |
1203 | |
1204 | protected: |
1205 | + virtual bool AcceptKeyNavFocus() { return false; } |
1206 | virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); |
1207 | virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) {}; |
1208 | |
1209 | |
1210 | === modified file 'plugins/unityshell/src/OverlayRenderer.cpp' |
1211 | --- plugins/unityshell/src/OverlayRenderer.cpp 2012-03-20 08:42:33 +0000 |
1212 | +++ plugins/unityshell/src/OverlayRenderer.cpp 2012-03-20 23:22:18 +0000 |
1213 | @@ -31,7 +31,7 @@ |
1214 | #include "UBusMessages.h" |
1215 | #include "UBusWrapper.h" |
1216 | |
1217 | -namespace unity |
1218 | +namespace unity |
1219 | { |
1220 | namespace |
1221 | { |
1222 | @@ -46,29 +46,29 @@ |
1223 | public: |
1224 | OverlayRendererImpl(OverlayRenderer *parent_); |
1225 | ~OverlayRendererImpl(); |
1226 | - |
1227 | + |
1228 | void Init(); |
1229 | void OnBackgroundColorChanged(GVariant* args); |
1230 | - |
1231 | + |
1232 | void Draw(nux::GraphicsEngine& gfx_context, nux::Geometry content_geo, nux::Geometry absolute_geo, nux::Geometry geometry, bool force_draw); |
1233 | void DrawContent(nux::GraphicsEngine& gfx_context, nux::Geometry content_geo, nux::Geometry absolute_geo, nux::Geometry geometry); |
1234 | void DrawContentCleanup(nux::GraphicsEngine& gfx_context, nux::Geometry content_geo, nux::Geometry absolute_geo, nux::Geometry geometry); |
1235 | - |
1236 | + |
1237 | BackgroundEffectHelper bg_effect_helper_; |
1238 | nux::ColorLayer* bg_layer_; |
1239 | nux::ColorLayer* bg_darken_layer_; |
1240 | nux::Color bg_color_; |
1241 | - |
1242 | + |
1243 | nux::Geometry content_geo; |
1244 | nux::ObjectPtr <nux::IOpenGLBaseTexture> bg_blur_texture_; |
1245 | nux::ObjectPtr <nux::IOpenGLBaseTexture> bg_shine_texture_; |
1246 | - |
1247 | + |
1248 | // temporary variable that stores the number of backgrounds we have rendered |
1249 | int bgs; |
1250 | bool visible; |
1251 | - |
1252 | + |
1253 | UBusManager ubus_manager_; |
1254 | - |
1255 | + |
1256 | OverlayRenderer *parent; |
1257 | }; |
1258 | |
1259 | @@ -93,16 +93,16 @@ |
1260 | rop.SrcBlend = GL_ONE; |
1261 | rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; |
1262 | bg_layer_ = new nux::ColorLayer(nux::Color(0.0f, 0.0f, 0.0f, 0.9), true, rop); |
1263 | - |
1264 | + |
1265 | rop.Blend = true; |
1266 | rop.SrcBlend = GL_ZERO; |
1267 | rop.DstBlend = GL_SRC_COLOR; |
1268 | bg_darken_layer_ = new nux::ColorLayer(nux::Color(0.9f, 0.9f, 0.9f, 1.0f), false, rop); |
1269 | bg_shine_texture_ = unity::dash::Style::Instance().GetDashShine()->GetDeviceTexture(); |
1270 | - |
1271 | + |
1272 | ubus_manager_.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED, |
1273 | sigc::mem_fun(this, &OverlayRendererImpl::OnBackgroundColorChanged)); |
1274 | - |
1275 | + |
1276 | ubus_manager_.SendMessage(UBUS_BACKGROUND_REQUEST_COLOUR_EMIT); |
1277 | } |
1278 | |
1279 | @@ -114,14 +114,14 @@ |
1280 | nux::Color color = nux::Color(red, green, blue, alpha); |
1281 | bg_layer_->SetColor(color); |
1282 | bg_color_ = color; |
1283 | - |
1284 | + |
1285 | parent->need_redraw.emit(); |
1286 | } |
1287 | |
1288 | void OverlayRendererImpl::Draw(nux::GraphicsEngine& gfx_context, nux::Geometry content_geo, nux::Geometry absolute_geo, nux::Geometry geometry, bool force_edges) |
1289 | { |
1290 | bool paint_blur = BackgroundEffectHelper::blur_type != BLUR_NONE; |
1291 | - nux::Geometry geo = content_geo; |
1292 | + nux::Geometry geo(content_geo); |
1293 | |
1294 | if (dash::Settings::Instance().GetFormFactor() != dash::FormFactor::NETBOOK || force_edges) |
1295 | { |
1296 | @@ -242,25 +242,25 @@ |
1297 | } |
1298 | } |
1299 | } |
1300 | - |
1301 | - |
1302 | + |
1303 | + |
1304 | nux::TexCoordXForm texxform_absolute_bg; |
1305 | texxform_absolute_bg.flip_v_coord = true; |
1306 | texxform_absolute_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
1307 | texxform_absolute_bg.uoffset = ((float) content_geo.x) / absolute_geo.width; |
1308 | texxform_absolute_bg.voffset = ((float) content_geo.y) / absolute_geo.height; |
1309 | texxform_absolute_bg.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); |
1310 | - |
1311 | + |
1312 | if (paint_blur) |
1313 | { |
1314 | nux::Geometry blur_geo(absolute_geo.x, absolute_geo.y, content_geo.width, content_geo.height); |
1315 | bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(blur_geo); |
1316 | - |
1317 | + |
1318 | if (bg_blur_texture_.IsValid()) |
1319 | { |
1320 | nux::Geometry bg_clip = geo; |
1321 | gfx_context.PushClippingRectangle(bg_clip); |
1322 | - |
1323 | + |
1324 | gfx_context.GetRenderStates().SetBlend(false); |
1325 | #ifndef NUX_OPENGLES_20 |
1326 | if (gfx_context.UsingGLSLCodePath()) |
1327 | @@ -281,22 +281,24 @@ |
1328 | |
1329 | #endif |
1330 | gPainter.PopBackground(); |
1331 | - |
1332 | + |
1333 | gfx_context.PopClippingRectangle(); |
1334 | } |
1335 | } |
1336 | |
1337 | // Draw the left and top lines |
1338 | + dash::Style& style = dash::Style::Instance(); |
1339 | + |
1340 | gfx_context.GetRenderStates().SetColorMask(true, true, true, true); |
1341 | gfx_context.GetRenderStates().SetBlend(true); |
1342 | gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
1343 | |
1344 | - const double line_opacity = 0.22; |
1345 | + const double line_opacity = 0.22f; |
1346 | nux::Color line_color = nux::color::White * line_opacity; |
1347 | nux::GetPainter().Paint2DQuadColor(gfx_context, |
1348 | nux::Geometry(geometry.x, |
1349 | geometry.y, |
1350 | - 1, |
1351 | + style.GetVSeparatorSize(), |
1352 | content_geo.height + INNER_CORNER_RADIUS), |
1353 | nux::color::Transparent, |
1354 | line_color, |
1355 | @@ -307,12 +309,12 @@ |
1356 | nux::Geometry(geometry.x, |
1357 | geometry.y, |
1358 | content_geo.width + INNER_CORNER_RADIUS, |
1359 | - 1), |
1360 | + style.GetHSeparatorSize()), |
1361 | nux::color::Transparent, |
1362 | nux::color::Transparent, |
1363 | line_color, |
1364 | line_color); |
1365 | - |
1366 | + |
1367 | // Draw the background |
1368 | bg_darken_layer_->SetGeometry(content_geo); |
1369 | nux::GetPainter().RenderSinglePaintLayer(gfx_context, content_geo, bg_darken_layer_); |
1370 | @@ -324,19 +326,19 @@ |
1371 | nux::GetPainter().RenderSinglePaintLayer(gfx_context, content_geo, bg_layer_); |
1372 | } |
1373 | #endif |
1374 | - |
1375 | - |
1376 | + |
1377 | + |
1378 | texxform_absolute_bg.flip_v_coord = false; |
1379 | texxform_absolute_bg.uoffset = (1.0f / bg_shine_texture_->GetWidth()) * parent->x_offset; |
1380 | texxform_absolute_bg.voffset = (1.0f / bg_shine_texture_->GetHeight()) * parent->y_offset; |
1381 | - |
1382 | + |
1383 | gfx_context.GetRenderStates().SetColorMask(true, true, true, false); |
1384 | gfx_context.GetRenderStates().SetBlend(true, GL_DST_COLOR, GL_ONE); |
1385 | - |
1386 | + |
1387 | gfx_context.QRP_1Tex (content_geo.x, content_geo.y, |
1388 | content_geo.width, content_geo.height, |
1389 | bg_shine_texture_, texxform_absolute_bg, nux::color::White); |
1390 | - |
1391 | + |
1392 | if (dash::Settings::Instance().GetFormFactor() != dash::FormFactor::NETBOOK) |
1393 | { |
1394 | // Make bottom-right corner rounded |
1395 | @@ -363,7 +365,7 @@ |
1396 | { |
1397 | nux::Geometry fill_geo (geo.x + geo.width, geo.y + i, INNER_CORNER_RADIUS - i, 1); |
1398 | nux::GetPainter().Paint2DQuadColor(gfx_context, fill_geo, bg_color_); |
1399 | - |
1400 | + |
1401 | nux::Color dark = bg_color_ * 0.8f; |
1402 | dark.alpha = bg_color_.alpha; |
1403 | fill_geo = nux::Geometry(geo.x + i, geo.y + geo.height, 1, INNER_CORNER_RADIUS - i); |
1404 | @@ -377,24 +379,24 @@ |
1405 | bool paint_blur = BackgroundEffectHelper::blur_type != BLUR_NONE; |
1406 | nux::Geometry geo = geometry; |
1407 | bgs = 0; |
1408 | - |
1409 | + |
1410 | gfx_context.PushClippingRectangle(geo); |
1411 | - |
1412 | + |
1413 | gfx_context.GetRenderStates().SetBlend(true); |
1414 | gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
1415 | - |
1416 | + |
1417 | nux::TexCoordXForm texxform_absolute_bg; |
1418 | texxform_absolute_bg.flip_v_coord = true; |
1419 | texxform_absolute_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
1420 | texxform_absolute_bg.uoffset = ((float) content_geo.x) / absolute_geo.width; |
1421 | texxform_absolute_bg.voffset = ((float) content_geo.y) / absolute_geo.height; |
1422 | texxform_absolute_bg.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); |
1423 | - |
1424 | + |
1425 | nux::ROPConfig rop; |
1426 | rop.Blend = false; |
1427 | rop.SrcBlend = GL_ONE; |
1428 | rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; |
1429 | - |
1430 | + |
1431 | if (bg_blur_texture_.IsValid() && paint_blur) |
1432 | { |
1433 | #ifndef NUX_OPENGLES_20 |
1434 | @@ -422,11 +424,11 @@ |
1435 | #endif |
1436 | bgs++; |
1437 | } |
1438 | - |
1439 | + |
1440 | // draw the darkening behind our paint |
1441 | nux::GetPainter().PushLayer(gfx_context, bg_darken_layer_->GetGeometry(), bg_darken_layer_); |
1442 | bgs++; |
1443 | - |
1444 | + |
1445 | #ifndef NUX_OPENGLES_20 |
1446 | if (gfx_context.UsingGLSLCodePath() == FALSE) |
1447 | { |
1448 | @@ -434,7 +436,7 @@ |
1449 | bgs++; |
1450 | } |
1451 | #endif |
1452 | - |
1453 | + |
1454 | // apply the shine |
1455 | rop.Blend = true; |
1456 | rop.SrcBlend = GL_DST_COLOR; |
1457 | @@ -442,7 +444,7 @@ |
1458 | texxform_absolute_bg.flip_v_coord = false; |
1459 | texxform_absolute_bg.uoffset = (1.0f / bg_shine_texture_->GetWidth()) * parent->x_offset; |
1460 | texxform_absolute_bg.voffset = (1.0f / bg_shine_texture_->GetHeight()) * parent->y_offset; |
1461 | - |
1462 | + |
1463 | nux::GetPainter().PushTextureLayer(gfx_context, content_geo, |
1464 | bg_shine_texture_, |
1465 | texxform_absolute_bg, |
1466 | @@ -455,10 +457,10 @@ |
1467 | void OverlayRendererImpl::DrawContentCleanup(nux::GraphicsEngine& gfx_context, nux::Geometry content_geo, nux::Geometry absolute_geo, nux::Geometry geometry) |
1468 | { |
1469 | nux::GetPainter().PopBackground(bgs); |
1470 | - |
1471 | + |
1472 | gfx_context.GetRenderStates().SetBlend(false); |
1473 | gfx_context.PopClippingRectangle(); |
1474 | - |
1475 | + |
1476 | if (dash::Settings::Instance().GetFormFactor() != dash::FormFactor::NETBOOK) |
1477 | { |
1478 | // Make bottom-right corner rounded |
1479 | @@ -474,16 +476,16 @@ |
1480 | true, |
1481 | rop); |
1482 | } |
1483 | - |
1484 | + |
1485 | bgs = 0; |
1486 | } |
1487 | |
1488 | |
1489 | - |
1490 | + |
1491 | OverlayRenderer::OverlayRenderer() |
1492 | : pimpl_(new OverlayRendererImpl(this)) |
1493 | { |
1494 | - |
1495 | + |
1496 | } |
1497 | |
1498 | |
1499 | @@ -540,7 +542,7 @@ |
1500 | LOG_DEBUG(logger) << "OverlayRenderer::DrawInnerCleanup(): absolute_geo: " << absolute_geo.width << "/" << absolute_geo.height; |
1501 | LOG_DEBUG(logger) << "OverlayRenderer::DrawInnerCleanup(): geo: " << geo.width << "/" << geo.height; |
1502 | } |
1503 | - |
1504 | + |
1505 | } |
1506 | |
1507 | |
1508 | |
1509 | === modified file 'plugins/unityshell/src/PlacesGroup.cpp' |
1510 | --- plugins/unityshell/src/PlacesGroup.cpp 2012-03-13 16:19:52 +0000 |
1511 | +++ plugins/unityshell/src/PlacesGroup.cpp 2012-03-20 23:22:18 +0000 |
1512 | @@ -41,9 +41,9 @@ |
1513 | #include <Nux/Utils.h> |
1514 | #include <UnityCore/Variant.h> |
1515 | #include "DashStyle.h" |
1516 | +#include "LineSeparator.h" |
1517 | #include "ubus-server.h" |
1518 | #include "UBusMessages.h" |
1519 | - #include "Introspectable.h" |
1520 | |
1521 | namespace unity |
1522 | { |
1523 | @@ -55,12 +55,8 @@ |
1524 | |
1525 | // Category highlight |
1526 | const int kHighlightHeight = 24; |
1527 | -const int kHighlightWidthSubtractor = 16; |
1528 | -const int kHighlightLeftPadding = 11; |
1529 | - |
1530 | -// Line Separator |
1531 | -const int kSeparatorLeftPadding = 16; |
1532 | -const int kSeparatorWidthSubtractor = 10; |
1533 | +const int kHighlightRightPadding = 10 - 3; // -3 because the scrollbar is not a real overlay scrollbar! |
1534 | +const int kHighlightLeftPadding = 10; |
1535 | |
1536 | // Font |
1537 | const char* const NAME_LABEL_FONT = "Ubuntu 13"; // 17px = 13 |
1538 | @@ -116,23 +112,26 @@ |
1539 | _n_visible_items_in_unexpand_mode(0), |
1540 | _n_total_items(0) |
1541 | { |
1542 | + dash::Style& style = dash::Style::Instance(); |
1543 | + |
1544 | SetAcceptKeyNavFocusOnMouseDown(false); |
1545 | SetAcceptKeyNavFocusOnMouseEnter(false); |
1546 | |
1547 | - nux::BaseTexture* arrow = dash::Style::Instance().GetGroupUnexpandIcon(); |
1548 | + nux::BaseTexture* arrow = style.GetGroupUnexpandIcon(); |
1549 | |
1550 | _cached_name = NULL; |
1551 | _group_layout = new nux::VLayout("", NUX_TRACKER_LOCATION); |
1552 | - _group_layout->SetHorizontalExternalMargin(20); |
1553 | - _group_layout->SetVerticalExternalMargin(1); |
1554 | |
1555 | - _group_layout->AddLayout(new nux::SpaceLayout(15,15,15,15), 0); |
1556 | + // -2 because the icons have an useless border. |
1557 | + int top_space = style.GetPlacesGroupTopSpace() - 2; |
1558 | + _group_layout->AddLayout(new nux::SpaceLayout(top_space, top_space, top_space, top_space), 0); |
1559 | |
1560 | _header_view = new HeaderView(NUX_TRACKER_LOCATION); |
1561 | _group_layout->AddView(_header_view, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_FIX); |
1562 | |
1563 | _header_layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
1564 | - _header_layout->SetHorizontalInternalMargin(10); |
1565 | + _header_layout->SetLeftAndRightPadding(style.GetCategoryHeaderLeftPadding(), 0); |
1566 | + _header_layout->SetSpaceBetweenChildren(10); |
1567 | _header_view->SetLayout(_header_layout); |
1568 | |
1569 | _icon = new IconTexture("", 24); |
1570 | @@ -169,6 +168,16 @@ |
1571 | _expand_icon->SetVisible(false); |
1572 | _expand_layout->AddView(_expand_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); |
1573 | |
1574 | + separator_layout_ = new nux::HLayout(); |
1575 | + separator_layout_->SinkReference(); |
1576 | + separator_layout_->SetLeftAndRightPadding(style.GetCategorySeparatorLeftPadding(), |
1577 | + style.GetCategorySeparatorRightPadding() - style.GetScrollbarWidth()); |
1578 | + |
1579 | + separator_ = new HSeparator; |
1580 | + separator_layout_->AddView(separator_, 1); |
1581 | + |
1582 | + draw_separator.changed.connect(sigc::mem_fun(this, &PlacesGroup::DrawSeparatorChanged)); |
1583 | + |
1584 | SetLayout(_group_layout); |
1585 | |
1586 | // don't need to disconnect these signals as they are disconnected when this object destroys the contents |
1587 | @@ -200,9 +209,21 @@ |
1588 | if (_cached_name != NULL) |
1589 | g_free(_cached_name); |
1590 | |
1591 | + if (separator_layout_) |
1592 | + separator_layout_->UnReference(); |
1593 | + |
1594 | delete _focus_layer; |
1595 | } |
1596 | |
1597 | +void PlacesGroup::DrawSeparatorChanged(bool draw) |
1598 | +{ |
1599 | + if (draw and !separator_layout_->IsChildOf(_group_layout)) |
1600 | + _group_layout->AddView(separator_layout_, 0); |
1601 | + else if (!draw and separator_layout_->IsChildOf(_group_layout)) |
1602 | + _group_layout->RemoveChildObject(separator_layout_); |
1603 | + QueueDraw(); |
1604 | +} |
1605 | + |
1606 | void |
1607 | PlacesGroup::OnLabelActivated(nux::Area* label) |
1608 | { |
1609 | @@ -265,7 +286,14 @@ |
1610 | if (i) |
1611 | AddChild(i); |
1612 | _child_view = view; |
1613 | - _group_layout->AddView(_child_view, 1); |
1614 | + |
1615 | + nux::VLayout* layout = new nux::VLayout(); |
1616 | + layout->AddView(_child_view, 0); |
1617 | + |
1618 | + layout->SetLeftAndRightPadding(25, 0); |
1619 | + _group_layout->AddLayout(new nux::SpaceLayout(8,8,8,8), 0); // top padding |
1620 | + _group_layout->AddLayout(layout, 1); |
1621 | + |
1622 | QueueDraw(); |
1623 | } |
1624 | |
1625 | @@ -370,7 +398,7 @@ |
1626 | if (_focus_layer) |
1627 | delete _focus_layer; |
1628 | |
1629 | - _focus_layer = dash::Style::Instance().FocusOverlay(geo.width - kHighlightWidthSubtractor, kHighlightHeight); |
1630 | + _focus_layer = dash::Style::Instance().FocusOverlay(geo.width - kHighlightLeftPadding - kHighlightRightPadding, kHighlightHeight); |
1631 | |
1632 | _cached_geometry = geo; |
1633 | } |
1634 | @@ -386,27 +414,11 @@ |
1635 | |
1636 | nux::GetPainter().PaintBackground(graphics_engine, base); |
1637 | |
1638 | - graphics_engine.GetRenderStates().SetColorMask(true, true, true, false); |
1639 | - graphics_engine.GetRenderStates().SetBlend(true); |
1640 | - graphics_engine.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
1641 | - |
1642 | - if (draw_separator) |
1643 | - { |
1644 | - nux::Color col(0.15f, 0.15f, 0.15f, 0.15f); |
1645 | - |
1646 | - nux::GetPainter().Draw2DLine(graphics_engine, |
1647 | - base.x + kSeparatorLeftPadding, base.y + base.height - 1, |
1648 | - base.x + base.width - kSeparatorWidthSubtractor, base.y + base.height - 1, |
1649 | - col); |
1650 | - } |
1651 | - |
1652 | - graphics_engine.GetRenderStates().SetColorMask(true, true, true, true); |
1653 | - |
1654 | if (ShouldBeHighlighted()) |
1655 | { |
1656 | nux::Geometry geo(_header_layout->GetGeometry()); |
1657 | - geo.x = base.x + kHighlightLeftPadding; |
1658 | - geo.width = base.width - kHighlightWidthSubtractor; |
1659 | + geo.width = base.width - kHighlightRightPadding - kHighlightLeftPadding; |
1660 | + geo.x += kHighlightLeftPadding; |
1661 | |
1662 | _focus_layer->SetGeometry(geo); |
1663 | _focus_layer->Renderlayer(graphics_engine); |
1664 | |
1665 | === modified file 'plugins/unityshell/src/PlacesGroup.h' |
1666 | --- plugins/unityshell/src/PlacesGroup.h 2012-03-13 16:19:52 +0000 |
1667 | +++ plugins/unityshell/src/PlacesGroup.h 2012-03-20 23:22:18 +0000 |
1668 | @@ -41,6 +41,9 @@ |
1669 | namespace unity |
1670 | { |
1671 | |
1672 | + |
1673 | +class HSeparator; |
1674 | + |
1675 | class PlacesGroup : public dash::AbstractPlacesGroup, public debug::Introspectable |
1676 | { |
1677 | NUX_DECLARE_OBJECT_TYPE(PlacesGroup, dash::AbstractPlacesGroup); |
1678 | @@ -93,6 +96,7 @@ |
1679 | bool HeaderHasKeyFocus() const; |
1680 | bool ShouldBeHighlighted() const; |
1681 | |
1682 | + void DrawSeparatorChanged(bool draw); |
1683 | void RecvMouseClick(int x, int y, unsigned long button_flags, unsigned long key_flags); |
1684 | void RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags); |
1685 | void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags); |
1686 | @@ -109,6 +113,8 @@ |
1687 | nux::HLayout* _expand_layout; |
1688 | nux::View* _child_view; |
1689 | nux::AbstractPaintLayer* _focus_layer; |
1690 | + nux::HLayout* separator_layout_; |
1691 | + HSeparator* separator_; |
1692 | |
1693 | IconTexture* _icon; |
1694 | nux::StaticCairoText* _name; |
1695 | @@ -121,7 +127,6 @@ |
1696 | guint _n_visible_items_in_unexpand_mode; |
1697 | guint _n_total_items; |
1698 | char* _cached_name; |
1699 | - bool _draw_sep; |
1700 | nux::Geometry _cached_geometry; |
1701 | |
1702 | UBusManager _ubus; |
1703 | |
1704 | === modified file 'plugins/unityshell/src/PlacesVScrollBar.cpp' |
1705 | --- plugins/unityshell/src/PlacesVScrollBar.cpp 2012-03-14 10:27:43 +0000 |
1706 | +++ plugins/unityshell/src/PlacesVScrollBar.cpp 2012-03-20 23:22:18 +0000 |
1707 | @@ -28,6 +28,12 @@ |
1708 | : VScrollBar(NUX_FILE_LINE_PARAM), |
1709 | _slider_texture(NULL) |
1710 | { |
1711 | + _scroll_up_button->SetMaximumHeight(15); |
1712 | + _scroll_up_button->SetMinimumHeight(15); |
1713 | + |
1714 | + _scroll_down_button->SetMaximumHeight(15); |
1715 | + _scroll_down_button->SetMinimumHeight(15); |
1716 | + |
1717 | _slider->SetMinimumWidth(3); |
1718 | _slider->SetMaximumWidth(3); |
1719 | SetMinimumWidth(3); |
1720 | @@ -58,8 +64,8 @@ |
1721 | void |
1722 | PlacesVScrollBar::Draw(nux::GraphicsEngine& gfxContext, bool force_draw) |
1723 | { |
1724 | - nux::Color color = nux::color::White; |
1725 | - nux::Geometry base = GetGeometry(); |
1726 | + nux::Color color = nux::color::White; |
1727 | + nux::Geometry const& base = GetGeometry(); |
1728 | nux::TexCoordXForm texxform; |
1729 | |
1730 | gfxContext.PushClippingRectangle(base); |
1731 | @@ -77,7 +83,8 @@ |
1732 | |
1733 | if (content_height_ > container_height_) |
1734 | { |
1735 | - nux::Geometry slider_geo = _slider->GetGeometry(); |
1736 | + nux::Geometry const& slider_geo = _slider->GetGeometry(); |
1737 | + |
1738 | gfxContext.QRP_1Tex(slider_geo.x, |
1739 | slider_geo.y, |
1740 | slider_geo.width, |
1741 | |
1742 | === modified file 'plugins/unityshell/src/ResultViewGrid.cpp' |
1743 | --- plugins/unityshell/src/ResultViewGrid.cpp 2012-02-17 16:48:25 +0000 |
1744 | +++ plugins/unityshell/src/ResultViewGrid.cpp 2012-03-20 23:22:18 +0000 |
1745 | @@ -61,9 +61,10 @@ |
1746 | , recorded_dash_height_(-1) |
1747 | , mouse_last_x_(-1) |
1748 | , mouse_last_y_(-1) |
1749 | + , extra_horizontal_spacing_(0) |
1750 | { |
1751 | SetAcceptKeyNavFocusOnMouseDown(false); |
1752 | - |
1753 | + |
1754 | auto needredraw_lambda = [&](int value) |
1755 | { |
1756 | NeedRedraw(); |
1757 | @@ -268,6 +269,16 @@ |
1758 | { |
1759 | total_height = renderer_->height; |
1760 | } |
1761 | + |
1762 | + int width = (items_per_row * renderer_->width) + (padding*2) + ((items_per_row - 1) * horizontal_spacing); |
1763 | + int geo_width = GetBaseWidth(); |
1764 | + int extra_width = geo_width - (width + 25-3); |
1765 | + |
1766 | + if (items_per_row != 1) |
1767 | + extra_horizontal_spacing_ = extra_width / (items_per_row - 1); |
1768 | + if (extra_horizontal_spacing_ < 0) |
1769 | + extra_horizontal_spacing_ = 0; |
1770 | + |
1771 | SetMinimumHeight(total_height + (padding * 2)); |
1772 | SetMaximumHeight(total_height + (padding * 2)); |
1773 | PositionPreview(); |
1774 | @@ -477,7 +488,7 @@ |
1775 | selected_index_ = std::min(static_cast<int>(results_.size() - 1), selected_index_); |
1776 | focused_uri_ = results_[selected_index_].uri; |
1777 | |
1778 | - int focused_x = (renderer_->width + horizontal_spacing) * (selected_index_ % items_per_row); |
1779 | + int focused_x = (renderer_->width + horizontal_spacing + extra_horizontal_spacing_) * (selected_index_ % items_per_row); |
1780 | int focused_y = (renderer_->height + vertical_spacing) * (selected_index_ / items_per_row); |
1781 | |
1782 | ubus_.SendMessage(UBUS_RESULT_VIEW_KEYNAV_CHANGED, |
1783 | @@ -510,19 +521,19 @@ |
1784 | if (direction == nux::KEY_NAV_UP && expanded) |
1785 | { |
1786 | // This View just got focused through keyboard navigation and the |
1787 | - // focus is comming from the bottom. We want to focus the |
1788 | + // focus is comming from the bottom. We want to focus the |
1789 | // first item (on the left) of the last row in this grid. |
1790 | |
1791 | int total_rows = std::ceil(results_.size() / (double)items_per_row); |
1792 | selected_index_ = items_per_row * (total_rows-1); |
1793 | |
1794 | - focused_x = (renderer_->width + horizontal_spacing) * (selected_index_ % items_per_row); |
1795 | + focused_x = (renderer_->width + horizontal_spacing + extra_horizontal_spacing_) * (selected_index_ % items_per_row); |
1796 | focused_y = (renderer_->height + vertical_spacing) * (selected_index_ / items_per_row); |
1797 | |
1798 | } |
1799 | else |
1800 | { |
1801 | - focused_x = (renderer_->width + horizontal_spacing) * (selected_index_ % items_per_row); |
1802 | + focused_x = (renderer_->width + horizontal_spacing + extra_horizontal_spacing_) * (selected_index_ % items_per_row); |
1803 | focused_y = (renderer_->height + vertical_spacing) * (selected_index_ / items_per_row); |
1804 | } |
1805 | |
1806 | @@ -670,9 +681,10 @@ |
1807 | offset_y = 0; |
1808 | } |
1809 | nux::Geometry render_geo(x_position, y_position, renderer_->width, renderer_->height); |
1810 | +//nux::GetPainter().Paint2DQuadColor(GfxContext, render_geo, nux::color::Blue*0.20); |
1811 | renderer_->Render(GfxContext, results_[index], state, render_geo, offset_x, offset_y); |
1812 | |
1813 | - x_position += renderer_->width + horizontal_spacing; |
1814 | + x_position += renderer_->width + horizontal_spacing + extra_horizontal_spacing_; |
1815 | } |
1816 | } |
1817 | |
1818 | @@ -734,7 +746,7 @@ |
1819 | { |
1820 | uint items_per_row = GetItemsPerRow(); |
1821 | |
1822 | - uint column_size = renderer_->width + horizontal_spacing; |
1823 | + uint column_size = renderer_->width + horizontal_spacing + extra_horizontal_spacing_; |
1824 | uint row_size = renderer_->height + vertical_spacing; |
1825 | |
1826 | if (preview_layout_ != NULL && (y - padding) / row_size > preview_row_) |
1827 | @@ -908,11 +920,11 @@ |
1828 | last_mouse_down_y_ = -1; |
1829 | current_drag_uri_.clear(); |
1830 | current_drag_icon_name_.clear(); |
1831 | - |
1832 | + |
1833 | // We need this because the drag can start in a ResultViewGrid and can |
1834 | // end in another ResultViewGrid |
1835 | EmitMouseLeaveSignal(0, 0, 0, 0); |
1836 | - |
1837 | + |
1838 | // We need an extra mouse motion to highlight the icon under the mouse |
1839 | // as soon as dnd finish |
1840 | Display* display = nux::GetGraphicsDisplay()->GetX11Display(); |
1841 | |
1842 | === modified file 'plugins/unityshell/src/ResultViewGrid.h' |
1843 | --- plugins/unityshell/src/ResultViewGrid.h 2012-02-22 10:35:19 +0000 |
1844 | +++ plugins/unityshell/src/ResultViewGrid.h 2012-03-20 23:22:18 +0000 |
1845 | @@ -106,6 +106,8 @@ |
1846 | int mouse_last_x_; |
1847 | int mouse_last_y_; |
1848 | |
1849 | + int extra_horizontal_spacing_; |
1850 | + |
1851 | UBusManager ubus_; |
1852 | |
1853 | }; |
1854 | |
1855 | === modified file 'plugins/unityshell/src/SearchBar.cpp' |
1856 | --- plugins/unityshell/src/SearchBar.cpp 2012-03-16 01:48:22 +0000 |
1857 | +++ plugins/unityshell/src/SearchBar.cpp 2012-03-20 23:22:18 +0000 |
1858 | @@ -46,21 +46,13 @@ |
1859 | namespace |
1860 | { |
1861 | const float kExpandDefaultIconOpacity = 1.0f; |
1862 | -const int external_margin_vertical = 8; |
1863 | -const int external_margin_horizontal = 7; |
1864 | const int LIVE_SEARCH_TIMEOUT = 40; |
1865 | const int SPINNER_TIMEOUT = 100; |
1866 | |
1867 | -const int SPINNER_HEIGHT = 48; // To don't break the current layout, let's use a fixed height for the spinner. |
1868 | -const int SPACE_BETWEEN_SPINNER_AND_TEXT = 4; |
1869 | -const int LEFT_INTERNAL_PADDING = 9; |
1870 | - |
1871 | - |
1872 | -// Highlight |
1873 | +const int SPACE_BETWEEN_SPINNER_AND_TEXT = 5; |
1874 | +const int LEFT_INTERNAL_PADDING = 7; |
1875 | + |
1876 | const int HIGHLIGHT_HEIGHT = 24; |
1877 | -const int HIGHLIGHT_WIDTH = 292; |
1878 | -const int HIGHLIGHT_LEFT_PADDING = 5; |
1879 | -const int HIGHLIGHT_RIGHT_PADDING = 4; |
1880 | |
1881 | // Fonts |
1882 | const std::string HINT_LABEL_FONT_SIZE = "20px"; |
1883 | @@ -133,7 +125,7 @@ |
1884 | , show_filter_hint_(true) |
1885 | , expander_view_(nullptr) |
1886 | , show_filters_(nullptr) |
1887 | - , search_bar_width_(640) |
1888 | + , search_bar_width_(621) |
1889 | , live_search_timeout_(0) |
1890 | , start_spinner_timeout_(0) |
1891 | { |
1892 | @@ -178,13 +170,12 @@ |
1893 | bg_layer_ = new nux::ColorLayer(nux::Color(0xff595853), true); |
1894 | |
1895 | layout_ = new nux::HLayout(NUX_TRACKER_LOCATION); |
1896 | - layout_->SetHorizontalInternalMargin(SPACE_BETWEEN_SPINNER_AND_TEXT); |
1897 | - layout_->SetTopAndBottomPadding(external_margin_vertical); |
1898 | - layout_->SetLeftAndRightPadding(external_margin_horizontal + LEFT_INTERNAL_PADDING, external_margin_horizontal); |
1899 | + layout_->SetLeftAndRightPadding(LEFT_INTERNAL_PADDING, 10); |
1900 | + layout_->SetSpaceBetweenChildren(SPACE_BETWEEN_SPINNER_AND_TEXT); |
1901 | SetLayout(layout_); |
1902 | |
1903 | spinner_ = new SearchBarSpinner(); |
1904 | - spinner_->SetMinMaxSize(icon->GetWidth(), SPINNER_HEIGHT); |
1905 | + spinner_->SetMinMaxSize(icon->GetWidth(), icon->GetHeight()); |
1906 | spinner_->mouse_click.connect(sigc::mem_fun(this, &SearchBar::OnClearClicked)); |
1907 | layout_->AddView(spinner_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
1908 | |
1909 | @@ -222,7 +213,8 @@ |
1910 | show_filters_->SetVisible(false); |
1911 | show_filters_->SetFont(SHOW_FILTERS_LABEL_DEFAULT_FONT.c_str()); |
1912 | show_filters_->SetTextColor(nux::color::White); |
1913 | - show_filters_->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_LEFT); |
1914 | + show_filters_->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_RIGHT); |
1915 | + show_filters_->SetLines(1); |
1916 | |
1917 | nux::BaseTexture* arrow; |
1918 | arrow = dash::Style::Instance().GetGroupExpandIcon(); |
1919 | @@ -235,7 +227,6 @@ |
1920 | |
1921 | filter_layout_ = new nux::HLayout(); |
1922 | filter_layout_->SetHorizontalInternalMargin(8); |
1923 | - filter_layout_->SetHorizontalExternalMargin(6); |
1924 | filter_layout_->AddView(show_filters_, 0, nux::MINOR_POSITION_CENTER); |
1925 | |
1926 | arrow_layout_ = new nux::VLayout(); |
1927 | @@ -254,6 +245,10 @@ |
1928 | expander_view_->SetLayout(filter_layout_); |
1929 | layout_->AddView(expander_view_, 0, nux::MINOR_POSITION_RIGHT, nux::MINOR_SIZE_FULL); |
1930 | |
1931 | + // Fix bug #917047 |
1932 | + show_filters_->SetMaximumWidth(dash::Style::Instance().GetFilterBarWidth() - 60); |
1933 | + show_filters_->SetMinimumWidth(dash::Style::Instance().GetFilterBarWidth() - 60); |
1934 | + |
1935 | // Lambda functions |
1936 | auto mouse_expand = [&](int, int, unsigned long, unsigned long) |
1937 | { |
1938 | @@ -422,23 +417,25 @@ |
1939 | GfxContext.PushClippingRectangle(base); |
1940 | nux::GetPainter().PaintBackground(GfxContext, base); |
1941 | |
1942 | - bg_layer_->SetGeometry(nux::Geometry(base.x, base.y, last_width_, base.height)); |
1943 | + bg_layer_->SetGeometry(nux::Geometry(base.x, base.y, last_width_, last_height_)); |
1944 | nux::GetPainter().RenderSinglePaintLayer(GfxContext, |
1945 | bg_layer_->GetGeometry(), |
1946 | bg_layer_); |
1947 | |
1948 | if (ShouldBeHighlighted()) |
1949 | { |
1950 | + dash::Style& style = dash::Style::Instance(); |
1951 | + |
1952 | nux::Geometry geo(show_filters_->GetGeometry()); |
1953 | nux::Geometry const& geo_arrow = arrow_layout_->GetGeometry(); |
1954 | |
1955 | geo.y -= (HIGHLIGHT_HEIGHT- geo.height) / 2; |
1956 | geo.height = HIGHLIGHT_HEIGHT; |
1957 | - geo.width = HIGHLIGHT_WIDTH + HIGHLIGHT_LEFT_PADDING + HIGHLIGHT_RIGHT_PADDING; |
1958 | - geo.x = geo_arrow.x + (geo_arrow.width - 1) - geo.width + HIGHLIGHT_RIGHT_PADDING; |
1959 | + geo.width = style.GetFilterBarWidth() + style.GetFilterBarLeftPadding() + style.GetFilterBarRightPadding(); |
1960 | + geo.x = geo_arrow.x + (geo_arrow.width - 1) - geo.width + style.GetFilterBarLeftPadding(); |
1961 | |
1962 | if (!highlight_layer_) |
1963 | - highlight_layer_.reset(dash::Style::Instance().FocusOverlay(geo.width, geo.height)); |
1964 | + highlight_layer_.reset(style.FocusOverlay(geo.width, geo.height)); |
1965 | |
1966 | highlight_layer_->SetGeometry(geo); |
1967 | highlight_layer_->Renderlayer(GfxContext); |
1968 | @@ -515,9 +512,7 @@ |
1969 | |
1970 | void SearchBar::UpdateBackground(bool force) |
1971 | { |
1972 | - int PADDING = 12; |
1973 | int RADIUS = 5; |
1974 | - int x, y, width, height; |
1975 | nux::Geometry geo(GetGeometry()); |
1976 | geo.width = layered_layout_->GetGeometry().width; |
1977 | |
1978 | @@ -534,43 +529,21 @@ |
1979 | last_width_ = geo.width; |
1980 | last_height_ = geo.height; |
1981 | |
1982 | - if (disable_glow) |
1983 | - PADDING = 2; |
1984 | - |
1985 | - x = y = PADDING - 1; |
1986 | - |
1987 | - width = last_width_ - (2 * PADDING); |
1988 | - height = last_height_ - (2 * PADDING) + 1; |
1989 | - |
1990 | nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, last_width_, last_height_); |
1991 | cairo_t* cr = cairo_graphics.GetContext(); |
1992 | |
1993 | cairo_graphics.DrawRoundedRectangle(cr, |
1994 | 1.0f, |
1995 | - x, |
1996 | - y, |
1997 | + 1 + 0.5, 1 + 0.5, |
1998 | RADIUS, |
1999 | - width, |
2000 | - height, |
2001 | - true); |
2002 | - |
2003 | - // Disable glow effect #929183 |
2004 | - //cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f); |
2005 | - //cairo_set_line_width(cr, 1.0); |
2006 | - //cairo_stroke_preserve(cr); |
2007 | - //cairo_graphics.BlurSurface (3, cairo_get_target (cr)); |
2008 | - |
2009 | - // XXX: Not sure this code is 100% correct. |
2010 | - cairo_operator_t op = CAIRO_OPERATOR_OVER; |
2011 | - op = cairo_get_operator (cr); |
2012 | - cairo_set_operator (cr, CAIRO_OPERATOR_OVER); |
2013 | - cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.35f); |
2014 | - cairo_fill_preserve(cr); |
2015 | - cairo_set_operator (cr, op); |
2016 | - cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.35f); |
2017 | - cairo_fill_preserve(cr); |
2018 | - cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 0.8f); |
2019 | - cairo_set_line_width(cr, 1.0); |
2020 | + last_width_ - 1 - 2, last_height_ - 1 - 2, |
2021 | + false); |
2022 | + |
2023 | + cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
2024 | + cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.57f); |
2025 | + cairo_fill_preserve(cr); |
2026 | + cairo_set_line_width(cr, 1); |
2027 | + cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f); |
2028 | cairo_stroke(cr); |
2029 | |
2030 | cairo_destroy(cr); |
2031 | @@ -579,6 +552,7 @@ |
2032 | nux::TexCoordXForm texxform; |
2033 | texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
2034 | texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT); |
2035 | + |
2036 | if (bg_layer_) |
2037 | delete bg_layer_; |
2038 |
This is a branch that would have been much easier to review in three different branches:
* removal of whitespace
* replacing constants with dash style
* fixing design bugs
Please think of the reviewers.
nux::Color color0 = color_;
color0.alpha = alpha0_;
is not the same as
nux::Color color0 = color_ * alpha0_;
The first has color0 same r,g,b values as color_ but a different alpha.
The second multiplies all the r,g,b and a values by the alpha.
Apart from that the code looks fine. However can you please add some before and after pictures and get a review from design?