← Back to team overview

widelands-dev team mailing list archive

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

 

Jens Beyer (Qcumber-some) has proposed merging lp:~qcumber-some/widelands/alocritani-896879-change_button_enable_logic into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #896879 in widelands: "Patch - Changes to spinboxes' behaviour"
  https://bugs.launchpad.net/widelands/+bug/896879

For more details, see:
https://code.launchpad.net/~qcumber-some/widelands/alocritani-896879-change_button_enable_logic/+merge/83533

On behalf of alocritani (see bug comments).
-- 
https://code.launchpad.net/~qcumber-some/widelands/alocritani-896879-change_button_enable_logic/+merge/83533
Your team Widelands Developers is requested to review the proposed merge of lp:~qcumber-some/widelands/alocritani-896879-change_button_enable_logic into lp:widelands.
=== modified file 'src/ui_basic/spinbox.cc'
--- src/ui_basic/spinbox.cc	2011-11-23 17:05:46 +0000
+++ src/ui_basic/spinbox.cc	2011-11-27 21:31:29 +0000
@@ -172,8 +172,8 @@
 	sbi->butMinus->set_enabled(sbi->min < sbi->value);
 	sbi->butPlus ->set_enabled           (sbi->value < sbi->max);
 	if (m_big) {
-		sbi->butTenMinus->set_enabled(sbi->min + 10 < sbi->value);
-		sbi->butTenPlus->set_enabled(sbi->value < sbi->max - 10);
+		sbi->butTenMinus->set_enabled(sbi->min < sbi->value);
+		sbi->butTenPlus ->set_enabled           (sbi->value < sbi->max);
 	}
 }
 
@@ -193,6 +193,10 @@
 void SpinBox::setValue(int32_t const value)
 {
 	sbi->value = value;
+	if (sbi->value > sbi->max)
+		sbi->value = sbi->max;
+	else if (sbi->value < sbi->min)
+		sbi->value = sbi->min;
 	update();
 }