terraform_gui.c
changeset 756 b76998029c12
parent 651 48b94e823465
child 867 dffd33233237
equal deleted inserted replaced
755:80091de50044 756:b76998029c12
    64 {
    64 {
    65 }
    65 }
    66 
    66 
    67 static void TerraformClick_Lower(Window *w)
    67 static void TerraformClick_Lower(Window *w)
    68 {
    68 {
    69 	HandlePlacePushButton(w, 3, ANIMCURSOR_LOWERLAND, 2, PlaceProc_LowerLand);
    69 	HandlePlacePushButton(w, 4, ANIMCURSOR_LOWERLAND, 2, PlaceProc_LowerLand);
    70 }
    70 }
    71 
    71 
    72 static void TerraformClick_Raise(Window *w)
    72 static void TerraformClick_Raise(Window *w)
    73 {
    73 {
    74 	HandlePlacePushButton(w, 4, ANIMCURSOR_RAISELAND, 2, PlaceProc_RaiseLand);
    74 	HandlePlacePushButton(w, 5, ANIMCURSOR_RAISELAND, 2, PlaceProc_RaiseLand);
    75 }
    75 }
    76 
    76 
    77 static void TerraformClick_Level(Window *w)
    77 static void TerraformClick_Level(Window *w)
    78 {
    78 {
    79 	HandlePlacePushButton(w, 5, SPR_OPENTTD_BASE+69, 2, PlaceProc_LevelLand);
    79 	HandlePlacePushButton(w, 6, SPR_OPENTTD_BASE+69, 2, PlaceProc_LevelLand);
    80 }
    80 }
    81 
    81 
    82 static void TerraformClick_BuyLand(Window *w)
    82 static void TerraformClick_BuyLand(Window *w)
    83 {
    83 {
    84 	HandlePlacePushButton(w, 6, 4792, 1, PlaceProc_BuyLand);
    84 	HandlePlacePushButton(w, 7, 4792, 1, PlaceProc_BuyLand);
    85 }
    85 }
    86 
    86 
    87 static void TerraformClick_Trees(Window *w)
    87 static void TerraformClick_Trees(Window *w)
    88 {
    88 {
    89 	if (HandlePlacePushButton(w, 7, 0, 1, PlaceProc_PlantTree)) ShowBuildTreesToolbar();
    89 	if (HandlePlacePushButton(w, 8, 0, 1, PlaceProc_PlantTree)) ShowBuildTreesToolbar();
    90 }
    90 }
    91 
    91 
    92 static void TerraformClick_PlaceSign(Window *w)
    92 static void TerraformClick_PlaceSign(Window *w)
    93 {
    93 {
    94 	HandlePlacePushButton(w, 8, 722, 1, PlaceProc_Sign);
    94 	HandlePlacePushButton(w, 9, 722, 1, PlaceProc_Sign);
    95 }
    95 }
    96 
    96 
    97 
    97 
    98 static OnButtonClick * const _terraform_button_proc[] = {
    98 static OnButtonClick * const _terraform_button_proc[] = {
    99 	TerraformClick_Lower,
    99 	TerraformClick_Lower,
   111 	switch(e->event) {
   111 	switch(e->event) {
   112 	case WE_PAINT:
   112 	case WE_PAINT:
   113 		DrawWindowWidgets(w);
   113 		DrawWindowWidgets(w);
   114 		break;
   114 		break;
   115 	case WE_CLICK:
   115 	case WE_CLICK:
   116 		if (e->click.widget >= 3) {
   116 		if (e->click.widget >= 4) {
   117 			_terraform_button_proc[e->click.widget - 3](w);
   117 			_terraform_button_proc[e->click.widget - 4](w);
   118 		}
   118 		}
   119 		break;
   119 		break;
   120 
   120 
   121 	case WE_KEYPRESS:
   121 	case WE_KEYPRESS:
   122 	{
   122 	{
   157 			}
   157 			}
   158 		}
   158 		}
   159 		break;
   159 		break;
   160 
   160 
   161 	case WE_ABORT_PLACE_OBJ:
   161 	case WE_ABORT_PLACE_OBJ:
   162 		w->click_state = 0;
   162 		UnclickWindowButtons(w);
   163 		SetWindowDirty(w);
   163 		SetWindowDirty(w);
   164 
   164 
   165 		w = FindWindowById(WC_BUILD_STATION, 0);
   165 		w = FindWindowById(WC_BUILD_STATION, 0);
   166 		if (w != NULL) WP(w,def_d).close=true;
   166 		if (w != NULL) WP(w,def_d).close=true;
   167 		w = FindWindowById(WC_BUILD_DEPOT, 0);
   167 		w = FindWindowById(WC_BUILD_DEPOT, 0);
   173 	}
   173 	}
   174 }
   174 }
   175 
   175 
   176 static const Widget _terraform_widgets[] = {
   176 static const Widget _terraform_widgets[] = {
   177 { WWT_CLOSEBOX,     7,   0,  10,   0,  13, STR_00C5,								STR_018B_CLOSE_WINDOW},
   177 { WWT_CLOSEBOX,     7,   0,  10,   0,  13, STR_00C5,								STR_018B_CLOSE_WINDOW},
   178 {  WWT_CAPTION,     7,  11, 135,   0,  13, STR_LANDSCAPING_TOOLBAR,	STR_018C_WINDOW_TITLE_DRAG_THIS},
   178 {  WWT_CAPTION,     7,  11, 123,   0,  13, STR_LANDSCAPING_TOOLBAR,	STR_018C_WINDOW_TITLE_DRAG_THIS},
       
   179 {WWT_STICKYBOX,     7, 124, 135,   0,  13, 0x0,                     STR_STICKY_BUTTON},
   179 
   180 
   180 {    WWT_PANEL,     7,  66,  69,  14,  35,  0x0,										STR_NULL},
   181 {    WWT_PANEL,     7,  66,  69,  14,  35,  0x0,										STR_NULL},
   181 
   182 
   182 {    WWT_PANEL,     7,   0,  21,  14,  35,  695,										STR_018E_LOWER_A_CORNER_OF_LAND},
   183 {    WWT_PANEL,     7,   0,  21,  14,  35,  695,										STR_018E_LOWER_A_CORNER_OF_LAND},
   183 {    WWT_PANEL,     7,  22,  43,  14,  35,  694,										STR_018F_RAISE_A_CORNER_OF_LAND},
   184 {    WWT_PANEL,     7,  22,  43,  14,  35,  694,										STR_018F_RAISE_A_CORNER_OF_LAND},
   190 };
   191 };
   191 
   192 
   192 static const WindowDesc _terraform_desc = {
   193 static const WindowDesc _terraform_desc = {
   193 	640-136, 22+36, 136, 36,
   194 	640-136, 22+36, 136, 36,
   194 	WC_SCEN_LAND_GEN,0,
   195 	WC_SCEN_LAND_GEN,0,
   195 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
   196 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
   196 	_terraform_widgets,
   197 	_terraform_widgets,
   197 	TerraformToolbWndProc
   198 	TerraformToolbWndProc
   198 };
   199 };
   199 
   200 
   200 
   201