From d74885cc1813442aecd0a7a74d41a579b55fba82 Mon Sep 17 00:00:00 2001 From: Maikel Stuivenberg Date: Fri, 26 Jun 2015 17:01:50 +0200 Subject: [PATCH 1/4] show/hide UI #1402 --- data/language/english_uk.txt | 1 + src/config.c | 1 + src/config.h | 1 + src/interface/keyboard_shortcut.c | 15 +++++++++++++++ src/interface/viewport.h | 2 +- src/localisation/string_ids.h | 1 + 6 files changed, 20 insertions(+), 1 deletion(-) diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index 0a2e5fd020..9ffd140a65 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3780,3 +3780,4 @@ STR_5443 :Speed{MOVE_X}{87}{STRINGID} STR_5444 :Speed: STR_5445 :Speed STR_5446 :Get +STR_5448 :Remove toolbar diff --git a/src/config.c b/src/config.c index 3fdde76f90..06523cf7ff 100644 --- a/src/config.c +++ b/src/config.c @@ -929,6 +929,7 @@ static const uint16 _defaultShortcutKeys[SHORTCUT_COUNT] = { SDL_SCANCODE_1, // SHORTCUT_UNDERGROUND_VIEW_TOGGLE SDL_SCANCODE_H, // SHORTCUT_REMOVE_BASE_LAND_TOGGLE SDL_SCANCODE_V, // SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE + SDL_SCANCODE_T, // SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE SDL_SCANCODE_3, // SHORTCUT_SEE_THROUGH_RIDES_TOGGLE SDL_SCANCODE_4, // SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE SDL_SCANCODE_5, // SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE diff --git a/src/config.h b/src/config.h index 6f5a85b991..8f000f488c 100644 --- a/src/config.h +++ b/src/config.h @@ -44,6 +44,7 @@ enum { SHORTCUT_UNDERGROUND_VIEW_TOGGLE, SHORTCUT_REMOVE_BASE_LAND_TOGGLE, SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE, + SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE, SHORTCUT_SEE_THROUGH_RIDES_TOGGLE, SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE, SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE, diff --git a/src/interface/keyboard_shortcut.c b/src/interface/keyboard_shortcut.c index c2e65483c2..cbb7936d55 100644 --- a/src/interface/keyboard_shortcut.c +++ b/src/interface/keyboard_shortcut.c @@ -228,6 +228,20 @@ static void shortcut_remove_vertical_land_toggle() toggle_view_flag(VIEWPORT_FLAG_HIDE_VERTICAL); } +static void shortcut_remove_top_bottom_toolbar_toggle() +{ + toggle_view_flag(VIEWPORT_FLAG_HIDE_TOP_BOTTOM_TOOLBAR); + + if (window_get_main()->viewport->flags & VIEWPORT_FLAG_HIDE_TOP_BOTTOM_TOOLBAR){ + window_close(window_find_by_class(WC_TOP_TOOLBAR)); + window_close(window_find_by_class(WC_BOTTOM_TOOLBAR)); + } + else { + window_top_toolbar_open(); + window_game_bottom_toolbar_open(); + } +} + static void shortcut_see_through_rides_toggle() { toggle_view_flag(VIEWPORT_FLAG_SEETHROUGH_RIDES); @@ -463,6 +477,7 @@ static const shortcut_action shortcut_table[SHORTCUT_COUNT] = { shortcut_underground_view_toggle, shortcut_remove_base_land_toggle, shortcut_remove_vertical_land_toggle, + shortcut_remove_top_bottom_toolbar_toggle, shortcut_see_through_rides_toggle, shortcut_see_through_scenery_toggle, shortcut_invisible_supports_toggle, diff --git a/src/interface/viewport.h b/src/interface/viewport.h index 429b91602e..f38f7adc33 100644 --- a/src/interface/viewport.h +++ b/src/interface/viewport.h @@ -41,7 +41,7 @@ enum { VIEWPORT_FLAG_HIDE_BASE = (1 << 12), VIEWPORT_FLAG_HIDE_VERTICAL = (1 << 13), VIEWPORT_FLAG_INVISIBLE_SPRITES = (1 << 14), - VIEWPORT_FLAG_15 = (1 << 15) + VIEWPORT_FLAG_HIDE_TOP_BOTTOM_TOOLBAR = (1 << 15), }; enum { diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index a1029e0da5..7190889aff 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -129,6 +129,7 @@ enum { STR_UNDERGROUND_VIEW = 939, STR_REMOVE_BASE_LAND = 940, STR_REMOVE_VERTICAL_FACES = 941, + STR_REMOVE_TOP_BOTTOM_BAR = 5448, STR_SEE_THROUGH_RIDES = 942, STR_SEE_THROUGH_SCENERY = 943, From 1f5fd4fe67a1f1c92c55af27a23c9d1c6ee4e672 Mon Sep 17 00:00:00 2001 From: Maikel Stuivenberg Date: Fri, 26 Jun 2015 17:26:29 +0200 Subject: [PATCH 2/4] Reorder shortcut --- src/config.c | 4 ++-- src/config.h | 2 +- src/interface/keyboard_shortcut.c | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/config.c b/src/config.c index 06523cf7ff..75e9c1dde0 100644 --- a/src/config.c +++ b/src/config.c @@ -929,7 +929,6 @@ static const uint16 _defaultShortcutKeys[SHORTCUT_COUNT] = { SDL_SCANCODE_1, // SHORTCUT_UNDERGROUND_VIEW_TOGGLE SDL_SCANCODE_H, // SHORTCUT_REMOVE_BASE_LAND_TOGGLE SDL_SCANCODE_V, // SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE - SDL_SCANCODE_T, // SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE SDL_SCANCODE_3, // SHORTCUT_SEE_THROUGH_RIDES_TOGGLE SDL_SCANCODE_4, // SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE SDL_SCANCODE_5, // SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE @@ -955,7 +954,8 @@ static const uint16 _defaultShortcutKeys[SHORTCUT_COUNT] = { // New SDL_SCANCODE_MINUS, // SHORTCUT_REDUCE_GAME_SPEED, SDL_SCANCODE_EQUALS, // SHORTCUT_INCREASE_GAME_SPEED, - 0x0200 | 0x0400 | SDL_SCANCODE_C // SHORTCUT_OPEN_CHEAT_WINDOW, + 0x0200 | 0x0400 | SDL_SCANCODE_C, // SHORTCUT_OPEN_CHEAT_WINDOW, + SDL_SCANCODE_T, // SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE, }; /** diff --git a/src/config.h b/src/config.h index 8f000f488c..8c70b4b64b 100644 --- a/src/config.h +++ b/src/config.h @@ -44,7 +44,6 @@ enum { SHORTCUT_UNDERGROUND_VIEW_TOGGLE, SHORTCUT_REMOVE_BASE_LAND_TOGGLE, SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE, - SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE, SHORTCUT_SEE_THROUGH_RIDES_TOGGLE, SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE, SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE, @@ -71,6 +70,7 @@ enum { SHORTCUT_REDUCE_GAME_SPEED, SHORTCUT_INCREASE_GAME_SPEED, SHORTCUT_OPEN_CHEAT_WINDOW, + SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE, SHORTCUT_COUNT }; diff --git a/src/interface/keyboard_shortcut.c b/src/interface/keyboard_shortcut.c index cbb7936d55..6aa94b916a 100644 --- a/src/interface/keyboard_shortcut.c +++ b/src/interface/keyboard_shortcut.c @@ -477,7 +477,6 @@ static const shortcut_action shortcut_table[SHORTCUT_COUNT] = { shortcut_underground_view_toggle, shortcut_remove_base_land_toggle, shortcut_remove_vertical_land_toggle, - shortcut_remove_top_bottom_toolbar_toggle, shortcut_see_through_rides_toggle, shortcut_see_through_scenery_toggle, shortcut_invisible_supports_toggle, @@ -499,9 +498,12 @@ static const shortcut_action shortcut_table[SHORTCUT_COUNT] = { shortcut_show_recent_messages, shortcut_show_map, shortcut_screenshot, + + //new shortcut_reduce_game_speed, shortcut_increase_game_speed, - shortcut_open_cheat_window + shortcut_open_cheat_window, + shortcut_remove_top_bottom_toolbar_toggle, }; #pragma endregion From 18008c2cc690ac4d66184216229ddb31dc530069 Mon Sep 17 00:00:00 2001 From: Maikel Stuivenberg Date: Fri, 26 Jun 2015 17:44:17 +0200 Subject: [PATCH 3/4] remove unneeded string --- data/language/english_uk.txt | 1 - src/localisation/string_ids.h | 1 - 2 files changed, 2 deletions(-) diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index 9ffd140a65..0a2e5fd020 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3780,4 +3780,3 @@ STR_5443 :Speed{MOVE_X}{87}{STRINGID} STR_5444 :Speed: STR_5445 :Speed STR_5446 :Get -STR_5448 :Remove toolbar diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index 7190889aff..a1029e0da5 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -129,7 +129,6 @@ enum { STR_UNDERGROUND_VIEW = 939, STR_REMOVE_BASE_LAND = 940, STR_REMOVE_VERTICAL_FACES = 941, - STR_REMOVE_TOP_BOTTOM_BAR = 5448, STR_SEE_THROUGH_RIDES = 942, STR_SEE_THROUGH_SCENERY = 943, From 9feff63c6d6086e6b3653bb42ab80a3a021b83b3 Mon Sep 17 00:00:00 2001 From: Maikel Stuivenberg Date: Sun, 28 Jun 2015 13:36:46 +0200 Subject: [PATCH 4/4] Remove viewport flag --- src/interface/keyboard_shortcut.c | 8 ++++---- src/interface/viewport.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/interface/keyboard_shortcut.c b/src/interface/keyboard_shortcut.c index 6aa94b916a..be2e210dcc 100644 --- a/src/interface/keyboard_shortcut.c +++ b/src/interface/keyboard_shortcut.c @@ -230,13 +230,13 @@ static void shortcut_remove_vertical_land_toggle() static void shortcut_remove_top_bottom_toolbar_toggle() { - toggle_view_flag(VIEWPORT_FLAG_HIDE_TOP_BOTTOM_TOOLBAR); - - if (window_get_main()->viewport->flags & VIEWPORT_FLAG_HIDE_TOP_BOTTOM_TOOLBAR){ + if (window_find_by_class(WC_TOP_TOOLBAR) != NULL) + { window_close(window_find_by_class(WC_TOP_TOOLBAR)); window_close(window_find_by_class(WC_BOTTOM_TOOLBAR)); } - else { + else + { window_top_toolbar_open(); window_game_bottom_toolbar_open(); } diff --git a/src/interface/viewport.h b/src/interface/viewport.h index 5836314b0a..62cfa47c7f 100644 --- a/src/interface/viewport.h +++ b/src/interface/viewport.h @@ -41,7 +41,7 @@ enum { VIEWPORT_FLAG_HIDE_BASE = (1 << 12), VIEWPORT_FLAG_HIDE_VERTICAL = (1 << 13), VIEWPORT_FLAG_INVISIBLE_SPRITES = (1 << 14), - VIEWPORT_FLAG_HIDE_TOP_BOTTOM_TOOLBAR = (1 << 15), + VIEWPORT_FLAG_15 = (1 << 15) }; enum {