~ubuntu-branches/debian/sid/freeciv/sid

« back to all changes in this revision

Viewing changes to client/options.h

  • Committer: Package Import Robot
  • Author(s): Clint Adams, Karl Goetz, Clint Adams
  • Date: 2011-08-28 22:40:00 UTC
  • mfrom: (1.2.19 upstream)
  • Revision ID: package-import@ubuntu.com-20110828224000-j2r1erewlem25dox
Tags: 2.3.0-1
[ Karl Goetz ]
* New upstream version.
* Fix themes_sdl_use_system_fonts.diff to apply cleanly on 2.3.0
* Massage work_around_unity_induced_breakage.diff to get it
  applying to the new codebase (The patch assumes commits made
  after 2.3.0 was tagged upstream).

[ Clint Adams ]
* Fudge build system to think there is no libtool mismatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
/* common */
20
20
#include "events.h"
21
21
#include "fc_types.h"           /* enum gui_type */
 
22
#include "featured_text.h"      /* struct ft_color */
 
23
 
 
24
#define DEFAULT_METASERVER_OPTION "default"
 
25
 
 
26
struct video_mode {
 
27
  int width;
 
28
  int height;
 
29
};
 
30
#define VIDEO_MODE(ARG_width, ARG_height) \
 
31
    { .width = ARG_width, .height = ARG_height }
 
32
/****************************************************************************
 
33
  Constructor.
 
34
****************************************************************************/
 
35
static inline struct video_mode video_mode(int width, int height)
 
36
{
 
37
  struct video_mode mode = VIDEO_MODE(width, height);
 
38
  return mode;
 
39
}
 
40
 
22
41
 
23
42
extern char default_user_name[512];
24
43
extern char default_server_host[512];
27
46
extern char default_tileset_name[512];
28
47
extern char default_sound_set_name[512];
29
48
extern char default_sound_plugin_name[512];
 
49
extern char default_chat_logfile[512];
30
50
 
31
51
extern bool save_options_on_exit;
32
52
extern bool fullscreen_mode;
56
76
extern bool enable_cursor_changes;
57
77
extern bool separate_unit_selection;
58
78
extern bool unit_selection_clears_orders;
59
 
extern char highlight_our_names[128];
 
79
extern struct ft_color highlight_our_names;
60
80
 
61
81
extern bool voteinfo_bar_use;
62
82
extern bool voteinfo_bar_always_show;
100
120
extern bool gui_gtk2_enable_tabs;
101
121
extern bool gui_gtk2_better_fog;
102
122
extern bool gui_gtk2_show_chat_message_time;
103
 
extern bool gui_gtk2_split_bottom_notebook;
104
123
extern bool gui_gtk2_new_messages_go_to_top;
105
124
extern bool gui_gtk2_show_message_window_buttons;
106
125
extern bool gui_gtk2_metaserver_tab_first;
107
126
extern bool gui_gtk2_allied_chat_only;
 
127
enum {
 
128
  /* Order must match strings in
 
129
   * options.c:gui_gtk2_message_chat_location_name() */
 
130
  GUI_GTK2_MSGCHAT_SPLIT,
 
131
  GUI_GTK2_MSGCHAT_SEPARATE,
 
132
  GUI_GTK2_MSGCHAT_MERGED
 
133
};
 
134
extern int gui_gtk2_message_chat_location; /* enum GUI_GTK2_MSGCHAT_* */
108
135
extern bool gui_gtk2_small_display_layout;
109
 
extern bool gui_gtk2_merge_notebooks;
110
136
extern bool gui_gtk2_mouse_over_map_focus;
 
137
extern bool gui_gtk2_chatline_autocompletion;
111
138
extern int gui_gtk2_citydlg_xsize;
112
139
extern int gui_gtk2_citydlg_ysize;
113
140
extern char gui_gtk2_font_city_label[512];
128
155
#define FC_SDL_DEFAULT_THEME_NAME "human"
129
156
extern char gui_sdl_default_theme_name[512];
130
157
extern bool gui_sdl_fullscreen;
131
 
extern int gui_sdl_screen_width;
132
 
extern int gui_sdl_screen_height;
 
158
extern struct video_mode gui_sdl_screen;
 
159
extern bool gui_sdl_do_cursor_animation;
 
160
extern bool gui_sdl_use_color_cursors;
133
161
 
134
162
/* gui-win32 client specific options. */
135
163
extern bool gui_win32_better_fog;
136
164
extern bool gui_win32_enable_alpha;
137
165
 
138
 
enum client_option_type {
139
 
  COT_BOOLEAN,
140
 
  COT_INTEGER,
141
 
  COT_STRING,
142
 
  COT_FONT
143
 
};
144
 
 
145
 
enum client_option_class {
146
 
  COC_GRAPHICS,
147
 
  COC_OVERVIEW,
148
 
  COC_SOUND,
149
 
  COC_INTERFACE,
150
 
  COC_NETWORK,
151
 
  COC_FONT,
152
 
  COC_MAX
153
 
};
154
 
 
155
 
struct client_option;           /* Opaque type. */
156
 
 
157
 
#define client_options_iterate(_p)                                          \
158
 
{                                                                           \
159
 
  struct client_option *_p = option_first();                                \
160
 
  for (; _p; _p = option_next(_p)) {                                        \
161
 
 
162
 
#define client_options_iterate_end                                          \
163
 
  }                                                                         \
164
 
}
 
166
 
 
167
#define SPECENUM_NAME option_type
 
168
#define SPECENUM_VALUE0 OT_BOOLEAN
 
169
#define SPECENUM_VALUE1 OT_INTEGER
 
170
#define SPECENUM_VALUE2 OT_STRING
 
171
#define SPECENUM_VALUE3 OT_ENUM
 
172
#define SPECENUM_VALUE4 OT_BITWISE
 
173
#define SPECENUM_VALUE5 OT_FONT
 
174
#define SPECENUM_VALUE6 OT_COLOR
 
175
#define SPECENUM_VALUE7 OT_VIDEO_MODE
 
176
#include "specenum_gen.h"
 
177
 
 
178
 
 
179
struct option;                  /* Opaque type. */
 
180
struct option_set;              /* Opaque type. */
 
181
 
165
182
 
166
183
/* Main functions. */
167
184
void options_init(void);
168
185
void options_free(void);
 
186
void server_options_init(void);
 
187
void server_options_free(void);
169
188
void options_load(void);
170
189
void options_save(void);
171
190
 
172
191
 
173
 
/* Option function accessors. */
174
 
struct client_option *option_by_number(int id);
175
 
struct client_option *option_by_name(const char *name);
176
 
struct client_option *option_first(void);
177
 
struct client_option *option_next(struct client_option *poption);
178
 
 
179
 
void option_set_changed_callback(struct client_option *poption,
180
 
                                 void (*callback) (struct client_option *));
181
 
void option_changed(struct client_option *poption);
182
 
bool option_reset(struct client_option *poption);
183
 
struct section_file;
184
 
bool option_load(struct client_option *poption, struct section_file *sf);
185
 
 
186
 
int option_number(const struct client_option *poption);
187
 
const char *option_name(const struct client_option *poption);
188
 
const char *option_description(const struct client_option *poption);
189
 
const char *option_help_text(const struct client_option *poption);
190
 
enum client_option_type option_type(const struct client_option *poption);
191
 
enum client_option_class option_class(const struct client_option *poption);
192
 
const char *option_class_name(enum client_option_class option_class);
 
192
/* Option sets. */
 
193
extern const struct option_set const *client_optset;
 
194
extern const struct option_set const *server_optset;
 
195
 
 
196
struct option *optset_option_by_number(const struct option_set *poptset,
 
197
                                       int id);
 
198
#define optset_option_by_index optset_option_by_number
 
199
struct option *optset_option_by_name(const struct option_set *poptset,
 
200
                                     const char *name);
 
201
struct option *optset_option_first(const struct option_set *poptset);
 
202
 
 
203
int optset_category_number(const struct option_set *poptset);
 
204
const char *optset_category_name(const struct option_set *poptset,
 
205
                                 int category);
 
206
 
 
207
 
 
208
/* Common option functions. */
 
209
const struct option_set *option_optset(const struct option *poption);
 
210
int option_number(const struct option *poption);
 
211
#define option_index option_number
 
212
const char *option_name(const struct option *poption);
 
213
const char *option_description(const struct option *poption);
 
214
const char *option_help_text(const struct option *poption);
 
215
enum option_type option_type(const struct option *poption);
 
216
int option_category(const struct option *poption);
 
217
const char *option_category_name(const struct option *poption);
 
218
bool option_is_changeable(const struct option *poption);
 
219
struct option *option_next(const struct option *poption);
 
220
 
 
221
bool option_reset(struct option *poption);
 
222
void option_set_changed_callback(struct option *poption,
 
223
                                 void (*callback) (struct option *));
 
224
void option_changed(struct option *poption);
193
225
 
194
226
/* Option gui functions. */
195
 
void option_set_gui_data(struct client_option *poption, void *data);
196
 
void *option_get_gui_data(const struct client_option *poption);
197
 
 
198
 
/* Option type COT_BOOLEAN functions. */
199
 
bool option_bool_get(const struct client_option *poption);
200
 
bool option_bool_def(const struct client_option *poption);
201
 
bool option_bool_set(struct client_option *poption, bool val);
202
 
 
203
 
/* Option type COT_INTEGER functions. */
204
 
int option_int_get(const struct client_option *poption);
205
 
int option_int_def(const struct client_option *poption);
206
 
int option_int_min(const struct client_option *poption);
207
 
int option_int_max(const struct client_option *poption);
208
 
bool option_int_set(struct client_option *poption, int val);
209
 
 
210
 
/* Option type COT_STRING functions. */
211
 
const char *option_str_get(const struct client_option *poption);
212
 
const char *option_str_def(const struct client_option *poption);
213
 
const struct strvec *option_str_values(const struct client_option *poption);
214
 
bool option_str_set(struct client_option *poption, const char *str);
215
 
 
216
 
/* Option type COT_FONT functions. */
217
 
const char *option_font_get(const struct client_option *poption);
218
 
const char *option_font_def(const struct client_option *poption);
219
 
const char *option_font_target(const struct client_option *poption);
220
 
bool option_font_set(struct client_option *poption, const char *str);
 
227
void option_set_gui_data(struct option *poption, void *data);
 
228
void *option_get_gui_data(const struct option *poption);
 
229
 
 
230
/* Option type OT_BOOLEAN functions. */
 
231
bool option_bool_get(const struct option *poption);
 
232
bool option_bool_def(const struct option *poption);
 
233
bool option_bool_set(struct option *poption, bool val);
 
234
 
 
235
/* Option type OT_INTEGER functions. */
 
236
int option_int_get(const struct option *poption);
 
237
int option_int_def(const struct option *poption);
 
238
int option_int_min(const struct option *poption);
 
239
int option_int_max(const struct option *poption);
 
240
bool option_int_set(struct option *poption, int val);
 
241
 
 
242
/* Option type OT_STRING functions. */
 
243
const char *option_str_get(const struct option *poption);
 
244
const char *option_str_def(const struct option *poption);
 
245
const struct strvec *option_str_values(const struct option *poption);
 
246
bool option_str_set(struct option *poption, const char *str);
 
247
 
 
248
/* Option type OT_ENUM functions. */
 
249
int option_enum_str_to_int(const struct option *poption, const char *str);
 
250
const char *option_enum_int_to_str(const struct option *poption, int val);
 
251
int option_enum_get_int(const struct option *poption);
 
252
const char *option_enum_get_str(const struct option *poption);
 
253
int option_enum_def_int(const struct option *poption);
 
254
const char *option_enum_def_str(const struct option *poption);
 
255
const struct strvec *option_enum_values(const struct option *poption);
 
256
bool option_enum_set_int(struct option *poption, int val);
 
257
bool option_enum_set_str(struct option *poption, const char *str);
 
258
 
 
259
/* Option type OT_BITWISE functions. */
 
260
unsigned option_bitwise_get(const struct option *poption);
 
261
unsigned option_bitwise_def(const struct option *poption);
 
262
unsigned option_bitwise_mask(const struct option *poption);
 
263
const struct strvec *option_bitwise_values(const struct option *poption);
 
264
bool option_bitwise_set(struct option *poption, unsigned val);
 
265
 
 
266
/* Option type OT_FONT functions. */
 
267
const char *option_font_get(const struct option *poption);
 
268
const char *option_font_def(const struct option *poption);
 
269
const char *option_font_target(const struct option *poption);
 
270
bool option_font_set(struct option *poption, const char *font);
 
271
 
 
272
/* Option type OT_COLOR functions. */
 
273
struct ft_color option_color_get(const struct option *poption);
 
274
struct ft_color option_color_def(const struct option *poption);
 
275
bool option_color_set(struct option *poption, struct ft_color color);
 
276
 
 
277
/* Option type OT_VIDEO_MODE functions. */
 
278
struct video_mode option_video_mode_get(const struct option *poption);
 
279
struct video_mode option_video_mode_def(const struct option *poption);
 
280
bool option_video_mode_set(struct option *poption, struct video_mode mode);
 
281
 
 
282
 
 
283
#define options_iterate(poptset, poption)                                   \
 
284
{                                                                           \
 
285
  struct option *poption = optset_option_first(poptset);                    \
 
286
  for (; NULL != poption; poption = option_next(poption))                {  \
 
287
 
 
288
#define options_iterate_end                                                 \
 
289
  }                                                                         \
 
290
}
221
291
 
222
292
 
223
293
/** Desired settable options. **/
224
 
struct options_settable;
225
294
void desired_settable_options_update(void);
226
295
void desired_settable_option_update(const char *op_name,
227
296
                                    const char *op_value,
228
297
                                    bool allow_replace);
229
 
void desired_settable_option_send(struct options_settable *pset);
230
298
 
231
299
 
232
300
/** Dialog report options. **/
242
310
#define MW_MESSAGES  2          /* add to the messages window */
243
311
#define MW_POPUP     4          /* popup an individual window */
244
312
 
245
 
extern unsigned int messages_where[];   /* OR-ed MW_ values [E_LAST] */
246
 
 
247
 
 
248
 
/** Client specific min/max/default option values **/
 
313
extern int messages_where[];    /* OR-ed MW_ values [E_LAST] */
 
314
 
 
315
 
 
316
/** Client options **/
 
317
 
 
318
#define GUI_DEFAULT_CHAT_LOGFILE        "freeciv-chat.log"
249
319
 
250
320
/* gui-gtk2: [xy]size of the city dialog */
251
321
#define GUI_GTK2_CITYDLG_DEFAULT_XSIZE  770
257
327
#define GUI_GTK2_CITYDLG_MAX_YSIZE      4096
258
328
 
259
329
 
 
330
#define GUI_GTK_OVERVIEW_MIN_XSIZE      160
 
331
#define GUI_GTK_OVERVIEW_MIN_YSIZE      100
260
332
#endif  /* FC__OPTIONS_H */