Data Structures | Functions | Variables
ui-keymap.c File Reference

Keymap handling. More...

#include "angband.h"
#include "ui-keymap.h"
#include "ui-term.h"

Data Structures

struct  keymap
 Keymap implementation. More...


struct keypresskeymap_find (int keymap, struct keypress kc)
 Find a keymap, given a keypress.
static struct keypresskeymap_make (const struct keypress *actions)
 Duplicate a given keypress string and return the duplicate.
void keymap_add (int keymap, struct keypress trigger, struct keypress *actions, bool user)
 Add a keymap to the mappings table.
bool keymap_remove (int keymap, struct keypress trigger)
 Remove a keymap.
void keymap_free (void)
 Forget and free all keymaps.
void keymap_dump (ang_file *fff)
 Append active keymaps to a given file.


static struct keymapkeymaps [KEYMAP_MODE_MAX]
 List of keymaps.

Detailed Description

Keymap handling.

Copyright (c) 2011 Andi Sidwell

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Function Documentation

void keymap_add ( int  keymap,
struct keypress  trigger,
struct keypress actions,
bool  user 

Add a keymap to the mappings table.

Given a keymap mode, a trigger, and an action, store it in the keymap list.

References keymap::actions, keymap::key, keymap_make(), KEYMAP_MODE_MAX, keymap_remove(), mem_zalloc(), keymap::next, and keymap::user.

Referenced by parse_prefs_keymap_input(), and ui_keymap_create().

void keymap_dump ( ang_file fff)

Append active keymaps to a given file.

Save keymaps to the specified file.

References keymap::actions, buf, FALSE, file_putf(), keymap::key, KEYMAP_MODE_ORIG, KEYMAP_MODE_ROGUE, keypress_to_text(), keymap::next, OPT, TRUE, and keymap::user.

Referenced by ui_keymap_pref_append().

struct keypress* keymap_find ( int  keymap,
struct keypress  kc 

Find a keymap, given a keypress.

Given a keymap mode and a keypress, return any attached action.

References keymap::actions, keypress::code, keymap::key, KEYMAP_MODE_MAX, keypress::mods, and keymap::next.

Referenced by target_dir_allow(), textui_get_command(), and ui_keymap_query().

void keymap_free ( void  )

Forget and free all keymaps.

Free all keymaps.

References keymap::actions, i, mem_free(), N_ELEMENTS, and keymap::next.

Referenced by textui_cleanup().

static struct keypress* keymap_make ( const struct keypress actions)

Duplicate a given keypress string and return the duplicate.

References EVT_NONE, mem_zalloc(), and type.

Referenced by keymap_add().

bool keymap_remove ( int  keymap,
struct keypress  trigger 

Remove a keymap.

Given a keypress, remove any keymap that would trigger on that key.

Return TRUE if one was removed.

References keymap::actions, keypress::code, FALSE, keymap::key, KEYMAP_MODE_MAX, mem_free(), keypress::mods, keymap::next, prev, and TRUE.

Referenced by keymap_add(), and ui_keymap_remove().

Variable Documentation

struct keymap* keymaps[KEYMAP_MODE_MAX]

List of keymaps.