From 7748f7cbf1bc3c26e0fcb9b04ff20966d00aa6a0 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Tue, 27 May 2014 22:15:25 +0300 Subject: [PATCH] Auto-switch to full toolbar if enough space --- src/lang/english.txt | 10 +++++----- src/toolbar_gui.cpp | 27 ++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index 31fefff068..b5a81a7093 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2450,17 +2450,17 @@ STR_LANDSCAPING_LEVEL_LAND_TOOLTIP :{BLACK}Level an STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND :{BLACK}Purchase land for future use. Shift toggles building/showing cost estimate # Tablet toolbar -STR_TABLET_X :{BLACK}Trans +STR_TABLET_X :{BLACK}{TINY_FONT}Trans STR_TABLET_TOGGLE_TRANSPARENCY_TOOLTIP :{BLACK}Toggle transparency STR_TABLET_CLOSE :{BLACK}X STR_TABLET_CLOSE_TOOLTIP :{BLACK}Close all opened windows (except pinned ones) -STR_TABLET_SHIFT :{BLACK}Shift +STR_TABLET_SHIFT :{BLACK}{TINY_FONT}Shft STR_TABLET_SHIFT_TOOLTIP :{BLACK}Press it for getting an estimated cost of executing an action -STR_TABLET_CTRL :{BLACK}Ctrl +STR_TABLET_CTRL :{BLACK}{TINY_FONT}Ctrl STR_TABLET_CTRL_TOOLTIP :{BLACK}Use it for actions that use the "CTRL" key -STR_TABLET_MOVE :{BLACK}Move +STR_TABLET_MOVE :{BLACK}{TINY_FONT}Move STR_TABLET_MOVE_TOOLTIP :{BLACK}Press it to move around viewports. No action will be executed on viewports while this is active -STR_TABLET_CONFIRM :{BLACK}Do +STR_TABLET_CONFIRM :{BLACK}{TINY_FONT}Do STR_TABLET_CONFIRM_TOOLTIP :{BLACK}Press it to confirm an action # Object construction window diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 2827e6c4d5..22d58990d7 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -1495,14 +1495,31 @@ class NWidgetMainToolbarContainer : public NWidgetToolbarContainer { { #ifdef __ANDROID__ - static const byte arrange_android[] = { - 0, 1, 2, 4, 5, 6, 7, 8, 9, 14, 21, 22, 23, 24, 25, 19, 20, 29, 30, 31, 32, - 0, 1, 3, 4, 5, 6, 7, 12, 15, 16, 17, 18, 26, 27, 28, 19, 20, 29, 30, 31, 32, + static const uint BIGGEST_ARRANGEMENT = 28; + static const uint ARRANGEMENT_30 = 24; + static const byte arrange_android_28[] = { + 0, 1, 3, 4, 5, 6, 7, 8, 9, 14, 21, 22, 23, 24, 25, 19, 20, 29, 30, 31, 32, + 0, 1, 2, 4, 5, 10, 11, 12, 15, 16, 17, 18, 26, 27, 28, 19, 20, 29, 30, 31, 32, + }; + static const byte arrange_android_30[] = { + 0, 1, 3, 4, 5, 6, 7, 12, 8, 9, 14, 21, 22, 23, 24, 25, 19, 20, 29, 30, 31, 32, + 0, 1, 2, 4, 5, 10, 11, 12, 13, 15, 16, 17, 18, 26, 27, 28, 19, 20, 29, 30, 31, 32, + }; + static const byte arrange_android_all[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32 }; - button_count = arrangable_count = lengthof(arrange_android) / 2; spacer_count = this->spacers; - return &arrange_android[((_toolbar_mode == TB_LOWER) ? button_count : 0)]; + if (width > BIGGEST_ARRANGEMENT * this->smallest_x) { + button_count = arrangable_count = lengthof(arrange_android_all); + return arrange_android_all; + } + if (width > ARRANGEMENT_30 * this->smallest_x) { + button_count = arrangable_count = lengthof(arrange_android_30) / 2; + return &arrange_android_30[((_toolbar_mode == TB_LOWER) ? button_count : 0)]; + } + button_count = arrangable_count = lengthof(arrange_android_28) / 2; + return &arrange_android_28[((_toolbar_mode == TB_LOWER) ? button_count : 0)]; #else