Merge lp:~hikiko/unity/unity.previews-text-scale into lp:unity

Proposed by Eleni Maria Stea
Status: Work in progress
Proposed branch: lp:~hikiko/unity/unity.previews-text-scale
Merge into: lp:unity
Diff against target: 1743 lines (+327/-49)
30 files modified
dash/previews/ActionButton.cpp (+28/-6)
dash/previews/ActionButton.h (+6/-0)
dash/previews/ActionLink.cpp (+9/-0)
dash/previews/ActionLink.h (+5/-1)
dash/previews/ApplicationPreview.cpp (+9/-1)
dash/previews/ErrorPreview.cpp (+12/-0)
dash/previews/GenericPreview.cpp (+6/-0)
dash/previews/MoviePreview.cpp (+6/-0)
dash/previews/MusicPaymentPreview.cpp (+29/-2)
dash/previews/MusicPreview.cpp (+5/-0)
dash/previews/PaymentPreview.cpp (+3/-0)
dash/previews/Preview.cpp (+16/-2)
dash/previews/Preview.h (+7/-0)
dash/previews/PreviewContainer.cpp (+17/-7)
dash/previews/PreviewContainer.h (+6/-0)
dash/previews/PreviewInfoHintWidget.cpp (+24/-11)
dash/previews/PreviewInfoHintWidget.h (+6/-0)
dash/previews/PreviewNavigator.cpp (+12/-2)
dash/previews/PreviewNavigator.h (+7/-1)
dash/previews/PreviewRatingsWidget.cpp (+12/-2)
dash/previews/PreviewRatingsWidget.h (+6/-0)
dash/previews/SocialPreview.cpp (+6/-1)
dash/previews/SocialPreviewComments.cpp (+12/-0)
dash/previews/SocialPreviewComments.h (+6/-0)
dash/previews/SocialPreviewContent.cpp (+10/-0)
dash/previews/SocialPreviewContent.h (+6/-0)
dash/previews/Track.cpp (+12/-0)
dash/previews/Track.h (+7/-0)
unity-shared/CoverArt.cpp (+31/-13)
unity-shared/CoverArt.h (+6/-0)
To merge this branch: bzr merge lp:~hikiko/unity/unity.previews-text-scale
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer Pending
Unity Team Pending
Review via email: mp+217572@code.launchpad.net

Commit message

scales the text of the previews

Description of the change

scales the text of the previews

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

It only scales the text :)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
3812. By Eleni Maria Stea

quick backup:
fixed padding - container's scaling, button text

todo:
fixes in ratings, buttons

3813. By Eleni Maria Stea

quick backup: Images, Image not found text scaled
missing: buttons, icon

3814. By Eleni Maria Stea

minor fix

3815. By Eleni Maria Stea

minor fix

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

35 + SetMinimumHeight((int)(scale * kMinButtonHeight));
36 + SetMinimumWidth((int)(scale * kMinButtonWidth));

Like everywhere else you used scale * SOME_INT, replace that using RawPixel instead as const value (if applicable), and anyway convert it using RawPixel.CP...

Where this is not convenient, use instead:
std::round(int_value * scale)

Also, don't store EMConverter::Ptr cv_ where you don't need it, or use UpdateScale.
Keep this dynamic, you can simply do something like:

BaseClass.h:
nux::Property<double> monitor;
nux::Property<double> scale;

BaseClass.cpp:
BaseClass::BaseClass() :
 : monitor(0)
 , scale(Settings::Instance().em(monitor)->DPIScale())
{
monitor.changed.connect(sigc::hide(sigc::mem_fun(this, &BaseClass::OnDPIChanged)));
Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &BaseClass::OnDPIChanged));
}

BaseClass::OnDPIChanged()
{
scale = Settings::Instance().em(monitor)->DPIScale();
}

That's all.
Then in extended classes if you need to redraw something when scale changes, you can just connect to scale.changed signal.

If you don't want to expose the monitor as property, just make sure you use the proper EMConverter in the preview, for the current dash monitor (this code doesn't seem to care about it currently).

Compare this to what we did in lp:~brandontschaefer/unity/shutdown-dialog-hi-dpi/+merge/217144 or in lp:~3v1n0/unity/dash-hidpi-cleanup/+merge/211861 for reference.

3816. By Eleni Maria Stea

fixed icon scaling in app previews

3817. By Eleni Maria Stea

fixed more Icons

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

@Marko: thanks a lot for the review! I will look at the branches and fix the code to use RawPixel, round etc. About the signal connector: I didn't keep it dynamic because, when the scale.changed signal is emitted there is no Preview instance, so, OnDPIChanged() is never called.

Unmerged revisions

3817. By Eleni Maria Stea

fixed more Icons

3816. By Eleni Maria Stea

fixed icon scaling in app previews

3815. By Eleni Maria Stea

minor fix

3814. By Eleni Maria Stea

minor fix

3813. By Eleni Maria Stea

quick backup: Images, Image not found text scaled
missing: buttons, icon

3812. By Eleni Maria Stea

quick backup:
fixed padding - container's scaling, button text

todo:
fixes in ratings, buttons

3811. By Eleni Maria Stea

put back empty lines - fix diff

3810. By Eleni Maria Stea

put back accidentally removed empty lines and comments to get a cleaner diff

3809. By Eleni Maria Stea

refactoring - adding scaling in all StaticCairoText

3808. By Eleni Maria Stea

scaled SocialPreviewComments text

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/previews/ActionButton.cpp'
2--- dash/previews/ActionButton.cpp 2013-11-19 18:48:35 +0000
3+++ dash/previews/ActionButton.cpp 2014-05-09 14:03:42 +0000
4@@ -25,6 +25,7 @@
5 #include <Nux/HLayout.h>
6 #include "unity-shared/IconTexture.h"
7 #include "unity-shared/StaticCairoText.h"
8+#include "unity-shared/UnitySettings.h"
9
10 namespace
11 {
12@@ -44,6 +45,7 @@
13 : nux::AbstractButton(NUX_FILE_LINE_PARAM)
14 , action_hint_(action_hint)
15 , image_(nullptr)
16+ , cv_(Settings::Instance().em())
17 {
18 SetAcceptKeyNavFocusOnMouseDown(false);
19 SetAcceptKeyNavFocusOnMouseEnter(true);
20@@ -84,6 +86,8 @@
21
22 void ActionButton::InitTheme()
23 {
24+ UpdateScale();
25+
26 if (!cr_active_)
27 {
28 nux::Geometry const& geo = GetGeometry();
29@@ -94,8 +98,8 @@
30 cr_focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &ActionButton::RedrawFocusOverlay)));
31 }
32
33- SetMinimumHeight(kMinButtonHeight);
34- SetMinimumWidth(kMinButtonWidth);
35+ SetMinimumHeight((int)(scale * kMinButtonHeight));
36+ SetMinimumWidth((int)(scale * kMinButtonWidth));
37 }
38
39 void ActionButton::SetExtraHint(std::string const& extra_hint, std::string const& font_hint)
40@@ -104,6 +108,10 @@
41 if (extra_text_)
42 {
43 extra_text_->SetFont(extra_font_hint_);
44+
45+ UpdateScale();
46+ extra_text_->SetScale(scale);
47+
48 ComputeContentSize();
49 QueueDraw();
50 }
51@@ -112,6 +120,8 @@
52
53 void ActionButton::BuildLayout(std::string const& label, std::string const& icon_hint, std::string const& extra_hint)
54 {
55+ UpdateScale();
56+
57 if (icon_hint != icon_hint_)
58 {
59 icon_hint_ = icon_hint;
60@@ -123,13 +133,13 @@
61
62 if (!icon_hint_.empty())
63 {
64- image_ = new IconTexture(icon_hint, icon_size);
65+ image_ = new IconTexture(icon_hint, (int)(icon_size * scale));
66 image_->texture_updated.connect([this](nux::ObjectPtr<nux::BaseTexture> const&)
67 {
68 BuildLayout(label_, icon_hint_, extra_hint_);
69 });
70 image_->SetInputEventSensitivity(false);
71- image_->SetMinMaxSize(icon_size, icon_size);
72+ image_->SetMinMaxSize((int)(icon_size * scale), (int)(icon_size * scale));
73 }
74 }
75
76@@ -149,6 +159,7 @@
77 static_text_->SetFont(font_hint_);
78 static_text_->SetInputEventSensitivity(false);
79 static_text_->SetTextAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
80+ static_text_->SetScale(scale);
81 }
82 }
83
84@@ -168,14 +179,15 @@
85 extra_text_->SetFont(extra_font_hint_);
86 extra_text_->SetInputEventSensitivity(false);
87 extra_text_->SetTextAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
88+ extra_text_->SetScale(scale);
89 }
90 }
91
92 RemoveLayout();
93
94 nux::HLayout* layout = new nux::HLayout();
95- layout->SetHorizontalInternalMargin(6);
96- layout->SetPadding(2, 0, 2, 0);
97+ layout->SetHorizontalInternalMargin((int)(6 * scale));
98+ layout->SetPadding((int)(2 * scale), 0, (int)(2 * scale), 0);
99 layout->AddSpace(0,1);
100 if (image_)
101 layout->AddView(image_.GetPointer(), 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
102@@ -186,6 +198,7 @@
103 layout->AddSpace(0,1);
104 SetLayout(layout);
105
106+
107 ComputeContentSize();
108 QueueDraw();
109 }
110@@ -296,6 +309,10 @@
111 if (static_text_)
112 {
113 static_text_->SetFont(font_hint);
114+
115+ UpdateScale();
116+ static_text_->SetScale(scale);
117+
118 ComputeContentSize();
119 QueueDraw();
120 }
121@@ -311,5 +328,10 @@
122 return extra_hint_;
123 }
124
125+void ActionButton::UpdateScale()
126+{
127+ scale = cv_->DPIScale();
128+}
129+
130 } // namespace dash
131 } // namespace unity
132
133=== modified file 'dash/previews/ActionButton.h'
134--- dash/previews/ActionButton.h 2013-09-19 16:44:03 +0000
135+++ dash/previews/ActionButton.h 2014-05-09 14:03:42 +0000
136@@ -27,6 +27,7 @@
137 #include <Nux/CairoWrapper.h>
138 #include <Nux/AbstractButton.h>
139 #include "unity-shared/Introspectable.h"
140+#include "unity-shared/EMConverter.h"
141
142 namespace unity
143 {
144@@ -59,6 +60,8 @@
145 std::string GetLabel() const;
146 std::string GetExtraText() const;
147
148+ nux::Property<double> scale;
149+
150 protected:
151 virtual long ComputeContentSize();
152 virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
153@@ -95,6 +98,9 @@
154 nux::ObjectPtr<IconTexture> image_;
155 nux::ObjectPtr<unity::StaticCairoText> static_text_;
156 nux::ObjectPtr<unity::StaticCairoText> extra_text_;
157+
158+ EMConverter::Ptr cv_;
159+ void UpdateScale();
160 };
161
162 } // namespace dash
163
164=== modified file 'dash/previews/ActionLink.cpp'
165--- dash/previews/ActionLink.cpp 2013-11-19 18:48:35 +0000
166+++ dash/previews/ActionLink.cpp 2014-05-09 14:03:42 +0000
167@@ -25,6 +25,7 @@
168 #include "unity-shared/DashStyle.h"
169 #include "unity-shared/IconTexture.h"
170 #include "unity-shared/StaticCairoText.h"
171+#include "unity-shared/UnitySettings.h"
172
173 namespace
174 {
175@@ -43,6 +44,7 @@
176 , action_hint_(action_hint)
177 , aligment_(StaticCairoText::NUX_ALIGN_CENTRE)
178 , underline_(StaticCairoText::NUX_UNDERLINE_SINGLE)
179+ , cv_(Settings::Instance().em())
180 {
181 Init();
182 BuildLayout(label);
183@@ -94,6 +96,7 @@
184
185 void ActionLink::BuildLayout(std::string const& label)
186 {
187+ UpdateScale();
188
189 if (label != label_)
190 {
191@@ -112,6 +115,7 @@
192 static_text_->SetInputEventSensitivity(false);
193 static_text_->SetTextAlignment(aligment_);
194 static_text_->SetUnderline(underline_);
195+ static_text_->SetScale(scale);
196 }
197 }
198
199@@ -243,5 +247,10 @@
200 return label_;
201 }
202
203+void ActionLink::UpdateScale()
204+{
205+ scale = cv_->DPIScale();
206+}
207+
208 } // namespace dash
209 } // namespace unity
210
211=== modified file 'dash/previews/ActionLink.h'
212--- dash/previews/ActionLink.h 2013-09-19 16:44:03 +0000
213+++ dash/previews/ActionLink.h 2014-05-09 14:03:42 +0000
214@@ -28,7 +28,7 @@
215 #include <Nux/AbstractButton.h>
216 #include "unity-shared/Introspectable.h"
217 #include "unity-shared/StaticCairoText.h"
218-
219+#include "unity-shared/EMConverter.h"
220
221 namespace unity
222 {
223@@ -56,6 +56,8 @@
224 std::string GetLabel() const;
225 std::string GetExtraText() const;
226
227+ nux::Property<double> scale;
228+
229 protected:
230 nux::ObjectPtr<StaticCairoText> static_text_;
231
232@@ -91,6 +93,8 @@
233 private:
234 typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
235
236+ EMConverter::Ptr cv_;
237+ void UpdateScale();
238
239 };
240
241
242=== modified file 'dash/previews/ApplicationPreview.cpp'
243--- dash/previews/ApplicationPreview.cpp 2013-11-19 18:48:35 +0000
244+++ dash/previews/ApplicationPreview.cpp 2014-05-09 14:03:42 +0000
245@@ -119,6 +119,8 @@
246
247 previews::Style& style = dash::previews::Style::Instance();
248
249+ UpdateScale();
250+
251 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); };
252
253 nux::HLayout* image_data_layout = new nux::HLayout();
254@@ -146,7 +148,7 @@
255 // Icon Layout
256 nux::VLayout* icon_layout = new nux::VLayout();
257 icon_layout->SetSpaceBetweenChildren(3);
258- app_icon_ = new IconTexture(app_preview_model->app_icon.Get().RawPtr() ? g_icon_to_string(app_preview_model->app_icon.Get().RawPtr()) : "", 72);
259+ app_icon_ = new IconTexture(app_preview_model->app_icon.Get().RawPtr() ? g_icon_to_string(app_preview_model->app_icon.Get().RawPtr()) : "", (int)(scale * 72));
260 AddChild(app_icon_.GetPointer());
261 app_icon_->SetMinimumSize(style.GetAppIconAreaWidth(), style.GetAppIconAreaWidth());
262 app_icon_->SetMaximumSize(style.GetAppIconAreaWidth(), style.GetAppIconAreaWidth());
263@@ -179,6 +181,7 @@
264 AddChild(title_.GetPointer());
265 title_->SetLines(-1);
266 title_->SetFont(style.title_font().c_str());
267+ title_->SetScale(scale);
268 title_->mouse_click.connect(on_mouse_down);
269 title_subtitle_layout_->AddView(title_.GetPointer(), 1);
270
271@@ -188,6 +191,7 @@
272 AddChild(subtitle_.GetPointer());
273 subtitle_->SetFont(style.subtitle_size_font().c_str());
274 subtitle_->SetLines(-1);
275+ subtitle_->SetScale(scale);
276 subtitle_->mouse_click.connect(on_mouse_down);
277 title_subtitle_layout_->AddView(subtitle_.GetPointer(), 1);
278 }
279@@ -201,6 +205,7 @@
280 AddChild(license_.GetPointer());
281 license_->SetFont(style.app_license_font().c_str());
282 license_->SetLines(-1);
283+ license_->SetScale(scale);
284 license_->mouse_click.connect(on_mouse_down);
285 app_updated_copywrite_layout->AddView(license_.GetPointer(), 1);
286 }
287@@ -213,6 +218,7 @@
288 last_update_ = new StaticCairoText(last_update.str(), true, NUX_TRACKER_LOCATION);
289 AddChild(last_update_.GetPointer());
290 last_update_->SetFont(style.app_last_update_font().c_str());
291+ last_update_->SetScale(scale);
292 last_update_->mouse_click.connect(on_mouse_down);
293 app_updated_copywrite_layout->AddView(last_update_.GetPointer(), 1);
294 }
295@@ -223,6 +229,7 @@
296 AddChild(copywrite_.GetPointer());
297 copywrite_->SetFont(style.app_copywrite_font().c_str());
298 copywrite_->SetLines(-1);
299+ copywrite_->SetScale(scale);
300 copywrite_->mouse_click.connect(on_mouse_down);
301 app_updated_copywrite_layout->AddView(copywrite_.GetPointer(), 1);
302 }
303@@ -255,6 +262,7 @@
304 description_->SetTextAlignment(StaticCairoText::NUX_ALIGN_TOP);
305 description_->SetLines(-style.GetDescriptionLineCount());
306 description_->SetLineSpacing(style.GetDescriptionLineSpacing());
307+ description_->SetScale(scale);
308 description_->mouse_click.connect(on_mouse_down);
309 app_info_layout->AddView(description_.GetPointer());
310 }
311
312=== modified file 'dash/previews/ErrorPreview.cpp'
313--- dash/previews/ErrorPreview.cpp 2013-09-19 16:44:03 +0000
314+++ dash/previews/ErrorPreview.cpp 2014-05-09 14:03:42 +0000
315@@ -121,6 +121,8 @@
316
317 nux::Layout* ErrorPreview::GetTitle()
318 {
319+ UpdateScale();
320+
321 previews::Style& style = dash::previews::Style::Instance();
322 nux::VLayout* title_data_layout = new nux::VLayout();
323 title_data_layout->SetMaximumHeight(76);
324@@ -135,6 +137,7 @@
325 title_->SetFont(style.title_font());
326 title_->SetMaximumWidth(480);
327 title_->SetTextEllipsize(StaticCairoText::EllipsizeState::NUX_ELLIPSIZE_END);
328+ title_->SetScale(scale);
329 title_data_layout->AddView(title_.GetPointer(), 1);
330
331 subtitle_ = new StaticCairoText(
332@@ -142,6 +145,7 @@
333 NUX_TRACKER_LOCATION);
334 subtitle_->SetLines(-1);
335 subtitle_->SetFont(style.payment_subtitle_font());
336+ subtitle_->SetScale(scale);
337 title_data_layout->AddView(subtitle_.GetPointer(), 1);
338 title_data_layout->AddSpace(1, 1);
339 return title_data_layout;
340@@ -149,6 +153,8 @@
341
342 nux::Layout* ErrorPreview::GetPrice()
343 {
344+ UpdateScale();
345+
346 previews::Style& style = dash::previews::Style::Instance();
347 nux::VLayout *prize_data_layout = new nux::VLayout();
348 prize_data_layout->SetMaximumHeight(76);
349@@ -160,6 +166,7 @@
350 NUX_TRACKER_LOCATION);
351 purchase_prize_->SetLines(-1);
352 purchase_prize_->SetFont(style.payment_prize_title_font());
353+ purchase_prize_->SetScale(scale);
354 prize_data_layout->AddView(purchase_prize_.GetPointer(), 1,
355 nux::MINOR_POSITION_END);
356
357@@ -168,6 +175,7 @@
358 true, NUX_TRACKER_LOCATION);
359 purchase_hint_->SetLines(-1);
360 purchase_hint_->SetFont(style.payment_prize_subtitle_font());
361+ purchase_hint_->SetScale(scale);
362 prize_data_layout->AddView(purchase_hint_.GetPointer(), 1,
363 nux::MINOR_POSITION_END);
364
365@@ -176,6 +184,7 @@
366 NUX_TRACKER_LOCATION);
367 purchase_type_->SetLines(-1);
368 purchase_type_->SetFont(style.payment_prize_subtitle_font());
369+ purchase_type_->SetScale(scale);
370 prize_data_layout->AddView(purchase_type_.GetPointer(), 1,
371 nux::MINOR_POSITION_END);
372 return prize_data_layout;
373@@ -183,6 +192,8 @@
374
375 nux::Layout* ErrorPreview::GetBody()
376 {
377+ UpdateScale();
378+
379 previews::Style& style = dash::previews::Style::Instance();
380 nux::HLayout *body_layout = new nux::HLayout();
381 nux::HLayout *intro_layout = new nux::HLayout();
382@@ -199,6 +210,7 @@
383 intro_->SetLines(-3);
384 intro_->SetLineSpacing(10);
385 intro_->SetTextEllipsize(StaticCairoText::EllipsizeState::NUX_ELLIPSIZE_END);
386+ intro_->SetScale(scale);
387
388 intro_layout->AddView(intro_.GetPointer());//, 0, nux::MINOR_POSITION_CENTER);
389
390
391=== modified file 'dash/previews/GenericPreview.cpp'
392--- dash/previews/GenericPreview.cpp 2013-11-19 18:48:35 +0000
393+++ dash/previews/GenericPreview.cpp 2014-05-09 14:03:42 +0000
394@@ -111,6 +111,8 @@
395 }
396 previews::Style& style = dash::previews::Style::Instance();
397
398+ UpdateScale();
399+
400 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); };
401
402 nux::HLayout* image_data_layout = new nux::HLayout();
403@@ -139,6 +141,7 @@
404 AddChild(title_.GetPointer());
405 title_->SetLines(-1);
406 title_->SetFont(style.title_font().c_str());
407+ title_->SetScale(scale);
408 title_->mouse_click.connect(on_mouse_down);
409 preview_data_layout->AddView(title_.GetPointer(), 1);
410
411@@ -148,6 +151,7 @@
412 AddChild(subtitle_.GetPointer());
413 subtitle_->SetLines(-1);
414 subtitle_->SetFont(style.subtitle_size_font().c_str());
415+ subtitle_->SetScale(scale);
416 subtitle_->mouse_click.connect(on_mouse_down);
417 preview_data_layout->AddView(subtitle_.GetPointer(), 1);
418 }
419@@ -171,6 +175,7 @@
420 description_->SetTextAlignment(StaticCairoText::NUX_ALIGN_TOP);
421 description_->SetLines(-style.GetDescriptionLineCount());
422 description_->SetLineSpacing(style.GetDescriptionLineSpacing());
423+ description_->SetScale(scale);
424 description_->mouse_click.connect(on_mouse_down);
425 preview_info_layout->AddView(description_.GetPointer());
426 }
427@@ -203,6 +208,7 @@
428 mouse_click.connect(on_mouse_down);
429
430 SetLayout(image_data_layout);
431+ UpdateScale();
432 }
433
434 void GenericPreview::PreLayoutManagement()
435
436=== modified file 'dash/previews/MoviePreview.cpp'
437--- dash/previews/MoviePreview.cpp 2013-11-19 18:48:35 +0000
438+++ dash/previews/MoviePreview.cpp 2014-05-09 14:03:42 +0000
439@@ -121,6 +121,8 @@
440 }
441 previews::Style& style = dash::previews::Style::Instance();
442
443+ UpdateScale();
444+
445 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); };
446
447 nux::HLayout* image_data_layout = new nux::HLayout();
448@@ -149,6 +151,7 @@
449 AddChild(title_.GetPointer());
450 title_->SetLines(-1);
451 title_->SetFont(style.title_font().c_str());
452+ title_->SetScale(scale);
453 title_->mouse_click.connect(on_mouse_down);
454 app_data_layout->AddView(title_.GetPointer(), 1);
455
456@@ -158,6 +161,7 @@
457 AddChild(subtitle_.GetPointer());
458 subtitle_->SetLines(-1);
459 subtitle_->SetFont(style.subtitle_size_font().c_str());
460+ subtitle_->SetScale(scale);
461 subtitle_->mouse_click.connect(on_mouse_down);
462 app_data_layout->AddView(subtitle_.GetPointer(), 1);
463 }
464@@ -199,6 +203,7 @@
465 description_->SetTextAlignment(StaticCairoText::NUX_ALIGN_TOP);
466 description_->SetLines(-style.GetDescriptionLineCount());
467 description_->SetLineSpacing(style.GetDescriptionLineSpacing());
468+ description_->SetScale(scale);
469 description_->mouse_click.connect(on_mouse_down);
470 preview_info_layout->AddView(description_.GetPointer());
471 }
472@@ -224,6 +229,7 @@
473 mouse_click.connect(on_mouse_down);
474
475 SetLayout(image_data_layout);
476+ UpdateScale();
477 }
478
479
480
481=== modified file 'dash/previews/MusicPaymentPreview.cpp'
482--- dash/previews/MusicPaymentPreview.cpp 2013-09-19 16:44:03 +0000
483+++ dash/previews/MusicPaymentPreview.cpp 2014-05-09 14:03:42 +0000
484@@ -146,6 +146,8 @@
485
486 nux::Layout* MusicPaymentPreview::GetTitle()
487 {
488+ UpdateScale();
489+
490 previews::Style& style = dash::previews::Style::Instance();
491 nux::VLayout* title_data_layout = new nux::VLayout();
492 title_data_layout->SetMaximumHeight(76);
493@@ -160,6 +162,7 @@
494 title_->SetFont(style.title_font());
495 title_->SetMaximumWidth(480);
496 title_->SetTextEllipsize(StaticCairoText::EllipsizeState::NUX_ELLIPSIZE_END);
497+ title_->SetScale(scale);
498 title_data_layout->AddView(title_.GetPointer(), 1);
499
500 subtitle_ = new StaticCairoText(
501@@ -167,6 +170,7 @@
502 NUX_TRACKER_LOCATION);
503 subtitle_->SetLines(-1);
504 subtitle_->SetFont(style.payment_subtitle_font());
505+ subtitle_->SetScale(scale);
506 title_data_layout->AddView(subtitle_.GetPointer(), 1);
507 title_data_layout->AddSpace(1, 1);
508 return title_data_layout;
509@@ -174,6 +178,8 @@
510
511 nux::Layout* MusicPaymentPreview::GetPrice()
512 {
513+ UpdateScale();
514+
515 previews::Style& style = dash::previews::Style::Instance();
516 nux::VLayout *prize_data_layout = new nux::VLayout();
517 prize_data_layout->SetMaximumHeight(76);
518@@ -185,6 +191,7 @@
519 NUX_TRACKER_LOCATION);
520 purchase_prize_->SetLines(-1);
521 purchase_prize_->SetFont(style.payment_prize_title_font());
522+ purchase_prize_->SetScale(scale);
523 prize_data_layout->AddView(purchase_prize_.GetPointer(), 1,
524 nux::MINOR_POSITION_END);
525
526@@ -193,6 +200,7 @@
527 true, NUX_TRACKER_LOCATION);
528 purchase_hint_->SetLines(-1);
529 purchase_hint_->SetFont(style.payment_prize_subtitle_font());
530+ purchase_hint_->SetScale(scale);
531 prize_data_layout->AddView(purchase_hint_.GetPointer(), 1,
532 nux::MINOR_POSITION_END);
533
534@@ -201,6 +209,7 @@
535 NUX_TRACKER_LOCATION);
536 purchase_type_->SetLines(-1);
537 purchase_type_->SetFont(style.payment_prize_subtitle_font());
538+ purchase_type_->SetScale(scale);
539 prize_data_layout->AddView(purchase_type_.GetPointer(), 1,
540 nux::MINOR_POSITION_END);
541 return prize_data_layout;
542@@ -208,6 +217,8 @@
543
544 nux::Layout* MusicPaymentPreview::GetBody()
545 {
546+ UpdateScale();
547+
548 previews::Style& style = dash::previews::Style::Instance();
549 nux::VLayout *body_layout = new nux::VLayout();
550 body_layout->SetSpaceBetweenChildren(20);
551@@ -219,6 +230,7 @@
552 intro_->SetLineSpacing(10);
553 intro_->SetLines(-style.GetDescriptionLineCount());
554 intro_->SetMinimumHeight(50);
555+ intro_->SetScale(scale);
556
557 form_layout_ = new nux::HLayout();
558 form_layout_->SetSpaceBetweenChildren(10);
559@@ -240,6 +252,8 @@
560
561 nux::Layout* MusicPaymentPreview::GetFormLabels()
562 {
563+ UpdateScale();
564+
565 previews::Style& style = dash::previews::Style::Instance();
566 nux::VLayout *labels_layout = new nux::VLayout();
567 if (error_message_.empty())
568@@ -256,6 +270,7 @@
569 NUX_TRACKER_LOCATION);
570 email_label_->SetLines(-1);
571 email_label_->SetFont(style.payment_form_labels_font());
572+ email_label_->SetScale(scale);
573 labels_layout->AddView(email_label_.GetPointer(), 0, nux::MINOR_POSITION_END);
574
575 payment_label_ = new StaticCairoText(
576@@ -263,6 +278,7 @@
577 NUX_TRACKER_LOCATION);
578 payment_label_->SetLines(-1);
579 payment_label_->SetFont(style.payment_form_labels_font());
580+ payment_label_->SetScale(scale);
581 labels_layout->AddView(payment_label_.GetPointer(), 0, nux::MINOR_POSITION_END);
582
583 password_label_ = new StaticCairoText(
584@@ -270,6 +286,7 @@
585 NUX_TRACKER_LOCATION);
586 password_label_->SetLines(-1);
587 password_label_->SetFont(style.payment_form_labels_font());
588+ password_label_->SetScale(scale);
589 password_label_->SetMinimumHeight(40);
590 labels_layout->AddView(password_label_.GetPointer(), 0, nux::MINOR_POSITION_END);
591
592@@ -278,6 +295,8 @@
593
594 nux::Layout* MusicPaymentPreview::GetFormFields()
595 {
596+ UpdateScale();
597+
598 previews::Style& style = dash::previews::Style::Instance();
599 nux::VLayout *fields_layout = new nux::VLayout();
600 if (error_message_.empty())
601@@ -294,6 +313,7 @@
602 NUX_TRACKER_LOCATION);
603 email_->SetLines(-1);
604 email_->SetFont(style.payment_form_data_font());
605+ email_->SetScale(scale);
606 fields_layout->AddView(email_.GetPointer(), 1,
607 nux::MINOR_POSITION_START);
608
609@@ -302,6 +322,7 @@
610 NUX_TRACKER_LOCATION);
611 payment_->SetLines(-1);
612 payment_->SetFont(style.payment_form_data_font());
613+ payment_->SetScale(scale);
614 fields_layout->AddView(payment_.GetPointer(), 1,
615 nux::MINOR_POSITION_START);
616
617@@ -325,6 +346,7 @@
618 error->SetFont(style.payment_form_data_font());
619 // ensure it is an error using red
620 error->SetTextColor(style.payment_error_color());
621+ error->SetScale(scale);
622 fields_layout->AddView(error, 0, nux::MINOR_POSITION_START);
623 }
624
625@@ -333,6 +355,8 @@
626
627 nux::Layout* MusicPaymentPreview::GetFormActions()
628 {
629+ UpdateScale();
630+
631 previews::Style& style = dash::previews::Style::Instance();
632 nux::VLayout *actions_layout = new nux::VLayout();
633 if (error_message_.empty())
634@@ -350,6 +374,7 @@
635 NUX_TRACKER_LOCATION);
636 empty_->SetLines(-1);
637 empty_->SetFont(style.payment_form_labels_font());
638+ empty_->SetScale(scale);
639 actions_layout->AddView(empty_.GetPointer(), 1,
640 nux::MINOR_POSITION_START);
641
642@@ -369,6 +394,8 @@
643
644 nux::Layout* MusicPaymentPreview::GetFooter()
645 {
646+ UpdateScale();
647+
648 previews::Style& style = dash::previews::Style::Instance();
649 nux::HLayout* actions_buffer_h = new nux::HLayout();
650 actions_buffer_h->AddSpace(0, 1);
651@@ -376,8 +403,8 @@
652 nux::HLayout* buttons_data_layout = new nux::HLayout();
653 buttons_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenActions());
654
655- lock_texture_ = new IconTexture(style.GetLockIcon(), style.GetPaymentLockWidth(),
656- style.GetPaymentLockHeight());
657+ lock_texture_ = new IconTexture(style.GetLockIcon(), (int)(scale * style.GetPaymentLockWidth()),
658+ (int)(scale * style.GetPaymentLockHeight()));
659 buttons_data_layout->AddView(lock_texture_.GetPointer(), 0, nux::MINOR_POSITION_CENTER,
660 nux::MINOR_SIZE_FULL, 100.0f, nux::NUX_LAYOUT_BEGIN);
661
662
663=== modified file 'dash/previews/MusicPreview.cpp'
664--- dash/previews/MusicPreview.cpp 2013-11-19 18:48:35 +0000
665+++ dash/previews/MusicPreview.cpp 2014-05-09 14:03:42 +0000
666@@ -147,6 +147,8 @@
667 full_data_layout_->SetPadding(style.GetDetailsTopMargin(), 0, style.GetDetailsBottomMargin(), style.GetDetailsLeftMargin());
668 full_data_layout_->SetSpaceBetweenChildren(16);
669
670+ UpdateScale();
671+
672 /////////////////////
673 // Music Info
674 nux::VLayout* album_data_layout = new nux::VLayout();
675@@ -156,6 +158,7 @@
676 AddChild(title_.GetPointer());
677 title_->SetFont(style.title_font().c_str());
678 title_->SetLines(-1);
679+ title_->SetScale(scale);
680 title_->mouse_click.connect(on_mouse_down);
681 album_data_layout->AddView(title_.GetPointer(), 1);
682
683@@ -165,6 +168,7 @@
684 AddChild(subtitle_.GetPointer());
685 subtitle_->SetFont(style.subtitle_size_font().c_str());
686 subtitle_->SetLines(-1);
687+ subtitle_->SetScale(scale);
688 subtitle_->mouse_click.connect(on_mouse_down);
689 album_data_layout->AddView(subtitle_.GetPointer(), 1);
690 }
691@@ -235,6 +239,7 @@
692 AddChild(warning_msg_.GetPointer());
693 warning_msg_->SetFont(style.u1_warning_font().c_str());
694 warning_msg_->SetLines(-2);
695+ warning_msg_->SetScale(scale);
696 warning_msg_->SetMinimumHeight(50);
697 warning_msg_->SetMaximumWidth(300);
698
699
700=== modified file 'dash/previews/PaymentPreview.cpp'
701--- dash/previews/PaymentPreview.cpp 2013-09-19 16:44:03 +0000
702+++ dash/previews/PaymentPreview.cpp 2014-05-09 14:03:42 +0000
703@@ -323,6 +323,8 @@
704
705 void PaymentPreview::SetupViews()
706 {
707+ UpdateScale();
708+
709 full_data_layout_ = new nux::LayeredLayout();
710
711 // layout to be used to show the info
712@@ -347,6 +349,7 @@
713 StaticCairoText* calculating = new StaticCairoText(
714 "Performing purchase", true,
715 NUX_TRACKER_LOCATION);
716+ calculating->SetScale(scale);
717
718 OverlaySpinner* spinner_ = new OverlaySpinner();
719 overlay_layout_->AddSpace(20, 1);
720
721=== modified file 'dash/previews/Preview.cpp'
722--- dash/previews/Preview.cpp 2013-11-19 18:48:35 +0000
723+++ dash/previews/Preview.cpp 2014-05-09 14:03:42 +0000
724@@ -24,6 +24,7 @@
725 #include "TabIterator.h"
726 #include "unity-shared/IntrospectableWrappers.h"
727 #include "unity-shared/CoverArt.h"
728+#include "unity-shared/UnitySettings.h"
729 #include <NuxCore/Logger.h>
730 #include <Nux/HLayout.h>
731 #include <Nux/VLayout.h>
732@@ -39,6 +40,8 @@
733 #include "SocialPreview.h"
734 #include "PreviewInfoHintWidget.h"
735
736+#define DEFAULT_SCALE 1.0
737+
738 namespace unity
739 {
740 namespace dash
741@@ -100,12 +103,14 @@
742
743 Preview::Preview(dash::Preview::Ptr preview_model)
744 : View(NUX_TRACKER_LOCATION)
745+ , scale(DEFAULT_SCALE)
746 , preview_model_(preview_model)
747 , tab_iterator_(new TabIterator())
748 , full_data_layout_(nullptr)
749 , image_(nullptr)
750 , title_(nullptr)
751 , subtitle_(nullptr)
752+ , cv_(Settings::Instance().em())
753 {
754 preview_container_ = new PreviewContainer;
755 }
756@@ -135,6 +140,8 @@
757
758 nux::Layout* Preview::BuildGridActionsLayout(dash::Preview::ActionPtrList actions, std::list<nux::AbstractButton*>& buttons)
759 {
760+ UpdateScale();
761+
762 previews::Style& style = dash::previews::Style::Instance();
763
764 nux::VLayout* actions_layout_v = new nux::VLayout();
765@@ -144,7 +151,7 @@
766 for (uint i = 0; i < rows; i++)
767 {
768 nux::HLayout* actions_layout_h = new TabIteratorHLayout(tab_iterator_);
769- actions_layout_h->SetSpaceBetweenChildren(style.GetSpaceBetweenActions());
770+ actions_layout_h->SetSpaceBetweenChildren((int)(style.GetSpaceBetweenActions() * scale));
771
772 for (uint j = 0; j < 2 && action_iter < actions.size(); j++, action_iter++)
773 {
774@@ -169,10 +176,12 @@
775
776 nux::Layout* Preview::BuildVerticalActionsLayout(dash::Preview::ActionPtrList actions, std::list<nux::AbstractButton*>& buttons)
777 {
778+ UpdateScale();
779+
780 previews::Style& style = dash::previews::Style::Instance();
781
782 nux::VLayout* actions_layout_v = new TabIteratorVLayout(tab_iterator_);
783- actions_layout_v->SetSpaceBetweenChildren(style.GetSpaceBetweenActions());
784+ actions_layout_v->SetSpaceBetweenChildren((int)(style.GetSpaceBetweenActions() * scale));
785
786 uint action_iter = 0;
787 for (uint i = 0; i < actions.size(); i++)
788@@ -279,6 +288,11 @@
789 return preview_container_->request_close;
790 }
791
792+void Preview::UpdateScale()
793+{
794+ scale = cv_->DPIScale();
795+}
796+
797 }
798 }
799 }
800
801=== modified file 'dash/previews/Preview.h'
802--- dash/previews/Preview.h 2013-09-19 16:44:03 +0000
803+++ dash/previews/Preview.h 2014-05-09 14:03:42 +0000
804@@ -29,6 +29,7 @@
805 #include "unity-shared/Introspectable.h"
806 #include "unity-shared/PreviewStyle.h"
807 #include "unity-shared/StaticCairoText.h"
808+#include "unity-shared/EMConverter.h"
809
810 namespace nux
811 {
812@@ -74,6 +75,9 @@
813 unsigned long special_keys_state);
814 virtual nux::Area* KeyNavIteration(nux::KeyNavDirection direction);
815
816+ virtual void UpdateScale();
817+ nux::Property<double> scale;
818+
819 protected:
820 virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw) {}
821 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) {}
822@@ -120,6 +124,9 @@
823 // Need to declare this as a pointer to avoid a circular header
824 // dependency issue between Preview.h and PreviewContainer.h
825 nux::ObjectPtr<PreviewContainer> preview_container_;
826+
827+private:
828+ EMConverter::Ptr cv_;
829 };
830
831 }
832
833=== modified file 'dash/previews/PreviewContainer.cpp'
834--- dash/previews/PreviewContainer.cpp 2013-11-19 18:48:35 +0000
835+++ dash/previews/PreviewContainer.cpp 2014-05-09 14:03:42 +0000
836@@ -29,6 +29,7 @@
837 #include "unity-shared/TimeUtil.h"
838 #include "unity-shared/PreviewStyle.h"
839 #include "unity-shared/GraphicsUtils.h"
840+#include "unity-shared/UnitySettings.h"
841 #include "PreviewNavigator.h"
842 #include <boost/math/constants/constants.hpp>
843 #include "config.h"
844@@ -398,6 +399,7 @@
845 , nav_disabled_(Navigation::NONE)
846 , navigation_progress_speed_(0.0)
847 , navigation_count_(0)
848+ , cv_(Settings::Instance().em())
849 {
850 SetAcceptKeyNavFocusOnMouseDown(false);
851 SetAcceptKeyNavFocusOnMouseEnter(false);
852@@ -454,33 +456,36 @@
853
854 void PreviewContainer::SetupViews()
855 {
856+ UpdateScale();
857+
858 previews::Style& style = previews::Style::Instance();
859
860 nux::VLayout* layout = new nux::VLayout();
861 SetLayout(layout);
862- layout->AddLayout(new nux::SpaceLayout(0,0,style.GetPreviewTopPadding(),style.GetPreviewTopPadding()));
863+ layout->AddLayout(new nux::SpaceLayout(0,0,(int)(style.GetPreviewTopPadding() * scale),
864+ (int)(style.GetPreviewTopPadding() * scale)));
865
866 layout_content_ = new nux::HLayout();
867- layout_content_->SetSpaceBetweenChildren(6);
868+ layout_content_->SetSpaceBetweenChildren((int)(6 * scale));
869 layout->AddLayout(layout_content_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
870
871 layout_content_->AddSpace(0, 1);
872 nav_left_ = new PreviewNavigator(Orientation::LEFT, NUX_TRACKER_LOCATION);
873 AddChild(nav_left_);
874- nav_left_->SetMinimumWidth(style.GetNavigatorWidth());
875- nav_left_->SetMaximumWidth(style.GetNavigatorWidth());
876+ nav_left_->SetMinimumWidth((int)(style.GetNavigatorWidth() * scale));
877+ nav_left_->SetMaximumWidth((int)(style.GetNavigatorWidth() * scale));
878 nav_left_->activated.connect([this]() { navigate_left.emit(); });
879 layout_content_->AddView(nav_left_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
880
881 preview_layout_ = new PreviewContent(this);
882- preview_layout_->SetMinMaxSize(style.GetPreviewWidth(), style.GetPreviewHeight());
883+ preview_layout_->SetMinMaxSize((int)(scale * style.GetPreviewWidth()), (int)(scale * style.GetPreviewHeight()));
884 AddChild(preview_layout_);
885 layout_content_->AddLayout(preview_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
886
887 nav_right_ = new PreviewNavigator(Orientation::RIGHT, NUX_TRACKER_LOCATION);
888 AddChild(nav_right_);
889- nav_right_->SetMinimumWidth(style.GetNavigatorWidth());
890- nav_right_->SetMaximumWidth(style.GetNavigatorWidth());
891+ nav_right_->SetMinimumWidth((int)(style.GetNavigatorWidth() * scale));
892+ nav_right_->SetMaximumWidth((int)(style.GetNavigatorWidth() * scale));
893 nav_right_->activated.connect([this]() { navigate_right.emit(); });
894 layout_content_->AddView(nav_right_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
895 layout_content_->AddSpace(0, 1);
896@@ -694,6 +699,11 @@
897 return layout_content_->GetAbsoluteGeometry();
898 }
899
900+void PreviewContainer::UpdateScale()
901+{
902+ scale = cv_->DPIScale();
903+}
904+
905 } // namespace previews
906 } // namespace dash
907 } // namespace unity
908
909=== modified file 'dash/previews/PreviewContainer.h'
910--- dash/previews/PreviewContainer.h 2013-09-19 16:44:03 +0000
911+++ dash/previews/PreviewContainer.h 2014-05-09 14:03:42 +0000
912@@ -28,6 +28,7 @@
913 #include <UnityCore/Preview.h>
914 #include "Preview.h"
915 #include "unity-shared/Introspectable.h"
916+#include "unity-shared/EMConverter.h"
917
918 #include <UnityCore/GLibSource.h>
919
920@@ -85,6 +86,8 @@
921
922 void OnMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags);
923
924+ nux::Property<double> scale;
925+
926 protected:
927 void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);
928 void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);
929@@ -115,6 +118,9 @@
930
931 glib::Source::UniquePtr animation_timer_;
932 friend class PreviewContent;
933+
934+ EMConverter::Ptr cv_;
935+ void UpdateScale();
936 };
937
938 } // namespace previews
939
940=== modified file 'dash/previews/PreviewInfoHintWidget.cpp'
941--- dash/previews/PreviewInfoHintWidget.cpp 2013-11-19 18:48:35 +0000
942+++ dash/previews/PreviewInfoHintWidget.cpp 2014-05-09 14:03:42 +0000
943@@ -31,6 +31,7 @@
944 #include <unity-shared/StaticCairoText.h>
945 #include <unity-shared/IconTexture.h>
946 #include <unity-shared/PreviewStyle.h>
947+#include <unity-shared/UnitySettings.h>
948
949 namespace unity
950 {
951@@ -50,6 +51,7 @@
952 : View(NUX_TRACKER_LOCATION)
953 , icon_size_(icon_size)
954 , preview_model_(preview_model)
955+, cv_(Settings::Instance().em())
956 {
957 SetupViews();
958 }
959@@ -146,17 +148,19 @@
960 RemoveLayout();
961 info_hints_.clear();
962
963+ UpdateScale();
964+
965 previews::Style& style = previews::Style::Instance();
966
967 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); };
968
969 nux::VLayout* layout = new nux::VLayout();
970- layout->SetSpaceBetweenChildren(6);
971+ layout->SetSpaceBetweenChildren((int)(6 * scale));
972
973 for (dash::Preview::InfoHintPtr info_hint : preview_model_->GetInfoHints())
974 {
975 nux::HLayout* hint_layout = new nux::HLayout();
976- hint_layout->SetSpaceBetweenChildren(layout_spacing);
977+ hint_layout->SetSpaceBetweenChildren((int)(layout_spacing * scale));
978
979 StaticCairoTextPtr info_name;
980 if (!info_hint->display_name.empty())
981@@ -168,6 +172,7 @@
982 info_name->SetFont(style.info_hint_bold_font());
983 info_name->SetLines(-1);
984 info_name->SetTextAlignment(StaticCairoText::NUX_ALIGN_RIGHT);
985+ info_name->SetScale(scale);
986 info_name->mouse_click.connect(on_mouse_down);
987 hint_layout->AddView(info_name.GetPointer(), 0, nux::MINOR_POSITION_CENTER);
988 }
989@@ -175,6 +180,7 @@
990 StaticCairoTextPtr info_value(new StaticCairoText(StringFromVariant(info_hint->value), true, NUX_TRACKER_LOCATION));
991 info_value->SetFont(style.info_hint_font());
992 info_value->SetLines(-1);
993+ info_value->SetScale(scale);
994 info_value->mouse_click.connect(on_mouse_down);
995 hint_layout->AddView(info_value.GetPointer(), 1, nux::MINOR_POSITION_CENTER);
996
997@@ -192,21 +198,23 @@
998
999 void PreviewInfoHintWidget::PreLayoutManagement()
1000 {
1001+ UpdateScale();
1002+
1003 previews::Style& style = previews::Style::Instance();
1004 nux::Geometry const& geo = GetGeometry();
1005
1006 int info_hint_width = 0;
1007 for (InfoHint const& info_hint : info_hints_)
1008 {
1009- int width = style.GetInfoHintNameMinimumWidth();
1010+ int width = (int)(style.GetInfoHintNameMinimumWidth() * scale);
1011 if (info_hint.first)
1012 {
1013- width = info_hint.first->GetTextExtents().width;
1014+ width = (int)(info_hint.first->GetTextExtents().width * scale);
1015
1016- if (width < style.GetInfoHintNameMinimumWidth())
1017- width = style.GetInfoHintNameMinimumWidth();
1018- else if (width > style.GetInfoHintNameMaximumWidth())
1019- width = style.GetInfoHintNameMaximumWidth();
1020+ if (width < (int)(style.GetInfoHintNameMinimumWidth() * scale))
1021+ width = (int)(style.GetInfoHintNameMinimumWidth() * scale);
1022+ else if (width > (int)(style.GetInfoHintNameMaximumWidth() * scale))
1023+ width = (int)(style.GetInfoHintNameMaximumWidth() * scale);
1024 }
1025
1026 if (info_hint_width < width)
1027@@ -215,9 +223,9 @@
1028 }
1029 }
1030
1031- int info_value_width = geo.width;
1032- info_value_width -= layout_spacing;
1033- info_value_width -= info_hint_width;
1034+ int info_value_width = (int)(geo.width * scale);
1035+ info_value_width -= (int)(layout_spacing * scale);
1036+ info_value_width -= (int)(info_hint_width * scale);
1037 info_value_width = MAX(0, info_value_width);
1038
1039 for (InfoHint const& info_hint : info_hints_)
1040@@ -236,6 +244,11 @@
1041 View::PreLayoutManagement();
1042 }
1043
1044+void PreviewInfoHintWidget::UpdateScale()
1045+{
1046+ scale = cv_->DPIScale();
1047+}
1048+
1049 } // namespace previews
1050 } // namespace dash
1051 } // namespace unity
1052
1053=== modified file 'dash/previews/PreviewInfoHintWidget.h'
1054--- dash/previews/PreviewInfoHintWidget.h 2013-09-19 16:44:03 +0000
1055+++ dash/previews/PreviewInfoHintWidget.h 2014-05-09 14:03:42 +0000
1056@@ -27,6 +27,7 @@
1057 #include <Nux/View.h>
1058 #include <UnityCore/Preview.h>
1059 #include "unity-shared/Introspectable.h"
1060+#include "unity-shared/EMConverter.h"
1061 #include "PreviewContainer.h"
1062
1063 namespace unity
1064@@ -58,6 +59,8 @@
1065
1066 sigc::signal<void> request_close() const { return preview_container_.request_close; }
1067
1068+ nux::Property<double> scale;
1069+
1070 protected:
1071 virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
1072 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
1073@@ -84,6 +87,9 @@
1074
1075 private:
1076 PreviewContainer preview_container_;
1077+
1078+ EMConverter::Ptr cv_;
1079+ void UpdateScale();
1080 };
1081
1082 } // namespace previews
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-05-09 14:03:42 +0000
1087@@ -27,6 +27,7 @@
1088 #include <Nux/VLayout.h>
1089 #include <unity-shared/IconTexture.h>
1090 #include <unity-shared/PreviewStyle.h>
1091+#include "unity-shared/UnitySettings.h"
1092
1093 namespace unity
1094 {
1095@@ -43,6 +44,7 @@
1096 , direction_(direction)
1097 , texture_(nullptr)
1098 , visual_state_(VisualState::NORMAL)
1099+ , cv_(Settings::Instance().em())
1100 {
1101 SetupViews();
1102 UpdateTexture();
1103@@ -96,6 +98,8 @@
1104
1105 void PreviewNavigator::SetupViews()
1106 {
1107+ UpdateScale();
1108+
1109 previews::Style& style = dash::previews::Style::Instance();
1110
1111 if (direction_ == Orientation::LEFT || direction_ == Orientation::RIGHT)
1112@@ -107,9 +111,11 @@
1113 layout_ = hlayout;
1114
1115 if (direction_ == Orientation::LEFT)
1116- texture_ = new IconTexture(Style::Instance().GetNavLeftIcon(), style.GetNavigatorIconSize(), style.GetNavigatorIconSize());
1117+ texture_ = new IconTexture(Style::Instance().GetNavLeftIcon(), (int)(scale * style.GetNavigatorIconSize()),
1118+ (int)(scale * style.GetNavigatorIconSize()));
1119 else
1120- texture_ = new IconTexture(Style::Instance().GetNavRightIcon(), style.GetNavigatorIconSize(), style.GetNavigatorIconSize());
1121+ texture_ = new IconTexture(Style::Instance().GetNavRightIcon(), (int)(scale * style.GetNavigatorIconSize()),
1122+ (int)(scale * style.GetNavigatorIconSize()));
1123 texture_->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
1124
1125 vlayout->AddSpace(0,1);
1126@@ -179,6 +185,10 @@
1127 }
1128 }
1129
1130+void PreviewNavigator::UpdateScale()
1131+{
1132+ scale = cv_->DPIScale();
1133+}
1134
1135 } // namespace previews
1136 } // namespace dash
1137
1138=== modified file 'dash/previews/PreviewNavigator.h'
1139--- dash/previews/PreviewNavigator.h 2013-09-19 16:44:03 +0000
1140+++ dash/previews/PreviewNavigator.h 2014-05-09 14:03:42 +0000
1141@@ -27,6 +27,7 @@
1142 #include <Nux/View.h>
1143 #include "unity-shared/PreviewStyle.h"
1144 #include "unity-shared/Introspectable.h"
1145+#include "unity-shared/EMConverter.h"
1146
1147
1148 namespace unity
1149@@ -46,6 +47,8 @@
1150 typedef nux::ObjectPtr<PreviewNavigator> Ptr;
1151 PreviewNavigator(Orientation direction, NUX_FILE_LINE_PROTO);
1152
1153+ nux::Property<double> scale;
1154+
1155 void SetEnabled(bool enabled);
1156
1157 // From debug::Introspectable
1158@@ -78,10 +81,13 @@
1159 ACTIVE
1160 };
1161 VisualState visual_state_;
1162+
1163+ EMConverter::Ptr cv_;
1164+ void UpdateScale();
1165 };
1166
1167 } // namespace previews
1168 } // namespace dash
1169 } // namespace unity
1170
1171-#endif // PREVIEWNAVIGATOR_H
1172\ No newline at end of file
1173+#endif // PREVIEWNAVIGATOR_H
1174
1175=== modified file 'dash/previews/PreviewRatingsWidget.cpp'
1176--- dash/previews/PreviewRatingsWidget.cpp 2013-11-19 18:48:35 +0000
1177+++ dash/previews/PreviewRatingsWidget.cpp 2014-05-09 14:03:42 +0000
1178@@ -29,6 +29,7 @@
1179 #include "unity-shared/RatingsButton.h"
1180 #include "unity-shared/StaticCairoText.h"
1181 #include "unity-shared/PreviewStyle.h"
1182+#include "unity-shared/UnitySettings.h"
1183 #include "PreviewRatingsWidget.h"
1184
1185 namespace unity
1186@@ -42,21 +43,25 @@
1187
1188 PreviewRatingsWidget::PreviewRatingsWidget(NUX_FILE_LINE_DECL)
1189 : View(NUX_FILE_LINE_PARAM)
1190+ , cv_(Settings::Instance().em())
1191 {
1192+ UpdateScale();
1193+
1194 nux::VLayout* layout = new nux::VLayout();
1195- layout->SetSpaceBetweenChildren(3);
1196+ layout->SetSpaceBetweenChildren((int)(scale * 3));
1197
1198 previews::Style& style = previews::Style::Instance();
1199
1200 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); };
1201
1202- ratings_ = new RatingsButton(18,2);
1203+ ratings_ = new RatingsButton((int)(scale * 18), (int)(scale * 2));
1204 ratings_->SetEditable(false);
1205 ratings_->mouse_click.connect(on_mouse_down);
1206 layout->AddView(ratings_);
1207
1208 reviews_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
1209 reviews_->SetFont(style.user_rating_font());
1210+ reviews_->SetScale(scale);
1211 reviews_->mouse_click.connect(on_mouse_down);
1212 layout->AddView(reviews_);
1213
1214@@ -114,6 +119,11 @@
1215 .add(GetAbsoluteGeometry());
1216 }
1217
1218+void PreviewRatingsWidget::UpdateScale()
1219+{
1220+ scale = cv_->DPIScale();
1221+}
1222+
1223 } // namespace previews
1224 } // namespace dash
1225 } // namespace unity
1226
1227=== modified file 'dash/previews/PreviewRatingsWidget.h'
1228--- dash/previews/PreviewRatingsWidget.h 2013-09-19 16:44:03 +0000
1229+++ dash/previews/PreviewRatingsWidget.h 2014-05-09 14:03:42 +0000
1230@@ -26,6 +26,7 @@
1231 #include <Nux/Nux.h>
1232 #include <Nux/View.h>
1233 #include "PreviewContainer.h"
1234+#include "unity-shared/EMConverter.h"
1235
1236 namespace nux
1237 {
1238@@ -54,6 +55,8 @@
1239
1240 sigc::signal<void> request_close() const { return preview_container_.request_close; }
1241
1242+ nux::Property<double> scale;
1243+
1244 protected:
1245 virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
1246 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
1247@@ -69,6 +72,9 @@
1248 StaticCairoText* reviews_;
1249
1250 PreviewContainer preview_container_;
1251+
1252+ EMConverter::Ptr cv_;
1253+ void UpdateScale();
1254 };
1255
1256 } // namespace previews
1257
1258=== modified file 'dash/previews/SocialPreview.cpp'
1259--- dash/previews/SocialPreview.cpp 2013-11-19 18:48:35 +0000
1260+++ dash/previews/SocialPreview.cpp 2014-05-09 14:03:42 +0000
1261@@ -111,6 +111,8 @@
1262
1263 void SocialPreview::SetupViews()
1264 {
1265+ UpdateScale();
1266+
1267 dash::SocialPreview* social_preview_model = dynamic_cast<dash::SocialPreview*>(preview_model_.get());
1268 if (!social_preview_model)
1269 {
1270@@ -158,7 +160,7 @@
1271 // Icon Layout
1272 nux::VLayout* icon_layout = new nux::VLayout();
1273 icon_layout->SetSpaceBetweenChildren(3);
1274- avatar_ = new IconTexture(social_preview_model->avatar.Get().RawPtr() ? g_icon_to_string(social_preview_model->avatar.Get().RawPtr()) : "", MIN(style.GetAvatarAreaWidth(), style.GetAvatarAreaHeight()));
1275+ avatar_ = new IconTexture(social_preview_model->avatar.Get().RawPtr() ? g_icon_to_string(social_preview_model->avatar.Get().RawPtr()) : "", MIN(style.GetAvatarAreaWidth(), (int)(scale * style.GetAvatarAreaHeight())));
1276 AddChild(avatar_.GetPointer());
1277 avatar_->SetMinMaxSize(style.GetAvatarAreaWidth(), style.GetAvatarAreaHeight());
1278 avatar_->mouse_click.connect(on_mouse_down);
1279@@ -175,12 +177,14 @@
1280 AddChild(title_.GetPointer());
1281 title_->SetLines(-1);
1282 title_->SetFont(style.title_font().c_str());
1283+ title_->SetScale(scale);
1284 title_->mouse_click.connect(on_mouse_down);
1285
1286 subtitle_ = new StaticCairoText(preview_model_->subtitle, true, NUX_TRACKER_LOCATION);
1287 AddChild(subtitle_.GetPointer());
1288 subtitle_->SetFont(style.content_font().c_str());
1289 subtitle_->SetLines(-1);
1290+ subtitle_->SetScale(scale);
1291 subtitle_->mouse_click.connect(on_mouse_down);
1292
1293 social_data_layout->AddView(title_.GetPointer(), 0);
1294@@ -225,6 +229,7 @@
1295 comments_hint_->SetLines(-1);
1296 comments_hint_->SetFont(style.info_hint_bold_font().c_str());
1297 comments_hint_->SetTextAlignment(StaticCairoText::NUX_ALIGN_RIGHT);
1298+ comments_hint_->SetScale(scale);
1299 comments_hint_->mouse_click.connect(on_mouse_down);
1300 comments_layout->AddView(comments_hint_.GetPointer(), 0, nux::MINOR_POSITION_START);
1301
1302
1303=== modified file 'dash/previews/SocialPreviewComments.cpp'
1304--- dash/previews/SocialPreviewComments.cpp 2013-11-19 18:48:35 +0000
1305+++ dash/previews/SocialPreviewComments.cpp 2014-05-09 14:03:42 +0000
1306@@ -22,6 +22,7 @@
1307
1308 #include "unity-shared/DashStyle.h"
1309 #include "unity-shared/PreviewStyle.h"
1310+#include "unity-shared/UnitySettings.h"
1311 #include <UnityCore/SocialPreview.h>
1312 #include <NuxCore/Logger.h>
1313 #include <Nux/Layout.h>
1314@@ -48,6 +49,7 @@
1315 SocialPreviewComments::SocialPreviewComments(dash::Preview::Ptr preview_model, NUX_FILE_LINE_DECL)
1316 : View(NUX_FILE_LINE_PARAM)
1317 , preview_model_(preview_model)
1318+, cv_(Settings::Instance().em())
1319 {
1320 SetupViews();
1321 }
1322@@ -126,6 +128,8 @@
1323 RemoveLayout();
1324 comments_.clear();
1325
1326+ UpdateScale();
1327+
1328 previews::Style& style = previews::Style::Instance();
1329
1330 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); };
1331@@ -146,6 +150,7 @@
1332 comment_name->SetFont(style.info_hint_bold_font());
1333 comment_name->SetLines(-1);
1334 comment_name->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
1335+ comment_name->SetScale(scale);
1336 comment_name->mouse_click.connect(on_mouse_down);
1337 name_layout->AddView(comment_name.GetPointer(), 0, nux::MINOR_POSITION_START);
1338 }
1339@@ -157,6 +162,7 @@
1340 comment_time->SetFont(style.info_hint_font());
1341 comment_time->SetLines(-1);
1342 comment_time->SetTextAlignment(StaticCairoText::NUX_ALIGN_RIGHT);
1343+ comment_time->SetScale(scale);
1344 comment_time->mouse_click.connect(on_mouse_down);
1345 name_layout->AddView(comment_time.GetPointer(), 0, nux::MINOR_POSITION_START);
1346 }
1347@@ -170,6 +176,7 @@
1348 comment_value->SetFont(style.info_hint_font());
1349 comment_value->SetLines(-7);
1350 comment_value->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
1351+ comment_value->SetScale(scale);
1352 comment_value->mouse_click.connect(on_mouse_down);
1353 comment_layout->AddView(comment_value.GetPointer(), 1, nux::MINOR_POSITION_START);
1354
1355@@ -195,6 +202,11 @@
1356 introspection.add(GetAbsoluteGeometry());
1357 }
1358
1359+void SocialPreviewComments::UpdateScale()
1360+{
1361+ scale = cv_->DPIScale();
1362+}
1363+
1364 }
1365 }
1366 }
1367
1368=== modified file 'dash/previews/SocialPreviewComments.h'
1369--- dash/previews/SocialPreviewComments.h 2013-09-19 16:44:03 +0000
1370+++ dash/previews/SocialPreviewComments.h 2014-05-09 14:03:42 +0000
1371@@ -28,6 +28,7 @@
1372 #include <NuxCore/ObjectPtr.h>
1373 #include "unity-shared/StaticCairoText.h"
1374 #include "unity-shared/Introspectable.h"
1375+#include "unity-shared/EMConverter.h"
1376 #include <UnityCore/SocialPreview.h>
1377 #include "PreviewContainer.h"
1378
1379@@ -50,6 +51,8 @@
1380
1381 sigc::signal<void> request_close() const { return preview_container_.request_close; }
1382
1383+ nux::Property<double> scale;
1384+
1385 protected:
1386
1387 typedef nux::ObjectPtr<StaticCairoText> StaticCairoTextPtr;
1388@@ -74,6 +77,9 @@
1389 typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
1390
1391 PreviewContainer preview_container_;
1392+
1393+ EMConverter::Ptr cv_;
1394+ void UpdateScale();
1395 };
1396
1397 }
1398
1399=== modified file 'dash/previews/SocialPreviewContent.cpp'
1400--- dash/previews/SocialPreviewContent.cpp 2013-11-19 18:48:35 +0000
1401+++ dash/previews/SocialPreviewContent.cpp 2014-05-09 14:03:42 +0000
1402@@ -23,6 +23,7 @@
1403
1404 #include "unity-shared/DashStyle.h"
1405 #include "unity-shared/PreviewStyle.h"
1406+#include "unity-shared/UnitySettings.h"
1407 #include <NuxCore/Logger.h>
1408 #include <Nux/Layout.h>
1409
1410@@ -56,6 +57,7 @@
1411
1412 SocialPreviewContent::SocialPreviewContent(std::string const& text, NUX_FILE_LINE_DECL)
1413 : View(NUX_FILE_LINE_PARAM)
1414+, cv_(Settings::Instance().em())
1415 {
1416 SetupViews();
1417 if (text.length() > 0)
1418@@ -128,6 +130,8 @@
1419
1420 void SocialPreviewContent::SetupViews()
1421 {
1422+ UpdateScale();
1423+
1424 dash::previews::Style const& style = dash::previews::Style::Instance();
1425
1426 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); };
1427@@ -137,6 +141,7 @@
1428 text_->SetFont(style.content_font());
1429 text_->SetLineSpacing(5);
1430 text_->SetTextEllipsize(StaticCairoText::NUX_ELLIPSIZE_MIDDLE);
1431+ text_->SetScale(scale);
1432 text_->mouse_click.connect(on_mouse_down);
1433
1434 nux::Layout* layout = new nux::Layout();
1435@@ -314,6 +319,11 @@
1436 introspection.add(GetAbsoluteGeometry());
1437 }
1438
1439+void SocialPreviewContent::UpdateScale()
1440+{
1441+ scale = cv_->DPIScale();
1442+}
1443+
1444 }
1445 }
1446 }
1447
1448=== modified file 'dash/previews/SocialPreviewContent.h'
1449--- dash/previews/SocialPreviewContent.h 2013-09-19 16:44:03 +0000
1450+++ dash/previews/SocialPreviewContent.h 2014-05-09 14:03:42 +0000
1451@@ -30,6 +30,7 @@
1452 #include <NuxCore/ObjectPtr.h>
1453 #include "unity-shared/StaticCairoText.h"
1454 #include "unity-shared/Introspectable.h"
1455+#include "unity-shared/EMConverter.h"
1456 #include "PreviewContainer.h"
1457
1458 namespace unity
1459@@ -52,6 +53,8 @@
1460
1461 sigc::signal<void> request_close() const { return preview_container_.request_close; }
1462
1463+ nux::Property<double> scale;
1464+
1465 protected:
1466 virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);
1467 virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);
1468@@ -82,6 +85,9 @@
1469 NuxCairoPtr cr_bubble_;
1470
1471 PreviewContainer preview_container_;
1472+
1473+ EMConverter::Ptr cv_;
1474+ void UpdateScale();
1475 };
1476
1477 }
1478
1479=== modified file 'dash/previews/Track.cpp'
1480--- dash/previews/Track.cpp 2013-11-19 18:48:35 +0000
1481+++ dash/previews/Track.cpp 2014-05-09 14:03:42 +0000
1482@@ -29,6 +29,7 @@
1483 #include <unity-shared/IconTexture.h>
1484 #include <unity-shared/DashStyle.h>
1485 #include <unity-shared/PreviewStyle.h>
1486+#include <unity-shared/UnitySettings.h>
1487
1488 namespace unity
1489 {
1490@@ -129,6 +130,7 @@
1491 , play_state_(PlayerState::STOPPED)
1492 , progress_(0.0)
1493 , mouse_over_(false)
1494+ , cv_(Settings::Instance().em())
1495 {
1496 SetupBackground();
1497 SetupViews();
1498@@ -197,6 +199,8 @@
1499
1500 void Track::SetupViews()
1501 {
1502+ UpdateScale();
1503+
1504 previews::Style& style = previews::Style::Instance();
1505 nux::HLayout* layout = new nux::HLayout();
1506 layout->SetLeftAndRightPadding(0,0);
1507@@ -214,12 +218,14 @@
1508 track_number_->SetTextVerticalAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
1509 track_number_->SetLines(-1);
1510 track_number_->SetFont(style.track_font());
1511+ track_number_->SetScale(scale);
1512
1513 title_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
1514 title_->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
1515 title_->SetTextVerticalAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
1516 title_->SetLines(-1);
1517 title_->SetFont(style.track_font());
1518+ title_->SetScale(scale);
1519
1520 duration_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
1521 duration_->SetTextEllipsize(StaticCairoText::NUX_ELLIPSIZE_NONE);
1522@@ -227,6 +233,7 @@
1523 duration_->SetTextVerticalAlignment(StaticCairoText::NUX_ALIGN_CENTRE);
1524 duration_->SetLines(-1);
1525 duration_->SetFont(style.track_font());
1526+ duration_->SetScale(scale);
1527 duration_->SetMaximumWidth(style.GetMusicDurationWidth());
1528 duration_->SetMaximumWidth(style.GetMusicDurationWidth());
1529 // Layouts
1530@@ -441,6 +448,11 @@
1531 View::PreLayoutManagement();
1532 }
1533
1534+void Track::UpdateScale()
1535+{
1536+ scale = cv_->DPIScale();
1537+}
1538+
1539 } // namespace previews
1540 } // namespace dash
1541 } // namesapce unity
1542
1543=== modified file 'dash/previews/Track.h'
1544--- dash/previews/Track.h 2013-09-19 16:44:03 +0000
1545+++ dash/previews/Track.h 2014-05-09 14:03:42 +0000
1546@@ -28,6 +28,7 @@
1547 #include <UnityCore/ConnectionManager.h>
1548 #include <UnityCore/Tracks.h>
1549 #include "unity-shared/Introspectable.h"
1550+#include "unity-shared/EMConverter.h"
1551 #include "PreviewPlayer.h"
1552
1553 namespace nux
1554@@ -55,6 +56,8 @@
1555
1556 void Update(dash::Track const& track_row);
1557
1558+ nux::Property<double> scale;
1559+
1560 protected:
1561 virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);
1562 virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);
1563@@ -100,6 +103,10 @@
1564
1565 bool mouse_over_;
1566 connection::Wrapper player_connection_;
1567+
1568+private:
1569+ EMConverter::Ptr cv_;
1570+ void UpdateScale();
1571 };
1572
1573 }
1574
1575=== modified file 'unity-shared/CoverArt.cpp'
1576--- unity-shared/CoverArt.cpp 2013-11-19 18:48:35 +0000
1577+++ unity-shared/CoverArt.cpp 2014-05-09 14:03:42 +0000
1578@@ -25,6 +25,7 @@
1579 #include "CoverArt.h"
1580 #include "unity-shared/IntrospectableWrappers.h"
1581 #include "unity-shared/CairoTexture.h"
1582+#include "unity-shared/UnitySettings.h"
1583 #include <NuxCore/Logger.h>
1584 #include <Nux/VLayout.h>
1585 #include "DashStyle.h"
1586@@ -56,6 +57,7 @@
1587 , stretch_image_(false)
1588 , waiting_(false)
1589 , rotation_(0.0)
1590+ , cv_(Settings::Instance().em())
1591 {
1592 SetupViews();
1593 }
1594@@ -99,6 +101,8 @@
1595 slot_handle_ = 0;
1596 }
1597
1598+ UpdateScale();
1599+
1600 bool bLoadTexture = false;
1601 bLoadTexture |= g_strrstr(image_hint.c_str(), "://") != NULL;
1602 if (!bLoadTexture && !image_hint.empty())
1603@@ -118,12 +122,14 @@
1604 if (icon.IsType(G_TYPE_ICON))
1605 {
1606 StartWaiting();
1607- slot_handle_ = IconLoader::GetDefault().LoadFromGIconString(image_hint, ICON_SIZE, ICON_SIZE, sigc::mem_fun(this, &CoverArt::IconLoaded));
1608+ slot_handle_ = IconLoader::GetDefault().LoadFromGIconString(image_hint, (int)(ICON_SIZE * _scale),
1609+ (int)(ICON_SIZE * _scale), sigc::mem_fun(this, &CoverArt::IconLoaded));
1610 }
1611 else
1612 {
1613 StartWaiting();
1614- slot_handle_ = IconLoader::GetDefault().LoadFromIconName(image_hint, ICON_SIZE, ICON_SIZE, sigc::mem_fun(this, &CoverArt::IconLoaded));
1615+ slot_handle_ = IconLoader::GetDefault().LoadFromIconName(image_hint, (int)(ICON_SIZE * _scale),
1616+ (int)(ICON_SIZE * _scale), sigc::mem_fun(this, &CoverArt::IconLoaded));
1617 }
1618 }
1619 else
1620@@ -134,7 +140,9 @@
1621
1622 void CoverArt::GenerateImage(std::string const& uri)
1623 {
1624- notifier_ = ThumbnailGenerator::Instance().GetThumbnail(uri, 512);
1625+ UpdateScale();
1626+
1627+ notifier_ = ThumbnailGenerator::Instance().GetThumbnail(uri, 512 * _scale);
1628 if (notifier_)
1629 {
1630 StartWaiting();
1631@@ -206,11 +214,13 @@
1632 return;
1633 }
1634
1635- int height = max_height;
1636+ UpdateScale();
1637+
1638+ int height = (int)(max_height * _scale);
1639
1640 int pixbuf_width, pixbuf_height;
1641- pixbuf_width = gdk_pixbuf_get_width(pixbuf);
1642- pixbuf_height = gdk_pixbuf_get_height(pixbuf);
1643+ pixbuf_width = (int)(gdk_pixbuf_get_width(pixbuf) * _scale);
1644+ pixbuf_height = (int)(gdk_pixbuf_get_height(pixbuf) * _scale);
1645 if (G_UNLIKELY(!pixbuf_height || !pixbuf_width))
1646 {
1647 pixbuf_width = (pixbuf_width) ? pixbuf_width : 1; // no zeros please
1648@@ -233,20 +243,20 @@
1649 float aspect = static_cast<float>(pixbuf_height) / pixbuf_width; // already sanitized width/height so can not be 0.0
1650 if (aspect < 1.0f)
1651 {
1652- pixbuf_width = ICON_SIZE;
1653+ pixbuf_width = (int)(ICON_SIZE * _scale);
1654 pixbuf_height = pixbuf_width * aspect;
1655
1656 if (pixbuf_height > height)
1657 {
1658- // scaled too big, scale down
1659- pixbuf_height = height;
1660- pixbuf_width = pixbuf_height / aspect;
1661+ // _scaled too big, _scale down
1662+ pixbuf_height = (int)(height * _scale);
1663+ pixbuf_width = (int)(pixbuf_height / aspect);
1664 }
1665 }
1666 else
1667 {
1668- pixbuf_height = height;
1669- pixbuf_width = pixbuf_height / aspect;
1670+ pixbuf_height = (int)(height * _scale);
1671+ pixbuf_width = (int)(pixbuf_height / aspect);
1672 }
1673
1674 if (gdk_pixbuf_get_height(pixbuf) == pixbuf_height)
1675@@ -263,7 +273,7 @@
1676 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
1677 cairo_paint(cr);
1678
1679- float scale = float(pixbuf_height) / gdk_pixbuf_get_height(pixbuf);
1680+ float scale = float(pixbuf_height) / (gdk_pixbuf_get_height(pixbuf) * _scale);
1681 cairo_scale(cr, scale, scale);
1682
1683 cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
1684@@ -439,6 +449,8 @@
1685
1686 void CoverArt::SetupViews()
1687 {
1688+ UpdateScale();
1689+
1690 nux::VLayout* layout = new nux::VLayout();
1691 layout->AddSpace(0, 1);
1692 layout->AddSpace(0, 1);
1693@@ -450,6 +462,7 @@
1694 overlay_text_->SetFont("Ubuntu 14");
1695 overlay_text_->SetLines(-3);
1696 overlay_text_->SetText(_("No Image Available"));
1697+ overlay_text_->SetScale(_scale);
1698
1699 dash::Style& style = dash::Style::Instance();
1700 spin_ = style.GetSearchSpinIcon();
1701@@ -496,6 +509,11 @@
1702 return false;
1703 }
1704
1705+void CoverArt::UpdateScale()
1706+{
1707+ _scale = cv_->DPIScale();
1708+}
1709+
1710 }
1711 }
1712 }
1713
1714=== modified file 'unity-shared/CoverArt.h'
1715--- unity-shared/CoverArt.h 2013-09-19 16:44:03 +0000
1716+++ unity-shared/CoverArt.h 2014-05-09 14:03:42 +0000
1717@@ -31,6 +31,7 @@
1718 #include <NuxCore/ObjectPtr.h>
1719 #include "unity-shared/StaticCairoText.h"
1720 #include "unity-shared/Introspectable.h"
1721+#include "unity-shared/EMConverter.h"
1722 #include "ThumbnailGenerator.h"
1723
1724 namespace unity
1725@@ -58,6 +59,8 @@
1726
1727 void SetFont(std::string const& font);
1728
1729+ nux::Property<double> _scale;
1730+
1731 protected:
1732 virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);
1733 virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);
1734@@ -99,6 +102,9 @@
1735
1736 typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
1737 LayerPtr bg_layer_;
1738+
1739+ EMConverter::Ptr cv_;
1740+ void UpdateScale();
1741 };
1742
1743 }