<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39667 >

> [EMAIL PROTECTED] - Di 04. Sep 2007, 13:09:46]:
> 
> Freeciv dialogs have a red X with the tooltip "Cancel" to close them.
> Not only is 'cancel' a horrible word - implies losing any changes but
> it simply leaves the dialog - it is also innaccurate. "Close Dialog"
> is better. A better icon may be the circular arrow commonly used to
> represent returning to a previous screen.
> 

The attached patch changes the tooltip to "Close Dialog (Esc)" and also
adds it to dialogs that didn't have it before. And it moves the close
button from the bottom right corner into the title bar in the city
dialog and the cities report dialog.
Index: client/gui-sdl/citydlg.c
===================================================================
--- client/gui-sdl/citydlg.c	(revision 13502)
+++ client/gui-sdl/citydlg.c	(working copy)
@@ -3682,31 +3682,18 @@
 
   /* ============================================================= */
 
-#if 0  
-  /* in title bar */
-  pBuf = create_themeicon(pTheme->CANCEL_Icon, pWindow->dst->surface,
+  /* close dialog button */
+  pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
 			  (WF_WIDGET_HAS_INFO_LABEL |
 			   WF_RESTORE_BACKGROUND));
-  pBuf->string16 = create_str16_from_char(_("Cancel"), adj_font(12));
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   pBuf->action = exit_city_dlg_callback;
   pBuf->size.x = area.x + area.w - pBuf->size.w;
   pBuf->size.y = pWindow->size.y + 1;
   pBuf->key = SDLK_ESCAPE;
   set_wstate(pBuf, FC_WS_NORMAL);
   add_to_gui_list(ID_CITY_DLG_EXIT_BUTTON, pBuf);
-#endif
 
-  /* Buttons */
-  pBuf = create_themeicon(pTheme->CANCEL_Icon, pWindow->dst,
-			  (WF_WIDGET_HAS_INFO_LABEL |
-			   WF_RESTORE_BACKGROUND));
-  pBuf->string16 = create_str16_from_char(_("Cancel"), adj_font(12));
-  pBuf->action = exit_city_dlg_callback;
-  pBuf->key = SDLK_ESCAPE;
-  pBuf->size.x = area.x + area.w - pBuf->size.w - adj_size(7);
-  pBuf->size.y = area.y + area.h - pBuf->size.h - adj_size(5);
-  set_wstate(pBuf, FC_WS_NORMAL);
-  add_to_gui_list(ID_CITY_DLG_EXIT_BUTTON, pBuf);
   /* -------- */
   
   pBuf = create_themeicon(pTheme->Support_Icon, pWindow->dst,
Index: client/gui-sdl/cityrep.c
===================================================================
--- client/gui-sdl/cityrep.c	(revision 13502)
+++ client/gui-sdl/cityrep.c	(working copy)
@@ -175,6 +175,7 @@
   copy_chars_to_string16(pStr, cBuf);
   pStr->fgcol = *get_game_colorRGB(COLOR_THEME_CITYREP_TEXT);
   pText4 = create_text_surf_from_str16(pStr);
+  prod_w = pText4->w;
   FREESTRING16(pStr);
   
   pUnits_Icon = create_icon_from_theme(pTheme->UNITS_Icon, 0);
@@ -195,16 +196,17 @@
   
   /* ------------------------- */
   /* exit button */
-  pBuf = create_themeicon(pTheme->CANCEL_Icon, pWindow->dst,
-			  (WF_WIDGET_HAS_INFO_LABEL |
-			   WF_RESTORE_BACKGROUND));
-
-  pBuf->string16 = create_str16_from_char(_("Exit Report"), adj_font(12));
+  pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
+			  (WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND));
+  pBuf->string16 = create_str16_from_char(_("Close Dialog"), adj_font(12));
   pBuf->action = exit_city_report_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
   pBuf->key = SDLK_ESCAPE;
   
   add_to_gui_list(ID_BUTTON, pBuf);
+  
+/* FIXME: not implemented yet */
+#if 0
   /* ------------------------- */
   pBuf = create_themeicon(pTheme->INFO_Icon, pWindow->dst,
 			  (WF_WIDGET_HAS_INFO_LABEL |
@@ -250,7 +252,8 @@
 */
   add_to_gui_list(ID_BUTTON, pBuf);
   /* ------------------------ */
-    
+#endif
+  
   pLast = pBuf;
   count = 0; 
   city_list_iterate(game.player_ptr->cities, pCity) {
@@ -607,13 +610,15 @@
   
   /* exit button */
   pBuf = pWindow->prev;
-  pBuf->size.x = area.x + area.w - pBuf->size.w - adj_size(25);
-  pBuf->size.y = area.y + area.h - pBuf->size.h - adj_size(5);
+  pBuf->size.x = area.x + area.w - pBuf->size.w - 1;
+  pBuf->size.y = pWindow->size.y + 1;
 
+/* FIXME: not implemented yet */
+#if 0
   /* info button */
   pBuf = pBuf->prev;
-  pBuf->size.x = pBuf->next->size.x - adj_size(5) - pBuf->size.w;
-  pBuf->size.y = pBuf->next->size.y;
+  pBuf->size.x = area.x + area.w - pBuf->size.w - adj_size(5);
+  pBuf->size.y = area.y + area.h - pBuf->size.h - adj_size(5);
 
   /* happy button */
   pBuf = pBuf->prev;
@@ -629,6 +634,7 @@
   pBuf = pBuf->prev;
   pBuf->size.x = pBuf->next->size.x - adj_size(5) - pBuf->size.w;
   pBuf->size.y = pBuf->next->size.y;
+#endif
   
   /* cities background and labels */
   dst.x = area.x + adj_size(2);
Index: client/gui-sdl/cma_fe.c
===================================================================
--- client/gui-sdl/cma_fe.c	(revision 13502)
+++ client/gui-sdl/cma_fe.c	(working copy)
@@ -463,7 +463,8 @@
   /* ---------- */
   /* create exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+	                  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   pBuf->action = cancel_SLD_cma_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
   pBuf->key = SDLK_ESCAPE;
@@ -868,7 +869,8 @@
   /* ---------- */
   /* create exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  	                  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   pBuf->action = exit_cma_dialog_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
   pBuf->key = SDLK_ESCAPE;
Index: client/gui-sdl/dialogs.c
===================================================================
--- client/gui-sdl/dialogs.c	(revision 13502)
+++ client/gui-sdl/dialogs.c	(working copy)
@@ -276,7 +276,8 @@
   /* ---------- */
   /* create exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   pBuf->action = exit_notify_dialog_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
   pBuf->key = SDLK_ESCAPE;
@@ -640,7 +641,8 @@
   /* ---------- */
   /* create exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   pBuf->action = exit_unit_select_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
   pBuf->key = SDLK_ESCAPE;
@@ -873,7 +875,8 @@
   
   /* exit icon */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   pBuf->size.x = area.x + area.w - pBuf->size.w - 1;
   pBuf->size.y = pWindow->size.y + 1;
   pBuf->action = exit_terrain_info_dialog_callback;
@@ -1200,8 +1203,8 @@
   /* ---------- */
   /* exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
-  
+  			  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   area.w += pBuf->size.w + adj_size(10);
   pBuf->action = exit_advanced_terrain_dlg_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
@@ -1755,7 +1758,8 @@
   /* ---------- */
   /* exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   area.w += pBuf->size.w + adj_size(10);
   pBuf->action = exit_pillage_dlg_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
Index: client/gui-sdl/diplomat_dialog.c
===================================================================
--- client/gui-sdl/diplomat_dialog.c	(revision 13502)
+++ client/gui-sdl/diplomat_dialog.c	(working copy)
@@ -264,8 +264,8 @@
   /* ------------------ */
   /* exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
-  
+  			  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   area.w += pBuf->size.w + adj_size(10);
   pBuf->action = exit_spy_steal_dlg_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
@@ -856,7 +856,8 @@
   /* ---------- */
   /* exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   area.w += pBuf->size.w + adj_size(10);
   pBuf->action = diplomat_close_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
@@ -1149,7 +1150,8 @@
     
     /* exit button */
     pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);  
+  			    WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);  
+    pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
     area.w += pBuf->size.w + adj_size(10);
     pBuf->action = exit_incite_dlg_callback;
     set_wstate(pBuf, FC_WS_NORMAL);
@@ -1216,7 +1218,8 @@
   } else {
     /* exit button */
     pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			    WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
     area.w += pBuf->size.w + adj_size(10);
     pBuf->action = exit_incite_dlg_callback;
     set_wstate(pBuf, FC_WS_NORMAL);
@@ -1422,7 +1425,8 @@
   } else {
     /* exit button */
     pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			    WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+    pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
     area.w += pBuf->size.w + adj_size(10);
     pBuf->action = exit_bribe_dlg_callback;
     set_wstate(pBuf, FC_WS_NORMAL);
Index: client/gui-sdl/finddlg.c
===================================================================
--- client/gui-sdl/finddlg.c	(revision 13502)
+++ client/gui-sdl/finddlg.c	(working copy)
@@ -140,7 +140,8 @@
   /* ---------- */
   /* exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  	(WF_RESTORE_BACKGROUND|WF_FREE_DATA));
+  			  (WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND | WF_FREE_DATA));
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   area.w = MAX(area.w, pBuf->size.w + adj_size(10));
   pBuf->action = exit_find_city_dlg_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
Index: client/gui-sdl/gotodlg.c
===================================================================
--- client/gui-sdl/gotodlg.c	(revision 13502)
+++ client/gui-sdl/gotodlg.c	(working copy)
@@ -247,7 +247,8 @@
   /* ---------- */
   /* create exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   pBuf->action = exit_goto_dialog_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
   pBuf->key = SDLK_ESCAPE;
Index: client/gui-sdl/helpdlg.c
===================================================================
--- client/gui-sdl/helpdlg.c	(revision 13502)
+++ client/gui-sdl/helpdlg.c	(working copy)
@@ -225,8 +225,8 @@
 
     /* close button */
     pCloseButton = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-                                    WF_RESTORE_BACKGROUND);
-
+                                    WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+    pCloseButton->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
     pCloseButton->action = exit_help_dlg_callback;
     set_wstate(pCloseButton, FC_WS_NORMAL);
     pCloseButton->key = SDLK_ESCAPE;
@@ -614,8 +614,8 @@
 
     /* close button */
     pCloseButton = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-                                    WF_RESTORE_BACKGROUND);
-
+                                    WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+    pCloseButton->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
     pCloseButton->action = exit_help_dlg_callback;
     set_wstate(pCloseButton, FC_WS_NORMAL);
     pCloseButton->key = SDLK_ESCAPE;
@@ -1917,8 +1917,8 @@
 
     /* close button */
     pCloseButton = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-                                    WF_RESTORE_BACKGROUND);
-
+                                    WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+    pCloseButton->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
     pCloseButton->action = exit_help_dlg_callback;
     set_wstate(pCloseButton, FC_WS_NORMAL);
     pCloseButton->key = SDLK_ESCAPE;
Index: client/gui-sdl/inteldlg.c
===================================================================
--- client/gui-sdl/inteldlg.c	(revision 13502)
+++ client/gui-sdl/inteldlg.c	(working copy)
@@ -232,7 +232,8 @@
     /* ---------- */
     /* exit button */
     pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-                                                  WF_RESTORE_BACKGROUND);
+                            WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+    pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
     area.w = MAX(area.w, pBuf->size.w + adj_size(10));
     pBuf->action = exit_intel_dlg_callback;
     set_wstate(pBuf, FC_WS_NORMAL);
Index: client/gui-sdl/plrdlg.c
===================================================================
--- client/gui-sdl/plrdlg.c	(revision 13502)
+++ client/gui-sdl/plrdlg.c	(working copy)
@@ -339,7 +339,8 @@
   /* ---------- */
   /* exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   pBuf->action = exit_players_dlg_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
   pBuf->key = SDLK_ESCAPE;
@@ -615,7 +616,8 @@
   /* ---------- */
   /* exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   area.w = MAX(area.w, pBuf->size.w + adj_size(10));
   pBuf->action = exit_players_nations_dlg_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
Index: client/gui-sdl/repodlgs.c
===================================================================
--- client/gui-sdl/repodlgs.c	(revision 13502)
+++ client/gui-sdl/repodlgs.c	(working copy)
@@ -386,7 +386,8 @@
   /* ------------------------- */
   /* exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   pBuf->action = exit_units_dlg_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
   pBuf->key = SDLK_ESCAPE;
@@ -2847,7 +2848,8 @@
   /* ------------------------- */
     /* exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   area.w += pBuf->size.w + adj_size(10);
   pBuf->action = exit_change_tech_dlg_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
@@ -3033,7 +3035,8 @@
   /* ------------------------- */
     /* exit button */
   pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			  WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   area.w += pBuf->size.w + adj_size(10);
   pBuf->action = exit_change_tech_dlg_callback;
   set_wstate(pBuf, FC_WS_NORMAL);
@@ -3296,8 +3299,8 @@
   /* ------ */
   /* exit button */
   pExitButton = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-                                                   WF_RESTORE_BACKGROUND);
-  
+                                 WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+  pExitButton->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
   pExitButton->action = popdown_science_dialog_callback;
   set_wstate(pExitButton, FC_WS_NORMAL);
   pExitButton->key = SDLK_ESCAPE;
Index: client/gui-sdl/spaceshipdlg.c
===================================================================
--- client/gui-sdl/spaceshipdlg.c	(revision 13502)
+++ client/gui-sdl/spaceshipdlg.c	(working copy)
@@ -158,7 +158,8 @@
     /* ---------- */
     /* create exit button */
     pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-  			  			WF_RESTORE_BACKGROUND);
+  			    WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
+    pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
     pBuf->data.player = pPlayer;
     pBuf->action = exit_space_dialog_callback;
     set_wstate(pBuf, FC_WS_NORMAL);
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to