diff --git a/misc_gui.c b/misc_gui.c index f0af8a7b15..429e7f0286 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -1014,12 +1014,12 @@ static const Widget _save_dialog_widgets[] = { { WWT_IMGBTN, RESIZE_RIGHT, 14, 0, 256, 26, 47, 0x0, STR_NULL}, { WWT_IMGBTN, RESIZE_RB, 14, 0, 256, 48, 291, 0x0, STR_NULL}, { WWT_6, RESIZE_RB, 14, 2, 243, 50, 290, 0x0, STR_400A_LIST_OF_DRIVES_DIRECTORIES}, -{ WWT_SCROLLBAR, RESIZE_LRB, 14, 246, 256, 48, 279, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, +{ WWT_SCROLLBAR, RESIZE_LRB, 14, 246, 256, 48, 291, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, { WWT_IMGBTN, RESIZE_RTB, 14, 0, 256, 292, 307, 0x0, STR_NULL}, { WWT_IMGBTN, RESIZE_RTB, 14, 2, 254, 294, 305, 0x0, STR_400B_CURRENTLY_SELECTED_NAME}, { WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 127, 308, 319, STR_4003_DELETE, STR_400C_DELETE_THE_CURRENTLY_SELECTED}, -{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 128, 256, 308, 319, STR_4002_SAVE, STR_400D_SAVE_THE_CURRENT_GAME_USING}, -{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 246, 256, 280, 291, 0x0, STR_RESIZE_BUTTON}, +{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 128, 245, 308, 319, STR_4002_SAVE, STR_400D_SAVE_THE_CURRENT_GAME_USING}, +{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 246, 256, 308, 319, 0x0, STR_RESIZE_BUTTON}, { WIDGETS_END}, }; @@ -1031,12 +1031,12 @@ static const Widget _save_dialog_scen_widgets[] = { { WWT_IMGBTN, RESIZE_RIGHT, 14, 0, 256, 26, 47, 0x0, STR_NULL}, { WWT_IMGBTN, RESIZE_RB, 14, 0, 256, 48, 291, 0x0, STR_NULL}, { WWT_6, RESIZE_RB, 14, 2, 243, 50, 290, 0x0, STR_400A_LIST_OF_DRIVES_DIRECTORIES}, -{ WWT_SCROLLBAR, RESIZE_LRB, 14, 246, 256, 48, 279, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, +{ WWT_SCROLLBAR, RESIZE_LRB, 14, 246, 256, 48, 291, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, { WWT_IMGBTN, RESIZE_RTB, 14, 0, 256, 292, 307, 0x0, STR_NULL}, { WWT_IMGBTN, RESIZE_RTB, 14, 2, 254, 294, 305, 0x0, STR_400B_CURRENTLY_SELECTED_NAME}, { WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 127, 308, 319, STR_4003_DELETE, STR_400C_DELETE_THE_CURRENTLY_SELECTED}, -{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 128, 256, 308, 319, STR_4002_SAVE, STR_400D_SAVE_THE_CURRENT_GAME_USING}, -{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 246, 256, 280, 291, 0x0, STR_RESIZE_BUTTON}, +{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 128, 245, 308, 319, STR_4002_SAVE, STR_400D_SAVE_THE_CURRENT_GAME_USING}, +{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 246, 256, 308, 319, 0x0, STR_RESIZE_BUTTON}, { WIDGETS_END}, }; diff --git a/player_gui.c b/player_gui.c index db5b62a2a5..07adb6c7ee 100644 --- a/player_gui.c +++ b/player_gui.c @@ -16,7 +16,7 @@ #include "network_client.h" #endif -static void DoShowPlayerFinances(int player, bool show_small); +static void DoShowPlayerFinances(int player, bool show_small, bool show_stickied); static void DrawPlayerEconomyStats(Player *p, byte mode) @@ -96,8 +96,9 @@ static void DrawPlayerEconomyStats(Player *p, byte mode) static const Widget _player_finances_widgets[] = { { WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, RESIZE_NONE, 14, 11, 392, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 393, 406, 0, 13, 0x2AA, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, +{ WWT_CAPTION, RESIZE_NONE, 14, 11, 379, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 380, 394, 0, 13, 0x2AA, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, +{ WWT_STICKYBOX, RESIZE_NONE, 14, 395, 406, 0, 13, 0x0, STR_STICKY_BUTTON}, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 406, 14, 169, 0x0, STR_NULL}, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 406, 170, 203, 0x0, STR_NULL}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 202, 204, 215, STR_7029_BORROW, STR_7035_INCREASE_SIZE_OF_LOAN}, @@ -107,8 +108,9 @@ static const Widget _player_finances_widgets[] = { static const Widget _other_player_finances_widgets[] = { { WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, RESIZE_NONE, 14, 11, 392, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 393, 406, 0, 13, 0x2AA, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, +{ WWT_CAPTION, RESIZE_NONE, 14, 11, 379, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 380, 394, 0, 13, 0x2AA, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, +{ WWT_STICKYBOX, RESIZE_NONE, 14, 395, 406, 0, 13, 0x0, STR_STICKY_BUTTON}, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 406, 14, 169, 0x0, STR_NULL}, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 406, 170, 203, 0x0, STR_NULL}, { WIDGETS_END}, @@ -116,8 +118,9 @@ static const Widget _other_player_finances_widgets[] = { static const Widget _other_player_finances_small_widgets[] = { { WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, RESIZE_NONE, 14, 11, 265, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 266, 279, 0, 13, 0x2AA, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, +{ WWT_CAPTION, RESIZE_NONE, 14, 11, 253, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 254, 267, 0, 13, 0x2AA, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, +{ WWT_STICKYBOX, RESIZE_NONE, 14, 268, 279, 0, 13, 0x0, STR_STICKY_BUTTON}, { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 279, 14, 47, 0x0, STR_NULL}, { WIDGETS_END}, @@ -125,8 +128,9 @@ static const Widget _other_player_finances_small_widgets[] = { static const Widget _player_finances_small_widgets[] = { { WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, RESIZE_NONE, 14, 11, 265, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 266, 279, 0, 13, 0x2AA, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, +{ WWT_CAPTION, RESIZE_NONE, 14, 11, 253, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 254, 267, 0, 13, 0x2AA, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, +{ WWT_STICKYBOX, RESIZE_NONE, 14, 268, 279, 0, 13, 0x0, STR_STICKY_BUTTON}, { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 279, 14, 47, 0x0, STR_NULL}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 139, 48, 59, STR_7029_BORROW, STR_7035_INCREASE_SIZE_OF_LOAN}, @@ -156,16 +160,17 @@ static void PlayerFinancesWndProc(Window *w, WindowEvent *e) switch(e->click.widget) { case 2: {/* toggle size */ byte mode = (byte)WP(w,def_d).data_1; + bool stickied = !!(w->flags4 & WF_STICKY); int player = w->window_number; DeleteWindow(w); - DoShowPlayerFinances(player, (mode & 1) == 0); + DoShowPlayerFinances(player, mode^1, stickied); } break; - case 5: /* increase loan */ + case 6: /* increase loan */ DoCommandP(0, w->window_number, _ctrl_pressed, NULL, CMD_INCREASE_LOAN | CMD_MSG(STR_702C_CAN_T_BORROW_ANY_MORE_MONEY)); break; - case 6: /* repay loan */ + case 7: /* repay loan */ DoCommandP(0, w->window_number, _ctrl_pressed, NULL, CMD_DECREASE_LOAN | CMD_MSG(STR_702F_CAN_T_REPAY_LOAN)); break; } @@ -176,7 +181,7 @@ static void PlayerFinancesWndProc(Window *w, WindowEvent *e) static const WindowDesc _player_finances_desc = { -1,-1, 407, 216, WC_FINANCES,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _player_finances_widgets, PlayerFinancesWndProc }; @@ -184,7 +189,7 @@ static const WindowDesc _player_finances_desc = { static const WindowDesc _player_finances_small_desc = { -1,-1, 280, 60, WC_FINANCES,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _player_finances_small_widgets, PlayerFinancesWndProc }; @@ -192,7 +197,7 @@ static const WindowDesc _player_finances_small_desc = { static const WindowDesc _other_player_finances_desc = { -1,-1, 407, 204, WC_FINANCES,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _other_player_finances_widgets, PlayerFinancesWndProc }; @@ -200,7 +205,7 @@ static const WindowDesc _other_player_finances_desc = { static const WindowDesc _other_player_finances_small_desc = { -1,-1, 280, 48, WC_FINANCES,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _other_player_finances_small_widgets, PlayerFinancesWndProc }; @@ -210,7 +215,7 @@ static const WindowDesc * const desc_table[2*2] = { &_other_player_finances_desc,&_other_player_finances_small_desc, }; -static void DoShowPlayerFinances(int player, bool show_small) +static void DoShowPlayerFinances(int player, bool show_small, bool show_stickied) { Window *w; int mode; @@ -220,12 +225,16 @@ static void DoShowPlayerFinances(int player, bool show_small) if (w) { w->caption_color = w->window_number; WP(w,def_d).data_1 = mode; + if (show_stickied) { + w->flags4 |= WF_STICKY; + w->click_state ^= (1 << 3); + } } } void ShowPlayerFinances(int player) { - DoShowPlayerFinances(player, false); + DoShowPlayerFinances(player, false, false); } static void SelectPlayerColorWndProc(Window *w, WindowEvent *e)