35 wk_keys_d win keybindings config keybindings nav down
36 wk_keys_u win keybindings config keybindings nav up
37 wk_keys_m win keybindings config keybindings modify
-38 reload_wins reload windows configuration
-39 save_winconf save windows' configuration
-40 save_keys save global keybindings
+38 reload_conf reload windows and keybindings configuration
+39 save_conf save windows and keybindings
41 map_u map up
42 map_d map down
43 map_l map left
60 cyc_win_b
262 scrl_l
360 scrl_r
-114 reload_wins
-75 save_keys
-87 save_winconf
+114 reload_conf
+67 save_conf
kmicl
-m
+m
\ No newline at end of file
#include "windows.h" /* for cycle_active_win(), shift_active_win(), struct Win,
* struct WinMeta
*/
-#include "keybindings.h" /* for get_keycode_to_action(), save_keybindings(),
- * move_keyb_mod_selection(), mod_selected_keyb()
+#include "keybindings.h" /* for get_keycode_to_action(), mod_selected_keyb(),
+ * move_keyb_mod_selection()
*/
#include "map.h" /* for map_scroll(), map_center_player(), dir enum */
#include "main.h" /* for World struct */
#include "rexit.h" /* for exit_err() */
#include "wincontrol.h" /* for scroll_pad(), toggle_window(),
- * growshrink_active_window(), reload_win_config()
- * toggle_winconfig(), save_win_configs(),
+ * growshrink_active_window(), toggle_winconfig(),
* toggle_win_height_type(), toggle_win_width_type()
*/
#include "map_object_actions.h" /* for player_wait(), move_player() */
#include "command_db.h" /* for is_command_id_shortdsc() */
+#include "misc.h" /* for load_interface_conf(), unload_interface_conf(),
+ * save_interface_conf()
+ */
{
exit_err(toggle_window(win_meta, win_log), world, err_toggle);
}
- else if (key == get_available_keycode_to_action(world, "save_keys"))
+ else if (key == get_available_keycode_to_action(world, "save_conf"))
{
- save_keybindings(world, "config/keybindings_global",
- &world->kb_global);
- save_keybindings(world, "config/keybindings_wingeom",
- &world->kb_wingeom);
- save_keybindings(world, "config/keybindings_winkeys",
- &world->kb_winkeys);
+ save_interface_conf(world);
}
else if (key == get_available_keycode_to_action(world, "g_keys_u"))
{
{
map_center_player(world->map, world->player, win_map->frame.size);
}
- else if (key == get_available_keycode_to_action(world, "reload_wins"))
+ else if (key == get_available_keycode_to_action(world, "reload_conf"))
{
- reload_win_config(world);
+ unload_interface_conf(world);
+ load_interface_conf(world);
}
else if (key == get_available_keycode_to_action(world, "winconf"))
{
toggle_winconfig(world, world->wmeta->active);
}
- else if (key == get_available_keycode_to_action(world, "save_winconf"))
- {
- save_win_configs(world);
- }
return 0;
}
#include <time.h> /* for time() */
#include <unistd.h> /* for getopt(), optarg */
#include <stdint.h> /* for uint16_t, uint32_t */
-#include "windows.h" /* for structs WinMeta, Win, init_win(), init_win_meta(),
- * draw_all_wins()
+#include "windows.h" /* for structs WinMeta, Win, init_win_meta(), draw_all_wins()
*/
#include "readwrite.h" /* for [read/write]_uint[8/16/32][_bigendian](),
* try_fopen(), try_fclose(), try_fclose_unlink_rename()
*/
#include "map.h" /* for struct Map, init_map() */
#include "misc.h" /* for update_log(), find_passable_pos(), save_game(),
- * try_calloc(), check_tempfile(), check_xor_files()
+ * try_calloc(), check_tempfile(), check_xor_files(),
+ * load_interface_conf()
*/
-#include "wincontrol.h" /* for create_winconfs(), init_winconfs(), init_wins(),
- * sorted_wintoggle_and_activate()
- */
+#include "wincontrol.h" /* get_win_by_id(), get_winconf_by_win() */
#include "rrand.h" /* for rrand(), rrand_seed() */
#include "rexit.h" /* for exit_game(), exit_err() */
#include "command_db.h" /* for init_command_db() */
-#include "control.h" /* for *_control() */
-#include "keybindings.h" /* for init_keybindings(),
- * get_available_keycode_to_action()
- */
+#include "control.h" /* for *_control(), get_available_keycode_to_action() */
curs_set(0);
keypad(screen, TRUE);
raw();
- init_keybindings(&world, "config/keybindings_global", &world.kb_global);
- init_keybindings(&world, "config/keybindings_wingeom", &world.kb_wingeom);
- init_keybindings(&world, "config/keybindings_winkeys", &world.kb_winkeys);
- set_cleanup_flag(CLEANUP_KEYBINDINGS);
char * err_winmem = "Trouble with init_win_meta() in main ().";
exit_err(init_win_meta(screen, &world.wmeta), &world, err_winmem);
set_cleanup_flag(CLEANUP_WIN_META);
- init_winconfs(&world);
- init_wins(&world);
- set_cleanup_flag(CLEANUP_WINCONFS);
- sorted_wintoggle_and_activate(&world);
+ load_interface_conf(&world);
+ set_cleanup_flag(CLEANUP_INTERFACE_CONF);
err_winmem = "Trouble with draw_all_wins() in main().";
/* Focus map on player. */
#include "yx_uint16.h" /* for yx_uint16 struct */
#include "rrand.h" /* for rrand(), rrand_seed() */
#include "rexit.h" /* for exit_err() */
-
+#include "wincontrol.h" /* for init_winconfs(), init_wins(), free_winconfs(),
+ * sorted_wintoggle_and_activate()
+ */
+#include "windows.h" /* for suspend_win() */
extern char * trouble_msg(struct World * w, char * parent, char * child)
+extern void save_interface_conf(struct World * world)
+{
+ save_keybindings(world, "config/keybindings_global", &world->kb_global);
+ save_keybindings(world, "config/keybindings_wingeom", &world->kb_wingeom);
+ save_keybindings(world, "config/keybindings_winkeys", &world->kb_winkeys);
+ save_win_configs(world);
+}
+
+
+
+extern void load_interface_conf(struct World * world)
+{
+ init_keybindings(world, "config/keybindings_global", &world->kb_global);
+ init_keybindings(world, "config/keybindings_wingeom", &world->kb_wingeom);
+ init_keybindings(world, "config/keybindings_winkeys", &world->kb_winkeys);
+ init_winconfs(world);
+ init_wins(world);
+ sorted_wintoggle_and_activate(world);
+}
+
+
+
+extern void unload_interface_conf(struct World * world)
+{
+ free_keybindings(world->kb_global.kbs);
+ free_keybindings(world->kb_wingeom.kbs);
+ free_keybindings(world->kb_winkeys.kbs);
+ while (0 != world->wmeta->active)
+ {
+ suspend_win(world->wmeta, world->wmeta->active);
+ }
+ free_winconfs(world);
+}
+
+
+
extern void update_log(struct World * world, char * text)
{
char * f_name = "update_log()";
+/* Save / load / unload (free) interface configuration data. */
+extern void save_interface_conf(struct World * world);
+extern void load_interface_conf(struct World * world);
+extern void unload_interface_conf(struct World * world);
+
+
+
/* Update game log by appending "text", or by appending a "." if "text" is the
* same as the last one passed.
*/
#include "windows.h" /* for Win struct, free_win(), free_winmeta() */
#include "map_objects.h" /* for free_item_defs(), free_monster_defs() */
#include "wincontrol.h" /* for free_winconfs() */
+#include "misc.h" /* for unload_interface_conf() */
+
/* The clean-up routine and the flag resource by which it decides what to do. */
{
free(world->map->cells);
}
- if (cleanup_flags & CLEANUP_KEYBINDINGS)
+ if (cleanup_flags & CLEANUP_INTERFACE_CONF)
{
- free_keybindings(world->kb_global.kbs);
- free_keybindings(world->kb_wingeom.kbs);
- free_keybindings(world->kb_winkeys.kbs);
+ unload_interface_conf(world);
}
if (cleanup_flags & CLEANUP_WIN_META)
{
free_winmeta(world->wmeta);
}
+/*
+ if (cleanup_flags & CLEANUP_KEYBINDINGS)
+ {
+ free_keybindings(world->kb_global.kbs);
+ free_keybindings(world->kb_wingeom.kbs);
+ free_keybindings(world->kb_winkeys.kbs);
+ }
if (cleanup_flags & CLEANUP_WINCONFS)
{
free_winconfs(world);
}
+*/
}
{
CLEANUP_NCURSES = 0x0001,
CLEANUP_MAP = 0x0002,
- CLEANUP_KEYBINDINGS = 0x0004,
- CLEANUP_LOG = 0x0008,
- CLEANUP_COMMAND_DB = 0x0010,
- CLEANUP_MAP_OBJECTS = 0x0020,
- CLEANUP_MAP_OBJECT_DEFS = 0x0040,
- CLEANUP_WIN_META = 0x0080,
- CLEANUP_WINCONFS = 0x0100
+ CLEANUP_LOG = 0x0004,
+ CLEANUP_COMMAND_DB = 0x0008,
+ CLEANUP_MAP_OBJECTS = 0x0010,
+ CLEANUP_MAP_OBJECT_DEFS = 0x0020,
+ CLEANUP_WIN_META = 0x0040,
+ CLEANUP_INTERFACE_CONF = 0x0080
};
extern void set_cleanup_flag(enum cleanup_flag flag);
-extern void reload_win_config(struct World * world)
-{
- while (0 != world->wmeta->active)
- {
- suspend_win(world->wmeta, world->wmeta->active);
- }
- free_winconfs(world);
- init_winconfs(world);
- init_wins(world);
- sorted_wintoggle_and_activate(world);
-}
-
-
-
extern void save_win_configs(struct World * world)
{
char * f_name = "save_win_configs()";
*/
extern void sorted_wintoggle_and_activate(struct World * world);
-/* Reload windows in order and sizes defined in win config. */
-extern void reload_win_config(struct World * world);
+
/* Save all window's configurations to their configuration files. */
extern void save_win_configs(struct World * world);