(svn r7176) -Fix: remove button was not always disabled when it should have been (rail/road build toolbar)
authorglx
Thu, 16 Nov 2006 18:41:57 +0000
changeset 5105 4332193c0aec
parent 5104 feac5e527d3f
child 5106 532ce17f917a
(svn r7176) -Fix: remove button was not always disabled when it should have been (rail/road build toolbar)
rail_gui.c
road_gui.c
--- a/rail_gui.c	Thu Nov 16 18:33:55 2006 +0000
+++ b/rail_gui.c	Thu Nov 16 18:41:57 2006 +0000
@@ -493,6 +493,8 @@
 
 	case WE_ABORT_PLACE_OBJ:
 		RaiseWindowButtons(w);
+		DisableWindowWidget(w, 16);
+		InvalidateWidget(w, 16);
 
 		w = FindWindowById(WC_BUILD_STATION, 0);
 		if (w != NULL) WP(w,def_d).close = true;
--- a/road_gui.c	Thu Nov 16 18:33:55 2006 +0000
+++ b/road_gui.c	Thu Nov 16 18:41:57 2006 +0000
@@ -183,12 +183,11 @@
 static void BuildRoadToolbWndProc(Window *w, WindowEvent *e)
 {
 	switch (e->event) {
+	case WE_CREATE: DisableWindowWidget(w, 11); break;
+
 	case WE_PAINT:
 		if (IsWindowWidgetLowered(w, 3) || IsWindowWidgetLowered(w, 4)) {
 			EnableWindowWidget(w, 11);
-		} else {
-			DisableWindowWidget(w, 11);
-			RaiseWindowWidget(w, 11);
 		}
 		DrawWindowWidgets(w);
 		break;
@@ -222,6 +221,8 @@
 
 	case WE_ABORT_PLACE_OBJ:
 		RaiseWindowButtons(w);
+		DisableWindowWidget(w, 11);
+		InvalidateWidget(w, 11);
 
 		w = FindWindowById(WC_BUS_STATION, 0);
 		if (w != NULL) WP(w,def_d).close = true;