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

Am Mittwoch, 20. August 2008 05:17:28 schrieb Madeline Book:
> the shortcut for
> city worker output having been moved to ctrl-w).
>
> (The sdl gui seems to be missing the city output toggle
> shortcut...?)

Attached patch implements this option on the SDL client as extra check
box option in the "Map options" menu dialog and via the ctrl-w key
combo. However in order to keep this GTK compatibility I had to move the
SDL client's own key combo for displaying the fog of war to
ctrl-shift-w. Leaving the combo for worker output on ctrl-t wouldn't be
helpful anyways, as this is also used by the SDL client for toggling the
terrain on/off.

Greetings,
Nico
diff -Nur -X.diff_ignore trunk/client/gui-sdl/gui_id.h changed/client/gui-sdl/gui_id.h
--- trunk/client/gui-sdl/gui_id.h	2008-07-27 21:46:35.000000000 +0200
+++ changed/client/gui-sdl/gui_id.h	2008-08-23 19:06:30.000000000 +0200
@@ -96,6 +96,8 @@
   ID_OPTIONS_MAP_CITY_NAMES_CHECKBOX,
   ID_OPTIONS_MAP_CITY_PROD_LABEL,
   ID_OPTIONS_MAP_CITY_PROD_CHECKBOX,
+  ID_OPTIONS_MAP_CITY_OUTPUT_CHECKBOX,
+  ID_OPTIONS_MAP_CITY_OUTPUT_LABEL,
   ID_OPTIONS_MAP_BORDERS_CHECKBOX,
   ID_OPTIONS_MAP_BORDERS_LABEL,
   ID_OPTIONS_MAP_CITY_CIV3_TEXT_STYLE_LABEL,
diff -Nur -X.diff_ignore trunk/client/gui-sdl/mapctrl.c changed/client/gui-sdl/mapctrl.c
--- trunk/client/gui-sdl/mapctrl.c	2008-07-27 21:46:35.000000000 +0200
+++ changed/client/gui-sdl/mapctrl.c	2008-08-23 19:31:41.000000000 +0200
@@ -2439,10 +2439,15 @@
   
       /* (show focus unit) */
       
-      /* show fog of war - Ctrl+w */
+      /* show city output - Ctrl+w
+       * show fog of war - Ctrl+Shift+w */
       case SDLK_w:
         if (LCTRL || RCTRL) {
-          key_fog_of_war_toggle();
+          if (LSHIFT || RSHIFT) {
+            key_fog_of_war_toggle();
+          } else {
+            key_city_output_toggle();
+          }
         }
         return FALSE;
   
diff -Nur -X.diff_ignore trunk/client/gui-sdl/optiondlg.c changed/client/gui-sdl/optiondlg.c
--- trunk/client/gui-sdl/optiondlg.c	2008-07-27 21:46:35.000000000 +0200
+++ changed/client/gui-sdl/optiondlg.c	2008-08-23 19:05:38.000000000 +0200
@@ -1302,6 +1302,20 @@
 /**************************************************************************
   ...
 **************************************************************************/
+static int draw_city_output_callback(struct widget *pWidget)
+{
+  if (Main.event.button.button == SDL_BUTTON_LEFT) {
+    widget_redraw(pWidget);
+    widget_flush(pWidget);
+    draw_city_output ^= 1;
+    update_map_canvas_visible();
+  }
+  return -1;
+}
+
+/**************************************************************************
+  ...
+**************************************************************************/
 static int borders_callback(struct widget *pWidget)
 {
   if (Main.event.button.button == SDL_BUTTON_LEFT) {
@@ -1586,11 +1600,38 @@
     
     pTmpGui->size.x = pWindow->size.x + adj_size(55);
   
-    add_to_gui_list(ID_OPTIONS_MAP_CITY_NAMES_LABEL, pTmpGui);
+    add_to_gui_list(ID_OPTIONS_MAP_CITY_PROD_LABEL, pTmpGui);
   
     pTmpGui->size.y = pTmpGui->next->size.y +
         ((pTmpGui->next->size.h - pTmpGui->size.h) / 2);
   
+    /* 'draw city worker output on map' */
+    /* check box */
+    pTmpGui = create_checkbox(pWindow->dst, draw_city_output,
+                              WF_RESTORE_BACKGROUND);
+  
+    pTmpGui->action = draw_city_output_callback;
+    set_wstate(pTmpGui, FC_WS_NORMAL);
+  
+    pTmpGui->size.x = pWindow->size.x + adj_size(15);
+  
+    add_to_gui_list(ID_OPTIONS_MAP_CITY_OUTPUT_CHECKBOX, pTmpGui);
+    pTmpGui->size.y = pTmpGui->next->next->size.y + pTmpGui->size.h + adj_size(4);
+  
+    /* label */
+    pStr = create_str16_from_char(_("City Output"), adj_font(10));
+    pStr->style |= TTF_STYLE_BOLD;
+    pStr->fgcol = text_color;
+    pTmpGui = create_iconlabel(NULL, pWindow->dst, pStr, 0);
+    
+    pTmpGui->size.x = pWindow->size.x + adj_size(55);
+  
+    add_to_gui_list(ID_OPTIONS_MAP_CITY_OUTPUT_LABEL, pTmpGui);
+  
+    pTmpGui->size.y = pTmpGui->next->size.y +
+        ((pTmpGui->next->size.h - pTmpGui->size.h) / 2);
+
+    
     /* 'draw borders' */
     /* check box */
     pTmpGui = create_checkbox(pWindow->dst, draw_borders,
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to