Merge lp:~nomeata/widelands/976077 into lp:widelands

Proposed by Joachim Breitner
Status: Merged
Merged at revision: 6436
Proposed branch: lp:~nomeata/widelands/976077
Merge into: lp:widelands
Diff against target: 65 lines (+9/-5)
2 files modified
src/wui/plot_area.cc (+8/-5)
src/wui/plot_area.h (+1/-0)
To merge this branch: bzr merge lp:~nomeata/widelands/976077
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+131729@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wui/plot_area.cc'
2--- src/wui/plot_area.cc 2012-09-21 21:36:07 +0000
3+++ src/wui/plot_area.cc 2012-10-27 12:01:23 +0000
4@@ -57,7 +57,8 @@
5 UI::Panel (parent, x, y, w, h),
6 spacing(5),
7 space_at_bottom(15),
8-space_at_right(5),
9+space_at_right(10),
10+space_left_of_label(15),
11 m_time (TIME_GAME),
12 m_sample_rate(0),
13 m_plotmode(PLOTMODE_ABSOLUTE),
14@@ -212,7 +213,7 @@
15
16 // plot the pixels
17 float sub =
18- xline_length
19+ (xline_length - space_left_of_label)
20 /
21 (static_cast<float>(time_in_ms_)
22 /
23@@ -237,7 +238,7 @@
24 }
25
26 dataset = &m_data;
27- sub = xline_length / static_cast<float>(nr_samples);
28+ sub = (xline_length - space_left_of_label) / static_cast<float>(nr_samples);
29 }
30
31 draw_plot_line
32@@ -380,7 +381,7 @@
33 UI::TextStyle xtickstyle(UI::TextStyle::ui_small());
34 xtickstyle.fg = RGBColor(255, 0, 0);
35
36- float sub = xline_length / how_many_ticks;
37+ float sub = (xline_length - space_left_of_label) / how_many_ticks;
38 float posx = get_inner_w() - space_at_right;
39
40 for (uint32_t i = 0; i <= how_many_ticks; ++i) {
41@@ -389,9 +390,11 @@
42 static_cast<int32_t>(posx), get_inner_h() - space_at_bottom + 3,
43 LINE_COLOR, 2);
44
45+ // The space at the end is intentional to have the tick centered
46+ // over the number, not to the left
47 snprintf
48 (buffer, sizeof(buffer),
49- "%u", max_x / how_many_ticks * i);
50+ "-%u ", max_x / how_many_ticks * i);
51
52 UI::g_fh->draw_text
53 (dst, xtickstyle,
54
55=== modified file 'src/wui/plot_area.h'
56--- src/wui/plot_area.h 2012-02-15 21:25:34 +0000
57+++ src/wui/plot_area.h 2012-10-27 12:01:23 +0000
58@@ -107,6 +107,7 @@
59 int32_t const spacing;
60 int32_t const space_at_bottom;
61 int32_t const space_at_right;
62+ int32_t const space_left_of_label;
63
64 static const uint32_t time_in_ms[];
65 static const uint32_t nr_samples = 30; // How many samples per diagramm when relative plotting

Subscribers

People subscribed via source and target branches

to status/vote changes: