Merge lp:~unity-team/unity/previews-scaling-final 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: 3839
Proposed branch: lp:~unity-team/unity/previews-scaling-final
Merge into: lp:unity
Diff against target: 4185 lines (+1053/-530)
49 files modified
dash/DashView.cpp (+47/-42)
dash/DashView.h (+3/-2)
dash/PlacesGroup.cpp (+15/-9)
dash/ResultRendererHorizontalTile.cpp (+2/-2)
dash/ScopeView.cpp (+2/-0)
dash/StandaloneDash.cpp (+41/-27)
dash/previews/ActionButton.cpp (+9/-11)
dash/previews/ActionLink.cpp (+13/-0)
dash/previews/ActionLink.h (+2/-2)
dash/previews/ApplicationPreview.cpp (+38/-14)
dash/previews/GenericPreview.cpp (+8/-3)
dash/previews/MoviePreview.cpp (+3/-0)
dash/previews/MusicPaymentPreview.cpp (+103/-29)
dash/previews/MusicPaymentPreview.h (+1/-0)
dash/previews/MusicPreview.cpp (+96/-37)
dash/previews/MusicPreview.h (+5/-0)
dash/previews/PaymentPreview.cpp (+45/-17)
dash/previews/PaymentPreview.h (+3/-0)
dash/previews/Preview.cpp (+5/-4)
dash/previews/PreviewContainer.cpp (+40/-42)
dash/previews/PreviewContainer.h (+3/-2)
dash/previews/PreviewInfoHintWidget.cpp (+2/-2)
dash/previews/PreviewNavigator.cpp (+22/-5)
dash/previews/PreviewNavigator.h (+8/-4)
dash/previews/PreviewRatingsWidget.cpp (+3/-2)
dash/previews/PreviewRatingsWidget.h (+1/-1)
dash/previews/SocialPreview.cpp (+125/-50)
dash/previews/SocialPreview.h (+10/-0)
dash/previews/SocialPreviewComments.cpp (+16/-22)
dash/previews/SocialPreviewComments.h (+1/-5)
dash/previews/SocialPreviewContent.cpp (+33/-19)
dash/previews/SocialPreviewContent.h (+4/-1)
dash/previews/StandaloneApplicationPreview.cpp (+28/-13)
dash/previews/StandaloneErrorPreview.cpp (+18/-4)
dash/previews/StandaloneMoviePreview.cpp (+18/-3)
dash/previews/StandaloneMusicPaymentPreview.cpp (+17/-4)
dash/previews/StandaloneSocialPreview.cpp (+22/-8)
dash/previews/Track.cpp (+41/-18)
dash/previews/Track.h (+10/-3)
dash/previews/Tracks.cpp (+36/-5)
dash/previews/Tracks.h (+5/-0)
unity-shared/CoverArt.cpp (+17/-21)
unity-shared/DashStyle.cpp (+46/-29)
unity-shared/IconTexture.cpp (+7/-17)
unity-shared/PreviewStyle.cpp (+1/-1)
unity-shared/SearchBar.cpp (+10/-10)
unity-shared/SearchBarSpinner.cpp (+46/-28)
unity-shared/SearchBarSpinner.h (+3/-0)
unity-shared/UnitySettings.cpp (+19/-12)
To merge this branch: bzr merge lp:~unity-team/unity/previews-scaling-final
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Eleni Maria Stea (community) Approve
Marco Trevisan (Treviño) Approve
Review via email: mp+225999@code.launchpad.net

Commit message

Previews: scale the dash preview contents to match current monitor scaling

Improved also the scaling of search-bar, spinner, categories and many other components.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Approving the Revisions till 3850.

Revision 3851 and 3852 have isses fixed by 3853 (which needs review by someone else)

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: Needs Fixing (continuous-integration)
Revision history for this message
Eleni Maria Stea (hikiko) wrote :

hello :) I got a segmentation fault at runtime, that I wasn't getting before. I'm further debugging/reproducing now..

review: Needs Fixing
Revision history for this message
Eleni Maria Stea (hikiko) wrote :

http://paste.ubuntu.com/7769368/ backlog + more info about the segmentation fault

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

I think it looks good now :)
Approved!

review: Approve
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-06-11 17:15:30 +0000
3+++ dash/DashView.cpp 2014-07-09 10:31:56 +0000
4@@ -57,6 +57,8 @@
5
6 const RawPixel DASH_RESULT_RIGHT_PAD = 35_em;
7 const RawPixel PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET = 10_em;
8+const RawPixel PREVIEW_CONTAINER_TRIANGLE_WIDTH = 14_em;
9+const RawPixel PREVIEW_CONTAINER_TRIANGLE_HEIGHT = 12_em;
10
11 const int MAX_ENTRY_ACTIVATE_WAIT_TIMEOUT = 1000;
12 }
13@@ -112,6 +114,7 @@
14
15 DashView::DashView(Scopes::Ptr const& scopes, ApplicationStarter::Ptr const& application_starter)
16 : nux::View(NUX_TRACKER_LOCATION)
17+ , scale(Settings::Instance().em()->DPIScale())
18 , scopes_(scopes)
19 , application_starter_(application_starter)
20 , preview_container_(nullptr)
21@@ -129,7 +132,6 @@
22 , animate_preview_container_value_(0.0)
23 , animate_preview_value_(0.0)
24 , overlay_window_buttons_(new OverlayWindowButtons())
25- , cv_(Settings::Instance().em())
26 , monitor_(0)
27 {
28 renderer_.SetOwner(this);
29@@ -144,7 +146,6 @@
30
31 mouse_down.connect(sigc::mem_fun(this, &DashView::OnMouseButtonDown));
32 preview_state_machine_.PreviewActivated.connect(sigc::mem_fun(this, &DashView::BuildPreview));
33- Relayout();
34
35 if (scopes_)
36 {
37@@ -159,6 +160,8 @@
38 });
39
40 unity::Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &DashView::OnDPIChanged));
41+ scale.changed.connect(sigc::mem_fun(this, &DashView::UpdateScale));
42+ UpdateScale(scale());
43 }
44
45 DashView::~DashView()
46@@ -232,13 +235,13 @@
47
48 if (!preview_container_)
49 {
50- preview_container_ = previews::PreviewContainer::Ptr(new previews::PreviewContainer());
51+ preview_container_ = new previews::PreviewContainer();
52 preview_container_->SetRedirectRenderingToTexture(true);
53 AddChild(preview_container_.GetPointer());
54 preview_container_->SetParentObject(this);
55 }
56 preview_container_->Preview(model, previews::Navigation::NONE); // no swipe left or right
57- preview_container_->scale = cv_->DPIScale();
58+ preview_container_->scale = scale();
59 preview_container_->SetGeometry(scopes_layout_->GetGeometry());
60 preview_displaying_ = true;
61
62@@ -265,7 +268,7 @@
63 {
64 // got a new preview whilst already displaying, we probably clicked a navigation button.
65 preview_container_->Preview(model, preview_navigation_mode_); // TODO
66- preview_container_->scale = cv_->DPIScale();
67+ preview_container_->scale = scale();
68 }
69
70 if (G_LIKELY(preview_state_machine_.left_results() > 0 && preview_state_machine_.right_results() > 0))
71@@ -467,10 +470,7 @@
72 if (monitor_ != monitor)
73 {
74 monitor_ = monitor;
75- cv_ = Settings::Instance().em(monitor_);
76-
77- OnDPIChanged();
78- Relayout();
79+ scale = Settings::Instance().em(monitor_)->DPIScale();
80 }
81
82 /* Give the scopes a chance to prep data before we map them */
83@@ -548,7 +548,7 @@
84 content_layout_->AddLayout(search_bar_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
85
86 search_bar_ = new SearchBar(true);
87- search_bar_->scale = cv_->DPIScale();
88+ search_bar_->scale = scale();
89 AddChild(search_bar_);
90 search_bar_->activated.connect(sigc::mem_fun(this, &DashView::OnEntryActivated));
91 search_bar_->search_changed.connect(sigc::mem_fun(this, &DashView::OnSearchChanged));
92@@ -577,8 +577,11 @@
93
94 void DashView::OnDPIChanged()
95 {
96- double scale = cv_->DPIScale();
97+ scale = Settings::Instance().em(monitor_)->DPIScale();
98+}
99
100+void DashView::UpdateScale(double scale)
101+{
102 UpdateDashViewSize();
103
104 for (auto& scope : scope_views_)
105@@ -588,7 +591,9 @@
106 scope_bar_->scale = scale;
107
108 if (preview_container_)
109- preview_container_->scale = cv_->DPIScale();
110+ preview_container_->scale = scale;
111+
112+ Relayout();
113 }
114
115 void DashView::UpdateDashViewSize()
116@@ -602,14 +607,14 @@
117 RawPixel const search_bar_left_padding = style.GetSearchBarLeftPadding();
118 RawPixel const search_bar_height = style.GetSearchBarHeight();
119
120- layout_->SetLeftAndRightPadding(v_separator_size.CP(cv_), 0);
121- layout_->SetTopAndBottomPadding(h_separator_size.CP(cv_), 0);
122-
123- content_layout_->SetTopAndBottomPadding(view_top_padding.CP(cv_), 0);
124-
125- search_bar_layout_->SetLeftAndRightPadding(search_bar_left_padding.CP(cv_), 0);
126- search_bar_->SetMinimumHeight(search_bar_height.CP(cv_));
127- search_bar_->SetMaximumHeight(search_bar_height.CP(cv_));
128+ layout_->SetLeftAndRightPadding(v_separator_size.CP(scale), 0);
129+ layout_->SetTopAndBottomPadding(h_separator_size.CP(scale), 0);
130+
131+ content_layout_->SetTopAndBottomPadding(view_top_padding.CP(scale), 0);
132+
133+ search_bar_layout_->SetLeftAndRightPadding(search_bar_left_padding.CP(scale), 0);
134+ search_bar_->SetMinimumHeight(search_bar_height.CP(scale));
135+ search_bar_->SetMaximumHeight(search_bar_height.CP(scale));
136 }
137
138 void DashView::SetupUBusConnections()
139@@ -638,18 +643,18 @@
140 scopes_layout_->SetMaximumHeight (std::max(0, content_geo_.height -
141 search_bar_->GetGeometry().height -
142 scope_bar_->GetGeometry().height -
143- top_padding.CP(cv_)));
144+ top_padding.CP(scale)));
145
146 scopes_layout_->SetMinimumHeight (std::max(0, content_geo_.height -
147 search_bar_->GetGeometry().height -
148 scope_bar_->GetGeometry().height -
149- top_padding.CP(cv_)));
150+ top_padding.CP(scale)));
151
152 layout_->SetMinMaxSize(content_geo_.width, content_geo_.y + content_geo_.height);
153
154 // Minus the padding that gets added to the left
155 RawPixel const tile_width = style.GetTileWidth();
156- style.SetDefaultNColumns(floorf((content_geo_.width - cv_->CP(32)) / tile_width.CP(cv_)));
157+ style.SetDefaultNColumns(floorf((content_geo_.width - (32_em).CP(scale)) / tile_width.CP(scale)));
158
159 ubus_manager_.SendMessage(UBUS_DASH_SIZE_CHANGED, g_variant_new("(ii)", content_geo_.width, content_geo_.height));
160
161@@ -676,27 +681,27 @@
162 RawPixel const category_icon_size = style.GetCategoryIconSize();
163 RawPixel const group_top_padding = style.GetPlacesGroupResultTopPadding();
164
165- int category_height = (group_top_space.CP(cv_) + category_icon_size.CP(cv_) +
166- group_top_padding.CP(cv_) + tile_height.CP(cv_));
167+ int category_height = (group_top_space.CP(scale) + category_icon_size.CP(scale) +
168+ group_top_padding.CP(scale) + tile_height.CP(scale));
169
170 int half = for_geo.width / 2;
171
172 // if default dash size is bigger than half a screens worth of items, go for that.
173- while ((width += tile_width.CP(cv_)) < half)
174+ while ((width += tile_width.CP(scale)) < half)
175 ;
176
177 RawPixel const v_separator_size = style.GetVSeparatorSize();
178 RawPixel const group_left_padding = style.GetPlacesGroupResultLeftPadding();
179
180- width = std::max(width, tile_width.CP(cv_) * DASH_TILE_HORIZONTAL_COUNT);
181- width += v_separator_size.CP(cv_);
182- width += group_left_padding.CP(cv_) + DASH_RESULT_RIGHT_PAD.CP(cv_);
183+ width = std::max(width, tile_width.CP(scale) * DASH_TILE_HORIZONTAL_COUNT);
184+ width += v_separator_size.CP(scale);
185+ width += group_left_padding.CP(scale) + DASH_RESULT_RIGHT_PAD.CP(scale);
186
187 RawPixel const h_separator_size = style.GetHSeparatorSize();
188 RawPixel const top_padding = style.GetDashViewTopPadding();
189
190- height = h_separator_size.CP(cv_);
191- height += top_padding.CP(cv_);
192+ height = h_separator_size.CP(scale);
193+ height += top_padding.CP(scale);
194 height += search_bar_->GetGeometry().height;
195 height += category_height * DASH_DEFAULT_CATEGORY_COUNT; // adding three categories
196 height += scope_bar_->GetGeometry().height;
197@@ -810,7 +815,7 @@
198 texxform.voffset = (scope_bar_->GetY() - content_view_->GetY())/(float)content_view_->GetHeight();
199
200 int start_y = scope_bar_->GetY();
201- int final_y = geo_layout.y + geo_layout.height + PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(cv_);
202+ int final_y = geo_layout.y + geo_layout.height + PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(scale);
203
204 int scope_y = (1.0f - animate_split_value_) * start_y + (animate_split_value_ * final_y);
205
206@@ -834,7 +839,7 @@
207 texxform.voffset = (search_bar_->GetY() - content_view_->GetY())/(float)content_view_->GetHeight();
208
209 start_y = search_bar_->GetY();
210- final_y = geo_layout.y - search_bar_->GetHeight() - PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(cv_);
211+ final_y = geo_layout.y - search_bar_->GetHeight() - PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(scale);
212
213 graphics_engine.QRP_1Tex
214 (
215@@ -852,7 +857,7 @@
216 texxform.voffset = (search_bar_->GetY() - content_view_->GetY())/(float)content_view_->GetHeight();
217
218 int start_x = active_scope_view_->filter_bar()->GetX();
219- int final_x = content_view_->GetX() + content_view_->GetWidth() + PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(cv_);
220+ int final_x = content_view_->GetX() + content_view_->GetWidth() + PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(scale);
221
222 int filter_x = (1.0f - animate_split_value_) * start_x + (animate_split_value_ * final_x);
223
224@@ -876,7 +881,7 @@
225 texxform.voffset = (search_bar_->GetY() - content_view_->GetY())/(float)content_view_->GetHeight();
226
227 int start_y = search_bar_->GetY();
228- int final_y = geo_layout.y - search_bar_->GetHeight() - PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(cv_);
229+ int final_y = geo_layout.y - search_bar_->GetHeight() - PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(scale);
230
231 graphics_engine.QRP_1Tex
232 (
233@@ -910,8 +915,8 @@
234 // Triangle pointed at preview item
235 if (opening_column_x_ != -1)
236 {
237- int final_width = cv_->CP(14);
238- int final_height = cv_->CP(12);
239+ int final_width = PREVIEW_CONTAINER_TRIANGLE_WIDTH.CP(scale);
240+ int final_height = PREVIEW_CONTAINER_TRIANGLE_HEIGHT.CP(scale);
241
242 int x_center = geo_content.x + (opening_column_x_ - geo_abs.x) + opening_column_width_ / 2;
243 int start_y = geo_abs_preview.y - geo_abs.y;
244@@ -1143,8 +1148,8 @@
245 RawPixel const right_title_width = style.GetDashRightTileWidth();
246 RawPixel const bottom_title_width = style.GetDashBottomTileHeight();
247
248- geo.width += right_title_width.CP(cv_);
249- geo.height += bottom_title_width.CP(cv_);
250+ geo.width += right_title_width.CP(scale);
251+ geo.height += bottom_title_width.CP(scale);
252 }
253 }
254
255@@ -1286,7 +1291,7 @@
256
257 nux::ObjectPtr<ScopeView> view(new ScopeView(scope, search_bar_->show_filters()));
258 AddChild(view.GetPointer());
259- view->scale = cv_->DPIScale();
260+ view->scale = scale();
261 view->SetVisible(false);
262 view->result_activated.connect(sigc::mem_fun(this, &DashView::OnResultActivated));
263
264@@ -1525,8 +1530,8 @@
265 introspection.add(nux::Geometry(GetAbsoluteX(), GetAbsoluteY(), content_geo_.width, content_geo_.height))
266 .add("num_rows", num_rows)
267 .add("form_factor", form_factor)
268- .add("right-border-width", right_title_width.CP(cv_))
269- .add("bottom-border-height", bottom_title_width.CP(cv_))
270+ .add("right-border-width", right_title_width.CP(scale))
271+ .add("bottom-border-height", bottom_title_width.CP(scale))
272 .add("preview_displaying", preview_displaying_)
273 .add("preview_animation", animate_split_value_ * animate_preview_container_value_ * animate_preview_value_)
274 .add("dash_maximized", style.always_maximised())
275
276=== modified file 'dash/DashView.h'
277--- dash/DashView.h 2014-03-01 22:51:41 +0000
278+++ dash/DashView.h 2014-07-09 10:31:56 +0000
279@@ -37,7 +37,6 @@
280
281 #include "unity-shared/BackgroundEffectHelper.h"
282 #include "unity-shared/BGHash.h"
283-#include "unity-shared/EMConverter.h"
284 #include "unity-shared/Introspectable.h"
285 #include "unity-shared/OverlayRenderer.h"
286 #include "unity-shared/SearchBar.h"
287@@ -63,6 +62,8 @@
288 DashView(Scopes::Ptr const& scopes, ApplicationStarter::Ptr const& application_starter);
289 ~DashView();
290
291+ nux::Property<double> scale;
292+
293 void AboutToShow(int monitor);
294 void AboutToHide();
295 void Relayout();
296@@ -131,6 +132,7 @@
297 nux::Geometry GetRenderAbsoluteGeometry() const;
298
299 void UpdateDashViewSize();
300+ void UpdateScale(double scale);
301 void OnDPIChanged();
302
303 nux::Area* KeyNavIteration(nux::KeyNavDirection direction);
304@@ -195,7 +197,6 @@
305
306 nux::ObjectPtr<OverlayWindowButtons> overlay_window_buttons_;
307
308- EMConverter::Ptr cv_;
309 int monitor_;
310
311 friend class TestDashView;
312
313=== modified file 'dash/PlacesGroup.cpp'
314--- dash/PlacesGroup.cpp 2014-03-20 04:05:39 +0000
315+++ dash/PlacesGroup.cpp 2014-07-09 10:31:56 +0000
316@@ -133,8 +133,6 @@
317 SetAcceptKeyNavFocusOnMouseEnter(false);
318 scale.changed.connect(sigc::mem_fun(this, &PlacesGroup::UpdateScale));
319
320- nux::BaseTexture* arrow = _style.GetGroupExpandIcon();
321-
322 _background = _style.GetCategoryBackground();
323 _background_nofilters = _style.GetCategoryBackgroundNoFilters();
324
325@@ -172,6 +170,7 @@
326
327 _name = new StaticCairoText("", NUX_TRACKER_LOCATION);
328 _name->SetFont(NAME_LABEL_FONT);
329+ _name->SetLines(-1);
330 _name->SetTextEllipsize(StaticCairoText::NUX_ELLIPSIZE_END);
331 _name->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
332 _text_layout->AddView(_name, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
333@@ -184,16 +183,17 @@
334
335 _expand_label = new StaticCairoText("", NUX_TRACKER_LOCATION);
336 _expand_label->SetFont(EXPANDER_LABEL_FONT);
337+ _expand_label->SetLines(-1);
338 _expand_label->SetTextEllipsize(StaticCairoText::NUX_ELLIPSIZE_END);
339 _expand_label->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
340 _expand_label->SetTextColor(kExpandDefaultTextColor);
341 _expand_label_layout->AddView(_expand_label, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
342
343- _expand_icon = new IconTexture(arrow, arrow->GetWidth(), arrow->GetHeight());
344+ _expand_icon = new IconTexture(_style.GetGroupExpandIcon());
345+ _expand_icon->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
346 _expand_icon->SetOpacity(kExpandDefaultIconOpacity);
347- _expand_icon->SetMinimumSize(arrow->GetWidth(), arrow->GetHeight());
348 _expand_icon->SetVisible(false);
349- _expand_layout->AddView(_expand_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
350+ _expand_layout->AddView(_expand_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
351
352 SetLayout(_group_layout);
353
354@@ -231,6 +231,7 @@
355 _space_layout->SetMaximumSize(top_space, top_space);
356
357 _header_layout->SetSpaceBetweenChildren(SPACE_BETWEEN_CHILDREN.CP(scale()));
358+ _header_layout->SetLeftAndRightPadding(RawPixel(_style.GetCategoryHeaderLeftPadding()).CP(scale), 0);
359
360 _icon->SetMinMaxSize(icon_size.CP(scale()), icon_size.CP(scale()));
361
362@@ -243,13 +244,16 @@
363 {
364 RawPixel const icon_size = _style.GetCategoryIconSize();
365
366+ _name->SetMinimumSize(nux::AREA_MIN_WIDTH, nux::AREA_MIN_HEIGHT);
367+ _name->SetMaximumSize(nux::AREA_MAX_WIDTH, nux::AREA_MAX_HEIGHT);
368 _name->SetScale(scale);
369 _expand_label->SetScale(scale);
370
371 _icon->SetSize(icon_size.CP(scale));
372 _icon->ReLoadIcon();
373
374- // FIXME _expand_icon, needs some work here. Not as easy as _icon
375+ auto const& arrow = _expand_icon->texture();
376+ _expand_icon->SetMinMaxSize(RawPixel(arrow->GetWidth()).CP(scale), RawPixel(arrow->GetHeight()).CP(scale));
377
378 if (_child_view)
379 _child_view->scale = scale;
380@@ -279,7 +283,6 @@
381
382 void
383
384-// FIXME _expand_icon, needs some work here. Not as easy as _icon
385 PlacesGroup::SetName(std::string const& name)
386 {
387 if (_cached_name != name)
388@@ -310,7 +313,7 @@
389 void
390 PlacesGroup::SetIcon(std::string const& path_to_emblem)
391 {
392- _icon->SetByIconName(path_to_emblem, _style.GetCategoryIconSize());
393+ _icon->SetByIconName(path_to_emblem, RawPixel(_style.GetCategoryIconSize()).CP(scale));
394 }
395
396 void
397@@ -462,7 +465,7 @@
398 // only the width matters
399 if (_cached_geometry.GetWidth() != geo.GetWidth())
400 {
401- _focus_layer.reset(_style.FocusOverlay(geo.width -
402+ _focus_layer.reset(_style.FocusOverlay(geo.width -
403 kHighlightLeftPadding.CP(scale()) -
404 kHighlightRightPadding.CP(scale()),
405 kHighlightHeight.CP(scale())));
406@@ -595,6 +598,9 @@
407 else
408 _expand_icon->SetTexture(_style.GetGroupExpandIcon());
409
410+ auto const& tex = _expand_icon->texture();
411+ _expand_icon->SetMinMaxSize(RawPixel(tex->GetWidth()).CP(scale), RawPixel(tex->GetHeight()).CP(scale));
412+
413 expanded.emit(this);
414 }
415
416
417=== modified file 'dash/ResultRendererHorizontalTile.cpp'
418--- dash/ResultRendererHorizontalTile.cpp 2014-03-20 05:05:21 +0000
419+++ dash/ResultRendererHorizontalTile.cpp 2014-07-09 10:31:56 +0000
420@@ -247,8 +247,8 @@
421 0.0f,
422 0.0f,
423 CARD_VIEW_HIGHLIGHT_CORNER_RADIUS,
424- width,
425- height,
426+ width/scale(),
427+ height/scale(),
428 false);
429 cairo_fill(cr);
430
431
432=== modified file 'dash/ScopeView.cpp'
433--- dash/ScopeView.cpp 2014-03-20 04:05:39 +0000
434+++ dash/ScopeView.cpp 2014-07-09 10:31:56 +0000
435@@ -250,6 +250,7 @@
436 no_results_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
437 no_results_->SetTextColor(nux::color::White);
438 no_results_->SetVisible(false);
439+ no_results_->SetScale(scale);
440 scroll_layout_->AddView(no_results_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
441
442 fscroll_view_ = new ScopeScrollView(new PlacesOverlayVScrollBar(NUX_TRACKER_LOCATION), NUX_TRACKER_LOCATION);
443@@ -299,6 +300,7 @@
444 group->scale = scale;
445
446 filter_bar_->scale = scale;
447+ no_results_->SetScale(scale);
448 }
449
450 void ScopeView::SetupCategories(Categories::Ptr const& categories)
451
452=== modified file 'dash/StandaloneDash.cpp'
453--- dash/StandaloneDash.cpp 2014-02-28 23:32:05 +0000
454+++ dash/StandaloneDash.cpp 2014-07-09 10:31:56 +0000
455@@ -36,47 +36,50 @@
456 #include "unity-shared/DashStyle.h"
457 #include "unity-shared/PanelStyle.h"
458 #include "unity-shared/ThumbnailGenerator.h"
459-#include "UnityCore/GSettingsScopes.h"
460+#include "unity-shared/UBusMessages.h"
461+#include "unity-shared/UBusServer.h"
462+#include <UnityCore/GSettingsScopes.h>
463+#include <UnityCore/ScopeProxyInterface.h>
464
465-#define WIDTH 1024
466-#define HEIGHT 768
467+const unity::RawPixel WIDTH(1024);
468+const unity::RawPixel HEIGHT(768);
469
470 using namespace unity::dash;
471
472 class TestRunner
473 {
474 public:
475- TestRunner ();
476- ~TestRunner ();
477+ TestRunner(std::string const& scope, double scale)
478+ : scope_(scope)
479+ , scale_(scale)
480+ {}
481
482 static void InitWindowThread (nux::NThread* thread, void* InitData);
483 void Init ();
484+ std::string scope_;
485+ double scale_;
486 nux::Layout *layout;
487 };
488
489-TestRunner::TestRunner ()
490-{
491-}
492-
493-TestRunner::~TestRunner ()
494-{
495-}
496-
497 void TestRunner::Init ()
498 {
499 layout = new nux::HLayout(NUX_TRACKER_LOCATION);
500
501- DashView* view = new DashView(std::make_shared<unity::dash::GSettingsScopes>(),
502+ DashView* view = new DashView(std::make_shared<unity::dash::GSettingsScopes>(),
503 std::make_shared<unity::ApplicationStarterImp>());
504+ view->scale = scale_;
505 view->DisableBlur();
506- view->SetMinMaxSize(WIDTH, HEIGHT);
507+ view->SetMinMaxSize(WIDTH.CP(scale_), HEIGHT.CP(scale_));
508 layout->AddView (view, 1, nux::MINOR_POSITION_CENTER);
509- layout->SetMinMaxSize(WIDTH, HEIGHT);
510+ layout->SetMinMaxSize(WIDTH.CP(scale_), HEIGHT.CP(scale_));
511
512 view->AboutToShow(0);
513
514 nux::GetWindowThread()->SetLayout (layout);
515 nux::GetWindowCompositor().SetKeyFocusArea(view->default_focus());
516+
517+ unity::UBusServer().SendMessage(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
518+ g_variant_new("(sus)", scope_.c_str(), GOTO_DASH_URI, ""));
519 }
520
521 void TestRunner::InitWindowThread(nux::NThread* thread, void* InitData)
522@@ -87,8 +90,6 @@
523
524 int main(int argc, char **argv)
525 {
526- nux::WindowThread* wt = NULL;
527-
528 gtk_init (&argc, &argv);
529
530 unity::BGHash bghash;
531@@ -102,17 +103,30 @@
532 unity::dash::Style dash_style;
533 unity::panel::Style panel_style;
534
535- TestRunner *test_runner = new TestRunner ();
536- wt = nux::CreateGUIThread(TEXT("Unity Dash"),
537- WIDTH, HEIGHT,
538- 0,
539- &TestRunner::InitWindowThread,
540- test_runner);
541+ double scale = 1.0;
542+ unity::glib::String scope;
543+ unity::glib::Error err;
544+
545+ GOptionEntry args_parsed[] =
546+ {
547+ { "scope", 's', 0, G_OPTION_ARG_STRING, &scope, "The default scope ", "S" },
548+ { "scaling-factor", 'f', 0, G_OPTION_ARG_DOUBLE, &scale, "The dash scaling factor", "F" },
549+ { NULL }
550+ };
551+
552+ std::shared_ptr<GOptionContext> ctx(g_option_context_new("Standalone Dash"), g_option_context_free);
553+ g_option_context_add_main_entries(ctx.get(), args_parsed, NULL);
554+ if (!g_option_context_parse(ctx.get(), &argc, &argv, &err))
555+ std::cerr << "Got error when parsing arguments: " << err << std::endl;
556+
557+ TestRunner *test_runner = new TestRunner(scope.Str(), scale);
558+ std::unique_ptr<nux::WindowThread> wt(nux::CreateGUIThread(TEXT("Unity Dash"),
559+ WIDTH.CP(scale), HEIGHT.CP(scale),
560+ 0, &TestRunner::InitWindowThread, test_runner));
561
562 nux::NuxTimerTickSource tick_source;
563 nux::animation::AnimationController animation_controller(tick_source);
564+ wt->Run(nullptr);
565
566- wt->Run (NULL);
567- delete wt;
568- return 0;
569+ return EXIT_SUCCESS;
570 }
571
572=== modified file 'dash/previews/ActionButton.cpp'
573--- dash/previews/ActionButton.cpp 2014-06-13 15:04:19 +0000
574+++ dash/previews/ActionButton.cpp 2014-07-09 10:31:56 +0000
575@@ -87,22 +87,19 @@
576
577 void ActionButton::InitTheme()
578 {
579- if (!cr_active_)
580- {
581- nux::Geometry const& geo = GetGeometry();
582+ nux::Geometry const& geo = GetGeometry();
583
584- cr_prelight_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
585- cr_active_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)));
586- cr_normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));
587- cr_focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &ActionButton::RedrawFocusOverlay)));
588- }
589+ cr_prelight_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
590+ cr_active_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)));
591+ cr_normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));
592+ cr_focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &ActionButton::RedrawFocusOverlay)));
593
594 SetMinimumHeight(MIN_BUTTON_HEIGHT.CP(scale));
595 SetMinimumWidth(MIN_BUTTON_WIDTH.CP(scale));
596 }
597
598 void ActionButton::SetExtraHint(std::string const& extra_hint, std::string const& font_hint)
599-{
600+{
601 extra_font_hint_= font_hint;
602 if (extra_text_)
603 {
604@@ -195,11 +192,13 @@
605
606 void ActionButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state)
607 {
608+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
609 Style::Instance().Button(cr, faked_state, "", -1, Alignment::CENTER, true);
610 }
611
612 void ActionButton::RedrawFocusOverlay(nux::Geometry const& geom, cairo_t* cr)
613 {
614+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
615 Style::Instance().ButtonFocusOverlay(cr, 0.20f);
616 }
617
618@@ -316,8 +315,7 @@
619
620 void ActionButton::UpdateScale(double scale)
621 {
622- SetMinimumHeight(MIN_BUTTON_HEIGHT.CP(scale));
623- SetMinimumWidth(MIN_BUTTON_WIDTH.CP(scale));
624+ InitTheme();
625
626 if (image_)
627 {
628
629=== modified file 'dash/previews/ActionLink.cpp'
630--- dash/previews/ActionLink.cpp 2013-11-19 18:48:35 +0000
631+++ dash/previews/ActionLink.cpp 2014-07-09 10:31:56 +0000
632@@ -40,12 +40,15 @@
633
634 ActionLink::ActionLink(std::string const& action_hint, std::string const& label, NUX_FILE_LINE_DECL)
635 : nux::AbstractButton(NUX_FILE_LINE_PARAM)
636+ , scale(1.0)
637 , action_hint_(action_hint)
638 , aligment_(StaticCairoText::NUX_ALIGN_CENTRE)
639 , underline_(StaticCairoText::NUX_UNDERLINE_SINGLE)
640 {
641 Init();
642 BuildLayout(label);
643+ UpdateScale(scale);
644+ scale.changed.connect(sigc::mem_fun(this, &ActionLink::UpdateScale));
645 }
646
647 std::string ActionLink::GetName() const
648@@ -109,6 +112,7 @@
649 static_text_ = new StaticCairoText(label_, true, NUX_TRACKER_LOCATION);
650 if (!font_hint_.empty())
651 static_text_->SetFont(font_hint_);
652+ static_text_->SetScale(scale);
653 static_text_->SetInputEventSensitivity(false);
654 static_text_->SetTextAlignment(aligment_);
655 static_text_->SetUnderline(underline_);
656@@ -243,5 +247,14 @@
657 return label_;
658 }
659
660+void ActionLink::UpdateScale(double scale)
661+{
662+ if (static_text_)
663+ static_text_->SetScale(scale);
664+
665+ QueueRelayout();
666+ QueueDraw();
667+}
668+
669 } // namespace dash
670 } // namespace unity
671
672=== modified file 'dash/previews/ActionLink.h'
673--- dash/previews/ActionLink.h 2013-09-19 16:44:03 +0000
674+++ dash/previews/ActionLink.h 2014-07-09 10:31:56 +0000
675@@ -47,6 +47,7 @@
676 nux::RWProperty<StaticCairoText::AlignState> text_aligment;
677 nux::RWProperty<StaticCairoText::UnderlineState> underline_state;
678 nux::RWProperty<std::string> font_hint;
679+ nux::Property<double> scale;
680
681 void Activate() {}
682 void Deactivate() {}
683@@ -90,8 +91,7 @@
684 StaticCairoText::UnderlineState underline_;
685 private:
686 typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
687-
688-
689+ void UpdateScale(double scale);
690 };
691
692 } // namespace dash
693
694=== modified file 'dash/previews/ApplicationPreview.cpp'
695--- dash/previews/ApplicationPreview.cpp 2014-06-17 18:22:33 +0000
696+++ dash/previews/ApplicationPreview.cpp 2014-07-09 10:31:56 +0000
697@@ -73,6 +73,14 @@
698
699 ApplicationPreview::ApplicationPreview(dash::Preview::Ptr preview_model)
700 : Preview(preview_model)
701+, title_subtitle_layout_(nullptr)
702+, image_data_layout_(nullptr)
703+, main_app_info_(nullptr)
704+, icon_layout_(nullptr)
705+, app_data_layout_(nullptr)
706+, app_updated_copywrite_layout_(nullptr)
707+, app_info_layout_(nullptr)
708+, actions_layout_(nullptr)
709 {
710 SetupViews();
711 }
712@@ -137,6 +145,7 @@
713 /////////////////////
714 // Image
715 image_ = new CoverArt();
716+ image_->scale = scale();
717 AddChild(image_.GetPointer());
718 UpdateCoverArtImage(image_.GetPointer());
719 /////////////////////
720@@ -145,7 +154,7 @@
721 // App Data Panel
722 full_data_layout_ = new nux::VLayout();
723 full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale));
724- full_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN);
725+ full_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN.CP(scale));
726
727 /////////////////////
728 // Main App Info
729@@ -166,6 +175,7 @@
730 if (app_preview_model->rating >= 0) {
731 app_rating_ = new PreviewRatingsWidget();
732 AddChild(app_rating_.GetPointer());
733+ app_rating_->scale = scale();
734 app_rating_->SetMaximumHeight(style.GetRatingWidgetHeight().CP(scale));
735 app_rating_->SetMinimumHeight(style.GetRatingWidgetHeight().CP(scale));
736 app_rating_->SetRating(app_preview_model->rating);
737@@ -188,6 +198,7 @@
738 title_ = new StaticCairoText(preview_model_->title, true, NUX_TRACKER_LOCATION);
739 AddChild(title_.GetPointer());
740 title_->SetLines(-1);
741+ title_->SetScale(scale);
742 title_->SetFont(style.title_font().c_str());
743 title_->mouse_click.connect(on_mouse_down);
744 title_subtitle_layout_->AddView(title_.GetPointer(), 1);
745@@ -198,6 +209,7 @@
746 AddChild(subtitle_.GetPointer());
747 subtitle_->SetFont(style.subtitle_size_font().c_str());
748 subtitle_->SetLines(-1);
749+ subtitle_->SetScale(scale);
750 subtitle_->mouse_click.connect(on_mouse_down);
751 title_subtitle_layout_->AddView(subtitle_.GetPointer(), 1);
752 }
753@@ -211,6 +223,7 @@
754 AddChild(license_.GetPointer());
755 license_->SetFont(style.app_license_font().c_str());
756 license_->SetLines(-1);
757+ license_->SetScale(scale);
758 license_->mouse_click.connect(on_mouse_down);
759 app_updated_copywrite_layout_->AddView(license_.GetPointer(), 1);
760 }
761@@ -223,6 +236,7 @@
762 last_update_ = new StaticCairoText(last_update.str(), true, NUX_TRACKER_LOCATION);
763 AddChild(last_update_.GetPointer());
764 last_update_->SetFont(style.app_last_update_font().c_str());
765+ last_update_->SetScale(scale);
766 last_update_->mouse_click.connect(on_mouse_down);
767 app_updated_copywrite_layout_->AddView(last_update_.GetPointer(), 1);
768 }
769@@ -233,6 +247,7 @@
770 AddChild(copywrite_.GetPointer());
771 copywrite_->SetFont(style.app_copywrite_font().c_str());
772 copywrite_->SetLines(-1);
773+ copywrite_->SetScale(scale);
774 copywrite_->mouse_click.connect(on_mouse_down);
775 app_updated_copywrite_layout_->AddView(copywrite_.GetPointer(), 1);
776 }
777@@ -254,7 +269,7 @@
778 app_info->mouse_click.connect(on_mouse_down);
779
780 app_info_layout_ = new nux::VLayout();
781- app_info_layout_->SetSpaceBetweenChildren(INFO_SPACE_CHILDREN);
782+ app_info_layout_->SetSpaceBetweenChildren(INFO_SPACE_CHILDREN.CP(scale));
783 app_info->SetLayout(app_info_layout_);
784
785 if (!preview_model_->description.Get().empty())
786@@ -271,7 +286,7 @@
787
788 if (!preview_model_->GetInfoHints().empty())
789 {
790- preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
791+ preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth().CP(scale));
792 AddChild(preview_info_hints_.GetPointer());
793 preview_info_hints_->request_close().connect([this]() { preview_container_->request_close.emit(); });
794 app_info_layout_->AddView(preview_info_hints_.GetPointer());
795@@ -281,15 +296,15 @@
796 /////////////////////
797 // Actions
798 action_buttons_.clear();
799- nux::Layout* actions_layout = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
800- actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin());
801+ actions_layout_ = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
802+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
803 ///////////////////
804
805 full_data_layout_->AddLayout(main_app_info_, 0);
806 full_data_layout_->AddView(app_info, 1);
807- full_data_layout_->AddLayout(actions_layout, 0);
808+ full_data_layout_->AddLayout(actions_layout_, 0);
809 /////////////////////
810-
811+
812 image_data_layout_->AddView(image_.GetPointer(), 0);
813 image_data_layout_->AddLayout(full_data_layout_, 1);
814
815@@ -306,7 +321,9 @@
816
817 nux::Geometry geo_art(geo.x, geo.y, style.GetAppImageAspectRatio() * geo.height, geo.height);
818
819- int content_width = geo.width - style.GetPanelSplitWidth().CP(scale) - style.GetDetailsLeftMargin().CP(scale) - style.GetDetailsRightMargin().CP(scale);
820+ int content_width = geo.width - style.GetPanelSplitWidth().CP(scale)
821+ - style.GetDetailsLeftMargin().CP(scale)
822+ - style.GetDetailsRightMargin().CP(scale);
823 if (content_width - geo_art.width < style.GetDetailsPanelMinimumWidth().CP(scale))
824 geo_art.width = std::max(0, content_width - style.GetDetailsPanelMinimumWidth().CP(scale));
825
826@@ -322,16 +339,19 @@
827 if (copywrite_) { copywrite_->SetMaximumWidth(top_app_info_max_width); }
828 if (description_) { description_->SetMaximumWidth(details_width); }
829
830+ int button_w = CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale));
831+ int button_h = style.GetActionButtonHeight().CP(scale);
832+
833 for (nux::AbstractButton* button : action_buttons_)
834- {
835- button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale)), style.GetActionButtonHeight().CP(scale));
836- }
837+ button->SetMinMaxSize(button_w, button_h);
838
839 Preview::PreLayoutManagement();
840 }
841
842 void ApplicationPreview::UpdateScale(double scale)
843 {
844+ Preview::UpdateScale(scale);
845+
846 previews::Style& style = dash::previews::Style::Instance();
847
848 if (app_icon_)
849@@ -351,9 +371,9 @@
850
851 if (app_rating_)
852 {
853- app_rating_->scale = scale;
854 app_rating_->SetMaximumHeight(style.GetRatingWidgetHeight().CP(scale));
855 app_rating_->SetMinimumHeight(style.GetRatingWidgetHeight().CP(scale));
856+ app_rating_->scale = scale;
857 }
858
859 if (image_data_layout_)
860@@ -374,13 +394,17 @@
861 if (app_data_layout_)
862 app_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN.CP(scale));
863
864+ if (title_subtitle_layout_)
865+ title_subtitle_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
866+
867 if (app_info_layout_)
868 app_info_layout_->SetSpaceBetweenChildren(INFO_SPACE_CHILDREN.CP(scale));
869
870+ if (actions_layout_)
871+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
872+
873 if (app_updated_copywrite_layout_)
874 app_updated_copywrite_layout_->SetSpaceBetweenChildren(COPYRIGHT_SPACE_CHILDREN.CP(scale));
875-
876- Preview::UpdateScale(scale);
877 }
878
879 } // namespace previews
880
881=== modified file 'dash/previews/GenericPreview.cpp'
882--- dash/previews/GenericPreview.cpp 2014-06-17 15:12:04 +0000
883+++ dash/previews/GenericPreview.cpp 2014-07-09 10:31:56 +0000
884@@ -64,6 +64,10 @@
885
886 GenericPreview::GenericPreview(dash::Preview::Ptr preview_model)
887 : Preview(preview_model)
888+, image_data_layout_(nullptr)
889+, preview_info_layout_(nullptr)
890+, preview_data_layout_(nullptr)
891+, actions_layout_(nullptr)
892 {
893 SetupViews();
894 UpdateScale(scale);
895@@ -237,10 +241,11 @@
896 if (subtitle_) { subtitle_->SetMaximumWidth(details_width); }
897 if (description_) { description_->SetMaximumWidth(details_width); }
898
899+ int button_w = CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale));
900+ int button_h = style.GetActionButtonHeight().CP(scale);
901+
902 for (nux::AbstractButton* button : action_buttons_)
903- {
904- button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale)), style.GetActionButtonHeight().CP(scale));
905- }
906+ button->SetMinMaxSize(button_w, button_h);
907
908 Preview::PreLayoutManagement();
909 }
910
911=== modified file 'dash/previews/MoviePreview.cpp'
912--- dash/previews/MoviePreview.cpp 2014-06-17 16:55:33 +0000
913+++ dash/previews/MoviePreview.cpp 2014-07-09 10:31:56 +0000
914@@ -65,6 +65,9 @@
915
916 MoviePreview::MoviePreview(dash::Preview::Ptr preview_model)
917 : Preview(preview_model)
918+, image_data_layout_(nullptr)
919+, preview_info_layout_(nullptr)
920+, actions_layout_(nullptr)
921 {
922 SetupViews();
923 }
924
925=== modified file 'dash/previews/MusicPaymentPreview.cpp'
926--- dash/previews/MusicPaymentPreview.cpp 2013-09-19 16:44:03 +0000
927+++ dash/previews/MusicPaymentPreview.cpp 2014-07-09 10:31:56 +0000
928@@ -49,6 +49,22 @@
929 {
930 nux::logging::Logger logger("unity.dash.previews.payment.preview.music");
931
932+const RawPixel DATA_MAX_HEIGHT = 76_em;
933+const RawPixel TITLE_CHILDREN_SPACE = 10_em;
934+const RawPixel PRIZE_CHILDREN_SPACE = 5_em;
935+const RawPixel TITLE_MAX_WIDTH = 480_em;
936+const RawPixel INTRO_MIN_HEIGHT = 50_em;
937+const RawPixel FORM_MIN_HEIGHT = 107_em;
938+const RawPixel FORM_PADDING = 20_em;
939+const RawPixel LABELS_CHILDREN_SPACE = 18_em;
940+const RawPixel PASSWORD_MIN_HEIGHT = 40_em;
941+const RawPixel PASSWORD_MIN_WIDTH = 240_em;
942+const RawPixel ACTIONS_CHILDREN_SPACE_MAX = 16_em;
943+const RawPixel ACTIONS_CHILDREN_SPACE_MIN = 8_em;
944+const RawPixel BUTTONS_SPACE = 20_em;
945+const RawPixel HEADER_CHILDREN_SPACE = 10_em;
946+const RawPixel HEADER_MAX_SIZE = 76_em;
947+const RawPixel BODY_CHILDREN_SPACE = 20_em;
948 }
949
950 // static string definitions
951@@ -77,6 +93,7 @@
952 {
953 SetupViews();
954 PaymentPreview::SetupBackground();
955+ UpdateScale(scale);
956 }
957
958 std::string MusicPaymentPreview::GetName() const
959@@ -127,6 +144,7 @@
960 || MusicPaymentPreview::FORGOT_PASSWORD_ACTION == action_id)
961 {
962 nux::ObjectPtr<ActionLink> link = this->CreateLink(action);
963+ link->scale = scale();
964 link->activate.connect(sigc::mem_fun(this,
965 &MusicPaymentPreview::OnActionLinkActivated));
966
967@@ -137,6 +155,7 @@
968 nux::ObjectPtr<ActionButton> button = this->CreateButton(action);
969 button->activate.connect(sigc::mem_fun(this,
970 &MusicPaymentPreview::OnActionActivated));
971+ button->scale = scale();
972
973 buttons_map_.insert(std::make_pair(action->id, button));
974 }
975@@ -148,8 +167,8 @@
976 {
977 previews::Style& style = dash::previews::Style::Instance();
978 nux::VLayout* title_data_layout = new nux::VLayout();
979- title_data_layout->SetMaximumHeight(76);
980- title_data_layout->SetSpaceBetweenChildren(10);
981+ title_data_layout->SetMaximumHeight(DATA_MAX_HEIGHT.CP(scale));
982+ title_data_layout->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
983
984 title_ = new StaticCairoText(
985 preview_model_->title.Get(), true,
986@@ -157,8 +176,9 @@
987
988 title_->SetFont(style.payment_title_font());
989 title_->SetLines(-1);
990+ title_->SetScale(scale);
991 title_->SetFont(style.title_font());
992- title_->SetMaximumWidth(480);
993+ title_->SetMaximumWidth(TITLE_MAX_WIDTH.CP(scale));
994 title_->SetTextEllipsize(StaticCairoText::EllipsizeState::NUX_ELLIPSIZE_END);
995 title_data_layout->AddView(title_.GetPointer(), 1);
996
997@@ -166,6 +186,7 @@
998 preview_model_->subtitle.Get(), true,
999 NUX_TRACKER_LOCATION);
1000 subtitle_->SetLines(-1);
1001+ subtitle_->SetScale(scale);
1002 subtitle_->SetFont(style.payment_subtitle_font());
1003 title_data_layout->AddView(subtitle_.GetPointer(), 1);
1004 title_data_layout->AddSpace(1, 1);
1005@@ -176,14 +197,15 @@
1006 {
1007 previews::Style& style = dash::previews::Style::Instance();
1008 nux::VLayout *prize_data_layout = new nux::VLayout();
1009- prize_data_layout->SetMaximumHeight(76);
1010- prize_data_layout->SetSpaceBetweenChildren(5);
1011- prize_data_layout->SetPadding(0, 10, 0, 0);
1012+ prize_data_layout->SetMaximumHeight(DATA_MAX_HEIGHT.CP(scale));
1013+ prize_data_layout->SetSpaceBetweenChildren(PRIZE_CHILDREN_SPACE.CP(scale));
1014+ prize_data_layout->SetPadding(0, TITLE_CHILDREN_SPACE.CP(scale), 0, 0);
1015
1016 purchase_prize_ = new StaticCairoText(
1017 payment_preview_model_->purchase_prize.Get(), true,
1018 NUX_TRACKER_LOCATION);
1019 purchase_prize_->SetLines(-1);
1020+ purchase_prize_->SetScale(scale);
1021 purchase_prize_->SetFont(style.payment_prize_title_font());
1022 prize_data_layout->AddView(purchase_prize_.GetPointer(), 1,
1023 nux::MINOR_POSITION_END);
1024@@ -192,6 +214,7 @@
1025 _("Ubuntu One best offer"),
1026 true, NUX_TRACKER_LOCATION);
1027 purchase_hint_->SetLines(-1);
1028+ purchase_hint_->SetScale(scale);
1029 purchase_hint_->SetFont(style.payment_prize_subtitle_font());
1030 prize_data_layout->AddView(purchase_hint_.GetPointer(), 1,
1031 nux::MINOR_POSITION_END);
1032@@ -200,6 +223,7 @@
1033 payment_preview_model_->purchase_type.Get(), true,
1034 NUX_TRACKER_LOCATION);
1035 purchase_type_->SetLines(-1);
1036+ purchase_type_->SetScale(scale);
1037 purchase_type_->SetFont(style.payment_prize_subtitle_font());
1038 prize_data_layout->AddView(purchase_type_.GetPointer(), 1,
1039 nux::MINOR_POSITION_END);
1040@@ -210,31 +234,30 @@
1041 {
1042 previews::Style& style = dash::previews::Style::Instance();
1043 nux::VLayout *body_layout = new nux::VLayout();
1044- body_layout->SetSpaceBetweenChildren(20);
1045+ body_layout->SetSpaceBetweenChildren(BODY_CHILDREN_SPACE.CP(scale));
1046
1047 intro_ = new StaticCairoText(
1048 payment_preview_model_->header.Get(), true,
1049 NUX_TRACKER_LOCATION);
1050 intro_->SetFont(style.payment_intro_font());
1051- intro_->SetLineSpacing(10);
1052+ intro_->SetScale(scale);
1053+ intro_->SetLineSpacing(TITLE_CHILDREN_SPACE.CP(scale));
1054 intro_->SetLines(-style.GetDescriptionLineCount());
1055- intro_->SetMinimumHeight(50);
1056+ intro_->SetMinimumHeight(INTRO_MIN_HEIGHT.CP(scale));
1057
1058 form_layout_ = new nux::HLayout();
1059- form_layout_->SetSpaceBetweenChildren(10);
1060- form_layout_->SetMinimumHeight(107);
1061- form_layout_->SetLeftAndRightPadding(20);
1062- form_layout_->SetTopAndBottomPadding(10);
1063+ form_layout_->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
1064+ form_layout_->SetMinimumHeight(FORM_MIN_HEIGHT.CP(scale));
1065+ form_layout_->SetLeftAndRightPadding(FORM_PADDING.CP(scale));
1066+ form_layout_->SetTopAndBottomPadding(TITLE_CHILDREN_SPACE.CP(scale));
1067
1068 form_layout_->AddLayout(GetFormLabels(), 1, nux::MINOR_POSITION_END);
1069 form_layout_->AddLayout(GetFormFields(), 1, nux::MINOR_POSITION_END);
1070 form_layout_->AddLayout(GetFormActions(), 1, nux::MINOR_POSITION_END);
1071
1072-
1073 body_layout->AddView(intro_.GetPointer(), 1);
1074 body_layout->AddLayout(form_layout_.GetPointer(), 1);
1075
1076-
1077 return body_layout;
1078 }
1079
1080@@ -244,17 +267,18 @@
1081 nux::VLayout *labels_layout = new nux::VLayout();
1082 if (error_message_.empty())
1083 {
1084- labels_layout->SetSpaceBetweenChildren(18);
1085+ labels_layout->SetSpaceBetweenChildren(LABELS_CHILDREN_SPACE.CP(scale));
1086 }
1087 else
1088 {
1089- labels_layout->SetSpaceBetweenChildren(10);
1090+ labels_layout->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
1091 }
1092
1093 email_label_ = new StaticCairoText(
1094 _("Ubuntu One email:"), true,
1095 NUX_TRACKER_LOCATION);
1096 email_label_->SetLines(-1);
1097+ email_label_->SetScale(scale);
1098 email_label_->SetFont(style.payment_form_labels_font());
1099 labels_layout->AddView(email_label_.GetPointer(), 0, nux::MINOR_POSITION_END);
1100
1101@@ -262,6 +286,7 @@
1102 _("Payment method:"), true,
1103 NUX_TRACKER_LOCATION);
1104 payment_label_->SetLines(-1);
1105+ payment_label_->SetScale(scale);
1106 payment_label_->SetFont(style.payment_form_labels_font());
1107 labels_layout->AddView(payment_label_.GetPointer(), 0, nux::MINOR_POSITION_END);
1108
1109@@ -269,8 +294,9 @@
1110 _("Ubuntu One password:"), true,
1111 NUX_TRACKER_LOCATION);
1112 password_label_->SetLines(-1);
1113+ password_label_->SetScale(scale);
1114 password_label_->SetFont(style.payment_form_labels_font());
1115- password_label_->SetMinimumHeight(40);
1116+ password_label_->SetMinimumHeight(PASSWORD_MIN_HEIGHT.CP(scale));
1117 labels_layout->AddView(password_label_.GetPointer(), 0, nux::MINOR_POSITION_END);
1118
1119 return labels_layout;
1120@@ -282,17 +308,18 @@
1121 nux::VLayout *fields_layout = new nux::VLayout();
1122 if (error_message_.empty())
1123 {
1124- fields_layout->SetSpaceBetweenChildren(18);
1125+ fields_layout->SetSpaceBetweenChildren(LABELS_CHILDREN_SPACE.CP(scale));
1126 }
1127 else
1128 {
1129- fields_layout->SetSpaceBetweenChildren(10);
1130+ fields_layout->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
1131 }
1132
1133 email_ = new StaticCairoText(
1134 payment_preview_model_->email.Get(), true,
1135 NUX_TRACKER_LOCATION);
1136 email_->SetLines(-1);
1137+ email_->SetScale(scale);
1138 email_->SetFont(style.payment_form_data_font());
1139 fields_layout->AddView(email_.GetPointer(), 1,
1140 nux::MINOR_POSITION_START);
1141@@ -301,13 +328,14 @@
1142 payment_preview_model_->payment_method.Get(), true,
1143 NUX_TRACKER_LOCATION);
1144 payment_->SetLines(-1);
1145+ payment_->SetScale(scale);
1146 payment_->SetFont(style.payment_form_data_font());
1147 fields_layout->AddView(payment_.GetPointer(), 1,
1148 nux::MINOR_POSITION_START);
1149
1150 password_entry_ = new TextInput();
1151- password_entry_->SetMinimumHeight(40);
1152- password_entry_->SetMinimumWidth(240);
1153+ password_entry_->SetMinimumHeight(PASSWORD_MIN_HEIGHT.CP(scale));
1154+ password_entry_->SetMinimumWidth(PASSWORD_MIN_WIDTH.CP(scale));
1155 password_entry_->input_hint = _("Password");
1156
1157 fields_layout->AddView(password_entry_.GetPointer(),
1158@@ -322,6 +350,7 @@
1159 StaticCairoText* error = new StaticCairoText(
1160 _("Wrong password"), true, NUX_TRACKER_LOCATION);
1161 error->SetLines(-1);
1162+ error->SetScale(scale);
1163 error->SetFont(style.payment_form_data_font());
1164 // ensure it is an error using red
1165 error->SetTextColor(style.payment_error_color());
1166@@ -337,11 +366,11 @@
1167 nux::VLayout *actions_layout = new nux::VLayout();
1168 if (error_message_.empty())
1169 {
1170- actions_layout->SetSpaceBetweenChildren(16);
1171+ actions_layout->SetSpaceBetweenChildren(ACTIONS_CHILDREN_SPACE_MAX.CP(scale));
1172 }
1173 else
1174 {
1175- actions_layout->SetSpaceBetweenChildren(8);
1176+ actions_layout->SetSpaceBetweenChildren(ACTIONS_CHILDREN_SPACE_MIN.CP(scale));
1177 }
1178
1179 nux::ObjectPtr<StaticCairoText> empty_;
1180@@ -349,6 +378,7 @@
1181 "", true,
1182 NUX_TRACKER_LOCATION);
1183 empty_->SetLines(-1);
1184+ empty_->SetScale(scale);
1185 empty_->SetFont(style.payment_form_labels_font());
1186 actions_layout->AddView(empty_.GetPointer(), 1,
1187 nux::MINOR_POSITION_START);
1188@@ -374,14 +404,14 @@
1189 actions_buffer_h->AddSpace(0, 1);
1190
1191 nux::HLayout* buttons_data_layout = new nux::HLayout();
1192- buttons_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenActions());
1193+ buttons_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenActions().CP(scale));
1194
1195- lock_texture_ = new IconTexture(style.GetLockIcon(), style.GetPaymentLockWidth(),
1196- style.GetPaymentLockHeight());
1197+ lock_texture_ = new IconTexture(style.GetLockIcon(), style.GetPaymentLockWidth().CP(scale),
1198+ style.GetPaymentLockHeight().CP(scale));
1199 buttons_data_layout->AddView(lock_texture_.GetPointer(), 0, nux::MINOR_POSITION_CENTER,
1200 nux::MINOR_SIZE_FULL, 100.0f, nux::NUX_LAYOUT_BEGIN);
1201
1202- buttons_data_layout->AddSpace(20, 1);
1203+ buttons_data_layout->AddSpace(BUTTONS_SPACE.CP(scale), 1);
1204 if(buttons_map_[MusicPaymentPreview::CANCEL_PURCHASE_ACTION].GetPointer())
1205 buttons_data_layout->AddView(buttons_map_[MusicPaymentPreview::CANCEL_PURCHASE_ACTION].GetPointer(),
1206 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL, 100.0f,
1207@@ -413,7 +443,8 @@
1208
1209 previews::Style& style = dash::previews::Style::Instance();
1210
1211- int width = std::max<int>(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin());
1212+ int content_width = geo.width - style.GetPanelSplitWidth().CP(scale) - style.GetDetailsLeftMargin().CP(scale) - style.GetDetailsRightMargin().CP(scale);
1213+ int width = std::max<int>(0, content_width);
1214
1215 if(full_data_layout_) { full_data_layout_->SetMaximumWidth(width); }
1216 if(header_layout_) { header_layout_->SetMaximumWidth(width); }
1217@@ -460,6 +491,49 @@
1218 PaymentPreview::SetupViews();
1219 }
1220
1221+void MusicPaymentPreview::UpdateScale(double scale)
1222+{
1223+ PaymentPreview::UpdateScale(scale);
1224+
1225+ if (intro_)
1226+ intro_->SetScale(scale);
1227+ if (email_label_)
1228+ email_label_->SetScale(scale);
1229+ if (payment_label_)
1230+ payment_label_->SetScale(scale);
1231+ if (payment_)
1232+ payment_->SetScale(scale);
1233+ if (password_label_)
1234+ password_label_->SetScale(scale);
1235+ if (purchase_hint_)
1236+ purchase_hint_->SetScale(scale);
1237+ if (purchase_prize_)
1238+ purchase_prize_->SetScale(scale);
1239+ if (purchase_type_)
1240+ purchase_type_->SetScale(scale);
1241+ if (change_payment_)
1242+ change_payment_->SetScale(scale);
1243+ if (error_label_)
1244+ error_label_->SetScale(scale);
1245+
1246+ previews::Style& style = dash::previews::Style::Instance();
1247+ if (lock_texture_)
1248+ lock_texture_->SetSize(std::max(style.GetPaymentLockWidth().CP(scale), style.GetPaymentLockHeight().CP(scale)));
1249+
1250+ if (password_entry_)
1251+ {
1252+ password_entry_->SetMinimumHeight(PASSWORD_MIN_HEIGHT.CP(scale));
1253+ password_entry_->SetMinimumWidth(PASSWORD_MIN_WIDTH.CP(scale));
1254+ }
1255+
1256+ if (form_layout_)
1257+ {
1258+ form_layout_->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
1259+ form_layout_->SetMinimumHeight(FORM_MIN_HEIGHT.CP(scale));
1260+ form_layout_->SetLeftAndRightPadding(FORM_PADDING.CP(scale));
1261+ form_layout_->SetTopAndBottomPadding(TITLE_CHILDREN_SPACE.CP(scale));
1262+ }
1263+}
1264
1265 }
1266 }
1267
1268=== modified file 'dash/previews/MusicPaymentPreview.h'
1269--- dash/previews/MusicPaymentPreview.h 2013-09-19 16:44:03 +0000
1270+++ dash/previews/MusicPaymentPreview.h 2014-07-09 10:31:56 +0000
1271@@ -90,6 +90,7 @@
1272 void OnActionLinkActivated(ActionLink* link, std::string const& id);
1273
1274 virtual void SetupViews();
1275+ virtual void UpdateScale(double scale) override;
1276
1277 void PreLayoutManagement();
1278
1279
1280=== modified file 'dash/previews/MusicPreview.cpp'
1281--- dash/previews/MusicPreview.cpp 2014-06-13 08:29:44 +0000
1282+++ dash/previews/MusicPreview.cpp 2014-07-09 10:31:56 +0000
1283@@ -42,14 +42,27 @@
1284 {
1285 namespace previews
1286 {
1287+
1288+namespace
1289+{
1290+ const RawPixel CHILDREN_SPACE = 16_em;
1291+ const RawPixel ICON_LEFT_RIGHT_PADDING = 10_em;
1292+ const RawPixel WARNING_MIN_HEIGHT = 50_em;
1293+ const RawPixel WARNING_MAX_WIDTH = 300_em;
1294+}
1295+
1296 DECLARE_LOGGER(logger, "unity.dash.preview.music");
1297
1298 NUX_IMPLEMENT_OBJECT_TYPE(MusicPreview);
1299
1300 MusicPreview::MusicPreview(dash::Preview::Ptr preview_model)
1301 : Preview(preview_model)
1302+, actions_layout_(nullptr)
1303+, image_data_layout_(nullptr)
1304+, icon_layout_(nullptr)
1305 {
1306 SetupViews();
1307+ UpdateScale(scale);
1308 }
1309
1310 MusicPreview::~MusicPreview()
1311@@ -130,13 +143,13 @@
1312
1313 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); };
1314
1315- nux::HLayout* image_data_layout = new nux::HLayout();
1316- image_data_layout->SetSpaceBetweenChildren(style.GetPanelSplitWidth());
1317+ image_data_layout_ = new nux::HLayout();
1318+ image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale));
1319
1320 /////////////////////
1321 // Image
1322 image_ = new CoverArt();
1323-
1324+ image_->scale = scale();
1325 AddChild(image_.GetPointer());
1326 UpdateCoverArtImage(image_.GetPointer());
1327 /////////////////////
1328@@ -144,20 +157,21 @@
1329 /////////////////////
1330 // App Data Panel
1331 full_data_layout_ = new nux::VLayout();
1332- full_data_layout_->SetPadding(style.GetDetailsTopMargin(), 0, style.GetDetailsBottomMargin(), style.GetDetailsLeftMargin());
1333- full_data_layout_->SetSpaceBetweenChildren(16);
1334+ full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale));
1335+ full_data_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
1336
1337 /////////////////////
1338 // Music Info
1339- nux::VLayout* album_data_layout = new nux::VLayout();
1340- album_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle());
1341+ album_data_layout_ = new nux::VLayout();
1342+ album_data_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
1343
1344 title_ = new StaticCairoText(preview_model_->title, true, NUX_TRACKER_LOCATION);
1345 AddChild(title_.GetPointer());
1346 title_->SetFont(style.title_font().c_str());
1347 title_->SetLines(-1);
1348+ title_->SetScale(scale);
1349 title_->mouse_click.connect(on_mouse_down);
1350- album_data_layout->AddView(title_.GetPointer(), 1);
1351+ album_data_layout_->AddView(title_.GetPointer(), 1);
1352
1353 if (!preview_model_->subtitle.Get().empty())
1354 {
1355@@ -165,8 +179,9 @@
1356 AddChild(subtitle_.GetPointer());
1357 subtitle_->SetFont(style.subtitle_size_font().c_str());
1358 subtitle_->SetLines(-1);
1359+ subtitle_->SetScale(scale);
1360 subtitle_->mouse_click.connect(on_mouse_down);
1361- album_data_layout->AddView(subtitle_.GetPointer(), 1);
1362+ album_data_layout_->AddView(subtitle_.GetPointer(), 1);
1363 }
1364
1365 /////////////////////
1366@@ -177,6 +192,7 @@
1367 if (tracks_model)
1368 {
1369 tracks_ = new previews::Tracks(tracks_model, NUX_TRACKER_LOCATION);
1370+ tracks_->scale = scale();
1371 AddChild(tracks_.GetPointer());
1372 tracks_->mouse_click.connect(on_mouse_down);
1373 }
1374@@ -187,7 +203,7 @@
1375 /////////////////////
1376 // Hints && Actions
1377 nux::VLayout* hints_layout = NULL;
1378- nux::Layout* actions_layout = NULL;
1379+ actions_layout_ = NULL;
1380 bool has_u1_creds = HasUbuntuOneCredentials();
1381
1382 if (has_u1_creds)
1383@@ -197,70 +213,72 @@
1384 hints_layout = new nux::VLayout();
1385 hints_layout->SetSpaceBetweenChildren(0);
1386 hints_layout->AddSpace(0, 1);
1387- preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
1388+ preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth().CP(scale));
1389+ preview_info_hints_->scale = scale();
1390 AddChild(preview_info_hints_.GetPointer());
1391 preview_info_hints_->request_close().connect([this]() { preview_container_->request_close.emit(); });
1392 hints_layout->AddView(preview_info_hints_.GetPointer(), 0);
1393
1394 // If there are actions, we use a vertical layout
1395 action_buttons_.clear();
1396- actions_layout = BuildVerticalActionsLayout(preview_model_->GetActions(), action_buttons_);
1397- actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin());
1398+ actions_layout_ = BuildVerticalActionsLayout(preview_model_->GetActions(), action_buttons_);
1399+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
1400 }
1401 else // otherwise we add a grid layout.
1402 {
1403 action_buttons_.clear();
1404- actions_layout = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
1405+ actions_layout_ = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
1406 if (action_buttons_.size() < 2)
1407 hint_actions_layout->AddSpace(0, 1);
1408- actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin());
1409+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
1410 }
1411 }
1412 else
1413 {
1414 // let the user know he needs to connect
1415 previews::Style& style = dash::previews::Style::Instance();
1416- actions_layout = new nux::HLayout();
1417- nux::VLayout* icon_layout = new nux::VLayout();
1418- icon_layout->SetLeftAndRightPadding(10);
1419+ nux::HLayout* actions_layout = new nux::HLayout();
1420+ icon_layout_ = new nux::VLayout();
1421+ icon_layout_->SetLeftAndRightPadding(ICON_LEFT_RIGHT_PADDING.CP(scale));
1422
1423 warning_texture_ = new IconTexture(style.GetWarningIcon());
1424- icon_layout->AddView(warning_texture_.GetPointer(), 0, nux::MINOR_POSITION_START,
1425+ icon_layout_->AddView(warning_texture_.GetPointer(), 0, nux::MINOR_POSITION_START,
1426 nux::MINOR_SIZE_FULL, 100.0f, nux::NUX_LAYOUT_BEGIN);
1427- actions_layout->AddLayout(icon_layout, 0, nux::MINOR_POSITION_CENTER);
1428+ actions_layout->AddLayout(icon_layout_, 0, nux::MINOR_POSITION_CENTER);
1429
1430 warning_msg_ = new StaticCairoText(
1431 no_credentials_message_, true,
1432 NUX_TRACKER_LOCATION);
1433- AddChild(warning_msg_.GetPointer());
1434+ AddChild(warning_msg_.GetPointer());
1435 warning_msg_->SetFont(style.u1_warning_font().c_str());
1436 warning_msg_->SetLines(-2);
1437- warning_msg_->SetMinimumHeight(50);
1438- warning_msg_->SetMaximumWidth(300);
1439+ warning_msg_->SetScale(scale);
1440+ warning_msg_->SetMinimumHeight(WARNING_MIN_HEIGHT.CP(scale));
1441+ warning_msg_->SetMaximumWidth(WARNING_MAX_WIDTH.CP(scale));
1442
1443 actions_layout->AddView(warning_msg_.GetPointer(), 0, nux::MINOR_POSITION_CENTER);
1444
1445 }
1446-
1447+
1448 /////////////////////
1449
1450 if (hints_layout) hint_actions_layout->AddView(hints_layout, 1);
1451- hint_actions_layout->AddView(actions_layout, 0);
1452+ hint_actions_layout->AddView(actions_layout_, 0);
1453
1454- full_data_layout_->AddLayout(album_data_layout, 0);
1455+ full_data_layout_->AddLayout(album_data_layout_, 0);
1456 if (tracks_)
1457 {
1458 full_data_layout_->AddView(tracks_.GetPointer(), 1);
1459 }
1460 full_data_layout_->AddLayout(hint_actions_layout, 0);
1461 /////////////////////
1462-
1463- image_data_layout->AddView(image_.GetPointer(), 0);
1464- image_data_layout->AddLayout(full_data_layout_, 1);
1465+
1466+ image_data_layout_->AddView(image_.GetPointer(), 0);
1467+ image_data_layout_->AddLayout(full_data_layout_, 1);
1468
1469 mouse_click.connect(on_mouse_down);
1470
1471- SetLayout(image_data_layout);
1472+ SetLayout(image_data_layout_);
1473 }
1474
1475 void MusicPreview::PreLayoutManagement()
1476@@ -272,23 +290,23 @@
1477
1478 nux::Geometry geo_art(geo.x, geo.y, style.GetAppImageAspectRatio() * geo.height, geo.height);
1479
1480- if (geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() < style.GetDetailsPanelMinimumWidth())
1481- geo_art.width = MAX(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() - style.GetDetailsPanelMinimumWidth());
1482+ int content_width = geo.width - style.GetPanelSplitWidth().CP(scale) - style.GetDetailsLeftMargin().CP(scale) - style.GetDetailsRightMargin().CP(scale);
1483+ if (content_width - geo_art.width < style.GetDetailsPanelMinimumWidth().CP(scale))
1484+ geo_art.width = MAX(0, content_width - style.GetDetailsPanelMinimumWidth().CP(scale));
1485 image_->SetMinMaxSize(geo_art.width, geo_art.height);
1486
1487- int details_width = MAX(0, geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin());
1488+ int details_width = MAX(0, content_width - geo_art.width);
1489
1490 if (title_) { title_->SetMaximumWidth(details_width); }
1491 if (subtitle_) { subtitle_->SetMaximumWidth(details_width); }
1492
1493 for (nux::AbstractButton* button : action_buttons_)
1494 {
1495- int action_width = CLAMP(RawPixel((details_width - style.GetSpaceBetweenActions()) /
1496- 2), 0_em, style.GetActionButtonMaximumWidth());
1497+ int action_width = CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale));
1498 // do not use SetMinMax because width has to be able to grow
1499 button->SetMinimumWidth(action_width);
1500- button->SetMinimumHeight(style.GetActionButtonHeight());
1501- button->SetMaximumHeight(style.GetActionButtonHeight());
1502+ button->SetMinimumHeight(style.GetActionButtonHeight().CP(scale));
1503+ button->SetMaximumHeight(style.GetActionButtonHeight().CP(scale));
1504 }
1505
1506 Preview::PreLayoutManagement();
1507@@ -300,6 +318,47 @@
1508 player.Stop();
1509 }
1510
1511+void MusicPreview::UpdateScale(double scale)
1512+{
1513+ Preview::UpdateScale(scale);
1514+
1515+ if (tracks_)
1516+ tracks_->scale = scale;
1517+
1518+ if (preview_info_hints_)
1519+ preview_info_hints_->scale = scale;
1520+
1521+ if (icon_layout_)
1522+ icon_layout_->SetLeftAndRightPadding(ICON_LEFT_RIGHT_PADDING.CP(scale));
1523+
1524+ if (warning_msg_)
1525+ {
1526+ warning_msg_->SetScale(scale);
1527+ warning_msg_->SetMinimumHeight(WARNING_MIN_HEIGHT.CP(scale));
1528+ warning_msg_->SetMaximumWidth(WARNING_MAX_WIDTH.CP(scale));
1529+ }
1530+
1531+ previews::Style& style = dash::previews::Style::Instance();
1532+
1533+ if (image_data_layout_)
1534+ image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale));
1535+
1536+ if (full_data_layout_)
1537+ {
1538+ full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale));
1539+ full_data_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
1540+ }
1541+
1542+ if (album_data_layout_)
1543+ album_data_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
1544+
1545+ if (actions_layout_)
1546+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
1547+
1548+ if (icon_layout_)
1549+ icon_layout_->SetLeftAndRightPadding(ICON_LEFT_RIGHT_PADDING.CP(scale));
1550+}
1551+
1552 } // namespace previews
1553 } // namespace dash
1554 } // namespace unity
1555
1556=== modified file 'dash/previews/MusicPreview.h'
1557--- dash/previews/MusicPreview.h 2013-09-19 16:44:03 +0000
1558+++ dash/previews/MusicPreview.h 2014-07-09 10:31:56 +0000
1559@@ -53,6 +53,7 @@
1560 virtual void PreLayoutManagement();
1561
1562 virtual void SetupViews();
1563+ virtual void UpdateScale(double scale);
1564
1565 virtual void OnNavigateOut();
1566
1567@@ -64,6 +65,10 @@
1568 nux::ObjectPtr<IconTexture> warning_texture_;
1569 std::string no_credentials_message_;
1570
1571+ nux::Layout* actions_layout_;
1572+ nux::HLayout* image_data_layout_;
1573+ nux::VLayout* icon_layout_;
1574+ nux::VLayout* album_data_layout_;
1575 };
1576
1577 }
1578
1579=== modified file 'dash/previews/PaymentPreview.cpp'
1580--- dash/previews/PaymentPreview.cpp 2013-09-19 16:44:03 +0000
1581+++ dash/previews/PaymentPreview.cpp 2014-07-09 10:31:56 +0000
1582@@ -39,6 +39,15 @@
1583
1584 nux::logging::Logger logger("unity.dash.previews.payment.preview");
1585
1586+const RawPixel CONTENT_DATA_CHILDREN_SPACE = 5_em;
1587+const RawPixel CONTENT_DATA_PADDING = 10_em;
1588+const RawPixel OVERLAY_LAYOUT_SPACE = 20_em;
1589+const RawPixel HEADER_CHILDREN_SPACE = 10_em;
1590+const RawPixel HEADER_MAX_SIZE = 76_em;
1591+const RawPixel IMAGE_MIN_MAX_SIZE = 64_em;
1592+const RawPixel HEADER_SPACE = 10_em;
1593+const RawPixel LINK_MIN_WIDTH = 178_em;
1594+const RawPixel LINK_MAX_HEIGHT = 34_em;
1595 }
1596
1597 class OverlaySpinner : public unity::debug::Introspectable, public nux::View
1598@@ -183,8 +192,12 @@
1599 : Preview(preview_model)
1600 , data_(nullptr)
1601 , full_data_layout_(nullptr)
1602-{
1603-}
1604+, content_data_layout_(nullptr)
1605+, overlay_layout_(nullptr)
1606+, header_layout_(nullptr)
1607+, body_layout_(nullptr)
1608+, footer_layout_(nullptr)
1609+{}
1610
1611 std::string PaymentPreview::GetName() const
1612 {
1613@@ -199,18 +212,18 @@
1614 nux::Layout* PaymentPreview::GetHeader()
1615 {
1616 nux::HLayout* header_data_layout = new nux::HLayout();
1617- header_data_layout->SetSpaceBetweenChildren(10);
1618- header_data_layout->SetMaximumHeight(76);
1619- header_data_layout->SetMinimumHeight(76);
1620+ header_data_layout->SetSpaceBetweenChildren(HEADER_CHILDREN_SPACE.CP(scale));
1621+ header_data_layout->SetMaximumHeight(HEADER_MAX_SIZE.CP(scale));
1622+ header_data_layout->SetMinimumHeight(HEADER_MAX_SIZE.CP(scale));
1623
1624 image_ = new CoverArt();
1625- image_->SetMinMaxSize(64, 64);
1626+ image_->SetMinMaxSize(IMAGE_MIN_MAX_SIZE.CP(scale), IMAGE_MIN_MAX_SIZE.CP(scale));
1627 AddChild(image_.GetPointer());
1628 UpdateCoverArtImage(image_.GetPointer());
1629
1630 header_data_layout->AddView(image_.GetPointer(), 0);
1631 header_data_layout->AddLayout(GetTitle(), 0);
1632- header_data_layout->AddSpace(10, 1);
1633+ header_data_layout->AddSpace(HEADER_SPACE.CP(scale), 1);
1634 header_data_layout->AddLayout(GetPrice(), 0);
1635 return header_data_layout;
1636 }
1637@@ -223,8 +236,8 @@
1638 link = new ActionLink(action->id,
1639 action->display_name, NUX_TRACKER_LOCATION);
1640 link->font_hint.Set(style.payment_form_labels_font().c_str());
1641- link->SetMinimumWidth(178);
1642- link->SetMaximumHeight(34);
1643+ link->SetMinimumWidth(LINK_MIN_WIDTH.CP(scale));
1644+ link->SetMaximumHeight(LINK_MAX_HEIGHT.CP(scale));
1645 return link;
1646 }
1647
1648@@ -239,8 +252,8 @@
1649 NUX_TRACKER_LOCATION);
1650 button->SetFont(style.action_font());
1651 button->SetExtraHint(action->extra_text, style.action_extra_font());
1652- button->SetMinimumWidth(178);
1653- button->SetMaximumHeight(34);
1654+ button->SetMinimumWidth(LINK_MIN_WIDTH.CP(scale));
1655+ button->SetMaximumHeight(LINK_MAX_HEIGHT.CP(scale));
1656 return button;
1657 }
1658
1659@@ -327,8 +340,8 @@
1660
1661 // layout to be used to show the info
1662 content_data_layout_ = new nux::VLayout();
1663- content_data_layout_->SetSpaceBetweenChildren(5);
1664- content_data_layout_->SetPadding(10, 10, 0, 10);
1665+ content_data_layout_->SetSpaceBetweenChildren(CONTENT_DATA_CHILDREN_SPACE.CP(scale));
1666+ content_data_layout_->SetPadding(CONTENT_DATA_PADDING.CP(scale), CONTENT_DATA_PADDING.CP(scale), 0, CONTENT_DATA_PADDING.CP(scale));
1667
1668 header_layout_ = GetHeader();
1669
1670@@ -344,21 +357,36 @@
1671
1672 // layout to draw an overlay
1673 overlay_layout_ = new nux::VLayout();
1674- StaticCairoText* calculating = new StaticCairoText(
1675+ calculating_ = new StaticCairoText(
1676 "Performing purchase", true,
1677 NUX_TRACKER_LOCATION);
1678
1679 OverlaySpinner* spinner_ = new OverlaySpinner();
1680- overlay_layout_->AddSpace(20, 1);
1681- overlay_layout_->AddView(calculating, 0, nux::MINOR_POSITION_CENTER);
1682+ overlay_layout_->AddSpace(OVERLAY_LAYOUT_SPACE.CP(scale), 1);
1683+ overlay_layout_->AddView(calculating_, 0, nux::MINOR_POSITION_CENTER);
1684 overlay_layout_->AddView(spinner_, 1, nux::MINOR_POSITION_CENTER);
1685- overlay_layout_->AddSpace(20, 1);
1686+ overlay_layout_->AddSpace(OVERLAY_LAYOUT_SPACE.CP(scale), 1);
1687
1688 full_data_layout_->AddLayout(overlay_layout_.GetPointer());
1689
1690+ UpdateScale(scale);
1691 SetLayout(full_data_layout_.GetPointer());
1692 }
1693
1694+void PaymentPreview::UpdateScale(double scale)
1695+{
1696+ Preview::UpdateScale(scale);
1697+
1698+ if (calculating_)
1699+ calculating_->SetScale(scale);
1700+
1701+ if (content_data_layout_)
1702+ {
1703+ content_data_layout_->SetSpaceBetweenChildren(CONTENT_DATA_CHILDREN_SPACE.CP(scale));
1704+ content_data_layout_->SetPadding(CONTENT_DATA_PADDING.CP(scale), CONTENT_DATA_PADDING.CP(scale), 0, CONTENT_DATA_PADDING.CP(scale));
1705+ }
1706+}
1707+
1708 }
1709
1710 }
1711
1712=== modified file 'dash/previews/PaymentPreview.h'
1713--- dash/previews/PaymentPreview.h 2013-09-19 16:44:03 +0000
1714+++ dash/previews/PaymentPreview.h 2014-07-09 10:31:56 +0000
1715@@ -106,6 +106,7 @@
1716
1717 virtual void LoadActions() = 0;
1718 virtual void SetupViews();
1719+ virtual void UpdateScale(double scale) override;
1720 virtual void SetupBackground();
1721
1722 nux::ObjectPtr<nux::LayeredLayout> full_data_layout_;
1723@@ -115,6 +116,8 @@
1724 nux::ObjectPtr<nux::Layout> body_layout_;
1725 nux::ObjectPtr<nux::Layout> footer_layout_;
1726
1727+ StaticCairoText* calculating_;
1728+
1729 // content elements
1730 nux::ObjectPtr<CoverArt> image_;
1731
1732
1733=== modified file 'dash/previews/Preview.cpp'
1734--- dash/previews/Preview.cpp 2014-06-13 15:04:19 +0000
1735+++ dash/previews/Preview.cpp 2014-07-09 10:31:56 +0000
1736@@ -101,7 +101,7 @@
1737
1738 Preview::Preview(dash::Preview::Ptr preview_model)
1739 : View(NUX_TRACKER_LOCATION)
1740- , scale(1.0)
1741+ , scale(1.0f)
1742 , preview_model_(preview_model)
1743 , tab_iterator_(new TabIterator())
1744 , full_data_layout_(nullptr)
1745@@ -110,7 +110,6 @@
1746 , subtitle_(nullptr)
1747 , preview_container_(new PreviewContainer)
1748 {
1749- preview_container_->scale = scale();
1750 scale.changed.connect(sigc::mem_fun(this, &Preview::UpdateScale));
1751 }
1752
1753@@ -303,9 +302,11 @@
1754
1755 for (nux::AbstractButton* button : action_buttons_)
1756 {
1757- ActionButton* bn = dynamic_cast<ActionButton*>(button);
1758- if (bn)
1759+ if (ActionButton* bn = dynamic_cast<ActionButton*>(button))
1760 bn->scale = scale;
1761+
1762+ if (ActionLink* link = dynamic_cast<ActionLink*>(button))
1763+ link->scale = scale;
1764 }
1765
1766 QueueRelayout();
1767
1768=== modified file 'dash/previews/PreviewContainer.cpp'
1769--- dash/previews/PreviewContainer.cpp 2014-06-16 06:43:37 +0000
1770+++ dash/previews/PreviewContainer.cpp 2014-07-09 10:31:56 +0000
1771@@ -23,7 +23,6 @@
1772 #include "PreviewContainer.h"
1773 #include <NuxCore/Logger.h>
1774 #include <Nux/HLayout.h>
1775-#include <Nux/VLayout.h>
1776
1777 #include "unity-shared/IntrospectableWrappers.h"
1778 #include "unity-shared/TimeUtil.h"
1779@@ -77,20 +76,19 @@
1780 // Need to update the preview geometries when updating the container geo.
1781 UpdateAnimationProgress(progress_, curve_progress_);
1782 });
1783- Style& style = previews::Style::Instance();
1784-
1785- spin_= style.GetSearchSpinIcon(SPIN_ICON_SIZE);
1786-
1787+
1788+ spin_ = Style::Instance().GetSearchSpinIcon(SPIN_ICON_SIZE.CP(scale));
1789 scale.changed.connect(sigc::mem_fun(this, &PreviewContent::UpdateScale));
1790 }
1791
1792 void UpdateScale(double scale)
1793 {
1794- Style& style = previews::Style::Instance();
1795- spin_ = style.GetSearchSpinIcon(SPIN_ICON_SIZE.CP(scale));
1796+ spin_ = Style::Instance().GetSearchSpinIcon(SPIN_ICON_SIZE.CP(scale));
1797
1798 for (auto* area : GetChildren())
1799 static_cast<previews::Preview*>(area)->scale = scale;
1800+
1801+ QueueDraw();
1802 }
1803
1804 // From debug::Introspectable
1805@@ -436,13 +434,12 @@
1806 void PreviewContainer::Preview(dash::Preview::Ptr preview_model, Navigation direction)
1807 {
1808 previews::Preview::Ptr preview_view = preview_model ? previews::Preview::PreviewForModel(preview_model) : previews::Preview::Ptr();
1809-
1810+
1811 if (preview_view)
1812 {
1813 preview_view->request_close().connect([this]() { request_close.emit(); });
1814+ preview_layout_->PushPreview(preview_view, direction);
1815 }
1816-
1817- preview_layout_->PushPreview(preview_view, direction);
1818 }
1819
1820 void PreviewContainer::DisableNavButton(Navigation button)
1821@@ -477,29 +474,32 @@
1822
1823 nux::VLayout* layout = new nux::VLayout();
1824 SetLayout(layout);
1825- layout->AddLayout(new nux::SpaceLayout(0,0,style.GetPreviewTopPadding(),style.GetPreviewTopPadding()));
1826+
1827+ layout->SetTopAndBottomPadding(style.GetPreviewTopPadding().CP(scale), 0);
1828
1829 layout_content_ = new nux::HLayout();
1830- layout_content_->SetSpaceBetweenChildren(CHILDREN_SPACE);
1831+ layout_content_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
1832 layout->AddLayout(layout_content_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
1833
1834 layout_content_->AddSpace(0, 1);
1835 nav_left_ = new PreviewNavigator(Orientation::LEFT, NUX_TRACKER_LOCATION);
1836 AddChild(nav_left_);
1837- nav_left_->SetMinimumWidth(style.GetNavigatorWidth());
1838- nav_left_->SetMaximumWidth(style.GetNavigatorWidth());
1839+ nav_left_->scale = scale();
1840+ nav_left_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
1841+ nav_left_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
1842 nav_left_->activated.connect([this]() { navigate_left.emit(); });
1843 layout_content_->AddView(nav_left_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
1844
1845 preview_layout_ = new PreviewContent(this);
1846- preview_layout_->SetMinMaxSize(style.GetPreviewWidth(), style.GetPreviewHeight());
1847+ preview_layout_->SetMinMaxSize(style.GetPreviewWidth().CP(scale), style.GetPreviewHeight().CP(scale));
1848 AddChild(preview_layout_);
1849 layout_content_->AddLayout(preview_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
1850
1851 nav_right_ = new PreviewNavigator(Orientation::RIGHT, NUX_TRACKER_LOCATION);
1852 AddChild(nav_right_);
1853- nav_right_->SetMinimumWidth(style.GetNavigatorWidth());
1854- nav_right_->SetMaximumWidth(style.GetNavigatorWidth());
1855+ nav_right_->scale = scale();
1856+ nav_right_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
1857+ nav_right_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
1858 nav_right_->activated.connect([this]() { navigate_right.emit(); });
1859 layout_content_->AddView(nav_right_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
1860 layout_content_->AddSpace(0, 1);
1861@@ -511,7 +511,7 @@
1862 // reset animation clock.
1863 if (navigation_count_ == 0)
1864 clock_gettime(CLOCK_MONOTONIC, &last_progress_time_);
1865-
1866+
1867 float navigation_progress_remaining = CLAMP((1.0 - preview_layout_->GetAnimationProgress()) + navigation_count_, 1.0f, 10.0f);
1868 navigation_count_++;
1869
1870@@ -553,7 +553,7 @@
1871 gfx_engine.GetRenderStates().SetBlend(false);
1872 gfx_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
1873 }
1874-
1875+
1876 // rely on the compiz event loop to come back to us in a nice throttling
1877 if (AnimationInProgress())
1878 {
1879@@ -614,11 +614,12 @@
1880 bool PreviewContainer::QueueAnimation()
1881 {
1882 animation_timer_.reset();
1883-
1884+
1885 timespec current;
1886 clock_gettime(CLOCK_MONOTONIC, &current);
1887 float progress = GetSwipeAnimationProgress(current);
1888- preview_layout_->UpdateAnimationProgress(progress, easeInOutQuart(progress)); // ease in/out.
1889+ if (preview_layout_)
1890+ preview_layout_->UpdateAnimationProgress(progress, easeInOutQuart(progress)); // ease in/out.
1891 last_progress_time_ = current;
1892
1893 QueueDraw();
1894@@ -710,33 +711,30 @@
1895
1896 nux::Geometry PreviewContainer::GetLayoutGeometry() const
1897 {
1898- return layout_content_->GetAbsoluteGeometry();
1899+ return layout_content_->GetAbsoluteGeometry();
1900 }
1901
1902 void PreviewContainer::UpdateScale(double scale)
1903 {
1904 previews::Style& style = previews::Style::Instance();
1905
1906- if (preview_layout_)
1907- {
1908- preview_layout_->scale = scale;
1909- preview_layout_->SetMinMaxSize(style.GetPreviewWidth().CP(scale), style.GetPreviewHeight().CP(scale));
1910- }
1911-
1912- if (layout_content_)
1913- layout_content_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
1914-
1915- if (nav_left_)
1916- {
1917- nav_left_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
1918- nav_left_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
1919- }
1920-
1921- if (nav_right_)
1922- {
1923- nav_right_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
1924- nav_right_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
1925- }
1926+ GetLayout()->SetTopAndBottomPadding(style.GetPreviewTopPadding().CP(scale), 0);
1927+
1928+ preview_layout_->SetMinMaxSize(style.GetPreviewWidth().CP(scale), style.GetPreviewHeight().CP(scale));
1929+ preview_layout_->scale = scale;
1930+
1931+ layout_content_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
1932+
1933+ nav_left_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
1934+ nav_left_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
1935+ nav_left_->scale = scale;
1936+
1937+ nav_right_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
1938+ nav_right_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
1939+ nav_right_->scale = scale;
1940+
1941+ QueueRelayout();
1942+ QueueDraw();
1943 }
1944
1945 } // namespace previews
1946
1947=== modified file 'dash/previews/PreviewContainer.h'
1948--- dash/previews/PreviewContainer.h 2014-06-13 08:03:39 +0000
1949+++ dash/previews/PreviewContainer.h 2014-07-09 10:31:56 +0000
1950@@ -25,6 +25,7 @@
1951
1952 #include <Nux/Nux.h>
1953 #include <Nux/View.h>
1954+#include <Nux/VLayout.h>
1955 #include <UnityCore/Preview.h>
1956 #include "Preview.h"
1957 #include "unity-shared/Introspectable.h"
1958@@ -93,7 +94,7 @@
1959
1960 bool InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character);
1961 void OnKeyDown(unsigned long event_type, unsigned long event_keysym, unsigned long event_state, const TCHAR* character, unsigned short key_repeat_count);
1962-
1963+
1964 private:
1965 void SetupViews();
1966
1967@@ -116,7 +117,7 @@
1968 struct timespec last_progress_time_;
1969 float navigation_progress_speed_;
1970 int navigation_count_;
1971-
1972+
1973 glib::Source::UniquePtr animation_timer_;
1974 friend class PreviewContent;
1975 };
1976
1977=== modified file 'dash/previews/PreviewInfoHintWidget.cpp'
1978--- dash/previews/PreviewInfoHintWidget.cpp 2014-06-17 07:59:33 +0000
1979+++ dash/previews/PreviewInfoHintWidget.cpp 2014-07-09 10:31:56 +0000
1980@@ -198,10 +198,10 @@
1981 {
1982 nux::Geometry const& geo = GetGeometry();
1983 info_names_layout_->SetMaximumWidth(info_names_layout_->GetContentWidth());
1984- int max_width = geo.width - info_names_layout_->GetWidth() - LAYOUT_SPACING.CP(scale) -1;
1985+ int max_width = std::max(0, geo.width - info_names_layout_->GetWidth() - LAYOUT_SPACING.CP(scale) -1);
1986
1987 for (auto value : info_values_layout_->GetChildren())
1988- value->SetMaximumWidth(max_width > 0 ? max_width : 0);
1989+ value->SetMaximumWidth(max_width);
1990 }
1991
1992 View::PreLayoutManagement();
1993
1994=== modified file 'dash/previews/PreviewNavigator.cpp'
1995--- dash/previews/PreviewNavigator.cpp 2013-11-19 18:48:35 +0000
1996+++ dash/previews/PreviewNavigator.cpp 2014-07-09 10:31:56 +0000
1997@@ -40,12 +40,16 @@
1998
1999 PreviewNavigator::PreviewNavigator(Orientation direction, NUX_FILE_LINE_DECL)
2000 : View(NUX_FILE_LINE_PARAM)
2001+ , scale(1.0)
2002 , direction_(direction)
2003 , texture_(nullptr)
2004 , visual_state_(VisualState::NORMAL)
2005 {
2006 SetupViews();
2007 UpdateTexture();
2008+
2009+ UpdateScale(scale);
2010+ scale.changed.connect(sigc::mem_fun(this, &PreviewNavigator::UpdateScale));
2011 }
2012
2013 void PreviewNavigator::SetEnabled(bool enabled)
2014@@ -97,7 +101,7 @@
2015 void PreviewNavigator::SetupViews()
2016 {
2017 previews::Style& style = dash::previews::Style::Instance();
2018-
2019+
2020 if (direction_ == Orientation::LEFT || direction_ == Orientation::RIGHT)
2021 {
2022 nux::VLayout* vlayout = new nux::VLayout();
2023@@ -107,9 +111,9 @@
2024 layout_ = hlayout;
2025
2026 if (direction_ == Orientation::LEFT)
2027- texture_ = new IconTexture(Style::Instance().GetNavLeftIcon(), style.GetNavigatorIconSize(), style.GetNavigatorIconSize());
2028- else
2029- texture_ = new IconTexture(Style::Instance().GetNavRightIcon(), style.GetNavigatorIconSize(), style.GetNavigatorIconSize());
2030+ texture_ = new IconTexture(Style::Instance().GetNavLeftIcon(), style.GetNavigatorIconSize().CP(scale), style.GetNavigatorIconSize().CP(scale));
2031+ else
2032+ texture_ = new IconTexture(Style::Instance().GetNavRightIcon(), style.GetNavigatorIconSize().CP(scale), style.GetNavigatorIconSize().CP(scale));
2033 texture_->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
2034
2035 vlayout->AddSpace(0,1);
2036@@ -138,7 +142,7 @@
2037 if (texture_)
2038 {
2039 AddChild(texture_);
2040- layout_->AddView(texture_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
2041+ layout_->AddView(texture_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
2042
2043 texture_->mouse_click.connect([this](int, int, unsigned long, unsigned long) { activated.emit(); });
2044 texture_->mouse_enter.connect(sigc::mem_fun(this, &PreviewNavigator::TexRecvMouseEnter));
2045@@ -179,6 +183,19 @@
2046 }
2047 }
2048
2049+void PreviewNavigator::UpdateScale(double scale)
2050+{
2051+ previews::Style& style = dash::previews::Style::Instance();
2052+
2053+ if (texture_)
2054+ {
2055+ int icon_size = style.GetNavigatorIconSize().CP(scale);
2056+ texture_->SetMinMaxSize(icon_size, icon_size);
2057+ }
2058+
2059+ QueueRelayout();
2060+ QueueDraw();
2061+}
2062
2063 } // namespace previews
2064 } // namespace dash
2065
2066=== modified file 'dash/previews/PreviewNavigator.h'
2067--- dash/previews/PreviewNavigator.h 2013-09-19 16:44:03 +0000
2068+++ dash/previews/PreviewNavigator.h 2014-07-09 10:31:56 +0000
2069@@ -43,7 +43,7 @@
2070 {
2071 NUX_DECLARE_OBJECT_TYPE(PreviewNavigator, nux::View);
2072 public:
2073- typedef nux::ObjectPtr<PreviewNavigator> Ptr;
2074+ typedef nux::ObjectPtr<PreviewNavigator> Ptr;
2075 PreviewNavigator(Orientation direction, NUX_FILE_LINE_PROTO);
2076
2077 void SetEnabled(bool enabled);
2078@@ -53,9 +53,11 @@
2079 void AddProperties(debug::IntrospectionData&);
2080
2081 sigc::signal<void> activated;
2082-
2083+
2084 virtual bool AcceptKeyNavFocus() { return false; }
2085
2086+ nux::Property<double> scale;
2087+
2088 private:
2089 virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);
2090 virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);
2091@@ -66,6 +68,7 @@
2092 void UpdateTexture();
2093
2094 void SetupViews();
2095+ void UpdateScale(double scale);
2096
2097 private:
2098 const Orientation direction_;
2099@@ -77,11 +80,12 @@
2100 NORMAL,
2101 ACTIVE
2102 };
2103- VisualState visual_state_;
2104+ VisualState visual_state_;
2105+
2106 };
2107
2108 } // namespace previews
2109 } // namespace dash
2110 } // namespace unity
2111
2112-#endif // PREVIEWNAVIGATOR_H
2113\ No newline at end of file
2114+#endif // PREVIEWNAVIGATOR_H
2115
2116=== modified file 'dash/previews/PreviewRatingsWidget.cpp'
2117--- dash/previews/PreviewRatingsWidget.cpp 2014-06-16 09:16:53 +0000
2118+++ dash/previews/PreviewRatingsWidget.cpp 2014-07-09 10:31:56 +0000
2119@@ -62,7 +62,7 @@
2120 ratings_->SetEditable(false);
2121 ratings_->mouse_click.connect(on_mouse_down);
2122 layout_->AddView(ratings_);
2123-
2124+
2125 reviews_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
2126 reviews_->SetFont(style.user_rating_font());
2127 reviews_->SetScale(scale);
2128@@ -73,6 +73,7 @@
2129
2130 SetLayout(layout_);
2131
2132+ UpdateScale(scale);
2133 scale.changed.connect(sigc::mem_fun(this, &PreviewRatingsWidget::UpdateScale));
2134 }
2135
2136@@ -132,7 +133,7 @@
2137
2138 if (ratings_)
2139 {
2140- ratings_->star_gap_ = RATINGS_SIZE.CP(scale);
2141+ ratings_->star_size_ = RATINGS_SIZE.CP(scale);
2142 ratings_->star_gap_ = RATINGS_GAP.CP(scale);
2143 }
2144
2145
2146=== modified file 'dash/previews/PreviewRatingsWidget.h'
2147--- dash/previews/PreviewRatingsWidget.h 2014-06-16 09:16:53 +0000
2148+++ dash/previews/PreviewRatingsWidget.h 2014-07-09 10:31:56 +0000
2149@@ -59,7 +59,7 @@
2150 protected:
2151 virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
2152 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
2153-
2154+
2155 virtual bool AcceptKeyNavFocus() { return false; }
2156
2157 // From debug::Introspectable
2158
2159=== modified file 'dash/previews/SocialPreview.cpp'
2160--- dash/previews/SocialPreview.cpp 2014-06-13 08:29:44 +0000
2161+++ dash/previews/SocialPreview.cpp 2014-07-09 10:31:56 +0000
2162@@ -49,6 +49,13 @@
2163 {
2164 DECLARE_LOGGER(logger, "unity.dash.preview.social");
2165
2166+namespace
2167+{
2168+ const RawPixel CHILDREN_SPACE = 16_em;
2169+ const RawPixel ICON_CHILDREN_SPACE = 3_em;
2170+ const RawPixel SOCIAL_INFO_CHILDREN_SPACE = 12_em;
2171+}
2172+
2173 class DetailsScrollView : public nux::ScrollView
2174 {
2175 public:
2176@@ -64,8 +71,17 @@
2177
2178 SocialPreview::SocialPreview(dash::Preview::Ptr preview_model)
2179 : Preview(preview_model)
2180+, image_data_layout_(nullptr)
2181+, main_social_info_(nullptr)
2182+, comments_layout_(nullptr)
2183+, social_content_layout_(nullptr)
2184+, social_data_layout_(nullptr)
2185+, social_info_layout_(nullptr)
2186+, icon_layout_(nullptr)
2187+, actions_layout_(nullptr)
2188 {
2189 SetupViews();
2190+ UpdateScale(scale);
2191 }
2192
2193 SocialPreview::~SocialPreview()
2194@@ -122,23 +138,24 @@
2195
2196 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); };
2197
2198- nux::HLayout* image_data_layout = new nux::HLayout();
2199- image_data_layout->SetSpaceBetweenChildren(style.GetPanelSplitWidth());
2200+ image_data_layout_ = new nux::HLayout();
2201+ image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale));
2202
2203- nux::VLayout* social_content_layout = new nux::VLayout();
2204- social_content_layout->SetSpaceBetweenChildren(16);
2205-
2206+ nux::VLayout* social_content_layout_ = new nux::VLayout();
2207+ social_content_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
2208
2209 if (social_preview_model->description.Get().length() > 0)
2210 {
2211 content_ = new SocialPreviewContent(social_preview_model->description, NUX_TRACKER_LOCATION);
2212 content_->request_close().connect([this]() { preview_container_->request_close.emit(); });
2213- social_content_layout->AddView(content_.GetPointer(), 1);
2214- } else {
2215+ social_content_layout_->AddView(content_.GetPointer(), 1);
2216+ }
2217+ else
2218+ {
2219 image_ = new CoverArt();
2220 AddChild(image_.GetPointer());
2221 UpdateCoverArtImage(image_.GetPointer());
2222- social_content_layout->AddView(image_.GetPointer(), 1);
2223+ social_content_layout_->AddView(image_.GetPointer(), 1);
2224 }
2225
2226 /////////////////////
2227@@ -146,34 +163,35 @@
2228 /////////////////////
2229 // Social Data Panel
2230 full_data_layout_ = new nux::VLayout();
2231- full_data_layout_->SetPadding(style.GetDetailsTopMargin(), 0, style.GetDetailsBottomMargin(), style.GetDetailsLeftMargin());
2232- full_data_layout_->SetSpaceBetweenChildren(16);
2233+ full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale));
2234+ full_data_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
2235
2236 /////////////////////
2237 // Main Social Info
2238- nux::HLayout* main_social_info = new nux::HLayout();
2239- main_social_info->SetSpaceBetweenChildren(style.GetSpaceBetweenIconAndDetails());
2240+ main_social_info_ = new nux::HLayout();
2241+ main_social_info_->SetSpaceBetweenChildren(style.GetSpaceBetweenIconAndDetails().CP(scale));
2242
2243 /////////////////////
2244 // Icon Layout
2245- nux::VLayout* icon_layout = new nux::VLayout();
2246- icon_layout->SetSpaceBetweenChildren(3);
2247- avatar_ = new IconTexture(social_preview_model->avatar.Get().RawPtr() ? g_icon_to_string(social_preview_model->avatar.Get().RawPtr()) : "", MIN(style.GetAvatarAreaWidth(), style.GetAvatarAreaHeight()));
2248+ icon_layout_ = new nux::VLayout();
2249+ icon_layout_->SetSpaceBetweenChildren(ICON_CHILDREN_SPACE.CP(scale));
2250+ avatar_ = new IconTexture(social_preview_model->avatar() ? g_icon_to_string(social_preview_model->avatar()) : "", MIN(style.GetAvatarAreaWidth().CP(scale), style.GetAvatarAreaHeight().CP(scale)));
2251 AddChild(avatar_.GetPointer());
2252- avatar_->SetMinMaxSize(style.GetAvatarAreaWidth(), style.GetAvatarAreaHeight());
2253+ avatar_->SetMinMaxSize(style.GetAvatarAreaWidth().CP(scale), style.GetAvatarAreaHeight().CP(scale));
2254 avatar_->mouse_click.connect(on_mouse_down);
2255- icon_layout->AddView(avatar_.GetPointer(), 0);
2256+ icon_layout_->AddView(avatar_.GetPointer(), 0);
2257
2258 /////////////////////
2259
2260 /////////////////////
2261 // Data
2262- nux::VLayout* social_data_layout = new nux::VLayout();
2263- social_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle());
2264+ social_data_layout_ = new nux::VLayout();
2265+ social_data_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
2266
2267 title_ = new StaticCairoText(preview_model_->title, true, NUX_TRACKER_LOCATION);
2268 AddChild(title_.GetPointer());
2269 title_->SetLines(-1);
2270+ title_->SetScale(scale);
2271 title_->SetFont(style.title_font().c_str());
2272 title_->mouse_click.connect(on_mouse_down);
2273
2274@@ -181,17 +199,18 @@
2275 AddChild(subtitle_.GetPointer());
2276 subtitle_->SetFont(style.content_font().c_str());
2277 subtitle_->SetLines(-1);
2278+ subtitle_->SetScale(scale);
2279 subtitle_->mouse_click.connect(on_mouse_down);
2280
2281- social_data_layout->AddView(title_.GetPointer(), 0);
2282- social_data_layout->AddView(subtitle_.GetPointer(), 0);
2283- social_data_layout->AddSpace(0, 1);
2284+ social_data_layout_->AddView(title_.GetPointer(), 0);
2285+ social_data_layout_->AddView(subtitle_.GetPointer(), 0);
2286+ social_data_layout_->AddSpace(0, 1);
2287
2288 // buffer space
2289 /////////////////////
2290
2291- main_social_info->AddLayout(icon_layout, 0);
2292- main_social_info->AddLayout(social_data_layout, 1);
2293+ main_social_info_->AddLayout(icon_layout_, 0);
2294+ main_social_info_->AddLayout(social_data_layout_, 1);
2295 /////////////////////
2296
2297 /////////////////////
2298@@ -200,92 +219,148 @@
2299 social_info->EnableHorizontalScrollBar(false);
2300 social_info->mouse_click.connect(on_mouse_down);
2301
2302- nux::VLayout* social_info_layout = new nux::VLayout();
2303- social_info_layout->SetSpaceBetweenChildren(12);
2304- social_info->SetLayout(social_info_layout);
2305+ social_info_layout_ = new nux::VLayout();
2306+ social_info_layout_->SetSpaceBetweenChildren(SOCIAL_INFO_CHILDREN_SPACE.CP(scale));
2307+ social_info->SetLayout(social_info_layout_);
2308
2309 if (!preview_model_->GetInfoHints().empty())
2310 {
2311 preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetAvatarAreaWidth());
2312 AddChild(preview_info_hints_.GetPointer());
2313 preview_info_hints_->request_close().connect([this]() { preview_container_->request_close.emit(); });
2314- social_info_layout->AddView(preview_info_hints_.GetPointer(), 0);
2315+ social_info_layout_->AddView(preview_info_hints_.GetPointer(), 0);
2316 }
2317 /////////////////////
2318 // Comments/Replies
2319 if (!social_preview_model->GetComments().empty())
2320 {
2321- nux::HLayout* comments_layout = new nux::HLayout();
2322- comments_layout->SetSpaceBetweenChildren(12);
2323+ comments_layout_ = new nux::HLayout();
2324+ comments_layout_->SetSpaceBetweenChildren(SOCIAL_INFO_CHILDREN_SPACE.CP(scale));
2325 std::string tmp_comments_hint = _("Comments");
2326 tmp_comments_hint += ":";
2327
2328 comments_hint_ = new StaticCairoText(tmp_comments_hint, true, NUX_TRACKER_LOCATION);
2329 AddChild(comments_hint_.GetPointer());
2330 comments_hint_->SetLines(-1);
2331+ comments_hint_->SetScale(scale);
2332 comments_hint_->SetFont(style.info_hint_bold_font().c_str());
2333 comments_hint_->SetTextAlignment(StaticCairoText::NUX_ALIGN_RIGHT);
2334 comments_hint_->mouse_click.connect(on_mouse_down);
2335- comments_layout->AddView(comments_hint_.GetPointer(), 0, nux::MINOR_POSITION_START);
2336+ comments_layout_->AddView(comments_hint_.GetPointer(), 0, nux::MINOR_POSITION_START);
2337
2338 comments_ = new SocialPreviewComments(preview_model_, NUX_TRACKER_LOCATION);
2339 AddChild(comments_.GetPointer());
2340 comments_->request_close().connect([this]() { preview_container_->request_close.emit(); });
2341- comments_layout->AddView(comments_.GetPointer());
2342- social_info_layout->AddView(comments_layout, 0);
2343+ comments_layout_->AddView(comments_.GetPointer());
2344+ social_info_layout_->AddView(comments_layout_, 0);
2345 }
2346
2347 /////////////////////
2348 // Actions
2349 action_buttons_.clear();
2350- nux::Layout* actions_layout = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
2351- actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin());
2352+ actions_layout_ = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
2353+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
2354 ///////////////////
2355
2356- full_data_layout_->AddLayout(main_social_info, 0, nux::MINOR_POSITION_START);
2357+ full_data_layout_->AddLayout(main_social_info_, 0, nux::MINOR_POSITION_START);
2358 full_data_layout_->AddView(social_info, 1, nux::MINOR_POSITION_START);
2359 //full_data_layout_->AddView(comments_.GetPointer(), 1, nux::MINOR_POSITION_START);
2360
2361- full_data_layout_->AddLayout(actions_layout, 0);
2362+ full_data_layout_->AddLayout(actions_layout_, 0);
2363 /////////////////////
2364-
2365- image_data_layout->AddView(social_content_layout, 0);
2366- image_data_layout->AddLayout(full_data_layout_, 1);
2367+
2368+ image_data_layout_->AddView(social_content_layout_, 0);
2369+ image_data_layout_->AddLayout(full_data_layout_, 1);
2370
2371 mouse_click.connect(on_mouse_down);
2372
2373- SetLayout(image_data_layout);
2374+ SetLayout(image_data_layout_);
2375 }
2376
2377 void SocialPreview::PreLayoutManagement()
2378 {
2379 nux::Geometry geo = GetGeometry();
2380-
2381 previews::Style& style = dash::previews::Style::Instance();
2382
2383 nux::Geometry geo_content(geo.x, geo.y, style.GetAppImageAspectRatio() * geo.height, geo.height);
2384
2385- if (geo.width - geo_content.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() < style.GetDetailsPanelMinimumWidth())
2386- geo_content.width = std::max(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() - style.GetDetailsPanelMinimumWidth());
2387+ int content_width = geo.width - style.GetPanelSplitWidth().CP(scale)
2388+ - style.GetDetailsLeftMargin().CP(scale)
2389+ - style.GetDetailsRightMargin().CP(scale);
2390+
2391+ if (content_width - geo_content.width < style.GetDetailsPanelMinimumWidth().CP(scale))
2392+ geo_content.width = std::max(0, content_width - style.GetDetailsPanelMinimumWidth().CP(scale));
2393+
2394 if (content_) { content_->SetMinMaxSize(geo_content.width, geo_content.height); }
2395 if (image_) { image_->SetMinMaxSize(geo_content.width, geo_content.height); }
2396
2397- int details_width = std::max(0, geo.width - geo_content.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin());
2398- int top_social_info_max_width = std::max(0, details_width - style.GetAppIconAreaWidth() - style.GetSpaceBetweenIconAndDetails());
2399+ int details_width = std::max(0, content_width - geo_content.width);
2400+ int top_social_info_max_width = std::max(0, details_width - style.GetAppIconAreaWidth().CP(scale) - style.GetSpaceBetweenIconAndDetails().CP(scale));
2401
2402 if (title_) { title_->SetMaximumWidth(top_social_info_max_width); }
2403 if (subtitle_) { subtitle_->SetMaximumWidth(top_social_info_max_width); }
2404 if (comments_) { comments_->SetMaximumWidth(top_social_info_max_width); }
2405- if (comments_hint_) { comments_hint_->SetMinimumWidth(style.GetInfoHintNameMinimumWidth()); }
2406+ if (comments_hint_) { comments_hint_->SetMinimumWidth(style.GetInfoHintNameMinimumWidth().CP(scale)); }
2407+
2408+ int button_w = CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale));
2409+ int button_h = style.GetActionButtonHeight().CP(scale);
2410
2411 for (nux::AbstractButton* button : action_buttons_)
2412- {
2413- button->SetMinMaxSize(CLAMP(RawPixel((details_width - style.GetSpaceBetweenActions()) / 2), 0_em, style.GetActionButtonMaximumWidth()), style.GetActionButtonHeight());
2414- }
2415+ button->SetMinMaxSize(button_w, button_h);
2416
2417 Preview::PreLayoutManagement();
2418 }
2419
2420+void SocialPreview::UpdateScale(double scale)
2421+{
2422+ Preview::UpdateScale(scale);
2423+
2424+ if (preview_info_hints_)
2425+ preview_info_hints_->scale = scale;
2426+
2427+ previews::Style& style = dash::previews::Style::Instance();
2428+
2429+ if (avatar_)
2430+ {
2431+ avatar_->SetMinMaxSize(style.GetAvatarAreaWidth().CP(scale), style.GetAvatarAreaHeight().CP(scale));
2432+ avatar_->SetSize(MIN(style.GetAvatarAreaWidth().CP(scale), style.GetAvatarAreaHeight().CP(scale)));
2433+ avatar_->ReLoadIcon();
2434+ }
2435+
2436+ if (image_data_layout_)
2437+ image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale));
2438+
2439+ if (social_content_layout_)
2440+ social_content_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
2441+
2442+ if (main_social_info_)
2443+ main_social_info_->SetSpaceBetweenChildren(style.GetSpaceBetweenIconAndDetails().CP(scale));
2444+
2445+ if (icon_layout_)
2446+ icon_layout_->SetSpaceBetweenChildren(ICON_CHILDREN_SPACE.CP(scale));
2447+
2448+ if (social_data_layout_)
2449+ social_data_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
2450+
2451+ if (social_info_layout_)
2452+ social_info_layout_->SetSpaceBetweenChildren(SOCIAL_INFO_CHILDREN_SPACE.CP(scale));
2453+
2454+ if (actions_layout_)
2455+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
2456+
2457+ if (content_)
2458+ content_->scale = scale;
2459+
2460+ if (comments_)
2461+ comments_->scale = scale;
2462+
2463+ if (comments_layout_)
2464+ comments_layout_->SetSpaceBetweenChildren(SOCIAL_INFO_CHILDREN_SPACE.CP(scale));
2465+
2466+ if (comments_hint_)
2467+ comments_hint_->SetScale(scale);
2468+}
2469+
2470 } // namespace previews
2471 } // namespace dash
2472 } // namepsace unity
2473
2474=== modified file 'dash/previews/SocialPreview.h'
2475--- dash/previews/SocialPreview.h 2013-09-19 16:44:03 +0000
2476+++ dash/previews/SocialPreview.h 2014-07-09 10:31:56 +0000
2477@@ -56,11 +56,21 @@
2478 virtual void PreLayoutManagement();
2479
2480 virtual void SetupViews();
2481+ virtual void UpdateScale(double scale) override;
2482
2483 protected:
2484 nux::VLayout* sender_layout_;
2485 nux::VLayout* title_layout_;
2486
2487+ nux::HLayout* image_data_layout_;
2488+ nux::HLayout* main_social_info_;
2489+ nux::HLayout* comments_layout_;
2490+ nux::VLayout* social_content_layout_;
2491+ nux::VLayout* social_data_layout_;
2492+ nux::VLayout* social_info_layout_;
2493+ nux::VLayout* icon_layout_;
2494+ nux::Layout* actions_layout_;
2495+
2496 nux::ObjectPtr<IconTexture> avatar_;
2497 nux::ObjectPtr<SocialPreviewContent> content_;
2498 nux::ObjectPtr<SocialPreviewComments> comments_;
2499
2500=== modified file 'dash/previews/SocialPreviewComments.cpp'
2501--- dash/previews/SocialPreviewComments.cpp 2013-11-19 18:48:35 +0000
2502+++ dash/previews/SocialPreviewComments.cpp 2014-07-09 10:31:56 +0000
2503@@ -40,20 +40,19 @@
2504
2505 namespace
2506 {
2507-const int layout_spacing = 12;
2508+const RawPixel LAYOUT_SPACING = 12_em;
2509+const RawPixel CHILDREN_SPACE = 6_em;
2510 }
2511
2512 NUX_IMPLEMENT_OBJECT_TYPE(SocialPreviewComments);
2513
2514 SocialPreviewComments::SocialPreviewComments(dash::Preview::Ptr preview_model, NUX_FILE_LINE_DECL)
2515 : View(NUX_FILE_LINE_PARAM)
2516+, scale(1.0)
2517 , preview_model_(preview_model)
2518 {
2519 SetupViews();
2520-}
2521-
2522-SocialPreviewComments::~SocialPreviewComments()
2523-{
2524+ scale.changed.connect(sigc::hide(sigc::mem_fun(this, &SocialPreviewComments::SetupViews)));
2525 }
2526
2527 void SocialPreviewComments::Draw(nux::GraphicsEngine& gfx_engine, bool force_draw)
2528@@ -85,24 +84,20 @@
2529 nux::Geometry const& geo = GetGeometry();
2530
2531 int comment_width = 0;
2532+ int minimum_detail_width = style.GetDetailsPanelMinimumWidth().CP(scale);
2533+
2534 for (Comment const& comment : comments_)
2535 {
2536- int width = style.GetDetailsPanelMinimumWidth();
2537+ int width = minimum_detail_width;
2538+
2539 if (comment.first)
2540- {
2541- width = comment.first->GetTextExtents().width;
2542-
2543- if (width < style.GetDetailsPanelMinimumWidth())
2544- width = style.GetDetailsPanelMinimumWidth();
2545- }
2546+ width = std::max(minimum_detail_width, comment.first->GetTextExtents().width);
2547
2548 if (comment_width < width)
2549- {
2550 comment_width = width;
2551- }
2552 }
2553
2554- int comment_value_width = MAX(0, geo.width - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin());
2555+ int comment_value_width = MAX(0, geo.width - style.GetDetailsLeftMargin().CP(scale) - style.GetDetailsRightMargin().CP(scale));
2556
2557 for (Comment const& comment : comments_)
2558 {
2559@@ -122,7 +117,6 @@
2560 {
2561 dash::SocialPreview* social_preview_model = dynamic_cast<dash::SocialPreview*>(preview_model_.get());
2562
2563-
2564 RemoveLayout();
2565 comments_.clear();
2566
2567@@ -131,13 +125,12 @@
2568 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); };
2569
2570 nux::VLayout* layout = new nux::VLayout();
2571- layout->SetSpaceBetweenChildren(6);
2572+ layout->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
2573
2574 for (dash::SocialPreview::CommentPtr comment : social_preview_model->GetComments())
2575 {
2576-
2577 nux::HLayout* name_layout = new nux::HLayout();
2578- name_layout->SetSpaceBetweenChildren(layout_spacing);
2579+ name_layout->SetSpaceBetweenChildren(LAYOUT_SPACING.CP(scale));
2580
2581 StaticCairoTextPtr comment_name;
2582 if (!comment->display_name.empty())
2583@@ -145,6 +138,7 @@
2584 comment_name = new StaticCairoText(comment->display_name, true, NUX_TRACKER_LOCATION);
2585 comment_name->SetFont(style.info_hint_bold_font());
2586 comment_name->SetLines(-1);
2587+ comment_name->SetScale(scale);
2588 comment_name->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
2589 comment_name->mouse_click.connect(on_mouse_down);
2590 name_layout->AddView(comment_name.GetPointer(), 0, nux::MINOR_POSITION_START);
2591@@ -156,19 +150,20 @@
2592 comment_time = new StaticCairoText(comment->time, true, NUX_TRACKER_LOCATION);
2593 comment_time->SetFont(style.info_hint_font());
2594 comment_time->SetLines(-1);
2595+ comment_time->SetScale(scale);
2596 comment_time->SetTextAlignment(StaticCairoText::NUX_ALIGN_RIGHT);
2597 comment_time->mouse_click.connect(on_mouse_down);
2598 name_layout->AddView(comment_time.GetPointer(), 0, nux::MINOR_POSITION_START);
2599 }
2600
2601-
2602 nux::HLayout* comment_layout = new nux::HLayout();
2603- comment_layout->SetSpaceBetweenChildren(layout_spacing);
2604+ comment_layout->SetSpaceBetweenChildren(LAYOUT_SPACING.CP(scale));
2605
2606 StaticCairoTextPtr comment_value(new StaticCairoText(comment->content, false, NUX_TRACKER_LOCATION));
2607
2608 comment_value->SetFont(style.info_hint_font());
2609 comment_value->SetLines(-7);
2610+ comment_value->SetScale(scale);
2611 comment_value->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
2612 comment_value->mouse_click.connect(on_mouse_down);
2613 comment_layout->AddView(comment_value.GetPointer(), 1, nux::MINOR_POSITION_START);
2614@@ -182,7 +177,6 @@
2615 mouse_click.connect(on_mouse_down);
2616
2617 SetLayout(layout);
2618-
2619 }
2620
2621 std::string SocialPreviewComments::GetName() const
2622
2623=== modified file 'dash/previews/SocialPreviewComments.h'
2624--- dash/previews/SocialPreviewComments.h 2013-09-19 16:44:03 +0000
2625+++ dash/previews/SocialPreviewComments.h 2014-07-09 10:31:56 +0000
2626@@ -46,12 +46,11 @@
2627
2628 SocialPreviewComments(dash::Preview::Ptr preview_model, NUX_FILE_LINE_PROTO);
2629
2630- virtual ~SocialPreviewComments();
2631+ nux::Property<double> scale;
2632
2633 sigc::signal<void> request_close() const { return preview_container_.request_close; }
2634
2635 protected:
2636-
2637 typedef nux::ObjectPtr<StaticCairoText> StaticCairoTextPtr;
2638 typedef std::pair<StaticCairoTextPtr, StaticCairoTextPtr> Comment;
2639 std::list<Comment> comments_;
2640@@ -70,9 +69,6 @@
2641 virtual void AddProperties(debug::IntrospectionData&);
2642
2643 private:
2644-
2645- typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
2646-
2647 PreviewContainer preview_container_;
2648 };
2649
2650
2651=== modified file 'dash/previews/SocialPreviewContent.cpp'
2652--- dash/previews/SocialPreviewContent.cpp 2013-11-19 18:48:35 +0000
2653+++ dash/previews/SocialPreviewContent.cpp 2014-07-09 10:31:56 +0000
2654@@ -38,16 +38,17 @@
2655
2656 namespace
2657 {
2658-const int BUBBLE_WIDTH = 300;
2659-const int BUBBLE_HEIGHT = 250;
2660-const int TAIL_HEIGHT = 50;
2661+const RawPixel BUBBLE_WIDTH = 300_em;
2662+const RawPixel BUBBLE_HEIGHT = 250_em;
2663+const RawPixel TAIL_HEIGHT = 50_em;
2664 const int TAIL_POS_FROM_RIGHT = 60;
2665+const RawPixel TEXT_LINE_SPACING = 5_em;
2666 }
2667
2668-inline nux::Geometry GetBubbleGeometry(nux::Geometry const& geo)
2669+inline nux::Geometry GetBubbleGeometry(nux::Geometry const& geo, double scale)
2670 {
2671- int width = MIN(BUBBLE_WIDTH, geo.width);
2672- int height = MIN(BUBBLE_HEIGHT + TAIL_HEIGHT, geo.height);
2673+ int width = std::min(BUBBLE_WIDTH.CP(scale), geo.width);
2674+ int height = std::min(BUBBLE_HEIGHT.CP(scale) + TAIL_HEIGHT.CP(scale), geo.height);
2675
2676 return nux::Geometry(geo.x + (geo.width - width)/2, geo.y + (geo.height - height)/2, width, height);
2677 }
2678@@ -56,14 +57,13 @@
2679
2680 SocialPreviewContent::SocialPreviewContent(std::string const& text, NUX_FILE_LINE_DECL)
2681 : View(NUX_FILE_LINE_PARAM)
2682+, scale(1.0)
2683 {
2684 SetupViews();
2685 if (text.length() > 0)
2686 SetText(text);
2687-}
2688-
2689-SocialPreviewContent::~SocialPreviewContent()
2690-{
2691+ UpdateScale(scale);
2692+ scale.changed.connect(sigc::mem_fun(this, &SocialPreviewContent::UpdateScale));
2693 }
2694
2695 void SocialPreviewContent::SetText(std::string const& text)
2696@@ -94,7 +94,7 @@
2697
2698 nux::ObjectPtr<nux::IOpenGLBaseTexture> tex = cr_bubble_->GetTexture()->GetDeviceTexture();
2699
2700- nux::Geometry geo_bubble(GetBubbleGeometry(geo));
2701+ nux::Geometry geo_bubble(GetBubbleGeometry(geo, scale));
2702
2703 gfx_engine.QRP_1Tex(geo_bubble.x,
2704 geo_bubble.y,
2705@@ -134,8 +134,9 @@
2706
2707 text_ = new StaticCairoText("", false, NUX_TRACKER_LOCATION);
2708 text_->SetLines(-8);
2709+ text_->SetScale(scale);
2710 text_->SetFont(style.content_font());
2711- text_->SetLineSpacing(5);
2712+ text_->SetLineSpacing(TEXT_LINE_SPACING.CP(scale));
2713 text_->SetTextEllipsize(StaticCairoText::NUX_ELLIPSIZE_MIDDLE);
2714 text_->mouse_click.connect(on_mouse_down);
2715
2716@@ -146,17 +147,18 @@
2717
2718 SetLayout(layout);
2719
2720- cr_bubble_.reset(new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &SocialPreviewContent::RedrawBubble), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
2721+ nux::Geometry bubble_geo = GetGeometry();
2722+ cr_bubble_.reset(new nux::CairoWrapper(bubble_geo, sigc::bind(sigc::mem_fun(this, &SocialPreviewContent::RedrawBubble), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
2723 }
2724
2725 void SocialPreviewContent::UpdateBaloonTexture()
2726 {
2727 nux::Geometry const& geo = GetGeometry();
2728
2729- nux::Geometry geo_cr(GetBubbleGeometry(geo));
2730+ nux::Geometry geo_cr(GetBubbleGeometry(geo, scale));
2731
2732 int max_width = std::max(0, (int)(geo_cr.width - 2*(geo_cr.width*0.1)));
2733- int max_height = std::max(0, (int)((geo_cr.height - TAIL_HEIGHT) - 2*((geo_cr.height - TAIL_HEIGHT)*0.1)));
2734+ int max_height = std::max(0, (int)((geo_cr.height - TAIL_HEIGHT.CP(scale)) - 2*((geo_cr.height - TAIL_HEIGHT.CP(scale))*0.1)));
2735
2736 // this will update the texture with the actual size of the text.
2737 text_->SetMaximumHeight(max_height);
2738@@ -165,7 +167,7 @@
2739
2740 // center text
2741 text_->SetBaseX(geo_cr.x + geo_cr.width/2 - geo_text.width/2);
2742- text_->SetBaseY(geo_cr.y + geo_cr.height/2 - geo_text.height/2 - TAIL_HEIGHT/2);
2743+ text_->SetBaseY(geo_cr.y + geo_cr.height/2 - geo_text.height/2 - TAIL_HEIGHT.CP(scale)/2);
2744
2745 if (geo_cr.width > 0 && geo_cr.height > 0)
2746 {
2747@@ -175,8 +177,9 @@
2748
2749 void SocialPreviewContent::RedrawBubble(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state)
2750 {
2751- double width = std::max(0, cairo_image_surface_get_width(cairo_get_target(cr)));
2752- double height = std::max(0, cairo_image_surface_get_height(cairo_get_target(cr)) - TAIL_HEIGHT);
2753+ auto* surface = cairo_get_target(cr);
2754+ double width = std::max(0.0, cairo_image_surface_get_width(surface) / scale());
2755+ double height = std::max(0.0, cairo_image_surface_get_height(surface) / scale() - TAIL_HEIGHT);
2756
2757 double tailPosition = width - TAIL_POS_FROM_RIGHT - TAIL_HEIGHT;
2758 if (width > 0 && height > 0)
2759@@ -222,11 +225,14 @@
2760 double tailPosition,
2761 double tailWidth)
2762 {
2763+ auto* surface = cairo_get_target(cr);
2764+
2765 // sanity check
2766 if (cairo_status(cr) != CAIRO_STATUS_SUCCESS &&
2767- cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
2768+ cairo_surface_get_type(surface) != CAIRO_SURFACE_TYPE_IMAGE)
2769 return;
2770
2771+ cairo_surface_set_device_scale(surface, scale(), scale());
2772 cairo_set_line_width(cr, line_width);
2773
2774 bool odd = line_width != double((int)line_width);
2775@@ -314,6 +320,14 @@
2776 introspection.add(GetAbsoluteGeometry());
2777 }
2778
2779+void SocialPreviewContent::UpdateScale(double scale)
2780+{
2781+ if (text_)
2782+ text_->SetScale(scale);
2783+
2784+ UpdateBaloonTexture();
2785+}
2786+
2787 }
2788 }
2789 }
2790
2791=== modified file 'dash/previews/SocialPreviewContent.h'
2792--- dash/previews/SocialPreviewContent.h 2013-09-19 16:44:03 +0000
2793+++ dash/previews/SocialPreviewContent.h 2014-07-09 10:31:56 +0000
2794@@ -46,7 +46,8 @@
2795 NUX_DECLARE_OBJECT_TYPE(SocialPreviewContent, nux::View);
2796
2797 SocialPreviewContent(std::string const& text, NUX_FILE_LINE_PROTO);
2798- virtual ~SocialPreviewContent();
2799+
2800+ nux::Property<double> scale;
2801
2802 void SetText(std::string const& text);
2803
2804@@ -76,6 +77,8 @@
2805 virtual void AddProperties(debug::IntrospectionData&);
2806
2807 private:
2808+ void UpdateScale(double scale);
2809+
2810 nux::ObjectPtr<StaticCairoText> text_;
2811
2812 typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
2813
2814=== modified file 'dash/previews/StandaloneApplicationPreview.cpp'
2815--- dash/previews/StandaloneApplicationPreview.cpp 2014-06-17 03:44:51 +0000
2816+++ dash/previews/StandaloneApplicationPreview.cpp 2014-07-09 10:31:56 +0000
2817@@ -39,12 +39,14 @@
2818 #include "PreviewContainer.h"
2819
2820
2821-#define WIDTH 972
2822-#define HEIGHT 452
2823+const unity::RawPixel WIDTH(1000);
2824+const unity::RawPixel HEIGHT(600);
2825
2826 using namespace unity;
2827 using namespace unity::dash;
2828
2829+static double scale = 1.0;
2830+
2831 class DummyView : public nux::View
2832 {
2833 public:
2834@@ -146,6 +148,7 @@
2835 container_->navigate_right.connect(sigc::mem_fun(this, &TestRunner::NavRight));
2836 container_->navigate_left.connect(sigc::mem_fun(this, &TestRunner::NavLeft));
2837 container_->request_close.connect([this]() { exit(0); });
2838+ container_->scale = scale;
2839
2840 DummyView* dummyView = new DummyView(container_.GetPointer());
2841 layout_ = new nux::VLayout(NUX_TRACKER_LOCATION);
2842@@ -162,9 +165,9 @@
2843 description << "Application description " << i << std::endl;
2844
2845 // creates a generic preview object
2846- glib::Object<GIcon> iconHint1(g_icon_new_for_string("/usr/share/unity/5/lens-nav-music.svg", NULL));
2847- glib::Object<GIcon> iconHint2(g_icon_new_for_string("/usr/share/unity/5/lens-nav-home.svg", NULL));
2848- glib::Object<GIcon> iconHint3(g_icon_new_for_string("/usr/share/unity/5/lens-nav-people.svg", NULL));
2849+ glib::Object<GIcon> iconHint1(g_icon_new_for_string("/usr/share/unity/icons/lens-nav-music.svg", NULL));
2850+ glib::Object<GIcon> iconHint2(g_icon_new_for_string("/usr/share/unity/icons/lens-nav-home.svg", NULL));
2851+ glib::Object<GIcon> iconHint3(g_icon_new_for_string("/usr/share/unity/icons/lens-nav-people.svg", NULL));
2852
2853 GHashTable* action_hints1(g_hash_table_new(g_direct_hash, g_direct_equal));
2854 g_hash_table_insert (action_hints1, g_strdup ("extra-text"), g_variant_new_string("£30.99"));
2855@@ -207,10 +210,10 @@
2856 The service allows users to communicate with peers by voice, video, and instant messaging over the Internet. Phone calls may be placed to recipients on the traditional telephone networks. Calls to other users within the Skype service are free of charge, while calls to landline telephones and mobile phones are charged via a debit-based user account system.";
2857
2858 // creates a generic preview object
2859- glib::Object<GIcon> iconHint1(g_icon_new_for_string("/usr/share/unity/5/lens-nav-music.svg", NULL));
2860- glib::Object<GIcon> iconHint2(g_icon_new_for_string("/usr/share/unity/5/lens-nav-home.svg", NULL));
2861- glib::Object<GIcon> iconHint3(g_icon_new_for_string("/usr/share/unity/5/lens-nav-people.svg", NULL));
2862- glib::Object<GIcon> iconHint4(g_icon_new_for_string("/usr/share/unity/5/lens-nav-people.svg", NULL));
2863+ glib::Object<GIcon> iconHint1(g_icon_new_for_string("/usr/share/unity/icons/lens-nav-music.svg", NULL));
2864+ glib::Object<GIcon> iconHint2(g_icon_new_for_string("/usr/share/unity/icons/lens-nav-home.svg", NULL));
2865+ glib::Object<GIcon> iconHint3(g_icon_new_for_string("/usr/share/unity/icons/lens-nav-people.svg", NULL));
2866+ glib::Object<GIcon> iconHint4(g_icon_new_for_string("/usr/share/unity/icons/lens-nav-people.svg", NULL));
2867
2868 GHashTable* action_hints1(g_hash_table_new(g_direct_hash, g_direct_equal));
2869 g_hash_table_insert (action_hints1, g_strdup ("extra-text"), g_variant_new_string("£30.99"));
2870@@ -259,9 +262,9 @@
2871 The service allows users to communicate with peers by voice, video, and instant messaging over the Internet. Phone calls may be placed to recipients on the traditional telephone networks. Calls to other users within the Skype service are free of charge, while calls to landline telephones and mobile phones are charged via a debit-based user account system.";
2872
2873 // creates a generic preview object
2874- glib::Object<GIcon> iconHint1(g_icon_new_for_string("/usr/share/unity/5/lens-nav-music.svg", NULL));
2875- glib::Object<GIcon> iconHint2(g_icon_new_for_string("/usr/share/unity/5/lens-nav-home.svg", NULL));
2876- glib::Object<GIcon> iconHint3(g_icon_new_for_string("/usr/share/unity/5/lens-nav-people.svg", NULL));
2877+ glib::Object<GIcon> iconHint1(g_icon_new_for_string("/usr/share/unity/icons/lens-nav-music.svg", NULL));
2878+ glib::Object<GIcon> iconHint2(g_icon_new_for_string("/usr/share/unity/icons/lens-nav-home.svg", NULL));
2879+ glib::Object<GIcon> iconHint3(g_icon_new_for_string("/usr/share/unity/icons/lens-nav-people.svg", NULL));
2880
2881 GHashTable* action_hints1(g_hash_table_new(g_direct_hash, g_direct_equal));
2882 g_hash_table_insert (action_hints1, g_strdup ("extra-text"), g_variant_new_string("£30.99"));
2883@@ -317,10 +320,22 @@
2884 unity::dash::previews::Style panel_style;
2885 unity::dash::Style dash_style;
2886 unity::ThumbnailGenerator thumbnail_generator;
2887+ unity::glib::Error err;
2888+
2889+ GOptionEntry args_parsed[] =
2890+ {
2891+ { "scaling-factor", 's', 0, G_OPTION_ARG_DOUBLE, &scale, "The dash scaling factor", "F" },
2892+ { NULL }
2893+ };
2894+
2895+ std::shared_ptr<GOptionContext> ctx(g_option_context_new("Unity Preview"), g_option_context_free);
2896+ g_option_context_add_main_entries(ctx.get(), args_parsed, NULL);
2897+ if (!g_option_context_parse(ctx.get(), &argc, &argv, &err))
2898+ std::cerr << "Got error when parsing arguments: " << err << std::endl;
2899
2900 TestRunner *test_runner = new TestRunner ();
2901 wt = nux::CreateGUIThread(TEXT("Unity Preview"),
2902- WIDTH, HEIGHT,
2903+ WIDTH.CP(scale), HEIGHT.CP(scale),
2904 0,
2905 &TestRunner::InitWindowThread,
2906 test_runner);
2907
2908=== modified file 'dash/previews/StandaloneErrorPreview.cpp'
2909--- dash/previews/StandaloneErrorPreview.cpp 2013-11-18 18:13:59 +0000
2910+++ dash/previews/StandaloneErrorPreview.cpp 2014-07-09 10:31:56 +0000
2911@@ -39,13 +39,14 @@
2912 #include "Preview.h"
2913 #include "PreviewContainer.h"
2914
2915-
2916-#define WIDTH 1100
2917-#define HEIGHT 600
2918+const unity::RawPixel WIDTH(1100);
2919+const unity::RawPixel HEIGHT(600);
2920
2921 using namespace unity;
2922 using namespace unity::dash;
2923
2924+static double scale = 1.0;
2925+
2926 namespace
2927 {
2928 nux::logging::Logger logger("unity.dash.StandaloneMusicPreview");
2929@@ -150,6 +151,7 @@
2930 container_ = new previews::PreviewContainer(NUX_TRACKER_LOCATION);
2931 container_->request_close.connect([this]() { exit(0); });
2932 container_->DisableNavButton(previews::Navigation::BOTH);
2933+ container_->scale = scale;
2934
2935 DummyView* dummyView = new DummyView(container_.GetPointer());
2936 layout_ = new nux::VLayout(NUX_TRACKER_LOCATION);
2937@@ -206,10 +208,22 @@
2938 unity::dash::previews::Style panel_style;
2939 unity::dash::Style dash_style;
2940 unity::ThumbnailGenerator thumbnail_generator;
2941+ unity::glib::Error err;
2942+
2943+ GOptionEntry args_parsed[] =
2944+ {
2945+ { "scaling-factor", 's', 0, G_OPTION_ARG_DOUBLE, &scale, "The dash scaling factor", "F" },
2946+ { NULL }
2947+ };
2948+
2949+ std::shared_ptr<GOptionContext> ctx(g_option_context_new("Unity Preview"), g_option_context_free);
2950+ g_option_context_add_main_entries(ctx.get(), args_parsed, NULL);
2951+ if (!g_option_context_parse(ctx.get(), &argc, &argv, &err))
2952+ std::cerr << "Got error when parsing arguments: " << err << std::endl;
2953
2954 TestRunner *test_runner = new TestRunner ();
2955 wt = nux::CreateGUIThread(TEXT("Unity Preview"),
2956- WIDTH, HEIGHT,
2957+ WIDTH.CP(scale), HEIGHT.CP(scale),
2958 0,
2959 &TestRunner::InitWindowThread,
2960 test_runner);
2961
2962=== modified file 'dash/previews/StandaloneMoviePreview.cpp'
2963--- dash/previews/StandaloneMoviePreview.cpp 2013-11-18 18:13:59 +0000
2964+++ dash/previews/StandaloneMoviePreview.cpp 2014-07-09 10:31:56 +0000
2965@@ -39,12 +39,14 @@
2966 #include "PreviewContainer.h"
2967
2968
2969-#define WIDTH 972
2970-#define HEIGHT 452
2971+const unity::RawPixel WIDTH(1000);
2972+const unity::RawPixel HEIGHT(600);
2973
2974 using namespace unity;
2975 using namespace unity::dash;
2976
2977+static double scale = 1.0;
2978+
2979 class DummyView : public nux::View
2980 {
2981 public:
2982@@ -145,6 +147,7 @@
2983 container_->navigate_right.connect(sigc::mem_fun(this, &TestRunner::NavRight));
2984 container_->navigate_left.connect(sigc::mem_fun(this, &TestRunner::NavLeft));
2985 container_->request_close.connect([this]() { exit(0); });
2986+ container_->scale = scale;
2987
2988 DummyView* dummyView = new DummyView(container_.GetPointer());
2989 layout_ = new nux::VLayout(NUX_TRACKER_LOCATION);
2990@@ -234,10 +237,22 @@
2991 unity::dash::previews::Style panel_style;
2992 unity::dash::Style dash_style;
2993 unity::ThumbnailGenerator thumbnail_generator;
2994+ unity::glib::Error err;
2995+
2996+ GOptionEntry args_parsed[] =
2997+ {
2998+ { "scaling-factor", 's', 0, G_OPTION_ARG_DOUBLE, &scale, "The dash scaling factor", "F" },
2999+ { NULL }
3000+ };
3001+
3002+ std::shared_ptr<GOptionContext> ctx(g_option_context_new("Unity Preview"), g_option_context_free);
3003+ g_option_context_add_main_entries(ctx.get(), args_parsed, NULL);
3004+ if (!g_option_context_parse(ctx.get(), &argc, &argv, &err))
3005+ std::cerr << "Got error when parsing arguments: " << err << std::endl;
3006
3007 TestRunner *test_runner = new TestRunner ();
3008 wt = nux::CreateGUIThread(TEXT("Unity Preview"),
3009- WIDTH, HEIGHT,
3010+ WIDTH.CP(scale), HEIGHT.CP(scale),
3011 0,
3012 &TestRunner::InitWindowThread,
3013 test_runner);
3014
3015=== modified file 'dash/previews/StandaloneMusicPaymentPreview.cpp'
3016--- dash/previews/StandaloneMusicPaymentPreview.cpp 2013-11-18 18:13:59 +0000
3017+++ dash/previews/StandaloneMusicPaymentPreview.cpp 2014-07-09 10:31:56 +0000
3018@@ -38,15 +38,15 @@
3019 #include "Preview.h"
3020 #include "PreviewContainer.h"
3021
3022-
3023-#define WIDTH 1100
3024-#define HEIGHT 600
3025+const unity::RawPixel WIDTH(1100);
3026+const unity::RawPixel HEIGHT(600);
3027
3028 using namespace unity;
3029 using namespace unity::dash;
3030
3031 namespace
3032 {
3033+static double scale = 1.0;
3034 nux::logging::Logger logger("unity.dash.StandaloneMusicPreview");
3035 }
3036
3037@@ -190,6 +190,7 @@
3038
3039 dash::Preview::Ptr preview_model(dash::Preview::PreviewForVariant(v));
3040 container_->Preview(preview_model, previews::Navigation::LEFT);
3041+ container_->scale = scale;
3042 }
3043
3044 void TestRunner::InitWindowThread(nux::NThread* thread, void* InitData)
3045@@ -211,10 +212,22 @@
3046 unity::dash::previews::Style panel_style;
3047 unity::dash::Style dash_style;
3048 unity::ThumbnailGenerator thumbnail_generator;
3049+ unity::glib::Error err;
3050+
3051+ GOptionEntry args_parsed[] =
3052+ {
3053+ { "scaling-factor", 's', 0, G_OPTION_ARG_DOUBLE, &scale, "The dash scaling factor", "F" },
3054+ { NULL }
3055+ };
3056+
3057+ std::shared_ptr<GOptionContext> ctx(g_option_context_new("Unity Preview"), g_option_context_free);
3058+ g_option_context_add_main_entries(ctx.get(), args_parsed, NULL);
3059+ if (!g_option_context_parse(ctx.get(), &argc, &argv, &err))
3060+ std::cerr << "Got error when parsing arguments: " << err << std::endl;
3061
3062 TestRunner *test_runner = new TestRunner ();
3063 wt = nux::CreateGUIThread(TEXT("Unity Preview"),
3064- WIDTH, HEIGHT,
3065+ WIDTH.CP(scale), HEIGHT.CP(scale),
3066 0,
3067 &TestRunner::InitWindowThread,
3068 test_runner);
3069
3070=== modified file 'dash/previews/StandaloneSocialPreview.cpp'
3071--- dash/previews/StandaloneSocialPreview.cpp 2013-11-18 18:13:59 +0000
3072+++ dash/previews/StandaloneSocialPreview.cpp 2014-07-09 10:31:56 +0000
3073@@ -38,9 +38,10 @@
3074 #include "Preview.h"
3075 #include "PreviewContainer.h"
3076
3077+const unity::RawPixel WIDTH(1000);
3078+const unity::RawPixel HEIGHT(600);
3079
3080-#define WIDTH 910
3081-#define HEIGHT 400
3082+static double scale = 1.0;
3083
3084 using namespace unity;
3085 using namespace unity::dash;
3086@@ -146,6 +147,7 @@
3087 container_->navigate_right.connect(sigc::mem_fun(this, &TestRunner::NavRight));
3088 container_->navigate_left.connect(sigc::mem_fun(this, &TestRunner::NavLeft));
3089 container_->request_close.connect([this]() { exit(0); });
3090+ container_->scale = scale;
3091
3092 DummyView* dummyView = new DummyView(container_.GetPointer());
3093 layout_ = new nux::VLayout(NUX_TRACKER_LOCATION);
3094@@ -157,7 +159,8 @@
3095 const char* description = "Lorem ipsum dolor sit amet, id eruditi referrentur cum, et est enim persequeris. Munere docendi intellegebat pro id, nam no delenit facilisis similique, ut usu eros aliquando. Electram postulant accusamus ut ius, cum ad impedit facilis mediocrem. At cum tamquam.";
3096
3097 glib::Object<GIcon> iconHint1(g_icon_new_for_string("/usr/share/pixmaps/faces/sunflower.jpg", NULL));
3098- glib::Object<GIcon> iconHint2(g_icon_new_for_string("/usr/share/unity/6/lens-nav-home.svg", NULL));
3099+ glib::Object<GIcon> iconHint2(g_icon_new_for_string("/usr/share/unity/icons/lens-nav-home.svg", NULL));
3100+ glib::Object<GIcon> iconHint3(g_icon_new_for_string("/usr/share/icons/unity-icon-theme/places/svg/service-twitter.svg", NULL));
3101
3102 glib::Object<UnityProtocolPreview> proto_obj(UNITY_PROTOCOL_PREVIEW(unity_protocol_social_preview_new()));
3103
3104@@ -169,7 +172,7 @@
3105 unity_protocol_preview_set_subtitle(proto_obj, subtitle);
3106 unity_protocol_preview_set_description(proto_obj, description);
3107 unity_protocol_preview_add_action(proto_obj, "view", "View", iconHint2, 0);
3108- unity_protocol_preview_add_action(proto_obj, "retweet", "Retweet", nullptr, 0);
3109+ unity_protocol_preview_add_action(proto_obj, "retweet", "Retweet", iconHint3, 0);
3110 unity_protocol_social_preview_add_comment(UNITY_PROTOCOL_SOCIAL_PREVIEW(proto_obj.RawPtr()), "comment", "Stacy", "Lorem ipsum dolor sit amet, id eruditi referrentur cum, et est enim persequeris. Munere docendi intellegebat pro id, nam no delenit facilisis similique, ut usu eros aliquando. Electram postulant accusamus ut ius, cum ad impedit facilis mediocrem. At cum tamquam.", "13 minutes ago");
3111 unity_protocol_social_preview_add_comment(UNITY_PROTOCOL_SOCIAL_PREVIEW(proto_obj.RawPtr()), "comment", "Jeremy", "This is a comment", "4 hours ago");
3112 unity_protocol_social_preview_add_comment(UNITY_PROTOCOL_SOCIAL_PREVIEW(proto_obj.RawPtr()), "comment", "Stacy", "This is a comment", "4 hours ago");
3113@@ -180,7 +183,6 @@
3114
3115 dash::Preview::Ptr preview_model(dash::Preview::PreviewForVariant(v));
3116 container_->Preview(preview_model, previews::Navigation::RIGHT);
3117-
3118 }
3119
3120 void TestRunner::NavRight()
3121@@ -191,7 +193,7 @@
3122
3123 // creates a generic preview object
3124 glib::Object<GIcon> iconHint1(g_icon_new_for_string("/usr/share/pixmaps/faces/astronaut.jpg", NULL));
3125- glib::Object<GIcon> iconHint2(g_icon_new_for_string("/usr/share/unity/6/lens-nav-home.svg", NULL));
3126+ glib::Object<GIcon> iconHint2(g_icon_new_for_string("/usr/share/unity/icons/lens-nav-home.svg", NULL));
3127
3128 glib::Object<UnityProtocolPreview> proto_obj(UNITY_PROTOCOL_PREVIEW(unity_protocol_social_preview_new()));
3129
3130@@ -226,7 +228,7 @@
3131 const char* description = "Profile pictures are what people want them to think they look like. Tagged pictures are what they really look like.";
3132
3133 glib::Object<GIcon> iconHint1(g_icon_new_for_string("/usr/share/pixmaps/faces/soccerball.png", NULL));
3134- glib::Object<GIcon> iconHint2(g_icon_new_for_string("/usr/share/unity/6/lens-nav-home.svg", NULL));
3135+ glib::Object<GIcon> iconHint2(g_icon_new_for_string("/usr/share/unity/icons/lens-nav-home.svg", NULL));
3136
3137 glib::Object<UnityProtocolPreview> proto_obj(UNITY_PROTOCOL_PREVIEW(unity_protocol_social_preview_new()));
3138
3139@@ -269,10 +271,22 @@
3140 unity::dash::previews::Style panel_style;
3141 unity::dash::Style dash_style;
3142 unity::ThumbnailGenerator thumbnail_generator;
3143+ unity::glib::Error err;
3144+
3145+ GOptionEntry args_parsed[] =
3146+ {
3147+ { "scaling-factor", 's', 0, G_OPTION_ARG_DOUBLE, &scale, "The dash scaling factor", "F" },
3148+ { NULL }
3149+ };
3150+
3151+ std::shared_ptr<GOptionContext> ctx(g_option_context_new("Unity Preview"), g_option_context_free);
3152+ g_option_context_add_main_entries(ctx.get(), args_parsed, NULL);
3153+ if (!g_option_context_parse(ctx.get(), &argc, &argv, &err))
3154+ std::cerr << "Got error when parsing arguments: " << err << std::endl;
3155
3156 TestRunner *test_runner = new TestRunner ();
3157 wt = nux::CreateGUIThread(TEXT("Unity Preview"),
3158- WIDTH, HEIGHT,
3159+ WIDTH.CP(scale), HEIGHT.CP(scale),
3160 0,
3161 &TestRunner::InitWindowThread,
3162 test_runner);
3163
3164=== modified file 'dash/previews/Track.cpp'
3165--- dash/previews/Track.cpp 2013-11-19 18:48:35 +0000
3166+++ dash/previews/Track.cpp 2014-07-09 10:31:56 +0000
3167@@ -37,6 +37,13 @@
3168 namespace previews
3169 {
3170
3171+DECLARE_LOGGER(logger, "unity.dash.preview.music.track");
3172+namespace
3173+{
3174+const RawPixel LAYOUT_SPACING = 6_em;
3175+const RawPixel TITLE_PADDING = 3_em;
3176+}
3177+
3178 class TmpView : public nux::View
3179 {
3180 public:
3181@@ -49,17 +56,11 @@
3182 if (GetCompositionLayout())
3183 GetCompositionLayout()->ProcessDraw(gfx_engine, force_draw);
3184 }
3185-
3186+
3187 virtual bool AcceptKeyNavFocus() { return false; }
3188
3189 };
3190
3191-DECLARE_LOGGER(logger, "unity.dash.preview.music.track");
3192-namespace
3193-{
3194-const int layout_spacing = 6;
3195-}
3196-
3197 NUX_IMPLEMENT_OBJECT_TYPE(Track);
3198
3199 class TrackProgressLayer : public nux::AbstractPaintLayer
3200@@ -126,12 +127,14 @@
3201
3202 Track::Track(NUX_FILE_LINE_DECL)
3203 : View(NUX_FILE_LINE_PARAM)
3204+ , scale(1.0)
3205 , play_state_(PlayerState::STOPPED)
3206 , progress_(0.0)
3207 , mouse_over_(false)
3208 {
3209 SetupBackground();
3210 SetupViews();
3211+ scale.changed.connect(sigc::mem_fun(this, &Track::UpdateScale));
3212 }
3213
3214 std::string Track::GetName() const
3215@@ -202,23 +205,25 @@
3216 layout->SetLeftAndRightPadding(0,0);
3217
3218 nux::BaseTexture* tex_play = style.GetPlayIcon();
3219- IconTexture* status_play = new IconTexture(tex_play, style.GetStatusIconSize(), style.GetStatusIconSize());
3220- status_play->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
3221+ status_play_ = new IconTexture(tex_play, style.GetStatusIconSize().CP(scale), style.GetStatusIconSize().CP(scale));
3222+ status_play_->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
3223
3224 nux::BaseTexture* tex_pause = style.GetPauseIcon();
3225- IconTexture* status_pause = new IconTexture(tex_pause, style.GetStatusIconSize(), style.GetStatusIconSize());
3226- status_pause->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
3227+ status_pause_ = new IconTexture(tex_pause, style.GetStatusIconSize().CP(scale), style.GetStatusIconSize().CP(scale));
3228+ status_pause_->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
3229
3230 track_number_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
3231 track_number_->SetTextAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
3232 track_number_->SetTextVerticalAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
3233 track_number_->SetLines(-1);
3234+ track_number_->SetScale(scale);
3235 track_number_->SetFont(style.track_font());
3236
3237 title_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
3238 title_->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
3239 title_->SetTextVerticalAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
3240 title_->SetLines(-1);
3241+ title_->SetScale(scale);
3242 title_->SetFont(style.track_font());
3243
3244 duration_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
3245@@ -226,21 +231,22 @@
3246 duration_->SetTextAlignment(StaticCairoText::NUX_ALIGN_RIGHT);
3247 duration_->SetTextVerticalAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
3248 duration_->SetLines(-1);
3249+ duration_->SetMinimumWidth(style.GetMusicDurationWidth().CP(scale));
3250+ duration_->SetMaximumWidth(style.GetMusicDurationWidth().CP(scale));
3251+ duration_->SetScale(scale);
3252 duration_->SetFont(style.track_font());
3253- duration_->SetMaximumWidth(style.GetMusicDurationWidth());
3254- duration_->SetMaximumWidth(style.GetMusicDurationWidth());
3255 // Layouts
3256 // stick text fields in a layout so they don't alter thier geometry.
3257 status_play_layout_ = new TmpView();
3258 status_play_layout_->SetLayout(new nux::HLayout());
3259 status_play_layout_->GetLayout()->AddSpace(0, 1);
3260- status_play_layout_->GetLayout()->AddView(status_play, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
3261+ status_play_layout_->GetLayout()->AddView(status_play_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
3262 status_play_layout_->GetLayout()->AddSpace(0, 1);
3263
3264 status_pause_layout_ = new TmpView();
3265 status_pause_layout_->SetLayout(new nux::HLayout());
3266 status_pause_layout_->GetLayout()->AddSpace(0, 1);
3267- status_pause_layout_->GetLayout()->AddView(status_pause, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
3268+ status_pause_layout_->GetLayout()->AddView(status_pause_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
3269 status_pause_layout_->GetLayout()->AddSpace(0, 1);
3270
3271 track_number_layout_ = new TmpView();
3272@@ -256,7 +262,7 @@
3273 track_status_layout_->SetActiveLayer(track_number_layout_);
3274
3275 title_layout_ = new nux::HLayout();
3276- title_layout_->SetLeftAndRightPadding(3);
3277+ title_layout_->SetLeftAndRightPadding(TITLE_PADDING.CP(scale));
3278 title_layout_->AddView(title_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
3279 title_layout_->AddSpace(0, 0);
3280
3281@@ -316,7 +322,7 @@
3282 progress_layer_->SetGeometry(geo_progress);
3283 nux::GetPainter().RenderSinglePaintLayer(gfx_engine, progress_layer_->GetGeometry(), progress_layer_.get());
3284 }
3285-
3286+
3287 gfx_engine.GetRenderStates().SetBlend(alpha, src, dest);
3288 }
3289
3290@@ -435,12 +441,29 @@
3291 track_status_layout_->SetMinimumWidth(geo.height);
3292 track_status_layout_->SetMaximumWidth(geo.height);
3293
3294- const int max_width = std::max(GetGeometry().width - geo.height - style.GetMusicDurationWidth() - layout_spacing*2, 0);
3295+ const int max_width = std::max(GetGeometry().width - geo.height - style.GetMusicDurationWidth().CP(scale) - LAYOUT_SPACING.CP(scale)*2, 0);
3296 title_->SetMaximumWidth(max_width);
3297
3298 View::PreLayoutManagement();
3299 }
3300
3301+void Track::UpdateScale(double scale)
3302+{
3303+ auto& style = Style::Instance();
3304+ int icon_size = style.GetStatusIconSize().CP(scale);
3305+ track_number_->SetScale(scale);
3306+ title_->SetScale(scale);
3307+ duration_->SetMaximumWidth(style.GetMusicDurationWidth().CP(scale));
3308+ duration_->SetMinimumWidth(style.GetMusicDurationWidth().CP(scale));
3309+ duration_->SetScale(scale);
3310+ title_layout_->SetLeftAndRightPadding(TITLE_PADDING.CP(scale));
3311+ status_play_->SetMinMaxSize(icon_size, icon_size);
3312+ status_pause_->SetMinMaxSize(icon_size, icon_size);
3313+
3314+ QueueRelayout();
3315+ QueueDraw();
3316+}
3317+
3318 } // namespace previews
3319 } // namespace dash
3320 } // namesapce unity
3321
3322=== modified file 'dash/previews/Track.h'
3323--- dash/previews/Track.h 2013-09-19 16:44:03 +0000
3324+++ dash/previews/Track.h 2014-07-09 10:31:56 +0000
3325@@ -55,18 +55,20 @@
3326
3327 void Update(dash::Track const& track_row);
3328
3329+ nux::Property<double> scale;
3330+
3331 protected:
3332 virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);
3333 virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);
3334 virtual void PreLayoutManagement();
3335 virtual nux::Area* FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type);
3336-
3337+
3338 // From debug::Introspectable
3339 std::string GetName() const;
3340 void AddProperties(debug::IntrospectionData&);
3341-
3342+
3343 virtual bool AcceptKeyNavFocus() { return false; }
3344-
3345+
3346 void SetupBackground();
3347 void SetupViews();
3348
3349@@ -97,9 +99,14 @@
3350 nux::View* status_pause_layout_;
3351 nux::View* track_number_layout_;
3352 nux::LayeredLayout* track_status_layout_;
3353+ IconTexture* status_play_;
3354+ IconTexture* status_pause_;
3355
3356 bool mouse_over_;
3357 connection::Wrapper player_connection_;
3358+
3359+private:
3360+ void UpdateScale(double scale);
3361 };
3362
3363 }
3364
3365=== modified file 'dash/previews/Tracks.cpp'
3366--- dash/previews/Tracks.cpp 2013-09-19 16:44:03 +0000
3367+++ dash/previews/Tracks.cpp 2014-07-09 10:31:56 +0000
3368@@ -34,12 +34,18 @@
3369 {
3370 namespace previews
3371 {
3372+
3373+namespace
3374+{
3375 DECLARE_LOGGER(logger, "unity.dash.preview.music.tracks");
3376+const RawPixel CHILDREN_SPACE = 1_em;
3377+}
3378
3379 NUX_IMPLEMENT_OBJECT_TYPE(Tracks);
3380
3381 Tracks::Tracks(dash::Tracks::Ptr tracks, NUX_FILE_LINE_DECL)
3382 : ScrollView(NUX_FILE_LINE_PARAM)
3383+ , scale(1.0)
3384 , tracks_(tracks)
3385 {
3386 SetupViews();
3387@@ -54,6 +60,8 @@
3388 for (std::size_t i = 0; i < tracks_->count.Get(); ++i)
3389 OnTrackAdded(tracks_->RowAtIndex(i));
3390 }
3391+ UpdateScale(scale);
3392+ scale.changed.connect(sigc::mem_fun(this, &Tracks::UpdateScale));
3393 }
3394
3395 std::string Tracks::GetName() const
3396@@ -72,8 +80,8 @@
3397 SetVScrollBar(new dash::PlacesOverlayVScrollBar(NUX_TRACKER_LOCATION));
3398 EnableHorizontalScrollBar(false);
3399 layout_ = new nux::VLayout();
3400- layout_->SetPadding(0, previews::Style::Instance().GetDetailsRightMargin(), 0, 0);
3401- layout_->SetSpaceBetweenChildren(1);
3402+ layout_->SetPadding(0, previews::Style::Instance().GetDetailsRightMargin().CP(scale), 0, 0);
3403+ layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
3404 SetLayout(layout_);
3405 }
3406
3407@@ -84,6 +92,7 @@
3408 return;
3409
3410 pos->second->Update(track_row);
3411+ pos->second->scale = scale();
3412 }
3413
3414 void Tracks::OnTrackAdded(dash::Track const& track_row)
3415@@ -100,8 +109,9 @@
3416 AddChild(track_view.GetPointer());
3417
3418 track_view->Update(track_row);
3419- track_view->SetMinimumHeight(style.GetTrackHeight());
3420- track_view->SetMaximumHeight(style.GetTrackHeight());
3421+ track_view->SetMinimumHeight(style.GetTrackHeight().CP(scale));
3422+ track_view->SetMaximumHeight(style.GetTrackHeight().CP(scale));
3423+ track_view->scale = scale();
3424 layout_->AddView(track_view.GetPointer(), 0);
3425
3426 m_tracks[track_uri] = track_view;
3427@@ -111,7 +121,7 @@
3428 void Tracks::OnTrackRemoved(dash::Track const& track_row)
3429 {
3430 LOG_TRACE(logger) << "OnTrackRemoved for " << track_row.title.Get();
3431-
3432+
3433 auto pos = m_tracks.find(track_row.uri.Get());
3434 if (pos == m_tracks.end())
3435 return;
3436@@ -121,6 +131,27 @@
3437 ComputeContentSize();
3438 }
3439
3440+void Tracks::UpdateScale(double scale)
3441+{
3442+ int track_height = Style::Instance().GetTrackHeight().CP(scale);
3443+
3444+ for (auto const& track : m_tracks)
3445+ {
3446+ track.second->SetMinimumHeight(track_height);
3447+ track.second->SetMaximumHeight(track_height);
3448+ track.second->scale = scale;
3449+ }
3450+
3451+ if (layout_)
3452+ {
3453+ layout_->SetPadding(0, Style::Instance().GetDetailsRightMargin().CP(scale), 0, 0);
3454+ layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
3455+ }
3456+
3457+ QueueRelayout();
3458+ QueueDraw();
3459+}
3460+
3461 } // namespace previews
3462 } // namespace dash
3463 } // namespace unity
3464
3465=== modified file 'dash/previews/Tracks.h'
3466--- dash/previews/Tracks.h 2013-09-19 16:44:03 +0000
3467+++ dash/previews/Tracks.h 2014-07-09 10:31:56 +0000
3468@@ -52,6 +52,8 @@
3469
3470 Tracks(dash::Tracks::Ptr tracks, NUX_FILE_LINE_PROTO);
3471
3472+ nux::Property<double> scale;
3473+
3474 protected:
3475 virtual bool AcceptKeyNavFocus() { return false; }
3476
3477@@ -71,6 +73,9 @@
3478 nux::VLayout* layout_;
3479 std::map<std::string, previews::Track::Ptr> m_tracks;
3480 connection::Manager sig_conn_;
3481+
3482+private:
3483+ void UpdateScale(double scale);
3484 };
3485
3486 }
3487
3488=== modified file 'unity-shared/CoverArt.cpp'
3489--- unity-shared/CoverArt.cpp 2014-06-13 08:03:39 +0000
3490+++ unity-shared/CoverArt.cpp 2014-07-09 10:31:56 +0000
3491@@ -43,6 +43,7 @@
3492 namespace
3493 {
3494 const RawPixel ICON_SIZE = 256_em;
3495+const RawPixel THUMBNAIL_SIZE = 512_em;
3496 const int IMAGE_TIMEOUT = 30;
3497 }
3498
3499@@ -136,7 +137,7 @@
3500
3501 void CoverArt::GenerateImage(std::string const& uri)
3502 {
3503- notifier_ = ThumbnailGenerator::Instance().GetThumbnail(uri, 512);
3504+ notifier_ = ThumbnailGenerator::Instance().GetThumbnail(uri, THUMBNAIL_SIZE.CP(scale));
3505 if (notifier_)
3506 {
3507 StartWaiting();
3508@@ -146,7 +147,7 @@
3509 else
3510 {
3511 StopWaiting();
3512- SetNoImageAvailable();
3513+ SetNoImageAvailable();
3514 }
3515 }
3516
3517@@ -170,7 +171,7 @@
3518 SetNoImageAvailable();
3519 return false;
3520 }));
3521-
3522+
3523 QueueDraw();
3524 }
3525
3526@@ -188,7 +189,7 @@
3527 GetLayout()->RemoveChildObject(overlay_text_);
3528 GetLayout()->AddView(overlay_text_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL, 100.0, nux::LayoutPosition(1));
3529 ComputeContentSize();
3530-
3531+
3532 QueueDraw();
3533 }
3534 }
3535@@ -223,7 +224,7 @@
3536 GetLayout()->RemoveChildObject(overlay_text_);
3537
3538 if (pixbuf_width == pixbuf_height)
3539- {
3540+ {
3541 // quick path for square icons
3542 texture_screenshot_.Adopt(nux::CreateTexture2DFromPixbuf(pixbuf, true));
3543 }
3544@@ -353,7 +354,7 @@
3545 if (image_aspect > base_apsect)
3546 {
3547 imageDest.SetHeight(float(imageDest.GetWidth()) / image_aspect);
3548- }
3549+ }
3550 if (image_aspect < base_apsect)
3551 {
3552 imageDest.SetWidth(image_aspect * imageDest.GetHeight());
3553@@ -364,16 +365,10 @@
3554 imageDest = nux::Geometry(0, 0, texture_screenshot_->GetWidth(), texture_screenshot_->GetHeight());
3555 }
3556
3557-
3558 texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_SCALE_COORD);
3559 texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
3560 texxform.SetFilter(nux::TEXFILTER_LINEAR, nux::TEXFILTER_LINEAR);
3561
3562- texxform.u0 = 0;
3563- texxform.v0 = 0;
3564- texxform.u1 = imageDest.width;
3565- texxform.v1 = imageDest.height;
3566-
3567 gfx_engine.QRP_1Tex(base.x + (float(base.GetWidth() - imageDest.GetWidth()) / 2),
3568 base.y + (float(base.GetHeight() - imageDest.GetHeight()) / 2),
3569 imageDest.width,
3570@@ -387,15 +382,15 @@
3571 if (waiting_)
3572 {
3573 nux::TexCoordXForm texxform;
3574- texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
3575- texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
3576- texxform.min_filter = nux::TEXFILTER_LINEAR;
3577- texxform.mag_filter = nux::TEXFILTER_LINEAR;
3578+ texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_SCALE_COORD);
3579+ texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
3580+ texxform.SetFilter(nux::TEXFILTER_LINEAR, nux::TEXFILTER_LINEAR);
3581
3582- nux::Geometry spin_geo(base.x + ((base.width - spin_->GetWidth()) / 2),
3583- base.y + ((base.height - spin_->GetHeight()) / 2),
3584- spin_->GetWidth(),
3585- spin_->GetHeight());
3586+ nux::Size spin_size(RawPixel(spin_->GetWidth()).CP(scale), RawPixel(spin_->GetHeight()).CP(scale));
3587+ nux::Geometry spin_geo(base.x + ((base.width - spin_size.width) / 2),
3588+ base.y + ((base.height - spin_size.height) / 2),
3589+ spin_size.width,
3590+ spin_size.height);
3591 // Geometry (== Rect) uses integers which were rounded above,
3592 // hence an extra 0.5 offset for odd sizes is needed
3593 // because pure floating point is not being used.
3594@@ -429,7 +424,7 @@
3595 }
3596 }
3597 }
3598-
3599+
3600 gfx_engine.GetRenderStates().SetBlend(alpha, src, dest);
3601
3602 if (GetLayout())
3603@@ -453,6 +448,7 @@
3604 overlay_text_->SetTextAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
3605 overlay_text_->SetFont("Ubuntu 14");
3606 overlay_text_->SetLines(-3);
3607+ overlay_text_->SetScale(scale);
3608 overlay_text_->SetText(_("No Image Available"));
3609
3610 dash::Style& style = dash::Style::Instance();
3611
3612=== modified file 'unity-shared/DashStyle.cpp'
3613--- unity-shared/DashStyle.cpp 2014-03-21 04:06:28 +0000
3614+++ unity-shared/DashStyle.cpp 2014-07-09 10:31:56 +0000
3615@@ -92,6 +92,16 @@
3616 }
3617 }
3618
3619+template <typename T>
3620+inline void get_actual_cairo_size(cairo_t* cr, T* width, T* height)
3621+{
3622+ double w_scale, h_scale;
3623+ auto* surface = cairo_get_target(cr);
3624+ cairo_surface_get_device_scale(surface, &w_scale, &h_scale);
3625+ *width = cairo_image_surface_get_width(surface) / w_scale;
3626+ *height = cairo_image_surface_get_height(surface) / h_scale;
3627+}
3628+
3629 class LazyLoadTexture
3630 {
3631 public:
3632@@ -682,9 +692,8 @@
3633 cairo_surface_flush(surface);
3634
3635 pixels = cairo_image_surface_get_data(surface);
3636- width = cairo_image_surface_get_width(surface);
3637- height = cairo_image_surface_get_height(surface);
3638 format = cairo_image_surface_get_format(surface);
3639+ get_actual_cairo_size(cr, &width, &height);
3640
3641 switch (format)
3642 {
3643@@ -782,8 +791,8 @@
3644 {
3645 double x = 0.0;
3646 double y = 0.0;
3647- double w = cairo_image_surface_get_width(cairo_get_target(cr));
3648- double h = cairo_image_surface_get_height(cairo_get_target(cr));
3649+ double w, h;
3650+ get_actual_cairo_size(cr, &w, &h);
3651 /*double xt = 0.0;
3652 double yt = 0.0;*/
3653
3654@@ -830,8 +839,11 @@
3655 {
3656 double x = 2.0;
3657 double y = 2.0;
3658- double w = cairo_image_surface_get_width(cairo_get_target(cr)) - 4.0;
3659- double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;
3660+
3661+ double w, h;
3662+ get_actual_cairo_size(cr, &w, &h);
3663+ w -= 4.0;
3664+ h -= 4.0;
3665
3666 // - these absolute values are the "cost" of getting only a SVG from design
3667 // and not a generic formular how to approximate the curve-shape, thus
3668@@ -1212,8 +1224,10 @@
3669 {
3670 double x = 0.0;
3671 double y = 2.0;
3672- double w = cairo_image_surface_get_width(cairo_get_target(cr));
3673- double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;
3674+
3675+ double w, h;
3676+ get_actual_cairo_size(cr, &w, &h);
3677+ h -= 4.0;
3678
3679 // - these absolute values are the "cost" of getting only a SVG from design
3680 // and not a generic formular how to approximate the curve-shape, thus
3681@@ -1446,9 +1460,7 @@
3682 gchar* fontName = NULL;
3683 //double horizMargin = 10.0;
3684
3685- w = cairo_image_surface_get_width(cairo_get_target(cr));
3686- h = cairo_image_surface_get_height(cairo_get_target(cr));
3687-
3688+ get_actual_cairo_size(cr, &w, &h);
3689 w -= 2 * horizMargin;
3690
3691 if (!screen)
3692@@ -1577,6 +1589,8 @@
3693 const unsigned char* data = NULL;
3694 int width = 0;
3695 int height = 0;
3696+ double w_scale = 0;
3697+ double h_scale = 0;
3698 int stride = 0;
3699 unsigned char* buffer = NULL;
3700 cairo_surface_t* surface = NULL;
3701@@ -1586,9 +1600,9 @@
3702 // aquire info about image-surface
3703 target = cairo_get_target(cr);
3704 data = cairo_image_surface_get_data(target);
3705- width = cairo_image_surface_get_width(target);
3706- height = cairo_image_surface_get_height(target);
3707 stride = cairo_image_surface_get_stride(target);
3708+ get_actual_cairo_size(cr, &width, &height);
3709+ cairo_surface_get_device_scale(target, &w_scale, &h_scale);
3710 cairo_format_t format = cairo_image_surface_get_format(target);
3711
3712 // get buffer
3713@@ -1621,6 +1635,7 @@
3714 }
3715
3716 // blur and blend overlay onto initial image-surface
3717+ cairo_surface_set_device_scale(surface, w_scale, h_scale);
3718 Blur(blurred_cr, blurSize);
3719 cairo_set_source_surface(cr, surface, 0.0, 0.0);
3720 old = SetBlendMode(cr, mode);
3721@@ -1649,8 +1664,8 @@
3722 garnish = GetButtonGarnishSize();
3723
3724 //ButtonOutlinePath(cr, true);
3725- double w = cairo_image_surface_get_width(cairo_get_target(cr));
3726- double h = cairo_image_surface_get_height(cairo_get_target(cr));
3727+ double w, h;
3728+ get_actual_cairo_size(cr, &w, &h);
3729
3730 cairo_set_line_width(cr, pimpl->button_label_border_size_[state]);
3731
3732@@ -1743,8 +1758,8 @@
3733 if (zeromargin == false)
3734 garnish = GetButtonGarnishSize();
3735
3736- double w = cairo_image_surface_get_width(cairo_get_target(cr));
3737- double h = cairo_image_surface_get_height(cairo_get_target(cr));
3738+ double w, h;
3739+ get_actual_cairo_size(cr, &w, &h);
3740
3741 double x = garnish;
3742 double y = garnish;
3743@@ -1854,8 +1869,8 @@
3744 if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
3745 return false;
3746
3747- double w = cairo_image_surface_get_width(cairo_get_target(cr));
3748- double h = cairo_image_surface_get_height(cairo_get_target(cr));
3749+ double w, h;
3750+ get_actual_cairo_size(cr, &w, &h);
3751
3752 nux::Color color(nux::color::White);
3753 color.alpha = alpha;
3754@@ -1891,10 +1906,11 @@
3755 return false;
3756
3757 //ButtonOutlinePathSegment(cr, segment);
3758- double x = 0.0;
3759- double y = 2.0;
3760- double w = cairo_image_surface_get_width(cairo_get_target(cr));
3761- double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;
3762+ double x = 0.0;
3763+ double y = 2.0;
3764+ double w, h;
3765+ get_actual_cairo_size(cr, &w, &h);
3766+ h -= 4.0;
3767
3768 if (segment == Segment::LEFT)
3769 {
3770@@ -1969,8 +1985,9 @@
3771
3772 double x = 0.0;
3773 double y = 2.0;
3774- double w = cairo_image_surface_get_width(cairo_get_target(cr));
3775- double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;
3776+ double w, h;
3777+ get_actual_cairo_size(cr, &w, &h);
3778+ h -= 4.0;
3779
3780 if (segment == Segment::LEFT)
3781 {
3782@@ -2062,8 +2079,8 @@
3783 if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
3784 return false;
3785
3786- double w = cairo_image_surface_get_width(cairo_get_target(cr));
3787- double h = cairo_image_surface_get_height(cairo_get_target(cr));
3788+ double w, h;
3789+ get_actual_cairo_size(cr, &w, &h);
3790 double x = w / 2.0;
3791 double y = 2.0;
3792
3793@@ -2090,8 +2107,8 @@
3794 if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
3795 return false;
3796
3797- double w = cairo_image_surface_get_width(cairo_get_target(cr));
3798- double h = cairo_image_surface_get_height(cairo_get_target(cr));
3799+ double w, h;
3800+ get_actual_cairo_size(cr, &w, &h);
3801 double x = 2.0;
3802 double y = h / 2.0;
3803
3804
3805=== modified file 'unity-shared/IconTexture.cpp'
3806--- unity-shared/IconTexture.cpp 2014-03-01 22:51:41 +0000
3807+++ unity-shared/IconTexture.cpp 2014-07-09 10:31:56 +0000
3808@@ -226,37 +226,27 @@
3809 if (_draw_mode == DrawMode::STRETCH_WITH_ASPECT)
3810 {
3811 nux::Geometry imageDest = geo;
3812-
3813- float geo_apsect = float(geo.GetWidth()) / geo.GetHeight();
3814+
3815+ float geo_apsect = float(geo.width) / geo.width;
3816 float image_aspect = float(_texture_cached->GetWidth()) / _texture_cached->GetHeight();
3817
3818 if (image_aspect > geo_apsect)
3819 {
3820 imageDest.SetHeight(float(imageDest.GetWidth()) / image_aspect);
3821- }
3822+ }
3823 if (image_aspect < geo_apsect)
3824 {
3825 imageDest.SetWidth(image_aspect * imageDest.GetHeight());
3826 }
3827- else
3828- {
3829- imageDest = nux::Geometry(0, 0, _texture_cached->GetWidth(), _texture_cached->GetHeight());
3830- }
3831
3832 texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_SCALE_COORD);
3833 texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
3834 texxform.SetFilter(nux::TEXFILTER_LINEAR, nux::TEXFILTER_LINEAR);
3835
3836- texxform.u0 = 0;
3837- texxform.v0 = 0;
3838- texxform.u1 = imageDest.width;
3839- texxform.v1 = imageDest.height;
3840-
3841- int border_width = 1;
3842- GfxContext.QRP_1Tex(geo.x + (float(geo.GetWidth() - imageDest.GetWidth()) / 2) + border_width,
3843- geo.y + (float(geo.GetHeight() - imageDest.GetHeight()) / 2) + border_width,
3844- imageDest.width - (border_width * 2),
3845- imageDest.height - (border_width * 2),
3846+ GfxContext.QRP_1Tex(geo.x + (float(geo.GetWidth() - imageDest.GetWidth()) / 2),
3847+ geo.y + (float(geo.GetHeight() - imageDest.GetHeight()) / 2),
3848+ imageDest.width,
3849+ imageDest.height,
3850 _texture_cached.GetPointer()->GetDeviceTexture(),
3851 texxform,
3852 col);
3853
3854=== modified file 'unity-shared/PreviewStyle.cpp'
3855--- unity-shared/PreviewStyle.cpp 2014-06-10 13:36:04 +0000
3856+++ unity-shared/PreviewStyle.cpp 2014-07-09 10:31:56 +0000
3857@@ -290,7 +290,7 @@
3858
3859 RawPixel Style::GetStatusIconSize() const
3860 {
3861- return 12_em;
3862+ return 10_em;
3863 }
3864
3865 std::string Style::payment_title_font() const
3866
3867=== modified file 'unity-shared/SearchBar.cpp'
3868--- unity-shared/SearchBar.cpp 2014-04-01 12:48:57 +0000
3869+++ unity-shared/SearchBar.cpp 2014-07-09 10:31:56 +0000
3870@@ -42,6 +42,7 @@
3871 const float DEFAULT_ICON_OPACITY = 1.0f;
3872 const int DEFAULT_LIVE_SEARCH_TIMEOUT = 40;
3873 const int SPINNER_TIMEOUT = 100;
3874+const int CORNER_RADIUS = 5;
3875
3876 const RawPixel SPACE_BETWEEN_SPINNER_AND_TEXT = 5_em;
3877 const RawPixel SPACE_BETWEEN_ENTRY_AND_HIGHLIGHT = 10_em;
3878@@ -150,12 +151,13 @@
3879 layout_->AddLayout(entry_layout_);
3880
3881 spinner_ = new SearchBarSpinner();
3882+ spinner_->scale = scale();
3883 spinner_->mouse_click.connect(sigc::mem_fun(this, &SearchBar::OnClearClicked));
3884 entry_layout_->AddView(spinner_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
3885
3886 nux::HLayout* hint_layout = new nux::HLayout(NUX_TRACKER_LOCATION);
3887
3888- hint_ = new StaticCairoText(" ");
3889+ hint_ = new StaticCairoText("");
3890 hint_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 0.5f));
3891 hint_->SetFont(HINT_LABEL_DEFAULT_FONT.c_str());
3892 hint_layout->AddView(hint_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
3893@@ -190,6 +192,7 @@
3894 show_filters_->SetFont(SHOW_FILTERS_LABEL_DEFAULT_FONT.c_str());
3895 show_filters_->SetTextColor(nux::color::White);
3896 show_filters_->SetTextAlignment(StaticCairoText::NUX_ALIGN_RIGHT);
3897+ show_filters_->SetScale(scale);
3898 show_filters_->SetLines(-1);
3899
3900 nux::BaseTexture* arrow;
3901@@ -288,11 +291,6 @@
3902
3903 void SearchBar::UpdateSearchBarSize()
3904 {
3905- dash::Style& style = dash::Style::Instance();
3906- nux::BaseTexture* icon = style.GetSearchMagnifyIcon();
3907- RawPixel const icon_width = icon->GetWidth();
3908- RawPixel const icon_height = icon->GetHeight();
3909-
3910 layout_->SetLeftAndRightPadding(LEFT_INTERNAL_PADDING.CP(scale()),
3911 SEARCH_ENTRY_RIGHT_BORDER.CP(scale()));
3912 layout_->SetSpaceBetweenChildren(SPACE_BETWEEN_ENTRY_AND_HIGHLIGHT.CP(scale()));
3913@@ -300,7 +298,6 @@
3914 entry_layout_->SetLeftAndRightPadding(LEFT_PADDING.CP(scale()),
3915 RIGHT_PADDING.CP(scale()));
3916
3917- spinner_->SetMinMaxSize(icon_width.CP(scale()), icon_height.CP(scale()));
3918 entry_layout_->SetSpaceBetweenChildren(SPACE_BETWEEN_SPINNER_AND_TEXT.CP(scale()));
3919
3920 pango_entry_->SetFontSize(PANGO_ENTRY_FONT_SIZE.CP(scale()));
3921@@ -331,7 +328,10 @@
3922
3923 void SearchBar::UpdateScale(double scale)
3924 {
3925+ hint_->SetMinimumSize(nux::AREA_MIN_WIDTH, nux::AREA_MIN_HEIGHT);
3926+ hint_->SetMaximumSize(nux::AREA_MAX_WIDTH, nux::AREA_MAX_HEIGHT);
3927 hint_->SetScale(scale);
3928+ spinner_->scale = scale;
3929
3930 if (show_filters_)
3931 show_filters_->SetScale(scale);
3932@@ -541,7 +541,6 @@
3933
3934 void SearchBar::UpdateBackground(bool force)
3935 {
3936- RawPixel const RADIUS = 5;
3937 nux::Geometry geo(GetGeometry());
3938 geo.width = layered_layout_->GetAbsoluteX() +
3939 layered_layout_->GetAbsoluteWidth() -
3940@@ -564,12 +563,13 @@
3941
3942 nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, last_width_, last_height_);
3943 cairo_t* cr = cairo_graphics.GetInternalContext();
3944+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
3945
3946 cairo_graphics.DrawRoundedRectangle(cr,
3947 1.0f,
3948 0.5, 0.5,
3949- RADIUS.CP(scale()),
3950- last_width_ - 1, last_height_ - 1,
3951+ CORNER_RADIUS,
3952+ (last_width_/scale) - 1, (last_height_/scale) - 1,
3953 false);
3954
3955 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
3956
3957=== modified file 'unity-shared/SearchBarSpinner.cpp'
3958--- unity-shared/SearchBarSpinner.cpp 2013-11-19 18:48:35 +0000
3959+++ unity-shared/SearchBarSpinner.cpp 2014-07-09 10:31:56 +0000
3960@@ -22,6 +22,7 @@
3961 #include <Nux/VLayout.h>
3962
3963 #include "unity-shared/DashStyle.h"
3964+#include "unity-shared/RawPixel.h"
3965
3966 namespace unity
3967 {
3968@@ -29,10 +30,11 @@
3969 NUX_IMPLEMENT_OBJECT_TYPE(SearchBarSpinner);
3970
3971 SearchBarSpinner::SearchBarSpinner()
3972- : nux::View(NUX_TRACKER_LOCATION),
3973- state_(STATE_READY),
3974- search_timeout_(-1),
3975- rotation_(0.0f)
3976+ : nux::View(NUX_TRACKER_LOCATION)
3977+ , scale(1.0)
3978+ , state_(STATE_READY)
3979+ , search_timeout_(-1)
3980+ , rotation_(0.0f)
3981 {
3982 dash::Style& style = dash::Style::Instance();
3983
3984@@ -43,10 +45,18 @@
3985
3986 rotate_.Identity();
3987 rotate_.Rotate_z(0.0);
3988-}
3989-
3990-void
3991-SearchBarSpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
3992+ UpdateScale(scale);
3993+
3994+ scale.changed.connect(sigc::mem_fun(this, &SearchBarSpinner::UpdateScale));
3995+}
3996+
3997+void SearchBarSpinner::UpdateScale(double scale)
3998+{
3999+ SetMinMaxSize(RawPixel(magnify_->GetWidth()).CP(scale), RawPixel(magnify_->GetHeight()).CP(scale));
4000+ QueueDraw();
4001+}
4002+
4003+void SearchBarSpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
4004 {
4005 nux::Geometry const& geo = GetGeometry();
4006 nux::TexCoordXForm texxform;
4007@@ -55,10 +65,9 @@
4008
4009 nux::GetPainter().PaintBackground(GfxContext, geo);
4010
4011- texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
4012- texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
4013- texxform.min_filter = nux::TEXFILTER_LINEAR;
4014- texxform.mag_filter = nux::TEXFILTER_LINEAR;
4015+ texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_SCALE_COORD);
4016+ texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
4017+ texxform.SetFilter(nux::TEXFILTER_LINEAR, nux::TEXFILTER_LINEAR);
4018
4019 unsigned int current_alpha_blend;
4020 unsigned int current_src_blend_factor;
4021@@ -68,20 +77,25 @@
4022
4023 if (state_ == STATE_READY)
4024 {
4025- GfxContext.QRP_1Tex(geo.x + ((geo.width - magnify_->GetWidth()) / 2),
4026- geo.y + ((geo.height - magnify_->GetHeight()) / 2),
4027- magnify_->GetWidth(),
4028- magnify_->GetHeight(),
4029+ nux::Size magnifier_size(RawPixel(magnify_->GetWidth()).CP(scale),
4030+ RawPixel(magnify_->GetHeight()).CP(scale));
4031+
4032+ GfxContext.QRP_1Tex(geo.x + ((geo.width - magnifier_size.width) / 2),
4033+ geo.y + ((geo.height - magnifier_size.height) / 2),
4034+ magnifier_size.width,
4035+ magnifier_size.height,
4036 magnify_->GetDeviceTexture(),
4037 texxform,
4038 nux::color::White);
4039 }
4040 else if (state_ == STATE_SEARCHING)
4041 {
4042- nux::Geometry spin_geo(geo.x + ((geo.width - spin_->GetWidth()) / 2),
4043- geo.y + ((geo.height - spin_->GetHeight()) / 2),
4044- spin_->GetWidth(),
4045- spin_->GetHeight());
4046+ nux::Size spin_size(RawPixel(spin_->GetWidth()).CP(scale),
4047+ RawPixel(spin_->GetHeight()).CP(scale));
4048+ nux::Geometry spin_geo(geo.x + ((geo.width - spin_size.width) / 2),
4049+ geo.y + ((geo.height - spin_size.height) / 2),
4050+ spin_size.width,
4051+ spin_size.height);
4052 // Geometry (== Rect) uses integers which were rounded above,
4053 // hence an extra 0.5 offset for odd sizes is needed
4054 // because pure floating point is not being used.
4055@@ -110,18 +124,22 @@
4056 }
4057 else
4058 {
4059- GfxContext.QRP_1Tex(geo.x + ((geo.width - circle_->GetWidth()) / 2),
4060- geo.y + ((geo.height - circle_->GetHeight()) / 2),
4061- circle_->GetWidth(),
4062- circle_->GetHeight(),
4063+ nux::Size circle_size(RawPixel(circle_->GetWidth()).CP(scale),
4064+ RawPixel(circle_->GetHeight()).CP(scale));
4065+ GfxContext.QRP_1Tex(geo.x + ((geo.width - circle_size.width) / 2),
4066+ geo.y + ((geo.height - circle_size.height) / 2),
4067+ circle_size.width,
4068+ circle_size.height,
4069 circle_->GetDeviceTexture(),
4070 texxform,
4071 nux::color::White);
4072
4073- GfxContext.QRP_1Tex(geo.x + ((geo.width - close_->GetWidth()) / 2),
4074- geo.y + ((geo.height - close_->GetHeight()) / 2),
4075- close_->GetWidth(),
4076- close_->GetHeight(),
4077+ nux::Size close_size(RawPixel(close_->GetWidth()).CP(scale),
4078+ RawPixel(close_->GetHeight()).CP(scale));
4079+ GfxContext.QRP_1Tex(geo.x + ((geo.width - close_size.width) / 2),
4080+ geo.y + ((geo.height - close_size.height) / 2),
4081+ close_size.width,
4082+ close_size.height,
4083 close_->GetDeviceTexture(),
4084 texxform,
4085 nux::color::White);
4086
4087=== modified file 'unity-shared/SearchBarSpinner.h'
4088--- unity-shared/SearchBarSpinner.h 2013-09-19 16:44:03 +0000
4089+++ unity-shared/SearchBarSpinner.h 2014-07-09 10:31:56 +0000
4090@@ -44,6 +44,8 @@
4091 public:
4092 SearchBarSpinner();
4093
4094+ nux::Property<double> scale;
4095+
4096 void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
4097 void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
4098
4099@@ -62,6 +64,7 @@
4100
4101 private:
4102 bool OnFrameTimeout();
4103+ void UpdateScale(double);
4104
4105 SpinnerState state_;
4106
4107
4108=== modified file 'unity-shared/UnitySettings.cpp'
4109--- unity-shared/UnitySettings.cpp 2014-03-31 18:57:43 +0000
4110+++ unity-shared/UnitySettings.cpp 2014-07-09 10:31:56 +0000
4111@@ -59,6 +59,7 @@
4112 const std::string GNOME_TEXT_SCALE_FACTOR = "text-scaling-factor";
4113
4114 const int DEFAULT_LAUNCHER_WIDTH = 64;
4115+const int MINIMUM_DESKTOP_HEIGHT = 800;
4116 const double DEFAULT_DPI = 96.0f;
4117 }
4118
4119@@ -89,9 +90,6 @@
4120 for (unsigned i = 0; i < monitors::MAX; ++i)
4121 em_converters_.emplace_back(std::make_shared<EMConverter>());
4122
4123- CacheFormFactor();
4124- CacheDoubleClickActivate();
4125-
4126 // The order is important here, DPI is the last thing to be updated
4127 UpdateLimSetting();
4128 UpdateTextScaleFactor();
4129@@ -99,6 +97,9 @@
4130 UpdateFontSize();
4131 UpdateDPI();
4132
4133+ CacheFormFactor();
4134+ CacheDoubleClickActivate();
4135+
4136 UScreen::GetDefault()->changed.connect(sigc::hide(sigc::hide(sigc::mem_fun(this, &Impl::UpdateDPI))));
4137
4138 signals_.Add<void, GSettings*, const gchar*>(usettings_, "changed::" + FORM_FACTOR, [this] (GSettings*, const gchar*) {
4139@@ -162,10 +163,11 @@
4140 if (raw_from_factor == 0) //Automatic
4141 {
4142 auto uscreen = UScreen::GetDefault();
4143- int primary_monitor = uscreen->GetMonitorWithMouse();
4144+ int primary_monitor = uscreen->GetPrimaryMonitor();
4145 auto const& geo = uscreen->GetMonitorGeometry(primary_monitor);
4146+ double monitor_scaling = em(primary_monitor)->DPIScale();
4147
4148- new_form_factor = geo.height > 799 ? FormFactor::DESKTOP : FormFactor::NETBOOK;
4149+ new_form_factor = (geo.height * monitor_scaling) >= MINIMUM_DESKTOP_HEIGHT ? FormFactor::DESKTOP : FormFactor::NETBOOK;
4150 }
4151 else
4152 {
4153@@ -239,6 +241,17 @@
4154 cursor_scale_ = g_settings_get_double(ui_settings_, CURSOR_SCALE_FACTOR.c_str());
4155 }
4156
4157+ EMConverter::Ptr const& em(int monitor) const
4158+ {
4159+ if (monitor < 0 || monitor >= (int)monitors::MAX)
4160+ {
4161+ LOG_ERROR(logger) << "Invalid monitor index: " << monitor << ". Returning index 0 monitor instead.";
4162+ return em_converters_[0];
4163+ }
4164+
4165+ return em_converters_[monitor];
4166+ }
4167+
4168 void UpdateDPI()
4169 {
4170 auto* uscreen = UScreen::GetDefault();
4171@@ -361,13 +374,7 @@
4172
4173 EMConverter::Ptr const& Settings::em(int monitor) const
4174 {
4175- if (monitor < 0 || monitor >= (int)monitors::MAX)
4176- {
4177- LOG_ERROR(logger) << "Invalid monitor index: " << monitor << ". Returning index 0 monitor instead.";
4178- return pimpl->em_converters_[0];
4179- }
4180-
4181- return pimpl->em_converters_[monitor];
4182+ return pimpl->em(monitor);
4183 }
4184
4185 void Settings::SetLauncherWidth(int launcher_width, int monitor)