From 5d7ece0760d0cd88b48f08a88c2a13df2a4bfdae Mon Sep 17 00:00:00 2001 From: pelya Date: Sun, 16 Mar 2014 00:17:25 +0200 Subject: [PATCH] OpenTTD: updated default settings, applied and removed patch files --- ...0006-Position-of-landscaping-toolbar.patch | 47 - ...down-doesn-t-need-trees-and-place-si.patch | 49 - ...-to-be-drawn-above-the-origin-widget.patch | 97 -- ...2-Modify-the-length-of-the-Group-GUI.patch | 27 - ...n-the-group-name-and-the-sprite-is-s.patch | 35 - ...-names-is-longer-when-autoreplace-pr.patch | 41 - ...rs-to-draw-strings-and-sprites-deali.patch | 145 --- ...showing-waiting-cargo-on-the-Station.patch | 195 ---- ...enter-yes-no-buttons-on-query-string.patch | 33 - ...eorder-DrawWidget-on-StatusBarWindow.patch | 86 -- ...etter-sizes-for-widgets-of-statusbar.patch | 50 - ...elling-selling-all-autoreplacing-.-t.patch | 28 - ...ll-Resize-status-of-order-group-by-w.patch | 47 - ...height-so-the-height-of-each-element.patch | 35 - ...r-drawing-vertically-aligned-strings.patch | 35 - ...s-vertically-aligned-on-some-windows.patch | 302 ------ ...-gui-strings-and-other-minor-changes.patch | 44 - ...rtically-aligned-on-vehicle-list-veh.patch | 180 ---- .../0183-Center-images-on-buttons.patch | 128 --- ...-Center-company-icon-on-league-table.patch | 51 - .../openttd/0186-Add-min-sizing.patch | 973 ------------------ ...87-Add-min-sizing-on-smallmap-window.patch | 105 -- ...sizings-to-some-construction-buttons.patch | 132 --- .../0189-More-sizing-and-centering.patch | 524 ---------- ...g-and-centering-of-owner-face-window.patch | 261 ----- ...ring-of-vehicle-image-on-refit-windo.patch | 49 - ...n-station-picker-for-road-stations-a.patch | 72 -- ...nter-sprites-on-bridge-picker-window.patch | 26 - .../0197-Center-vehicle-status-icon.patch | 34 - ...98-Center-cargo-icons-on-station-GUI.patch | 51 - ...fic-min-sizing-for-onscreen-keyboard.patch | 116 --- ...-for-width-of-command-errors-news-an.patch | 93 -- .../0201-Add-a-min-sizing-for-viewports.patch | 76 -- ...r-automatically-set-min-sizing-value.patch | 264 ----- ...ts-properties-for-high-resolution-sc.patch | 24 - ...04-Sizing-and-centering-editbox-icon.patch | 48 - ...-centering-on-create-scenario-window.patch | 44 - .../0206-Some-amends-about-sizings.patch | 56 - ...o-tracklist-window-and-set-min-sizin.patch | 379 ------- ...it-presizing-mode-from-outside-viewp.patch | 39 - .../0211-Add-new-viewport-methods.patch | 81 -- ...releasing-the-mouse-instead-of-when-.patch | 524 ---------- ...ace-station-when-releasing-the-mouse.patch | 57 - ...functions-for-cycling-inside-an-enum.patch | 36 - .../openttd/0215-Toolbar-types.patch | 115 --- ...Add-a-window-for-touchscreen-devices.patch | 380 ------- ...ort-related-files-to-deal-with-touch.patch | 87 -- ...tion-child-windows-to-screen-borders.patch | 49 - ...-s-to-work-with-touchscreen-controls.patch | 120 --- ...r-toggling-touchscreen-mouse-control.patch | 45 - .../openttd/0222-amend-vehicle-gui.patch | 24 - ...ettings-in-three-columns-for-tablets.patch | 123 --- ...e-console-and-when-in-touchscreen-mo.patch | 66 -- ...console-command-to-open-cheat-window.patch | 45 - ...-functions-for-a-confirm-action-mode.patch | 290 ------ ...les-dirty-when-erasing-a-queued-comm.patch | 62 -- ...ion-tiles-when-bridge-is-too-long-to.patch | 34 - ...ptation-of-viewport-for-confirm-mode.patch | 60 -- ...-actions-that-will-need-confirmation.patch | 322 ------ ...mand-when-closing-windows-that-can-q.patch | 147 --- ...ued-command-when-changing-CTRL-state.patch | 24 - ...mand-also-when-depot-direction-airpo.patch | 82 -- ...mands-when-another-command-is-about-.patch | 90 -- ...nstruction-windows-with-main-toolbar.patch | 81 -- ...een-modes-windows-aligned-with-main-.patch | 32 - ...or-deleting-windows-linked-to-main-t.patch | 59 -- ...inked-to-main-toolbar-windows-delete.patch | 130 --- .../openttd/AndroidAppSettings.cfg | 2 +- .../openttd/AndroidData/openttd-1.4.0.27.cfg | 17 +- .../application/openttd/cargodist-patches.sh | 13 - .../openttd/openttd-trunk-android.patch | 397 ------- project/jni/application/openttd/src | 2 +- .../jni/application/openttd/update-patch.sh | 2 - 73 files changed, 8 insertions(+), 8611 deletions(-) delete mode 100644 project/jni/application/openttd/0006-Position-of-landscaping-toolbar.patch delete mode 100644 project/jni/application/openttd/0007-Landscaping-dropdown-doesn-t-need-trees-and-place-si.patch delete mode 100644 project/jni/application/openttd/0008-Allow-dropdown-to-be-drawn-above-the-origin-widget.patch delete mode 100644 project/jni/application/openttd/0012-Modify-the-length-of-the-Group-GUI.patch delete mode 100644 project/jni/application/openttd/0013-The-space-between-the-group-name-and-the-sprite-is-s.patch delete mode 100644 project/jni/application/openttd/0014-Display-of-group-names-is-longer-when-autoreplace-pr.patch delete mode 100644 project/jni/application/openttd/0018-Some-small-helpers-to-draw-strings-and-sprites-deali.patch delete mode 100644 project/jni/application/openttd/0019-Adapt-the-boxes-showing-waiting-cargo-on-the-Station.patch delete mode 100644 project/jni/application/openttd/0172-Center-yes-no-buttons-on-query-string.patch delete mode 100644 project/jni/application/openttd/0173-Reorder-DrawWidget-on-StatusBarWindow.patch delete mode 100644 project/jni/application/openttd/0174-Get-better-sizes-for-widgets-of-statusbar.patch delete mode 100644 project/jni/application/openttd/0176-Make-icons-for-selling-selling-all-autoreplacing-.-t.patch delete mode 100644 project/jni/application/openttd/0177-Change-the-SetFill-Resize-status-of-order-group-by-w.patch delete mode 100644 project/jni/application/openttd/0178-Use-resize.step_height-so-the-height-of-each-element.patch delete mode 100644 project/jni/application/openttd/0179-Functions-for-drawing-vertically-aligned-strings.patch delete mode 100644 project/jni/application/openttd/0180-Draw-strings-vertically-aligned-on-some-windows.patch delete mode 100644 project/jni/application/openttd/0181-Center-group-gui-strings-and-other-minor-changes.patch delete mode 100644 project/jni/application/openttd/0182-Draw-vehicles-vertically-aligned-on-vehicle-list-veh.patch delete mode 100644 project/jni/application/openttd/0183-Center-images-on-buttons.patch delete mode 100644 project/jni/application/openttd/0184-Center-company-icon-on-league-table.patch delete mode 100644 project/jni/application/openttd/0186-Add-min-sizing.patch delete mode 100644 project/jni/application/openttd/0187-Add-min-sizing-on-smallmap-window.patch delete mode 100644 project/jni/application/openttd/0188-Add-min-sizings-to-some-construction-buttons.patch delete mode 100644 project/jni/application/openttd/0189-More-sizing-and-centering.patch delete mode 100644 project/jni/application/openttd/0190-Sizing-and-centering-of-owner-face-window.patch delete mode 100644 project/jni/application/openttd/0191-Sizing-and-centering-of-vehicle-image-on-refit-windo.patch delete mode 100644 project/jni/application/openttd/0195-Center-sprites-on-station-picker-for-road-stations-a.patch delete mode 100644 project/jni/application/openttd/0196-Center-sprites-on-bridge-picker-window.patch delete mode 100644 project/jni/application/openttd/0197-Center-vehicle-status-icon.patch delete mode 100644 project/jni/application/openttd/0198-Center-cargo-icons-on-station-GUI.patch delete mode 100644 project/jni/application/openttd/0199-Add-a-specific-min-sizing-for-onscreen-keyboard.patch delete mode 100644 project/jni/application/openttd/0200-Add-a-min-sizing-for-width-of-command-errors-news-an.patch delete mode 100644 project/jni/application/openttd/0201-Add-a-min-sizing-for-viewports.patch delete mode 100644 project/jni/application/openttd/0202-Add-a-setting-for-automatically-set-min-sizing-value.patch delete mode 100644 project/jni/application/openttd/0203-Amend-some-widgets-properties-for-high-resolution-sc.patch delete mode 100644 project/jni/application/openttd/0204-Sizing-and-centering-editbox-icon.patch delete mode 100644 project/jni/application/openttd/0205-Sizing-and-centering-on-create-scenario-window.patch delete mode 100644 project/jni/application/openttd/0206-Some-amends-about-sizings.patch delete mode 100644 project/jni/application/openttd/0209-Add-scrollbars-to-tracklist-window-and-set-min-sizin.patch delete mode 100644 project/jni/application/openttd/0210-Allow-calling-init-presizing-mode-from-outside-viewp.patch delete mode 100644 project/jni/application/openttd/0211-Add-new-viewport-methods.patch delete mode 100644 project/jni/application/openttd/0212-Do-actions-when-releasing-the-mouse-instead-of-when-.patch delete mode 100644 project/jni/application/openttd/0213-Place-station-when-releasing-the-mouse.patch delete mode 100644 project/jni/application/openttd/0214-Add-functions-for-cycling-inside-an-enum.patch delete mode 100644 project/jni/application/openttd/0215-Toolbar-types.patch delete mode 100644 project/jni/application/openttd/0217-Add-a-window-for-touchscreen-devices.patch delete mode 100644 project/jni/application/openttd/0218-Changes-on-viewport-related-files-to-deal-with-touch.patch delete mode 100644 project/jni/application/openttd/0219-Set-construction-child-windows-to-screen-borders.patch delete mode 100644 project/jni/application/openttd/0220-Amend-gui-s-to-work-with-touchscreen-controls.patch delete mode 100644 project/jni/application/openttd/0221-Add-a-hotkey-for-toggling-touchscreen-mouse-control.patch delete mode 100644 project/jni/application/openttd/0222-amend-vehicle-gui.patch delete mode 100644 project/jni/application/openttd/0226-Settings-in-three-columns-for-tablets.patch delete mode 100644 project/jni/application/openttd/0227-When-clicking-the-console-and-when-in-touchscreen-mo.patch delete mode 100644 project/jni/application/openttd/0228-Add-a-console-command-to-open-cheat-window.patch delete mode 100644 project/jni/application/openttd/0230-Base-functions-for-a-confirm-action-mode.patch delete mode 100644 project/jni/application/openttd/0231-Set-selection-tiles-dirty-when-erasing-a-queued-comm.patch delete mode 100644 project/jni/application/openttd/0232-Set-dirty-selection-tiles-when-bridge-is-too-long-to.patch delete mode 100644 project/jni/application/openttd/0233-Adaptation-of-viewport-for-confirm-mode.patch delete mode 100644 project/jni/application/openttd/0234-Select-the-actions-that-will-need-confirmation.patch delete mode 100644 project/jni/application/openttd/0235-Reset-queued-command-when-closing-windows-that-can-q.patch delete mode 100644 project/jni/application/openttd/0236-Reset-queued-command-when-changing-CTRL-state.patch delete mode 100644 project/jni/application/openttd/0237-Erase-queued-command-also-when-depot-direction-airpo.patch delete mode 100644 project/jni/application/openttd/0238-Erase-queued-commands-when-another-command-is-about-.patch delete mode 100644 project/jni/application/openttd/0239-Align-construction-windows-with-main-toolbar.patch delete mode 100644 project/jni/application/openttd/0240-When-in-touchscreen-modes-windows-aligned-with-main-.patch delete mode 100644 project/jni/application/openttd/0241-Add-a-function-for-deleting-windows-linked-to-main-t.patch delete mode 100644 project/jni/application/openttd/0242-Before-opening-linked-to-main-toolbar-windows-delete.patch delete mode 100755 project/jni/application/openttd/cargodist-patches.sh delete mode 100644 project/jni/application/openttd/openttd-trunk-android.patch delete mode 100755 project/jni/application/openttd/update-patch.sh diff --git a/project/jni/application/openttd/0006-Position-of-landscaping-toolbar.patch b/project/jni/application/openttd/0006-Position-of-landscaping-toolbar.patch deleted file mode 100644 index 01ac6424d..000000000 --- a/project/jni/application/openttd/0006-Position-of-landscaping-toolbar.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 421c7f351ded614e3c1eb0d10c079e5d26865bd5 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 19 Oct 2013 11:48:29 +0000 -Subject: [PATCH 006/249] Position of landscaping toolbar. - ---- - src/terraform_gui.cpp | 10 +--------- - 1 file changed, 1 insertion(+), 9 deletions(-) - -diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp -index 89e6204..2524b29 100644 ---- a/src/terraform_gui.cpp -+++ b/src/terraform_gui.cpp -@@ -259,13 +259,6 @@ struct TerraformToolbarWindow : Window { - VpSelectTilesWithMethod(pt.x, pt.y, select_method); - } - -- virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) -- { -- Point pt = GetToolbarAlignedWindowPosition(sm_width); -- pt.y += sm_height; -- return pt; -- } -- - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) - { - if (pt.x != -1) { -@@ -348,7 +341,7 @@ static const NWidgetPart _nested_terraform_widgets[] = { - }; - - static WindowDesc _terraform_desc( -- WDP_MANUAL, "toolbar_landscape", 0, 0, -+ WDP_ALIGN_TOOLBAR, "toolbar_landscape", 0, 0, - WC_SCEN_LAND_GEN, WC_NONE, - WDF_CONSTRUCTION, - _nested_terraform_widgets, lengthof(_nested_terraform_widgets), -@@ -372,7 +365,6 @@ Window *ShowTerraformToolbar(Window *link) - DeleteWindowById(WC_SCEN_LAND_GEN, 0, true); - Window *w = AllocateWindowDescFront(&_terraform_desc, 0); - /* Align the terraform toolbar under the main toolbar. */ -- w->top -= w->height; - w->SetDirty(); - /* Put the linked toolbar to the left / right of it. */ - link->left = w->left + (_current_text_dir == TD_RTL ? w->width : -link->width); --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0007-Landscaping-dropdown-doesn-t-need-trees-and-place-si.patch b/project/jni/application/openttd/0007-Landscaping-dropdown-doesn-t-need-trees-and-place-si.patch deleted file mode 100644 index f4e503156..000000000 --- a/project/jni/application/openttd/0007-Landscaping-dropdown-doesn-t-need-trees-and-place-si.patch +++ /dev/null @@ -1,49 +0,0 @@ -From fd1f3a3f2f615e12b5be1f318b2ddc6d9f854944 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 5 Oct 2013 17:40:42 +0000 -Subject: [PATCH 007/249] Landscaping dropdown doesn't need trees and place - signs entries. - ---- - src/lang/english.txt | 2 -- - src/toolbar_gui.cpp | 4 +--- - 2 files changed, 1 insertion(+), 5 deletions(-) - -diff --git a/src/lang/english.txt b/src/lang/english.txt -index 0ebfe96..665b826 100644 ---- a/src/lang/english.txt -+++ b/src/lang/english.txt -@@ -442,8 +442,6 @@ STR_AIRCRAFT_MENU_AIRPORT_CONSTRUCTION :Airport constru - - ############ range for landscaping menu starts - STR_LANDSCAPING_MENU_LANDSCAPING :Landscaping --STR_LANDSCAPING_MENU_PLANT_TREES :Plant trees --STR_LANDSCAPING_MENU_PLACE_SIGN :Place sign - ############ range ends here - - ############ range for music menu starts -diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp -index f4cb584..cd7b9f6 100644 ---- a/src/toolbar_gui.cpp -+++ b/src/toolbar_gui.cpp -@@ -958,7 +958,7 @@ static CallBackFunction MenuClickBuildAir(int index) - - static CallBackFunction ToolbarForestClick(Window *w) - { -- PopupMainToolbMenu(w, WID_TN_LANDSCAPE, STR_LANDSCAPING_MENU_LANDSCAPING, 3); -+ PopupMainToolbMenu(w, WID_TN_LANDSCAPE, STR_LANDSCAPING_MENU_LANDSCAPING, 1); - return CBF_NONE; - } - -@@ -972,8 +972,6 @@ static CallBackFunction MenuClickForest(int index) - { - switch (index) { - case 0: ShowTerraformToolbar(); break; -- case 1: ShowBuildTreesToolbar(); break; -- case 2: return SelectSignTool(); - } - return CBF_NONE; - } --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0008-Allow-dropdown-to-be-drawn-above-the-origin-widget.patch b/project/jni/application/openttd/0008-Allow-dropdown-to-be-drawn-above-the-origin-widget.patch deleted file mode 100644 index 898edd376..000000000 --- a/project/jni/application/openttd/0008-Allow-dropdown-to-be-drawn-above-the-origin-widget.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 43c03c190fae34d1cdbaa7028f21c54342b81ada Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 6 Jul 2013 22:08:58 +0200 -Subject: [PATCH 008/249] Allow dropdown to be drawn above the origin widget, - even in the case the dropdown needs a scrollbar. - ---- - src/widgets/dropdown.cpp | 45 ++++++++++++++++++++++++++++++++------------- - 1 file changed, 32 insertions(+), 13 deletions(-) - -diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp -index 6b0f60e..fa5753d 100644 ---- a/src/widgets/dropdown.cpp -+++ b/src/widgets/dropdown.cpp -@@ -334,10 +334,10 @@ void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int b - { - DeleteWindowById(WC_DROPDOWN_MENU, 0); - -- /* The preferred position is just below the dropdown calling widget */ -+ /* The preferred position is just below the dropdown calling widget. */ - int top = w->top + wi_rect.bottom + 1; - -- /* The preferred width equals the calling widget */ -+ /* The preferred width equals the calling widget. */ - uint width = wi_rect.right - wi_rect.left + 1; - - uint max_item_width = 0; -@@ -350,7 +350,7 @@ void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int b - } - } - -- /* Total length of list */ -+ /* Total length of list. */ - int list_height = 0; - - for (const DropDownListItem * const *it = list->Begin(); it != list->End(); ++it) { -@@ -358,28 +358,47 @@ void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int b - list_height += item->Height(width); - } - -- /* Height of window visible */ -+ /* Height of the dropdown window; by default, the total length of the list. */ - int height = list_height; - - /* Check if the status bar is visible, as we don't want to draw over it */ - int screen_bottom = GetMainViewBottom(); - bool scroll = false; - -- /* Check if the dropdown will fully fit below the widget */ -+ /* Check if the dropdown will fully fit below the widget. */ - if (top + height + 4 >= screen_bottom) { -- /* If not, check if it will fit above the widget */ -- if (w->top + wi_rect.top - height > GetMainViewTop()) { -+ /* If not, check if it will fit above the widget. */ -+ int screen_top = GetMainViewTop(); -+ if (w->top + wi_rect.top > screen_top + height) { - top = w->top + wi_rect.top - height - 4; - } else { -- /* ... and lastly if it won't, enable the scroll bar and fit the -- * list in below the widget */ -+ /* If it doesn't fit above the widget, we need to enable a scrollbar... */ - int avg_height = list_height / (int)list->Length(); -- int rows = (screen_bottom - 4 - top) / avg_height; -- height = rows * avg_height; - scroll = true; -- /* Add space for the scroll bar if we automatically determined -- * the width of the list. */ -+ -+ /* ... and choose whether to put the list above or below the widget. */ -+ bool put_above = false; -+ int available_height = screen_bottom - w->top - wi_rect.bottom; -+ if (w->top + wi_rect.top - screen_top > available_height) { -+ // Put it above. -+ available_height = w->top + wi_rect.top - screen_top; -+ put_above = true; -+ } -+ -+ /* Check at least there is space for one item. */ -+ assert(available_height >= avg_height); -+ -+ /* And lastly, fit the list,... */ -+ int rows = available_height / avg_height; -+ height = rows * avg_height; -+ -+ /* ... add space for the scrollbar,... */ - max_item_width += NWidgetScrollbar::GetVerticalDimension().width; -+ -+ /* ... and set the top position if needed. */ -+ if (put_above) { -+ top = w->top + wi_rect.top - height - 4; -+ } - } - } - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0012-Modify-the-length-of-the-Group-GUI.patch b/project/jni/application/openttd/0012-Modify-the-length-of-the-Group-GUI.patch deleted file mode 100644 index 706af733c..000000000 --- a/project/jni/application/openttd/0012-Modify-the-length-of-the-Group-GUI.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 70e27c1f16620f76591f32955a76da59dcde3ec9 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Wed, 24 Apr 2013 18:40:21 +0200 -Subject: [PATCH 012/249] Modify the length of the Group GUI. - -Set it to the length of the 'a' character * maximum length of a group name. ---- - src/group_gui.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/group_gui.cpp b/src/group_gui.cpp -index ed3176e..3048f17 100644 ---- a/src/group_gui.cpp -+++ b/src/group_gui.cpp -@@ -165,7 +165,8 @@ private: - uint ComputeGroupInfoSize() - { - this->column_size[VGC_NAME] = maxdim(GetStringBoundingBox(STR_GROUP_DEFAULT_TRAINS + this->vli.vtype), GetStringBoundingBox(STR_GROUP_ALL_TRAINS + this->vli.vtype)); -- this->column_size[VGC_NAME].width = max(170u, this->column_size[VGC_NAME].width); -+/* We consider the max average length of characters to be the one of "a" */ -+ this->column_size[VGC_NAME].width = max(GetCharacterWidth(FS_NORMAL, 97) * (MAX_LENGTH_GROUP_NAME_CHARS - 4), this->column_size[VGC_NAME].width); - this->tiny_step_height = this->column_size[VGC_NAME].height; - - this->column_size[VGC_PROTECT] = GetSpriteSize(SPR_GROUP_REPLACE_PROTECT); --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0013-The-space-between-the-group-name-and-the-sprite-is-s.patch b/project/jni/application/openttd/0013-The-space-between-the-group-name-and-the-sprite-is-s.patch deleted file mode 100644 index d64a1a948..000000000 --- a/project/jni/application/openttd/0013-The-space-between-the-group-name-and-the-sprite-is-s.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 629484ecf00a137de94f7e38d46da094866902c0 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 31 Dec 2012 11:47:07 +0100 -Subject: [PATCH 013/249] The space between the group name and the sprite is - set to 2 instead of 8. Less unused space. - ---- - src/group_gui.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/group_gui.cpp b/src/group_gui.cpp -index 3048f17..d8dbadd 100644 ---- a/src/group_gui.cpp -+++ b/src/group_gui.cpp -@@ -191,7 +191,7 @@ private: - this->tiny_step_height += WD_MATRIX_TOP; - - return WD_FRAMERECT_LEFT + 8 + -- this->column_size[VGC_NAME].width + 8 + -+ this->column_size[VGC_NAME].width + 2 + - this->column_size[VGC_PROTECT].width + 2 + - this->column_size[VGC_AUTOREPLACE].width + 2 + - this->column_size[VGC_PROFIT].width + 2 + -@@ -235,7 +235,7 @@ private: - DrawString(x, x + this->column_size[VGC_NAME].width - 1, y + (this->tiny_step_height - this->column_size[VGC_NAME].height) / 2, str, colour); - - /* draw autoreplace protection */ -- x = rtl ? x - 8 - this->column_size[VGC_PROTECT].width : x + 8 + this->column_size[VGC_NAME].width; -+ x = rtl ? x - 2 - this->column_size[VGC_PROTECT].width : x + 2 + this->column_size[VGC_NAME].width; - if (protection) DrawSprite(SPR_GROUP_REPLACE_PROTECT, PAL_NONE, x, y + (this->tiny_step_height - this->column_size[VGC_PROTECT].height) / 2); - - /* draw autoreplace status */ --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0014-Display-of-group-names-is-longer-when-autoreplace-pr.patch b/project/jni/application/openttd/0014-Display-of-group-names-is-longer-when-autoreplace-pr.patch deleted file mode 100644 index d16e94de8..000000000 --- a/project/jni/application/openttd/0014-Display-of-group-names-is-longer-when-autoreplace-pr.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 1531195c111c9857513a9978901afc883e183f4f Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 31 Dec 2012 11:47:33 +0100 -Subject: [PATCH 014/249] Display of group names is longer when - autoreplace/protection sprites are hidden. - ---- - src/group_gui.cpp | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/src/group_gui.cpp b/src/group_gui.cpp -index d8dbadd..11502c7 100644 ---- a/src/group_gui.cpp -+++ b/src/group_gui.cpp -@@ -222,6 +222,7 @@ private: - bool rtl = _current_text_dir == TD_RTL; - - /* draw group name */ -+ int longer_name = 0; - StringID str; - if (IsAllGroupID(g_id)) { - str = STR_GROUP_ALL_TRAINS + this->vli.vtype; -@@ -230,9 +231,13 @@ private: - } else { - SetDParam(0, g_id); - str = STR_GROUP_NAME; -+ if (!protection) { -+ longer_name += this->column_size[VGC_PROTECT].width + 2; -+ if (!stats.autoreplace_defined) longer_name += this->column_size[VGC_AUTOREPLACE].width + 2; -+ } - } -- int x = rtl ? right - WD_FRAMERECT_RIGHT - 8 - this->column_size[VGC_NAME].width + 1 : left + WD_FRAMERECT_LEFT + 8; -- DrawString(x, x + this->column_size[VGC_NAME].width - 1, y + (this->tiny_step_height - this->column_size[VGC_NAME].height) / 2, str, colour); -+ int x = rtl ? right - WD_FRAMERECT_RIGHT - 8 - this->column_size[VGC_NAME].width - longer_name + 1 : left + WD_FRAMERECT_LEFT + 8; -+ DrawString(x, x + this->column_size[VGC_NAME].width + longer_name - 1, y + (this->tiny_step_height - this->column_size[VGC_NAME].height) / 2, str, colour); - - /* draw autoreplace protection */ - x = rtl ? x - 2 - this->column_size[VGC_PROTECT].width : x + 2 + this->column_size[VGC_NAME].width; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0018-Some-small-helpers-to-draw-strings-and-sprites-deali.patch b/project/jni/application/openttd/0018-Some-small-helpers-to-draw-strings-and-sprites-deali.patch deleted file mode 100644 index d94114357..000000000 --- a/project/jni/application/openttd/0018-Some-small-helpers-to-draw-strings-and-sprites-deali.patch +++ /dev/null @@ -1,145 +0,0 @@ -From b26a95ac71bf3b079e0decb9ed73f6548ed4e30b Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 31 Dec 2012 11:25:18 +0100 -Subject: [PATCH 018/249] Some small helpers to draw strings and sprites - dealing with left-to-right/right-to-left. - ---- - src/gfx.cpp | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - src/gfx_func.h | 11 +++++++ - 2 files changed, 112 insertions(+) - -diff --git a/src/gfx.cpp b/src/gfx.cpp -index 938404c..eabb49c 100644 ---- a/src/gfx.cpp -+++ b/src/gfx.cpp -@@ -1657,3 +1657,104 @@ void SortResolutions(int count) - { - QSortT(_resolutions, count, &compare_res); - } -+ -+ -+/** -+ * Returns the initial value for a margin, after telling where are the left and right margins and where we want to draw/write (begining/end of line) -+ * @param left is the left margin of the horizontal space we want to draw to -+ * @param right: right margin -+ * @param to_end_line: 0 if working at the begining of the line, 1 if working at the end -+ * @return the margin we asked -+ */ -+int InitTempMargin(int left, int right, bool to_end_line) -+{ -+ return to_end_line ^ (_current_text_dir == TD_RTL) ? right :left; -+} -+ -+/** -+ * Consumes a space in an horizontal margin -+ * @param space: amount of space used -+ * @param here: the margin where to add the space -+ * @param to_end_line: 0 if working at the begining of the line, 1 if working at the end -+ */ -+void AddSpace(int space, int &here, bool to_end_line) -+{ -+ here += to_end_line ^ (_current_text_dir == TD_RTL) ? -space : space; -+} -+ -+/** -+ * After drawing something, update a margin -+ * @param end is where we ended drawing (usually the return value of a DrawString function) -+ * @param margin is the margin we want to update -+ * @param to_end_line: 0 if working at the begining of the line, 1 if working at the end -+ */ -+void UpdateMarginEnd(int end, int &margin, bool to_end_line) -+{ -+ margin = to_end_line ^ (_current_text_dir == TD_RTL) ? min(end, margin) : max(end, margin); -+} -+ -+/** -+ * After drawing something, horizontal margins are updated -+ * @param end: last position drawn -+ * @param left is the left margin of the horizontal space drawn -+ * @param right: right margin -+ * @param to_end_line: 0 if working at the begining of the line, 1 if working at the end -+ */ -+void UpdateMarginsEnd(int end, int &left, int &right, bool to_end_line) -+{ -+ if (to_end_line ^ (_current_text_dir == TD_RTL)) { -+ right = end; -+ } else { -+ left = end; -+ } -+} -+ -+/** -+ * After drawing something of a certain width, update margins -+ * @param width: used space -+ * @param initial left margin -+ * @param initial right margin -+ * @param to_end_line: 0 if working at the begining of the line, 1 if working at the end -+ */ -+void UpdateMarginsWidth(int width, int &left, int &right, bool to_end_line) -+{ -+ if (to_end_line ^ (_current_text_dir == TD_RTL)) { -+ right -= width; -+ } else { -+ left += width; -+ } -+} -+ -+/** -+ * Draws a string in a delimited space; temporal margin gets updated -+ * @param left is the left margin of the horizontal space we want to draw to -+ * @param right: right margin of the horizontal space we want to draw to -+ * @param top: vertical position -+ * @param margin keeps the most extreme limit used of the line (this should be previously initialized with InitTempLimit) -+ * @param string to draw -+ * @param colour for the string -+ * @param alignment of the string (only left or right alignment) -+ * @param underline -+ */ -+void DrawString2(int left, int right, int top, int &margin, StringID str, TextColour colour, StringAlignment align, bool underline) -+{ -+ int end = DrawString(left, right, top, str, colour, align, underline); -+ UpdateMarginEnd(end, margin, align == SA_RIGHT); -+} -+ -+/** -+ * Draws a sprite in a delimited space; temporal margin gets updated -+ * @param width of the sprite -+ * @param left is the left margin of the horizontal space we want to draw to -+ * @param right: right margin of the horizontal space -+ * @param top: vertical position -+ * @param margin keeps the most extreme limit used of the line (this should be previously initialized with InitTempLimit) -+ * @param sprite -+ * @param palette -+ * @param to_end_line: 0 if working at the begining of the line, 1 if working at the end -+ */ -+void DrawSprite2(int width, int left, int right, int top, int &margin, SpriteID img, PaletteID pal, bool to_end_line, SubSprite *sub) -+{ -+ DrawSprite(img, pal, to_end_line ^ (_current_text_dir == TD_RTL) ? right - width : left, top, sub); -+ margin = to_end_line ^ (_current_text_dir == TD_RTL) ? min(right - width, margin): max(margin, left + width); -+} -diff --git a/src/gfx_func.h b/src/gfx_func.h -index 69d2e45..3a59073 100644 ---- a/src/gfx_func.h -+++ b/src/gfx_func.h -@@ -170,6 +170,17 @@ int GetCharacterHeight(FontSize size); - /** Height of characters in the large (#FS_MONO) font. */ - #define FONT_HEIGHT_MONO (GetCharacterHeight(FS_MONO)) - -+int InitTempMargin(int left, int right, bool to_end_line); -+void AddSpace(int space, int &here, bool to_end_line); -+ -+void UpdateMarginEnd(int end, int &margin, bool to_end_line); -+void UpdateMarginWidth(int adding, int &margin, bool to_end_line); -+void UpdateMarginsEnd(int end, int &left, int &right, bool to_end_line); -+void UpdateMarginsWidth(int width, int &left, int &right, bool to_end_line); -+ -+void DrawString2(int left, int right, int top, int &margin, StringID str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false); -+void DrawSprite2(int width, int left, int right, int top, int &margin, SpriteID img, PaletteID pal, bool to_end_line = false, SubSprite *sub = NULL); -+ - extern DrawPixelInfo *_cur_dpi; - - TextColour GetContrastColour(uint8 background); --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0019-Adapt-the-boxes-showing-waiting-cargo-on-the-Station.patch b/project/jni/application/openttd/0019-Adapt-the-boxes-showing-waiting-cargo-on-the-Station.patch deleted file mode 100644 index 3ceb35190..000000000 --- a/project/jni/application/openttd/0019-Adapt-the-boxes-showing-waiting-cargo-on-the-Station.patch +++ /dev/null @@ -1,195 +0,0 @@ -From 0704c42d1428c1ffc94680972fcf1d146c5c2724 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Wed, 24 Apr 2013 18:58:14 +0200 -Subject: [PATCH 019/249] Adapt the boxes showing waiting cargo on the Station - List: - -- rtl suport. -- size of the boxes adapted to the height of the normal font. -- draw a shadowed box if there is no cargo waiting but cargo has been accepted in that station. -- also always draw the box for a cargo if cargo has been produced but there are no waiting units. ---- - src/station_base.h | 8 ++++ - src/station_gui.cpp | 119 ++++++++++++++++++++++++++++++++-------------------- - 2 files changed, 81 insertions(+), 46 deletions(-) - -diff --git a/src/station_base.h b/src/station_base.h -index c0bb96c..523b52b 100644 ---- a/src/station_base.h -+++ b/src/station_base.h -@@ -290,6 +290,14 @@ struct GoodsEntry { - FlowStatMap::const_iterator flow_it(this->flows.find(source)); - return flow_it != this->flows.end() ? flow_it->second.GetVia(excluded, excluded2) : INVALID_STATION; - } -+ -+ /** -+ * Return true if a cargo type has a rating here or if there is cargo waiting for this type. -+ */ -+ inline bool IsSourceStationForCargo() const -+ { -+ return this->HasRating() || this->cargo.TotalCount() > 0; -+ } - }; - - /** All airport-related information. Only valid if tile != INVALID_TILE. */ -diff --git a/src/station_gui.cpp b/src/station_gui.cpp -index e658c1f..e46bcac 100644 ---- a/src/station_gui.cpp -+++ b/src/station_gui.cpp -@@ -100,44 +100,90 @@ void CheckRedrawStationCoverage(const Window *w) - * @param type Cargo type - * @param amount Cargo amount - * @param rating ratings data for that particular cargo -- * -- * @note Each cargo-bar is 16 pixels wide and 6 pixels high -- * @note Each rating 14 pixels wide and 1 pixel high and is 1 pixel below the cargo-bar - */ - static void StationsWndShowStationRating(int left, int right, int y, CargoID type, uint amount, byte rating) - { -- static const uint units_full = 576; ///< number of units to show station as 'full' -- static const uint rating_full = 224; ///< rating needed so it is shown as 'full' -+ static const uint units_full = 1 << 9; ///< Number of units to show station as full. -+ static const uint rating_full = 224; ///< Rating needed so it is shown as full. - - const CargoSpec *cs = CargoSpec::Get(type); - if (!cs->IsValid()) return; - -+ y++; ///< Make boxes 1 pixel shorter. -+ int left_start = left; -+ int right_start = right; -+ int height = GetCharacterHeight(FS_SMALL) - 2; - int colour = cs->rating_colour; -- TextColour tc = GetContrastColour(colour); -- uint w = (minu(amount, units_full) + 5) / 36; - -- int height = GetCharacterHeight(FS_SMALL); -+ /* Get width of the box to draw. */ -+ uint width = minu(amount, units_full) * (right - left) / units_full; - -- /* Draw total cargo (limited) on station (fits into 16 pixels) */ -- if (w != 0) GfxFillRect(left, y, left + w - 1, y + height, colour); -+ /* Update the end margin, adding the width of the box not to be drawn... */ -+ if (width != 0) UpdateMarginsWidth(right - left - width, left_start, right_start, true); -+ /* ... or prepare margins in case width == 0 and amount > 0 (just one pixel bar). */ -+ else left_start = right_start = _current_text_dir ? right : left; - -- /* Draw a one pixel-wide bar of additional cargo meter, useful -- * for stations with only a small amount (<=30) */ -- if (w == 0) { -- uint rest = amount / 5; -- if (rest != 0) { -- w += left; -- GfxFillRect(w, y + height - rest, w, y + height, colour); -- } -- } -+ /* Draw total cargo (limited) on station */ -+ if (amount > 0) GfxFillRect(left_start, y, right_start, y + height, colour); - -- DrawString(left + 1, right, y, cs->abbrev, tc); -+ DrawString(left, right, y, cs->abbrev, GetContrastColour(colour), SA_CENTER); - -- /* Draw green/red ratings bar (fits into 14 pixels) */ -+ /* Draw green/red ratings bar*/ - y += height + 2; -- GfxFillRect(left + 1, y, left + 14, y, PC_RED); -- rating = minu(rating, rating_full) / 16; -- if (rating != 0) GfxFillRect(left + 1, y, left + rating, y, PC_GREEN); -+ left_start = left + 1; -+ right_start = right - 1; -+ if (rating != 0) { -+ GfxFillRect(left_start, y, right_start, y, PC_GREEN); -+ width = minu(rating, rating_full) * (right_start - left_start) / rating_full; -+ UpdateMarginsWidth(width, left_start, right_start, false); -+ } -+ GfxFillRect(left_start, y, right_start, y, PC_RED); -+} -+ -+/** -+ * Draw small boxes of cargo accepted. -+ * @param left Left most coordinate to draw the box at. -+ * @param right Right most coordinate to draw the box at. -+ * @param y Coordinate to draw the box at. -+ * @param type Cargo type. -+ * @param acceptance_pickup_byte Acceptance byte. -+ */ -+static void StationsWndShowAcceptance(int left, int right, int y, CargoID type) -+{ -+ const CargoSpec *cs = CargoSpec::Get(type); -+ if (!cs->IsValid()) return; -+ y++; -+ GfxFillRect(left, y, right, y + GetCharacterHeight(FS_SMALL), cs->rating_colour, FILLRECT_CHECKER); -+ DrawString(left, right, y, cs->abbrev, TC_BLACK, SA_CENTER); -+} -+ -+/** -+ * Draw small boxes showing cargo waiting, ratings... for a given station. -+ * @param st Station to draw statistics of. -+ * @param x Position to start drawing at. -+ * @param width Width for each box. -+ * @param y Height position to draw the box at. -+ */ -+void StationsWndShowStationRating(const Station *st, int left, int right, int x, int width, int y) -+{ -+ bool rtl = _current_text_dir == TD_RTL; -+ AddSpace(5, x, false); -+ -+ /* For RTL we work in exactly the opposite direction. So -+ * decrement the space needed first, then draw to the left -+ * instead of drawing to the left and then incrementing -+ * the space. */ -+ if (rtl) x -= width + 4; -+ for (uint j = 0; j < _sorted_standard_cargo_specs_size && ( x > left && x + width < right ); j++) { -+ CargoID cid = _sorted_cargo_specs[j]->Index(); -+ if (st->goods[cid].IsSourceStationForCargo()) { -+ StationsWndShowStationRating(x, x + width, y, cid, st->goods[cid].cargo.TotalCount(), st->goods[cid].rating); -+ AddSpace(width + 4, x, false); -+ } else if (HasBit(st->goods[cid].acceptance_pickup, GoodsEntry::GES_EVER_ACCEPTED)) { -+ StationsWndShowAcceptance(x, x + width, y, cid); -+ AddSpace(width + 4, x, false); -+ } -+ } - } - - typedef GUIList GUIStationList; -@@ -404,7 +450,6 @@ public: - break; - - case WID_STL_LIST: { -- bool rtl = _current_text_dir == TD_RTL; - int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->stations.Length()); - int y = r.top + WD_FRAMERECT_TOP; - for (int i = this->vscroll->GetPosition(); i < max; ++i) { // do until max number of stations of owner -@@ -418,27 +463,9 @@ public: - SetDParam(0, st->index); - SetDParam(1, st->facilities); - int x = DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_STATION_LIST_STATION); -- x += rtl ? -5 : 5; -- -- /* show cargo waiting and station ratings */ -- for (uint j = 0; j < _sorted_standard_cargo_specs_size; j++) { -- CargoID cid = _sorted_cargo_specs[j]->Index(); -- if (st->goods[cid].cargo.TotalCount() > 0) { -- /* For RTL we work in exactly the opposite direction. So -- * decrement the space needed first, then draw to the left -- * instead of drawing to the left and then incrementing -- * the space. */ -- if (rtl) { -- x -= 20; -- if (x < r.left + WD_FRAMERECT_LEFT) break; -- } -- StationsWndShowStationRating(x, x + 16, y, cid, st->goods[cid].cargo.TotalCount(), st->goods[cid].rating); -- if (!rtl) { -- x += 20; -- if (x > r.right - WD_FRAMERECT_RIGHT) break; -- } -- } -- } -+ -+ StationsWndShowStationRating(st, r.left, r.right, x, FONT_HEIGHT_NORMAL + 2, y); -+ - y += FONT_HEIGHT_NORMAL; - } - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0172-Center-yes-no-buttons-on-query-string.patch b/project/jni/application/openttd/0172-Center-yes-no-buttons-on-query-string.patch deleted file mode 100644 index 616d37ff9..000000000 --- a/project/jni/application/openttd/0172-Center-yes-no-buttons-on-query-string.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 199983be811c042a54b4079139d5521e9dcce9d5 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Fri, 9 Aug 2013 09:33:12 +0000 -Subject: [PATCH 172/249] Center yes/no buttons on query string. - ---- - src/misc_gui.cpp | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp -index d771f92..2e54b4f 100644 ---- a/src/misc_gui.cpp -+++ b/src/misc_gui.cpp -@@ -1155,9 +1155,13 @@ static const NWidgetPart _nested_query_widgets[] = { - EndContainer(), - NWidget(WWT_PANEL, COLOUR_RED), SetPIP(8, 15, 8), - NWidget(WWT_TEXT, COLOUR_RED, WID_Q_TEXT), SetMinimalSize(200, 12), -- NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(20, 29, 20), -- NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_Q_NO), SetMinimalSize(71, 12), SetDataTip(STR_QUIT_NO, STR_NULL), -- NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_Q_YES), SetMinimalSize(71, 12), SetDataTip(STR_QUIT_YES, STR_NULL), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_EMPTY), SetFill(1, 1), -+ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(20, 29, 20), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_Q_NO), SetMinimalSize(71, 12), SetDataTip(STR_QUIT_NO, STR_NULL), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_Q_YES), SetMinimalSize(71, 12), SetDataTip(STR_QUIT_YES, STR_NULL), -+ EndContainer(), -+ NWidget(WWT_EMPTY), SetFill(1, 1), - EndContainer(), - EndContainer(), - }; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0173-Reorder-DrawWidget-on-StatusBarWindow.patch b/project/jni/application/openttd/0173-Reorder-DrawWidget-on-StatusBarWindow.patch deleted file mode 100644 index b19099929..000000000 --- a/project/jni/application/openttd/0173-Reorder-DrawWidget-on-StatusBarWindow.patch +++ /dev/null @@ -1,86 +0,0 @@ -From acd5c1d49292557fb174c42b33d02232b52b9c6f Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Wed, 26 Jun 2013 20:34:38 +0200 -Subject: [PATCH 173/249] Reorder DrawWidget on StatusBarWindow. - ---- - src/statusbar_gui.cpp | 27 +++++++++++++++------------ - 1 file changed, 15 insertions(+), 12 deletions(-) - -diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp -index 62799e1..fe9b2b3 100644 ---- a/src/statusbar_gui.cpp -+++ b/src/statusbar_gui.cpp -@@ -128,11 +128,13 @@ struct StatusBarWindow : Window { - - virtual void DrawWidget(const Rect &r, int widget) const - { -+ StringID str = INVALID_STRING_ID; -+ - switch (widget) { - case WID_S_LEFT: - /* Draw the date */ - SetDParam(0, _date); -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_WHITE_DATE_LONG, TC_FROMSTRING, SA_HOR_CENTER); -+ str = STR_WHITE_DATE_LONG; - break; - - case WID_S_RIGHT: { -@@ -140,7 +142,7 @@ struct StatusBarWindow : Window { - const Company *c = Company::GetIfValid(_local_company); - if (c != NULL) { - SetDParam(0, c->money); -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_COMPANY_MONEY, TC_FROMSTRING, SA_HOR_CENTER); -+ str = STR_COMPANY_MONEY; - } - break; - } -@@ -148,11 +150,11 @@ struct StatusBarWindow : Window { - case WID_S_MIDDLE: - /* Draw status bar */ - if (this->saving) { // true when saving is active -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_STATUSBAR_SAVING_GAME, TC_FROMSTRING, SA_HOR_CENTER); -+ str = STR_STATUSBAR_SAVING_GAME; - } else if (_do_autosave) { -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_STATUSBAR_AUTOSAVE, TC_FROMSTRING, SA_HOR_CENTER); -+ str = STR_STATUSBAR_AUTOSAVE; - } else if (_pause_mode != PM_UNPAUSED) { -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_STATUSBAR_PAUSED, TC_FROMSTRING, SA_HOR_CENTER); -+ str = STR_STATUSBAR_PAUSED; - } else if (this->ticker_scroll < TICKER_STOP && FindWindowById(WC_NEWS_WINDOW, 0) == NULL && _statusbar_news_item != NULL && _statusbar_news_item->string_id != 0) { - /* Draw the scrolling news text */ - if (!DrawScrollingStatusText(_statusbar_news_item, this->ticker_scroll, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, r.bottom)) { -@@ -160,22 +162,23 @@ struct StatusBarWindow : Window { - if (Company::IsValidID(_local_company)) { - /* This is the default text */ - SetDParam(0, _local_company); -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_STATUSBAR_COMPANY_NAME, TC_FROMSTRING, SA_HOR_CENTER); -+ str = STR_STATUSBAR_COMPANY_NAME; - } - } - } else { - if (Company::IsValidID(_local_company)) { - /* This is the default text */ - SetDParam(0, _local_company); -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_STATUSBAR_COMPANY_NAME, TC_FROMSTRING, SA_HOR_CENTER); -+ str = STR_STATUSBAR_COMPANY_NAME; - } - } -+ } - -- if (this->reminder_timeout > 0) { -- Dimension icon_size = GetSpriteSize(SPR_UNREAD_NEWS); -- DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, r.right - WD_FRAMERECT_RIGHT - icon_size.width, r.top + WD_FRAMERECT_TOP + (int)(FONT_HEIGHT_NORMAL - icon_size.height) / 2); -- } -- break; -+ if (str != INVALID_STRING_ID) DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_FROMSTRING, SA_HOR_CENTER); -+ -+ if (widget == WID_S_MIDDLE && this->reminder_timeout > 0) { -+ Dimension icon_size = GetSpriteSize(SPR_UNREAD_NEWS); -+ DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, r.right - WD_FRAMERECT_RIGHT - icon_size.width, r.top + WD_FRAMERECT_TOP + (int)(FONT_HEIGHT_NORMAL - icon_size.height) / 2); - } - } - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0174-Get-better-sizes-for-widgets-of-statusbar.patch b/project/jni/application/openttd/0174-Get-better-sizes-for-widgets-of-statusbar.patch deleted file mode 100644 index 9cf8e0fb6..000000000 --- a/project/jni/application/openttd/0174-Get-better-sizes-for-widgets-of-statusbar.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 44eb7d5368be869a0e8bcaf9251fa2e368427b3c Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Fri, 9 Aug 2013 09:33:00 +0000 -Subject: [PATCH 174/249] Get better sizes for widgets of statusbar. - ---- - src/statusbar_gui.cpp | 16 +++++++++++++--- - 1 file changed, 13 insertions(+), 3 deletions(-) - -diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp -index fe9b2b3..a6123e5 100644 ---- a/src/statusbar_gui.cpp -+++ b/src/statusbar_gui.cpp -@@ -103,20 +103,30 @@ struct StatusBarWindow : Window { - { - Dimension d; - switch (widget) { -+ /* Left and right should have same sizing. */ - case WID_S_LEFT: -+ case WID_S_RIGHT: { - SetDParamMaxValue(0, MAX_YEAR * DAYS_IN_YEAR); - d = GetStringBoundingBox(STR_WHITE_DATE_LONG); -- break; - -- case WID_S_RIGHT: { - int64 max_money = UINT32_MAX; - const Company *c; - FOR_ALL_COMPANIES(c) max_money = max(c->money, max_money); - SetDParam(0, 100LL * max_money); -- d = GetStringBoundingBox(STR_COMPANY_MONEY); -+ d = maxdim(d, GetStringBoundingBox(STR_COMPANY_MONEY)); - break; - } - -+ case WID_S_MIDDLE: -+ d = GetStringBoundingBox(STR_STATUSBAR_AUTOSAVE); -+ d = maxdim(d, GetStringBoundingBox(STR_STATUSBAR_PAUSED)); -+ -+ if (Company::IsValidID(_local_company)) { -+ SetDParam(0, _local_company); -+ d = maxdim(d, GetStringBoundingBox(STR_STATUSBAR_COMPANY_NAME)); -+ } -+ break; -+ - default: - return; - } --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0176-Make-icons-for-selling-selling-all-autoreplacing-.-t.patch b/project/jni/application/openttd/0176-Make-icons-for-selling-selling-all-autoreplacing-.-t.patch deleted file mode 100644 index 8ed40cf7d..000000000 --- a/project/jni/application/openttd/0176-Make-icons-for-selling-selling-all-autoreplacing-.-t.patch +++ /dev/null @@ -1,28 +0,0 @@ -From d55046d99644223cdecb03763e87401349c816c0 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 10 Aug 2013 19:44:28 +0000 -Subject: [PATCH 176/249] Make icons for selling, selling all, - autoreplacing,... the same height. - ---- - src/depot_gui.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp -index c677d03..c71089b 100644 ---- a/src/depot_gui.cpp -+++ b/src/depot_gui.cpp -@@ -60,8 +60,8 @@ static const NWidgetPart _nested_train_depot_widgets[] = { - NWidget(NWID_SELECTION, INVALID_COLOUR, WID_D_SHOW_SELL_CHAIN), - NWidget(WWT_IMGBTN, COLOUR_GREY, WID_D_SELL_CHAIN), SetDataTip(SPR_SELL_CHAIN_TRAIN, STR_DEPOT_DRAG_WHOLE_TRAIN_TO_SELL_TOOLTIP), SetResize(0, 1), SetFill(0, 1), - EndContainer(), -- NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_D_SELL_ALL), SetDataTip(0x0, STR_NULL), -- NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_D_AUTOREPLACE), SetDataTip(0x0, STR_NULL), -+ NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_D_SELL_ALL), SetResize(0, 1), SetFill(0, 1), SetDataTip(0x0, STR_NULL), -+ NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_D_AUTOREPLACE), SetResize(0, 1), SetFill(0, 1), SetDataTip(0x0, STR_NULL), - EndContainer(), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_D_V_SCROLL), - EndContainer(), --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0177-Change-the-SetFill-Resize-status-of-order-group-by-w.patch b/project/jni/application/openttd/0177-Change-the-SetFill-Resize-status-of-order-group-by-w.patch deleted file mode 100644 index fd1b11fe3..000000000 --- a/project/jni/application/openttd/0177-Change-the-SetFill-Resize-status-of-order-group-by-w.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 3b35d40eaf709c7851a95f5788d29470bad25d1e Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sun, 11 Aug 2013 13:33:33 +0000 -Subject: [PATCH 177/249] Change the SetFill/Resize status of order/group by - widgets on station GUI. - ---- - src/station_gui.cpp | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) - -diff --git a/src/station_gui.cpp b/src/station_gui.cpp -index 4373ff3..c011f7c 100644 ---- a/src/station_gui.cpp -+++ b/src/station_gui.cpp -@@ -612,12 +612,12 @@ static const NWidgetPart _nested_station_view_widgets[] = { - NWidget(WWT_STICKYBOX, COLOUR_GREY), - EndContainer(), - NWidget(NWID_HORIZONTAL), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SV_SORT_ORDER), SetMinimalSize(81, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), -- NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SV_SORT_BY), SetMinimalSize(168, 12), SetResize(1, 0), SetFill(0, 1), SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIA), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SV_SORT_ORDER), SetMinimalSize(81, 12), SetFill(0, 1), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), -+ NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SV_SORT_BY), SetMinimalSize(168, 12), SetResize(1, 0), SetFill(1, 1), SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIA), - EndContainer(), - NWidget(NWID_HORIZONTAL), -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SV_GROUP), SetMinimalSize(81, 12), SetFill(1, 1), SetDataTip(STR_STATION_VIEW_GROUP, 0x0), -- NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SV_GROUP_BY), SetMinimalSize(168, 12), SetResize(1, 0), SetFill(0, 1), SetDataTip(0x0, STR_TOOLTIP_GROUP_ORDER), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SV_GROUP), SetMinimalSize(81, 12), SetFill(0, 1), SetDataTip(STR_STATION_VIEW_GROUP, 0x0), -+ NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SV_GROUP_BY), SetMinimalSize(168, 12), SetResize(1, 0), SetFill(1, 1), SetDataTip(0x0, STR_TOOLTIP_GROUP_ORDER), - EndContainer(), - NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_GREY, WID_SV_WAITING), SetMinimalSize(237, 44), SetResize(1, 10), SetScrollbar(WID_SV_SCROLLBAR), EndContainer(), -@@ -1234,6 +1234,12 @@ struct StationViewWindow : public Window { - fill->width = 0; - } - break; -+ -+ case WID_SV_SORT_ORDER: -+ case WID_SV_GROUP: -+ *size = maxdim(GetStringBoundingBox(STR_BUTTON_SORT_BY), GetStringBoundingBox(STR_STATION_VIEW_GROUP)); -+ size->width += padding.width; -+ break; - } - } - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0178-Use-resize.step_height-so-the-height-of-each-element.patch b/project/jni/application/openttd/0178-Use-resize.step_height-so-the-height-of-each-element.patch deleted file mode 100644 index 95a2e1cc1..000000000 --- a/project/jni/application/openttd/0178-Use-resize.step_height-so-the-height-of-each-element.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 35dca6035b51dcaf5519e7cd20dbc1671b4a9bbd Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Wed, 26 Jun 2013 20:13:41 +0200 -Subject: [PATCH 178/249] Use resize.step_height, so the height of each element - doesn't need to be FONT_HEIGHT_NORMAL. - ---- - src/town_gui.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/town_gui.cpp b/src/town_gui.cpp -index f575839..b00be1a 100644 ---- a/src/town_gui.cpp -+++ b/src/town_gui.cpp -@@ -203,7 +203,7 @@ public: - - if (--pos < 0) { - DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_LOCAL_AUTHORITY_ACTIONS_TITLE); -- y += FONT_HEIGHT_NORMAL; -+ y += this->resize.step_height; - } - - for (int i = 0; buttons; i++, buttons >>= 1) { -@@ -212,7 +212,7 @@ public: - if ((buttons & 1) && --pos < 0) { - DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, - STR_LOCAL_AUTHORITY_ACTION_SMALL_ADVERTISING_CAMPAIGN + i, this->sel_index == i ? TC_WHITE : TC_ORANGE); -- y += FONT_HEIGHT_NORMAL; -+ y += this->resize.step_height; - } - } - break; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0179-Functions-for-drawing-vertically-aligned-strings.patch b/project/jni/application/openttd/0179-Functions-for-drawing-vertically-aligned-strings.patch deleted file mode 100644 index 032fa8a95..000000000 --- a/project/jni/application/openttd/0179-Functions-for-drawing-vertically-aligned-strings.patch +++ /dev/null @@ -1,35 +0,0 @@ -From f68093a3e526ea71fc67bd764c2f1ef0e39b9438 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 22 Jun 2013 20:09:00 +0200 -Subject: [PATCH 179/249] Functions for drawing vertically aligned strings. - ---- - src/gfx_func.h | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/src/gfx_func.h b/src/gfx_func.h -index 3a59073..4750b3c 100644 ---- a/src/gfx_func.h -+++ b/src/gfx_func.h -@@ -181,6 +181,18 @@ void UpdateMarginsWidth(int width, int &left, int &right, bool to_end_line); - void DrawString2(int left, int right, int top, int &margin, StringID str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false); - void DrawSprite2(int width, int left, int right, int top, int &margin, SpriteID img, PaletteID pal, bool to_end_line = false, SubSprite *sub = NULL); - -+/** -+ * Return where to start drawing a centered object inside a widget. -+ * @param top The top coordinate (or the left coordinate) of the widget. -+ * @param height The height (or width) of the widget. -+ * @param size The height (or width) of the object to draw. -+ * @return The coordinate where to start drawing the centered object. -+ */ -+static inline int Center(int top, int height, uint size = FONT_HEIGHT_NORMAL) -+{ -+ return top + (height - size) / 2; -+} -+ - extern DrawPixelInfo *_cur_dpi; - - TextColour GetContrastColour(uint8 background); --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0180-Draw-strings-vertically-aligned-on-some-windows.patch b/project/jni/application/openttd/0180-Draw-strings-vertically-aligned-on-some-windows.patch deleted file mode 100644 index e2460ae03..000000000 --- a/project/jni/application/openttd/0180-Draw-strings-vertically-aligned-on-some-windows.patch +++ /dev/null @@ -1,302 +0,0 @@ -From 9dc15df06c0badd6317b58267763e821a61ca588 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 29 Jun 2013 11:53:50 +0200 -Subject: [PATCH 180/249] Draw strings vertically aligned on some windows. - ---- - src/airport_gui.cpp | 4 +++- - src/autoreplace_gui.cpp | 2 +- - src/build_vehicle_gui.cpp | 13 ++++--------- - src/filters/filter_window_gui.cpp | 2 +- - src/fios_gui.cpp | 2 +- - src/group_details_gui.cpp | 11 +++++------ - src/industry_gui.cpp | 2 +- - src/misc_gui.cpp | 5 +++-- - src/network/network_chat_gui.cpp | 2 +- - src/network/network_content_gui.cpp | 13 +++++++------ - src/settings_gui.cpp | 4 ++-- - src/station_gui.cpp | 2 +- - src/statusbar_gui.cpp | 9 ++++++--- - src/town_gui.cpp | 2 +- - src/vehicle_gui.cpp | 4 ++-- - src/widgets/dropdown.cpp | 2 +- - 16 files changed, 40 insertions(+), 39 deletions(-) - -diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp -index ca40f35..a7476fc 100644 ---- a/src/airport_gui.cpp -+++ b/src/airport_gui.cpp -@@ -335,7 +335,9 @@ public: - if (!as->IsAvailable()) { - GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->line_height - 2, PC_BLACK, FILLRECT_CHECKER); - } -- DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y + WD_MATRIX_TOP, as->name, ((int)i == _selected_airport_index) ? TC_WHITE : TC_BLACK); -+ -+ DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, Center(y, this->line_height), as->name, ((int)i == _selected_airport_index) ? TC_WHITE : TC_BLACK); -+ - y += this->line_height; - } - break; -diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp -index 5345ff4..94c44c6 100644 ---- a/src/autoreplace_gui.cpp -+++ b/src/autoreplace_gui.cpp -@@ -362,7 +362,7 @@ public: - SetDParam(0, STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED); - } - -- DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_BLACK_STRING, TC_FROMSTRING, SA_HOR_CENTER); -+ DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, Center(r.top, r.bottom - r.top), STR_BLACK_STRING, TC_FROMSTRING, SA_HOR_CENTER); - break; - } - -diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp -index adb117b..fd78d4d 100644 ---- a/src/build_vehicle_gui.cpp -+++ b/src/build_vehicle_gui.cpp -@@ -886,7 +886,6 @@ void DrawEngineList(VehicleType type, int l, int r, int y, const GUIEngineList * - int sprite_width = sprite_left + sprite_right; - - int sprite_x = rtl ? r - sprite_right - 1 : l + sprite_left + 1; -- int sprite_y_offset = sprite_y_offsets[type] + step_size / 2; - - Dimension replace_icon = {0, 0}; - int count_width = 0; -@@ -902,10 +901,6 @@ void DrawEngineList(VehicleType type, int l, int r, int y, const GUIEngineList * - int count_left = l; - int count_right = rtl ? text_left : r - WD_FRAMERECT_RIGHT - replace_icon.width - 8; - -- int normal_text_y_offset = (step_size - FONT_HEIGHT_NORMAL) / 2; -- int small_text_y_offset = step_size - FONT_HEIGHT_SMALL - WD_FRAMERECT_BOTTOM - 1; -- int replace_icon_y_offset = (step_size - replace_icon.height) / 2 - 1; -- - for (; min < max; min++, y += step_size) { - const EngineID engine = (*eng_list)[min]; - Engine *e = Engine::Get(engine); -@@ -929,13 +924,13 @@ void DrawEngineList(VehicleType type, int l, int r, int y, const GUIEngineList * - const uint num_engines = GetGroupNumEngines(_local_company, selected_group, engine); - - SetDParam(0, engine); -- DrawString(text_left, text_right, y + normal_text_y_offset, STR_ENGINE_NAME, engine == selected_id ? TC_WHITE : TC_BLACK); -- DrawVehicleEngine(l, r, sprite_x, y + sprite_y_offset, engine, (show_count && num_engines == 0) ? PALETTE_CRASH : GetEnginePalette(engine, _local_company), EIT_PURCHASE); -+ DrawString(text_left, text_right, Center(y, step_size), STR_ENGINE_NAME, text_colour); -+ DrawVehicleEngine(l, r, sprite_x, Center(y, step_size, sprite_y_offsets[type]), engine, palette_crash ? PALETTE_CRASH : GetEnginePalette(engine, _local_company), EIT_PURCHASE); - if (show_count) { - SetDParam(0, num_engines); -- DrawString(count_left, count_right, y + small_text_y_offset, STR_TINY_BLACK_COMA, TC_FROMSTRING, SA_RIGHT | SA_FORCE); -- if (EngineHasReplacementForCompany(Company::Get(_local_company), engine, selected_group)) DrawSprite(SPR_GROUP_REPLACE_ACTIVE, num_engines == 0 ? PALETTE_CRASH : PAL_NONE, replace_icon_left, y + replace_icon_y_offset); -+ DrawString(count_left, count_right, Center(y, step_size, FONT_HEIGHT_SMALL), STR_TINY_BLACK_COMA, TC_FROMSTRING, SA_RIGHT | SA_FORCE); -+ if (EngineHasReplacementForCompany(Company::Get(_local_company), engine, selected_group)) DrawSprite(SPR_GROUP_REPLACE_ACTIVE, num_engines == 0 ? PALETTE_CRASH : PAL_NONE, replace_icon_left, Center(y, step_size, replace_icon.height)); - } - } - } - -diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp -index 4f15860..de595e3 100644 ---- a/src/industry_gui.cpp -+++ b/src/industry_gui.cpp -@@ -1266,7 +1266,7 @@ public: - - case WID_ID_INDUSTRY_LIST: { - int n = 0; -- int y = r.top + WD_FRAMERECT_TOP; -+ int y = Center(r.top, this->resize.step_height); - if (this->industries.Length() == 0) { - DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_INDUSTRY_DIRECTORY_NONE); - break; -diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp -index 2e54b4f..05ab96d 100644 ---- a/src/misc_gui.cpp -+++ b/src/misc_gui.cpp -@@ -778,11 +778,12 @@ void QueryString::DrawEditBox(const Window *w, int wid) const - /* If we have a marked area, draw a background highlight. */ - if (tb->marklength != 0) GfxFillRect(delta + tb->markxoffs, 0, delta + tb->markxoffs + tb->marklength - 1, bottom - top, PC_GREY); - -- DrawString(delta, tb->pixels, 0, tb->buf, TC_YELLOW); -+ DrawString(delta, tb->pixels, Center(0, bottom - top), tb->buf, TC_YELLOW); -+ - bool focussed = w->IsWidgetGloballyFocused(wid) || IsOSKOpenedFor(w, wid); - if (focussed && tb->caret) { - int caret_width = GetStringBoundingBox("_").width; -- DrawString(tb->caretxoffs + delta, tb->caretxoffs + delta + caret_width, 0, "_", TC_WHITE); -+ DrawString(tb->caretxoffs + delta, tb->caretxoffs + delta + caret_width, Center(0, bottom - top), "_", TC_WHITE); - } - - _cur_dpi = old_dpi; -diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp -index 5fa311b..92cd39d 100644 ---- a/src/network/network_chat_gui.cpp -+++ b/src/network/network_chat_gui.cpp -@@ -478,7 +478,7 @@ struct NetworkChatWindow : public Window { - if (this->dtype == DESTTYPE_CLIENT) { - SetDParamStr(0, NetworkClientInfo::GetByClientID((ClientID)this->dest)->client_name); - } -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, this->dest_string, TC_BLACK, SA_RIGHT); -+ DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, Center(r.top, r.bottom - r.top), this->dest_string, TC_BLACK, SA_RIGHT); - } - - virtual void OnClick(Point pt, int widget, int click_count) -diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp -index 643628a..3ed9dfd 100644 ---- a/src/network/network_content_gui.cpp -+++ b/src/network/network_content_gui.cpp -@@ -535,7 +535,7 @@ public: - { - switch (widget) { - case WID_NCL_FILTER_CAPT: -- DrawString(r.left, r.right, r.top, STR_CONTENT_FILTER_TITLE, TC_FROMSTRING, SA_RIGHT); -+ DrawString(r.left, r.right, Center(r.top, r.bottom - r.top), STR_CONTENT_FILTER_TITLE, TC_FROMSTRING, SA_RIGHT); - break; - - case WID_NCL_DETAILS: -@@ -577,13 +577,13 @@ public: - - - /* Fill the matrix with the information */ -- int sprite_y_offset = WD_MATRIX_TOP + (FONT_HEIGHT_NORMAL - 10) / 2; -+ Dimension sprite_dim = GetSpriteSize(SPR_BOX_EMPTY); - uint y = r.top; - int cnt = 0; - for (ConstContentIterator iter = this->content.Get(this->vscroll->GetPosition()); iter != this->content.End() && cnt < this->vscroll->GetCapacity(); iter++, cnt++) { - const ContentInfo *ci = *iter; - -- if (ci == this->selected) GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->resize.step_height - 1, PC_GREY); -+ if (ci == this->selected) GfxFillRect(r.left + 1, y + WD_FRAMERECT_TOP, r.right - 1, y + this->resize.step_height - WD_FRAMERECT_BOTTOM, PC_GREY); - - SpriteID sprite; - SpriteID pal = PAL_NONE; -@@ -595,12 +595,13 @@ public: - case ContentInfo::DOES_NOT_EXIST: sprite = SPR_BLOT; pal = PALETTE_TO_RED; break; - default: NOT_REACHED(); - } -- DrawSprite(sprite, pal, nwi_checkbox->pos_x + (pal == PAL_NONE ? 2 : 3), y + sprite_y_offset + (pal == PAL_NONE ? 1 : 0)); -+ -+ DrawSprite(sprite, pal, Center(nwi_checkbox->pos_x + (pal == PAL_NONE ? 2 : 3), nwi_checkbox->current_x, sprite_dim.width), Center(y, this->resize.step_height, sprite_dim.height + (pal == PAL_NONE ? 0 : -2))); - - StringID str = STR_CONTENT_TYPE_BASE_GRAPHICS + ci->type - CONTENT_TYPE_BASE_GRAPHICS; -- DrawString(nwi_type->pos_x, nwi_type->pos_x + nwi_type->current_x - 1, y + WD_MATRIX_TOP, str, TC_BLACK, SA_HOR_CENTER); -+ DrawString(nwi_type->pos_x, nwi_type->pos_x + nwi_type->current_x - 1, Center(y, this->resize.step_height), str, TC_BLACK, SA_HOR_CENTER); - -- DrawString(nwi_name->pos_x + WD_FRAMERECT_LEFT, nwi_name->pos_x + nwi_name->current_x - WD_FRAMERECT_RIGHT, y + WD_MATRIX_TOP, ci->name, TC_BLACK); -+ DrawString(nwi_name->pos_x + WD_FRAMERECT_LEFT, nwi_name->pos_x + nwi_name->current_x - WD_FRAMERECT_RIGHT, Center(y,this->resize.step_height), ci->name, TC_BLACK); - y += this->resize.step_height; - } - } -diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp -index 838e5fa..5067550 100644 ---- a/src/settings_gui.cpp -+++ b/src/settings_gui.cpp -@@ -1140,7 +1140,7 @@ uint SettingEntry::Draw(GameSettings *settings_ptr, int left, int right, int bas - case SEF_SUBTREE_KIND: - if (cur_row >= first_row) { - DrawSprite((this->d.sub.folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED), PAL_NONE, rtl ? x - 8 : x, y + (SETTING_HEIGHT - 11) / 2); -- DrawString(rtl ? left : x + 12, rtl ? x - 12 : right, y, this->d.sub.title); -+ DrawString(rtl ? left : x + 12, rtl ? x - 12 : right, Center(y, SETTING_HEIGHT), this->d.sub.title); - } - cur_row++; - if (!this->d.sub.folded) { -@@ -1232,7 +1232,7 @@ void SettingEntry::DrawSetting(GameSettings *settings_ptr, int left, int right, - editable && value != (sdb->flags & SGF_0ISDISABLED ? 0 : sdb->min), editable && (uint32)value != sdb->max); - } - this->SetValueDParams(1, value); -- DrawString(text_left, text_right, y, sdb->str, highlight ? TC_WHITE : TC_LIGHT_BLUE); -+ DrawString(text_left, text_right, Center(y, SETTING_HEIGHT), sdb->str, highlight ? TC_WHITE : TC_LIGHT_BLUE); - } - - -diff --git a/src/station_gui.cpp b/src/station_gui.cpp -index c011f7c..9080fa8 100644 ---- a/src/station_gui.cpp -+++ b/src/station_gui.cpp -@@ -2132,7 +2132,7 @@ struct SelectStationWindow : Window { - { - if (widget != WID_JS_PANEL) return; - -- uint y = r.top + WD_FRAMERECT_TOP; -+ uint y = Center(r.top, this->resize.step_height); - if (this->vscroll->GetPosition() == 0) { - DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, T::EXPECTED_FACIL == FACIL_WAYPOINT ? STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT : STR_JOIN_STATION_CREATE_SPLITTED_STATION); - y += this->resize.step_height; -diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp -index a6123e5..c06976f 100644 ---- a/src/statusbar_gui.cpp -+++ b/src/statusbar_gui.cpp -@@ -67,7 +67,7 @@ static bool DrawScrollingStatusText(const NewsItem *ni, int scroll_pos, int left - - DrawPixelInfo *old_dpi = _cur_dpi; - _cur_dpi = &tmp_dpi; -- DrawString(pos, INT16_MAX, 0, buffer, TC_LIGHT_BLUE, SA_LEFT | SA_FORCE); -+ DrawString(pos, INT16_MAX, Center(0, bottom - top), buffer, TC_LIGHT_BLUE, SA_LEFT | SA_FORCE); - _cur_dpi = old_dpi; - - return (_current_text_dir == TD_RTL) ? (pos < right - left) : (pos + width > 0); -@@ -182,13 +182,16 @@ struct StatusBarWindow : Window { - str = STR_STATUSBAR_COMPANY_NAME; - } - } -+ break; - } - -- if (str != INVALID_STRING_ID) DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_FROMSTRING, SA_HOR_CENTER); -+ int center_top = Center(r.top + WD_FRAMERECT_TOP, r.bottom - r.top); -+ if (str != INVALID_STRING_ID) DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, center_top, str, TC_FROMSTRING, SA_HOR_CENTER); - - if (widget == WID_S_MIDDLE && this->reminder_timeout > 0) { - Dimension icon_size = GetSpriteSize(SPR_UNREAD_NEWS); -- DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, r.right - WD_FRAMERECT_RIGHT - icon_size.width, r.top + WD_FRAMERECT_TOP + (int)(FONT_HEIGHT_NORMAL - icon_size.height) / 2); -+ center_top = Center(r.top + WD_FRAMERECT_TOP, r.bottom - r.top, icon_size.height); -+ DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, r.right - WD_FRAMERECT_RIGHT - icon_size.width, center_top); - } - } - -diff --git a/src/town_gui.cpp b/src/town_gui.cpp -index b00be1a..3960469 100644 ---- a/src/town_gui.cpp -+++ b/src/town_gui.cpp -@@ -198,7 +198,7 @@ public: - case WID_TA_COMMAND_LIST: { - int numact; - uint buttons = GetMaskOfTownActions(&numact, _local_company, this->town); -- int y = r.top + WD_FRAMERECT_TOP; -+ int y = Center(r.top, this->resize.step_height); - int pos = this->vscroll->GetPosition(); - - if (--pos < 0) { -diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp -index bf95b64..785b88c 100644 ---- a/src/vehicle_gui.cpp -+++ b/src/vehicle_gui.cpp -@@ -430,7 +430,7 @@ typedef SmallVector SubtypeList; ///< List of refit subtypes as - */ - static void DrawVehicleRefitWindow(const SubtypeList list[NUM_CARGO], const int sel[2], uint pos, uint rows, uint delta, const Rect &r) - { -- uint y = r.top + WD_MATRIX_TOP; -+ uint y = Center(r.top, delta); - uint current = 0; - - bool rtl = _current_text_dir == TD_RTL; -@@ -3036,7 +3036,7 @@ public: - int image = ((v->vehstatus & VS_STOPPED) != 0) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING; - int lowered = this->IsWidgetLowered(WID_VV_START_STOP) ? 1 : 0; - DrawSprite(image, PAL_NONE, image_left + lowered, r.top + WD_IMGBTN_TOP + lowered); -- DrawString(text_left + lowered, text_right + lowered, r.top + WD_FRAMERECT_TOP + lowered, str, TC_FROMSTRING, SA_HOR_CENTER); -+ DrawString(text_left + lowered, text_right + lowered, Center(r.top + lowered, r.bottom - r.top), str, TC_FROMSTRING, SA_HOR_CENTER); - } - - virtual void OnClick(Point pt, int widget, int click_count) -diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp -index fa5753d..6603dd5 100644 ---- a/src/widgets/dropdown.cpp -+++ b/src/widgets/dropdown.cpp -@@ -38,7 +38,7 @@ uint DropDownListStringItem::Width() const - - void DropDownListStringItem::Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const - { -- DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, this->String(), sel ? TC_WHITE : TC_BLACK); -+ DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, Center(top, bottom - top), this->String(), sel ? TC_WHITE : TC_BLACK); - } - - /** --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0181-Center-group-gui-strings-and-other-minor-changes.patch b/project/jni/application/openttd/0181-Center-group-gui-strings-and-other-minor-changes.patch deleted file mode 100644 index fee46daad..000000000 --- a/project/jni/application/openttd/0181-Center-group-gui-strings-and-other-minor-changes.patch +++ /dev/null @@ -1,44 +0,0 @@ -From a8d3244dca1f0bf568fef9ffd5576d2b20e4b8f8 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 8 Jul 2013 22:49:02 +0200 -Subject: [PATCH 181/249] Center group gui strings (and other minor changes). - ---- - src/group_gui.cpp | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -diff --git a/src/group_gui.cpp b/src/group_gui.cpp -index 2e52123..83bfefe 100644 ---- a/src/group_gui.cpp -+++ b/src/group_gui.cpp -@@ -190,7 +190,7 @@ private: - { - /* Highlight the group if a vehicle is dragged over it */ - if (g_id == this->group_over) { -- GfxFillRect(left + WD_FRAMERECT_LEFT, y + WD_FRAMERECT_TOP, right - WD_FRAMERECT_RIGHT, y + this->tiny_step_height - WD_FRAMERECT_BOTTOM - WD_MATRIX_TOP, _colour_gradient[COLOUR_GREY][7]); -+ GfxFillRect(left + WD_FRAMERECT_LEFT, y + WD_FRAMERECT_TOP + WD_MATRIX_TOP, right - WD_FRAMERECT_RIGHT, y + this->tiny_step_height - WD_FRAMERECT_BOTTOM - WD_MATRIX_TOP, _colour_gradient[COLOUR_GREY][7]); - } - - if (g_id == NEW_GROUP) return; -@@ -527,15 +527,15 @@ public: - { - switch (widget) { - case WID_GL_ALL_VEHICLES: -- DrawGroupInfo(r.top + WD_FRAMERECT_TOP, r.left, r.right, ALL_GROUP); -+ DrawGroupInfo(r.top, r.left, r.right, ALL_GROUP); - break; - - case WID_GL_DEFAULT_VEHICLES: -- DrawGroupInfo(r.top + WD_FRAMERECT_TOP, r.left, r.right, DEFAULT_GROUP); -+ DrawGroupInfo(r.top, r.left, r.right, DEFAULT_GROUP); - break; - - case WID_GL_LIST_GROUP: { -- int y1 = r.top + WD_FRAMERECT_TOP; -+ int y1 = r.top; - int max = min(this->group_sb->GetPosition() + this->group_sb->GetCapacity(), this->groups.Length()); - for (int i = this->group_sb->GetPosition(); i < max; ++i) { - const Group *g = this->groups[i]; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0182-Draw-vehicles-vertically-aligned-on-vehicle-list-veh.patch b/project/jni/application/openttd/0182-Draw-vehicles-vertically-aligned-on-vehicle-list-veh.patch deleted file mode 100644 index 5048a1551..000000000 --- a/project/jni/application/openttd/0182-Draw-vehicles-vertically-aligned-on-vehicle-list-veh.patch +++ /dev/null @@ -1,180 +0,0 @@ -From fc3c780f654c65eade1c57409094e63055781c63 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Tue, 16 Jul 2013 21:50:42 +0200 -Subject: [PATCH 182/249] Draw vehicles vertically aligned on vehicle list, - vehicle info panel, etc. - ---- - src/depot_gui.cpp | 25 ++++++++++++++----------- - src/newgrf_debug_gui.cpp | 4 ++-- - src/vehicle_gui.cpp | 13 +++++++------ - src/vehicle_gui.h | 2 +- - 4 files changed, 24 insertions(+), 20 deletions(-) - -diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp -index c71089b..35d44dd 100644 ---- a/src/depot_gui.cpp -+++ b/src/depot_gui.cpp -@@ -272,7 +272,7 @@ struct DepotWindow : Window { - void DrawVehicleInDepot(const Vehicle *v, int left, int right, int y) const - { - bool free_wagon = false; -- int sprite_y = y + (this->resize.step_height - GetVehicleHeight(v->type)) / 2; -+ int sprite_y = Center(y, this->resize.step_height, GetVehicleHeight(v->type)); - - bool rtl = _current_text_dir == TD_RTL; - int image_left = rtl ? left + this->count_width : left + this->header_width; -@@ -284,13 +284,13 @@ struct DepotWindow : Window { - free_wagon = u->IsFreeWagon(); - - uint x_space = free_wagon ? TRAININFO_DEFAULT_VEHICLE_WIDTH : 0; -- DrawTrainImage(u, image_left + (rtl ? 0 : x_space), image_right - (rtl ? x_space : 0), sprite_y - 1, -+ DrawTrainImage(u, image_left + (rtl ? 0 : x_space), image_right - (rtl ? x_space : 0), sprite_y, - this->sel, EIT_IN_DEPOT, free_wagon ? 0 : this->hscroll->GetPosition(), this->vehicle_over); - - /* Length of consist in tiles with 1 fractional digit (rounded up) */ - SetDParam(0, CeilDiv(u->gcache.cached_total_length * 10, TILE_SIZE)); - SetDParam(1, 1); -- DrawString(rtl ? left + WD_FRAMERECT_LEFT : right - this->count_width, rtl ? left + this->count_width : right - WD_FRAMERECT_RIGHT, y + (this->resize.step_height - FONT_HEIGHT_SMALL) / 2, STR_TINY_BLACK_DECIMAL, TC_FROMSTRING, SA_RIGHT); // Draw the counter -+ DrawString(rtl ? left + WD_FRAMERECT_LEFT : right - this->count_width, rtl ? left + this->count_width : right - WD_FRAMERECT_RIGHT, Center(y, this->resize.step_height, FONT_HEIGHT_SMALL), STR_TINY_BLACK_DECIMAL, TC_FROMSTRING, SA_RIGHT); // Draw the counter - break; - } - -@@ -299,33 +299,35 @@ struct DepotWindow : Window { - case VEH_AIRCRAFT: { - const Sprite *spr = GetSprite(v->GetImage(DIR_W, EIT_IN_DEPOT), ST_NORMAL); - DrawAircraftImage(v, image_left, image_right, -- y + max(UnScaleByZoom(spr->height, ZOOM_LVL_GUI) + UnScaleByZoom(spr->y_offs, ZOOM_LVL_GUI) - 14, 0), // tall sprites needs an y offset -+ Center(y, this->resize.step_height, UnScaleByZoom(spr->height, ZOOM_LVL_GUI) + UnScaleByZoom(spr->y_offs, ZOOM_LVL_GUI)), // tall sprites needs an y offset - this->sel, EIT_IN_DEPOT); - break; - } - default: NOT_REACHED(); - } - -- uint diff_x, diff_y; -+ uint diff_x, y_sprite, y_num; - if (v->IsGroundVehicle()) { - /* Arrange unitnumber and flag horizontally */ - diff_x = this->flag_width + WD_FRAMERECT_LEFT; -- diff_y = (this->resize.step_height - this->flag_height) / 2 - 2; -+ y_sprite = Center(y, this->resize.step_height, this->flag_height); -+ y_num = Center(y, this->resize.step_height); - } else { - /* Arrange unitnumber and flag vertically */ - diff_x = WD_FRAMERECT_LEFT; -- diff_y = FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL; -+ y_num = Center(y, this->resize.step_height, FONT_HEIGHT_NORMAL + this->flag_height + 2); -+ y_sprite = y_num + FONT_HEIGHT_NORMAL; - } - int text_left = rtl ? right - this->header_width - 1 : left + diff_x; - int text_right = rtl ? right - diff_x : left + this->header_width - 1; - - if (free_wagon) { -- DrawString(text_left, text_right, y + 2, STR_DEPOT_NO_ENGINE); -+ DrawString(text_left, text_right, Center(y, this->resize.step_height), STR_DEPOT_NO_ENGINE); - } else { -- DrawSprite((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, rtl ? right - this->flag_width : left + WD_FRAMERECT_LEFT, y + diff_y); -+ DrawSprite((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, rtl ? right - this->flag_width : left + WD_FRAMERECT_LEFT, y_sprite); - - SetDParam(0, v->unitnumber); -- DrawString(text_left, text_right, y + 2, (uint16)(v->max_age - DAYS_IN_LEAP_YEAR) >= v->age ? STR_BLACK_COMMA : STR_RED_COMMA); -+ DrawString(text_left, text_right, y_num, (uint16)(v->max_age - DAYS_IN_LEAP_YEAR) >= v->age ? STR_BLACK_COMMA : STR_RED_COMMA); - } - } - -@@ -342,7 +344,7 @@ struct DepotWindow : Window { - uint16 num = this->vscroll->GetPosition() * this->num_columns; - int maxval = min(this->vehicle_list.Length(), num + (rows_in_display * this->num_columns)); - int y; -- for (y = r.top + 1; num < maxval; y += this->resize.step_height) { // Draw the rows -+ for (y = r.top; num < maxval; y += this->resize.step_height) { // Draw the rows - for (byte i = 0; i < this->num_columns && num < maxval; i++, num++) { - /* Draw all vehicles in the current row */ - const Vehicle *v = this->vehicle_list[num]; -@@ -623,6 +625,7 @@ struct DepotWindow : Window { - int base_width = this->count_width + this->header_width; - - resize->height = max(GetVehicleImageCellSize(this->type, EIT_IN_DEPOT).height, min_height); -+ resize->height = GetMinSizing(NWST_STEP, resize->height); - if (this->type == VEH_TRAIN) { - resize->width = 1; - size->width = base_width + 2 * 29; // about 2 parts -diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp -index cead627..be4e992 100644 ---- a/src/newgrf_debug_gui.cpp -+++ b/src/newgrf_debug_gui.cpp -@@ -434,8 +434,8 @@ struct NewGRFInspectWindow : Window { - - GrfSpecFeature f = GetFeatureNum(this->window_number); - int h = GetVehicleImageCellSize((VehicleType)(VEH_TRAIN + (f - GSF_TRAINS)), EIT_IN_DEPOT).height; -- int y = (r.top + r.bottom - h) / 2; -- DrawVehicleImage(v->First(), r.left + WD_BEVEL_LEFT, r.right - WD_BEVEL_RIGHT, y + 1, INVALID_VEHICLE, EIT_IN_DETAILS, skip); -+ int y = Center(r.top, r.bottom - r.top, h); -+ DrawVehicleImage(v->First(), r.left + WD_BEVEL_LEFT, r.right - WD_BEVEL_RIGHT, y + 1, h, INVALID_VEHICLE, EIT_IN_DETAILS, skip); - - /* Highlight the articulated part (this is different to the whole-vehicle highlighting of DrawVehicleImage */ - if (_current_text_dir == TD_RTL) { -diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp -index 785b88c..8bff19d 100644 ---- a/src/vehicle_gui.cpp -+++ b/src/vehicle_gui.cpp -@@ -825,7 +825,7 @@ struct RefitWindow : public Window { - case WID_VR_VEHICLE_PANEL_DISPLAY: { - Vehicle *v = Vehicle::Get(this->window_number); - DrawVehicleImage(v, this->sprite_left + WD_FRAMERECT_LEFT, this->sprite_right - WD_FRAMERECT_RIGHT, -- r.top + WD_FRAMERECT_TOP, INVALID_VEHICLE, EIT_IN_DETAILS, this->hscroll != NULL ? this->hscroll->GetPosition() : 0); -+ r.top, r.bottom - r.top, INVALID_VEHICLE, EIT_IN_DETAILS, this->hscroll != NULL ? this->hscroll->GetPosition() : 0); - - /* Highlight selected vehicles. */ - if (this->order != INVALID_VEH_ORDER_ID) break; -@@ -1503,8 +1503,9 @@ static int DrawSmallOrderList(const Group *g, int left, int right, int y) - * @param selection Selected vehicle to draw a frame around - * @param skip Number of pixels to skip at the front (for scrolling) - */ --void DrawVehicleImage(const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type, int skip) -+void DrawVehicleImage(const Vehicle *v, int left, int right, int y, int height, VehicleID selection, EngineImageType image_type, int skip) - { -+ y = Center(y, height, GetVehicleHeight(v->type)); - switch (v->type) { - case VEH_TRAIN: DrawTrainImage(Train::From(v), left, right, y, selection, image_type, skip); break; - case VEH_ROAD: DrawRoadVehImage(v, left, right, y, selection, image_type, skip); break; -@@ -1374,7 +1375,7 @@ - SetDParam(0, v->GetDisplayProfitThisYear()); - SetDParam(1, v->GetDisplayProfitLastYear()); - -- DrawVehicleImage(v, image_left, image_right, y + FONT_HEIGHT_SMALL - 1, selected_vehicle, EIT_IN_LIST, 0); -+ DrawVehicleImage(v, image_left, image_right, y, line_height, selected_vehicle, EIT_IN_LIST, 0); - DrawString(text_left, text_right, y + line_height - FONT_HEIGHT_SMALL - WD_FRAMERECT_BOTTOM - 1, STR_VEHICLE_LIST_PROFIT_THIS_YEAR_LAST_YEAR); - - if (v->name != NULL) { -@@ -2479,12 +2480,12 @@ struct VehicleDetailsWindow : Window { - - /* Articulated road vehicles use a complete line. */ - if (v->type == VEH_ROAD && v->HasArticulatedPart()) { -- DrawVehicleImage(v, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, INVALID_VEHICLE, EIT_IN_DETAILS, 0); -+ DrawVehicleImage(v, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top, r.bottom - r.top, INVALID_VEHICLE, EIT_IN_DETAILS, 0); - } else { - uint sprite_left = rtl ? text_right : r.left; - uint sprite_right = rtl ? r.right : text_left; - -- DrawVehicleImage(v, sprite_left + WD_FRAMERECT_LEFT, sprite_right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, INVALID_VEHICLE, EIT_IN_DETAILS, 0); -+ DrawVehicleImage(v, sprite_left + WD_FRAMERECT_LEFT, sprite_right - WD_FRAMERECT_RIGHT, r.top, r.bottom - r.top, INVALID_VEHICLE, EIT_IN_DETAILS, 0); - } - DrawVehicleDetails(v, text_left + WD_FRAMERECT_LEFT, text_right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, 0, 0, this->tab); - break; -diff --git a/src/vehicle_gui.h b/src/vehicle_gui.h -index e999945..0bb9549 100644 ---- a/src/vehicle_gui.h -+++ b/src/vehicle_gui.h -@@ -101,6 +101,6 @@ void StartStopVehicle(const Vehicle *v, bool texteffect); - - Vehicle *CheckClickOnVehicle(const struct ViewPort *vp, int x, int y); - --void DrawVehicleImage(const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type, int skip); -+void DrawVehicleImage(const Vehicle *v, int left, int right, int y, int height, VehicleID selection, EngineImageType image_type, int skip); - - #endif /* VEHICLE_GUI_H */ --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0183-Center-images-on-buttons.patch b/project/jni/application/openttd/0183-Center-images-on-buttons.patch deleted file mode 100644 index ddea8b29d..000000000 --- a/project/jni/application/openttd/0183-Center-images-on-buttons.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 6fbe41762ecbe2afcc44382e57a32b15ca58507d Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Wed, 24 Jul 2013 22:20:06 +0000 -Subject: [PATCH 183/249] Center images on buttons. - ---- - src/widget.cpp | 72 ++++++++++++---------------------------------------------- - 1 file changed, 14 insertions(+), 58 deletions(-) - -diff --git a/src/widget.cpp b/src/widget.cpp -index 81a7760..3253cbb 100644 ---- a/src/widget.cpp -+++ b/src/widget.cpp -@@ -222,7 +222,8 @@ static inline void DrawImageButtons(const Rect &r, WidgetType type, Colours colo - DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE); - - if ((type & WWT_MASK) == WWT_IMGBTN_2 && clicked) img++; // Show different image when clicked for #WWT_IMGBTN_2. -- DrawSprite(img, PAL_NONE, r.left + WD_IMGBTN_LEFT + clicked, r.top + WD_IMGBTN_TOP + clicked); -+ Dimension d2 = GetSpriteSize(img); -+ DrawSprite(img, PAL_NONE, Center(r.left + clicked, r.right - r.left, d2.width), Center(r.top + clicked, r.bottom - r.top, d2.height)); - } - - /** -@@ -453,54 +454,6 @@ static inline void DrawFrame(const Rect &r, Colours colour, StringID str) - } - - /** -- * Draw a shade box. -- * @param r Rectangle of the box. -- * @param colour Colour of the shade box. -- * @param clicked Box is lowered. -- */ --static inline void DrawShadeBox(const Rect &r, Colours colour, bool clicked) --{ -- DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE); -- DrawSprite((clicked) ? SPR_WINDOW_SHADE : SPR_WINDOW_UNSHADE, PAL_NONE, r.left + WD_SHADEBOX_LEFT + clicked, r.top + WD_SHADEBOX_TOP + clicked); --} -- --/** -- * Draw a sticky box. -- * @param r Rectangle of the box. -- * @param colour Colour of the sticky box. -- * @param clicked Box is lowered. -- */ --static inline void DrawStickyBox(const Rect &r, Colours colour, bool clicked) --{ -- DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE); -- DrawSprite((clicked) ? SPR_PIN_UP : SPR_PIN_DOWN, PAL_NONE, r.left + WD_STICKYBOX_LEFT + clicked, r.top + WD_STICKYBOX_TOP + clicked); --} -- --/** -- * Draw a defsize box. -- * @param r Rectangle of the box. -- * @param colour Colour of the defsize box. -- * @param clicked Box is lowered. -- */ --static inline void DrawDefSizeBox(const Rect &r, Colours colour, bool clicked) --{ -- DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE); -- DrawSprite(SPR_WINDOW_DEFSIZE, PAL_NONE, r.left + WD_DEFSIZEBOX_LEFT + clicked, r.top + WD_DEFSIZEBOX_TOP + clicked); --} -- --/** -- * Draw a NewGRF debug box. -- * @param r Rectangle of the box. -- * @param colour Colour of the debug box. -- * @param clicked Box is lowered. -- */ --static inline void DrawDebugBox(const Rect &r, Colours colour, bool clicked) --{ -- DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE); -- DrawSprite(SPR_WINDOW_DEBUG, PAL_NONE, r.left + WD_DEBUGBOX_LEFT + clicked, r.top + WD_DEBUGBOX_TOP + clicked); --} -- --/** - * Draw a resize box. - * @param r Rectangle of the box. - * @param colour Colour of the resize box. -@@ -510,12 +463,13 @@ static inline void DrawDebugBox(const Rect &r, Colours colour, bool clicked) - static inline void DrawResizeBox(const Rect &r, Colours colour, bool at_left, bool clicked) - { - DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE); -+ Dimension d = GetSpriteSize(at_left ? SPR_WINDOW_RESIZE_LEFT : SPR_WINDOW_RESIZE_RIGHT); - if (at_left) { -- DrawSprite(SPR_WINDOW_RESIZE_LEFT, PAL_NONE, r.left + WD_RESIZEBOX_RIGHT + clicked, -- r.bottom - WD_RESIZEBOX_BOTTOM - GetSpriteSize(SPR_WINDOW_RESIZE_LEFT).height + clicked); -+ DrawSprite(SPR_WINDOW_RESIZE_LEFT, PAL_NONE, r.left + WD_RESIZEBOX_LEFT + clicked, -+ r.bottom - WD_RESIZEBOX_BOTTOM - d.height + clicked); - } else { -- DrawSprite(SPR_WINDOW_RESIZE_RIGHT, PAL_NONE, r.left + WD_RESIZEBOX_LEFT + clicked, -- r.bottom - WD_RESIZEBOX_BOTTOM - GetSpriteSize(SPR_WINDOW_RESIZE_RIGHT).height + clicked); -+ DrawSprite(SPR_WINDOW_RESIZE_RIGHT, PAL_NONE, r.right - WD_RESIZEBOX_RIGHT - d.width + clicked, -+ r.bottom - WD_RESIZEBOX_BOTTOM - d.height + clicked); - } - } - -@@ -2450,21 +2404,23 @@ void NWidgetLeaf::Draw(const Window *w) - - case WWT_SHADEBOX: - assert(this->widget_data == 0); -- DrawShadeBox(r, this->colour, w->IsShaded()); -+ DrawImageButtons(r, WWT_SHADEBOX, this->colour, w->IsShaded(), w->IsShaded() ? SPR_WINDOW_SHADE : SPR_WINDOW_UNSHADE); - break; - - case WWT_DEBUGBOX: -- DrawDebugBox(r, this->colour, clicked); -+ DrawImageButtons(r, WWT_DEBUGBOX, this->colour, clicked, SPR_WINDOW_DEBUG); - break; - -- case WWT_STICKYBOX: -+ case WWT_STICKYBOX: { - assert(this->widget_data == 0); -- DrawStickyBox(r, this->colour, !!(w->flags & WF_STICKY)); -+ bool clicked = !!(w->flags & WF_STICKY); -+ DrawImageButtons(r, WWT_STICKYBOX, this->colour, clicked, clicked ? SPR_PIN_DOWN : SPR_PIN_UP); - break; -+ } - - case WWT_DEFSIZEBOX: - assert(this->widget_data == 0); -- DrawDefSizeBox(r, this->colour, clicked); -+ DrawImageButtons(r, WWT_DEFSIZEBOX, this->colour, clicked, SPR_WINDOW_DEFSIZE); - break; - - case WWT_RESIZEBOX: --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0184-Center-company-icon-on-league-table.patch b/project/jni/application/openttd/0184-Center-company-icon-on-league-table.patch deleted file mode 100644 index f6206eb22..000000000 --- a/project/jni/application/openttd/0184-Center-company-icon-on-league-table.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 32056cc9932ad73e22dda9a4ea0dc6d2a69465e6 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Fri, 2 Aug 2013 19:22:04 +0000 -Subject: [PATCH 184/249] Center company icon on league table. - ---- - src/graph_gui.cpp | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp -index 1077950..99cff0e 100644 ---- a/src/graph_gui.cpp -+++ b/src/graph_gui.cpp -@@ -1128,6 +1128,7 @@ private: - uint ordinal_width; ///< The width of the ordinal number - uint text_width; ///< The width of the actual text - uint icon_width; ///< The width of the company icon -+ uint icon_y_offset; ///< The vertical offset for drawing the company icon. - int line_height; ///< Height of the text lines - - /** -@@ -1174,8 +1175,7 @@ public: - { - if (widget != WID_CL_BACKGROUND) return; - -- int icon_y_offset = 1 + (FONT_HEIGHT_NORMAL - this->line_height) / 2; -- uint y = r.top + WD_FRAMERECT_TOP - icon_y_offset; -+ uint y = r.top + WD_FRAMERECT_TOP; - - bool rtl = _current_text_dir == TD_RTL; - uint ordinal_left = rtl ? r.right - WD_FRAMERECT_LEFT - this->ordinal_width : r.left + WD_FRAMERECT_LEFT; -@@ -1188,7 +1188,7 @@ public: - const Company *c = this->companies[i]; - DrawString(ordinal_left, ordinal_right, y, i + STR_ORDINAL_NUMBER_1ST, i == 0 ? TC_WHITE : TC_YELLOW); - -- DrawCompanyIcon(c->index, icon_left, y + icon_y_offset); -+ DrawCompanyIcon(c->index, icon_left, y + this->icon_y_offset); - - SetDParam(0, c->index); - SetDParam(1, c->index); -@@ -1221,6 +1221,7 @@ public: - Dimension d = GetSpriteSize(SPR_COMPANY_ICON); - this->icon_width = d.width + 2; - this->line_height = max(d.height + 2, FONT_HEIGHT_NORMAL); -+ this->icon_y_offset = Center(1, this->line_height, d.height); - - const Company *c; - FOR_ALL_COMPANIES(c) { --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0186-Add-min-sizing.patch b/project/jni/application/openttd/0186-Add-min-sizing.patch deleted file mode 100644 index 305c63404..000000000 --- a/project/jni/application/openttd/0186-Add-min-sizing.patch +++ /dev/null @@ -1,973 +0,0 @@ -From 9d64539b8739d940c2b3c74a07b8e1123b710726 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 29 Jun 2013 15:12:06 +0200 -Subject: [PATCH 186/249] Add min sizing. - ---- - src/ai/ai_gui.cpp | 8 +-- - src/airport_gui.cpp | 9 ++-- - src/build_vehicle_gui.cpp | 10 ++-- - src/company_gui.cpp | 3 +- - src/filters/filter_window_gui.cpp | 5 +- - src/fios_gui.cpp | 2 +- - src/genworld_gui.cpp | 7 +-- - src/graph_gui.cpp | 1 + - src/group_details_gui.cpp | 10 ++-- - src/group_gui.cpp | 21 +++----- - src/industry_gui.cpp | 4 +- - src/linkgraph/linkgraph_gui.cpp | 1 + - src/network/network_content_gui.cpp | 2 +- - src/network/network_gui.cpp | 18 +++---- - src/newgrf_gui.cpp | 10 ++-- - src/settings_gui.cpp | 2 +- - src/settings_type.h | 2 + - src/signs_gui.cpp | 1 + - src/station_gui.cpp | 15 +++--- - src/table/misc_settings.ini | 19 +++++++ - src/toolbar_gui.cpp | 2 +- - src/town_gui.cpp | 21 ++++---- - src/vehicle_gui.cpp | 4 +- - src/widget.cpp | 101 ++++++++++++++++++++++++++++++++++-- - src/widget_type.h | 41 +++++++++++++-- - src/widgets/dropdown_type.h | 3 +- - 26 files changed, 239 insertions(+), 83 deletions(-) - -diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp -index 8bcc414..62fed7d 100644 ---- a/src/ai/ai_gui.cpp -+++ b/src/ai/ai_gui.cpp -@@ -107,7 +107,7 @@ struct AIListWindow : public Window { - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) - { - if (widget == WID_AIL_LIST) { -- this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; -+ this->line_height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); - - resize->width = 1; - resize->height = this->line_height; -@@ -345,7 +345,7 @@ struct AISettingsWindow : public Window { - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) - { - if (widget == WID_AIS_BACKGROUND) { -- this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; -+ this->line_height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); - - resize->width = 1; - resize->height = this->line_height; -@@ -761,7 +761,7 @@ struct AIConfigWindow : public Window { - break; - - case WID_AIC_LIST: -- this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; -+ this->line_height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); - size->height = 8 * this->line_height; - break; - } -@@ -1072,7 +1072,7 @@ struct AIDebugWindow : public Window { - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) - { - if (widget == WID_AID_LOG_PANEL) { -- resize->height = FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL; -+ resize->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL); - size->height = 14 * resize->height + this->top_offset + this->bottom_offset; - } - } -diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp -index a7476fc..103b826 100644 ---- a/src/airport_gui.cpp -+++ b/src/airport_gui.cpp -@@ -272,6 +272,7 @@ public: - d.width += padding.width; - d.height += padding.height; - *size = maxdim(*size, d); -+ size->height = GetMinSizing(NWST_STEP, size->height); - break; - } - -@@ -283,7 +284,7 @@ public: - size->width = max(size->width, GetStringBoundingBox(as->name).width); - } - -- this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; -+ this->line_height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); - size->height = 5 * this->line_height; - break; - } -@@ -522,7 +541,7 @@ - NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), - EndContainer(), - NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 0), SetPIP(2, 0, 2), -- NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0), -+ NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetSizingType(NWST_STEP), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0), - NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_AP_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP), - NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_AIRPORT_SPRITE), SetFill(1, 0), - NWidget(NWID_HORIZONTAL), -@@ -530,9 +549,9 @@ - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_AP_SCROLLBAR), - EndContainer(), - NWidget(NWID_HORIZONTAL), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_DECREASE), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE, STR_NULL), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_DECREASE), SetSizingType(NWST_STEP), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE, STR_NULL), - NWidget(WWT_LABEL, COLOUR_GREY, WID_AP_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_INCREASE), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_INCREASE), SetSizingType(NWST_STEP), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL), - EndContainer(), - NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0), - EndContainer(), -diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp -index fd78d4d..1546393 100644 ---- a/src/build_vehicle_gui.cpp -+++ b/src/build_vehicle_gui.cpp -@@ -44,7 +44,8 @@ - */ - uint GetEngineListHeight(VehicleType type) - { -- return max(FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM, GetVehicleImageCellSize(type, EIT_PURCHASE).height); -+ uint size = max(FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM, GetVehicleImageCellSize(type, EIT_PURCHASE).height); -+ return GetMinSizing(NWST_STEP, size); - } - - static const NWidgetPart _nested_build_vehicle_widgets[] = { -@@ -59,12 +60,12 @@ static const NWidgetPart _nested_build_vehicle_widgets[] = { - NWidget(WWT_PANEL, COLOUR_GREY), - NWidget(NWID_HORIZONTAL), - NWidget(NWID_VERTICAL), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BV_SORT_ASSENDING_DESCENDING), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BV_SORT_ASSENDING_DESCENDING), SetSizingType(NWST_STEP), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), - NWidget(NWID_SPACER), SetFill(1, 1), - EndContainer(), - NWidget(NWID_VERTICAL), -- NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_BV_SORT_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA), -- NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_BV_CARGO_FILTER_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_FILTER_CRITERIA), -+ NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_BV_SORT_DROPDOWN), SetSizingType(NWST_STEP), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA), -+ NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_BV_CARGO_FILTER_DROPDOWN), SetSizingType(NWST_STEP), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_FILTER_CRITERIA), - EndContainer(), - EndContainer(), - EndContainer(), -@@ -1316,6 +1317,7 @@ struct BuildVehicleWindow : Window { - Dimension d = GetStringBoundingBox(this->GetWidget(widget)->widget_data); - d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better. - d.height += padding.height; -+ d.height = GetMinSizing(NWST_STEP, d.height); - *size = maxdim(*size, d); - break; - } -diff --git a/src/company_gui.cpp b/src/company_gui.cpp -index 1cf38fc..060c796 100644 ---- a/src/company_gui.cpp -+++ b/src/company_gui.cpp -@@ -35,6 +35,7 @@ - #include "road_func.h" - #include "water.h" - #include "station_func.h" -+#include "widget_type.h" - - #include "widgets/company_widget.h" - -@@ -526,7 +527,7 @@ public: - - uint Height(uint width) const - { -- return max(FONT_HEIGHT_NORMAL, 14); -+ return GetMinSizing(NWST_STEP, max(FONT_HEIGHT_NORMAL, 14)); - } - - bool Selectable() const -diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp -index 08d6415..629f8bb 100644 ---- a/src/fios_gui.cpp -+++ b/src/fios_gui.cpp -@@ -473,7 +473,7 @@ public: - break; - - case WID_SL_DRIVES_DIRECTORIES_LIST: -- resize->height = FONT_HEIGHT_NORMAL; -+ resize->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); - size->height = resize->height * 10 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; - break; - case WID_SL_SORT_BYNAME: -diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp -index f1b561e..1cc26bd 100644 ---- a/src/genworld_gui.cpp -+++ b/src/genworld_gui.cpp -@@ -451,6 +451,7 @@ struct GenerateLandscapeWindow : public Window { - case WID_GL_MAPSIZE_Y_PULLDOWN: - SetDParamMaxValue(0, MAX_MAP_SIZE); - *size = GetStringBoundingBox(STR_JUST_INT); -+ size->width = size->width + GetMinSizing(NWST_BUTTON); - break; - - case WID_GL_SNOW_LEVEL_TEXT: -@@ -508,7 +509,7 @@ struct GenerateLandscapeWindow : public Window { - } - } - size->width += padding.width; -- size->height = FONT_HEIGHT_NORMAL + WD_DROPDOWNTEXT_TOP + WD_DROPDOWNTEXT_BOTTOM; -+ size->height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL + WD_DROPDOWNTEXT_TOP + WD_DROPDOWNTEXT_BOTTOM); - } - - virtual void DrawWidget(const Rect &r, int widget) const -diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp -index 99cff0e..4e8e3ae 100644 ---- a/src/graph_gui.cpp -+++ b/src/graph_gui.cpp -@@ -114,6 +114,7 @@ static NWidgetBase *MakeNWidgetCompanyLines(int *biggest_index) - - for (int widnum = WID_GL_FIRST_COMPANY; widnum <= WID_GL_LAST_COMPANY; widnum++) { - NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum); -+ panel->sizing_type = NWST_STEP; - panel->SetMinimalSize(246, line_height); - panel->SetFill(1, 0); - panel->SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP); -diff --git a/src/group_gui.cpp b/src/group_gui.cpp -index ee1a240..537ccac 100644 ---- a/src/group_gui.cpp -+++ b/src/group_gui.cpp -@@ -66,7 +66,7 @@ - /* right part */ - NWidget(NWID_VERTICAL), - NWidget(NWID_HORIZONTAL), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GL_SORT_BY_ORDER), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GL_SORT_BY_ORDER), SetSizingType(NWST_STEP), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), - NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GL_SORT_BY_DROPDOWN), SetMinimalSize(167, 12), SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIA), - NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(12, 12), SetResize(1, 0), EndContainer(), - EndContainer(), -@@ -94,7 +94,7 @@ static const NWidgetPart _nested_group_widgets[] = { - NWidget(WWT_MATRIX, COLOUR_GREY, WID_GL_LIST_VEHICLE), SetMinimalSize(248, 0), SetMatrixDataTip(1, 0, STR_NULL), SetResize(1, 1), SetFill(1, 0), SetScrollbar(WID_GL_LIST_VEHICLE_SCROLLBAR), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_GL_LIST_VEHICLE_SCROLLBAR), - EndContainer(), -- NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(1, 0), SetFill(1, 1), SetResize(1, 0), EndContainer(), -+ NWidget(WWT_PANEL, COLOUR_GREY), SetFill(1, 1), SetResize(1, 0), EndContainer(), - NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GL_AVAILABLE_VEHICLES), SetMinimalSize(106, 12), SetFill(0, 1), - SetDataTip(STR_BLACK_STRING, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP), -@@ -143,7 +143,7 @@ private: - this->column_size[VGC_NAME] = maxdim(GetStringBoundingBox(STR_GROUP_DEFAULT_TRAINS + this->vli.vtype), GetStringBoundingBox(STR_GROUP_ALL_TRAINS + this->vli.vtype)); - /* We consider the max average length of characters to be the one of "a" */ - this->column_size[VGC_NAME].width = max(GetCharacterWidth(FS_NORMAL, 97) * (MAX_LENGTH_GROUP_NAME_CHARS - 4), this->column_size[VGC_NAME].width); -- this->tiny_step_height = this->column_size[VGC_NAME].height; -+ this->tiny_step_height = max(11U, this->column_size[VGC_NAME].height); - - this->column_size[VGC_PROTECT] = GetSpriteSize(SPR_GROUP_REPLACE_PROTECT); - this->tiny_step_height = max(this->tiny_step_height, this->column_size[VGC_PROTECT].height); -@@ -167,6 +167,7 @@ private: - this->tiny_step_height = max(this->tiny_step_height, this->column_size[VGC_NUMBER].height); - - this->tiny_step_height += WD_MATRIX_TOP; -+ this->tiny_step_height = GetMinSizing(NWST_STEP, this->tiny_step_height); - - return WD_FRAMERECT_LEFT + 8 + - this->column_size[VGC_NAME].width + 2 + -@@ -364,14 +365,8 @@ public: - /* Minimum height is the height of the list widget minus all and default vehicles... */ - size->height = 4 * GetVehicleListHeight(this->vli.vtype, this->tiny_step_height) - 4 * this->tiny_step_height; - -- /* ... minus the buttons at the bottom ... */ -- uint max_icon_height = GetSpriteSize(this->GetWidget(WID_GL_CREATE_GROUP)->widget_data).height; -- max_icon_height = max(max_icon_height, GetSpriteSize(this->GetWidget(WID_GL_RENAME_GROUP)->widget_data).height); -- max_icon_height = max(max_icon_height, GetSpriteSize(this->GetWidget(WID_GL_DELETE_GROUP)->widget_data).height); -- max_icon_height = max(max_icon_height, GetSpriteSize(this->GetWidget(WID_GL_REPLACE_PROTECTION)->widget_data).height); -- - /* Get a multiple of tiny_step_height of that amount */ -- size->height = Ceil(size->height - max_icon_height, tiny_step_height); -+ size->height = Ceil(size->height, tiny_step_height); - break; - } - -diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp -index de595e3..360ce8a 100644 ---- a/src/industry_gui.cpp -+++ b/src/industry_gui.cpp -@@ -298,7 +298,7 @@ public: - if (this->index[i] == INVALID_INDUSTRYTYPE) continue; - d = maxdim(d, GetStringBoundingBox(GetIndustrySpec(this->index[i])->name)); - } -- resize->height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; -+ resize->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); - d.width += MATRIX_TEXT_OFFSET + padding.width; - d.height = 5 * resize->height; - *size = maxdim(*size, d); -@@ -1309,7 +1309,7 @@ public: - for (uint i = 0; i < this->industries.Length(); i++) { - d = maxdim(d, GetStringBoundingBox(this->GetIndustryString(this->industries[i]))); - } -- resize->height = d.height; -+ resize->height = d.height = GetMinSizing(NWST_STEP, d.height); - d.height *= 5; - d.width += padding.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; - d.height += padding.height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; -diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp -index ae4cdee..9889ad8 100644 ---- a/src/linkgraph/linkgraph_gui.cpp -+++ b/src/linkgraph/linkgraph_gui.cpp -@@ -344,6 +344,7 @@ NWidgetBase *MakeCargoesLegendLinkGraphGUI(int *biggest_index) - row = new NWidgetHorizontal(NC_EQUALSIZE); - } - NWidgetBackground * wid = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, i + WID_LGL_CARGO_FIRST); -+ wid->sizing_type = NWST_STEP; - wid->SetMinimalSize(25, FONT_HEIGHT_SMALL); - wid->SetFill(1, 1); - wid->SetResize(0, 0); -diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp -index 3ed9dfd..77b51bc 100644 ---- a/src/network/network_content_gui.cpp -+++ b/src/network/network_content_gui.cpp -@@ -524,7 +524,7 @@ public: - } - - case WID_NCL_MATRIX: -- resize->height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; -+ resize->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); - size->height = 10 * resize->height; - break; - } -diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp -index 3165f4d..6d4c38d 100644 ---- a/src/network/network_gui.cpp -+++ b/src/network/network_gui.cpp -@@ -499,12 +499,12 @@ public: - break; - - case WID_NG_MATRIX: -- resize->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM; -+ resize->height = GetMinSizing(NWST_STEP, WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM); - size->height = 10 * resize->height; - break; - - case WID_NG_LASTJOINED: -- size->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM; -+ size->height = GetMinSizing(NWST_STEP, WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM); - break; - - case WID_NG_LASTJOINED_SPACER: -@@ -931,7 +931,7 @@ static const NWidgetPart _nested_network_game_widgets[] = { - /* LEFT SIDE */ - NWidget(NWID_VERTICAL), SetPIP(0, 7, 0), - NWidget(NWID_HORIZONTAL), SetPIP(0, 7, 0), -- NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_CONNECTION), SetDataTip(STR_NETWORK_SERVER_LIST_ADVERTISED, STR_NULL), -+ NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_CONNECTION), SetSizingType(NWST_STEP), SetDataTip(STR_NETWORK_SERVER_LIST_ADVERTISED, STR_NULL), - NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, WID_NG_CONN_BTN), - SetDataTip(STR_BLACK_STRING, STR_NETWORK_SERVER_LIST_ADVERTISED_TOOLTIP), - NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0), -@@ -1080,8 +1080,8 @@ struct NetworkStartServerWindow : public Window { - switch (widget) { - case WID_NSS_CONNTYPE_BTN: - *size = maxdim(GetStringBoundingBox(_connection_types_dropdown[0]), GetStringBoundingBox(_connection_types_dropdown[1])); -- size->width += padding.width; -- size->height += padding.height; -+ size->width = GetMinSizing(NWST_BUTTON, size->width + padding.width); -+ size->height = GetMinSizing(NWST_BUTTON, size->height + padding.height); - break; - } - } -@@ -1264,15 +1264,15 @@ - NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 6, 10), - NWidget(NWID_VERTICAL), SetPIP(0, 1, 0), - NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NSS_CONNTYPE_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_ADVERTISED, STR_NULL), -- NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, WID_NSS_CONNTYPE_BTN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NETWORK_SERVER_LIST_ADVERTISED_TOOLTIP), -+ NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, WID_NSS_CONNTYPE_BTN), SetSizingType(NWST_BUTTON), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NETWORK_SERVER_LIST_ADVERTISED_TOOLTIP), - EndContainer(), - NWidget(NWID_VERTICAL), SetPIP(0, 1, 0), - NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NSS_LANGUAGE_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_LANGUAGE_SPOKEN, STR_NULL), -- NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, WID_NSS_LANGUAGE_BTN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NETWORK_START_SERVER_LANGUAGE_TOOLTIP), -+ NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, WID_NSS_LANGUAGE_BTN), SetSizingType(NWST_BUTTON), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NETWORK_START_SERVER_LANGUAGE_TOOLTIP), - EndContainer(), - NWidget(NWID_VERTICAL), SetPIP(0, 1, 0), - NWidget(NWID_SPACER), SetFill(1, 1), -- NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NSS_SETPWD), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_SET_PASSWORD, STR_NETWORK_START_SERVER_PASSWORD_TOOLTIP), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NSS_SETPWD), SetSizingType(NWST_BUTTON), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_SET_PASSWORD, STR_NETWORK_START_SERVER_PASSWORD_TOOLTIP), - EndContainer(), - EndContainer(), - -@@ -1375,7 +1375,7 @@ struct NetworkLobbyWindow : public Window { - break; - - case WID_NL_MATRIX: -- resize->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM; -+ resize->height = GetMinSizing(NWST_STEP, WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM); - size->height = 10 * resize->height; - break; - -diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp -index 47cca02..aedb4fd 100644 ---- a/src/newgrf_gui.cpp -+++ b/src/newgrf_gui.cpp -@@ -681,14 +681,14 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { - case WID_NS_FILE_LIST: - { - Dimension d = maxdim(GetSpriteSize(SPR_SQUARE), GetSpriteSize(SPR_WARNING_SIGN)); -- resize->height = max(d.height + 2U, FONT_HEIGHT_NORMAL + 2U); -- size->height = max(size->height, WD_FRAMERECT_TOP + 6 * resize->height + WD_FRAMERECT_BOTTOM); -+ resize->height = GetMinSizing(NWST_STEP, max(d.height + 2U, FONT_HEIGHT_NORMAL + 2U)); -+ size->height = max(size->height, WD_FRAMERECT_TOP + 4 * resize->height + WD_FRAMERECT_BOTTOM); - break; - } - - case WID_NS_AVAIL_LIST: -- resize->height = max(12, FONT_HEIGHT_NORMAL + 2); -- size->height = max(size->height, WD_FRAMERECT_TOP + 8 * resize->height + WD_FRAMERECT_BOTTOM); -+ resize->height = GetMinSizing(NWST_STEP, max(12, FONT_HEIGHT_NORMAL + 2)); -+ size->height = max(size->height, WD_FRAMERECT_TOP + 4 * resize->height + WD_FRAMERECT_BOTTOM); - break; - - case WID_NS_NEWGRF_INFO_TITLE: { -@@ -711,6 +711,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { - } - } - d.width += padding.width; -+ d.height = GetMinSizing(NWST_BUTTON, d.height); - *size = maxdim(d, *size); - break; - } -@@ -721,6 +722,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { - *size = maxdim(d, GetStringBoundingBox(STR_INTRO_ONLINE_CONTENT)); - size->width += padding.width; - size->height += padding.height; -+ size->height = GetMinSizing(NWST_BUTTON, size->height); - break; - } - } -diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp -index 5067550..afdbb4a 100644 ---- a/src/settings_gui.cpp -+++ b/src/settings_gui.cpp -@@ -1772,7 +1772,7 @@ struct GameSettingsWindow : Window { - { - switch (widget) { - case WID_GS_OPTIONSPANEL: -- resize->height = SETTING_HEIGHT = max(11, FONT_HEIGHT_NORMAL + 1); -+ resize->height = SETTING_HEIGHT = GetMinSizing(NWST_STEP, max(11, FONT_HEIGHT_NORMAL + 1)); - resize->width = 1; - - size->height = 5 * resize->height + SETTINGTREE_TOP_OFFSET + SETTINGTREE_BOTTOM_OFFSET; -diff --git a/src/settings_type.h b/src/settings_type.h -index f194550..aa0e2a4 100644 ---- a/src/settings_type.h -+++ b/src/settings_type.h -@@ -77,6 +77,8 @@ struct GUISettings { - bool lost_vehicle_warn; ///< if a vehicle can't find its destination, show a warning - uint8 order_review_system; ///< perform order reviews on vehicles - bool vehicle_income_warn; ///< if a vehicle isn't generating income, show a warning -+ uint min_button; ///< min size of most button widgets -+ uint min_step; ///< min size of scrollbar/dropdown elements - bool show_finances; ///< show finances at end of year - bool sg_new_nonstop; ///< ttdpatch compatible nonstop handling read from pre v93 savegames - bool new_nonstop; ///< ttdpatch compatible nonstop handling -diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp -index aeac02e..2ec3677 100644 ---- a/src/signs_gui.cpp -+++ b/src/signs_gui.cpp -@@ -267,6 +267,7 @@ struct SignListWindow : Window, SignList { - Dimension spr_dim = GetSpriteSize(SPR_COMPANY_ICON); - this->text_offset = WD_FRAMETEXT_LEFT + spr_dim.width + 2; // 2 pixels space between icon and the sign text. - resize->height = max(FONT_HEIGHT_NORMAL, spr_dim.height); -+ resize->height = GetMinSizing(NWST_STEP, resize->height); - Dimension d = {this->text_offset + WD_FRAMETEXT_RIGHT, WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM}; - *size = maxdim(*size, d); - break; -diff --git a/src/station_gui.cpp b/src/station_gui.cpp -index 9080fa8..28f9ea6 100644 ---- a/src/station_gui.cpp -+++ b/src/station_gui.cpp -@@ -390,7 +390,7 @@ public: - } - - case WID_STL_LIST: -- resize->height = FONT_HEIGHT_NORMAL; -+ resize->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); - size->height = WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM; - break; - } -@@ -414,7 +414,8 @@ public: - - case WID_STL_LIST: { - int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->stations.Length()); -- int y = r.top + WD_FRAMERECT_TOP; -+ uint line_height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); -+ int y = Center(r.top + WD_FRAMERECT_TOP, line_height); - for (int i = this->vscroll->GetPosition(); i < max; ++i) { // do until max number of stations of owner - const Station *st = this->stations[i]; - assert(st->xy != INVALID_TILE); -@@ -427,9 +428,9 @@ public: - SetDParam(1, st->facilities); - int x = DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_STATION_LIST_STATION); - -- StationsWndShowStationRating(st, r.left, r.right, x, FONT_HEIGHT_NORMAL + 2, y); -+ StationsWndShowStationRating(st, r.left, r.right, x, line_height + 2, y); - -- y += FONT_HEIGHT_NORMAL; -+ y += line_height; - } - - if (this->vscroll->GetCount() == 0) { // company has no stations -@@ -459,7 +460,7 @@ public: - break; - - case WID_STL_LIST: { -- uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_STL_LIST, 0, FONT_HEIGHT_NORMAL); -+ uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_STL_LIST, 0, this->resize.step_height); - if (id_v >= this->stations.Length()) return; // click out of list bound - - const Station *st = this->stations[id_v]; -@@ -2121,8 +2122,8 @@ struct SelectStationWindow : Window { - d = maxdim(d, GetStringBoundingBox(T::EXPECTED_FACIL == FACIL_WAYPOINT ? STR_STATION_LIST_WAYPOINT : STR_STATION_LIST_STATION)); - } - -- resize->height = d.height; -- d.height *= 5; -+ resize->height = GetMinSizing(NWST_STEP, d.height); -+ d.height = 5 * resize->height; - d.width += WD_FRAMERECT_RIGHT + WD_FRAMERECT_LEFT; - d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; - *size = d; -diff --git a/src/table/misc_settings.ini b/src/table/misc_settings.ini -index 1a2b5ef..0b02e69 100644 ---- a/src/table/misc_settings.ini -+++ b/src/table/misc_settings.ini -@@ -220,6 +220,25 @@ var = _freetype.mono.aa - def = false - - [SDTG_VAR] -+name = ""min_button_size"" -+type = SLE_UINT -+var = _settings_client.gui.min_button -+def = 0 -+min = 0 -+max = 100 -+cat = SC_EXPERT -+ -+[SDTG_VAR] -+name = ""min_step_size"" -+type = SLE_UINT -+var = _settings_client.gui.min_step -+def = 0 -+min = 0 -+max = 100 -+cat = SC_EXPERT -+ -+ -+[SDTG_VAR] - name = ""sprite_cache_size_px"" - type = SLE_UINT - var = _sprite_cache_size -diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp -index 8834497..32992d9 100644 ---- a/src/toolbar_gui.cpp -+++ b/src/toolbar_gui.cpp -@@ -134,7 +134,7 @@ public: - - uint Height(uint width) const - { -- return max(this->icon_size.height + 2U, (uint)FONT_HEIGHT_NORMAL); -+ return GetMinSizing(NWST_STEP, max(this->icon_size.height + 2U, (uint)FONT_HEIGHT_NORMAL)); - } - - void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const -diff --git a/src/town_gui.cpp b/src/town_gui.cpp -index 3960469..3c541e5 100644 ---- a/src/town_gui.cpp -+++ b/src/town_gui.cpp -@@ -48,12 +48,12 @@ static const NWidgetPart _nested_town_authority_widgets[] = { - NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN), - NWidget(WWT_STICKYBOX, COLOUR_BROWN), - EndContainer(), -- NWidget(WWT_PANEL, COLOUR_BROWN, WID_TA_RATING_INFO), SetMinimalSize(317, 92), SetResize(1, 1), EndContainer(), -+ NWidget(WWT_PANEL, COLOUR_BROWN, WID_TA_RATING_INFO), SetMinimalSize(317, 92), SetResize(1, 1), SetFill(1, 1), EndContainer(), - NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_BROWN, WID_TA_COMMAND_LIST), SetMinimalSize(305, 52), SetResize(1, 0), SetDataTip(0x0, STR_LOCAL_AUTHORITY_ACTIONS_TOOLTIP), SetScrollbar(WID_TA_SCROLLBAR), EndContainer(), - NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_TA_SCROLLBAR), - EndContainer(), -- NWidget(WWT_PANEL, COLOUR_BROWN, WID_TA_ACTION_INFO), SetMinimalSize(317, 52), SetResize(1, 0), EndContainer(), -+ NWidget(WWT_PANEL, COLOUR_BROWN, WID_TA_ACTION_INFO), SetMinimalSize(317, 52), SetResize(1, 1), SetFill(1, 1), EndContainer(), - NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_TA_EXECUTE), SetMinimalSize(317, 12), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_LOCAL_AUTHORITY_DO_IT_BUTTON, STR_LOCAL_AUTHORITY_DO_IT_TOOLTIP), - NWidget(WWT_RESIZEBOX, COLOUR_BROWN), -@@ -66,6 +66,7 @@ private: - Town *town; ///< Town being displayed. - int sel_index; ///< Currently selected town action, \c 0 to \c TACT_COUNT-1, \c -1 means no action selected. - Scrollbar *vscroll; -+ uint actions_step; - uint displayed_actions_on_previous_painting; ///< Actions that were available on the previous call to OnPaint() - - /** -@@ -95,7 +96,8 @@ public: - this->town = Town::Get(window_number); - this->InitNested(window_number); - this->vscroll = this->GetScrollbar(WID_TA_SCROLLBAR); -- this->vscroll->SetCapacity((this->GetWidget(WID_TA_COMMAND_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / FONT_HEIGHT_NORMAL); -+ this->actions_step = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); -+ this->vscroll->SetCapacity((this->GetWidget(WID_TA_COMMAND_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->actions_step); - } - - virtual void OnPaint() -@@ -197,12 +199,12 @@ - case WID_TA_COMMAND_LIST: { - int numact; - uint buttons = GetMaskOfTownActions(&numact, _local_company, this->town); -- int y = Center(r.top, this->resize.step_height); -+ int y = Center(r.top, this->actions_step); - int pos = this->vscroll->GetPosition(); - - if (--pos < 0) { - DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_LOCAL_AUTHORITY_ACTIONS_TITLE); -- y += this->resize.step_height; -+ y += this->actions_step; - } - - for (int i = 0; buttons; i++, buttons >>= 1) { -@@ -212,7 +214,7 @@ public: - if ((buttons & 1) && --pos < 0) { - DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, - STR_LOCAL_AUTHORITY_ACTION_SMALL_ADVERTISING_CAMPAIGN + i, this->sel_index == i ? TC_WHITE : TC_ORANGE); -- y += this->resize.step_height; -+ y += this->actions_step; - } - } - break; -@@ -239,7 +241,8 @@ public: - } - - case WID_TA_COMMAND_LIST: -- size->height = WD_FRAMERECT_TOP + 5 * FONT_HEIGHT_NORMAL + WD_FRAMERECT_BOTTOM; -+ resize->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); -+ size->height = WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM; - size->width = GetStringBoundingBox(STR_LOCAL_AUTHORITY_ACTIONS_TITLE).width; - for (uint i = 0; i < TACT_COUNT; i++ ) { - size->width = max(size->width, GetStringBoundingBox(STR_LOCAL_AUTHORITY_ACTION_SMALL_ADVERTISING_CAMPAIGN + i).width); -@@ -258,7 +261,7 @@ public: - { - switch (widget) { - case WID_TA_COMMAND_LIST: { -- int y = this->GetRowFromWidget(pt.y, WID_TA_COMMAND_LIST, 1, FONT_HEIGHT_NORMAL); -+ int y = this->GetRowFromWidget(pt.y, WID_TA_COMMAND_LIST, 1, this->actions_step); - if (!IsInsideMM(y, 0, 5)) return; - - y = GetNthSetBit(GetMaskOfTownActions(NULL, _local_company, this->town), y + this->vscroll->GetPosition() - 1); -@@ -828,7 +831,7 @@ public: - } - Dimension icon_size = GetSpriteSize(SPR_TOWN_RATING_GOOD); - d.width += icon_size.width + 2; -- d.height = max(d.height, icon_size.height); -+ d.height = GetMinSizing(NWST_STEP, max(d.height, icon_size.height)); - resize->height = d.height; - d.height *= 5; - d.width += padding.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; -diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp -index 8bff19d..e13a131 100644 ---- a/src/vehicle_gui.cpp -+++ b/src/vehicle_gui.cpp -@@ -760,7 +760,7 @@ struct RefitWindow : public Window { - { - switch (widget) { - case WID_VR_MATRIX: -- resize->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM; -+ resize->height = GetMinSizing(NWST_STEP, WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM); - size->height = resize->height * 8; - break; - -@@ -1524,7 +1524,7 @@ void DrawVehicleImage(const Vehicle *v, int left, int right, int y, int height, - uint GetVehicleListHeight(VehicleType type, uint divisor) - { - /* Name + vehicle + profit */ -- uint base = GetVehicleHeight(type) + 2 * FONT_HEIGHT_SMALL; -+ uint base = GetMinSizing(NWST_STEP, GetVehicleHeight(type) + 2 * FONT_HEIGHT_SMALL); - /* Drawing of the 4 small orders + profit*/ - if (type >= VEH_SHIP) base = max(base, 5U * FONT_HEIGHT_SMALL); - -diff --git a/src/widget.cpp b/src/widget.cpp -index 3253cbb..8d14527 100644 ---- a/src/widget.cpp -+++ b/src/widget.cpp -@@ -523,7 +523,7 @@ static inline void DrawButtonDropdown(const Rect &r, Colours colour, bool clicke - { - int text_offset = max(0, ((int)(r.bottom - r.top + 1) - FONT_HEIGHT_NORMAL) / 2); // Offset for rendering the text vertically centered - -- int dd_width = NWidgetLeaf::dropdown_dimension.width; -+ int dd_width = GetMinSizing(NWST_STEP, NWidgetLeaf::dropdown_dimension.width); - - if (_current_text_dir == TD_LTR) { - DrawFrameRect(r.left, r.top, r.right - dd_width, r.bottom, colour, clicked_button ? FR_LOWERED : FR_NONE); -@@ -746,6 +746,7 @@ NWidgetBase *NWidgetBase::GetWidgetOfType(WidgetType tp) - */ - NWidgetResizeBase::NWidgetResizeBase(WidgetType tp, uint fill_x, uint fill_y) : NWidgetBase(tp) - { -+ this->sizing_type = NWST_NONE; - this->fill_x = fill_x; - this->fill_y = fill_y; - } -@@ -757,8 +758,23 @@ NWidgetResizeBase::NWidgetResizeBase(WidgetType tp, uint fill_x, uint fill_y) : - */ - void NWidgetResizeBase::SetMinimalSize(uint min_x, uint min_y) - { -- this->min_x = min_x; -- this->min_y = min_y; -+ uint min_size = 0; -+ switch (this->sizing_type) { -+ case NWST_NONE: -+ case NWST_OVERRIDE: -+ min_size = 0; -+ break; -+ case NWST_BUTTON: -+ min_size = _settings_client.gui.min_button; -+ break; -+ case NWST_STEP: -+ min_size = _settings_client.gui.min_step; -+ break; -+ default: NOT_REACHED(); -+ } -+ -+ this->min_x = max(min_x, min_size); -+ this->min_y = max(min_y, min_size); - } - - /** -@@ -810,6 +826,7 @@ void NWidgetResizeBase::AssignSizePosition(SizingType sizing, uint x, uint y, ui - */ - NWidgetCore::NWidgetCore(WidgetType tp, Colours colour, uint fill_x, uint fill_y, uint32 widget_data, StringID tool_tip) : NWidgetResizeBase(tp, fill_x, fill_y) - { -+ this->sizing_type = NWST_NONE; - this->colour = colour; - this->index = -1; - this->widget_data = widget_data; -@@ -1930,6 +1947,7 @@ void Scrollbar::SetCapacityFromWidget(Window *w, int widget, int padding) - NWidgetScrollbar::NWidgetScrollbar(WidgetType tp, Colours colour, int index) : NWidgetCore(tp, colour, 1, 1, 0x0, STR_NULL), Scrollbar(tp != NWID_HSCROLLBAR) - { - assert(tp == NWID_HSCROLLBAR || tp == NWID_VSCROLLBAR); -+ this->sizing_type = NWST_STEP; - this->SetIndex(index); - - switch (this->type) { -@@ -2001,7 +2019,9 @@ void NWidgetScrollbar::Draw(const Window *w) - if (vertical_dimension.width == 0) { - vertical_dimension = maxdim(GetSpriteSize(SPR_ARROW_UP), GetSpriteSize(SPR_ARROW_DOWN)); - vertical_dimension.width += extra.width; -+ vertical_dimension.width = GetMinSizing(NWST_STEP, vertical_dimension.width); - vertical_dimension.height += extra.height; -+ vertical_dimension.height = GetMinSizing(NWST_STEP, vertical_dimension.height); - } - return vertical_dimension; - } -@@ -2012,7 +2032,9 @@ void NWidgetScrollbar::Draw(const Window *w) - if (horizontal_dimension.width == 0) { - horizontal_dimension = maxdim(GetSpriteSize(SPR_ARROW_LEFT), GetSpriteSize(SPR_ARROW_RIGHT)); - horizontal_dimension.width += extra.width; -+ horizontal_dimension.width = GetMinSizing(NWST_STEP, horizontal_dimension.width); - horizontal_dimension.height += extra.height; -+ horizontal_dimension.height = GetMinSizing(NWST_STEP, horizontal_dimension.height); - } - return horizontal_dimension; - } -@@ -2049,8 +2071,40 @@ Dimension NWidgetLeaf::dropdown_dimension = {0, 0}; - */ - NWidgetLeaf::NWidgetLeaf(WidgetType tp, Colours colour, int index, uint16 data, StringID tip) : NWidgetCore(tp, colour, 1, 1, data, tip) - { -+ assert(this->sizing_type < NWST_END); - assert(index >= 0 || tp == WWT_LABEL || tp == WWT_TEXT || tp == WWT_CAPTION || tp == WWT_RESIZEBOX || tp == WWT_SHADEBOX || tp == WWT_DEFSIZEBOX || tp == WWT_DEBUGBOX || tp == WWT_STICKYBOX || tp == WWT_CLOSEBOX); - if (index >= 0) this->SetIndex(index); -+ -+ if (this->sizing_type == NWST_NONE) { -+ switch (tp) { -+ case WWT_PUSHBTN: -+ case WWT_IMGBTN: -+ case WWT_PUSHIMGBTN: -+ case WWT_IMGBTN_2: -+ case WWT_TEXTBTN: -+ case WWT_PUSHTXTBTN: -+ case WWT_TEXTBTN_2: -+ case WWT_PUSHARROWBTN: -+ case WWT_EDITBOX: -+ case WWT_CAPTION: -+ case WWT_STICKYBOX: -+ case WWT_SHADEBOX: -+ case WWT_DEBUGBOX: -+ case WWT_DEFSIZEBOX: -+ case WWT_RESIZEBOX: -+ case WWT_CLOSEBOX: -+ this->sizing_type = NWST_BUTTON; -+ break; -+ case NWID_PUSHBUTTON_DROPDOWN: -+ case NWID_BUTTON_DROPDOWN: -+ case WWT_DROPDOWN: -+ this->sizing_type = NWST_STEP; -+ break; -+ default: -+ this->sizing_type = NWST_OVERRIDE; -+ } -+ } -+ - this->SetMinimalSize(0, 0); - this->SetResize(0, 0); - -@@ -2462,11 +2516,12 @@ void NWidgetLeaf::Draw(const Window *w) - */ - bool NWidgetLeaf::ButtonHit(const Point &pt) - { -+ uint button_size = GetMinSizing(NWST_STEP, 12); - if (_current_text_dir == TD_LTR) { -- int button_width = this->pos_x + this->current_x - 12; -+ int button_width = this->pos_x + this->current_x - button_size; - return pt.x < button_width; - } else { -- int button_left = this->pos_x + 12; -+ int button_left = this->pos_x + button_size; - return pt.x >= button_left; - } - } -@@ -2559,6 +2614,16 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, - break; - } - -+ case WPT_SIZINGTYPE: { -+ NWidgetResizeBase *nwrb = dynamic_cast(*dest); -+ if (nwrb != NULL) { -+ assert(parts->u.sizing_type < NWST_END); -+ nwrb->sizing_type = parts->u.sizing_type; -+ nwrb->SetMinimalSize(0, 0); -+ } -+ break; -+ } -+ - case WPT_MINSIZE: { - NWidgetResizeBase *nwrb = dynamic_cast(*dest); - if (nwrb != NULL) { -@@ -2815,6 +2880,7 @@ NWidgetBase *MakeCompanyButtonRows(int *biggest_index, int widget_first, int wid - } - - NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum); -+ panel->sizing_type = NWST_STEP; - panel->SetMinimalSize(sprite_size.width, sprite_size.height); - panel->SetFill(1, 1); - panel->SetResize(1, 0); -@@ -2835,3 +2901,28 @@ NWidgetBase *MakeCompanyButtonRows(int *biggest_index, int widget_first, int wid - if (hor != NULL) vert->Add(hor); - return vert; - } -+ -+/** -+ * Return the minimal automatic size for a widget. -+ * @param type The automatic sizing type to use. -+ * @param min_1 Minimal passed value. -+ * @return At least the passed value, or the minimal size for the associated sizing type. -+ */ -+uint GetMinSizing(NWidSizingType type, uint min_1) -+{ -+ uint min_sizing; -+ switch (type) { -+ case NWST_NONE: -+ case NWST_OVERRIDE: -+ return min_1; -+ case NWST_BUTTON: -+ min_sizing = _settings_client.gui.min_button; -+ break; -+ case NWST_STEP: -+ min_sizing = _settings_client.gui.min_step; -+ break; -+ default: NOT_REACHED(); -+ } -+ -+ return max(min_sizing, min_1); -+} -diff --git a/src/widget_type.h b/src/widget_type.h -index 6d8b32b..1003096 100644 ---- a/src/widget_type.h -+++ b/src/widget_type.h -@@ -40,6 +40,17 @@ enum ArrowWidgetValues { - AWV_RIGHT, ///< Force the arrow to the right - }; - -+/** Values for different minimal sizing of widgets. */ -+enum NWidSizingType { -+ NWST_NONE, ///< No sizing type is yet defined. -+ ///< Most buttons and scrollbars are initialized with this value. -+ ///< Later, they are automatically set to NWST_BUTTON or NWST_STEP. -+ NWST_BUTTON, ///< Size will be set at least _settings_client.gui.min_button. -+ NWST_STEP, ///< Size will be set at least _settings_client.gui.min_step (scrollbars and dropdowns). -+ NWST_OVERRIDE, ///< Avoid widgets to use automatic minimal sizing. -+ NWST_END -+}; -+ - /** - * Window widget types, nested widget types, and nested widget part types. - */ -@@ -85,6 +96,7 @@ enum WidgetType { - - /* Nested widget part types. */ - WPT_RESIZE, ///< Widget part for specifying resizing. -+ WPT_SIZINGTYPE, ///< Widget part for specifying sizing mode. - WPT_MINSIZE, ///< Widget part for specifying minimal size. - WPT_MINTEXTLINES, ///< Widget part for specifying minimal number of lines of text. - WPT_FILL, ///< Widget part for specifying fill. -@@ -160,11 +172,12 @@ public: - virtual void Draw(const Window *w) = 0; - virtual void SetDirty(const Window *w) const; - -- WidgetType type; ///< Type of the widget / nested widget. -- uint fill_x; ///< Horizontal fill stepsize (from initial size, \c 0 means not resizable). -- uint fill_y; ///< Vertical fill stepsize (from initial size, \c 0 means not resizable). -- uint resize_x; ///< Horizontal resize step (\c 0 means not resizable). -- uint resize_y; ///< Vertical resize step (\c 0 means not resizable). -+ WidgetType type; ///< Type of the widget / nested widget. -+ NWidSizingType sizing_type; ///< Type for deciding minimal sizes of the widget. -+ uint fill_x; ///< Horizontal fill stepsize (from initial size, \c 0 means not resizable). -+ uint fill_y; ///< Vertical fill stepsize (from initial size, \c 0 means not resizable). -+ uint resize_x; ///< Horizontal resize step (\c 0 means not resizable). -+ uint resize_y; ///< Vertical resize step (\c 0 means not resizable). - /* Size of the widget in the smallest window possible. - * Computed by #SetupSmallestSize() followed by #AssignSizePosition(). - */ -@@ -918,6 +931,7 @@ struct NWidgetPart { - NWidgetPartTextLines text_lines; ///< Part with text line data. - NWidgetFunctionType *func_ptr; ///< Part with a function call. - NWidContainerFlags cont_flags; ///< Part with container flags. -+ NWidSizingType sizing_type; ///< Part with sizing type. - } u; - }; - -@@ -939,6 +953,23 @@ static inline NWidgetPart SetResize(int16 dx, int16 dy) - } - - /** -+ * Widget part function for setting the automatic minimal size. -+ * @param type How to decide the minimal size of the widget. -+ * @ingroup NestedWidgetParts -+ */ -+static inline NWidgetPart SetSizingType(NWidSizingType type) -+{ -+ NWidgetPart part; -+ -+ part.type = WPT_SIZINGTYPE; -+ part.u.sizing_type = type; -+ -+ return part; -+} -+ -+uint GetMinSizing(NWidSizingType type, uint min_1 = 0); -+ -+/** - * Widget part function for setting the minimal size. - * @param x Horizontal minimal size. - * @param y Vertical minimal size. -diff --git a/src/widgets/dropdown_type.h b/src/widgets/dropdown_type.h -index b65d455..4c33011 100644 ---- a/src/widgets/dropdown_type.h -+++ b/src/widgets/dropdown_type.h -@@ -13,6 +13,7 @@ - #define WIDGETS_DROPDOWN_TYPE_H - - #include "../window_type.h" -+#include "../widget_type.h" - #include "../gfx_func.h" - #include "../core/smallvec_type.hpp" - #include "table/strings.h" -@@ -30,7 +31,7 @@ public: - virtual ~DropDownListItem() {} - - virtual bool Selectable() const { return false; } -- virtual uint Height(uint width) const { return FONT_HEIGHT_NORMAL; } -+ virtual uint Height(uint width) const { return GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); } - virtual uint Width() const { return 0; } - virtual void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const; - }; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0187-Add-min-sizing-on-smallmap-window.patch b/project/jni/application/openttd/0187-Add-min-sizing-on-smallmap-window.patch deleted file mode 100644 index 66844a867..000000000 --- a/project/jni/application/openttd/0187-Add-min-sizing-on-smallmap-window.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 747ad8e3e5bce77bc409fcc141ed37ab25b55104 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sun, 21 Jul 2013 22:03:46 +0200 -Subject: [PATCH 187/249] Add min sizing on smallmap window. - ---- - src/smallmap_gui.cpp | 20 +++++++++++--------- - src/smallmap_gui.h | 3 ++- - 2 files changed, 13 insertions(+), 10 deletions(-) - -diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp -index 99097c5..06087a0 100644 ---- a/src/smallmap_gui.cpp -+++ b/src/smallmap_gui.cpp -@@ -1045,7 +1045,10 @@ void SmallMapWindow::SetupWidgetData() - this->GetWidget(WID_SM_SELECT_BUTTONS)->SetDisplayedPlane(plane); - } - --SmallMapWindow::SmallMapWindow(WindowDesc *desc, int window_number) : Window(desc), refresh(FORCE_REFRESH_PERIOD) -+SmallMapWindow::SmallMapWindow(WindowDesc *desc, int window_number) : -+ Window(desc), -+ row_height(GetMinSizing(NWST_STEP, FONT_HEIGHT_SMALL)), -+ refresh(FORCE_REFRESH_PERIOD) - { - _smallmap_industry_highlight = INVALID_INDUSTRYTYPE; - this->overlay = new LinkGraphOverlay(this, WID_SM_MAP); -@@ -1155,9 +1158,8 @@ SmallMapWindow::SmallMapWindow(WindowDesc *desc, int window_number) : Window(des - bool rtl = _current_text_dir == TD_RTL; - uint y_org = r.top + WD_FRAMERECT_TOP; - uint x = rtl ? r.right - this->column_width - WD_FRAMERECT_RIGHT : r.left + WD_FRAMERECT_LEFT; -- uint y = y_org; -+ uint y = Center(y_org, this->row_height, FONT_HEIGHT_SMALL); - uint i = 0; // Row counter for industry legend. -- uint row_height = FONT_HEIGHT_SMALL; - - uint text_left = rtl ? 0 : LEGEND_BLOB_WIDTH + WD_FRAMERECT_LEFT; - uint text_right = this->column_width - 1 - (rtl ? LEGEND_BLOB_WIDTH + WD_FRAMERECT_RIGHT : 0); -@@ -1184,7 +1186,7 @@ SmallMapWindow::SmallMapWindow(WindowDesc *desc, int window_number) : Window(des - /* Column break needed, continue at top, COLUMN_WIDTH pixels - * (one "row") to the right. */ - x += rtl ? -(int)this->column_width : this->column_width; -- y = y_org; -+ y = Center(y_org, this->row_height, FONT_HEIGHT_SMALL); - i = 1; - } - -@@ -1212,7 +1214,7 @@ SmallMapWindow::SmallMapWindow(WindowDesc *desc, int window_number) : Window(des - DrawString(x + text_left, x + text_right, y, string, TC_GREY); - } else { - DrawString(x + text_left, x + text_right, y, string, TC_BLACK); -- GfxFillRect(x + blob_left, y + 1, x + blob_right, y + row_height - 1, PC_BLACK); // Outer border of the legend colour -+ GfxFillRect(x + blob_left, y + 1, x + blob_right, y + FONT_HEIGHT_SMALL - 1, PC_BLACK); // Outer border of the legend colour - } - break; - } -@@ -1220,13 +1222,13 @@ SmallMapWindow::SmallMapWindow(WindowDesc *desc, int window_number) : Window(des - default: - if (this->map_type == SMT_CONTOUR) SetDParam(0, tbl->height * TILE_HEIGHT_STEP); - /* Anything that is not an industry or a company is using normal process */ -- GfxFillRect(x + blob_left, y + 1, x + blob_right, y + row_height - 1, PC_BLACK); -+ GfxFillRect(x + blob_left, y + 1, x + blob_right, y + FONT_HEIGHT_SMALL - 1, PC_BLACK); - DrawString(x + text_left, x + text_right, y, tbl->legend); - break; - } -- GfxFillRect(x + blob_left + 1, y + 2, x + blob_right - 1, y + row_height - 2, legend_colour); // Legend colour -+ GfxFillRect(x + blob_left + 1, y + 2, x + blob_right - 1, y + FONT_HEIGHT_SMALL - 2, legend_colour); // Legend colour - -- y += row_height; -+ y += this->row_height; - } - } - } -@@ -1319,7 +1321,7 @@ void SmallMapWindow::SetOverlayCargoMask() - int SmallMapWindow::GetPositionOnLegend(Point pt) - { - const NWidgetBase *wi = this->GetWidget(WID_SM_LEGEND); -- uint line = (pt.y - wi->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_SMALL; -+ uint line = (pt.y - wi->pos_y - WD_FRAMERECT_TOP) / this->row_height; - uint columns = this->GetNumberColumnsLegend(wi->current_x); - uint number_of_rows = this->GetNumberRowsLegend(columns); - if (line >= number_of_rows) return -1; -diff --git a/src/smallmap_gui.h b/src/smallmap_gui.h -index 4b180f5..f62c516 100644 ---- a/src/smallmap_gui.h -+++ b/src/smallmap_gui.h -@@ -71,6 +71,7 @@ protected: - uint min_number_of_columns; ///< Minimal number of columns in legends. - uint min_number_of_fixed_rows; ///< Minimal number of rows in the legends for the fixed layouts only (all except #SMT_INDUSTRY). - uint column_width; ///< Width of a column in the #WID_SM_LEGEND widget. -+ const uint row_height; ///< Heigth of each row in the #WID_SM_LEGEND widget. - - int32 scroll_x; ///< Horizontal world coordinate of the base tile left of the top-left corner of the smallmap display. - int32 scroll_y; ///< Vertical world coordinate of the base tile left of the top-left corner of the smallmap display. -@@ -132,7 +133,7 @@ protected: - inline uint GetLegendHeight(uint num_columns) const - { - return WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + -- this->GetNumberRowsLegend(num_columns) * FONT_HEIGHT_SMALL; -+ this->GetNumberRowsLegend(num_columns) * this->row_height; - } - - uint GetNumberRowsLegend(uint columns) const; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0188-Add-min-sizings-to-some-construction-buttons.patch b/project/jni/application/openttd/0188-Add-min-sizings-to-some-construction-buttons.patch deleted file mode 100644 index 702fc7c03..000000000 --- a/project/jni/application/openttd/0188-Add-min-sizings-to-some-construction-buttons.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 6a611be077b4f635285f08c1be4d20f4ba47ce13 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Fri, 2 Aug 2013 18:33:46 +0000 -Subject: [PATCH 188/249] Add min sizings to some construction buttons. - ---- - src/dock_gui.cpp | 4 ++-- - src/rail_gui.cpp | 16 ++++++++-------- - src/road_gui.cpp | 20 ++++++++++---------- - 3 files changed, 20 insertions(+), 20 deletions(-) - -diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp -index 03c661d..89e9250 100644 ---- a/src/dock_gui.cpp -+++ b/src/dock_gui.cpp -@@ -531,10 +531,10 @@ static const NWidgetPart _nested_build_docks_depot_widgets[] = { - NWidget(NWID_SPACER), SetMinimalSize(0, 3), - NWidget(NWID_HORIZONTAL_LTR), - NWidget(NWID_SPACER), SetMinimalSize(3, 0), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BDD_X), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BDD_X), SetSizingType(NWST_BUTTON), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(2, 0), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BDD_Y), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BDD_Y), SetSizingType(NWST_BUTTON), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(3, 0), - EndContainer(), -diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp -index cbd4400..08018eb 100644 ---- a/src/rail_gui.cpp -+++ b/src/rail_gui.cpp -@@ -1364,9 +1364,9 @@ static const NWidgetPart _nested_station_builder_widgets[] = { - NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(144, 11), SetDataTip(STR_STATION_BUILD_ORIENTATION, STR_NULL), SetPadding(1, 2, 0, 2), - NWidget(NWID_HORIZONTAL), - NWidget(NWID_SPACER), SetMinimalSize(7, 0), SetFill(1, 0), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAS_PLATFORM_DIR_X), SetMinimalSize(66, 60), SetFill(0, 0), SetDataTip(0x0, STR_STATION_BUILD_RAILROAD_ORIENTATION_TOOLTIP), EndContainer(), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAS_PLATFORM_DIR_X), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 60), SetFill(0, 0), SetDataTip(0x0, STR_STATION_BUILD_RAILROAD_ORIENTATION_TOOLTIP), EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(2, 0), SetFill(1, 0), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAS_PLATFORM_DIR_Y), SetMinimalSize(66, 60), SetFill(0, 0), SetDataTip(0x0, STR_STATION_BUILD_RAILROAD_ORIENTATION_TOOLTIP), EndContainer(), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAS_PLATFORM_DIR_Y), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 60), SetFill(0, 0), SetDataTip(0x0, STR_STATION_BUILD_RAILROAD_ORIENTATION_TOOLTIP), EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(7, 0), SetFill(1, 0), - EndContainer(), - NWidget(WWT_LABEL, COLOUR_DARK_GREEN, WID_BRAS_SHOW_NEWST_TYPE), SetMinimalSize(144, 11), SetDataTip(STR_ORANGE_STRING, STR_NULL), SetPadding(1, 2, 4, 2), -@@ -1638,8 +1638,8 @@ static const NWidgetPart _nested_signal_builder_widgets[] = { - NWidget(WWT_LABEL, COLOUR_DARK_GREEN, WID_BS_DRAG_SIGNALS_DENSITY_LABEL), SetDataTip(STR_ORANGE_INT, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_TOOLTIP), SetFill(1, 1), - NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2), - NWidget(NWID_SPACER), SetFill(1, 0), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_BS_DRAG_SIGNALS_DENSITY_DECREASE), SetMinimalSize(9, 12), SetDataTip(AWV_DECREASE, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_DECREASE_TOOLTIP), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_BS_DRAG_SIGNALS_DENSITY_INCREASE), SetMinimalSize(9, 12), SetDataTip(AWV_INCREASE, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_INCREASE_TOOLTIP), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_BS_DRAG_SIGNALS_DENSITY_DECREASE), SetSizingType(NWST_STEP), SetMinimalSize(9, 12), SetDataTip(AWV_DECREASE, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_DECREASE_TOOLTIP), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_BS_DRAG_SIGNALS_DENSITY_INCREASE), SetSizingType(NWST_STEP), SetMinimalSize(9, 12), SetDataTip(AWV_INCREASE, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_INCREASE_TOOLTIP), - NWidget(NWID_SPACER), SetFill(1, 0), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 2), SetFill(1, 0), -@@ -1706,18 +1706,18 @@ static const NWidgetPart _nested_build_depot_widgets[] = { - NWidget(NWID_HORIZONTAL_LTR), - NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), - NWidget(NWID_VERTICAL), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_NW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_NW), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 2), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_SW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_SW), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), - EndContainer(), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(2, 0), - NWidget(NWID_VERTICAL), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_NE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_NE), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 2), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_SE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BRAD_DEPOT_SE), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), - EndContainer(), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), -diff --git a/src/road_gui.cpp b/src/road_gui.cpp -index e8d9409..58ac2da 100644 ---- a/src/road_gui.cpp -+++ b/src/road_gui.cpp -@@ -897,18 +897,18 @@ static const NWidgetPart _nested_build_road_depot_widgets[] = { - NWidget(NWID_HORIZONTAL_LTR), - NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), - NWidget(NWID_VERTICAL), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_NW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_NW), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 2), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_SW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_SW), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), - EndContainer(), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(2, 0), - NWidget(NWID_VERTICAL), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_NE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_NE), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 2), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_SE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_SE), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), - EndContainer(), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), -@@ -1043,17 +1043,17 @@ static const NWidgetPart _nested_rv_station_picker_widgets[] = { - NWidget(NWID_SPACER), SetMinimalSize(0, 3), - NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0), - NWidget(NWID_SPACER), SetFill(1, 0), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_NW), SetMinimalSize(66, 50), EndContainer(), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_NE), SetMinimalSize(66, 50), EndContainer(), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_X), SetMinimalSize(66, 50), EndContainer(), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_NW), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), EndContainer(), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_NE), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), EndContainer(), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_X), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), EndContainer(), - NWidget(NWID_SPACER), SetFill(1, 0), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 2), - NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0), - NWidget(NWID_SPACER), SetFill(1, 0), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_SW), SetMinimalSize(66, 50), EndContainer(), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_SE), SetMinimalSize(66, 50), EndContainer(), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_Y), SetMinimalSize(66, 50), EndContainer(), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_SW), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), EndContainer(), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_SE), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), EndContainer(), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_Y), SetSizingType(NWST_BUTTON), SetMinimalSize(66, 50), EndContainer(), - NWidget(NWID_SPACER), SetFill(1, 0), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 1), --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0189-More-sizing-and-centering.patch b/project/jni/application/openttd/0189-More-sizing-and-centering.patch deleted file mode 100644 index 0480ef179..000000000 --- a/project/jni/application/openttd/0189-More-sizing-and-centering.patch +++ /dev/null @@ -1,524 +0,0 @@ -From 02339f2b7217551c1e7a3a6fe1688192016df10a Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 27 Jul 2013 22:03:06 +0000 -Subject: [PATCH 189/249] More sizing and centering. - ---- - src/ai/ai_gui.cpp | 27 ++++++++++++++------------- - src/cheat_gui.cpp | 16 +++++++++++----- - src/industry_gui.cpp | 39 +++++++++++++++++++++------------------ - src/intro_gui.cpp | 2 +- - src/newgrf_debug_gui.cpp | 6 +++--- - src/newgrf_gui.cpp | 1 + - src/news_gui.cpp | 12 ++++++------ - src/osk_gui.cpp | 5 +++-- - src/settings_gui.cpp | 10 ++++++---- - src/signs_gui.cpp | 2 +- - src/station_gui.cpp | 2 +- - src/town_gui.cpp | 2 +- - src/transparency_gui.cpp | 2 +- - 13 files changed, 70 insertions(+), 56 deletions(-) - -diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp -index 62fed7d..1fec5ff 100644 ---- a/src/ai/ai_gui.cpp -+++ b/src/ai/ai_gui.cpp -@@ -120,16 +120,16 @@ struct AIListWindow : public Window { - switch (widget) { - case WID_AIL_LIST: { - /* Draw a list of all available AIs. */ -- int y = this->GetWidget(WID_AIL_LIST)->pos_y; -+ int y = Center(r.top, this->line_height); - /* First AI in the list is hardcoded to random */ - if (this->vscroll->IsVisible(0)) { -- DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_LEFT, y + WD_MATRIX_TOP, this->slot == OWNER_DEITY ? STR_AI_CONFIG_NONE : STR_AI_CONFIG_RANDOM_AI, this->selected == -1 ? TC_WHITE : TC_ORANGE); -+ DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_LEFT, y, this->slot == OWNER_DEITY ? STR_AI_CONFIG_NONE : STR_AI_CONFIG_RANDOM_AI, this->selected == -1 ? TC_WHITE : TC_ORANGE); - y += this->line_height; - } - ScriptInfoList::const_iterator it = this->info_list->begin(); - for (int i = 1; it != this->info_list->end(); i++, it++) { - if (this->vscroll->IsVisible(i)) { -- DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y + WD_MATRIX_TOP, (*it).second->GetName(), (this->selected == i - 1) ? TC_WHITE : TC_ORANGE); -+ DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y, (*it).second->GetName(), (this->selected == i - 1) ? TC_WHITE : TC_ORANGE); - y += this->line_height; - } - } -@@ -367,7 +367,6 @@ struct AISettingsWindow : public Window { - uint text_left = r.left + (rtl ? WD_FRAMERECT_LEFT : SETTING_BUTTON_WIDTH + 8); - uint text_right = r.right - (rtl ? SETTING_BUTTON_WIDTH + 8 : WD_FRAMERECT_RIGHT); - -- - int y = r.top; - int button_y_offset = (this->line_height - SETTING_BUTTON_HEIGHT) / 2; - for (; this->vscroll->IsVisible(i) && it != visible_settings.end(); i++, it++) { -@@ -411,7 +410,7 @@ struct AISettingsWindow : public Window { - } - } - -- DrawString(text_left, text_right, y + WD_MATRIX_TOP, str, colour); -+ DrawString(text_left, text_right, Center(y, this->line_height), str, colour); - y += this->line_height; - } - } -@@ -679,7 +678,7 @@ static const NWidgetPart _nested_ai_config_widgets[] = { - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 9), - NWidget(WWT_FRAME, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_GAMESCRIPT, STR_NULL), SetPadding(0, 5, 4, 5), -- NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_GAMELIST), SetMinimalSize(288, 14), SetFill(1, 0), SetMatrixDataTip(1, 1, STR_AI_CONFIG_GAMELIST_TOOLTIP), -+ NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_GAMELIST), SetSizingType(NWST_STEP), SetMinimalSize(288, 14), SetFill(1, 0), SetMatrixDataTip(1, 1, STR_AI_CONFIG_GAMELIST_TOOLTIP), - EndContainer(), - NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CHANGE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CHANGE, STR_AI_CONFIG_CHANGE_TOOLTIP), -@@ -756,8 +755,8 @@ struct AIConfigWindow : public Window { - { - switch (widget) { - case WID_AIC_GAMELIST: -- this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; -- size->height = 1 * this->line_height; -+ this->line_height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); -+ size->height = this->line_height; - break; - - case WID_AIC_LIST: -@@ -799,14 +798,14 @@ struct AIConfigWindow : public Window { - text = STR_JUST_RAW_STRING; - } - -- DrawString(r.left + 10, r.right - 10, r.top + WD_MATRIX_TOP, text, -+ DrawString(r.left + 10, r.right - 10, Center(r.top, this->line_height), text, - (this->selected_slot == OWNER_DEITY) ? TC_WHITE : (IsEditable(OWNER_DEITY) ? TC_ORANGE : TC_SILVER)); - - break; - } - - case WID_AIC_LIST: { -- int y = r.top; -+ int y = Center(r.top, this->line_height); - for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < MAX_COMPANIES; i++) { - StringID text; - -@@ -818,7 +817,7 @@ struct AIConfigWindow : public Window { - } else { - text = STR_AI_CONFIG_RANDOM_AI; - } -- DrawString(r.left + 10, r.right - 10, y + WD_MATRIX_TOP, text, -+ DrawString(r.left + 10, r.right - 10, y, text, - (this->selected_slot == i) ? TC_WHITE : (IsEditable((CompanyID)i) ? TC_ORANGE : TC_SILVER)); - y += this->line_height; - } -@@ -1088,6 +1087,8 @@ struct AIDebugWindow : public Window { - - bool dirty = false; - -+ Dimension d = GetSpriteSize(SPR_COMPANY_ICON); -+ uint offset_y = Center(0, GetMinSizing(NWST_STEP, d.height + WD_MATRIX_TOP + WD_MATRIX_BOTTOM + 1), d.height); - /* Paint the company icons */ - for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) { - NWidgetCore *button = this->GetWidget(i + WID_AID_COMPANY_BUTTON_START); -@@ -1108,7 +1109,7 @@ struct AIDebugWindow : public Window { - if (!valid) continue; - - byte offset = (i == ai_debug_company) ? 1 : 0; -- DrawCompanyIcon(i, button->pos_x + button->current_x / 2 - 7 + offset, this->GetWidget(WID_AID_COMPANY_BUTTON_START + i)->pos_y + 2 + offset); -+ DrawCompanyIcon(i, Center(button->pos_x + offset, button->current_x, d.width), button->pos_y + offset + offset_y); - } - - /* Set button colour for Game Script. */ -@@ -1187,7 +1188,7 @@ struct AIDebugWindow : public Window { - ScriptLog::LogData *log = this->GetLogPointer(); - if (log == NULL) return; - -- int y = this->top_offset; -+ int y = Center(this->top_offset, this->resize.step_height); - for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < log->used; i++) { - int pos = (i + log->pos + 1 - log->used + log->count) % log->count; - if (log->lines[pos] == NULL) break; -diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp -index 9eb405d..01ea1a4 100644 ---- a/src/cheat_gui.cpp -+++ b/src/cheat_gui.cpp -@@ -172,9 +172,11 @@ static const NWidgetPart _nested_cheat_widgets[] = { - struct CheatWindow : Window { - int clicked; - int header_height; -+ int line_height; - - CheatWindow(WindowDesc *desc) : Window(desc) - { -+ this->line_height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL); - this->InitNested(); - } - -@@ -190,11 +192,12 @@ struct CheatWindow : Window { - uint button_left = rtl ? r.right - 20 - SETTING_BUTTON_WIDTH : r.left + 20; - uint text_left = r.left + (rtl ? WD_FRAMERECT_LEFT : 30 + SETTING_BUTTON_WIDTH); - uint text_right = r.right - (rtl ? 30 + SETTING_BUTTON_WIDTH : WD_FRAMERECT_RIGHT); -+ uint box_height = GetSpriteSize(SPR_BOX_EMPTY).height; - - for (int i = 0; i != lengthof(_cheats_ui); i++) { - const CheatEntry *ce = &_cheats_ui[i]; - -- DrawSprite((*ce->been_used) ? SPR_BOX_CHECKED : SPR_BOX_EMPTY, PAL_NONE, box_left, y + 2); -+ DrawSprite((*ce->been_used) ? SPR_BOX_CHECKED : SPR_BOX_EMPTY, PAL_NONE, box_left, Center(y, SETTING_BUTTON_HEIGHT, box_height)); - - switch (ce->type) { - case SLE_BOOL: { -@@ -233,7 +236,7 @@ struct CheatWindow : Window { - - DrawString(text_left, text_right, y + 1, ce->str); - -- y += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL; -+ y += this->line_height; - } - } - -@@ -275,15 +278,18 @@ struct CheatWindow : Window { - } - } - -- size->width = width + 50 /* stuff on the left */ + 10 /* extra spacing on right */; -+ size->width = width + 30 + SETTING_BUTTON_WIDTH /* stuff on the left */ + 10 /* extra spacing on right */; - this->header_height = GetStringHeight(STR_CHEATS_WARNING, size->width - WD_FRAMERECT_LEFT - WD_FRAMERECT_RIGHT) + WD_PAR_VSEP_WIDE; -- size->height = this->header_height + WD_FRAMERECT_TOP + WD_PAR_VSEP_NORMAL + WD_FRAMERECT_BOTTOM + (FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL) * lengthof(_cheats_ui); -+ size->height = this->header_height + WD_FRAMERECT_TOP + WD_PAR_VSEP_NORMAL + WD_FRAMERECT_BOTTOM + this->line_height * lengthof(_cheats_ui); - } - - virtual void OnClick(Point pt, int widget, int click_count) - { - const NWidgetBase *wid = this->GetWidget(WID_C_PANEL); -- uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / (FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL); -+ -+ if ((pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) % this->line_height > SETTING_BUTTON_HEIGHT) return; -+ -+ uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / this->line_height; - uint x = pt.x - wid->pos_x; - bool rtl = _current_text_dir == TD_RTL; - if (rtl) x = wid->current_x - x; -diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp -index 360ce8a..5c88ca9 100644 ---- a/src/industry_gui.cpp -+++ b/src/industry_gui.cpp -@@ -208,9 +208,6 @@ class BuildIndustryWindow : public Window { - bool enabled[NUM_INDUSTRYTYPES + 1]; ///< availability state, coming from CBID_INDUSTRY_PROBABILITY (if ever) - Scrollbar *vscroll; - -- /** The offset for the text in the matrix. */ -- static const int MATRIX_TEXT_OFFSET = 17; -- - void SetupArrays() - { - this->count = 0; -@@ -299,7 +296,7 @@ public: - d = maxdim(d, GetStringBoundingBox(GetIndustrySpec(this->index[i])->name)); - } - resize->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); -- d.width += MATRIX_TEXT_OFFSET + padding.width; -+ d.width += FONT_HEIGHT_NORMAL * 5 / 4 + padding.width; - d.height = 5 * resize->height; - *size = maxdim(*size, d); - break; -@@ -383,20 +380,22 @@ public: - switch (widget) { - case WID_DPI_MATRIX_WIDGET: { - uint text_left, text_right, icon_left, icon_right; -+ uint square_size = FONT_HEIGHT_NORMAL - 2; -+ uint text_offset = FONT_HEIGHT_NORMAL * 5 / 4; - if (_current_text_dir == TD_RTL) { - icon_right = r.right - WD_MATRIX_RIGHT; -- icon_left = icon_right - 10; -- text_right = icon_right - BuildIndustryWindow::MATRIX_TEXT_OFFSET; -+ icon_left = icon_right - square_size; -+ text_right = icon_right - text_offset; - text_left = r.left + WD_MATRIX_LEFT; - } else { - icon_left = r.left + WD_MATRIX_LEFT; -- icon_right = icon_left + 10; -- text_left = icon_left + BuildIndustryWindow::MATRIX_TEXT_OFFSET; -+ icon_right = icon_left + square_size; -+ text_left = icon_left + text_offset; - text_right = r.right - WD_MATRIX_RIGHT; - } - -- for (byte i = 0; i < this->vscroll->GetCapacity() && i + this->vscroll->GetPosition() < this->count; i++) { -- int y = r.top + WD_MATRIX_TOP + i * this->resize.step_height; -+ int y = Center(r.top, this->resize.step_height); -+ for (byte i = 0; i < this->vscroll->GetCapacity() && i + this->vscroll->GetPosition() < this->count; i++, y += this->resize.step_height) { - bool selected = this->selected_index == i + this->vscroll->GetPosition(); - - if (this->index[i + this->vscroll->GetPosition()] == INVALID_INDUSTRYTYPE) { -@@ -407,8 +406,8 @@ public: - - /* Draw the name of the industry in white is selected, otherwise, in orange */ - DrawString(text_left, text_right, y, indsp->name, selected ? TC_WHITE : TC_ORANGE); -- GfxFillRect(icon_left, y + 1, icon_right, y + 7, selected ? PC_WHITE : PC_BLACK); -- GfxFillRect(icon_left + 1, y + 2, icon_right - 1, y + 6, indsp->map_colour); -+ GfxFillRect(icon_left, y + 1, icon_right, y + square_size, selected ? PC_WHITE : PC_BLACK); -+ GfxFillRect(icon_left + 1, y + 2, icon_right - 1, y + square_size - 1, indsp->map_colour); - } - break; - } -@@ -760,7 +759,7 @@ public: - if (first) { - if (has_accept) y += WD_PAR_VSEP_WIDE; - DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, y, STR_INDUSTRY_VIEW_PRODUCTION_LAST_MONTH_TITLE); -- y += FONT_HEIGHT_NORMAL; -+ y += this->editable == EA_RATE ? GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL) : FONT_HEIGHT_NORMAL; - if (this->editable == EA_RATE) this->production_offset_y = y; - first = false; - } -@@ -775,8 +774,10 @@ public: - if (this->editable == EA_RATE) { - DrawArrowButtons(left + WD_FRAMETEXT_LEFT, y, COLOUR_YELLOW, (this->clicked_line == IL_RATE1 + j) ? this->clicked_button : 0, - i->production_rate[j] > 0, i->production_rate[j] < 255); -+ y += GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); -+ } else { -+ y += FONT_HEIGHT_NORMAL; - } -- y += FONT_HEIGHT_NORMAL; - } - - /* Display production multiplier if editable */ -@@ -788,7 +789,7 @@ public: - DrawString(x, right - WD_FRAMERECT_RIGHT, y, STR_INDUSTRY_VIEW_PRODUCTION_LEVEL); - DrawArrowButtons(left + WD_FRAMETEXT_LEFT, y, COLOUR_YELLOW, (this->clicked_line == IL_MULTIPLIER) ? this->clicked_button : 0, - i->prod_level > PRODLEVEL_MINIMUM, i->prod_level < PRODLEVEL_MAXIMUM); -- y += FONT_HEIGHT_NORMAL; -+ y += GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); - } - - /* Get the extra message for the GUI */ -@@ -836,12 +837,14 @@ public: - case EA_NONE: break; - - case EA_MULTIPLIER: -- if (IsInsideBS(pt.y, this->production_offset_y, FONT_HEIGHT_NORMAL)) line = IL_MULTIPLIER; -+ if (IsInsideBS(pt.y, this->production_offset_y, SETTING_BUTTON_HEIGHT)) line = IL_MULTIPLIER; - break; - - case EA_RATE: - if (pt.y >= this->production_offset_y) { -- int row = (pt.y - this->production_offset_y) / FONT_HEIGHT_NORMAL; -+ if ((pt.y - this->production_offset_y) % GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL) > SETTING_BUTTON_HEIGHT) break;; -+ -+ int row = (pt.y - this->production_offset_y) / GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); - for (uint j = 0; j < lengthof(i->produced_cargo); j++) { - if (i->produced_cargo[j] == CT_INVALID) continue; - row--; -@@ -1059,7 +1062,7 @@ static const NWidgetPart _nested_industry_directory_widgets[] = { - NWidget(NWID_HORIZONTAL), - NWidget(NWID_VERTICAL), - NWidget(NWID_HORIZONTAL), -- NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_ID_DROPDOWN_ORDER), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), -+ NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_ID_DROPDOWN_ORDER), SetSizingType(NWST_STEP), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), - NWidget(WWT_DROPDOWN, COLOUR_BROWN, WID_ID_DROPDOWN_CRITERIA), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA), - NWidget(WWT_PANEL, COLOUR_BROWN), SetResize(1, 0), EndContainer(), - EndContainer(), -diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp -index 5d13058..3d07096 100644 ---- a/src/intro_gui.cpp -+++ b/src/intro_gui.cpp -@@ -145,7 +145,7 @@ struct SelectGameWindow : public Window { - }; - - static const NWidgetPart _nested_select_game_widgets[] = { -- NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_INTRO_CAPTION, STR_NULL), -+ NWidget(WWT_CAPTION, COLOUR_BROWN), SetSizingType(NWST_BUTTON), SetDataTip(STR_INTRO_CAPTION, STR_NULL), - NWidget(WWT_PANEL, COLOUR_BROWN), - NWidget(NWID_SPACER), SetMinimalSize(0, 8), - -diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp -index be4e992..2f14e6c 100644 ---- a/src/newgrf_debug_gui.cpp -+++ b/src/newgrf_debug_gui.cpp -@@ -840,7 +840,7 @@ struct SpriteAlignerWindow : Window { - { - if (widget != WID_SA_LIST) return; - -- resize->height = max(11, FONT_HEIGHT_NORMAL + 1); -+ resize->height = GetMinSizing(NWST_STEP, max(11, FONT_HEIGHT_NORMAL + 1)); - resize->width = 1; - - /* Resize to about 200 pixels (for the preview) */ -@@ -877,10 +877,10 @@ struct SpriteAlignerWindow : Window { - SmallVector &list = _newgrf_debug_sprite_picker.sprites; - int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), list.Length()); - -- int y = r.top + WD_FRAMERECT_TOP; -+ int y = Center(r.top + WD_FRAMERECT_TOP, step_size, FONT_HEIGHT_NORMAL); - for (int i = this->vscroll->GetPosition(); i < max; i++) { - SetDParam(0, list[i]); -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_BLACK_COMMA, TC_FROMSTRING, SA_RIGHT | SA_FORCE); -+ DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_BLACK_COMMA, TC_FROMSTRING, SA_CENTER | SA_FORCE); - y += step_size; - } - break; -diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp -index aedb4fd..a46aa79 100644 ---- a/src/newgrf_gui.cpp -+++ b/src/newgrf_gui.cpp -@@ -1943,6 +1943,7 @@ void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFC - /** Widgets for the progress window. */ - static const NWidgetPart _nested_scan_progress_widgets[] = { - NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_NEWGRF_SCAN_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), -+ SetSizingType(NWST_BUTTON), - NWidget(WWT_PANEL, COLOUR_GREY), - NWidget(NWID_HORIZONTAL), SetPIP(20, 0, 20), - NWidget(NWID_VERTICAL), SetPIP(11, 8, 11), -diff --git a/src/news_gui.cpp b/src/news_gui.cpp -index 5639001..97d4f79 100644 ---- a/src/news_gui.cpp -+++ b/src/news_gui.cpp -@@ -78,7 +78,7 @@ static TileIndex GetReferenceTile(NewsReferenceType reftype, uint32 ref) - static const NWidgetPart _nested_normal_news_widgets[] = { - NWidget(WWT_PANEL, COLOUR_WHITE, WID_N_PANEL), - NWidget(NWID_HORIZONTAL), SetPadding(1, 1, 0, 1), -- NWidget(WWT_TEXT, COLOUR_WHITE, WID_N_CLOSEBOX), SetDataTip(STR_SILVER_CROSS, STR_NULL), SetPadding(0, 0, 0, 1), -+ NWidget(WWT_TEXT, COLOUR_WHITE, WID_N_CLOSEBOX), SetSizingType(NWST_BUTTON), SetDataTip(STR_SILVER_CROSS, STR_NULL), SetPadding(0, 0, 0, 1), - NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(NWID_VERTICAL), - NWidget(WWT_LABEL, COLOUR_WHITE, WID_N_DATE), SetDataTip(STR_DATE_LONG_SMALL, STR_NULL), -@@ -101,7 +101,7 @@ static const NWidgetPart _nested_vehicle_news_widgets[] = { - NWidget(WWT_PANEL, COLOUR_WHITE, WID_N_PANEL), - NWidget(NWID_HORIZONTAL), SetPadding(1, 1, 0, 1), - NWidget(NWID_VERTICAL), -- NWidget(WWT_TEXT, COLOUR_WHITE, WID_N_CLOSEBOX), SetDataTip(STR_SILVER_CROSS, STR_NULL), SetPadding(0, 0, 0, 1), -+ NWidget(WWT_TEXT, COLOUR_WHITE, WID_N_CLOSEBOX), SetSizingType(NWST_BUTTON), SetDataTip(STR_SILVER_CROSS, STR_NULL), SetPadding(0, 0, 0, 1), - NWidget(NWID_SPACER), SetFill(0, 1), - EndContainer(), - NWidget(WWT_LABEL, COLOUR_WHITE, WID_N_VEH_TITLE), SetFill(1, 1), SetMinimalSize(419, 55), SetDataTip(STR_EMPTY, STR_NULL), -@@ -128,7 +128,7 @@ static const NWidgetPart _nested_company_news_widgets[] = { - NWidget(WWT_PANEL, COLOUR_WHITE, WID_N_PANEL), - NWidget(NWID_HORIZONTAL), SetPadding(1, 1, 0, 1), - NWidget(NWID_VERTICAL), -- NWidget(WWT_TEXT, COLOUR_WHITE, WID_N_CLOSEBOX), SetDataTip(STR_SILVER_CROSS, STR_NULL), SetPadding(0, 0, 0, 1), -+ NWidget(WWT_TEXT, COLOUR_WHITE, WID_N_CLOSEBOX), SetSizingType(NWST_BUTTON), SetDataTip(STR_SILVER_CROSS, STR_NULL), SetPadding(0, 0, 0, 1), - NWidget(NWID_SPACER), SetFill(0, 1), - EndContainer(), - NWidget(WWT_LABEL, COLOUR_WHITE, WID_N_TITLE), SetFill(1, 1), SetMinimalSize(410, 20), SetDataTip(STR_EMPTY, STR_NULL), -@@ -158,7 +158,7 @@ static WindowDesc _company_news_desc( - static const NWidgetPart _nested_thin_news_widgets[] = { - NWidget(WWT_PANEL, COLOUR_WHITE, WID_N_PANEL), - NWidget(NWID_HORIZONTAL), SetPadding(1, 1, 0, 1), -- NWidget(WWT_TEXT, COLOUR_WHITE, WID_N_CLOSEBOX), SetDataTip(STR_SILVER_CROSS, STR_NULL), SetPadding(0, 0, 0, 1), -+ NWidget(WWT_TEXT, COLOUR_WHITE, WID_N_CLOSEBOX), SetSizingType(NWST_STEP), SetDataTip(STR_SILVER_CROSS, STR_NULL), SetPadding(0, 0, 0, 1), - NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(NWID_VERTICAL), - NWidget(WWT_LABEL, COLOUR_WHITE, WID_N_DATE), SetDataTip(STR_DATE_LONG_SMALL, STR_NULL), -@@ -1007,7 +1007,7 @@ struct MessageHistoryWindow : Window { - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) - { - if (widget == WID_MH_BACKGROUND) { -- this->line_height = FONT_HEIGHT_NORMAL + 2; -+ this->line_height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + 2); - resize->height = this->line_height; - - /* Months are off-by-one, so it's actually 8. Not using -@@ -1038,7 +1038,7 @@ struct MessageHistoryWindow : Window { - } - - /* Fill the widget with news items. */ -- int y = r.top + this->top_spacing; -+ int y = Center(r.top + this->top_spacing, this->line_height, FONT_HEIGHT_NORMAL); - bool rtl = _current_text_dir == TD_RTL; - uint date_left = rtl ? r.right - WD_FRAMERECT_RIGHT - this->date_width : r.left + WD_FRAMERECT_LEFT; - uint date_right = rtl ? r.right - WD_FRAMERECT_RIGHT : r.left + WD_FRAMERECT_LEFT + this->date_width; -diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp -index 2516c4d..f172c1c 100644 ---- a/src/osk_gui.cpp -+++ b/src/osk_gui.cpp -@@ -227,7 +227,8 @@ static const int INTER_KEY_SPACE = 2; // Number of pixels between two keys. - */ - static void AddKey(NWidgetHorizontal *hor, int height, int num_half, WidgetType widtype, int widnum, uint16 widdata, int *biggest_index) - { -- int key_width = HALF_KEY_WIDTH + (INTER_KEY_SPACE + HALF_KEY_WIDTH) * (num_half - 1); -+ int min_half_key = max(GetMinSizing(NWST_BUTTON) / 2, HALF_KEY_WIDTH); -+ int key_width = min_half_key + (INTER_KEY_SPACE + min_half_key) * (num_half - 1); - - if (widtype == NWID_SPACER) { - if (!hor->IsEmpty()) key_width += INTER_KEY_SPACE; -@@ -327,7 +328,7 @@ static NWidgetBase *MakeSpacebarKeys(int *biggest_index) - - - static const NWidgetPart _nested_osk_widgets[] = { -- NWidget(WWT_CAPTION, COLOUR_GREY, WID_OSK_CAPTION), SetDataTip(STR_WHITE_STRING, STR_NULL), -+ NWidget(WWT_CAPTION, COLOUR_GREY, WID_OSK_CAPTION), SetSizingType(NWST_BUTTON), SetDataTip(STR_WHITE_STRING, STR_NULL), - NWidget(WWT_PANEL, COLOUR_GREY), - NWidget(WWT_EDITBOX, COLOUR_GREY, WID_OSK_TEXT), SetMinimalSize(252, 12), SetPadding(2, 2, 2, 2), - EndContainer(), -diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp -index afdbb4a..74b97bc 100644 ---- a/src/settings_gui.cpp -+++ b/src/settings_gui.cpp -@@ -2290,11 +2290,13 @@ void ShowGameSettings() - void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clickable_left, bool clickable_right) - { - int colour = _colour_gradient[button_colour][2]; -+ int half_button = SETTING_BUTTON_WIDTH / 2; - -- DrawFrameRect(x, y, x + SETTING_BUTTON_WIDTH / 2 - 1, y + SETTING_BUTTON_HEIGHT - 1, button_colour, (state == 1) ? FR_LOWERED : FR_NONE); -- DrawFrameRect(x + SETTING_BUTTON_WIDTH / 2, y, x + SETTING_BUTTON_WIDTH - 1, y + SETTING_BUTTON_HEIGHT - 1, button_colour, (state == 2) ? FR_LOWERED : FR_NONE); -- DrawSprite(SPR_ARROW_LEFT, PAL_NONE, x + WD_IMGBTN_LEFT, y + WD_IMGBTN_TOP); -- DrawSprite(SPR_ARROW_RIGHT, PAL_NONE, x + WD_IMGBTN_LEFT + SETTING_BUTTON_WIDTH / 2, y + WD_IMGBTN_TOP); -+ DrawFrameRect(x, y, x + half_button - 1, y + SETTING_BUTTON_HEIGHT - 1, button_colour, (state == 1) ? FR_LOWERED : FR_NONE); -+ DrawFrameRect(x + half_button, y, x + SETTING_BUTTON_WIDTH - 1, y + SETTING_BUTTON_HEIGHT - 1, button_colour, (state == 2) ? FR_LOWERED : FR_NONE); -+ Dimension d = GetSpriteSize(SPR_ARROW_LEFT); -+ DrawSprite(SPR_ARROW_LEFT, PAL_NONE, Center(x, half_button, d.width), Center(y, SETTING_BUTTON_HEIGHT, d.height)); -+ DrawSprite(SPR_ARROW_RIGHT, PAL_NONE, Center(x + half_button, half_button, d.width), Center(y, SETTING_BUTTON_HEIGHT, d.height)); - - /* Grey out the buttons that aren't clickable */ - bool rtl = _current_text_dir == TD_RTL; -diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp -index 2ec3677..e572f51 100644 ---- a/src/signs_gui.cpp -+++ b/src/signs_gui.cpp -@@ -195,7 +195,7 @@ struct SignListWindow : Window, SignList { - { - switch (widget) { - case WID_SIL_LIST: { -- uint y = r.top + WD_FRAMERECT_TOP; // Offset from top of widget. -+ uint y = Center(r.top + WD_FRAMERECT_TOP, this->resize.step_height); // Offset from top of widget. - /* No signs? */ - if (this->vscroll->GetCount() == 0) { - DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, y, STR_STATION_LIST_NONE); -diff --git a/src/station_gui.cpp b/src/station_gui.cpp -index 28f9ea6..7a57229 100644 ---- a/src/station_gui.cpp -+++ b/src/station_gui.cpp -@@ -572,7 +572,7 @@ static const NWidgetPart _nested_company_stations_widgets[] = { - NWidget(WWT_STICKYBOX, COLOUR_GREY), - EndContainer(), - NWidget(NWID_HORIZONTAL), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_STL_SORTBY), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_STL_SORTBY), SetSizingType(NWST_STEP), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), - NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_STL_SORTDROPBTN), SetMinimalSize(163, 12), SetDataTip(STR_SORT_BY_NAME, STR_TOOLTIP_SORT_CRITERIA), // widget_data gets overwritten. - NWidget(WWT_PANEL, COLOUR_GREY), SetDataTip(0x0, STR_NULL), SetResize(1, 0), SetFill(1, 1), EndContainer(), - EndContainer(), -diff --git a/src/town_gui.cpp b/src/town_gui.cpp -index 3c541e5..dbc9345 100644 ---- a/src/town_gui.cpp -+++ b/src/town_gui.cpp -@@ -618,7 +618,7 @@ static const NWidgetPart _nested_town_directory_widgets[] = { - NWidget(NWID_HORIZONTAL), - NWidget(NWID_VERTICAL), - NWidget(NWID_HORIZONTAL), -- NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_TD_SORT_ORDER), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), -+ NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_TD_SORT_ORDER), SetSizingType(NWST_STEP), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), - NWidget(WWT_DROPDOWN, COLOUR_BROWN, WID_TD_SORT_CRITERIA), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA), - NWidget(WWT_PANEL, COLOUR_BROWN), SetResize(1, 0), EndContainer(), - EndContainer(), -diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp -index 9e00552..50778fc 100644 ---- a/src/transparency_gui.cpp -+++ b/src/transparency_gui.cpp -@@ -142,7 +142,7 @@ static const NWidgetPart _nested_transparency_widgets[] = { - NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 1), EndContainer(), - EndContainer(), - /* Panel with 'invisibility' buttons. */ -- NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_TT_BUTTONS), SetMinimalSize(219, 13), SetDataTip(0x0, STR_TRANSPARENT_INVISIBLE_TOOLTIP), -+ NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_TT_BUTTONS), SetSizingType(NWST_STEP), SetMinimalSize(219, 13), SetDataTip(0x0, STR_TRANSPARENT_INVISIBLE_TOOLTIP), - EndContainer(), - }; - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0190-Sizing-and-centering-of-owner-face-window.patch b/project/jni/application/openttd/0190-Sizing-and-centering-of-owner-face-window.patch deleted file mode 100644 index 1738562b7..000000000 --- a/project/jni/application/openttd/0190-Sizing-and-centering-of-owner-face-window.patch +++ /dev/null @@ -1,261 +0,0 @@ -From 8b2df1217b9a3f16bfc189d1c01b897e879696c9 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Fri, 9 Aug 2013 09:33:23 +0000 -Subject: [PATCH 190/249] Sizing and centering of owner face window. - ---- - src/company_gui.cpp | 202 +++++++++++++++++++++++++++------------------------- - 1 file changed, 106 insertions(+), 96 deletions(-) - -diff --git a/src/company_gui.cpp b/src/company_gui.cpp -index 060c796..3be6dec 100644 ---- a/src/company_gui.cpp -+++ b/src/company_gui.cpp -@@ -921,102 +921,108 @@ static const NWidgetPart _nested_select_company_manager_face_widgets[] = { - EndContainer(), - EndContainer(), - EndContainer(), -- NWidget(NWID_VERTICAL), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_TOGGLE_LARGE_SMALL_BUTTON), SetFill(1, 0), SetDataTip(STR_FACE_ADVANCED, STR_FACE_ADVANCED_TOOLTIP), -- NWidget(NWID_SPACER), SetMinimalSize(0, 2), -- NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SCMF_SEL_MALEFEMALE), // Simple male/female face setting. -- NWidget(NWID_VERTICAL), -- NWidget(NWID_SPACER), SetFill(0, 1), -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_MALE), SetFill(1, 0), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP), -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_FEMALE), SetFill(1, 0), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP), -- NWidget(NWID_SPACER), SetFill(0, 1), -- EndContainer(), -- EndContainer(), -- NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SCMF_SEL_PARTS), // Advanced face parts setting. -- NWidget(NWID_VERTICAL), -- NWidget(NWID_SPACER), SetMinimalSize(0, 2), -- NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_MALE2), SetFill(1, 0), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP), -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_FEMALE2), SetFill(1, 0), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP), -- EndContainer(), -- NWidget(NWID_SPACER), SetMinimalSize(0, 2), -- NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_ETHNICITY_EUR), SetFill(1, 0), SetDataTip(STR_FACE_EUROPEAN, STR_FACE_SELECT_EUROPEAN), -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_ETHNICITY_AFR), SetFill(1, 0), SetDataTip(STR_FACE_AFRICAN, STR_FACE_SELECT_AFRICAN), -- EndContainer(), -- NWidget(NWID_SPACER), SetMinimalSize(0, 4), -- NWidget(NWID_HORIZONTAL), -- NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT), SetFill(1, 0), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAS_MOUSTACHE_EARRING), SetDataTip(STR_EMPTY, STR_FACE_MOUSTACHE_EARRING_TOOLTIP), -- EndContainer(), -- NWidget(NWID_HORIZONTAL), -- NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_HAS_GLASSES_TEXT), SetFill(1, 0), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAS_GLASSES), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP), -- EndContainer(), -- NWidget(NWID_SPACER), SetMinimalSize(0, 2), SetFill(1, 0), -- NWidget(NWID_HORIZONTAL), -- NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_HAIR_TEXT), SetFill(1, 0), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_HAIR_L), SetDataTip(AWV_DECREASE, STR_FACE_HAIR_TOOLTIP), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAIR), SetDataTip(STR_EMPTY, STR_FACE_HAIR_TOOLTIP), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_HAIR_R), SetDataTip(AWV_INCREASE, STR_FACE_HAIR_TOOLTIP), -- EndContainer(), -- NWidget(NWID_HORIZONTAL), -- NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_EYEBROWS_TEXT), SetFill(1, 0), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYEBROWS_L), SetDataTip(AWV_DECREASE, STR_FACE_EYEBROWS_TOOLTIP), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_EYEBROWS), SetDataTip(STR_EMPTY, STR_FACE_EYEBROWS_TOOLTIP), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYEBROWS_R), SetDataTip(AWV_INCREASE, STR_FACE_EYEBROWS_TOOLTIP), -- EndContainer(), -- NWidget(NWID_HORIZONTAL), -- NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_EYECOLOUR_TEXT), SetFill(1, 0), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR_L), SetDataTip(AWV_DECREASE, STR_FACE_EYECOLOUR_TOOLTIP), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR), SetDataTip(STR_EMPTY, STR_FACE_EYECOLOUR_TOOLTIP), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR_R), SetDataTip(AWV_INCREASE, STR_FACE_EYECOLOUR_TOOLTIP), -- EndContainer(), -- NWidget(NWID_HORIZONTAL), -- NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_GLASSES_TEXT), SetFill(1, 0), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_GLASSES_L), SetDataTip(AWV_DECREASE, STR_FACE_GLASSES_TOOLTIP_2), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_GLASSES), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP_2), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_GLASSES_R), SetDataTip(AWV_INCREASE, STR_FACE_GLASSES_TOOLTIP_2), -- EndContainer(), -- NWidget(NWID_HORIZONTAL), -- NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_NOSE_TEXT), SetFill(1, 0), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_NOSE_L), SetDataTip(AWV_DECREASE, STR_FACE_NOSE_TOOLTIP), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_NOSE), SetDataTip(STR_EMPTY, STR_FACE_NOSE_TOOLTIP), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_NOSE_R), SetDataTip(AWV_INCREASE, STR_FACE_NOSE_TOOLTIP), -- EndContainer(), -- NWidget(NWID_HORIZONTAL), -- NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_LIPS_MOUSTACHE_TEXT), SetFill(1, 0), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE_L), SetDataTip(AWV_DECREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE), SetDataTip(STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE_R), SetDataTip(AWV_INCREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), -- EndContainer(), -- NWidget(NWID_HORIZONTAL), -- NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_CHIN_TEXT), SetFill(1, 0), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_CHIN_L), SetDataTip(AWV_DECREASE, STR_FACE_CHIN_TOOLTIP), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_CHIN), SetDataTip(STR_EMPTY, STR_FACE_CHIN_TOOLTIP), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_CHIN_R), SetDataTip(AWV_INCREASE, STR_FACE_CHIN_TOOLTIP), -- EndContainer(), -- NWidget(NWID_HORIZONTAL), -- NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_JACKET_TEXT), SetFill(1, 0), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_JACKET_L), SetDataTip(AWV_DECREASE, STR_FACE_JACKET_TOOLTIP), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_JACKET), SetDataTip(STR_EMPTY, STR_FACE_JACKET_TOOLTIP), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_JACKET_R), SetDataTip(AWV_INCREASE, STR_FACE_JACKET_TOOLTIP), -- EndContainer(), -- NWidget(NWID_HORIZONTAL), -- NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_COLLAR_TEXT), SetFill(1, 0), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_COLLAR_L), SetDataTip(AWV_DECREASE, STR_FACE_COLLAR_TOOLTIP), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_COLLAR), SetDataTip(STR_EMPTY, STR_FACE_COLLAR_TOOLTIP), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_COLLAR_R), SetDataTip(AWV_INCREASE, STR_FACE_COLLAR_TOOLTIP), -+ -+ NWidget(NWID_HORIZONTAL), -+ NWidget(NWID_SPACER), SetFill(1, 0), -+ NWidget(NWID_VERTICAL), -+ NWidget(NWID_SPACER), SetFill(0, 1), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_TOGGLE_LARGE_SMALL_BUTTON), SetFill(1, 0), SetDataTip(STR_FACE_ADVANCED, STR_FACE_ADVANCED_TOOLTIP), -+ NWidget(NWID_SPACER), SetMinimalSize(0, 2), -+ NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SCMF_SEL_MALEFEMALE), // Simple male/female face setting. -+ NWidget(NWID_VERTICAL), -+ NWidget(NWID_SPACER), SetFill(0, 1), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_MALE), SetFill(1, 0), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_FEMALE), SetFill(1, 0), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP), -+ NWidget(NWID_SPACER), SetFill(0, 1), - EndContainer(), -- NWidget(NWID_HORIZONTAL), -- NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_TIE_EARRING_TEXT), SetFill(1, 0), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING_L), SetDataTip(AWV_DECREASE, STR_FACE_TIE_EARRING_TOOLTIP), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING), SetDataTip(STR_EMPTY, STR_FACE_TIE_EARRING_TOOLTIP), -- NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING_R), SetDataTip(AWV_INCREASE, STR_FACE_TIE_EARRING_TOOLTIP), -+ EndContainer(), -+ NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SCMF_SEL_PARTS), // Advanced face parts setting. -+ NWidget(NWID_VERTICAL), -+ NWidget(NWID_SPACER), SetMinimalSize(0, 2), -+ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_MALE2), SetFill(1, 0), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_FEMALE2), SetFill(1, 0), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP), -+ EndContainer(), -+ NWidget(NWID_SPACER), SetMinimalSize(0, 2), -+ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_ETHNICITY_EUR), SetFill(1, 0), SetDataTip(STR_FACE_EUROPEAN, STR_FACE_SELECT_EUROPEAN), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_ETHNICITY_AFR), SetFill(1, 0), SetDataTip(STR_FACE_AFRICAN, STR_FACE_SELECT_AFRICAN), -+ EndContainer(), -+ NWidget(NWID_SPACER), SetMinimalSize(0, 4), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT), SetFill(1, 0), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAS_MOUSTACHE_EARRING), SetDataTip(STR_EMPTY, STR_FACE_MOUSTACHE_EARRING_TOOLTIP), -+ EndContainer(), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_HAS_GLASSES_TEXT), SetFill(1, 0), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAS_GLASSES), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP), -+ EndContainer(), -+ NWidget(NWID_SPACER), SetMinimalSize(0, 2), SetFill(1, 0), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_HAIR_TEXT), SetFill(1, 0), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_HAIR_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_HAIR_TOOLTIP), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAIR), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_HAIR_TOOLTIP), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_HAIR_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_HAIR_TOOLTIP), -+ EndContainer(), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_EYEBROWS_TEXT), SetFill(1, 0), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYEBROWS_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_EYEBROWS_TOOLTIP), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_EYEBROWS), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_EYEBROWS_TOOLTIP), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYEBROWS_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_EYEBROWS_TOOLTIP), -+ EndContainer(), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_EYECOLOUR_TEXT), SetFill(1, 0), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_EYECOLOUR_TOOLTIP), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_EYECOLOUR_TOOLTIP), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_EYECOLOUR_TOOLTIP), -+ EndContainer(), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_GLASSES_TEXT), SetFill(1, 0), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_GLASSES_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_GLASSES_TOOLTIP_2), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_GLASSES), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP_2), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_GLASSES_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_GLASSES_TOOLTIP_2), -+ EndContainer(), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_NOSE_TEXT), SetFill(1, 0), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_NOSE_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_NOSE_TOOLTIP), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_NOSE), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_NOSE_TOOLTIP), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_NOSE_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_NOSE_TOOLTIP), -+ EndContainer(), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_LIPS_MOUSTACHE_TEXT), SetFill(1, 0), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), -+ EndContainer(), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_CHIN_TEXT), SetFill(1, 0), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_CHIN_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_CHIN_TOOLTIP), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_CHIN), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_CHIN_TOOLTIP), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_CHIN_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_CHIN_TOOLTIP), -+ EndContainer(), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_JACKET_TEXT), SetFill(1, 0), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_JACKET_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_JACKET_TOOLTIP), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_JACKET), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_JACKET_TOOLTIP), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_JACKET_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_JACKET_TOOLTIP), -+ EndContainer(), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_COLLAR_TEXT), SetFill(1, 0), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_COLLAR_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_COLLAR_TOOLTIP), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_COLLAR), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_COLLAR_TOOLTIP), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_COLLAR_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_COLLAR_TOOLTIP), -+ EndContainer(), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_TIE_EARRING_TEXT), SetFill(1, 0), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_TIE_EARRING_TOOLTIP), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_TIE_EARRING_TOOLTIP), -+ NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_TIE_EARRING_TOOLTIP), -+ EndContainer(), -+ NWidget(NWID_SPACER), SetFill(0, 1), - EndContainer(), -- NWidget(NWID_SPACER), SetFill(0, 1), - EndContainer(), - EndContainer(), -+ NWidget(NWID_SPACER), SetFill(1, 0), - EndContainer(), - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 2), -@@ -1066,7 +1072,7 @@ class SelectCompanyManagerFaceWindow : public Window - - /* Draw the value/bool in white (0xC). If the button clicked adds 1px to x and y text coordinates (IsWindowWidgetLowered()). */ - DrawString(nwi_widget->pos_x + nwi_widget->IsLowered(), nwi_widget->pos_x + nwi_widget->current_x - 1 - nwi_widget->IsLowered(), -- nwi_widget->pos_y + 1 + nwi_widget->IsLowered(), str, TC_WHITE, SA_HOR_CENTER); -+ Center(nwi_widget->pos_y + nwi_widget->IsLowered(), nwi_widget->current_y), str, TC_WHITE, SA_HOR_CENTER); - } - } - -@@ -1116,6 +1122,10 @@ public: - Dimension yesno_dim = maxdim(GetStringBoundingBox(STR_FACE_YES), GetStringBoundingBox(STR_FACE_NO)); - yesno_dim.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; - yesno_dim.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; -+ -+ yesno_dim.width = GetMinSizing(NWST_STEP, yesno_dim.width); -+ yesno_dim.height = GetMinSizing(NWST_STEP, yesno_dim.height); -+ - /* Size of the number button + arrows. */ - Dimension number_dim = {0, 0}; - for (int val = 1; val <= 12; val++) { -@@ -1252,12 +1262,12 @@ public: - case WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT: - case WID_SCMF_TIE_EARRING_TEXT: { - StringID str = PART_TEXTS_IS_FEMALE[(widget - WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT) * 2 + this->is_female]; -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_GOLD, SA_RIGHT); -+ DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, Center(r.top, r.bottom - r.top), str, TC_GOLD, SA_RIGHT); - break; - } - - case WID_SCMF_LIPS_MOUSTACHE_TEXT: -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, (this->is_moust_male) ? STR_FACE_MOUSTACHE : STR_FACE_LIPS, TC_GOLD, SA_RIGHT); -+ DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, Center(r.top, r.bottom - r.top), (this->is_moust_male) ? STR_FACE_MOUSTACHE : STR_FACE_LIPS, TC_GOLD, SA_RIGHT); - break; - - case WID_SCMF_HAS_GLASSES_TEXT: -@@ -1269,7 +1279,7 @@ public: - case WID_SCMF_CHIN_TEXT: - case WID_SCMF_JACKET_TEXT: - case WID_SCMF_COLLAR_TEXT: -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, PART_TEXTS[widget - WID_SCMF_HAS_GLASSES_TEXT], TC_GOLD, SA_RIGHT); -+ DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, Center(r.top, r.bottom - r.top), PART_TEXTS[widget - WID_SCMF_HAS_GLASSES_TEXT], TC_GOLD, SA_RIGHT); - break; - - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0191-Sizing-and-centering-of-vehicle-image-on-refit-windo.patch b/project/jni/application/openttd/0191-Sizing-and-centering-of-vehicle-image-on-refit-windo.patch deleted file mode 100644 index 231f54080..000000000 --- a/project/jni/application/openttd/0191-Sizing-and-centering-of-vehicle-image-on-refit-windo.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 20ee01e02e30d889b5d36054dc86c14443d6376e Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sun, 11 Aug 2013 12:27:04 +0000 -Subject: [PATCH 191/249] Sizing and centering of vehicle image on refit - window. - ---- - src/vehicle_gui.cpp | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp -index e13a131..2e8c995 100644 ---- a/src/vehicle_gui.cpp -+++ b/src/vehicle_gui.cpp -@@ -765,7 +765,7 @@ struct RefitWindow : public Window { - break; - - case WID_VR_VEHICLE_PANEL_DISPLAY: -- size->height = GetVehicleHeight(Vehicle::Get(this->window_number)->type); -+ size->height = max(GetMinSizing(NWST_STEP), GetVehicleHeight(Vehicle::Get(this->window_number)->type)); - break; - - case WID_VR_INFO: -@@ -825,11 +825,12 @@ struct RefitWindow : public Window { - case WID_VR_VEHICLE_PANEL_DISPLAY: { - Vehicle *v = Vehicle::Get(this->window_number); - DrawVehicleImage(v, this->sprite_left + WD_FRAMERECT_LEFT, this->sprite_right - WD_FRAMERECT_RIGHT, -- r.top, r.bottom - r.top, INVALID_VEHICLE, EIT_IN_DETAILS, this->hscroll != NULL ? this->hscroll->GetPosition() : 0); -+ r.top, r.bottom - r.top + 1, INVALID_VEHICLE, EIT_IN_DETAILS, this->hscroll != NULL ? this->hscroll->GetPosition() : 0); - - /* Highlight selected vehicles. */ - if (this->order != INVALID_VEH_ORDER_ID) break; - int x = 0; -+ int y_offset_frame = Center(0, r.bottom - r.top + 1, 14); - switch (v->type) { - case VEH_TRAIN: { - VehicleSet vehicles_to_refit; -@@ -862,7 +863,7 @@ struct RefitWindow : public Window { - } - - if (left != right) { -- DrawFrameRect(left, r.top + WD_FRAMERECT_TOP, right, r.top + WD_FRAMERECT_TOP + 13, COLOUR_WHITE, FR_BORDERONLY); -+ DrawFrameRect(left, r.top + y_offset_frame, right, r.top + y_offset_frame + 13, COLOUR_WHITE, FR_BORDERONLY); - } - - left = INT32_MIN; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0195-Center-sprites-on-station-picker-for-road-stations-a.patch b/project/jni/application/openttd/0195-Center-sprites-on-station-picker-for-road-stations-a.patch deleted file mode 100644 index 76f32becd..000000000 --- a/project/jni/application/openttd/0195-Center-sprites-on-station-picker-for-road-stations-a.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 9a2fe87d754e34b524b187d428109efddded0cbe Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 10 Aug 2013 15:23:33 +0000 -Subject: [PATCH 195/249] Center sprites on station picker for road stations - and rail stations. - ---- - src/rail_gui.cpp | 15 +++++++++------ - src/road_gui.cpp | 6 +++++- - 2 files changed, 14 insertions(+), 7 deletions(-) - -diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp -index a2067c5..004b47f 100644 ---- a/src/rail_gui.cpp -+++ b/src/rail_gui.cpp -@@ -1088,8 +1088,9 @@ public: - if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) { - DrawPixelInfo *old_dpi = _cur_dpi; - _cur_dpi = &tmp_dpi; -- if (!DrawStationTile(32, 28, _cur_railtype, AXIS_X, _railstation.station_class, _railstation.station_type)) { -- StationPickerDrawSprite(32, 28, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 2); -+ int x = Center(TILE_PIXELS, r.right - r.left, 2 * TILE_PIXELS); -+ if (!DrawStationTile(x, 28, _cur_railtype, AXIS_X, _railstation.station_class, _railstation.station_type)) { -+ StationPickerDrawSprite(x, 28, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 2); - } - _cur_dpi = old_dpi; - } -@@ -1100,8 +1101,9 @@ public: - if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) { - DrawPixelInfo *old_dpi = _cur_dpi; - _cur_dpi = &tmp_dpi; -- if (!DrawStationTile(32, 28, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) { -- StationPickerDrawSprite(32, 28, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 3); -+ int x = Center(TILE_PIXELS, r.right - r.left, 2 * TILE_PIXELS); -+ if (!DrawStationTile(x, 28, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) { -+ StationPickerDrawSprite(x, 28, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 3); - } - _cur_dpi = old_dpi; - } -@@ -1136,8 +1138,9 @@ public: - if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) { - DrawPixelInfo *old_dpi = _cur_dpi; - _cur_dpi = &tmp_dpi; -- if (!DrawStationTile(32, 28, _cur_railtype, _railstation.orientation, _railstation.station_class, type)) { -- StationPickerDrawSprite(32, 28, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 2 + _railstation.orientation); -+ int x = Center(TILE_PIXELS, r.right - r.left, 2 * TILE_PIXELS); -+ if (!DrawStationTile(x, 28, _cur_railtype, _railstation.orientation, _railstation.station_class, type)) { -+ StationPickerDrawSprite(x, 28, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 2 + _railstation.orientation); - } - _cur_dpi = old_dpi; - } -diff --git a/src/road_gui.cpp b/src/road_gui.cpp -index 03925fc..f35a2c2 100644 ---- a/src/road_gui.cpp -+++ b/src/road_gui.cpp -@@ -1005,8 +1005,12 @@ struct BuildRoadStationWindow : public PickerWindowBase { - { - if (!IsInsideMM(widget, WID_BROS_STATION_NE, WID_BROS_STATION_Y + 1)) return; - -+ int x = Center(r.left + TILE_PIXELS, r.right - r.left, 2 * TILE_PIXELS); -+ /* Height of bus/truck sprite in OpenGFX is TILE_PIXELS + 11. */ -+ int y = Center(r.top + WD_FRAMERECT_TOP - WD_MATRIX_BOTTOM + IsWidgetLowered(widget) + 11, r.bottom - r.top, TILE_PIXELS + 11); -+ - StationType st = (this->window_class == WC_BUS_STATION) ? STATION_BUS : STATION_TRUCK; -- StationPickerDrawSprite(r.left + TILE_PIXELS, r.bottom - TILE_PIXELS, st, INVALID_RAILTYPE, widget < WID_BROS_STATION_X ? ROADTYPE_ROAD : _cur_roadtype, widget - WID_BROS_STATION_NE); -+ StationPickerDrawSprite(x, y, st, INVALID_RAILTYPE, widget < WID_BROS_STATION_X ? ROADTYPE_ROAD : _cur_roadtype, widget - WID_BROS_STATION_NE); - } - - virtual void OnClick(Point pt, int widget, int click_count) --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0196-Center-sprites-on-bridge-picker-window.patch b/project/jni/application/openttd/0196-Center-sprites-on-bridge-picker-window.patch deleted file mode 100644 index e55e6f322..000000000 --- a/project/jni/application/openttd/0196-Center-sprites-on-bridge-picker-window.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0d255c000ba8913e3e8c6c48922d09071f5ba3e6 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 10 Aug 2013 15:19:00 +0000 -Subject: [PATCH 196/249] Center sprites on bridge picker window. - ---- - src/bridge_gui.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp -index 61c477a..78e7ff8 100644 ---- a/src/bridge_gui.cpp -+++ b/src/bridge_gui.cpp -@@ -231,7 +231,8 @@ public: - SetDParam(1, b->speed); - SetDParam(0, b->material); - -- DrawSprite(b->sprite, b->pal, r.left + WD_MATRIX_LEFT, y + this->resize.step_height - 1 - GetSpriteSize(b->sprite).height); -+ uint y_sprite = Center(y, this->resize.step_height, GetSpriteSize(b->sprite).height); -+ DrawSprite(b->sprite, b->pal, r.left + WD_MATRIX_LEFT, y_sprite); - DrawStringMultiLine(r.left + this->bridgetext_offset, r.right, y + 2, y + this->resize.step_height, - _game_mode == GM_EDITOR ? STR_SELECT_BRIDGE_SCENEDIT_INFO : STR_SELECT_BRIDGE_INFO); - y += this->resize.step_height; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0197-Center-vehicle-status-icon.patch b/project/jni/application/openttd/0197-Center-vehicle-status-icon.patch deleted file mode 100644 index 4472b4271..000000000 --- a/project/jni/application/openttd/0197-Center-vehicle-status-icon.patch +++ /dev/null @@ -1,34 +0,0 @@ -From c967a3b02c96e35f1354bde0ed7b129b821d2e5e Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Thu, 26 Sep 2013 11:50:35 +0000 -Subject: [PATCH 197/249] Center vehicle status icon. - ---- - src/vehicle_gui.cpp | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp -index 2e8c995..80198f0 100644 ---- a/src/vehicle_gui.cpp -+++ b/src/vehicle_gui.cpp -@@ -3031,13 +3031,14 @@ public: - - /* Draw the flag plus orders. */ - bool rtl = (_current_text_dir == TD_RTL); -- uint text_offset = max(GetSpriteSize(SPR_FLAG_VEH_STOPPED).width, GetSpriteSize(SPR_FLAG_VEH_RUNNING).width) + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT; -+ int image = ((v->vehstatus & VS_STOPPED) != 0) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING; -+ Dimension d = GetSpriteSize(image); -+ uint text_offset = d.width + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT; - int text_left = r.left + (rtl ? (uint)WD_FRAMERECT_LEFT : text_offset); - int text_right = r.right - (rtl ? text_offset : (uint)WD_FRAMERECT_RIGHT); - int image_left = (rtl ? text_right + 1 : r.left) + WD_IMGBTN_LEFT; -- int image = ((v->vehstatus & VS_STOPPED) != 0) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING; - int lowered = this->IsWidgetLowered(WID_VV_START_STOP) ? 1 : 0; -- DrawSprite(image, PAL_NONE, image_left + lowered, r.top + WD_IMGBTN_TOP + lowered); -+ DrawSprite(image, PAL_NONE, image_left + lowered, Center(r.top + WD_IMGBTN_TOP + lowered, r.bottom - r.top, d.height)); - DrawString(text_left + lowered, text_right + lowered, Center(r.top + lowered, r.bottom - r.top), str, TC_FROMSTRING, SA_HOR_CENTER); - } - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0198-Center-cargo-icons-on-station-GUI.patch b/project/jni/application/openttd/0198-Center-cargo-icons-on-station-GUI.patch deleted file mode 100644 index 99427be11..000000000 --- a/project/jni/application/openttd/0198-Center-cargo-icons-on-station-GUI.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 58bb44dae5f1165333369b2015fbf4005052efcb Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sun, 6 Oct 2013 14:52:43 +0000 -Subject: [PATCH 198/249] Center cargo icons on station GUI. - ---- - src/station_gui.cpp | 16 +++++++++------- - 1 file changed, 9 insertions(+), 7 deletions(-) - -diff --git a/src/station_gui.cpp b/src/station_gui.cpp -index 7a57229..19d0f37 100644 ---- a/src/station_gui.cpp -+++ b/src/station_gui.cpp -@@ -654,17 +654,19 @@ static const NWidgetPart _nested_station_view_widgets[] = { - * @param y y coordinate - * @param width the width of the view - */ --static void DrawCargoIcons(CargoID i, uint waiting, int left, int right, int y) -+static void DrawCargoIcons(CargoID i, uint waiting, int left, int right, int top, int bottom) - { -- uint num = min((waiting + 5) / 10, (right - left) / 10); // maximum is width / 10 icons so it won't overflow -- if (num == 0) return; -- - SpriteID sprite = CargoSpec::Get(i)->GetCargoIcon(); -+ Dimension d = GetSpriteSize(sprite); -+ -+ uint num = min((waiting + 5) / d.width, (right - left) / d.width); // maximum is width / 10 icons so it won't overflow -+ if (num == 0) return; - -- int x = _current_text_dir == TD_RTL ? left : right - num * 10; -+ int x = _current_text_dir == TD_RTL ? left : right - num * d.width; -+ int y = Center(top, bottom - top, d.height); - do { - DrawSprite(sprite, PAL_NONE, x, y); -- x += 10; -+ x += d.width; - } while (--num); - } - -@@ -1590,7 +1592,7 @@ struct StationViewWindow : public Window { - - if (this->groupings[column] == GR_CARGO) { - str = STR_STATION_VIEW_WAITING_CARGO; -- DrawCargoIcons(cd->GetCargo(), cd->GetCount(), r.left + WD_FRAMERECT_LEFT + this->expand_shrink_width, r.right - WD_FRAMERECT_RIGHT - this->expand_shrink_width, y); -+ DrawCargoIcons(cd->GetCargo(), cd->GetCount(), r.left + WD_FRAMERECT_LEFT + this->expand_shrink_width, r.right - WD_FRAMERECT_RIGHT - this->expand_shrink_width, y, y + FONT_HEIGHT_NORMAL); - } else { - if (!auto_distributed) grouping = GR_SOURCE; - StationID station = cd->GetStation(); --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0199-Add-a-specific-min-sizing-for-onscreen-keyboard.patch b/project/jni/application/openttd/0199-Add-a-specific-min-sizing-for-onscreen-keyboard.patch deleted file mode 100644 index a14d0f1f2..000000000 --- a/project/jni/application/openttd/0199-Add-a-specific-min-sizing-for-onscreen-keyboard.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 6251bbea8a9dab7e4dfa94e9d661edea0a259fd1 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Fri, 2 Aug 2013 18:36:00 +0000 -Subject: [PATCH 199/249] Add a specific min sizing for onscreen keyboard. - ---- - src/osk_gui.cpp | 16 ++++++++-------- - src/widget.cpp | 3 +++ - src/widget_type.h | 1 + - 3 files changed, 12 insertions(+), 8 deletions(-) - -diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp -index f172c1c..52d0d2d 100644 ---- a/src/osk_gui.cpp -+++ b/src/osk_gui.cpp -@@ -103,7 +103,7 @@ struct OskWindow : public Window { - - widget -= WID_OSK_LETTERS; - DrawCharCentered(_keyboard[this->shift][widget], -- r.left + 8, -+ (r.left + r.right) / 2, - r.top + 3, - TC_BLACK); - } -@@ -227,7 +227,7 @@ static const int INTER_KEY_SPACE = 2; // Number of pixels between two keys. - */ - static void AddKey(NWidgetHorizontal *hor, int height, int num_half, WidgetType widtype, int widnum, uint16 widdata, int *biggest_index) - { -- int min_half_key = max(GetMinSizing(NWST_BUTTON) / 2, HALF_KEY_WIDTH); -+ int min_half_key = max(GetMinSizing(NWST_BUTTON), HALF_KEY_WIDTH); - int key_width = min_half_key + (INTER_KEY_SPACE + min_half_key) * (num_half - 1); - - if (widtype == NWID_SPACER) { -@@ -251,7 +251,7 @@ static void AddKey(NWidgetHorizontal *hor, int height, int num_half, WidgetType - static NWidgetBase *MakeTopKeys(int *biggest_index) - { - NWidgetHorizontal *hor = new NWidgetHorizontal(); -- int key_height = FONT_HEIGHT_NORMAL + 2; -+ int key_height = GetMinSizing(NWST_KEYBOARD, FONT_HEIGHT_NORMAL + 2); - - AddKey(hor, key_height, 6 * 2, WWT_TEXTBTN, WID_OSK_CANCEL, STR_BUTTON_CANCEL, biggest_index); - AddKey(hor, key_height, 6 * 2, WWT_TEXTBTN, WID_OSK_OK, STR_BUTTON_OK, biggest_index); -@@ -263,7 +263,7 @@ static NWidgetBase *MakeTopKeys(int *biggest_index) - static NWidgetBase *MakeNumberKeys(int *biggest_index) - { - NWidgetHorizontal *hor = new NWidgetHorizontalLTR(); -- int key_height = FONT_HEIGHT_NORMAL + 6; -+ int key_height = GetMinSizing(NWST_KEYBOARD, FONT_HEIGHT_NORMAL + 6); - - for (int widnum = WID_OSK_NUMBERS_FIRST; widnum <= WID_OSK_NUMBERS_LAST; widnum++) { - AddKey(hor, key_height, 2, WWT_PUSHBTN, widnum, 0x0, biggest_index); -@@ -275,7 +275,7 @@ static NWidgetBase *MakeNumberKeys(int *biggest_index) - static NWidgetBase *MakeQwertyKeys(int *biggest_index) - { - NWidgetHorizontal *hor = new NWidgetHorizontalLTR(); -- int key_height = FONT_HEIGHT_NORMAL + 6; -+ int key_height = GetMinSizing(NWST_KEYBOARD, FONT_HEIGHT_NORMAL + 6); - - AddKey(hor, key_height, 3, WWT_PUSHIMGBTN, WID_OSK_SPECIAL, SPR_OSK_SPECIAL, biggest_index); - for (int widnum = WID_OSK_QWERTY_FIRST; widnum <= WID_OSK_QWERTY_LAST; widnum++) { -@@ -289,7 +289,7 @@ static NWidgetBase *MakeQwertyKeys(int *biggest_index) - static NWidgetBase *MakeAsdfgKeys(int *biggest_index) - { - NWidgetHorizontal *hor = new NWidgetHorizontalLTR(); -- int key_height = FONT_HEIGHT_NORMAL + 6; -+ int key_height = GetMinSizing(NWST_KEYBOARD, FONT_HEIGHT_NORMAL + 6); - - AddKey(hor, key_height, 4, WWT_IMGBTN, WID_OSK_CAPS, SPR_OSK_CAPS, biggest_index); - for (int widnum = WID_OSK_ASDFG_FIRST; widnum <= WID_OSK_ASDFG_LAST; widnum++) { -@@ -302,7 +302,7 @@ static NWidgetBase *MakeAsdfgKeys(int *biggest_index) - static NWidgetBase *MakeZxcvbKeys(int *biggest_index) - { - NWidgetHorizontal *hor = new NWidgetHorizontalLTR(); -- int key_height = FONT_HEIGHT_NORMAL + 6; -+ int key_height = GetMinSizing(NWST_KEYBOARD, FONT_HEIGHT_NORMAL + 6); - - AddKey(hor, key_height, 3, WWT_IMGBTN, WID_OSK_SHIFT, SPR_OSK_SHIFT, biggest_index); - for (int widnum = WID_OSK_ZXCVB_FIRST; widnum <= WID_OSK_ZXCVB_LAST; widnum++) { -@@ -316,7 +316,7 @@ static NWidgetBase *MakeZxcvbKeys(int *biggest_index) - static NWidgetBase *MakeSpacebarKeys(int *biggest_index) - { - NWidgetHorizontal *hor = new NWidgetHorizontal(); -- int key_height = FONT_HEIGHT_NORMAL + 6; -+ int key_height = GetMinSizing(NWST_KEYBOARD, FONT_HEIGHT_NORMAL + 6); - - AddKey(hor, key_height, 8, NWID_SPACER, 0, 0, biggest_index); - AddKey(hor, key_height, 13, WWT_PUSHTXTBTN, WID_OSK_SPACE, STR_EMPTY, biggest_index); -diff --git a/src/widget.cpp b/src/widget.cpp -index 8d14527..74b0112 100644 ---- a/src/widget.cpp -+++ b/src/widget.cpp -@@ -2921,6 +2921,9 @@ uint GetMinSizing(NWidSizingType type, uint min_1) - case NWST_STEP: - min_sizing = _settings_client.gui.min_step; - break; -+ case NWST_KEYBOARD: -+ min_sizing = 2 * _settings_client.gui.min_button; -+ break; - default: NOT_REACHED(); - } - -diff --git a/src/widget_type.h b/src/widget_type.h -index 1003096..f2e015c 100644 ---- a/src/widget_type.h -+++ b/src/widget_type.h -@@ -47,6 +47,7 @@ enum NWidSizingType { - ///< Later, they are automatically set to NWST_BUTTON or NWST_STEP. - NWST_BUTTON, ///< Size will be set at least _settings_client.gui.min_button. - NWST_STEP, ///< Size will be set at least _settings_client.gui.min_step (scrollbars and dropdowns). -+ NWST_KEYBOARD, ///< Size for keyboard keys. - NWST_OVERRIDE, ///< Avoid widgets to use automatic minimal sizing. - NWST_END - }; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0200-Add-a-min-sizing-for-width-of-command-errors-news-an.patch b/project/jni/application/openttd/0200-Add-a-min-sizing-for-width-of-command-errors-news-an.patch deleted file mode 100644 index a29615eb7..000000000 --- a/project/jni/application/openttd/0200-Add-a-min-sizing-for-width-of-command-errors-news-an.patch +++ /dev/null @@ -1,93 +0,0 @@ -From dece237b88597d34baafbcbf9b7587e87e16a4c4 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Fri, 9 Aug 2013 08:34:39 +0000 -Subject: [PATCH 200/249] Add a min sizing for width of command errors, news - and query windows. - ---- - src/error_gui.cpp | 1 + - src/misc_gui.cpp | 1 + - src/news_gui.cpp | 1 + - src/widget.cpp | 3 +++ - src/widget_type.h | 15 ++++++++------- - 5 files changed, 14 insertions(+), 7 deletions(-) - -diff --git a/src/error_gui.cpp b/src/error_gui.cpp -index b498cff..ceec8f5 100644 ---- a/src/error_gui.cpp -+++ b/src/error_gui.cpp -@@ -183,6 +183,7 @@ public: - CopyInDParam(0, this->decode_params, lengthof(this->decode_params)); - if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_size, this->textref_stack); - -+ size->width = GetMinSizing(NWST_WINDOW_LENGTH, size->width); - int text_width = max(0, (int)size->width - WD_FRAMETEXT_LEFT - WD_FRAMETEXT_RIGHT); - this->height_summary = GetStringHeight(this->summary_msg, text_width); - this->height_detailed = (this->detailed_msg == INVALID_STRING_ID) ? 0 : GetStringHeight(this->detailed_msg, text_width); -diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp -index 05ab96d..f65dcdd 100644 ---- a/src/misc_gui.cpp -+++ b/src/misc_gui.cpp -@@ -1093,6 +1093,7 @@ struct QueryWindow : public Window { - { - if (widget != WID_Q_TEXT) return; - -+ size->width = GetMinSizing(NWST_WINDOW_LENGTH, size->width); - Dimension d = GetStringMultiLineBoundingBox(this->message, *size); - d.width += WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT; - d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; -diff --git a/src/news_gui.cpp b/src/news_gui.cpp -index 97d4f79..ba4b557 100644 ---- a/src/news_gui.cpp -+++ b/src/news_gui.cpp -@@ -315,6 +315,7 @@ struct NewsWindow : Window { - StringID str = STR_NULL; - switch (widget) { - case WID_N_MESSAGE: -+ size->width = GetMinSizing(NWST_WINDOW_LENGTH, size->width); - CopyInDParam(0, this->ni->params, lengthof(this->ni->params)); - str = this->ni->string_id; - break; -diff --git a/src/widget.cpp b/src/widget.cpp -index 74b0112..068a945 100644 ---- a/src/widget.cpp -+++ b/src/widget.cpp -@@ -2924,6 +2924,9 @@ uint GetMinSizing(NWidSizingType type, uint min_1) - case NWST_KEYBOARD: - min_sizing = 2 * _settings_client.gui.min_button; - break; -+ case NWST_WINDOW_LENGTH: -+ min_sizing = 8 * _settings_client.gui.min_button; -+ break; - default: NOT_REACHED(); - } - -diff --git a/src/widget_type.h b/src/widget_type.h -index f2e015c..6d95a2c 100644 ---- a/src/widget_type.h -+++ b/src/widget_type.h -@@ -42,13 +42,14 @@ enum ArrowWidgetValues { - - /** Values for different minimal sizing of widgets. */ - enum NWidSizingType { -- NWST_NONE, ///< No sizing type is yet defined. -- ///< Most buttons and scrollbars are initialized with this value. -- ///< Later, they are automatically set to NWST_BUTTON or NWST_STEP. -- NWST_BUTTON, ///< Size will be set at least _settings_client.gui.min_button. -- NWST_STEP, ///< Size will be set at least _settings_client.gui.min_step (scrollbars and dropdowns). -- NWST_KEYBOARD, ///< Size for keyboard keys. -- NWST_OVERRIDE, ///< Avoid widgets to use automatic minimal sizing. -+ NWST_NONE, ///< No sizing type is yet defined. -+ ///< Most buttons and scrollbars are initialized with this value. -+ ///< Later, they are automatically set to NWST_BUTTON or NWST_STEP. -+ NWST_BUTTON, ///< Size will be set at least _settings_client.gui.min_button. -+ NWST_STEP, ///< Size will be set at least _settings_client.gui.min_step (scrollbars and dropdowns). -+ NWST_KEYBOARD, ///< Size for keyboard keys. -+ NWST_WINDOW_LENGTH, ///< Width for command errors, message windows and statusbar middle part. -+ NWST_OVERRIDE, ///< Avoid widgets to use automatic minimal sizing. - NWST_END - }; - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0201-Add-a-min-sizing-for-viewports.patch b/project/jni/application/openttd/0201-Add-a-min-sizing-for-viewports.patch deleted file mode 100644 index 7d7d56e28..000000000 --- a/project/jni/application/openttd/0201-Add-a-min-sizing-for-viewports.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 6b010716fe9c2f867ec5d0895dc638985751bc1d Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Fri, 9 Aug 2013 09:32:52 +0000 -Subject: [PATCH 201/249] Add a min sizing for viewports. - ---- - src/news_gui.cpp | 4 ++-- - src/viewport_gui.cpp | 2 +- - src/widget.cpp | 3 +++ - src/widget_type.h | 1 + - 4 files changed, 7 insertions(+), 3 deletions(-) - -diff --git a/src/news_gui.cpp b/src/news_gui.cpp -index ba4b557..9760ac8 100644 ---- a/src/news_gui.cpp -+++ b/src/news_gui.cpp -@@ -166,7 +166,7 @@ static const NWidgetPart _nested_thin_news_widgets[] = { - EndContainer(), - EndContainer(), - NWidget(WWT_EMPTY, COLOUR_WHITE, WID_N_MESSAGE), SetMinimalSize(428, 48), SetFill(1, 0), SetPadding(0, 5, 0, 5), -- NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_N_VIEWPORT), SetMinimalSize(426, 70), SetPadding(1, 2, 2, 2), -+ NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_N_VIEWPORT), SetSizingType(NWST_VIEWPORT), SetMinimalSize(426, 70), SetPadding(1, 2, 2, 2), - EndContainer(), - }; - -@@ -188,7 +188,7 @@ static const NWidgetPart _nested_small_news_widgets[] = { - /* Main part */ - NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_N_HEADLINE), - NWidget(WWT_INSET, COLOUR_LIGHT_BLUE, WID_N_INSET), SetPadding(2, 2, 2, 2), -- NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_N_VIEWPORT), SetPadding(1, 1, 1, 1), SetMinimalSize(274, 47), SetFill(1, 0), -+ NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_N_VIEWPORT), SetSizingType(NWST_VIEWPORT), SetPadding(1, 1, 1, 1), SetMinimalSize(274, 47), SetFill(1, 0), - EndContainer(), - NWidget(WWT_EMPTY, COLOUR_WHITE, WID_N_MESSAGE), SetMinimalSize(275, 20), SetFill(1, 0), SetPadding(0, 5, 0, 5), - EndContainer(), -diff --git a/src/viewport_gui.cpp b/src/viewport_gui.cpp -index ab8125f..7e9b3b3 100644 ---- a/src/viewport_gui.cpp -+++ b/src/viewport_gui.cpp -@@ -32,7 +32,7 @@ static const NWidgetPart _nested_extra_view_port_widgets[] = { - NWidget(WWT_STICKYBOX, COLOUR_GREY), - EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY), -- NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_EV_VIEWPORT), SetPadding(2, 2, 2, 2), SetResize(1, 1), SetFill(1, 1), -+ NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_EV_VIEWPORT), SetSizingType(NWST_VIEWPORT), SetPadding(2, 2, 2, 2), SetResize(1, 1), SetFill(1, 1), - EndContainer(), - NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_EV_ZOOM_IN), SetDataTip(SPR_IMG_ZOOMIN, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_IN), -diff --git a/src/widget.cpp b/src/widget.cpp -index 068a945..f48b033 100644 ---- a/src/widget.cpp -+++ b/src/widget.cpp -@@ -770,6 +770,9 @@ void NWidgetResizeBase::SetMinimalSize(uint min_x, uint min_y) - case NWST_STEP: - min_size = _settings_client.gui.min_step; - break; -+ case NWST_VIEWPORT: -+ min_size = 3 * _settings_client.gui.min_button; -+ break; - default: NOT_REACHED(); - } - -diff --git a/src/widget_type.h b/src/widget_type.h -index 6d95a2c..43ec2e4 100644 ---- a/src/widget_type.h -+++ b/src/widget_type.h -@@ -49,6 +49,7 @@ enum NWidSizingType { - NWST_STEP, ///< Size will be set at least _settings_client.gui.min_step (scrollbars and dropdowns). - NWST_KEYBOARD, ///< Size for keyboard keys. - NWST_WINDOW_LENGTH, ///< Width for command errors, message windows and statusbar middle part. -+ NWST_VIEWPORT, ///< Sizing type for viewports. - NWST_OVERRIDE, ///< Avoid widgets to use automatic minimal sizing. - NWST_END - }; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0202-Add-a-setting-for-automatically-set-min-sizing-value.patch b/project/jni/application/openttd/0202-Add-a-setting-for-automatically-set-min-sizing-value.patch deleted file mode 100644 index 23002be24..000000000 --- a/project/jni/application/openttd/0202-Add-a-setting-for-automatically-set-min-sizing-value.patch +++ /dev/null @@ -1,264 +0,0 @@ -From f167fb10f164ff720774cbb51f3ce5edb0f664f5 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 27 Jul 2013 22:04:33 +0000 -Subject: [PATCH 202/249] Add a setting for automatically set min sizing - values. - ---- - src/cheat_gui.cpp | 9 +++--- - src/gfx.cpp | 2 ++ - src/industry_gui.cpp | 2 +- - src/lang/english.txt | 2 ++ - src/misc_gui.cpp | 4 ++- - src/settings_gui.h | 4 +-- - src/settings_type.h | 1 + - src/table/misc_settings.ini | 5 ++++ - src/window.cpp | 72 +++++++++++++++++++++++++++++++++++++++++++++ - src/window_func.h | 1 + - 10 files changed, 94 insertions(+), 8 deletions(-) - -diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp -index 01ea1a4..db61024 100644 ---- a/src/cheat_gui.cpp -+++ b/src/cheat_gui.cpp -@@ -287,7 +287,7 @@ struct CheatWindow : Window { - { - const NWidgetBase *wid = this->GetWidget(WID_C_PANEL); - -- if ((pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) % this->line_height > SETTING_BUTTON_HEIGHT) return; -+ if ((pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) % this->line_height > (uint)SETTING_BUTTON_HEIGHT) return; - - uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / this->line_height; - uint x = pt.x - wid->pos_x; -@@ -300,7 +300,7 @@ struct CheatWindow : Window { - int value = (int32)ReadValue(ce->variable, ce->type); - int oldvalue = value; - -- if (btn == CHT_CHANGE_DATE && x >= 20 + SETTING_BUTTON_WIDTH) { -+ if (btn == CHT_CHANGE_DATE && x >= (20 + (uint)SETTING_BUTTON_WIDTH)) { - /* Click at the date text directly. */ - SetDParam(0, value); - ShowQueryString(STR_JUST_INT, STR_CHEAT_CHANGE_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED); -@@ -320,10 +320,11 @@ struct CheatWindow : Window { - - default: - /* Take whatever the function returns */ -- value = ce->proc(value + ((x >= 20 + SETTING_BUTTON_WIDTH / 2) ? 1 : -1), (x >= 20 + SETTING_BUTTON_WIDTH / 2) ? 1 : -1); -+ bool clicked_right = x >= 20 + (uint)(SETTING_BUTTON_WIDTH / 2); -+ value = ce->proc(value + (clicked_right ? 1 : -1), clicked_right ? 1 : -1); - - /* The first cheat (money), doesn't return a different value. */ -- if (value != oldvalue || btn == CHT_MONEY) this->clicked = btn * 2 + 1 + ((x >= 20 + SETTING_BUTTON_WIDTH / 2) != rtl ? 1 : 0); -+ if (value != oldvalue || btn == CHT_MONEY) this->clicked = btn * 2 + 1 + (clicked_right != rtl ? 1 : 0); - break; - } - -diff --git a/src/gfx.cpp b/src/gfx.cpp -index eabb49c..5c2cdc2 100644 ---- a/src/gfx.cpp -+++ b/src/gfx.cpp -@@ -1230,6 +1230,8 @@ void ScreenSizeChanged() - - /* screen size changed and the old bitmap is invalid now, so we don't want to undraw it */ - _cursor.visible = false; -+ -+ CheckWindowMinSizings(); - } - - void UndrawMouseCursor() -diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp -index 5c88ca9..8619a17 100644 ---- a/src/industry_gui.cpp -+++ b/src/industry_gui.cpp -@@ -842,7 +842,7 @@ public: - - case EA_RATE: - if (pt.y >= this->production_offset_y) { -- if ((pt.y - this->production_offset_y) % GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL) > SETTING_BUTTON_HEIGHT) break;; -+ if ((pt.y - this->production_offset_y) % GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL) > (uint)SETTING_BUTTON_HEIGHT) break;; - - int row = (pt.y - this->production_offset_y) / GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); - for (uint j = 0; j < lengthof(i->produced_cargo); j++) { -diff --git a/src/lang/english.txt b/src/lang/english.txt -index d67f2de..155b73e 100644 ---- a/src/lang/english.txt -+++ b/src/lang/english.txt -@@ -976,6 +976,8 @@ STR_GAME_OPTIONS_BASE_MUSIC_STATUS :{RED}{NUM} corr - STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP :{BLACK}Additional information about the base music set - - STR_ERROR_FULLSCREEN_FAILED :{WHITE}Fullscreen mode failed -+STR_ERROR_RESET_WINDOWS :{WHITE}All windows have been reseted... -+STR_ERROR_AUTOMATIC_SIZING :{WHITE}Sizes of buttons and fonts have changed - - # Custom currency window - -diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp -index f65dcdd..dbbde57 100644 ---- a/src/misc_gui.cpp -+++ b/src/misc_gui.cpp -@@ -623,6 +623,8 @@ static WindowDesc _tool_tips_desc( - _nested_tooltips_widgets, lengthof(_nested_tooltips_widgets) - ); - -+uint _tooltip_width = 194; -+ - /** Window for displaying a tooltip. */ - struct TooltipsWindow : public Window - { -@@ -671,7 +673,7 @@ struct TooltipsWindow : public Window - /* There is only one widget. */ - for (uint i = 0; i != this->paramcount; i++) SetDParam(i, this->params[i]); - -- size->width = min(GetStringBoundingBox(this->string_id).width, 194); -+ size->width = min(GetStringBoundingBox(this->string_id).width, _tooltip_width); - size->height = GetStringHeight(this->string_id, size->width); - - /* Increase slightly to have some space around the box. */ -diff --git a/src/settings_gui.h b/src/settings_gui.h -index 2ca418b..bb2a1ec 100644 ---- a/src/settings_gui.h -+++ b/src/settings_gui.h -@@ -14,8 +14,8 @@ - - #include "gfx_type.h" - --static const int SETTING_BUTTON_WIDTH = 20; ///< Width of setting buttons --static const int SETTING_BUTTON_HEIGHT = 10; ///< Height of setting buttons -+extern int SETTING_BUTTON_WIDTH; ///< Width of setting buttons -+extern int SETTING_BUTTON_HEIGHT; ///< Height of setting buttons - - void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clickable_left, bool clickable_right); - void DrawDropDownButton(int x, int y, Colours button_colour, bool state, bool clickable); -diff --git a/src/settings_type.h b/src/settings_type.h -index aa0e2a4..93b9cfb 100644 ---- a/src/settings_type.h -+++ b/src/settings_type.h -@@ -79,6 +79,7 @@ struct GUISettings { - bool vehicle_income_warn; ///< if a vehicle isn't generating income, show a warning - uint min_button; ///< min size of most button widgets - uint min_step; ///< min size of scrollbar/dropdown elements -+ bool manage_min_sizing; ///< automatically set min_button and min_step - bool show_finances; ///< show finances at end of year - bool sg_new_nonstop; ///< ttdpatch compatible nonstop handling read from pre v93 savegames - bool new_nonstop; ///< ttdpatch compatible nonstop handling -diff --git a/src/table/misc_settings.ini b/src/table/misc_settings.ini -index 0b02e69..fd0207c 100644 ---- a/src/table/misc_settings.ini -+++ b/src/table/misc_settings.ini -@@ -228,6 +228,11 @@ min = 0 - max = 100 - cat = SC_EXPERT - -+[SDTG_BOOL] -+name = ""manage_min_sizing"" -+var = _settings_client.gui.manage_min_sizing -+def = false -+ - [SDTG_VAR] - name = ""min_step_size"" - type = SLE_UINT -diff --git a/src/window.cpp b/src/window.cpp -index 903a56f..60153bc 100644 ---- a/src/window.cpp -+++ b/src/window.cpp -@@ -36,6 +36,14 @@ - #include "error.h" - #include "game/game.hpp" - #include "video/video_driver.hpp" -+#include "settings_gui.h" -+#include "fontcache.h" -+#include "error.h" -+#include "station_base.h" -+#include "waypoint_base.h" -+#include "command_func.h" -+ -+#include "table/strings.h" - - /** Values for _settings_client.gui.auto_scrolling */ - enum ViewportAutoscrolling { -@@ -1787,6 +1795,70 @@ Window *FindWindowFromPt(int x, int y) - return NULL; - } - -+int SETTING_BUTTON_WIDTH = 20; -+int SETTING_BUTTON_HEIGHT = 10; -+ -+/** -+ * Set button size of settings. If automatic sizing is also enabled, it also sets -+ * the sizing of buttons, scrollbars and font size (recommend restart). -+ * @todo Check if it can be moved to another file, so we do not need to include error, string and fontcache headers. -+ * @todo Fix magic numbers 16/18/20/30/32 -+ */ -+void CheckWindowMinSizings() -+{ -+ if (_settings_client.gui.manage_min_sizing) { -+ /* Fill the min sizing values for the current resolution. */ -+ uint swap_x = 32; // in longest border, let main toolbar to have 30 buttons. -+ uint swap_y = 16; // if short border, let main toolbar have 16/18/20 buttons..) -+ if (_cur_resolution.width < _cur_resolution.height) Swap(swap_x, swap_y); -+ _settings_client.gui.min_button = min(_cur_resolution.width / swap_x, _cur_resolution.height / swap_y); -+ _settings_client.gui.min_step = _settings_client.gui.min_button * 3 / 4; -+ } -+ -+ SETTING_BUTTON_HEIGHT = max(GetMinSizing(NWST_STEP) - 10, 10); -+ SETTING_BUTTON_WIDTH = 2 * SETTING_BUTTON_HEIGHT; -+ -+ extern uint _tooltip_width; -+ _tooltip_width = max(194, 10 * _settings_client.gui.min_button); -+ -+ if (!_settings_client.gui.manage_min_sizing) return; -+ -+ _freetype.large.size = _settings_client.gui.min_button; -+ _freetype.medium.size = max(_settings_client.gui.min_step * 2 / 3, 10U); -+ _freetype.mono.size = _freetype.medium.size; -+ _freetype.small.size = max(_freetype.medium.size * 2 / 3, 8U); -+ -+ InitFreeType(true); -+ CheckForMissingGlyphs(); -+ -+ if (_z_front_window == NULL) return; -+ -+ DeleteAllNonVitalWindows(); -+ -+ switch (_game_mode) { -+ default: break; -+ case GM_MENU: -+ DeleteWindowById(WC_SELECT_GAME, 0); -+ extern void ShowSelectGameWindow(); -+ ShowSelectGameWindow(); -+ break; -+ -+ case GM_NORMAL: -+ case GM_EDITOR: { -+ Station *st; -+ FOR_ALL_STATIONS(st) { st->UpdateVirtCoord(); } -+ Waypoint *wp; -+ FOR_ALL_WAYPOINTS(wp) { wp->UpdateVirtCoord(); } -+ -+ HideVitalWindows(); -+ ShowVitalWindows(); -+ break; -+ } -+ } -+ -+ ShowErrorMessage(STR_ERROR_RESET_WINDOWS, STR_ERROR_AUTOMATIC_SIZING, WL_WARNING); -+} -+ - /** - * (re)initialize the windowing system - */ -diff --git a/src/window_func.h b/src/window_func.h -index 453b889..a0fff7c 100644 ---- a/src/window_func.h -+++ b/src/window_func.h -@@ -29,6 +29,7 @@ int PositionNetworkChatWindow(Window *w); - int GetMainViewTop(); - int GetMainViewBottom(); - -+void CheckWindowMinSizings(); - void InitWindowSystem(); - void UnInitWindowSystem(); - void ResetWindowSystem(); --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0203-Amend-some-widgets-properties-for-high-resolution-sc.patch b/project/jni/application/openttd/0203-Amend-some-widgets-properties-for-high-resolution-sc.patch deleted file mode 100644 index 2290d82b5..000000000 --- a/project/jni/application/openttd/0203-Amend-some-widgets-properties-for-high-resolution-sc.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 2cff7802a81ee36edfb4aea23a0ebb64ece46c76 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Fri, 2 Aug 2013 18:37:51 +0000 -Subject: [PATCH 203/249] Amend some widgets properties for high resolution - screens. - ---- - src/statusbar_gui.cpp | 2 +- - src/vehicle_gui.cpp | 8 ++++---- - 2 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp -index c06976f..ed56f4b 100644 ---- a/src/statusbar_gui.cpp -+++ b/src/statusbar_gui.cpp -@@ -246,7 +246,7 @@ struct StatusBarWindow : Window { - static const NWidgetPart _nested_main_status_widgets[] = { - NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_GREY, WID_S_LEFT), SetMinimalSize(140, 12), EndContainer(), -- NWidget(WWT_PUSHBTN, COLOUR_GREY, WID_S_MIDDLE), SetMinimalSize(40, 12), SetDataTip(0x0, STR_STATUSBAR_TOOLTIP_SHOW_LAST_NEWS), SetResize(1, 0), -+ NWidget(WWT_PUSHBTN, COLOUR_GREY, WID_S_MIDDLE), SetMinimalSize(360, 12), SetDataTip(0x0, STR_STATUSBAR_TOOLTIP_SHOW_LAST_NEWS), SetResize(1, 0), - NWidget(WWT_PUSHBTN, COLOUR_GREY, WID_S_RIGHT), SetMinimalSize(140, 12), - EndContainer(), - }; diff --git a/project/jni/application/openttd/0204-Sizing-and-centering-editbox-icon.patch b/project/jni/application/openttd/0204-Sizing-and-centering-editbox-icon.patch deleted file mode 100644 index 47987ab6f..000000000 --- a/project/jni/application/openttd/0204-Sizing-and-centering-editbox-icon.patch +++ /dev/null @@ -1,48 +0,0 @@ -From c62d0c89f0c0f2630024c196e75edfcbba7c66cf Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Thu, 26 Sep 2013 11:50:14 +0000 -Subject: [PATCH 204/249] Sizing and centering editbox icon. - ---- - src/misc_gui.cpp | 4 ++-- - src/widget.cpp | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp -index dbbde57..09985d5 100644 ---- a/src/misc_gui.cpp -+++ b/src/misc_gui.cpp -@@ -746,7 +746,7 @@ void QueryString::DrawEditBox(const Window *w, int wid) const - - bool rtl = _current_text_dir == TD_RTL; - Dimension sprite_size = GetSpriteSize(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT); -- int clearbtn_width = sprite_size.width + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT; -+ int clearbtn_width = GetMinSizing(NWST_BUTTON, sprite_size.width + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT); - - int clearbtn_left = wi->pos_x + (rtl ? 0 : wi->current_x - clearbtn_width); - int clearbtn_right = wi->pos_x + (rtl ? clearbtn_width : wi->current_x) - 1; -@@ -757,7 +757,7 @@ void QueryString::DrawEditBox(const Window *w, int wid) const - int bottom = wi->pos_y + wi->current_y - 1; - - DrawFrameRect(clearbtn_left, top, clearbtn_right, bottom, wi->colour, wi->IsLowered() ? FR_LOWERED : FR_NONE); -- DrawSprite(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT, PAL_NONE, clearbtn_left + WD_IMGBTN_LEFT + (wi->IsLowered() ? 1 : 0), (top + bottom - sprite_size.height) / 2 + (wi->IsLowered() ? 1 : 0)); -+ DrawSprite(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT, PAL_NONE, Center(clearbtn_left + wi->IsLowered(), clearbtn_width, sprite_size.width), Center(top + wi->IsLowered(), bottom - top, sprite_size.height)); - if (this->text.bytes == 1) GfxFillRect(clearbtn_left + 1, top + 1, clearbtn_right - 1, bottom - 1, _colour_gradient[wi->colour & 0xF][2], FILLRECT_CHECKER); - - DrawFrameRect(left, top, right, bottom, wi->colour, FR_LOWERED | FR_DARKENED); -diff --git a/src/widget.cpp b/src/widget.cpp -index f48b033..b085be3 100644 ---- a/src/widget.cpp -+++ b/src/widget.cpp -@@ -2134,7 +2134,7 @@ NWidgetLeaf::NWidgetLeaf(WidgetType tp, Colours colour, int index, uint16 data, - - case WWT_EDITBOX: { - Dimension sprite_size = GetSpriteSize(_current_text_dir == TD_RTL ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT); -- this->SetMinimalSize(30 + sprite_size.width, sprite_size.height); -+ this->SetMinimalSize(30 + GetMinSizing(NWST_BUTTON, sprite_size.width), sprite_size.height); - this->SetFill(0, 0); - break; - } --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0205-Sizing-and-centering-on-create-scenario-window.patch b/project/jni/application/openttd/0205-Sizing-and-centering-on-create-scenario-window.patch deleted file mode 100644 index 324269a9a..000000000 --- a/project/jni/application/openttd/0205-Sizing-and-centering-on-create-scenario-window.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 5c75b2d4eb2a5353bf322054bc2897ee89642b89 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 21 Oct 2013 20:34:05 +0000 -Subject: [PATCH 205/249] Sizing and centering on create scenario window. - ---- - src/genworld_gui.cpp | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp -index 1cc26bd..ee65bef 100644 ---- a/src/genworld_gui.cpp -+++ b/src/genworld_gui.cpp -@@ -936,7 +936,9 @@ struct CreateScenarioWindow : public Window - } - *size = GetStringBoundingBox(str); - size->width += padding.width; -+ size->width = GetMinSizing(NWST_BUTTON, size->width); - size->height += padding.height; -+ size->height = GetMinSizing(NWST_BUTTON, size->height); - } - - virtual void OnClick(Point pt, int widget, int click_count) -@@ -1055,11 +1057,16 @@ static const NWidgetPart _nested_create_scenario_widgets[] = { - NWidget(NWID_SPACER), SetMinimalSize(0, 10), - /* Landscape style selection. */ - NWidget(NWID_HORIZONTAL), SetPIP(10, 3, 10), -+ NWidget(NWID_SPACER), SetFill(1, 1), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE), -+ NWidget(NWID_SPACER), SetFill(1, 1), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE), -+ NWidget(NWID_SPACER), SetFill(1, 1), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE), -+ NWidget(NWID_SPACER), SetFill(1, 1), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE), -- EndContainer(), -+ NWidget(NWID_SPACER), SetFill(1, 1), -+ EndContainer(), - NWidget(NWID_HORIZONTAL), SetPIP(10, 8, 10), - /* Green generation type buttons: 'Flat land' and 'Random land'. */ - NWidget(NWID_VERTICAL), SetPIP(10, 6, 10), --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0206-Some-amends-about-sizings.patch b/project/jni/application/openttd/0206-Some-amends-about-sizings.patch deleted file mode 100644 index 45e3d8ceb..000000000 --- a/project/jni/application/openttd/0206-Some-amends-about-sizings.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 3de38eb550cdb720ac4bc8a648cc19070c0c89f8 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Fri, 27 Sep 2013 20:38:34 +0000 -Subject: [PATCH 206/249] Some amends about sizings. - ---- - src/network/network_gui.cpp | 2 +- - src/settings_gui.cpp | 5 +++-- - src/widget.cpp | 2 +- - 3 files changed, 5 insertions(+), 4 deletions(-) - -diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp -index 6d4c38d..4f41dbb 100644 ---- a/src/network/network_gui.cpp -+++ b/src/network/network_gui.cpp -@@ -494,7 +494,7 @@ public: - switch (widget) { - case WID_NG_CONN_BTN: - *size = maxdim(GetStringBoundingBox(_lan_internet_types_dropdown[0]), GetStringBoundingBox(_lan_internet_types_dropdown[1])); -- size->width += padding.width; -+ size->width += padding.width + GetMinSizing(NWST_STEP, 11U); - size->height += padding.height; - break; - -diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp -index 74b97bc..45eeb79 100644 ---- a/src/settings_gui.cpp -+++ b/src/settings_gui.cpp -@@ -1139,8 +1139,9 @@ uint SettingEntry::Draw(GameSettings *settings_ptr, int left, int right, int bas - break; - case SEF_SUBTREE_KIND: - if (cur_row >= first_row) { -- DrawSprite((this->d.sub.folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED), PAL_NONE, rtl ? x - 8 : x, y + (SETTING_HEIGHT - 11) / 2); -- DrawString(rtl ? left : x + 12, rtl ? x - 12 : right, Center(y, SETTING_HEIGHT), this->d.sub.title); -+ Dimension d = GetSpriteSize(SPR_CIRCLE_UNFOLDED); -+ DrawSprite((this->d.sub.folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED), PAL_NONE, rtl ? x - d.width : x, Center(y, SETTING_HEIGHT, d.height)); -+ DrawString(rtl ? left : x + d.width + 2, rtl ? x - (d.width + 2) : right, Center(y, SETTING_HEIGHT), this->d.sub.title); - } - cur_row++; - if (!this->d.sub.folded) { -diff --git a/src/widget.cpp b/src/widget.cpp -index b085be3..76dc50d 100644 ---- a/src/widget.cpp -+++ b/src/widget.cpp -@@ -2346,7 +2346,7 @@ void NWidgetLeaf::SetupSmallestSize(Window *w, bool init_array) - padding = &extra; - if (this->index >= 0) w->SetStringParameters(this->index); - Dimension d2 = GetStringBoundingBox(this->widget_data); -- d2.width += extra.width; -+ d2.width += extra.width + GetMinSizing(NWST_STEP, 11U); - d2.height += extra.height; - size = maxdim(size, d2); - break; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0209-Add-scrollbars-to-tracklist-window-and-set-min-sizin.patch b/project/jni/application/openttd/0209-Add-scrollbars-to-tracklist-window-and-set-min-sizin.patch deleted file mode 100644 index be79907fa..000000000 --- a/project/jni/application/openttd/0209-Add-scrollbars-to-tracklist-window-and-set-min-sizin.patch +++ /dev/null @@ -1,379 +0,0 @@ -From 6930ad0acb5fb1bc20881fb803c894b2d93b8403 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Thu, 26 Sep 2013 10:56:20 +0000 -Subject: [PATCH 209/249] Add scrollbars to tracklist window and set min - sizing. - ---- - src/music_gui.cpp | 134 ++++++++++++++++++++++----------- - src/script/api/game/game_window.hpp.sq | 2 + - src/script/api/script_window.hpp | 8 +- - src/widgets/music_widget.h | 22 +++--- - 4 files changed, 107 insertions(+), 59 deletions(-) - -diff --git a/src/music_gui.cpp b/src/music_gui.cpp -index 896624c..26910e9 100644 ---- a/src/music_gui.cpp -+++ b/src/music_gui.cpp -@@ -290,13 +290,32 @@ static void SelectPlaylist(byte list) - } - - struct MusicTrackSelectionWindow : public Window { -+ Scrollbar *left_sb; -+ Scrollbar *right_sb; -+ -+ /** Count the number of tracks of current tracklist. */ -+ uint GetNumberOfTracksOfTracklist() const -+ { -+ uint i = 0; -+ for (; _playlists[_settings_client.music.playlist][i] > 0; i++) {} -+ return i; -+ } -+ - MusicTrackSelectionWindow(WindowDesc *desc, WindowNumber number) : Window(desc) - { -- this->InitNested(number); -+ -+ this->CreateNestedTree(); -+ this->left_sb = this->GetScrollbar(WID_MTS_LEFT_SCROLLBAR); -+ this->right_sb = this->GetScrollbar(WID_MTS_RIGHT_SCROLLBAR); -+ - this->LowerWidget(WID_MTS_LIST_LEFT); - this->LowerWidget(WID_MTS_LIST_RIGHT); - this->SetWidgetDisabledState(WID_MTS_CLEAR, _settings_client.music.playlist <= 3); - this->LowerWidget(WID_MTS_ALL + _settings_client.music.playlist); -+ this->FinishInitNested(number); -+ -+ this->left_sb->SetCount(NUM_SONGS_AVAILABLE); -+ this->right_sb->SetCount(GetNumberOfTracksOfTracklist()); - } - - virtual void SetStringParameters(int widget) const -@@ -320,6 +339,7 @@ struct MusicTrackSelectionWindow : public Window { - this->SetWidgetLoweredState(WID_MTS_ALL + i, i == _settings_client.music.playlist); - } - this->SetWidgetDisabledState(WID_MTS_CLEAR, _settings_client.music.playlist <= 3); -+ this->right_sb->SetCount(GetNumberOfTracksOfTracklist()); - this->SetDirty(); - } - -@@ -339,7 +359,8 @@ struct MusicTrackSelectionWindow : public Window { - break; - } - -- case WID_MTS_LIST_LEFT: case WID_MTS_LIST_RIGHT: { -+ case WID_MTS_LIST_LEFT: -+ case WID_MTS_LIST_RIGHT: { - Dimension d = {0, 0}; - - for (uint i = 0; i < NUM_SONGS_AVAILABLE; i++) { -@@ -349,12 +370,11 @@ struct MusicTrackSelectionWindow : public Window { - SetDParam(0, GetTrackNumber(i)); - SetDParam(1, 2); - SetDParamStr(2, GetSongName(i)); -- Dimension d2 = GetStringBoundingBox(STR_PLAYLIST_TRACK_NAME); -- d.width = max(d.width, d2.width); -- d.height += d2.height; -+ d = maxdim(d, GetStringBoundingBox(STR_PLAYLIST_TRACK_NAME)); - } -- d.width += padding.width; -- d.height += padding.height; -+ resize->height = GetMinSizing(NWST_STEP, d.height); -+ d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; -+ d.height = 10 * resize->height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; - *size = maxdim(*size, d); - break; - } -@@ -368,15 +388,17 @@ struct MusicTrackSelectionWindow : public Window { - GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_BLACK); - - int y = r.top + WD_FRAMERECT_TOP; -- for (uint i = 0; i < NUM_SONGS_AVAILABLE; i++) { -+ uint vscroll_max = min(this->left_sb->GetPosition() + this->left_sb->GetCapacity(), NUM_SONGS_AVAILABLE); -+ -+ for (uint i = this->left_sb->GetPosition(); i < vscroll_max; i++) { - const char *song_name = GetSongName(i); - if (StrEmpty(song_name)) continue; - - SetDParam(0, GetTrackNumber(i)); - SetDParam(1, 2); - SetDParamStr(2, song_name); -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_PLAYLIST_TRACK_NAME); -- y += FONT_HEIGHT_SMALL; -+ DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, Center(y, this->resize.step_height, FONT_HEIGHT_SMALL), STR_PLAYLIST_TRACK_NAME); -+ y += this->resize.step_height; - } - break; - } -@@ -385,13 +407,15 @@ struct MusicTrackSelectionWindow : public Window { - GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_BLACK); - - int y = r.top + WD_FRAMERECT_TOP; -- for (const byte *p = _playlists[_settings_client.music.playlist]; *p != 0; p++) { -- uint i = *p - 1; -- SetDParam(0, GetTrackNumber(i)); -+ uint vscroll_max = min(this->right_sb->GetPosition() + this->right_sb->GetCapacity(), this->GetNumberOfTracksOfTracklist()); -+ -+ for (uint i = this->right_sb->GetPosition(); i < vscroll_max; i++) { -+ uint j = _playlists[_settings_client.music.playlist][i] - 1; -+ SetDParam(0, GetTrackNumber(j)); - SetDParam(1, 2); -- SetDParamStr(2, GetSongName(i)); -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_PLAYLIST_TRACK_NAME); -- y += FONT_HEIGHT_SMALL; -+ SetDParamStr(2, GetSongName(j)); -+ DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, Center(y, this->resize.step_height, FONT_HEIGHT_SMALL), STR_PLAYLIST_TRACK_NAME); -+ y += this->resize.step_height; - } - break; - } -@@ -402,22 +426,22 @@ struct MusicTrackSelectionWindow : public Window { - { - switch (widget) { - case WID_MTS_LIST_LEFT: { // add to playlist -- int y = this->GetRowFromWidget(pt.y, widget, 0, FONT_HEIGHT_SMALL); -- - if (_settings_client.music.playlist < 4) return; -- if (!IsInsideMM(y, 0, BaseMusic::GetUsedSet()->num_available)) return; -+ int id_m = this->left_sb->GetScrolledRowFromWidget(pt.y, this, WID_MTS_LIST_LEFT, WD_FRAMERECT_TOP, this->resize.step_height); -+ if (!IsInsideMM(id_m, 0, BaseMusic::GetUsedSet()->num_available)) return; - - byte *p = _playlists[_settings_client.music.playlist]; - for (uint i = 0; i != NUM_SONGS_PLAYLIST - 1; i++) { - if (p[i] == 0) { - /* Find the actual song number */ - for (uint j = 0; j < NUM_SONGS_AVAILABLE; j++) { -- if (GetTrackNumber(j) == y + 1) { -+ if (GetTrackNumber(j) == id_m + 1) { - p[i] = j + 1; - break; - } - } - p[i + 1] = 0; -+ this->right_sb->SetCount(GetNumberOfTracksOfTracklist()); - this->SetDirty(); - SelectSongToPlay(); - break; -@@ -427,16 +451,16 @@ struct MusicTrackSelectionWindow : public Window { - } - - case WID_MTS_LIST_RIGHT: { // remove from playlist -- int y = this->GetRowFromWidget(pt.y, widget, 0, FONT_HEIGHT_SMALL); -- - if (_settings_client.music.playlist < 4) return; -- if (!IsInsideMM(y, 0, NUM_SONGS_PLAYLIST)) return; -+ int id_m = this->right_sb->GetScrolledRowFromWidget(pt.y, this, WID_MTS_LIST_RIGHT, WD_FRAMERECT_TOP, this->resize.step_height); -+ if (!IsInsideMM(id_m, 0, NUM_SONGS_PLAYLIST)) return; - - byte *p = _playlists[_settings_client.music.playlist]; -- for (uint i = y; i != NUM_SONGS_PLAYLIST - 1; i++) { -+ for (uint i = id_m; i != NUM_SONGS_PLAYLIST - 1; i++) { - p[i] = p[i + 1]; - } - -+ this->right_sb->SetCount(GetNumberOfTracksOfTracklist()); - this->SetDirty(); - SelectSongToPlay(); - break; -@@ -444,55 +468,74 @@ struct MusicTrackSelectionWindow : public Window { - - case WID_MTS_CLEAR: // clear - for (uint i = 0; _playlists[_settings_client.music.playlist][i] != 0; i++) _playlists[_settings_client.music.playlist][i] = 0; -+ this->right_sb->SetCount(GetNumberOfTracksOfTracklist()); - this->SetDirty(); - StopMusic(); - SelectSongToPlay(); - break; - -- case WID_MTS_ALL: case WID_MTS_OLD: case WID_MTS_NEW: -- case WID_MTS_EZY: case WID_MTS_CUSTOM1: case WID_MTS_CUSTOM2: // set playlist -+ case WID_MTS_ALL: -+ case WID_MTS_OLD: -+ case WID_MTS_NEW: -+ case WID_MTS_EZY: -+ case WID_MTS_CUSTOM1: -+ case WID_MTS_CUSTOM2: // set playlist - SelectPlaylist(widget - WID_MTS_ALL); -+ this->right_sb->SetCount(GetNumberOfTracksOfTracklist()); -+ this->SetDirty(); - StopMusic(); - SelectSongToPlay(); - break; - } - } -+ -+ virtual void OnResize() -+ { -+ this->left_sb->SetCapacityFromWidget(this, WID_MTS_LIST_LEFT); -+ this->right_sb->SetCapacityFromWidget(this, WID_MTS_LIST_RIGHT); -+ } - }; - - static const NWidgetPart _nested_music_track_selection_widgets[] = { - NWidget(NWID_HORIZONTAL), - NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_PLAYLIST_MUSIC_PROGRAM_SELECTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), -+ NWidget(WWT_DEFSIZEBOX, COLOUR_GREY), - EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY), - NWidget(NWID_HORIZONTAL), SetPIP(2, 4, 2), - /* Left panel. */ - NWidget(NWID_VERTICAL), - NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_PLAYLIST_TRACK_INDEX, STR_NULL), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_MTS_LIST_LEFT), SetMinimalSize(180, 194), SetDataTip(0x0, STR_PLAYLIST_TOOLTIP_CLICK_TO_ADD_TRACK), EndContainer(), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_MATRIX, COLOUR_GREY, WID_MTS_LIST_LEFT), SetMinimalSize(180, 100), SetMatrixDataTip(1, 0, STR_PLAYLIST_TOOLTIP_CLICK_TO_ADD_TRACK), -+ SetFill(1, 0), SetResize(1, 1), SetScrollbar(WID_MTS_LEFT_SCROLLBAR), -+ NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_MTS_LEFT_SCROLLBAR), -+ EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 2), - EndContainer(), -- /* Middle buttons. */ -- NWidget(NWID_VERTICAL), -- NWidget(NWID_SPACER), SetMinimalSize(60, 30), // Space above the first button from the title bar. -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_ALL), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_ALL, STR_MUSIC_TOOLTIP_SELECT_ALL_TRACKS_PROGRAM), -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_OLD), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_OLD_STYLE, STR_MUSIC_TOOLTIP_SELECT_OLD_STYLE_MUSIC), -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_NEW), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_NEW_STYLE, STR_MUSIC_TOOLTIP_SELECT_NEW_STYLE_MUSIC), -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_EZY), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_EZY_STREET, STR_MUSIC_TOOLTIP_SELECT_EZY_STREET_STYLE), -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_CUSTOM1), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_1, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_1_USER_DEFINED), -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_CUSTOM2), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_2, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_2_USER_DEFINED), -- NWidget(NWID_SPACER), SetMinimalSize(0, 16), // Space above 'clear' button -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_MTS_CLEAR), SetFill(1, 0), SetDataTip(STR_PLAYLIST_CLEAR, STR_PLAYLIST_TOOLTIP_CLEAR_CURRENT_PROGRAM_CUSTOM1), -- NWidget(NWID_SPACER), SetFill(0, 1), -- EndContainer(), - /* Right panel. */ - NWidget(NWID_VERTICAL), - NWidget(WWT_LABEL, COLOUR_GREY, WID_MTS_PLAYLIST), SetDataTip(STR_PLAYLIST_PROGRAM, STR_NULL), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_MTS_LIST_RIGHT), SetMinimalSize(180, 194), SetDataTip(0x0, STR_PLAYLIST_TOOLTIP_CLICK_TO_REMOVE_TRACK), EndContainer(), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_MATRIX, COLOUR_GREY, WID_MTS_LIST_RIGHT), SetMinimalSize(180, 100), SetMatrixDataTip(1, 0, STR_PLAYLIST_TOOLTIP_CLICK_TO_REMOVE_TRACK), -+ SetFill(1, 0), SetResize(1, 1), SetScrollbar(WID_MTS_RIGHT_SCROLLBAR), -+ NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_MTS_RIGHT_SCROLLBAR), -+ EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 2), - EndContainer(), - EndContainer(), - EndContainer(), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_ALL), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_ALL, STR_MUSIC_TOOLTIP_SELECT_ALL_TRACKS_PROGRAM), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_OLD), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_OLD_STYLE, STR_MUSIC_TOOLTIP_SELECT_OLD_STYLE_MUSIC), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_NEW), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_NEW_STYLE, STR_MUSIC_TOOLTIP_SELECT_NEW_STYLE_MUSIC), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_EZY), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_EZY_STREET, STR_MUSIC_TOOLTIP_SELECT_EZY_STREET_STYLE), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_CUSTOM1), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_1, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_1_USER_DEFINED), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_CUSTOM2), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_2, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_2_USER_DEFINED), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_MTS_CLEAR), SetFill(1, 0), SetDataTip(STR_PLAYLIST_CLEAR, STR_PLAYLIST_TOOLTIP_CLEAR_CURRENT_PROGRAM_CUSTOM1), -+ NWidget(WWT_RESIZEBOX, COLOUR_GREY), -+ EndContainer(), - }; - - static WindowDesc _music_track_selection_desc( -@@ -570,7 +613,7 @@ struct MusicWindow : public Window { - SetDParam(1, 2); - str = STR_MUSIC_TRACK_DIGIT; - } -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str); -+ DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, Center(r.top, r.bottom - r.top, FONT_HEIGHT_SMALL), str); - break; - } - -@@ -581,7 +624,7 @@ struct MusicWindow : public Window { - str = STR_MUSIC_TITLE_NAME; - SetDParamStr(0, GetSongName(_music_wnd_cursong - 1)); - } -- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_FROMSTRING, SA_HOR_CENTER); -+ DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, Center(r.top, r.bottom - r.top, FONT_HEIGHT_SMALL), str, TC_FROMSTRING, SA_HOR_CENTER); - break; - } - -@@ -672,7 +715,6 @@ struct MusicWindow : public Window { - SelectPlaylist(widget - WID_M_ALL); - StopMusic(); - SelectSongToPlay(); -- this->SetDirty(); - break; - } - } -@@ -737,11 +779,11 @@ static const NWidgetPart _nested_music_window_widgets[] = { - EndContainer(), - NWidget(NWID_VERTICAL), SetPadding(0, 0, 3, 3), - NWidget(WWT_LABEL, COLOUR_GREY, WID_M_TRACK), SetFill(0, 0), SetDataTip(STR_MUSIC_TRACK, STR_NULL), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_M_TRACK_NR), EndContainer(), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_M_TRACK_NR), SetFill(0, 1), EndContainer(), - EndContainer(), - NWidget(NWID_VERTICAL), SetPadding(0, 3, 3, 0), - NWidget(WWT_LABEL, COLOUR_GREY, WID_M_TRACK_TITLE), SetFill(1, 0), SetDataTip(STR_MUSIC_XTITLE, STR_NULL), -- NWidget(WWT_PANEL, COLOUR_GREY, WID_M_TRACK_NAME), SetFill(1, 0), EndContainer(), -+ NWidget(WWT_PANEL, COLOUR_GREY, WID_M_TRACK_NAME), SetFill(1, 1), EndContainer(), - EndContainer(), - NWidget(NWID_VERTICAL), - NWidget(NWID_SPACER), SetFill(0, 1), -diff --git a/src/script/api/game/game_window.hpp.sq b/src/script/api/game/game_window.hpp.sq -index 117d9c3..7a711b9 100644 ---- a/src/script/api/game/game_window.hpp.sq -+++ b/src/script/api/game/game_window.hpp.sq -@@ -673,8 +673,10 @@ void SQGSWindow_Register(Squirrel *engine) - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_VSCROLLBAR, "WID_TF_VSCROLLBAR"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_HSCROLLBAR, "WID_TF_HSCROLLBAR"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_LIST_LEFT, "WID_MTS_LIST_LEFT"); -+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_LEFT_SCROLLBAR, "WID_MTS_LEFT_SCROLLBAR"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_PLAYLIST, "WID_MTS_PLAYLIST"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_LIST_RIGHT, "WID_MTS_LIST_RIGHT"); -+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_RIGHT_SCROLLBAR, "WID_MTS_RIGHT_SCROLLBAR"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_ALL, "WID_MTS_ALL"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_OLD, "WID_MTS_OLD"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_NEW, "WID_MTS_NEW"); -diff --git a/src/script/api/script_window.hpp b/src/script/api/script_window.hpp -index 47ffaab..dce9a97 100644 ---- a/src/script/api/script_window.hpp -+++ b/src/script/api/script_window.hpp -@@ -1677,9 +1677,11 @@ public: - /* automatically generated from ../../widgets/music_widget.h */ - /** Widgets of the #MusicTrackSelectionWindow class. */ - enum MusicTrackSelectionWidgets { -- WID_MTS_LIST_LEFT = ::WID_MTS_LIST_LEFT, ///< Left button. -- WID_MTS_PLAYLIST = ::WID_MTS_PLAYLIST, ///< Playlist. -- WID_MTS_LIST_RIGHT = ::WID_MTS_LIST_RIGHT, ///< Right button. -+ WID_MTS_LIST_LEFT = ::WID_MTS_LIST_LEFT, ///< Left list. -+ WID_MTS_LEFT_SCROLLBAR = ::WID_MTS_LEFT_SCROLLBAR, ///< Scrollbar of left list. -+ WID_MTS_PLAYLIST = ::WID_MTS_PLAYLIST, ///< Playlist name. -+ WID_MTS_LIST_RIGHT = ::WID_MTS_LIST_RIGHT, ///< Right list. -+ WID_MTS_RIGHT_SCROLLBAR = ::WID_MTS_RIGHT_SCROLLBAR, ///< Scrollbar of right list. - WID_MTS_ALL = ::WID_MTS_ALL, ///< All button. - WID_MTS_OLD = ::WID_MTS_OLD, ///< Old button. - WID_MTS_NEW = ::WID_MTS_NEW, ///< New button. -diff --git a/src/widgets/music_widget.h b/src/widgets/music_widget.h -index 3a99bc6..ebd7ea0 100644 ---- a/src/widgets/music_widget.h -+++ b/src/widgets/music_widget.h -@@ -14,16 +14,18 @@ - - /** Widgets of the #MusicTrackSelectionWindow class. */ - enum MusicTrackSelectionWidgets { -- WID_MTS_LIST_LEFT, ///< Left button. -- WID_MTS_PLAYLIST, ///< Playlist. -- WID_MTS_LIST_RIGHT, ///< Right button. -- WID_MTS_ALL, ///< All button. -- WID_MTS_OLD, ///< Old button. -- WID_MTS_NEW, ///< New button. -- WID_MTS_EZY, ///< Ezy button. -- WID_MTS_CUSTOM1, ///< Custom1 button. -- WID_MTS_CUSTOM2, ///< Custom2 button. -- WID_MTS_CLEAR, ///< Clear button. -+ WID_MTS_LIST_LEFT, ///< Left list. -+ WID_MTS_LEFT_SCROLLBAR, ///< Scrollbar of left list. -+ WID_MTS_PLAYLIST, ///< Playlist name. -+ WID_MTS_LIST_RIGHT, ///< Right list. -+ WID_MTS_RIGHT_SCROLLBAR, ///< Scrollbar of right list. -+ WID_MTS_ALL, ///< All button. -+ WID_MTS_OLD, ///< Old button. -+ WID_MTS_NEW, ///< New button. -+ WID_MTS_EZY, ///< Ezy button. -+ WID_MTS_CUSTOM1, ///< Custom1 button. -+ WID_MTS_CUSTOM2, ///< Custom2 button. -+ WID_MTS_CLEAR, ///< Clear button. - }; - - /** Widgets of the #MusicWindow class. */ --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0210-Allow-calling-init-presizing-mode-from-outside-viewp.patch b/project/jni/application/openttd/0210-Allow-calling-init-presizing-mode-from-outside-viewp.patch deleted file mode 100644 index 2e04bf4a6..000000000 --- a/project/jni/application/openttd/0210-Allow-calling-init-presizing-mode-from-outside-viewp.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 8346d064a4f744de4d7600109278b094b586014a Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 24 Jun 2013 17:35:48 +0200 -Subject: [PATCH 210/249] Allow calling init presizing mode from outside - viewport.cpp. - ---- - src/tilehighlight_func.h | 1 + - src/viewport.cpp | 2 +- - 2 files changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/tilehighlight_func.h b/src/tilehighlight_func.h -index 3edef50..af44c4d 100644 ---- a/src/tilehighlight_func.h -+++ b/src/tilehighlight_func.h -@@ -25,6 +25,7 @@ void ResetObjectToPlace(); - - void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method); - void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process); -+void VpStartPreSizing(); - void VpSetPresizeRange(TileIndex from, TileIndex to); - void VpSetPlaceSizingLimit(int limit); - -diff --git a/src/viewport.cpp b/src/viewport.cpp -index a5ed41c..df686ab 100644 ---- a/src/viewport.cpp -+++ b/src/viewport.cpp -@@ -2350,7 +2350,7 @@ void VpSetPresizeRange(TileIndex from, TileIndex to) - if (distance > 1) ShowMeasurementTooltips(STR_MEASURE_LENGTH, 1, &distance, TCC_HOVER); - } - --static void VpStartPreSizing() -+void VpStartPreSizing() - { - _thd.selend.x = -1; - _special_mouse_mode = WSM_PRESIZE; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0211-Add-new-viewport-methods.patch b/project/jni/application/openttd/0211-Add-new-viewport-methods.patch deleted file mode 100644 index c247b7b62..000000000 --- a/project/jni/application/openttd/0211-Add-new-viewport-methods.patch +++ /dev/null @@ -1,81 +0,0 @@ -From d80cad8f13164deed44a14119ab7f565a0ce846f Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Tue, 18 Jun 2013 08:34:56 +0200 -Subject: [PATCH 211/249] Add new viewport methods. - ---- - src/viewport.cpp | 14 ++++++++++++-- - src/viewport_type.h | 4 ++++ - 2 files changed, 16 insertions(+), 2 deletions(-) - -diff --git a/src/viewport.cpp b/src/viewport.cpp -index df686ab..07f02af 100644 ---- a/src/viewport.cpp -+++ b/src/viewport.cpp -@@ -2313,7 +2313,9 @@ void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDrag - } - - HighLightStyle others = _thd.place_mode & ~(HT_DRAG_MASK | HT_DIR_MASK); -- if ((_thd.place_mode & HT_DRAG_MASK) == HT_RECT) { -+ if (method == VPM_SINGLE_TILE) { -+ /* Nothing to do. */ -+ } else if ((_thd.place_mode & HT_DRAG_MASK) == HT_RECT) { - _thd.place_mode = HT_SPECIAL | others; - _thd.next_drawstyle = HT_RECT | others; - } else if (_thd.place_mode & (HT_RAIL | HT_LINE)) { -@@ -2792,6 +2794,11 @@ void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method) - int limit = 0; - - switch (method) { -+ case VPM_SINGLE_TILE: -+ _thd.selstart.x = x; -+ _thd.selstart.y = y; -+ break; -+ - case VPM_X_OR_Y: // drag in X or Y direction - if (abs(sy - y) < abs(sx - x)) { - y = sy; -@@ -2950,7 +2957,9 @@ EventState VpHandlePlaceSizingDrag() - * keep the selected tool, but reset it to the original mode. */ - _special_mouse_mode = WSM_NONE; - HighLightStyle others = _thd.place_mode & ~(HT_DRAG_MASK | HT_DIR_MASK); -- if ((_thd.next_drawstyle & HT_DRAG_MASK) == HT_RECT) { -+ if (_thd.select_method == VPM_SINGLE_TILE) { -+ goto place_mouseup; -+ } else if ((_thd.next_drawstyle & HT_DRAG_MASK) == HT_RECT) { - _thd.place_mode = HT_RECT | others; - } else if (_thd.select_method & VPM_SIGNALDIRS) { - _thd.place_mode = HT_RECT | others; -@@ -2961,6 +2970,7 @@ EventState VpHandlePlaceSizingDrag() - } - SetTileSelectSize(1, 1); - -+place_mouseup: - w->OnPlaceMouseUp(_thd.select_method, _thd.select_proc, _thd.selend, TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y)); - - return ES_HANDLED; -diff --git a/src/viewport_type.h b/src/viewport_type.h -index 800c8b4..3566c41 100644 ---- a/src/viewport_type.h -+++ b/src/viewport_type.h -@@ -84,6 +84,7 @@ enum ViewportPlaceMethod { - VPM_FIX_VERTICAL = 6, ///< drag only in vertical direction - VPM_X_LIMITED = 7, ///< Drag only in X axis with limited size - VPM_Y_LIMITED = 8, ///< Drag only in Y axis with limited size -+ VPM_SINGLE_TILE = 9, ///< Drag around the screen, selecting only the end tile - VPM_RAILDIRS = 0x40, ///< all rail directions - VPM_SIGNALDIRS = 0x80, ///< similar to VMP_RAILDIRS, but with different cursor - }; -@@ -120,6 +121,9 @@ enum ViewportDragDropSelectionProcess { - DDSP_BUILD_TRUCKSTOP, ///< Road stop placement (trucks) - DDSP_REMOVE_BUSSTOP, ///< Road stop removal (buses) - DDSP_REMOVE_TRUCKSTOP, ///< Road stop removal (trucks) -+ -+ /* Single tile dragging */ -+ DDSP_SINGLE_TILE, ///< Single tile actions (build industry, town, etc.) - }; - - #endif /* VIEWPORT_TYPE_H */ --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0212-Do-actions-when-releasing-the-mouse-instead-of-when-.patch b/project/jni/application/openttd/0212-Do-actions-when-releasing-the-mouse-instead-of-when-.patch deleted file mode 100644 index dd3666b82..000000000 --- a/project/jni/application/openttd/0212-Do-actions-when-releasing-the-mouse-instead-of-when-.patch +++ /dev/null @@ -1,524 +0,0 @@ -From f84e2e304fb25277dd998a905480c2dbe4d6fa45 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 24 Jun 2013 17:34:25 +0200 -Subject: [PATCH 212/249] Do actions when releasing the mouse, instead of when - clicking: - -Build town, industry, airport, dock, lock, -buoy, aqueduct, depots, change bridge rail/road specs. ---- - src/airport_gui.cpp | 18 +++++++++---- - src/dock_gui.cpp | 75 +++++++++++++++++++++++++++++++++++++-------------- - src/industry_gui.cpp | 17 ++++++++++-- - src/rail_gui.cpp | 71 ++++++++++++++++++++++++++++++------------------ - src/road_gui.cpp | 47 ++++++++++++++++---------------- - src/terraform_gui.cpp | 23 +++++++++++----- - src/town_gui.cpp | 13 ++++++++- - 7 files changed, 180 insertions(+), 84 deletions(-) - -diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp -index 103b826..77a71d4 100644 ---- a/src/airport_gui.cpp -+++ b/src/airport_gui.cpp -@@ -99,13 +99,13 @@ struct BuildAirToolbarWindow : Window { - } - } - -- - virtual void OnPlaceObject(Point pt, TileIndex tile) - { - switch (this->last_user_action) { -- case WID_AT_AIRPORT: -- PlaceAirport(tile); -+ case WID_AT_AIRPORT: { -+ VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_BUILD_STATION); - break; -+ } - - case WID_AT_DEMOLISH: - PlaceProc_DemolishArea(tile); -@@ -122,8 +122,16 @@ struct BuildAirToolbarWindow : Window { - - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) - { -- if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) { -- GUIPlaceProcDragXY(select_proc, start_tile, end_tile); -+ if (pt.x == -1) return; -+ switch (select_proc) { -+ case DDSP_BUILD_STATION: -+ assert(start_tile == end_tile); -+ PlaceAirport(end_tile); -+ break; -+ case DDSP_DEMOLISH_AREA: -+ GUIPlaceProcDragXY(select_proc, start_tile, end_tile); -+ break; -+ default: NOT_REACHED(); - } - } - -diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp -index ca06589..86f03fc 100644 ---- a/src/dock_gui.cpp -+++ b/src/dock_gui.cpp -@@ -26,6 +26,7 @@ - #include "company_base.h" - #include "hotkeys.h" - #include "gui.h" -+#include "bridge_map.h" - - #include "widgets/dock_widget.h" - -@@ -172,33 +173,21 @@ struct BuildDocksToolbarWindow : Window { - break; - - case WID_DT_LOCK: // Build lock button -- DoCommandP(tile, 0, 0, CMD_BUILD_LOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_LOCKS), CcBuildDocks); -+ /* Reuse DDSP_REMOVE_TRUCKSTOP. */ -+ VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_REMOVE_TRUCKSTOP); - break; - - case WID_DT_DEMOLISH: // Demolish aka dynamite button - PlaceProc_DemolishArea(tile); - break; - -- case WID_DT_DEPOT: // Build depot button -- DoCommandP(tile, _ship_depot_direction, 0, CMD_BUILD_SHIP_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_SHIP_DEPOT), CcBuildDocks); -- break; -- -- case WID_DT_STATION: { // Build station button -- uint32 p2 = (uint32)INVALID_STATION << 16; // no station to join -- -- /* tile is always the land tile, so need to evaluate _thd.pos */ -- CommandContainer cmdcont = { tile, _ctrl_pressed, p2, CMD_BUILD_DOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_DOCK_HERE), CcBuildDocks, "" }; -- -- /* Determine the watery part of the dock. */ -- DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile)); -- TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile); -- -- ShowSelectStationIfNeeded(cmdcont, TileArea(tile, tile_to)); -+ case WID_DT_STATION: // Build station button -+ VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_BUILD_STATION); - break; -- } - -+ case WID_DT_DEPOT: // Build depot button - case WID_DT_BUOY: // Build buoy button -- DoCommandP(tile, 0, 0, CMD_BUILD_BUOY | CMD_MSG(STR_ERROR_CAN_T_POSITION_BUOY_HERE), CcBuildDocks); -+ VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_SINGLE_TILE); - break; - - case WID_DT_RIVER: // Build river button (in scenario editor) -@@ -206,7 +195,7 @@ struct BuildDocksToolbarWindow : Window { - break; - - case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button -- DoCommandP(tile, GetOtherAqueductEnd(tile), TRANSPORT_WATER << 15, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_AQUEDUCT_HERE), CcBuildBridge); -+ VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_BUILD_BRIDGE); - break; - - default: NOT_REACHED(); -@@ -215,7 +204,16 @@ struct BuildDocksToolbarWindow : Window { - - virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) - { -- VpSelectTilesWithMethod(pt.x, pt.y, select_method); -+ switch (last_clicked_widget) { -+ case WID_DT_BUILD_AQUEDUCT: -+ case WID_DT_LOCK: -+ case WID_DT_STATION: -+ this->OnPlacePresize(pt, TileVirtXY(pt.x, pt.y)); -+ break; -+ default: -+ VpSelectTilesWithMethod(pt.x, pt.y, select_method); -+ break; -+ } - } - - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) -@@ -231,6 +229,42 @@ struct BuildDocksToolbarWindow : Window { - case DDSP_CREATE_RIVER: - DoCommandP(end_tile, start_tile, WATER_CLASS_RIVER, CMD_BUILD_CANAL | CMD_MSG(STR_ERROR_CAN_T_PLACE_RIVERS), CcBuildCanal); - break; -+ case DDSP_BUILD_STATION: { -+ uint32 p2 = (uint32)INVALID_STATION << 16; // no station to join -+ -+ /* Tile is always the land tile, so need to evaluate _thd.pos. */ -+ CommandContainer cmdcont = { start_tile, _ctrl_pressed, p2, CMD_BUILD_DOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_DOCK_HERE), CcBuildDocks, "" }; -+ -+ //SetObjectToPlace(SPR_CURSOR_DOCK, PAL_NONE, HT_SPECIAL, this->window_class, this->window_number); -+ ShowSelectStationIfNeeded(cmdcont, TileArea(start_tile, end_tile)); -+ VpStartPreSizing(); -+ break; -+ } -+ -+ case DDSP_BUILD_BRIDGE: -+ DoCommandP(start_tile, GetOtherAqueductEnd(start_tile), TRANSPORT_WATER << 15, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_AQUEDUCT_HERE), CcBuildBridge); -+ VpStartPreSizing(); -+ break; -+ -+ case DDSP_REMOVE_TRUCKSTOP: { // Reusing for locks. -+ TileIndex middle_tile = start_tile; -+ if (start_tile != end_tile) middle_tile = TileAddByDiagDir(start_tile, DiagdirBetweenTiles(start_tile, end_tile)); -+ DoCommandP(middle_tile, 0, 0, CMD_BUILD_LOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_LOCKS), CcBuildDocks); -+ VpStartPreSizing(); -+ break; -+ } -+ -+ case DDSP_SINGLE_TILE: -+ assert(start_tile == end_tile); -+ switch (last_clicked_widget) { -+ case WID_DT_BUOY: -+ DoCommandP(end_tile, 0, 0, CMD_BUILD_BUOY | CMD_MSG(STR_ERROR_CAN_T_POSITION_BUOY_HERE), CcBuildDocks); -+ break; -+ case WID_DT_DEPOT: // Build depot button -+ DoCommandP(end_tile, _ship_depot_direction, 0, CMD_BUILD_SHIP_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_SHIP_DEPOT), CcBuildDocks); -+ break; -+ default: NOT_REACHED(); -+ } - - default: break; - } -@@ -249,6 +283,7 @@ struct BuildDocksToolbarWindow : Window { - - virtual void OnPlacePresize(Point pt, TileIndex tile_from) - { -+ if (!IsValidTile(tile_from)) return; - TileIndex tile_to = tile_from; - - if (this->last_clicked_widget == WID_DT_BUILD_AQUEDUCT) { -diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp -index 02e2b86..8c8245b 100644 ---- a/src/industry_gui.cpp -+++ b/src/industry_gui.cpp -@@ -546,6 +546,19 @@ public: - - virtual void OnPlaceObject(Point pt, TileIndex tile) - { -+ VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_SINGLE_TILE); -+ } -+ -+ virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) -+ { -+ VpSelectTilesWithMethod(pt.x, pt.y, select_method); -+ } -+ -+ virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) -+ { -+ if (pt.x == -1) return; -+ assert(end_tile == start_tile); -+ - bool success = true; - /* We do not need to protect ourselves against "Random Many Industries" in this mode */ - const IndustrySpec *indsp = GetIndustrySpec(this->selected_type); -@@ -563,14 +576,14 @@ public: - _generating_world = true; - _ignore_restrictions = true; - -- DoCommandP(tile, (InteractiveRandomRange(indsp->num_table) << 8) | this->selected_type, seed, -+ DoCommandP(end_tile, (InteractiveRandomRange(indsp->num_table) << 8) | this->selected_type, seed, - CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY), &CcBuildIndustry); - - cur_company.Restore(); - _ignore_restrictions = false; - _generating_world = false; - } else { -- success = DoCommandP(tile, (InteractiveRandomRange(indsp->num_table) << 8) | this->selected_type, seed, CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY)); -+ success = DoCommandP(end_tile, (InteractiveRandomRange(indsp->num_table) << 8) | this->selected_type, seed, CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY)); - } - - /* If an industry has been built, just reset the cursor and the system */ -diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp -index 004b47f..6b03f7e 100644 ---- a/src/rail_gui.cpp -+++ b/src/rail_gui.cpp -@@ -252,22 +252,6 @@ static void GenericPlaceSignals(TileIndex tile) - } - } - --/** -- * Start placing a rail bridge. -- * @param tile Position of the first tile of the bridge. -- * @param w Rail toolbar window. -- */ --static void PlaceRail_Bridge(TileIndex tile, Window *w) --{ -- if (IsBridgeTile(tile)) { -- TileIndex other_tile = GetOtherTunnelBridgeEnd(tile); -- Point pt = {0, 0}; -- w->OnPlaceMouseUp(VPM_X_OR_Y, DDSP_BUILD_BRIDGE, pt, other_tile, tile); -- } else { -- VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE); -- } --} -- - /** Command callback for building a tunnel */ - void CcBuildRailTunnel(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) - { -@@ -632,9 +616,7 @@ struct BuildRailToolbarWindow : Window { - break; - - case WID_RAT_BUILD_DEPOT: -- DoCommandP(tile, _cur_railtype, _build_depot_direction, -- CMD_BUILD_TRAIN_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_TRAIN_DEPOT), -- CcRailDepot); -+ VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_SINGLE_TILE); - break; - - case WID_RAT_BUILD_WAYPOINT: -@@ -650,11 +632,11 @@ struct BuildRailToolbarWindow : Window { - break; - - case WID_RAT_BUILD_BRIDGE: -- PlaceRail_Bridge(tile, this); -+ VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE); - break; - - case WID_RAT_BUILD_TUNNEL: -- DoCommandP(tile, _cur_railtype | (TRANSPORT_RAIL << 8), 0, CMD_BUILD_TUNNEL | CMD_MSG(STR_ERROR_CAN_T_BUILD_TUNNEL_HERE), CcBuildRailTunnel); -+ VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_BUILD_BRIDGE); - break; - - case WID_RAT_CONVERT_RAIL: -@@ -670,6 +652,14 @@ struct BuildRailToolbarWindow : Window { - /* no dragging if you have pressed the convert button */ - if (FindWindowById(WC_BUILD_SIGNAL, 0) != NULL && _convert_signal_button && this->IsWidgetLowered(WID_RAT_BUILD_SIGNALS)) return; - -+ switch (this->last_user_action) { -+ case WID_RAT_BUILD_TUNNEL: -+ this->OnPlacePresize(pt, TileVirtXY(pt.x, pt.y)); -+ return; -+ default: -+ break; -+ } -+ - VpSelectTilesWithMethod(pt.x, pt.y, select_method); - } - -@@ -678,9 +668,21 @@ struct BuildRailToolbarWindow : Window { - if (pt.x != -1) { - switch (select_proc) { - default: NOT_REACHED(); -+ case DDSP_PLACE_AUTOROAD: -+ assert(this->last_user_action == WID_RAT_BUILD_BRIDGE); - case DDSP_BUILD_BRIDGE: -- if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); -- ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_RAIL, _cur_railtype); -+ switch (this->last_user_action) { -+ case WID_RAT_BUILD_TUNNEL: -+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); -+ else VpStartPreSizing(); -+ DoCommandP(end_tile, _cur_railtype | (TRANSPORT_RAIL << 8), 0, CMD_BUILD_TUNNEL | CMD_MSG(STR_ERROR_CAN_T_BUILD_TUNNEL_HERE), CcBuildRailTunnel); -+ break; -+ case WID_RAT_BUILD_BRIDGE: -+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); -+ ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_RAIL, _cur_railtype); -+ break; -+ default: NOT_REACHED(); -+ } - break; - - case DDSP_PLACE_RAIL: -@@ -722,6 +724,14 @@ struct BuildRailToolbarWindow : Window { - } - } - break; -+ -+ case DDSP_SINGLE_TILE: -+ assert(end_tile == start_tile); -+ assert(last_user_action == WID_RAT_BUILD_DEPOT); -+ DoCommandP(end_tile, _cur_railtype, _build_depot_direction, -+ CMD_BUILD_TRAIN_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_TRAIN_DEPOT), -+ CcRailDepot); -+ break; - } - } - } -@@ -740,10 +750,19 @@ struct BuildRailToolbarWindow : Window { - DeleteWindowByClass(WC_BUILD_BRIDGE); - } - -- virtual void OnPlacePresize(Point pt, TileIndex tile) -+ virtual void OnPlacePresize(Point pt, TileIndex tile_from) - { -- DoCommand(tile, _cur_railtype | (TRANSPORT_RAIL << 8), 0, DC_AUTO, CMD_BUILD_TUNNEL); -- VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile); -+ TileIndex tile_to = tile_from; -+ -+ if (this->last_user_action == WID_RAT_BUILD_BRIDGE) { -+ tile_to = IsBridgeTile(tile_from) ? GetOtherBridgeEnd(tile_from) : TileVirtXY(pt.x, pt.y); -+ } else { -+ assert(this->last_user_action == WID_RAT_BUILD_TUNNEL); -+ DoCommand(tile_from, _cur_railtype | (TRANSPORT_RAIL << 8), 0, DC_AUTO, CMD_BUILD_TUNNEL); -+ tile_to = _build_tunnel_endtile == 0 ? tile_from : _build_tunnel_endtile; -+ } -+ -+ VpSetPresizeRange(tile_from, tile_to); - } - - virtual EventState OnCTRLStateChange() -diff --git a/src/road_gui.cpp b/src/road_gui.cpp -index f35a2c2..d79477d 100644 ---- a/src/road_gui.cpp -+++ b/src/road_gui.cpp -@@ -67,21 +67,6 @@ void CcPlaySound1D(const CommandCost &result, TileIndex tile, uint32 p1, uint32 - } - - /** -- * Callback to start placing a bridge. -- * @param tile Start tile of the bridge. -- */ --static void PlaceRoad_Bridge(TileIndex tile, Window *w) --{ -- if (IsBridgeTile(tile)) { -- TileIndex other_tile = GetOtherTunnelBridgeEnd(tile); -- Point pt = {0, 0}; -- w->OnPlaceMouseUp(VPM_X_OR_Y, DDSP_BUILD_BRIDGE, pt, other_tile, tile); -- } else { -- VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE); -- } --} -- --/** - * Callback executed after a build road tunnel command has been called. - * - * @param result Whether the build succeeded. -@@ -508,8 +493,7 @@ struct BuildRoadToolbarWindow : Window { - break; - - case WID_ROT_DEPOT: -- DoCommandP(tile, _cur_roadtype << 2 | _road_depot_orientation, 0, -- CMD_BUILD_ROAD_DEPOT | CMD_MSG(_road_type_infos[_cur_roadtype].err_depot), CcRoadDepot); -+ VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_SINGLE_TILE); - break; - - case WID_ROT_BUS_STATION: -@@ -521,12 +505,11 @@ struct BuildRoadToolbarWindow : Window { - break; - - case WID_ROT_BUILD_BRIDGE: -- PlaceRoad_Bridge(tile, this); -+ VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE); - break; - - case WID_ROT_BUILD_TUNNEL: -- DoCommandP(tile, RoadTypeToRoadTypes(_cur_roadtype) | (TRANSPORT_ROAD << 8), 0, -- CMD_BUILD_TUNNEL | CMD_MSG(STR_ERROR_CAN_T_BUILD_TUNNEL_HERE), CcBuildRoadTunnel); -+ VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_BUILD_BRIDGE); - break; - - default: NOT_REACHED(); -@@ -583,7 +566,6 @@ struct BuildRoadToolbarWindow : Window { - /* Set dir = Y */ - _place_road_flag |= RF_DIR_Y; - } -- - break; - - default: -@@ -599,8 +581,19 @@ struct BuildRoadToolbarWindow : Window { - switch (select_proc) { - default: NOT_REACHED(); - case DDSP_BUILD_BRIDGE: -- if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); -- ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_ROAD, RoadTypeToRoadTypes(_cur_roadtype)); -+ switch (last_started_action) { -+ case WID_ROT_BUILD_TUNNEL: -+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); -+ else VpStartPreSizing(); -+ DoCommandP(end_tile, RoadTypeToRoadTypes(_cur_roadtype) | (TRANSPORT_ROAD << 8), 0, -+ CMD_BUILD_TUNNEL | CMD_MSG(STR_ERROR_CAN_T_BUILD_TUNNEL_HERE), CcBuildRoadTunnel); -+ break; -+ case WID_ROT_BUILD_BRIDGE: -+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); -+ ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_ROAD, RoadTypeToRoadTypes(_cur_roadtype)); -+ break; -+ default: NOT_REACHED(); -+ } - break; - - case DDSP_DEMOLISH_AREA: -@@ -641,6 +634,14 @@ struct BuildRoadToolbarWindow : Window { - DoCommandP(ta.tile, ta.w | ta.h << 8, ROADSTOP_TRUCK, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_TRUCK]), CcPlaySound1D); - break; - } -+ -+ case DDSP_SINGLE_TILE: -+ /* Build depot. */ -+ assert(start_tile == end_tile); -+ assert(last_started_action == WID_ROT_DEPOT); -+ DoCommandP(start_tile, _cur_roadtype << 2 | _road_depot_orientation, 0, -+ CMD_BUILD_ROAD_DEPOT | CMD_MSG(_road_type_infos[_cur_roadtype].err_depot), CcRoadDepot); -+ break; - } - } - } -diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp -index 2524b29..95ad6da 100644 ---- a/src/terraform_gui.cpp -+++ b/src/terraform_gui.cpp -@@ -239,15 +239,9 @@ struct TerraformToolbarWindow : Window { - break; - - case WID_TT_BUY_LAND: // Buy land button -- DoCommandP(tile, OBJECT_OWNED_LAND, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_PURCHASE_THIS_LAND), CcPlaySound1E); -- break; -- - case WID_TT_PLACE_SIGN: // Place sign button -- PlaceProc_Sign(tile); -- break; -- - case WID_TT_PLACE_OBJECT: // Place object button -- PlaceProc_Object(tile); -+ VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_SINGLE_TILE); - break; - - default: NOT_REACHED(); -@@ -270,6 +264,21 @@ struct TerraformToolbarWindow : Window { - case DDSP_LEVEL_AREA: - GUIPlaceProcDragXY(select_proc, start_tile, end_tile); - break; -+ -+ case DDSP_SINGLE_TILE: -+ assert(start_tile == end_tile); -+ switch (this->last_user_action) { -+ case WID_TT_BUY_LAND: -+ DoCommandP(end_tile, OBJECT_OWNED_LAND, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_PURCHASE_THIS_LAND), CcPlaySound1E); -+ break; -+ case WID_TT_PLACE_SIGN: -+ PlaceProc_Sign(end_tile); -+ break; -+ case WID_TT_PLACE_OBJECT: -+ PlaceProc_Object(end_tile); -+ break; -+ default: NOT_REACHED(); -+ } - } - } - } -diff --git a/src/town_gui.cpp b/src/town_gui.cpp -index 944b8d7..841c70e 100644 ---- a/src/town_gui.cpp -+++ b/src/town_gui.cpp -@@ -1175,7 +1175,18 @@ public: - - virtual void OnPlaceObject(Point pt, TileIndex tile) - { -- this->ExecuteFoundTownCommand(tile, false, STR_ERROR_CAN_T_FOUND_TOWN_HERE, CcFoundTown); -+ VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_SINGLE_TILE); -+ } -+ -+ virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) -+ { -+ VpSelectTilesWithMethod(pt.x, pt.y, select_method); -+ } -+ -+ virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) -+ { -+ assert(start_tile == end_tile); -+ this->ExecuteFoundTownCommand(end_tile, false, STR_ERROR_CAN_T_FOUND_TOWN_HERE, CcFoundTown); - } - - virtual void OnPlaceObjectAbort() --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0213-Place-station-when-releasing-the-mouse.patch b/project/jni/application/openttd/0213-Place-station-when-releasing-the-mouse.patch deleted file mode 100644 index 091a5d2a6..000000000 --- a/project/jni/application/openttd/0213-Place-station-when-releasing-the-mouse.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 56281b9136b6cd5c6890baf86e369f75550647bc Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Tue, 16 Jul 2013 22:31:44 +0200 -Subject: [PATCH 213/249] Place station when releasing the mouse. - ---- - src/rail_gui.cpp | 26 ++++++++++++++++---------- - 1 file changed, 16 insertions(+), 10 deletions(-) - -diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp -index 6b03f7e..7c4b86b 100644 ---- a/src/rail_gui.cpp -+++ b/src/rail_gui.cpp -@@ -189,15 +189,7 @@ static void PlaceRail_Station(TileIndex tile) - VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION); - VpSetPlaceSizingLimit(_settings_game.station.station_spread); - } else { -- uint32 p1 = _cur_railtype | _railstation.orientation << 4 | _settings_client.gui.station_numtracks << 8 | _settings_client.gui.station_platlength << 16 | _ctrl_pressed << 24; -- uint32 p2 = _railstation.station_class | _railstation.station_type << 8 | INVALID_STATION << 16; -- -- int w = _settings_client.gui.station_numtracks; -- int h = _settings_client.gui.station_platlength; -- if (!_railstation.orientation) Swap(w, h); -- -- CommandContainer cmdcont = { tile, p1, p2, CMD_BUILD_RAIL_STATION | CMD_MSG(STR_ERROR_CAN_T_BUILD_RAILROAD_STATION), CcStation, "" }; -- ShowSelectStationIfNeeded(cmdcont, TileArea(tile, w, h)); -+ VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_BUILD_STATION); - } - } - -@@ -701,8 +693,22 @@ struct BuildRailToolbarWindow : Window { - DoCommandP(end_tile, start_tile, _cur_railtype | (_ctrl_pressed ? 0x10 : 0), CMD_CONVERT_RAIL | CMD_MSG(STR_ERROR_CAN_T_CONVERT_RAIL), CcPlaySound10); - break; - -- case DDSP_REMOVE_STATION: - case DDSP_BUILD_STATION: -+ if (!_remove_button_clicked && !_settings_client.gui.station_dragdrop) { -+ uint32 p1 = _cur_railtype | _railstation.orientation << 4 | _settings_client.gui.station_numtracks << 8 | _settings_client.gui.station_platlength << 16 | _ctrl_pressed << 24; -+ uint32 p2 = _railstation.station_class | _railstation.station_type << 8 | INVALID_STATION << 16; -+ -+ int w = _settings_client.gui.station_numtracks; -+ int h = _settings_client.gui.station_platlength; -+ if (!_railstation.orientation) Swap(w, h); -+ -+ CommandContainer cmdcont = { end_tile, p1, p2, CMD_BUILD_RAIL_STATION | CMD_MSG(STR_ERROR_CAN_T_BUILD_RAILROAD_STATION), CcStation, "" }; -+ ShowSelectStationIfNeeded(cmdcont, TileArea(end_tile, w, h)); -+ break; -+ } -+ /* Fall through. */ -+ -+ case DDSP_REMOVE_STATION: - if (this->IsWidgetLowered(WID_RAT_BUILD_STATION)) { - /* Station */ - if (_remove_button_clicked) { --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0214-Add-functions-for-cycling-inside-an-enum.patch b/project/jni/application/openttd/0214-Add-functions-for-cycling-inside-an-enum.patch deleted file mode 100644 index 5db261063..000000000 --- a/project/jni/application/openttd/0214-Add-functions-for-cycling-inside-an-enum.patch +++ /dev/null @@ -1,36 +0,0 @@ -From a31e52ce77a53313ade55af5a1674cd3fa4c05a8 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Tue, 18 Jun 2013 16:32:04 +0200 -Subject: [PATCH 214/249] Add functions for cycling inside an enum. - ---- - src/core/enum_type.hpp | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/src/core/enum_type.hpp b/src/core/enum_type.hpp -index 35a0cb2..b5a12c4 100644 ---- a/src/core/enum_type.hpp -+++ b/src/core/enum_type.hpp -@@ -28,6 +28,19 @@ - } - - -+/** Some enums need to have cycling through values */ -+#define DECLARE_CYCLE(type, min_val, max_val) \ -+ inline type CycleUp(type e) \ -+ { \ -+ assert(!((int)e < min_val || (int)e > max_val)); \ -+ return e == max_val ? (type)min_val : (type)((int)e + 1); \ -+ } \ -+ inline type CycleDown(type e) \ -+ { \ -+ assert(!((int)e < min_val || (int)e > max_val)); \ -+ return e == min_val ? (type)max_val : (type)((int)e - 1); \ -+ } -+ - - /** Operators to allow to work with enum as with type safe bit set in C++ */ - # define DECLARE_ENUM_AS_BIT_SET(mask_t) \ --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0215-Toolbar-types.patch b/project/jni/application/openttd/0215-Toolbar-types.patch deleted file mode 100644 index a97b1c1d1..000000000 --- a/project/jni/application/openttd/0215-Toolbar-types.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 5974ad304471edf7ec34ebc014f171412120a8ed Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 29 Jun 2013 19:17:27 +0200 -Subject: [PATCH 215/249] Toolbar types. - ---- - projects/openttd_vs100.vcxproj | 1 + - projects/openttd_vs100.vcxproj.filters | 3 +++ - projects/openttd_vs80.vcproj | 4 ++++ - projects/openttd_vs90.vcproj | 4 ++++ - source.list | 1 + - src/toolbar_type.h | 23 +++++++++++++++++++++++ - 6 files changed, 36 insertions(+) - create mode 100644 src/toolbar_type.h - -diff --git a/projects/openttd_vs100.vcxproj b/projects/openttd_vs100.vcxproj -index 354731a..b980c83 100644 ---- a/projects/openttd_vs100.vcxproj -+++ b/projects/openttd_vs100.vcxproj -@@ -634,6 +634,7 @@ - - - -+ - - - -diff --git a/projects/openttd_vs100.vcxproj.filters b/projects/openttd_vs100.vcxproj.filters -index e7bb03a..a30700e 100644 ---- a/projects/openttd_vs100.vcxproj.filters -+++ b/projects/openttd_vs100.vcxproj.filters -@@ -1131,6 +1131,9 @@ - - Header Files - -+ -+ Header Files -+ - - Header Files - -diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj -index a194b39..ee68720 100644 ---- a/projects/openttd_vs80.vcproj -+++ b/projects/openttd_vs80.vcproj -@@ -1811,6 +1811,10 @@ - > - - -+ -+ - -diff --git a/projects/openttd_vs90.vcproj b/projects/openttd_vs90.vcproj -index bc765a2..4fb7047 100644 ---- a/projects/openttd_vs90.vcproj -+++ b/projects/openttd_vs90.vcproj -@@ -1808,6 +1808,10 @@ - > - - -+ -+ - -diff --git a/source.list b/source.list -index 6f74b0b..fa68f60 100644 ---- a/source.list -+++ b/source.list -@@ -367,6 +367,7 @@ tilehighlight_func.h - tilehighlight_type.h - tilematrix_type.hpp - timetable.h -+toolbar_type.h - toolbar_gui.h - town.h - town_type.h -diff --git a/src/toolbar_type.h b/src/toolbar_type.h -new file mode 100644 -index 0000000..cfde179 ---- /dev/null -+++ b/src/toolbar_type.h -@@ -0,0 +1,23 @@ -+/* $Id$ */ -+ -+/* -+ * This file is part of OpenTTD. -+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. -+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . -+ */ -+ -+/** @file toolbar_type.h Types related to toolbars. */ -+ -+#ifndef TOOLBAR_TYPE_H -+#define TOOLBAR_TYPE_H -+ -+/** Types of touchscreen modes. */ -+enum TouchscreenMode { -+ TSC_NONE = 0, -+ TSC_SIMPLE, -+}; -+DECLARE_CYCLE(TouchscreenMode, TSC_NONE, TSC_SIMPLE) -+typedef SimpleTinyEnumT TouchscreenModeByte; -+ -+#endif /* TOOLBAR_TYPE_H */ --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0217-Add-a-window-for-touchscreen-devices.patch b/project/jni/application/openttd/0217-Add-a-window-for-touchscreen-devices.patch deleted file mode 100644 index fee499763..000000000 --- a/project/jni/application/openttd/0217-Add-a-window-for-touchscreen-devices.patch +++ /dev/null @@ -1,380 +0,0 @@ -From 512f1cd75f7af8d2ca769fc4aba330efdae7db73 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 24 Jun 2013 17:59:37 +0200 -Subject: [PATCH 217/249] Add a window for touchscreen devices. - ---- - src/gfx.cpp | 8 +- - src/gfx_func.h | 2 + - src/lang/english.txt | 12 +++ - src/script/api/game/game_window.hpp.sq | 6 ++ - src/script/api/script_window.hpp | 15 ++++ - src/script/api/template/template_window.hpp.sq | 2 + - src/settings.cpp | 2 +- - src/toolbar_gui.cpp | 107 +++++++++++++++++++++++++ - src/toolbar_gui.h | 2 + - src/video/sdl_v.cpp | 7 +- - src/widgets/toolbar_widget.h | 9 +++ - src/window.cpp | 1 + - src/window_type.h | 6 ++ - 13 files changed, 172 insertions(+), 7 deletions(-) - -diff --git a/src/gfx.cpp b/src/gfx.cpp -index 5c2cdc2..5b647f9 100644 ---- a/src/gfx.cpp -+++ b/src/gfx.cpp -@@ -31,11 +31,14 @@ bool _fullscreen; - CursorVars _cursor; - bool _ctrl_pressed; ///< Is Ctrl pressed? - bool _shift_pressed; ///< Is Shift pressed? -+bool _move_pressed; -+ - byte _fast_forward; - bool _left_button_down; ///< Is left mouse button pressed? - bool _left_button_clicked; ///< Is left mouse button clicked? - bool _right_button_down; ///< Is right mouse button pressed? - bool _right_button_clicked; ///< Is right mouse button clicked? -+ - DrawPixelInfo _screen; - bool _screen_disable_anim = false; ///< Disable palette animation (important for 32bpp-anim blitter during giant screenshot) - bool _exit_game; -@@ -1249,10 +1252,7 @@ void UndrawMouseCursor() - - void DrawMouseCursor() - { --#if defined(WINCE) -- /* Don't ever draw the mouse for WinCE, as we work with a stylus */ -- return; --#endif -+ if (_settings_client.gui.touchscreen_mode != 0) return; - - /* Don't draw the mouse cursor if the screen is not ready */ - if (_screen.dst_ptr == NULL) return; -diff --git a/src/gfx_func.h b/src/gfx_func.h -index 4750b3c..4a87089 100644 ---- a/src/gfx_func.h -+++ b/src/gfx_func.h -@@ -55,6 +55,8 @@ extern bool _fullscreen; - extern CursorVars _cursor; - extern bool _ctrl_pressed; ///< Is Ctrl pressed? - extern bool _shift_pressed; ///< Is Shift pressed? -+extern bool _move_pressed; -+ - extern byte _fast_forward; - - extern bool _left_button_down; -diff --git a/src/lang/english.txt b/src/lang/english.txt -index b8bdf72..9ca1c3e 100644 ---- a/src/lang/english.txt -+++ b/src/lang/english.txt -@@ -2446,6 +2446,18 @@ STR_LANDSCAPING_TOOLTIP_RAISE_A_CORNER_OF_LAND :{BLACK}Raise a - STR_LANDSCAPING_LEVEL_LAND_TOOLTIP :{BLACK}Level an area of land to the height of the first selected corner. Ctrl selects the area diagonally. Shift toggles building/showing cost estimate - STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND :{BLACK}Purchase land for future use. Shift toggles building/showing cost estimate - -+# Tablet toolbar -+STR_TABLET_X :{BLACK}X -+STR_TABLET_TOGGLE_TRANSPARENCY_TOOLTIP :{BLACK}Toggle transparency -+STR_TABLET_CLOSE :{BLACK}Supr -+STR_TABLET_CLOSE_TOOLTIP :{BLACK}Close all opened windows (except pinned ones) -+STR_TABLET_SHIFT :{BLACK}Shift -+STR_TABLET_SHIFT_TOOLTIP :{BLACK}Press it for getting an estimated cost of executing an action -+STR_TABLET_CTRL :{BLACK}Ctrl -+STR_TABLET_CTRL_TOOLTIP :{BLACK}Use it for actions that use the "CTRL" key -+STR_TABLET_MOVE :{BLACK}Move -+STR_TABLET_MOVE_TOOLTIP :{BLACK}Press it to move around viewports. No action will be executed on viewports while this is active -+ - # Object construction window - STR_OBJECT_BUILD_CAPTION :{WHITE}Object Selection - STR_OBJECT_BUILD_TOOLTIP :{BLACK}Select object to build. Shift toggles building/showing cost estimate -diff --git a/src/script/api/game/game_window.hpp.sq b/src/script/api/game/game_window.hpp.sq -index 7a711b9..f06fae3 100644 ---- a/src/script/api/game/game_window.hpp.sq -+++ b/src/script/api/game/game_window.hpp.sq -@@ -40,6 +40,7 @@ void SQGSWindow_Register(Squirrel *engine) - SQGSWindow.DefSQConst(engine, ScriptWindow::WC_MAIN_WINDOW, "WC_MAIN_WINDOW"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WC_MAIN_TOOLBAR, "WC_MAIN_TOOLBAR"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WC_STATUS_BAR, "WC_STATUS_BAR"); -+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_TABLET_BAR, "WC_TABLET_BAR"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUILD_TOOLBAR, "WC_BUILD_TOOLBAR"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SCEN_BUILD_TOOLBAR, "WC_SCEN_BUILD_TOOLBAR"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUILD_TREES, "WC_BUILD_TREES"); -@@ -1246,6 +1247,11 @@ void SQGSWindow_Register(Squirrel *engine) - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_MUSIC_SOUND, "WID_TE_MUSIC_SOUND"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_HELP, "WID_TE_HELP"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_SWITCH_BAR, "WID_TE_SWITCH_BAR"); -+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_X, "WID_TT_X"); -+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_DELETE, "WID_TT_DELETE"); -+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_SHIFT, "WID_TT_SHIFT"); -+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_CTRL, "WID_TT_CTRL"); -+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_MOVE, "WID_TT_MOVE"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_SORT_ORDER, "WID_TD_SORT_ORDER"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_SORT_CRITERIA, "WID_TD_SORT_CRITERIA"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_FILTER, "WID_TD_FILTER"); -diff --git a/src/script/api/script_window.hpp b/src/script/api/script_window.hpp -index dce9a97..a5c0684 100644 ---- a/src/script/api/script_window.hpp -+++ b/src/script/api/script_window.hpp -@@ -143,6 +143,12 @@ public: - WC_STATUS_BAR = ::WC_STATUS_BAR, - - /** -+ * Tablet bar; %Window numbers: -+ * - 0 = #StatusbarWidgets -+ */ -+ WC_TABLET_BAR = ::WC_TABLET_BAR, -+ -+ /** - * Build toolbar; %Window numbers: - * - #TRANSPORT_RAIL = #RailToolbarWidgets - * - #TRANSPORT_AIR = #AirportToolbarWidgets -@@ -2496,6 +2502,15 @@ public: - WID_TE_SWITCH_BAR = ::WID_TE_SWITCH_BAR, ///< Only available when toolbar has been split to switch between different subsets. - }; - -+ /** Widgets of the TabletToolbar class. */ -+ enum ToolbarTabletWidgets { -+ WID_TT_X = ::WID_TT_X, ///< Press X (toggle transparency). -+ WID_TT_DELETE = ::WID_TT_DELETE, ///< Press DELETE. -+ WID_TT_SHIFT = ::WID_TT_SHIFT, ///< Press SHIFT. -+ WID_TT_CTRL = ::WID_TT_CTRL, ///< Press CTRL. -+ WID_TT_MOVE = ::WID_TT_MOVE, ///< Click for moving around viewports. -+ }; -+ - /* automatically generated from ../../widgets/town_widget.h */ - /** Widgets of the #TownDirectoryWindow class. */ - enum TownDirectoryWidgets { -diff --git a/src/script/api/template/template_window.hpp.sq b/src/script/api/template/template_window.hpp.sq -index dc99b5d..27aac38 100644 ---- a/src/script/api/template/template_window.hpp.sq -+++ b/src/script/api/template/template_window.hpp.sq -@@ -229,6 +229,8 @@ namespace SQConvert { - template <> inline int Return(HSQUIRRELVM vm, ScriptWindow::ToolbarNormalWidgets res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptWindow::ToolbarEditorWidgets GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::ToolbarEditorWidgets)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptWindow::ToolbarEditorWidgets res) { sq_pushinteger(vm, (int32)res); return 1; } -+ template <> inline ScriptWindow::ToolbarTabletWidgets GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::ToolbarTabletWidgets)tmp; } -+ template <> inline int Return(HSQUIRRELVM vm, ScriptWindow::ToolbarTabletWidgets res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptWindow::TownDirectoryWidgets GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::TownDirectoryWidgets)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptWindow::TownDirectoryWidgets res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptWindow::TownAuthorityWidgets GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::TownAuthorityWidgets)tmp; } -diff --git a/src/settings.cpp b/src/settings.cpp -index fd6992d..7057d67 100644 ---- a/src/settings.cpp -+++ b/src/settings.cpp -@@ -1092,7 +1092,7 @@ static bool ZoomMinMaxChanged(int32 p1) - - static bool TouchscreenModeChanged(int32 p1) - { -- //ResetTabletWindow(); -+ ResetTabletWindow(); - return true; - } - -diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp -index 32992d9..93b5a80 100644 ---- a/src/toolbar_gui.cpp -+++ b/src/toolbar_gui.cpp -@@ -2218,6 +2218,111 @@ static WindowDesc _toolb_scen_desc( - &ScenarioEditorToolbarWindow::hotkeys - ); - -+ -+/** Tablet toolbar. */ -+struct TabletToolbar : Window { -+ -+ TabletToolbar(WindowDesc *desc) : Window(desc) -+ { -+ this->InitNested(0); -+ this->flags |= WF_STICKY; -+ ResetObjectToPlace(); -+ this->OnInvalidateData(1 << 2); // Disable widgets. -+ if (_current_text_dir == TD_RTL) { this->left = _screen.width - this->width; } -+ } -+ -+ ~TabletToolbar() { -+ _shift_pressed = false; -+ _move_pressed = false; -+ -+ if (_ctrl_pressed) { -+ _ctrl_pressed = false; -+ HandleCtrlChanged(); -+ } -+ } -+ -+ virtual void OnClick(Point pt, int widget, int click_count) -+ { -+ switch (widget) { -+ case WID_TT_X: -+ extern void ResetRestoreAllTransparency(); -+ ResetRestoreAllTransparency(); -+ break; -+ case WID_TT_DELETE: -+ DeleteNonVitalWindows(); -+ break; -+ case WID_TT_SHIFT: -+ _shift_pressed = !_shift_pressed; -+ this->ToggleWidgetLoweredState(WID_TT_SHIFT); -+ this->SetWidgetDirty(WID_TT_SHIFT); -+ break; -+ case WID_TT_CTRL: -+ _ctrl_pressed = !_ctrl_pressed; -+ this->ToggleWidgetLoweredState(WID_TT_CTRL); -+ HandleCtrlChanged(); -+ this->SetWidgetDirty(WID_TT_CTRL); -+ break; -+ case WID_TT_MOVE: -+ _move_pressed = !_move_pressed; -+ this->ToggleWidgetLoweredState(WID_TT_MOVE); -+ this->SetWidgetDirty(WID_TT_MOVE); -+ break; -+ default: -+ NOT_REACHED(); -+ } -+ } -+ -+ /** -+ * Some data on this window has become invalid. -+ * @param data Information about the changed data. -+ * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. -+ * @note bit 2 -> Update tile selection. -+ * bit 3 -> Set window dirty. -+ */ -+ virtual void OnInvalidateData(int data = 0, bool gui_scope = true) -+ { -+ /* Selection has changed. */ -+ if (HasBit(data, 2)) { UpdateTileSelection(); } -+ -+ /* This window is dirty. */ -+ if (HasBit(data, 3)) { this->SetDirty(); } -+ } -+}; -+ -+static const NWidgetPart _nested_tablet_simple_widgets[] = { -+ NWidget(NWID_VERTICAL), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TT_X), SetDataTip(STR_TABLET_X, STR_TABLET_TOGGLE_TRANSPARENCY_TOOLTIP), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TT_DELETE), SetDataTip(STR_TABLET_CLOSE, STR_TABLET_CLOSE_TOOLTIP), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_TT_SHIFT), SetDataTip(STR_TABLET_SHIFT, STR_TABLET_SHIFT_TOOLTIP), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_TT_CTRL), SetDataTip(STR_TABLET_CTRL, STR_TABLET_CTRL_TOOLTIP), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_TT_MOVE), SetDataTip(STR_TABLET_MOVE, STR_TABLET_MOVE_TOOLTIP), -+ EndContainer(), -+}; -+ -+static WindowDesc _toolbar_tablet_simple_desc( -+ WDP_AUTO, NULL, 0, 0, -+ WC_TABLET_BAR, WC_NONE, -+ WDF_NO_FOCUS, -+ _nested_tablet_simple_widgets, lengthof(_nested_tablet_simple_widgets) -+); -+ -+void ResetTabletWindow() -+{ -+ if (_game_mode == GM_MENU) return; -+ -+ DeleteWindowByClass(WC_TABLET_BAR); -+ -+ switch (_settings_client.gui.touchscreen_mode) { -+ case TSC_NONE: -+ break; -+ case TSC_SIMPLE: -+ new TabletToolbar(&_toolbar_tablet_simple_desc); -+ break; -+ default: NOT_REACHED(); -+ -+ } -+} -+ - /** Allocate the toolbar. */ - void AllocateToolbar() - { -@@ -2229,4 +2334,6 @@ void AllocateToolbar() - } else { - new MainToolbarWindow(&_toolb_normal_desc); - } -+ -+ ResetTabletWindow(); - } -diff --git a/src/toolbar_gui.h b/src/toolbar_gui.h -index d3eba5b..acfe0ed 100644 ---- a/src/toolbar_gui.h -+++ b/src/toolbar_gui.h -@@ -16,4 +16,6 @@ void AllocateToolbar(); - void ToggleBoundingBoxes(); - void ToggleDirtyBlocks(); - -+void ResetTabletWindow(); -+ - #endif /* TOOLBAR_GUI_H */ -diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp -index ba0b076..c961ad4 100644 ---- a/src/video/sdl_v.cpp -+++ b/src/video/sdl_v.cpp -@@ -23,6 +23,7 @@ - #include "../core/random_func.hpp" - #include "../core/math_func.hpp" - #include "../fileio_func.h" -+#include "../settings_type.h" - #include "sdl_v.h" - #include - -@@ -751,8 +752,10 @@ void VideoDriver_SDL::MainLoop() - - bool old_ctrl_pressed = _ctrl_pressed; - -- _ctrl_pressed = !!(mod & KMOD_CTRL); -- _shift_pressed = !!(mod & KMOD_SHIFT); -+ if (_settings_client.gui.touchscreen_mode == TSC_NONE) { -+ _ctrl_pressed = !!(mod & KMOD_CTRL); -+ _shift_pressed = !!(mod & KMOD_SHIFT); -+ } - - /* determine which directional keys are down */ - _dirkeys = -diff --git a/src/widgets/toolbar_widget.h b/src/widgets/toolbar_widget.h -index 6ede3ad..c7bac73 100644 ---- a/src/widgets/toolbar_widget.h -+++ b/src/widgets/toolbar_widget.h -@@ -75,4 +75,13 @@ enum ToolbarEditorWidgets { - WID_TE_SWITCH_BAR = WID_TN_SWITCH_BAR, ///< Only available when toolbar has been split to switch between different subsets. - }; - -+/** Widgets of the TabletToolbar class. */ -+enum ToolbarTabletWidgets { -+ WID_TT_X, ///< Press X (toggle transparency). -+ WID_TT_DELETE, ///< Press DELETE. -+ WID_TT_SHIFT, ///< Press SHIFT. -+ WID_TT_CTRL, ///< Press CTRL. -+ WID_TT_MOVE, ///< Click for moving around viewports. -+}; -+ - #endif /* WIDGETS_TOOLBAR_WIDGET_H */ -diff --git a/src/window.cpp b/src/window.cpp -index 60153bc..9b4f416 100644 ---- a/src/window.cpp -+++ b/src/window.cpp -@@ -1292,6 +1292,7 @@ static uint GetWindowZPriority(const Window *w) - ++z_priority; - - case WC_NEWS_WINDOW: -+ case WC_TABLET_BAR: - ++z_priority; - - default: -diff --git a/src/window_type.h b/src/window_type.h -index e350ff6..0e4544b 100644 ---- a/src/window_type.h -+++ b/src/window_type.h -@@ -59,6 +59,12 @@ enum WindowClass { - WC_STATUS_BAR, - - /** -+ * Tablet bar; %Window numbers: -+ * - 0 = #StatusbarWidgets -+ */ -+ WC_TABLET_BAR, -+ -+ /** - * Build toolbar; %Window numbers: - * - #TRANSPORT_RAIL = #RailToolbarWidgets - * - #TRANSPORT_AIR = #AirportToolbarWidgets --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0218-Changes-on-viewport-related-files-to-deal-with-touch.patch b/project/jni/application/openttd/0218-Changes-on-viewport-related-files-to-deal-with-touch.patch deleted file mode 100644 index e3a74d37c..000000000 --- a/project/jni/application/openttd/0218-Changes-on-viewport-related-files-to-deal-with-touch.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 72663a2c57f50dcd41eebe90c60a46e4f3ffb2b4 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 24 Jun 2013 18:07:55 +0200 -Subject: [PATCH 218/249] Changes on viewport related files to deal with - touchscreen options. - ---- - src/viewport.cpp | 3 ++- - src/window.cpp | 18 +++++++++++------- - 2 files changed, 13 insertions(+), 8 deletions(-) - -diff --git a/src/viewport.cpp b/src/viewport.cpp -index 07f02af..81a9dca 100644 ---- a/src/viewport.cpp -+++ b/src/viewport.cpp -@@ -2000,6 +2000,8 @@ static void PlaceObject() - - bool HandleViewportClicked(const ViewPort *vp, int x, int y) - { -+ if (_move_pressed) return false; -+ - const Vehicle *v = CheckClickOnVehicle(vp, x, y); - - if (_thd.place_mode & HT_VEHICLE) { -@@ -2972,7 +2974,6 @@ EventState VpHandlePlaceSizingDrag() - - place_mouseup: - w->OnPlaceMouseUp(_thd.select_method, _thd.select_proc, _thd.selend, TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y)); -- - return ES_HANDLED; - } - -diff --git a/src/window.cpp b/src/window.cpp -index 9b4f416..ec3c647 100644 ---- a/src/window.cpp -+++ b/src/window.cpp -@@ -2439,7 +2439,9 @@ static EventState HandleViewportScroll() - * outside of the window and should not left-mouse scroll anymore. */ - if (_last_scroll_window == NULL) _last_scroll_window = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y); - -- if (_last_scroll_window == NULL || !(_right_button_down || scrollwheel_scrolling || (_settings_client.gui.left_mouse_btn_scrolling && _left_button_down))) { -+ -+ if (_last_scroll_window == NULL || !(_right_button_down || scrollwheel_scrolling || -+ (_left_button_down && (_move_pressed || _settings_client.gui.left_mouse_btn_scrolling)))) { - _cursor.fix_at = false; - _scrolling_viewport = false; - _last_scroll_window = NULL; -@@ -2829,6 +2831,12 @@ static void MouseLoop(MouseClick click, int mousewheel) - * But there is no company related window open anyway, so _current_company is not used. */ - assert(HasModalProgress() || IsLocalCompany()); - -+ int x = _cursor.pos.x; -+ int y = _cursor.pos.y; -+ Window *w = FindWindowFromPt(x, y); -+ if (w == NULL) return; -+ ViewPort *vp = IsPtInWindowViewport(w, x, y); -+ - HandlePlacePresize(); - UpdateTileSelection(); - -@@ -2843,13 +2851,9 @@ static void MouseLoop(MouseClick click, int mousewheel) - bool scrollwheel_scrolling = _settings_client.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0); - if (click == MC_NONE && mousewheel == 0 && !scrollwheel_scrolling) return; - -- int x = _cursor.pos.x; -- int y = _cursor.pos.y; -- Window *w = FindWindowFromPt(x, y); - if (w == NULL) return; - -- if (click != MC_HOVER && !MaybeBringWindowToFront(w)) return; -- ViewPort *vp = IsPtInWindowViewport(w, x, y); -+ if (click != MC_NONE && click != MC_HOVER && !MaybeBringWindowToFront(w)) return; - - /* Don't allow any action in a viewport if either in menu or when having a modal progress window */ - if (vp != NULL && (_game_mode == GM_MENU || HasModalProgress())) return; -@@ -2870,7 +2874,7 @@ static void MouseLoop(MouseClick click, int mousewheel) - DEBUG(misc, 2, "Cursor: 0x%X (%d)", _cursor.sprite, _cursor.sprite); - if (!HandleViewportClicked(vp, x, y) && - !(w->flags & WF_DISABLE_VP_SCROLL) && -- _settings_client.gui.left_mouse_btn_scrolling) { -+ (_settings_client.gui.left_mouse_btn_scrolling || _move_pressed)) { - _scrolling_viewport = true; - _cursor.fix_at = false; - } --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0219-Set-construction-child-windows-to-screen-borders.patch b/project/jni/application/openttd/0219-Set-construction-child-windows-to-screen-borders.patch deleted file mode 100644 index 5626a6d1b..000000000 --- a/project/jni/application/openttd/0219-Set-construction-child-windows-to-screen-borders.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 5722b99c4b0366e4c91ff94eb3febd7ff80c249b Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Fri, 18 Oct 2013 18:52:01 +0000 -Subject: [PATCH 219/249] Set construction child windows to screen borders. - ---- - src/window.cpp | 15 +++++++++++---- - 1 file changed, 11 insertions(+), 4 deletions(-) - -diff --git a/src/window.cpp b/src/window.cpp -index ec3c647..71a8977 100644 ---- a/src/window.cpp -+++ b/src/window.cpp -@@ -1686,14 +1686,19 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int - int16 default_width = max(desc->GetDefaultWidth(), sm_width); - int16 default_height = max(desc->GetDefaultHeight(), sm_height); - -- if (desc->parent_cls != 0 /* WC_MAIN_WINDOW */ && -+ if (desc->parent_cls != WC_NONE && - (w = FindWindowById(desc->parent_cls, window_number)) != NULL && - w->left < _screen.width - 20 && w->left > -60 && w->top < _screen.height - 20) { - -- pt.x = w->left + ((desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) ? 0 : 10); -- if (pt.x > _screen.width + 10 - default_width) { -- pt.x = (_screen.width + 10 - default_width) - 20; -+ if (_settings_client.gui.touchscreen_mode != TSC_NONE) { -+ pt.x = _current_text_dir == TD_RTL ? 0 : (_screen.width - default_width); -+ } else { -+ pt.x = w->left + ((desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) ? 0 : 10); -+ if (pt.x > _screen.width + 10 - default_width) { -+ pt.x = (_screen.width + 10 - default_width) - 20; -+ } - } -+ - pt.y = w->top + ((desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) ? w->height : 10); - return pt; - } -@@ -1719,6 +1724,8 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int - NOT_REACHED(); - } - -+ // try to put it to -+ - return pt; - } - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0220-Amend-gui-s-to-work-with-touchscreen-controls.patch b/project/jni/application/openttd/0220-Amend-gui-s-to-work-with-touchscreen-controls.patch deleted file mode 100644 index 84f08a6f9..000000000 --- a/project/jni/application/openttd/0220-Amend-gui-s-to-work-with-touchscreen-controls.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 69eec94d6f79ffc1fc2a3bdb11f50d7c42172135 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 24 Jun 2013 20:32:29 +0200 -Subject: [PATCH 220/249] Amend gui's to work with touchscreen controls. - ---- - src/airport_gui.cpp | 3 +++ - src/industry_gui.cpp | 4 ++++ - src/terraform_gui.cpp | 2 ++ - src/town_gui.cpp | 4 ++++ - src/tree_gui.cpp | 8 ++++++++ - 5 files changed, 21 insertions(+) - -diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp -index 77a71d4..61c9f2d 100644 ---- a/src/airport_gui.cpp -+++ b/src/airport_gui.cpp -@@ -77,6 +77,7 @@ struct BuildAirToolbarWindow : Window { - - ~BuildAirToolbarWindow() - { -+ if (_thd.GetCallbackWnd() == this) this->OnPlaceObjectAbort(); - if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false); - } - -@@ -141,6 +142,8 @@ struct BuildAirToolbarWindow : Window { - - DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR); - DeleteWindowById(WC_SELECT_STATION, 0); -+ -+ ResetObjectToPlace(); - } - - static HotkeyList hotkeys; -diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp -index 8c8245b..3ddb3c5 100644 ---- a/src/industry_gui.cpp -+++ b/src/industry_gui.cpp -@@ -281,6 +281,10 @@ public: - this->SetButtons(); - } - -+ ~BuildIndustryWindow() { -+ if (_thd.GetCallbackWnd() == this) this->OnPlaceObjectAbort(); -+ } -+ - virtual void OnInit() - { - this->SetupArrays(); -diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp -index 95ad6da..c2d697a 100644 ---- a/src/terraform_gui.cpp -+++ b/src/terraform_gui.cpp -@@ -158,6 +158,7 @@ struct TerraformToolbarWindow : Window { - - ~TerraformToolbarWindow() - { -+ if (_thd.GetCallbackWnd() == this) this->OnPlaceObjectAbort(); - } - - virtual void OnInit() -@@ -287,6 +288,7 @@ struct TerraformToolbarWindow : Window { - { - DeleteWindowById(WC_BUILD_OBJECT, 0); - this->RaiseButtons(); -+ ResetObjectToPlace(); - } - - static HotkeyList hotkeys; -diff --git a/src/town_gui.cpp b/src/town_gui.cpp -index 841c70e..d1f9847 100644 ---- a/src/town_gui.cpp -+++ b/src/town_gui.cpp -@@ -1072,6 +1072,10 @@ public: - this->UpdateButtons(true); - } - -+ ~FoundTownWindow() { -+ if (_thd.GetCallbackWnd() == this) this->OnPlaceObjectAbort(); -+ } -+ - void RandomTownName() - { - this->townnamevalid = GenerateTownName(&this->townnameparts); -diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp -index 784f454..34c3862 100644 ---- a/src/tree_gui.cpp -+++ b/src/tree_gui.cpp -@@ -18,6 +18,7 @@ - #include "command_func.h" - #include "sound_func.h" - #include "tree_map.h" -+#include "window_func.h" - - #include "widgets/tree_widget.h" - -@@ -58,6 +59,11 @@ public: - ResetObjectToPlace(); - } - -+ ~BuildTreesWindow() -+ { -+ if (_thd.GetCallbackWnd() == this) this->OnPlaceObjectAbort(); -+ } -+ - /** - * Calculate the maximum size of all tree sprites - * @return Dimension of the largest tree sprite -@@ -166,6 +172,8 @@ public: - virtual void OnPlaceObjectAbort() - { - this->RaiseButtons(); -+ -+ ResetObjectToPlace(); - } - }; - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0221-Add-a-hotkey-for-toggling-touchscreen-mouse-control.patch b/project/jni/application/openttd/0221-Add-a-hotkey-for-toggling-touchscreen-mouse-control.patch deleted file mode 100644 index 8ba72e2bb..000000000 --- a/project/jni/application/openttd/0221-Add-a-hotkey-for-toggling-touchscreen-mouse-control.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 80ed52400f9660c715e4293d439bb6479239dba9 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 15 Jun 2013 21:43:22 +0200 -Subject: [PATCH 221/249] Add a hotkey for toggling touchscreen/mouse control. - ---- - src/main_gui.cpp | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/src/main_gui.cpp b/src/main_gui.cpp -index 350439c..59cc6f1 100644 ---- a/src/main_gui.cpp -+++ b/src/main_gui.cpp -@@ -225,6 +225,7 @@ enum { - GHK_TOGGLE_INVISIBILITY = GHK_TOGGLE_TRANSPARENCY + 9, - GHK_TRANSPARENCY_TOOLBAR = GHK_TOGGLE_INVISIBILITY + 8, - GHK_TRANSPARANCY, -+ GHK_TOUCHSCREEN, - GHK_CHAT, - GHK_CHAT_ALL, - GHK_CHAT_COMPANY, -@@ -385,6 +386,11 @@ struct MainWindow : Window - ResetRestoreAllTransparency(); - break; - -+ case GHK_TOUCHSCREEN: -+ _settings_client.gui.touchscreen_mode = CycleUp(_settings_client.gui.touchscreen_mode); // cycle through -+ ResetTabletWindow(); -+ break; -+ - #ifdef ENABLE_NETWORK - case GHK_CHAT: // smart chat; send to team if any, otherwise to all - if (_networking) { -@@ -503,6 +509,8 @@ static Hotkey global_hotkeys[] = { - Hotkey('8' | WKC_CTRL | WKC_SHIFT, "invisibility_catenary", GHK_TOGGLE_INVISIBILITY + 7), - Hotkey('X' | WKC_CTRL, "transparency_toolbar", GHK_TRANSPARENCY_TOOLBAR), - Hotkey('X', "toggle_transparency", GHK_TRANSPARANCY), -+ Hotkey('N', "toggle_touchscreen_control", GHK_TOUCHSCREEN), -+ - #ifdef ENABLE_NETWORK - Hotkey(_ghk_chat_keys, "chat", GHK_CHAT), - Hotkey(_ghk_chat_all_keys, "chat_all", GHK_CHAT_ALL), --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0222-amend-vehicle-gui.patch b/project/jni/application/openttd/0222-amend-vehicle-gui.patch deleted file mode 100644 index ee31dd034..000000000 --- a/project/jni/application/openttd/0222-amend-vehicle-gui.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 5c8d6ef18e85a2ac89b53dc18f2a787bb7a6d3ec Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Thu, 26 Sep 2013 12:11:59 +0000 -Subject: [PATCH 222/249] amend vehicle gui - ---- - src/vehicle_gui.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp -index f2748a8..a5e1b0f 100644 ---- a/src/vehicle_gui.cpp -+++ b/src/vehicle_gui.cpp -@@ -2057,6 +2057,7 @@ public: - virtual void OnResize() - { - this->vscroll->SetCapacityFromWidget(this, WID_VL_LIST); -+ this->GetWidget(WID_VL_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); - } - - /** --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0226-Settings-in-three-columns-for-tablets.patch b/project/jni/application/openttd/0226-Settings-in-three-columns-for-tablets.patch deleted file mode 100644 index eb2f2dd03..000000000 --- a/project/jni/application/openttd/0226-Settings-in-three-columns-for-tablets.patch +++ /dev/null @@ -1,123 +0,0 @@ -From 3d4004852e44550d3d194ae4e73108e5bf7ff57d Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 28 Sep 2013 15:00:43 +0000 -Subject: [PATCH 226/249] Settings in three columns for tablets. - ---- - src/settings_gui.cpp | 89 ++++++++++++++++++++++++++-------------------------- - 1 file changed, 45 insertions(+), 44 deletions(-) - -diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp -index d269348..4b180bb 100644 ---- a/src/settings_gui.cpp -+++ b/src/settings_gui.cpp -@@ -570,16 +570,6 @@ static const NWidgetPart _nested_game_options_widgets[] = { - NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_AUTOSAVE_FRAME, STR_NULL), - NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_AUTOSAVE_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP), SetFill(1, 0), - EndContainer(), -- NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_RESOLUTION, STR_NULL), -- NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_RESOLUTION_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_RESOLUTION_TOOLTIP), SetFill(1, 0), SetPadding(0, 0, 3, 0), -- NWidget(NWID_HORIZONTAL), -- NWidget(WWT_TEXT, COLOUR_GREY), SetMinimalSize(0, 12), SetFill(1, 0), SetDataTip(STR_GAME_OPTIONS_FULLSCREEN, STR_NULL), -- NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GO_FULLSCREEN_BUTTON), SetMinimalSize(21, 9), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_FULLSCREEN_TOOLTIP), -- EndContainer(), -- EndContainer(), -- EndContainer(), -- -- NWidget(NWID_VERTICAL), SetPIP(0, 6, 0), - NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_TOWN_NAMES_FRAME, STR_NULL), - NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_TOWNNAME_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_TOWN_NAMES_DROPDOWN_TOOLTIP), SetFill(1, 0), - EndContainer(), -@@ -591,44 +581,55 @@ static const NWidgetPart _nested_game_options_widgets[] = { - EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(0, 0), SetFill(0, 1), - EndContainer(), -- EndContainer(), - -- NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_BASE_GRF, STR_NULL), SetPadding(0, 10, 0, 10), -- NWidget(NWID_HORIZONTAL), SetPIP(0, 30, 0), -- NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_BASE_GRF_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_GRF_TOOLTIP), -- NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_GRF_STATUS), SetMinimalSize(150, 12), SetDataTip(STR_EMPTY, STR_NULL), SetFill(1, 0), -- EndContainer(), -- NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_GRF_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_GRF_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 6, 0), -- NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_GRF_TEXTFILE + TFT_README), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_README, STR_NULL), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_GRF_TEXTFILE + TFT_CHANGELOG), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_CHANGELOG, STR_NULL), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_GRF_TEXTFILE + TFT_LICENSE), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_LICENCE, STR_NULL), -+ NWidget(NWID_VERTICAL), SetPIP(0, 6, 0), -+ NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_RESOLUTION, STR_NULL), -+ NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_RESOLUTION_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_RESOLUTION_TOOLTIP), SetFill(1, 0), SetPadding(0, 0, 3, 0), -+ NWidget(NWID_HORIZONTAL), -+ NWidget(WWT_TEXT, COLOUR_GREY), SetMinimalSize(0, 12), SetFill(1, 0), SetDataTip(STR_GAME_OPTIONS_FULLSCREEN, STR_NULL), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GO_FULLSCREEN_BUTTON), SetMinimalSize(21, 9), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_FULLSCREEN_TOOLTIP), -+ EndContainer(), -+ EndContainer(), -+ NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_BASE_GRF, STR_NULL), -+ NWidget(NWID_HORIZONTAL), SetPIP(0, 30, 0), -+ NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_BASE_GRF_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_GRF_TOOLTIP), -+ NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_GRF_STATUS), SetMinimalSize(150, 12), SetDataTip(STR_EMPTY, STR_NULL), SetFill(1, 0), -+ EndContainer(), -+ NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_GRF_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_GRF_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 6, 0), -+ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_GRF_TEXTFILE + TFT_README), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_README, STR_NULL), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_GRF_TEXTFILE + TFT_CHANGELOG), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_CHANGELOG, STR_NULL), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_GRF_TEXTFILE + TFT_LICENSE), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_LICENCE, STR_NULL), -+ EndContainer(), -+ EndContainer(), - EndContainer(), -- EndContainer(), - -- NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_BASE_SFX, STR_NULL), SetPadding(0, 10, 0, 10), -- NWidget(NWID_HORIZONTAL), SetPIP(0, 30, 0), -- NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_BASE_SFX_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_SFX_TOOLTIP), -- NWidget(NWID_SPACER), SetFill(1, 0), -- EndContainer(), -- NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_SFX_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_SFX_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 6, 0), -- NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_SFX_TEXTFILE + TFT_README), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_README, STR_NULL), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_SFX_TEXTFILE + TFT_CHANGELOG), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_CHANGELOG, STR_NULL), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_SFX_TEXTFILE + TFT_LICENSE), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_LICENCE, STR_NULL), -- EndContainer(), -- EndContainer(), -+ NWidget(NWID_VERTICAL), SetPIP(0, 6, 0), -+ NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_BASE_SFX, STR_NULL), SetPadding(0, 10, 0, 10), -+ NWidget(NWID_HORIZONTAL), SetPIP(0, 30, 0), -+ NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_BASE_SFX_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_SFX_TOOLTIP), -+ NWidget(NWID_SPACER), SetFill(1, 0), -+ EndContainer(), -+ NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_SFX_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_SFX_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 6, 0), -+ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_SFX_TEXTFILE + TFT_README), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_README, STR_NULL), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_SFX_TEXTFILE + TFT_CHANGELOG), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_CHANGELOG, STR_NULL), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_SFX_TEXTFILE + TFT_LICENSE), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_LICENCE, STR_NULL), -+ EndContainer(), -+ EndContainer(), - -- NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_BASE_MUSIC, STR_NULL), SetPadding(0, 10, 0, 10), -- NWidget(NWID_HORIZONTAL), SetPIP(0, 30, 0), -- NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_BASE_MUSIC_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_MUSIC_TOOLTIP), -- NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_MUSIC_STATUS), SetMinimalSize(150, 12), SetDataTip(STR_EMPTY, STR_NULL), SetFill(1, 0), -- EndContainer(), -- NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_MUSIC_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 6, 0), -- NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_MUSIC_TEXTFILE + TFT_README), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_README, STR_NULL), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_MUSIC_TEXTFILE + TFT_CHANGELOG), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_CHANGELOG, STR_NULL), -- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_MUSIC_TEXTFILE + TFT_LICENSE), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_LICENCE, STR_NULL), -+ NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_BASE_MUSIC, STR_NULL), SetPadding(0, 10, 0, 10), -+ NWidget(NWID_HORIZONTAL), SetPIP(0, 30, 0), -+ NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_BASE_MUSIC_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_MUSIC_TOOLTIP), -+ NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_MUSIC_STATUS), SetMinimalSize(150, 12), SetDataTip(STR_EMPTY, STR_NULL), SetFill(1, 0), -+ EndContainer(), -+ NWidget(WWT_TEXT, COLOUR_GREY, WID_GO_BASE_MUSIC_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 6, 0), -+ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_MUSIC_TEXTFILE + TFT_README), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_README, STR_NULL), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_MUSIC_TEXTFILE + TFT_CHANGELOG), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_CHANGELOG, STR_NULL), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GO_BASE_MUSIC_TEXTFILE + TFT_LICENSE), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TEXTFILE_VIEW_LICENCE, STR_NULL), -+ EndContainer(), -+ EndContainer(), - EndContainer(), - EndContainer(), - EndContainer(), --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0227-When-clicking-the-console-and-when-in-touchscreen-mo.patch b/project/jni/application/openttd/0227-When-clicking-the-console-and-when-in-touchscreen-mo.patch deleted file mode 100644 index 73cb1f788..000000000 --- a/project/jni/application/openttd/0227-When-clicking-the-console-and-when-in-touchscreen-mo.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 738750120f21c397e32391ed04e69648dc064738 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sun, 28 Jul 2013 11:44:10 +0000 -Subject: [PATCH 227/249] When clicking the console and when in touchscreen - modes, open a query string window. - ---- - src/console_gui.cpp | 19 +++++++++++++++++++ - src/lang/english.txt | 4 ++++ - 2 files changed, 23 insertions(+) - -diff --git a/src/console_gui.cpp b/src/console_gui.cpp -index c3dcdaa..031a490 100644 ---- a/src/console_gui.cpp -+++ b/src/console_gui.cpp -@@ -22,6 +22,7 @@ - #include "console_func.h" - #include "rev.h" - #include "video/video_driver.hpp" -+#include "textbuf_gui.h" - - #include "widgets/console_widget.h" - -@@ -227,6 +228,24 @@ struct IConsoleWindow : Window - } - } - -+ virtual void OnClick(Point pt, int widget, int click_count) -+ { -+ if (_settings_client.gui.touchscreen_mode == 0) return; -+ -+ ShowQueryString(STR_EMPTY, STR_CONSOLE_QUERY_STRING, ICON_CMDLN_SIZE, -+ this, CS_ALPHANUMERAL, QSF_NONE); -+ } -+ -+ virtual void OnQueryTextFinished(char *str) -+ { -+ _focused_window = this; -+ -+ if (str == NULL) return; -+ -+ _iconsole_cmdline.Assign(str); -+ this->OnKeyPress(0, WKC_RETURN); -+ } -+ - virtual void OnHundredthTick() - { - if (IConsoleLine::Truncate() && -diff --git a/src/lang/english.txt b/src/lang/english.txt -index 9ca1c3e..be69bbb 100644 ---- a/src/lang/english.txt -+++ b/src/lang/english.txt -@@ -2664,6 +2664,10 @@ STR_LAI_OBJECT_DESCRIPTION_LIGHTHOUSE :Lighthouse - STR_LAI_OBJECT_DESCRIPTION_COMPANY_HEADQUARTERS :Company headquarters - STR_LAI_OBJECT_DESCRIPTION_COMPANY_OWNED_LAND :Company-owned land - -+# Console -+ -+STR_CONSOLE_QUERY_STRING :Enter a console command -+ - # About OpenTTD window - STR_ABOUT_OPENTTD :{WHITE}About OpenTTD - STR_ABOUT_ORIGINAL_COPYRIGHT :{BLACK}Original copyright {COPYRIGHT} 1995 Chris Sawyer, All rights reserved --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0228-Add-a-console-command-to-open-cheat-window.patch b/project/jni/application/openttd/0228-Add-a-console-command-to-open-cheat-window.patch deleted file mode 100644 index 56f53bd2a..000000000 --- a/project/jni/application/openttd/0228-Add-a-console-command-to-open-cheat-window.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 6551255ec29d75700426d5e9fbae2ef4a510c61d Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sun, 28 Jul 2013 14:21:56 +0000 -Subject: [PATCH 228/249] Add a console command to open cheat window. - ---- - src/console_cmds.cpp | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp -index 1a4ea92..11cf46b 100644 ---- a/src/console_cmds.cpp -+++ b/src/console_cmds.cpp -@@ -423,6 +423,20 @@ DEF_CONSOLE_CMD(ConListFiles) - return true; - } - -+/* Open the cheat window. */ -+DEF_CONSOLE_CMD(ConOpenCheats) -+{ -+ if (argc == 0) { -+ IConsoleHelp("Open the cheat window. Usage: 'open_cheats'"); -+ return true; -+ } -+ -+ extern void ShowCheatWindow(); -+ ShowCheatWindow(); -+ -+ return true; -+} -+ - /* Change the dir via console */ - DEF_CONSOLE_CMD(ConChangeDirectory) - { -@@ -1926,6 +1940,7 @@ void IConsoleStdLibRegister() - IConsoleCmdRegister("save", ConSave); - IConsoleCmdRegister("saveconfig", ConSaveConfig); - IConsoleCmdRegister("ls", ConListFiles); -+ IConsoleCmdRegister("open_cheats", ConOpenCheats); - IConsoleCmdRegister("cd", ConChangeDirectory); - IConsoleCmdRegister("pwd", ConPrintWorkingDirectory); - IConsoleCmdRegister("clear", ConClearBuffer); --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0230-Base-functions-for-a-confirm-action-mode.patch b/project/jni/application/openttd/0230-Base-functions-for-a-confirm-action-mode.patch deleted file mode 100644 index b45b51f06..000000000 --- a/project/jni/application/openttd/0230-Base-functions-for-a-confirm-action-mode.patch +++ /dev/null @@ -1,290 +0,0 @@ -From 77e5ea97fc6e8a7192077eb6474d8597f888c7ad Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sun, 13 Oct 2013 13:53:11 +0000 -Subject: [PATCH 230/249] Base functions for a confirm action mode. - ---- - src/command.cpp | 74 ++++++++++++++++++++++++++++++++++++++++ - src/command_func.h | 6 ++++ - src/lang/english.txt | 3 ++ - src/script/api/script_window.hpp | 1 + - src/table/settings.ini | 2 +- - src/toolbar_gui.cpp | 39 +++++++++++++++++++-- - src/toolbar_type.h | 3 +- - src/widgets/toolbar_widget.h | 1 + - 8 files changed, 125 insertions(+), 4 deletions(-) - -diff --git a/src/command.cpp b/src/command.cpp -index 1414076..53aeac1 100644 ---- a/src/command.cpp -+++ b/src/command.cpp -@@ -26,6 +26,7 @@ - #include "signal_func.h" - #include "core/backup_type.hpp" - #include "object_base.h" -+#include "string_func.h" - - #include "table/strings.h" - -@@ -531,6 +532,79 @@ bool DoCommandP(const CommandContainer *container, bool my_cmd) - return DoCommandP(container->tile, container->p1, container->p2, container->cmd, container->callback, container->text, my_cmd); - } - -+/* Stored data for a command that is waiting for user confirmation. */ -+bool _is_queued_command; -+bool _my_cmd; -+CommandContainer _queued_command; -+ -+/** -+ * Store a command that needs user confirmation. -+ * If current mode doesn't need confirmation, execute it immediately via DoCommandP. -+ * @param tile The tile to perform a command on (see #CommandProc) -+ * @param p1 Additional data for the command (see #CommandProc) -+ * @param p2 Additional data for the command (see #CommandProc) -+ * @param cmd The command to execute (a CMD_* value) -+ * @param callback A callback function to call after the command is finished -+ * @param text The text to pass -+ * @param my_cmd indicator if the command is from a company or server (to display error messages for a user) -+ * @return \c true if the command succeeded or is stored, else \c false. -+ */ -+bool TouchCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd) -+{ -+ if (_settings_client.gui.touchscreen_mode == TSC_CONFIRM && !_shift_pressed) { -+ _queued_command.tile = tile; -+ _queued_command.p1 = p1; -+ _queued_command.p2 = p2; -+ _queued_command.cmd = cmd; -+ _queued_command.callback = callback; -+ if (text != NULL) ttd_strlcpy(_queued_command.text, text, 32 * MAX_CHAR_LENGTH); -+ _my_cmd = my_cmd; -+ _is_queued_command = true; -+ extern void UpdateTouchscreenBar(); -+ UpdateTouchscreenBar(); -+ return true; -+ } else { -+ return DoCommandP(tile, p1, p2, cmd, callback, text, my_cmd); -+ } -+} -+ -+/** -+ * Shortcut for the long TouchCommandP when having a container with the data. -+ * Store a command that needs user confirmation. -+ * If current mode doesn't need confirmation, execute it immediately via DoCommandP. -+ * @param container the container with information. -+ * @param my_cmd indicator if the command is from a company or server (to display error messages for a user) -+ * @return true if the command succeeded or when it is stored, else false -+ */ -+bool TouchCommandP(const CommandContainer *container, bool my_cmd) -+{ -+ return TouchCommandP(container->tile, container->p1, container->p2, container->cmd, container->callback, container->text, my_cmd); -+} -+ -+/** Return whether there is a command stored waiting for confirmation. */ -+bool IsQueuedTouchCommand() -+{ -+ return _is_queued_command; -+} -+ -+/** Execute a stored command. Keep it when asking for estimated cost. */ -+bool DoQueuedTouchCommand() -+{ -+ bool result = DoCommandP(&_queued_command, _my_cmd); -+ if (!_shift_pressed && result) EraseQueuedTouchCommand(); -+ return result; -+} -+ -+/** Erase a stored command and update viewport and touchscreen bar. */ -+void EraseQueuedTouchCommand() -+{ -+ if (!IsQueuedTouchCommand()) return; -+ _is_queued_command = false; -+ extern void UpdateTouchscreenBar(); -+ UpdateTouchscreenBar(); -+ //reset selection of tiles -+} -+ - /*! - * Toplevel network safe docommand function for the current company. Must not be called recursively. - * The callback is called when the command succeeded or failed. The parameters -diff --git a/src/command_func.h b/src/command_func.h -index c4cc51e..ab9fb05 100644 ---- a/src/command_func.h -+++ b/src/command_func.h -@@ -40,6 +40,12 @@ CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags); - bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback = NULL, const char *text = NULL, bool my_cmd = true); - bool DoCommandP(const CommandContainer *container, bool my_cmd = true); - -+bool TouchCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback = NULL, const char *text = NULL, bool my_cmd = true); -+bool TouchCommandP(const CommandContainer *container, bool my_cmd = true); -+bool IsQueuedTouchCommand(); -+bool DoQueuedTouchCommand(); -+void EraseQueuedTouchCommand(); -+ - CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd, bool estimate_only); - - #ifdef ENABLE_NETWORK -diff --git a/src/lang/english.txt b/src/lang/english.txt -index be69bbb..49de7b3 100644 ---- a/src/lang/english.txt -+++ b/src/lang/english.txt -@@ -1187,6 +1187,7 @@ STR_CONFIG_SETTING_TOUCHSCREEN_MODE :Control mode fo - STR_CONFIG_SETTING_TOUCHSCREEN_MODE_HELPTEXT :If playing with a mouse, choose no adaptation. Other modes are for touchscreen devices. Associated hotkey: N - STR_CONFIG_SETTING_TOUCHSCREEN_NONE :no adaptation - STR_CONFIG_SETTING_TOUCHSCREEN_SIMPLE :simple -+STR_CONFIG_SETTING_TOUCHSCREEN_CONFIRM :confirm - STR_CONFIG_SETTING_SHOWFINANCES :Show finances window at the end of the year: {STRING2} - STR_CONFIG_SETTING_SHOWFINANCES_HELPTEXT :If enabled, the finances window pops up at the end of each year to allow easy inspection of the financial status of the company - STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT :New orders are 'non-stop' by default: {STRING2} -@@ -2457,6 +2458,8 @@ STR_TABLET_CTRL :{BLACK}Ctrl - STR_TABLET_CTRL_TOOLTIP :{BLACK}Use it for actions that use the "CTRL" key - STR_TABLET_MOVE :{BLACK}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_TOOLTIP :{BLACK}Press it to confirm an action - - # Object construction window - STR_OBJECT_BUILD_CAPTION :{WHITE}Object Selection -diff --git a/src/script/api/script_window.hpp b/src/script/api/script_window.hpp -index a5c0684..af43ce5 100644 ---- a/src/script/api/script_window.hpp -+++ b/src/script/api/script_window.hpp -@@ -2509,6 +2509,7 @@ public: - WID_TT_SHIFT = ::WID_TT_SHIFT, ///< Press SHIFT. - WID_TT_CTRL = ::WID_TT_CTRL, ///< Press CTRL. - WID_TT_MOVE = ::WID_TT_MOVE, ///< Click for moving around viewports. -+ WID_TT_CONFIRM = ::WID_TT_CONFIRM, ///< Confirm action. - }; - - /* automatically generated from ../../widgets/town_widget.h */ -diff --git a/src/table/settings.ini b/src/table/settings.ini -index 781f2b2..6514108 100644 ---- a/src/table/settings.ini -+++ b/src/table/settings.ini -@@ -2515,7 +2515,7 @@ type = SLE_UINT8 - guiflags = SGF_MULTISTRING - def = 0 - min = 0 --max = 1 -+max = 2 - interval = 1 - str = STR_CONFIG_SETTING_TOUCHSCREEN_MODE - strval = STR_CONFIG_SETTING_TOUCHSCREEN_NONE -diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp -index 93b5a80..7ef8511 100644 ---- a/src/toolbar_gui.cpp -+++ b/src/toolbar_gui.cpp -@@ -2267,6 +2267,9 @@ struct TabletToolbar : Window { - this->ToggleWidgetLoweredState(WID_TT_MOVE); - this->SetWidgetDirty(WID_TT_MOVE); - break; -+ case WID_TT_CONFIRM: -+ DoQueuedTouchCommand(); -+ break; - default: - NOT_REACHED(); - } -@@ -2285,7 +2288,10 @@ struct TabletToolbar : Window { - if (HasBit(data, 2)) { UpdateTileSelection(); } - - /* This window is dirty. */ -- if (HasBit(data, 3)) { this->SetDirty(); } -+ if (HasBit(data, 3)) { -+ SetWidgetDisabledState(WID_TT_CONFIRM, !IsQueuedTouchCommand()); -+ this->SetWidgetDirty(WID_TT_CONFIRM); -+ } - } - }; - -@@ -2299,6 +2305,17 @@ static const NWidgetPart _nested_tablet_simple_widgets[] = { - EndContainer(), - }; - -+static const NWidgetPart _nested_tablet_confirm_widgets[] = { -+ NWidget(NWID_VERTICAL), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TT_X), SetDataTip(STR_TABLET_X, STR_TABLET_TOGGLE_TRANSPARENCY_TOOLTIP), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TT_DELETE), SetDataTip(STR_TABLET_CLOSE, STR_TABLET_CLOSE_TOOLTIP), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_TT_SHIFT), SetDataTip(STR_TABLET_SHIFT, STR_TABLET_SHIFT_TOOLTIP), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_TT_CTRL), SetDataTip(STR_TABLET_CTRL, STR_TABLET_CTRL_TOOLTIP), -+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_TT_MOVE), SetDataTip(STR_TABLET_MOVE, STR_TABLET_MOVE_TOOLTIP), -+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TT_CONFIRM), SetDataTip(STR_TABLET_CONFIRM, STR_TABLET_CONFIRM_TOOLTIP), -+ EndContainer(), -+}; -+ - static WindowDesc _toolbar_tablet_simple_desc( - WDP_AUTO, NULL, 0, 0, - WC_TABLET_BAR, WC_NONE, -@@ -2306,11 +2323,19 @@ static WindowDesc _toolbar_tablet_simple_desc( - _nested_tablet_simple_widgets, lengthof(_nested_tablet_simple_widgets) - ); - -+static WindowDesc _toolbar_tablet_confirm_desc( -+ WDP_AUTO, NULL, 0, 0, -+ WC_TABLET_BAR, WC_NONE, -+ WDF_NO_FOCUS, -+ _nested_tablet_confirm_widgets, lengthof(_nested_tablet_confirm_widgets) -+); -+ - void ResetTabletWindow() - { - if (_game_mode == GM_MENU) return; - - DeleteWindowByClass(WC_TABLET_BAR); -+ EraseQueuedTouchCommand(); - - switch (_settings_client.gui.touchscreen_mode) { - case TSC_NONE: -@@ -2318,9 +2343,14 @@ void ResetTabletWindow() - case TSC_SIMPLE: - new TabletToolbar(&_toolbar_tablet_simple_desc); - break; -+ case TSC_CONFIRM: -+ new TabletToolbar(&_toolbar_tablet_confirm_desc); -+ InvalidateWindowData(WC_TABLET_BAR, 0, 1 << 3); -+ break; - default: NOT_REACHED(); -- - } -+ -+ MarkWholeScreenDirty(); - } - - /** Allocate the toolbar. */ -@@ -2337,3 +2367,8 @@ void AllocateToolbar() - - ResetTabletWindow(); - } -+ -+void UpdateTouchscreenBar() -+{ -+ InvalidateWindowData(WC_TABLET_BAR, 0, 1 << 3); -+} -diff --git a/src/toolbar_type.h b/src/toolbar_type.h -index cfde179..682cf2f 100644 ---- a/src/toolbar_type.h -+++ b/src/toolbar_type.h -@@ -16,8 +16,9 @@ - enum TouchscreenMode { - TSC_NONE = 0, - TSC_SIMPLE, -+ TSC_CONFIRM, - }; --DECLARE_CYCLE(TouchscreenMode, TSC_NONE, TSC_SIMPLE) -+DECLARE_CYCLE(TouchscreenMode, TSC_NONE, TSC_CONFIRM) - typedef SimpleTinyEnumT TouchscreenModeByte; - - #endif /* TOOLBAR_TYPE_H */ -diff --git a/src/widgets/toolbar_widget.h b/src/widgets/toolbar_widget.h -index c7bac73..4399b5d 100644 ---- a/src/widgets/toolbar_widget.h -+++ b/src/widgets/toolbar_widget.h -@@ -82,6 +82,7 @@ enum ToolbarTabletWidgets { - WID_TT_SHIFT, ///< Press SHIFT. - WID_TT_CTRL, ///< Press CTRL. - WID_TT_MOVE, ///< Click for moving around viewports. -+ WID_TT_CONFIRM, ///< Confirm action. - }; - - #endif /* WIDGETS_TOOLBAR_WIDGET_H */ --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0231-Set-selection-tiles-dirty-when-erasing-a-queued-comm.patch b/project/jni/application/openttd/0231-Set-selection-tiles-dirty-when-erasing-a-queued-comm.patch deleted file mode 100644 index 31c4aefac..000000000 --- a/project/jni/application/openttd/0231-Set-selection-tiles-dirty-when-erasing-a-queued-comm.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 824f296d4c9faa9e6a50806270241e90f2a69c8a Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 14 Oct 2013 17:55:30 +0000 -Subject: [PATCH 231/249] Set selection tiles dirty when erasing a queued - command. - ---- - src/command.cpp | 4 +++- - src/tilehighlight_func.h | 1 + - src/viewport.cpp | 2 +- - 3 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/src/command.cpp b/src/command.cpp -index 53aeac1..02720ce 100644 ---- a/src/command.cpp -+++ b/src/command.cpp -@@ -27,6 +27,7 @@ - #include "core/backup_type.hpp" - #include "object_base.h" - #include "string_func.h" -+#include "tilehighlight_func.h" - - #include "table/strings.h" - -@@ -602,7 +603,8 @@ void EraseQueuedTouchCommand() - _is_queued_command = false; - extern void UpdateTouchscreenBar(); - UpdateTouchscreenBar(); -- //reset selection of tiles -+ SetSelectionTilesDirty(); -+ _thd.Reset(); - } - - /*! -diff --git a/src/tilehighlight_func.h b/src/tilehighlight_func.h -index af44c4d..ac15672 100644 ---- a/src/tilehighlight_func.h -+++ b/src/tilehighlight_func.h -@@ -30,6 +30,7 @@ void VpSetPresizeRange(TileIndex from, TileIndex to); - void VpSetPlaceSizingLimit(int limit); - - void UpdateTileSelection(); -+void SetSelectionTilesDirty(); - - extern TileHighlightData _thd; - -diff --git a/src/viewport.cpp b/src/viewport.cpp -index 81a9dca..95aecf3 100644 ---- a/src/viewport.cpp -+++ b/src/viewport.cpp -@@ -1766,7 +1766,7 @@ void MarkTileDirtyByTile(TileIndex tile) - * - * @ingroup dirty - */ --static void SetSelectionTilesDirty() -+void SetSelectionTilesDirty() - { - int x_size = _thd.size.x; - int y_size = _thd.size.y; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0232-Set-dirty-selection-tiles-when-bridge-is-too-long-to.patch b/project/jni/application/openttd/0232-Set-dirty-selection-tiles-when-bridge-is-too-long-to.patch deleted file mode 100644 index 74ae8f823..000000000 --- a/project/jni/application/openttd/0232-Set-dirty-selection-tiles-when-bridge-is-too-long-to.patch +++ /dev/null @@ -1,34 +0,0 @@ -From a6bea6f5e2c2629593dc232b960685e0dc491196 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 14 Oct 2013 17:58:51 +0000 -Subject: [PATCH 232/249] Set dirty selection tiles when bridge is too long to - build. - ---- - src/bridge_gui.cpp | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp -index 78e7ff8..9ce304f 100644 ---- a/src/bridge_gui.cpp -+++ b/src/bridge_gui.cpp -@@ -24,6 +24,7 @@ - #include "cmd_helper.h" - #include "tunnelbridge_map.h" - #include "road_gui.h" -+#include "tilehighlight_func.h" - - #include "widgets/bridge_widget.h" - -@@ -429,6 +430,8 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo - new BuildBridgeWindow(&_build_bridge_desc, start, end, type, bl); - } else { - delete bl; -+ SetSelectionTilesDirty(); -+ _thd.Reset(); - ShowErrorMessage(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE, errmsg, WL_INFO, TileX(end) * TILE_SIZE, TileY(end) * TILE_SIZE); - } - } --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0233-Adaptation-of-viewport-for-confirm-mode.patch b/project/jni/application/openttd/0233-Adaptation-of-viewport-for-confirm-mode.patch deleted file mode 100644 index 0e14eeef0..000000000 --- a/project/jni/application/openttd/0233-Adaptation-of-viewport-for-confirm-mode.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 46160c673718e5a287e46470ce450df24634ebb2 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Fri, 25 Oct 2013 17:26:13 +0000 -Subject: [PATCH 233/249] Adaptation of viewport for confirm mode. - ---- - src/script/api/game/game_window.hpp.sq | 1 + - src/window.cpp | 16 +++++++++++----- - 2 files changed, 12 insertions(+), 5 deletions(-) - -diff --git a/src/script/api/game/game_window.hpp.sq b/src/script/api/game/game_window.hpp.sq -index f06fae3..6d87c22 100644 ---- a/src/script/api/game/game_window.hpp.sq -+++ b/src/script/api/game/game_window.hpp.sq -@@ -1252,6 +1252,7 @@ void SQGSWindow_Register(Squirrel *engine) - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_SHIFT, "WID_TT_SHIFT"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_CTRL, "WID_TT_CTRL"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_MOVE, "WID_TT_MOVE"); -+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_CONFIRM, "WID_TT_CONFIRM"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_SORT_ORDER, "WID_TD_SORT_ORDER"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_SORT_CRITERIA, "WID_TD_SORT_CRITERIA"); - SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_FILTER, "WID_TD_FILTER"); -diff --git a/src/window.cpp b/src/window.cpp -index 71a8977..b783125 100644 ---- a/src/window.cpp -+++ b/src/window.cpp -@@ -2843,9 +2843,18 @@ static void MouseLoop(MouseClick click, int mousewheel) - Window *w = FindWindowFromPt(x, y); - if (w == NULL) return; - ViewPort *vp = IsPtInWindowViewport(w, x, y); -+ bool confirm = (_settings_client.gui.touchscreen_mode == TSC_CONFIRM); - -- HandlePlacePresize(); -- UpdateTileSelection(); -+ /* Don't allow any action in a viewport if either in menu or when having a modal progress window */ -+ if (vp != NULL && (_game_mode == GM_MENU || HasModalProgress())) return; -+ -+ /* On confirm mode do not update tile selection unless we are clicking on a viewport. */ -+ if (!confirm || (vp != NULL && _left_button_down && !_move_pressed)) { -+ HandlePlacePresize(); -+ UpdateTileSelection(); -+ } else { -+ //if presize, show tooltip if needed -+ } - - if (VpHandlePlaceSizingDrag() == ES_HANDLED) return; - if (HandleMouseDragDrop() == ES_HANDLED) return; -@@ -2862,9 +2871,6 @@ static void MouseLoop(MouseClick click, int mousewheel) - - if (click != MC_NONE && click != MC_HOVER && !MaybeBringWindowToFront(w)) return; - -- /* Don't allow any action in a viewport if either in menu or when having a modal progress window */ -- if (vp != NULL && (_game_mode == GM_MENU || HasModalProgress())) return; -- - if (mousewheel != 0) { - /* Send mousewheel event to window */ - w->OnMouseWheel(mousewheel); --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0234-Select-the-actions-that-will-need-confirmation.patch b/project/jni/application/openttd/0234-Select-the-actions-that-will-need-confirmation.patch deleted file mode 100644 index 909efb50e..000000000 --- a/project/jni/application/openttd/0234-Select-the-actions-that-will-need-confirmation.patch +++ /dev/null @@ -1,322 +0,0 @@ -From 6fc82e66b6f24cc97de9f7f923c48dd9dcdd08ff Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sun, 13 Oct 2013 13:46:59 +0000 -Subject: [PATCH 234/249] Select the actions that will need confirmation. - ---- - src/bridge_gui.cpp | 2 +- - src/company_gui.cpp | 2 +- - src/dock_gui.cpp | 12 ++++++------ - src/object_gui.cpp | 2 +- - src/rail_gui.cpp | 20 ++++++++++---------- - src/road_gui.cpp | 10 +++++----- - src/station_gui.cpp | 2 +- - src/terraform_gui.cpp | 14 +++++++------- - src/tree_gui.cpp | 2 +- - 9 files changed, 33 insertions(+), 33 deletions(-) - -diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp -index 9ce304f..6834359 100644 ---- a/src/bridge_gui.cpp -+++ b/src/bridge_gui.cpp -@@ -383,7 +383,7 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo - default: break; // water ways and air routes don't have bridge types - } - if (_ctrl_pressed && CheckBridgeAvailability(last_bridge_type, bridge_len).Succeeded()) { -- DoCommandP(end, start, type | last_bridge_type, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE), CcBuildBridge); -+ TouchCommandP(end, start, type | last_bridge_type, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE), CcBuildBridge); - return; - } - -diff --git a/src/company_gui.cpp b/src/company_gui.cpp -index 3be6dec..498d3df 100644 ---- a/src/company_gui.cpp -+++ b/src/company_gui.cpp -@@ -2366,7 +2366,7 @@ struct CompanyWindow : Window - - virtual void OnPlaceObject(Point pt, TileIndex tile) - { -- if (DoCommandP(tile, OBJECT_HQ, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS))) { -+ if (TouchCommandP(tile, OBJECT_HQ, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS))) { - ResetObjectToPlace(); - this->RaiseButtons(); - } -diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp -index 86f03fc..460ae57 100644 ---- a/src/dock_gui.cpp -+++ b/src/dock_gui.cpp -@@ -224,10 +224,10 @@ struct BuildDocksToolbarWindow : Window { - GUIPlaceProcDragXY(select_proc, start_tile, end_tile); - break; - case DDSP_CREATE_WATER: -- DoCommandP(end_tile, start_tile, (_game_mode == GM_EDITOR && _ctrl_pressed) ? WATER_CLASS_SEA : WATER_CLASS_CANAL, CMD_BUILD_CANAL | CMD_MSG(STR_ERROR_CAN_T_BUILD_CANALS), CcBuildCanal); -+ TouchCommandP(end_tile, start_tile, (_game_mode == GM_EDITOR && _ctrl_pressed) ? WATER_CLASS_SEA : WATER_CLASS_CANAL, CMD_BUILD_CANAL | CMD_MSG(STR_ERROR_CAN_T_BUILD_CANALS), CcBuildCanal); - break; - case DDSP_CREATE_RIVER: -- DoCommandP(end_tile, start_tile, WATER_CLASS_RIVER, CMD_BUILD_CANAL | CMD_MSG(STR_ERROR_CAN_T_PLACE_RIVERS), CcBuildCanal); -+ TouchCommandP(end_tile, start_tile, WATER_CLASS_RIVER, CMD_BUILD_CANAL | CMD_MSG(STR_ERROR_CAN_T_PLACE_RIVERS), CcBuildCanal); - break; - case DDSP_BUILD_STATION: { - uint32 p2 = (uint32)INVALID_STATION << 16; // no station to join -@@ -242,14 +242,14 @@ struct BuildDocksToolbarWindow : Window { - } - - case DDSP_BUILD_BRIDGE: -- DoCommandP(start_tile, GetOtherAqueductEnd(start_tile), TRANSPORT_WATER << 15, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_AQUEDUCT_HERE), CcBuildBridge); -+ TouchCommandP(start_tile, GetOtherAqueductEnd(start_tile), TRANSPORT_WATER << 15, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_AQUEDUCT_HERE), CcBuildBridge); - VpStartPreSizing(); - break; - - case DDSP_REMOVE_TRUCKSTOP: { // Reusing for locks. - TileIndex middle_tile = start_tile; - if (start_tile != end_tile) middle_tile = TileAddByDiagDir(start_tile, DiagdirBetweenTiles(start_tile, end_tile)); -- DoCommandP(middle_tile, 0, 0, CMD_BUILD_LOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_LOCKS), CcBuildDocks); -+ TouchCommandP(middle_tile, 0, 0, CMD_BUILD_LOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_LOCKS), CcBuildDocks); - VpStartPreSizing(); - break; - } -@@ -258,10 +258,10 @@ struct BuildDocksToolbarWindow : Window { - assert(start_tile == end_tile); - switch (last_clicked_widget) { - case WID_DT_BUOY: -- DoCommandP(end_tile, 0, 0, CMD_BUILD_BUOY | CMD_MSG(STR_ERROR_CAN_T_POSITION_BUOY_HERE), CcBuildDocks); -+ TouchCommandP(end_tile, 0, 0, CMD_BUILD_BUOY | CMD_MSG(STR_ERROR_CAN_T_POSITION_BUOY_HERE), CcBuildDocks); - break; - case WID_DT_DEPOT: // Build depot button -- DoCommandP(end_tile, _ship_depot_direction, 0, CMD_BUILD_SHIP_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_SHIP_DEPOT), CcBuildDocks); -+ TouchCommandP(end_tile, _ship_depot_direction, 0, CMD_BUILD_SHIP_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_SHIP_DEPOT), CcBuildDocks); - break; - default: NOT_REACHED(); - } -diff --git a/src/object_gui.cpp b/src/object_gui.cpp -index 3bd3798..6675ec2 100644 ---- a/src/object_gui.cpp -+++ b/src/object_gui.cpp -@@ -499,5 +499,5 @@ void InitializeObjectGui() - */ - void PlaceProc_Object(TileIndex tile) - { -- DoCommandP(tile, ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index)->Index(), _selected_object_view, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_BUILD_OBJECT), CcTerraform); -+ TouchCommandP(tile, ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index)->Index(), _selected_object_view, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_BUILD_OBJECT), CcTerraform); - } -diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp -index 7c4b86b..d537646 100644 ---- a/src/rail_gui.cpp -+++ b/src/rail_gui.cpp -@@ -91,7 +91,7 @@ void CcPlaySound1E(const CommandCost &result, TileIndex tile, uint32 p1, uint32 - - static void GenericPlaceRail(TileIndex tile, int cmd) - { -- DoCommandP(tile, _cur_railtype, cmd, -+ TouchCommandP(tile, _cur_railtype, cmd, - _remove_button_clicked ? - CMD_REMOVE_SINGLE_RAIL | CMD_MSG(STR_ERROR_CAN_T_REMOVE_RAILROAD_TRACK) : - CMD_BUILD_SINGLE_RAIL | CMD_MSG(STR_ERROR_CAN_T_BUILD_RAILROAD_TRACK), -@@ -213,7 +213,7 @@ static void GenericPlaceSignals(TileIndex tile) - Track track = FindFirstTrack(trackbits); - - if (_remove_button_clicked) { -- DoCommandP(tile, track, 0, CMD_REMOVE_SIGNALS | CMD_MSG(STR_ERROR_CAN_T_REMOVE_SIGNALS_FROM), CcPlaySound1E); -+ TouchCommandP(tile, track, 0, CMD_REMOVE_SIGNALS | CMD_MSG(STR_ERROR_CAN_T_REMOVE_SIGNALS_FROM), CcPlaySound1E); - } else { - const Window *w = FindWindowById(WC_BUILD_SIGNAL, 0); - -@@ -238,7 +238,7 @@ static void GenericPlaceSignals(TileIndex tile) - SB(p1, 9, 6, cycle_bounds[_settings_client.gui.cycle_signal_types]); - } - -- DoCommandP(tile, p1, 0, CMD_BUILD_SIGNALS | -+ TouchCommandP(tile, p1, 0, CMD_BUILD_SIGNALS | - CMD_MSG((w != NULL && _convert_signal_button) ? STR_ERROR_SIGNAL_CAN_T_CONVERT_SIGNALS_HERE : STR_ERROR_CAN_T_BUILD_SIGNALS_HERE), - CcPlaySound1E); - } -@@ -325,7 +325,7 @@ static void BuildRailClick_Remove(Window *w) - - static void DoRailroadTrack(int mode) - { -- DoCommandP(TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), _cur_railtype | (mode << 4), -+ TouchCommandP(TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), _cur_railtype | (mode << 4), - _remove_button_clicked ? - CMD_REMOVE_RAILROAD_TRACK | CMD_MSG(STR_ERROR_CAN_T_REMOVE_RAILROAD_TRACK) : - CMD_BUILD_RAILROAD_TRACK | CMD_MSG(STR_ERROR_CAN_T_BUILD_RAILROAD_TRACK), -@@ -380,7 +380,7 @@ static void HandleAutoSignalPlacement() - - /* _settings_client.gui.drag_signals_density is given as a parameter such that each user - * in a network game can specify his/her own signal density */ -- DoCommandP(TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), p2, -+ TouchCommandP(TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), p2, - _remove_button_clicked ? - CMD_REMOVE_SIGNAL_TRACK | CMD_MSG(STR_ERROR_CAN_T_REMOVE_SIGNALS_FROM) : - CMD_BUILD_SIGNAL_TRACK | CMD_MSG(STR_ERROR_CAN_T_BUILD_SIGNALS_HERE), -@@ -667,7 +667,7 @@ struct BuildRailToolbarWindow : Window { - case WID_RAT_BUILD_TUNNEL: - if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); - else VpStartPreSizing(); -- DoCommandP(end_tile, _cur_railtype | (TRANSPORT_RAIL << 8), 0, CMD_BUILD_TUNNEL | CMD_MSG(STR_ERROR_CAN_T_BUILD_TUNNEL_HERE), CcBuildRailTunnel); -+ TouchCommandP(end_tile, _cur_railtype | (TRANSPORT_RAIL << 8), 0, CMD_BUILD_TUNNEL | CMD_MSG(STR_ERROR_CAN_T_BUILD_TUNNEL_HERE), CcBuildRailTunnel); - break; - case WID_RAT_BUILD_BRIDGE: - if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); -@@ -690,7 +690,7 @@ struct BuildRailToolbarWindow : Window { - break; - - case DDSP_CONVERT_RAIL: -- DoCommandP(end_tile, start_tile, _cur_railtype | (_ctrl_pressed ? 0x10 : 0), CMD_CONVERT_RAIL | CMD_MSG(STR_ERROR_CAN_T_CONVERT_RAIL), CcPlaySound10); -+ TouchCommandP(end_tile, start_tile, _cur_railtype | (_ctrl_pressed ? 0x10 : 0), CMD_CONVERT_RAIL | CMD_MSG(STR_ERROR_CAN_T_CONVERT_RAIL), CcPlaySound10); - break; - - case DDSP_BUILD_STATION: -@@ -712,14 +712,14 @@ struct BuildRailToolbarWindow : Window { - if (this->IsWidgetLowered(WID_RAT_BUILD_STATION)) { - /* Station */ - if (_remove_button_clicked) { -- DoCommandP(end_tile, start_tile, _ctrl_pressed ? 0 : 1, CMD_REMOVE_FROM_RAIL_STATION | CMD_MSG(STR_ERROR_CAN_T_REMOVE_PART_OF_STATION), CcPlaySound1E); -+ TouchCommandP(end_tile, start_tile, _ctrl_pressed ? 0 : 1, CMD_REMOVE_FROM_RAIL_STATION | CMD_MSG(STR_ERROR_CAN_T_REMOVE_PART_OF_STATION), CcPlaySound1E); - } else { - HandleStationPlacement(start_tile, end_tile); - } - } else { - /* Waypoint */ - if (_remove_button_clicked) { -- DoCommandP(end_tile, start_tile, _ctrl_pressed ? 0 : 1, CMD_REMOVE_FROM_RAIL_WAYPOINT | CMD_MSG(STR_ERROR_CAN_T_REMOVE_TRAIN_WAYPOINT), CcPlaySound1E); -+ TouchCommandP(end_tile, start_tile, _ctrl_pressed ? 0 : 1, CMD_REMOVE_FROM_RAIL_WAYPOINT | CMD_MSG(STR_ERROR_CAN_T_REMOVE_TRAIN_WAYPOINT), CcPlaySound1E); - } else { - TileArea ta(start_tile, end_tile); - uint32 p1 = _cur_railtype | (select_method == VPM_FIX_X ? AXIS_X : AXIS_Y) << 4 | ta.w << 8 | ta.h << 16 | _ctrl_pressed << 24; -@@ -734,7 +734,7 @@ struct BuildRailToolbarWindow : Window { - case DDSP_SINGLE_TILE: - assert(end_tile == start_tile); - assert(last_user_action == WID_RAT_BUILD_DEPOT); -- DoCommandP(end_tile, _cur_railtype, _build_depot_direction, -+ TouchCommandP(end_tile, _cur_railtype, _build_depot_direction, - CMD_BUILD_TRAIN_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_TRAIN_DEPOT), - CcRailDepot); - break; -diff --git a/src/road_gui.cpp b/src/road_gui.cpp -index d79477d..ef6c6d3 100644 ---- a/src/road_gui.cpp -+++ b/src/road_gui.cpp -@@ -585,7 +585,7 @@ struct BuildRoadToolbarWindow : Window { - case WID_ROT_BUILD_TUNNEL: - if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); - else VpStartPreSizing(); -- DoCommandP(end_tile, RoadTypeToRoadTypes(_cur_roadtype) | (TRANSPORT_ROAD << 8), 0, -+ TouchCommandP(end_tile, RoadTypeToRoadTypes(_cur_roadtype) | (TRANSPORT_ROAD << 8), 0, - CMD_BUILD_TUNNEL | CMD_MSG(STR_ERROR_CAN_T_BUILD_TUNNEL_HERE), CcBuildRoadTunnel); - break; - case WID_ROT_BUILD_BRIDGE: -@@ -609,7 +609,7 @@ struct BuildRoadToolbarWindow : Window { - * not the 3rd bit set) */ - _place_road_flag = (RoadFlags)((_place_road_flag & RF_DIR_Y) ? (_place_road_flag & 0x07) : (_place_road_flag >> 3)); - -- DoCommandP(start_tile, end_tile, _place_road_flag | (_cur_roadtype << 3) | (_one_way_button_clicked << 5), -+ TouchCommandP(start_tile, end_tile, _place_road_flag | (_cur_roadtype << 3) | (_one_way_button_clicked << 5), - _remove_button_clicked ? - CMD_REMOVE_LONG_ROAD | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_road) : - CMD_BUILD_LONG_ROAD | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_road), CcPlaySound1D); -@@ -625,13 +625,13 @@ struct BuildRoadToolbarWindow : Window { - - case DDSP_REMOVE_BUSSTOP: { - TileArea ta(start_tile, end_tile); -- DoCommandP(ta.tile, ta.w | ta.h << 8, ROADSTOP_BUS, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_BUS]), CcPlaySound1D); -+ TouchCommandP(ta.tile, ta.w | ta.h << 8, ROADSTOP_BUS, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_BUS]), CcPlaySound1D); - break; - } - - case DDSP_REMOVE_TRUCKSTOP: { - TileArea ta(start_tile, end_tile); -- DoCommandP(ta.tile, ta.w | ta.h << 8, ROADSTOP_TRUCK, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_TRUCK]), CcPlaySound1D); -+ TouchCommandP(ta.tile, ta.w | ta.h << 8, ROADSTOP_TRUCK, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_TRUCK]), CcPlaySound1D); - break; - } - -@@ -639,7 +639,7 @@ struct BuildRoadToolbarWindow : Window { - /* Build depot. */ - assert(start_tile == end_tile); - assert(last_started_action == WID_ROT_DEPOT); -- DoCommandP(start_tile, _cur_roadtype << 2 | _road_depot_orientation, 0, -+ TouchCommandP(start_tile, _cur_roadtype << 2 | _road_depot_orientation, 0, - CMD_BUILD_ROAD_DEPOT | CMD_MSG(_road_type_infos[_cur_roadtype].err_depot), CcRoadDepot); - break; - } -diff --git a/src/station_gui.cpp b/src/station_gui.cpp -index 9ea7daf..c0a0135 100644 ---- a/src/station_gui.cpp -+++ b/src/station_gui.cpp -@@ -2267,7 +2267,7 @@ void ShowSelectBaseStationIfNeeded(const CommandContainer &cmd, TileArea ta) - if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); - new SelectStationWindow(&_select_station_desc, cmd, ta); - } else { -- DoCommandP(&cmd); -+ TouchCommandP(&cmd); - } - } - -diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp -index c2d697a..922071c 100644 ---- a/src/terraform_gui.cpp -+++ b/src/terraform_gui.cpp -@@ -111,16 +111,16 @@ bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_t - - switch (proc) { - case DDSP_DEMOLISH_AREA: -- DoCommandP(end_tile, start_tile, _ctrl_pressed ? 1 : 0, CMD_CLEAR_AREA | CMD_MSG(STR_ERROR_CAN_T_CLEAR_THIS_AREA), CcPlaySound10); -+ TouchCommandP(end_tile, start_tile, _ctrl_pressed ? 1 : 0, CMD_CLEAR_AREA | CMD_MSG(STR_ERROR_CAN_T_CLEAR_THIS_AREA), CcPlaySound10); - break; - case DDSP_RAISE_AND_LEVEL_AREA: -- DoCommandP(end_tile, start_tile, LM_RAISE << 1 | (_ctrl_pressed ? 1 : 0), CMD_LEVEL_LAND | CMD_MSG(STR_ERROR_CAN_T_RAISE_LAND_HERE), CcTerraform); -+ TouchCommandP(end_tile, start_tile, LM_RAISE << 1 | (_ctrl_pressed ? 1 : 0), CMD_LEVEL_LAND | CMD_MSG(STR_ERROR_CAN_T_RAISE_LAND_HERE), CcTerraform); - break; - case DDSP_LOWER_AND_LEVEL_AREA: -- DoCommandP(end_tile, start_tile, LM_LOWER << 1 | (_ctrl_pressed ? 1 : 0), CMD_LEVEL_LAND | CMD_MSG(STR_ERROR_CAN_T_LOWER_LAND_HERE), CcTerraform); -+ TouchCommandP(end_tile, start_tile, LM_LOWER << 1 | (_ctrl_pressed ? 1 : 0), CMD_LEVEL_LAND | CMD_MSG(STR_ERROR_CAN_T_LOWER_LAND_HERE), CcTerraform); - break; - case DDSP_LEVEL_AREA: -- DoCommandP(end_tile, start_tile, LM_LEVEL << 1 | (_ctrl_pressed ? 1 : 0), CMD_LEVEL_LAND | CMD_MSG(STR_ERROR_CAN_T_LEVEL_LAND_HERE), CcTerraform); -+ TouchCommandP(end_tile, start_tile, LM_LEVEL << 1 | (_ctrl_pressed ? 1 : 0), CMD_LEVEL_LAND | CMD_MSG(STR_ERROR_CAN_T_LEVEL_LAND_HERE), CcTerraform); - break; - case DDSP_CREATE_ROCKS: - GenerateRockyArea(end_tile, start_tile); -@@ -270,7 +270,7 @@ struct TerraformToolbarWindow : Window { - assert(start_tile == end_tile); - switch (this->last_user_action) { - case WID_TT_BUY_LAND: -- DoCommandP(end_tile, OBJECT_OWNED_LAND, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_PURCHASE_THIS_LAND), CcPlaySound1E); -+ TouchCommandP(end_tile, OBJECT_OWNED_LAND, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_PURCHASE_THIS_LAND), CcPlaySound1E); - break; - case WID_TT_PLACE_SIGN: - PlaceProc_Sign(end_tile); -@@ -402,7 +402,7 @@ static void CommonRaiseLowerBigLand(TileIndex tile, int mode) - StringID msg = - mode ? STR_ERROR_CAN_T_RAISE_LAND_HERE : STR_ERROR_CAN_T_LOWER_LAND_HERE; - -- DoCommandP(tile, SLOPE_N, (uint32)mode, CMD_TERRAFORM_LAND | CMD_MSG(msg), CcTerraform); -+ TouchCommandP(tile, SLOPE_N, (uint32)mode, CMD_TERRAFORM_LAND | CMD_MSG(msg), CcTerraform); - } else { - assert(_terraform_size != 0); - TileArea ta(tile, _terraform_size, _terraform_size); -@@ -429,7 +429,7 @@ static void CommonRaiseLowerBigLand(TileIndex tile, int mode) - - TILE_AREA_LOOP(tile2, ta) { - if (TileHeight(tile2) == h) { -- DoCommandP(tile2, SLOPE_N, (uint32)mode, CMD_TERRAFORM_LAND); -+ TouchCommandP(tile2, SLOPE_N, (uint32)mode, CMD_TERRAFORM_LAND); - } - } - } -diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp -index 34c3862..bcd3281 100644 ---- a/src/tree_gui.cpp -+++ b/src/tree_gui.cpp -@@ -155,7 +155,7 @@ public: - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) - { - if (pt.x != -1 && select_proc == DDSP_PLANT_TREES) { -- DoCommandP(end_tile, this->tree_to_plant, start_tile, -+ TouchCommandP(end_tile, this->tree_to_plant, start_tile, - CMD_PLANT_TREE | CMD_MSG(STR_ERROR_CAN_T_PLANT_TREE_HERE)); - } - } --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0235-Reset-queued-command-when-closing-windows-that-can-q.patch b/project/jni/application/openttd/0235-Reset-queued-command-when-closing-windows-that-can-q.patch deleted file mode 100644 index 3169c6050..000000000 --- a/project/jni/application/openttd/0235-Reset-queued-command-when-closing-windows-that-can-q.patch +++ /dev/null @@ -1,147 +0,0 @@ -From e7e2c3f1392ae1d9be5e3cc96fa31d4cb894a1ea Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 14 Oct 2013 17:49:14 +0000 -Subject: [PATCH 235/249] Reset queued command when closing windows that can - queue them. - ---- - src/airport_gui.cpp | 4 +++- - src/dock_gui.cpp | 3 +++ - src/rail_gui.cpp | 2 ++ - src/road_gui.cpp | 3 +++ - src/terraform_gui.cpp | 1 + - src/tree_gui.cpp | 1 + - 6 files changed, 13 insertions(+), 1 deletion(-) - -diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp -index 61c9f2d..c927ef4 100644 ---- a/src/airport_gui.cpp -+++ b/src/airport_gui.cpp -@@ -28,6 +28,7 @@ - #include "hotkeys.h" - #include "vehicle_func.h" - #include "gui.h" -+#include "command_func.h" - - #include "widgets/airport_widget.h" - -@@ -142,7 +143,7 @@ struct BuildAirToolbarWindow : Window { - - DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR); - DeleteWindowById(WC_SELECT_STATION, 0); -- -+ EraseQueuedTouchCommand(); - ResetObjectToPlace(); - } - -@@ -243,6 +244,7 @@ public: - - virtual ~BuildAirportWindow() - { -+ EraseQueuedTouchCommand(); - DeleteWindowById(WC_SELECT_STATION, 0); - } - -diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp -index 460ae57..934ff9e 100644 ---- a/src/dock_gui.cpp -+++ b/src/dock_gui.cpp -@@ -103,6 +103,7 @@ struct BuildDocksToolbarWindow : Window { - - ~BuildDocksToolbarWindow() - { -+ if (_thd.GetCallbackWnd() == this) this->OnPlaceObjectAbort(); - if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false); - } - -@@ -279,6 +280,7 @@ struct BuildDocksToolbarWindow : Window { - DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER); - DeleteWindowById(WC_SELECT_STATION, 0); - DeleteWindowByClass(WC_BUILD_BRIDGE); -+ EraseQueuedTouchCommand(); - } - - virtual void OnPlacePresize(Point pt, TileIndex tile_from) -@@ -558,6 +560,7 @@ public: - this->LowerWidget(_ship_depot_direction + WID_BDD_X); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); - UpdateDocksDirection(); -+ EraseQueuedTouchCommand(); - this->SetDirty(); - break; - } -diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp -index d537646..ce9d105 100644 ---- a/src/rail_gui.cpp -+++ b/src/rail_gui.cpp -@@ -405,6 +405,7 @@ struct BuildRailToolbarWindow : Window { - - ~BuildRailToolbarWindow() - { -+ if (_thd.GetCallbackWnd() == this) this->OnPlaceObjectAbort(); - if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false); - } - -@@ -754,6 +755,7 @@ struct BuildRailToolbarWindow : Window { - DeleteWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL); - DeleteWindowById(WC_SELECT_STATION, 0); - DeleteWindowByClass(WC_BUILD_BRIDGE); -+ EraseQueuedTouchCommand(); - } - - virtual void OnPlacePresize(Point pt, TileIndex tile_from) -diff --git a/src/road_gui.cpp b/src/road_gui.cpp -index ef6c6d3..1b7ea07 100644 ---- a/src/road_gui.cpp -+++ b/src/road_gui.cpp -@@ -309,6 +309,7 @@ struct BuildRoadToolbarWindow : Window { - - ~BuildRoadToolbarWindow() - { -+ if (_thd.GetCallbackWnd() == this) this->OnPlaceObjectAbort(); - if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false); - } - -@@ -531,6 +532,7 @@ struct BuildRoadToolbarWindow : Window { - DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD); - DeleteWindowById(WC_SELECT_STATION, 0); - DeleteWindowByClass(WC_BUILD_BRIDGE); -+ EraseQueuedTouchCommand(); - } - - virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) -@@ -1029,6 +1031,7 @@ struct BuildRoadStationWindow : public PickerWindowBase { - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); - this->SetDirty(); - DeleteWindowById(WC_SELECT_STATION, 0); -+ EraseQueuedTouchCommand(); - break; - - case WID_BROS_LT_OFF: -diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp -index 922071c..c6b3dff 100644 ---- a/src/terraform_gui.cpp -+++ b/src/terraform_gui.cpp -@@ -288,6 +288,7 @@ struct TerraformToolbarWindow : Window { - { - DeleteWindowById(WC_BUILD_OBJECT, 0); - this->RaiseButtons(); -+ EraseQueuedTouchCommand(); - ResetObjectToPlace(); - } - -diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp -index bcd3281..eac8584 100644 ---- a/src/tree_gui.cpp -+++ b/src/tree_gui.cpp -@@ -174,6 +174,7 @@ public: - this->RaiseButtons(); - - ResetObjectToPlace(); -+ EraseQueuedTouchCommand(); - } - }; - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0236-Reset-queued-command-when-changing-CTRL-state.patch b/project/jni/application/openttd/0236-Reset-queued-command-when-changing-CTRL-state.patch deleted file mode 100644 index e211699ae..000000000 --- a/project/jni/application/openttd/0236-Reset-queued-command-when-changing-CTRL-state.patch +++ /dev/null @@ -1,24 +0,0 @@ -From a9f29e52e61812d9272e1d6de192e075da82da28 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 14 Oct 2013 17:49:32 +0000 -Subject: [PATCH 236/249] Reset queued command when changing CTRL state. - ---- - src/toolbar_gui.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp -index 7ef8511..f38cffe 100644 ---- a/src/toolbar_gui.cpp -+++ b/src/toolbar_gui.cpp -@@ -2261,6 +2261,7 @@ struct TabletToolbar : Window { - this->ToggleWidgetLoweredState(WID_TT_CTRL); - HandleCtrlChanged(); - this->SetWidgetDirty(WID_TT_CTRL); -+ EraseQueuedTouchCommand(); - break; - case WID_TT_MOVE: - _move_pressed = !_move_pressed; --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0237-Erase-queued-command-also-when-depot-direction-airpo.patch b/project/jni/application/openttd/0237-Erase-queued-command-also-when-depot-direction-airpo.patch deleted file mode 100644 index c7f0103e0..000000000 --- a/project/jni/application/openttd/0237-Erase-queued-command-also-when-depot-direction-airpo.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 6e8c23fd95493265aa393bb9e4fd7ddb5078ac9f Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 14 Oct 2013 18:10:26 +0000 -Subject: [PATCH 237/249] Erase queued command also when depot - direction/airport type/station type changes. - ---- - src/airport_gui.cpp | 2 ++ - src/dock_gui.cpp | 1 + - src/rail_gui.cpp | 3 +++ - src/road_gui.cpp | 2 ++ - 4 files changed, 8 insertions(+) - -diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp -index c927ef4..fa9d1b7 100644 ---- a/src/airport_gui.cpp -+++ b/src/airport_gui.cpp -@@ -423,6 +423,8 @@ public: - - void UpdateSelectSize() - { -+ EraseQueuedTouchCommand(); -+ - if (_selected_airport_index == -1) { - SetTileSelectSize(1, 1); - this->DisableWidget(WID_AP_LAYOUT_DECREASE); -diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp -index 934ff9e..701a597 100644 ---- a/src/dock_gui.cpp -+++ b/src/dock_gui.cpp -@@ -474,6 +474,7 @@ public: - _settings_client.gui.station_show_coverage = (widget != BDSW_LT_OFF); - this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); -+ EraseQueuedTouchCommand(); - this->SetDirty(); - break; - } -diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp -index ce9d105..a0fa459 100644 ---- a/src/rail_gui.cpp -+++ b/src/rail_gui.cpp -@@ -1365,6 +1365,8 @@ public: - break; - } - } -+ -+ EraseQueuedTouchCommand(); - } - - virtual void OnTick() -@@ -1723,6 +1725,7 @@ struct BuildRailDepotWindow : public PickerWindowBase { - _build_depot_direction = (DiagDirection)(widget - WID_BRAD_DEPOT_NE); - this->LowerWidget(_build_depot_direction + WID_BRAD_DEPOT_NE); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); -+ EraseQueuedTouchCommand(); - this->SetDirty(); - break; - } -diff --git a/src/road_gui.cpp b/src/road_gui.cpp -index 1b7ea07..455eef1 100644 ---- a/src/road_gui.cpp -+++ b/src/road_gui.cpp -@@ -894,6 +894,7 @@ struct BuildRoadDepotWindow : public PickerWindowBase { - _road_depot_orientation = (DiagDirection)(widget - WID_BROD_DEPOT_NE); - this->LowerWidget(_road_depot_orientation + WID_BROD_DEPOT_NE); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); -+ EraseQueuedTouchCommand(); - this->SetDirty(); - break; - -@@ -1040,6 +1041,7 @@ struct BuildRoadStationWindow : public PickerWindowBase { - _settings_client.gui.station_show_coverage = (widget != WID_BROS_LT_OFF); - this->LowerWidget(_settings_client.gui.station_show_coverage + WID_BROS_LT_OFF); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); -+ EraseQueuedTouchCommand(); - this->SetDirty(); - break; - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0238-Erase-queued-commands-when-another-command-is-about-.patch b/project/jni/application/openttd/0238-Erase-queued-commands-when-another-command-is-about-.patch deleted file mode 100644 index 56f8d3fc8..000000000 --- a/project/jni/application/openttd/0238-Erase-queued-commands-when-another-command-is-about-.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 7e4ef45b2c7703047ac2ba97ff5fc93cdc38fed5 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Mon, 14 Oct 2013 19:24:30 +0000 -Subject: [PATCH 238/249] Erase queued commands when another command is about - to be queued. - ---- - src/airport_gui.cpp | 1 + - src/dock_gui.cpp | 1 + - src/rail_gui.cpp | 1 + - src/road_gui.cpp | 1 + - src/terraform_gui.cpp | 1 + - src/tree_gui.cpp | 1 + - 6 files changed, 6 insertions(+) - -diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp -index fa9d1b7..4f1335b 100644 ---- a/src/airport_gui.cpp -+++ b/src/airport_gui.cpp -@@ -103,6 +103,7 @@ struct BuildAirToolbarWindow : Window { - - virtual void OnPlaceObject(Point pt, TileIndex tile) - { -+ EraseQueuedTouchCommand(); - switch (this->last_user_action) { - case WID_AT_AIRPORT: { - VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_BUILD_STATION); -diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp -index 701a597..2962a09 100644 ---- a/src/dock_gui.cpp -+++ b/src/dock_gui.cpp -@@ -168,6 +168,7 @@ struct BuildDocksToolbarWindow : Window { - - virtual void OnPlaceObject(Point pt, TileIndex tile) - { -+ EraseQueuedTouchCommand(); - switch (this->last_clicked_widget) { - case WID_DT_CANAL: // Build canal button - VpStartPlaceSizing(tile, (_game_mode == GM_EDITOR) ? VPM_X_AND_Y : VPM_X_OR_Y, DDSP_CREATE_WATER); -diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp -index a0fa459..4e6a5d4 100644 ---- a/src/rail_gui.cpp -+++ b/src/rail_gui.cpp -@@ -583,6 +583,7 @@ struct BuildRailToolbarWindow : Window { - - virtual void OnPlaceObject(Point pt, TileIndex tile) - { -+ EraseQueuedTouchCommand(); - switch (this->last_user_action) { - case WID_RAT_BUILD_NS: - VpStartPlaceSizing(tile, VPM_FIX_VERTICAL | VPM_RAILDIRS, DDSP_PLACE_RAIL); -diff --git a/src/road_gui.cpp b/src/road_gui.cpp -index 455eef1..1dc2eb7 100644 ---- a/src/road_gui.cpp -+++ b/src/road_gui.cpp -@@ -467,6 +467,7 @@ struct BuildRoadToolbarWindow : Window { - - virtual void OnPlaceObject(Point pt, TileIndex tile) - { -+ EraseQueuedTouchCommand(); - _remove_button_clicked = this->IsWidgetLowered(WID_ROT_REMOVE); - _one_way_button_clicked = this->IsWidgetLowered(WID_ROT_ONE_WAY); - switch (this->last_started_action) { -diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp -index c6b3dff..f8d7e0b 100644 ---- a/src/terraform_gui.cpp -+++ b/src/terraform_gui.cpp -@@ -653,6 +653,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { - - virtual void OnPlaceObject(Point pt, TileIndex tile) - { -+ EraseQueuedTouchCommand(); - switch (this->last_user_action) { - case WID_ETT_DEMOLISH: // Demolish aka dynamite button - PlaceProc_DemolishArea(tile); -diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp -index eac8584..f57d67a 100644 ---- a/src/tree_gui.cpp -+++ b/src/tree_gui.cpp -@@ -144,6 +144,7 @@ public: - - virtual void OnPlaceObject(Point pt, TileIndex tile) - { -+ EraseQueuedTouchCommand(); - VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_PLANT_TREES); - } - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0239-Align-construction-windows-with-main-toolbar.patch b/project/jni/application/openttd/0239-Align-construction-windows-with-main-toolbar.patch deleted file mode 100644 index 7c7c3d936..000000000 --- a/project/jni/application/openttd/0239-Align-construction-windows-with-main-toolbar.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 5f5f740ab93005b641e6062a9c255117e363c17b Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 19 Oct 2013 11:40:00 +0000 -Subject: [PATCH 239/249] Align construction windows with main toolbar. - ---- - src/dock_gui.cpp | 2 +- - src/industry_gui.cpp | 2 +- - src/road_gui.cpp | 2 +- - src/terraform_gui.cpp | 2 +- - src/town_gui.cpp | 2 +- - 5 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp -index 2962a09..3ffded2 100644 ---- a/src/dock_gui.cpp -+++ b/src/dock_gui.cpp -@@ -402,7 +402,7 @@ static const NWidgetPart _nested_build_docks_scen_toolbar_widgets[] = { - - /** Window definition for the build docks in scenario editor window. */ - static WindowDesc _build_docks_scen_toolbar_desc( -- WDP_AUTO, "toolbar_water_scen", 0, 0, -+ WDP_ALIGN_TOOLBAR, "toolbar_water_scen", 0, 0, - WC_SCEN_BUILD_TOOLBAR, WC_NONE, - WDF_CONSTRUCTION, - _nested_build_docks_scen_toolbar_widgets, lengthof(_nested_build_docks_scen_toolbar_widgets) -diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp -index 3ddb3c5..b886119 100644 ---- a/src/industry_gui.cpp -+++ b/src/industry_gui.cpp -@@ -191,7 +191,7 @@ static const NWidgetPart _nested_build_industry_widgets[] = { - - /** Window definition of the dynamic place industries gui */ - static WindowDesc _build_industry_desc( -- WDP_AUTO, "build_industry", 170, 212, -+ WDP_ALIGN_TOOLBAR, "build_industry", 170, 212, - WC_BUILD_INDUSTRY, WC_NONE, - WDF_CONSTRUCTION, - _nested_build_industry_widgets, lengthof(_nested_build_industry_widgets) -diff --git a/src/road_gui.cpp b/src/road_gui.cpp -index 1dc2eb7..353f76b 100644 ---- a/src/road_gui.cpp -+++ b/src/road_gui.cpp -@@ -833,7 +833,7 @@ static const NWidgetPart _nested_build_road_scen_widgets[] = { - }; - - static WindowDesc _build_road_scen_desc( -- WDP_AUTO, "toolbar_road_scen", 0, 0, -+ WDP_ALIGN_TOOLBAR, "toolbar_road_scen", 0, 0, - WC_SCEN_BUILD_TOOLBAR, WC_NONE, - WDF_CONSTRUCTION, - _nested_build_road_scen_widgets, lengthof(_nested_build_road_scen_widgets), -diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp -index f8d7e0b..8cfee69 100644 ---- a/src/terraform_gui.cpp -+++ b/src/terraform_gui.cpp -@@ -746,7 +746,7 @@ static Hotkey terraform_editor_hotkeys[] = { - HotkeyList ScenarioEditorLandscapeGenerationWindow::hotkeys("terraform_editor", terraform_editor_hotkeys, TerraformToolbarEditorGlobalHotkeys); - - static WindowDesc _scen_edit_land_gen_desc( -- WDP_AUTO, "toolbar_landscape_scen", 0, 0, -+ WDP_ALIGN_TOOLBAR, "toolbar_landscape_scen", 0, 0, - WC_SCEN_LAND_GEN, WC_NONE, - WDF_CONSTRUCTION, - _nested_scen_edit_land_gen_widgets, lengthof(_nested_scen_edit_land_gen_widgets), -diff --git a/src/town_gui.cpp b/src/town_gui.cpp -index d1f9847..ad51d39 100644 ---- a/src/town_gui.cpp -+++ b/src/town_gui.cpp -@@ -1212,7 +1212,7 @@ public: - }; - - static WindowDesc _found_town_desc( -- WDP_AUTO, "build_town", 160, 162, -+ WDP_ALIGN_TOOLBAR, "build_town", 160, 162, - WC_FOUND_TOWN, WC_NONE, - WDF_CONSTRUCTION, - _nested_found_town_widgets, lengthof(_nested_found_town_widgets) --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0240-When-in-touchscreen-modes-windows-aligned-with-main-.patch b/project/jni/application/openttd/0240-When-in-touchscreen-modes-windows-aligned-with-main-.patch deleted file mode 100644 index e4d951b28..000000000 --- a/project/jni/application/openttd/0240-When-in-touchscreen-modes-windows-aligned-with-main-.patch +++ /dev/null @@ -1,32 +0,0 @@ -From af53477a11a5960aa352e7ac394eb19bb418d8c9 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 19 Oct 2013 11:47:55 +0000 -Subject: [PATCH 240/249] When in touchscreen modes, windows aligned with main - toolbar are aligned to the left/right edge of the screen. - ---- - src/window.cpp | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/src/window.cpp b/src/window.cpp -index b783125..6d9c087 100644 ---- a/src/window.cpp -+++ b/src/window.cpp -@@ -1657,7 +1657,13 @@ Point GetToolbarAlignedWindowPosition(int window_width) - { - const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0); - assert(w != NULL); -- Point pt = { _current_text_dir == TD_RTL ? w->left : (w->left + w->width) - window_width, w->top + w->height }; -+ Point pt; -+ pt.y = w->top + w->height; -+ if (_settings_client.gui.touchscreen_mode != TSC_NONE) { -+ pt.x = _current_text_dir == TD_RTL ? 0 : (_screen.width - window_width); -+ } else { -+ pt.x = _current_text_dir == TD_RTL ? w->left : (w->left + w->width) - window_width; -+ } - return pt; - } - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0241-Add-a-function-for-deleting-windows-linked-to-main-t.patch b/project/jni/application/openttd/0241-Add-a-function-for-deleting-windows-linked-to-main-t.patch deleted file mode 100644 index 0ec24d34d..000000000 --- a/project/jni/application/openttd/0241-Add-a-function-for-deleting-windows-linked-to-main-t.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 33d0fb1efffe097449201b5adc001706ffd565e9 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 19 Oct 2013 13:35:17 +0000 -Subject: [PATCH 241/249] Add a function for deleting windows linked to main - toolbar. - ---- - src/window.cpp | 22 ++++++++++++++++++++++ - src/window_func.h | 1 + - 2 files changed, 23 insertions(+) - -diff --git a/src/window.cpp b/src/window.cpp -index 6d9c087..795c82e 100644 ---- a/src/window.cpp -+++ b/src/window.cpp -@@ -3346,6 +3346,28 @@ restart_search: - FOR_ALL_WINDOWS_FROM_BACK(w) w->SetDirty(); - } - -+/** -+ * Delete all windows that are linked to the main toolbar. -+ * Once done with that, refresh other windows too. -+ */ -+void DeleteToolbarLinkedWindows() -+{ -+ Window *w; -+ -+restart_search: -+ /* When we find the window to delete, we need to restart the search -+ * as deleting this window could cascade in deleting (many) others -+ * anywhere in the z-array */ -+ FOR_ALL_WINDOWS_FROM_BACK(w) { -+ if (w->window_desc->default_pos == WDP_ALIGN_TOOLBAR) { -+ delete w; -+ goto restart_search; -+ } -+ } -+ -+ FOR_ALL_WINDOWS_FROM_BACK(w) w->SetDirty(); -+} -+ - /** Delete all always on-top windows to get an empty screen */ - void HideVitalWindows() - { -diff --git a/src/window_func.h b/src/window_func.h -index a0fff7c..335ab9e 100644 ---- a/src/window_func.h -+++ b/src/window_func.h -@@ -42,6 +42,7 @@ void InvalidateWindowClassesData(WindowClass cls, int data = 0, bool gui_scope = - void DeleteNonVitalWindows(); - void DeleteAllNonVitalWindows(); - void DeleteConstructionWindows(); -+void DeleteToolbarLinkedWindows(); - void HideVitalWindows(); - void ShowVitalWindows(); - --- -1.8.1.2 - diff --git a/project/jni/application/openttd/0242-Before-opening-linked-to-main-toolbar-windows-delete.patch b/project/jni/application/openttd/0242-Before-opening-linked-to-main-toolbar-windows-delete.patch deleted file mode 100644 index 366bb887b..000000000 --- a/project/jni/application/openttd/0242-Before-opening-linked-to-main-toolbar-windows-delete.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 3d4a72d84722bdd5235d5318158e0555ce58b2f2 Mon Sep 17 00:00:00 2001 -From: Juanjo -Date: Sat, 19 Oct 2013 19:23:15 +0000 -Subject: [PATCH 242/249] Before opening linked to main toolbar windows, delete - linked windows. - ---- - src/airport_gui.cpp | 2 +- - src/dock_gui.cpp | 3 ++- - src/industry_gui.cpp | 2 +- - src/rail_gui.cpp | 2 +- - src/road_gui.cpp | 3 ++- - src/terraform_gui.cpp | 2 ++ - src/town_gui.cpp | 1 + - 7 files changed, 10 insertions(+), 5 deletions(-) - -diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp -index 4f1335b..09f4a95 100644 ---- a/src/airport_gui.cpp -+++ b/src/airport_gui.cpp -@@ -203,7 +203,7 @@ Window *ShowBuildAirToolbar() - { - if (!Company::IsValidID(_local_company)) return NULL; - -- DeleteWindowByClass(WC_BUILD_TOOLBAR); -+ DeleteToolbarLinkedWindows(); - return AllocateWindowDescFront(&_air_toolbar_desc, TRANSPORT_AIR); - } - -diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp -index 3ffded2..499861f 100644 ---- a/src/dock_gui.cpp -+++ b/src/dock_gui.cpp -@@ -376,7 +376,7 @@ Window *ShowBuildDocksToolbar() - { - if (!Company::IsValidID(_local_company)) return NULL; - -- DeleteWindowByClass(WC_BUILD_TOOLBAR); -+ DeleteToolbarLinkedWindows(); - return AllocateWindowDescFront(&_build_docks_toolbar_desc, TRANSPORT_WATER); - } - -@@ -415,6 +415,7 @@ static WindowDesc _build_docks_scen_toolbar_desc( - */ - Window *ShowBuildDocksScenToolbar() - { -+ DeleteToolbarLinkedWindows(); - return AllocateWindowDescFront(&_build_docks_scen_toolbar_desc, TRANSPORT_WATER); - } - -diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp -index b886119..1253f71 100644 ---- a/src/industry_gui.cpp -+++ b/src/industry_gui.cpp -@@ -647,7 +647,7 @@ public: - void ShowBuildIndustryWindow() - { - if (_game_mode != GM_EDITOR && !Company::IsValidID(_local_company)) return; -- if (BringWindowToFrontById(WC_BUILD_INDUSTRY, 0)) return; -+ DeleteToolbarLinkedWindows(); - new BuildIndustryWindow(); - } - -diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp -index 4e6a5d4..2cb9a54 100644 ---- a/src/rail_gui.cpp -+++ b/src/rail_gui.cpp -@@ -882,7 +882,7 @@ Window *ShowBuildRailToolbar(RailType railtype) - if (!Company::IsValidID(_local_company)) return NULL; - if (!ValParamRailtype(railtype)) return NULL; - -- DeleteWindowByClass(WC_BUILD_TOOLBAR); -+ DeleteToolbarLinkedWindows(); - _cur_railtype = railtype; - _remove_button_clicked = false; - return new BuildRailToolbarWindow(&_build_rail_desc, railtype); -diff --git a/src/road_gui.cpp b/src/road_gui.cpp -index 353f76b..63c4e85 100644 ---- a/src/road_gui.cpp -+++ b/src/road_gui.cpp -@@ -801,7 +801,7 @@ Window *ShowBuildRoadToolbar(RoadType roadtype) - if (!Company::IsValidID(_local_company)) return NULL; - _cur_roadtype = roadtype; - -- DeleteWindowByClass(WC_BUILD_TOOLBAR); -+ DeleteToolbarLinkedWindows(); - return AllocateWindowDescFront(roadtype == ROADTYPE_ROAD ? &_build_road_desc : &_build_tramway_desc, TRANSPORT_ROAD); - } - -@@ -846,6 +846,7 @@ static WindowDesc _build_road_scen_desc( - */ - Window *ShowBuildRoadScenToolbar() - { -+ DeleteToolbarLinkedWindows(); - _cur_roadtype = ROADTYPE_ROAD; - return AllocateWindowDescFront(&_build_road_scen_desc, TRANSPORT_ROAD); - } -diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp -index 8cfee69..2fb78ce 100644 ---- a/src/terraform_gui.cpp -+++ b/src/terraform_gui.cpp -@@ -370,6 +370,7 @@ Window *ShowTerraformToolbar(Window *link) - if (!Company::IsValidID(_local_company)) return NULL; - - if (link == NULL) { -+ DeleteToolbarLinkedWindows(); - return AllocateWindowDescFront(&_terraform_desc, 0); - } - -@@ -759,5 +760,6 @@ static WindowDesc _scen_edit_land_gen_desc( - */ - Window *ShowEditorTerraformToolbar() - { -+ DeleteToolbarLinkedWindows(); - return AllocateWindowDescFront(&_scen_edit_land_gen_desc, 0); - } -diff --git a/src/town_gui.cpp b/src/town_gui.cpp -index ad51d39..10967d3 100644 ---- a/src/town_gui.cpp -+++ b/src/town_gui.cpp -@@ -1221,5 +1221,6 @@ static WindowDesc _found_town_desc( - void ShowFoundTownWindow() - { - if (_game_mode != GM_EDITOR && !Company::IsValidID(_local_company)) return; -+ DeleteToolbarLinkedWindows(); - AllocateWindowDescFront(&_found_town_desc, 0); - } --- -1.8.1.2 - diff --git a/project/jni/application/openttd/AndroidAppSettings.cfg b/project/jni/application/openttd/AndroidAppSettings.cfg index c8c5e3885..e87508597 100644 --- a/project/jni/application/openttd/AndroidAppSettings.cfg +++ b/project/jni/application/openttd/AndroidAppSettings.cfg @@ -18,7 +18,7 @@ AppVersionName="1.4.0.27" # If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - # these files are put inside .apk package by build system # Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS -AppDataDownloadUrl="!!Data files - 20 Mb|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/openttd-1.4.0-beta5.zip/download^!MIDI music support (18 Mb)|timidity.zip|http://sourceforge.net/projects/libsdl-android/files/timidity.zip^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.27.cfg^!!Internationalization files|http://sourceforge.net/projects/libsdl-android/files/icudt52l.zip/download" +AppDataDownloadUrl="!!Data files - 20 Mb|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/openttd-data-1.4.0-beta5.zip/download^!MIDI music support (18 Mb)|timidity.zip|http://sourceforge.net/projects/libsdl-android/files/timidity.zip^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.27.cfg^!!Internationalization files|http://sourceforge.net/projects/libsdl-android/files/icudt52l.zip/download" # Reset SDL config when updating application to the new version (y) / (n) ResetSdlConfigForThisVersion=y diff --git a/project/jni/application/openttd/AndroidData/openttd-1.4.0.27.cfg b/project/jni/application/openttd/AndroidData/openttd-1.4.0.27.cfg index c95b6cc34..c070baf03 100644 --- a/project/jni/application/openttd/AndroidData/openttd-1.4.0.27.cfg +++ b/project/jni/application/openttd/AndroidData/openttd-1.4.0.27.cfg @@ -1,10 +1,9 @@ - [misc] resolution = 854,480 -small_font = -medium_font = -large_font = -mono_font = +small_font = fonts/Roboto-Bold.ttf +medium_font = fonts/Roboto-Bold.ttf +large_font = fonts/DroidSerif-Bold.ttf +mono_font = fonts/DroidSansMono.ttf small_size = 10 medium_size = 12 large_size = 16 @@ -13,13 +12,9 @@ small_aa = true medium_aa = true large_aa = true mono_aa = true -last_newgrf_count = 1 -language = english.lng - -[newgrf] -opengfx+biggui.grf = +min_button_size = 30 +min_step_size = 30 [gui] left_mouse_btn_scrolling = true osk_activation = double - diff --git a/project/jni/application/openttd/cargodist-patches.sh b/project/jni/application/openttd/cargodist-patches.sh deleted file mode 100755 index dd839d940..000000000 --- a/project/jni/application/openttd/cargodist-patches.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -rm cargodist-patches.log - -PATCHES="*.patch" -if [ -n "$1" ]; then PATCHES="`echo $PATCHES | xargs -n1 echo | sort -r -t' '`" ; fi - -for f in $PATCHES; do - [ $f = openttd-trunk-android.patch ] && continue - echo $f | tee -a cargodist-patches.log - patch -p1 -d openttd-*-armeabi-v7a $1 < $f 2>&1 | tee -a cargodist-patches.log - grep FAILED cargodist-patches.log && exit 1 -done diff --git a/project/jni/application/openttd/openttd-trunk-android.patch b/project/jni/application/openttd/openttd-trunk-android.patch deleted file mode 100644 index d22a91ddd..000000000 --- a/project/jni/application/openttd/openttd-trunk-android.patch +++ /dev/null @@ -1,397 +0,0 @@ ---- findversion.sh 2014-02-25 11:17:27.000000000 +0200 -+++ findversion.sh 2014-03-13 22:51:42.431059430 +0200 -@@ -134,6 +134,7 @@ - REV_NR="" - fi - -+MODIFIED="0" # This prevents Andorid build from connecting to a public servers - if [ "$MODIFIED" -eq "2" ]; then - REV="${REV}M" - fi ---- src/debug.cpp 2014-02-25 11:17:24.000000000 +0200 -+++ src/debug.cpp 2014-03-13 22:51:41.679014683 +0200 -@@ -16,6 +16,9 @@ - #include "string_func.h" - #include "fileio_func.h" - #include "settings_type.h" -+#ifdef __ANDROID__ -+#include -+#endif - - #include - -@@ -107,6 +110,9 @@ - */ - static void debug_print(const char *dbg, const char *buf) - { -+#ifdef __ANDROID__ -+ __android_log_print(ANDROID_LOG_INFO, "OpenTTD", "[%s] %s", dbg, buf); -+#endif - #if defined(ENABLE_NETWORK) - if (_debug_socket != INVALID_SOCKET) { - char buf2[1024 + 32]; ---- src/fontdetection.cpp 2014-02-25 11:17:24.000000000 +0200 -+++ src/fontdetection.cpp 2014-03-14 15:18:47.947366408 +0200 -@@ -639,6 +639,7 @@ - if (fs != NULL) { - int best_weight = -1; - const char *best_font = NULL; -+ int best_missing_glypths = 65536; - - for (int i = 0; i < fs->nfont; i++) { - FcPattern *font = fs->fonts[i]; -@@ -664,12 +665,13 @@ - - callback->SetFontNames(settings, (const char*)file); - -- bool missing = callback->FindMissingGlyphs(NULL); -- DEBUG(freetype, 1, "Font \"%s\" misses%s glyphs", file, missing ? "" : " no"); -+ int missing = callback->FindMissingGlyphs(NULL); -+ DEBUG(freetype, 1, "Font \"%s\" misses %d glyphs for lang %s", file, missing, lang); - -- if (!missing) { -+ if (missing < best_missing_glypths) { - best_weight = value; - best_font = (const char *)file; -+ best_missing_glypths = missing; - } - } - -@@ -677,6 +679,7 @@ - ret = true; - callback->SetFontNames(settings, best_font); - InitFreeType(callback->Monospace()); -+ DEBUG(freetype, 1, "Selected font %s for lang %s", best_font, lang); - } - - /* Clean up the list of filenames. */ ---- src/music/libtimidity.cpp 2014-02-25 11:17:00.000000000 +0200 -+++ src/music/libtimidity.cpp 2014-03-13 22:51:41.711016587 +0200 -@@ -13,6 +13,7 @@ - #include "../openttd.h" - #include "../sound_type.h" - #include "../debug.h" -+#include "../core/math_func.hpp" - #include "libtimidity.h" - #include - #include -@@ -22,6 +23,7 @@ - #include - #include - #include -+#include - #if defined(PSP) - #include - #endif /* PSP */ -@@ -51,6 +53,24 @@ - } - } - #endif /* PSP */ -+#ifdef __ANDROID__ -+/* Android does not have Midi chip, we have to route the libtimidity output through SDL audio output */ -+void Android_MidiMixMusic(Sint16 *stream, int len) -+{ -+ if (_midi.status == MIDI_PLAYING) { -+ Sint16 buf[16384]; -+ while( len > 0 ) -+ { -+ int minlen = min(sizeof(buf), len); -+ mid_song_read_wave(_midi.song, stream, min(sizeof(buf), len*2)); -+ for( Uint16 i = 0; i < minlen; i++ ) -+ stream[i] += buf[i]; -+ stream += minlen; -+ len -= minlen; -+ } -+ } -+} -+#endif /* __ANDROID__ */ - - /** Factory for the libtimidity driver. */ - static FMusicDriver_LibTimidity iFMusicDriver_LibTimidity; ---- src/network/core/os_abstraction.h 2014-02-25 11:17:18.000000000 +0200 -+++ src/network/core/os_abstraction.h 2014-03-13 22:51:42.427059192 +0200 -@@ -161,7 +161,7 @@ - # include - /* According to glibc/NEWS, appeared in glibc-2.3. */ - # if !defined(__sgi__) && !defined(SUNOS) && !defined(__MORPHOS__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__INNOTEK_LIBC__) \ -- && !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX) -+ && !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX) && !defined(__ANDROID__) - /* If for any reason ifaddrs.h does not exist on your system, comment out - * the following two lines and an alternative way will be used to fetch - * the list of IPs from the system. */ ---- src/os/unix/crashlog_unix.cpp 2014-02-25 11:17:03.000000000 +0200 -+++ src/os/unix/crashlog_unix.cpp 2014-03-13 22:51:42.427059192 +0200 -@@ -141,7 +141,11 @@ - }; - - /** The signals we want our crash handler to handle. */ -+#ifdef __ANDROID__ -+static const int _signals_to_handle[] = { }; // Default Android signal handler will give us stack trace -+#else - static const int _signals_to_handle[] = { SIGSEGV, SIGABRT, SIGFPE, SIGBUS, SIGILL }; -+#endif - - /** - * Entry point for the crash handler. ---- src/os/unix/unix.cpp 2014-02-25 11:17:03.000000000 +0200 -+++ src/os/unix/unix.cpp 2014-03-13 22:51:42.427059192 +0200 -@@ -25,7 +25,7 @@ - - #ifdef __APPLE__ - #include --#elif (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__GLIBC__) -+#elif ((defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__GLIBC__)) && !defined(__ANDROID__) - #define HAS_STATVFS - #endif - -@@ -254,6 +254,11 @@ - void cocoaReleaseAutoreleasePool(); - #endif - -+#ifdef __ANDROID__ -+#define main SDL_main -+extern "C" int CDECL main(int, char *[]); -+#endif -+ - int CDECL main(int argc, char *argv[]) - { - int ret; ---- src/osk_gui.cpp 2014-02-25 11:17:24.000000000 +0200 -+++ src/osk_gui.cpp 2014-03-13 22:51:42.431059430 +0200 -@@ -22,6 +22,9 @@ - - #include "table/sprites.h" - #include "table/strings.h" -+#ifdef __ANDROID__ -+#include -+#endif - - char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1]; - static WChar _keyboard[2][OSK_KEYBOARD_ENTRIES]; -@@ -413,6 +416,16 @@ - - GetKeyboardLayout(); - new OskWindow(&_osk_desc, parent, button); -+#ifdef __ANDROID__ -+ char text[256]; -+ SDL_ANDROID_GetScreenKeyboardTextInput(text, sizeof(text) - 1); /* Invoke Android built-in screen keyboard */ -+ OskWindow *osk = dynamic_cast(FindWindowById(WC_OSK, 0)); -+ osk->qs->text.Assign(text); -+ free(osk->orig_str_buf); -+ osk->orig_str_buf = strdup(osk->qs->text.buf); -+ -+ osk->SetDirty(); -+#endif - } - - /** ---- src/script/api/script_date.cpp 2014-02-25 11:17:12.000000000 +0200 -+++ src/script/api/script_date.cpp 2014-03-13 22:51:42.431059430 +0200 -@@ -9,8 +9,8 @@ - - /** @file script_date.cpp Implementation of ScriptDate. */ - -+#include "../../stdafx.h" /* Have to be included before time.h, if we want UINT32_MAX macro defined on Android */ - #include --#include "../../stdafx.h" - #include "script_date.hpp" - #include "../../date_func.h" - ---- src/settings_gui.cpp 2014-02-25 11:17:23.000000000 +0200 -+++ src/settings_gui.cpp 2014-03-13 23:01:22.521550369 +0200 -@@ -323,17 +323,17 @@ - switch (widget) { - case WID_GO_BASE_GRF_DESCRIPTION: - SetDParamStr(0, BaseGraphics::GetUsedSet()->GetDescription(GetCurrentLanguageIsoCode())); -- DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_BLACK_RAW_STRING); -+ DrawString(r.left, r.right, r.top, STR_BLACK_RAW_STRING); - break; - - case WID_GO_BASE_SFX_DESCRIPTION: - SetDParamStr(0, BaseSounds::GetUsedSet()->GetDescription(GetCurrentLanguageIsoCode())); -- DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_BLACK_RAW_STRING); -+ DrawString(r.left, r.right, r.top, STR_BLACK_RAW_STRING); - break; - - case WID_GO_BASE_MUSIC_DESCRIPTION: - SetDParamStr(0, BaseMusic::GetUsedSet()->GetDescription(GetCurrentLanguageIsoCode())); -- DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_BLACK_RAW_STRING); -+ DrawString(r.left, r.right, r.top, STR_BLACK_RAW_STRING); - break; - } - } -@@ -344,7 +344,7 @@ - case WID_GO_BASE_GRF_DESCRIPTION: - /* Find the biggest description for the default size. */ - for (int i = 0; i < BaseGraphics::GetNumSets(); i++) { -- SetDParamStr(0, BaseGraphics::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode())); -+ SetDParamStr(0, "123"); - size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); - } - break; -@@ -363,7 +363,7 @@ - case WID_GO_BASE_SFX_DESCRIPTION: - /* Find the biggest description for the default size. */ - for (int i = 0; i < BaseSounds::GetNumSets(); i++) { -- SetDParamStr(0, BaseSounds::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode())); -+ SetDParamStr(0, "123"); - size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); - } - break; -@@ -371,7 +371,7 @@ - case WID_GO_BASE_MUSIC_DESCRIPTION: - /* Find the biggest description for the default size. */ - for (int i = 0; i < BaseMusic::GetNumSets(); i++) { -- SetDParamStr(0, BaseMusic::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode())); -+ SetDParamStr(0, "123"); - size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); - } - break; ---- src/sound/sdl_s.cpp 2014-02-25 11:16:59.000000000 +0200 -+++ src/sound/sdl_s.cpp 2014-03-13 22:51:42.431059430 +0200 -@@ -21,6 +21,10 @@ - /** Factory for the SDL sound driver. */ - static FSoundDriver_SDL iFSoundDriver_SDL; - -+#ifdef __ANDROID__ -+extern void Android_MidiMixMusic(Sint16 *stream, int len); -+#endif -+ - /** - * Callback that fills the sound buffer. - * @param userdata Ignored. -@@ -30,6 +34,9 @@ - static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len) - { - MxMixSamples(stream, len / 4); -+#if defined(__ANDROID__) && defined(LIBTIMIDITY) -+ Android_MidiMixMusic((Sint16 *)stream, len / 2); -+#endif - } - - const char *SoundDriver_SDL::Start(const char * const *parm) ---- src/strings.cpp 2014-02-25 11:17:24.000000000 +0200 -+++ src/strings.cpp 2014-03-13 23:44:07.197919943 +0200 -@@ -2005,7 +2005,7 @@ - * @return If glyphs are missing, return \c true, else return \c false. - * @post If \c true is returned and str is not NULL, *str points to a string that is found to contain at least one missing glyph. - */ --bool MissingGlyphSearcher::FindMissingGlyphs(const char **str) -+int MissingGlyphSearcher::FindMissingGlyphs(const char **str) - { - InitFreeType(this->Monospace()); - const Sprite *question_mark[FS_END]; -@@ -2015,6 +2015,7 @@ - } - - this->Reset(); -+ int missing = 0; - for (const char *text = this->NextString(); text != NULL; text = this->NextString()) { - FontSize size = this->DefaultSize(); - if (str != NULL) *str = text; -@@ -2025,11 +2026,11 @@ - size = FS_LARGE; - } else if (!IsInsideMM(c, SCC_SPRITE_START, SCC_SPRITE_END) && IsPrintable(c) && !IsTextDirectionChar(c) && c != '?' && GetGlyph(size, c) == question_mark[size]) { - /* The character is printable, but not in the normal font. This is the case we were testing for. */ -- return true; -+ missing++; - } - } - } -- return false; -+ return missing; - } - - /** Helper for searching through the language pack. */ ---- src/strings_func.h 2014-02-25 11:17:24.000000000 +0200 -+++ src/strings_func.h 2014-03-13 23:44:13.558298069 +0200 -@@ -235,7 +235,7 @@ - */ - virtual void SetFontNames(struct FreeTypeSettings *settings, const char *font_name) = 0; - -- bool FindMissingGlyphs(const char **str); -+ int FindMissingGlyphs(const char **str); - }; - - void CheckForMissingGlyphs(bool base_font = true, MissingGlyphSearcher *search = NULL); ---- src/video/sdl_v.cpp 2014-02-25 11:16:44.000000000 +0200 -+++ src/video/sdl_v.cpp 2014-03-13 22:51:42.431059430 +0200 -@@ -25,6 +25,9 @@ - #include "../fileio_func.h" - #include "sdl_v.h" - #include -+#ifdef __ANDROID__ -+#include -+#endif - - static FVideoDriver_SDL iFVideoDriver_SDL; - -@@ -349,6 +352,15 @@ - * surface, for example). */ - _requested_hwpalette = want_hwpalette; - -+#ifdef __ANDROID__ -+ SDL_Rect r; -+ r.h = SDL_ListModes(NULL, 0)[0]->h / 10; -+ r.w = r.h; -+ r.x = SDL_ListModes(NULL, 0)[0]->w - r.w; -+ r.y = SDL_ListModes(NULL, 0)[0]->h - r.h; -+ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, &r); -+#endif -+ - /* DO NOT CHANGE TO HWSURFACE, IT DOES NOT WORK */ - newscreen = SDL_CALL SDL_SetVideoMode(w, h, bpp, SDL_SWSURFACE | (want_hwpalette ? SDL_HWPALETTE : 0) | (_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE)); - if (newscreen == NULL) { -@@ -521,6 +533,8 @@ - if (sym->scancode == 49) key = WKC_BACKSPACE; - #elif defined(__sgi__) - if (sym->scancode == 22) key = WKC_BACKQUOTE; -+#elif defined(__ANDROID__) -+ if (sym->scancode == SDLK_BACKQUOTE) key = WKC_BACKQUOTE; - #else - if (sym->scancode == 49) key = WKC_BACKQUOTE; - #endif -@@ -597,7 +611,7 @@ - } - HandleMouseEvents(); - break; -- -+#ifndef __ANDROID__ - case SDL_ACTIVEEVENT: - if (!(ev.active.state & SDL_APPMOUSEFOCUS)) break; - -@@ -608,7 +622,7 @@ - _cursor.in_window = false; - } - break; -- -+#endif /* not __ANDROID__ */ - case SDL_QUIT: - HandleExitGameRequest(); - break; -@@ -623,13 +637,14 @@ - HandleKeypress(keycode, character); - } - break; -- -+#ifndef __ANDROID__ - case SDL_VIDEORESIZE: { - int w = max(ev.resize.w, 64); - int h = max(ev.resize.h, 64); - CreateMainSurface(w, h); - break; - } -+#endif /* not __ANDROID__ */ - case SDL_VIDEOEXPOSE: { - /* Force a redraw of the entire screen. Note - * that SDL 1.2 seems to do this automatically -@@ -661,6 +676,9 @@ - SetupKeyboard(); - - _draw_threaded = GetDriverParam(parm, "no_threads") == NULL && GetDriverParam(parm, "no_thread") == NULL; -+#ifdef __ANDROID__ -+ _draw_threaded = false; -+#endif - - return NULL; - } diff --git a/project/jni/application/openttd/src b/project/jni/application/openttd/src index d7b18a8e2..b17015932 160000 --- a/project/jni/application/openttd/src +++ b/project/jni/application/openttd/src @@ -1 +1 @@ -Subproject commit d7b18a8e2d5fbd64cea3099a6ea318d0fe1b3493 +Subproject commit b17015932c33e39ce9b4a6b2808dc7d7d1813858 diff --git a/project/jni/application/openttd/update-patch.sh b/project/jni/application/openttd/update-patch.sh deleted file mode 100755 index 3cb1b9e56..000000000 --- a/project/jni/application/openttd/update-patch.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -diff -u -r openttd-*-orig openttd-*-armeabi-v7a | filterdiff --strip=1 > openttd-trunk-android.patch