static cb_ret_t edit_dialog_command_execute (WDialog * h, long command) { Widget *wh = WIDGET (h); cb_ret_t ret = MSG_HANDLED; switch (command) { case CK_EditNew: edit_add_window (h, wh->y + 1, wh->x, wh->lines - 2, wh->cols, NULL, 0); break; case CK_EditFile: edit_load_cmd (h); break; case CK_EditSyntaxFile: edit_load_syntax_file (h); break; case CK_EditUserMenu: edit_load_menu_file (h); break; case CK_Close: /* if there are no opened files anymore, close MC editor */ if (edit_widget_is_editor (CONST_WIDGET (h->current->data)) && edit_close_cmd ((WEdit *) h->current->data) && find_editor (h) == NULL) dlg_stop (h); break; case CK_Help: edit_help (); /* edit->force |= REDRAW_COMPLETELY; */ break; case CK_Menu: edit_menu_cmd (h); break; case CK_Quit: case CK_Cancel: /* don't close editor due to SIGINT, but stop move/resize window */ { Widget *w = WIDGET (h->current->data); if (edit_widget_is_editor (w) && ((WEdit *) w)->drag_state != MCEDIT_DRAG_NONE) edit_restore_size ((WEdit *) w); else if (command == CK_Quit) dlg_stop (h); } break; case CK_About: edit_about (); break; case CK_SyntaxOnOff: edit_syntax_onoff_cmd (h); break; case CK_ShowTabTws: edit_show_tabs_tws_cmd (h); break; case CK_ShowMargin: edit_show_margin_cmd (h); break; case CK_ShowNumbers: edit_show_numbers_cmd (h); break; case CK_Refresh: edit_refresh_cmd (); break; case CK_Shell: view_other_cmd (); break; case CK_LearnKeys: learn_keys (); break; case CK_WindowMove: case CK_WindowResize: if (edit_widget_is_editor (CONST_WIDGET (h->current->data))) edit_handle_move_resize ((WEdit *) h->current->data, command); break; case CK_WindowList: edit_window_list (h); break; case CK_WindowNext: dlg_select_next_widget (h); break; case CK_WindowPrev: dlg_select_prev_widget (h); break; case CK_Options: edit_options_dialog (h); break; case CK_OptionsSaveMode: edit_save_mode_cmd (); break; case CK_SaveSetup: save_setup_cmd (); break; default: ret = MSG_NOT_HANDLED; break; } return ret; }
static cb_ret_t edit_dialog_command_execute (Dlg_head * h, unsigned long command) { gboolean ret = MSG_HANDLED; switch (command) { case CK_EditNew: edit_add_window (h, h->y + 1, h->x, h->lines - 2, h->cols, NULL, 0); break; case CK_EditFile: edit_load_cmd (h); break; case CK_EditSyntaxFile: edit_load_syntax_file (h); break; case CK_EditUserMenu: edit_load_menu_file (h); break; case CK_Close: /* if there are no opened files anymore, close MC editor */ if (edit_widget_is_editor ((Widget *) h->current->data) && edit_close_cmd ((WEdit *) h->current->data) && find_editor (h) == NULL) dlg_stop (h); break; case CK_Help: edit_help (); /* edit->force |= REDRAW_COMPLETELY; */ break; case CK_Menu: edit_menu_cmd (h); break; case CK_Quit: case CK_Cancel: { Widget *w = (Widget *) h->current->data; if (!edit_widget_is_editor (w) || ((WEdit *) w)->drag_state == MCEDIT_DRAG_NORMAL) dlg_stop (h); else edit_restore_size ((WEdit *) w); } break; case CK_About: edit_about (); break; case CK_SyntaxOnOff: edit_syntax_onoff_cmd (h); break; case CK_ShowTabTws: edit_show_tabs_tws_cmd (h); break; case CK_ShowMargin: edit_show_margin_cmd (h); break; case CK_ShowNumbers: edit_show_numbers_cmd (h); break; case CK_Refresh: edit_refresh_cmd (); break; case CK_Shell: view_other_cmd (); break; case CK_LearnKeys: learn_keys (); break; case CK_WindowMove: case CK_WindowResize: if (edit_widget_is_editor ((Widget *) h->current->data)) edit_handle_move_resize ((WEdit *) h->current->data, command); break; case CK_WindowList: edit_window_list (h); break; case CK_WindowNext: dlg_one_down (h); dlg_set_top_widget (h->current->data); break; case CK_WindowPrev: dlg_one_up (h); dlg_set_top_widget (h->current->data); break; case CK_Options: edit_options_dialog (h); break; case CK_OptionsSaveMode: edit_save_mode_cmd (); break; case CK_SaveSetup: save_setup_cmd (); break; default: ret = MSG_NOT_HANDLED; break; } return ret; }