http://bugs.freeciv.org/Ticket/Display.html?id=36339 >
> [dmarks - Do 20. Sep 2007, 07:11:05]:
>
> On 9/17/07, Pepeto _ <[EMAIL PROTECTED]> wrote:
> >
> > http://bugs.freeciv.org/Ticket/Display.html?id=36339 >
> >
> > > [dmarks - Lun. Sep. 17 08:11:29 2007]:
> > >
> > > > [dmarks - Mon Feb 19 05:36:47 2007]:
> > > >
> > > > The SDL client lacks a simple 'save' button (couldn't find one at
> > > least).
> > > >
> > > > ~Daniel
> > > >
> > > >
> > > >
> > >
> > > I propose this simple (?) solution:
> > >
> > > In the options dialog, replace the 'Disconnect' button with a 'Save
> > > and Quit' one.
> > > Clicking it will save the game for you and then bring you to the main
> > > menu. The
> > > 'Quit' button will bring you to the main menu without saving (equal to
> > > the current
> > > effect of the 'Disconnect' button.)
> > >
> > > Thoughts?
> > >
> > > ~Daniel
> > >
> > >
> > It should depend of is_server_running(). If is_server_running() ==
> > FALSE, there is any reason to set a button 'Save and Quit', because it
> > should fail.
> >
> >
>
> Agreed. In that case the button should naturally be grayed out.
>
> ~Daniel
>
How about this solution?
<>Index: client/gui-sdl/gui_id.h
===
--- client/gui-sdl/gui_id.h (revision 13780)
+++ client/gui-sdl/gui_id.h (working copy)
@@ -124,6 +124,7 @@
ID_OPTIONS_MAP_TERRAIN_FOG_LABEL,
ID_OPTIONS_MAP_TERRAIN_FOG_CHECKBOX,
ID_OPTIONS_WORKLIST_BUTTON,
+ ID_OPTIONS_SAVE_GAME_BUTTON,
ID_OPTIONS_DISC_BUTTON,
ID_OPTIONS_BACK_BUTTON,
ID_OPTIONS_EXIT_BUTTON,
Index: client/gui-sdl/optiondlg.c
===
--- client/gui-sdl/optiondlg.c (revision 13780)
+++ client/gui-sdl/optiondlg.c (working copy)
@@ -39,6 +39,7 @@
#include "civclient.h"
#include "climisc.h"
#include "clinet.h"
+#include "connectdlg_common.h"
/* gui-sdl */
#include "colors.h"
@@ -2127,6 +2128,15 @@
enable_options_button();
}
+static int save_game_callback(struct widget *pWidget)
+{
+ if (Main.event.button.button == SDL_BUTTON_LEFT) {
+send_save_game(NULL);
+back_callback(NULL);
+ }
+ return -1;
+}
+
static int exit_callback(struct widget *pWidget)
{
if (Main.event.button.button == SDL_BUTTON_LEFT) {
@@ -2142,7 +2152,7 @@
void popup_optiondlg(void)
{
struct widget *pTmp_GUI, *pWindow;
- struct widget *pQuit, *pDisconnect = NULL, *pBack;
+ struct widget *pCloseButton;
SDL_String16 *pStr;
SDL_Surface *pLogo;
int longest = 0;
@@ -2172,39 +2182,18 @@
pOption_Dlg->pEndOptionsWidgetList = pWindow;
area = pWindow->area;
+
+ /* close button */
+ pCloseButton = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
+ WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+ pCloseButton->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
+ pCloseButton->action = back_callback;
+ set_wstate(pCloseButton, FC_WS_NORMAL);
+ pCloseButton->key = SDLK_ESCAPE;
- /* create exit button */
- pQuit = create_themeicon_button_from_chars(pTheme->CANCEL_Icon,
-pWindow->dst, _("Quit"), adj_font(12), 0);
- pQuit->action = exit_callback;
- pQuit->key = SDLK_q;
- set_wstate(pQuit, FC_WS_NORMAL);
- add_to_gui_list(ID_OPTIONS_EXIT_BUTTON, pQuit);
-
- area.w += adj_size(10) + pQuit->size.w;
+ add_to_gui_list(ID_OPTIONS_BACK_BUTTON, pCloseButton);
- /* create disconnection button */
- if(aconnection.established) {
-pDisconnect = create_themeicon_button_from_chars(pTheme->BACK_Icon,
-pWindow->dst, _("Disconnect"), adj_font(12), 0);
-pDisconnect->action = disconnect_callback;
-set_wstate(pDisconnect, FC_WS_NORMAL);
-add_to_gui_list(ID_OPTIONS_DISC_BUTTON, pDisconnect);
-
-area.w += adj_size(10) + pDisconnect->size.w + adj_size(10);
- }
-
- /* create back button */
- pBack = create_themeicon_button_from_chars(pTheme->BACK_Icon,
-pWindow->dst, _("Back"), adj_font(12), 0);
- pBack->action = back_callback;
- pBack->key = SDLK_ESCAPE;
- set_wstate(pBack, FC_WS_NORMAL);
- add_to_gui_list(ID_OPTIONS_BACK_BUTTON, pBack);
-
- area.w += pBack->size.w + adj_size(10);
-
- pOption_Dlg->pBeginCoreOptionsWidgetList = pBack;
+ pOption_Dlg->pBeginCoreOptionsWidgetList = pCloseButton;
/* -- */
area.w = MAX(area.w, (adj_size(360) - (pWindow->size.w - pWindow->area.w)));
@@ -2223,29 +2212,11 @@
widget_set_position(pWindow,
(Main.screen->w - pWindow->size.w) / 2,
(Main.screen->h - pWindow->size.h) / 2);
-
- if(aconnection.established) {
-widget_set_position(pDisconnect,
-area.x + (area.w - pDisconnect->size.w) / 2,
-area.y + area.h - pDisconnect->size.h - adj_size(10));
-
-widget_set_position(pBack,
-pDisconnect->size.x - adj_size(10) - pBack->size.w,
-area.y