Merge lp:~gordallott/unity/dash-layout-stuff into lp:unity

Proposed by Gord Allott
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 1587
Proposed branch: lp:~gordallott/unity/dash-layout-stuff
Merge into: lp:unity
Diff against target: 198 lines (+39/-28)
8 files modified
plugins/unityshell/src/DashSearchBar.cpp (+1/-1)
plugins/unityshell/src/DashView.cpp (+7/-3)
plugins/unityshell/src/PlacesGroup.cpp (+22/-16)
plugins/unityshell/src/PlacesGroup.h (+1/-0)
plugins/unityshell/src/PlacesStyle.cpp (+3/-2)
plugins/unityshell/src/ResultRendererTile.cpp (+2/-3)
plugins/unityshell/src/ResultViewGrid.cpp (+1/-1)
tests/standalone_dash.cpp (+2/-2)
To merge this branch: bzr merge lp:~gordallott/unity/dash-layout-stuff
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Review via email: mp+76259@code.launchpad.net

Description of the change

some dash layout changes, lot more magic numbers added because the design made no sense, conflicting between the measurements and the actual complaint.

To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/DashSearchBar.cpp'
2--- plugins/unityshell/src/DashSearchBar.cpp 2011-09-16 14:11:39 +0000
3+++ plugins/unityshell/src/DashSearchBar.cpp 2011-09-20 16:40:29 +0000
4@@ -85,7 +85,7 @@
5 pango_entry_->cursor_moved.connect([&](int i) { QueueDraw(); });
6 pango_entry_->mouse_down.connect(sigc::mem_fun(this, &SearchBar::OnMouseButtonDown));
7 pango_entry_->end_key_focus.connect(sigc::mem_fun(this, &SearchBar::OnEndKeyFocus));
8-
9+
10 layered_layout_ = new nux::LayeredLayout();
11 layered_layout_->AddLayer(hint_);
12 layered_layout_->AddLayer(pango_entry_);
13
14=== modified file 'plugins/unityshell/src/DashView.cpp'
15--- plugins/unityshell/src/DashView.cpp 2011-09-16 21:06:05 +0000
16+++ plugins/unityshell/src/DashView.cpp 2011-09-20 16:40:29 +0000
17@@ -186,13 +186,17 @@
18 int tile_height = style->GetTileHeight();
19 int half = for_geo.width / 2;
20
21- while ((width += tile_width) < half)
22+ // if default dash size is bigger than half a screens worth of items, go for that.
23+ while ((width += tile_width) + (19 * 2) < half)
24 ;
25
26- width = MAX(width, tile_width * 7);
27+ width = MAX(width, tile_width * 6);
28+
29+ width += 19 + 32; // add the left padding and the group plugin padding
30
31 height = search_bar_->GetGeometry().height;
32- height += tile_height * 4.75;
33+ height += tile_height * 3;
34+ height += (24 + 15) * 3; // adding three group headers
35 height += lens_bar_->GetGeometry().height;
36
37 if (for_geo.width > 800 && for_geo.height > 550)
38
39=== modified file 'plugins/unityshell/src/PlacesGroup.cpp'
40--- plugins/unityshell/src/PlacesGroup.cpp 2011-09-15 09:13:45 +0000
41+++ plugins/unityshell/src/PlacesGroup.cpp 2011-09-20 16:40:29 +0000
42@@ -66,9 +66,10 @@
43
44 _cached_name = NULL;
45 _group_layout = new nux::VLayout("", NUX_TRACKER_LOCATION);
46- _group_layout->SetVerticalExternalMargin(15);
47 _group_layout->SetHorizontalExternalMargin(19);
48
49+ _group_layout->AddLayout(new nux::SpaceLayout(15,15,15,15), 0);
50+
51 _header_layout = new nux::HLayout(NUX_TRACKER_LOCATION);
52 _group_layout->AddLayout(_header_layout, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_FULL);
53
54@@ -299,28 +300,33 @@
55 void PlacesGroup::Draw(nux::GraphicsEngine& GfxContext,
56 bool forceDraw)
57 {
58- nux::Geometry geo = GetGeometry();
59+}
60+
61+void
62+PlacesGroup::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
63+{
64+ nux::Geometry base = GetGeometry();
65+ GfxContext.PushClippingRectangle(base);
66+
67+ _group_layout->ProcessDraw(GfxContext, force_draw);
68+ GfxContext.PopClippingRectangle();
69+}
70+
71+void PlacesGroup::PostDraw(nux::GraphicsEngine& GfxContext,
72+ bool forceDraw)
73+{
74+ nux::Geometry base = GetGeometry();
75+ GfxContext.PushClippingRectangle(base);
76+
77 nux::Color col(0.2f, 0.2f, 0.2f, 0.2f);
78
79- GfxContext.PushClippingRectangle(geo);
80-
81 if (_draw_sep)
82 nux::GetPainter().Draw2DLine(GfxContext,
83- geo.x + 10, geo.y + geo.height - 1,
84- geo.x + geo.width - 10, geo.y + geo.height - 1,
85+ base.x + 10, base.y + base.height - 1,
86+ base.x + base.width - 10, base.y + base.height - 1,
87 col,
88 col);
89
90- GfxContext.PopClippingRectangle();
91-}
92-
93-void
94-PlacesGroup::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
95-{
96- nux::Geometry base = GetGeometry();
97- GfxContext.PushClippingRectangle(base);
98-
99- _group_layout->ProcessDraw(GfxContext, force_draw);
100
101 GfxContext.PopClippingRectangle();
102 }
103
104=== modified file 'plugins/unityshell/src/PlacesGroup.h'
105--- plugins/unityshell/src/PlacesGroup.h 2011-09-02 02:27:51 +0000
106+++ plugins/unityshell/src/PlacesGroup.h 2011-09-20 16:40:29 +0000
107@@ -72,6 +72,7 @@
108 long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo);
109 void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
110 void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
111+ void PostDraw (nux::GraphicsEngine &GfxContext, bool force_draw);
112
113 static gboolean OnIdleRelayout(PlacesGroup* self);
114
115
116=== modified file 'plugins/unityshell/src/PlacesStyle.cpp'
117--- plugins/unityshell/src/PlacesStyle.cpp 2011-09-15 14:17:34 +0000
118+++ plugins/unityshell/src/PlacesStyle.cpp 2011-09-20 16:40:29 +0000
119@@ -101,12 +101,12 @@
120
121 int PlacesStyle::GetTileWidth() const
122 {
123- return _text_width;
124+ return MAX(_text_width, 150);
125 }
126
127 int PlacesStyle::GetTileHeight() const
128 {
129- return GetTileIconSize() + (_text_height * 3) + 12;
130+ return MAX(GetTileIconSize() + (_text_height * 2) + 10, GetTileIconSize() + 50 + 18); // magic design numbers.
131 }
132
133 int PlacesStyle::GetHomeTileIconSize() const
134@@ -293,6 +293,7 @@
135 NULL);
136 desc = pango_font_description_from_string(font_description);
137 pango_font_description_set_weight(desc, PANGO_WEIGHT_NORMAL);
138+ pango_font_description_set_size (desc, 9 * PANGO_SCALE);
139
140 layout = pango_cairo_create_layout(cr);
141 pango_layout_set_font_description(layout, desc);
142
143=== modified file 'plugins/unityshell/src/ResultRendererTile.cpp'
144--- plugins/unityshell/src/ResultRendererTile.cpp 2011-09-15 15:13:39 +0000
145+++ plugins/unityshell/src/ResultRendererTile.cpp 2011-09-20 16:40:29 +0000
146@@ -61,7 +61,7 @@
147 ResultRendererTile::ResultRendererTile(NUX_FILE_LINE_DECL)
148 : ResultRenderer(NUX_FILE_LINE_PARAM)
149 , highlight_padding(6)
150- , spacing(12)
151+ , spacing(10)
152 , padding(6)
153 {
154 PlacesStyle* style = PlacesStyle::GetDefault();
155@@ -170,7 +170,6 @@
156 }
157
158 GfxContext.GetRenderStates().SetBlend(alpha, src, dest);
159-
160 }
161
162 nux::BaseTexture* ResultRendererTile::DrawHighlight(std::string const& texid, int width, int height)
163@@ -400,7 +399,7 @@
164 pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
165 pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_START);
166 pango_layout_set_width(layout, (style->GetTileWidth() - (padding * 2))* PANGO_SCALE);
167- pango_layout_set_height(layout, -3);
168+ pango_layout_set_height(layout, -2);
169
170 pango_layout_set_markup(layout, row.name().c_str(), -1);
171
172
173=== modified file 'plugins/unityshell/src/ResultViewGrid.cpp'
174--- plugins/unityshell/src/ResultViewGrid.cpp 2011-09-15 13:25:34 +0000
175+++ plugins/unityshell/src/ResultViewGrid.cpp 2011-09-20 16:40:29 +0000
176@@ -47,7 +47,7 @@
177 : ResultView(NUX_FILE_LINE_PARAM)
178 , horizontal_spacing(0)
179 , vertical_spacing(0)
180- , padding(6)
181+ , padding(0)
182 , mouse_over_index_(-1)
183 , active_index_(-1)
184 , selected_index_(-1)
185
186=== modified file 'tests/standalone_dash.cpp'
187--- tests/standalone_dash.cpp 2011-09-15 02:17:21 +0000
188+++ tests/standalone_dash.cpp 2011-09-20 16:40:29 +0000
189@@ -32,8 +32,8 @@
190 #include "DashStyle.h"
191 #include "PlacesStyle.h"
192
193-#define WIDTH 958
194-#define HEIGHT 574
195+#define WIDTH 1024
196+#define HEIGHT 768
197
198 using namespace unity::dash;
199