diff options
author | belugas <belugas@openttd.org> | 2006-10-05 01:43:49 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2006-10-05 01:43:49 +0000 |
commit | 0257cc1496578020d7942059b3518acc6b0a63df (patch) | |
tree | 01128b2f1574643c630fdbdd0b66ec5701cacd4b | |
parent | 384a8be1cc615bbcdd40b96add005830d6fd1ae1 (diff) | |
download | openttd-0257cc1496578020d7942059b3518acc6b0a63df.tar.xz |
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
-rw-r--r-- | rail_gui.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/rail_gui.c b/rail_gui.c index c7114b88a..5eba3abbd 100644 --- a/rail_gui.c +++ b/rail_gui.c @@ -403,16 +403,33 @@ static const uint16 _rail_keycodes[] = { static void UpdateRemoveWidgetStatus(Window *w, int clicked_widget) { + /* If it is the removal button that has been clicked, do nothing, + * as it is up to the other buttons to drive removal status */ + if (clicked_widget == 16) return; + switch (clicked_widget) { - case 4: case 5: case 6: case 7: case 8: case 11: case 12: case 13: EnableWindowWidget(w, 16); break; - default: DisableWindowWidget(w, 16); LowerWindowWidget(w, 16); break; + case 4: case 5: case 6: case 7: case 8: case 11: case 12: case 13: + /* Removal button is enabled only if the rail/signal/waypoint/station + * button is still lowered. Once raised, it has to be disabled */ + SetWindowWidgetDisabledState(w, 16, !IsWindowWidgetLowered(w, clicked_widget)); + break; + + default: + /* When any other buttons than rail/signal/waypoint/station, raise and + * disable the removal button*/ + DisableWindowWidget(w, 16); + RaiseWindowWidget(w, 16); + break; } } static void BuildRailToolbWndProc(Window *w, WindowEvent *e) { switch (e->event) { + case WE_CREATE: DisableWindowWidget(w, 16); break; + case WE_PAINT: DrawWindowWidgets(w); break; + case WE_CLICK: if (e->we.click.widget >= 4) { _remove_button_clicked = false; |