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