Merge lp:~unity-team/unity/prepare-7.2.3-SRU into lp:unity/7.2

Proposed by Christopher Townsend
Status: Merged
Approved by: Stephen M. Webb
Approved revision: no longer in the source branch.
Merged at revision: 3802
Proposed branch: lp:~unity-team/unity/prepare-7.2.3-SRU
Merge into: lp:unity/7.2
Diff against target: 13027 lines (+3701/-2676)
142 files modified
UnityCore/GnomeSessionManager.cpp (+62/-14)
UnityCore/GnomeSessionManager.h (+2/-0)
UnityCore/GnomeSessionManagerImpl.h (+1/-0)
UnityCore/SessionManager.h (+3/-0)
dash/DashController.cpp (+2/-2)
dash/DashView.cpp (+55/-71)
dash/DashView.h (+3/-2)
dash/FilterBar.cpp (+8/-18)
dash/FilterBar.h (+0/-2)
dash/FilterBasicButton.cpp (+39/-46)
dash/FilterBasicButton.h (+6/-4)
dash/FilterExpanderLabel.cpp (+39/-41)
dash/FilterExpanderLabel.h (+2/-5)
dash/FilterGenreWidget.cpp (+33/-16)
dash/FilterGenreWidget.h (+1/-1)
dash/FilterMultiRangeButton.cpp (+22/-30)
dash/FilterMultiRangeButton.h (+3/-3)
dash/FilterMultiRangeWidget.cpp (+12/-1)
dash/FilterRatingsButton.cpp (+30/-223)
dash/FilterRatingsButton.h (+8/-21)
dash/FilterRatingsWidget.cpp (+22/-12)
dash/FilterRatingsWidget.h (+2/-1)
dash/PlacesGroup.cpp (+27/-29)
dash/ResultRendererHorizontalTile.cpp (+2/-2)
dash/ResultRendererTile.cpp (+18/-33)
dash/ScopeBar.cpp (+3/-1)
dash/ScopeBarIcon.cpp (+0/-1)
dash/ScopeView.cpp (+23/-23)
dash/ScopeView.h (+0/-1)
dash/StandaloneDash.cpp (+41/-27)
dash/previews/ActionButton.cpp (+43/-20)
dash/previews/ActionButton.h (+4/-0)
dash/previews/ActionLink.cpp (+13/-0)
dash/previews/ActionLink.h (+2/-2)
dash/previews/ApplicationPreview.cpp (+148/-62)
dash/previews/ApplicationPreview.h (+10/-0)
dash/previews/ErrorPreview.cpp (+53/-26)
dash/previews/ErrorPreview.h (+2/-0)
dash/previews/GenericPreview.cpp (+86/-42)
dash/previews/GenericPreview.h (+9/-1)
dash/previews/MoviePreview.cpp (+78/-34)
dash/previews/MoviePreview.h (+8/-1)
dash/previews/MusicPaymentPreview.cpp (+103/-41)
dash/previews/MusicPaymentPreview.h (+1/-0)
dash/previews/MusicPreview.cpp (+96/-37)
dash/previews/MusicPreview.h (+6/-0)
dash/previews/PaymentPreview.cpp (+59/-23)
dash/previews/PaymentPreview.h (+3/-0)
dash/previews/Preview.cpp (+42/-8)
dash/previews/Preview.h (+4/-0)
dash/previews/PreviewContainer.cpp (+62/-20)
dash/previews/PreviewContainer.h (+7/-2)
dash/previews/PreviewInfoHintWidget.cpp (+73/-77)
dash/previews/PreviewInfoHintWidget.h (+9/-8)
dash/previews/PreviewNavigator.cpp (+22/-5)
dash/previews/PreviewNavigator.h (+8/-4)
dash/previews/PreviewRatingsWidget.cpp (+31/-10)
dash/previews/PreviewRatingsWidget.h (+7/-2)
dash/previews/SocialPreview.cpp (+130/-61)
dash/previews/SocialPreview.h (+12/-0)
dash/previews/SocialPreviewComments.cpp (+16/-22)
dash/previews/SocialPreviewComments.h (+1/-5)
dash/previews/SocialPreviewContent.cpp (+33/-19)
dash/previews/SocialPreviewContent.h (+4/-1)
dash/previews/StandaloneApplicationPreview.cpp (+31/-12)
dash/previews/StandaloneErrorPreview.cpp (+18/-4)
dash/previews/StandaloneMoviePreview.cpp (+18/-3)
dash/previews/StandaloneMusicPaymentPreview.cpp (+17/-4)
dash/previews/StandaloneSocialPreview.cpp (+22/-8)
dash/previews/Track.cpp (+41/-18)
dash/previews/Track.h (+10/-3)
dash/previews/Tracks.cpp (+36/-7)
dash/previews/Tracks.h (+5/-1)
debian/changelog (+62/-1)
debian/patches/lp1349128.patch (+0/-164)
debian/patches/series (+0/-1)
hud/HudAbstractView.h (+3/-0)
hud/HudButton.cpp (+40/-28)
hud/HudButton.h (+5/-4)
hud/HudController.cpp (+15/-1)
hud/HudController.h (+4/-2)
hud/HudIcon.cpp (+1/-2)
hud/HudView.cpp (+52/-36)
hud/HudView.h (+2/-2)
hud/StandaloneHud.cpp (+28/-12)
launcher/Launcher.cpp (+1/-1)
launcher/SwitcherView.cpp (+11/-2)
launcher/SwitcherView.h (+1/-0)
lockscreen/LockScreenAcceleratorController.cpp (+46/-2)
lockscreen/LockScreenAcceleratorController.h (+2/-1)
lockscreen/LockScreenController.cpp (+13/-6)
lockscreen/LockScreenShield.cpp (+35/-22)
lockscreen/LockScreenShield.h (+3/-0)
lockscreen/UserPromptView.cpp (+0/-1)
plugins/unityshell/src/unityshell.cpp (+17/-13)
plugins/unityshell/src/unityshell.h (+1/-0)
resources/flow-view.svg (+0/-16)
resources/grid-view.svg (+0/-21)
resources/search_magnify.svg (+155/-0)
services/panel-service.c (+27/-5)
shutdown/SessionDBusManager.cpp (+23/-9)
shutdown/SessionView.cpp (+49/-30)
shutdown/SessionView.h (+6/-5)
shutdown/StandaloneSession.cpp (+2/-0)
tests/autopilot/unity/emulators/switcher.py (+4/-4)
tests/test_mock_session_manager.h (+2/-0)
tests/test_places_group.cpp (+34/-25)
tests/test_previews_payment.cpp (+1/-2)
tests/test_session_controller.cpp (+1/-0)
tests/test_session_view.cpp (+23/-2)
tools/unity.cmake (+14/-1)
unity-shared/CMakeLists.txt (+1/-0)
unity-shared/CoverArt.cpp (+37/-28)
unity-shared/CoverArt.h (+7/-3)
unity-shared/DashStyle.cpp (+260/-302)
unity-shared/DashStyle.h (+88/-94)
unity-shared/DashStyleInterface.h (+13/-11)
unity-shared/IconTexture.cpp (+7/-17)
unity-shared/OverlayRenderer.cpp (+129/-89)
unity-shared/OverlayRenderer.h (+1/-0)
unity-shared/OverlayScrollView.cpp (+56/-0)
unity-shared/OverlayScrollView.h (+43/-0)
unity-shared/PlacesOverlayVScrollBar.cpp (+47/-27)
unity-shared/PlacesOverlayVScrollBar.h (+6/-4)
unity-shared/PlacesVScrollBar.cpp (+54/-53)
unity-shared/PlacesVScrollBar.h (+6/-11)
unity-shared/PluginAdapter.cpp (+1/-0)
unity-shared/PreviewStyle.cpp (+155/-163)
unity-shared/PreviewStyle.h (+46/-45)
unity-shared/RatingsButton.cpp (+20/-20)
unity-shared/RatingsButton.h (+5/-4)
unity-shared/RawPixel.h (+1/-1)
unity-shared/SearchBar.cpp (+39/-32)
unity-shared/SearchBarSpinner.cpp (+48/-34)
unity-shared/SearchBarSpinner.h (+7/-4)
unity-shared/SpreadFilter.cpp (+2/-2)
unity-shared/TextInput.cpp (+6/-24)
unity-shared/TextInput.h (+0/-1)
unity-shared/TextureCache.cpp (+10/-3)
unity-shared/UnitySettings.cpp (+19/-12)
unity-shared/VScrollBarOverlayWindow.cpp (+49/-47)
unity-shared/VScrollBarOverlayWindow.h (+3/-1)
To merge this branch: bzr merge lp:~unity-team/unity/prepare-7.2.3-SRU
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+228324@code.launchpad.net

Commit message

Prepare fixes for upstream micro-release 7.2.3.

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

I think it would be nice to include in this revision also the other hidpi branches that have been approved recently or that are about to be finished, so that we can just make one trusty landing with all the HiDPI fixes at once.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UnityCore/GnomeSessionManager.cpp'
2--- UnityCore/GnomeSessionManager.cpp 2014-07-01 15:24:59 +0000
3+++ UnityCore/GnomeSessionManager.cpp 2014-08-06 16:03:19 +0000
4@@ -91,6 +91,11 @@
5 shell_object_ = shell_server_.GetObject(shell::DBUS_INTERFACE);
6 shell_object_->SetMethodsCallsHandler(sigc::mem_fun(this, &Impl::OnShellMethodCall));
7
8+ manager_->is_locked = false;
9+ manager_->is_locked.changed.connect([this] (bool locked) {
10+ locked ? manager_->locked.emit() : manager_->unlocked.emit();
11+ });
12+
13 {
14 const char* session_id = test_mode_ ? "id0" : g_getenv("XDG_SESSION_ID");
15
16@@ -421,21 +426,13 @@
17 {
18 EnsureCancelPendingAction();
19
20+ if (!manager_->CanLock())
21+ {
22+ manager_->ScreenSaverActivate();
23+ return;
24+ }
25+
26 // FIXME (andy) we should ask gnome-session to emit the logind signal
27- glib::Object<GSettings> lockdown_settings(g_settings_new(GNOME_LOCKDOWN_OPTIONS.c_str()));
28-
29- if (g_settings_get_boolean(lockdown_settings, DISABLE_LOCKSCREEN_KEY.c_str()))
30- {
31- manager_->ScreenSaverActivate();
32- return;
33- }
34- else if (manager_->UserName().find("guest-") == 0)
35- {
36- LOG_INFO(logger) << "Impossible to lock a guest session";
37- manager_->ScreenSaverActivate();
38- return;
39- }
40-
41 prompt ? manager_->prompt_lock_requested.emit() : manager_->lock_requested.emit();
42 }
43
44@@ -454,6 +451,39 @@
45 });
46 }
47
48+bool GnomeManager::Impl::HasInhibitors()
49+{
50+ glib::Error error;
51+ glib::Object<GDBusConnection> bus(g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, &error));
52+
53+ if (error)
54+ {
55+ LOG_ERROR(logger) << "Impossible to get the session bus, to fetch the inhibitors: " << error;
56+ return false;
57+ }
58+
59+ enum class Inhibited : unsigned
60+ {
61+ LOGOUT = 1,
62+ USER_SWITCH = 2,
63+ SUSPEND = 4,
64+ IDLE_SET = 8
65+ };
66+
67+ glib::Variant inhibitors(g_dbus_connection_call_sync(bus, test_mode_ ? testing::DBUS_NAME.c_str() : "org.gnome.SessionManager",
68+ "/org/gnome/SessionManager", "org.gnome.SessionManager",
69+ "IsInhibited", g_variant_new("(u)", Inhibited::LOGOUT), nullptr,
70+ G_DBUS_CALL_FLAGS_NONE, 500, nullptr, &error));
71+
72+ if (error)
73+ {
74+ LOG_ERROR(logger) << "Impossible to get the inhibitors: " << error;
75+ return false;
76+ }
77+
78+ return inhibitors.GetBool();
79+}
80+
81 // Public implementation
82
83 GnomeManager::GnomeManager()
84@@ -617,6 +647,19 @@
85 });
86 }
87
88+bool GnomeManager::CanLock() const
89+{
90+ glib::Object<GSettings> lockdown_settings(g_settings_new(GNOME_LOCKDOWN_OPTIONS.c_str()));
91+
92+ if (g_settings_get_boolean(lockdown_settings, DISABLE_LOCKSCREEN_KEY.c_str()) ||
93+ UserName().find("guest-") == 0 || is_locked())
94+ {
95+ return false;
96+ }
97+
98+ return true;
99+}
100+
101 bool GnomeManager::CanShutdown() const
102 {
103 return impl_->can_shutdown_;
104@@ -632,6 +675,11 @@
105 return impl_->can_hibernate_;
106 }
107
108+bool GnomeManager::HasInhibitors() const
109+{
110+ return impl_->HasInhibitors();
111+}
112+
113 void GnomeManager::CancelAction()
114 {
115 impl_->CancelAction();
116
117=== modified file 'UnityCore/GnomeSessionManager.h'
118--- UnityCore/GnomeSessionManager.h 2014-04-10 04:47:58 +0000
119+++ UnityCore/GnomeSessionManager.h 2014-08-06 16:03:19 +0000
120@@ -47,9 +47,11 @@
121 void Suspend();
122 void Hibernate();
123
124+ bool CanLock() const;
125 bool CanShutdown() const;
126 bool CanSuspend() const;
127 bool CanHibernate() const;
128+ bool HasInhibitors() const;
129
130 void CancelAction();
131
132
133=== modified file 'UnityCore/GnomeSessionManagerImpl.h'
134--- UnityCore/GnomeSessionManagerImpl.h 2014-07-01 15:24:59 +0000
135+++ UnityCore/GnomeSessionManagerImpl.h 2014-08-06 16:03:19 +0000
136@@ -51,6 +51,7 @@
137 void ConfirmShutdown();
138 void CancelAction();
139 void ClosedDialog();
140+ bool HasInhibitors();
141 void EnsureCancelPendingAction();
142 void LockScreen(bool prompt);
143
144
145=== modified file 'UnityCore/SessionManager.h'
146--- UnityCore/SessionManager.h 2014-07-01 15:24:59 +0000
147+++ UnityCore/SessionManager.h 2014-08-06 16:03:19 +0000
148@@ -39,6 +39,7 @@
149 virtual ~Manager() = default;
150
151 nux::ROProperty<bool> have_other_open_sessions;
152+ nux::Property<bool> is_locked;
153
154 virtual std::string RealName() const = 0;
155 virtual std::string UserName() const = 0;
156@@ -54,9 +55,11 @@
157 virtual void Suspend() = 0;
158 virtual void Hibernate() = 0;
159
160+ virtual bool CanLock() const = 0;
161 virtual bool CanShutdown() const = 0;
162 virtual bool CanSuspend() const = 0;
163 virtual bool CanHibernate() const = 0;
164+ virtual bool HasInhibitors() const = 0;
165
166 virtual void CancelAction() = 0;
167
168
169=== modified file 'dash/DashController.cpp'
170--- dash/DashController.cpp 2014-06-23 19:42:24 +0000
171+++ dash/DashController.cpp 2014-08-06 16:03:19 +0000
172@@ -468,8 +468,8 @@
173 nux::Geometry const& view_content_geo(view_->GetContentGeometry());
174
175 nux::Geometry geo(window_geo.x, window_geo.y, view_content_geo.width, view_content_geo.height);
176- geo.width += style.GetDashRightTileWidth();
177- geo.height += style.GetDashBottomTileHeight();
178+ geo.width += style.GetDashRightTileWidth().CP(view_->scale());
179+ geo.height += style.GetDashBottomTileHeight().CP(view_->scale());
180 return geo;
181 }
182
183
184=== modified file 'dash/DashView.cpp'
185--- dash/DashView.cpp 2014-04-25 02:42:01 +0000
186+++ dash/DashView.cpp 2014-08-06 16:03:19 +0000
187@@ -36,7 +36,6 @@
188 #include "unity-shared/DashStyle.h"
189 #include "unity-shared/KeyboardUtil.h"
190 #include "unity-shared/PreviewStyle.h"
191-#include "unity-shared/RawPixel.h"
192 #include "unity-shared/UBusMessages.h"
193 #include "unity-shared/UnitySettings.h"
194 #include "unity-shared/WindowManager.h"
195@@ -57,6 +56,8 @@
196
197 const RawPixel DASH_RESULT_RIGHT_PAD = 35_em;
198 const RawPixel PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET = 10_em;
199+const RawPixel PREVIEW_CONTAINER_TRIANGLE_WIDTH = 14_em;
200+const RawPixel PREVIEW_CONTAINER_TRIANGLE_HEIGHT = 12_em;
201
202 const int MAX_ENTRY_ACTIVATE_WAIT_TIMEOUT = 1000;
203 }
204@@ -112,6 +113,7 @@
205
206 DashView::DashView(Scopes::Ptr const& scopes, ApplicationStarter::Ptr const& application_starter)
207 : nux::View(NUX_TRACKER_LOCATION)
208+ , scale(Settings::Instance().em()->DPIScale())
209 , scopes_(scopes)
210 , application_starter_(application_starter)
211 , preview_container_(nullptr)
212@@ -129,7 +131,6 @@
213 , animate_preview_container_value_(0.0)
214 , animate_preview_value_(0.0)
215 , overlay_window_buttons_(new OverlayWindowButtons())
216- , cv_(Settings::Instance().em())
217 , monitor_(0)
218 {
219 renderer_.SetOwner(this);
220@@ -144,7 +145,6 @@
221
222 mouse_down.connect(sigc::mem_fun(this, &DashView::OnMouseButtonDown));
223 preview_state_machine_.PreviewActivated.connect(sigc::mem_fun(this, &DashView::BuildPreview));
224- Relayout();
225
226 if (scopes_)
227 {
228@@ -159,6 +159,8 @@
229 });
230
231 unity::Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &DashView::OnDPIChanged));
232+ scale.changed.connect(sigc::mem_fun(this, &DashView::UpdateScale));
233+ UpdateScale(scale());
234 }
235
236 DashView::~DashView()
237@@ -232,13 +234,13 @@
238
239 if (!preview_container_)
240 {
241- preview_container_ = previews::PreviewContainer::Ptr(new previews::PreviewContainer());
242+ preview_container_ = new previews::PreviewContainer();
243 preview_container_->SetRedirectRenderingToTexture(true);
244 AddChild(preview_container_.GetPointer());
245 preview_container_->SetParentObject(this);
246 }
247 preview_container_->Preview(model, previews::Navigation::NONE); // no swipe left or right
248-
249+ preview_container_->scale = scale();
250 preview_container_->SetGeometry(scopes_layout_->GetGeometry());
251 preview_displaying_ = true;
252
253@@ -265,6 +267,7 @@
254 {
255 // got a new preview whilst already displaying, we probably clicked a navigation button.
256 preview_container_->Preview(model, preview_navigation_mode_); // TODO
257+ preview_container_->scale = scale();
258 }
259
260 if (G_LIKELY(preview_state_machine_.left_results() > 0 && preview_state_machine_.right_results() > 0))
261@@ -466,10 +469,7 @@
262 if (monitor_ != monitor)
263 {
264 monitor_ = monitor;
265- cv_ = Settings::Instance().em(monitor_);
266-
267- OnDPIChanged();
268- Relayout();
269+ scale = Settings::Instance().em(monitor_)->DPIScale();
270 }
271
272 /* Give the scopes a chance to prep data before we map them */
273@@ -492,6 +492,7 @@
274
275 overlay_window_buttons_->Show();
276
277+ renderer_.scale = scale();
278 renderer_.UpdateBlurBackgroundSize(content_geo_, GetRenderAbsoluteGeometry(), false);
279 renderer_.AboutToShow();
280 }
281@@ -499,7 +500,7 @@
282 void DashView::AboutToHide()
283 {
284 if (BackgroundEffectHelper::blur_type == BLUR_STATIC)
285- {
286+ {
287 content_geo_ = {0, 0, 0, 0};
288 renderer_.UpdateBlurBackgroundSize(content_geo_, GetRenderAbsoluteGeometry(), false);
289 }
290@@ -547,7 +548,7 @@
291 content_layout_->AddLayout(search_bar_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
292
293 search_bar_ = new SearchBar(true);
294- search_bar_->scale = cv_->DPIScale();
295+ search_bar_->scale = scale();
296 AddChild(search_bar_);
297 search_bar_->activated.connect(sigc::mem_fun(this, &DashView::OnEntryActivated));
298 search_bar_->search_changed.connect(sigc::mem_fun(this, &DashView::OnSearchChanged));
299@@ -576,8 +577,11 @@
300
301 void DashView::OnDPIChanged()
302 {
303- double scale = cv_->DPIScale();
304+ scale = Settings::Instance().em(monitor_)->DPIScale();
305+}
306
307+void DashView::UpdateScale(double scale)
308+{
309 UpdateDashViewSize();
310
311 for (auto& scope : scope_views_)
312@@ -585,27 +589,23 @@
313
314 search_bar_->scale = scale;
315 scope_bar_->scale = scale;
316+ renderer_.scale = scale;
317+
318+ if (preview_container_)
319+ preview_container_->scale = scale;
320+
321+ Relayout();
322 }
323
324 void DashView::UpdateDashViewSize()
325 {
326 dash::Style const& style = dash::Style::Instance();
327
328- RawPixel const v_separator_size = style.GetVSeparatorSize();
329- RawPixel const h_separator_size = style.GetHSeparatorSize();
330- RawPixel const view_top_padding = style.GetDashViewTopPadding();
331-
332- RawPixel const search_bar_left_padding = style.GetSearchBarLeftPadding();
333- RawPixel const search_bar_height = style.GetSearchBarHeight();
334-
335- layout_->SetLeftAndRightPadding(v_separator_size.CP(cv_), 0);
336- layout_->SetTopAndBottomPadding(h_separator_size.CP(cv_), 0);
337-
338- content_layout_->SetTopAndBottomPadding(view_top_padding.CP(cv_), 0);
339-
340- search_bar_layout_->SetLeftAndRightPadding(search_bar_left_padding.CP(cv_), 0);
341- search_bar_->SetMinimumHeight(search_bar_height.CP(cv_));
342- search_bar_->SetMaximumHeight(search_bar_height.CP(cv_));
343+ layout_->SetLeftAndRightPadding(style.GetVSeparatorSize().CP(scale), 0);
344+ layout_->SetTopAndBottomPadding(style.GetHSeparatorSize().CP(scale), 0);
345+
346+ content_layout_->SetTopAndBottomPadding(style.GetDashViewTopPadding().CP(scale), 0);
347+ search_bar_layout_->SetLeftAndRightPadding(style.GetSearchBarLeftPadding().CP(scale), 0);
348 }
349
350 void DashView::SetupUBusConnections()
351@@ -626,7 +626,7 @@
352 content_geo_ = GetBestFitGeometry(geo);
353 dash::Style& style = dash::Style::Instance();
354
355- RawPixel const top_padding = style.GetDashViewTopPadding();
356+ int top_padding = style.GetDashViewTopPadding().CP(scale);
357
358 // kinda hacky, but it makes sure the content isn't so big that it throws
359 // the bottom of the dash off the screen
360@@ -634,18 +634,17 @@
361 scopes_layout_->SetMaximumHeight (std::max(0, content_geo_.height -
362 search_bar_->GetGeometry().height -
363 scope_bar_->GetGeometry().height -
364- top_padding.CP(cv_)));
365+ top_padding));
366
367 scopes_layout_->SetMinimumHeight (std::max(0, content_geo_.height -
368 search_bar_->GetGeometry().height -
369 scope_bar_->GetGeometry().height -
370- top_padding.CP(cv_)));
371+ top_padding));
372
373 layout_->SetMinMaxSize(content_geo_.width, content_geo_.y + content_geo_.height);
374
375 // Minus the padding that gets added to the left
376- RawPixel const tile_width = style.GetTileWidth();
377- style.SetDefaultNColumns(floorf((content_geo_.width - cv_->CP(32)) / tile_width.CP(cv_)));
378+ style.columns_number = floorf((content_geo_.width - (32_em).CP(scale)) / style.GetTileWidth().CP(scale));
379
380 ubus_manager_.SendMessage(UBUS_DASH_SIZE_CHANGED, g_variant_new("(ii)", content_geo_.width, content_geo_.height));
381
382@@ -666,33 +665,24 @@
383 int panel_height = renderer_.y_offset;
384
385 int width = 0, height = 0;
386- RawPixel const tile_width = style.GetTileWidth();
387- RawPixel const tile_height = style.GetTileHeight();
388- RawPixel const group_top_space = style.GetPlacesGroupTopSpace();
389- RawPixel const category_icon_size = style.GetCategoryIconSize();
390- RawPixel const group_top_padding = style.GetPlacesGroupResultTopPadding();
391+ int tile_width = style.GetTileWidth().CP(scale);
392
393- int category_height = (group_top_space.CP(cv_) + category_icon_size.CP(cv_) +
394- group_top_padding.CP(cv_) + tile_height.CP(cv_));
395+ int category_height = (style.GetPlacesGroupTopSpace().CP(scale) +
396+ style.GetCategoryIconSize().CP(scale) +
397+ style.GetPlacesGroupResultTopPadding().CP(scale) +
398+ style.GetTileHeight().CP(scale));
399
400 int half = for_geo.width / 2;
401
402 // if default dash size is bigger than half a screens worth of items, go for that.
403- while ((width += tile_width.CP(cv_)) < half)
404- ;
405-
406- RawPixel const v_separator_size = style.GetVSeparatorSize();
407- RawPixel const group_left_padding = style.GetPlacesGroupResultLeftPadding();
408-
409- width = std::max(width, tile_width.CP(cv_) * DASH_TILE_HORIZONTAL_COUNT);
410- width += v_separator_size.CP(cv_);
411- width += group_left_padding.CP(cv_) + DASH_RESULT_RIGHT_PAD.CP(cv_);
412-
413- RawPixel const h_separator_size = style.GetHSeparatorSize();
414- RawPixel const top_padding = style.GetDashViewTopPadding();
415-
416- height = h_separator_size.CP(cv_);
417- height += top_padding.CP(cv_);
418+ while ((width += tile_width) < half);
419+
420+ width = std::max(width, tile_width * DASH_TILE_HORIZONTAL_COUNT);
421+ width += style.GetVSeparatorSize().CP(scale);
422+ width += style.GetPlacesGroupResultLeftPadding().CP(scale) + DASH_RESULT_RIGHT_PAD.CP(scale);
423+
424+ height = style.GetHSeparatorSize().CP(scale);
425+ height += style.GetDashViewTopPadding().CP(scale);
426 height += search_bar_->GetGeometry().height;
427 height += category_height * DASH_DEFAULT_CATEGORY_COUNT; // adding three categories
428 height += scope_bar_->GetGeometry().height;
429@@ -806,7 +796,7 @@
430 texxform.voffset = (scope_bar_->GetY() - content_view_->GetY())/(float)content_view_->GetHeight();
431
432 int start_y = scope_bar_->GetY();
433- int final_y = geo_layout.y + geo_layout.height + PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(cv_);
434+ int final_y = geo_layout.y + geo_layout.height + PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(scale);
435
436 int scope_y = (1.0f - animate_split_value_) * start_y + (animate_split_value_ * final_y);
437
438@@ -830,7 +820,7 @@
439 texxform.voffset = (search_bar_->GetY() - content_view_->GetY())/(float)content_view_->GetHeight();
440
441 start_y = search_bar_->GetY();
442- final_y = geo_layout.y - search_bar_->GetHeight() - PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(cv_);
443+ final_y = geo_layout.y - search_bar_->GetHeight() - PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(scale);
444
445 graphics_engine.QRP_1Tex
446 (
447@@ -848,7 +838,7 @@
448 texxform.voffset = (search_bar_->GetY() - content_view_->GetY())/(float)content_view_->GetHeight();
449
450 int start_x = active_scope_view_->filter_bar()->GetX();
451- int final_x = content_view_->GetX() + content_view_->GetWidth() + PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(cv_);
452+ int final_x = content_view_->GetX() + content_view_->GetWidth() + PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(scale);
453
454 int filter_x = (1.0f - animate_split_value_) * start_x + (animate_split_value_ * final_x);
455
456@@ -872,7 +862,7 @@
457 texxform.voffset = (search_bar_->GetY() - content_view_->GetY())/(float)content_view_->GetHeight();
458
459 int start_y = search_bar_->GetY();
460- int final_y = geo_layout.y - search_bar_->GetHeight() - PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(cv_);
461+ int final_y = geo_layout.y - search_bar_->GetHeight() - PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET.CP(scale);
462
463 graphics_engine.QRP_1Tex
464 (
465@@ -906,8 +896,8 @@
466 // Triangle pointed at preview item
467 if (opening_column_x_ != -1)
468 {
469- int final_width = cv_->CP(14);
470- int final_height = cv_->CP(12);
471+ int final_width = PREVIEW_CONTAINER_TRIANGLE_WIDTH.CP(scale);
472+ int final_height = PREVIEW_CONTAINER_TRIANGLE_HEIGHT.CP(scale);
473
474 int x_center = geo_content.x + (opening_column_x_ - geo_abs.x) + opening_column_width_ / 2;
475 int start_y = geo_abs_preview.y - geo_abs.y;
476@@ -1136,11 +1126,8 @@
477 if (Settings::Instance().form_factor() == FormFactor::DESKTOP)
478 {
479 dash::Style& style = dash::Style::Instance();
480- RawPixel const right_title_width = style.GetDashRightTileWidth();
481- RawPixel const bottom_title_width = style.GetDashBottomTileHeight();
482-
483- geo.width += right_title_width.CP(cv_);
484- geo.height += bottom_title_width.CP(cv_);
485+ geo.width += style.GetDashRightTileWidth().CP(scale);
486+ geo.height += style.GetDashBottomTileHeight().CP(scale);
487 }
488 }
489
490@@ -1282,7 +1269,7 @@
491
492 nux::ObjectPtr<ScopeView> view(new ScopeView(scope, search_bar_->show_filters()));
493 AddChild(view.GetPointer());
494- view->scale = cv_->DPIScale();
495+ view->scale = scale();
496 view->SetVisible(false);
497 view->result_activated.connect(sigc::mem_fun(this, &DashView::OnResultActivated));
498
499@@ -1500,9 +1487,6 @@
500 int num_rows = 1; // The search bar
501 std::vector<bool> button_on_monitor;
502
503- RawPixel const right_title_width = style.GetDashRightTileWidth();
504- RawPixel const bottom_title_width = style.GetDashBottomTileHeight();
505-
506 if (active_scope_view_.IsValid())
507 num_rows += active_scope_view_->GetNumRows();
508
509@@ -1521,8 +1505,8 @@
510 introspection.add(nux::Geometry(GetAbsoluteX(), GetAbsoluteY(), content_geo_.width, content_geo_.height))
511 .add("num_rows", num_rows)
512 .add("form_factor", form_factor)
513- .add("right-border-width", right_title_width.CP(cv_))
514- .add("bottom-border-height", bottom_title_width.CP(cv_))
515+ .add("right-border-width", style.GetDashRightTileWidth().CP(scale))
516+ .add("bottom-border-height", style.GetDashBottomTileHeight().CP(scale))
517 .add("preview_displaying", preview_displaying_)
518 .add("preview_animation", animate_split_value_ * animate_preview_container_value_ * animate_preview_value_)
519 .add("dash_maximized", style.always_maximised())
520
521=== modified file 'dash/DashView.h'
522--- dash/DashView.h 2014-03-01 22:51:41 +0000
523+++ dash/DashView.h 2014-08-06 16:03:19 +0000
524@@ -37,7 +37,6 @@
525
526 #include "unity-shared/BackgroundEffectHelper.h"
527 #include "unity-shared/BGHash.h"
528-#include "unity-shared/EMConverter.h"
529 #include "unity-shared/Introspectable.h"
530 #include "unity-shared/OverlayRenderer.h"
531 #include "unity-shared/SearchBar.h"
532@@ -63,6 +62,8 @@
533 DashView(Scopes::Ptr const& scopes, ApplicationStarter::Ptr const& application_starter);
534 ~DashView();
535
536+ nux::Property<double> scale;
537+
538 void AboutToShow(int monitor);
539 void AboutToHide();
540 void Relayout();
541@@ -131,6 +132,7 @@
542 nux::Geometry GetRenderAbsoluteGeometry() const;
543
544 void UpdateDashViewSize();
545+ void UpdateScale(double scale);
546 void OnDPIChanged();
547
548 nux::Area* KeyNavIteration(nux::KeyNavDirection direction);
549@@ -195,7 +197,6 @@
550
551 nux::ObjectPtr<OverlayWindowButtons> overlay_window_buttons_;
552
553- EMConverter::Ptr cv_;
554 int monitor_;
555
556 friend class TestDashView;
557
558=== modified file 'dash/FilterBar.cpp'
559--- dash/FilterBar.cpp 2014-03-20 04:05:39 +0000
560+++ dash/FilterBar.cpp 2014-08-06 16:03:19 +0000
561@@ -47,28 +47,20 @@
562 : View(NUX_FILE_LINE_PARAM)
563 , scale(DEFAULT_SCALE)
564 {
565- Init();
566-}
567-
568-FilterBar::~FilterBar()
569-{
570-}
571-
572-void FilterBar::Init()
573-{
574- dash::Style& style = dash::Style::Instance();
575-
576- nux::LinearLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION);
577- layout->SetTopAndBottomPadding(style.GetFilterBarTopPadding() - style.GetFilterHighlightPadding());
578- layout->SetSpaceBetweenChildren(style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding());
579+ SetLayout(new nux::VLayout(NUX_TRACKER_LOCATION));
580 scale.changed.connect(sigc::mem_fun(this, &FilterBar::UpdateScale));
581- SetLayout(layout);
582+ UpdateScale(scale);
583 }
584
585 void FilterBar::UpdateScale(double scale)
586 {
587 for (auto& filters : filter_map_)
588 filters.second->scale = scale;
589+
590+ auto& style = dash::Style::Instance();
591+ auto* layout = static_cast<nux::VLayout*>(GetLayout());
592+ layout->SetTopAndBottomPadding(style.GetFilterBarTopPadding().CP(scale) - style.GetFilterHighlightPadding().CP(scale));
593+ layout->SetSpaceBetweenChildren(style.GetSpaceBetweenFilterWidgets().CP(scale) - style.GetFilterHighlightPadding().CP(scale));
594 }
595
596 void FilterBar::SetFilters(Filters::Ptr const& filters)
597@@ -118,9 +110,7 @@
598 }
599
600 void FilterBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
601-{
602-
603-}
604+{}
605
606 void FilterBar::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
607 {
608
609=== modified file 'dash/FilterBar.h'
610--- dash/FilterBar.h 2014-03-20 04:05:39 +0000
611+++ dash/FilterBar.h 2014-08-06 16:03:19 +0000
612@@ -42,7 +42,6 @@
613 NUX_DECLARE_OBJECT_TYPE(FilterBar, nux::View);
614 public:
615 FilterBar(NUX_FILE_LINE_PROTO);
616- ~FilterBar();
617
618 nux::Property<double> scale;
619
620@@ -62,7 +61,6 @@
621 virtual void AddProperties(debug::IntrospectionData&);
622
623 private:
624- void Init();
625 void UpdateScale(double scale);
626
627 FilterFactory factory_;
628
629=== modified file 'dash/FilterBasicButton.cpp'
630--- dash/FilterBasicButton.cpp 2013-11-14 03:00:29 +0000
631+++ dash/FilterBasicButton.cpp 2014-08-06 16:03:19 +0000
632@@ -22,53 +22,36 @@
633 #include "unity-shared/DashStyle.h"
634 #include "FilterBasicButton.h"
635
636-namespace
637-{
638-const int kMinButtonHeight = 30;
639-const int kMinButtonWidth = 48;
640-const int kFontSizePx = 15; // 15px == 11pt
641-}
642-
643 namespace unity
644 {
645 namespace dash
646 {
647-
648+namespace
649+{
650+const RawPixel BUTTON_HEIGHT = 30_em;
651+const RawPixel MIN_BUTTON_WIDTH = 48_em;
652+const int FONT_SIZE_PX = 15; // 15px == 11pt
653+}
654+
655 NUX_IMPLEMENT_OBJECT_TYPE(FilterBasicButton);
656
657 FilterBasicButton::FilterBasicButton(nux::TextureArea* image, NUX_FILE_LINE_DECL)
658- : nux::ToggleButton(image, NUX_FILE_LINE_PARAM)
659-{
660- Init();
661-}
662+ : FilterBasicButton(std::string(), image, NUX_FILE_LINE_PARAM)
663+{}
664+
665+FilterBasicButton::FilterBasicButton(NUX_FILE_LINE_DECL)
666+ : FilterBasicButton(std::string(), NUX_FILE_LINE_PARAM)
667+{}
668
669 FilterBasicButton::FilterBasicButton(std::string const& label, NUX_FILE_LINE_DECL)
670- : nux::ToggleButton(NUX_FILE_LINE_PARAM)
671- , label_(label)
672-{
673- Init();
674-}
675+ : FilterBasicButton(label, nullptr, NUX_FILE_LINE_PARAM)
676+{}
677
678 FilterBasicButton::FilterBasicButton(std::string const& label, nux::TextureArea* image, NUX_FILE_LINE_DECL)
679 : nux::ToggleButton(image, NUX_FILE_LINE_PARAM)
680+ , scale(1.0)
681 , label_(label)
682 {
683- Init();
684-}
685-
686-FilterBasicButton::FilterBasicButton(NUX_FILE_LINE_DECL)
687- : nux::ToggleButton(NUX_FILE_LINE_PARAM)
688-{
689- Init();
690-}
691-
692-FilterBasicButton::~FilterBasicButton()
693-{
694-}
695-
696-void FilterBasicButton::Init()
697-{
698-
699 InitTheme();
700 SetAcceptKeyNavFocusOnMouseDown(false);
701 SetAcceptKeyNavFocusOnMouseEnter(true);
702@@ -85,34 +68,44 @@
703 if (GetInputEventSensitivity())
704 Active() ? Deactivate() : Activate();
705 });
706+
707+ scale.changed.connect(sigc::mem_fun(this, &FilterBasicButton::UpdateScale));
708 }
709
710 void FilterBasicButton::InitTheme()
711 {
712- if (!active_)
713- {
714- nux::Geometry const& geo = GetGeometry();
715-
716- prelight_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
717- active_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)));
718- normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));
719- focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &FilterBasicButton::RedrawFocusOverlay)));
720- }
721-
722- SetMinimumHeight(kMinButtonHeight);
723- SetMinimumWidth(kMinButtonWidth);
724+ nux::Geometry const& geo = GetGeometry();
725+
726+ prelight_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
727+ active_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)));
728+ normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));
729+ focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &FilterBasicButton::RedrawFocusOverlay)));
730+
731+ SetMinimumWidth(MIN_BUTTON_WIDTH.CP(scale));
732+ ApplyMinWidth();
733+
734+ SetMinimumHeight(BUTTON_HEIGHT.CP(scale));
735+ SetMaximumHeight(BUTTON_HEIGHT.CP(scale));
736 }
737
738 void FilterBasicButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state)
739 {
740- Style::Instance().Button(cr, faked_state, label_, kFontSizePx, Alignment::CENTER, true);
741+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
742+ Style::Instance().Button(cr, faked_state, label_, FONT_SIZE_PX, Alignment::CENTER, true);
743 }
744
745 void FilterBasicButton::RedrawFocusOverlay(nux::Geometry const& geom, cairo_t* cr)
746 {
747+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
748 Style::Instance().ButtonFocusOverlay(cr);
749 }
750
751+void FilterBasicButton::UpdateScale(double scale)
752+{
753+ InitTheme();
754+ QueueDraw();
755+}
756+
757 long FilterBasicButton::ComputeContentSize()
758 {
759 long ret = nux::Button::ComputeContentSize();
760
761=== modified file 'dash/FilterBasicButton.h'
762--- dash/FilterBasicButton.h 2012-12-13 09:19:34 +0000
763+++ dash/FilterBasicButton.h 2014-08-06 16:03:19 +0000
764@@ -39,15 +39,15 @@
765 FilterBasicButton(std::string const& label, NUX_FILE_LINE_PROTO);
766 FilterBasicButton(std::string const& label, nux::TextureArea* image, NUX_FILE_LINE_PROTO);
767 FilterBasicButton(NUX_FILE_LINE_PROTO);
768- virtual ~FilterBasicButton();
769-
770- void SetClearBeforeDraw(bool clear_before_draw);
771+
772+ nux::Property<double> scale;
773+
774 protected:
775 virtual long ComputeContentSize();
776 virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
777
778- void Init();
779 void InitTheme();
780+ void SetClearBeforeDraw(bool clear_before_draw);
781 void RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state);
782 void RedrawFocusOverlay(nux::Geometry const& geom, cairo_t* cr);
783
784@@ -61,6 +61,8 @@
785 nux::Geometry cached_geometry_;
786
787 private:
788+ void UpdateScale(double);
789+
790 std::string label_;
791 bool clear_before_draw_;
792 };
793
794=== modified file 'dash/FilterExpanderLabel.cpp'
795--- dash/FilterExpanderLabel.cpp 2014-03-20 04:05:39 +0000
796+++ dash/FilterExpanderLabel.cpp 2014-08-06 16:03:19 +0000
797@@ -22,16 +22,20 @@
798
799 #include "unity-shared/DashStyle.h"
800 #include "unity-shared/GraphicsUtils.h"
801-#include "unity-shared/RawPixel.h"
802 #include "FilterExpanderLabel.h"
803
804+namespace unity
805+{
806+namespace dash
807+{
808 namespace
809 {
810-
811+const double DEFAULT_SCALE = 1.0;
812 const float EXPAND_DEFAULT_ICON_OPACITY = 1.0f;
813-
814-// expander_layout_
815-const int EXPANDER_LAYOUT_SPACE_BETWEEN_CHILDREN = 8;
816+const RawPixel EXPANDER_LAYOUT_SPACE_BETWEEN_CHILDREN = 8_em;
817+const RawPixel ARROW_HORIZONTAL_PADDING = 2_em;
818+const RawPixel ARROW_TOP_PADDING = 11_em;
819+const RawPixel ARROW_BOTTOM_PADDING = 9_em;
820
821 // font
822 const char* const FONT_EXPANDER_LABEL = "Ubuntu 13"; // 17px = 13
823@@ -72,16 +76,6 @@
824
825 }
826
827-namespace unity
828-{
829-namespace dash
830-{
831-
832-namespace
833-{
834- double const DEFAULT_SCALE = 1.0;
835-}
836-
837 NUX_IMPLEMENT_OBJECT_TYPE(FilterExpanderLabel);
838
839 FilterExpanderLabel::FilterExpanderLabel(std::string const& label, NUX_FILE_LINE_DECL)
840@@ -94,8 +88,6 @@
841 , expander_layout_(nullptr)
842 , right_hand_contents_(nullptr)
843 , cairo_label_(nullptr)
844- , raw_label_(label)
845- , label_("label")
846 {
847 scale.changed.connect(sigc::mem_fun(this, &FilterExpanderLabel::UpdateScale));
848 expanded.changed.connect(sigc::mem_fun(this, &FilterExpanderLabel::DoExpandChange));
849@@ -104,14 +96,13 @@
850
851 void FilterExpanderLabel::SetLabel(std::string const& label)
852 {
853- raw_label_ = label;
854-
855- cairo_label_->SetText(label.c_str());
856+ cairo_label_->SetText(label);
857 }
858
859 void FilterExpanderLabel::UpdateScale(double scale)
860 {
861 cairo_label_->SetScale(scale);
862+ UpdateLayoutSizes();
863 }
864
865 void FilterExpanderLabel::SetRightHandView(nux::View* view)
866@@ -143,40 +134,27 @@
867
868 void FilterExpanderLabel::BuildLayout()
869 {
870- dash::Style& style = dash::Style::Instance();
871-
872 layout_ = new nux::VLayout(NUX_TRACKER_LOCATION);
873- layout_->SetLeftAndRightPadding(style.GetFilterBarLeftPadding(), style.GetFilterBarRightPadding());
874-
875 top_bar_layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
876- top_bar_layout_->SetTopAndBottomPadding(style.GetFilterHighlightPadding());
877-
878 expander_layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
879- expander_layout_->SetSpaceBetweenChildren(EXPANDER_LAYOUT_SPACE_BETWEEN_CHILDREN);
880
881 expander_view_ = new ExpanderView(NUX_TRACKER_LOCATION);
882 expander_view_->SetLayout(expander_layout_);
883 top_bar_layout_->AddView(expander_view_, 1);
884
885- cairo_label_ = new StaticCairoText(label_.c_str(), NUX_TRACKER_LOCATION);
886+ cairo_label_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
887 cairo_label_->SetFont(FONT_EXPANDER_LABEL);
888+ cairo_label_->SetScale(scale);
889 cairo_label_->SetTextColor(nux::color::White);
890 cairo_label_->SetAcceptKeyboardEvent(false);
891
892- nux::BaseTexture* arrow;
893- arrow = dash::Style::Instance().GetGroupUnexpandIcon();
894- expand_icon_ = new IconTexture(arrow,
895- arrow->GetWidth(),
896- arrow->GetHeight());
897+ expand_icon_ = new IconTexture(Style::Instance().GetGroupUnexpandIcon());
898 expand_icon_->SetOpacity(EXPAND_DEFAULT_ICON_OPACITY);
899- expand_icon_->SetMinimumSize(arrow->GetWidth(), arrow->GetHeight());
900+ expand_icon_->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
901 expand_icon_->SetVisible(true);
902+
903 arrow_layout_ = new nux::VLayout();
904- arrow_top_space_ = new nux::SpaceLayout(2, 2, 11, 11);
905- arrow_bottom_space_ = new nux::SpaceLayout(2, 2, 9, 9);
906- arrow_layout_->AddView(arrow_top_space_, 0, nux::MINOR_POSITION_CENTER);
907 arrow_layout_->AddView(expand_icon_, 0, nux::MINOR_POSITION_CENTER);
908- arrow_layout_->AddView(arrow_bottom_space_, 0, nux::MINOR_POSITION_CENTER);
909
910 expander_layout_->AddView(cairo_label_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
911 expander_layout_->AddView(arrow_layout_, 0, nux::MINOR_POSITION_CENTER);
912@@ -209,8 +187,25 @@
913 cairo_label_->mouse_click.connect(mouse_expand);
914 expand_icon_->mouse_click.connect(mouse_expand);
915
916+ UpdateLayoutSizes();
917+}
918+
919+void FilterExpanderLabel::UpdateLayoutSizes()
920+{
921+ auto& style = dash::Style::Instance();
922+
923+ layout_->SetLeftAndRightPadding(style.GetFilterBarLeftPadding().CP(scale), style.GetFilterBarRightPadding().CP(scale));
924+ top_bar_layout_->SetTopAndBottomPadding(style.GetFilterHighlightPadding().CP(scale));
925+ expander_layout_->SetSpaceBetweenChildren(EXPANDER_LAYOUT_SPACE_BETWEEN_CHILDREN.CP(scale));
926+
927+ auto const& tex = expand_icon_->texture();
928+ expand_icon_->SetMinMaxSize(RawPixel(tex->GetWidth()).CP(scale), RawPixel(tex->GetHeight()).CP(scale));
929+
930+ arrow_layout_->SetLeftAndRightPadding(ARROW_HORIZONTAL_PADDING.CP(scale));
931+ arrow_layout_->SetTopAndBottomPadding(ARROW_TOP_PADDING.CP(scale), ARROW_BOTTOM_PADDING.CP(scale));
932+
933 QueueRelayout();
934- NeedRedraw();
935+ QueueDraw();
936 }
937
938 void FilterExpanderLabel::DoExpandChange(bool change)
939@@ -221,6 +216,9 @@
940 else
941 expand_icon_->SetTexture(style.GetGroupExpandIcon());
942
943+ auto const& tex = expand_icon_->texture();
944+ expand_icon_->SetMinMaxSize(RawPixel(tex->GetWidth()).CP(scale), RawPixel(tex->GetHeight()).CP(scale));
945+
946 if (change and contents_ and !contents_->IsChildOf(layout_))
947 {
948 layout_->AddLayout(contents_.GetPointer(), 1, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL, 100.0f, nux::LayoutPosition(1));
949@@ -278,7 +276,7 @@
950 graphics::ClearGeometry(right_hand_contents_->GetGeometry());
951
952 if (expanded())
953- ClearRedirectedRenderChildArea();
954+ ClearRedirectedRenderChildArea();
955 }
956
957 if (focus_layer_ && ShouldBeHighlighted())
958@@ -296,7 +294,7 @@
959
960 if (IsFullRedraw())
961 {
962- nux::GetPainter().PopPaintLayerStack();
963+ nux::GetPainter().PopPaintLayerStack();
964 }
965 else if (pushed_paint_layers > 0)
966 {
967
968=== modified file 'dash/FilterExpanderLabel.h'
969--- dash/FilterExpanderLabel.h 2014-03-20 04:05:39 +0000
970+++ dash/FilterExpanderLabel.h 2014-08-06 16:03:19 +0000
971@@ -80,21 +80,18 @@
972
973 private:
974 void BuildLayout();
975+ void UpdateLayoutSizes();
976 void DoExpandChange(bool change);
977 bool ShouldBeHighlighted();
978 void UpdateScale(double scale);
979
980- nux::LinearLayout* layout_;
981+ nux::VLayout* layout_;
982 nux::LinearLayout* top_bar_layout_;
983 nux::View* expander_view_;
984 nux::LinearLayout* expander_layout_;
985 nux::View* right_hand_contents_;
986 StaticCairoText* cairo_label_;
987- std::string raw_label_;
988- std::string label_;
989 nux::VLayout* arrow_layout_;
990- nux::SpaceLayout* arrow_top_space_;
991- nux::SpaceLayout* arrow_bottom_space_;
992 IconTexture* expand_icon_;
993
994 nux::ObjectPtr<nux::Layout> contents_;
995
996=== modified file 'dash/FilterGenreWidget.cpp'
997--- dash/FilterGenreWidget.cpp 2013-04-18 12:13:21 +0000
998+++ dash/FilterGenreWidget.cpp 2014-08-06 16:03:19 +0000
999@@ -35,6 +35,11 @@
1000 {
1001 namespace dash
1002 {
1003+namespace
1004+{
1005+const RawPixel CHILDREN_SPACE = 12_em;
1006+const RawPixel CHILDREN_SPACE_SMALLER = 10_em;
1007+}
1008
1009 NUX_IMPLEMENT_OBJECT_TYPE(FilterGenre);
1010
1011@@ -42,33 +47,41 @@
1012 : FilterExpanderLabel(_("Categories"), NUX_FILE_LINE_PARAM)
1013 , all_button_(nullptr)
1014 {
1015- dash::Style& style = dash::Style::Instance();
1016-
1017 InitTheme();
1018
1019-
1020 genre_layout_ = new nux::GridHLayout(NUX_TRACKER_LOCATION);
1021 genre_layout_->ForceChildrenSize(true);
1022 genre_layout_->MatchContentSize(true);
1023- genre_layout_->SetTopAndBottomPadding(style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding(), style.GetFilterHighlightPadding());
1024 genre_layout_->EnablePartialVisibility(false);
1025
1026+ UpdateSize(columns);
1027+ SetContents(genre_layout_);
1028+
1029+ scale.changed.connect([this, columns] (double scale) {
1030+ if (all_button_) all_button_->scale = scale;
1031+
1032+ for (auto* button : buttons_)
1033+ button->scale = scale;
1034+
1035+ UpdateSize(columns);
1036+ });
1037+}
1038+
1039+void FilterGenre::UpdateSize(int columns)
1040+{
1041+ auto& style = dash::Style::Instance();
1042+ genre_layout_->SetTopAndBottomPadding(style.GetSpaceBetweenFilterWidgets().CP(scale) - style.GetFilterHighlightPadding().CP(scale), style.GetFilterHighlightPadding().CP(scale));
1043+
1044 if (columns == 3)
1045 {
1046- genre_layout_->SetChildrenSize((style.GetFilterBarWidth() - 12 * 2) / 3, style.GetFilterButtonHeight());
1047- genre_layout_->SetSpaceBetweenChildren (12, 12);
1048+ genre_layout_->SetChildrenSize((style.GetFilterBarWidth().CP(scale) - CHILDREN_SPACE.CP(scale) * 2) / 3, style.GetFilterButtonHeight().CP(scale));
1049+ genre_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale), CHILDREN_SPACE.CP(scale));
1050 }
1051 else
1052 {
1053- genre_layout_->SetChildrenSize((style.GetFilterBarWidth() - 10 ) / 2, style.GetFilterButtonHeight());
1054- genre_layout_->SetSpaceBetweenChildren (10, 12);
1055+ genre_layout_->SetChildrenSize((style.GetFilterBarWidth().CP(scale) - CHILDREN_SPACE_SMALLER.CP(scale)) / 2, style.GetFilterButtonHeight().CP(scale));
1056+ genre_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE_SMALLER.CP(scale), CHILDREN_SPACE.CP(scale));
1057 }
1058-
1059- SetContents(genre_layout_);
1060-}
1061-
1062-FilterGenre::~FilterGenre()
1063-{
1064 }
1065
1066 void FilterGenre::SetFilter(Filter::Ptr const& filter)
1067@@ -81,11 +94,14 @@
1068 all_button_ = show_all_button ? new FilterAllButton(NUX_TRACKER_LOCATION) : nullptr;
1069 SetRightHandView(all_button_);
1070 if (all_button_)
1071+ {
1072+ all_button_->scale = scale();
1073 all_button_->SetFilter(filter_);
1074+ }
1075 };
1076 show_button_func(filter_->show_all_button);
1077 filter_->show_all_button.changed.connect(show_button_func);
1078-
1079+
1080 expanded = !filter_->collapsed();
1081
1082 filter_->option_added.connect(sigc::mem_fun(this, &FilterGenre::OnOptionAdded));
1083@@ -106,6 +122,7 @@
1084 std::string label(escape.Value());
1085
1086 FilterGenreButton* button = new FilterGenreButton(label, NUX_TRACKER_LOCATION);
1087+ button->scale = scale();
1088 button->SetFilter(new_filter);
1089 genre_layout_->AddView(button, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
1090 buttons_.push_back(button);
1091@@ -121,7 +138,7 @@
1092 {
1093 genre_layout_->RemoveChildObject(*it);
1094 buttons_.erase(it);
1095-
1096+
1097 QueueRelayout();
1098 break;
1099 }
1100
1101=== modified file 'dash/FilterGenreWidget.h'
1102--- dash/FilterGenreWidget.h 2012-11-27 23:16:06 +0000
1103+++ dash/FilterGenreWidget.h 2014-08-06 16:03:19 +0000
1104@@ -46,7 +46,6 @@
1105 NUX_DECLARE_OBJECT_TYPE(FilterGenre, FilterExpanderLabel);
1106 public:
1107 FilterGenre(int columns, NUX_FILE_LINE_PROTO);
1108- virtual ~FilterGenre();
1109
1110 void SetFilter(Filter::Ptr const& filter);
1111 std::string GetFilterType();
1112@@ -59,6 +58,7 @@
1113 private:
1114 void OnOptionAdded(FilterOption::Ptr const& new_filter);
1115 void OnOptionRemoved(FilterOption::Ptr const& removed_filter);
1116+ void UpdateSize(int columns);
1117
1118 nux::GridHLayout* genre_layout_;
1119 FilterAllButton* all_button_;
1120
1121=== modified file 'dash/FilterMultiRangeButton.cpp'
1122--- dash/FilterMultiRangeButton.cpp 2013-11-14 03:00:29 +0000
1123+++ dash/FilterMultiRangeButton.cpp 2014-08-06 16:03:19 +0000
1124@@ -33,29 +33,18 @@
1125
1126 namespace
1127 {
1128-const int kFontSizePx = 10;
1129-
1130-const int kLayoutPadLeftRight = 4;
1131-const int kLayoutPadtopBottom = 2;
1132+const int FONT_SIZE_PX = 10;
1133 }
1134
1135 NUX_IMPLEMENT_OBJECT_TYPE(FilterMultiRangeButton);
1136
1137 FilterMultiRangeButton::FilterMultiRangeButton(NUX_FILE_LINE_DECL)
1138 : nux::ToggleButton(NUX_FILE_LINE_PARAM)
1139+ , scale(1.0)
1140 , theme_init_(false)
1141 , has_arrow_(MultiRangeArrow::NONE)
1142 , side_(MultiRangeSide::CENTER)
1143 {
1144- Init();
1145-}
1146-
1147-FilterMultiRangeButton::~FilterMultiRangeButton()
1148-{
1149-}
1150-
1151-void FilterMultiRangeButton::Init()
1152-{
1153 InitTheme();
1154 // Controlled by parent widget
1155 SetAcceptKeyNavFocusOnMouseDown(false);
1156@@ -64,6 +53,8 @@
1157 state_change.connect(sigc::mem_fun(this, &FilterMultiRangeButton::OnActivated));
1158 key_nav_focus_change.connect([this](nux::Area*, bool, nux::KeyNavDirection) { QueueDraw(); });
1159 key_nav_focus_activate.connect([this](nux::Area* area) { Active() ? Deactivate() : Activate(); });
1160+
1161+ scale.changed.connect(sigc::hide(sigc::mem_fun(this, &FilterMultiRangeButton::InitTheme)));
1162 }
1163
1164 void FilterMultiRangeButton::OnActivated(nux::Area* area)
1165@@ -133,27 +124,26 @@
1166
1167 void FilterMultiRangeButton::InitTheme()
1168 {
1169- if (!active_[MapKey(MultiRangeArrow::LEFT, MultiRangeSide::LEFT)])
1170+ nux::Geometry const& geo = GetGeometry();
1171+
1172+ std::vector<MultiRangeSide> sides = {MultiRangeSide::LEFT, MultiRangeSide::RIGHT, MultiRangeSide::CENTER};
1173+ std::vector<MultiRangeArrow> arrows = {MultiRangeArrow::LEFT, MultiRangeArrow::RIGHT, MultiRangeArrow::BOTH, MultiRangeArrow::NONE};
1174+
1175+ for (auto arrow : arrows)
1176 {
1177- nux::Geometry const& geo = GetGeometry();
1178-
1179- std::vector<MultiRangeSide> sides = {MultiRangeSide::LEFT, MultiRangeSide::RIGHT, MultiRangeSide::CENTER};
1180- std::vector<MultiRangeArrow> arrows = {MultiRangeArrow::LEFT, MultiRangeArrow::RIGHT, MultiRangeArrow::BOTH, MultiRangeArrow::NONE};
1181-
1182- for (auto arrow : arrows)
1183+ for (auto side : sides)
1184 {
1185- for (auto side : sides)
1186- {
1187- active_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED, arrow, side)));
1188- normal_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL, arrow, side)));
1189- prelight_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT, arrow, side)));
1190- focus_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawFocusOverlay), arrow, side)));
1191- }
1192+ active_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED, arrow, side)));
1193+ normal_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL, arrow, side)));
1194+ prelight_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT, arrow, side)));
1195+ focus_[MapKey(arrow, side)].reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawFocusOverlay), arrow, side)));
1196 }
1197 }
1198
1199- SetMinimumHeight(dash::Style::Instance().GetFilterButtonHeight() + 3);
1200+ SetMinimumHeight(Style::Instance().GetFilterButtonHeight().CP(scale) + (3_em).CP(scale));
1201 theme_init_ = true;
1202+
1203+ QueueDraw();
1204 }
1205
1206 void FilterMultiRangeButton::RedrawTheme(nux::Geometry const& geom,
1207@@ -187,8 +177,9 @@
1208 else
1209 segment = Segment::RIGHT;
1210
1211- Style::Instance().MultiRangeSegment(cr, faked_state, name, kFontSizePx, arrow, segment);
1212- NeedRedraw();
1213+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
1214+ Style::Instance().MultiRangeSegment(cr, faked_state, name, FONT_SIZE_PX, arrow, segment);
1215+ QueueDraw();
1216 }
1217
1218 void FilterMultiRangeButton::RedrawFocusOverlay(nux::Geometry const& geom,
1219@@ -214,6 +205,7 @@
1220 else
1221 segment = Segment::RIGHT;
1222
1223+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
1224 Style::Instance().MultiRangeFocusOverlay(cr, arrow, segment);
1225 QueueDraw();
1226 }
1227
1228=== modified file 'dash/FilterMultiRangeButton.h'
1229--- dash/FilterMultiRangeButton.h 2013-11-08 15:05:51 +0000
1230+++ dash/FilterMultiRangeButton.h 2014-08-06 16:03:19 +0000
1231@@ -54,8 +54,9 @@
1232 {
1233 NUX_DECLARE_OBJECT_TYPE(FilterMultiRangeButton, nux::ToggleButton);
1234 public:
1235- FilterMultiRangeButton (NUX_FILE_LINE_PROTO);
1236- virtual ~FilterMultiRangeButton();
1237+ FilterMultiRangeButton(NUX_FILE_LINE_PROTO);
1238+
1239+ nux::Property<double> scale;
1240
1241 void SetFilter(FilterOption::Ptr const& filter);
1242 FilterOption::Ptr GetFilter();
1243@@ -69,7 +70,6 @@
1244
1245 private:
1246 void InitTheme();
1247- void Init();
1248
1249 void RedrawTheme(nux::Geometry const& geom,
1250 cairo_t* cr,
1251
1252=== modified file 'dash/FilterMultiRangeWidget.cpp'
1253--- dash/FilterMultiRangeWidget.cpp 2013-04-17 15:10:39 +0000
1254+++ dash/FilterMultiRangeWidget.cpp 2014-08-06 16:03:19 +0000
1255@@ -64,6 +64,13 @@
1256 mouse_up.connect(sigc::mem_fun(this, &FilterMultiRangeWidget::RecvMouseUp));
1257
1258 mouse_drag.connect(sigc::mem_fun(this, &FilterMultiRangeWidget::RecvMouseDrag));
1259+
1260+ scale.changed.connect([this] (double scale) {
1261+ if (all_button_) all_button_->scale = scale;
1262+
1263+ for (auto const& button : buttons_)
1264+ button->scale = scale;
1265+ });
1266 }
1267
1268 void FilterMultiRangeWidget::SetFilter(Filter::Ptr const& filter)
1269@@ -83,11 +90,14 @@
1270 all_button_ = show_all_button ? new FilterAllButton(NUX_TRACKER_LOCATION) : nullptr;
1271 SetRightHandView(all_button_);
1272 if (all_button_)
1273+ {
1274+ all_button_->scale = scale();
1275 all_button_->SetFilter(filter_);
1276+ }
1277 };
1278 show_button_func(filter_->show_all_button);
1279 filter_->show_all_button.changed.connect(show_button_func);
1280-
1281+
1282 expanded = !filter_->collapsed();
1283
1284 filter_->option_added.connect(sigc::mem_fun(this, &FilterMultiRangeWidget::OnOptionAdded));
1285@@ -151,6 +161,7 @@
1286 void FilterMultiRangeWidget::OnOptionAdded(FilterOption::Ptr const& new_filter)
1287 {
1288 FilterMultiRangeButtonPtr button(new FilterMultiRangeButton(NUX_TRACKER_LOCATION));
1289+ button->scale = scale();
1290 button->SetFilter(new_filter);
1291 layout_->AddView(button.GetPointer());
1292 buttons_.push_back(button);
1293
1294=== modified file 'dash/FilterRatingsButton.cpp'
1295--- dash/FilterRatingsButton.cpp 2013-11-14 03:00:29 +0000
1296+++ dash/FilterRatingsButton.cpp 2014-08-06 16:03:19 +0000
1297@@ -1,5 +1,5 @@
1298 /*
1299- * Copyright 2011 Canonical Ltd.
1300+ * Copyright 2014 Canonical Ltd.
1301 *
1302 * This program is free software: you can redistribute it and/or modify it
1303 * under the terms of the GNU Lesser General Public License version 3, as
1304@@ -15,66 +15,39 @@
1305 * License version 3 along with this program. If not, see
1306 * <http://www.gnu.org/licenses/>
1307 *
1308- * Authored by: Gordon Allott <gord.allott@canonical.com>
1309+ * Authored by: Marco Trevisan <marco.trevisan@canonical.com>
1310 *
1311 */
1312
1313-#include <math.h>
1314-
1315-#include <Nux/Nux.h>
1316-#include <NuxCore/Logger.h>
1317-
1318-#include "unity-shared/DashStyle.h"
1319 #include "FilterRatingsButton.h"
1320
1321 namespace
1322 {
1323-const int star_size = 28;
1324-const int star_gap = 10;
1325-const int num_stars = 5;
1326+const int STAR_SIZE = 28;
1327+const int STAR_GAP = 10;
1328 }
1329
1330 namespace unity
1331 {
1332 namespace dash
1333 {
1334-
1335+
1336 NUX_IMPLEMENT_OBJECT_TYPE(FilterRatingsButton);
1337
1338 FilterRatingsButton::FilterRatingsButton(NUX_FILE_LINE_DECL)
1339- : nux::ToggleButton(NUX_FILE_LINE_PARAM)
1340- , focused_star_(-1)
1341-{
1342- SetAcceptKeyNavFocusOnMouseDown(false);
1343- SetAcceptKeyNavFocusOnMouseEnter(true);
1344-
1345- mouse_up.connect(sigc::mem_fun(this, &FilterRatingsButton::RecvMouseUp));
1346- mouse_move.connect(sigc::mem_fun(this, &FilterRatingsButton::RecvMouseMove));
1347- mouse_drag.connect(sigc::mem_fun(this, &FilterRatingsButton::RecvMouseDrag));
1348-
1349- key_nav_focus_change.connect([this](nux::Area* area, bool has_focus, nux::KeyNavDirection direction)
1350- {
1351- if (has_focus)
1352- focused_star_ = 0;
1353- else if (!has_focus)
1354- focused_star_ = -1;
1355-
1356- QueueDraw();
1357- });
1358-
1359- key_nav_focus_activate.connect([this](nux::Area*) { filter_->rating = static_cast<float>(focused_star_+1)/num_stars; });
1360- key_down.connect(sigc::mem_fun(this, &FilterRatingsButton::OnKeyDown));
1361-}
1362-
1363-FilterRatingsButton::~FilterRatingsButton()
1364-{
1365-}
1366+ : RatingsButton(STAR_SIZE, STAR_GAP, NUX_FILE_LINE_PARAM)
1367+{}
1368
1369 void FilterRatingsButton::SetFilter(Filter::Ptr const& filter)
1370 {
1371 filter_ = std::static_pointer_cast<RatingsFilter>(filter);
1372- filter_->rating.changed.connect(sigc::mem_fun(this, &FilterRatingsButton::OnRatingsChanged));
1373- NeedRedraw();
1374+ filter_->rating.changed.connect(sigc::mem_fun(this, &FilterRatingsButton::SetRating));
1375+ QueueDraw();
1376+}
1377+
1378+RatingsFilter::Ptr FilterRatingsButton::GetFilter() const
1379+{
1380+ return filter_;
1381 }
1382
1383 std::string FilterRatingsButton::GetFilterType()
1384@@ -82,188 +55,22 @@
1385 return "FilterRatingsButton";
1386 }
1387
1388-void FilterRatingsButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
1389-{
1390- int rating = 0;
1391- if (filter_ && filter_->filtering)
1392- rating = static_cast<int>(filter_->rating * num_stars);
1393- // FIXME: 9/26/2011
1394- // We should probably support an API for saying whether the ratings
1395- // should or shouldn't support half stars...but our only consumer at
1396- // the moment is the applications scope which according to design
1397- // (Bug #839759) shouldn't. So for now just force rounding.
1398- // int total_half_stars = rating % 2;
1399- // int total_full_stars = rating / 2;
1400- int total_full_stars = rating;
1401-
1402- nux::Geometry const& geo = GetGeometry();
1403- nux::Geometry geo_star(geo);
1404- geo_star.width = star_size;
1405-
1406- gPainter.PaintBackground(GfxContext, geo);
1407- // set up our texture mode
1408- nux::TexCoordXForm texxform;
1409- texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
1410- texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
1411-
1412- // clear what is behind us
1413- unsigned int alpha = 0, src = 0, dest = 0;
1414-
1415- GfxContext.GetRenderStates().GetBlend(alpha, src, dest);
1416- GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
1417-
1418- nux::Color col = nux::color::Black;
1419- col.alpha = 0;
1420- GfxContext.QRP_Color(geo.x,
1421- geo.y,
1422- geo.width,
1423- geo.height,
1424- col);
1425-
1426- for (int index = 0; index < num_stars; ++index)
1427- {
1428- Style& style = Style::Instance();
1429- nux::BaseTexture* texture = style.GetStarSelectedIcon();
1430- if (index < total_full_stars)
1431- {
1432- if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL)
1433- texture = style.GetStarSelectedIcon();
1434- else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)
1435- texture = style.GetStarSelectedIcon();
1436- else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
1437- texture = style.GetStarSelectedIcon();
1438- }
1439- else
1440- {
1441- if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL)
1442- texture = style.GetStarDeselectedIcon();
1443- else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)
1444- texture = style.GetStarDeselectedIcon();
1445- else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
1446- texture = style.GetStarDeselectedIcon();
1447- }
1448-
1449- GfxContext.QRP_1Tex(geo_star.x,
1450- geo_star.y,
1451- geo_star.width,
1452- geo_star.height,
1453- texture->GetDeviceTexture(),
1454- texxform,
1455- nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
1456-
1457- if (focused_star_ == index)
1458- {
1459- GfxContext.QRP_1Tex(geo_star.x,
1460- geo_star.y,
1461- geo_star.width,
1462- geo_star.height,
1463- style.GetStarHighlightIcon()->GetDeviceTexture(),
1464- texxform,
1465- nux::Color(1.0f, 1.0f, 1.0f, 0.5f));
1466- }
1467-
1468- geo_star.x += geo_star.width + star_gap;
1469-
1470- }
1471-
1472- GfxContext.GetRenderStates().SetBlend(alpha, src, dest);
1473-
1474-}
1475-
1476-static void _UpdateRatingToMouse(RatingsFilter::Ptr filter, int x)
1477-{
1478- int width = 180;
1479- float new_rating = (static_cast<float>(x) / width);
1480-
1481- // FIXME: change to * 2 once we decide to support also half-stars
1482- new_rating = ceil((num_stars * 1) * new_rating) / (num_stars * 1);
1483- new_rating = (new_rating > 1) ? 1 : ((new_rating < 0) ? 0 : new_rating);
1484-
1485- if (filter)
1486- filter->rating = new_rating;
1487-}
1488-
1489-void FilterRatingsButton::RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags)
1490-{
1491- _UpdateRatingToMouse(filter_, x);
1492-}
1493-
1494-void FilterRatingsButton::RecvMouseDrag(int x, int y, int dx, int dy,
1495- unsigned long button_flags,
1496- unsigned long key_flags)
1497-{
1498- _UpdateRatingToMouse(filter_, x);
1499-}
1500-
1501-void FilterRatingsButton::OnRatingsChanged(int rating)
1502-{
1503- NeedRedraw();
1504-}
1505-
1506-void FilterRatingsButton::RecvMouseMove(int x, int y, int dx, int dy,
1507- unsigned long button_flags,
1508- unsigned long key_flags)
1509-{
1510- int width = 180;
1511- focused_star_ = std::max(0, std::min(static_cast<int>(ceil((static_cast<float>(x) / width) * num_stars) - 1), num_stars - 1));
1512-
1513- if (!HasKeyFocus())
1514- nux::GetWindowCompositor().SetKeyFocusArea(this);
1515-
1516- QueueDraw();
1517-}
1518-
1519-
1520-bool FilterRatingsButton::InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character)
1521-{
1522- nux::KeyNavDirection direction = nux::KEY_NAV_NONE;
1523-
1524- switch (keysym)
1525- {
1526- case NUX_VK_LEFT:
1527- direction = nux::KeyNavDirection::KEY_NAV_LEFT;
1528- break;
1529- case NUX_VK_RIGHT:
1530- direction = nux::KeyNavDirection::KEY_NAV_RIGHT;
1531- break;
1532- default:
1533- direction = nux::KeyNavDirection::KEY_NAV_NONE;
1534- break;
1535- }
1536-
1537- if (direction == nux::KeyNavDirection::KEY_NAV_NONE)
1538- return false;
1539- else if (direction == nux::KEY_NAV_LEFT && (focused_star_ <= 0))
1540- return false;
1541- else if (direction == nux::KEY_NAV_RIGHT && (focused_star_ >= num_stars - 1))
1542- return false;
1543- else
1544- return true;
1545-}
1546-
1547-
1548-void FilterRatingsButton::OnKeyDown(unsigned long event_type, unsigned long event_keysym,
1549- unsigned long event_state, const TCHAR* character,
1550- unsigned short key_repeat_count)
1551-{
1552- switch (event_keysym)
1553- {
1554- case NUX_VK_LEFT:
1555- --focused_star_;
1556- break;
1557- case NUX_VK_RIGHT:
1558- ++focused_star_;
1559- break;
1560- default:
1561- return;
1562- }
1563-
1564- QueueDraw();
1565-}
1566-
1567-bool FilterRatingsButton::AcceptKeyNavFocus()
1568-{
1569- return true;
1570+std::string FilterRatingsButton::GetName() const
1571+{
1572+ return "FilterRatingsButton";
1573+}
1574+
1575+void FilterRatingsButton::SetRating(float rating)
1576+{
1577+ if (filter_)
1578+ filter_->rating = rating;
1579+
1580+ QueueDraw();
1581+}
1582+
1583+float FilterRatingsButton::GetRating() const
1584+{
1585+ return (filter_ && filter_->filtering) ? filter_->rating : 0;
1586 }
1587
1588 } // namespace dash
1589
1590=== modified file 'dash/FilterRatingsButton.h'
1591--- dash/FilterRatingsButton.h 2012-12-13 09:19:34 +0000
1592+++ dash/FilterRatingsButton.h 2014-08-06 16:03:19 +0000
1593@@ -25,46 +25,33 @@
1594 #include <memory>
1595
1596 #include <Nux/Nux.h>
1597-#include <Nux/ToggleButton.h>
1598-#include <Nux/CairoWrapper.h>
1599 #include <UnityCore/RatingsFilter.h>
1600+#include "unity-shared/RatingsButton.h"
1601
1602 namespace unity
1603 {
1604 namespace dash
1605 {
1606
1607-class FilterRatingsButton : public nux::ToggleButton
1608+class FilterRatingsButton : public RatingsButton
1609 {
1610- NUX_DECLARE_OBJECT_TYPE(FilterRatingsButton, nux::ToggleButton);
1611+ NUX_DECLARE_OBJECT_TYPE(FilterRatingsButton, RatingsButton);
1612 public:
1613 FilterRatingsButton(NUX_FILE_LINE_PROTO);
1614- virtual ~FilterRatingsButton();
1615
1616 void SetFilter(Filter::Ptr const& filter);
1617- RatingsFilter::Ptr GetFilter();
1618+ RatingsFilter::Ptr GetFilter() const;
1619 std::string GetFilterType();
1620
1621 protected:
1622- virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
1623+ // Introspectable methods
1624+ std::string GetName() const;
1625
1626- // Key-nav
1627- virtual bool AcceptKeyNavFocus();
1628- virtual bool InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character);
1629+ void SetRating(float rating) override;
1630+ float GetRating() const override;
1631
1632 private:
1633- void OnKeyDown(unsigned long event_type, unsigned long event_keysym,
1634- unsigned long event_state, const TCHAR* character,
1635- unsigned short key_repeat_count);
1636-
1637- void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);
1638- void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
1639- void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
1640- void OnRatingsChanged(int rating);
1641-
1642 dash::RatingsFilter::Ptr filter_;
1643- int focused_star_;
1644-
1645 };
1646
1647 } // namespace dash
1648
1649=== modified file 'dash/FilterRatingsWidget.cpp'
1650--- dash/FilterRatingsWidget.cpp 2013-03-19 18:22:11 +0000
1651+++ dash/FilterRatingsWidget.cpp 2014-08-06 16:03:19 +0000
1652@@ -33,15 +33,14 @@
1653 #include "FilterRatingsButton.h"
1654 #include "FilterRatingsWidget.h"
1655
1656-namespace
1657-{
1658-const int star_size = 28;
1659-}
1660-
1661 namespace unity
1662 {
1663 namespace dash
1664 {
1665+namespace
1666+{
1667+const RawPixel STAR_SIZE = 28_em;
1668+}
1669
1670 NUX_IMPLEMENT_OBJECT_TYPE(FilterRatingsWidget);
1671
1672@@ -49,22 +48,30 @@
1673 : FilterExpanderLabel(_("Rating"), NUX_FILE_LINE_PARAM)
1674 , all_button_(nullptr)
1675 {
1676- dash::Style& style = dash::Style::Instance();
1677- const int top_padding = style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding() - 1; // -1 (PNGs have an 1px top padding)
1678- const int bottom_padding = style.GetFilterHighlightPadding();
1679-
1680 nux::VLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION);
1681- layout->SetTopAndBottomPadding(top_padding, bottom_padding);
1682 ratings_ = new FilterRatingsButton(NUX_TRACKER_LOCATION);
1683- ratings_->SetMinimumHeight(star_size);
1684
1685 layout->AddView(ratings_);
1686
1687+ UpdateSize();
1688 SetContents(layout);
1689+
1690+ scale.changed.connect([this] (double scale) {
1691+ if (all_button_) all_button_->scale = scale;
1692+ UpdateSize();
1693+ });
1694 }
1695
1696-FilterRatingsWidget::~FilterRatingsWidget()
1697+void FilterRatingsWidget::UpdateSize()
1698 {
1699+ dash::Style& style = dash::Style::Instance();
1700+ int top_padding = style.GetSpaceBetweenFilterWidgets().CP(scale) - style.GetFilterHighlightPadding().CP(scale) - (1_em).CP(scale); // -1 (PNGs have an 1px top padding)
1701+ int bottom_padding = style.GetFilterHighlightPadding().CP(scale);
1702+ static_cast<nux::VLayout*>(GetLayout())->SetTopAndBottomPadding(top_padding, bottom_padding);
1703+
1704+ ratings_->scale = scale();
1705+ ratings_->SetMinimumHeight(STAR_SIZE.CP(scale));
1706+ ratings_->ApplyMinHeight();
1707 }
1708
1709 void FilterRatingsWidget::SetFilter(Filter::Ptr const& filter)
1710@@ -77,7 +84,10 @@
1711 all_button_ = show_all_button ? new FilterAllButton(NUX_TRACKER_LOCATION) : nullptr;
1712 SetRightHandView(all_button_);
1713 if (all_button_)
1714+ {
1715+ all_button_->scale = scale();
1716 all_button_->SetFilter(filter_);
1717+ }
1718 };
1719 show_button_func(filter_->show_all_button);
1720 filter_->show_all_button.changed.connect(show_button_func);
1721
1722=== modified file 'dash/FilterRatingsWidget.h'
1723--- dash/FilterRatingsWidget.h 2012-11-27 23:16:06 +0000
1724+++ dash/FilterRatingsWidget.h 2014-08-06 16:03:19 +0000
1725@@ -45,7 +45,6 @@
1726 NUX_DECLARE_OBJECT_TYPE(FilterRatingsWidget, FilterExpanderLabel);
1727 public:
1728 FilterRatingsWidget(NUX_FILE_LINE_PROTO);
1729- virtual ~FilterRatingsWidget();
1730
1731 void SetFilter(Filter::Ptr const& filter);
1732 std::string GetFilterType();
1733@@ -54,6 +53,8 @@
1734 void ClearRedirectedRenderChildArea();
1735
1736 private:
1737+ void UpdateSize();
1738+
1739 FilterAllButton* all_button_;
1740 FilterRatingsButton* ratings_;
1741 RatingsFilter::Ptr filter_;
1742
1743=== modified file 'dash/PlacesGroup.cpp'
1744--- dash/PlacesGroup.cpp 2014-03-20 04:05:39 +0000
1745+++ dash/PlacesGroup.cpp 2014-08-06 16:03:19 +0000
1746@@ -33,7 +33,6 @@
1747 #include "unity-shared/UBusWrapper.h"
1748 #include "unity-shared/UBusMessages.h"
1749 #include "unity-shared/GraphicsUtils.h"
1750-#include "unity-shared/RawPixel.h"
1751
1752 #include "ResultView.h"
1753 #include "ResultViewGrid.h"
1754@@ -133,10 +132,8 @@
1755 SetAcceptKeyNavFocusOnMouseEnter(false);
1756 scale.changed.connect(sigc::mem_fun(this, &PlacesGroup::UpdateScale));
1757
1758- nux::BaseTexture* arrow = _style.GetGroupExpandIcon();
1759-
1760- _background = _style.GetCategoryBackground();
1761- _background_nofilters = _style.GetCategoryBackgroundNoFilters();
1762+ _background = _style.GetCategoryBackground().GetPointer();
1763+ _background_nofilters = _style.GetCategoryBackgroundNoFilters().GetPointer();
1764
1765 nux::ROPConfig rop;
1766 rop.Blend = true;
1767@@ -144,8 +141,8 @@
1768 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
1769
1770 nux::TexCoordXForm texxform;
1771- _background_layer.reset(new nux::TextureLayer(_background_nofilters->GetDeviceTexture(),
1772- texxform,
1773+ _background_layer.reset(new nux::TextureLayer(_background_nofilters->GetDeviceTexture(),
1774+ texxform,
1775 nux::color::White,
1776 false,
1777 rop));
1778@@ -160,11 +157,10 @@
1779 _group_layout->AddView(_header_view, 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL);
1780
1781 _header_layout = new nux::HLayout(NUX_TRACKER_LOCATION);
1782- _header_layout->SetLeftAndRightPadding(_style.GetCategoryHeaderLeftPadding(), 0);
1783+ _header_layout->SetLeftAndRightPadding(_style.GetCategoryHeaderLeftPadding().CP(scale), 0);
1784 _header_view->SetLayout(_header_layout);
1785
1786- RawPixel const icon_size = _style.GetCategoryIconSize();
1787- _icon = new IconTexture("", icon_size.CP(scale()));
1788+ _icon = new IconTexture("", _style.GetCategoryIconSize().CP(scale));
1789 _header_layout->AddView(_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
1790
1791 _text_layout = new nux::HLayout(NUX_TRACKER_LOCATION);
1792@@ -172,6 +168,7 @@
1793
1794 _name = new StaticCairoText("", NUX_TRACKER_LOCATION);
1795 _name->SetFont(NAME_LABEL_FONT);
1796+ _name->SetLines(-1);
1797 _name->SetTextEllipsize(StaticCairoText::NUX_ELLIPSIZE_END);
1798 _name->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
1799 _text_layout->AddView(_name, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
1800@@ -184,16 +181,17 @@
1801
1802 _expand_label = new StaticCairoText("", NUX_TRACKER_LOCATION);
1803 _expand_label->SetFont(EXPANDER_LABEL_FONT);
1804+ _expand_label->SetLines(-1);
1805 _expand_label->SetTextEllipsize(StaticCairoText::NUX_ELLIPSIZE_END);
1806 _expand_label->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
1807 _expand_label->SetTextColor(kExpandDefaultTextColor);
1808 _expand_label_layout->AddView(_expand_label, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
1809
1810- _expand_icon = new IconTexture(arrow, arrow->GetWidth(), arrow->GetHeight());
1811+ _expand_icon = new IconTexture(_style.GetGroupExpandIcon());
1812+ _expand_icon->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
1813 _expand_icon->SetOpacity(kExpandDefaultIconOpacity);
1814- _expand_icon->SetMinimumSize(arrow->GetWidth(), arrow->GetHeight());
1815 _expand_icon->SetVisible(false);
1816- _expand_layout->AddView(_expand_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
1817+ _expand_layout->AddView(_expand_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
1818
1819 SetLayout(_group_layout);
1820
1821@@ -223,16 +221,16 @@
1822 void
1823 PlacesGroup::UpdatePlacesGroupSize()
1824 {
1825- RawPixel const icon_size = _style.GetCategoryIconSize();
1826- RawPixel const group_top = _style.GetPlacesGroupTopSpace();
1827+ int icon_size = _style.GetCategoryIconSize().CP(scale);
1828+ int top_space = _style.GetPlacesGroupTopSpace().CP(scale);
1829
1830- int top_space = group_top.CP(scale());
1831 _space_layout->SetMinimumSize(top_space, top_space);
1832 _space_layout->SetMaximumSize(top_space, top_space);
1833
1834 _header_layout->SetSpaceBetweenChildren(SPACE_BETWEEN_CHILDREN.CP(scale()));
1835+ _header_layout->SetLeftAndRightPadding(_style.GetCategoryHeaderLeftPadding().CP(scale), 0);
1836
1837- _icon->SetMinMaxSize(icon_size.CP(scale()), icon_size.CP(scale()));
1838+ _icon->SetMinMaxSize(icon_size, icon_size);
1839
1840 _text_layout->SetHorizontalInternalMargin(TEXT_INTERNAL_MARGIN.CP(scale()));
1841 _expand_layout->SetHorizontalInternalMargin(EXPAND_INTERNAL_MARGIN.CP(scale()));
1842@@ -241,15 +239,16 @@
1843 void
1844 PlacesGroup::UpdateScale(double scale)
1845 {
1846- RawPixel const icon_size = _style.GetCategoryIconSize();
1847-
1848+ _name->SetMinimumSize(nux::AREA_MIN_WIDTH, nux::AREA_MIN_HEIGHT);
1849+ _name->SetMaximumSize(nux::AREA_MAX_WIDTH, nux::AREA_MAX_HEIGHT);
1850 _name->SetScale(scale);
1851 _expand_label->SetScale(scale);
1852
1853- _icon->SetSize(icon_size.CP(scale));
1854+ _icon->SetSize(_style.GetCategoryIconSize().CP(scale));
1855 _icon->ReLoadIcon();
1856
1857- // FIXME _expand_icon, needs some work here. Not as easy as _icon
1858+ auto const& arrow = _expand_icon->texture();
1859+ _expand_icon->SetMinMaxSize(RawPixel(arrow->GetWidth()).CP(scale), RawPixel(arrow->GetHeight()).CP(scale));
1860
1861 if (_child_view)
1862 _child_view->scale = scale;
1863@@ -279,7 +278,6 @@
1864
1865 void
1866
1867-// FIXME _expand_icon, needs some work here. Not as easy as _icon
1868 PlacesGroup::SetName(std::string const& name)
1869 {
1870 if (_cached_name != name)
1871@@ -310,7 +308,7 @@
1872 void
1873 PlacesGroup::SetIcon(std::string const& path_to_emblem)
1874 {
1875- _icon->SetByIconName(path_to_emblem, _style.GetCategoryIconSize());
1876+ _icon->SetByIconName(path_to_emblem, _style.GetCategoryIconSize().CP(scale));
1877 }
1878
1879 void
1880@@ -318,11 +316,8 @@
1881 {
1882 if (_child_layout)
1883 {
1884- RawPixel const result_top_padding = _style.GetPlacesGroupResultTopPadding();
1885- RawPixel const result_left_padding = _style.GetPlacesGroupResultLeftPadding();
1886-
1887- _child_layout->SetTopAndBottomPadding(result_top_padding.CP(scale()), 0);
1888- _child_layout->SetLeftAndRightPadding(result_left_padding.CP(scale()), 0);
1889+ _child_layout->SetTopAndBottomPadding(_style.GetPlacesGroupResultTopPadding().CP(scale), 0);
1890+ _child_layout->SetLeftAndRightPadding(_style.GetPlacesGroupResultLeftPadding().CP(scale), 0);
1891 }
1892 }
1893
1894@@ -462,7 +457,7 @@
1895 // only the width matters
1896 if (_cached_geometry.GetWidth() != geo.GetWidth())
1897 {
1898- _focus_layer.reset(_style.FocusOverlay(geo.width -
1899+ _focus_layer.reset(_style.FocusOverlay(geo.width -
1900 kHighlightLeftPadding.CP(scale()) -
1901 kHighlightRightPadding.CP(scale()),
1902 kHighlightHeight.CP(scale())));
1903@@ -595,6 +590,9 @@
1904 else
1905 _expand_icon->SetTexture(_style.GetGroupExpandIcon());
1906
1907+ auto const& tex = _expand_icon->texture();
1908+ _expand_icon->SetMinMaxSize(RawPixel(tex->GetWidth()).CP(scale), RawPixel(tex->GetHeight()).CP(scale));
1909+
1910 expanded.emit(this);
1911 }
1912
1913
1914=== modified file 'dash/ResultRendererHorizontalTile.cpp'
1915--- dash/ResultRendererHorizontalTile.cpp 2014-03-20 05:05:21 +0000
1916+++ dash/ResultRendererHorizontalTile.cpp 2014-08-06 16:03:19 +0000
1917@@ -247,8 +247,8 @@
1918 0.0f,
1919 0.0f,
1920 CARD_VIEW_HIGHLIGHT_CORNER_RADIUS,
1921- width,
1922- height,
1923+ width/scale(),
1924+ height/scale(),
1925 false);
1926 cairo_fill(cr);
1927
1928
1929=== modified file 'dash/ResultRendererTile.cpp'
1930--- dash/ResultRendererTile.cpp 2014-05-03 17:57:47 +0000
1931+++ dash/ResultRendererTile.cpp 2014-08-06 16:03:19 +0000
1932@@ -31,7 +31,6 @@
1933 #include "unity-shared/CairoTexture.h"
1934 #include "unity-shared/DashStyle.h"
1935 #include "unity-shared/TextureCache.h"
1936-#include "unity-shared/RawPixel.h"
1937 #include "unity-shared/UnitySettings.h"
1938
1939 namespace unity
1940@@ -120,13 +119,7 @@
1941 return;
1942
1943 dash::Style const& style = dash::Style::Instance();
1944- RawPixel const tile_size = style.GetTileImageSize();
1945- RawPixel const tile_width = style.GetTileWidth();
1946- RawPixel const tile_height = style.GetTileHeight();
1947- RawPixel const tile_highlight_width = style.GetTileIconHightlightWidth();
1948- RawPixel const tile_highlight_height = style.GetTileIconHightlightHeight();
1949-
1950- int tile_icon_size = tile_size.CP(scale());
1951+ int tile_icon_size = style.GetTileImageSize().CP(scale);
1952
1953 // set up our texture mode
1954 nux::TexCoordXForm texxform;
1955@@ -148,8 +141,8 @@
1956 // render highlight if its needed
1957 if (container->prelight && state != ResultRendererState::RESULT_RENDERER_NORMAL)
1958 {
1959- int highlight_x = (geometry.x + geometry.width/2) - tile_highlight_width.CP(scale())/2;
1960- int highlight_y = (geometry.y + PADDING.CP(scale()) + tile_icon_size / 2) - tile_highlight_height.CP(scale())/2;
1961+ int highlight_x = (geometry.x + geometry.width/2) - style.GetTileIconHightlightWidth().CP(scale)/2;
1962+ int highlight_y = (geometry.y + PADDING.CP(scale) + tile_icon_size / 2) - style.GetTileIconHightlightHeight().CP(scale)/2;
1963
1964 RenderTexture(GfxContext,
1965 highlight_x,
1966@@ -179,10 +172,10 @@
1967 if (container->text)
1968 {
1969 RenderTexture(GfxContext,
1970- geometry.x + PADDING.CP(scale()),
1971- geometry.y + tile_icon_size + SPACING.CP(scale()),
1972- tile_width.CP(scale()) - (PADDING.CP(scale()) * 2),
1973- tile_height.CP(scale()) - tile_icon_size - SPACING.CP(scale()),
1974+ geometry.x + PADDING.CP(scale),
1975+ geometry.y + tile_icon_size + SPACING.CP(scale),
1976+ style.GetTileWidth().CP(scale) - (PADDING.CP(scale) * 2),
1977+ style.GetTileHeight().CP(scale) - tile_icon_size - SPACING.CP(scale),
1978 container->text->GetDeviceTexture(),
1979 texxform,
1980 color,
1981@@ -273,10 +266,8 @@
1982 void ResultRendererTile::LoadIcon(Result const& row)
1983 {
1984 Style const& style = Style::Instance();
1985- RawPixel const tile_size = style.GetTileImageSize();
1986- RawPixel const tile_gsize = style.GetTileGIconSize();
1987- RawPixel const tile_highlight_width = style.GetTileIconHightlightWidth();
1988- RawPixel const tile_highlight_height = style.GetTileIconHightlightHeight();
1989+ int tile_size = style.GetTileImageSize().CP(scale);
1990+ int tile_gsize = style.GetTileGIconSize().CP(scale);
1991
1992 std::string const& icon_hint = row.icon_hint;
1993 std::string const& icon_name = !icon_hint.empty() ? icon_hint : DEFAULT_GICON;
1994@@ -288,8 +279,8 @@
1995 {
1996 TextureCache& cache = TextureCache::GetDefault();
1997 BaseTexturePtr texture_prelight(cache.FindTexture("resultview_prelight",
1998- tile_highlight_width.CP(scale()),
1999- tile_highlight_height.CP(scale()),
2000+ style.GetTileIconHightlightWidth().CP(scale),
2001+ style.GetTileIconHightlightHeight().CP(scale),
2002 sigc::mem_fun(this, &ResultRendererTile::DrawHighlight)));
2003 container->prelight = texture_prelight;
2004 }
2005@@ -300,13 +291,13 @@
2006 {
2007 bool use_large_icon = icon.IsType(G_TYPE_FILE_ICON) || !icon.IsType(G_TYPE_THEMED_ICON);
2008 container->slot_handle = IconLoader::GetDefault().LoadFromGIconString(icon_name,
2009- tile_size.CP(scale()),
2010+ tile_size,
2011 use_large_icon ?
2012- tile_size.CP(scale()) : tile_gsize.CP(scale()), slot);
2013+ tile_size : tile_gsize, slot);
2014 }
2015 else
2016 {
2017- container->slot_handle = IconLoader::GetDefault().LoadFromIconName(icon_name, -1, tile_gsize.CP(scale()), slot);
2018+ container->slot_handle = IconLoader::GetDefault().LoadFromIconName(icon_name, -1, tile_gsize, slot);
2019 }
2020 }
2021
2022@@ -333,15 +324,12 @@
2023 }
2024 else
2025 {
2026- Style const& style = Style::Instance();
2027- RawPixel const tile_size = style.GetTileImageSize();
2028-
2029 // slow path for non square icons that must be resized to fit in the square
2030 // texture
2031 float aspect = static_cast<float>(pixbuf_height) / pixbuf_width; // already sanitized width/height so can not be 0.0
2032 if (aspect < 1.0f)
2033 {
2034- pixbuf_width = tile_size.CP(scale());
2035+ pixbuf_width = Style::Instance().GetTileImageSize().CP(scale);
2036 pixbuf_height = pixbuf_width * aspect;
2037
2038 if (pixbuf_height > height)
2039@@ -470,13 +458,10 @@
2040 void ResultRendererTile::LoadText(Result const& row)
2041 {
2042 Style const& style = Style::Instance();
2043- RawPixel const tile_size = style.GetTileImageSize();
2044- RawPixel const tile_width = style.GetTileWidth();
2045- RawPixel const tile_height = style.GetTileHeight();
2046
2047 nux::CairoGraphics _cairoGraphics(CAIRO_FORMAT_ARGB32,
2048- tile_width.CP(scale()) - (PADDING.CP(scale()) * 2),
2049- tile_height.CP(scale()) - tile_size.CP(scale()) - SPACING.CP(scale()));
2050+ style.GetTileWidth().CP(scale()) - (PADDING.CP(scale()) * 2),
2051+ style.GetTileHeight().CP(scale()) - style.GetTileImageSize().CP(scale()) - SPACING.CP(scale()));
2052 cairo_surface_set_device_scale(_cairoGraphics.GetSurface(), scale(), scale());
2053
2054 cairo_t* cr = _cairoGraphics.GetInternalContext();
2055@@ -499,7 +484,7 @@
2056
2057 pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
2058 pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_START);
2059- pango_layout_set_width(layout, (tile_width - (PADDING * 2))* PANGO_SCALE);
2060+ pango_layout_set_width(layout, (style.GetTileWidth() - (PADDING * 2))* PANGO_SCALE);
2061 pango_layout_set_height(layout, -2);
2062
2063 // FIXME bug #1239381
2064
2065=== modified file 'dash/ScopeBar.cpp'
2066--- dash/ScopeBar.cpp 2014-03-20 04:05:39 +0000
2067+++ dash/ScopeBar.cpp 2014-08-06 16:03:19 +0000
2068@@ -27,7 +27,6 @@
2069 #include "unity-shared/StaticCairoText.h"
2070 #include "unity-shared/CairoTexture.h"
2071 #include "unity-shared/GraphicsUtils.h"
2072-#include "unity-shared/RawPixel.h"
2073 #include "unity-shared/UBusMessages.h"
2074
2075 namespace unity
2076@@ -71,6 +70,9 @@
2077
2078 for (auto icon : icons_)
2079 icon->scale = scale;
2080+
2081+ QueueDraw();
2082+ QueueRelayout();
2083 }
2084
2085 void ScopeBar::SetupLayout()
2086
2087=== modified file 'dash/ScopeBarIcon.cpp'
2088--- dash/ScopeBarIcon.cpp 2014-03-20 21:43:02 +0000
2089+++ dash/ScopeBarIcon.cpp 2014-08-06 16:03:19 +0000
2090@@ -17,7 +17,6 @@
2091 */
2092
2093 #include "unity-shared/DashStyle.h"
2094-#include "unity-shared/RawPixel.h"
2095 #include "ScopeBarIcon.h"
2096
2097 #include "config.h"
2098
2099=== modified file 'dash/ScopeView.cpp'
2100--- dash/ScopeView.cpp 2014-03-20 04:05:39 +0000
2101+++ dash/ScopeView.cpp 2014-08-06 16:03:19 +0000
2102@@ -29,9 +29,8 @@
2103 #include "ResultRendererHorizontalTile.h"
2104 #include "unity-shared/UBusMessages.h"
2105 #include "unity-shared/UBusWrapper.h"
2106-#include "unity-shared/PlacesOverlayVScrollBar.h"
2107+#include "unity-shared/OverlayScrollView.h"
2108 #include "unity-shared/GraphicsUtils.h"
2109-#include "unity-shared/RawPixel.h"
2110
2111 #include "config.h"
2112 #include <glib/gi18n-lib.h>
2113@@ -52,16 +51,14 @@
2114 }
2115
2116 // This is so we can access some protected members in scrollview.
2117-class ScopeScrollView: public nux::ScrollView
2118+class ScopeScrollView: public dash::ScrollView
2119 {
2120 public:
2121- ScopeScrollView(nux::VScrollBar* scroll_bar, NUX_FILE_LINE_DECL)
2122- : nux::ScrollView(NUX_FILE_LINE_PARAM)
2123+ ScopeScrollView(NUX_FILE_LINE_DECL)
2124+ : ScrollView(NUX_FILE_LINE_PARAM)
2125 , right_area_(nullptr)
2126 , up_area_(nullptr)
2127 {
2128- SetVScrollBar(scroll_bar);
2129-
2130 OnVisibleChanged.connect([this] (nux::Area* /*area*/, bool visible) {
2131 if (m_horizontal_scrollbar_enable)
2132 _hscrollbar->SetVisible(visible);
2133@@ -237,8 +234,8 @@
2134 {
2135 layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
2136
2137- scroll_view_ = new ScopeScrollView(new PlacesOverlayVScrollBar(NUX_TRACKER_LOCATION),
2138- NUX_TRACKER_LOCATION);
2139+ scroll_view_ = new ScopeScrollView(NUX_TRACKER_LOCATION);
2140+ scroll_view_->scale = scale();
2141 scroll_view_->EnableVerticalScrollBar(true);
2142 scroll_view_->EnableHorizontalScrollBar(false);
2143 layout_->AddView(scroll_view_);
2144@@ -250,9 +247,11 @@
2145 no_results_ = new StaticCairoText("", NUX_TRACKER_LOCATION);
2146 no_results_->SetTextColor(nux::color::White);
2147 no_results_->SetVisible(false);
2148+ no_results_->SetScale(scale);
2149 scroll_layout_->AddView(no_results_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
2150
2151- fscroll_view_ = new ScopeScrollView(new PlacesOverlayVScrollBar(NUX_TRACKER_LOCATION), NUX_TRACKER_LOCATION);
2152+ fscroll_view_ = new ScopeScrollView(NUX_TRACKER_LOCATION);
2153+ fscroll_view_->scale = scale();
2154 fscroll_view_->EnableVerticalScrollBar(true);
2155 fscroll_view_->EnableHorizontalScrollBar(false);
2156 fscroll_view_->SetVisible(false);
2157@@ -276,19 +275,17 @@
2158 {
2159 dash::Style const& style = dash::Style::Instance();
2160
2161- RawPixel const scope_filter_space = style.GetSpaceBetweenScopeAndFilters();
2162- RawPixel const right_padding = style.GetFilterViewRightPadding();
2163- RawPixel const filter_width = style.GetFilterBarWidth() +
2164- style.GetFilterBarLeftPadding() +
2165- style.GetFilterBarRightPadding();
2166-
2167- double scale = this->scale();
2168- layout_->SetSpaceBetweenChildren(scope_filter_space.CP(scale));
2169-
2170- fscroll_view_->SetMinimumWidth(filter_width.CP(scale) + right_padding.CP(scale));
2171- fscroll_view_->SetMaximumWidth(filter_width.CP(scale) + right_padding.CP(scale));
2172- filter_bar_->SetMinimumWidth(filter_width.CP(scale));
2173- filter_bar_->SetMaximumWidth(filter_width.CP(scale));
2174+ int right_padding = style.GetFilterViewRightPadding().CP(scale);
2175+ int filter_width = style.GetFilterBarWidth().CP(scale) +
2176+ style.GetFilterBarLeftPadding().CP(scale) +
2177+ style.GetFilterBarRightPadding().CP(scale);
2178+
2179+ layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenScopeAndFilters().CP(scale));
2180+
2181+ fscroll_view_->SetMinimumWidth(filter_width + right_padding);
2182+ fscroll_view_->SetMaximumWidth(filter_width + right_padding);
2183+ filter_bar_->SetMinimumWidth(filter_width);
2184+ filter_bar_->SetMaximumWidth(filter_width);
2185 }
2186
2187 void ScopeView::UpdateScale(double scale)
2188@@ -298,7 +295,10 @@
2189 for (auto& group : category_views_)
2190 group->scale = scale;
2191
2192+ scroll_view_->scale = scale;
2193+ fscroll_view_->scale = scale;
2194 filter_bar_->scale = scale;
2195+ no_results_->SetScale(scale);
2196 }
2197
2198 void ScopeView::SetupCategories(Categories::Ptr const& categories)
2199
2200=== modified file 'dash/ScopeView.h'
2201--- dash/ScopeView.h 2014-03-20 04:05:39 +0000
2202+++ dash/ScopeView.h 2014-08-06 16:03:19 +0000
2203@@ -36,7 +36,6 @@
2204 #include "PlacesGroup.h"
2205 #include "ResultViewGrid.h"
2206 #include "unity-shared/UBusWrapper.h"
2207-#include "unity-shared/PlacesVScrollBar.h"
2208
2209 namespace unity
2210 {
2211
2212=== modified file 'dash/StandaloneDash.cpp'
2213--- dash/StandaloneDash.cpp 2014-02-28 23:32:05 +0000
2214+++ dash/StandaloneDash.cpp 2014-08-06 16:03:19 +0000
2215@@ -36,47 +36,50 @@
2216 #include "unity-shared/DashStyle.h"
2217 #include "unity-shared/PanelStyle.h"
2218 #include "unity-shared/ThumbnailGenerator.h"
2219-#include "UnityCore/GSettingsScopes.h"
2220+#include "unity-shared/UBusMessages.h"
2221+#include "unity-shared/UBusServer.h"
2222+#include <UnityCore/GSettingsScopes.h>
2223+#include <UnityCore/ScopeProxyInterface.h>
2224
2225-#define WIDTH 1024
2226-#define HEIGHT 768
2227+const unity::RawPixel WIDTH(1024);
2228+const unity::RawPixel HEIGHT(768);
2229
2230 using namespace unity::dash;
2231
2232 class TestRunner
2233 {
2234 public:
2235- TestRunner ();
2236- ~TestRunner ();
2237+ TestRunner(std::string const& scope, double scale)
2238+ : scope_(scope)
2239+ , scale_(scale)
2240+ {}
2241
2242 static void InitWindowThread (nux::NThread* thread, void* InitData);
2243 void Init ();
2244+ std::string scope_;
2245+ double scale_;
2246 nux::Layout *layout;
2247 };
2248
2249-TestRunner::TestRunner ()
2250-{
2251-}
2252-
2253-TestRunner::~TestRunner ()
2254-{
2255-}
2256-
2257 void TestRunner::Init ()
2258 {
2259 layout = new nux::HLayout(NUX_TRACKER_LOCATION);
2260
2261- DashView* view = new DashView(std::make_shared<unity::dash::GSettingsScopes>(),
2262+ DashView* view = new DashView(std::make_shared<unity::dash::GSettingsScopes>(),
2263 std::make_shared<unity::ApplicationStarterImp>());
2264+ view->scale = scale_;
2265 view->DisableBlur();
2266- view->SetMinMaxSize(WIDTH, HEIGHT);
2267+ view->SetMinMaxSize(WIDTH.CP(scale_), HEIGHT.CP(scale_));
2268 layout->AddView (view, 1, nux::MINOR_POSITION_CENTER);
2269- layout->SetMinMaxSize(WIDTH, HEIGHT);
2270+ layout->SetMinMaxSize(WIDTH.CP(scale_), HEIGHT.CP(scale_));
2271
2272 view->AboutToShow(0);
2273
2274 nux::GetWindowThread()->SetLayout (layout);
2275 nux::GetWindowCompositor().SetKeyFocusArea(view->default_focus());
2276+
2277+ unity::UBusServer().SendMessage(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
2278+ g_variant_new("(sus)", scope_.c_str(), GOTO_DASH_URI, ""));
2279 }
2280
2281 void TestRunner::InitWindowThread(nux::NThread* thread, void* InitData)
2282@@ -87,8 +90,6 @@
2283
2284 int main(int argc, char **argv)
2285 {
2286- nux::WindowThread* wt = NULL;
2287-
2288 gtk_init (&argc, &argv);
2289
2290 unity::BGHash bghash;
2291@@ -102,17 +103,30 @@
2292 unity::dash::Style dash_style;
2293 unity::panel::Style panel_style;
2294
2295- TestRunner *test_runner = new TestRunner ();
2296- wt = nux::CreateGUIThread(TEXT("Unity Dash"),
2297- WIDTH, HEIGHT,
2298- 0,
2299- &TestRunner::InitWindowThread,
2300- test_runner);
2301+ double scale = 1.0;
2302+ unity::glib::String scope;
2303+ unity::glib::Error err;
2304+
2305+ GOptionEntry args_parsed[] =
2306+ {
2307+ { "scope", 's', 0, G_OPTION_ARG_STRING, &scope, "The default scope ", "S" },
2308+ { "scaling-factor", 'f', 0, G_OPTION_ARG_DOUBLE, &scale, "The dash scaling factor", "F" },
2309+ { NULL }
2310+ };
2311+
2312+ std::shared_ptr<GOptionContext> ctx(g_option_context_new("Standalone Dash"), g_option_context_free);
2313+ g_option_context_add_main_entries(ctx.get(), args_parsed, NULL);
2314+ if (!g_option_context_parse(ctx.get(), &argc, &argv, &err))
2315+ std::cerr << "Got error when parsing arguments: " << err << std::endl;
2316+
2317+ TestRunner *test_runner = new TestRunner(scope.Str(), scale);
2318+ std::unique_ptr<nux::WindowThread> wt(nux::CreateGUIThread(TEXT("Unity Dash"),
2319+ WIDTH.CP(scale), HEIGHT.CP(scale),
2320+ 0, &TestRunner::InitWindowThread, test_runner));
2321
2322 nux::NuxTimerTickSource tick_source;
2323 nux::animation::AnimationController animation_controller(tick_source);
2324+ wt->Run(nullptr);
2325
2326- wt->Run (NULL);
2327- delete wt;
2328- return 0;
2329+ return EXIT_SUCCESS;
2330 }
2331
2332=== modified file 'dash/previews/ActionButton.cpp'
2333--- dash/previews/ActionButton.cpp 2013-11-19 18:48:35 +0000
2334+++ dash/previews/ActionButton.cpp 2014-08-06 16:03:19 +0000
2335@@ -26,22 +26,23 @@
2336 #include "unity-shared/IconTexture.h"
2337 #include "unity-shared/StaticCairoText.h"
2338
2339+namespace unity
2340+{
2341 namespace
2342 {
2343-const int kMinButtonHeight = 34;
2344-const int kMinButtonWidth = 48;
2345+const RawPixel MIN_BUTTON_HEIGHT = 34_em;
2346+const RawPixel MIN_BUTTON_WIDTH = 48_em;
2347
2348-const int icon_size = 24;
2349+const RawPixel icon_size = 24_em;
2350 }
2351
2352-namespace unity
2353-{
2354 namespace dash
2355 {
2356 DECLARE_LOGGER(logger, "unity.dash.preview.action");
2357
2358 ActionButton::ActionButton(std::string const& action_hint, std::string const& label, std::string const& icon_hint, NUX_FILE_LINE_DECL)
2359 : nux::AbstractButton(NUX_FILE_LINE_PARAM)
2360+ , scale(1.0)
2361 , action_hint_(action_hint)
2362 , image_(nullptr)
2363 {
2364@@ -49,6 +50,7 @@
2365 SetAcceptKeyNavFocusOnMouseEnter(true);
2366 Init();
2367 BuildLayout(label, icon_hint, "");
2368+ scale.changed.connect(sigc::mem_fun(this, &ActionButton::UpdateScale));
2369 }
2370
2371 ActionButton::~ActionButton()
2372@@ -84,22 +86,19 @@
2373
2374 void ActionButton::InitTheme()
2375 {
2376- if (!cr_active_)
2377- {
2378- nux::Geometry const& geo = GetGeometry();
2379-
2380- cr_prelight_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
2381- cr_active_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)));
2382- cr_normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));
2383- cr_focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &ActionButton::RedrawFocusOverlay)));
2384- }
2385-
2386- SetMinimumHeight(kMinButtonHeight);
2387- SetMinimumWidth(kMinButtonWidth);
2388+ nux::Geometry const& geo = GetGeometry();
2389+
2390+ cr_prelight_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
2391+ cr_active_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)));
2392+ cr_normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));
2393+ cr_focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &ActionButton::RedrawFocusOverlay)));
2394+
2395+ SetMinimumHeight(MIN_BUTTON_HEIGHT.CP(scale));
2396+ SetMinimumWidth(MIN_BUTTON_WIDTH.CP(scale));
2397 }
2398
2399 void ActionButton::SetExtraHint(std::string const& extra_hint, std::string const& font_hint)
2400-{
2401+{
2402 extra_font_hint_= font_hint;
2403 if (extra_text_)
2404 {
2405@@ -123,13 +122,13 @@
2406
2407 if (!icon_hint_.empty())
2408 {
2409- image_ = new IconTexture(icon_hint, icon_size);
2410+ image_ = new IconTexture(icon_hint, icon_size.CP(scale));
2411 image_->texture_updated.connect([this](nux::ObjectPtr<nux::BaseTexture> const&)
2412 {
2413 BuildLayout(label_, icon_hint_, extra_hint_);
2414 });
2415 image_->SetInputEventSensitivity(false);
2416- image_->SetMinMaxSize(icon_size, icon_size);
2417+ image_->SetMinMaxSize(icon_size.CP(scale), icon_size.CP(scale));
2418 }
2419 }
2420
2421@@ -192,11 +191,13 @@
2422
2423 void ActionButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state)
2424 {
2425+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
2426 Style::Instance().Button(cr, faked_state, "", -1, Alignment::CENTER, true);
2427 }
2428
2429 void ActionButton::RedrawFocusOverlay(nux::Geometry const& geom, cairo_t* cr)
2430 {
2431+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
2432 Style::Instance().ButtonFocusOverlay(cr, 0.20f);
2433 }
2434
2435@@ -311,5 +312,27 @@
2436 return extra_hint_;
2437 }
2438
2439+void ActionButton::UpdateScale(double scale)
2440+{
2441+ InitTheme();
2442+
2443+ if (image_)
2444+ {
2445+ image_->SetSize(icon_size.CP(scale));
2446+ image_->SetMinMaxSize(icon_size.CP(scale), icon_size.CP(scale));
2447+ image_->ReLoadIcon();
2448+ }
2449+
2450+ if (static_text_)
2451+ static_text_->SetScale(scale);
2452+
2453+ if (extra_text_)
2454+ extra_text_->SetScale(scale);
2455+
2456+ QueueRelayout();
2457+ QueueDraw();
2458+}
2459+
2460+
2461 } // namespace dash
2462 } // namespace unity
2463
2464=== modified file 'dash/previews/ActionButton.h'
2465--- dash/previews/ActionButton.h 2013-09-19 16:44:03 +0000
2466+++ dash/previews/ActionButton.h 2014-08-06 16:03:19 +0000
2467@@ -59,6 +59,8 @@
2468 std::string GetLabel() const;
2469 std::string GetExtraText() const;
2470
2471+ nux::Property<double> scale;
2472+
2473 protected:
2474 virtual long ComputeContentSize();
2475 virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
2476@@ -95,6 +97,8 @@
2477 nux::ObjectPtr<IconTexture> image_;
2478 nux::ObjectPtr<unity::StaticCairoText> static_text_;
2479 nux::ObjectPtr<unity::StaticCairoText> extra_text_;
2480+
2481+ void UpdateScale(double scale);
2482 };
2483
2484 } // namespace dash
2485
2486=== modified file 'dash/previews/ActionLink.cpp'
2487--- dash/previews/ActionLink.cpp 2013-11-19 18:48:35 +0000
2488+++ dash/previews/ActionLink.cpp 2014-08-06 16:03:19 +0000
2489@@ -40,12 +40,15 @@
2490
2491 ActionLink::ActionLink(std::string const& action_hint, std::string const& label, NUX_FILE_LINE_DECL)
2492 : nux::AbstractButton(NUX_FILE_LINE_PARAM)
2493+ , scale(1.0)
2494 , action_hint_(action_hint)
2495 , aligment_(StaticCairoText::NUX_ALIGN_CENTRE)
2496 , underline_(StaticCairoText::NUX_UNDERLINE_SINGLE)
2497 {
2498 Init();
2499 BuildLayout(label);
2500+ UpdateScale(scale);
2501+ scale.changed.connect(sigc::mem_fun(this, &ActionLink::UpdateScale));
2502 }
2503
2504 std::string ActionLink::GetName() const
2505@@ -109,6 +112,7 @@
2506 static_text_ = new StaticCairoText(label_, true, NUX_TRACKER_LOCATION);
2507 if (!font_hint_.empty())
2508 static_text_->SetFont(font_hint_);
2509+ static_text_->SetScale(scale);
2510 static_text_->SetInputEventSensitivity(false);
2511 static_text_->SetTextAlignment(aligment_);
2512 static_text_->SetUnderline(underline_);
2513@@ -243,5 +247,14 @@
2514 return label_;
2515 }
2516
2517+void ActionLink::UpdateScale(double scale)
2518+{
2519+ if (static_text_)
2520+ static_text_->SetScale(scale);
2521+
2522+ QueueRelayout();
2523+ QueueDraw();
2524+}
2525+
2526 } // namespace dash
2527 } // namespace unity
2528
2529=== modified file 'dash/previews/ActionLink.h'
2530--- dash/previews/ActionLink.h 2013-09-19 16:44:03 +0000
2531+++ dash/previews/ActionLink.h 2014-08-06 16:03:19 +0000
2532@@ -47,6 +47,7 @@
2533 nux::RWProperty<StaticCairoText::AlignState> text_aligment;
2534 nux::RWProperty<StaticCairoText::UnderlineState> underline_state;
2535 nux::RWProperty<std::string> font_hint;
2536+ nux::Property<double> scale;
2537
2538 void Activate() {}
2539 void Deactivate() {}
2540@@ -90,8 +91,7 @@
2541 StaticCairoText::UnderlineState underline_;
2542 private:
2543 typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
2544-
2545-
2546+ void UpdateScale(double scale);
2547 };
2548
2549 } // namespace dash
2550
2551=== modified file 'dash/previews/ApplicationPreview.cpp'
2552--- dash/previews/ApplicationPreview.cpp 2013-11-19 18:48:35 +0000
2553+++ dash/previews/ApplicationPreview.cpp 2014-08-06 16:03:19 +0000
2554@@ -24,7 +24,6 @@
2555 #include "unity-shared/PreviewStyle.h"
2556 #include "unity-shared/CoverArt.h"
2557 #include "unity-shared/IconTexture.h"
2558-#include "unity-shared/PlacesOverlayVScrollBar.h"
2559 #include <UnityCore/ApplicationPreview.h>
2560 #include <NuxCore/Logger.h>
2561 #include <Nux/HLayout.h>
2562@@ -46,23 +45,31 @@
2563 {
2564 namespace previews
2565 {
2566+
2567+namespace
2568+{
2569+ const RawPixel ICON_SPACE_CHILDREN = 3_em;
2570+ const RawPixel DATA_SPACE_CHILDREN = 16_em;
2571+ const RawPixel INFO_SPACE_CHILDREN = 12_em;
2572+ const RawPixel COPYRIGHT_SPACE_CHILDREN = 8_em;
2573+ const RawPixel ICON_SIZE = 72_em;
2574+}
2575+
2576 DECLARE_LOGGER(logger, "unity.dash.preview.application");
2577
2578-class DetailsScrollView : public nux::ScrollView
2579-{
2580-public:
2581- DetailsScrollView(NUX_FILE_LINE_PROTO)
2582- : ScrollView(NUX_FILE_LINE_PARAM)
2583- {
2584- SetVScrollBar(new dash::PlacesOverlayVScrollBar(NUX_TRACKER_LOCATION));
2585- }
2586-
2587-};
2588-
2589 NUX_IMPLEMENT_OBJECT_TYPE(ApplicationPreview);
2590
2591 ApplicationPreview::ApplicationPreview(dash::Preview::Ptr preview_model)
2592 : Preview(preview_model)
2593+, title_subtitle_layout_(nullptr)
2594+, image_data_layout_(nullptr)
2595+, main_app_info_(nullptr)
2596+, icon_layout_(nullptr)
2597+, app_data_layout_(nullptr)
2598+, app_updated_copywrite_layout_(nullptr)
2599+, app_info_layout_(nullptr)
2600+, app_info_scroll_(nullptr)
2601+, actions_layout_(nullptr)
2602 {
2603 SetupViews();
2604 }
2605@@ -121,12 +128,13 @@
2606
2607 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); };
2608
2609- nux::HLayout* image_data_layout = new nux::HLayout();
2610- image_data_layout->SetSpaceBetweenChildren(style.GetPanelSplitWidth());
2611+ image_data_layout_ = new nux::HLayout();
2612+ image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale));
2613
2614 /////////////////////
2615 // Image
2616 image_ = new CoverArt();
2617+ image_->scale = scale();
2618 AddChild(image_.GetPointer());
2619 UpdateCoverArtImage(image_.GetPointer());
2620 /////////////////////
2621@@ -134,34 +142,36 @@
2622 /////////////////////
2623 // App Data Panel
2624 full_data_layout_ = new nux::VLayout();
2625- full_data_layout_->SetPadding(style.GetDetailsTopMargin(), 0, style.GetDetailsBottomMargin(), style.GetDetailsLeftMargin());
2626- full_data_layout_->SetSpaceBetweenChildren(16);
2627+ full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale));
2628+ full_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN.CP(scale));
2629
2630 /////////////////////
2631 // Main App Info
2632- nux::HLayout* main_app_info = new nux::HLayout();
2633- main_app_info->SetSpaceBetweenChildren(style.GetSpaceBetweenIconAndDetails());
2634+ main_app_info_ = new nux::HLayout();
2635+ main_app_info_->SetSpaceBetweenChildren(style.GetSpaceBetweenIconAndDetails().CP(scale));
2636
2637 /////////////////////
2638 // Icon Layout
2639- nux::VLayout* icon_layout = new nux::VLayout();
2640- icon_layout->SetSpaceBetweenChildren(3);
2641- app_icon_ = new IconTexture(app_preview_model->app_icon.Get().RawPtr() ? g_icon_to_string(app_preview_model->app_icon.Get().RawPtr()) : "", 72);
2642+ icon_layout_ = new nux::VLayout();
2643+ icon_layout_->SetSpaceBetweenChildren(ICON_SPACE_CHILDREN.CP(scale));
2644+ app_icon_ = new IconTexture(app_preview_model->app_icon.Get().RawPtr() ? g_icon_to_string(app_preview_model->app_icon.Get().RawPtr()) : "", ICON_SIZE.CP(scale));
2645 AddChild(app_icon_.GetPointer());
2646- app_icon_->SetMinimumSize(style.GetAppIconAreaWidth(), style.GetAppIconAreaWidth());
2647- app_icon_->SetMaximumSize(style.GetAppIconAreaWidth(), style.GetAppIconAreaWidth());
2648+ app_icon_->SetMinimumSize(style.GetAppIconAreaWidth().CP(scale), style.GetAppIconAreaWidth().CP(scale));
2649+ app_icon_->SetMaximumSize(style.GetAppIconAreaWidth().CP(scale), style.GetAppIconAreaWidth().CP(scale));
2650 app_icon_->mouse_click.connect(on_mouse_down);
2651- icon_layout->AddView(app_icon_.GetPointer(), 0);
2652+ icon_layout_->AddView(app_icon_.GetPointer(), 0);
2653
2654- if (app_preview_model->rating >= 0) {
2655+ if (app_preview_model->rating >= 0)
2656+ {
2657 app_rating_ = new PreviewRatingsWidget();
2658 AddChild(app_rating_.GetPointer());
2659- app_rating_->SetMaximumHeight(style.GetRatingWidgetHeight());
2660- app_rating_->SetMinimumHeight(style.GetRatingWidgetHeight());
2661+ app_rating_->scale = scale();
2662+ app_rating_->SetMaximumHeight(style.GetRatingWidgetHeight().CP(scale));
2663+ app_rating_->SetMinimumHeight(style.GetRatingWidgetHeight().CP(scale));
2664 app_rating_->SetRating(app_preview_model->rating);
2665 app_rating_->SetReviews(app_preview_model->num_ratings);
2666 app_rating_->request_close().connect([this]() { preview_container_->request_close.emit(); });
2667- icon_layout->AddView(app_rating_.GetPointer(), 0);
2668+ icon_layout_->AddView(app_rating_.GetPointer(), 0);
2669 }
2670
2671 /////////////////////
2672@@ -169,15 +179,16 @@
2673 /////////////////////
2674 // Data
2675
2676- nux::VLayout* app_data_layout = new nux::VLayout();
2677- app_data_layout->SetSpaceBetweenChildren(16);
2678+ app_data_layout_ = new nux::VLayout();
2679+ app_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN.CP(scale));
2680
2681 title_subtitle_layout_ = new nux::VLayout();
2682- title_subtitle_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle());
2683+ title_subtitle_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
2684
2685 title_ = new StaticCairoText(preview_model_->title, true, NUX_TRACKER_LOCATION);
2686 AddChild(title_.GetPointer());
2687 title_->SetLines(-1);
2688+ title_->SetScale(scale);
2689 title_->SetFont(style.title_font().c_str());
2690 title_->mouse_click.connect(on_mouse_down);
2691 title_subtitle_layout_->AddView(title_.GetPointer(), 1);
2692@@ -188,12 +199,13 @@
2693 AddChild(subtitle_.GetPointer());
2694 subtitle_->SetFont(style.subtitle_size_font().c_str());
2695 subtitle_->SetLines(-1);
2696+ subtitle_->SetScale(scale);
2697 subtitle_->mouse_click.connect(on_mouse_down);
2698 title_subtitle_layout_->AddView(subtitle_.GetPointer(), 1);
2699 }
2700
2701- nux::VLayout* app_updated_copywrite_layout = new nux::VLayout();
2702- app_updated_copywrite_layout->SetSpaceBetweenChildren(8);
2703+ app_updated_copywrite_layout_ = new nux::VLayout();
2704+ app_updated_copywrite_layout_->SetSpaceBetweenChildren(COPYRIGHT_SPACE_CHILDREN.CP(scale));
2705
2706 if (!app_preview_model->license.Get().empty())
2707 {
2708@@ -201,8 +213,9 @@
2709 AddChild(license_.GetPointer());
2710 license_->SetFont(style.app_license_font().c_str());
2711 license_->SetLines(-1);
2712+ license_->SetScale(scale);
2713 license_->mouse_click.connect(on_mouse_down);
2714- app_updated_copywrite_layout->AddView(license_.GetPointer(), 1);
2715+ app_updated_copywrite_layout_->AddView(license_.GetPointer(), 1);
2716 }
2717
2718 if (!app_preview_model->last_update.Get().empty())
2719@@ -213,8 +226,9 @@
2720 last_update_ = new StaticCairoText(last_update.str(), true, NUX_TRACKER_LOCATION);
2721 AddChild(last_update_.GetPointer());
2722 last_update_->SetFont(style.app_last_update_font().c_str());
2723+ last_update_->SetScale(scale);
2724 last_update_->mouse_click.connect(on_mouse_down);
2725- app_updated_copywrite_layout->AddView(last_update_.GetPointer(), 1);
2726+ app_updated_copywrite_layout_->AddView(last_update_.GetPointer(), 1);
2727 }
2728
2729 if (!app_preview_model->copyright.Get().empty())
2730@@ -223,29 +237,32 @@
2731 AddChild(copywrite_.GetPointer());
2732 copywrite_->SetFont(style.app_copywrite_font().c_str());
2733 copywrite_->SetLines(-1);
2734+ copywrite_->SetScale(scale);
2735 copywrite_->mouse_click.connect(on_mouse_down);
2736- app_updated_copywrite_layout->AddView(copywrite_.GetPointer(), 1);
2737+ app_updated_copywrite_layout_->AddView(copywrite_.GetPointer(), 1);
2738 }
2739
2740- app_data_layout->AddLayout(title_subtitle_layout_);
2741- app_data_layout->AddLayout(app_updated_copywrite_layout);
2742+ app_data_layout_->AddLayout(title_subtitle_layout_);
2743+ app_data_layout_->AddLayout(app_updated_copywrite_layout_);
2744
2745 // buffer space
2746 /////////////////////
2747
2748- main_app_info->AddLayout(icon_layout, 0);
2749- main_app_info->AddLayout(app_data_layout, 1);
2750+ main_app_info_->AddLayout(icon_layout_, 0);
2751+ main_app_info_->AddLayout(app_data_layout_, 1);
2752 /////////////////////
2753
2754 /////////////////////
2755 // Description
2756- nux::ScrollView* app_info = new DetailsScrollView(NUX_TRACKER_LOCATION);
2757+ auto* app_info = new ScrollView(NUX_TRACKER_LOCATION);
2758+ app_info_scroll_ = app_info;
2759+ app_info->scale = scale();
2760 app_info->EnableHorizontalScrollBar(false);
2761 app_info->mouse_click.connect(on_mouse_down);
2762
2763- nux::VLayout* app_info_layout = new nux::VLayout();
2764- app_info_layout->SetSpaceBetweenChildren(12);
2765- app_info->SetLayout(app_info_layout);
2766+ app_info_layout_ = new nux::VLayout();
2767+ app_info_layout_->SetSpaceBetweenChildren(INFO_SPACE_CHILDREN.CP(scale));
2768+ app_info->SetLayout(app_info_layout_);
2769
2770 if (!preview_model_->description.Get().empty())
2771 {
2772@@ -256,36 +273,36 @@
2773 description_->SetLines(-style.GetDescriptionLineCount());
2774 description_->SetLineSpacing(style.GetDescriptionLineSpacing());
2775 description_->mouse_click.connect(on_mouse_down);
2776- app_info_layout->AddView(description_.GetPointer());
2777+ app_info_layout_->AddView(description_.GetPointer());
2778 }
2779
2780 if (!preview_model_->GetInfoHints().empty())
2781 {
2782- preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
2783+ preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth().CP(scale));
2784 AddChild(preview_info_hints_.GetPointer());
2785 preview_info_hints_->request_close().connect([this]() { preview_container_->request_close.emit(); });
2786- app_info_layout->AddView(preview_info_hints_.GetPointer());
2787+ app_info_layout_->AddView(preview_info_hints_.GetPointer());
2788 }
2789 /////////////////////
2790
2791 /////////////////////
2792 // Actions
2793 action_buttons_.clear();
2794- nux::Layout* actions_layout = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
2795- actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin());
2796+ actions_layout_ = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
2797+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
2798 ///////////////////
2799
2800- full_data_layout_->AddLayout(main_app_info, 0);
2801+ full_data_layout_->AddLayout(main_app_info_, 0);
2802 full_data_layout_->AddView(app_info, 1);
2803- full_data_layout_->AddLayout(actions_layout, 0);
2804+ full_data_layout_->AddLayout(actions_layout_, 0);
2805 /////////////////////
2806-
2807- image_data_layout->AddView(image_.GetPointer(), 0);
2808- image_data_layout->AddLayout(full_data_layout_, 1);
2809+
2810+ image_data_layout_->AddView(image_.GetPointer(), 0);
2811+ image_data_layout_->AddLayout(full_data_layout_, 1);
2812
2813 mouse_click.connect(on_mouse_down);
2814
2815- SetLayout(image_data_layout);
2816+ SetLayout(image_data_layout_);
2817 }
2818
2819 void ApplicationPreview::PreLayoutManagement()
2820@@ -296,12 +313,16 @@
2821
2822 nux::Geometry geo_art(geo.x, geo.y, style.GetAppImageAspectRatio() * geo.height, geo.height);
2823
2824- if (geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() < style.GetDetailsPanelMinimumWidth())
2825- geo_art.width = MAX(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() - style.GetDetailsPanelMinimumWidth());
2826+ int content_width = geo.width - style.GetPanelSplitWidth().CP(scale)
2827+ - style.GetDetailsLeftMargin().CP(scale)
2828+ - style.GetDetailsRightMargin().CP(scale);
2829+ if (content_width - geo_art.width < style.GetDetailsPanelMinimumWidth().CP(scale))
2830+ geo_art.width = std::max(0, content_width - style.GetDetailsPanelMinimumWidth().CP(scale));
2831+
2832 image_->SetMinMaxSize(geo_art.width, geo_art.height);
2833
2834- int details_width = MAX(0, geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin());
2835- int top_app_info_max_width = MAX(0, details_width - style.GetAppIconAreaWidth() - style.GetSpaceBetweenIconAndDetails());
2836+ int details_width = std::max(0, content_width - geo_art.width);
2837+ int top_app_info_max_width = std::max(0, details_width - style.GetAppIconAreaWidth().CP(scale) - style.GetSpaceBetweenIconAndDetails().CP(scale));
2838
2839 if (title_) { title_->SetMaximumWidth(top_app_info_max_width); }
2840 if (subtitle_) { subtitle_->SetMaximumWidth(top_app_info_max_width); }
2841@@ -310,14 +331,79 @@
2842 if (copywrite_) { copywrite_->SetMaximumWidth(top_app_info_max_width); }
2843 if (description_) { description_->SetMaximumWidth(details_width); }
2844
2845+ int button_w = CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale));
2846+ int button_h = style.GetActionButtonHeight().CP(scale);
2847+
2848 for (nux::AbstractButton* button : action_buttons_)
2849- {
2850- button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions()) / 2, 0, style.GetActionButtonMaximumWidth()), style.GetActionButtonHeight());
2851- }
2852+ button->SetMinMaxSize(button_w, button_h);
2853
2854 Preview::PreLayoutManagement();
2855 }
2856
2857+void ApplicationPreview::UpdateScale(double scale)
2858+{
2859+ Preview::UpdateScale(scale);
2860+
2861+ previews::Style& style = dash::previews::Style::Instance();
2862+
2863+ if (app_icon_)
2864+ {
2865+ app_icon_->SetSize(ICON_SIZE.CP(scale));
2866+ app_icon_->SetMinimumSize(style.GetAppIconAreaWidth().CP(scale), style.GetAppIconAreaWidth().CP(scale));
2867+ app_icon_->SetMaximumSize(style.GetAppIconAreaWidth().CP(scale), style.GetAppIconAreaWidth().CP(scale));
2868+ app_icon_->ReLoadIcon();
2869+ }
2870+
2871+ if (app_info_scroll_)
2872+ app_info_scroll_->scale = scale;
2873+
2874+ if (license_)
2875+ license_->SetScale(scale);
2876+
2877+ if (last_update_)
2878+ last_update_->SetScale(scale);
2879+
2880+ if (copywrite_)
2881+ copywrite_->SetScale(scale);
2882+
2883+ if (app_rating_)
2884+ {
2885+ app_rating_->SetMaximumHeight(style.GetRatingWidgetHeight().CP(scale));
2886+ app_rating_->SetMinimumHeight(style.GetRatingWidgetHeight().CP(scale));
2887+ app_rating_->scale = scale;
2888+ }
2889+
2890+ if (image_data_layout_)
2891+ image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale));
2892+
2893+ if (full_data_layout_)
2894+ {
2895+ full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale));
2896+ full_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN.CP(scale));
2897+ }
2898+
2899+ if (main_app_info_)
2900+ main_app_info_->SetSpaceBetweenChildren(style.GetSpaceBetweenIconAndDetails().CP(scale));
2901+
2902+ if (icon_layout_)
2903+ icon_layout_->SetSpaceBetweenChildren(ICON_SPACE_CHILDREN.CP(scale));
2904+
2905+ if (app_data_layout_)
2906+ app_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN.CP(scale));
2907+
2908+ if (title_subtitle_layout_)
2909+ title_subtitle_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
2910+
2911+ if (app_info_layout_)
2912+ app_info_layout_->SetSpaceBetweenChildren(INFO_SPACE_CHILDREN.CP(scale));
2913+
2914+ if (actions_layout_)
2915+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
2916+
2917+ if (app_updated_copywrite_layout_)
2918+ app_updated_copywrite_layout_->SetSpaceBetweenChildren(COPYRIGHT_SPACE_CHILDREN.CP(scale));
2919+}
2920+
2921 } // namespace previews
2922 } // namespace dash
2923 } // namepsace unity
2924
2925=== modified file 'dash/previews/ApplicationPreview.h'
2926--- dash/previews/ApplicationPreview.h 2013-09-19 16:44:03 +0000
2927+++ dash/previews/ApplicationPreview.h 2014-08-06 16:03:19 +0000
2928@@ -24,6 +24,7 @@
2929 #define APPLICATIONPREVIEW_H
2930
2931 #include "Preview.h"
2932+#include "unity-shared/OverlayScrollView.h"
2933
2934 namespace unity
2935 {
2936@@ -54,9 +55,18 @@
2937 virtual void PreLayoutManagement();
2938
2939 virtual void SetupViews();
2940+ void UpdateScale(double scale) override;
2941
2942 protected:
2943 nux::VLayout* title_subtitle_layout_;
2944+ nux::HLayout* image_data_layout_;
2945+ nux::HLayout* main_app_info_;
2946+ nux::VLayout* icon_layout_;
2947+ nux::VLayout* app_data_layout_;
2948+ nux::VLayout* app_updated_copywrite_layout_;
2949+ nux::VLayout* app_info_layout_;
2950+ ScrollView* app_info_scroll_;
2951+ nux::Layout* actions_layout_;
2952
2953 nux::ObjectPtr<IconTexture> app_icon_;
2954 nux::ObjectPtr<PreviewRatingsWidget> app_rating_;
2955
2956=== modified file 'dash/previews/ErrorPreview.cpp'
2957--- dash/previews/ErrorPreview.cpp 2013-09-19 16:44:03 +0000
2958+++ dash/previews/ErrorPreview.cpp 2014-08-06 16:03:19 +0000
2959@@ -26,7 +26,6 @@
2960 #include "unity-shared/PreviewStyle.h"
2961 #include "unity-shared/CoverArt.h"
2962 #include "unity-shared/StaticCairoText.h"
2963-#include "unity-shared/PlacesVScrollBar.h"
2964 #include <NuxCore/Logger.h>
2965 #include <Nux/VLayout.h>
2966 #include <Nux/HLayout.h>
2967@@ -50,22 +49,18 @@
2968 {
2969 nux::logging::Logger logger("unity.dash.previews.ErrorPreview");
2970
2971+const RawPixel TITLE_DATA_MAX_SIZE = 76_em;
2972+const RawPixel TITLE_DATA_CHILDREN_SPACE = 10_em;
2973+const RawPixel LINE_SPACING = 10_em;
2974+const RawPixel TITLE_MAX_WIDTH = 480_em;
2975+const RawPixel CHILDREN_SPACE = 5_em;
2976+const RawPixel BUTTONS_DATA_SPACE = 20_em;
2977+const RawPixel INTRO_SPACE = 110_em;
2978 }
2979
2980 const std::string ErrorPreview::CANCEL_ACTION = "cancel";
2981 const std::string ErrorPreview::GO_TO_U1_ACTION = "open_u1_link";
2982
2983-class DetailsScrollView : public nux::ScrollView
2984-{
2985-public:
2986- DetailsScrollView(NUX_FILE_LINE_PROTO)
2987- : ScrollView(NUX_FILE_LINE_PARAM)
2988- {
2989- SetVScrollBar(new dash::PlacesVScrollBar(NUX_TRACKER_LOCATION));
2990- }
2991-
2992-};
2993-
2994 NUX_IMPLEMENT_OBJECT_TYPE(ErrorPreview)
2995
2996 ErrorPreview::ErrorPreview(dash::Preview::Ptr preview_model)
2997@@ -73,6 +68,9 @@
2998 {
2999 PaymentPreview::SetupBackground();
3000 SetupViews();
3001+
3002+ UpdateScale(scale);
3003+ scale.changed.connect(sigc::mem_fun(this, &ErrorPreview::UpdateScale));
3004 }
3005
3006 ErrorPreview::~ErrorPreview()
3007@@ -114,6 +112,7 @@
3008 for (dash::Preview::ActionPtr action : preview_model_->GetActions())
3009 {
3010 nux::ObjectPtr<ActionButton> button = this->CreateButton(action);
3011+ button->scale = scale();
3012 button->activate.connect(sigc::mem_fun(this, &ErrorPreview::OnActionActivated));
3013 buttons_map_.insert(std::make_pair(action->id, button));
3014 }
3015@@ -123,8 +122,8 @@
3016 {
3017 previews::Style& style = dash::previews::Style::Instance();
3018 nux::VLayout* title_data_layout = new nux::VLayout();
3019- title_data_layout->SetMaximumHeight(76);
3020- title_data_layout->SetSpaceBetweenChildren(10);
3021+ title_data_layout->SetMaximumHeight(TITLE_DATA_MAX_SIZE.CP(scale));
3022+ title_data_layout->SetSpaceBetweenChildren(TITLE_DATA_CHILDREN_SPACE.CP(scale));
3023
3024 title_ = new StaticCairoText(
3025 preview_model_->title.Get(), true,
3026@@ -133,7 +132,7 @@
3027 title_->SetFont(style.payment_title_font());
3028 title_->SetLines(-1);
3029 title_->SetFont(style.title_font());
3030- title_->SetMaximumWidth(480);
3031+ title_->SetMaximumWidth(TITLE_MAX_WIDTH.CP(scale));
3032 title_->SetTextEllipsize(StaticCairoText::EllipsizeState::NUX_ELLIPSIZE_END);
3033 title_data_layout->AddView(title_.GetPointer(), 1);
3034
3035@@ -151,9 +150,9 @@
3036 {
3037 previews::Style& style = dash::previews::Style::Instance();
3038 nux::VLayout *prize_data_layout = new nux::VLayout();
3039- prize_data_layout->SetMaximumHeight(76);
3040- prize_data_layout->SetSpaceBetweenChildren(5);
3041- prize_data_layout->SetPadding(0, 10, 0, 0);
3042+ prize_data_layout->SetMaximumHeight(TITLE_DATA_MAX_SIZE.CP(scale));
3043+ prize_data_layout->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
3044+ prize_data_layout->SetPadding(0, TITLE_DATA_CHILDREN_SPACE.CP(scale), 0, 0);
3045
3046 purchase_prize_ = new StaticCairoText(
3047 error_preview_model_->purchase_prize.Get(), true,
3048@@ -188,16 +187,17 @@
3049 nux::HLayout *intro_layout = new nux::HLayout();
3050 nux::VLayout *icon_layout = new nux::VLayout();
3051
3052- icon_layout->SetPadding(78, 10, 90, 43);
3053- intro_layout->SetPadding(75, 20, 0, 0);
3054- intro_layout->SetSpaceBetweenChildren(5);
3055+ icon_layout->SetPadding((78_em).CP(scale), (10_em).CP(scale), (90_em).CP(scale), (43_em).CP(scale));
3056+ intro_layout->SetPadding((75_em).CP(scale), (20_em).CP(scale), 0, 0);
3057+ intro_layout->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
3058
3059 intro_ = new StaticCairoText(
3060 error_preview_model_->header.Get(), true,
3061 NUX_TRACKER_LOCATION);
3062 intro_->SetFont(style.payment_intro_font().c_str());
3063+ intro_->SetScale(scale);
3064 intro_->SetLines(-3);
3065- intro_->SetLineSpacing(10);
3066+ intro_->SetLineSpacing(LINE_SPACING.CP(scale));
3067 intro_->SetTextEllipsize(StaticCairoText::EllipsizeState::NUX_ELLIPSIZE_END);
3068
3069 intro_layout->AddView(intro_.GetPointer());//, 0, nux::MINOR_POSITION_CENTER);
3070@@ -220,9 +220,9 @@
3071 actions_buffer_h->AddSpace(0, 1);
3072
3073 nux::HLayout* buttons_data_layout = new TabIteratorHLayout(tab_iterator_);
3074- buttons_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenActions());
3075+ buttons_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenActions().CP(scale));
3076
3077- buttons_data_layout->AddSpace(20, 1);
3078+ buttons_data_layout->AddSpace(BUTTONS_DATA_SPACE.CP(scale), 1);
3079 if(buttons_map_[ErrorPreview::CANCEL_ACTION].GetPointer()){
3080 ActionButton* button = (ActionButton*)buttons_map_[ErrorPreview::CANCEL_ACTION].GetPointer();
3081 buttons_data_layout->AddView(buttons_map_[ErrorPreview::CANCEL_ACTION].GetPointer(),
3082@@ -249,11 +249,11 @@
3083
3084 previews::Style& style = dash::previews::Style::Instance();
3085
3086- int width = MAX(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin());
3087+ int width = std::max(0, geo.width - style.GetPanelSplitWidth().CP(scale) - style.GetDetailsLeftMargin().CP(scale) - style.GetDetailsRightMargin().CP(scale));
3088
3089 if(full_data_layout_) { full_data_layout_->SetMaximumWidth(width); }
3090 if(header_layout_) { header_layout_->SetMaximumWidth(width); }
3091- if(intro_) { intro_->SetMaximumWidth(width - 110); }
3092+ if(intro_) { intro_->SetMaximumWidth(width - INTRO_SPACE.CP(scale)); }
3093 if(footer_layout_) { footer_layout_->SetMaximumWidth(width); }
3094
3095 Preview::PreLayoutManagement();
3096@@ -274,6 +274,33 @@
3097 PaymentPreview::SetupViews();
3098 }
3099
3100+void ErrorPreview::UpdateScale(double scale)
3101+{
3102+ if (intro_)
3103+ intro_->SetScale(scale);
3104+
3105+ if (purchase_hint_)
3106+ purchase_hint_->SetScale(scale);
3107+ if (purchase_prize_)
3108+ purchase_prize_->SetScale(scale);
3109+ if (purchase_type_)
3110+ purchase_type_->SetScale(scale);
3111+
3112+ if (warning_texture_)
3113+ {
3114+ previews::Style& style = dash::previews::Style::Instance();
3115+ RawPixel width(style.GetWarningIcon()->GetWidth());
3116+ RawPixel height(style.GetWarningIcon()->GetHeight());
3117+
3118+ warning_texture_->SetSize(std::max(width, height).CP(scale));
3119+ warning_texture_->ReLoadIcon();
3120+ }
3121+
3122+ if (title_)
3123+ title_->SetMaximumWidth(TITLE_MAX_WIDTH.CP(scale));
3124+
3125+ Preview::UpdateScale(scale);
3126+}
3127
3128 }
3129 }
3130
3131=== modified file 'dash/previews/ErrorPreview.h'
3132--- dash/previews/ErrorPreview.h 2013-09-19 16:44:03 +0000
3133+++ dash/previews/ErrorPreview.h 2014-08-06 16:03:19 +0000
3134@@ -94,6 +94,8 @@
3135 void PreLayoutManagement();
3136
3137 virtual void SetupViews();
3138+ virtual void UpdateScale(double scale);
3139+
3140 // content elements
3141 nux::ObjectPtr<CoverArt> image_;
3142 nux::ObjectPtr<StaticCairoText> intro_;
3143
3144=== modified file 'dash/previews/GenericPreview.cpp'
3145--- dash/previews/GenericPreview.cpp 2013-11-19 18:48:35 +0000
3146+++ dash/previews/GenericPreview.cpp 2014-08-06 16:03:19 +0000
3147@@ -23,7 +23,6 @@
3148 #include "unity-shared/IntrospectableWrappers.h"
3149 #include "unity-shared/PreviewStyle.h"
3150 #include "unity-shared/CoverArt.h"
3151-#include "unity-shared/PlacesOverlayVScrollBar.h"
3152 #include <NuxCore/Logger.h>
3153 #include <Nux/HLayout.h>
3154 #include <Nux/VLayout.h>
3155@@ -40,25 +39,28 @@
3156 {
3157 namespace previews
3158 {
3159+
3160+namespace
3161+{
3162+ const RawPixel CHILDREN_SPACE = 12_em;
3163+ const RawPixel FULL_CHILDREN_SPACE = 16_em;
3164+}
3165+
3166 DECLARE_LOGGER(logger, "unity.dash.preview.generic");
3167
3168-class DetailsScrollView : public nux::ScrollView
3169-{
3170-public:
3171- DetailsScrollView(NUX_FILE_LINE_PROTO)
3172- : ScrollView(NUX_FILE_LINE_PARAM)
3173- {
3174- SetVScrollBar(new dash::PlacesOverlayVScrollBar(NUX_TRACKER_LOCATION));
3175- }
3176-
3177-};
3178-
3179 NUX_IMPLEMENT_OBJECT_TYPE(GenericPreview);
3180
3181 GenericPreview::GenericPreview(dash::Preview::Ptr preview_model)
3182 : Preview(preview_model)
3183+, image_data_layout_(nullptr)
3184+, preview_info_layout_(nullptr)
3185+, preview_info_scroll_(nullptr)
3186+, preview_data_layout_(nullptr)
3187+, actions_layout_(nullptr)
3188 {
3189 SetupViews();
3190+ UpdateScale(scale);
3191+ scale.changed.connect(sigc::mem_fun(this, &GenericPreview::UpdateScale));
3192 }
3193
3194 GenericPreview::~GenericPreview()
3195@@ -72,7 +74,7 @@
3196 gfx_engine.PushClippingRectangle(base);
3197 nux::GetPainter().PaintBackground(gfx_engine, base);
3198
3199- gfx_engine.PopClippingRectangle();
3200+ gfx_engine.PopClippingRectangle();
3201 }
3202
3203 void GenericPreview::DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw)
3204@@ -113,8 +115,8 @@
3205
3206 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); };
3207
3208- nux::HLayout* image_data_layout = new nux::HLayout();
3209- image_data_layout->SetSpaceBetweenChildren(style.GetPanelSplitWidth());
3210+ image_data_layout_ = new nux::HLayout();
3211+ image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale));
3212
3213 /////////////////////
3214 // Image
3215@@ -126,21 +128,22 @@
3216 /////////////////////
3217 // Data Panel
3218 full_data_layout_ = new nux::VLayout();
3219- full_data_layout_->SetPadding(style.GetDetailsTopMargin(), 0, style.GetDetailsBottomMargin(), style.GetDetailsLeftMargin());
3220- full_data_layout_->SetSpaceBetweenChildren(16);
3221+ full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0,
3222+ style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale));
3223+ full_data_layout_->SetSpaceBetweenChildren(FULL_CHILDREN_SPACE.CP(scale));
3224
3225 /////////////////////
3226 // Data
3227
3228- nux::VLayout* preview_data_layout = new nux::VLayout();
3229- preview_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle());
3230+ preview_data_layout_ = new nux::VLayout();
3231+ preview_data_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
3232
3233 title_ = new StaticCairoText(preview_model_->title, true, NUX_TRACKER_LOCATION);
3234 AddChild(title_.GetPointer());
3235 title_->SetLines(-1);
3236 title_->SetFont(style.title_font().c_str());
3237 title_->mouse_click.connect(on_mouse_down);
3238- preview_data_layout->AddView(title_.GetPointer(), 1);
3239+ preview_data_layout_->AddView(title_.GetPointer(), 1);
3240
3241 if (!preview_model_->subtitle.Get().empty())
3242 {
3243@@ -149,19 +152,21 @@
3244 subtitle_->SetLines(-1);
3245 subtitle_->SetFont(style.subtitle_size_font().c_str());
3246 subtitle_->mouse_click.connect(on_mouse_down);
3247- preview_data_layout->AddView(subtitle_.GetPointer(), 1);
3248+ preview_data_layout_->AddView(subtitle_.GetPointer(), 1);
3249 }
3250 /////////////////////
3251
3252 /////////////////////
3253 // Description
3254- nux::ScrollView* preview_info = new DetailsScrollView(NUX_TRACKER_LOCATION);
3255+ auto* preview_info = new ScrollView(NUX_TRACKER_LOCATION);
3256+ preview_info_scroll_ = preview_info;
3257+ preview_info->scale = scale();
3258 preview_info->EnableHorizontalScrollBar(false);
3259 preview_info->mouse_click.connect(on_mouse_down);
3260
3261- nux::VLayout* preview_info_layout = new nux::VLayout();
3262- preview_info_layout->SetSpaceBetweenChildren(12);
3263- preview_info->SetLayout(preview_info_layout);
3264+ preview_info_layout_ = new nux::VLayout();
3265+ preview_info_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
3266+ preview_info->SetLayout(preview_info_layout_);
3267
3268 if (!preview_model_->description.Get().empty())
3269 {
3270@@ -172,37 +177,37 @@
3271 description_->SetLines(-style.GetDescriptionLineCount());
3272 description_->SetLineSpacing(style.GetDescriptionLineSpacing());
3273 description_->mouse_click.connect(on_mouse_down);
3274- preview_info_layout->AddView(description_.GetPointer());
3275+ preview_info_layout_->AddView(description_.GetPointer());
3276 }
3277
3278 if (!preview_model_->GetInfoHints().empty())
3279 {
3280- preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
3281+ preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth().CP(scale));
3282 AddChild(preview_info_hints_.GetPointer());
3283 preview_info_hints_->request_close().connect([this]() { preview_container_->request_close.emit(); });
3284- preview_info_layout->AddView(preview_info_hints_.GetPointer());
3285+ preview_info_layout_->AddView(preview_info_hints_.GetPointer());
3286 }
3287 /////////////////////
3288
3289 /////////////////////
3290 // Actions
3291 action_buttons_.clear();
3292- nux::Layout* actions_layout = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
3293- actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin());
3294+ actions_layout_ = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
3295+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
3296 ///////////////////
3297
3298- full_data_layout_->AddLayout(preview_data_layout, 0);
3299+ full_data_layout_->AddLayout(preview_data_layout_, 0);
3300 full_data_layout_->AddView(preview_info, 1);
3301- full_data_layout_->AddView(actions_layout, 0);
3302+ full_data_layout_->AddView(actions_layout_, 0);
3303 /////////////////////
3304
3305- image_data_layout->AddView(image_.GetPointer(), 0);
3306+ image_data_layout_->AddView(image_.GetPointer(), 0);
3307
3308- image_data_layout->AddLayout(full_data_layout_, 1);
3309+ image_data_layout_->AddLayout(full_data_layout_, 1);
3310
3311 mouse_click.connect(on_mouse_down);
3312
3313- SetLayout(image_data_layout);
3314+ SetLayout(image_data_layout_);
3315 }
3316
3317 void GenericPreview::PreLayoutManagement()
3318@@ -213,24 +218,63 @@
3319
3320 nux::Geometry geo_art(geo.x, geo.y, style.GetAppImageAspectRatio() * geo.height, geo.height);
3321
3322- if (geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() < style.GetDetailsPanelMinimumWidth())
3323- geo_art.width = MAX(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() - style.GetDetailsPanelMinimumWidth());
3324+ int content_width = geo.width - style.GetPanelSplitWidth().CP(scale)
3325+ - style.GetDetailsLeftMargin().CP(scale)
3326+ - style.GetDetailsRightMargin().CP(scale);
3327+
3328+ if (content_width - geo_art.width < style.GetDetailsPanelMinimumWidth().CP(scale))
3329+ geo_art.width = std::max(0, content_width - style.GetDetailsPanelMinimumWidth().CP(scale));
3330+
3331 image_->SetMinMaxSize(geo_art.width, geo_art.height);
3332-
3333- int details_width = MAX(0, geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin());
3334+ int details_width = std::max(0, content_width - geo_art.width);
3335
3336 if (title_) { title_->SetMaximumWidth(details_width); }
3337 if (subtitle_) { subtitle_->SetMaximumWidth(details_width); }
3338 if (description_) { description_->SetMaximumWidth(details_width); }
3339
3340+ int button_w = CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale));
3341+ int button_h = style.GetActionButtonHeight().CP(scale);
3342+
3343 for (nux::AbstractButton* button : action_buttons_)
3344- {
3345- button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions()) / 2, 0, style.GetActionButtonMaximumWidth()), style.GetActionButtonHeight());
3346- }
3347+ button->SetMinMaxSize(button_w, button_h);
3348
3349 Preview::PreLayoutManagement();
3350 }
3351
3352+void GenericPreview::UpdateScale(double scale)
3353+{
3354+ if (image_)
3355+ image_->scale = scale;
3356+
3357+ if (preview_info_scroll_)
3358+ preview_info_scroll_->scale = scale;
3359+
3360+ if (preview_info_hints_)
3361+ preview_info_hints_->scale = scale;
3362+
3363+ previews::Style& style = dash::previews::Style::Instance();
3364+
3365+ if (full_data_layout_)
3366+ {
3367+ full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale));
3368+ full_data_layout_->SetSpaceBetweenChildren(FULL_CHILDREN_SPACE.CP(scale));
3369+ }
3370+
3371+ if (image_data_layout_)
3372+ image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale));
3373+
3374+ if (preview_info_layout_)
3375+ preview_info_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
3376+
3377+ if (preview_data_layout_)
3378+ preview_data_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
3379+
3380+ if (actions_layout_)
3381+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
3382+
3383+ Preview::UpdateScale(scale);
3384+}
3385+
3386
3387 }
3388 }
3389
3390=== modified file 'dash/previews/GenericPreview.h'
3391--- dash/previews/GenericPreview.h 2013-09-19 16:44:03 +0000
3392+++ dash/previews/GenericPreview.h 2014-08-06 16:03:19 +0000
3393@@ -23,8 +23,9 @@
3394 #ifndef GENERICPREVIEW_H
3395 #define GENERICPREVIEW_H
3396
3397+#include <UnityCore/GenericPreview.h>
3398 #include "Preview.h"
3399-#include <UnityCore/GenericPreview.h>
3400+#include "unity-shared/OverlayScrollView.h"
3401
3402 namespace unity
3403 {
3404@@ -52,6 +53,13 @@
3405 virtual void PreLayoutManagement();
3406
3407 virtual void SetupViews();
3408+ virtual void UpdateScale(double scale);
3409+
3410+ nux::HLayout* image_data_layout_;
3411+ nux::VLayout* preview_info_layout_;
3412+ ScrollView* preview_info_scroll_;
3413+ nux::VLayout* preview_data_layout_;
3414+ nux::Layout* actions_layout_;
3415 };
3416
3417 }
3418
3419=== modified file 'dash/previews/MoviePreview.cpp'
3420--- dash/previews/MoviePreview.cpp 2013-11-19 18:48:35 +0000
3421+++ dash/previews/MoviePreview.cpp 2014-08-06 16:03:19 +0000
3422@@ -23,7 +23,6 @@
3423 #include "unity-shared/IntrospectableWrappers.h"
3424 #include "unity-shared/PreviewStyle.h"
3425 #include "unity-shared/CoverArt.h"
3426-#include "unity-shared/PlacesOverlayVScrollBar.h"
3427 #include <UnityCore/MoviePreview.h>
3428 #include <NuxCore/Logger.h>
3429 #include <Nux/HLayout.h>
3430@@ -41,23 +40,23 @@
3431 {
3432 namespace previews
3433 {
3434+
3435+namespace
3436+{
3437+ const RawPixel CHILDREN_SPACE = 16_em;
3438+ const RawPixel PREVIEW_INFO_CHILDREN_SPACE = 12_em;
3439+}
3440+
3441 DECLARE_LOGGER(logger, "unity.dash.preview.movie");
3442
3443-class DetailsScrollView : public nux::ScrollView
3444-{
3445-public:
3446- DetailsScrollView(NUX_FILE_LINE_PROTO)
3447- : ScrollView(NUX_FILE_LINE_PARAM)
3448- {
3449- SetVScrollBar(new dash::PlacesOverlayVScrollBar(NUX_TRACKER_LOCATION));
3450- }
3451-
3452-};
3453-
3454 NUX_IMPLEMENT_OBJECT_TYPE(MoviePreview);
3455
3456 MoviePreview::MoviePreview(dash::Preview::Ptr preview_model)
3457 : Preview(preview_model)
3458+, image_data_layout_(nullptr)
3459+, preview_info_layout_(nullptr)
3460+, preview_info_scroll_(nullptr)
3461+, actions_layout_(nullptr)
3462 {
3463 SetupViews();
3464 }
3465@@ -123,8 +122,8 @@
3466
3467 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); };
3468
3469- nux::HLayout* image_data_layout = new nux::HLayout();
3470- image_data_layout->SetSpaceBetweenChildren(style.GetPanelSplitWidth());
3471+ image_data_layout_ = new nux::HLayout();
3472+ image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale));
3473
3474 /////////////////////
3475 // Image
3476@@ -136,8 +135,8 @@
3477 /////////////////////
3478 // Data Panel
3479 full_data_layout_ = new nux::VLayout();
3480- full_data_layout_->SetPadding(style.GetDetailsTopMargin(), 0, style.GetDetailsBottomMargin(), style.GetDetailsLeftMargin());
3481- full_data_layout_->SetSpaceBetweenChildren(16);
3482+ full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale));
3483+ full_data_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
3484
3485 /////////////////////
3486 // Data
3487@@ -148,6 +147,7 @@
3488 title_ = new StaticCairoText(preview_model_->title, true, NUX_TRACKER_LOCATION);
3489 AddChild(title_.GetPointer());
3490 title_->SetLines(-1);
3491+ title_->SetScale(scale);
3492 title_->SetFont(style.title_font().c_str());
3493 title_->mouse_click.connect(on_mouse_down);
3494 app_data_layout->AddView(title_.GetPointer(), 1);
3495@@ -157,6 +157,7 @@
3496 subtitle_ = new StaticCairoText(preview_model_->subtitle, true, NUX_TRACKER_LOCATION);
3497 AddChild(subtitle_.GetPointer());
3498 subtitle_->SetLines(-1);
3499+ subtitle_->SetScale(scale);
3500 subtitle_->SetFont(style.subtitle_size_font().c_str());
3501 subtitle_->mouse_click.connect(on_mouse_down);
3502 app_data_layout->AddView(subtitle_.GetPointer(), 1);
3503@@ -166,8 +167,8 @@
3504 if (movie_preview_model->rating >= 0) {
3505 rating_ = new PreviewRatingsWidget();
3506 AddChild(rating_.GetPointer());
3507- rating_->SetMaximumHeight(style.GetRatingWidgetHeight());
3508- rating_->SetMinimumHeight(style.GetRatingWidgetHeight());
3509+ rating_->SetMaximumHeight(style.GetRatingWidgetHeight().CP(scale));
3510+ rating_->SetMinimumHeight(style.GetRatingWidgetHeight().CP(scale));
3511 rating_->SetRating(movie_preview_model->rating);
3512 rating_->SetReviews(movie_preview_model->num_ratings);
3513 rating_->request_close().connect([this]() { preview_container_->request_close.emit(); });
3514@@ -175,20 +176,23 @@
3515
3516 /////////////////////
3517 // Description
3518- nux::ScrollView* preview_info = new DetailsScrollView(NUX_TRACKER_LOCATION);
3519+ auto* preview_info = new ScrollView(NUX_TRACKER_LOCATION);
3520+ preview_info_scroll_ = preview_info;
3521+ preview_info->scale = scale();
3522 preview_info->EnableHorizontalScrollBar(false);
3523 preview_info->mouse_click.connect(on_mouse_down);
3524
3525- nux::VLayout* preview_info_layout = new nux::VLayout();
3526- preview_info_layout->SetSpaceBetweenChildren(12);
3527- preview_info->SetLayout(preview_info_layout);
3528+ preview_info_layout_ = new nux::VLayout();
3529+ preview_info_layout_->SetSpaceBetweenChildren(PREVIEW_INFO_CHILDREN_SPACE.CP(scale));
3530+ preview_info->SetLayout(preview_info_layout_);
3531
3532 if (!preview_model_->GetInfoHints().empty())
3533 {
3534 preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
3535+ preview_info_hints_->scale = scale();
3536 AddChild(preview_info_hints_.GetPointer());
3537 preview_info_hints_->request_close().connect([this]() { preview_container_->request_close.emit(); });
3538- preview_info_layout->AddView(preview_info_hints_.GetPointer(), 0);
3539+ preview_info_layout_->AddView(preview_info_hints_.GetPointer(), 0);
3540 }
3541
3542 if (!preview_model_->description.Get().empty())
3543@@ -196,34 +200,35 @@
3544 description_ = new StaticCairoText(preview_model_->description, false, NUX_TRACKER_LOCATION); // not escaped!
3545 AddChild(description_.GetPointer());
3546 description_->SetFont(style.description_font().c_str());
3547+ description_->SetScale(scale);
3548 description_->SetTextAlignment(StaticCairoText::NUX_ALIGN_TOP);
3549 description_->SetLines(-style.GetDescriptionLineCount());
3550 description_->SetLineSpacing(style.GetDescriptionLineSpacing());
3551 description_->mouse_click.connect(on_mouse_down);
3552- preview_info_layout->AddView(description_.GetPointer());
3553+ preview_info_layout_->AddView(description_.GetPointer());
3554 }
3555 /////////////////////
3556
3557 /////////////////////
3558 // Actions
3559 action_buttons_.clear();
3560- nux::Layout* actions_layout = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
3561- actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin());
3562+ actions_layout_ = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
3563+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
3564 ///////////////////
3565
3566 full_data_layout_->AddLayout(app_data_layout, 0);
3567 if (rating_ != NULL)
3568 full_data_layout_->AddView(rating_.GetPointer(), 0);
3569 full_data_layout_->AddView(preview_info, 1);
3570- full_data_layout_->AddView(actions_layout, 0);
3571+ full_data_layout_->AddView(actions_layout_, 0);
3572 /////////////////////
3573
3574- image_data_layout->AddView(image_.GetPointer(), 0);
3575- image_data_layout->AddLayout(full_data_layout_, 1);
3576+ image_data_layout_->AddView(image_.GetPointer(), 0);
3577+ image_data_layout_->AddLayout(full_data_layout_, 1);
3578
3579 mouse_click.connect(on_mouse_down);
3580
3581- SetLayout(image_data_layout);
3582+ SetLayout(image_data_layout_);
3583 }
3584
3585
3586@@ -235,11 +240,13 @@
3587
3588 nux::Geometry geo_art(geo.x, geo.y, style.GetVideoImageAspectRatio() * geo.height, geo.height);
3589
3590- if (geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() < style.GetDetailsPanelMinimumWidth())
3591- geo_art.width = MAX(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() - style.GetDetailsPanelMinimumWidth());
3592+ int content_width = geo.width - style.GetPanelSplitWidth().CP(scale) - style.GetDetailsLeftMargin().CP(scale) - style.GetDetailsRightMargin().CP(scale);
3593+ if (content_width - geo_art.width < style.GetDetailsPanelMinimumWidth().CP(scale))
3594+ geo_art.width = std::max(0, content_width - style.GetDetailsPanelMinimumWidth().CP(scale));
3595+
3596 image_->SetMinMaxSize(geo_art.width, geo_art.height);
3597
3598- int details_width = MAX(0, geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin());
3599+ int details_width = std::max(0, geo.width - geo_art.width - style.GetPanelSplitWidth().CP(scale) - style.GetDetailsLeftMargin().CP(scale) - style.GetDetailsRightMargin().CP(scale));
3600
3601 if (title_) { title_->SetMaximumWidth(details_width); }
3602 if (subtitle_) { subtitle_->SetMaximumWidth(details_width); }
3603@@ -247,12 +254,49 @@
3604
3605 for (nux::AbstractButton* button : action_buttons_)
3606 {
3607- button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions()) / 2, 0, style.GetActionButtonMaximumWidth()), style.GetActionButtonHeight());
3608+ button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale)), style.GetActionButtonHeight().CP(scale));
3609 }
3610
3611 Preview::PreLayoutManagement();
3612 }
3613
3614+void MoviePreview::UpdateScale(double scale)
3615+{
3616+ Preview::UpdateScale(scale);
3617+
3618+ if (image_)
3619+ image_->scale = scale;
3620+
3621+ if (preview_info_hints_)
3622+ preview_info_hints_->scale = scale;
3623+
3624+ previews::Style& style = dash::previews::Style::Instance();
3625+
3626+ if (full_data_layout_)
3627+ {
3628+ full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale));
3629+ full_data_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
3630+ }
3631+
3632+ if (image_data_layout_)
3633+ image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale));
3634+
3635+ if (rating_)
3636+ {
3637+ rating_->SetMaximumHeight(style.GetRatingWidgetHeight().CP(scale));
3638+ rating_->SetMinimumHeight(style.GetRatingWidgetHeight().CP(scale));
3639+ }
3640+
3641+ if (preview_info_scroll_)
3642+ preview_info_scroll_->scale = scale;
3643+
3644+ if (preview_info_layout_)
3645+ preview_info_layout_->SetSpaceBetweenChildren(PREVIEW_INFO_CHILDREN_SPACE);
3646+
3647+ if (actions_layout_)
3648+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
3649+}
3650+
3651 } // namespace previews
3652 } // namespace dash
3653 } // namespace unity
3654
3655=== modified file 'dash/previews/MoviePreview.h'
3656--- dash/previews/MoviePreview.h 2013-09-19 16:44:03 +0000
3657+++ dash/previews/MoviePreview.h 2014-08-06 16:03:19 +0000
3658@@ -24,6 +24,7 @@
3659 #define MOVIEPREVIEW_H
3660
3661 #include "Preview.h"
3662+#include "unity-shared/OverlayScrollView.h"
3663
3664 namespace unity
3665 {
3666@@ -55,9 +56,15 @@
3667 virtual void OnNavigateInComplete();
3668
3669 virtual void SetupViews();
3670-
3671+ virtual void UpdateScale(double scale);
3672+
3673 protected:
3674 nux::ObjectPtr<PreviewRatingsWidget> rating_;
3675+
3676+ nux::HLayout* image_data_layout_;
3677+ nux::VLayout* preview_info_layout_;
3678+ ScrollView* preview_info_scroll_;
3679+ nux::Layout* actions_layout_;
3680 };
3681
3682 }
3683
3684=== modified file 'dash/previews/MusicPaymentPreview.cpp'
3685--- dash/previews/MusicPaymentPreview.cpp 2013-09-19 16:44:03 +0000
3686+++ dash/previews/MusicPaymentPreview.cpp 2014-08-06 16:03:19 +0000
3687@@ -24,7 +24,6 @@
3688 #include "unity-shared/PreviewStyle.h"
3689 #include "unity-shared/CoverArt.h"
3690 #include "unity-shared/StaticCairoText.h"
3691-#include "unity-shared/PlacesVScrollBar.h"
3692 #include "config.h"
3693
3694 #include <glib/gi18n-lib.h>
3695@@ -49,6 +48,22 @@
3696 {
3697 nux::logging::Logger logger("unity.dash.previews.payment.preview.music");
3698
3699+const RawPixel DATA_MAX_HEIGHT = 76_em;
3700+const RawPixel TITLE_CHILDREN_SPACE = 10_em;
3701+const RawPixel PRIZE_CHILDREN_SPACE = 5_em;
3702+const RawPixel TITLE_MAX_WIDTH = 480_em;
3703+const RawPixel INTRO_MIN_HEIGHT = 50_em;
3704+const RawPixel FORM_MIN_HEIGHT = 107_em;
3705+const RawPixel FORM_PADDING = 20_em;
3706+const RawPixel LABELS_CHILDREN_SPACE = 18_em;
3707+const RawPixel PASSWORD_MIN_HEIGHT = 40_em;
3708+const RawPixel PASSWORD_MIN_WIDTH = 240_em;
3709+const RawPixel ACTIONS_CHILDREN_SPACE_MAX = 16_em;
3710+const RawPixel ACTIONS_CHILDREN_SPACE_MIN = 8_em;
3711+const RawPixel BUTTONS_SPACE = 20_em;
3712+const RawPixel HEADER_CHILDREN_SPACE = 10_em;
3713+const RawPixel HEADER_MAX_SIZE = 76_em;
3714+const RawPixel BODY_CHILDREN_SPACE = 20_em;
3715 }
3716
3717 // static string definitions
3718@@ -59,17 +74,6 @@
3719 const std::string MusicPaymentPreview::CANCEL_PURCHASE_ACTION = "cancel_purchase";
3720 const std::string MusicPaymentPreview::PURCHASE_ALBUM_ACTION = "purchase_album";
3721
3722-class DetailsScrollView : public nux::ScrollView
3723-{
3724-public:
3725- DetailsScrollView(NUX_FILE_LINE_PROTO)
3726- : ScrollView(NUX_FILE_LINE_PARAM)
3727- {
3728- SetVScrollBar(new dash::PlacesVScrollBar(NUX_TRACKER_LOCATION));
3729- }
3730-
3731-};
3732-
3733 NUX_IMPLEMENT_OBJECT_TYPE(MusicPaymentPreview)
3734
3735 MusicPaymentPreview::MusicPaymentPreview(dash::Preview::Ptr preview_model)
3736@@ -77,6 +81,7 @@
3737 {
3738 SetupViews();
3739 PaymentPreview::SetupBackground();
3740+ UpdateScale(scale);
3741 }
3742
3743 std::string MusicPaymentPreview::GetName() const
3744@@ -127,6 +132,7 @@
3745 || MusicPaymentPreview::FORGOT_PASSWORD_ACTION == action_id)
3746 {
3747 nux::ObjectPtr<ActionLink> link = this->CreateLink(action);
3748+ link->scale = scale();
3749 link->activate.connect(sigc::mem_fun(this,
3750 &MusicPaymentPreview::OnActionLinkActivated));
3751
3752@@ -137,6 +143,7 @@
3753 nux::ObjectPtr<ActionButton> button = this->CreateButton(action);
3754 button->activate.connect(sigc::mem_fun(this,
3755 &MusicPaymentPreview::OnActionActivated));
3756+ button->scale = scale();
3757
3758 buttons_map_.insert(std::make_pair(action->id, button));
3759 }
3760@@ -148,8 +155,8 @@
3761 {
3762 previews::Style& style = dash::previews::Style::Instance();
3763 nux::VLayout* title_data_layout = new nux::VLayout();
3764- title_data_layout->SetMaximumHeight(76);
3765- title_data_layout->SetSpaceBetweenChildren(10);
3766+ title_data_layout->SetMaximumHeight(DATA_MAX_HEIGHT.CP(scale));
3767+ title_data_layout->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
3768
3769 title_ = new StaticCairoText(
3770 preview_model_->title.Get(), true,
3771@@ -157,8 +164,9 @@
3772
3773 title_->SetFont(style.payment_title_font());
3774 title_->SetLines(-1);
3775+ title_->SetScale(scale);
3776 title_->SetFont(style.title_font());
3777- title_->SetMaximumWidth(480);
3778+ title_->SetMaximumWidth(TITLE_MAX_WIDTH.CP(scale));
3779 title_->SetTextEllipsize(StaticCairoText::EllipsizeState::NUX_ELLIPSIZE_END);
3780 title_data_layout->AddView(title_.GetPointer(), 1);
3781
3782@@ -166,6 +174,7 @@
3783 preview_model_->subtitle.Get(), true,
3784 NUX_TRACKER_LOCATION);
3785 subtitle_->SetLines(-1);
3786+ subtitle_->SetScale(scale);
3787 subtitle_->SetFont(style.payment_subtitle_font());
3788 title_data_layout->AddView(subtitle_.GetPointer(), 1);
3789 title_data_layout->AddSpace(1, 1);
3790@@ -176,14 +185,15 @@
3791 {
3792 previews::Style& style = dash::previews::Style::Instance();
3793 nux::VLayout *prize_data_layout = new nux::VLayout();
3794- prize_data_layout->SetMaximumHeight(76);
3795- prize_data_layout->SetSpaceBetweenChildren(5);
3796- prize_data_layout->SetPadding(0, 10, 0, 0);
3797+ prize_data_layout->SetMaximumHeight(DATA_MAX_HEIGHT.CP(scale));
3798+ prize_data_layout->SetSpaceBetweenChildren(PRIZE_CHILDREN_SPACE.CP(scale));
3799+ prize_data_layout->SetPadding(0, TITLE_CHILDREN_SPACE.CP(scale), 0, 0);
3800
3801 purchase_prize_ = new StaticCairoText(
3802 payment_preview_model_->purchase_prize.Get(), true,
3803 NUX_TRACKER_LOCATION);
3804 purchase_prize_->SetLines(-1);
3805+ purchase_prize_->SetScale(scale);
3806 purchase_prize_->SetFont(style.payment_prize_title_font());
3807 prize_data_layout->AddView(purchase_prize_.GetPointer(), 1,
3808 nux::MINOR_POSITION_END);
3809@@ -192,6 +202,7 @@
3810 _("Ubuntu One best offer"),
3811 true, NUX_TRACKER_LOCATION);
3812 purchase_hint_->SetLines(-1);
3813+ purchase_hint_->SetScale(scale);
3814 purchase_hint_->SetFont(style.payment_prize_subtitle_font());
3815 prize_data_layout->AddView(purchase_hint_.GetPointer(), 1,
3816 nux::MINOR_POSITION_END);
3817@@ -200,6 +211,7 @@
3818 payment_preview_model_->purchase_type.Get(), true,
3819 NUX_TRACKER_LOCATION);
3820 purchase_type_->SetLines(-1);
3821+ purchase_type_->SetScale(scale);
3822 purchase_type_->SetFont(style.payment_prize_subtitle_font());
3823 prize_data_layout->AddView(purchase_type_.GetPointer(), 1,
3824 nux::MINOR_POSITION_END);
3825@@ -210,31 +222,30 @@
3826 {
3827 previews::Style& style = dash::previews::Style::Instance();
3828 nux::VLayout *body_layout = new nux::VLayout();
3829- body_layout->SetSpaceBetweenChildren(20);
3830+ body_layout->SetSpaceBetweenChildren(BODY_CHILDREN_SPACE.CP(scale));
3831
3832 intro_ = new StaticCairoText(
3833 payment_preview_model_->header.Get(), true,
3834 NUX_TRACKER_LOCATION);
3835 intro_->SetFont(style.payment_intro_font());
3836- intro_->SetLineSpacing(10);
3837+ intro_->SetScale(scale);
3838+ intro_->SetLineSpacing(TITLE_CHILDREN_SPACE.CP(scale));
3839 intro_->SetLines(-style.GetDescriptionLineCount());
3840- intro_->SetMinimumHeight(50);
3841+ intro_->SetMinimumHeight(INTRO_MIN_HEIGHT.CP(scale));
3842
3843 form_layout_ = new nux::HLayout();
3844- form_layout_->SetSpaceBetweenChildren(10);
3845- form_layout_->SetMinimumHeight(107);
3846- form_layout_->SetLeftAndRightPadding(20);
3847- form_layout_->SetTopAndBottomPadding(10);
3848+ form_layout_->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
3849+ form_layout_->SetMinimumHeight(FORM_MIN_HEIGHT.CP(scale));
3850+ form_layout_->SetLeftAndRightPadding(FORM_PADDING.CP(scale));
3851+ form_layout_->SetTopAndBottomPadding(TITLE_CHILDREN_SPACE.CP(scale));
3852
3853 form_layout_->AddLayout(GetFormLabels(), 1, nux::MINOR_POSITION_END);
3854 form_layout_->AddLayout(GetFormFields(), 1, nux::MINOR_POSITION_END);
3855 form_layout_->AddLayout(GetFormActions(), 1, nux::MINOR_POSITION_END);
3856
3857-
3858 body_layout->AddView(intro_.GetPointer(), 1);
3859 body_layout->AddLayout(form_layout_.GetPointer(), 1);
3860
3861-
3862 return body_layout;
3863 }
3864
3865@@ -244,17 +255,18 @@
3866 nux::VLayout *labels_layout = new nux::VLayout();
3867 if (error_message_.empty())
3868 {
3869- labels_layout->SetSpaceBetweenChildren(18);
3870+ labels_layout->SetSpaceBetweenChildren(LABELS_CHILDREN_SPACE.CP(scale));
3871 }
3872 else
3873 {
3874- labels_layout->SetSpaceBetweenChildren(10);
3875+ labels_layout->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
3876 }
3877
3878 email_label_ = new StaticCairoText(
3879 _("Ubuntu One email:"), true,
3880 NUX_TRACKER_LOCATION);
3881 email_label_->SetLines(-1);
3882+ email_label_->SetScale(scale);
3883 email_label_->SetFont(style.payment_form_labels_font());
3884 labels_layout->AddView(email_label_.GetPointer(), 0, nux::MINOR_POSITION_END);
3885
3886@@ -262,6 +274,7 @@
3887 _("Payment method:"), true,
3888 NUX_TRACKER_LOCATION);
3889 payment_label_->SetLines(-1);
3890+ payment_label_->SetScale(scale);
3891 payment_label_->SetFont(style.payment_form_labels_font());
3892 labels_layout->AddView(payment_label_.GetPointer(), 0, nux::MINOR_POSITION_END);
3893
3894@@ -269,8 +282,9 @@
3895 _("Ubuntu One password:"), true,
3896 NUX_TRACKER_LOCATION);
3897 password_label_->SetLines(-1);
3898+ password_label_->SetScale(scale);
3899 password_label_->SetFont(style.payment_form_labels_font());
3900- password_label_->SetMinimumHeight(40);
3901+ password_label_->SetMinimumHeight(PASSWORD_MIN_HEIGHT.CP(scale));
3902 labels_layout->AddView(password_label_.GetPointer(), 0, nux::MINOR_POSITION_END);
3903
3904 return labels_layout;
3905@@ -282,17 +296,18 @@
3906 nux::VLayout *fields_layout = new nux::VLayout();
3907 if (error_message_.empty())
3908 {
3909- fields_layout->SetSpaceBetweenChildren(18);
3910+ fields_layout->SetSpaceBetweenChildren(LABELS_CHILDREN_SPACE.CP(scale));
3911 }
3912 else
3913 {
3914- fields_layout->SetSpaceBetweenChildren(10);
3915+ fields_layout->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
3916 }
3917
3918 email_ = new StaticCairoText(
3919 payment_preview_model_->email.Get(), true,
3920 NUX_TRACKER_LOCATION);
3921 email_->SetLines(-1);
3922+ email_->SetScale(scale);
3923 email_->SetFont(style.payment_form_data_font());
3924 fields_layout->AddView(email_.GetPointer(), 1,
3925 nux::MINOR_POSITION_START);
3926@@ -301,13 +316,14 @@
3927 payment_preview_model_->payment_method.Get(), true,
3928 NUX_TRACKER_LOCATION);
3929 payment_->SetLines(-1);
3930+ payment_->SetScale(scale);
3931 payment_->SetFont(style.payment_form_data_font());
3932 fields_layout->AddView(payment_.GetPointer(), 1,
3933 nux::MINOR_POSITION_START);
3934
3935 password_entry_ = new TextInput();
3936- password_entry_->SetMinimumHeight(40);
3937- password_entry_->SetMinimumWidth(240);
3938+ password_entry_->SetMinimumHeight(PASSWORD_MIN_HEIGHT.CP(scale));
3939+ password_entry_->SetMinimumWidth(PASSWORD_MIN_WIDTH.CP(scale));
3940 password_entry_->input_hint = _("Password");
3941
3942 fields_layout->AddView(password_entry_.GetPointer(),
3943@@ -322,6 +338,7 @@
3944 StaticCairoText* error = new StaticCairoText(
3945 _("Wrong password"), true, NUX_TRACKER_LOCATION);
3946 error->SetLines(-1);
3947+ error->SetScale(scale);
3948 error->SetFont(style.payment_form_data_font());
3949 // ensure it is an error using red
3950 error->SetTextColor(style.payment_error_color());
3951@@ -337,11 +354,11 @@
3952 nux::VLayout *actions_layout = new nux::VLayout();
3953 if (error_message_.empty())
3954 {
3955- actions_layout->SetSpaceBetweenChildren(16);
3956+ actions_layout->SetSpaceBetweenChildren(ACTIONS_CHILDREN_SPACE_MAX.CP(scale));
3957 }
3958 else
3959 {
3960- actions_layout->SetSpaceBetweenChildren(8);
3961+ actions_layout->SetSpaceBetweenChildren(ACTIONS_CHILDREN_SPACE_MIN.CP(scale));
3962 }
3963
3964 nux::ObjectPtr<StaticCairoText> empty_;
3965@@ -349,6 +366,7 @@
3966 "", true,
3967 NUX_TRACKER_LOCATION);
3968 empty_->SetLines(-1);
3969+ empty_->SetScale(scale);
3970 empty_->SetFont(style.payment_form_labels_font());
3971 actions_layout->AddView(empty_.GetPointer(), 1,
3972 nux::MINOR_POSITION_START);
3973@@ -374,14 +392,14 @@
3974 actions_buffer_h->AddSpace(0, 1);
3975
3976 nux::HLayout* buttons_data_layout = new nux::HLayout();
3977- buttons_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenActions());
3978+ buttons_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenActions().CP(scale));
3979
3980- lock_texture_ = new IconTexture(style.GetLockIcon(), style.GetPaymentLockWidth(),
3981- style.GetPaymentLockHeight());
3982+ lock_texture_ = new IconTexture(style.GetLockIcon(), style.GetPaymentLockWidth().CP(scale),
3983+ style.GetPaymentLockHeight().CP(scale));
3984 buttons_data_layout->AddView(lock_texture_.GetPointer(), 0, nux::MINOR_POSITION_CENTER,
3985 nux::MINOR_SIZE_FULL, 100.0f, nux::NUX_LAYOUT_BEGIN);
3986
3987- buttons_data_layout->AddSpace(20, 1);
3988+ buttons_data_layout->AddSpace(BUTTONS_SPACE.CP(scale), 1);
3989 if(buttons_map_[MusicPaymentPreview::CANCEL_PURCHASE_ACTION].GetPointer())
3990 buttons_data_layout->AddView(buttons_map_[MusicPaymentPreview::CANCEL_PURCHASE_ACTION].GetPointer(),
3991 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL, 100.0f,
3992@@ -413,7 +431,8 @@
3993
3994 previews::Style& style = dash::previews::Style::Instance();
3995
3996- int width = std::max<int>(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin());
3997+ int content_width = geo.width - style.GetPanelSplitWidth().CP(scale) - style.GetDetailsLeftMargin().CP(scale) - style.GetDetailsRightMargin().CP(scale);
3998+ int width = std::max<int>(0, content_width);
3999
4000 if(full_data_layout_) { full_data_layout_->SetMaximumWidth(width); }
4001 if(header_layout_) { header_layout_->SetMaximumWidth(width); }
4002@@ -460,6 +479,49 @@
4003 PaymentPreview::SetupViews();
4004 }
4005
4006+void MusicPaymentPreview::UpdateScale(double scale)
4007+{
4008+ PaymentPreview::UpdateScale(scale);
4009+
4010+ if (intro_)
4011+ intro_->SetScale(scale);
4012+ if (email_label_)
4013+ email_label_->SetScale(scale);
4014+ if (payment_label_)
4015+ payment_label_->SetScale(scale);
4016+ if (payment_)
4017+ payment_->SetScale(scale);
4018+ if (password_label_)
4019+ password_label_->SetScale(scale);
4020+ if (purchase_hint_)
4021+ purchase_hint_->SetScale(scale);
4022+ if (purchase_prize_)
4023+ purchase_prize_->SetScale(scale);
4024+ if (purchase_type_)
4025+ purchase_type_->SetScale(scale);
4026+ if (change_payment_)
4027+ change_payment_->SetScale(scale);
4028+ if (error_label_)
4029+ error_label_->SetScale(scale);
4030+
4031+ previews::Style& style = dash::previews::Style::Instance();
4032+ if (lock_texture_)
4033+ lock_texture_->SetSize(std::max(style.GetPaymentLockWidth().CP(scale), style.GetPaymentLockHeight().CP(scale)));
4034+
4035+ if (password_entry_)
4036+ {
4037+ password_entry_->SetMinimumHeight(PASSWORD_MIN_HEIGHT.CP(scale));
4038+ password_entry_->SetMinimumWidth(PASSWORD_MIN_WIDTH.CP(scale));
4039+ }
4040+
4041+ if (form_layout_)
4042+ {
4043+ form_layout_->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
4044+ form_layout_->SetMinimumHeight(FORM_MIN_HEIGHT.CP(scale));
4045+ form_layout_->SetLeftAndRightPadding(FORM_PADDING.CP(scale));
4046+ form_layout_->SetTopAndBottomPadding(TITLE_CHILDREN_SPACE.CP(scale));
4047+ }
4048+}
4049
4050 }
4051 }
4052
4053=== modified file 'dash/previews/MusicPaymentPreview.h'
4054--- dash/previews/MusicPaymentPreview.h 2013-09-19 16:44:03 +0000
4055+++ dash/previews/MusicPaymentPreview.h 2014-08-06 16:03:19 +0000
4056@@ -90,6 +90,7 @@
4057 void OnActionLinkActivated(ActionLink* link, std::string const& id);
4058
4059 virtual void SetupViews();
4060+ virtual void UpdateScale(double scale) override;
4061
4062 void PreLayoutManagement();
4063
4064
4065=== modified file 'dash/previews/MusicPreview.cpp'
4066--- dash/previews/MusicPreview.cpp 2013-11-19 18:48:35 +0000
4067+++ dash/previews/MusicPreview.cpp 2014-08-06 16:03:19 +0000
4068@@ -42,14 +42,27 @@
4069 {
4070 namespace previews
4071 {
4072+
4073+namespace
4074+{
4075+ const RawPixel CHILDREN_SPACE = 16_em;
4076+ const RawPixel ICON_LEFT_RIGHT_PADDING = 10_em;
4077+ const RawPixel WARNING_MIN_HEIGHT = 50_em;
4078+ const RawPixel WARNING_MAX_WIDTH = 300_em;
4079+}
4080+
4081 DECLARE_LOGGER(logger, "unity.dash.preview.music");
4082
4083 NUX_IMPLEMENT_OBJECT_TYPE(MusicPreview);
4084
4085 MusicPreview::MusicPreview(dash::Preview::Ptr preview_model)
4086 : Preview(preview_model)
4087+, actions_layout_(nullptr)
4088+, image_data_layout_(nullptr)
4089+, icon_layout_(nullptr)
4090 {
4091 SetupViews();
4092+ UpdateScale(scale);
4093 }
4094
4095 MusicPreview::~MusicPreview()
4096@@ -130,13 +143,13 @@
4097
4098 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); };
4099
4100- nux::HLayout* image_data_layout = new nux::HLayout();
4101- image_data_layout->SetSpaceBetweenChildren(style.GetPanelSplitWidth());
4102+ image_data_layout_ = new nux::HLayout();
4103+ image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale));
4104
4105 /////////////////////
4106 // Image
4107 image_ = new CoverArt();
4108-
4109+ image_->scale = scale();
4110 AddChild(image_.GetPointer());
4111 UpdateCoverArtImage(image_.GetPointer());
4112 /////////////////////
4113@@ -144,20 +157,21 @@
4114 /////////////////////
4115 // App Data Panel
4116 full_data_layout_ = new nux::VLayout();
4117- full_data_layout_->SetPadding(style.GetDetailsTopMargin(), 0, style.GetDetailsBottomMargin(), style.GetDetailsLeftMargin());
4118- full_data_layout_->SetSpaceBetweenChildren(16);
4119+ full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale));
4120+ full_data_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
4121
4122 /////////////////////
4123 // Music Info
4124- nux::VLayout* album_data_layout = new nux::VLayout();
4125- album_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle());
4126+ album_data_layout_ = new nux::VLayout();
4127+ album_data_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
4128
4129 title_ = new StaticCairoText(preview_model_->title, true, NUX_TRACKER_LOCATION);
4130 AddChild(title_.GetPointer());
4131 title_->SetFont(style.title_font().c_str());
4132 title_->SetLines(-1);
4133+ title_->SetScale(scale);
4134 title_->mouse_click.connect(on_mouse_down);
4135- album_data_layout->AddView(title_.GetPointer(), 1);
4136+ album_data_layout_->AddView(title_.GetPointer(), 1);
4137
4138 if (!preview_model_->subtitle.Get().empty())
4139 {
4140@@ -165,8 +179,9 @@
4141 AddChild(subtitle_.GetPointer());
4142 subtitle_->SetFont(style.subtitle_size_font().c_str());
4143 subtitle_->SetLines(-1);
4144+ subtitle_->SetScale(scale);
4145 subtitle_->mouse_click.connect(on_mouse_down);
4146- album_data_layout->AddView(subtitle_.GetPointer(), 1);
4147+ album_data_layout_->AddView(subtitle_.GetPointer(), 1);
4148 }
4149
4150 /////////////////////
4151@@ -177,6 +192,7 @@
4152 if (tracks_model)
4153 {
4154 tracks_ = new previews::Tracks(tracks_model, NUX_TRACKER_LOCATION);
4155+ tracks_->scale = scale();
4156 AddChild(tracks_.GetPointer());
4157 tracks_->mouse_click.connect(on_mouse_down);
4158 }
4159@@ -187,7 +203,7 @@
4160 /////////////////////
4161 // Hints && Actions
4162 nux::VLayout* hints_layout = NULL;
4163- nux::Layout* actions_layout = NULL;
4164+ actions_layout_ = NULL;
4165 bool has_u1_creds = HasUbuntuOneCredentials();
4166
4167 if (has_u1_creds)
4168@@ -197,70 +213,72 @@
4169 hints_layout = new nux::VLayout();
4170 hints_layout->SetSpaceBetweenChildren(0);
4171 hints_layout->AddSpace(0, 1);
4172- preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
4173+ preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth().CP(scale));
4174+ preview_info_hints_->scale = scale();
4175 AddChild(preview_info_hints_.GetPointer());
4176 preview_info_hints_->request_close().connect([this]() { preview_container_->request_close.emit(); });
4177 hints_layout->AddView(preview_info_hints_.GetPointer(), 0);
4178
4179 // If there are actions, we use a vertical layout
4180 action_buttons_.clear();
4181- actions_layout = BuildVerticalActionsLayout(preview_model_->GetActions(), action_buttons_);
4182- actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin());
4183+ actions_layout_ = BuildVerticalActionsLayout(preview_model_->GetActions(), action_buttons_);
4184+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
4185 }
4186 else // otherwise we add a grid layout.
4187 {
4188 action_buttons_.clear();
4189- actions_layout = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
4190+ actions_layout_ = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
4191 if (action_buttons_.size() < 2)
4192 hint_actions_layout->AddSpace(0, 1);
4193- actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin());
4194+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
4195 }
4196 }
4197 else
4198 {
4199 // let the user know he needs to connect
4200 previews::Style& style = dash::previews::Style::Instance();
4201- actions_layout = new nux::HLayout();
4202- nux::VLayout* icon_layout = new nux::VLayout();
4203- icon_layout->SetLeftAndRightPadding(10);
4204+ nux::HLayout* actions_layout = new nux::HLayout();
4205+ icon_layout_ = new nux::VLayout();
4206+ icon_layout_->SetLeftAndRightPadding(ICON_LEFT_RIGHT_PADDING.CP(scale));
4207
4208 warning_texture_ = new IconTexture(style.GetWarningIcon());
4209- icon_layout->AddView(warning_texture_.GetPointer(), 0, nux::MINOR_POSITION_START,
4210+ icon_layout_->AddView(warning_texture_.GetPointer(), 0, nux::MINOR_POSITION_START,
4211 nux::MINOR_SIZE_FULL, 100.0f, nux::NUX_LAYOUT_BEGIN);
4212- actions_layout->AddLayout(icon_layout, 0, nux::MINOR_POSITION_CENTER);
4213+ actions_layout->AddLayout(icon_layout_, 0, nux::MINOR_POSITION_CENTER);
4214
4215 warning_msg_ = new StaticCairoText(
4216 no_credentials_message_, true,
4217 NUX_TRACKER_LOCATION);
4218- AddChild(warning_msg_.GetPointer());
4219+ AddChild(warning_msg_.GetPointer());
4220 warning_msg_->SetFont(style.u1_warning_font().c_str());
4221 warning_msg_->SetLines(-2);
4222- warning_msg_->SetMinimumHeight(50);
4223- warning_msg_->SetMaximumWidth(300);
4224+ warning_msg_->SetScale(scale);
4225+ warning_msg_->SetMinimumHeight(WARNING_MIN_HEIGHT.CP(scale));
4226+ warning_msg_->SetMaximumWidth(WARNING_MAX_WIDTH.CP(scale));
4227
4228 actions_layout->AddView(warning_msg_.GetPointer(), 0, nux::MINOR_POSITION_CENTER);
4229
4230 }
4231-
4232+
4233 /////////////////////
4234
4235 if (hints_layout) hint_actions_layout->AddView(hints_layout, 1);
4236- hint_actions_layout->AddView(actions_layout, 0);
4237+ hint_actions_layout->AddView(actions_layout_, 0);
4238
4239- full_data_layout_->AddLayout(album_data_layout, 0);
4240+ full_data_layout_->AddLayout(album_data_layout_, 0);
4241 if (tracks_)
4242 {
4243 full_data_layout_->AddView(tracks_.GetPointer(), 1);
4244 }
4245 full_data_layout_->AddLayout(hint_actions_layout, 0);
4246 /////////////////////
4247-
4248- image_data_layout->AddView(image_.GetPointer(), 0);
4249- image_data_layout->AddLayout(full_data_layout_, 1);
4250+
4251+ image_data_layout_->AddView(image_.GetPointer(), 0);
4252+ image_data_layout_->AddLayout(full_data_layout_, 1);
4253
4254 mouse_click.connect(on_mouse_down);
4255
4256- SetLayout(image_data_layout);
4257+ SetLayout(image_data_layout_);
4258 }
4259
4260 void MusicPreview::PreLayoutManagement()
4261@@ -272,23 +290,23 @@
4262
4263 nux::Geometry geo_art(geo.x, geo.y, style.GetAppImageAspectRatio() * geo.height, geo.height);
4264
4265- if (geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() < style.GetDetailsPanelMinimumWidth())
4266- geo_art.width = MAX(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() - style.GetDetailsPanelMinimumWidth());
4267+ int content_width = geo.width - style.GetPanelSplitWidth().CP(scale) - style.GetDetailsLeftMargin().CP(scale) - style.GetDetailsRightMargin().CP(scale);
4268+ if (content_width - geo_art.width < style.GetDetailsPanelMinimumWidth().CP(scale))
4269+ geo_art.width = MAX(0, content_width - style.GetDetailsPanelMinimumWidth().CP(scale));
4270 image_->SetMinMaxSize(geo_art.width, geo_art.height);
4271
4272- int details_width = MAX(0, geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin());
4273+ int details_width = MAX(0, content_width - geo_art.width);
4274
4275 if (title_) { title_->SetMaximumWidth(details_width); }
4276 if (subtitle_) { subtitle_->SetMaximumWidth(details_width); }
4277
4278 for (nux::AbstractButton* button : action_buttons_)
4279 {
4280- int action_width = CLAMP((details_width - style.GetSpaceBetweenActions()) /
4281- 2, 0, style.GetActionButtonMaximumWidth());
4282+ int action_width = CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale));
4283 // do not use SetMinMax because width has to be able to grow
4284 button->SetMinimumWidth(action_width);
4285- button->SetMinimumHeight(style.GetActionButtonHeight());
4286- button->SetMaximumHeight(style.GetActionButtonHeight());
4287+ button->SetMinimumHeight(style.GetActionButtonHeight().CP(scale));
4288+ button->SetMaximumHeight(style.GetActionButtonHeight().CP(scale));
4289 }
4290
4291 Preview::PreLayoutManagement();
4292@@ -300,6 +318,47 @@
4293 player.Stop();
4294 }
4295
4296+void MusicPreview::UpdateScale(double scale)
4297+{
4298+ Preview::UpdateScale(scale);
4299+
4300+ if (tracks_)
4301+ tracks_->scale = scale;
4302+
4303+ if (preview_info_hints_)
4304+ preview_info_hints_->scale = scale;
4305+
4306+ if (icon_layout_)
4307+ icon_layout_->SetLeftAndRightPadding(ICON_LEFT_RIGHT_PADDING.CP(scale));
4308+
4309+ if (warning_msg_)
4310+ {
4311+ warning_msg_->SetScale(scale);
4312+ warning_msg_->SetMinimumHeight(WARNING_MIN_HEIGHT.CP(scale));
4313+ warning_msg_->SetMaximumWidth(WARNING_MAX_WIDTH.CP(scale));
4314+ }
4315+
4316+ previews::Style& style = dash::previews::Style::Instance();
4317+
4318+ if (image_data_layout_)
4319+ image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale));
4320+
4321+ if (full_data_layout_)
4322+ {
4323+ full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale));
4324+ full_data_layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
4325+ }
4326+
4327+ if (album_data_layout_)
4328+ album_data_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale));
4329+
4330+ if (actions_layout_)
4331+ actions_layout_->SetLeftAndRightPadding(0, style.GetDetailsRightMargin().CP(scale));
4332+
4333+ if (icon_layout_)
4334+ icon_layout_->SetLeftAndRightPadding(ICON_LEFT_RIGHT_PADDING.CP(scale));
4335+}
4336+
4337 } // namespace previews
4338 } // namespace dash
4339 } // namespace unity
4340
4341=== modified file 'dash/previews/MusicPreview.h'
4342--- dash/previews/MusicPreview.h 2013-09-19 16:44:03 +0000
4343+++ dash/previews/MusicPreview.h 2014-08-06 16:03:19 +0000
4344@@ -24,6 +24,7 @@
4345 #define MUSICPREVIEW_H
4346
4347 #include "Preview.h"
4348+#include "unity-shared/OverlayScrollView.h"
4349 #include "unity-shared/IconTexture.h"
4350
4351 namespace unity
4352@@ -53,6 +54,7 @@
4353 virtual void PreLayoutManagement();
4354
4355 virtual void SetupViews();
4356+ virtual void UpdateScale(double scale);
4357
4358 virtual void OnNavigateOut();
4359
4360@@ -64,6 +66,10 @@
4361 nux::ObjectPtr<IconTexture> warning_texture_;
4362 std::string no_credentials_message_;
4363
4364+ nux::Layout* actions_layout_;
4365+ nux::HLayout* image_data_layout_;
4366+ nux::VLayout* icon_layout_;
4367+ nux::VLayout* album_data_layout_;
4368 };
4369
4370 }
4371
4372=== modified file 'dash/previews/PaymentPreview.cpp'
4373--- dash/previews/PaymentPreview.cpp 2013-09-19 16:44:03 +0000
4374+++ dash/previews/PaymentPreview.cpp 2014-08-06 16:03:19 +0000
4375@@ -23,6 +23,7 @@
4376 #include <NuxCore/Logger.h>
4377 #include "PaymentPreview.h"
4378 #include "unity-shared/CoverArt.h"
4379+#include "unity-shared/DashStyle.h"
4380 #include "unity-shared/PreviewStyle.h"
4381
4382 namespace unity
4383@@ -39,6 +40,15 @@
4384
4385 nux::logging::Logger logger("unity.dash.previews.payment.preview");
4386
4387+const RawPixel CONTENT_DATA_CHILDREN_SPACE = 5_em;
4388+const RawPixel CONTENT_DATA_PADDING = 10_em;
4389+const RawPixel OVERLAY_LAYOUT_SPACE = 20_em;
4390+const RawPixel HEADER_CHILDREN_SPACE = 10_em;
4391+const RawPixel HEADER_MAX_SIZE = 76_em;
4392+const RawPixel IMAGE_MIN_MAX_SIZE = 64_em;
4393+const RawPixel HEADER_SPACE = 10_em;
4394+const RawPixel LINK_MIN_WIDTH = 178_em;
4395+const RawPixel LINK_MAX_HEIGHT = 34_em;
4396 }
4397
4398 class OverlaySpinner : public unity::debug::Introspectable, public nux::View
4399@@ -47,6 +57,8 @@
4400 public:
4401 OverlaySpinner();
4402
4403+ nux::Property<double> scale;
4404+
4405 void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
4406 void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
4407
4408@@ -61,7 +73,7 @@
4409 private:
4410 bool OnFrameTimeout();
4411
4412- nux::BaseTexture* spin_;
4413+ nux::ObjectPtr<nux::BaseTexture> spin_;
4414
4415 glib::Source::UniquePtr frame_timeout_;
4416
4417@@ -72,15 +84,19 @@
4418 NUX_IMPLEMENT_OBJECT_TYPE(OverlaySpinner);
4419
4420 OverlaySpinner::OverlaySpinner()
4421- : nux::View(NUX_TRACKER_LOCATION),
4422- rotation_(0.0f)
4423+ : nux::View(NUX_TRACKER_LOCATION)
4424+ , scale(1.0)
4425+ , rotation_(0.0f)
4426 {
4427- previews::Style& style = dash::previews::Style::Instance();
4428-
4429- spin_ = style.GetSearchSpinIcon();
4430+ spin_ = dash::Style::Instance().GetSearchSpinIcon(scale);
4431
4432 rotate_.Identity();
4433 rotate_.Rotate_z(0.0);
4434+
4435+ scale.changed.connect([this] (double scale) {
4436+ spin_ = dash::Style::Instance().GetSearchSpinIcon(scale);
4437+ QueueDraw();
4438+ });
4439 }
4440
4441 void OverlaySpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
4442@@ -183,8 +199,12 @@
4443 : Preview(preview_model)
4444 , data_(nullptr)
4445 , full_data_layout_(nullptr)
4446-{
4447-}
4448+, content_data_layout_(nullptr)
4449+, overlay_layout_(nullptr)
4450+, header_layout_(nullptr)
4451+, body_layout_(nullptr)
4452+, footer_layout_(nullptr)
4453+{}
4454
4455 std::string PaymentPreview::GetName() const
4456 {
4457@@ -199,18 +219,18 @@
4458 nux::Layout* PaymentPreview::GetHeader()
4459 {
4460 nux::HLayout* header_data_layout = new nux::HLayout();
4461- header_data_layout->SetSpaceBetweenChildren(10);
4462- header_data_layout->SetMaximumHeight(76);
4463- header_data_layout->SetMinimumHeight(76);
4464+ header_data_layout->SetSpaceBetweenChildren(HEADER_CHILDREN_SPACE.CP(scale));
4465+ header_data_layout->SetMaximumHeight(HEADER_MAX_SIZE.CP(scale));
4466+ header_data_layout->SetMinimumHeight(HEADER_MAX_SIZE.CP(scale));
4467
4468 image_ = new CoverArt();
4469- image_->SetMinMaxSize(64, 64);
4470+ image_->SetMinMaxSize(IMAGE_MIN_MAX_SIZE.CP(scale), IMAGE_MIN_MAX_SIZE.CP(scale));
4471 AddChild(image_.GetPointer());
4472 UpdateCoverArtImage(image_.GetPointer());
4473
4474 header_data_layout->AddView(image_.GetPointer(), 0);
4475 header_data_layout->AddLayout(GetTitle(), 0);
4476- header_data_layout->AddSpace(10, 1);
4477+ header_data_layout->AddSpace(HEADER_SPACE.CP(scale), 1);
4478 header_data_layout->AddLayout(GetPrice(), 0);
4479 return header_data_layout;
4480 }
4481@@ -223,8 +243,8 @@
4482 link = new ActionLink(action->id,
4483 action->display_name, NUX_TRACKER_LOCATION);
4484 link->font_hint.Set(style.payment_form_labels_font().c_str());
4485- link->SetMinimumWidth(178);
4486- link->SetMaximumHeight(34);
4487+ link->SetMinimumWidth(LINK_MIN_WIDTH.CP(scale));
4488+ link->SetMaximumHeight(LINK_MAX_HEIGHT.CP(scale));
4489 return link;
4490 }
4491
4492@@ -239,8 +259,8 @@
4493 NUX_TRACKER_LOCATION);
4494 button->SetFont(style.action_font());
4495 button->SetExtraHint(action->extra_text, style.action_extra_font());
4496- button->SetMinimumWidth(178);
4497- button->SetMaximumHeight(34);
4498+ button->SetMinimumWidth(LINK_MIN_WIDTH.CP(scale));
4499+ button->SetMaximumHeight(LINK_MAX_HEIGHT.CP(scale));
4500 return button;
4501 }
4502
4503@@ -327,8 +347,8 @@
4504
4505 // layout to be used to show the info
4506 content_data_layout_ = new nux::VLayout();
4507- content_data_layout_->SetSpaceBetweenChildren(5);
4508- content_data_layout_->SetPadding(10, 10, 0, 10);
4509+ content_data_layout_->SetSpaceBetweenChildren(CONTENT_DATA_CHILDREN_SPACE.CP(scale));
4510+ content_data_layout_->SetPadding(CONTENT_DATA_PADDING.CP(scale), CONTENT_DATA_PADDING.CP(scale), 0, CONTENT_DATA_PADDING.CP(scale));
4511
4512 header_layout_ = GetHeader();
4513
4514@@ -344,21 +364,37 @@
4515
4516 // layout to draw an overlay
4517 overlay_layout_ = new nux::VLayout();
4518- StaticCairoText* calculating = new StaticCairoText(
4519+ calculating_ = new StaticCairoText(
4520 "Performing purchase", true,
4521 NUX_TRACKER_LOCATION);
4522
4523 OverlaySpinner* spinner_ = new OverlaySpinner();
4524- overlay_layout_->AddSpace(20, 1);
4525- overlay_layout_->AddView(calculating, 0, nux::MINOR_POSITION_CENTER);
4526+ overlay_layout_->AddSpace(OVERLAY_LAYOUT_SPACE.CP(scale), 1);
4527+ overlay_layout_->AddView(calculating_, 0, nux::MINOR_POSITION_CENTER);
4528 overlay_layout_->AddView(spinner_, 1, nux::MINOR_POSITION_CENTER);
4529- overlay_layout_->AddSpace(20, 1);
4530+ overlay_layout_->AddSpace(OVERLAY_LAYOUT_SPACE.CP(scale), 1);
4531+ scale.changed.connect([this, spinner_] (double scale) { spinner_->scale = scale; });
4532
4533 full_data_layout_->AddLayout(overlay_layout_.GetPointer());
4534
4535+ UpdateScale(scale);
4536 SetLayout(full_data_layout_.GetPointer());
4537 }
4538
4539+void PaymentPreview::UpdateScale(double scale)
4540+{
4541+ Preview::UpdateScale(scale);
4542+
4543+ if (calculating_)
4544+ calculating_->SetScale(scale);
4545+
4546+ if (content_data_layout_)
4547+ {
4548+ content_data_layout_->SetSpaceBetweenChildren(CONTENT_DATA_CHILDREN_SPACE.CP(scale));
4549+ content_data_layout_->SetPadding(CONTENT_DATA_PADDING.CP(scale), CONTENT_DATA_PADDING.CP(scale), 0, CONTENT_DATA_PADDING.CP(scale));
4550+ }
4551+}
4552+
4553 }
4554
4555 }
4556
4557=== modified file 'dash/previews/PaymentPreview.h'
4558--- dash/previews/PaymentPreview.h 2013-09-19 16:44:03 +0000
4559+++ dash/previews/PaymentPreview.h 2014-08-06 16:03:19 +0000
4560@@ -106,6 +106,7 @@
4561
4562 virtual void LoadActions() = 0;
4563 virtual void SetupViews();
4564+ virtual void UpdateScale(double scale) override;
4565 virtual void SetupBackground();
4566
4567 nux::ObjectPtr<nux::LayeredLayout> full_data_layout_;
4568@@ -115,6 +116,8 @@
4569 nux::ObjectPtr<nux::Layout> body_layout_;
4570 nux::ObjectPtr<nux::Layout> footer_layout_;
4571
4572+ StaticCairoText* calculating_;
4573+
4574 // content elements
4575 nux::ObjectPtr<CoverArt> image_;
4576
4577
4578=== modified file 'dash/previews/Preview.cpp'
4579--- dash/previews/Preview.cpp 2013-11-19 18:48:35 +0000
4580+++ dash/previews/Preview.cpp 2014-08-06 16:03:19 +0000
4581@@ -38,6 +38,7 @@
4582 #include "MusicPaymentPreview.h"
4583 #include "SocialPreview.h"
4584 #include "PreviewInfoHintWidget.h"
4585+#include "ActionButton.h"
4586
4587 namespace unity
4588 {
4589@@ -100,14 +101,16 @@
4590
4591 Preview::Preview(dash::Preview::Ptr preview_model)
4592 : View(NUX_TRACKER_LOCATION)
4593+ , scale(1.0f)
4594 , preview_model_(preview_model)
4595 , tab_iterator_(new TabIterator())
4596 , full_data_layout_(nullptr)
4597 , image_(nullptr)
4598 , title_(nullptr)
4599 , subtitle_(nullptr)
4600+ , preview_container_(new PreviewContainer)
4601 {
4602- preview_container_ = new PreviewContainer;
4603+ scale.changed.connect(sigc::mem_fun(this, &Preview::UpdateScale));
4604 }
4605
4606 Preview::~Preview()
4607@@ -138,13 +141,13 @@
4608 previews::Style& style = dash::previews::Style::Instance();
4609
4610 nux::VLayout* actions_layout_v = new nux::VLayout();
4611- actions_layout_v->SetSpaceBetweenChildren(style.GetSpaceBetweenActions());
4612+ actions_layout_v->SetSpaceBetweenChildren(style.GetSpaceBetweenActions().CP(scale));
4613 uint rows = actions.size() / 2 + ((actions.size() % 2 > 0) ? 1 : 0);
4614 uint action_iter = 0;
4615 for (uint i = 0; i < rows; i++)
4616 {
4617 nux::HLayout* actions_layout_h = new TabIteratorHLayout(tab_iterator_);
4618- actions_layout_h->SetSpaceBetweenChildren(style.GetSpaceBetweenActions());
4619+ actions_layout_h->SetSpaceBetweenChildren(style.GetSpaceBetweenActions().CP(scale));
4620
4621 for (uint j = 0; j < 2 && action_iter < actions.size(); j++, action_iter++)
4622 {
4623@@ -172,7 +175,7 @@
4624 previews::Style& style = dash::previews::Style::Instance();
4625
4626 nux::VLayout* actions_layout_v = new TabIteratorVLayout(tab_iterator_);
4627- actions_layout_v->SetSpaceBetweenChildren(style.GetSpaceBetweenActions());
4628+ actions_layout_v->SetSpaceBetweenChildren(style.GetSpaceBetweenActions().CP(scale));
4629
4630 uint action_iter = 0;
4631 for (uint i = 0; i < actions.size(); i++)
4632@@ -215,7 +218,7 @@
4633 else
4634 cover_art->SetNoImageAvailable();
4635 cover_art->SetFont(style.no_preview_image_font());
4636-
4637+
4638 cover_art->mouse_click.connect(on_mouse_down);
4639 }
4640
4641@@ -279,6 +282,37 @@
4642 return preview_container_->request_close;
4643 }
4644
4645-}
4646-}
4647-}
4648+void Preview::UpdateScale(double scale)
4649+{
4650+ if (image_)
4651+ image_->scale = scale;
4652+
4653+ if (title_)
4654+ title_->SetScale(scale);
4655+ if (subtitle_)
4656+ subtitle_->SetScale(scale);
4657+ if (description_)
4658+ description_->SetScale(scale);
4659+
4660+ if (preview_container_)
4661+ preview_container_->scale = scale;
4662+
4663+ if (preview_info_hints_)
4664+ preview_info_hints_->scale = scale;
4665+
4666+ for (nux::AbstractButton* button : action_buttons_)
4667+ {
4668+ if (ActionButton* bn = dynamic_cast<ActionButton*>(button))
4669+ bn->scale = scale;
4670+
4671+ if (ActionLink* link = dynamic_cast<ActionLink*>(button))
4672+ link->scale = scale;
4673+ }
4674+
4675+ QueueRelayout();
4676+ QueueDraw();
4677+}
4678+
4679+} // preview
4680+} // dash
4681+} // unity
4682
4683=== modified file 'dash/previews/Preview.h'
4684--- dash/previews/Preview.h 2013-09-19 16:44:03 +0000
4685+++ dash/previews/Preview.h 2014-08-06 16:03:19 +0000
4686@@ -74,6 +74,8 @@
4687 unsigned long special_keys_state);
4688 virtual nux::Area* KeyNavIteration(nux::KeyNavDirection direction);
4689
4690+ nux::Property<double> scale;
4691+
4692 protected:
4693 virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw) {}
4694 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) {}
4695@@ -88,6 +90,8 @@
4696
4697 virtual void SetupViews() = 0;
4698
4699+ virtual void UpdateScale(double scale);
4700+
4701 nux::Layout* BuildGridActionsLayout(dash::Preview::ActionPtrList actions, std::list<nux::AbstractButton*>& buttons);
4702 nux::Layout* BuildVerticalActionsLayout(dash::Preview::ActionPtrList actions, std::list<nux::AbstractButton*>& buttons);
4703
4704
4705=== modified file 'dash/previews/PreviewContainer.cpp'
4706--- dash/previews/PreviewContainer.cpp 2013-11-19 18:48:35 +0000
4707+++ dash/previews/PreviewContainer.cpp 2014-08-06 16:03:19 +0000
4708@@ -23,11 +23,11 @@
4709 #include "PreviewContainer.h"
4710 #include <NuxCore/Logger.h>
4711 #include <Nux/HLayout.h>
4712-#include <Nux/VLayout.h>
4713
4714 #include "unity-shared/IntrospectableWrappers.h"
4715 #include "unity-shared/TimeUtil.h"
4716 #include "unity-shared/PreviewStyle.h"
4717+#include "unity-shared/DashStyle.h"
4718 #include "unity-shared/GraphicsUtils.h"
4719 #include "PreviewNavigator.h"
4720 #include <boost/math/constants/constants.hpp>
4721@@ -52,13 +52,15 @@
4722 const int PREVIEW_SPINNER_WAIT = 2000;
4723
4724 const std::string ANIMATION_IDLE = "animation-idle";
4725+const RawPixel CHILDREN_SPACE = 6_em;
4726 }
4727
4728 class PreviewContent : public nux::Layout, public debug::Introspectable
4729 {
4730 public:
4731 PreviewContent(PreviewContainer*const parent)
4732- : parent_(parent)
4733+ : scale(1.0)
4734+ , parent_(parent)
4735 , progress_(0.0)
4736 , curve_progress_(0.0)
4737 , animating_(false)
4738@@ -73,9 +75,19 @@
4739 // Need to update the preview geometries when updating the container geo.
4740 UpdateAnimationProgress(progress_, curve_progress_);
4741 });
4742- Style& style = previews::Style::Instance();
4743-
4744- spin_= style.GetSearchSpinIcon(32);
4745+
4746+ spin_ = dash::Style::Instance().GetSearchSpinIcon(scale);
4747+ scale.changed.connect(sigc::mem_fun(this, &PreviewContent::UpdateScale));
4748+ }
4749+
4750+ void UpdateScale(double scale)
4751+ {
4752+ spin_ = dash::Style::Instance().GetSearchSpinIcon(scale);
4753+
4754+ for (auto* area : GetChildren())
4755+ static_cast<previews::Preview*>(area)->scale = scale;
4756+
4757+ QueueDraw();
4758 }
4759
4760 // From debug::Introspectable
4761@@ -107,6 +119,7 @@
4762 AddChild(preview.GetPointer());
4763 AddView(preview.GetPointer());
4764 preview->SetVisible(false);
4765+ preview->scale = scale();
4766 }
4767 else
4768 {
4769@@ -355,6 +368,7 @@
4770 sigc::signal<void> start_navigation;
4771 sigc::signal<void> continue_navigation;
4772 sigc::signal<void> end_navigation;
4773+ nux::Property<double> scale;
4774
4775 private:
4776 PreviewContainer*const parent_;
4777@@ -394,6 +408,7 @@
4778
4779 PreviewContainer::PreviewContainer(NUX_FILE_LINE_DECL)
4780 : View(NUX_FILE_LINE_PARAM)
4781+ , scale(1.0)
4782 , preview_layout_(nullptr)
4783 , nav_disabled_(Navigation::NONE)
4784 , navigation_progress_speed_(0.0)
4785@@ -408,6 +423,7 @@
4786
4787 key_down.connect(sigc::mem_fun(this, &PreviewContainer::OnKeyDown));
4788 mouse_click.connect(sigc::mem_fun(this, &PreviewContainer::OnMouseDown));
4789+ scale.changed.connect(sigc::mem_fun(this, &PreviewContainer::UpdateScale));
4790 }
4791
4792 PreviewContainer::~PreviewContainer()
4793@@ -417,13 +433,12 @@
4794 void PreviewContainer::Preview(dash::Preview::Ptr preview_model, Navigation direction)
4795 {
4796 previews::Preview::Ptr preview_view = preview_model ? previews::Preview::PreviewForModel(preview_model) : previews::Preview::Ptr();
4797-
4798+
4799 if (preview_view)
4800 {
4801 preview_view->request_close().connect([this]() { request_close.emit(); });
4802+ preview_layout_->PushPreview(preview_view, direction);
4803 }
4804-
4805- preview_layout_->PushPreview(preview_view, direction);
4806 }
4807
4808 void PreviewContainer::DisableNavButton(Navigation button)
4809@@ -458,29 +473,32 @@
4810
4811 nux::VLayout* layout = new nux::VLayout();
4812 SetLayout(layout);
4813- layout->AddLayout(new nux::SpaceLayout(0,0,style.GetPreviewTopPadding(),style.GetPreviewTopPadding()));
4814+
4815+ layout->SetTopAndBottomPadding(style.GetPreviewTopPadding().CP(scale), 0);
4816
4817 layout_content_ = new nux::HLayout();
4818- layout_content_->SetSpaceBetweenChildren(6);
4819+ layout_content_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
4820 layout->AddLayout(layout_content_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
4821
4822 layout_content_->AddSpace(0, 1);
4823 nav_left_ = new PreviewNavigator(Orientation::LEFT, NUX_TRACKER_LOCATION);
4824 AddChild(nav_left_);
4825- nav_left_->SetMinimumWidth(style.GetNavigatorWidth());
4826- nav_left_->SetMaximumWidth(style.GetNavigatorWidth());
4827+ nav_left_->scale = scale();
4828+ nav_left_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
4829+ nav_left_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
4830 nav_left_->activated.connect([this]() { navigate_left.emit(); });
4831 layout_content_->AddView(nav_left_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
4832
4833 preview_layout_ = new PreviewContent(this);
4834- preview_layout_->SetMinMaxSize(style.GetPreviewWidth(), style.GetPreviewHeight());
4835+ preview_layout_->SetMinMaxSize(style.GetPreviewWidth().CP(scale), style.GetPreviewHeight().CP(scale));
4836 AddChild(preview_layout_);
4837 layout_content_->AddLayout(preview_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
4838
4839 nav_right_ = new PreviewNavigator(Orientation::RIGHT, NUX_TRACKER_LOCATION);
4840 AddChild(nav_right_);
4841- nav_right_->SetMinimumWidth(style.GetNavigatorWidth());
4842- nav_right_->SetMaximumWidth(style.GetNavigatorWidth());
4843+ nav_right_->scale = scale();
4844+ nav_right_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
4845+ nav_right_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
4846 nav_right_->activated.connect([this]() { navigate_right.emit(); });
4847 layout_content_->AddView(nav_right_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
4848 layout_content_->AddSpace(0, 1);
4849@@ -492,7 +510,7 @@
4850 // reset animation clock.
4851 if (navigation_count_ == 0)
4852 clock_gettime(CLOCK_MONOTONIC, &last_progress_time_);
4853-
4854+
4855 float navigation_progress_remaining = CLAMP((1.0 - preview_layout_->GetAnimationProgress()) + navigation_count_, 1.0f, 10.0f);
4856 navigation_count_++;
4857
4858@@ -534,7 +552,7 @@
4859 gfx_engine.GetRenderStates().SetBlend(false);
4860 gfx_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
4861 }
4862-
4863+
4864 // rely on the compiz event loop to come back to us in a nice throttling
4865 if (AnimationInProgress())
4866 {
4867@@ -595,11 +613,12 @@
4868 bool PreviewContainer::QueueAnimation()
4869 {
4870 animation_timer_.reset();
4871-
4872+
4873 timespec current;
4874 clock_gettime(CLOCK_MONOTONIC, &current);
4875 float progress = GetSwipeAnimationProgress(current);
4876- preview_layout_->UpdateAnimationProgress(progress, easeInOutQuart(progress)); // ease in/out.
4877+ if (preview_layout_)
4878+ preview_layout_->UpdateAnimationProgress(progress, easeInOutQuart(progress)); // ease in/out.
4879 last_progress_time_ = current;
4880
4881 QueueDraw();
4882@@ -691,7 +710,30 @@
4883
4884 nux::Geometry PreviewContainer::GetLayoutGeometry() const
4885 {
4886- return layout_content_->GetAbsoluteGeometry();
4887+ return layout_content_->GetAbsoluteGeometry();
4888+}
4889+
4890+void PreviewContainer::UpdateScale(double scale)
4891+{
4892+ previews::Style& style = previews::Style::Instance();
4893+
4894+ GetLayout()->SetTopAndBottomPadding(style.GetPreviewTopPadding().CP(scale), 0);
4895+
4896+ preview_layout_->SetMinMaxSize(style.GetPreviewWidth().CP(scale), style.GetPreviewHeight().CP(scale));
4897+ preview_layout_->scale = scale;
4898+
4899+ layout_content_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale));
4900+
4901+ nav_left_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
4902+ nav_left_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
4903+ nav_left_->scale = scale;
4904+
4905+ nav_right_->SetMinimumWidth(style.GetNavigatorWidth().CP(scale));
4906+ nav_right_->SetMaximumWidth(style.GetNavigatorWidth().CP(scale));
4907+ nav_right_->scale = scale;
4908+
4909+ QueueRelayout();
4910+ QueueDraw();
4911 }
4912
4913 } // namespace previews
4914
4915=== modified file 'dash/previews/PreviewContainer.h'
4916--- dash/previews/PreviewContainer.h 2013-09-19 16:44:03 +0000
4917+++ dash/previews/PreviewContainer.h 2014-08-06 16:03:19 +0000
4918@@ -25,6 +25,7 @@
4919
4920 #include <Nux/Nux.h>
4921 #include <Nux/View.h>
4922+#include <Nux/VLayout.h>
4923 #include <UnityCore/Preview.h>
4924 #include "Preview.h"
4925 #include "unity-shared/Introspectable.h"
4926@@ -74,6 +75,8 @@
4927 sigc::signal<void> navigate_right;
4928 sigc::signal<void> request_close;
4929
4930+ nux::Property<double> scale;
4931+
4932 bool AcceptKeyNavFocus();
4933
4934 nux::Area* KeyNavIteration(nux::KeyNavDirection direction);
4935@@ -91,7 +94,7 @@
4936
4937 bool InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character);
4938 void OnKeyDown(unsigned long event_type, unsigned long event_keysym, unsigned long event_state, const TCHAR* character, unsigned short key_repeat_count);
4939-
4940+
4941 private:
4942 void SetupViews();
4943
4944@@ -101,6 +104,8 @@
4945 bool QueueAnimation();
4946
4947 private:
4948+ void UpdateScale(double scale);
4949+
4950 // View related
4951 nux::HLayout* layout_content_;
4952 PreviewNavigator* nav_left_;
4953@@ -112,7 +117,7 @@
4954 struct timespec last_progress_time_;
4955 float navigation_progress_speed_;
4956 int navigation_count_;
4957-
4958+
4959 glib::Source::UniquePtr animation_timer_;
4960 friend class PreviewContent;
4961 };
4962
4963=== modified file 'dash/previews/PreviewInfoHintWidget.cpp'
4964--- dash/previews/PreviewInfoHintWidget.cpp 2013-11-19 18:48:35 +0000
4965+++ dash/previews/PreviewInfoHintWidget.cpp 2014-08-06 16:03:19 +0000
4966@@ -17,6 +17,7 @@
4967 * <http://www.gnu.org/licenses/>
4968 *
4969 * Authored by: Nick Dedekind <nick.dedekind@canonical.com>
4970+ * Marco Trevisan <marco.trevisan@canonical.com>
4971 *
4972 */
4973
4974@@ -41,21 +42,23 @@
4975 DECLARE_LOGGER(logger, "unity.dash.preview.infohintwidget");
4976 namespace
4977 {
4978-const int layout_spacing = 12;
4979+const RawPixel LAYOUT_SPACING = 12_em;
4980+const RawPixel HINTS_SPACING = 6_em;
4981 }
4982
4983 NUX_IMPLEMENT_OBJECT_TYPE(PreviewInfoHintWidget);
4984
4985 PreviewInfoHintWidget::PreviewInfoHintWidget(dash::Preview::Ptr preview_model, int icon_size)
4986 : View(NUX_TRACKER_LOCATION)
4987+, scale(1.0)
4988 , icon_size_(icon_size)
4989+, layout_(nullptr)
4990+, info_names_layout_(nullptr)
4991+, info_values_layout_(nullptr)
4992 , preview_model_(preview_model)
4993 {
4994 SetupViews();
4995-}
4996-
4997-PreviewInfoHintWidget::~PreviewInfoHintWidget()
4998-{
4999+ scale.changed.connect(sigc::mem_fun(this, &PreviewInfoHintWidget::UpdateScale));
5000 }
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: