Merge lp:~3v1n0/unity/dash-style-rawpixel into lp:unity
- dash-style-rawpixel
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3840 |
Proposed branch: | lp:~3v1n0/unity/dash-style-rawpixel |
Merge into: | lp:unity |
Prerequisite: | lp:~unity-team/unity/previews-scaling-final |
Diff against target: |
1294 lines (+290/-354) 17 files modified
dash/DashController.cpp (+2/-2) dash/DashView.cpp (+34/-54) dash/FilterExpanderLabel.cpp (+0/-1) dash/PlacesGroup.cpp (+10/-18) dash/ResultRendererTile.cpp (+18/-33) dash/ScopeBar.cpp (+0/-1) dash/ScopeBarIcon.cpp (+0/-1) dash/ScopeView.cpp (+11/-14) dash/previews/ActionButton.cpp (+0/-1) hud/StandaloneHud.cpp (+8/-5) lockscreen/UserPromptView.cpp (+0/-1) tests/test_places_group.cpp (+16/-7) unity-shared/DashStyle.cpp (+112/-130) unity-shared/DashStyle.h (+51/-58) unity-shared/DashStyleInterface.h (+6/-5) unity-shared/OverlayRenderer.cpp (+21/-23) unity-shared/OverlayRenderer.h (+1/-0) |
To merge this branch: | bzr merge lp:~3v1n0/unity/dash-style-rawpixel |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Eleni Maria Stea (community) | Approve | ||
Review via email:
|
Commit message
DashStyle: return RawPixel's instead of integers for sizes, and avoid duplication in code
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3868
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3869
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3870
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'dash/DashController.cpp' |
2 | --- dash/DashController.cpp 2014-06-06 13:54:29 +0000 |
3 | +++ dash/DashController.cpp 2014-07-10 11:23:35 +0000 |
4 | @@ -468,8 +468,8 @@ |
5 | nux::Geometry const& view_content_geo(view_->GetContentGeometry()); |
6 | |
7 | nux::Geometry geo(window_geo.x, window_geo.y, view_content_geo.width, view_content_geo.height); |
8 | - geo.width += style.GetDashRightTileWidth(); |
9 | - geo.height += style.GetDashBottomTileHeight(); |
10 | + geo.width += style.GetDashRightTileWidth().CP(view_->scale()); |
11 | + geo.height += style.GetDashBottomTileHeight().CP(view_->scale()); |
12 | return geo; |
13 | } |
14 | |
15 | |
16 | === modified file 'dash/DashView.cpp' |
17 | --- dash/DashView.cpp 2014-07-10 11:23:34 +0000 |
18 | +++ dash/DashView.cpp 2014-07-10 11:23:35 +0000 |
19 | @@ -36,7 +36,6 @@ |
20 | #include "unity-shared/DashStyle.h" |
21 | #include "unity-shared/KeyboardUtil.h" |
22 | #include "unity-shared/PreviewStyle.h" |
23 | -#include "unity-shared/RawPixel.h" |
24 | #include "unity-shared/UBusMessages.h" |
25 | #include "unity-shared/UnitySettings.h" |
26 | #include "unity-shared/WindowManager.h" |
27 | @@ -493,6 +492,7 @@ |
28 | |
29 | overlay_window_buttons_->Show(); |
30 | |
31 | + renderer_.scale = scale(); |
32 | renderer_.UpdateBlurBackgroundSize(content_geo_, GetRenderAbsoluteGeometry(), false); |
33 | renderer_.AboutToShow(); |
34 | } |
35 | @@ -500,7 +500,7 @@ |
36 | void DashView::AboutToHide() |
37 | { |
38 | if (BackgroundEffectHelper::blur_type == BLUR_STATIC) |
39 | - { |
40 | + { |
41 | content_geo_ = {0, 0, 0, 0}; |
42 | renderer_.UpdateBlurBackgroundSize(content_geo_, GetRenderAbsoluteGeometry(), false); |
43 | } |
44 | @@ -589,6 +589,7 @@ |
45 | |
46 | search_bar_->scale = scale; |
47 | scope_bar_->scale = scale; |
48 | + renderer_.scale = scale; |
49 | |
50 | if (preview_container_) |
51 | preview_container_->scale = scale; |
52 | @@ -600,21 +601,16 @@ |
53 | { |
54 | dash::Style const& style = dash::Style::Instance(); |
55 | |
56 | - RawPixel const v_separator_size = style.GetVSeparatorSize(); |
57 | - RawPixel const h_separator_size = style.GetHSeparatorSize(); |
58 | - RawPixel const view_top_padding = style.GetDashViewTopPadding(); |
59 | - |
60 | - RawPixel const search_bar_left_padding = style.GetSearchBarLeftPadding(); |
61 | - RawPixel const search_bar_height = style.GetSearchBarHeight(); |
62 | - |
63 | - layout_->SetLeftAndRightPadding(v_separator_size.CP(scale), 0); |
64 | - layout_->SetTopAndBottomPadding(h_separator_size.CP(scale), 0); |
65 | - |
66 | - content_layout_->SetTopAndBottomPadding(view_top_padding.CP(scale), 0); |
67 | - |
68 | - search_bar_layout_->SetLeftAndRightPadding(search_bar_left_padding.CP(scale), 0); |
69 | - search_bar_->SetMinimumHeight(search_bar_height.CP(scale)); |
70 | - search_bar_->SetMaximumHeight(search_bar_height.CP(scale)); |
71 | + layout_->SetLeftAndRightPadding(style.GetVSeparatorSize().CP(scale), 0); |
72 | + layout_->SetTopAndBottomPadding(style.GetHSeparatorSize().CP(scale), 0); |
73 | + |
74 | + content_layout_->SetTopAndBottomPadding(style.GetDashViewTopPadding().CP(scale), 0); |
75 | + |
76 | + search_bar_layout_->SetLeftAndRightPadding(style.GetSearchBarLeftPadding().CP(scale), 0); |
77 | + |
78 | + int search_bar_height = style.GetSearchBarHeight().CP(scale); |
79 | + search_bar_->SetMinimumHeight(search_bar_height); |
80 | + search_bar_->SetMaximumHeight(search_bar_height); |
81 | } |
82 | |
83 | void DashView::SetupUBusConnections() |
84 | @@ -635,7 +631,7 @@ |
85 | content_geo_ = GetBestFitGeometry(geo); |
86 | dash::Style& style = dash::Style::Instance(); |
87 | |
88 | - RawPixel const top_padding = style.GetDashViewTopPadding(); |
89 | + int top_padding = style.GetDashViewTopPadding().CP(scale); |
90 | |
91 | // kinda hacky, but it makes sure the content isn't so big that it throws |
92 | // the bottom of the dash off the screen |
93 | @@ -643,18 +639,17 @@ |
94 | scopes_layout_->SetMaximumHeight (std::max(0, content_geo_.height - |
95 | search_bar_->GetGeometry().height - |
96 | scope_bar_->GetGeometry().height - |
97 | - top_padding.CP(scale))); |
98 | + top_padding)); |
99 | |
100 | scopes_layout_->SetMinimumHeight (std::max(0, content_geo_.height - |
101 | search_bar_->GetGeometry().height - |
102 | scope_bar_->GetGeometry().height - |
103 | - top_padding.CP(scale))); |
104 | + top_padding)); |
105 | |
106 | layout_->SetMinMaxSize(content_geo_.width, content_geo_.y + content_geo_.height); |
107 | |
108 | // Minus the padding that gets added to the left |
109 | - RawPixel const tile_width = style.GetTileWidth(); |
110 | - style.SetDefaultNColumns(floorf((content_geo_.width - (32_em).CP(scale)) / tile_width.CP(scale))); |
111 | + style.columns_number = floorf((content_geo_.width - (32_em).CP(scale)) / style.GetTileWidth().CP(scale)); |
112 | |
113 | ubus_manager_.SendMessage(UBUS_DASH_SIZE_CHANGED, g_variant_new("(ii)", content_geo_.width, content_geo_.height)); |
114 | |
115 | @@ -675,33 +670,24 @@ |
116 | int panel_height = renderer_.y_offset; |
117 | |
118 | int width = 0, height = 0; |
119 | - RawPixel const tile_width = style.GetTileWidth(); |
120 | - RawPixel const tile_height = style.GetTileHeight(); |
121 | - RawPixel const group_top_space = style.GetPlacesGroupTopSpace(); |
122 | - RawPixel const category_icon_size = style.GetCategoryIconSize(); |
123 | - RawPixel const group_top_padding = style.GetPlacesGroupResultTopPadding(); |
124 | + int tile_width = style.GetTileWidth().CP(scale); |
125 | |
126 | - int category_height = (group_top_space.CP(scale) + category_icon_size.CP(scale) + |
127 | - group_top_padding.CP(scale) + tile_height.CP(scale)); |
128 | + int category_height = (style.GetPlacesGroupTopSpace().CP(scale) + |
129 | + style.GetCategoryIconSize().CP(scale) + |
130 | + style.GetPlacesGroupResultTopPadding().CP(scale) + |
131 | + style.GetTileHeight().CP(scale)); |
132 | |
133 | int half = for_geo.width / 2; |
134 | |
135 | // if default dash size is bigger than half a screens worth of items, go for that. |
136 | - while ((width += tile_width.CP(scale)) < half) |
137 | - ; |
138 | - |
139 | - RawPixel const v_separator_size = style.GetVSeparatorSize(); |
140 | - RawPixel const group_left_padding = style.GetPlacesGroupResultLeftPadding(); |
141 | - |
142 | - width = std::max(width, tile_width.CP(scale) * DASH_TILE_HORIZONTAL_COUNT); |
143 | - width += v_separator_size.CP(scale); |
144 | - width += group_left_padding.CP(scale) + DASH_RESULT_RIGHT_PAD.CP(scale); |
145 | - |
146 | - RawPixel const h_separator_size = style.GetHSeparatorSize(); |
147 | - RawPixel const top_padding = style.GetDashViewTopPadding(); |
148 | - |
149 | - height = h_separator_size.CP(scale); |
150 | - height += top_padding.CP(scale); |
151 | + while ((width += tile_width) < half); |
152 | + |
153 | + width = std::max(width, tile_width * DASH_TILE_HORIZONTAL_COUNT); |
154 | + width += style.GetVSeparatorSize().CP(scale); |
155 | + width += style.GetPlacesGroupResultLeftPadding().CP(scale) + DASH_RESULT_RIGHT_PAD.CP(scale); |
156 | + |
157 | + height = style.GetHSeparatorSize().CP(scale); |
158 | + height += style.GetDashViewTopPadding().CP(scale); |
159 | height += search_bar_->GetGeometry().height; |
160 | height += category_height * DASH_DEFAULT_CATEGORY_COUNT; // adding three categories |
161 | height += scope_bar_->GetGeometry().height; |
162 | @@ -1145,11 +1131,8 @@ |
163 | if (Settings::Instance().form_factor() == FormFactor::DESKTOP) |
164 | { |
165 | dash::Style& style = dash::Style::Instance(); |
166 | - RawPixel const right_title_width = style.GetDashRightTileWidth(); |
167 | - RawPixel const bottom_title_width = style.GetDashBottomTileHeight(); |
168 | - |
169 | - geo.width += right_title_width.CP(scale); |
170 | - geo.height += bottom_title_width.CP(scale); |
171 | + geo.width += style.GetDashRightTileWidth().CP(scale); |
172 | + geo.height += style.GetDashBottomTileHeight().CP(scale); |
173 | } |
174 | } |
175 | |
176 | @@ -1509,9 +1492,6 @@ |
177 | int num_rows = 1; // The search bar |
178 | std::vector<bool> button_on_monitor; |
179 | |
180 | - RawPixel const right_title_width = style.GetDashRightTileWidth(); |
181 | - RawPixel const bottom_title_width = style.GetDashBottomTileHeight(); |
182 | - |
183 | if (active_scope_view_.IsValid()) |
184 | num_rows += active_scope_view_->GetNumRows(); |
185 | |
186 | @@ -1530,8 +1510,8 @@ |
187 | introspection.add(nux::Geometry(GetAbsoluteX(), GetAbsoluteY(), content_geo_.width, content_geo_.height)) |
188 | .add("num_rows", num_rows) |
189 | .add("form_factor", form_factor) |
190 | - .add("right-border-width", right_title_width.CP(scale)) |
191 | - .add("bottom-border-height", bottom_title_width.CP(scale)) |
192 | + .add("right-border-width", style.GetDashRightTileWidth().CP(scale)) |
193 | + .add("bottom-border-height", style.GetDashBottomTileHeight().CP(scale)) |
194 | .add("preview_displaying", preview_displaying_) |
195 | .add("preview_animation", animate_split_value_ * animate_preview_container_value_ * animate_preview_value_) |
196 | .add("dash_maximized", style.always_maximised()) |
197 | |
198 | === modified file 'dash/FilterExpanderLabel.cpp' |
199 | --- dash/FilterExpanderLabel.cpp 2014-03-20 04:05:39 +0000 |
200 | +++ dash/FilterExpanderLabel.cpp 2014-07-10 11:23:35 +0000 |
201 | @@ -22,7 +22,6 @@ |
202 | |
203 | #include "unity-shared/DashStyle.h" |
204 | #include "unity-shared/GraphicsUtils.h" |
205 | -#include "unity-shared/RawPixel.h" |
206 | #include "FilterExpanderLabel.h" |
207 | |
208 | namespace |
209 | |
210 | === modified file 'dash/PlacesGroup.cpp' |
211 | --- dash/PlacesGroup.cpp 2014-07-10 11:23:34 +0000 |
212 | +++ dash/PlacesGroup.cpp 2014-07-10 11:23:35 +0000 |
213 | @@ -33,7 +33,6 @@ |
214 | #include "unity-shared/UBusWrapper.h" |
215 | #include "unity-shared/UBusMessages.h" |
216 | #include "unity-shared/GraphicsUtils.h" |
217 | -#include "unity-shared/RawPixel.h" |
218 | |
219 | #include "ResultView.h" |
220 | #include "ResultViewGrid.h" |
221 | @@ -158,11 +157,10 @@ |
222 | _group_layout->AddView(_header_view, 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL); |
223 | |
224 | _header_layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
225 | - _header_layout->SetLeftAndRightPadding(_style.GetCategoryHeaderLeftPadding(), 0); |
226 | + _header_layout->SetLeftAndRightPadding(_style.GetCategoryHeaderLeftPadding().CP(scale), 0); |
227 | _header_view->SetLayout(_header_layout); |
228 | |
229 | - RawPixel const icon_size = _style.GetCategoryIconSize(); |
230 | - _icon = new IconTexture("", icon_size.CP(scale())); |
231 | + _icon = new IconTexture("", _style.GetCategoryIconSize().CP(scale)); |
232 | _header_layout->AddView(_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); |
233 | |
234 | _text_layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
235 | @@ -223,17 +221,16 @@ |
236 | void |
237 | PlacesGroup::UpdatePlacesGroupSize() |
238 | { |
239 | - RawPixel const icon_size = _style.GetCategoryIconSize(); |
240 | - RawPixel const group_top = _style.GetPlacesGroupTopSpace(); |
241 | + int icon_size = _style.GetCategoryIconSize().CP(scale); |
242 | + int top_space = _style.GetPlacesGroupTopSpace().CP(scale); |
243 | |
244 | - int top_space = group_top.CP(scale()); |
245 | _space_layout->SetMinimumSize(top_space, top_space); |
246 | _space_layout->SetMaximumSize(top_space, top_space); |
247 | |
248 | _header_layout->SetSpaceBetweenChildren(SPACE_BETWEEN_CHILDREN.CP(scale())); |
249 | - _header_layout->SetLeftAndRightPadding(RawPixel(_style.GetCategoryHeaderLeftPadding()).CP(scale), 0); |
250 | + _header_layout->SetLeftAndRightPadding(_style.GetCategoryHeaderLeftPadding().CP(scale), 0); |
251 | |
252 | - _icon->SetMinMaxSize(icon_size.CP(scale()), icon_size.CP(scale())); |
253 | + _icon->SetMinMaxSize(icon_size, icon_size); |
254 | |
255 | _text_layout->SetHorizontalInternalMargin(TEXT_INTERNAL_MARGIN.CP(scale())); |
256 | _expand_layout->SetHorizontalInternalMargin(EXPAND_INTERNAL_MARGIN.CP(scale())); |
257 | @@ -242,14 +239,12 @@ |
258 | void |
259 | PlacesGroup::UpdateScale(double scale) |
260 | { |
261 | - RawPixel const icon_size = _style.GetCategoryIconSize(); |
262 | - |
263 | _name->SetMinimumSize(nux::AREA_MIN_WIDTH, nux::AREA_MIN_HEIGHT); |
264 | _name->SetMaximumSize(nux::AREA_MAX_WIDTH, nux::AREA_MAX_HEIGHT); |
265 | _name->SetScale(scale); |
266 | _expand_label->SetScale(scale); |
267 | |
268 | - _icon->SetSize(icon_size.CP(scale)); |
269 | + _icon->SetSize(_style.GetCategoryIconSize().CP(scale)); |
270 | _icon->ReLoadIcon(); |
271 | |
272 | auto const& arrow = _expand_icon->texture(); |
273 | @@ -313,7 +308,7 @@ |
274 | void |
275 | PlacesGroup::SetIcon(std::string const& path_to_emblem) |
276 | { |
277 | - _icon->SetByIconName(path_to_emblem, RawPixel(_style.GetCategoryIconSize()).CP(scale)); |
278 | + _icon->SetByIconName(path_to_emblem, _style.GetCategoryIconSize().CP(scale)); |
279 | } |
280 | |
281 | void |
282 | @@ -321,11 +316,8 @@ |
283 | { |
284 | if (_child_layout) |
285 | { |
286 | - RawPixel const result_top_padding = _style.GetPlacesGroupResultTopPadding(); |
287 | - RawPixel const result_left_padding = _style.GetPlacesGroupResultLeftPadding(); |
288 | - |
289 | - _child_layout->SetTopAndBottomPadding(result_top_padding.CP(scale()), 0); |
290 | - _child_layout->SetLeftAndRightPadding(result_left_padding.CP(scale()), 0); |
291 | + _child_layout->SetTopAndBottomPadding(_style.GetPlacesGroupResultTopPadding().CP(scale), 0); |
292 | + _child_layout->SetLeftAndRightPadding(_style.GetPlacesGroupResultLeftPadding().CP(scale), 0); |
293 | } |
294 | } |
295 | |
296 | |
297 | === modified file 'dash/ResultRendererTile.cpp' |
298 | --- dash/ResultRendererTile.cpp 2014-05-03 17:57:47 +0000 |
299 | +++ dash/ResultRendererTile.cpp 2014-07-10 11:23:35 +0000 |
300 | @@ -31,7 +31,6 @@ |
301 | #include "unity-shared/CairoTexture.h" |
302 | #include "unity-shared/DashStyle.h" |
303 | #include "unity-shared/TextureCache.h" |
304 | -#include "unity-shared/RawPixel.h" |
305 | #include "unity-shared/UnitySettings.h" |
306 | |
307 | namespace unity |
308 | @@ -120,13 +119,7 @@ |
309 | return; |
310 | |
311 | dash::Style const& style = dash::Style::Instance(); |
312 | - RawPixel const tile_size = style.GetTileImageSize(); |
313 | - RawPixel const tile_width = style.GetTileWidth(); |
314 | - RawPixel const tile_height = style.GetTileHeight(); |
315 | - RawPixel const tile_highlight_width = style.GetTileIconHightlightWidth(); |
316 | - RawPixel const tile_highlight_height = style.GetTileIconHightlightHeight(); |
317 | - |
318 | - int tile_icon_size = tile_size.CP(scale()); |
319 | + int tile_icon_size = style.GetTileImageSize().CP(scale); |
320 | |
321 | // set up our texture mode |
322 | nux::TexCoordXForm texxform; |
323 | @@ -148,8 +141,8 @@ |
324 | // render highlight if its needed |
325 | if (container->prelight && state != ResultRendererState::RESULT_RENDERER_NORMAL) |
326 | { |
327 | - int highlight_x = (geometry.x + geometry.width/2) - tile_highlight_width.CP(scale())/2; |
328 | - int highlight_y = (geometry.y + PADDING.CP(scale()) + tile_icon_size / 2) - tile_highlight_height.CP(scale())/2; |
329 | + int highlight_x = (geometry.x + geometry.width/2) - style.GetTileIconHightlightWidth().CP(scale)/2; |
330 | + int highlight_y = (geometry.y + PADDING.CP(scale) + tile_icon_size / 2) - style.GetTileIconHightlightHeight().CP(scale)/2; |
331 | |
332 | RenderTexture(GfxContext, |
333 | highlight_x, |
334 | @@ -179,10 +172,10 @@ |
335 | if (container->text) |
336 | { |
337 | RenderTexture(GfxContext, |
338 | - geometry.x + PADDING.CP(scale()), |
339 | - geometry.y + tile_icon_size + SPACING.CP(scale()), |
340 | - tile_width.CP(scale()) - (PADDING.CP(scale()) * 2), |
341 | - tile_height.CP(scale()) - tile_icon_size - SPACING.CP(scale()), |
342 | + geometry.x + PADDING.CP(scale), |
343 | + geometry.y + tile_icon_size + SPACING.CP(scale), |
344 | + style.GetTileWidth().CP(scale) - (PADDING.CP(scale) * 2), |
345 | + style.GetTileHeight().CP(scale) - tile_icon_size - SPACING.CP(scale), |
346 | container->text->GetDeviceTexture(), |
347 | texxform, |
348 | color, |
349 | @@ -273,10 +266,8 @@ |
350 | void ResultRendererTile::LoadIcon(Result const& row) |
351 | { |
352 | Style const& style = Style::Instance(); |
353 | - RawPixel const tile_size = style.GetTileImageSize(); |
354 | - RawPixel const tile_gsize = style.GetTileGIconSize(); |
355 | - RawPixel const tile_highlight_width = style.GetTileIconHightlightWidth(); |
356 | - RawPixel const tile_highlight_height = style.GetTileIconHightlightHeight(); |
357 | + int tile_size = style.GetTileImageSize().CP(scale); |
358 | + int tile_gsize = style.GetTileGIconSize().CP(scale); |
359 | |
360 | std::string const& icon_hint = row.icon_hint; |
361 | std::string const& icon_name = !icon_hint.empty() ? icon_hint : DEFAULT_GICON; |
362 | @@ -288,8 +279,8 @@ |
363 | { |
364 | TextureCache& cache = TextureCache::GetDefault(); |
365 | BaseTexturePtr texture_prelight(cache.FindTexture("resultview_prelight", |
366 | - tile_highlight_width.CP(scale()), |
367 | - tile_highlight_height.CP(scale()), |
368 | + style.GetTileIconHightlightWidth().CP(scale), |
369 | + style.GetTileIconHightlightHeight().CP(scale), |
370 | sigc::mem_fun(this, &ResultRendererTile::DrawHighlight))); |
371 | container->prelight = texture_prelight; |
372 | } |
373 | @@ -300,13 +291,13 @@ |
374 | { |
375 | bool use_large_icon = icon.IsType(G_TYPE_FILE_ICON) || !icon.IsType(G_TYPE_THEMED_ICON); |
376 | container->slot_handle = IconLoader::GetDefault().LoadFromGIconString(icon_name, |
377 | - tile_size.CP(scale()), |
378 | + tile_size, |
379 | use_large_icon ? |
380 | - tile_size.CP(scale()) : tile_gsize.CP(scale()), slot); |
381 | + tile_size : tile_gsize, slot); |
382 | } |
383 | else |
384 | { |
385 | - container->slot_handle = IconLoader::GetDefault().LoadFromIconName(icon_name, -1, tile_gsize.CP(scale()), slot); |
386 | + container->slot_handle = IconLoader::GetDefault().LoadFromIconName(icon_name, -1, tile_gsize, slot); |
387 | } |
388 | } |
389 | |
390 | @@ -333,15 +324,12 @@ |
391 | } |
392 | else |
393 | { |
394 | - Style const& style = Style::Instance(); |
395 | - RawPixel const tile_size = style.GetTileImageSize(); |
396 | - |
397 | // slow path for non square icons that must be resized to fit in the square |
398 | // texture |
399 | float aspect = static_cast<float>(pixbuf_height) / pixbuf_width; // already sanitized width/height so can not be 0.0 |
400 | if (aspect < 1.0f) |
401 | { |
402 | - pixbuf_width = tile_size.CP(scale()); |
403 | + pixbuf_width = Style::Instance().GetTileImageSize().CP(scale); |
404 | pixbuf_height = pixbuf_width * aspect; |
405 | |
406 | if (pixbuf_height > height) |
407 | @@ -470,13 +458,10 @@ |
408 | void ResultRendererTile::LoadText(Result const& row) |
409 | { |
410 | Style const& style = Style::Instance(); |
411 | - RawPixel const tile_size = style.GetTileImageSize(); |
412 | - RawPixel const tile_width = style.GetTileWidth(); |
413 | - RawPixel const tile_height = style.GetTileHeight(); |
414 | |
415 | nux::CairoGraphics _cairoGraphics(CAIRO_FORMAT_ARGB32, |
416 | - tile_width.CP(scale()) - (PADDING.CP(scale()) * 2), |
417 | - tile_height.CP(scale()) - tile_size.CP(scale()) - SPACING.CP(scale())); |
418 | + style.GetTileWidth().CP(scale()) - (PADDING.CP(scale()) * 2), |
419 | + style.GetTileHeight().CP(scale()) - style.GetTileImageSize().CP(scale()) - SPACING.CP(scale())); |
420 | cairo_surface_set_device_scale(_cairoGraphics.GetSurface(), scale(), scale()); |
421 | |
422 | cairo_t* cr = _cairoGraphics.GetInternalContext(); |
423 | @@ -499,7 +484,7 @@ |
424 | |
425 | pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR); |
426 | pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_START); |
427 | - pango_layout_set_width(layout, (tile_width - (PADDING * 2))* PANGO_SCALE); |
428 | + pango_layout_set_width(layout, (style.GetTileWidth() - (PADDING * 2))* PANGO_SCALE); |
429 | pango_layout_set_height(layout, -2); |
430 | |
431 | // FIXME bug #1239381 |
432 | |
433 | === modified file 'dash/ScopeBar.cpp' |
434 | --- dash/ScopeBar.cpp 2014-03-20 04:05:39 +0000 |
435 | +++ dash/ScopeBar.cpp 2014-07-10 11:23:35 +0000 |
436 | @@ -27,7 +27,6 @@ |
437 | #include "unity-shared/StaticCairoText.h" |
438 | #include "unity-shared/CairoTexture.h" |
439 | #include "unity-shared/GraphicsUtils.h" |
440 | -#include "unity-shared/RawPixel.h" |
441 | #include "unity-shared/UBusMessages.h" |
442 | |
443 | namespace unity |
444 | |
445 | === modified file 'dash/ScopeBarIcon.cpp' |
446 | --- dash/ScopeBarIcon.cpp 2014-03-20 21:43:02 +0000 |
447 | +++ dash/ScopeBarIcon.cpp 2014-07-10 11:23:35 +0000 |
448 | @@ -17,7 +17,6 @@ |
449 | */ |
450 | |
451 | #include "unity-shared/DashStyle.h" |
452 | -#include "unity-shared/RawPixel.h" |
453 | #include "ScopeBarIcon.h" |
454 | |
455 | #include "config.h" |
456 | |
457 | === modified file 'dash/ScopeView.cpp' |
458 | --- dash/ScopeView.cpp 2014-07-10 11:23:34 +0000 |
459 | +++ dash/ScopeView.cpp 2014-07-10 11:23:35 +0000 |
460 | @@ -31,7 +31,6 @@ |
461 | #include "unity-shared/UBusWrapper.h" |
462 | #include "unity-shared/PlacesOverlayVScrollBar.h" |
463 | #include "unity-shared/GraphicsUtils.h" |
464 | -#include "unity-shared/RawPixel.h" |
465 | |
466 | #include "config.h" |
467 | #include <glib/gi18n-lib.h> |
468 | @@ -277,19 +276,17 @@ |
469 | { |
470 | dash::Style const& style = dash::Style::Instance(); |
471 | |
472 | - RawPixel const scope_filter_space = style.GetSpaceBetweenScopeAndFilters(); |
473 | - RawPixel const right_padding = style.GetFilterViewRightPadding(); |
474 | - RawPixel const filter_width = style.GetFilterBarWidth() + |
475 | - style.GetFilterBarLeftPadding() + |
476 | - style.GetFilterBarRightPadding(); |
477 | - |
478 | - double scale = this->scale(); |
479 | - layout_->SetSpaceBetweenChildren(scope_filter_space.CP(scale)); |
480 | - |
481 | - fscroll_view_->SetMinimumWidth(filter_width.CP(scale) + right_padding.CP(scale)); |
482 | - fscroll_view_->SetMaximumWidth(filter_width.CP(scale) + right_padding.CP(scale)); |
483 | - filter_bar_->SetMinimumWidth(filter_width.CP(scale)); |
484 | - filter_bar_->SetMaximumWidth(filter_width.CP(scale)); |
485 | + int right_padding = style.GetFilterViewRightPadding().CP(scale); |
486 | + int filter_width = style.GetFilterBarWidth().CP(scale) + |
487 | + style.GetFilterBarLeftPadding().CP(scale) + |
488 | + style.GetFilterBarRightPadding().CP(scale); |
489 | + |
490 | + layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenScopeAndFilters().CP(scale)); |
491 | + |
492 | + fscroll_view_->SetMinimumWidth(filter_width + right_padding); |
493 | + fscroll_view_->SetMaximumWidth(filter_width + right_padding); |
494 | + filter_bar_->SetMinimumWidth(filter_width); |
495 | + filter_bar_->SetMaximumWidth(filter_width); |
496 | } |
497 | |
498 | void ScopeView::UpdateScale(double scale) |
499 | |
500 | === modified file 'dash/previews/ActionButton.cpp' |
501 | --- dash/previews/ActionButton.cpp 2014-07-10 11:23:34 +0000 |
502 | +++ dash/previews/ActionButton.cpp 2014-07-10 11:23:35 +0000 |
503 | @@ -25,7 +25,6 @@ |
504 | #include <Nux/HLayout.h> |
505 | #include "unity-shared/IconTexture.h" |
506 | #include "unity-shared/StaticCairoText.h" |
507 | -#include "unity-shared/RawPixel.h" |
508 | |
509 | namespace unity |
510 | { |
511 | |
512 | === modified file 'hud/StandaloneHud.cpp' |
513 | --- hud/StandaloneHud.cpp 2013-11-14 03:00:29 +0000 |
514 | +++ hud/StandaloneHud.cpp 2014-07-10 11:23:35 +0000 |
515 | @@ -30,10 +30,13 @@ |
516 | #include "HudView.h" |
517 | #include "unity-shared/DashStyle.h" |
518 | #include "unity-shared/UnitySettings.h" |
519 | +#include "unity-shared/PanelStyle.h" |
520 | #include <NuxCore/Logger.h> |
521 | |
522 | DECLARE_LOGGER(logger, "unity.tests.hud"); |
523 | |
524 | +using namespace unity; |
525 | + |
526 | class TestRunner |
527 | { |
528 | public: |
529 | @@ -44,7 +47,6 @@ |
530 | void Init (); |
531 | nux::Layout *layout; |
532 | unity::hud::View* hud_view_; |
533 | - unity::Settings dash_settings_; |
534 | |
535 | private: |
536 | unity::hud::Hud hud_service_; |
537 | @@ -64,7 +66,7 @@ |
538 | LOG_WARNING(logger) << "test init"; |
539 | layout = new nux::VLayout(); |
540 | |
541 | - hud_view_ = new unity::hud::View(); |
542 | + hud_view_ = new hud::View(); |
543 | |
544 | layout->AddView (hud_view_, 1, nux::MINOR_POSITION_START); |
545 | nux::GetWindowCompositor().SetKeyFocusArea(hud_view_->default_focus()); |
546 | @@ -135,15 +137,16 @@ |
547 | gtk_init (&argc, &argv); |
548 | |
549 | nux::NuxInitialize(0); |
550 | - |
551 | + |
552 | // Slightly higher as we're more likely to test things we know will fail |
553 | nux::logging::configure_logging("unity.hud=debug"); |
554 | - |
555 | + |
556 | nux::logging::configure_logging(::getenv("UNITY_LOG_SEVERITY")); |
557 | LOG_DEBUG(logger) << "starting the standalone hud"; |
558 | // The instances for the pseudo-singletons. |
559 | unity::Settings settings; |
560 | - unity::dash::Style dash_style; |
561 | + panel::Style panel_style; |
562 | + dash::Style dash_style; |
563 | |
564 | TestRunner *test_runner = new TestRunner (); |
565 | wt = nux::CreateGUIThread(TEXT("Hud Prototype Test"), |
566 | |
567 | === modified file 'lockscreen/UserPromptView.cpp' |
568 | --- lockscreen/UserPromptView.cpp 2014-06-07 16:26:51 +0000 |
569 | +++ lockscreen/UserPromptView.cpp 2014-07-10 11:23:35 +0000 |
570 | @@ -24,7 +24,6 @@ |
571 | |
572 | #include "LockScreenSettings.h" |
573 | #include "unity-shared/CairoTexture.h" |
574 | -#include "unity-shared/DashStyle.h" |
575 | #include "unity-shared/TextInput.h" |
576 | #include "unity-shared/StaticCairoText.h" |
577 | #include "unity-shared/RawPixel.h" |
578 | |
579 | === modified file 'tests/test_places_group.cpp' |
580 | --- tests/test_places_group.cpp 2013-07-03 23:20:03 +0000 |
581 | +++ tests/test_places_group.cpp 2014-07-10 11:23:35 +0000 |
582 | @@ -46,12 +46,12 @@ |
583 | MOCK_METHOD0(GetGroupExpandIcon, nux::BaseTexture*()); |
584 | MOCK_METHOD0(GetGroupUnexpandIcon, nux::BaseTexture*()); |
585 | |
586 | - MOCK_CONST_METHOD0(GetCategoryIconSize, int()); |
587 | - MOCK_CONST_METHOD0(GetCategoryHeaderLeftPadding, int()); |
588 | + MOCK_CONST_METHOD0(GetCategoryIconSize, RawPixel()); |
589 | + MOCK_CONST_METHOD0(GetCategoryHeaderLeftPadding, RawPixel()); |
590 | |
591 | - MOCK_CONST_METHOD0(GetPlacesGroupTopSpace, int()); |
592 | - MOCK_CONST_METHOD0(GetPlacesGroupResultTopPadding, int()); |
593 | - MOCK_CONST_METHOD0(GetPlacesGroupResultLeftPadding, int()); |
594 | + MOCK_CONST_METHOD0(GetPlacesGroupTopSpace, RawPixel()); |
595 | + MOCK_CONST_METHOD0(GetPlacesGroupResultTopPadding, RawPixel()); |
596 | + MOCK_CONST_METHOD0(GetPlacesGroupResultLeftPadding, RawPixel()); |
597 | |
598 | nux::ObjectPtr<nux::BaseTexture> base_texture_; |
599 | }; |
600 | @@ -85,10 +85,19 @@ |
601 | .WillByDefault(Return(dash_style_.base_texture_.GetPointer())); |
602 | |
603 | ON_CALL(dash_style_, GetCategoryHeaderLeftPadding()) |
604 | - .WillByDefault(Return(19)); |
605 | + .WillByDefault(Return(19_em)); |
606 | |
607 | ON_CALL(dash_style_, GetPlacesGroupTopSpace()) |
608 | - .WillByDefault(Return(7)); |
609 | + .WillByDefault(Return(7_em)); |
610 | + |
611 | + ON_CALL(dash_style_, GetCategoryIconSize()) |
612 | + .WillByDefault(Return(0_em)); |
613 | + |
614 | + ON_CALL(dash_style_, GetPlacesGroupResultTopPadding()) |
615 | + .WillByDefault(Return(0_em)); |
616 | + |
617 | + ON_CALL(dash_style_, GetPlacesGroupResultLeftPadding()) |
618 | + .WillByDefault(Return(0_em)); |
619 | } |
620 | |
621 | NiceMock<MockDashStyle> dash_style_; |
622 | |
623 | === modified file 'unity-shared/DashStyle.cpp' |
624 | --- unity-shared/DashStyle.cpp 2014-07-10 11:23:34 +0000 |
625 | +++ unity-shared/DashStyle.cpp 2014-07-10 11:23:35 +0000 |
626 | @@ -217,7 +217,6 @@ |
627 | |
628 | int text_width_; |
629 | int text_height_; |
630 | - int number_of_columns_; |
631 | |
632 | LazyLoadTexture category_texture_; |
633 | LazyLoadTexture category_texture_no_filters_; |
634 | @@ -268,7 +267,6 @@ |
635 | , text_color_(nux::color::White) |
636 | , text_width_(0) |
637 | , text_height_(0) |
638 | - , number_of_columns_(6) |
639 | , category_texture_("/category_gradient.png") |
640 | , category_texture_no_filters_("/category_gradient_no_refine.png") |
641 | , dash_bottom_texture_("/dash_bottom_border_tile.png") |
642 | @@ -437,7 +435,8 @@ |
643 | } |
644 | |
645 | Style::Style() |
646 | - : always_maximised(false) |
647 | + : columns_number(6) |
648 | + , always_maximised(false) |
649 | , pimpl(new Impl(this)) |
650 | { |
651 | if (style_instance) |
652 | @@ -2126,7 +2125,7 @@ |
653 | return true; |
654 | } |
655 | |
656 | -int Style::GetButtonGarnishSize() |
657 | +RawPixel Style::GetButtonGarnishSize() const |
658 | { |
659 | int maxBlurSize = 0; |
660 | |
661 | @@ -2139,12 +2138,12 @@ |
662 | return 2 * maxBlurSize; |
663 | } |
664 | |
665 | -int Style::GetSeparatorGarnishSize() |
666 | +RawPixel Style::GetSeparatorGarnishSize() const |
667 | { |
668 | return pimpl->separator_blur_size_; |
669 | } |
670 | |
671 | -int Style::GetScrollbarGarnishSize() |
672 | +RawPixel Style::GetScrollbarGarnishSize() const |
673 | { |
674 | return pimpl->scrollbar_blur_size_; |
675 | } |
676 | @@ -2154,68 +2153,53 @@ |
677 | return pimpl->text_color_; |
678 | } |
679 | |
680 | -int Style::GetDefaultNColumns() const |
681 | -{ |
682 | - return pimpl->number_of_columns_; |
683 | -} |
684 | - |
685 | -void Style::SetDefaultNColumns(int n_cols) |
686 | -{ |
687 | - if (pimpl->number_of_columns_ == n_cols) |
688 | - return; |
689 | - |
690 | - pimpl->number_of_columns_ = n_cols; |
691 | - |
692 | - columns_changed.emit(); |
693 | -} |
694 | - |
695 | -int Style::GetTileGIconSize() const |
696 | +RawPixel Style::GetTileGIconSize() const |
697 | { |
698 | return 64; |
699 | } |
700 | |
701 | -int Style::GetTileImageSize() const |
702 | +RawPixel Style::GetTileImageSize() const |
703 | { |
704 | return 96; |
705 | } |
706 | |
707 | -int Style::GetTileWidth() const |
708 | +RawPixel Style::GetTileWidth() const |
709 | { |
710 | return std::max(pimpl->text_width_, 150); |
711 | } |
712 | |
713 | -int Style::GetTileHeight() const |
714 | +RawPixel Style::GetTileHeight() const |
715 | { |
716 | return std::max(GetTileImageSize() + (pimpl->text_height_ * 2) + 15, |
717 | GetTileImageSize() + 32); // magic design numbers. |
718 | } |
719 | |
720 | -int Style::GetTileIconHightlightHeight() const |
721 | -{ |
722 | - return 106; |
723 | -} |
724 | - |
725 | -int Style::GetTileIconHightlightWidth() const |
726 | -{ |
727 | - return 106; |
728 | -} |
729 | - |
730 | -int Style::GetHomeTileIconSize() const |
731 | +RawPixel Style::GetTileIconHightlightHeight() const |
732 | +{ |
733 | + return 106; |
734 | +} |
735 | + |
736 | +RawPixel Style::GetTileIconHightlightWidth() const |
737 | +{ |
738 | + return 106; |
739 | +} |
740 | + |
741 | +RawPixel Style::GetHomeTileIconSize() const |
742 | { |
743 | return 104; |
744 | } |
745 | |
746 | -int Style::GetHomeTileWidth() const |
747 | +RawPixel Style::GetHomeTileWidth() const |
748 | { |
749 | return pimpl->text_width_ * 1.2; |
750 | } |
751 | |
752 | -int Style::GetHomeTileHeight() const |
753 | +RawPixel Style::GetHomeTileHeight() const |
754 | { |
755 | return GetHomeTileIconSize() + (pimpl->text_height_ * 5); |
756 | } |
757 | |
758 | -int Style::GetTextLineHeight() const |
759 | +RawPixel Style::GetTextLineHeight() const |
760 | { |
761 | return pimpl->text_height_; |
762 | } |
763 | @@ -2366,149 +2350,147 @@ |
764 | return pimpl->dash_shine_.texture(); |
765 | } |
766 | |
767 | -int Style::GetDashBottomTileHeight() const |
768 | -{ |
769 | - return 30; |
770 | -} |
771 | - |
772 | -int Style::GetDashRightTileWidth() const |
773 | -{ |
774 | - return 30; |
775 | -} |
776 | - |
777 | -int Style::GetVSeparatorSize() const |
778 | -{ |
779 | - return 1; |
780 | -} |
781 | - |
782 | -int Style::GetHSeparatorSize() const |
783 | -{ |
784 | - return 1; |
785 | - |
786 | -} |
787 | - |
788 | -int Style::GetFilterBarWidth() const |
789 | +RawPixel Style::GetDashBottomTileHeight() const |
790 | +{ |
791 | + return 30; |
792 | +} |
793 | + |
794 | +RawPixel Style::GetDashRightTileWidth() const |
795 | +{ |
796 | + return 30; |
797 | +} |
798 | + |
799 | +RawPixel Style::GetVSeparatorSize() const |
800 | +{ |
801 | + return 1; |
802 | +} |
803 | + |
804 | +RawPixel Style::GetHSeparatorSize() const |
805 | +{ |
806 | + return 1; |
807 | +} |
808 | + |
809 | +RawPixel Style::GetFilterBarWidth() const |
810 | { |
811 | return 300; |
812 | } |
813 | |
814 | - |
815 | -int Style::GetFilterBarLeftPadding() const |
816 | -{ |
817 | - return 5; |
818 | -} |
819 | - |
820 | -int Style::GetFilterBarRightPadding() const |
821 | -{ |
822 | - return 5; |
823 | -} |
824 | - |
825 | -int Style::GetDashViewTopPadding() const |
826 | -{ |
827 | - return 10; |
828 | -} |
829 | - |
830 | -int Style::GetSearchBarLeftPadding() const |
831 | -{ |
832 | - return 10; |
833 | -} |
834 | - |
835 | -int Style::GetSearchBarRightPadding() const |
836 | -{ |
837 | - return 10; |
838 | -} |
839 | - |
840 | -int Style::GetSearchBarHeight() const |
841 | +RawPixel Style::GetFilterBarLeftPadding() const |
842 | +{ |
843 | + return 5; |
844 | +} |
845 | + |
846 | +RawPixel Style::GetFilterBarRightPadding() const |
847 | +{ |
848 | + return 5; |
849 | +} |
850 | + |
851 | +RawPixel Style::GetDashViewTopPadding() const |
852 | +{ |
853 | + return 10; |
854 | +} |
855 | + |
856 | +RawPixel Style::GetSearchBarLeftPadding() const |
857 | +{ |
858 | + return 10; |
859 | +} |
860 | + |
861 | +RawPixel Style::GetSearchBarRightPadding() const |
862 | +{ |
863 | + return 10; |
864 | +} |
865 | + |
866 | +RawPixel Style::GetSearchBarHeight() const |
867 | { |
868 | return 42; |
869 | } |
870 | |
871 | -int Style::GetFilterResultsHighlightRightPadding() const |
872 | -{ |
873 | - return 5; |
874 | -} |
875 | - |
876 | -int Style::GetFilterResultsHighlightLeftPadding() const |
877 | -{ |
878 | - return 5; |
879 | -} |
880 | - |
881 | -int Style::GetFilterBarTopPadding() const |
882 | +RawPixel Style::GetFilterResultsHighlightRightPadding() const |
883 | +{ |
884 | + return 5; |
885 | +} |
886 | + |
887 | +RawPixel Style::GetFilterResultsHighlightLeftPadding() const |
888 | +{ |
889 | + return 5; |
890 | +} |
891 | + |
892 | +RawPixel Style::GetFilterBarTopPadding() const |
893 | { |
894 | return 10; |
895 | } |
896 | |
897 | -int Style::GetFilterHighlightPadding() const |
898 | +RawPixel Style::GetFilterHighlightPadding() const |
899 | { |
900 | return 2; |
901 | } |
902 | |
903 | -int Style::GetSpaceBetweenFilterWidgets() const |
904 | +RawPixel Style::GetSpaceBetweenFilterWidgets() const |
905 | { |
906 | return 12; |
907 | } |
908 | |
909 | -int Style::GetAllButtonHeight() const |
910 | -{ |
911 | - return 30; |
912 | -} |
913 | - |
914 | -int Style::GetFilterButtonHeight() const |
915 | -{ |
916 | - return 30; |
917 | -} |
918 | - |
919 | -int Style::GetSpaceBetweenScopeAndFilters() const |
920 | -{ |
921 | - return 10; |
922 | -} |
923 | - |
924 | -int Style::GetFilterViewRightPadding() const |
925 | -{ |
926 | - return 10; |
927 | -} |
928 | - |
929 | -int Style::GetScrollbarWidth() const |
930 | +RawPixel Style::GetAllButtonHeight() const |
931 | +{ |
932 | + return 30; |
933 | +} |
934 | + |
935 | +RawPixel Style::GetFilterButtonHeight() const |
936 | +{ |
937 | + return 30; |
938 | +} |
939 | + |
940 | +RawPixel Style::GetSpaceBetweenScopeAndFilters() const |
941 | +{ |
942 | + return 10; |
943 | +} |
944 | + |
945 | +RawPixel Style::GetFilterViewRightPadding() const |
946 | +{ |
947 | + return 10; |
948 | +} |
949 | + |
950 | +RawPixel Style::GetScrollbarWidth() const |
951 | { |
952 | return 3; |
953 | } |
954 | |
955 | -int Style::GetCategoryIconSize() const |
956 | +RawPixel Style::GetCategoryIconSize() const |
957 | { |
958 | return 22; |
959 | } |
960 | |
961 | -int Style::GetCategoryHighlightHeight() const |
962 | +RawPixel Style::GetCategoryHighlightHeight() const |
963 | { |
964 | return 24; |
965 | } |
966 | |
967 | -int Style::GetPlacesGroupTopSpace() const |
968 | +RawPixel Style::GetPlacesGroupTopSpace() const |
969 | { |
970 | return 7; |
971 | } |
972 | |
973 | -int Style::GetPlacesGroupResultTopPadding() const |
974 | +RawPixel Style::GetPlacesGroupResultTopPadding() const |
975 | { |
976 | return 2; |
977 | } |
978 | |
979 | -int Style::GetPlacesGroupResultLeftPadding() const |
980 | +RawPixel Style::GetPlacesGroupResultLeftPadding() const |
981 | { |
982 | return 25; |
983 | } |
984 | |
985 | -int Style::GetCategoryHeaderLeftPadding() const |
986 | +RawPixel Style::GetCategoryHeaderLeftPadding() const |
987 | { |
988 | return 19; |
989 | } |
990 | |
991 | -int Style::GetCategorySeparatorLeftPadding() const |
992 | +RawPixel Style::GetCategorySeparatorLeftPadding() const |
993 | { |
994 | return 15; |
995 | } |
996 | |
997 | -int Style::GetCategorySeparatorRightPadding() const |
998 | +RawPixel Style::GetCategorySeparatorRightPadding() const |
999 | { |
1000 | return 15; |
1001 | } |
1002 | |
1003 | === modified file 'unity-shared/DashStyle.h' |
1004 | --- unity-shared/DashStyle.h 2013-02-19 15:07:36 +0000 |
1005 | +++ unity-shared/DashStyle.h 2014-07-10 11:23:35 +0000 |
1006 | @@ -135,11 +135,11 @@ |
1007 | |
1008 | virtual bool SeparatorHoriz(cairo_t* cr); |
1009 | |
1010 | - virtual int GetButtonGarnishSize(); |
1011 | - |
1012 | - virtual int GetSeparatorGarnishSize(); |
1013 | - |
1014 | - virtual int GetScrollbarGarnishSize(); |
1015 | + RawPixel GetButtonGarnishSize() const; |
1016 | + |
1017 | + RawPixel GetSeparatorGarnishSize() const; |
1018 | + |
1019 | + RawPixel GetScrollbarGarnishSize() const; |
1020 | |
1021 | void Blur(cairo_t* cr, int size); |
1022 | |
1023 | @@ -153,23 +153,18 @@ |
1024 | |
1025 | nux::Color const& GetTextColor() const; |
1026 | |
1027 | - // TODO nux::Property<int> |
1028 | - int GetDefaultNColumns() const; |
1029 | - void SetDefaultNColumns(int n_cols); |
1030 | - sigc::signal<void> columns_changed; |
1031 | - |
1032 | - int GetTileGIconSize() const; |
1033 | - int GetTileImageSize() const; |
1034 | - int GetTileWidth() const; |
1035 | - int GetTileHeight() const; |
1036 | - int GetTileIconHightlightHeight() const; |
1037 | - int GetTileIconHightlightWidth() const; |
1038 | - |
1039 | - int GetHomeTileIconSize() const; |
1040 | - int GetHomeTileWidth() const; |
1041 | - int GetHomeTileHeight() const; |
1042 | - |
1043 | - int GetTextLineHeight() const; |
1044 | + RawPixel GetTileGIconSize() const; |
1045 | + RawPixel GetTileImageSize() const; |
1046 | + RawPixel GetTileWidth() const; |
1047 | + RawPixel GetTileHeight() const; |
1048 | + RawPixel GetTileIconHightlightHeight() const; |
1049 | + RawPixel GetTileIconHightlightWidth() const; |
1050 | + |
1051 | + RawPixel GetHomeTileIconSize() const; |
1052 | + RawPixel GetHomeTileWidth() const; |
1053 | + RawPixel GetHomeTileHeight() const; |
1054 | + |
1055 | + RawPixel GetTextLineHeight() const; |
1056 | |
1057 | nux::BaseTexture* GetCategoryBackground(); |
1058 | nux::BaseTexture* GetCategoryBackgroundNoFilters(); |
1059 | @@ -188,8 +183,8 @@ |
1060 | nux::BaseTexture* GetDashTopCornerMask(); |
1061 | nux::BaseTexture* GetDashTopTile(); |
1062 | |
1063 | - int GetDashBottomTileHeight() const; |
1064 | - int GetDashRightTileWidth() const; |
1065 | + RawPixel GetDashBottomTileHeight() const; |
1066 | + RawPixel GetDashRightTileWidth() const; |
1067 | |
1068 | nux::BaseTexture* GetDashShine(); |
1069 | |
1070 | @@ -204,60 +199,58 @@ |
1071 | nux::BaseTexture* GetStarDeselectedIcon(); |
1072 | nux::BaseTexture* GetStarSelectedIcon(); |
1073 | nux::BaseTexture* GetStarHighlightIcon(); |
1074 | - |
1075 | + |
1076 | nux::BaseTexture* GetInformationTexture(); |
1077 | |
1078 | nux::BaseTexture* GetRefineTextureCorner(); |
1079 | nux::BaseTexture* GetRefineTextureDash(); |
1080 | - |
1081 | + |
1082 | // Returns the width of the separator between the dash and the launcher. |
1083 | - int GetVSeparatorSize() const; |
1084 | + RawPixel GetVSeparatorSize() const; |
1085 | |
1086 | // Returns the height of the separator between the dash and the top panel. |
1087 | - int GetHSeparatorSize() const; |
1088 | + RawPixel GetHSeparatorSize() const; |
1089 | |
1090 | // Practically it is the space between the top border of the dash and the searchbar. |
1091 | - int GetDashViewTopPadding() const; |
1092 | - |
1093 | - |
1094 | + RawPixel GetDashViewTopPadding() const; |
1095 | + |
1096 | + |
1097 | // Search bar |
1098 | - int GetSearchBarLeftPadding() const; |
1099 | - int GetSearchBarRightPadding() const; |
1100 | - int GetSearchBarHeight() const; |
1101 | - int GetFilterResultsHighlightRightPadding() const; |
1102 | - int GetFilterResultsHighlightLeftPadding() const; |
1103 | + RawPixel GetSearchBarLeftPadding() const; |
1104 | + RawPixel GetSearchBarRightPadding() const; |
1105 | + RawPixel GetSearchBarHeight() const; |
1106 | |
1107 | // Filter bar |
1108 | - int GetFilterBarTopPadding() const; |
1109 | - int GetFilterHighlightPadding() const; |
1110 | - int GetSpaceBetweenFilterWidgets() const; |
1111 | - int GetAllButtonHeight() const; |
1112 | - int GetFilterBarLeftPadding() const; |
1113 | - int GetFilterBarRightPadding() const; |
1114 | - int GetFilterBarWidth() const; |
1115 | - int GetFilterButtonHeight() const; |
1116 | - int GetFilterViewRightPadding() const; |
1117 | + RawPixel GetFilterResultsHighlightRightPadding() const; |
1118 | + RawPixel GetFilterResultsHighlightLeftPadding() const; |
1119 | + RawPixel GetFilterBarTopPadding() const; |
1120 | + RawPixel GetFilterHighlightPadding() const; |
1121 | + RawPixel GetSpaceBetweenFilterWidgets() const; |
1122 | + RawPixel GetAllButtonHeight() const; |
1123 | + RawPixel GetFilterBarLeftPadding() const; |
1124 | + RawPixel GetFilterBarRightPadding() const; |
1125 | + RawPixel GetFilterBarWidth() const; |
1126 | + RawPixel GetFilterButtonHeight() const; |
1127 | + RawPixel GetFilterViewRightPadding() const; |
1128 | |
1129 | - int GetSpaceBetweenScopeAndFilters() const; |
1130 | + RawPixel GetSpaceBetweenScopeAndFilters() const; |
1131 | |
1132 | // Scrollbars |
1133 | - int GetScrollbarWidth() const; |
1134 | + RawPixel GetScrollbarWidth() const; |
1135 | |
1136 | // Places Group |
1137 | - int GetCategoryIconSize() const; |
1138 | - int GetCategoryHighlightHeight() const; |
1139 | - int GetPlacesGroupTopSpace() const; |
1140 | - int GetPlacesGroupResultTopPadding() const; |
1141 | - int GetPlacesGroupResultLeftPadding() const; |
1142 | - int GetCategoryHeaderLeftPadding() const; |
1143 | - int GetCategorySeparatorLeftPadding() const; |
1144 | - int GetCategorySeparatorRightPadding() const; |
1145 | - |
1146 | - bool GetUseBlur() const; |
1147 | - |
1148 | + RawPixel GetCategoryIconSize() const; |
1149 | + RawPixel GetCategoryHighlightHeight() const; |
1150 | + RawPixel GetPlacesGroupTopSpace() const; |
1151 | + RawPixel GetPlacesGroupResultTopPadding() const; |
1152 | + RawPixel GetPlacesGroupResultLeftPadding() const; |
1153 | + RawPixel GetCategoryHeaderLeftPadding() const; |
1154 | + RawPixel GetCategorySeparatorLeftPadding() const; |
1155 | + RawPixel GetCategorySeparatorRightPadding() const; |
1156 | |
1157 | sigc::signal<void> changed; |
1158 | |
1159 | + nux::Property<int> columns_number; |
1160 | nux::Property<bool> always_maximised; |
1161 | nux::Property<bool> preview_mode; |
1162 | |
1163 | |
1164 | === modified file 'unity-shared/DashStyleInterface.h' |
1165 | --- unity-shared/DashStyleInterface.h 2012-12-13 12:56:29 +0000 |
1166 | +++ unity-shared/DashStyleInterface.h 2014-07-10 11:23:35 +0000 |
1167 | @@ -21,6 +21,7 @@ |
1168 | #define UNITYSHELL_DASH_STYLE_INTERFACE_H |
1169 | |
1170 | #include <memory> |
1171 | +#include "unity-shared/RawPixel.h" |
1172 | |
1173 | namespace nux { |
1174 | class AbstractPaintLayer; |
1175 | @@ -43,11 +44,11 @@ |
1176 | virtual nux::BaseTexture* GetGroupUnexpandIcon() = 0; |
1177 | virtual nux::BaseTexture* GetGroupExpandIcon() = 0; |
1178 | |
1179 | - virtual int GetCategoryIconSize() const = 0; |
1180 | - virtual int GetCategoryHeaderLeftPadding() const = 0; |
1181 | - virtual int GetPlacesGroupTopSpace() const = 0; |
1182 | - virtual int GetPlacesGroupResultTopPadding() const = 0; |
1183 | - virtual int GetPlacesGroupResultLeftPadding() const = 0; |
1184 | + virtual RawPixel GetCategoryIconSize() const = 0; |
1185 | + virtual RawPixel GetCategoryHeaderLeftPadding() const = 0; |
1186 | + virtual RawPixel GetPlacesGroupTopSpace() const = 0; |
1187 | + virtual RawPixel GetPlacesGroupResultTopPadding() const = 0; |
1188 | + virtual RawPixel GetPlacesGroupResultLeftPadding() const = 0; |
1189 | }; |
1190 | |
1191 | } |
1192 | |
1193 | === modified file 'unity-shared/OverlayRenderer.cpp' |
1194 | --- unity-shared/OverlayRenderer.cpp 2013-11-18 17:44:31 +0000 |
1195 | +++ unity-shared/OverlayRenderer.cpp 2014-07-10 11:23:35 +0000 |
1196 | @@ -35,8 +35,16 @@ |
1197 | DECLARE_LOGGER(logger, "unity.overlayrenderer"); |
1198 | namespace |
1199 | { |
1200 | -const int INNER_CORNER_RADIUS = 5; |
1201 | +const RawPixel INNER_CORNER_RADIUS = 5_em; |
1202 | const int EXCESS_BORDER = 10; |
1203 | + |
1204 | +const nux::Color LINE_COLOR = nux::color::White * 0.07f; |
1205 | +const RawPixel GRADIENT_HEIGHT = 50_em; |
1206 | +const RawPixel VERTICAL_PADDING = 20_em; |
1207 | + |
1208 | +// Now that we mask the corners of the dash, |
1209 | +// draw longer lines to fill the minimal gaps |
1210 | +const RawPixel CORNER_OVERLAP = 3_em; |
1211 | } |
1212 | |
1213 | // Impl class |
1214 | @@ -88,6 +96,7 @@ |
1215 | : visible(false) |
1216 | , parent(parent_) |
1217 | { |
1218 | + parent_->scale = 1.0; |
1219 | UpdateTextures(); |
1220 | } |
1221 | |
1222 | @@ -427,6 +436,7 @@ |
1223 | void OverlayRendererImpl::Draw(nux::GraphicsEngine& gfx_context, nux::Geometry const& content_geo, nux::Geometry const& absolute_geo, nux::Geometry const& geometry, bool force_edges) |
1224 | { |
1225 | nux::Geometry geo(content_geo); |
1226 | + double scale = parent->scale; |
1227 | |
1228 | nux::Geometry larger_content_geo = content_geo; |
1229 | nux::Geometry larger_absolute_geo = absolute_geo; |
1230 | @@ -480,32 +490,22 @@ |
1231 | gfx_context.GetRenderStates().SetBlend(true); |
1232 | gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
1233 | |
1234 | - const double line_opacity = 0.1f; |
1235 | - const int gradient_height = 50; |
1236 | - const int vertical_padding = 20; |
1237 | - |
1238 | - // Now that we mask the corners of the dash, |
1239 | - // draw longer lines to fill the minimal gaps |
1240 | - const int corner_overlap = 3; |
1241 | - |
1242 | - nux::Color line_color = nux::color::White * line_opacity; |
1243 | - |
1244 | // Vertical lancher/dash separator |
1245 | nux::GetPainter().Paint2DQuadColor(gfx_context, |
1246 | nux::Geometry(geometry.x, |
1247 | - geometry.y + vertical_padding, |
1248 | - style.GetVSeparatorSize(), |
1249 | - gradient_height), |
1250 | + geometry.y + VERTICAL_PADDING.CP(scale), |
1251 | + style.GetVSeparatorSize().CP(scale), |
1252 | + GRADIENT_HEIGHT.CP(scale)), |
1253 | nux::color::Transparent, |
1254 | - line_color * 0.7f, // less opacity |
1255 | - line_color * 0.7f, // less opacity |
1256 | + LINE_COLOR, |
1257 | + LINE_COLOR, |
1258 | nux::color::Transparent); |
1259 | nux::GetPainter().Draw2DLine(gfx_context, |
1260 | geometry.x, |
1261 | - geometry.y + vertical_padding + gradient_height, |
1262 | - style.GetVSeparatorSize(), |
1263 | - geometry.y + content_geo.height + INNER_CORNER_RADIUS + corner_overlap, |
1264 | - line_color * 0.7f); // less opacity |
1265 | + geometry.y + VERTICAL_PADDING.CP(scale) + GRADIENT_HEIGHT.CP(scale), |
1266 | + style.GetVSeparatorSize().CP(scale), |
1267 | + geometry.y + content_geo.height + INNER_CORNER_RADIUS.CP(scale) + CORNER_OVERLAP.CP(scale), |
1268 | + LINE_COLOR); |
1269 | |
1270 | //Draw the background |
1271 | bg_darken_layer_->SetGeometry(larger_content_geo); |
1272 | @@ -925,9 +925,7 @@ |
1273 | |
1274 | OverlayRenderer::OverlayRenderer() |
1275 | : pimpl_(new OverlayRendererImpl(this)) |
1276 | -{ |
1277 | - |
1278 | -} |
1279 | +{} |
1280 | |
1281 | |
1282 | OverlayRenderer::~OverlayRenderer() |
1283 | |
1284 | === modified file 'unity-shared/OverlayRenderer.h' |
1285 | --- unity-shared/OverlayRenderer.h 2013-11-18 16:24:41 +0000 |
1286 | +++ unity-shared/OverlayRenderer.h 2014-07-10 11:23:35 +0000 |
1287 | @@ -39,6 +39,7 @@ |
1288 | |
1289 | nux::Property<int> x_offset; |
1290 | nux::Property<int> y_offset; |
1291 | + nux::Property<double> scale; |
1292 | |
1293 | OverlayRenderer(); |
1294 | ~OverlayRenderer(); |
It looks good :)