mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-05 11:04:42 +03:00
Add WST_MODAL state.
* WDialog::modal: remove. Use WST_MODAL instead. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
fd4e56bf39
commit
db0d01b9d6
@ -319,19 +319,19 @@ dlg_execute_cmd (WDialog * h, long command)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CK_ScreenList:
|
case CK_ScreenList:
|
||||||
if (!h->modal)
|
if (!widget_get_state (WIDGET (h), WST_MODAL))
|
||||||
dialog_switch_list ();
|
dialog_switch_list ();
|
||||||
else
|
else
|
||||||
ret = MSG_NOT_HANDLED;
|
ret = MSG_NOT_HANDLED;
|
||||||
break;
|
break;
|
||||||
case CK_ScreenNext:
|
case CK_ScreenNext:
|
||||||
if (!h->modal)
|
if (!widget_get_state (WIDGET (h), WST_MODAL))
|
||||||
dialog_switch_next ();
|
dialog_switch_next ();
|
||||||
else
|
else
|
||||||
ret = MSG_NOT_HANDLED;
|
ret = MSG_NOT_HANDLED;
|
||||||
break;
|
break;
|
||||||
case CK_ScreenPrev:
|
case CK_ScreenPrev:
|
||||||
if (!h->modal)
|
if (!widget_get_state (WIDGET (h), WST_MODAL))
|
||||||
dialog_switch_prev ();
|
dialog_switch_prev ();
|
||||||
else
|
else
|
||||||
ret = MSG_NOT_HANDLED;
|
ret = MSG_NOT_HANDLED;
|
||||||
@ -559,7 +559,7 @@ frontend_dlg_run (WDialog * h)
|
|||||||
event.x = -1;
|
event.x = -1;
|
||||||
|
|
||||||
/* close opened editors, viewers, etc */
|
/* close opened editors, viewers, etc */
|
||||||
if (!h->modal && mc_global.midnight_shutdown)
|
if (!widget_get_state (wh, WST_MODAL) && mc_global.midnight_shutdown)
|
||||||
{
|
{
|
||||||
send_message (h, NULL, MSG_VALIDATE, 0, NULL);
|
send_message (h, NULL, MSG_VALIDATE, 0, NULL);
|
||||||
return;
|
return;
|
||||||
@ -834,9 +834,11 @@ dlg_create (gboolean modal, int y1, int x1, int lines, int cols,
|
|||||||
mouse_callback);
|
mouse_callback);
|
||||||
widget_want_cursor (w, FALSE);
|
widget_want_cursor (w, FALSE);
|
||||||
w->options |= WOP_TOP_SELECT;
|
w->options |= WOP_TOP_SELECT;
|
||||||
w->state |= WST_CONSTRUCT;
|
|
||||||
|
|
||||||
new_d->modal = modal;
|
w->state |= WST_CONSTRUCT;
|
||||||
|
if (modal)
|
||||||
|
w->state |= WST_MODAL;
|
||||||
|
|
||||||
new_d->color = colors;
|
new_d->color = colors;
|
||||||
new_d->help_ctx = help_ctx;
|
new_d->help_ctx = help_ctx;
|
||||||
new_d->flags = flags;
|
new_d->flags = flags;
|
||||||
@ -1229,8 +1231,8 @@ dlg_init (WDialog * h)
|
|||||||
{
|
{
|
||||||
Widget *wh = WIDGET (h);
|
Widget *wh = WIDGET (h);
|
||||||
|
|
||||||
if (top_dlg != NULL && DIALOG (top_dlg->data)->modal)
|
if (top_dlg != NULL && widget_get_state (WIDGET (top_dlg->data), WST_MODAL))
|
||||||
h->modal = TRUE;
|
widget_set_state (wh, WST_MODAL, TRUE);
|
||||||
|
|
||||||
/* add dialog to the stack */
|
/* add dialog to the stack */
|
||||||
top_dlg = g_list_prepend (top_dlg, h);
|
top_dlg = g_list_prepend (top_dlg, h);
|
||||||
@ -1238,7 +1240,7 @@ dlg_init (WDialog * h)
|
|||||||
/* Initialize dialog manager and widgets */
|
/* Initialize dialog manager and widgets */
|
||||||
if (widget_get_state (wh, WST_CONSTRUCT))
|
if (widget_get_state (wh, WST_CONSTRUCT))
|
||||||
{
|
{
|
||||||
if (!h->modal)
|
if (!widget_get_state (wh, WST_MODAL))
|
||||||
dialog_switch_add (h);
|
dialog_switch_add (h);
|
||||||
|
|
||||||
send_message (h, NULL, MSG_INIT, 0, NULL);
|
send_message (h, NULL, MSG_INIT, 0, NULL);
|
||||||
@ -1287,7 +1289,7 @@ dlg_run_done (WDialog * h)
|
|||||||
if (widget_get_state (WIDGET (h), WST_CLOSED))
|
if (widget_get_state (WIDGET (h), WST_CLOSED))
|
||||||
{
|
{
|
||||||
send_message (h, h->current->data, MSG_END, 0, NULL);
|
send_message (h, h->current->data, MSG_END, 0, NULL);
|
||||||
if (!h->modal)
|
if (!widget_get_state (WIDGET (h), WST_MODAL))
|
||||||
dialog_switch_remove (h);
|
dialog_switch_remove (h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,6 @@ struct WDialog
|
|||||||
Widget widget;
|
Widget widget;
|
||||||
|
|
||||||
/* Set by the user */
|
/* Set by the user */
|
||||||
gboolean modal; /* type of dialog: modal or not */
|
|
||||||
dlg_flags_t flags; /* User flags */
|
dlg_flags_t flags; /* User flags */
|
||||||
const char *help_ctx; /* Name of the help entry */
|
const char *help_ctx; /* Name of the help entry */
|
||||||
const int *color; /* Color set. Unused in viewer and editor */
|
const int *color; /* Color set. Unused in viewer and editor */
|
||||||
|
@ -76,7 +76,8 @@ typedef enum
|
|||||||
{
|
{
|
||||||
WST_DEFAULT = (0 << 0),
|
WST_DEFAULT = (0 << 0),
|
||||||
WST_DISABLED = (1 << 0), /* Widget cannot be selected */
|
WST_DISABLED = (1 << 0), /* Widget cannot be selected */
|
||||||
WST_IDLE = (1 << 1), /* @FIXME@: we want more correct name here */
|
WST_IDLE = (1 << 1),
|
||||||
|
WST_MODAL = (1 << 2), /* Widget (dialog) is modal */
|
||||||
|
|
||||||
WST_CONSTRUCT = (1 << 15), /* Dialog has been constructed but not run yet */
|
WST_CONSTRUCT = (1 << 15), /* Dialog has been constructed but not run yet */
|
||||||
WST_ACTIVE = (1 << 16), /* Dialog is visible and active */
|
WST_ACTIVE = (1 << 16), /* Dialog is visible and active */
|
||||||
|
@ -2890,10 +2890,13 @@ dview_edit (WDiff * dview, diff_place_t ord)
|
|||||||
}
|
}
|
||||||
|
|
||||||
h = WIDGET (dview)->owner;
|
h = WIDGET (dview)->owner;
|
||||||
h_modal = h->modal;
|
h_modal = widget_get_state (WIDGET (h), WST_MODAL);
|
||||||
|
|
||||||
get_line_numbers (dview->a[ord], dview->skip_rows, &linenum, &lineofs);
|
get_line_numbers (dview->a[ord], dview->skip_rows, &linenum, &lineofs);
|
||||||
h->modal = TRUE; /* not allow edit file in several editors */
|
|
||||||
|
/* disallow edit file in several editors */
|
||||||
|
widget_set_state (WIDGET (h), WST_MODAL, TRUE);
|
||||||
|
|
||||||
{
|
{
|
||||||
vfs_path_t *tmp_vpath;
|
vfs_path_t *tmp_vpath;
|
||||||
|
|
||||||
@ -2901,7 +2904,8 @@ dview_edit (WDiff * dview, diff_place_t ord)
|
|||||||
edit_file_at_line (tmp_vpath, use_internal_edit != 0, linenum);
|
edit_file_at_line (tmp_vpath, use_internal_edit != 0, linenum);
|
||||||
vfs_path_free (tmp_vpath);
|
vfs_path_free (tmp_vpath);
|
||||||
}
|
}
|
||||||
h->modal = h_modal;
|
|
||||||
|
widget_set_state (WIDGET (h), WST_MODAL, h_modal);
|
||||||
dview_redo (dview);
|
dview_redo (dview);
|
||||||
dview_update (dview);
|
dview_update (dview);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user