Fix of DLG_ACTION handling in viewer.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2011-03-28 22:02:00 +04:00
parent 87f3030c7a
commit 9ae7a28bf8
4 changed files with 22 additions and 9 deletions

View File

@ -334,7 +334,7 @@ ExtendedKeyMap = ctrl-x
[viewer]
Help = f1
WrapMode = f2
Quit = f3; f10; q; esc; ctrl-g
Quit = f3; f10; q; esc
HexMode = f4
Goto = f5
Search = f7; question; slash
@ -366,7 +366,7 @@ Ruler = alt-r
[viewer:hex]
Help = f1
HexEditMode = f2
Quit = f3; f10; q; esc; ctrl-g
Quit = f3; f10; q; esc
HexMode = f4
Goto = f5
Save = f6

View File

@ -337,7 +337,7 @@ EditNew = k
[viewer]
Help = f1
WrapMode = f2
Quit = f3; f10; q; esc; ctrl-g
Quit = f3; f10; q; esc
HexMode = f4
Goto = f5
Search = f7; question; slash
@ -369,7 +369,7 @@ Ruler = alt-r
[viewer:hex]
Help = f1
HexEditMode = f2
Quit = f3; f10; q; esc; ctrl-g
Quit = f3; f10; q; esc
HexMode = f4
Goto = f5
Save = f6

View File

@ -426,7 +426,7 @@ static const global_keymap_ini_t default_editor_x_keymap[] = {
static const global_keymap_ini_t default_viewer_keymap[] = {
{"Help", "f1"},
{"WrapMode", "f2"},
{"Quit", "f3; f10; q; esc; ctrl-g"},
{"Quit", "f3; f10; q; esc"},
{"HexMode", "f4"},
{"Goto", "f5"},
{"Search", "f7; question; slash"},
@ -463,7 +463,7 @@ static const global_keymap_ini_t default_viewer_keymap[] = {
static const global_keymap_ini_t default_viewer_hex_keymap[] = {
{"Help", "f1"},
{"HexEditMode", "f2"},
{"Quit", "f3; f10; q; esc; ctrl-g"},
{"Quit", "f3; f10; q; esc"},
{"HexMode", "f4"},
{"Goto", "f5"},
{"Save", "f6"},

View File

@ -382,6 +382,9 @@ mcview_execute_cmd (mcview_t * view, unsigned long command)
if (!mcview_is_in_panel (view))
dlg_stop (view->widget.owner);
break;
case CK_Cancel:
/* don't close viewer due to SIGINT */
break;
default:
res = MSG_NOT_HANDLED;
}
@ -522,9 +525,19 @@ mcview_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm,
return MSG_HANDLED;
case DLG_ACTION:
/* command from buttonbar */
view = (mcview_t *) data;
return send_message ((Widget *) view, WIDGET_COMMAND, parm);
/* shortcut */
if (sender == NULL)
return mcview_execute_cmd (NULL, parm);
/* message from buttonbar */
if (sender == (Widget *) find_buttonbar (h))
{
if (data != NULL)
return send_message ((Widget *) data, WIDGET_COMMAND, parm);
view = (mcview_t *) find_widget_type (h, mcview_callback);
return mcview_execute_cmd (view, parm);
}
return MSG_NOT_HANDLED;
case DLG_VALIDATE:
view = (mcview_t *) find_widget_type (h, mcview_callback);