src/main_gui.cpp
changeset 6247 7d81e3a5d803
parent 6231 ff7454d35935
child 6259 471b91a4b1d8
equal deleted inserted replaced
6246:75451000349d 6247:7d81e3a5d803
    50 
    50 
    51 static byte _terraform_size = 1;
    51 static byte _terraform_size = 1;
    52 RailType _last_built_railtype;
    52 RailType _last_built_railtype;
    53 static int _scengen_town_size = 2; // depress medium-sized towns per default
    53 static int _scengen_town_size = 2; // depress medium-sized towns per default
    54 
    54 
    55 extern void GenerateIndustries(void);
    55 extern void GenerateIndustries();
    56 extern bool GenerateTowns(void);
    56 extern bool GenerateTowns();
    57 
    57 
    58 
    58 
    59 void HandleOnEditText(const char *str)
    59 void HandleOnEditText(const char *str)
    60 {
    60 {
    61 	int id = _rename_id;
    61 	int id = _rename_id;
   335 	_rename_what = 1;
   335 	_rename_what = 1;
   336 	SetDParam(0, id);
   336 	SetDParam(0, id);
   337 	ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, 30, 180, NULL, CS_ALPHANUMERAL);
   337 	ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, 30, 180, NULL, CS_ALPHANUMERAL);
   338 }
   338 }
   339 
   339 
   340 static void SelectSignTool(void)
   340 static void SelectSignTool()
   341 {
   341 {
   342 	if (_cursor.sprite == SPR_CURSOR_SIGN) {
   342 	if (_cursor.sprite == SPR_CURSOR_SIGN) {
   343 		ResetObjectToPlace();
   343 		ResetObjectToPlace();
   344 	} else {
   344 	} else {
   345 		SetObjectToPlace(SPR_CURSOR_SIGN, PAL_NONE, 1, WC_MAIN_TOOLBAR, 0);
   345 		SetObjectToPlace(SPR_CURSOR_SIGN, PAL_NONE, 1, WC_MAIN_TOOLBAR, 0);
   368 		case 1: ShowMessageOptions();  break;
   368 		case 1: ShowMessageOptions();  break;
   369 		case 2: ShowMessageHistory();  break;
   369 		case 2: ShowMessageHistory();  break;
   370 	}
   370 	}
   371 }
   371 }
   372 
   372 
   373 static void MenuClickSmallScreenshot(void)
   373 static void MenuClickSmallScreenshot()
   374 {
   374 {
   375 	SetScreenshotType(SC_VIEWPORT);
   375 	SetScreenshotType(SC_VIEWPORT);
   376 }
   376 }
   377 
   377 
   378 static void MenuClickWorldScreenshot(void)
   378 static void MenuClickWorldScreenshot()
   379 {
   379 {
   380 	SetScreenshotType(SC_WORLD);
   380 	SetScreenshotType(SC_WORLD);
   381 }
   381 }
   382 
   382 
   383 static void MenuClickHelp(int index)
   383 static void MenuClickHelp(int index)
  1377 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
  1377 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
  1378 	_scen_edit_land_gen_widgets,
  1378 	_scen_edit_land_gen_widgets,
  1379 	ScenEditLandGenWndProc,
  1379 	ScenEditLandGenWndProc,
  1380 };
  1380 };
  1381 
  1381 
  1382 static inline void ShowEditorTerraformToolBar(void)
  1382 static inline void ShowEditorTerraformToolBar()
  1383 {
  1383 {
  1384 	AllocateWindowDescFront(&_scen_edit_land_gen_desc, 0);
  1384 	AllocateWindowDescFront(&_scen_edit_land_gen_desc, 0);
  1385 }
  1385 }
  1386 
  1386 
  1387 static void ToolbarScenGenLand(Window *w)
  1387 static void ToolbarScenGenLand(Window *w)
  1591 {    WWT_TEXTBTN,   RESIZE_NONE,    14,     2,   167,   172,   183, STR_0261_SUGAR_MINE,          STR_0284_CONSTRUCT_SUGAR_MINE},
  1591 {    WWT_TEXTBTN,   RESIZE_NONE,    14,     2,   167,   172,   183, STR_0261_SUGAR_MINE,          STR_0284_CONSTRUCT_SUGAR_MINE},
  1592 {   WIDGETS_END},
  1592 {   WIDGETS_END},
  1593 };
  1593 };
  1594 
  1594 
  1595 
  1595 
  1596 static bool AnyTownExists(void)
  1596 static bool AnyTownExists()
  1597 {
  1597 {
  1598 	const Town *t;
  1598 	const Town *t;
  1599 
  1599 
  1600 	FOR_ALL_TOWNS(t) return true;
  1600 	FOR_ALL_TOWNS(t) return true;
  1601 
  1601 
  2233 	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
  2233 	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
  2234 	_main_status_widgets,
  2234 	_main_status_widgets,
  2235 	StatusBarWndProc
  2235 	StatusBarWndProc
  2236 };
  2236 };
  2237 
  2237 
  2238 extern void UpdateAllStationVirtCoord(void);
  2238 extern void UpdateAllStationVirtCoord();
  2239 
  2239 
  2240 static void MainWindowWndProc(Window *w, WindowEvent *e)
  2240 static void MainWindowWndProc(Window *w, WindowEvent *e)
  2241 {
  2241 {
  2242 	int off_x;
  2242 	int off_x;
  2243 
  2243 
  2399 			break;
  2399 			break;
  2400 	}
  2400 	}
  2401 }
  2401 }
  2402 
  2402 
  2403 
  2403 
  2404 void ShowSelectGameWindow(void);
  2404 void ShowSelectGameWindow();
  2405 
  2405 
  2406 void SetupColorsAndInitialWindow(void)
  2406 void SetupColorsAndInitialWindow()
  2407 {
  2407 {
  2408 	uint i;
  2408 	uint i;
  2409 	Window *w;
  2409 	Window *w;
  2410 	int width, height;
  2410 	int width, height;
  2411 
  2411 
  2434 			ShowVitalWindows();
  2434 			ShowVitalWindows();
  2435 			break;
  2435 			break;
  2436 	}
  2436 	}
  2437 }
  2437 }
  2438 
  2438 
  2439 void ShowVitalWindows(void)
  2439 void ShowVitalWindows()
  2440 {
  2440 {
  2441 	Window *w;
  2441 	Window *w;
  2442 
  2442 
  2443 	w = AllocateWindowDesc((_game_mode != GM_EDITOR) ? &_toolb_normal_desc : &_toolb_scen_desc);
  2443 	w = AllocateWindowDesc((_game_mode != GM_EDITOR) ? &_toolb_normal_desc : &_toolb_scen_desc);
  2444 	DoZoomInOutWindow(ZOOM_NONE, w);
  2444 	DoZoomInOutWindow(ZOOM_NONE, w);
  2459 	CLRBITS(w->flags4, WF_WHITE_BORDER_MASK);
  2459 	CLRBITS(w->flags4, WF_WHITE_BORDER_MASK);
  2460 
  2460 
  2461 	WP(w,def_d).data_1 = -1280;
  2461 	WP(w,def_d).data_1 = -1280;
  2462 }
  2462 }
  2463 
  2463 
  2464 void GameSizeChanged(void)
  2464 void GameSizeChanged()
  2465 {
  2465 {
  2466 	_cur_resolution[0] = _screen.width;
  2466 	_cur_resolution[0] = _screen.width;
  2467 	_cur_resolution[1] = _screen.height;
  2467 	_cur_resolution[1] = _screen.height;
  2468 	RelocateAllWindows(_screen.width, _screen.height);
  2468 	RelocateAllWindows(_screen.width, _screen.height);
  2469 	ScreenSizeChanged();
  2469 	ScreenSizeChanged();
  2470 	MarkWholeScreenDirty();
  2470 	MarkWholeScreenDirty();
  2471 }
  2471 }
  2472 
  2472 
  2473 void InitializeMainGui(void)
  2473 void InitializeMainGui()
  2474 {
  2474 {
  2475 	/* Clean old GUI values */
  2475 	/* Clean old GUI values */
  2476 	_last_built_railtype = RAILTYPE_RAIL;
  2476 	_last_built_railtype = RAILTYPE_RAIL;
  2477 }
  2477 }
  2478 
  2478