Merge lp:~azzar1/unity/fix-841907 into lp:unity
- fix-841907
- Merge into trunk
Proposed by
Andrea Azzarone
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2191 |
Proposed branch: | lp:~azzar1/unity/fix-841907 |
Merge into: | lp:unity |
Diff against target: |
348 lines (+45/-70) 7 files modified
plugins/unityshell/src/DashStyle.cpp (+1/-1) plugins/unityshell/src/DashStyle.h (+0/-2) plugins/unityshell/src/DashView.cpp (+5/-5) plugins/unityshell/src/FilterBar.cpp (+1/-1) plugins/unityshell/src/HudView.cpp (+4/-5) plugins/unityshell/src/SearchBar.cpp (+32/-52) plugins/unityshell/src/SearchBar.h (+2/-4) |
To merge this branch: | bzr merge lp:~azzar1/unity/fix-841907 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Approve | ||
Andrea Cimitan (community) | design | Approve | |
Review via email: mp+99541@code.launchpad.net |
Commit message
Makes the dash search entry horizontally extensible.
Description of the change
== Problem ==
The Dash search box should expand horizontally when the Dash switches to full screen mode
== Fix ==
Don't use a fixed width for the search bar but let's use nux layout sytem. I'd like to make the search entry a completely different widget but it's too late now.
== Test ==
Not applicable. It's a visual change and we just need design review.
== Screenshots ==
* http://
* http://
* http://
To post a comment you must log in.
Revision history for this message
Omer Akram (om26er) wrote : | # |
Revision history for this message
Andrea Cimitan (cimi) : | # |
review:
Approve
(design)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Cool, looks good, works well.
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/DashStyle.cpp' | |||
2 | --- plugins/unityshell/src/DashStyle.cpp 2012-03-21 14:18:06 +0000 | |||
3 | +++ plugins/unityshell/src/DashStyle.cpp 2012-03-27 15:22:27 +0000 | |||
4 | @@ -2235,7 +2235,7 @@ | |||
5 | 2235 | 2235 | ||
6 | 2236 | int Style::GetSpaceBetweenLensAndFilters() const | 2236 | int Style::GetSpaceBetweenLensAndFilters() const |
7 | 2237 | { | 2237 | { |
9 | 2238 | return 9; | 2238 | return 10; |
10 | 2239 | } | 2239 | } |
11 | 2240 | 2240 | ||
12 | 2241 | int Style::GetFilterViewRightPadding() const | 2241 | int Style::GetFilterViewRightPadding() const |
13 | 2242 | 2242 | ||
14 | === modified file 'plugins/unityshell/src/DashStyle.h' | |||
15 | --- plugins/unityshell/src/DashStyle.h 2012-03-21 14:18:06 +0000 | |||
16 | +++ plugins/unityshell/src/DashStyle.h 2012-03-27 15:22:27 +0000 | |||
17 | @@ -228,8 +228,6 @@ | |||
18 | 228 | int GetCategorySeparatorLeftPadding() const; | 228 | int GetCategorySeparatorLeftPadding() const; |
19 | 229 | int GetCategorySeparatorRightPadding() const; | 229 | int GetCategorySeparatorRightPadding() const; |
20 | 230 | 230 | ||
21 | 231 | const static int SEARCH_BAR_EXTRA_PADDING = 1; | ||
22 | 232 | |||
23 | 233 | sigc::signal<void> changed; | 231 | sigc::signal<void> changed; |
24 | 234 | 232 | ||
25 | 235 | private: | 233 | private: |
26 | 236 | 234 | ||
27 | === modified file 'plugins/unityshell/src/DashView.cpp' | |||
28 | --- plugins/unityshell/src/DashView.cpp 2012-03-22 09:02:06 +0000 | |||
29 | +++ plugins/unityshell/src/DashView.cpp 2012-03-27 15:22:27 +0000 | |||
30 | @@ -176,17 +176,17 @@ | |||
31 | 176 | SetLayout(layout_); | 176 | SetLayout(layout_); |
32 | 177 | 177 | ||
33 | 178 | content_layout_ = new DashLayout(NUX_TRACKER_LOCATION); | 178 | content_layout_ = new DashLayout(NUX_TRACKER_LOCATION); |
35 | 179 | content_layout_->SetTopAndBottomPadding(style.GetDashViewTopPadding() - style.SEARCH_BAR_EXTRA_PADDING, 0); | 179 | content_layout_->SetTopAndBottomPadding(style.GetDashViewTopPadding(), 0); |
36 | 180 | layout_->AddLayout(content_layout_, 1, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL); | 180 | layout_->AddLayout(content_layout_, 1, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL); |
37 | 181 | 181 | ||
38 | 182 | search_bar_layout_ = new nux::HLayout(); | 182 | search_bar_layout_ = new nux::HLayout(); |
40 | 183 | search_bar_layout_->SetLeftAndRightPadding(style.GetSearchBarLeftPadding() - style.SEARCH_BAR_EXTRA_PADDING, style.GetSearchBarLeftPadding() - style.GetFilterResultsHighlightRightPadding() - style.SEARCH_BAR_EXTRA_PADDING); | 183 | search_bar_layout_->SetLeftAndRightPadding(style.GetSearchBarLeftPadding(), 0); |
41 | 184 | content_layout_->AddLayout(search_bar_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 184 | content_layout_->AddLayout(search_bar_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
42 | 185 | 185 | ||
43 | 186 | search_bar_ = new SearchBar(); | 186 | search_bar_ = new SearchBar(); |
44 | 187 | AddChild(search_bar_); | 187 | AddChild(search_bar_); |
47 | 188 | search_bar_->SetMinimumHeight(style.GetSearchBarHeight() + style.SEARCH_BAR_EXTRA_PADDING * 2); | 188 | search_bar_->SetMinimumHeight(style.GetSearchBarHeight()); |
48 | 189 | search_bar_->SetMaximumHeight(style.GetSearchBarHeight() + style.SEARCH_BAR_EXTRA_PADDING * 2); | 189 | search_bar_->SetMaximumHeight(style.GetSearchBarHeight()); |
49 | 190 | search_bar_->activated.connect(sigc::mem_fun(this, &DashView::OnEntryActivated)); | 190 | search_bar_->activated.connect(sigc::mem_fun(this, &DashView::OnEntryActivated)); |
50 | 191 | search_bar_->search_changed.connect(sigc::mem_fun(this, &DashView::OnSearchChanged)); | 191 | search_bar_->search_changed.connect(sigc::mem_fun(this, &DashView::OnSearchChanged)); |
51 | 192 | search_bar_->live_search_reached.connect(sigc::mem_fun(this, &DashView::OnLiveSearchReached)); | 192 | search_bar_->live_search_reached.connect(sigc::mem_fun(this, &DashView::OnLiveSearchReached)); |
52 | @@ -269,7 +269,7 @@ | |||
53 | 269 | 269 | ||
54 | 270 | width = MAX(width, tile_width * 6); | 270 | width = MAX(width, tile_width * 6); |
55 | 271 | 271 | ||
57 | 272 | width += 19 + 40; // add the left padding and the group plugin padding | 272 | width += 20 + 40; // add the left padding and the group plugin padding |
58 | 273 | 273 | ||
59 | 274 | height = search_bar_->GetGeometry().height; | 274 | height = search_bar_->GetGeometry().height; |
60 | 275 | height += tile_height * 3; | 275 | height += tile_height * 3; |
61 | 276 | 276 | ||
62 | === modified file 'plugins/unityshell/src/FilterBar.cpp' | |||
63 | --- plugins/unityshell/src/FilterBar.cpp 2012-03-21 14:18:06 +0000 | |||
64 | +++ plugins/unityshell/src/FilterBar.cpp 2012-03-27 15:22:27 +0000 | |||
65 | @@ -60,7 +60,7 @@ | |||
66 | 60 | dash::Style& style = dash::Style::Instance(); | 60 | dash::Style& style = dash::Style::Instance(); |
67 | 61 | 61 | ||
68 | 62 | nux::LinearLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION); | 62 | nux::LinearLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION); |
70 | 63 | layout->SetTopAndBottomPadding(style.GetFilterBarTopPadding() - style.GetFilterHighlightPadding() - style.SEARCH_BAR_EXTRA_PADDING); | 63 | layout->SetTopAndBottomPadding(style.GetFilterBarTopPadding() - style.GetFilterHighlightPadding()); |
71 | 64 | layout->SetSpaceBetweenChildren(style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding()); | 64 | layout->SetSpaceBetweenChildren(style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding()); |
72 | 65 | SetLayout(layout); | 65 | SetLayout(layout); |
73 | 66 | } | 66 | } |
74 | 67 | 67 | ||
75 | === modified file 'plugins/unityshell/src/HudView.cpp' | |||
76 | --- plugins/unityshell/src/HudView.cpp 2012-03-21 15:07:29 +0000 | |||
77 | +++ plugins/unityshell/src/HudView.cpp 2012-03-27 15:22:27 +0000 | |||
78 | @@ -333,7 +333,7 @@ | |||
79 | 333 | 333 | ||
80 | 334 | namespace | 334 | namespace |
81 | 335 | { | 335 | { |
83 | 336 | const int top_spacing = 9; | 336 | const int top_spacing = 11; |
84 | 337 | const int content_width = 941; | 337 | const int content_width = 941; |
85 | 338 | const int icon_vertical_margin = 5; | 338 | const int icon_vertical_margin = 5; |
86 | 339 | const int spacing_between_icon_and_content = 8; | 339 | const int spacing_between_icon_and_content = 8; |
87 | @@ -369,10 +369,9 @@ | |||
88 | 369 | content_layout_->AddLayout(new nux::SpaceLayout(top_spacing,top_spacing,top_spacing,top_spacing), 0); | 369 | content_layout_->AddLayout(new nux::SpaceLayout(top_spacing,top_spacing,top_spacing,top_spacing), 0); |
89 | 370 | 370 | ||
90 | 371 | // add the search bar to the composite | 371 | // add the search bar to the composite |
95 | 372 | search_bar_ = new unity::SearchBar(content_width, true); | 372 | search_bar_ = new unity::SearchBar(true); |
96 | 373 | search_bar_->disable_glow = true; | 373 | search_bar_->SetMinimumHeight(style.GetSearchBarHeight()); |
97 | 374 | search_bar_->SetMinimumHeight(style.GetSearchBarHeight() + style.SEARCH_BAR_EXTRA_PADDING * 2); | 374 | search_bar_->SetMaximumHeight(style.GetSearchBarHeight()); |
94 | 375 | search_bar_->SetMaximumHeight(style.GetSearchBarHeight() + style.SEARCH_BAR_EXTRA_PADDING * 2); | ||
98 | 376 | search_bar_->search_hint = default_text; | 375 | search_bar_->search_hint = default_text; |
99 | 377 | search_bar_->search_changed.connect(sigc::mem_fun(this, &View::OnSearchChanged)); | 376 | search_bar_->search_changed.connect(sigc::mem_fun(this, &View::OnSearchChanged)); |
100 | 378 | AddChild(search_bar_.GetPointer()); | 377 | AddChild(search_bar_.GetPointer()); |
101 | 379 | 378 | ||
102 | === modified file 'plugins/unityshell/src/SearchBar.cpp' | |||
103 | --- plugins/unityshell/src/SearchBar.cpp 2012-03-21 18:37:19 +0000 | |||
104 | +++ plugins/unityshell/src/SearchBar.cpp 2012-03-27 15:22:27 +0000 | |||
105 | @@ -50,7 +50,9 @@ | |||
106 | 50 | const int SPINNER_TIMEOUT = 100; | 50 | const int SPINNER_TIMEOUT = 100; |
107 | 51 | 51 | ||
108 | 52 | const int SPACE_BETWEEN_SPINNER_AND_TEXT = 5; | 52 | const int SPACE_BETWEEN_SPINNER_AND_TEXT = 5; |
110 | 53 | const int LEFT_INTERNAL_PADDING = 7; | 53 | const int SPACE_BETWEEN_ENTRY_AND_HIGHLIGHT = 10; |
111 | 54 | const int LEFT_INTERNAL_PADDING = 6; | ||
112 | 55 | const int SEARCH_ENTRY_RIGHT_BORDER = 10; | ||
113 | 54 | 56 | ||
114 | 55 | const int HIGHLIGHT_HEIGHT = 24; | 57 | const int HIGHLIGHT_HEIGHT = 24; |
115 | 56 | 58 | ||
116 | @@ -121,42 +123,23 @@ | |||
117 | 121 | , search_hint("") | 123 | , search_hint("") |
118 | 122 | , showing_filters(false) | 124 | , showing_filters(false) |
119 | 123 | , can_refine_search(false) | 125 | , can_refine_search(false) |
120 | 124 | , disable_glow(false) | ||
121 | 125 | , show_filter_hint_(true) | 126 | , show_filter_hint_(true) |
122 | 126 | , expander_view_(nullptr) | 127 | , expander_view_(nullptr) |
123 | 127 | , show_filters_(nullptr) | 128 | , show_filters_(nullptr) |
124 | 128 | , search_bar_width_(621) | ||
125 | 129 | , live_search_timeout_(0) | 129 | , live_search_timeout_(0) |
126 | 130 | , start_spinner_timeout_(0) | 130 | , start_spinner_timeout_(0) |
127 | 131 | { | 131 | { |
128 | 132 | Init(); | 132 | Init(); |
129 | 133 | } | 133 | } |
130 | 134 | 134 | ||
132 | 135 | SearchBar::SearchBar(int search_bar_width, bool show_filter_hint_, NUX_FILE_LINE_DECL) | 135 | SearchBar::SearchBar(bool show_filter_hint_, NUX_FILE_LINE_DECL) |
133 | 136 | : View(NUX_FILE_LINE_PARAM) | 136 | : View(NUX_FILE_LINE_PARAM) |
134 | 137 | , search_hint("") | 137 | , search_hint("") |
135 | 138 | , showing_filters(false) | 138 | , showing_filters(false) |
136 | 139 | , can_refine_search(false) | 139 | , can_refine_search(false) |
137 | 140 | , disable_glow(false) | ||
138 | 141 | , show_filter_hint_(show_filter_hint_) | 140 | , show_filter_hint_(show_filter_hint_) |
139 | 142 | , expander_view_(nullptr) | 141 | , expander_view_(nullptr) |
140 | 143 | , show_filters_(nullptr) | 142 | , show_filters_(nullptr) |
141 | 144 | , search_bar_width_(search_bar_width) | ||
142 | 145 | , live_search_timeout_(0) | ||
143 | 146 | , start_spinner_timeout_(0) | ||
144 | 147 | { | ||
145 | 148 | Init(); | ||
146 | 149 | } | ||
147 | 150 | |||
148 | 151 | SearchBar::SearchBar(int search_bar_width, NUX_FILE_LINE_DECL) | ||
149 | 152 | : View(NUX_FILE_LINE_PARAM) | ||
150 | 153 | , search_hint("") | ||
151 | 154 | , showing_filters(false) | ||
152 | 155 | , can_refine_search(false) | ||
153 | 156 | , disable_glow(false) | ||
154 | 157 | , show_filter_hint_(true) | ||
155 | 158 | , expander_view_(nullptr) | ||
156 | 159 | , search_bar_width_(search_bar_width) | ||
157 | 160 | , live_search_timeout_(0) | 143 | , live_search_timeout_(0) |
158 | 161 | , start_spinner_timeout_(0) | 144 | , start_spinner_timeout_(0) |
159 | 162 | { | 145 | { |
160 | @@ -165,25 +148,30 @@ | |||
161 | 165 | 148 | ||
162 | 166 | void SearchBar::Init() | 149 | void SearchBar::Init() |
163 | 167 | { | 150 | { |
165 | 168 | nux::BaseTexture* icon = dash::Style::Instance().GetSearchMagnifyIcon(); | 151 | dash::Style& style = dash::Style::Instance(); |
166 | 152 | nux::BaseTexture* icon = style.GetSearchMagnifyIcon(); | ||
167 | 169 | 153 | ||
168 | 170 | bg_layer_ = new nux::ColorLayer(nux::Color(0xff595853), true); | 154 | bg_layer_ = new nux::ColorLayer(nux::Color(0xff595853), true); |
169 | 171 | 155 | ||
170 | 172 | layout_ = new nux::HLayout(NUX_TRACKER_LOCATION); | 156 | layout_ = new nux::HLayout(NUX_TRACKER_LOCATION); |
173 | 173 | layout_->SetLeftAndRightPadding(LEFT_INTERNAL_PADDING, 10); | 157 | layout_->SetLeftAndRightPadding(LEFT_INTERNAL_PADDING, SEARCH_ENTRY_RIGHT_BORDER); |
174 | 174 | layout_->SetSpaceBetweenChildren(SPACE_BETWEEN_SPINNER_AND_TEXT); | 158 | layout_->SetSpaceBetweenChildren(SPACE_BETWEEN_ENTRY_AND_HIGHLIGHT); |
175 | 175 | SetLayout(layout_); | 159 | SetLayout(layout_); |
176 | 176 | 160 | ||
177 | 161 | entry_layout_ = new nux::HLayout(NUX_TRACKER_LOCATION); | ||
178 | 162 | entry_layout_->SetLeftAndRightPadding(0, 10); | ||
179 | 163 | layout_->AddLayout(entry_layout_); | ||
180 | 164 | |||
181 | 177 | spinner_ = new SearchBarSpinner(); | 165 | spinner_ = new SearchBarSpinner(); |
182 | 178 | spinner_->SetMinMaxSize(icon->GetWidth(), icon->GetHeight()); | 166 | spinner_->SetMinMaxSize(icon->GetWidth(), icon->GetHeight()); |
183 | 179 | spinner_->mouse_click.connect(sigc::mem_fun(this, &SearchBar::OnClearClicked)); | 167 | spinner_->mouse_click.connect(sigc::mem_fun(this, &SearchBar::OnClearClicked)); |
185 | 180 | layout_->AddView(spinner_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 168 | entry_layout_->AddView(spinner_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
186 | 169 | entry_layout_->SetSpaceBetweenChildren(SPACE_BETWEEN_SPINNER_AND_TEXT); | ||
187 | 181 | 170 | ||
188 | 182 | nux::HLayout* hint_layout = new nux::HLayout(NUX_TRACKER_LOCATION); | 171 | nux::HLayout* hint_layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
189 | 183 | 172 | ||
190 | 184 | hint_ = new nux::StaticCairoText(" "); | 173 | hint_ = new nux::StaticCairoText(" "); |
191 | 185 | hint_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 0.5f)); | 174 | hint_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 0.5f)); |
192 | 186 | hint_->SetMaximumWidth(search_bar_width_ - icon->GetWidth()); | ||
193 | 187 | hint_->SetFont(HINT_LABEL_DEFAULT_FONT.c_str()); | 175 | hint_->SetFont(HINT_LABEL_DEFAULT_FONT.c_str()); |
194 | 188 | hint_layout->AddView(hint_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 176 | hint_layout->AddView(hint_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
195 | 189 | 177 | ||
196 | @@ -195,16 +183,13 @@ | |||
197 | 195 | pango_entry_->cursor_moved.connect([&](int i) { QueueDraw(); }); | 183 | pango_entry_->cursor_moved.connect([&](int i) { QueueDraw(); }); |
198 | 196 | pango_entry_->mouse_down.connect(sigc::mem_fun(this, &SearchBar::OnMouseButtonDown)); | 184 | pango_entry_->mouse_down.connect(sigc::mem_fun(this, &SearchBar::OnMouseButtonDown)); |
199 | 197 | pango_entry_->end_key_focus.connect(sigc::mem_fun(this, &SearchBar::OnEndKeyFocus)); | 185 | pango_entry_->end_key_focus.connect(sigc::mem_fun(this, &SearchBar::OnEndKeyFocus)); |
200 | 198 | pango_entry_->SetMaximumWidth(search_bar_width_ - 1.5 * icon->GetWidth()); | ||
201 | 199 | 186 | ||
202 | 200 | layered_layout_ = new nux::LayeredLayout(); | 187 | layered_layout_ = new nux::LayeredLayout(); |
203 | 201 | layered_layout_->AddLayout(hint_layout); | 188 | layered_layout_->AddLayout(hint_layout); |
204 | 202 | layered_layout_->AddLayer(pango_entry_); | 189 | layered_layout_->AddLayer(pango_entry_); |
205 | 203 | layered_layout_->SetPaintAll(true); | 190 | layered_layout_->SetPaintAll(true); |
206 | 204 | layered_layout_->SetActiveLayerN(1); | 191 | layered_layout_->SetActiveLayerN(1); |
210 | 205 | layered_layout_->SetMinimumWidth(search_bar_width_); | 192 | entry_layout_->AddView(layered_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); |
208 | 206 | layered_layout_->SetMaximumWidth(search_bar_width_); | ||
209 | 207 | layout_->AddView(layered_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); | ||
211 | 208 | 193 | ||
212 | 209 | if (show_filter_hint_) | 194 | if (show_filter_hint_) |
213 | 210 | { | 195 | { |
214 | @@ -217,7 +202,7 @@ | |||
215 | 217 | show_filters_->SetLines(1); | 202 | show_filters_->SetLines(1); |
216 | 218 | 203 | ||
217 | 219 | nux::BaseTexture* arrow; | 204 | nux::BaseTexture* arrow; |
219 | 220 | arrow = dash::Style::Instance().GetGroupExpandIcon(); | 205 | arrow = style.GetGroupExpandIcon(); |
220 | 221 | expand_icon_ = new IconTexture(arrow, | 206 | expand_icon_ = new IconTexture(arrow, |
221 | 222 | arrow->GetWidth(), | 207 | arrow->GetWidth(), |
222 | 223 | arrow->GetHeight()); | 208 | arrow->GetHeight()); |
223 | @@ -227,6 +212,8 @@ | |||
224 | 227 | 212 | ||
225 | 228 | filter_layout_ = new nux::HLayout(); | 213 | filter_layout_ = new nux::HLayout(); |
226 | 229 | filter_layout_->SetHorizontalInternalMargin(8); | 214 | filter_layout_->SetHorizontalInternalMargin(8); |
227 | 215 | filter_layout_->SetLeftAndRightPadding(style.GetFilterResultsHighlightLeftPadding(), style.GetFilterResultsHighlightRightPadding()); | ||
228 | 216 | filter_layout_->SetContentDistribution(nux::MAJOR_POSITION_END); | ||
229 | 230 | filter_layout_->AddView(show_filters_, 0, nux::MINOR_POSITION_CENTER); | 217 | filter_layout_->AddView(show_filters_, 0, nux::MINOR_POSITION_CENTER); |
230 | 231 | 218 | ||
231 | 232 | arrow_layout_ = new nux::VLayout(); | 219 | arrow_layout_ = new nux::VLayout(); |
232 | @@ -238,16 +225,18 @@ | |||
233 | 238 | 225 | ||
234 | 239 | filter_layout_->AddView(arrow_layout_, 0, nux::MINOR_POSITION_CENTER); | 226 | filter_layout_->AddView(arrow_layout_, 0, nux::MINOR_POSITION_CENTER); |
235 | 240 | 227 | ||
236 | 241 | layout_->AddLayout(new nux::SpaceLayout(1, 10000, 0, 1), 1); | ||
237 | 242 | |||
238 | 243 | expander_view_ = new ExpanderView(NUX_TRACKER_LOCATION); | 228 | expander_view_ = new ExpanderView(NUX_TRACKER_LOCATION); |
239 | 244 | expander_view_->SetVisible(false); | 229 | expander_view_->SetVisible(false); |
240 | 245 | expander_view_->SetLayout(filter_layout_); | 230 | expander_view_->SetLayout(filter_layout_); |
241 | 246 | layout_->AddView(expander_view_, 0, nux::MINOR_POSITION_RIGHT, nux::MINOR_SIZE_FULL); | 231 | layout_->AddView(expander_view_, 0, nux::MINOR_POSITION_RIGHT, nux::MINOR_SIZE_FULL); |
242 | 247 | 232 | ||
246 | 248 | // Fix bug #917047 | 233 | int width = style.GetFilterBarWidth() + |
247 | 249 | show_filters_->SetMaximumWidth(dash::Style::Instance().GetFilterBarWidth() - 60); | 234 | style.GetFilterResultsHighlightLeftPadding() + |
248 | 250 | show_filters_->SetMinimumWidth(dash::Style::Instance().GetFilterBarWidth() - 60); | 235 | style.GetFilterResultsHighlightRightPadding(); |
249 | 236 | |||
250 | 237 | expander_view_->SetMaximumWidth(width); | ||
251 | 238 | expander_view_->SetMinimumWidth(width); | ||
252 | 239 | show_filters_->SetMaximumWidth(style.GetFilterBarWidth() - arrow_layout_->GetBaseWidth() - 8); | ||
253 | 251 | 240 | ||
254 | 252 | // Lambda functions | 241 | // Lambda functions |
255 | 253 | auto mouse_expand = [&](int, int, unsigned long, unsigned long) | 242 | auto mouse_expand = [&](int, int, unsigned long, unsigned long) |
256 | @@ -293,15 +282,6 @@ | |||
257 | 293 | expand_icon_->SetVisible(can_refine); | 282 | expand_icon_->SetVisible(can_refine); |
258 | 294 | } | 283 | } |
259 | 295 | }); | 284 | }); |
260 | 296 | |||
261 | 297 | disable_glow.changed.connect([&](bool disabled) | ||
262 | 298 | { | ||
263 | 299 | layout_->SetVerticalExternalMargin(0); | ||
264 | 300 | layout_->SetHorizontalExternalMargin(0); | ||
265 | 301 | UpdateBackground(true); | ||
266 | 302 | QueueDraw(); | ||
267 | 303 | }); | ||
268 | 304 | |||
269 | 305 | } | 285 | } |
270 | 306 | 286 | ||
271 | 307 | SearchBar::~SearchBar() | 287 | SearchBar::~SearchBar() |
272 | @@ -426,13 +406,10 @@ | |||
273 | 426 | { | 406 | { |
274 | 427 | dash::Style& style = dash::Style::Instance(); | 407 | dash::Style& style = dash::Style::Instance(); |
275 | 428 | 408 | ||
278 | 429 | nux::Geometry geo(show_filters_->GetGeometry()); | 409 | nux::Geometry geo(expander_view_->GetGeometry()); |
277 | 430 | nux::Geometry const& geo_arrow = arrow_layout_->GetGeometry(); | ||
279 | 431 | 410 | ||
280 | 432 | geo.y -= (HIGHLIGHT_HEIGHT- geo.height) / 2; | 411 | geo.y -= (HIGHLIGHT_HEIGHT- geo.height) / 2; |
281 | 433 | geo.height = HIGHLIGHT_HEIGHT; | 412 | geo.height = HIGHLIGHT_HEIGHT; |
282 | 434 | geo.width = style.GetFilterBarWidth() + style.GetFilterBarLeftPadding() + style.GetFilterBarRightPadding(); | ||
283 | 435 | geo.x = geo_arrow.x + (geo_arrow.width - 1) - geo.width + style.GetFilterBarLeftPadding(); | ||
284 | 436 | 413 | ||
285 | 437 | if (!highlight_layer_) | 414 | if (!highlight_layer_) |
286 | 438 | highlight_layer_.reset(style.FocusOverlay(geo.width, geo.height)); | 415 | highlight_layer_.reset(style.FocusOverlay(geo.width, geo.height)); |
287 | @@ -514,7 +491,10 @@ | |||
288 | 514 | { | 491 | { |
289 | 515 | int RADIUS = 5; | 492 | int RADIUS = 5; |
290 | 516 | nux::Geometry geo(GetGeometry()); | 493 | nux::Geometry geo(GetGeometry()); |
292 | 517 | geo.width = layered_layout_->GetGeometry().width; | 494 | geo.width = layered_layout_->GetAbsoluteX() + |
293 | 495 | layered_layout_->GetAbsoluteWidth() - | ||
294 | 496 | GetAbsoluteX() + | ||
295 | 497 | SEARCH_ENTRY_RIGHT_BORDER; | ||
296 | 518 | 498 | ||
297 | 519 | LOG_DEBUG(logger) << "height: " | 499 | LOG_DEBUG(logger) << "height: " |
298 | 520 | << geo.height << " - " | 500 | << geo.height << " - " |
299 | @@ -534,9 +514,9 @@ | |||
300 | 534 | 514 | ||
301 | 535 | cairo_graphics.DrawRoundedRectangle(cr, | 515 | cairo_graphics.DrawRoundedRectangle(cr, |
302 | 536 | 1.0f, | 516 | 1.0f, |
304 | 537 | 1 + 0.5, 1 + 0.5, | 517 | 0.5, 0.5, |
305 | 538 | RADIUS, | 518 | RADIUS, |
307 | 539 | last_width_ - 1 - 2, last_height_ - 1 - 2, | 519 | last_width_ - 1, last_height_ - 1, |
308 | 540 | false); | 520 | false); |
309 | 541 | 521 | ||
310 | 542 | cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); | 522 | cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
311 | 543 | 523 | ||
312 | === modified file 'plugins/unityshell/src/SearchBar.h' | |||
313 | --- plugins/unityshell/src/SearchBar.h 2012-03-14 06:24:18 +0000 | |||
314 | +++ plugins/unityshell/src/SearchBar.h 2012-03-27 15:22:27 +0000 | |||
315 | @@ -57,8 +57,7 @@ | |||
316 | 57 | public: | 57 | public: |
317 | 58 | typedef nux::ObjectPtr<SearchBar> Ptr; | 58 | typedef nux::ObjectPtr<SearchBar> Ptr; |
318 | 59 | SearchBar(NUX_FILE_LINE_PROTO); | 59 | SearchBar(NUX_FILE_LINE_PROTO); |
321 | 60 | SearchBar(int search_width, bool show_filter_hint, NUX_FILE_LINE_PROTO); | 60 | SearchBar(bool show_filter_hint, NUX_FILE_LINE_PROTO); |
320 | 61 | SearchBar(int search_width, NUX_FILE_LINE_PROTO); | ||
322 | 62 | ~SearchBar(); | 61 | ~SearchBar(); |
323 | 63 | 62 | ||
324 | 64 | void SearchFinished(); | 63 | void SearchFinished(); |
325 | @@ -69,7 +68,6 @@ | |||
326 | 69 | nux::Property<std::string> search_hint; | 68 | nux::Property<std::string> search_hint; |
327 | 70 | nux::Property<bool> showing_filters; | 69 | nux::Property<bool> showing_filters; |
328 | 71 | nux::Property<bool> can_refine_search; | 70 | nux::Property<bool> can_refine_search; |
329 | 72 | nux::Property<bool> disable_glow; | ||
330 | 73 | nux::ROProperty<bool> im_active; | 71 | nux::ROProperty<bool> im_active; |
331 | 74 | 72 | ||
332 | 75 | sigc::signal<void> activated; | 73 | sigc::signal<void> activated; |
333 | @@ -115,6 +113,7 @@ | |||
334 | 115 | nux::AbstractPaintLayer* bg_layer_; | 113 | nux::AbstractPaintLayer* bg_layer_; |
335 | 116 | std::unique_ptr<nux::AbstractPaintLayer> highlight_layer_; | 114 | std::unique_ptr<nux::AbstractPaintLayer> highlight_layer_; |
336 | 117 | nux::HLayout* layout_; | 115 | nux::HLayout* layout_; |
337 | 116 | nux::HLayout* entry_layout_; | ||
338 | 118 | nux::LayeredLayout* layered_layout_; | 117 | nux::LayeredLayout* layered_layout_; |
339 | 119 | nux::StaticCairoText* hint_; | 118 | nux::StaticCairoText* hint_; |
340 | 120 | nux::LinearLayout* expander_layout_; | 119 | nux::LinearLayout* expander_layout_; |
341 | @@ -126,7 +125,6 @@ | |||
342 | 126 | nux::SpaceLayout* arrow_top_space_; | 125 | nux::SpaceLayout* arrow_top_space_; |
343 | 127 | nux::SpaceLayout* arrow_bottom_space_; | 126 | nux::SpaceLayout* arrow_bottom_space_; |
344 | 128 | IconTexture* expand_icon_; | 127 | IconTexture* expand_icon_; |
345 | 129 | int search_bar_width_; | ||
346 | 130 | 128 | ||
347 | 131 | int last_width_; | 129 | int last_width_; |
348 | 132 | int last_height_; | 130 | int last_height_; |
Aww man, I totally love u for this bug fix :-*