Merge lp:~qcumber-some/widelands/alocritani-896879-change_button_enable_logic into lp:widelands

Proposed by Jens Beyer
Status: Merged
Merged at revision: 6132
Proposed branch: lp:~qcumber-some/widelands/alocritani-896879-change_button_enable_logic
Merge into: lp:widelands
Diff against target: 24 lines (+6/-2)
1 file modified
src/ui_basic/spinbox.cc (+6/-2)
To merge this branch: bzr merge lp:~qcumber-some/widelands/alocritani-896879-change_button_enable_logic
Reviewer Review Type Date Requested Status
Nicolai Hähnle Approve
Tino Approve
Review via email: mp+83533@code.launchpad.net

Description of the change

On behalf of alocritani (see bug comments).

To post a comment you must log in.
Revision history for this message
Tino (tino79) :
review: Approve
Revision history for this message
Nicolai Hähnle (nha) wrote :

Approve.

Side note: I'm not a huge fan of the type of alignment that is done in the hunk at line 172. Yes, the original code does it that way, so this is not a comment against the patch. I just don't think it's good practice, because it makes code maintenance more painful.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ui_basic/spinbox.cc'
2--- src/ui_basic/spinbox.cc 2011-11-23 17:05:46 +0000
3+++ src/ui_basic/spinbox.cc 2011-11-27 21:31:29 +0000
4@@ -172,8 +172,8 @@
5 sbi->butMinus->set_enabled(sbi->min < sbi->value);
6 sbi->butPlus ->set_enabled (sbi->value < sbi->max);
7 if (m_big) {
8- sbi->butTenMinus->set_enabled(sbi->min + 10 < sbi->value);
9- sbi->butTenPlus->set_enabled(sbi->value < sbi->max - 10);
10+ sbi->butTenMinus->set_enabled(sbi->min < sbi->value);
11+ sbi->butTenPlus ->set_enabled (sbi->value < sbi->max);
12 }
13 }
14
15@@ -193,6 +193,10 @@
16 void SpinBox::setValue(int32_t const value)
17 {
18 sbi->value = value;
19+ if (sbi->value > sbi->max)
20+ sbi->value = sbi->max;
21+ else if (sbi->value < sbi->min)
22+ sbi->value = sbi->min;
23 update();
24 }
25

Subscribers

People subscribed via source and target branches

to status/vote changes: