Merge lp:~hikiko/unity/unity.scale-track into lp:unity

Proposed by Eleni Maria Stea
Status: Merged
Merged at revision: 3839
Proposed branch: lp:~hikiko/unity/unity.scale-track
Merge into: lp:unity
Prerequisite: lp:~hikiko/unity/unity.scale-social-preview
Diff against target: 2316 lines (+479/-330)
34 files modified
dash/DashView.cpp (+48/-46)
dash/DashView.h (+3/-2)
dash/PlacesGroup.cpp (+13/-9)
dash/StandaloneDash.cpp (+37/-18)
dash/previews/ActionButton.cpp (+9/-11)
dash/previews/ActionLink.h (+0/-1)
dash/previews/ApplicationPreview.cpp (+30/-14)
dash/previews/GenericPreview.cpp (+4/-3)
dash/previews/MusicPreview.cpp (+16/-6)
dash/previews/MusicPreview.h (+1/-0)
dash/previews/PaymentPreview.cpp (+2/-3)
dash/previews/Preview.cpp (+3/-6)
dash/previews/PreviewContainer.cpp (+24/-13)
dash/previews/PreviewContainer.h (+4/-1)
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 (+31/-16)
dash/previews/SocialPreview.h (+1/-0)
dash/previews/SocialPreviewComments.cpp (+41/-72)
dash/previews/SocialPreviewComments.h (+1/-16)
dash/previews/SocialPreviewContent.cpp (+15/-12)
dash/previews/SocialPreviewContent.h (+2/-3)
dash/previews/StandaloneMusicPaymentPreview.cpp (+1/-3)
dash/previews/StandaloneSocialPreview.cpp (+2/-2)
dash/previews/Track.cpp (+54/-15)
dash/previews/Track.h (+10/-3)
dash/previews/Tracks.cpp (+36/-5)
dash/previews/Tracks.h (+5/-0)
unity-shared/CoverArt.cpp (+1/-0)
unity-shared/DashStyle.cpp (+46/-29)
unity-shared/IconTexture.cpp (+3/-7)
To merge this branch: bzr merge lp:~hikiko/unity/unity.scale-track
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Marco Trevisan (Treviño) Pending
Unity Team Pending
Review via email: mp+225336@code.launchpad.net

Commit message

Scaled tracks, navigator, fixed bugs in all previews

Description of the change

Scaled tracks, navigator, fixed bugs in all previews

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~hikiko/unity/unity.scale-track updated
3851. By Eleni Maria Stea

fixed problems in SocialPreview

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~hikiko/unity/unity.scale-track updated
3852. By Eleni Maria Stea

merged music preview changes
(removed unnecessary check in DashView)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~hikiko/unity/unity.scale-track updated
3853. By Eleni Maria Stea

merged marco's fix for social previews:
lp:~3v1n0/unity/previews-scaling-improved

3854. By Eleni Maria Stea

fixed accidentally introduced compile error

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~hikiko/unity/unity.scale-track updated
3855. By Eleni Maria Stea

merged fix for lp:~3v1n0/unity/previews-scaling-improved

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~hikiko/unity/unity.scale-track updated
3856. By Eleni Maria Stea

more fixes

3857. By Eleni Maria Stea

patched UnitySettings

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

There were some issues here as well, as shown in comments.

BTW I've fixed them all in the shared branch lp:~unity-team/unity/previews-scaling-final which contains a lot of other fixes for the dash scaling.

lp:~hikiko/unity/unity.scale-track updated
3858. By Eleni Maria Stea

added fixes (local merge)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~hikiko/unity/unity.scale-track updated
3859. By Eleni Maria Stea

reverted revno 3857 changes

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/DashView.cpp'
2--- dash/DashView.cpp 2014-07-08 09:48:09 +0000
3+++ dash/DashView.cpp 2014-07-08 09:48:09 +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@@ -238,7 +241,7 @@
47 preview_container_->SetParentObject(this);
48 }
49 preview_container_->Preview(model, previews::Navigation::NONE); // no swipe left or right
50- preview_container_->scale = cv_->DPIScale();
51+ preview_container_->scale = scale();
52 preview_container_->SetGeometry(scopes_layout_->GetGeometry());
53 preview_displaying_ = true;
54
55@@ -263,12 +266,9 @@
56 }
57 else
58 {
59- if (preview_container_)
60- {
61- // got a new preview whilst already displaying, we probably clicked a navigation button.
62- preview_container_->Preview(model, preview_navigation_mode_); // TODO
63- preview_container_->scale = cv_->DPIScale();
64- }
65+ // got a new preview whilst already displaying, we probably clicked a navigation button.
66+ preview_container_->Preview(model, preview_navigation_mode_); // TODO
67+ preview_container_->scale = scale();
68 }
69
70 if (G_LIKELY(preview_state_machine_.left_results() > 0 && preview_state_machine_.right_results() > 0))
71@@ -470,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@@ -551,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@@ -580,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@@ -591,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@@ -605,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@@ -641,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@@ -679,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@@ -813,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@@ -837,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@@ -855,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@@ -879,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@@ -913,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@@ -1146,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@@ -1289,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@@ -1528,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-08 09:48:09 +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-08 09:48:09 +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@@ -189,11 +187,11 @@
326 _expand_label->SetTextColor(kExpandDefaultTextColor);
327 _expand_label_layout->AddView(_expand_label, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
328
329- _expand_icon = new IconTexture(arrow, arrow->GetWidth(), arrow->GetHeight());
330+ _expand_icon = new IconTexture(_style.GetGroupExpandIcon());
331+ _expand_icon->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
332 _expand_icon->SetOpacity(kExpandDefaultIconOpacity);
333- _expand_icon->SetMinimumSize(arrow->GetWidth(), arrow->GetHeight());
334 _expand_icon->SetVisible(false);
335- _expand_layout->AddView(_expand_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
336+ _expand_layout->AddView(_expand_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
337
338 SetLayout(_group_layout);
339
340@@ -231,6 +229,7 @@
341 _space_layout->SetMaximumSize(top_space, top_space);
342
343 _header_layout->SetSpaceBetweenChildren(SPACE_BETWEEN_CHILDREN.CP(scale()));
344+ _header_layout->SetLeftAndRightPadding(RawPixel(_style.GetCategoryHeaderLeftPadding()).CP(scale), 0);
345
346 _icon->SetMinMaxSize(icon_size.CP(scale()), icon_size.CP(scale()));
347
348@@ -244,12 +243,15 @@
349 RawPixel const icon_size = _style.GetCategoryIconSize();
350
351 _name->SetScale(scale);
352+ auto const& name_extents = _name->GetTextExtents();
353+ _name->SetMinMaxSize(name_extents.width, name_extents.height);
354 _expand_label->SetScale(scale);
355
356 _icon->SetSize(icon_size.CP(scale));
357 _icon->ReLoadIcon();
358
359- // FIXME _expand_icon, needs some work here. Not as easy as _icon
360+ auto const& arrow = _expand_icon->texture();
361+ _expand_icon->SetMinMaxSize(RawPixel(arrow->GetWidth()).CP(scale), RawPixel(arrow->GetHeight()).CP(scale));
362
363 if (_child_view)
364 _child_view->scale = scale;
365@@ -279,7 +281,6 @@
366
367 void
368
369-// FIXME _expand_icon, needs some work here. Not as easy as _icon
370 PlacesGroup::SetName(std::string const& name)
371 {
372 if (_cached_name != name)
373@@ -310,7 +311,7 @@
374 void
375 PlacesGroup::SetIcon(std::string const& path_to_emblem)
376 {
377- _icon->SetByIconName(path_to_emblem, _style.GetCategoryIconSize());
378+ _icon->SetByIconName(path_to_emblem, RawPixel(_style.GetCategoryIconSize()).CP(scale));
379 }
380
381 void
382@@ -462,7 +463,7 @@
383 // only the width matters
384 if (_cached_geometry.GetWidth() != geo.GetWidth())
385 {
386- _focus_layer.reset(_style.FocusOverlay(geo.width -
387+ _focus_layer.reset(_style.FocusOverlay(geo.width -
388 kHighlightLeftPadding.CP(scale()) -
389 kHighlightRightPadding.CP(scale()),
390 kHighlightHeight.CP(scale())));
391@@ -595,6 +596,9 @@
392 else
393 _expand_icon->SetTexture(_style.GetGroupExpandIcon());
394
395+ auto const& tex = _expand_icon->texture();
396+ _expand_icon->SetMinMaxSize(RawPixel(tex->GetWidth()).CP(scale), RawPixel(tex->GetHeight()).CP(scale));
397+
398 expanded.emit(this);
399 }
400
401
402=== modified file 'dash/StandaloneDash.cpp'
403--- dash/StandaloneDash.cpp 2014-02-28 23:32:05 +0000
404+++ dash/StandaloneDash.cpp 2014-07-08 09:48:09 +0000
405@@ -36,47 +36,50 @@
406 #include "unity-shared/DashStyle.h"
407 #include "unity-shared/PanelStyle.h"
408 #include "unity-shared/ThumbnailGenerator.h"
409-#include "UnityCore/GSettingsScopes.h"
410+#include "unity-shared/UBusMessages.h"
411+#include "unity-shared/UBusServer.h"
412+#include <UnityCore/GSettingsScopes.h>
413+#include <UnityCore/ScopeProxyInterface.h>
414
415-#define WIDTH 1024
416-#define HEIGHT 768
417+const unity::RawPixel WIDTH(1024);
418+const unity::RawPixel HEIGHT(768);
419
420 using namespace unity::dash;
421
422 class TestRunner
423 {
424 public:
425- TestRunner ();
426- ~TestRunner ();
427+ TestRunner(std::string const& scope, double scale)
428+ : scope_(scope)
429+ , scale_(scale)
430+ {}
431
432 static void InitWindowThread (nux::NThread* thread, void* InitData);
433 void Init ();
434+ std::string scope_;
435+ double scale_;
436 nux::Layout *layout;
437 };
438
439-TestRunner::TestRunner ()
440-{
441-}
442-
443-TestRunner::~TestRunner ()
444-{
445-}
446-
447 void TestRunner::Init ()
448 {
449 layout = new nux::HLayout(NUX_TRACKER_LOCATION);
450
451- DashView* view = new DashView(std::make_shared<unity::dash::GSettingsScopes>(),
452+ DashView* view = new DashView(std::make_shared<unity::dash::GSettingsScopes>(),
453 std::make_shared<unity::ApplicationStarterImp>());
454+ view->scale = scale_;
455 view->DisableBlur();
456- view->SetMinMaxSize(WIDTH, HEIGHT);
457+ view->SetMinMaxSize(WIDTH.CP(scale_), HEIGHT.CP(scale_));
458 layout->AddView (view, 1, nux::MINOR_POSITION_CENTER);
459- layout->SetMinMaxSize(WIDTH, HEIGHT);
460+ layout->SetMinMaxSize(WIDTH.CP(scale_), HEIGHT.CP(scale_));
461
462 view->AboutToShow(0);
463
464 nux::GetWindowThread()->SetLayout (layout);
465 nux::GetWindowCompositor().SetKeyFocusArea(view->default_focus());
466+
467+ unity::UBusServer().SendMessage(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
468+ g_variant_new("(sus)", scope_.c_str(), GOTO_DASH_URI, ""));
469 }
470
471 void TestRunner::InitWindowThread(nux::NThread* thread, void* InitData)
472@@ -102,9 +105,25 @@
473 unity::dash::Style dash_style;
474 unity::panel::Style panel_style;
475
476- TestRunner *test_runner = new TestRunner ();
477+ double scale = 1.0;
478+ unity::glib::String scope;
479+ unity::glib::Error err;
480+
481+ GOptionEntry args_parsed[] =
482+ {
483+ { "scope", 's', 0, G_OPTION_ARG_STRING, &scope, "The default scope ", "S" },
484+ { "scaling-factor", 'f', 0, G_OPTION_ARG_DOUBLE, &scale, "The dash scaling factor", "F" },
485+ { NULL }
486+ };
487+
488+ std::shared_ptr<GOptionContext> ctx(g_option_context_new("Standalone Dash"), g_option_context_free);
489+ g_option_context_add_main_entries(ctx.get(), args_parsed, NULL);
490+ if (!g_option_context_parse(ctx.get(), &argc, &argv, &err))
491+ std::cerr << "Got error when parsing arguments: " << err << std::endl;
492+
493+ TestRunner *test_runner = new TestRunner(scope.Str(), scale);
494 wt = nux::CreateGUIThread(TEXT("Unity Dash"),
495- WIDTH, HEIGHT,
496+ WIDTH.CP(scale), HEIGHT.CP(scale),
497 0,
498 &TestRunner::InitWindowThread,
499 test_runner);
500
501=== modified file 'dash/previews/ActionButton.cpp'
502--- dash/previews/ActionButton.cpp 2014-07-08 09:48:09 +0000
503+++ dash/previews/ActionButton.cpp 2014-07-08 09:48:09 +0000
504@@ -87,22 +87,19 @@
505
506 void ActionButton::InitTheme()
507 {
508- if (!cr_active_)
509- {
510- nux::Geometry const& geo = GetGeometry();
511+ nux::Geometry const& geo = GetGeometry();
512
513- cr_prelight_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
514- cr_active_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)));
515- cr_normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));
516- cr_focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &ActionButton::RedrawFocusOverlay)));
517- }
518+ cr_prelight_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
519+ cr_active_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)));
520+ cr_normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));
521+ cr_focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &ActionButton::RedrawFocusOverlay)));
522
523 SetMinimumHeight(MIN_BUTTON_HEIGHT.CP(scale));
524 SetMinimumWidth(MIN_BUTTON_WIDTH.CP(scale));
525 }
526
527 void ActionButton::SetExtraHint(std::string const& extra_hint, std::string const& font_hint)
528-{
529+{
530 extra_font_hint_= font_hint;
531 if (extra_text_)
532 {
533@@ -195,11 +192,13 @@
534
535 void ActionButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state)
536 {
537+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
538 Style::Instance().Button(cr, faked_state, "", -1, Alignment::CENTER, true);
539 }
540
541 void ActionButton::RedrawFocusOverlay(nux::Geometry const& geom, cairo_t* cr)
542 {
543+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
544 Style::Instance().ButtonFocusOverlay(cr, 0.20f);
545 }
546
547@@ -316,8 +315,7 @@
548
549 void ActionButton::UpdateScale(double scale)
550 {
551- SetMinimumHeight(MIN_BUTTON_HEIGHT.CP(scale));
552- SetMinimumWidth(MIN_BUTTON_WIDTH.CP(scale));
553+ InitTheme();
554
555 if (image_)
556 {
557
558=== modified file 'dash/previews/ActionLink.h'
559--- dash/previews/ActionLink.h 2014-07-08 09:48:09 +0000
560+++ dash/previews/ActionLink.h 2014-07-08 09:48:09 +0000
561@@ -47,7 +47,6 @@
562 nux::RWProperty<StaticCairoText::AlignState> text_aligment;
563 nux::RWProperty<StaticCairoText::UnderlineState> underline_state;
564 nux::RWProperty<std::string> font_hint;
565-
566 nux::Property<double> scale;
567
568 void Activate() {}
569
570=== modified file 'dash/previews/ApplicationPreview.cpp'
571--- dash/previews/ApplicationPreview.cpp 2014-07-08 09:48:09 +0000
572+++ dash/previews/ApplicationPreview.cpp 2014-07-08 09:48:09 +0000
573@@ -145,6 +145,7 @@
574 /////////////////////
575 // Image
576 image_ = new CoverArt();
577+ image_->scale = scale();
578 AddChild(image_.GetPointer());
579 UpdateCoverArtImage(image_.GetPointer());
580 /////////////////////
581@@ -153,7 +154,7 @@
582 // App Data Panel
583 full_data_layout_ = new nux::VLayout();
584 full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale));
585- full_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN);
586+ full_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN.CP(scale));
587
588 /////////////////////
589 // Main App Info
590@@ -174,6 +175,7 @@
591 if (app_preview_model->rating >= 0) {
592 app_rating_ = new PreviewRatingsWidget();
593 AddChild(app_rating_.GetPointer());
594+ app_rating_->scale = scale();
595 app_rating_->SetMaximumHeight(style.GetRatingWidgetHeight().CP(scale));
596 app_rating_->SetMinimumHeight(style.GetRatingWidgetHeight().CP(scale));
597 app_rating_->SetRating(app_preview_model->rating);
598@@ -196,6 +198,7 @@
599 title_ = new StaticCairoText(preview_model_->title, true, NUX_TRACKER_LOCATION);
600 AddChild(title_.GetPointer());
601 title_->SetLines(-1);
602+ title_->SetScale(scale);
603 title_->SetFont(style.title_font().c_str());
604 title_->mouse_click.connect(on_mouse_down);
605 title_subtitle_layout_->AddView(title_.GetPointer(), 1);
606@@ -206,6 +209,7 @@
607 AddChild(subtitle_.GetPointer());
608 subtitle_->SetFont(style.subtitle_size_font().c_str());
609 subtitle_->SetLines(-1);
610+ subtitle_->SetScale(scale);
611 subtitle_->mouse_click.connect(on_mouse_down);
612 title_subtitle_layout_->AddView(subtitle_.GetPointer(), 1);
613 }
614@@ -219,6 +223,7 @@
615 AddChild(license_.GetPointer());
616 license_->SetFont(style.app_license_font().c_str());
617 license_->SetLines(-1);
618+ license_->SetScale(scale);
619 license_->mouse_click.connect(on_mouse_down);
620 app_updated_copywrite_layout_->AddView(license_.GetPointer(), 1);
621 }
622@@ -231,6 +236,7 @@
623 last_update_ = new StaticCairoText(last_update.str(), true, NUX_TRACKER_LOCATION);
624 AddChild(last_update_.GetPointer());
625 last_update_->SetFont(style.app_last_update_font().c_str());
626+ last_update_->SetScale(scale);
627 last_update_->mouse_click.connect(on_mouse_down);
628 app_updated_copywrite_layout_->AddView(last_update_.GetPointer(), 1);
629 }
630@@ -241,6 +247,7 @@
631 AddChild(copywrite_.GetPointer());
632 copywrite_->SetFont(style.app_copywrite_font().c_str());
633 copywrite_->SetLines(-1);
634+ copywrite_->SetScale(scale);
635 copywrite_->mouse_click.connect(on_mouse_down);
636 app_updated_copywrite_layout_->AddView(copywrite_.GetPointer(), 1);
637 }
638@@ -262,7 +269,7 @@
639 app_info->mouse_click.connect(on_mouse_down);
640
641 app_info_layout_ = new nux::VLayout();
642- app_info_layout_->SetSpaceBetweenChildren(INFO_SPACE_CHILDREN);
643+ app_info_layout_->SetSpaceBetweenChildren(INFO_SPACE_CHILDREN.CP(scale));
644 app_info->SetLayout(app_info_layout_);
645
646 if (!preview_model_->description.Get().empty())
647@@ -279,7 +286,7 @@
648
649 if (!preview_model_->GetInfoHints().empty())
650 {
651- preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
652+ preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth().CP(scale));
653 AddChild(preview_info_hints_.GetPointer());
654 preview_info_hints_->request_close().connect([this]() { preview_container_->request_close.emit(); });
655 app_info_layout_->AddView(preview_info_hints_.GetPointer());
656@@ -289,15 +296,15 @@
657 /////////////////////
658 // Actions
659 action_buttons_.clear();
660- nux::Layout* actions_layout = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
661- actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin());
662+ actions_layout_ = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
663+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
664 ///////////////////
665
666 full_data_layout_->AddLayout(main_app_info_, 0);
667 full_data_layout_->AddView(app_info, 1);
668- full_data_layout_->AddLayout(actions_layout, 0);
669+ full_data_layout_->AddLayout(actions_layout_, 0);
670 /////////////////////
671-
672+
673 image_data_layout_->AddView(image_.GetPointer(), 0);
674 image_data_layout_->AddLayout(full_data_layout_, 1);
675
676@@ -314,7 +321,9 @@
677
678 nux::Geometry geo_art(geo.x, geo.y, style.GetAppImageAspectRatio() * geo.height, geo.height);
679
680- int content_width = geo.width - style.GetPanelSplitWidth().CP(scale) - style.GetDetailsLeftMargin().CP(scale) - style.GetDetailsRightMargin().CP(scale);
681+ int content_width = geo.width - style.GetPanelSplitWidth().CP(scale)
682+ - style.GetDetailsLeftMargin().CP(scale)
683+ - style.GetDetailsRightMargin().CP(scale);
684 if (content_width - geo_art.width < style.GetDetailsPanelMinimumWidth().CP(scale))
685 geo_art.width = std::max(0, content_width - style.GetDetailsPanelMinimumWidth().CP(scale));
686
687@@ -330,16 +339,19 @@
688 if (copywrite_) { copywrite_->SetMaximumWidth(top_app_info_max_width); }
689 if (description_) { description_->SetMaximumWidth(details_width); }
690
691+ int button_w = CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale));
692+ int button_h = style.GetActionButtonHeight().CP(scale);
693+
694 for (nux::AbstractButton* button : action_buttons_)
695- {
696- button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale)), style.GetActionButtonHeight().CP(scale));
697- }
698+ button->SetMinMaxSize(button_w, button_h);
699
700 Preview::PreLayoutManagement();
701 }
702
703 void ApplicationPreview::UpdateScale(double scale)
704 {
705+ Preview::UpdateScale(scale);
706+
707 previews::Style& style = dash::previews::Style::Instance();
708
709 if (app_icon_)
710@@ -359,9 +371,9 @@
711
712 if (app_rating_)
713 {
714- app_rating_->scale = scale;
715 app_rating_->SetMaximumHeight(style.GetRatingWidgetHeight().CP(scale));
716 app_rating_->SetMinimumHeight(style.GetRatingWidgetHeight().CP(scale));
717+ app_rating_->scale = scale;
718 }
719
720 if (image_data_layout_)
721@@ -382,13 +394,17 @@
722 if (app_data_layout_)
723 app_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN.CP(scale));
724
725+ if (title_subtitle_layout_)
726+ title_subtitle_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
727+
728 if (app_info_layout_)
729 app_info_layout_->SetSpaceBetweenChildren(INFO_SPACE_CHILDREN.CP(scale));
730
731+ if (actions_layout_)
732+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
733+
734 if (app_updated_copywrite_layout_)
735 app_updated_copywrite_layout_->SetSpaceBetweenChildren(COPYRIGHT_SPACE_CHILDREN.CP(scale));
736-
737- Preview::UpdateScale(scale);
738 }
739
740 } // namespace previews
741
742=== modified file 'dash/previews/GenericPreview.cpp'
743--- dash/previews/GenericPreview.cpp 2014-07-08 09:48:09 +0000
744+++ dash/previews/GenericPreview.cpp 2014-07-08 09:48:09 +0000
745@@ -241,10 +241,11 @@
746 if (subtitle_) { subtitle_->SetMaximumWidth(details_width); }
747 if (description_) { description_->SetMaximumWidth(details_width); }
748
749+ int button_w = CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale));
750+ int button_h = style.GetActionButtonHeight().CP(scale);
751+
752 for (nux::AbstractButton* button : action_buttons_)
753- {
754- button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale)), style.GetActionButtonHeight().CP(scale));
755- }
756+ button->SetMinMaxSize(button_w, button_h);
757
758 Preview::PreLayoutManagement();
759 }
760
761=== modified file 'dash/previews/MusicPreview.cpp'
762--- dash/previews/MusicPreview.cpp 2014-07-08 09:48:09 +0000
763+++ dash/previews/MusicPreview.cpp 2014-07-08 09:48:09 +0000
764@@ -162,8 +162,8 @@
765
766 /////////////////////
767 // Music Info
768- nux::VLayout* album_data_layout = new nux::VLayout();
769- album_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle());
770+ album_data_layout_ = new nux::VLayout();
771+ album_data_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
772
773 title_ = new StaticCairoText(preview_model_->title, true, NUX_TRACKER_LOCATION);
774 AddChild(title_.GetPointer());
775@@ -171,7 +171,7 @@
776 title_->SetLines(-1);
777 title_->SetScale(scale);
778 title_->mouse_click.connect(on_mouse_down);
779- album_data_layout->AddView(title_.GetPointer(), 1);
780+ album_data_layout_->AddView(title_.GetPointer(), 1);
781
782 if (!preview_model_->subtitle.Get().empty())
783 {
784@@ -181,7 +181,7 @@
785 subtitle_->SetLines(-1);
786 subtitle_->SetScale(scale);
787 subtitle_->mouse_click.connect(on_mouse_down);
788- album_data_layout->AddView(subtitle_.GetPointer(), 1);
789+ album_data_layout_->AddView(subtitle_.GetPointer(), 1);
790 }
791
792 /////////////////////
793@@ -192,6 +192,7 @@
794 if (tracks_model)
795 {
796 tracks_ = new previews::Tracks(tracks_model, NUX_TRACKER_LOCATION);
797+ tracks_->scale = scale();
798 AddChild(tracks_.GetPointer());
799 tracks_->mouse_click.connect(on_mouse_down);
800 }
801@@ -238,7 +239,7 @@
802 previews::Style& style = dash::previews::Style::Instance();
803 nux::HLayout* actions_layout = new nux::HLayout();
804 icon_layout_ = new nux::VLayout();
805- icon_layout_->SetLeftAndRightPadding(ICON_LEFT_RIGHT_PADDING);
806+ icon_layout_->SetLeftAndRightPadding(ICON_LEFT_RIGHT_PADDING.CP(scale));
807
808 warning_texture_ = new IconTexture(style.GetWarningIcon());
809 icon_layout_->AddView(warning_texture_.GetPointer(), 0, nux::MINOR_POSITION_START,
810@@ -264,7 +265,7 @@
811 if (hints_layout) hint_actions_layout->AddView(hints_layout, 1);
812 hint_actions_layout->AddView(actions_layout_, 0);
813
814- full_data_layout_->AddLayout(album_data_layout, 0);
815+ full_data_layout_->AddLayout(album_data_layout_, 0);
816 if (tracks_)
817 {
818 full_data_layout_->AddView(tracks_.GetPointer(), 1);
819@@ -321,9 +322,15 @@
820 {
821 Preview::UpdateScale(scale);
822
823+ if (tracks_)
824+ tracks_->scale = scale;
825+
826 if (preview_info_hints_)
827 preview_info_hints_->scale = scale;
828
829+ if (icon_layout_)
830+ icon_layout_->SetLeftAndRightPadding(ICON_LEFT_RIGHT_PADDING.CP(scale));
831+
832 if (warning_msg_)
833 {
834 warning_msg_->SetScale(scale);
835@@ -342,6 +349,9 @@
836 full_data_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
837 }
838
839+ if (album_data_layout_)
840+ album_data_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
841+
842 if (actions_layout_)
843 actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
844
845
846=== modified file 'dash/previews/MusicPreview.h'
847--- dash/previews/MusicPreview.h 2014-07-08 09:48:09 +0000
848+++ dash/previews/MusicPreview.h 2014-07-08 09:48:09 +0000
849@@ -68,6 +68,7 @@
850 nux::Layout* actions_layout_;
851 nux::HLayout* image_data_layout_;
852 nux::VLayout* icon_layout_;
853+ nux::VLayout* album_data_layout_;
854 };
855
856 }
857
858=== modified file 'dash/previews/PaymentPreview.cpp'
859--- dash/previews/PaymentPreview.cpp 2014-07-08 09:48:09 +0000
860+++ dash/previews/PaymentPreview.cpp 2014-07-08 09:48:09 +0000
861@@ -197,9 +197,7 @@
862 , header_layout_(nullptr)
863 , body_layout_(nullptr)
864 , footer_layout_(nullptr)
865-{
866- UpdateScale(scale);
867-}
868+{}
869
870 std::string PaymentPreview::GetName() const
871 {
872@@ -371,6 +369,7 @@
873
874 full_data_layout_->AddLayout(overlay_layout_.GetPointer());
875
876+ UpdateScale(scale);
877 SetLayout(full_data_layout_.GetPointer());
878 }
879
880
881=== modified file 'dash/previews/Preview.cpp'
882--- dash/previews/Preview.cpp 2014-07-08 09:48:09 +0000
883+++ dash/previews/Preview.cpp 2014-07-08 09:48:09 +0000
884@@ -101,7 +101,7 @@
885
886 Preview::Preview(dash::Preview::Ptr preview_model)
887 : View(NUX_TRACKER_LOCATION)
888- , scale(1.0)
889+ , scale(1.0f)
890 , preview_model_(preview_model)
891 , tab_iterator_(new TabIterator())
892 , full_data_layout_(nullptr)
893@@ -110,7 +110,6 @@
894 , subtitle_(nullptr)
895 , preview_container_(new PreviewContainer)
896 {
897- preview_container_->scale = scale();
898 scale.changed.connect(sigc::mem_fun(this, &Preview::UpdateScale));
899 }
900
901@@ -303,12 +302,10 @@
902
903 for (nux::AbstractButton* button : action_buttons_)
904 {
905- ActionButton* bn = dynamic_cast<ActionButton*>(button);
906- if (bn)
907+ if (ActionButton* bn = dynamic_cast<ActionButton*>(button))
908 bn->scale = scale;
909
910- ActionLink* link = dynamic_cast<ActionLink*>(button);
911- if (link)
912+ if (ActionLink* link = dynamic_cast<ActionLink*>(button))
913 link->scale = scale;
914 }
915
916
917=== modified file 'dash/previews/PreviewContainer.cpp'
918--- dash/previews/PreviewContainer.cpp 2014-07-08 09:48:09 +0000
919+++ dash/previews/PreviewContainer.cpp 2014-07-08 09:48:09 +0000
920@@ -23,7 +23,6 @@
921 #include "PreviewContainer.h"
922 #include <NuxCore/Logger.h>
923 #include <Nux/HLayout.h>
924-#include <Nux/VLayout.h>
925
926 #include "unity-shared/IntrospectableWrappers.h"
927 #include "unity-shared/TimeUtil.h"
928@@ -436,7 +435,7 @@
929 void PreviewContainer::Preview(dash::Preview::Ptr preview_model, Navigation direction)
930 {
931 previews::Preview::Ptr preview_view = preview_model ? previews::Preview::PreviewForModel(preview_model) : previews::Preview::Ptr();
932-
933+
934 if (preview_view)
935 {
936 preview_view->request_close().connect([this]() { request_close.emit(); });
937@@ -477,29 +476,33 @@
938
939 nux::VLayout* layout = new nux::VLayout();
940 SetLayout(layout);
941- layout->AddLayout(new nux::SpaceLayout(0,0,style.GetPreviewTopPadding(),style.GetPreviewTopPadding()));
942+
943+ space_layout_ = new nux::SpaceLayout(0,0,style.GetPreviewTopPadding().CP(scale),style.GetPreviewTopPadding().CP(scale));
944+ layout->AddLayout(space_layout_);
945
946 layout_content_ = new nux::HLayout();
947- layout_content_->SetSpaceBetweenChildren(CHILDREN_SPACE);
948+ layout_content_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
949 layout->AddLayout(layout_content_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
950
951 layout_content_->AddSpace(0, 1);
952 nav_left_ = new PreviewNavigator(Orientation::LEFT, NUX_TRACKER_LOCATION);
953 AddChild(nav_left_);
954- nav_left_->SetMinimumWidth(style.GetNavigatorWidth());
955- nav_left_->SetMaximumWidth(style.GetNavigatorWidth());
956+ nav_left_->scale = scale();
957+ nav_left_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
958+ nav_left_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
959 nav_left_->activated.connect([this]() { navigate_left.emit(); });
960 layout_content_->AddView(nav_left_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
961
962 preview_layout_ = new PreviewContent(this);
963- preview_layout_->SetMinMaxSize(style.GetPreviewWidth(), style.GetPreviewHeight());
964+ preview_layout_->SetMinMaxSize(style.GetPreviewWidth().CP(scale), style.GetPreviewHeight().CP(scale));
965 AddChild(preview_layout_);
966 layout_content_->AddLayout(preview_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
967
968 nav_right_ = new PreviewNavigator(Orientation::RIGHT, NUX_TRACKER_LOCATION);
969 AddChild(nav_right_);
970- nav_right_->SetMinimumWidth(style.GetNavigatorWidth());
971- nav_right_->SetMaximumWidth(style.GetNavigatorWidth());
972+ nav_right_->scale = scale();
973+ nav_right_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
974+ nav_right_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
975 nav_right_->activated.connect([this]() { navigate_right.emit(); });
976 layout_content_->AddView(nav_right_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
977 layout_content_->AddSpace(0, 1);
978@@ -511,7 +514,7 @@
979 // reset animation clock.
980 if (navigation_count_ == 0)
981 clock_gettime(CLOCK_MONOTONIC, &last_progress_time_);
982-
983+
984 float navigation_progress_remaining = CLAMP((1.0 - preview_layout_->GetAnimationProgress()) + navigation_count_, 1.0f, 10.0f);
985 navigation_count_++;
986
987@@ -553,7 +556,7 @@
988 gfx_engine.GetRenderStates().SetBlend(false);
989 gfx_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
990 }
991-
992+
993 // rely on the compiz event loop to come back to us in a nice throttling
994 if (AnimationInProgress())
995 {
996@@ -614,7 +617,7 @@
997 bool PreviewContainer::QueueAnimation()
998 {
999 animation_timer_.reset();
1000-
1001+
1002 timespec current;
1003 clock_gettime(CLOCK_MONOTONIC, &current);
1004 float progress = GetSwipeAnimationProgress(current);
1005@@ -711,7 +714,7 @@
1006
1007 nux::Geometry PreviewContainer::GetLayoutGeometry() const
1008 {
1009- return layout_content_->GetAbsoluteGeometry();
1010+ return layout_content_->GetAbsoluteGeometry();
1011 }
1012
1013 void PreviewContainer::UpdateScale(double scale)
1014@@ -724,6 +727,9 @@
1015 preview_layout_->SetMinMaxSize(style.GetPreviewWidth().CP(scale), style.GetPreviewHeight().CP(scale));
1016 }
1017
1018+ if (space_layout_)
1019+ space_layout_->SetPadding(0,0,style.GetPreviewTopPadding().CP(scale),style.GetPreviewTopPadding().CP(scale));
1020+
1021 if (layout_content_)
1022 layout_content_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
1023
1024@@ -731,13 +737,18 @@
1025 {
1026 nav_left_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
1027 nav_left_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
1028+ nav_left_->scale = scale;
1029 }
1030
1031 if (nav_right_)
1032 {
1033 nav_right_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
1034 nav_right_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
1035+ nav_right_->scale = scale;
1036 }
1037+
1038+ QueueRelayout();
1039+ QueueDraw();
1040 }
1041
1042 } // namespace previews
1043
1044=== modified file 'dash/previews/PreviewContainer.h'
1045--- dash/previews/PreviewContainer.h 2014-07-08 09:48:09 +0000
1046+++ dash/previews/PreviewContainer.h 2014-07-08 09:48:09 +0000
1047@@ -25,6 +25,7 @@
1048
1049 #include <Nux/Nux.h>
1050 #include <Nux/View.h>
1051+#include <Nux/VLayout.h>
1052 #include <UnityCore/Preview.h>
1053 #include "Preview.h"
1054 #include "unity-shared/Introspectable.h"
1055@@ -116,7 +117,9 @@
1056 struct timespec last_progress_time_;
1057 float navigation_progress_speed_;
1058 int navigation_count_;
1059-
1060+
1061+ nux::SpaceLayout* space_layout_;
1062+
1063 glib::Source::UniquePtr animation_timer_;
1064 friend class PreviewContent;
1065 };
1066
1067=== modified file 'dash/previews/PreviewInfoHintWidget.cpp'
1068--- dash/previews/PreviewInfoHintWidget.cpp 2014-07-08 09:48:09 +0000
1069+++ dash/previews/PreviewInfoHintWidget.cpp 2014-07-08 09:48:09 +0000
1070@@ -198,10 +198,10 @@
1071 {
1072 nux::Geometry const& geo = GetGeometry();
1073 info_names_layout_->SetMaximumWidth(info_names_layout_->GetContentWidth());
1074- int max_width = geo.width - info_names_layout_->GetWidth() - LAYOUT_SPACING.CP(scale) -1;
1075+ int max_width = std::max(0, geo.width - info_names_layout_->GetWidth() - LAYOUT_SPACING.CP(scale) -1);
1076
1077 for (auto value : info_values_layout_->GetChildren())
1078- value->SetMaximumWidth(max_width > 0 ? max_width : 0);
1079+ value->SetMaximumWidth(max_width);
1080 }
1081
1082 View::PreLayoutManagement();
1083
1084=== modified file 'dash/previews/PreviewNavigator.cpp'
1085--- dash/previews/PreviewNavigator.cpp 2013-11-19 18:48:35 +0000
1086+++ dash/previews/PreviewNavigator.cpp 2014-07-08 09:48:09 +0000
1087@@ -40,12 +40,16 @@
1088
1089 PreviewNavigator::PreviewNavigator(Orientation direction, NUX_FILE_LINE_DECL)
1090 : View(NUX_FILE_LINE_PARAM)
1091+ , scale(1.0)
1092 , direction_(direction)
1093 , texture_(nullptr)
1094 , visual_state_(VisualState::NORMAL)
1095 {
1096 SetupViews();
1097 UpdateTexture();
1098+
1099+ UpdateScale(scale);
1100+ scale.changed.connect(sigc::mem_fun(this, &PreviewNavigator::UpdateScale));
1101 }
1102
1103 void PreviewNavigator::SetEnabled(bool enabled)
1104@@ -97,7 +101,7 @@
1105 void PreviewNavigator::SetupViews()
1106 {
1107 previews::Style& style = dash::previews::Style::Instance();
1108-
1109+
1110 if (direction_ == Orientation::LEFT || direction_ == Orientation::RIGHT)
1111 {
1112 nux::VLayout* vlayout = new nux::VLayout();
1113@@ -107,9 +111,9 @@
1114 layout_ = hlayout;
1115
1116 if (direction_ == Orientation::LEFT)
1117- texture_ = new IconTexture(Style::Instance().GetNavLeftIcon(), style.GetNavigatorIconSize(), style.GetNavigatorIconSize());
1118- else
1119- texture_ = new IconTexture(Style::Instance().GetNavRightIcon(), style.GetNavigatorIconSize(), style.GetNavigatorIconSize());
1120+ texture_ = new IconTexture(Style::Instance().GetNavLeftIcon(), style.GetNavigatorIconSize().CP(scale), style.GetNavigatorIconSize().CP(scale));
1121+ else
1122+ texture_ = new IconTexture(Style::Instance().GetNavRightIcon(), style.GetNavigatorIconSize().CP(scale), style.GetNavigatorIconSize().CP(scale));
1123 texture_->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
1124
1125 vlayout->AddSpace(0,1);
1126@@ -138,7 +142,7 @@
1127 if (texture_)
1128 {
1129 AddChild(texture_);
1130- layout_->AddView(texture_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
1131+ layout_->AddView(texture_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
1132
1133 texture_->mouse_click.connect([this](int, int, unsigned long, unsigned long) { activated.emit(); });
1134 texture_->mouse_enter.connect(sigc::mem_fun(this, &PreviewNavigator::TexRecvMouseEnter));
1135@@ -179,6 +183,19 @@
1136 }
1137 }
1138
1139+void PreviewNavigator::UpdateScale(double scale)
1140+{
1141+ previews::Style& style = dash::previews::Style::Instance();
1142+
1143+ if (texture_)
1144+ {
1145+ int icon_size = style.GetNavigatorIconSize().CP(scale);
1146+ texture_->SetMinMaxSize(icon_size, icon_size);
1147+ }
1148+
1149+ QueueRelayout();
1150+ QueueDraw();
1151+}
1152
1153 } // namespace previews
1154 } // namespace dash
1155
1156=== modified file 'dash/previews/PreviewNavigator.h'
1157--- dash/previews/PreviewNavigator.h 2013-09-19 16:44:03 +0000
1158+++ dash/previews/PreviewNavigator.h 2014-07-08 09:48:09 +0000
1159@@ -43,7 +43,7 @@
1160 {
1161 NUX_DECLARE_OBJECT_TYPE(PreviewNavigator, nux::View);
1162 public:
1163- typedef nux::ObjectPtr<PreviewNavigator> Ptr;
1164+ typedef nux::ObjectPtr<PreviewNavigator> Ptr;
1165 PreviewNavigator(Orientation direction, NUX_FILE_LINE_PROTO);
1166
1167 void SetEnabled(bool enabled);
1168@@ -53,9 +53,11 @@
1169 void AddProperties(debug::IntrospectionData&);
1170
1171 sigc::signal<void> activated;
1172-
1173+
1174 virtual bool AcceptKeyNavFocus() { return false; }
1175
1176+ nux::Property<double> scale;
1177+
1178 private:
1179 virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);
1180 virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);
1181@@ -66,6 +68,7 @@
1182 void UpdateTexture();
1183
1184 void SetupViews();
1185+ void UpdateScale(double scale);
1186
1187 private:
1188 const Orientation direction_;
1189@@ -77,11 +80,12 @@
1190 NORMAL,
1191 ACTIVE
1192 };
1193- VisualState visual_state_;
1194+ VisualState visual_state_;
1195+
1196 };
1197
1198 } // namespace previews
1199 } // namespace dash
1200 } // namespace unity
1201
1202-#endif // PREVIEWNAVIGATOR_H
1203\ No newline at end of file
1204+#endif // PREVIEWNAVIGATOR_H
1205
1206=== modified file 'dash/previews/PreviewRatingsWidget.cpp'
1207--- dash/previews/PreviewRatingsWidget.cpp 2014-07-08 09:48:09 +0000
1208+++ dash/previews/PreviewRatingsWidget.cpp 2014-07-08 09:48:09 +0000
1209@@ -62,7 +62,7 @@
1210 ratings_->SetEditable(false);
1211 ratings_->mouse_click.connect(on_mouse_down);
1212 layout_->AddView(ratings_);
1213-
1214+
1215 reviews_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
1216 reviews_->SetFont(style.user_rating_font());
1217 reviews_->SetScale(scale);
1218@@ -73,6 +73,7 @@
1219
1220 SetLayout(layout_);
1221
1222+ UpdateScale(scale);
1223 scale.changed.connect(sigc::mem_fun(this, &PreviewRatingsWidget::UpdateScale));
1224 }
1225
1226@@ -132,7 +133,7 @@
1227
1228 if (ratings_)
1229 {
1230- ratings_->star_gap_ = RATINGS_SIZE.CP(scale);
1231+ ratings_->star_size_ = RATINGS_SIZE.CP(scale);
1232 ratings_->star_gap_ = RATINGS_GAP.CP(scale);
1233 }
1234
1235
1236=== modified file 'dash/previews/PreviewRatingsWidget.h'
1237--- dash/previews/PreviewRatingsWidget.h 2014-07-08 09:48:09 +0000
1238+++ dash/previews/PreviewRatingsWidget.h 2014-07-08 09:48:09 +0000
1239@@ -59,7 +59,7 @@
1240 protected:
1241 virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
1242 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
1243-
1244+
1245 virtual bool AcceptKeyNavFocus() { return false; }
1246
1247 // From debug::Introspectable
1248
1249=== modified file 'dash/previews/SocialPreview.cpp'
1250--- dash/previews/SocialPreview.cpp 2014-07-08 09:48:09 +0000
1251+++ dash/previews/SocialPreview.cpp 2014-07-08 09:48:09 +0000
1252@@ -73,6 +73,7 @@
1253 : Preview(preview_model)
1254 , image_data_layout_(nullptr)
1255 , main_social_info_(nullptr)
1256+, comments_layout_(nullptr)
1257 , social_content_layout_(nullptr)
1258 , social_data_layout_(nullptr)
1259 , social_info_layout_(nullptr)
1260@@ -148,7 +149,9 @@
1261 content_ = new SocialPreviewContent(social_preview_model->description, NUX_TRACKER_LOCATION);
1262 content_->request_close().connect([this]() { preview_container_->request_close.emit(); });
1263 social_content_layout_->AddView(content_.GetPointer(), 1);
1264- } else {
1265+ }
1266+ else
1267+ {
1268 image_ = new CoverArt();
1269 AddChild(image_.GetPointer());
1270 UpdateCoverArtImage(image_.GetPointer());
1271@@ -172,7 +175,7 @@
1272 // Icon Layout
1273 icon_layout_ = new nux::VLayout();
1274 icon_layout_->SetSpaceBetweenChildren(ICON_CHILDREN_SPACE.CP(scale));
1275- avatar_ = new IconTexture(social_preview_model->avatar.Get().RawPtr() ? g_icon_to_string(social_preview_model->avatar.Get().RawPtr()) : "", MIN(style.GetAvatarAreaWidth().CP(scale), style.GetAvatarAreaHeight().CP(scale)));
1276+ avatar_ = new IconTexture(social_preview_model->avatar() ? g_icon_to_string(social_preview_model->avatar()) : "", MIN(style.GetAvatarAreaWidth().CP(scale), style.GetAvatarAreaHeight().CP(scale)));
1277 AddChild(avatar_.GetPointer());
1278 avatar_->SetMinMaxSize(style.GetAvatarAreaWidth().CP(scale), style.GetAvatarAreaHeight().CP(scale));
1279 avatar_->mouse_click.connect(on_mouse_down);
1280@@ -231,24 +234,25 @@
1281 // Comments/Replies
1282 if (!social_preview_model->GetComments().empty())
1283 {
1284- nux::HLayout* comments_layout = new nux::HLayout();
1285- comments_layout->SetSpaceBetweenChildren(12);
1286+ comments_layout_ = new nux::HLayout();
1287+ comments_layout_->SetSpaceBetweenChildren(SOCIAL_INFO_CHILDREN_SPACE.CP(scale));
1288 std::string tmp_comments_hint = _("Comments");
1289 tmp_comments_hint += ":";
1290
1291 comments_hint_ = new StaticCairoText(tmp_comments_hint, true, NUX_TRACKER_LOCATION);
1292 AddChild(comments_hint_.GetPointer());
1293 comments_hint_->SetLines(-1);
1294+ comments_hint_->SetScale(scale);
1295 comments_hint_->SetFont(style.info_hint_bold_font().c_str());
1296 comments_hint_->SetTextAlignment(StaticCairoText::NUX_ALIGN_RIGHT);
1297 comments_hint_->mouse_click.connect(on_mouse_down);
1298- comments_layout->AddView(comments_hint_.GetPointer(), 0, nux::MINOR_POSITION_START);
1299+ comments_layout_->AddView(comments_hint_.GetPointer(), 0, nux::MINOR_POSITION_START);
1300
1301 comments_ = new SocialPreviewComments(preview_model_, NUX_TRACKER_LOCATION);
1302 AddChild(comments_.GetPointer());
1303 comments_->request_close().connect([this]() { preview_container_->request_close.emit(); });
1304- comments_layout->AddView(comments_.GetPointer());
1305- social_info_layout_->AddView(comments_layout, 0);
1306+ comments_layout_->AddView(comments_.GetPointer());
1307+ social_info_layout_->AddView(comments_layout_, 0);
1308 }
1309
1310 /////////////////////
1311@@ -276,28 +280,33 @@
1312 void SocialPreview::PreLayoutManagement()
1313 {
1314 nux::Geometry geo = GetGeometry();
1315-
1316 previews::Style& style = dash::previews::Style::Instance();
1317
1318 nux::Geometry geo_content(geo.x, geo.y, style.GetAppImageAspectRatio() * geo.height, geo.height);
1319
1320- if (geo.width - geo_content.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() < style.GetDetailsPanelMinimumWidth())
1321- geo_content.width = std::max(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() - style.GetDetailsPanelMinimumWidth());
1322+ int content_width = geo.width - style.GetPanelSplitWidth().CP(scale)
1323+ - style.GetDetailsLeftMargin().CP(scale)
1324+ - style.GetDetailsRightMargin().CP(scale);
1325+
1326+ if (content_width - geo_content.width < style.GetDetailsPanelMinimumWidth().CP(scale))
1327+ geo_content.width = std::max(0, content_width - style.GetDetailsPanelMinimumWidth().CP(scale));
1328+
1329 if (content_) { content_->SetMinMaxSize(geo_content.width, geo_content.height); }
1330 if (image_) { image_->SetMinMaxSize(geo_content.width, geo_content.height); }
1331
1332- int details_width = std::max(0, geo.width - geo_content.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin());
1333- int top_social_info_max_width = std::max(0, details_width - style.GetAppIconAreaWidth() - style.GetSpaceBetweenIconAndDetails());
1334+ int details_width = std::max(0, content_width - geo_content.width);
1335+ int top_social_info_max_width = std::max(0, details_width - style.GetAppIconAreaWidth().CP(scale) - style.GetSpaceBetweenIconAndDetails().CP(scale));
1336
1337 if (title_) { title_->SetMaximumWidth(top_social_info_max_width); }
1338 if (subtitle_) { subtitle_->SetMaximumWidth(top_social_info_max_width); }
1339 if (comments_) { comments_->SetMaximumWidth(top_social_info_max_width); }
1340- if (comments_hint_) { comments_hint_->SetMinimumWidth(style.GetInfoHintNameMinimumWidth()); }
1341+ if (comments_hint_) { comments_hint_->SetMinimumWidth(style.GetInfoHintNameMinimumWidth().CP(scale)); }
1342+
1343+ int button_w = CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale));
1344+ int button_h = style.GetActionButtonHeight().CP(scale);
1345
1346 for (nux::AbstractButton* button : action_buttons_)
1347- {
1348- button->SetMinMaxSize(CLAMP(RawPixel((details_width - style.GetSpaceBetweenActions()) / 2), 0_em, style.GetActionButtonMaximumWidth()), style.GetActionButtonHeight());
1349- }
1350+ button->SetMinMaxSize(button_w, button_h);
1351
1352 Preview::PreLayoutManagement();
1353 }
1354@@ -344,6 +353,12 @@
1355
1356 if (comments_)
1357 comments_->scale = scale;
1358+
1359+ if (comments_layout_)
1360+ comments_layout_->SetSpaceBetweenChildren(SOCIAL_INFO_CHILDREN_SPACE.CP(scale));
1361+
1362+ if (comments_hint_)
1363+ comments_hint_->SetScale(scale);
1364 }
1365
1366 } // namespace previews
1367
1368=== modified file 'dash/previews/SocialPreview.h'
1369--- dash/previews/SocialPreview.h 2014-07-08 09:48:09 +0000
1370+++ dash/previews/SocialPreview.h 2014-07-08 09:48:09 +0000
1371@@ -64,6 +64,7 @@
1372
1373 nux::HLayout* image_data_layout_;
1374 nux::HLayout* main_social_info_;
1375+ nux::HLayout* comments_layout_;
1376 nux::VLayout* social_content_layout_;
1377 nux::VLayout* social_data_layout_;
1378 nux::VLayout* social_info_layout_;
1379
1380=== modified file 'dash/previews/SocialPreviewComments.cpp'
1381--- dash/previews/SocialPreviewComments.cpp 2014-07-08 09:48:09 +0000
1382+++ dash/previews/SocialPreviewComments.cpp 2014-07-08 09:48:09 +0000
1383@@ -50,19 +50,9 @@
1384 : View(NUX_FILE_LINE_PARAM)
1385 , scale(1.0)
1386 , preview_model_(preview_model)
1387-, layout_(nullptr)
1388-, name_layout_(nullptr)
1389-, comment_name_(nullptr)
1390-, comment_time_(nullptr)
1391-, comment_value_(nullptr)
1392 {
1393 SetupViews();
1394- UpdateScale(scale);
1395- scale.changed.connect(sigc::mem_fun(this, &SocialPreviewComments::UpdateScale));
1396-}
1397-
1398-SocialPreviewComments::~SocialPreviewComments()
1399-{
1400+ scale.changed.connect(sigc::hide(sigc::mem_fun(this, &SocialPreviewComments::SetupViews)));
1401 }
1402
1403 void SocialPreviewComments::Draw(nux::GraphicsEngine& gfx_engine, bool force_draw)
1404@@ -94,21 +84,17 @@
1405 nux::Geometry const& geo = GetGeometry();
1406
1407 int comment_width = 0;
1408+ int minimum_detail_width = style.GetDetailsPanelMinimumWidth().CP(scale);
1409+
1410 for (Comment const& comment : comments_)
1411 {
1412- int width = style.GetDetailsPanelMinimumWidth().CP(scale);
1413+ int width = minimum_detail_width;
1414+
1415 if (comment.first)
1416- {
1417- width = comment.first->GetTextExtents().width;
1418-
1419- if (width < style.GetDetailsPanelMinimumWidth().CP(scale))
1420- width = style.GetDetailsPanelMinimumWidth().CP(scale);
1421- }
1422+ width = std::max(minimum_detail_width, comment.first->GetTextExtents().width);
1423
1424 if (comment_width < width)
1425- {
1426 comment_width = width;
1427- }
1428 }
1429
1430 int comment_value_width = MAX(0, geo.width - style.GetDetailsLeftMargin().CP(scale) - style.GetDetailsRightMargin().CP(scale));
1431@@ -138,58 +124,59 @@
1432
1433 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); };
1434
1435- layout_ = new nux::VLayout();
1436- layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
1437+ nux::VLayout* layout = new nux::VLayout();
1438+ layout->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
1439
1440 for (dash::SocialPreview::CommentPtr comment : social_preview_model->GetComments())
1441 {
1442- name_layout_ = new nux::HLayout();
1443- name_layout_->SetSpaceBetweenChildren(LAYOUT_SPACING.CP(scale));
1444+ nux::HLayout* name_layout = new nux::HLayout();
1445+ name_layout->SetSpaceBetweenChildren(LAYOUT_SPACING.CP(scale));
1446
1447+ StaticCairoTextPtr comment_name;
1448 if (!comment->display_name.empty())
1449 {
1450- comment_name_ = new StaticCairoText(comment->display_name, true, NUX_TRACKER_LOCATION);
1451- comment_name_->SetFont(style.info_hint_bold_font());
1452- comment_name_->SetLines(-1);
1453- comment_name_->SetScale(scale);
1454- comment_name_->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
1455- comment_name_->mouse_click.connect(on_mouse_down);
1456- name_layout_->AddView(comment_name_.GetPointer(), 0, nux::MINOR_POSITION_START);
1457+ comment_name = new StaticCairoText(comment->display_name, true, NUX_TRACKER_LOCATION);
1458+ comment_name->SetFont(style.info_hint_bold_font());
1459+ comment_name->SetLines(-1);
1460+ comment_name->SetScale(scale);
1461+ comment_name->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
1462+ comment_name->mouse_click.connect(on_mouse_down);
1463+ name_layout->AddView(comment_name.GetPointer(), 0, nux::MINOR_POSITION_START);
1464 }
1465
1466+ StaticCairoTextPtr comment_time;
1467 if (!comment->time.empty())
1468 {
1469- comment_time_ = new StaticCairoText(comment->time, true, NUX_TRACKER_LOCATION);
1470- comment_time_->SetFont(style.info_hint_font());
1471- comment_time_->SetLines(-1);
1472- comment_time_->SetScale(scale);
1473- comment_time_->SetTextAlignment(StaticCairoText::NUX_ALIGN_RIGHT);
1474- comment_time_->mouse_click.connect(on_mouse_down);
1475- name_layout_->AddView(comment_time_.GetPointer(), 0, nux::MINOR_POSITION_START);
1476+ comment_time = new StaticCairoText(comment->time, true, NUX_TRACKER_LOCATION);
1477+ comment_time->SetFont(style.info_hint_font());
1478+ comment_time->SetLines(-1);
1479+ comment_time->SetScale(scale);
1480+ comment_time->SetTextAlignment(StaticCairoText::NUX_ALIGN_RIGHT);
1481+ comment_time->mouse_click.connect(on_mouse_down);
1482+ name_layout->AddView(comment_time.GetPointer(), 0, nux::MINOR_POSITION_START);
1483 }
1484
1485-
1486 nux::HLayout* comment_layout = new nux::HLayout();
1487- comment_layout->SetSpaceBetweenChildren(LAYOUT_SPACING);
1488-
1489- comment_value_ = new StaticCairoText(comment->content, false, NUX_TRACKER_LOCATION);
1490-
1491- comment_value_->SetFont(style.info_hint_font());
1492- comment_value_->SetLines(-7);
1493- comment_value_->SetScale(scale);
1494- comment_value_->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
1495- comment_value_->mouse_click.connect(on_mouse_down);
1496- comment_layout->AddView(comment_value_.GetPointer(), 1, nux::MINOR_POSITION_START);
1497-
1498- Comment comment_views(comment_name_, comment_value_);
1499+ comment_layout->SetSpaceBetweenChildren(LAYOUT_SPACING.CP(scale));
1500+
1501+ StaticCairoTextPtr comment_value(new StaticCairoText(comment->content, false, NUX_TRACKER_LOCATION));
1502+
1503+ comment_value->SetFont(style.info_hint_font());
1504+ comment_value->SetLines(-7);
1505+ comment_value->SetScale(scale);
1506+ comment_value->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
1507+ comment_value->mouse_click.connect(on_mouse_down);
1508+ comment_layout->AddView(comment_value.GetPointer(), 1, nux::MINOR_POSITION_START);
1509+
1510+ Comment comment_views(comment_name, comment_value);
1511 comments_.push_back(comment_views);
1512
1513- layout_->AddLayout(name_layout_, 0);
1514- layout_->AddLayout(comment_layout, 1);
1515+ layout->AddLayout(name_layout, 0);
1516+ layout->AddLayout(comment_layout, 1);
1517 }
1518 mouse_click.connect(on_mouse_down);
1519
1520- SetLayout(layout_);
1521+ SetLayout(layout);
1522 }
1523
1524 std::string SocialPreviewComments::GetName() const
1525@@ -202,24 +189,6 @@
1526 introspection.add(GetAbsoluteGeometry());
1527 }
1528
1529-void SocialPreviewComments::UpdateScale(double scale)
1530-{
1531- if (comment_name_)
1532- comment_name_->SetScale(scale);
1533-
1534- if (comment_time_)
1535- comment_time_->SetScale(scale);
1536-
1537- if (comment_value_)
1538- comment_value_->SetScale(scale);
1539-
1540- if (layout_)
1541- layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
1542-
1543- if (name_layout_)
1544- name_layout_->SetSpaceBetweenChildren(LAYOUT_SPACING.CP(scale));
1545-}
1546-
1547 }
1548 }
1549 }
1550
1551=== modified file 'dash/previews/SocialPreviewComments.h'
1552--- dash/previews/SocialPreviewComments.h 2014-07-08 09:48:09 +0000
1553+++ dash/previews/SocialPreviewComments.h 2014-07-08 09:48:09 +0000
1554@@ -46,14 +46,11 @@
1555
1556 SocialPreviewComments(dash::Preview::Ptr preview_model, NUX_FILE_LINE_PROTO);
1557
1558- virtual ~SocialPreviewComments();
1559+ nux::Property<double> scale;
1560
1561 sigc::signal<void> request_close() const { return preview_container_.request_close; }
1562
1563- nux::Property<double> scale;
1564-
1565 protected:
1566-
1567 typedef nux::ObjectPtr<StaticCairoText> StaticCairoTextPtr;
1568 typedef std::pair<StaticCairoTextPtr, StaticCairoTextPtr> Comment;
1569 std::list<Comment> comments_;
1570@@ -72,19 +69,7 @@
1571 virtual void AddProperties(debug::IntrospectionData&);
1572
1573 private:
1574- void UpdateScale(double scale);
1575-
1576- typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
1577-
1578 PreviewContainer preview_container_;
1579-
1580- nux::VLayout* layout_;
1581- nux::HLayout* name_layout_;
1582-
1583- StaticCairoTextPtr comment_name_;
1584- StaticCairoTextPtr comment_time_;
1585- StaticCairoTextPtr comment_value_;
1586-
1587 };
1588
1589 }
1590
1591=== modified file 'dash/previews/SocialPreviewContent.cpp'
1592--- dash/previews/SocialPreviewContent.cpp 2014-07-08 09:48:09 +0000
1593+++ dash/previews/SocialPreviewContent.cpp 2014-07-08 09:48:09 +0000
1594@@ -41,14 +41,14 @@
1595 const RawPixel BUBBLE_WIDTH = 300_em;
1596 const RawPixel BUBBLE_HEIGHT = 250_em;
1597 const RawPixel TAIL_HEIGHT = 50_em;
1598-const RawPixel TAIL_POS_FROM_RIGHT = 60_em;
1599+const int TAIL_POS_FROM_RIGHT = 60;
1600 const RawPixel TEXT_LINE_SPACING = 5_em;
1601 }
1602
1603 inline nux::Geometry GetBubbleGeometry(nux::Geometry const& geo, double scale)
1604 {
1605- int width = MIN(BUBBLE_WIDTH.CP(scale), geo.width);
1606- int height = MIN(BUBBLE_HEIGHT.CP(scale) + TAIL_HEIGHT.CP(scale), geo.height);
1607+ int width = std::min(BUBBLE_WIDTH.CP(scale), geo.width);
1608+ int height = std::min(BUBBLE_HEIGHT.CP(scale) + TAIL_HEIGHT.CP(scale), geo.height);
1609
1610 return nux::Geometry(geo.x + (geo.width - width)/2, geo.y + (geo.height - height)/2, width, height);
1611 }
1612@@ -66,10 +66,6 @@
1613 scale.changed.connect(sigc::mem_fun(this, &SocialPreviewContent::UpdateScale));
1614 }
1615
1616-SocialPreviewContent::~SocialPreviewContent()
1617-{
1618-}
1619-
1620 void SocialPreviewContent::SetText(std::string const& text)
1621 {
1622 std::stringstream ss;
1623@@ -151,7 +147,8 @@
1624
1625 SetLayout(layout);
1626
1627- cr_bubble_.reset(new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &SocialPreviewContent::RedrawBubble), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
1628+ nux::Geometry bubble_geo = GetGeometry();
1629+ cr_bubble_.reset(new nux::CairoWrapper(bubble_geo, sigc::bind(sigc::mem_fun(this, &SocialPreviewContent::RedrawBubble), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
1630 }
1631
1632 void SocialPreviewContent::UpdateBaloonTexture()
1633@@ -170,7 +167,7 @@
1634
1635 // center text
1636 text_->SetBaseX(geo_cr.x + geo_cr.width/2 - geo_text.width/2);
1637- text_->SetBaseY(geo_cr.y + geo_cr.height/2 - geo_text.height/2 - TAIL_HEIGHT/2);
1638+ text_->SetBaseY(geo_cr.y + geo_cr.height/2 - geo_text.height/2 - TAIL_HEIGHT.CP(scale)/2);
1639
1640 if (geo_cr.width > 0 && geo_cr.height > 0)
1641 {
1642@@ -180,8 +177,9 @@
1643
1644 void SocialPreviewContent::RedrawBubble(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state)
1645 {
1646- double width = std::max(0, cairo_image_surface_get_width(cairo_get_target(cr)));
1647- double height = std::max(0, cairo_image_surface_get_height(cairo_get_target(cr)) - TAIL_HEIGHT);
1648+ auto* surface = cairo_get_target(cr);
1649+ double width = std::max(0.0, cairo_image_surface_get_width(surface) / scale());
1650+ double height = std::max(0.0, cairo_image_surface_get_height(surface) / scale() - TAIL_HEIGHT);
1651
1652 double tailPosition = width - TAIL_POS_FROM_RIGHT - TAIL_HEIGHT;
1653 if (width > 0 && height > 0)
1654@@ -227,11 +225,14 @@
1655 double tailPosition,
1656 double tailWidth)
1657 {
1658+ auto* surface = cairo_get_target(cr);
1659+
1660 // sanity check
1661 if (cairo_status(cr) != CAIRO_STATUS_SUCCESS &&
1662- cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
1663+ cairo_surface_get_type(surface) != CAIRO_SURFACE_TYPE_IMAGE)
1664 return;
1665
1666+ cairo_surface_set_device_scale(surface, scale(), scale());
1667 cairo_set_line_width(cr, line_width);
1668
1669 bool odd = line_width != double((int)line_width);
1670@@ -323,6 +324,8 @@
1671 {
1672 if (text_)
1673 text_->SetScale(scale);
1674+
1675+ UpdateBaloonTexture();
1676 }
1677
1678 }
1679
1680=== modified file 'dash/previews/SocialPreviewContent.h'
1681--- dash/previews/SocialPreviewContent.h 2014-07-08 09:48:09 +0000
1682+++ dash/previews/SocialPreviewContent.h 2014-07-08 09:48:09 +0000
1683@@ -46,14 +46,13 @@
1684 NUX_DECLARE_OBJECT_TYPE(SocialPreviewContent, nux::View);
1685
1686 SocialPreviewContent(std::string const& text, NUX_FILE_LINE_PROTO);
1687- virtual ~SocialPreviewContent();
1688+
1689+ nux::Property<double> scale;
1690
1691 void SetText(std::string const& text);
1692
1693 sigc::signal<void> request_close() const { return preview_container_.request_close; }
1694
1695- nux::Property<double> scale;
1696-
1697 protected:
1698 virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);
1699 virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);
1700
1701=== modified file 'dash/previews/StandaloneMusicPaymentPreview.cpp'
1702--- dash/previews/StandaloneMusicPaymentPreview.cpp 2014-07-08 09:48:09 +0000
1703+++ dash/previews/StandaloneMusicPaymentPreview.cpp 2013-11-18 18:13:59 +0000
1704@@ -147,7 +147,6 @@
1705 void TestRunner::Init ()
1706 {
1707 container_ = new previews::PreviewContainer(NUX_TRACKER_LOCATION);
1708-// container_->scale = 1.62;
1709 container_->request_close.connect([this]() { exit(0); });
1710 container_->DisableNavButton(previews::Navigation::BOTH);
1711
1712@@ -190,8 +189,7 @@
1713 glib::StealRef());
1714
1715 dash::Preview::Ptr preview_model(dash::Preview::PreviewForVariant(v));
1716- if (container_)
1717- container_->Preview(preview_model, previews::Navigation::LEFT);
1718+ container_->Preview(preview_model, previews::Navigation::LEFT);
1719 }
1720
1721 void TestRunner::InitWindowThread(nux::NThread* thread, void* InitData)
1722
1723=== modified file 'dash/previews/StandaloneSocialPreview.cpp'
1724--- dash/previews/StandaloneSocialPreview.cpp 2013-11-18 18:13:59 +0000
1725+++ dash/previews/StandaloneSocialPreview.cpp 2014-07-08 09:48:09 +0000
1726@@ -158,6 +158,7 @@
1727
1728 glib::Object<GIcon> iconHint1(g_icon_new_for_string("/usr/share/pixmaps/faces/sunflower.jpg", NULL));
1729 glib::Object<GIcon> iconHint2(g_icon_new_for_string("/usr/share/unity/6/lens-nav-home.svg", NULL));
1730+ glib::Object<GIcon> iconHint3(g_icon_new_for_string("/usr/share/icons/unity-icon-theme/places/svg/service-twitter.svg", NULL));
1731
1732 glib::Object<UnityProtocolPreview> proto_obj(UNITY_PROTOCOL_PREVIEW(unity_protocol_social_preview_new()));
1733
1734@@ -169,7 +170,7 @@
1735 unity_protocol_preview_set_subtitle(proto_obj, subtitle);
1736 unity_protocol_preview_set_description(proto_obj, description);
1737 unity_protocol_preview_add_action(proto_obj, "view", "View", iconHint2, 0);
1738- unity_protocol_preview_add_action(proto_obj, "retweet", "Retweet", nullptr, 0);
1739+ unity_protocol_preview_add_action(proto_obj, "retweet", "Retweet", iconHint3, 0);
1740 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");
1741 unity_protocol_social_preview_add_comment(UNITY_PROTOCOL_SOCIAL_PREVIEW(proto_obj.RawPtr()), "comment", "Jeremy", "This is a comment", "4 hours ago");
1742 unity_protocol_social_preview_add_comment(UNITY_PROTOCOL_SOCIAL_PREVIEW(proto_obj.RawPtr()), "comment", "Stacy", "This is a comment", "4 hours ago");
1743@@ -180,7 +181,6 @@
1744
1745 dash::Preview::Ptr preview_model(dash::Preview::PreviewForVariant(v));
1746 container_->Preview(preview_model, previews::Navigation::RIGHT);
1747-
1748 }
1749
1750 void TestRunner::NavRight()
1751
1752=== modified file 'dash/previews/Track.cpp'
1753--- dash/previews/Track.cpp 2013-11-19 18:48:35 +0000
1754+++ dash/previews/Track.cpp 2014-07-08 09:48:09 +0000
1755@@ -37,6 +37,13 @@
1756 namespace previews
1757 {
1758
1759+DECLARE_LOGGER(logger, "unity.dash.preview.music.track");
1760+namespace
1761+{
1762+const RawPixel LAYOUT_SPACING = 6_em;
1763+const RawPixel TITLE_PADDING = 3_em;
1764+}
1765+
1766 class TmpView : public nux::View
1767 {
1768 public:
1769@@ -54,12 +61,6 @@
1770
1771 };
1772
1773-DECLARE_LOGGER(logger, "unity.dash.preview.music.track");
1774-namespace
1775-{
1776-const int layout_spacing = 6;
1777-}
1778-
1779 NUX_IMPLEMENT_OBJECT_TYPE(Track);
1780
1781 class TrackProgressLayer : public nux::AbstractPaintLayer
1782@@ -126,12 +127,15 @@
1783
1784 Track::Track(NUX_FILE_LINE_DECL)
1785 : View(NUX_FILE_LINE_PARAM)
1786+ , scale(1.0)
1787 , play_state_(PlayerState::STOPPED)
1788 , progress_(0.0)
1789 , mouse_over_(false)
1790 {
1791 SetupBackground();
1792 SetupViews();
1793+ UpdateScale(scale);
1794+ scale.changed.connect(sigc::mem_fun(this, &Track::UpdateScale));
1795 }
1796
1797 std::string Track::GetName() const
1798@@ -202,23 +206,25 @@
1799 layout->SetLeftAndRightPadding(0,0);
1800
1801 nux::BaseTexture* tex_play = style.GetPlayIcon();
1802- IconTexture* status_play = new IconTexture(tex_play, style.GetStatusIconSize(), style.GetStatusIconSize());
1803- status_play->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
1804+ status_play_ = new IconTexture(tex_play, style.GetStatusIconSize().CP(scale), style.GetStatusIconSize().CP(scale));
1805+ status_play_->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
1806
1807 nux::BaseTexture* tex_pause = style.GetPauseIcon();
1808- IconTexture* status_pause = new IconTexture(tex_pause, style.GetStatusIconSize(), style.GetStatusIconSize());
1809- status_pause->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
1810+ status_pause_ = new IconTexture(tex_pause, style.GetStatusIconSize().CP(scale), style.GetStatusIconSize().CP(scale));
1811+ status_pause_->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
1812
1813 track_number_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
1814 track_number_->SetTextAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
1815 track_number_->SetTextVerticalAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
1816 track_number_->SetLines(-1);
1817+ track_number_->SetScale(scale);
1818 track_number_->SetFont(style.track_font());
1819
1820 title_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
1821 title_->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
1822 title_->SetTextVerticalAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
1823 title_->SetLines(-1);
1824+ title_->SetScale(scale);
1825 title_->SetFont(style.track_font());
1826
1827 duration_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
1828@@ -226,6 +232,7 @@
1829 duration_->SetTextAlignment(StaticCairoText::NUX_ALIGN_RIGHT);
1830 duration_->SetTextVerticalAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
1831 duration_->SetLines(-1);
1832+ duration_->SetScale(scale);
1833 duration_->SetFont(style.track_font());
1834 duration_->SetMaximumWidth(style.GetMusicDurationWidth());
1835 duration_->SetMaximumWidth(style.GetMusicDurationWidth());
1836@@ -234,13 +241,13 @@
1837 status_play_layout_ = new TmpView();
1838 status_play_layout_->SetLayout(new nux::HLayout());
1839 status_play_layout_->GetLayout()->AddSpace(0, 1);
1840- status_play_layout_->GetLayout()->AddView(status_play, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
1841+ status_play_layout_->GetLayout()->AddView(status_play_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
1842 status_play_layout_->GetLayout()->AddSpace(0, 1);
1843
1844 status_pause_layout_ = new TmpView();
1845 status_pause_layout_->SetLayout(new nux::HLayout());
1846 status_pause_layout_->GetLayout()->AddSpace(0, 1);
1847- status_pause_layout_->GetLayout()->AddView(status_pause, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
1848+ status_pause_layout_->GetLayout()->AddView(status_pause_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
1849 status_pause_layout_->GetLayout()->AddSpace(0, 1);
1850
1851 track_number_layout_ = new TmpView();
1852@@ -256,7 +263,7 @@
1853 track_status_layout_->SetActiveLayer(track_number_layout_);
1854
1855 title_layout_ = new nux::HLayout();
1856- title_layout_->SetLeftAndRightPadding(3);
1857+ title_layout_->SetLeftAndRightPadding(TITLE_PADDING.CP(scale));
1858 title_layout_->AddView(title_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
1859 title_layout_->AddSpace(0, 0);
1860
1861@@ -316,7 +323,7 @@
1862 progress_layer_->SetGeometry(geo_progress);
1863 nux::GetPainter().RenderSinglePaintLayer(gfx_engine, progress_layer_->GetGeometry(), progress_layer_.get());
1864 }
1865-
1866+
1867 gfx_engine.GetRenderStates().SetBlend(alpha, src, dest);
1868 }
1869
1870@@ -435,12 +442,44 @@
1871 track_status_layout_->SetMinimumWidth(geo.height);
1872 track_status_layout_->SetMaximumWidth(geo.height);
1873
1874- const int max_width = std::max(GetGeometry().width - geo.height - style.GetMusicDurationWidth() - layout_spacing*2, 0);
1875+ const int max_width = std::max(GetGeometry().width - geo.height - style.GetMusicDurationWidth().CP(scale) - LAYOUT_SPACING.CP(scale)*2, 0);
1876 title_->SetMaximumWidth(max_width);
1877
1878 View::PreLayoutManagement();
1879 }
1880
1881+void Track::UpdateScale(double scale)
1882+{
1883+ if (track_number_)
1884+ track_number_->SetScale(scale);
1885+
1886+ if (title_)
1887+ title_->SetScale(scale);
1888+
1889+ if (duration_)
1890+ duration_->SetScale(scale);
1891+
1892+ if (title_layout_)
1893+ title_layout_->SetLeftAndRightPadding(TITLE_PADDING.CP(scale));
1894+
1895+ previews::Style& style = previews::Style::Instance();
1896+
1897+ if (status_play_)
1898+ {
1899+ status_play_->SetSize(style.GetStatusIconSize().CP(scale));
1900+ status_play_->ReLoadIcon();
1901+ }
1902+
1903+ if (status_pause_)
1904+ {
1905+ status_pause_->SetSize(style.GetStatusIconSize().CP(scale));
1906+ status_pause_->ReLoadIcon();
1907+ }
1908+
1909+ QueueRelayout();
1910+ QueueDraw();
1911+}
1912+
1913 } // namespace previews
1914 } // namespace dash
1915 } // namesapce unity
1916
1917=== modified file 'dash/previews/Track.h'
1918--- dash/previews/Track.h 2013-09-19 16:44:03 +0000
1919+++ dash/previews/Track.h 2014-07-08 09:48:09 +0000
1920@@ -55,18 +55,20 @@
1921
1922 void Update(dash::Track const& track_row);
1923
1924+ nux::Property<double> scale;
1925+
1926 protected:
1927 virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);
1928 virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);
1929 virtual void PreLayoutManagement();
1930 virtual nux::Area* FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type);
1931-
1932+
1933 // From debug::Introspectable
1934 std::string GetName() const;
1935 void AddProperties(debug::IntrospectionData&);
1936-
1937+
1938 virtual bool AcceptKeyNavFocus() { return false; }
1939-
1940+
1941 void SetupBackground();
1942 void SetupViews();
1943
1944@@ -97,9 +99,14 @@
1945 nux::View* status_pause_layout_;
1946 nux::View* track_number_layout_;
1947 nux::LayeredLayout* track_status_layout_;
1948+ IconTexture* status_play_;
1949+ IconTexture* status_pause_;
1950
1951 bool mouse_over_;
1952 connection::Wrapper player_connection_;
1953+
1954+private:
1955+ void UpdateScale(double scale);
1956 };
1957
1958 }
1959
1960=== modified file 'dash/previews/Tracks.cpp'
1961--- dash/previews/Tracks.cpp 2013-09-19 16:44:03 +0000
1962+++ dash/previews/Tracks.cpp 2014-07-08 09:48:09 +0000
1963@@ -34,12 +34,19 @@
1964 {
1965 namespace previews
1966 {
1967+
1968+namespace
1969+{
1970+ const RawPixel CHILDREN_SPACE = 1_em;
1971+}
1972+
1973 DECLARE_LOGGER(logger, "unity.dash.preview.music.tracks");
1974
1975 NUX_IMPLEMENT_OBJECT_TYPE(Tracks);
1976
1977 Tracks::Tracks(dash::Tracks::Ptr tracks, NUX_FILE_LINE_DECL)
1978 : ScrollView(NUX_FILE_LINE_PARAM)
1979+ , scale(1.0)
1980 , tracks_(tracks)
1981 {
1982 SetupViews();
1983@@ -54,6 +61,8 @@
1984 for (std::size_t i = 0; i < tracks_->count.Get(); ++i)
1985 OnTrackAdded(tracks_->RowAtIndex(i));
1986 }
1987+ UpdateScale(scale);
1988+ scale.changed.connect(sigc::mem_fun(this, &Tracks::UpdateScale));
1989 }
1990
1991 std::string Tracks::GetName() const
1992@@ -72,8 +81,8 @@
1993 SetVScrollBar(new dash::PlacesOverlayVScrollBar(NUX_TRACKER_LOCATION));
1994 EnableHorizontalScrollBar(false);
1995 layout_ = new nux::VLayout();
1996- layout_->SetPadding(0, previews::Style::Instance().GetDetailsRightMargin(), 0, 0);
1997- layout_->SetSpaceBetweenChildren(1);
1998+ layout_->SetPadding(0, previews::Style::Instance().GetDetailsRightMargin().CP(scale), 0, 0);
1999+ layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
2000 SetLayout(layout_);
2001 }
2002
2003@@ -84,6 +93,7 @@
2004 return;
2005
2006 pos->second->Update(track_row);
2007+ pos->second->scale = scale();
2008 }
2009
2010 void Tracks::OnTrackAdded(dash::Track const& track_row)
2011@@ -100,8 +110,9 @@
2012 AddChild(track_view.GetPointer());
2013
2014 track_view->Update(track_row);
2015- track_view->SetMinimumHeight(style.GetTrackHeight());
2016- track_view->SetMaximumHeight(style.GetTrackHeight());
2017+ track_view->SetMinimumHeight(style.GetTrackHeight().CP(scale));
2018+ track_view->SetMaximumHeight(style.GetTrackHeight().CP(scale));
2019+ track_view->scale = scale();
2020 layout_->AddView(track_view.GetPointer(), 0);
2021
2022 m_tracks[track_uri] = track_view;
2023@@ -111,7 +122,7 @@
2024 void Tracks::OnTrackRemoved(dash::Track const& track_row)
2025 {
2026 LOG_TRACE(logger) << "OnTrackRemoved for " << track_row.title.Get();
2027-
2028+
2029 auto pos = m_tracks.find(track_row.uri.Get());
2030 if (pos == m_tracks.end())
2031 return;
2032@@ -121,6 +132,26 @@
2033 ComputeContentSize();
2034 }
2035
2036+void Tracks::UpdateScale(double scale)
2037+{
2038+ previews::Style& style = dash::previews::Style::Instance();
2039+
2040+ for (std::map<std::string, previews::Track::Ptr>::iterator it = m_tracks.begin(); it != m_tracks.end(); ++it)
2041+ {
2042+ it->second->scale = scale;
2043+ it->second->SetMinimumHeight(style.GetTrackHeight().CP(scale));
2044+ it->second->SetMaximumHeight(style.GetTrackHeight().CP(scale));
2045+ it->second->SetMinimumWidth(style.GetTrackHeight().CP(scale));
2046+ it->second->SetMaximumWidth(style.GetTrackHeight().CP(scale));
2047+ }
2048+
2049+ if (layout_)
2050+ {
2051+ layout_->SetPadding(0, previews::Style::Instance().GetDetailsRightMargin().CP(scale), 0, 0);
2052+ layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
2053+ }
2054+}
2055+
2056 } // namespace previews
2057 } // namespace dash
2058 } // namespace unity
2059
2060=== modified file 'dash/previews/Tracks.h'
2061--- dash/previews/Tracks.h 2013-09-19 16:44:03 +0000
2062+++ dash/previews/Tracks.h 2014-07-08 09:48:09 +0000
2063@@ -52,6 +52,8 @@
2064
2065 Tracks(dash::Tracks::Ptr tracks, NUX_FILE_LINE_PROTO);
2066
2067+ nux::Property<double> scale;
2068+
2069 protected:
2070 virtual bool AcceptKeyNavFocus() { return false; }
2071
2072@@ -71,6 +73,9 @@
2073 nux::VLayout* layout_;
2074 std::map<std::string, previews::Track::Ptr> m_tracks;
2075 connection::Manager sig_conn_;
2076+
2077+private:
2078+ void UpdateScale(double scale);
2079 };
2080
2081 }
2082
2083=== modified file 'unity-shared/CoverArt.cpp'
2084--- unity-shared/CoverArt.cpp 2014-07-08 09:48:09 +0000
2085+++ unity-shared/CoverArt.cpp 2014-07-08 09:48:09 +0000
2086@@ -453,6 +453,7 @@
2087 overlay_text_->SetTextAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
2088 overlay_text_->SetFont("Ubuntu 14");
2089 overlay_text_->SetLines(-3);
2090+ overlay_text_->SetScale(scale);
2091 overlay_text_->SetText(_("No Image Available"));
2092
2093 dash::Style& style = dash::Style::Instance();
2094
2095=== modified file 'unity-shared/DashStyle.cpp'
2096--- unity-shared/DashStyle.cpp 2014-03-21 04:06:28 +0000
2097+++ unity-shared/DashStyle.cpp 2014-07-08 09:48:09 +0000
2098@@ -92,6 +92,16 @@
2099 }
2100 }
2101
2102+template <typename T>
2103+inline void get_actual_cairo_size(cairo_t* cr, T* width, T* height)
2104+{
2105+ double w_scale, h_scale;
2106+ auto* surface = cairo_get_target(cr);
2107+ cairo_surface_get_device_scale(surface, &w_scale, &h_scale);
2108+ *width = cairo_image_surface_get_width(surface) / w_scale;
2109+ *height = cairo_image_surface_get_height(surface) / h_scale;
2110+}
2111+
2112 class LazyLoadTexture
2113 {
2114 public:
2115@@ -682,9 +692,8 @@
2116 cairo_surface_flush(surface);
2117
2118 pixels = cairo_image_surface_get_data(surface);
2119- width = cairo_image_surface_get_width(surface);
2120- height = cairo_image_surface_get_height(surface);
2121 format = cairo_image_surface_get_format(surface);
2122+ get_actual_cairo_size(cr, &width, &height);
2123
2124 switch (format)
2125 {
2126@@ -782,8 +791,8 @@
2127 {
2128 double x = 0.0;
2129 double y = 0.0;
2130- double w = cairo_image_surface_get_width(cairo_get_target(cr));
2131- double h = cairo_image_surface_get_height(cairo_get_target(cr));
2132+ double w, h;
2133+ get_actual_cairo_size(cr, &w, &h);
2134 /*double xt = 0.0;
2135 double yt = 0.0;*/
2136
2137@@ -830,8 +839,11 @@
2138 {
2139 double x = 2.0;
2140 double y = 2.0;
2141- double w = cairo_image_surface_get_width(cairo_get_target(cr)) - 4.0;
2142- double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;
2143+
2144+ double w, h;
2145+ get_actual_cairo_size(cr, &w, &h);
2146+ w -= 4.0;
2147+ h -= 4.0;
2148
2149 // - these absolute values are the "cost" of getting only a SVG from design
2150 // and not a generic formular how to approximate the curve-shape, thus
2151@@ -1212,8 +1224,10 @@
2152 {
2153 double x = 0.0;
2154 double y = 2.0;
2155- double w = cairo_image_surface_get_width(cairo_get_target(cr));
2156- double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;
2157+
2158+ double w, h;
2159+ get_actual_cairo_size(cr, &w, &h);
2160+ h -= 4.0;
2161
2162 // - these absolute values are the "cost" of getting only a SVG from design
2163 // and not a generic formular how to approximate the curve-shape, thus
2164@@ -1446,9 +1460,7 @@
2165 gchar* fontName = NULL;
2166 //double horizMargin = 10.0;
2167
2168- w = cairo_image_surface_get_width(cairo_get_target(cr));
2169- h = cairo_image_surface_get_height(cairo_get_target(cr));
2170-
2171+ get_actual_cairo_size(cr, &w, &h);
2172 w -= 2 * horizMargin;
2173
2174 if (!screen)
2175@@ -1577,6 +1589,8 @@
2176 const unsigned char* data = NULL;
2177 int width = 0;
2178 int height = 0;
2179+ double w_scale = 0;
2180+ double h_scale = 0;
2181 int stride = 0;
2182 unsigned char* buffer = NULL;
2183 cairo_surface_t* surface = NULL;
2184@@ -1586,9 +1600,9 @@
2185 // aquire info about image-surface
2186 target = cairo_get_target(cr);
2187 data = cairo_image_surface_get_data(target);
2188- width = cairo_image_surface_get_width(target);
2189- height = cairo_image_surface_get_height(target);
2190 stride = cairo_image_surface_get_stride(target);
2191+ get_actual_cairo_size(cr, &width, &height);
2192+ cairo_surface_get_device_scale(target, &w_scale, &h_scale);
2193 cairo_format_t format = cairo_image_surface_get_format(target);
2194
2195 // get buffer
2196@@ -1621,6 +1635,7 @@
2197 }
2198
2199 // blur and blend overlay onto initial image-surface
2200+ cairo_surface_set_device_scale(surface, w_scale, h_scale);
2201 Blur(blurred_cr, blurSize);
2202 cairo_set_source_surface(cr, surface, 0.0, 0.0);
2203 old = SetBlendMode(cr, mode);
2204@@ -1649,8 +1664,8 @@
2205 garnish = GetButtonGarnishSize();
2206
2207 //ButtonOutlinePath(cr, true);
2208- double w = cairo_image_surface_get_width(cairo_get_target(cr));
2209- double h = cairo_image_surface_get_height(cairo_get_target(cr));
2210+ double w, h;
2211+ get_actual_cairo_size(cr, &w, &h);
2212
2213 cairo_set_line_width(cr, pimpl->button_label_border_size_[state]);
2214
2215@@ -1743,8 +1758,8 @@
2216 if (zeromargin == false)
2217 garnish = GetButtonGarnishSize();
2218
2219- double w = cairo_image_surface_get_width(cairo_get_target(cr));
2220- double h = cairo_image_surface_get_height(cairo_get_target(cr));
2221+ double w, h;
2222+ get_actual_cairo_size(cr, &w, &h);
2223
2224 double x = garnish;
2225 double y = garnish;
2226@@ -1854,8 +1869,8 @@
2227 if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
2228 return false;
2229
2230- double w = cairo_image_surface_get_width(cairo_get_target(cr));
2231- double h = cairo_image_surface_get_height(cairo_get_target(cr));
2232+ double w, h;
2233+ get_actual_cairo_size(cr, &w, &h);
2234
2235 nux::Color color(nux::color::White);
2236 color.alpha = alpha;
2237@@ -1891,10 +1906,11 @@
2238 return false;
2239
2240 //ButtonOutlinePathSegment(cr, segment);
2241- double x = 0.0;
2242- double y = 2.0;
2243- double w = cairo_image_surface_get_width(cairo_get_target(cr));
2244- double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;
2245+ double x = 0.0;
2246+ double y = 2.0;
2247+ double w, h;
2248+ get_actual_cairo_size(cr, &w, &h);
2249+ h -= 4.0;
2250
2251 if (segment == Segment::LEFT)
2252 {
2253@@ -1969,8 +1985,9 @@
2254
2255 double x = 0.0;
2256 double y = 2.0;
2257- double w = cairo_image_surface_get_width(cairo_get_target(cr));
2258- double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;
2259+ double w, h;
2260+ get_actual_cairo_size(cr, &w, &h);
2261+ h -= 4.0;
2262
2263 if (segment == Segment::LEFT)
2264 {
2265@@ -2062,8 +2079,8 @@
2266 if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
2267 return false;
2268
2269- double w = cairo_image_surface_get_width(cairo_get_target(cr));
2270- double h = cairo_image_surface_get_height(cairo_get_target(cr));
2271+ double w, h;
2272+ get_actual_cairo_size(cr, &w, &h);
2273 double x = w / 2.0;
2274 double y = 2.0;
2275
2276@@ -2090,8 +2107,8 @@
2277 if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
2278 return false;
2279
2280- double w = cairo_image_surface_get_width(cairo_get_target(cr));
2281- double h = cairo_image_surface_get_height(cairo_get_target(cr));
2282+ double w, h;
2283+ get_actual_cairo_size(cr, &w, &h);
2284 double x = 2.0;
2285 double y = h / 2.0;
2286
2287
2288=== modified file 'unity-shared/IconTexture.cpp'
2289--- unity-shared/IconTexture.cpp 2014-03-01 22:51:41 +0000
2290+++ unity-shared/IconTexture.cpp 2014-07-08 09:48:09 +0000
2291@@ -226,22 +226,18 @@
2292 if (_draw_mode == DrawMode::STRETCH_WITH_ASPECT)
2293 {
2294 nux::Geometry imageDest = geo;
2295-
2296- float geo_apsect = float(geo.GetWidth()) / geo.GetHeight();
2297+
2298+ float geo_apsect = float(geo.width) / geo.width;
2299 float image_aspect = float(_texture_cached->GetWidth()) / _texture_cached->GetHeight();
2300
2301 if (image_aspect > geo_apsect)
2302 {
2303 imageDest.SetHeight(float(imageDest.GetWidth()) / image_aspect);
2304- }
2305+ }
2306 if (image_aspect < geo_apsect)
2307 {
2308 imageDest.SetWidth(image_aspect * imageDest.GetHeight());
2309 }
2310- else
2311- {
2312- imageDest = nux::Geometry(0, 0, _texture_cached->GetWidth(), _texture_cached->GetHeight());
2313- }
2314
2315 texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_SCALE_COORD);
2316 texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);