From 8b223f0274f67ead6089f4c34224b9b99fb460e1 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 31 Dec 2011 14:56:39 +0000 Subject: (svn r23695) -Fix/Feature [FS#4916]: make a distinction between fully zoomed in and default zoomed in screenshots --- src/lang/english.txt | 3 ++- src/screenshot.cpp | 10 ++++--- src/screenshot.h | 11 ++++---- src/toolbar_gui.cpp | 74 ++++++++++++++++++++++++++++++---------------------- 4 files changed, 58 insertions(+), 40 deletions(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index e28d32800..ea6b69a99 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -446,7 +446,8 @@ STR_ABOUT_MENU_SEPARATOR : STR_ABOUT_MENU_TOGGLE_CONSOLE :Toggle console STR_ABOUT_MENU_AI_DEBUG :AI / GameScript debug STR_ABOUT_MENU_SCREENSHOT :Screenshot -STR_ABOUT_MENU_ZOOMIN_SCREENSHOT :Zoomed in screenshot +STR_ABOUT_MENU_ZOOMIN_SCREENSHOT :Fully zoomed in screenshot +STR_ABOUT_MENU_DEFAULTZOOM_SCREENSHOT :Default zoom screenshot STR_ABOUT_MENU_GIANT_SCREENSHOT :Whole map screenshot STR_ABOUT_MENU_ABOUT_OPENTTD :About 'OpenTTD' STR_ABOUT_MENU_SPRITE_ALIGNER :Sprite aligner diff --git a/src/screenshot.cpp b/src/screenshot.cpp index 9f8174208..a2b351379 100644 --- a/src/screenshot.cpp +++ b/src/screenshot.cpp @@ -729,12 +729,12 @@ static bool MakeSmallScreenshot() } /** Make a zoomed-in screenshot of the currently visible area. */ -static bool MakeZoomedInScreenshot() +static bool MakeZoomedInScreenshot(ZoomLevel zl) { Window *w = FindWindowById(WC_MAIN_WINDOW, 0); ViewPort vp; - vp.zoom = _settings_client.gui.zoom_min; + vp.zoom = zl; vp.left = w->viewport->left; vp.top = w->viewport->top; vp.virtual_left = w->viewport->virtual_left; @@ -845,7 +845,11 @@ bool MakeScreenshot(ScreenshotType t, const char *name) break; case SC_ZOOMEDIN: - ret = MakeZoomedInScreenshot(); + ret = MakeZoomedInScreenshot(_settings_client.gui.zoom_min); + break; + + case SC_DEFAULTZOOM: + ret = MakeZoomedInScreenshot(ZOOM_LVL_VIEWPORT); break; case SC_WORLD: diff --git a/src/screenshot.h b/src/screenshot.h index 64c588178..474b93f89 100644 --- a/src/screenshot.h +++ b/src/screenshot.h @@ -20,11 +20,12 @@ const char *GetCurrentScreenshotExtension(); /** Type of requested screenshot */ enum ScreenshotType { - SC_VIEWPORT, ///< Screenshot of viewport. - SC_RAW, ///< Raw screenshot from blitter buffer. - SC_ZOOMEDIN, ///< Zoomed in screenshot of the visible area. - SC_WORLD, ///< World screenshot. - SC_HEIGHTMAP, ///< Heightmap of the world. + SC_VIEWPORT, ///< Screenshot of viewport. + SC_RAW, ///< Raw screenshot from blitter buffer. + SC_ZOOMEDIN, ///< Fully zoomed in screenshot of the visible area. + SC_DEFAULTZOOM, ///< Zoomed to default zoom level screenshot of the visible area. + SC_WORLD, ///< World screenshot. + SC_HEIGHTMAP, ///< Heightmap of the world. }; bool MakeHeightmapScreenshot(const char *filename); diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index de1fb73bf..1ab2ba0f1 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -953,7 +953,7 @@ static CallBackFunction PlaceLandBlockInfo() static CallBackFunction ToolbarHelpClick(Window *w) { - PopupMainToolbMenu(w, WID_TN_HELP, STR_ABOUT_MENU_LAND_BLOCK_INFO, _settings_client.gui.newgrf_developer_tools ? 10 : 8); + PopupMainToolbMenu(w, WID_TN_HELP, STR_ABOUT_MENU_LAND_BLOCK_INFO, _settings_client.gui.newgrf_developer_tools ? 11 : 9); return CBF_NONE; } @@ -967,6 +967,11 @@ static void MenuClickZoomedInScreenshot() MakeScreenshot(SC_ZOOMEDIN, NULL); } +static void MenuClickDefaultZoomScreenshot() +{ + MakeScreenshot(SC_DEFAULTZOOM, NULL); +} + static void MenuClickWorldScreenshot() { MakeScreenshot(SC_WORLD, NULL); @@ -997,15 +1002,16 @@ void ToggleBoundingBoxes() static CallBackFunction MenuClickHelp(int index) { switch (index) { - case 0: return PlaceLandBlockInfo(); - case 2: IConsoleSwitch(); break; - case 3: ShowAIDebugWindow(); break; - case 4: MenuClickSmallScreenshot(); break; - case 5: MenuClickZoomedInScreenshot(); break; - case 6: MenuClickWorldScreenshot(); break; - case 7: ShowAboutWindow(); break; - case 8: ShowSpriteAlignerWindow(); break; - case 9: ToggleBoundingBoxes(); break; + case 0: return PlaceLandBlockInfo(); + case 2: IConsoleSwitch(); break; + case 3: ShowAIDebugWindow(); break; + case 4: MenuClickSmallScreenshot(); break; + case 5: MenuClickDefaultZoomScreenshot(); break; + case 6: MenuClickZoomedInScreenshot(); break; + case 7: MenuClickWorldScreenshot(); break; + case 8: ShowAboutWindow(); break; + case 9: ShowSpriteAlignerWindow(); break; + case 10: ToggleBoundingBoxes(); break; } return CBF_NONE; } @@ -1497,6 +1503,7 @@ enum MainToolbarHotkeys { MTHK_AI_DEBUG, MTHK_SMALL_SCREENSHOT, MTHK_ZOOMEDIN_SCREENSHOT, + MTHK_DEFAULTZOOM_SCREENSHOT, MTHK_GIANT_SCREENSHOT, MTHK_CHEATS, MTHK_TERRAFORM, @@ -1579,6 +1586,7 @@ struct MainToolbarWindow : Window { case MTHK_AI_DEBUG: ShowAIDebugWindow(); break; case MTHK_SMALL_SCREENSHOT: MenuClickSmallScreenshot(); break; case MTHK_ZOOMEDIN_SCREENSHOT: MenuClickZoomedInScreenshot(); break; + case MTHK_DEFAULTZOOM_SCREENSHOT: MenuClickDefaultZoomScreenshot(); break; case MTHK_GIANT_SCREENSHOT: MenuClickWorldScreenshot(); break; case MTHK_CHEATS: if (!_networking) ShowCheatWindow(); break; case MTHK_TERRAFORM: ShowTerraformToolbar(); break; @@ -1681,6 +1689,7 @@ Hotkey MainToolbarWindow::maintoolbar_hotkeys[] = { Hotkey((uint16)0, "ai_debug", MTHK_AI_DEBUG), Hotkey(WKC_CTRL | 'S', "small_screenshot", MTHK_SMALL_SCREENSHOT), Hotkey(WKC_CTRL | 'P', "zoomedin_screenshot", MTHK_ZOOMEDIN_SCREENSHOT), + Hotkey(WKC_CTRL | 'D', "defaultzoom_screenshot", MTHK_DEFAULTZOOM_SCREENSHOT), Hotkey((uint16)0, "giant_screenshot", MTHK_GIANT_SCREENSHOT), Hotkey(WKC_CTRL | WKC_ALT | 'C', "cheats", MTHK_CHEATS), Hotkey('L', "terraform", MTHK_TERRAFORM), @@ -1800,6 +1809,7 @@ enum MainToolbarEditorHotkeys { MTEHK_LANDINFO, MTEHK_SMALL_SCREENSHOT, MTEHK_ZOOMEDIN_SCREENSHOT, + MTEHK_DEFAULTZOOM_SCREENSHOT, MTEHK_GIANT_SCREENSHOT, MTEHK_ZOOM_IN, MTEHK_ZOOM_OUT, @@ -1886,27 +1896,28 @@ struct ScenarioEditorToolbarWindow : Window { { CallBackFunction cbf = CBF_NONE; switch (CheckHotkeyMatch(scenedit_maintoolbar_hotkeys, keycode, this)) { - case MTEHK_PAUSE: ToolbarPauseClick(this); break; - case MTEHK_FASTFORWARD: ToolbarFastForwardClick(this); break; - case MTEHK_SETTINGS: ShowGameOptions(); break; - case MTEHK_SAVEGAME: MenuClickSaveLoad(); break; - case MTEHK_GENLAND: ToolbarScenGenLand(this); break; - case MTEHK_GENTOWN: ToolbarScenGenTown(this); break; - case MTEHK_GENINDUSTRY: ToolbarScenGenIndustry(this); break; - case MTEHK_BUILD_ROAD: ToolbarScenBuildRoad(this); break; - case MTEHK_BUILD_DOCKS: ToolbarScenBuildDocks(this); break; - case MTEHK_BUILD_TREES: ToolbarScenPlantTrees(this); break; - case MTEHK_SIGN: cbf = ToolbarScenPlaceSign(this); break; - case MTEHK_MUSIC: ShowMusicWindow(); break; - case MTEHK_LANDINFO: cbf = PlaceLandBlockInfo(); break; - case MTEHK_SMALL_SCREENSHOT: MenuClickSmallScreenshot(); break; - case MTEHK_ZOOMEDIN_SCREENSHOT: MenuClickZoomedInScreenshot(); break; - case MTEHK_GIANT_SCREENSHOT: MenuClickWorldScreenshot(); break; - case MTEHK_ZOOM_IN: ToolbarZoomInClick(this); break; - case MTEHK_ZOOM_OUT: ToolbarZoomOutClick(this); break; - case MTEHK_TERRAFORM: ShowEditorTerraformToolbar(); break; - case MTEHK_SMALLMAP: ShowSmallMap(); break; - case MTEHK_EXTRA_VIEWPORT: ShowExtraViewPortWindowForTileUnderCursor(); break; + case MTEHK_PAUSE: ToolbarPauseClick(this); break; + case MTEHK_FASTFORWARD: ToolbarFastForwardClick(this); break; + case MTEHK_SETTINGS: ShowGameOptions(); break; + case MTEHK_SAVEGAME: MenuClickSaveLoad(); break; + case MTEHK_GENLAND: ToolbarScenGenLand(this); break; + case MTEHK_GENTOWN: ToolbarScenGenTown(this); break; + case MTEHK_GENINDUSTRY: ToolbarScenGenIndustry(this); break; + case MTEHK_BUILD_ROAD: ToolbarScenBuildRoad(this); break; + case MTEHK_BUILD_DOCKS: ToolbarScenBuildDocks(this); break; + case MTEHK_BUILD_TREES: ToolbarScenPlantTrees(this); break; + case MTEHK_SIGN: cbf = ToolbarScenPlaceSign(this); break; + case MTEHK_MUSIC: ShowMusicWindow(); break; + case MTEHK_LANDINFO: cbf = PlaceLandBlockInfo(); break; + case MTEHK_SMALL_SCREENSHOT: MenuClickSmallScreenshot(); break; + case MTEHK_ZOOMEDIN_SCREENSHOT: MenuClickZoomedInScreenshot(); break; + case MTEHK_DEFAULTZOOM_SCREENSHOT: MenuClickDefaultZoomScreenshot(); break; + case MTEHK_GIANT_SCREENSHOT: MenuClickWorldScreenshot(); break; + case MTEHK_ZOOM_IN: ToolbarZoomInClick(this); break; + case MTEHK_ZOOM_OUT: ToolbarZoomOutClick(this); break; + case MTEHK_TERRAFORM: ShowEditorTerraformToolbar(); break; + case MTEHK_SMALLMAP: ShowSmallMap(); break; + case MTEHK_EXTRA_VIEWPORT: ShowExtraViewPortWindowForTileUnderCursor(); break; default: return ES_NOT_HANDLED; } if (cbf != CBF_NONE) this->last_started_action = cbf; @@ -1996,6 +2007,7 @@ Hotkey ScenarioEditorToolbarWindow::scenedit_mainto Hotkey(WKC_F12, "land_info", MTEHK_LANDINFO), Hotkey(WKC_CTRL | 'S', "small_screenshot", MTEHK_SMALL_SCREENSHOT), Hotkey(WKC_CTRL | 'P', "zoomedin_screenshot", MTEHK_ZOOMEDIN_SCREENSHOT), + Hotkey(WKC_CTRL | 'D', "defaultzoom_screenshot", MTEHK_DEFAULTZOOM_SCREENSHOT), Hotkey((uint16)0, "giant_screenshot", MTEHK_GIANT_SCREENSHOT), Hotkey(_maintoolbar_zoomin_keys, "zoomin", MTEHK_ZOOM_IN), Hotkey(_maintoolbar_zoomout_keys, "zoomout", MTEHK_ZOOM_OUT), -- cgit v1.2.3-70-g09d2