summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-12-22 01:32:30 +0000
committerdarkvater <darkvater@openttd.org>2004-12-22 01:32:30 +0000
commit4e38703e8cdc63c33b1f70079ac250a0415ce0f8 (patch)
tree3c5684f75c1a347d6c3d5074699b344f4fb36c46
parentf8c9d0ea56d32367d8d646d7028a2ee843cca7fe (diff)
downloadopenttd-4e38703e8cdc63c33b1f70079ac250a0415ce0f8.tar.xz
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
-Feature: With the sticky windows on and some unfortunate resizing of your game it the 'close' button might go outside of the playing field, making it impossible to close. Added an option to the Options menu that closes all windows, even if they are stickified ("Close ALL windows")
-rw-r--r--industry_gui.c24
-rw-r--r--lang/english.txt2
-rw-r--r--main_gui.c50
-rw-r--r--smallmap_gui.c45
-rw-r--r--station_gui.c39
-rw-r--r--town_gui.c33
6 files changed, 113 insertions, 80 deletions
diff --git a/industry_gui.c b/industry_gui.c
index b43aaabc9..235004c01 100644
--- a/industry_gui.c
+++ b/industry_gui.c
@@ -315,11 +315,11 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch(e->click.widget) {
- case 5:
+ case 6:
i = DEREF_INDUSTRY(w->window_number);
ScrollMainWindowToTile(i->xy + TILE_XY(1,1));
break;
- case 6:
+ case 7:
// Destroy Industry button costing money removed per request of dominik
//i = DEREF_INDUSTRY(w->window_number);
/* passing only i->xy is not safe if industry has a weird shape like:
@@ -337,7 +337,8 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
static const Widget _industry_view_widgets[] = {
{ WWT_TEXTBTN, 9, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 9, 11, 259, 0, 13, STR_4801, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 9, 11, 247, 0, 13, STR_4801, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 9, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_IMGBTN, 9, 0, 259, 14, 105, 0x0, STR_NULL},
{ WWT_6, 9, 2, 257, 16, 103, 0x0, STR_NULL},
{ WWT_IMGBTN, 9, 0, 259, 106, 147, 0x0, STR_NULL},
@@ -351,7 +352,7 @@ static const Widget _industry_view_widgets[] = {
static const WindowDesc _industry_view_desc = {
-1, -1, 260, 160,
WC_INDUSTRY_VIEW,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
_industry_view_widgets,
IndustryViewWndProc
};
@@ -371,7 +372,8 @@ void ShowIndustryViewWindow(int industry)
static const Widget _industry_directory_widgets[] = {
{ WWT_TEXTBTN, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 13, 11, 507, 0, 13, STR_INDUSTRYDIR_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 13, 11, 495, 0, 13, STR_INDUSTRYDIR_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 13, 496, 507, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_PUSHTXTBTN, 13, 0, 100, 14, 25, STR_SORT_BY_NAME, STR_SORT_ORDER_TIP},
{ WWT_PUSHTXTBTN, 13, 101, 200, 14, 25, STR_SORT_BY_TYPE, STR_SORT_ORDER_TIP},
{ WWT_PUSHTXTBTN, 13, 201, 300, 14, 25, STR_SORT_BY_PRODUCTION, STR_SORT_ORDER_TIP},
@@ -520,31 +522,31 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch(e->click.widget) {
- case 2: {
+ case 3: {
_industry_sort_order = _industry_sort_order==0 ? 1 : 0;
_industry_sort_dirty = true;
SetWindowDirty(w);
} break;
- case 3: {
+ case 4: {
_industry_sort_order = _industry_sort_order==2 ? 3 : 2;
_industry_sort_dirty = true;
SetWindowDirty(w);
} break;
- case 4: {
+ case 5: {
_industry_sort_order = _industry_sort_order==4 ? 5 : 4;
_industry_sort_dirty = true;
SetWindowDirty(w);
} break;
- case 5: {
+ case 6: {
_industry_sort_order = _industry_sort_order==6 ? 7 : 6;
_industry_sort_dirty = true;
SetWindowDirty(w);
} break;
- case 7: {
+ case 8: {
int y = (e->click.pt.y - 28) / 10;
byte p;
Industry *c;
@@ -571,7 +573,7 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
static const WindowDesc _industry_directory_desc = {
-1, -1, 508, 190,
WC_INDUSTRY_DIRECTORY,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
_industry_directory_widgets,
IndustryDirectoryWndProc
};
diff --git a/lang/english.txt b/lang/english.txt
index 2c33409f9..6d4b3b316 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -742,6 +742,8 @@ STR_NEWGRF_SETTINGS :Newgrf settings
STR_NEWGRF_SETTINGS2 :Newgrf settings
STR_GAMEOPTMENU_0A :
STR_GAMEOPTMENU_0B :
+STR_CLOSE_ALL_WINDOWS :Close ALL windows
+STR_CLOSE_ALL_WINDOWS2 :Close ALL windows
STR_02C9_TOWN_NAMES_DISPLAYED :{CHECKMARK}{SETX 12}Town names displayed
STR_02CA_TOWN_NAMES_DISPLAYED :{SETX 12}Town names displayed
STR_02CB_STATION_NAMES_DISPLAYED :{CHECKMARK}{SETX 12}Station names displayed
diff --git a/main_gui.c b/main_gui.c
index c8fec2574..93577dbc5 100644
--- a/main_gui.c
+++ b/main_gui.c
@@ -152,6 +152,25 @@ static void ToolbarFastForwardClick(Window *w)
SndPlayFx(SND_15_BEEP);
}
+/* It is possible that a stickied window gets to a position where the
+ * 'close' button is outside the gaming area. You cannot close it then; except
+ * with this function. It closes all windows calling the standard function,
+ * then, does a little hacked loop of closing all stickied windows. Note
+ * that standard windows (status bar, etc.) are not stickied, so these aren't affected */
+static void CloseEveryWindow(void)
+{
+ Window *w;
+ // Delete every window except for stickied ones
+ DeleteNonVitalWindows();
+ // Delete all sticked windows
+ for (w = _windows; w != _last_window;) {
+ if (w->flags4 & WF_STICKY) {
+ DeleteWindow(w);
+ w = _windows;
+ } else
+ w++;
+ }
+}
typedef void MenuClickedProc(int index);
@@ -164,13 +183,14 @@ static void MenuClickSettings(int index)
case 2: ShowPatchesSelection(); return;
case 3: ShowNewgrf(); return;
- case 5: _display_opt ^= DO_SHOW_TOWN_NAMES; MarkWholeScreenDirty(); return;
- case 6: _display_opt ^= DO_SHOW_STATION_NAMES; MarkWholeScreenDirty(); return;
- case 7: _display_opt ^= DO_SHOW_SIGNS; MarkWholeScreenDirty(); return;
- case 8: _display_opt ^= DO_WAYPOINTS; MarkWholeScreenDirty(); return;
- case 9: _display_opt ^= DO_FULL_ANIMATION; MarkWholeScreenDirty(); return;
- case 10: _display_opt ^= DO_FULL_DETAIL; MarkWholeScreenDirty(); return;
- case 11: _display_opt ^= DO_TRANS_BUILDINGS; MarkWholeScreenDirty(); return;
+ case 5: CloseEveryWindow(); return;
+ case 6: _display_opt ^= DO_SHOW_TOWN_NAMES; MarkWholeScreenDirty(); return;
+ case 7: _display_opt ^= DO_SHOW_STATION_NAMES; MarkWholeScreenDirty(); return;
+ case 8: _display_opt ^= DO_SHOW_SIGNS; MarkWholeScreenDirty(); return;
+ case 9: _display_opt ^= DO_WAYPOINTS; MarkWholeScreenDirty(); return;
+ case 10: _display_opt ^= DO_FULL_ANIMATION; MarkWholeScreenDirty(); return;
+ case 11: _display_opt ^= DO_FULL_DETAIL; MarkWholeScreenDirty(); return;
+ case 12: _display_opt ^= DO_TRANS_BUILDINGS; MarkWholeScreenDirty(); return;
}
}
@@ -985,16 +1005,16 @@ static void ToolbarOptionsClick(Window *w)
{
uint16 x;
- w = PopupMainToolbMenu(w, 43, 2, STR_02C3_GAME_OPTIONS, 12);
+ w = PopupMainToolbMenu(w, 43, 2, STR_02C3_GAME_OPTIONS, 13);
x = (uint16)-1;
- if (_display_opt & DO_SHOW_TOWN_NAMES) x &= ~(1<<5);
- if (_display_opt & DO_SHOW_STATION_NAMES) x &= ~(1<<6);
- if (_display_opt & DO_SHOW_SIGNS) x &= ~(1<<7);
- if (_display_opt & DO_WAYPOINTS) x &= ~(1<<8);
- if (_display_opt & DO_FULL_ANIMATION) x &= ~(1<<9);
- if (_display_opt & DO_FULL_DETAIL) x &= ~(1<<10);
- if (_display_opt & DO_TRANS_BUILDINGS) x &= ~(1<<11);
+ if (_display_opt & DO_SHOW_TOWN_NAMES) x &= ~(1<<6);
+ if (_display_opt & DO_SHOW_STATION_NAMES) x &= ~(1<<7);
+ if (_display_opt & DO_SHOW_SIGNS) x &= ~(1<<8);
+ if (_display_opt & DO_WAYPOINTS) x &= ~(1<<9);
+ if (_display_opt & DO_FULL_ANIMATION) x &= ~(1<<10);
+ if (_display_opt & DO_FULL_DETAIL) x &= ~(1<<11);
+ if (_display_opt & DO_TRANS_BUILDINGS) x &= ~(1<<12);
WP(w,menu_d).checked_items = x;
}
diff --git a/smallmap_gui.c b/smallmap_gui.c
index 063a3da90..880ff40d4 100644
--- a/smallmap_gui.c
+++ b/smallmap_gui.c
@@ -13,7 +13,8 @@
static const Widget _smallmap_megabig_widgets[] = {
{ WWT_TEXTBTN, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 13, 11, 592, 0, 13, STR_00B0_MAP,STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 13, 11, 580, 0, 13, STR_00B0_MAP,STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 13, 581, 592, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_IMGBTN, 13, 593, 606, 0, 13, 0x2AA, STR_01CC_TOGGLE_LARGE_SMALL_MAP},
{ WWT_IMGBTN, 13, 0, 606, 14, 407, 0x0, STR_NULL},
{ WWT_6, 13, 2, 604, 16, 405, 0x0, STR_NULL},
@@ -31,7 +32,8 @@ static const Widget _smallmap_megabig_widgets[] = {
static const Widget _smallmap_big_widgets[] = {
{ WWT_TEXTBTN, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 13, 11, 431, 0, 13, STR_00B0_MAP,STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 13, 11, 419, 0, 13, STR_00B0_MAP,STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 13, 420, 431, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_IMGBTN, 13, 432, 445, 0, 13, 0x2AA, STR_01CC_TOGGLE_LARGE_SMALL_MAP},
{ WWT_IMGBTN, 13, 0, 445, 14, 257, 0x0, STR_NULL},
{ WWT_6, 13, 2, 443, 16, 255, 0x0, STR_NULL},
@@ -50,7 +52,8 @@ static const Widget _smallmap_big_widgets[] = {
static const Widget _smallmap_small_widgets[] = {
{ WWT_TEXTBTN, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 13, 11, 233, 0, 13, STR_00B0_MAP,STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 13, 11, 221, 0, 13, STR_00B0_MAP,STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 13, 222, 233, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_IMGBTN, 13, 234, 247, 0, 13, 0x2AA, STR_01CC_TOGGLE_LARGE_SMALL_MAP},
{ WWT_IMGBTN, 13, 0, 225, 14, 167, 0x0, STR_NULL},
{ WWT_6, 13, 2, 223, 16, 165, 0x0, STR_NULL},
@@ -879,7 +882,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch(e->click.widget) {
- case 2: {/* big/small size */
+ case 3: {/* big/small size */
// const Widget *wi = w->widget;
DeleteWindow(w);
SndPlayFx(SND_15_BEEP);
@@ -890,7 +893,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
}
} break;
- case 4: {/* main wnd */
+ case 5: {/* main wnd */
Window *w2;
Point pt;
@@ -903,23 +906,23 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
WP(w2,vp_d).scrollpos_y = pt.y + ((_cursor.pos.y - w->top - 16) << 4) - (w2->viewport->virtual_height >> 1);
} break;
- case 5: /* show land contours */
- case 6: /* show vehicles */
- case 7: /* show industries */
- case 8: /* show transport routes */
- case 9: /* show vegetation */
- case 10: /* show land owners */
- w->click_state &= ~(1<<5|1<<6|1<<7|1<<8|1<<9|1<<10);
+ case 6: /* show land contours */
+ case 7: /* show vehicles */
+ case 8: /* show industries */
+ case 9: /* show transport routes */
+ case 10: /* show vegetation */
+ case 11: /* show land owners */
+ w->click_state &= ~(1<<6|1<<7|1<<8|1<<9|1<<10|1<<11);
w->click_state |= 1 << e->click.widget;
- _smallmap_type = e->click.widget - 5;
+ _smallmap_type = e->click.widget - 6;
SetWindowDirty(w);
SndPlayFx(SND_15_BEEP);
break;
- case 11: /* toggle town names */
- w->click_state ^= (1 << 11);
- _smallmap_show_towns = (w->click_state >> 11) & 1;
+ case 12: /* toggle town names */
+ w->click_state ^= (1 << 12);
+ _smallmap_show_towns = (w->click_state >> 12) & 1;
SetWindowDirty(w);
SndPlayFx(SND_15_BEEP);
break;
@@ -927,7 +930,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
break;
case WE_RCLICK:
- if (e->click.widget == 4) {
+ if (e->click.widget == 5) {
if (_scrolling_viewport)
return;
_scrolling_viewport = true;
@@ -947,7 +950,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
static const WindowDesc _smallmap_small_desc = {
-1,-1, 248, 212,
WC_SMALLMAP,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_smallmap_small_widgets,
SmallMapWindowProc
};
@@ -955,7 +958,7 @@ static const WindowDesc _smallmap_small_desc = {
static const WindowDesc _smallmap_big_desc = {
-1,-1, 446, 302,
WC_SMALLMAP,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_smallmap_big_widgets,
SmallMapWindowProc
};
@@ -963,7 +966,7 @@ static const WindowDesc _smallmap_big_desc = {
static const WindowDesc _smallmap_megabig_desc = {
-1,-1, 607, 452,
WC_SMALLMAP,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_smallmap_megabig_widgets,
SmallMapWindowProc
};
@@ -984,7 +987,7 @@ static void DoShowSmallMap(int big)
w = AllocateWindowDescFront(_smallmap_descs[big], 0);
if (w) {
- w->click_state = (1<<5) << _smallmap_type | _smallmap_show_towns << 11;
+ w->click_state = (1<<6) << _smallmap_type | _smallmap_show_towns << 12;
vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport;
x = (((vp->virtual_width - (big?220*32:110*32)) >> 1) + vp->virtual_left) >> 2;
diff --git a/station_gui.c b/station_gui.c
index 91800124c..222da540b 100644
--- a/station_gui.c
+++ b/station_gui.c
@@ -195,7 +195,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
} break;
case WE_CLICK: {
switch(e->click.widget) {
- case 2: {
+ case 3: {
uint32 id_v = (e->click.pt.y - 15) / 10;
if (id_v >= w->vscroll.cap) { return;} // click out of bounds
@@ -231,7 +231,8 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
static const Widget _player_stations_widgets[] = {
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 14, 11, 357, 0, 13, STR_3048_STATIONS, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 14, 11, 345, 0, 13, STR_3048_STATIONS, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 14, 346, 357, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_PANEL, 14, 0, 346, 14, 137, 0x0, STR_3057_STATION_NAMES_CLICK_ON},
{ WWT_SCROLLBAR, 14, 347, 357, 14, 137, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
{ WIDGETS_END},
@@ -240,7 +241,7 @@ static const Widget _player_stations_widgets[] = {
static const WindowDesc _player_stations_desc = {
-1, -1, 358, 138,
WC_STATION_LIST,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_player_stations_widgets,
PlayerStationsWndProc
};
@@ -259,7 +260,8 @@ void ShowPlayerStations(int player)
static const Widget _station_view_expanded_widgets[] = {
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 14, 11, 248, 0, 13, STR_300A_0, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 14, 11, 236, 0, 13, STR_300A_0, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 14, 237, 248, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_IMGBTN, 14, 0, 237, 14, 65, 0x0, STR_NULL},
{ WWT_SCROLLBAR, 14, 238, 248, 14, 65, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
{ WWT_EMPTY, 0, 0, 0, 0, 0, 0x0, STR_NULL},
@@ -276,7 +278,8 @@ static const Widget _station_view_expanded_widgets[] = {
static const Widget _station_view_widgets[] = {
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 14, 11, 248, 0, 13, STR_300A_0, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 14, 11, 236, 0, 13, STR_300A_0, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 14, 237, 248, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_IMGBTN, 14, 0, 237, 14, 65, 0x0, STR_NULL},
{ WWT_SCROLLBAR, 14, 238, 248, 14, 65, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
{ WWT_IMGBTN, 14, 0, 248, 66, 97, 0x0, STR_NULL},
@@ -317,13 +320,13 @@ static void DrawStationViewWindow(Window *w)
}
SetVScrollCount(w, num);
- w->disabled_state = st->owner == _local_player ? 0 : (1 << 8);
+ w->disabled_state = st->owner == _local_player ? 0 : (1 << 9);
- if (!(st->facilities & FACIL_TRAIN)) SETBIT(w->disabled_state, 9);
+ if (!(st->facilities & FACIL_TRAIN)) SETBIT(w->disabled_state, 10);
if (!(st->facilities & FACIL_TRUCK_STOP) &&
- !(st->facilities & FACIL_BUS_STOP)) SETBIT(w->disabled_state, 10);
- if (!(st->facilities & FACIL_AIRPORT)) SETBIT(w->disabled_state, 11);
- if (!(st->facilities & FACIL_DOCK)) SETBIT(w->disabled_state, 12);
+ !(st->facilities & FACIL_BUS_STOP)) SETBIT(w->disabled_state, 11);
+ if (!(st->facilities & FACIL_AIRPORT)) SETBIT(w->disabled_state, 12);
+ if (!(st->facilities & FACIL_DOCK)) SETBIT(w->disabled_state, 13);
SetDParam(0, st->index);
SetDParam(1, st->facilities);
@@ -438,11 +441,11 @@ static void StationViewWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch(e->click.widget) {
- case 6:
+ case 7:
ScrollMainWindowToTile(DEREF_STATION(w->window_number)->xy);
break;
- case 7:
+ case 8:
SetWindowDirty(w);
/* toggle height/widget set */
@@ -452,32 +455,32 @@ static void StationViewWndProc(Window *w, WindowEvent *e)
SetWindowDirty(w);
break;
- case 8: {
+ case 9: {
Station *st = DEREF_STATION(w->window_number);
SetDParam(0, st->town->townnametype);
SetDParam(1, st->town->townnameparts);
ShowQueryString(st->string_id, STR_3030_RENAME_STATION_LOADING, 31, 180, w->window_class, w->window_number);
} break;
- case 9: {
+ case 10: {
const Station *st = DEREF_STATION(w->window_number);
ShowPlayerTrains(st->owner, w->window_number);
break;
}
- case 10: {
+ case 11: {
const Station *st = DEREF_STATION(w->window_number);
ShowPlayerRoadVehicles(st->owner, w->window_number);
break;
}
- case 11: {
+ case 12: {
const Station *st = DEREF_STATION(w->window_number);
ShowPlayerAircraft(st->owner, w->window_number);
break;
}
- case 12: {
+ case 13: {
const Station *st = DEREF_STATION(w->window_number);
ShowPlayerShips(st->owner, w->window_number);
break;
@@ -513,7 +516,7 @@ static void StationViewWndProc(Window *w, WindowEvent *e)
static const WindowDesc _station_view_desc = {
-1, -1, 249, 110,
WC_STATION_VIEW,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
_station_view_widgets,
StationViewWndProc
};
diff --git a/town_gui.c b/town_gui.c
index cabee1028..652899c11 100644
--- a/town_gui.c
+++ b/town_gui.c
@@ -247,20 +247,20 @@ static void TownViewWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch(e->click.widget) {
- case 5: /* scroll to location */
+ case 6: /* scroll to location */
ScrollMainWindowToTile(t->xy);
break;
- case 6: /* town authority */
+ case 7: /* town authority */
ShowTownAuthorityWindow(w->window_number);
break;
- case 7: /* rename */
+ case 8: /* rename */
SetDParam(0, t->townnameparts);
ShowQueryString(t->townnametype, STR_2007_RENAME_TOWN, 31, 130, w->window_class, w->window_number);
break;
- case 8: /* expand town */
+ case 9: /* expand town */
ExpandTown(t);
break;
- case 9: /* delete town */
+ case 10: /* delete town */
DeleteTown(t);
break;
}
@@ -279,7 +279,8 @@ static void TownViewWndProc(Window *w, WindowEvent *e)
static const Widget _town_view_widgets[] = {
{ WWT_TEXTBTN, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 13, 11, 259, 0, 13, STR_2005, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 13, 11, 247, 0, 13, STR_2005, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 13, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_IMGBTN, 13, 0, 259, 14, 105, 0x0, STR_NULL},
{ WWT_6, 13, 2, 257, 16, 103, 0x0, STR_NULL},
{ WWT_IMGBTN, 13, 0, 259, 106, 137, 0x0, STR_NULL},
@@ -292,20 +293,21 @@ static const Widget _town_view_widgets[] = {
static const WindowDesc _town_view_desc = {
-1, -1, 260, 150,
WC_TOWN_VIEW,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
_town_view_widgets,
TownViewWndProc
};
static const Widget _town_view_scen_widgets[] = {
{ WWT_TEXTBTN, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 13, 11, 184, 0, 13, STR_2005, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 13, 11, 172, 0, 13, STR_2005, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 13, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_IMGBTN, 13, 0, 259, 14, 105, 0x0, STR_NULL},
{ WWT_6, 13, 2, 257, 16, 103, 0x0, STR_NULL},
{ WWT_IMGBTN, 13, 0, 259, 106, 137, 0x0, STR_NULL},
{ WWT_PUSHTXTBTN, 13, 0, 85, 138, 149, STR_00E4_LOCATION, STR_200B_CENTER_THE_MAIN_VIEW_ON},
{ WWT_EMPTY, 0, 0, 0, 0, 0, 0x0, STR_NULL},
-{ WWT_PUSHTXTBTN, 13, 185, 259, 0, 13, STR_0130_RENAME, STR_200C_CHANGE_TOWN_NAME},
+{ WWT_PUSHTXTBTN, 13, 173, 247, 0, 13, STR_0130_RENAME, STR_200C_CHANGE_TOWN_NAME},
{ WWT_PUSHTXTBTN, 13, 86, 171, 138, 149, STR_023C_EXPAND, STR_023B_INCREASE_SIZE_OF_TOWN},
{ WWT_PUSHTXTBTN, 13, 172, 259, 138, 149, STR_0290_DELETE, STR_0291_DELETE_THIS_TOWN_COMPLETELY},
{ WIDGETS_END},
@@ -314,7 +316,7 @@ static const Widget _town_view_scen_widgets[] = {
static const WindowDesc _town_view_scen_desc = {
-1, -1, 260, 150,
WC_TOWN_VIEW,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
_town_view_scen_widgets,
TownViewWndProc
};
@@ -339,7 +341,8 @@ void ShowTownViewWindow(uint town)
static const Widget _town_directory_widgets[] = {
{ WWT_TEXTBTN, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 13, 11, 207, 0, 13, STR_2000_TOWNS, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 13, 11, 195, 0, 13, STR_2000_TOWNS, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 13, 196, 207, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_PUSHTXTBTN, 13, 0, 98, 14, 25, STR_SORT_BY_NAME, STR_SORT_ORDER_TIP},
{ WWT_PUSHTXTBTN, 13, 99, 196, 14, 25, STR_SORT_BY_POPULATION,STR_SORT_ORDER_TIP},
{ WWT_IMGBTN, 13, 0, 196, 26, 189, 0x0, STR_200A_TOWN_NAMES_CLICK_ON_NAME},
@@ -440,19 +443,19 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch(e->click.widget) {
- case 2: { /* Sort by Name ascending/descending */
+ case 3: { /* Sort by Name ascending/descending */
_town_sort_order = (_town_sort_order == 0) ? 1 : 0;
_town_sort_dirty = true;
SetWindowDirty(w);
} break;
- case 3: { /* Sort by Population ascending/descending */
+ case 4: { /* Sort by Population ascending/descending */
_town_sort_order = (_town_sort_order == 2) ? 3 : 2;
_town_sort_dirty = true;
SetWindowDirty(w);
} break;
- case 4: { /* Click on Town Matrix */
+ case 5: { /* Click on Town Matrix */
uint16 id_v = (e->click.pt.y - 28) / 10;
if (id_v >= w->vscroll.cap) { return;} // click out of bounds
@@ -480,7 +483,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
static const WindowDesc _town_directory_desc = {
-1, -1, 208, 190,
WC_TOWN_DIRECTORY,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
_town_directory_widgets,
TownDirectoryWndProc
};