Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] (PR#8501) RFC: extended options dialog
Home

[Freeciv-Dev] (PR#8501) RFC: extended options dialog

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#8501) RFC: extended options dialog
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 21 Nov 2004 21:37:13 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8501 >

> [jdorje - Tue Apr 13 01:46:08 2004]:

> My suggestion is that each option is given a type.  The options dialog 
> can then have multiple tabs, one for each type.  This is basically what 
> the SDL client's options dialog does (the SDL client doesn't have menus 
> so these options must be integrated some other way; this will also apply 
> to the FS client I think).

Here is an updated version of this patch.  Unless someone has
suggestions for improvements this should be applied.  (I'm sure there
will be suggestions for improvements later, but for now we need some
code to get things moving before we can really have a good discussion of
categories.)

jason

Index: client/options.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.c,v
retrieving revision 1.106
diff -u -r1.106 options.c
--- client/options.c    17 Nov 2004 19:21:13 -0000      1.106
+++ client/options.c    22 Nov 2004 05:35:51 -0000
@@ -79,38 +79,56 @@
 
 static client_option common_options[] = {
   GEN_BOOL_OPTION(save_options_on_exit,
-                 N_("Save the options when exiting the game")),
-  GEN_STR_OPTION(default_user_name,        N_("Default player's login name"),
-                NULL, NULL), 
-  GEN_STR_OPTION(default_server_host,       N_("Default server"),
-                NULL, NULL),
-  GEN_INT_OPTION(default_server_port,       N_("Default server's port")),
-  GEN_STR_OPTION(default_metaserver,        N_("Default metaserver"),
-                NULL, NULL),
-  GEN_STR_OPTION(default_sound_set_name,    N_("Default name of sound set"),
-                get_soundset_list, NULL),
+                 N_("Save the options when exiting the game"),
+                 COC_MISCELLANEOUS),
+  GEN_STR_OPTION(default_user_name, N_("Default player's login name"),
+                COC_MISCELLANEOUS, NULL, NULL),
+  GEN_STR_OPTION(default_server_host, N_("Default server"),
+                COC_MISCELLANEOUS, NULL, NULL),
+  GEN_INT_OPTION(default_server_port, N_("Default server's port"),
+                COC_MISCELLANEOUS),
+  GEN_STR_OPTION(default_metaserver, N_("Default metaserver"),
+                COC_MISCELLANEOUS, NULL, NULL),
+  GEN_STR_OPTION(default_sound_set_name, N_("Default name of sound set"),
+                COC_MISCELLANEOUS, get_soundset_list, NULL),
   GEN_STR_OPTION(default_sound_plugin_name, N_("Default sound plugin"),
-                get_soundplugin_list, NULL),
-  GEN_STR_OPTION(default_tileset_name,     N_("Tileset"),
+                COC_MISCELLANEOUS, get_soundplugin_list, NULL),
+  GEN_STR_OPTION(default_tileset_name, N_("Tileset"), COC_MISCELLANEOUS,
                 get_tileset_list, tilespec_reread_callback),
 
-  GEN_BOOL_OPTION(solid_color_behind_units, N_("Solid unit background color")),
-  GEN_BOOL_OPTION(sound_bell_at_new_turn,   N_("Sound bell at new turn")),
+  GEN_BOOL_OPTION(solid_color_behind_units,
+                 N_("Solid unit background color"),
+                 COC_GRAPHICS),
+  GEN_BOOL_OPTION(sound_bell_at_new_turn, N_("Sound bell at new turn"),
+                 COC_INTERFACE),
   GEN_INT_OPTION(smooth_move_unit_msec,
-                N_("Unit movement animation time (milliseconds)")),
+                N_("Unit movement animation time (milliseconds)"),
+                COC_GRAPHICS),
   GEN_INT_OPTION(smooth_center_slide_msec,
-                N_("Mapview recentering time (milliseconds)")),
-  GEN_BOOL_OPTION(do_combat_animation,      N_("Show combat animation")),
-  GEN_BOOL_OPTION(ai_popup_windows,         N_("Popup dialogs in AI Mode")),
-  GEN_BOOL_OPTION(ai_manual_turn_done,      N_("Manual Turn Done in AI Mode")),
-  GEN_BOOL_OPTION(auto_center_on_unit,      N_("Auto Center on Units")),
-  GEN_BOOL_OPTION(auto_center_on_combat,    N_("Auto Center on Combat")),
-  GEN_BOOL_OPTION(wakeup_focus,             N_("Focus on Awakened Units")),
-  GEN_BOOL_OPTION(center_when_popup_city,   N_("Center map when Popup city")),
-  GEN_BOOL_OPTION(concise_city_production,  N_("Concise City Production")),
-  GEN_BOOL_OPTION(auto_turn_done,           N_("End Turn when done moving")),
-  GEN_BOOL_OPTION(ask_city_name,            N_("Prompt for city names")),
-  GEN_BOOL_OPTION(popup_new_cities,         N_("Pop up city dialog for new 
cities")),
+                N_("Mapview recentering time (milliseconds)"),
+                COC_GRAPHICS),
+  GEN_BOOL_OPTION(do_combat_animation, N_("Show combat animation"),
+                 COC_GRAPHICS),
+  GEN_BOOL_OPTION(ai_popup_windows, N_("Popup dialogs in AI Mode"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(ai_manual_turn_done, N_("Manual Turn Done in AI Mode"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(auto_center_on_unit,      N_("Auto Center on Units"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(auto_center_on_combat,    N_("Auto Center on Combat"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(wakeup_focus,             N_("Focus on Awakened Units"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(center_when_popup_city,   N_("Center map when Popup city"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(concise_city_production,  N_("Concise City Production"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(auto_turn_done,           N_("End Turn when done moving"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(ask_city_name,            N_("Prompt for city names"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(popup_new_cities, N_("Pop up city dialog for new cities"),
+                 COC_INTERFACE),
 };
 #undef GEN_INT_OPTION
 #undef GEN_BOOL_OPTION
Index: client/options.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.h,v
retrieving revision 1.40
diff -u -r1.40 options.h
--- client/options.h    17 Nov 2004 18:04:40 -0000      1.40
+++ client/options.h    22 Nov 2004 05:35:51 -0000
@@ -55,9 +55,18 @@
   COT_STR
 };
 
+enum client_option_class {
+  COC_GRAPHICS,
+  COC_INTERFACE,
+  COC_MISCELLANEOUS
+};
+
+extern const char *client_option_class_names[];
+
 typedef struct client_option {
   const char *name;
   const char *description;
+  enum client_option_class class;
   enum client_option_type type;
   int *p_int_value;
   bool *p_bool_value;
@@ -76,16 +85,14 @@
 } client_option;
 extern client_option *options;
 
-#define GEN_INT_OPTION(oname, desc) { #oname, desc, COT_INT, \
-                                      &oname, NULL, NULL, 0, NULL, \
-                                       NULL, NULL }
-#define GEN_BOOL_OPTION(oname, desc) { #oname, desc, COT_BOOL, \
-                                       NULL, &oname, NULL, 0, NULL, \
-                                       NULL, NULL }
-#define GEN_STR_OPTION(oname, desc, str_defaults, callback) \
-                                    { #oname, desc, COT_STR, \
-                                      NULL, NULL, oname, sizeof(oname), \
-                                      callback, str_defaults, NULL }
+#define GEN_INT_OPTION(oname, desc, class) { #oname, desc, class, COT_INT, \
+                                             &oname, NULL, NULL, 0, NULL, \
+                                             NULL, NULL }
+#define GEN_BOOL_OPTION(oname, desc, class) \
+  { #oname, desc, class, COT_BOOL, NULL, &oname, NULL, 0, NULL, NULL, NULL }
+#define GEN_STR_OPTION(oname, desc, class, str_defaults, callback) \
+  { #oname, desc, class, COT_STR, NULL, NULL, oname, sizeof(oname), \
+    callback, str_defaults, NULL }
 
 extern int num_options;
 
Index: client/gui-gtk/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/gui_main.c,v
retrieving revision 1.153
diff -u -r1.153 gui_main.c
--- client/gui-gtk/gui_main.c   13 Nov 2004 09:26:51 -0000      1.153
+++ client/gui-gtk/gui_main.c   22 Nov 2004 05:35:51 -0000
@@ -125,9 +125,10 @@
 static gint gdk_input_id;
 
 client_option gui_options[] = {
-  GEN_BOOL_OPTION(meta_accelerators, N_("Use Alt/Meta for accelerators")),
-  GEN_BOOL_OPTION(map_scrollbars, N_("Show Map Scrollbars")),
-  GEN_BOOL_OPTION(keyboardless_goto, N_("Keyboardless goto")),
+  GEN_BOOL_OPTION(meta_accelerators, N_("Use Alt/Meta for accelerators"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(map_scrollbars, N_("Show Map Scrollbars"), COC_INTERFACE),
+  GEN_BOOL_OPTION(keyboardless_goto, N_("Keyboardless goto"), COC_INTERFACE),
 };
 const int num_gui_options = ARRAY_SIZE(gui_options);
 
Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.92
diff -u -r1.92 gui_main.c
--- client/gui-gtk-2.0/gui_main.c       17 Nov 2004 18:04:40 -0000      1.92
+++ client/gui-gtk-2.0/gui_main.c       22 Nov 2004 05:35:52 -0000
@@ -132,13 +132,20 @@
 GtkWidget *government_ebox;
 
 client_option gui_options[] = {
-  GEN_BOOL_OPTION(meta_accelerators,   N_("Use Alt/Meta for accelerators")),
-  GEN_BOOL_OPTION(map_scrollbars,      N_("Show Map Scrollbars")),
-  GEN_BOOL_OPTION(keyboardless_goto,   N_("Keyboardless goto")),
-  GEN_BOOL_OPTION(dialogs_on_top,      N_("Keep dialogs on top")),
-  GEN_BOOL_OPTION(show_task_icons,     N_("Show worklist task icons")),
-  GEN_BOOL_OPTION(fullscreen_mode,     N_("Fullscreen Mode")),
-  GEN_BOOL_OPTION(enable_tabs,         N_("Enable status report tabs")),
+  GEN_BOOL_OPTION(meta_accelerators,   N_("Use Alt/Meta for accelerators"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(map_scrollbars,      N_("Show Map Scrollbars"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(keyboardless_goto,   N_("Keyboardless goto"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(dialogs_on_top,      N_("Keep dialogs on top"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(show_task_icons,     N_("Show worklist task icons"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(fullscreen_mode,     N_("Fullscreen Mode"),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(enable_tabs,         N_("Enable status report tabs"),
+                 COC_INTERFACE),
 };
 const int num_gui_options = ARRAY_SIZE(gui_options);
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8501) RFC: extended options dialog, Jason Short <=