Author: cazfi
Date: Fri Feb 12 11:51:57 2016
New Revision: 31893

URL: http://svn.gna.org/viewcvs/freeciv?rev=31893&view=rev
Log:
Added a button to enter Help Browser from sdl-clients' options menu. 

Requested by Daniel Markstedt <dmarks>

See bug #17167

Modified:
    branches/S2_5/client/gui-sdl/gui_id.h
    branches/S2_5/client/gui-sdl/helpdlg.c
    branches/S2_5/client/gui-sdl/helpdlg.h
    branches/S2_5/client/gui-sdl/optiondlg.c

Modified: branches/S2_5/client/gui-sdl/gui_id.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-sdl/gui_id.h?rev=31893&r1=31892&r2=31893&view=diff
==============================================================================
--- branches/S2_5/client/gui-sdl/gui_id.h       (original)
+++ branches/S2_5/client/gui-sdl/gui_id.h       Fri Feb 12 11:51:57 2016
@@ -74,6 +74,7 @@
   ID_OPTIONS_WORKLIST_BUTTON,
   ID_OPTIONS_SAVE_BUTTON,
   ID_OPTIONS_SAVE_GAME_BUTTON,
+  ID_OPTIONS_HELP_BROWSER_BUTTON,
   ID_OPTIONS_DISC_BUTTON,
   ID_OPTIONS_BACK_BUTTON,
   ID_OPTIONS_APPLY_BUTTON,

Modified: branches/S2_5/client/gui-sdl/helpdlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-sdl/helpdlg.c?rev=31893&r1=31892&r2=31893&view=diff
==============================================================================
--- branches/S2_5/client/gui-sdl/helpdlg.c      (original)
+++ branches/S2_5/client/gui-sdl/helpdlg.c      Fri Feb 12 11:51:57 2016
@@ -67,8 +67,16 @@
 static int change_tech_callback(struct widget *pWidget);
 
 /**************************************************************************
+  Open Help Browser without any specific topic in mind
+**************************************************************************/
+void popup_help_browser(void)
+{
+  popup_tech_info(A_NONE);
+}
+
+/**************************************************************************
   Popup the help dialog to get help on the given string topic.  Note that
-  the toppic may appear in multiple sections of the help (it may be both
+  the topic may appear in multiple sections of the help (it may be both
   an improvement and a unit, for example).
 
   The string will be untranslated.

Modified: branches/S2_5/client/gui-sdl/helpdlg.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-sdl/helpdlg.h?rev=31893&r1=31892&r2=31893&view=diff
==============================================================================
--- branches/S2_5/client/gui-sdl/helpdlg.h      (original)
+++ branches/S2_5/client/gui-sdl/helpdlg.h      Fri Feb 12 11:51:57 2016
@@ -14,9 +14,12 @@
 #ifndef FC__HELPDLG_H
 #define FC__HELPDLG_H
 
+/* common */
 #include "tech.h"
 
 #include "helpdlg_g.h"
+
+void popup_help_browser(void);
 
 void popup_tech_info(Tech_type_id tech);
 void popup_impr_info(Impr_type_id impr);

Modified: branches/S2_5/client/gui-sdl/optiondlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-sdl/optiondlg.c?rev=31893&r1=31892&r2=31893&view=diff
==============================================================================
--- branches/S2_5/client/gui-sdl/optiondlg.c    (original)
+++ branches/S2_5/client/gui-sdl/optiondlg.c    Fri Feb 12 11:51:57 2016
@@ -53,6 +53,7 @@
 #include "gui_id.h"
 #include "gui_main.h"
 #include "gui_tilespec.h"
+#include "helpdlg.h"
 #include "mapctrl.h"
 #include "mapview.h"
 #include "menu.h"
@@ -361,6 +362,18 @@
 }
 
 /****************************************************************************
+  Open Help Browser callback
+****************************************************************************/
+static int help_browser_callback(struct widget *pwidget)
+{
+  if (Main.event.button.button == SDL_BUTTON_LEFT) {
+    popup_help_browser();
+  }
+
+  return -1;
+}
+
+/****************************************************************************
   Client disconnect from server callback.
 ****************************************************************************/
 static int disconnect_callback(struct widget *pWidget)
@@ -836,6 +849,17 @@
   }
   widget_resize(widget, widget->size.w, widget->size.h + adj_size(4));
   add_to_gui_list(ID_OPTIONS_SAVE_GAME_BUTTON, widget);
+
+  /* Create help browser button widget. */
+  widget = create_icon_button_from_chars(NULL, window->dst,
+                                         _("Help Browser"), adj_font(12), 0);
+  widget->action = help_browser_callback;
+  widget->key = SDLK_h;
+  if (client.conn.established) {
+    set_wstate(widget, FC_WS_NORMAL);
+  }
+  widget_resize(widget, widget->size.w, widget->size.h + adj_size(4));
+  add_to_gui_list(ID_OPTIONS_HELP_BROWSER_BUTTON, widget);
 
   /* Create leave game button widget. */
   widget = create_icon_button_from_chars(NULL, window->dst,


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to