1998-02-27 07:54:42 +03:00
|
|
|
/* Learn keys
|
2007-09-25 19:33:35 +04:00
|
|
|
Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
2009-05-20 16:34:33 +04:00
|
|
|
2007, 2009 Free Software Foundation, Inc.
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
Written by: 1995 Jakub Jelinek
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-05-27 07:35:10 +04:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
1998-02-27 07:54:42 +03:00
|
|
|
*/
|
|
|
|
|
2009-02-05 21:28:18 +03:00
|
|
|
/** \file learn.c
|
|
|
|
* \brief Source: learn keys module
|
|
|
|
*/
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
#include <config.h>
|
2005-02-08 12:04:03 +03:00
|
|
|
|
|
|
|
#include <ctype.h>
|
1998-02-27 07:54:42 +03:00
|
|
|
#include <stdio.h>
|
2005-02-08 12:04:03 +03:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2009-02-06 01:27:37 +03:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
2005-02-08 12:04:03 +03:00
|
|
|
#include <unistd.h>
|
2001-09-03 09:07:40 +04:00
|
|
|
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
#include "global.h"
|
2009-05-09 19:17:57 +04:00
|
|
|
|
2009-05-08 14:01:05 +04:00
|
|
|
#include "../src/tty/tty.h"
|
2009-05-09 19:17:57 +04:00
|
|
|
#include "../src/tty/key.h"
|
|
|
|
|
2003-10-25 03:20:30 +04:00
|
|
|
#include "dialog.h"
|
1998-02-27 07:54:42 +03:00
|
|
|
#include "widget.h"
|
2009-05-20 16:34:33 +04:00
|
|
|
#include "../src/mcconfig/mcconfig.h" /* Save profile */
|
1998-02-27 07:54:42 +03:00
|
|
|
#include "setup.h"
|
2009-07-19 19:00:26 +04:00
|
|
|
#include "layout.h" /* repaint_screen() */
|
1998-12-03 00:27:27 +03:00
|
|
|
#include "learn.h"
|
2002-08-23 03:01:08 +04:00
|
|
|
#include "wtools.h"
|
2008-12-29 02:11:45 +03:00
|
|
|
#include "strutil.h"
|
1998-12-03 00:27:27 +03:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
#define UX 4
|
|
|
|
#define UY 3
|
|
|
|
|
|
|
|
#define BY UY + 17
|
|
|
|
|
|
|
|
#define ROWS 13
|
|
|
|
#define COLSHIFT 23
|
|
|
|
|
|
|
|
#define BUTTONS 2
|
|
|
|
|
2001-06-05 20:41:44 +04:00
|
|
|
static struct {
|
1998-02-27 07:54:42 +03:00
|
|
|
int ret_cmd, flags, y, x;
|
2004-08-30 03:27:40 +04:00
|
|
|
const char *text;
|
1998-02-27 07:54:42 +03:00
|
|
|
} learn_but[BUTTONS] = {
|
2003-09-03 08:37:35 +04:00
|
|
|
{ B_CANCEL, NORMAL_BUTTON, 0, 39, N_("&Cancel") },
|
|
|
|
{ B_ENTER, DEFPUSH_BUTTON, 0, 25, N_("&Save") }
|
1998-02-27 07:54:42 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
static Dlg_head *learn_dlg;
|
|
|
|
typedef struct {
|
|
|
|
Widget *button;
|
|
|
|
Widget *label;
|
|
|
|
int ok;
|
|
|
|
char *sequence;
|
|
|
|
} learnkey;
|
|
|
|
static learnkey *learnkeys = NULL;
|
|
|
|
static int learn_total;
|
|
|
|
static int learnok;
|
|
|
|
static int learnchanged;
|
2004-08-30 03:27:40 +04:00
|
|
|
static const char* learn_title = N_("Learn keys");
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
|
2003-09-01 06:07:02 +04:00
|
|
|
static int learn_button (int action)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
2005-05-11 05:16:58 +04:00
|
|
|
char *seq;
|
2003-10-26 01:12:05 +04:00
|
|
|
Dlg_head *d = create_message (D_ERROR, _(" Teach me a key "),
|
1998-03-25 08:16:00 +03:00
|
|
|
_("Please press the %s\n"
|
1998-02-27 07:54:42 +03:00
|
|
|
"and then wait until this message disappears.\n\n"
|
|
|
|
"Then, press it again to see if OK appears\n"
|
|
|
|
"next to its button.\n\n"
|
|
|
|
"If you want to escape, press a single Escape key\n"
|
1998-03-25 08:16:00 +03:00
|
|
|
"and wait as well."),
|
|
|
|
_(key_name_conv_tab [action - B_USER].longname));
|
2009-08-16 19:27:33 +04:00
|
|
|
mc_refresh ();
|
1998-02-27 07:54:42 +03:00
|
|
|
if (learnkeys [action - B_USER].sequence != NULL) {
|
2009-02-06 01:27:37 +03:00
|
|
|
g_free (learnkeys [action - B_USER].sequence);
|
1998-02-27 07:54:42 +03:00
|
|
|
learnkeys [action - B_USER].sequence = NULL;
|
|
|
|
}
|
|
|
|
seq = learn_key ();
|
|
|
|
|
|
|
|
if (seq){
|
|
|
|
/* Esc hides the dialog and do not allow definitions of
|
|
|
|
* regular characters
|
|
|
|
*/
|
2009-07-04 14:48:39 +04:00
|
|
|
gboolean seq_ok = FALSE;
|
2001-08-14 08:48:26 +04:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
if (*seq && strcmp (seq, "\\e") && strcmp (seq, "\\e\\e")
|
2002-08-21 10:50:09 +04:00
|
|
|
&& strcmp (seq, "^m" ) && strcmp (seq, "^i" )
|
1998-02-27 07:54:42 +03:00
|
|
|
&& (seq [1] || (*seq < ' ' || *seq > '~'))){
|
2009-07-04 14:48:39 +04:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
learnchanged = 1;
|
|
|
|
learnkeys [action - B_USER].sequence = seq;
|
|
|
|
seq = convert_controls (seq);
|
2001-08-14 08:48:26 +04:00
|
|
|
seq_ok = define_sequence (key_name_conv_tab [action - B_USER].code,
|
|
|
|
seq, MCKEY_NOACTION);
|
|
|
|
}
|
|
|
|
|
2009-07-04 14:48:39 +04:00
|
|
|
if (!seq_ok)
|
2009-01-10 16:13:56 +03:00
|
|
|
message (D_NORMAL, _(" Cannot accept this key "),
|
1998-03-25 08:16:00 +03:00
|
|
|
_(" You have entered \"%s\""), seq);
|
2009-07-04 14:48:39 +04:00
|
|
|
|
|
|
|
g_free (seq);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
2009-07-04 14:48:39 +04:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
dlg_run_done (d);
|
|
|
|
destroy_dlg (d);
|
2005-05-21 00:22:06 +04:00
|
|
|
dlg_select_widget (learnkeys [action - B_USER].button);
|
1998-02-27 07:54:42 +03:00
|
|
|
return 0; /* Do not kill learn_dlg */
|
|
|
|
}
|
|
|
|
|
|
|
|
static int learn_move (int right)
|
|
|
|
{
|
|
|
|
int i, totalcols;
|
|
|
|
|
|
|
|
totalcols = (learn_total - 1) / ROWS + 1;
|
|
|
|
for (i = 0; i < learn_total; i++)
|
2003-09-13 03:38:42 +04:00
|
|
|
if (learnkeys [i].button == learn_dlg->current) {
|
1998-02-27 07:54:42 +03:00
|
|
|
if (right) {
|
|
|
|
if (i < learn_total - ROWS)
|
|
|
|
i += ROWS;
|
|
|
|
else
|
|
|
|
i %= ROWS;
|
|
|
|
} else {
|
|
|
|
if (i / ROWS)
|
|
|
|
i -= ROWS;
|
|
|
|
else if (i + (totalcols - 1) * ROWS >= learn_total)
|
|
|
|
i += (totalcols - 2) * ROWS;
|
|
|
|
else
|
|
|
|
i += (totalcols - 1) * ROWS;
|
|
|
|
}
|
2005-05-21 00:22:06 +04:00
|
|
|
dlg_select_widget (learnkeys [i].button);
|
1998-02-27 07:54:42 +03:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-10-22 02:54:20 +04:00
|
|
|
static int
|
|
|
|
learn_check_key (int c)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < learn_total; i++) {
|
2002-10-22 02:54:20 +04:00
|
|
|
if (key_name_conv_tab[i].code != c || learnkeys[i].ok)
|
|
|
|
continue;
|
|
|
|
|
2005-05-21 00:22:06 +04:00
|
|
|
dlg_select_widget (learnkeys[i].button);
|
2002-10-22 02:54:20 +04:00
|
|
|
/* TRANSLATORS: This label appears near learned keys. Keep it short. */
|
|
|
|
label_set_text ((WLabel *) learnkeys[i].label, _("OK"));
|
|
|
|
learnkeys[i].ok = 1;
|
|
|
|
learnok++;
|
|
|
|
if (learnok >= learn_total) {
|
|
|
|
learn_dlg->ret_value = B_CANCEL;
|
|
|
|
if (learnchanged) {
|
|
|
|
if (query_dialog (learn_title,
|
|
|
|
_
|
|
|
|
("It seems that all your keys already\n"
|
2009-01-10 16:13:56 +03:00
|
|
|
"work fine. That's great."), D_ERROR, 2,
|
2002-10-22 02:54:20 +04:00
|
|
|
_("&Save"), _("&Discard")) == 0)
|
|
|
|
learn_dlg->ret_value = B_ENTER;
|
|
|
|
} else {
|
2009-01-10 16:13:56 +03:00
|
|
|
message (D_ERROR, learn_title,
|
2002-10-22 02:54:20 +04:00
|
|
|
_
|
|
|
|
("Great! You have a complete terminal database!\n"
|
1998-03-25 08:16:00 +03:00
|
|
|
"All your keys work well."));
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
2002-10-22 02:54:20 +04:00
|
|
|
dlg_stop (learn_dlg);
|
|
|
|
}
|
|
|
|
return 1;
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
switch (c) {
|
2002-10-22 02:54:20 +04:00
|
|
|
case KEY_LEFT:
|
|
|
|
case 'h':
|
|
|
|
return learn_move (0);
|
|
|
|
case KEY_RIGHT:
|
|
|
|
case 'l':
|
|
|
|
return learn_move (1);
|
|
|
|
case 'j':
|
|
|
|
dlg_one_down (learn_dlg);
|
|
|
|
return 1;
|
|
|
|
case 'k':
|
|
|
|
dlg_one_up (learn_dlg);
|
|
|
|
return 1;
|
|
|
|
}
|
1998-04-08 22:50:24 +04:00
|
|
|
|
|
|
|
/* Prevent from disappearing if a non-defined sequence is pressed
|
2003-09-03 08:37:35 +04:00
|
|
|
and contains a button hotkey. Only recognize hotkeys with ALT. */
|
2008-12-29 02:11:45 +03:00
|
|
|
if (c < 255 && g_ascii_isalnum (c))
|
2002-10-22 02:54:20 +04:00
|
|
|
return 1;
|
1998-04-08 22:50:24 +04:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-09-08 01:24:01 +04:00
|
|
|
static cb_ret_t
|
|
|
|
learn_callback (Dlg_head *h, dlg_msg_t msg, int parm)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
2003-09-08 01:24:01 +04:00
|
|
|
switch (msg) {
|
1998-02-27 07:54:42 +03:00
|
|
|
case DLG_DRAW:
|
2002-08-23 03:01:08 +04:00
|
|
|
common_dialog_repaint (h);
|
2003-09-08 01:24:01 +04:00
|
|
|
return MSG_HANDLED;
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
case DLG_KEY:
|
2003-09-08 01:24:01 +04:00
|
|
|
return learn_check_key (parm);
|
|
|
|
|
|
|
|
default:
|
|
|
|
return default_dlg_callback (h, msg, parm);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-09-01 04:18:37 +04:00
|
|
|
static void
|
|
|
|
init_learn (void)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
int x, y, i, j;
|
|
|
|
key_code_name_t *key;
|
2003-09-01 04:18:37 +04:00
|
|
|
char buffer[BUF_TINY];
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-04-08 22:50:24 +04:00
|
|
|
#ifdef ENABLE_NLS
|
2003-09-01 04:18:37 +04:00
|
|
|
static int i18n_flag = 0;
|
|
|
|
if (!i18n_flag) {
|
|
|
|
learn_but[0].text = _(learn_but[0].text);
|
|
|
|
learn_but[0].x = 78 / 2 + 4;
|
|
|
|
|
|
|
|
learn_but[1].text = _(learn_but[1].text);
|
2008-12-29 02:11:45 +03:00
|
|
|
learn_but[1].x = 78 / 2 - (str_term_width1 (learn_but[1].text) + 9);
|
2003-09-01 04:18:37 +04:00
|
|
|
|
|
|
|
learn_title = _(learn_title);
|
|
|
|
i18n_flag = 1;
|
|
|
|
}
|
|
|
|
#endif /* ENABLE_NLS */
|
2001-08-03 08:47:52 +04:00
|
|
|
|
2003-09-01 04:18:37 +04:00
|
|
|
do_refresh ();
|
1998-02-27 07:54:42 +03:00
|
|
|
|
2003-09-01 04:18:37 +04:00
|
|
|
learn_dlg =
|
|
|
|
create_dlg (0, 0, 23, 78, dialog_colors, learn_callback,
|
2003-09-13 01:22:01 +04:00
|
|
|
"[Learn keys]", learn_title, DLG_CENTER | DLG_REVERSE);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
for (i = 0; i < BUTTONS; i++)
|
2003-09-01 04:18:37 +04:00
|
|
|
add_widget (learn_dlg,
|
|
|
|
button_new (BY + learn_but[i].y, learn_but[i].x,
|
|
|
|
learn_but[i].ret_cmd, learn_but[i].flags,
|
2003-09-01 06:07:02 +04:00
|
|
|
_(learn_but[i].text), 0));
|
2003-09-01 04:18:37 +04:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
x = UX;
|
|
|
|
y = UY;
|
2003-09-01 04:18:37 +04:00
|
|
|
for (key = key_name_conv_tab, j = 0;
|
|
|
|
key->name != NULL && strcmp (key->name, "kpleft"); key++, j++);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
learnkeys = g_new (learnkey, j);
|
1998-02-27 07:54:42 +03:00
|
|
|
x += ((j - 1) / ROWS) * COLSHIFT;
|
|
|
|
y += (j - 1) % ROWS;
|
|
|
|
learn_total = j;
|
|
|
|
learnok = 0;
|
|
|
|
learnchanged = 0;
|
|
|
|
for (i = j - 1, key = key_name_conv_tab + j - 1; i >= 0; i--, key--) {
|
2003-09-01 04:18:37 +04:00
|
|
|
learnkeys[i].ok = 0;
|
|
|
|
learnkeys[i].sequence = NULL;
|
2009-02-06 01:49:00 +03:00
|
|
|
g_snprintf (buffer, sizeof (buffer), "%-16s", _(key->longname));
|
2003-09-01 04:18:37 +04:00
|
|
|
add_widget (learn_dlg, learnkeys[i].button = (Widget *)
|
|
|
|
button_new (y, x, B_USER + i, NARROW_BUTTON, buffer,
|
2003-09-01 06:07:02 +04:00
|
|
|
learn_button));
|
2003-09-01 04:18:37 +04:00
|
|
|
add_widget (learn_dlg, learnkeys[i].label = (Widget *)
|
|
|
|
label_new (y, x + 19, ""));
|
1998-02-27 07:54:42 +03:00
|
|
|
if (i % 13)
|
|
|
|
y--;
|
|
|
|
else {
|
|
|
|
x -= COLSHIFT;
|
|
|
|
y = UY + ROWS - 1;
|
|
|
|
}
|
|
|
|
}
|
1998-03-25 08:16:00 +03:00
|
|
|
add_widget (learn_dlg,
|
2003-09-01 04:18:37 +04:00
|
|
|
label_new (UY + 14, 5,
|
|
|
|
_
|
|
|
|
("Press all the keys mentioned here. After you have done it, check")));
|
1998-03-25 08:16:00 +03:00
|
|
|
add_widget (learn_dlg,
|
2003-09-01 04:18:37 +04:00
|
|
|
label_new (UY + 15, 5,
|
|
|
|
_
|
|
|
|
("which keys are not marked with OK. Press space on the missing")));
|
1998-03-25 08:16:00 +03:00
|
|
|
add_widget (learn_dlg,
|
2003-09-01 04:18:37 +04:00
|
|
|
label_new (UY + 16, 5,
|
|
|
|
_
|
|
|
|
("key, or click with the mouse to define it. Move around with Tab.")));
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void learn_done (void)
|
|
|
|
{
|
|
|
|
destroy_dlg (learn_dlg);
|
|
|
|
repaint_screen ();
|
|
|
|
}
|
|
|
|
|
1998-12-03 00:27:27 +03:00
|
|
|
static void
|
|
|
|
learn_save (void)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int profile_changed = 0;
|
2004-09-24 19:05:28 +04:00
|
|
|
char *section = g_strconcat ("terminal:", getenv ("TERM"), (char *) NULL);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
for (i = 0; i < learn_total; i++) {
|
|
|
|
if (learnkeys [i].sequence != NULL) {
|
|
|
|
profile_changed = 1;
|
2009-05-20 16:34:33 +04:00
|
|
|
mc_config_set_string(mc_main_config, section,
|
|
|
|
key_name_conv_tab [i].name, learnkeys [i].sequence);
|
2001-08-12 22:20:33 +04:00
|
|
|
}
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* On the one hand no good idea to save the complete setup but
|
|
|
|
* without 'Auto save setup' the new key-definitions will not be
|
|
|
|
* saved unless the user does an 'Options/Save Setup'.
|
|
|
|
* On the other hand a save-button that does not save anything to
|
|
|
|
* disk is much worse.
|
|
|
|
*/
|
|
|
|
if (profile_changed)
|
2009-05-20 16:34:33 +04:00
|
|
|
mc_config_save_file (mc_main_config);
|
2001-08-12 22:20:33 +04:00
|
|
|
|
2009-02-06 01:27:37 +03:00
|
|
|
g_free (section);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void learn_keys (void)
|
|
|
|
{
|
|
|
|
int save_old_esc_mode = old_esc_mode;
|
1998-04-01 02:36:24 +04:00
|
|
|
int save_alternate_plus_minus = alternate_plus_minus;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
old_esc_mode = 0; /* old_esc_mode cannot work in learn keys dialog */
|
1998-04-01 02:36:24 +04:00
|
|
|
alternate_plus_minus = 1; /* don't translate KP_ADD, KP_SUBTRACT and
|
|
|
|
KP_MULTIPLY to '+', '-' and '*' in
|
|
|
|
correct_key_code */
|
|
|
|
application_keypad_mode ();
|
1998-02-27 07:54:42 +03:00
|
|
|
init_learn ();
|
|
|
|
|
|
|
|
run_dlg (learn_dlg);
|
|
|
|
|
|
|
|
old_esc_mode = save_old_esc_mode;
|
1998-04-01 02:36:24 +04:00
|
|
|
alternate_plus_minus = save_alternate_plus_minus;
|
|
|
|
|
|
|
|
if (!alternate_plus_minus)
|
|
|
|
numeric_keypad_mode ();
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
switch (learn_dlg->ret_value) {
|
|
|
|
case B_ENTER:
|
|
|
|
learn_save ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
learn_done ();
|
|
|
|
}
|
|
|
|
|