5
* Andreas Boose <viceteam@t-online.de>
6
* Andr� Fachat <fachat@physik.tu-chemnitz.de>
8
* This file is part of VICE, the Versatile Commodore Emulator.
9
* See README for copyright notice.
11
* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version.
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* You should have received a copy of the GNU General Public License
22
* along with this program; if not, write to the Free Software
23
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
38
#include "resources.h"
39
#include "uikeyboard.h"
45
static UI_CALLBACK(set_keymap_type)
47
int kindex, newindex = (int)UI_MENU_CB_PARAM;
49
if (resources_get_value("KeymapIndex", (void *)&kindex) < 0)
53
if ((kindex & 1) != newindex) {
54
resources_set_value("KeymapIndex", (resource_value_t)
55
((kindex & ~1) + newindex));
59
ui_menu_set_tick(w, (kindex & 1) == newindex);
63
static ui_menu_entry_t keyboard_maptype_submenu[] = {
64
{ N_("*Symbolic mapping"), (ui_callback_t)set_keymap_type,
65
(ui_callback_data_t)0, NULL },
66
{ N_("*Positional mapping (US)"), (ui_callback_t)set_keymap_type,
67
(ui_callback_data_t)1, NULL },
71
static UI_CALLBACK(select_user_keymap)
77
static char *last_dir;
79
resources_get_value("KeymapIndex", (void *)&kindex);
80
kindex = (kindex & ~1) + (int)UI_MENU_CB_PARAM;
81
resname = machine_keymap_res_name_list[kindex];
83
vsync_suspend_speed_eval();
84
filename = ui_select_file(_("Read Keymap File"), NULL, 0, False, last_dir,
85
"*.vkm", &button, False, NULL);
89
resources_set_value(resname, (resource_value_t)filename);
92
util_fname_split(filename, &last_dir, NULL);
95
/* Do nothing special. */
102
static UI_CALLBACK(dump_keymap)
107
len = ioutil_maxpathlen();
108
wd = lib_malloc(len);
110
ioutil_getcwd(wd, len);
111
vsync_suspend_speed_eval();
112
if (ui_input_string(_("VICE setting"), _("Write to Keymap File:"),
113
wd, len) == UI_BUTTON_OK) {
114
if (keyboard_keymap_dump(wd) < 0)
115
ui_error(strerror(errno));
120
static ui_menu_entry_t keyboard_settings_submenu[] = {
121
{ N_("Keyboard mapping type"),
122
NULL, NULL, keyboard_maptype_submenu },
124
{ N_("Set symbolic keymap file"), (ui_callback_t)select_user_keymap,
125
(ui_callback_data_t)0, NULL},
126
{ N_("Set positional keymap file"), (ui_callback_t)select_user_keymap,
127
(ui_callback_data_t)1, NULL},
129
{ N_("Dump keymap to file"),
130
(ui_callback_t) dump_keymap, NULL, NULL },
134
ui_menu_entry_t uikeyboard_settings_menu[] = {
135
{ N_("Keyboard settings"),
136
NULL, NULL, keyboard_settings_submenu },