Auto-switch to full toolbar if enough space

This commit is contained in:
Sergii Pylypenko
2014-05-27 22:15:25 +03:00
parent ba809d1b21
commit 7748f7cbf1
2 changed files with 27 additions and 10 deletions

View File

@@ -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

View File

@@ -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