Merge lp:~macslow/unity/unity.fix-851359 into lp:unity

Proposed by Mirco Müller
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 1666
Proposed branch: lp:~macslow/unity/unity.fix-851359
Merge into: lp:unity
Diff against target: 108 lines (+25/-8)
2 files modified
plugins/unityshell/src/DashStyle.cpp (+18/-4)
plugins/unityshell/src/FilterMultiRangeButton.cpp (+7/-4)
To merge this branch: bzr merge lp:~macslow/unity/unity.fix-851359
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+77479@code.launchpad.net

Description of the change

Fixes LP: #851359 by making the left/right margin for the text in the multirange-widget configurable and also use the <small>-tag of the pango-markup to even further condense the text.

Also see a before/after screenshot if you're the lazy-type ;)

http://people.canonical.com/~mmueller/before-after-851359.jpg

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) :
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 2011-09-22 09:22:25 +0000
3+++ plugins/unityshell/src/DashStyle.cpp 2011-09-29 08:36:34 +0000
4@@ -55,10 +55,17 @@
5 {
6 double fract = val - (int) val;
7
8+ // for strokes with an odd line-width
9 if (fract != 0.5f)
10 return (double) ((int) val + 0.5f);
11 else
12 return val;
13+
14+ // for strokes with an even line-width
15+ /*if (fract != 0.0f)
16+ return (double) ((int) val);
17+ else
18+ return val;*/
19 }
20
21 } // anon namespace
22@@ -84,7 +91,8 @@
23
24 void Text(cairo_t* cr,
25 nux::Color const& color,
26- std::string const& label);
27+ std::string const& label,
28+ double horizMargin = 10.0);
29
30 void ButtonOutlinePath(cairo_t* cr, bool align);
31
32@@ -897,6 +905,9 @@
33 90.0f * G_PI / 180.0f,
34 180.0f * G_PI / 180.0f);
35
36+ // left, right of the corner
37+ cairo_line_to(cr, x, y + radius);
38+
39 // top-left, right of the corner
40 cairo_arc(cr,
41 x + radius,
42@@ -904,6 +915,7 @@
43 radius,
44 180.0f * G_PI / 180.0f,
45 270.0f * G_PI / 180.0f);
46+
47 break;
48
49 case Segment::MIDDLE:
50@@ -1213,7 +1225,8 @@
51
52 void DashStyle::Impl::Text(cairo_t* cr,
53 nux::Color const& color,
54- std::string const& label)
55+ std::string const& label,
56+ double horizMargin)
57 {
58 double x = 0.0;
59 double y = 0.0;
60@@ -1226,7 +1239,7 @@
61 GdkScreen* screen = gdk_screen_get_default(); // not ref'ed
62 GtkSettings* settings = gtk_settings_get_default(); // not ref'ed
63 gchar* fontName = NULL;
64- double horizMargin = 10.0;
65+ //double horizMargin = 10.0;
66
67 w = cairo_image_surface_get_width(cairo_get_target(cr));
68 h = cairo_image_surface_get_height(cairo_get_target(cr));
69@@ -1579,7 +1592,8 @@
70 cairo_stroke(cr);
71 pimpl->Text(cr,
72 pimpl->button_label_text_color_[state],
73- label);
74+ label,
75+ 1.0);
76
77 return true;
78 }
79
80=== modified file 'plugins/unityshell/src/FilterMultiRangeButton.cpp'
81--- plugins/unityshell/src/FilterMultiRangeButton.cpp 2011-09-15 02:09:12 +0000
82+++ plugins/unityshell/src/FilterMultiRangeButton.cpp 2011-09-29 08:36:34 +0000
83@@ -129,10 +129,14 @@
84
85 void FilterMultiRangeButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state)
86 {
87-
88 std::string name = "10";
89+ std::stringstream final;
90+
91 if (filter_)
92- name = filter_->name;
93+ {
94+ name = filter_->name;
95+ final << "<small>" << name << "</small>";
96+ }
97
98 DashStyle::Arrow arrow;
99 if (has_arrow_ == MULTI_RANGE_ARROW_NONE)
100@@ -152,8 +156,7 @@
101 else
102 segment = DashStyle::Segment::RIGHT;
103
104-
105- DashStyle::Instance().MultiRangeSegment(cr, faked_state, name, arrow, segment);
106+ DashStyle::Instance().MultiRangeSegment(cr, faked_state, final.str(), arrow, segment);
107 NeedRedraw();
108 }
109