Merge lp:~3v1n0/unity/dash-filters-scaling into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3841
Proposed branch: lp:~3v1n0/unity/dash-filters-scaling
Merge into: lp:unity
Prerequisite: lp:~3v1n0/unity/dash-style-rawpixel
Diff against target: 1628 lines (+292/-499)
24 files modified
dash/DashView.cpp (+0/-5)
dash/FilterBar.cpp (+8/-18)
dash/FilterBar.h (+0/-2)
dash/FilterBasicButton.cpp (+39/-46)
dash/FilterBasicButton.h (+6/-4)
dash/FilterExpanderLabel.cpp (+39/-40)
dash/FilterExpanderLabel.h (+2/-5)
dash/FilterGenreWidget.cpp (+33/-16)
dash/FilterGenreWidget.h (+1/-1)
dash/FilterMultiRangeButton.cpp (+22/-30)
dash/FilterMultiRangeButton.h (+3/-3)
dash/FilterMultiRangeWidget.cpp (+12/-1)
dash/FilterRatingsButton.cpp (+30/-223)
dash/FilterRatingsButton.h (+8/-21)
dash/FilterRatingsWidget.cpp (+22/-12)
dash/FilterRatingsWidget.h (+2/-1)
dash/ScopeBar.cpp (+3/-0)
dash/previews/PreviewRatingsWidget.cpp (+8/-19)
dash/previews/PreviewRatingsWidget.h (+0/-1)
hud/HudView.cpp (+0/-4)
unity-shared/RatingsButton.cpp (+17/-17)
unity-shared/RatingsButton.h (+5/-5)
unity-shared/SearchBar.cpp (+30/-23)
unity-shared/SpreadFilter.cpp (+2/-2)
To merge this branch: bzr merge lp:~3v1n0/unity/dash-filters-scaling
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Eleni Maria Stea (community) Approve
Review via email: mp+226141@code.launchpad.net

Commit message

FilterWidgets: add support for scaling

To post a comment you must log in.
Revision history for this message
Eleni Maria Stea (hikiko) wrote :

it looks good!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/DashView.cpp'
2--- dash/DashView.cpp 2014-07-10 12:35:22 +0000
3+++ dash/DashView.cpp 2014-07-10 12:35:22 +0000
4@@ -605,12 +605,7 @@
5 layout_->SetTopAndBottomPadding(style.GetHSeparatorSize().CP(scale), 0);
6
7 content_layout_->SetTopAndBottomPadding(style.GetDashViewTopPadding().CP(scale), 0);
8-
9 search_bar_layout_->SetLeftAndRightPadding(style.GetSearchBarLeftPadding().CP(scale), 0);
10-
11- int search_bar_height = style.GetSearchBarHeight().CP(scale);
12- search_bar_->SetMinimumHeight(search_bar_height);
13- search_bar_->SetMaximumHeight(search_bar_height);
14 }
15
16 void DashView::SetupUBusConnections()
17
18=== modified file 'dash/FilterBar.cpp'
19--- dash/FilterBar.cpp 2014-03-20 04:05:39 +0000
20+++ dash/FilterBar.cpp 2014-07-10 12:35:22 +0000
21@@ -47,28 +47,20 @@
22 : View(NUX_FILE_LINE_PARAM)
23 , scale(DEFAULT_SCALE)
24 {
25- Init();
26-}
27-
28-FilterBar::~FilterBar()
29-{
30-}
31-
32-void FilterBar::Init()
33-{
34- dash::Style& style = dash::Style::Instance();
35-
36- nux::LinearLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION);
37- layout->SetTopAndBottomPadding(style.GetFilterBarTopPadding() - style.GetFilterHighlightPadding());
38- layout->SetSpaceBetweenChildren(style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding());
39+ SetLayout(new nux::VLayout(NUX_TRACKER_LOCATION));
40 scale.changed.connect(sigc::mem_fun(this, &FilterBar::UpdateScale));
41- SetLayout(layout);
42+ UpdateScale(scale);
43 }
44
45 void FilterBar::UpdateScale(double scale)
46 {
47 for (auto& filters : filter_map_)
48 filters.second->scale = scale;
49+
50+ auto& style = dash::Style::Instance();
51+ auto* layout = static_cast<nux::VLayout*>(GetLayout());
52+ layout->SetTopAndBottomPadding(style.GetFilterBarTopPadding().CP(scale) - style.GetFilterHighlightPadding().CP(scale));
53+ layout->SetSpaceBetweenChildren(style.GetSpaceBetweenFilterWidgets().CP(scale) - style.GetFilterHighlightPadding().CP(scale));
54 }
55
56 void FilterBar::SetFilters(Filters::Ptr const& filters)
57@@ -118,9 +110,7 @@
58 }
59
60 void FilterBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
61-{
62-
63-}
64+{}
65
66 void FilterBar::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
67 {
68
69=== modified file 'dash/FilterBar.h'
70--- dash/FilterBar.h 2014-03-20 04:05:39 +0000
71+++ dash/FilterBar.h 2014-07-10 12:35:22 +0000
72@@ -42,7 +42,6 @@
73 NUX_DECLARE_OBJECT_TYPE(FilterBar, nux::View);
74 public:
75 FilterBar(NUX_FILE_LINE_PROTO);
76- ~FilterBar();
77
78 nux::Property<double> scale;
79
80@@ -62,7 +61,6 @@
81 virtual void AddProperties(debug::IntrospectionData&);
82
83 private:
84- void Init();
85 void UpdateScale(double scale);
86
87 FilterFactory factory_;
88
89=== modified file 'dash/FilterBasicButton.cpp'
90--- dash/FilterBasicButton.cpp 2013-11-14 03:00:29 +0000
91+++ dash/FilterBasicButton.cpp 2014-07-10 12:35:22 +0000
92@@ -22,53 +22,36 @@
93 #include "unity-shared/DashStyle.h"
94 #include "FilterBasicButton.h"
95
96-namespace
97-{
98-const int kMinButtonHeight = 30;
99-const int kMinButtonWidth = 48;
100-const int kFontSizePx = 15; // 15px == 11pt
101-}
102-
103 namespace unity
104 {
105 namespace dash
106 {
107-
108+namespace
109+{
110+const RawPixel BUTTON_HEIGHT = 30_em;
111+const RawPixel MIN_BUTTON_WIDTH = 48_em;
112+const int FONT_SIZE_PX = 15; // 15px == 11pt
113+}
114+
115 NUX_IMPLEMENT_OBJECT_TYPE(FilterBasicButton);
116
117 FilterBasicButton::FilterBasicButton(nux::TextureArea* image, NUX_FILE_LINE_DECL)
118- : nux::ToggleButton(image, NUX_FILE_LINE_PARAM)
119-{
120- Init();
121-}
122+ : FilterBasicButton(std::string(), image, NUX_FILE_LINE_PARAM)
123+{}
124+
125+FilterBasicButton::FilterBasicButton(NUX_FILE_LINE_DECL)
126+ : FilterBasicButton(std::string(), NUX_FILE_LINE_PARAM)
127+{}
128
129 FilterBasicButton::FilterBasicButton(std::string const& label, NUX_FILE_LINE_DECL)
130- : nux::ToggleButton(NUX_FILE_LINE_PARAM)
131- , label_(label)
132-{
133- Init();
134-}
135+ : FilterBasicButton(label, nullptr, NUX_FILE_LINE_PARAM)
136+{}
137
138 FilterBasicButton::FilterBasicButton(std::string const& label, nux::TextureArea* image, NUX_FILE_LINE_DECL)
139 : nux::ToggleButton(image, NUX_FILE_LINE_PARAM)
140+ , scale(1.0)
141 , label_(label)
142 {
143- Init();
144-}
145-
146-FilterBasicButton::FilterBasicButton(NUX_FILE_LINE_DECL)
147- : nux::ToggleButton(NUX_FILE_LINE_PARAM)
148-{
149- Init();
150-}
151-
152-FilterBasicButton::~FilterBasicButton()
153-{
154-}
155-
156-void FilterBasicButton::Init()
157-{
158-
159 InitTheme();
160 SetAcceptKeyNavFocusOnMouseDown(false);
161 SetAcceptKeyNavFocusOnMouseEnter(true);
162@@ -85,34 +68,44 @@
163 if (GetInputEventSensitivity())
164 Active() ? Deactivate() : Activate();
165 });
166+
167+ scale.changed.connect(sigc::mem_fun(this, &FilterBasicButton::UpdateScale));
168 }
169
170 void FilterBasicButton::InitTheme()
171 {
172- if (!active_)
173- {
174- nux::Geometry const& geo = GetGeometry();
175-
176- prelight_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
177- active_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)));
178- normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));
179- focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &FilterBasicButton::RedrawFocusOverlay)));
180- }
181-
182- SetMinimumHeight(kMinButtonHeight);
183- SetMinimumWidth(kMinButtonWidth);
184+ nux::Geometry const& geo = GetGeometry();
185+
186+ prelight_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
187+ active_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)));
188+ normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));
189+ focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &FilterBasicButton::RedrawFocusOverlay)));
190+
191+ SetMinimumWidth(MIN_BUTTON_WIDTH.CP(scale));
192+ ApplyMinWidth();
193+
194+ SetMinimumHeight(BUTTON_HEIGHT.CP(scale));
195+ SetMaximumHeight(BUTTON_HEIGHT.CP(scale));
196 }
197
198 void FilterBasicButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state)
199 {
200- Style::Instance().Button(cr, faked_state, label_, kFontSizePx, Alignment::CENTER, true);
201+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
202+ Style::Instance().Button(cr, faked_state, label_, FONT_SIZE_PX, Alignment::CENTER, true);
203 }
204
205 void FilterBasicButton::RedrawFocusOverlay(nux::Geometry const& geom, cairo_t* cr)
206 {
207+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
208 Style::Instance().ButtonFocusOverlay(cr);
209 }
210
211+void FilterBasicButton::UpdateScale(double scale)
212+{
213+ InitTheme();
214+ QueueDraw();
215+}
216+
217 long FilterBasicButton::ComputeContentSize()
218 {
219 long ret = nux::Button::ComputeContentSize();
220
221=== modified file 'dash/FilterBasicButton.h'
222--- dash/FilterBasicButton.h 2012-12-13 09:19:34 +0000
223+++ dash/FilterBasicButton.h 2014-07-10 12:35:22 +0000
224@@ -39,15 +39,15 @@
225 FilterBasicButton(std::string const& label, NUX_FILE_LINE_PROTO);
226 FilterBasicButton(std::string const& label, nux::TextureArea* image, NUX_FILE_LINE_PROTO);
227 FilterBasicButton(NUX_FILE_LINE_PROTO);
228- virtual ~FilterBasicButton();
229-
230- void SetClearBeforeDraw(bool clear_before_draw);
231+
232+ nux::Property<double> scale;
233+
234 protected:
235 virtual long ComputeContentSize();
236 virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
237
238- void Init();
239 void InitTheme();
240+ void SetClearBeforeDraw(bool clear_before_draw);
241 void RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state);
242 void RedrawFocusOverlay(nux::Geometry const& geom, cairo_t* cr);
243
244@@ -61,6 +61,8 @@
245 nux::Geometry cached_geometry_;
246
247 private:
248+ void UpdateScale(double);
249+
250 std::string label_;
251 bool clear_before_draw_;
252 };
253
254=== modified file 'dash/FilterExpanderLabel.cpp'
255--- dash/FilterExpanderLabel.cpp 2014-07-10 12:35:22 +0000
256+++ dash/FilterExpanderLabel.cpp 2014-07-10 12:35:22 +0000
257@@ -24,13 +24,18 @@
258 #include "unity-shared/GraphicsUtils.h"
259 #include "FilterExpanderLabel.h"
260
261+namespace unity
262+{
263+namespace dash
264+{
265 namespace
266 {
267-
268+const double DEFAULT_SCALE = 1.0;
269 const float EXPAND_DEFAULT_ICON_OPACITY = 1.0f;
270-
271-// expander_layout_
272-const int EXPANDER_LAYOUT_SPACE_BETWEEN_CHILDREN = 8;
273+const RawPixel EXPANDER_LAYOUT_SPACE_BETWEEN_CHILDREN = 8_em;
274+const RawPixel ARROW_HORIZONTAL_PADDING = 2_em;
275+const RawPixel ARROW_TOP_PADDING = 11_em;
276+const RawPixel ARROW_BOTTOM_PADDING = 9_em;
277
278 // font
279 const char* const FONT_EXPANDER_LABEL = "Ubuntu 13"; // 17px = 13
280@@ -71,16 +76,6 @@
281
282 }
283
284-namespace unity
285-{
286-namespace dash
287-{
288-
289-namespace
290-{
291- double const DEFAULT_SCALE = 1.0;
292-}
293-
294 NUX_IMPLEMENT_OBJECT_TYPE(FilterExpanderLabel);
295
296 FilterExpanderLabel::FilterExpanderLabel(std::string const& label, NUX_FILE_LINE_DECL)
297@@ -93,8 +88,6 @@
298 , expander_layout_(nullptr)
299 , right_hand_contents_(nullptr)
300 , cairo_label_(nullptr)
301- , raw_label_(label)
302- , label_("label")
303 {
304 scale.changed.connect(sigc::mem_fun(this, &FilterExpanderLabel::UpdateScale));
305 expanded.changed.connect(sigc::mem_fun(this, &FilterExpanderLabel::DoExpandChange));
306@@ -103,14 +96,13 @@
307
308 void FilterExpanderLabel::SetLabel(std::string const& label)
309 {
310- raw_label_ = label;
311-
312- cairo_label_->SetText(label.c_str());
313+ cairo_label_->SetText(label);
314 }
315
316 void FilterExpanderLabel::UpdateScale(double scale)
317 {
318 cairo_label_->SetScale(scale);
319+ UpdateLayoutSizes();
320 }
321
322 void FilterExpanderLabel::SetRightHandView(nux::View* view)
323@@ -142,40 +134,27 @@
324
325 void FilterExpanderLabel::BuildLayout()
326 {
327- dash::Style& style = dash::Style::Instance();
328-
329 layout_ = new nux::VLayout(NUX_TRACKER_LOCATION);
330- layout_->SetLeftAndRightPadding(style.GetFilterBarLeftPadding(), style.GetFilterBarRightPadding());
331-
332 top_bar_layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
333- top_bar_layout_->SetTopAndBottomPadding(style.GetFilterHighlightPadding());
334-
335 expander_layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
336- expander_layout_->SetSpaceBetweenChildren(EXPANDER_LAYOUT_SPACE_BETWEEN_CHILDREN);
337
338 expander_view_ = new ExpanderView(NUX_TRACKER_LOCATION);
339 expander_view_->SetLayout(expander_layout_);
340 top_bar_layout_->AddView(expander_view_, 1);
341
342- cairo_label_ = new StaticCairoText(label_.c_str(), NUX_TRACKER_LOCATION);
343+ cairo_label_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
344 cairo_label_->SetFont(FONT_EXPANDER_LABEL);
345+ cairo_label_->SetScale(scale);
346 cairo_label_->SetTextColor(nux::color::White);
347 cairo_label_->SetAcceptKeyboardEvent(false);
348
349- nux::BaseTexture* arrow;
350- arrow = dash::Style::Instance().GetGroupUnexpandIcon();
351- expand_icon_ = new IconTexture(arrow,
352- arrow->GetWidth(),
353- arrow->GetHeight());
354+ expand_icon_ = new IconTexture(Style::Instance().GetGroupUnexpandIcon());
355 expand_icon_->SetOpacity(EXPAND_DEFAULT_ICON_OPACITY);
356- expand_icon_->SetMinimumSize(arrow->GetWidth(), arrow->GetHeight());
357+ expand_icon_->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
358 expand_icon_->SetVisible(true);
359+
360 arrow_layout_ = new nux::VLayout();
361- arrow_top_space_ = new nux::SpaceLayout(2, 2, 11, 11);
362- arrow_bottom_space_ = new nux::SpaceLayout(2, 2, 9, 9);
363- arrow_layout_->AddView(arrow_top_space_, 0, nux::MINOR_POSITION_CENTER);
364 arrow_layout_->AddView(expand_icon_, 0, nux::MINOR_POSITION_CENTER);
365- arrow_layout_->AddView(arrow_bottom_space_, 0, nux::MINOR_POSITION_CENTER);
366
367 expander_layout_->AddView(cairo_label_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
368 expander_layout_->AddView(arrow_layout_, 0, nux::MINOR_POSITION_CENTER);
369@@ -208,8 +187,25 @@
370 cairo_label_->mouse_click.connect(mouse_expand);
371 expand_icon_->mouse_click.connect(mouse_expand);
372
373+ UpdateLayoutSizes();
374+}
375+
376+void FilterExpanderLabel::UpdateLayoutSizes()
377+{
378+ auto& style = dash::Style::Instance();
379+
380+ layout_->SetLeftAndRightPadding(style.GetFilterBarLeftPadding().CP(scale), style.GetFilterBarRightPadding().CP(scale));
381+ top_bar_layout_->SetTopAndBottomPadding(style.GetFilterHighlightPadding().CP(scale));
382+ expander_layout_->SetSpaceBetweenChildren(EXPANDER_LAYOUT_SPACE_BETWEEN_CHILDREN.CP(scale));
383+
384+ auto const& tex = expand_icon_->texture();
385+ expand_icon_->SetMinMaxSize(RawPixel(tex->GetWidth()).CP(scale), RawPixel(tex->GetHeight()).CP(scale));
386+
387+ arrow_layout_->SetLeftAndRightPadding(ARROW_HORIZONTAL_PADDING.CP(scale));
388+ arrow_layout_->SetTopAndBottomPadding(ARROW_TOP_PADDING.CP(scale), ARROW_BOTTOM_PADDING.CP(scale));
389+
390 QueueRelayout();
391- NeedRedraw();
392+ QueueDraw();
393 }
394
395 void FilterExpanderLabel::DoExpandChange(bool change)
396@@ -220,6 +216,9 @@
397 else
398 expand_icon_->SetTexture(style.GetGroupExpandIcon());
399
400+ auto const& tex = expand_icon_->texture();
401+ expand_icon_->SetMinMaxSize(RawPixel(tex->GetWidth()).CP(scale), RawPixel(tex->GetHeight()).CP(scale));
402+
403 if (change and contents_ and !contents_->IsChildOf(layout_))
404 {
405 layout_->AddLayout(contents_.GetPointer(), 1, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL, 100.0f, nux::LayoutPosition(1));
406@@ -277,7 +276,7 @@
407 graphics::ClearGeometry(right_hand_contents_->GetGeometry());
408
409 if (expanded())
410- ClearRedirectedRenderChildArea();
411+ ClearRedirectedRenderChildArea();
412 }
413
414 if (focus_layer_ && ShouldBeHighlighted())
415@@ -295,7 +294,7 @@
416
417 if (IsFullRedraw())
418 {
419- nux::GetPainter().PopPaintLayerStack();
420+ nux::GetPainter().PopPaintLayerStack();
421 }
422 else if (pushed_paint_layers > 0)
423 {
424
425=== modified file 'dash/FilterExpanderLabel.h'
426--- dash/FilterExpanderLabel.h 2014-03-20 04:05:39 +0000
427+++ dash/FilterExpanderLabel.h 2014-07-10 12:35:22 +0000
428@@ -80,21 +80,18 @@
429
430 private:
431 void BuildLayout();
432+ void UpdateLayoutSizes();
433 void DoExpandChange(bool change);
434 bool ShouldBeHighlighted();
435 void UpdateScale(double scale);
436
437- nux::LinearLayout* layout_;
438+ nux::VLayout* layout_;
439 nux::LinearLayout* top_bar_layout_;
440 nux::View* expander_view_;
441 nux::LinearLayout* expander_layout_;
442 nux::View* right_hand_contents_;
443 StaticCairoText* cairo_label_;
444- std::string raw_label_;
445- std::string label_;
446 nux::VLayout* arrow_layout_;
447- nux::SpaceLayout* arrow_top_space_;
448- nux::SpaceLayout* arrow_bottom_space_;
449 IconTexture* expand_icon_;
450
451 nux::ObjectPtr<nux::Layout> contents_;
452
453=== modified file 'dash/FilterGenreWidget.cpp'
454--- dash/FilterGenreWidget.cpp 2013-04-18 12:13:21 +0000
455+++ dash/FilterGenreWidget.cpp 2014-07-10 12:35:22 +0000
456@@ -35,6 +35,11 @@
457 {
458 namespace dash
459 {
460+namespace
461+{
462+const RawPixel CHILDREN_SPACE = 12_em;
463+const RawPixel CHILDREN_SPACE_SMALLER = 10_em;
464+}
465
466 NUX_IMPLEMENT_OBJECT_TYPE(FilterGenre);
467
468@@ -42,33 +47,41 @@
469 : FilterExpanderLabel(_("Categories"), NUX_FILE_LINE_PARAM)
470 , all_button_(nullptr)
471 {
472- dash::Style& style = dash::Style::Instance();
473-
474 InitTheme();
475
476-
477 genre_layout_ = new nux::GridHLayout(NUX_TRACKER_LOCATION);
478 genre_layout_->ForceChildrenSize(true);
479 genre_layout_->MatchContentSize(true);
480- genre_layout_->SetTopAndBottomPadding(style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding(), style.GetFilterHighlightPadding());
481 genre_layout_->EnablePartialVisibility(false);
482
483+ UpdateSize(columns);
484+ SetContents(genre_layout_);
485+
486+ scale.changed.connect([this, columns] (double scale) {
487+ if (all_button_) all_button_->scale = scale;
488+
489+ for (auto* button : buttons_)
490+ button->scale = scale;
491+
492+ UpdateSize(columns);
493+ });
494+}
495+
496+void FilterGenre::UpdateSize(int columns)
497+{
498+ auto& style = dash::Style::Instance();
499+ genre_layout_->SetTopAndBottomPadding(style.GetSpaceBetweenFilterWidgets().CP(scale) - style.GetFilterHighlightPadding().CP(scale), style.GetFilterHighlightPadding().CP(scale));
500+
501 if (columns == 3)
502 {
503- genre_layout_->SetChildrenSize((style.GetFilterBarWidth() - 12 * 2) / 3, style.GetFilterButtonHeight());
504- genre_layout_->SetSpaceBetweenChildren (12, 12);
505+ genre_layout_->SetChildrenSize((style.GetFilterBarWidth().CP(scale) - CHILDREN_SPACE.CP(scale) * 2) / 3, style.GetFilterButtonHeight().CP(scale));
506+ genre_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale), CHILDREN_SPACE.CP(scale));
507 }
508 else
509 {
510- genre_layout_->SetChildrenSize((style.GetFilterBarWidth() - 10 ) / 2, style.GetFilterButtonHeight());
511- genre_layout_->SetSpaceBetweenChildren (10, 12);
512+ genre_layout_->SetChildrenSize((style.GetFilterBarWidth().CP(scale) - CHILDREN_SPACE_SMALLER.CP(scale)) / 2, style.GetFilterButtonHeight().CP(scale));
513+ genre_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE_SMALLER.CP(scale), CHILDREN_SPACE.CP(scale));
514 }
515-
516- SetContents(genre_layout_);
517-}
518-
519-FilterGenre::~FilterGenre()
520-{
521 }
522
523 void FilterGenre::SetFilter(Filter::Ptr const& filter)
524@@ -81,11 +94,14 @@
525 all_button_ = show_all_button ? new FilterAllButton(NUX_TRACKER_LOCATION) : nullptr;
526 SetRightHandView(all_button_);
527 if (all_button_)
528+ {
529+ all_button_->scale = scale();
530 all_button_->SetFilter(filter_);
531+ }
532 };
533 show_button_func(filter_->show_all_button);
534 filter_->show_all_button.changed.connect(show_button_func);
535-
536+
537 expanded = !filter_->collapsed();
538
539 filter_->option_added.connect(sigc::mem_fun(this, &FilterGenre::OnOptionAdded));
540@@ -106,6 +122,7 @@
541 std::string label(escape.Value());
542
543 FilterGenreButton* button = new FilterGenreButton(label, NUX_TRACKER_LOCATION);
544+ button->scale = scale();
545 button->SetFilter(new_filter);
546 genre_layout_->AddView(button, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
547 buttons_.push_back(button);
548@@ -121,7 +138,7 @@
549 {
550 genre_layout_->RemoveChildObject(*it);
551 buttons_.erase(it);
552-
553+
554 QueueRelayout();
555 break;
556 }
557
558=== modified file 'dash/FilterGenreWidget.h'
559--- dash/FilterGenreWidget.h 2012-11-27 23:16:06 +0000
560+++ dash/FilterGenreWidget.h 2014-07-10 12:35:22 +0000
561@@ -46,7 +46,6 @@
562 NUX_DECLARE_OBJECT_TYPE(FilterGenre, FilterExpanderLabel);
563 public:
564 FilterGenre(int columns, NUX_FILE_LINE_PROTO);
565- virtual ~FilterGenre();
566
567 void SetFilter(Filter::Ptr const& filter);
568 std::string GetFilterType();
569@@ -59,6 +58,7 @@
570 private:
571 void OnOptionAdded(FilterOption::Ptr const& new_filter);
572 void OnOptionRemoved(FilterOption::Ptr const& removed_filter);
573+ void UpdateSize(int columns);
574
575 nux::GridHLayout* genre_layout_;
576 FilterAllButton* all_button_;
577
578=== modified file 'dash/FilterMultiRangeButton.cpp'
579--- dash/FilterMultiRangeButton.cpp 2013-11-14 03:00:29 +0000
580+++ dash/FilterMultiRangeButton.cpp 2014-07-10 12:35:22 +0000
581@@ -33,29 +33,18 @@
582
583 namespace
584 {
585-const int kFontSizePx = 10;
586-
587-const int kLayoutPadLeftRight = 4;
588-const int kLayoutPadtopBottom = 2;
589+const int FONT_SIZE_PX = 10;
590 }
591
592 NUX_IMPLEMENT_OBJECT_TYPE(FilterMultiRangeButton);
593
594 FilterMultiRangeButton::FilterMultiRangeButton(NUX_FILE_LINE_DECL)
595 : nux::ToggleButton(NUX_FILE_LINE_PARAM)
596+ , scale(1.0)
597 , theme_init_(false)
598 , has_arrow_(MultiRangeArrow::NONE)
599 , side_(MultiRangeSide::CENTER)
600 {
601- Init();
602-}
603-
604-FilterMultiRangeButton::~FilterMultiRangeButton()
605-{
606-}
607-
608-void FilterMultiRangeButton::Init()
609-{
610 InitTheme();
611 // Controlled by parent widget
612 SetAcceptKeyNavFocusOnMouseDown(false);
613@@ -64,6 +53,8 @@
614 state_change.connect(sigc::mem_fun(this, &FilterMultiRangeButton::OnActivated));
615 key_nav_focus_change.connect([this](nux::Area*, bool, nux::KeyNavDirection) { QueueDraw(); });
616 key_nav_focus_activate.connect([this](nux::Area* area) { Active() ? Deactivate() : Activate(); });
617+
618+ scale.changed.connect(sigc::hide(sigc::mem_fun(this, &FilterMultiRangeButton::InitTheme)));
619 }
620
621 void FilterMultiRangeButton::OnActivated(nux::Area* area)
622@@ -133,27 +124,26 @@
623
624 void FilterMultiRangeButton::InitTheme()
625 {
626- if (!active_[MapKey(MultiRangeArrow::LEFT, MultiRangeSide::LEFT)])
627+ nux::Geometry const& geo = GetGeometry();
628+
629+ std::vector<MultiRangeSide> sides = {MultiRangeSide::LEFT, MultiRangeSide::RIGHT, MultiRangeSide::CENTER};
630+ std::vector<MultiRangeArrow> arrows = {MultiRangeArrow::LEFT, MultiRangeArrow::RIGHT, MultiRangeArrow::BOTH, MultiRangeArrow::NONE};
631+
632+ for (auto arrow : arrows)
633 {
634- nux::Geometry const& geo = GetGeometry();
635-
636- std::vector<MultiRangeSide> sides = {MultiRangeSide::LEFT, MultiRangeSide::RIGHT, MultiRangeSide::CENTER};
637- std::vector<MultiRangeArrow> arrows = {MultiRangeArrow::LEFT, MultiRangeArrow::RIGHT, MultiRangeArrow::BOTH, MultiRangeArrow::NONE};
638-
639- for (auto arrow : arrows)
640+ for (auto side : sides)
641 {
642- for (auto side : sides)
643- {
644- active_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED, arrow, side)));
645- normal_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL, arrow, side)));
646- prelight_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT, arrow, side)));
647- focus_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawFocusOverlay), arrow, side)));
648- }
649+ active_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED, arrow, side)));
650+ normal_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL, arrow, side)));
651+ prelight_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT, arrow, side)));
652+ focus_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawFocusOverlay), arrow, side)));
653 }
654 }
655
656- SetMinimumHeight(dash::Style::Instance().GetFilterButtonHeight() + 3);
657+ SetMinimumHeight(Style::Instance().GetFilterButtonHeight().CP(scale) + (3_em).CP(scale));
658 theme_init_ = true;
659+
660+ QueueDraw();
661 }
662
663 void FilterMultiRangeButton::RedrawTheme(nux::Geometry const& geom,
664@@ -187,8 +177,9 @@
665 else
666 segment = Segment::RIGHT;
667
668- Style::Instance().MultiRangeSegment(cr, faked_state, name, kFontSizePx, arrow, segment);
669- NeedRedraw();
670+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
671+ Style::Instance().MultiRangeSegment(cr, faked_state, name, FONT_SIZE_PX, arrow, segment);
672+ QueueDraw();
673 }
674
675 void FilterMultiRangeButton::RedrawFocusOverlay(nux::Geometry const& geom,
676@@ -214,6 +205,7 @@
677 else
678 segment = Segment::RIGHT;
679
680+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
681 Style::Instance().MultiRangeFocusOverlay(cr, arrow, segment);
682 QueueDraw();
683 }
684
685=== modified file 'dash/FilterMultiRangeButton.h'
686--- dash/FilterMultiRangeButton.h 2013-11-08 15:05:51 +0000
687+++ dash/FilterMultiRangeButton.h 2014-07-10 12:35:22 +0000
688@@ -54,8 +54,9 @@
689 {
690 NUX_DECLARE_OBJECT_TYPE(FilterMultiRangeButton, nux::ToggleButton);
691 public:
692- FilterMultiRangeButton (NUX_FILE_LINE_PROTO);
693- virtual ~FilterMultiRangeButton();
694+ FilterMultiRangeButton(NUX_FILE_LINE_PROTO);
695+
696+ nux::Property<double> scale;
697
698 void SetFilter(FilterOption::Ptr const& filter);
699 FilterOption::Ptr GetFilter();
700@@ -69,7 +70,6 @@
701
702 private:
703 void InitTheme();
704- void Init();
705
706 void RedrawTheme(nux::Geometry const& geom,
707 cairo_t* cr,
708
709=== modified file 'dash/FilterMultiRangeWidget.cpp'
710--- dash/FilterMultiRangeWidget.cpp 2013-04-17 15:10:39 +0000
711+++ dash/FilterMultiRangeWidget.cpp 2014-07-10 12:35:22 +0000
712@@ -64,6 +64,13 @@
713 mouse_up.connect(sigc::mem_fun(this, &FilterMultiRangeWidget::RecvMouseUp));
714
715 mouse_drag.connect(sigc::mem_fun(this, &FilterMultiRangeWidget::RecvMouseDrag));
716+
717+ scale.changed.connect([this] (double scale) {
718+ if (all_button_) all_button_->scale = scale;
719+
720+ for (auto const& button : buttons_)
721+ button->scale = scale;
722+ });
723 }
724
725 void FilterMultiRangeWidget::SetFilter(Filter::Ptr const& filter)
726@@ -83,11 +90,14 @@
727 all_button_ = show_all_button ? new FilterAllButton(NUX_TRACKER_LOCATION) : nullptr;
728 SetRightHandView(all_button_);
729 if (all_button_)
730+ {
731+ all_button_->scale = scale();
732 all_button_->SetFilter(filter_);
733+ }
734 };
735 show_button_func(filter_->show_all_button);
736 filter_->show_all_button.changed.connect(show_button_func);
737-
738+
739 expanded = !filter_->collapsed();
740
741 filter_->option_added.connect(sigc::mem_fun(this, &FilterMultiRangeWidget::OnOptionAdded));
742@@ -151,6 +161,7 @@
743 void FilterMultiRangeWidget::OnOptionAdded(FilterOption::Ptr const& new_filter)
744 {
745 FilterMultiRangeButtonPtr button(new FilterMultiRangeButton(NUX_TRACKER_LOCATION));
746+ button->scale = scale();
747 button->SetFilter(new_filter);
748 layout_->AddView(button.GetPointer());
749 buttons_.push_back(button);
750
751=== modified file 'dash/FilterRatingsButton.cpp'
752--- dash/FilterRatingsButton.cpp 2013-11-14 03:00:29 +0000
753+++ dash/FilterRatingsButton.cpp 2014-07-10 12:35:22 +0000
754@@ -1,5 +1,5 @@
755 /*
756- * Copyright 2011 Canonical Ltd.
757+ * Copyright 2014 Canonical Ltd.
758 *
759 * This program is free software: you can redistribute it and/or modify it
760 * under the terms of the GNU Lesser General Public License version 3, as
761@@ -15,66 +15,39 @@
762 * License version 3 along with this program. If not, see
763 * <http://www.gnu.org/licenses/>
764 *
765- * Authored by: Gordon Allott <gord.allott@canonical.com>
766+ * Authored by: Marco Trevisan <marco.trevisan@canonical.com>
767 *
768 */
769
770-#include <math.h>
771-
772-#include <Nux/Nux.h>
773-#include <NuxCore/Logger.h>
774-
775-#include "unity-shared/DashStyle.h"
776 #include "FilterRatingsButton.h"
777
778 namespace
779 {
780-const int star_size = 28;
781-const int star_gap = 10;
782-const int num_stars = 5;
783+const int STAR_SIZE = 28;
784+const int STAR_GAP = 10;
785 }
786
787 namespace unity
788 {
789 namespace dash
790 {
791-
792+
793 NUX_IMPLEMENT_OBJECT_TYPE(FilterRatingsButton);
794
795 FilterRatingsButton::FilterRatingsButton(NUX_FILE_LINE_DECL)
796- : nux::ToggleButton(NUX_FILE_LINE_PARAM)
797- , focused_star_(-1)
798-{
799- SetAcceptKeyNavFocusOnMouseDown(false);
800- SetAcceptKeyNavFocusOnMouseEnter(true);
801-
802- mouse_up.connect(sigc::mem_fun(this, &FilterRatingsButton::RecvMouseUp));
803- mouse_move.connect(sigc::mem_fun(this, &FilterRatingsButton::RecvMouseMove));
804- mouse_drag.connect(sigc::mem_fun(this, &FilterRatingsButton::RecvMouseDrag));
805-
806- key_nav_focus_change.connect([this](nux::Area* area, bool has_focus, nux::KeyNavDirection direction)
807- {
808- if (has_focus)
809- focused_star_ = 0;
810- else if (!has_focus)
811- focused_star_ = -1;
812-
813- QueueDraw();
814- });
815-
816- key_nav_focus_activate.connect([this](nux::Area*) { filter_->rating = static_cast<float>(focused_star_+1)/num_stars; });
817- key_down.connect(sigc::mem_fun(this, &FilterRatingsButton::OnKeyDown));
818-}
819-
820-FilterRatingsButton::~FilterRatingsButton()
821-{
822-}
823+ : RatingsButton(STAR_SIZE, STAR_GAP, NUX_FILE_LINE_PARAM)
824+{}
825
826 void FilterRatingsButton::SetFilter(Filter::Ptr const& filter)
827 {
828 filter_ = std::static_pointer_cast<RatingsFilter>(filter);
829- filter_->rating.changed.connect(sigc::mem_fun(this, &FilterRatingsButton::OnRatingsChanged));
830- NeedRedraw();
831+ filter_->rating.changed.connect(sigc::mem_fun(this, &FilterRatingsButton::SetRating));
832+ QueueDraw();
833+}
834+
835+RatingsFilter::Ptr FilterRatingsButton::GetFilter() const
836+{
837+ return filter_;
838 }
839
840 std::string FilterRatingsButton::GetFilterType()
841@@ -82,188 +55,22 @@
842 return "FilterRatingsButton";
843 }
844
845-void FilterRatingsButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
846-{
847- int rating = 0;
848- if (filter_ && filter_->filtering)
849- rating = static_cast<int>(filter_->rating * num_stars);
850- // FIXME: 9/26/2011
851- // We should probably support an API for saying whether the ratings
852- // should or shouldn't support half stars...but our only consumer at
853- // the moment is the applications scope which according to design
854- // (Bug #839759) shouldn't. So for now just force rounding.
855- // int total_half_stars = rating % 2;
856- // int total_full_stars = rating / 2;
857- int total_full_stars = rating;
858-
859- nux::Geometry const& geo = GetGeometry();
860- nux::Geometry geo_star(geo);
861- geo_star.width = star_size;
862-
863- gPainter.PaintBackground(GfxContext, geo);
864- // set up our texture mode
865- nux::TexCoordXForm texxform;
866- texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
867- texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
868-
869- // clear what is behind us
870- unsigned int alpha = 0, src = 0, dest = 0;
871-
872- GfxContext.GetRenderStates().GetBlend(alpha, src, dest);
873- GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
874-
875- nux::Color col = nux::color::Black;
876- col.alpha = 0;
877- GfxContext.QRP_Color(geo.x,
878- geo.y,
879- geo.width,
880- geo.height,
881- col);
882-
883- for (int index = 0; index < num_stars; ++index)
884- {
885- Style& style = Style::Instance();
886- nux::BaseTexture* texture = style.GetStarSelectedIcon();
887- if (index < total_full_stars)
888- {
889- if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL)
890- texture = style.GetStarSelectedIcon();
891- else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)
892- texture = style.GetStarSelectedIcon();
893- else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
894- texture = style.GetStarSelectedIcon();
895- }
896- else
897- {
898- if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL)
899- texture = style.GetStarDeselectedIcon();
900- else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)
901- texture = style.GetStarDeselectedIcon();
902- else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
903- texture = style.GetStarDeselectedIcon();
904- }
905-
906- GfxContext.QRP_1Tex(geo_star.x,
907- geo_star.y,
908- geo_star.width,
909- geo_star.height,
910- texture->GetDeviceTexture(),
911- texxform,
912- nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
913-
914- if (focused_star_ == index)
915- {
916- GfxContext.QRP_1Tex(geo_star.x,
917- geo_star.y,
918- geo_star.width,
919- geo_star.height,
920- style.GetStarHighlightIcon()->GetDeviceTexture(),
921- texxform,
922- nux::Color(1.0f, 1.0f, 1.0f, 0.5f));
923- }
924-
925- geo_star.x += geo_star.width + star_gap;
926-
927- }
928-
929- GfxContext.GetRenderStates().SetBlend(alpha, src, dest);
930-
931-}
932-
933-static void _UpdateRatingToMouse(RatingsFilter::Ptr filter, int x)
934-{
935- int width = 180;
936- float new_rating = (static_cast<float>(x) / width);
937-
938- // FIXME: change to * 2 once we decide to support also half-stars
939- new_rating = ceil((num_stars * 1) * new_rating) / (num_stars * 1);
940- new_rating = (new_rating > 1) ? 1 : ((new_rating < 0) ? 0 : new_rating);
941-
942- if (filter)
943- filter->rating = new_rating;
944-}
945-
946-void FilterRatingsButton::RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags)
947-{
948- _UpdateRatingToMouse(filter_, x);
949-}
950-
951-void FilterRatingsButton::RecvMouseDrag(int x, int y, int dx, int dy,
952- unsigned long button_flags,
953- unsigned long key_flags)
954-{
955- _UpdateRatingToMouse(filter_, x);
956-}
957-
958-void FilterRatingsButton::OnRatingsChanged(int rating)
959-{
960- NeedRedraw();
961-}
962-
963-void FilterRatingsButton::RecvMouseMove(int x, int y, int dx, int dy,
964- unsigned long button_flags,
965- unsigned long key_flags)
966-{
967- int width = 180;
968- focused_star_ = std::max(0, std::min(static_cast<int>(ceil((static_cast<float>(x) / width) * num_stars) - 1), num_stars - 1));
969-
970- if (!HasKeyFocus())
971- nux::GetWindowCompositor().SetKeyFocusArea(this);
972-
973- QueueDraw();
974-}
975-
976-
977-bool FilterRatingsButton::InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character)
978-{
979- nux::KeyNavDirection direction = nux::KEY_NAV_NONE;
980-
981- switch (keysym)
982- {
983- case NUX_VK_LEFT:
984- direction = nux::KeyNavDirection::KEY_NAV_LEFT;
985- break;
986- case NUX_VK_RIGHT:
987- direction = nux::KeyNavDirection::KEY_NAV_RIGHT;
988- break;
989- default:
990- direction = nux::KeyNavDirection::KEY_NAV_NONE;
991- break;
992- }
993-
994- if (direction == nux::KeyNavDirection::KEY_NAV_NONE)
995- return false;
996- else if (direction == nux::KEY_NAV_LEFT && (focused_star_ <= 0))
997- return false;
998- else if (direction == nux::KEY_NAV_RIGHT && (focused_star_ >= num_stars - 1))
999- return false;
1000- else
1001- return true;
1002-}
1003-
1004-
1005-void FilterRatingsButton::OnKeyDown(unsigned long event_type, unsigned long event_keysym,
1006- unsigned long event_state, const TCHAR* character,
1007- unsigned short key_repeat_count)
1008-{
1009- switch (event_keysym)
1010- {
1011- case NUX_VK_LEFT:
1012- --focused_star_;
1013- break;
1014- case NUX_VK_RIGHT:
1015- ++focused_star_;
1016- break;
1017- default:
1018- return;
1019- }
1020-
1021- QueueDraw();
1022-}
1023-
1024-bool FilterRatingsButton::AcceptKeyNavFocus()
1025-{
1026- return true;
1027+std::string FilterRatingsButton::GetName() const
1028+{
1029+ return "FilterRatingsButton";
1030+}
1031+
1032+void FilterRatingsButton::SetRating(float rating)
1033+{
1034+ if (filter_)
1035+ filter_->rating = rating;
1036+
1037+ QueueDraw();
1038+}
1039+
1040+float FilterRatingsButton::GetRating() const
1041+{
1042+ return (filter_ && filter_->filtering) ? filter_->rating : 0;
1043 }
1044
1045 } // namespace dash
1046
1047=== modified file 'dash/FilterRatingsButton.h'
1048--- dash/FilterRatingsButton.h 2012-12-13 09:19:34 +0000
1049+++ dash/FilterRatingsButton.h 2014-07-10 12:35:22 +0000
1050@@ -25,46 +25,33 @@
1051 #include <memory>
1052
1053 #include <Nux/Nux.h>
1054-#include <Nux/ToggleButton.h>
1055-#include <Nux/CairoWrapper.h>
1056 #include <UnityCore/RatingsFilter.h>
1057+#include "unity-shared/RatingsButton.h"
1058
1059 namespace unity
1060 {
1061 namespace dash
1062 {
1063
1064-class FilterRatingsButton : public nux::ToggleButton
1065+class FilterRatingsButton : public RatingsButton
1066 {
1067- NUX_DECLARE_OBJECT_TYPE(FilterRatingsButton, nux::ToggleButton);
1068+ NUX_DECLARE_OBJECT_TYPE(FilterRatingsButton, RatingsButton);
1069 public:
1070 FilterRatingsButton(NUX_FILE_LINE_PROTO);
1071- virtual ~FilterRatingsButton();
1072
1073 void SetFilter(Filter::Ptr const& filter);
1074- RatingsFilter::Ptr GetFilter();
1075+ RatingsFilter::Ptr GetFilter() const;
1076 std::string GetFilterType();
1077
1078 protected:
1079- virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
1080+ // Introspectable methods
1081+ std::string GetName() const;
1082
1083- // Key-nav
1084- virtual bool AcceptKeyNavFocus();
1085- virtual bool InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character);
1086+ void SetRating(float rating) override;
1087+ float GetRating() const override;
1088
1089 private:
1090- void OnKeyDown(unsigned long event_type, unsigned long event_keysym,
1091- unsigned long event_state, const TCHAR* character,
1092- unsigned short key_repeat_count);
1093-
1094- void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);
1095- void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
1096- void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
1097- void OnRatingsChanged(int rating);
1098-
1099 dash::RatingsFilter::Ptr filter_;
1100- int focused_star_;
1101-
1102 };
1103
1104 } // namespace dash
1105
1106=== modified file 'dash/FilterRatingsWidget.cpp'
1107--- dash/FilterRatingsWidget.cpp 2013-03-19 18:22:11 +0000
1108+++ dash/FilterRatingsWidget.cpp 2014-07-10 12:35:22 +0000
1109@@ -33,15 +33,14 @@
1110 #include "FilterRatingsButton.h"
1111 #include "FilterRatingsWidget.h"
1112
1113-namespace
1114-{
1115-const int star_size = 28;
1116-}
1117-
1118 namespace unity
1119 {
1120 namespace dash
1121 {
1122+namespace
1123+{
1124+const RawPixel STAR_SIZE = 28_em;
1125+}
1126
1127 NUX_IMPLEMENT_OBJECT_TYPE(FilterRatingsWidget);
1128
1129@@ -49,22 +48,30 @@
1130 : FilterExpanderLabel(_("Rating"), NUX_FILE_LINE_PARAM)
1131 , all_button_(nullptr)
1132 {
1133- dash::Style& style = dash::Style::Instance();
1134- const int top_padding = style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding() - 1; // -1 (PNGs have an 1px top padding)
1135- const int bottom_padding = style.GetFilterHighlightPadding();
1136-
1137 nux::VLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION);
1138- layout->SetTopAndBottomPadding(top_padding, bottom_padding);
1139 ratings_ = new FilterRatingsButton(NUX_TRACKER_LOCATION);
1140- ratings_->SetMinimumHeight(star_size);
1141
1142 layout->AddView(ratings_);
1143
1144+ UpdateSize();
1145 SetContents(layout);
1146+
1147+ scale.changed.connect([this] (double scale) {
1148+ if (all_button_) all_button_->scale = scale;
1149+ UpdateSize();
1150+ });
1151 }
1152
1153-FilterRatingsWidget::~FilterRatingsWidget()
1154+void FilterRatingsWidget::UpdateSize()
1155 {
1156+ dash::Style& style = dash::Style::Instance();
1157+ int top_padding = style.GetSpaceBetweenFilterWidgets().CP(scale) - style.GetFilterHighlightPadding().CP(scale) - (1_em).CP(scale); // -1 (PNGs have an 1px top padding)
1158+ int bottom_padding = style.GetFilterHighlightPadding().CP(scale);
1159+ static_cast<nux::VLayout*>(GetLayout())->SetTopAndBottomPadding(top_padding, bottom_padding);
1160+
1161+ ratings_->scale = scale();
1162+ ratings_->SetMinimumHeight(STAR_SIZE.CP(scale));
1163+ ratings_->ApplyMinHeight();
1164 }
1165
1166 void FilterRatingsWidget::SetFilter(Filter::Ptr const& filter)
1167@@ -77,7 +84,10 @@
1168 all_button_ = show_all_button ? new FilterAllButton(NUX_TRACKER_LOCATION) : nullptr;
1169 SetRightHandView(all_button_);
1170 if (all_button_)
1171+ {
1172+ all_button_->scale = scale();
1173 all_button_->SetFilter(filter_);
1174+ }
1175 };
1176 show_button_func(filter_->show_all_button);
1177 filter_->show_all_button.changed.connect(show_button_func);
1178
1179=== modified file 'dash/FilterRatingsWidget.h'
1180--- dash/FilterRatingsWidget.h 2012-11-27 23:16:06 +0000
1181+++ dash/FilterRatingsWidget.h 2014-07-10 12:35:22 +0000
1182@@ -45,7 +45,6 @@
1183 NUX_DECLARE_OBJECT_TYPE(FilterRatingsWidget, FilterExpanderLabel);
1184 public:
1185 FilterRatingsWidget(NUX_FILE_LINE_PROTO);
1186- virtual ~FilterRatingsWidget();
1187
1188 void SetFilter(Filter::Ptr const& filter);
1189 std::string GetFilterType();
1190@@ -54,6 +53,8 @@
1191 void ClearRedirectedRenderChildArea();
1192
1193 private:
1194+ void UpdateSize();
1195+
1196 FilterAllButton* all_button_;
1197 FilterRatingsButton* ratings_;
1198 RatingsFilter::Ptr filter_;
1199
1200=== modified file 'dash/ScopeBar.cpp'
1201--- dash/ScopeBar.cpp 2014-07-10 12:35:22 +0000
1202+++ dash/ScopeBar.cpp 2014-07-10 12:35:22 +0000
1203@@ -70,6 +70,9 @@
1204
1205 for (auto icon : icons_)
1206 icon->scale = scale;
1207+
1208+ QueueDraw();
1209+ QueueRelayout();
1210 }
1211
1212 void ScopeBar::SetupLayout()
1213
1214=== modified file 'dash/previews/PreviewRatingsWidget.cpp'
1215--- dash/previews/PreviewRatingsWidget.cpp 2014-07-10 12:35:22 +0000
1216+++ dash/previews/PreviewRatingsWidget.cpp 2014-07-10 12:35:22 +0000
1217@@ -29,6 +29,7 @@
1218 #include "unity-shared/RatingsButton.h"
1219 #include "unity-shared/StaticCairoText.h"
1220 #include "unity-shared/PreviewStyle.h"
1221+#include "unity-shared/DashStyle.h"
1222 #include "PreviewRatingsWidget.h"
1223
1224 namespace unity
1225@@ -41,8 +42,8 @@
1226 namespace
1227 {
1228 const RawPixel CHILDREN_SPACE = 3_em;
1229- const RawPixel RATINGS_SIZE = 18_em;
1230- const RawPixel RATINGS_GAP = 2_em;
1231+ const int RATINGS_SIZE = 18;
1232+ const int RATINGS_GAP = 2;
1233 }
1234
1235 NUX_IMPLEMENT_OBJECT_TYPE(PreviewRatingsWidget);
1236@@ -58,9 +59,10 @@
1237
1238 auto on_mouse_down = [this](int x, int y, unsigned long button_flags, unsigned long key_flags) { this->preview_container_.OnMouseDown(x, y, button_flags, key_flags); };
1239
1240- ratings_ = new RatingsButton(RATINGS_SIZE.CP(scale), RATINGS_GAP.CP(scale));
1241+ ratings_ = new RatingsButton(RATINGS_SIZE, RATINGS_GAP);
1242 ratings_->SetEditable(false);
1243 ratings_->mouse_click.connect(on_mouse_down);
1244+ ratings_->scale = scale();
1245 layout_->AddView(ratings_);
1246
1247 reviews_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
1248@@ -77,10 +79,6 @@
1249 scale.changed.connect(sigc::mem_fun(this, &PreviewRatingsWidget::UpdateScale));
1250 }
1251
1252-PreviewRatingsWidget::~PreviewRatingsWidget()
1253-{
1254-}
1255-
1256 void PreviewRatingsWidget::SetRating(float rating)
1257 {
1258 ratings_->SetRating(rating);
1259@@ -128,19 +126,10 @@
1260
1261 void PreviewRatingsWidget::UpdateScale(double scale)
1262 {
1263- if (reviews_)
1264- reviews_->SetScale(scale);
1265-
1266- if (ratings_)
1267- {
1268- ratings_->star_size_ = RATINGS_SIZE.CP(scale);
1269- ratings_->star_gap_ = RATINGS_GAP.CP(scale);
1270- }
1271-
1272+ reviews_->SetScale(scale);
1273+ ratings_->scale = scale;
1274 preview_container_.scale = scale;
1275-
1276- if (layout_)
1277- layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
1278+ layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
1279
1280 QueueRelayout();
1281 QueueDraw();
1282
1283=== modified file 'dash/previews/PreviewRatingsWidget.h'
1284--- dash/previews/PreviewRatingsWidget.h 2014-07-10 12:35:22 +0000
1285+++ dash/previews/PreviewRatingsWidget.h 2014-07-10 12:35:22 +0000
1286@@ -45,7 +45,6 @@
1287 NUX_DECLARE_OBJECT_TYPE(PreviewRatingsWidget, nux::View);
1288 public:
1289 PreviewRatingsWidget(NUX_FILE_LINE_PROTO);
1290- virtual ~PreviewRatingsWidget();
1291
1292 void SetRating(float rating);
1293 float GetRating() const;
1294
1295=== modified file 'hud/HudView.cpp'
1296--- hud/HudView.cpp 2014-02-20 19:43:52 +0000
1297+++ hud/HudView.cpp 2014-07-10 12:35:22 +0000
1298@@ -367,8 +367,6 @@
1299
1300 void View::SetupViews()
1301 {
1302- dash::Style& style = dash::Style::Instance();
1303-
1304 nux::VLayout* super_layout = new nux::VLayout();
1305 layout_ = new nux::HLayout();
1306 {
1307@@ -388,8 +386,6 @@
1308
1309 // add the search bar to the composite
1310 search_bar_ = new unity::SearchBar(true);
1311- search_bar_->SetMinimumHeight(style.GetSearchBarHeight());
1312- search_bar_->SetMaximumHeight(style.GetSearchBarHeight());
1313 search_bar_->search_hint = _("Type your command");
1314 search_bar_->live_search_reached.connect(sigc::mem_fun(this, &View::OnSearchChanged));
1315 AddChild(search_bar_.GetPointer());
1316
1317=== modified file 'unity-shared/RatingsButton.cpp'
1318--- unity-shared/RatingsButton.cpp 2014-06-16 09:16:53 +0000
1319+++ unity-shared/RatingsButton.cpp 2014-07-10 12:35:22 +0000
1320@@ -29,13 +29,14 @@
1321
1322 namespace
1323 {
1324-const int num_stars = 5;
1325+const int NUM_STARS = 5;
1326 }
1327
1328 namespace unity
1329 {
1330 RatingsButton::RatingsButton(int star_size, int star_gap, NUX_FILE_LINE_DECL)
1331 : nux::ToggleButton(NUX_FILE_LINE_PARAM)
1332+ , scale(1.0)
1333 , star_size_(star_size)
1334 , star_gap_(star_gap)
1335 , editable_(true)
1336@@ -58,12 +59,11 @@
1337
1338 QueueDraw();
1339 });
1340- key_nav_focus_activate.connect([this](nux::Area*) { SetRating(static_cast<float>(focused_star_+1)/num_stars); });
1341+
1342+ key_nav_focus_activate.connect([this](nux::Area*) { SetRating(static_cast<float>(focused_star_+1)/NUM_STARS); });
1343 key_down.connect(sigc::mem_fun(this, &RatingsButton::OnKeyDown));
1344-}
1345
1346-RatingsButton::~RatingsButton()
1347-{
1348+ scale.changed.connect(sigc::hide(sigc::mem_fun(this, &RatingsButton::QueueDraw)));
1349 }
1350
1351 void RatingsButton::SetEditable(bool editable)
1352@@ -76,7 +76,7 @@
1353
1354 void RatingsButton::SetRating(float rating)
1355 {
1356- rating_ = rating;
1357+ rating_ = rating;
1358 QueueDraw();
1359 }
1360
1361@@ -87,7 +87,7 @@
1362
1363 void RatingsButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
1364 {
1365- int rating = static_cast<int>(rating_ * num_stars);
1366+ int rating = static_cast<int>(GetRating() * NUM_STARS);
1367 // FIXME: 9/26/2011
1368 // We should probably support an API for saying whether the ratings
1369 // should or shouldn't support half stars...but our only consumer at
1370@@ -99,8 +99,8 @@
1371
1372 nux::Geometry const& geo = GetGeometry();
1373 nux::Geometry geo_star(geo);
1374- geo_star.width = star_size_;
1375- geo_star.height = star_size_;
1376+ geo_star.width = star_size_.CP(scale);
1377+ geo_star.height = star_size_.CP(scale);
1378
1379 gPainter.PaintBackground(GfxContext, geo);
1380 // set up our texture mode
1381@@ -123,7 +123,7 @@
1382 geo.height,
1383 col);
1384
1385- for (int index = 0; index < num_stars; ++index)
1386+ for (int index = 0; index < NUM_STARS; ++index)
1387 {
1388 dash::Style& style = dash::Style::Instance();
1389 nux::BaseTexture* texture = style.GetStarSelectedIcon();
1390@@ -165,7 +165,7 @@
1391 nux::Color(1.0f, 1.0f, 1.0f, 0.5f));
1392 }
1393
1394- geo_star.x += geo_star.width + star_gap_;
1395+ geo_star.x += geo_star.width + star_gap_.CP(scale);
1396
1397 }
1398
1399@@ -175,11 +175,11 @@
1400
1401 void RatingsButton::UpdateRatingToMouse(int x)
1402 {
1403- int width = num_stars*star_size_ + (num_stars-1)*star_gap_;
1404+ int width = NUM_STARS*star_size_.CP(scale) + (NUM_STARS-1)*star_gap_.CP(scale);
1405 float new_rating = (static_cast<float>(x) / width);
1406
1407 // FIXME: change to * 2 once we decide to support also half-stars
1408- new_rating = ceil((num_stars * 1) * new_rating) / (num_stars * 1);
1409+ new_rating = ceil((NUM_STARS * 1) * new_rating) / (NUM_STARS * 1);
1410 new_rating = (new_rating > 1) ? 1 : ((new_rating < 0) ? 0 : new_rating);
1411
1412 SetRating(new_rating);
1413@@ -210,8 +210,8 @@
1414 if (!editable_)
1415 return;
1416
1417- int width = num_stars*star_size_+ (num_stars-1)*star_gap_;
1418- focused_star_ = std::max(0, std::min(static_cast<int>(ceil((static_cast<float>(x) / width) * num_stars) - 1), num_stars - 1));
1419+ int width = NUM_STARS*star_size_.CP(scale)+ (NUM_STARS-1)*star_gap_.CP(scale);
1420+ focused_star_ = std::max(0, std::min(static_cast<int>(ceil((static_cast<float>(x) / width) * NUM_STARS) - 1), NUM_STARS - 1));
1421
1422 if (!HasKeyFocus())
1423 nux::GetWindowCompositor().SetKeyFocusArea(this);
1424@@ -240,7 +240,7 @@
1425 return false;
1426 else if (direction == nux::KEY_NAV_LEFT && (focused_star_ <= 0))
1427 return false;
1428- else if (direction == nux::KEY_NAV_RIGHT && (focused_star_ >= num_stars - 1))
1429+ else if (direction == nux::KEY_NAV_RIGHT && (focused_star_ >= NUM_STARS - 1))
1430 return false;
1431 else
1432 return true;
1433@@ -283,7 +283,7 @@
1434 {
1435 introspection
1436 .add(GetAbsoluteGeometry())
1437- .add("rating", rating_)
1438+ .add("rating", GetRating())
1439 .add("focused-star", focused_star_)
1440 .add("editable", editable_);
1441 }
1442
1443=== modified file 'unity-shared/RatingsButton.h'
1444--- unity-shared/RatingsButton.h 2014-06-16 09:16:53 +0000
1445+++ unity-shared/RatingsButton.h 2014-07-10 12:35:22 +0000
1446@@ -27,6 +27,7 @@
1447 #include <Nux/Nux.h>
1448 #include <Nux/ToggleButton.h>
1449 #include "unity-shared/Introspectable.h"
1450+#include "unity-shared/RawPixel.h"
1451
1452 namespace unity
1453 {
1454@@ -35,15 +36,13 @@
1455 {
1456 public:
1457 RatingsButton(int star_size, int star_gap, NUX_FILE_LINE_PROTO);
1458- virtual ~RatingsButton();
1459+
1460+ nux::Property<double> scale;
1461
1462 void SetEditable(bool editable);
1463 virtual void SetRating(float rating);
1464 virtual float GetRating() const;
1465
1466- int star_size_;
1467- int star_gap_;
1468-
1469 protected:
1470 virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
1471
1472@@ -65,8 +64,9 @@
1473 void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
1474 void UpdateRatingToMouse(int x);
1475
1476-
1477 protected:
1478+ RawPixel star_size_;
1479+ RawPixel star_gap_;
1480 bool editable_;
1481 float rating_;
1482 int focused_star_;
1483
1484=== modified file 'unity-shared/SearchBar.cpp'
1485--- unity-shared/SearchBar.cpp 2014-07-10 12:35:22 +0000
1486+++ unity-shared/SearchBar.cpp 2014-07-10 12:35:22 +0000
1487@@ -62,6 +62,8 @@
1488 const RawPixel BOT_ARROW_MIN_HEIGHT = 8_em;
1489 const RawPixel BOT_ARROW_MAX_HEIGHT = 8_em;
1490
1491+const RawPixel FILTER_HORIZONTAL_MARGIN = 8_em;
1492+
1493 // Fonts
1494 const std::string HINT_LABEL_FONT_SIZE = "20px";
1495 const std::string HINT_LABEL_FONT_STYLE = "Italic";
1496@@ -195,19 +197,12 @@
1497 show_filters_->SetScale(scale);
1498 show_filters_->SetLines(-1);
1499
1500- nux::BaseTexture* arrow;
1501- arrow = style.GetGroupExpandIcon();
1502- expand_icon_ = new IconTexture(arrow,
1503- arrow->GetWidth(),
1504- arrow->GetHeight());
1505+ expand_icon_ = new IconTexture(style.GetGroupExpandIcon());
1506 expand_icon_->SetOpacity(DEFAULT_ICON_OPACITY);
1507- expand_icon_->SetMinimumSize(arrow->GetWidth(), arrow->GetHeight());
1508+ expand_icon_->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
1509 expand_icon_->SetVisible(false);
1510
1511 filter_layout_ = new nux::HLayout();
1512- filter_layout_->SetHorizontalInternalMargin(8);
1513- filter_layout_->SetLeftAndRightPadding(style.GetFilterResultsHighlightLeftPadding(),
1514- style.GetFilterResultsHighlightRightPadding());
1515 filter_layout_->SetContentDistribution(nux::MAJOR_POSITION_END);
1516 filter_layout_->AddView(show_filters_, 0, nux::MINOR_POSITION_CENTER);
1517
1518@@ -233,14 +228,6 @@
1519 expander_view_->SetLayout(filter_layout_);
1520 layout_->AddView(expander_view_, 0, nux::MINOR_POSITION_END, nux::MINOR_SIZE_FULL);
1521
1522- int width = style.GetFilterBarWidth() +
1523- style.GetFilterResultsHighlightLeftPadding() +
1524- style.GetFilterResultsHighlightRightPadding();
1525-
1526- expander_view_->SetMaximumWidth(width);
1527- expander_view_->SetMinimumWidth(width);
1528- show_filters_->SetMaximumWidth(style.GetFilterBarWidth() - arrow_layout_->GetBaseWidth() - 8);
1529-
1530 // Lambda functions
1531 auto mouse_expand = [this](int, int, unsigned long, unsigned long)
1532 {
1533@@ -291,6 +278,8 @@
1534
1535 void SearchBar::UpdateSearchBarSize()
1536 {
1537+ auto& style = dash::Style::Instance();
1538+
1539 layout_->SetLeftAndRightPadding(LEFT_INTERNAL_PADDING.CP(scale()),
1540 SEARCH_ENTRY_RIGHT_BORDER.CP(scale()));
1541 layout_->SetSpaceBetweenChildren(SPACE_BETWEEN_ENTRY_AND_HIGHLIGHT.CP(scale()));
1542@@ -313,6 +302,21 @@
1543 BOT_ARROW_MIN_HEIGHT.CP(scale()));
1544 arrow_bottom_space_->SetMaximumSize(ARROW_MAX_WIDTH.CP(scale()),
1545 BOT_ARROW_MAX_HEIGHT.CP(scale()));
1546+
1547+ int highlight_left_padding = style.GetFilterResultsHighlightLeftPadding().CP(scale);
1548+ int highlight_right_padding = style.GetFilterResultsHighlightRightPadding().CP(scale);
1549+ int filter_bar_width = style.GetFilterBarWidth().CP(scale);
1550+
1551+ filter_layout_->SetHorizontalInternalMargin(FILTER_HORIZONTAL_MARGIN.CP(scale));
1552+ filter_layout_->SetLeftAndRightPadding(highlight_left_padding, highlight_right_padding);
1553+ show_filters_->SetMaximumWidth(filter_bar_width - arrow_layout_->GetBaseWidth() - (8_em).CP(scale));
1554+
1555+ int width = filter_bar_width + highlight_right_padding + highlight_right_padding;
1556+ expander_view_->SetMaximumWidth(width);
1557+ expander_view_->SetMinimumWidth(width);
1558+
1559+ auto const& arrow = expand_icon_->texture();
1560+ expand_icon_->SetMinMaxSize(RawPixel(arrow->GetWidth()).CP(scale), RawPixel(arrow->GetHeight()).CP(scale));
1561 }
1562
1563 // Based on the Font size, the MinHeight is changing in TextEntry. From there the
1564@@ -324,6 +328,10 @@
1565 pango_entry_->SetMaximumHeight(entry_min);
1566 layered_layout_->SetMinimumHeight(entry_min);
1567 layered_layout_->SetMaximumHeight(entry_min);
1568+
1569+ int search_bar_height = style.GetSearchBarHeight().CP(scale);
1570+ SetMinimumHeight(search_bar_height);
1571+ SetMaximumHeight(search_bar_height);
1572 }
1573
1574 void SearchBar::UpdateScale(double scale)
1575@@ -333,7 +341,7 @@
1576 hint_->SetScale(scale);
1577 spinner_->scale = scale;
1578
1579- if (show_filters_)
1580+ if (show_filter_hint_)
1581 show_filters_->SetScale(scale);
1582
1583 UpdateSearchBarSize();
1584@@ -371,11 +379,7 @@
1585
1586 void SearchBar::OnSearchHintChanged()
1587 {
1588- gchar* tmp = g_markup_escape_text(search_hint().c_str(), -1);
1589-
1590- hint_->SetText(tmp);
1591-
1592- g_free(tmp);
1593+ hint_->SetText(glib::String(g_markup_escape_text(search_hint().c_str(), -1)).Str());
1594 }
1595
1596 void SearchBar::OnSearchChanged(nux::TextEntry* text_entry)
1597@@ -422,6 +426,9 @@
1598 expand_icon_->SetTexture(style.GetGroupUnexpandIcon());
1599 else
1600 expand_icon_->SetTexture(style.GetGroupExpandIcon());
1601+
1602+ auto const& arrow = expand_icon_->texture();
1603+ expand_icon_->SetMinMaxSize(RawPixel(arrow->GetWidth()).CP(scale), RawPixel(arrow->GetHeight()).CP(scale));
1604 }
1605 }
1606
1607
1608=== modified file 'unity-shared/SpreadFilter.cpp'
1609--- unity-shared/SpreadFilter.cpp 2014-04-01 17:13:29 +0000
1610+++ unity-shared/SpreadFilter.cpp 2014-07-10 12:35:22 +0000
1611@@ -38,7 +38,6 @@
1612 const RawPixel OFFSET_X = 10_em;
1613 const RawPixel OFFSET_Y = 15_em;
1614 const RawPixel WIDTH = 620_em;
1615-const RawPixel HEIGHT = 42_em;
1616
1617 // For some reason std::to_lower or boost::to_lower_copy doesn't seem to handle well utf8
1618 std::string casefold_copy(std::string const& str)
1619@@ -58,7 +57,8 @@
1620 auto const& cv = settings.em(monitor);
1621
1622 search_bar_ = SearchBar::Ptr(new SearchBar());
1623- search_bar_->SetMinMaxSize(WIDTH.CP(cv), HEIGHT.CP(cv));
1624+ search_bar_->SetMinimumWidth(WIDTH.CP(cv));
1625+ search_bar_->SetMaximumWidth(WIDTH.CP(cv));
1626 search_bar_->scale = cv->DPIScale();
1627 search_bar_->live_search_wait = DEFAULT_SEARCH_WAIT;
1628 text.SetGetterFunction([this] { return search_bar_->search_string(); });