Author: cazfi Date: Tue Dec 29 18:06:01 2015 New Revision: 31259 URL: http://svn.gna.org/viewcvs/freeciv?rev=31259&view=rev Log: Added zoom options to client rc file.
See patch #6473 Modified: trunk/client/options.c trunk/client/options.h trunk/utility/registry_ini.c trunk/utility/registry_ini.h Modified: trunk/client/options.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/options.c?rev=31259&r1=31258&r2=31259&view=diff ============================================================================== --- trunk/client/options.c (original) +++ trunk/client/options.c Tue Dec 29 18:06:01 2015 @@ -178,6 +178,9 @@ TRUE /* u - MAPIMG_LAYER_UNITS */ }, /* .mapimg_filename, */ + + .zoom_set = FALSE, + .zoom_default_level = 1.0, /* gui-gtk-2.0 client specific options. */ .gui_gtk2_default_theme_name = FC_GTK2_DEFAULT_THEME_NAME, @@ -5660,6 +5663,13 @@ secfile_lookup_bool_default(sf, gui_options.gui_qt_migrated_from_2_5, "%s.migration_qt_from_2_5", prefix); + /* These are not gui-enabled yet */ + gui_options.zoom_set = + secfile_lookup_bool_default(sf, FALSE, "%s.zoom_set", prefix); + gui_options.zoom_default_level = + secfile_lookup_float_default(sf, 1.0, + "%s.zoom_default_level", prefix); + /* Backwards compatibility for removed options replaced by entirely "new" * options. The equivalent "new" option will override these, if set. */ @@ -5774,6 +5784,7 @@ secfile_insert_bool(sf, gui_options.gui_qt_migrated_from_2_5, "client.migration_qt_from_2_5"); + /* gui-enabled options */ client_options_iterate_all(poption) { if (client_poption->specific != GUI_SDL || !gui_options.gui_sdl2_migrated_from_sdl) { /* Once sdl-client options have been migrated to sdl2-client, there's no @@ -5781,6 +5792,11 @@ client_option_save(poption, sf); } } client_options_iterate_all_end; + + /* These are not gui-enabled yet. */ + secfile_insert_bool(sf, gui_options.zoom_set, "client.zoom_set"); + secfile_insert_float(sf, gui_options.zoom_default_level, + "client.zoom_default_level"); message_options_save(sf, "client"); options_dialogs_save(sf); Modified: trunk/client/options.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/options.h?rev=31259&r1=31258&r2=31259&view=diff ============================================================================== --- trunk/client/options.h (original) +++ trunk/client/options.h Tue Dec 29 18:06:01 2015 @@ -190,6 +190,9 @@ int mapimg_zoom; bool mapimg_layer[MAPIMG_LAYER_COUNT]; char mapimg_filename[512]; + + bool zoom_set; + float zoom_default_level; /* gui-gtk-2.0 client specific options. */ #define FC_GTK2_DEFAULT_THEME_NAME "Freeciv" Modified: trunk/utility/registry_ini.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/registry_ini.c?rev=31259&r1=31258&r2=31259&view=diff ============================================================================== --- trunk/utility/registry_ini.c (original) +++ trunk/utility/registry_ini.c Tue Dec 29 18:06:01 2015 @@ -1956,6 +1956,59 @@ } /************************************************************************** + Lookup a floating point value in the secfile. Returns TRUE on success. +**************************************************************************/ +bool secfile_lookup_float(const struct section_file *secfile, float *fval, + const char *path, ...) +{ + char fullpath[MAX_LEN_SECPATH]; + const struct entry *pentry; + va_list args; + + SECFILE_RETURN_VAL_IF_FAIL(secfile, NULL, NULL != secfile, FALSE); + + va_start(args, path); + fc_vsnprintf(fullpath, sizeof(fullpath), path, args); + va_end(args); + + if (!(pentry = secfile_entry_by_path(secfile, fullpath))) { + SECFILE_LOG(secfile, NULL, "\"%s\" entry doesn't exist.", fullpath); + return FALSE; + } + + return entry_float_get(pentry, fval); +} + +/************************************************************************** + Lookup a floating point value in the secfile. On failure, use the default + value. +**************************************************************************/ +float secfile_lookup_float_default(const struct section_file *secfile, + float def, const char *path, ...) +{ + char fullpath[MAX_LEN_SECPATH]; + const struct entry *pentry; + float fval; + va_list args; + + SECFILE_RETURN_VAL_IF_FAIL(secfile, NULL, NULL != secfile, def); + + va_start(args, path); + fc_vsnprintf(fullpath, sizeof(fullpath), path, args); + va_end(args); + + if (!(pentry = secfile_entry_by_path(secfile, fullpath))) { + return def; + } + + if (entry_float_get(pentry, &fval)) { + return fval; + } + + return def; +} + +/************************************************************************** Lookup a string value in the secfile. Returns NULL on error. **************************************************************************/ const char *secfile_lookup_str(const struct section_file *secfile, Modified: trunk/utility/registry_ini.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/registry_ini.h?rev=31259&r1=31258&r2=31259&view=diff ============================================================================== --- trunk/utility/registry_ini.h (original) +++ trunk/utility/registry_ini.h Tue Dec 29 18:06:01 2015 @@ -424,6 +424,13 @@ fc__warn_unused_result fc__attribute((__format__ (__printf__, 3, 4))); +bool secfile_lookup_float(const struct section_file *secfile, float *fval, + const char *path, ...) + fc__warn_unused_result + fc__attribute((__format__ (__printf__, 3, 4))); +float secfile_lookup_float_default(const struct section_file *secfile, + float def, const char *path, ...); + const char *secfile_lookup_str(const struct section_file *secfile, const char *path, ...) fc__warn_unused_result _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits