static cb_ret_t query_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WDialog *h = DIALOG (w); switch (msg) { case MSG_RESIZE: if ((h->flags & DLG_CENTER) == 0) { WDialog *prev_dlg = NULL; int ypos, xpos; /* get dialog under h */ if (top_dlg != NULL) { if (top_dlg->data != (void *) h) prev_dlg = DIALOG (top_dlg->data); else { GList *p; /* Top dialog is current if it is visible. Get previous dialog in stack */ p = g_list_next (top_dlg); if (p != NULL) prev_dlg = DIALOG (p->data); } } /* if previous dialog is not fullscreen'd -- overlap it */ if (prev_dlg == NULL || prev_dlg->fullscreen) ypos = LINES / 3 - (w->lines - 3) / 2; else ypos = WIDGET (prev_dlg)->y + 2; xpos = COLS / 2 - w->cols / 2; /* set position */ dlg_set_position (h, ypos, xpos, ypos + w->lines, xpos + w->cols); return MSG_HANDLED; } /* fallthrough */ default: return dlg_default_callback (w, sender, msg, parm, data); } }
static cb_ret_t tree_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WDialog *h = DIALOG (w); switch (msg) { case MSG_RESIZE: { Widget *bar; /* simply call dlg_set_size() with new size */ dlg_set_size (h, LINES - 9, COLS - 20); bar = WIDGET (find_buttonbar (h)); bar->x = 0; bar->y = LINES - 1; return MSG_HANDLED; } case MSG_ACTION: return send_message (find_tree (h), NULL, MSG_ACTION, parm, NULL); default: return dlg_default_callback (w, sender, msg, parm, data); } }
void dlg_init (WDialog * h) { if (top_dlg != NULL && DIALOG (top_dlg->data)->modal) h->modal = TRUE; /* add dialog to the stack */ top_dlg = g_list_prepend (top_dlg, h); /* Initialize dialog manager and widgets */ if (h->state == DLG_CONSTRUCT) { if (!h->modal) dialog_switch_add (h); send_message (h, NULL, MSG_INIT, 0, NULL); dlg_broadcast_msg (h, MSG_INIT); dlg_read_history (h); } h->state = DLG_ACTIVE; /* Select the first widget that takes focus */ while (h->current != NULL && !dlg_focus (h)) h->current = dlg_widget_next (h, h->current); dlg_redraw (h); h->ret_value = 0; }
static cb_ret_t help_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WDialog *h = DIALOG (w); switch (msg) { case MSG_RESIZE: { WButtonBar *bb; help_lines = MIN (LINES - 4, MAX (2 * LINES / 3, 18)); dlg_set_size (h, help_lines + 4, HELP_WINDOW_WIDTH + 4); bb = find_buttonbar (h); widget_set_size (WIDGET (bb), LINES - 1, 0, 1, COLS); return MSG_HANDLED; } case MSG_DRAW: dlg_default_repaint (h); help_show (h, currentpoint); return MSG_HANDLED; case MSG_KEY: return help_handle_key (h, parm); case MSG_ACTION: /* Handle shortcuts and buttonbar. */ return help_execute_cmd (parm); default: return dlg_default_callback (w, sender, msg, parm, data); } }
static cb_ret_t panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WDialog *h = DIALOG (w); switch (msg) { case MSG_NOTIFY: if (sender != NULL && sender->id == panel_listing_types_id) { WCheck *ch; WInput *in1, *in2, *in3; in1 = INPUT (dlg_find_by_id (h, panel_user_format_id)); in2 = INPUT (dlg_find_by_id (h, panel_brief_cols_id)); ch = CHECK (dlg_find_by_id (h, mini_user_status_id)); in3 = INPUT (dlg_find_by_id (h, mini_user_format_id)); if (!(ch->state & C_BOOL)) input_assign_text (in3, status_format[RADIO (sender)->sel]); input_update (in1, FALSE); input_update (in2, FALSE); input_update (in3, FALSE); widget_disable (WIDGET (in1), RADIO (sender)->sel != panel_listing_user_idx); widget_disable (WIDGET (in2), RADIO (sender)->sel != panel_listing_brief_idx); return MSG_HANDLED; } if (sender != NULL && sender->id == mini_user_status_id) { WInput *in; in = INPUT (dlg_find_by_id (h, mini_user_format_id)); if (CHECK (sender)->state & C_BOOL) { widget_disable (WIDGET (in), FALSE); input_assign_text (in, status_format[3]); } else { WRadio *r; r = RADIO (dlg_find_by_id (h, panel_listing_types_id)); widget_disable (WIDGET (in), TRUE); input_assign_text (in, status_format[r->sel]); } /* input_update (in, FALSE); */ return MSG_HANDLED; } return MSG_NOT_HANDLED; default: return dlg_default_callback (w, sender, msg, parm, data); } }
/** * Handle mouse events of editor screen. * * @param w Widget object (the editor) * @param msg mouse event message * @param event mouse event data */ static void edit_dialog_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event) { gboolean unhandled = TRUE; if (msg == MSG_MOUSE_DOWN && event->y == 0) { WDialog *h = DIALOG (w); WMenuBar *b; b = find_menubar (h); if (!widget_get_state (WIDGET (b), WST_FOCUSED)) { /* menubar */ GList *l; GList *top = NULL; int x; /* Try find top fullscreen window */ for (l = h->widgets; l != NULL; l = g_list_next (l)) if (edit_widget_is_editor (CONST_WIDGET (l->data)) && ((WEdit *) l->data)->fullscreen) top = l; /* Handle fullscreen/close buttons in the top line */ x = w->cols - 6; if (top != NULL && event->x >= x) { WEdit *e = (WEdit *) top->data; if (top != h->current) { /* Window is not active. Activate it */ widget_select (WIDGET (e)); } /* Handle buttons */ if (event->x - x <= 2) edit_toggle_fullscreen (e); else send_message (h, NULL, MSG_ACTION, CK_Close, NULL); unhandled = FALSE; } if (unhandled) menubar_activate (b, drop_menus, -1); } } /* Continue handling of unhandled event in window or menu */ event->result.abort = unhandled; }
static int edit_dialog_event (Gpm_Event * event, void *data) { WDialog *h = DIALOG (data); Widget *w; Widget *wh = WIDGET (h); int ret = MOU_UNHANDLED; w = WIDGET (find_menubar (h)); if (event->y == wh->y + 1 && (event->type & GPM_DOWN) != 0 && !MENUBAR (w)->is_active) { /* menubar */ GList *l; GList *top = NULL; int x; /* Try find top fullscreen window */ for (l = h->widgets; l != NULL; l = g_list_next (l)) if (edit_widget_is_editor (WIDGET (l->data)) && ((WEdit *) l->data)->fullscreen) top = l; /* Handle fullscreen/close buttons in the top line */ x = wh->x + wh->cols + 1 - 6; if (top != NULL && event->x >= x) { WEdit *e; e = (WEdit *) top->data; x = event->x - x; if (top != h->current) { /* Window is not active. Activate it */ dlg_set_top_widget (e); } /* Handle buttons */ if (x <= 2) edit_toggle_fullscreen (e); else send_message (h, NULL, MSG_ACTION, CK_Close, NULL); ret = MOU_NORMAL; } if (ret == MOU_UNHANDLED) dlg_select_widget (w); } return ret; }
void do_refresh (void) { GList *d = top_dlg; if (fast_refresh) { if (d != NULL) dlg_redraw (DIALOG (d->data)); } else { /* Search first fullscreen dialog */ for (; d != NULL; d = g_list_next (d)) if ((WIDGET (d->data)->pos_flags & WPOS_FULLSCREEN) != 0) break; /* back to top dialog */ for (; d != NULL; d = g_list_previous (d)) dlg_redraw (DIALOG (d->data)); } }
void do_refresh (void) { GList *d = top_dlg; if (fast_refresh) { if ((d != NULL) && (d->data != NULL)) dlg_redraw (DIALOG (d->data)); } else { /* Search first fullscreen dialog */ for (; d != NULL; d = g_list_next (d)) if (d->data != NULL && DIALOG (d->data)->fullscreen) break; /* back to top dialog */ for (; d != NULL; d = g_list_previous (d)) if (d->data != NULL) dlg_redraw (DIALOG (d->data)); } }
static cb_ret_t chown_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { switch (msg) { case MSG_DRAW: chown_refresh (DIALOG (w)); return MSG_HANDLED; default: return dlg_default_callback (w, sender, msg, parm, data); } }
static cb_ret_t editcmd_dialog_raw_key_query_cb (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WDialog *h = DIALOG (w); switch (msg) { case MSG_KEY: h->ret_value = parm; dlg_stop (h); return MSG_HANDLED; default: return dlg_default_callback (w, sender, msg, parm, data); } }
static cb_ret_t help_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WDialog *h = DIALOG (w); switch (msg) { case MSG_RESIZE: { WButtonBar *bb; help_lines = min (LINES - 4, max (2 * LINES / 3, 18)); dlg_set_size (h, help_lines + 4, HELP_WINDOW_WIDTH + 4); bb = find_buttonbar (h); widget_set_size (WIDGET (bb), LINES - 1, 0, 1, COLS); return MSG_HANDLED; } case MSG_DRAW: dlg_default_repaint (h); help_show (h, currentpoint); return MSG_HANDLED; case MSG_KEY: return help_handle_key (h, parm); case MSG_ACTION: /* shortcut */ if (sender == NULL) return help_execute_cmd (parm); /* message from buttonbar */ if (sender == WIDGET (find_buttonbar (h))) { if (data != NULL) return send_message (data, NULL, MSG_ACTION, parm, NULL); return help_execute_cmd (parm); } return MSG_NOT_HANDLED; default: return dlg_default_callback (w, sender, msg, parm, data); } }
static void widget_focus (Widget * w) { WDialog *h = DIALOG (w->owner); if (h == NULL) return; if (WIDGET (h->current->data) != w) { widget_do_focus (WIDGET (h->current->data), FALSE); /* Test if focus lost was allowed and focus has really been loose */ if (h->current == NULL || !widget_get_state (WIDGET (h->current->data), WST_FOCUSED)) { widget_do_focus (w, TRUE); h->current = dlg_find (h, w); } } else if (!widget_get_state (w, WST_FOCUSED)) widget_do_focus (w, TRUE); }
static cb_ret_t chl_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { switch (msg) { case MSG_KEY: switch (parm) { case KEY_LEFT: case KEY_RIGHT: { WDialog *h = DIALOG (w); h->ret_value = parm; dlg_stop (h); } } default: return dlg_default_callback (w, sender, msg, parm, data); } }
cb_ret_t dlg_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WDialog *h = DIALOG (w); (void) sender; (void) parm; (void) data; switch (msg) { case MSG_DRAW: if (h->color != NULL) { dlg_default_repaint (h); return MSG_HANDLED; } return MSG_NOT_HANDLED; case MSG_IDLE: /* we don't want endless loop */ widget_idle (w, FALSE); return MSG_HANDLED; case MSG_RESIZE: /* this is default resizing mechanism */ /* the main idea of this code is to resize dialog according to flags (if any of flags require automatic resizing, like WPOS_CENTER, end after that reposition controls in dialog according to flags of widget) */ dlg_set_size (h, w->lines, w->cols); return MSG_HANDLED; default: break; } return MSG_NOT_HANDLED; }
static cb_ret_t confvfs_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { switch (msg) { case MSG_ACTION: /* message from "Always use ftp proxy" checkbutton */ if (sender != NULL && sender->id == ftpfs_always_use_proxy_id) { const gboolean not_use = !(CHECK (sender)->state & C_BOOL); Widget *wi; /* input */ wi = dlg_find_by_id (DIALOG (w), ftpfs_proxy_host_id); widget_disable (wi, not_use); return MSG_HANDLED; } return MSG_NOT_HANDLED; default: return dlg_default_callback (w, sender, msg, parm, data); } }
gboolean do_load_prompt (void) { gboolean ret = FALSE; if (!read_subshell_prompt ()) return ret; /* Don't actually change the prompt if it's invisible */ if (top_dlg != NULL && DIALOG (top_dlg->data) == midnight_dlg && command_prompt) { setup_cmdline (); /* since the prompt has changed, and we are called from one of the * tty_get_event channels, the prompt updating does not take place * automatically: force a cursor update and a screen refresh */ update_cursor (midnight_dlg); mc_refresh (); ret = TRUE; } update_subshell_prompt = TRUE; return ret; }
static cb_ret_t configure_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { switch (msg) { case MSG_ACTION: /* message from "Single press" checkbutton */ if (sender != NULL && sender->id == configure_old_esc_mode_id) { const gboolean not_single = !(CHECK (sender)->state & C_BOOL); Widget *ww; /* input line */ ww = dlg_find_by_id (DIALOG (w), configure_time_out_id); widget_disable (ww, not_single); return MSG_HANDLED; } return MSG_NOT_HANDLED; default: return dlg_default_callback (w, sender, msg, parm, data); } }
static cb_ret_t layout_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WDialog *h = DIALOG (w); switch (msg) { case MSG_DRAW: /* When repainting the whole dialog (e.g. with C-l) we have to update everything */ dlg_default_repaint (h); old_output_lines = -1; update_split (h); if (old_output_lines != _output_lines) { old_output_lines = _output_lines; tty_setcolor (mc_global.tty.console_flag != '\0' ? COLOR_NORMAL : DISABLED_COLOR); widget_move (h, 9, 5); tty_print_string (output_lines_label); widget_move (h, 9, 5 + 3 + output_lines_label_len); tty_printf ("%02d", _output_lines); } return MSG_HANDLED; case MSG_POST_KEY: _menubar_visible = check_options[1].widget->state & C_BOOL; _command_prompt = (check_options[2].widget->state & C_BOOL) != 0; _keybar_visible = check_options[3].widget->state & C_BOOL; _message_visible = check_options[4].widget->state & C_BOOL; _xterm_title = (check_options[5].widget->state & C_BOOL) != 0; _free_space = check_options[6].widget->state & C_BOOL; if (mc_global.tty.console_flag != '\0') { int minimum; if (_output_lines < 0) _output_lines = 0; height = LINES - _keybar_visible - (_command_prompt ? 1 : 0) - _menubar_visible - _output_lines - _message_visible; minimum = MINHEIGHT * (1 + panels_layout.horizontal_split); if (height < minimum) { _output_lines -= minimum - height; height = minimum; } } else height = LINES - _keybar_visible - (_command_prompt ? 1 : 0) - _menubar_visible - _output_lines - _message_visible; if (old_output_lines != _output_lines) { old_output_lines = _output_lines; tty_setcolor (mc_global.tty.console_flag != '\0' ? COLOR_NORMAL : DISABLED_COLOR); widget_move (h, 9, 5 + 3 + output_lines_label_len); tty_printf ("%02d", _output_lines); } return MSG_HANDLED; case MSG_ACTION: if (sender == WIDGET (radio_widget)) { if (panels_layout.horizontal_split != radio_widget->sel) { int eq; panels_layout.horizontal_split = radio_widget->sel; if (panels_layout.horizontal_split) { eq = panels_layout.horizontal_equal; if (eq) panels_layout.top_panel_size = height / 2; } else { eq = panels_layout.vertical_equal; if (eq) panels_layout.left_panel_size = COLS / 2; } widget_disable (WIDGET (bleft_widget), eq); widget_disable (WIDGET (bright_widget), eq); update_split (h); layout_change (); do_refresh (); } else update_split (h); return MSG_HANDLED; } if (sender == WIDGET (check_options[0].widget)) { int eq; if (panels_layout.horizontal_split) { panels_layout.horizontal_equal = check_options[0].widget->state & C_BOOL; eq = panels_layout.horizontal_equal; } else { panels_layout.vertical_equal = check_options[0].widget->state & C_BOOL; eq = panels_layout.vertical_equal; } widget_disable (WIDGET (bleft_widget), eq); widget_disable (WIDGET (bright_widget), eq); update_split (h); layout_change (); do_refresh (); return MSG_HANDLED; } return MSG_NOT_HANDLED; default: return dlg_default_callback (w, sender, msg, parm, data); } }
static cb_ret_t panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WDialog *h = DIALOG (w); switch (msg) { case MSG_KEY: if (parm == '\n') { Widget *wi; wi = dlg_find_by_id (h, panel_listing_types_id); if (widget_is_active (wi)) { WInput *in; in = INPUT (dlg_find_by_id (h, mini_user_format_id)); input_assign_text (in, status_format[RADIO (wi)->sel]); dlg_stop (h); return MSG_HANDLED; } wi = dlg_find_by_id (h, panel_user_format_id); if (widget_is_active (wi)) { h->ret_value = B_USER + 6; dlg_stop (h); return MSG_HANDLED; } wi = dlg_find_by_id (h, mini_user_format_id); if (widget_is_active (wi)) { h->ret_value = B_USER + 7; dlg_stop (h); return MSG_HANDLED; } } if (g_ascii_tolower (parm) == listing_user_hotkey) { Widget *wi; wi = dlg_find_by_id (h, panel_user_format_id); if (widget_is_active (wi)) { wi = dlg_find_by_id (h, mini_user_format_id); if (widget_is_active (wi)) { WRadio *r; r = RADIO (dlg_find_by_id (h, panel_listing_types_id)); r->pos = r->sel = panel_listing_user_idx; dlg_select_widget (WIDGET (r)); /* force redraw */ send_message (h, r, MSG_ACTION, 0, NULL); return MSG_HANDLED; } } } return MSG_NOT_HANDLED; case MSG_ACTION: if (sender != NULL && sender->id == panel_listing_types_id) { WCheck *ch; WInput *in1, *in2, *in3; in1 = INPUT (dlg_find_by_id (h, panel_user_format_id)); in2 = INPUT (dlg_find_by_id (h, panel_brief_cols_id)); ch = CHECK (dlg_find_by_id (h, mini_user_status_id)); in3 = INPUT (dlg_find_by_id (h, mini_user_format_id)); if (!(ch->state & C_BOOL)) input_assign_text (in3, status_format[RADIO (sender)->sel]); input_update (in1, FALSE); input_update (in2, FALSE); input_update (in3, FALSE); widget_disable (WIDGET (in1), RADIO (sender)->sel != panel_listing_user_idx); widget_disable (WIDGET (in2), RADIO (sender)->sel != panel_listing_brief_idx); return MSG_HANDLED; } if (sender != NULL && sender->id == mini_user_status_id) { WInput *in; in = INPUT (dlg_find_by_id (h, mini_user_format_id)); if (CHECK (sender)->state & C_BOOL) { widget_disable (WIDGET (in), FALSE); input_assign_text (in, status_format[3]); } else { WRadio *r; r = RADIO (dlg_find_by_id (h, panel_listing_types_id)); widget_disable (WIDGET (in), TRUE); input_assign_text (in, status_format[r->sel]); } /* input_update (in, FALSE); */ return MSG_HANDLED; } return MSG_NOT_HANDLED; default: return dlg_default_callback (w, sender, msg, parm, data); } }
static cb_ret_t edit_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WMenuBar *menubar; WButtonBar *buttonbar; WDialog *h = DIALOG (w); switch (msg) { case MSG_INIT: edit_dlg_init (); return MSG_HANDLED; case MSG_DRAW: /* don't use dlg_default_repaint() -- we don't need a frame */ tty_setcolor (EDITOR_BACKGROUND); dlg_erase (h); return MSG_HANDLED; case MSG_RESIZE: menubar = find_menubar (h); buttonbar = find_buttonbar (h); /* dlg_set_size() is surplus for this case */ w->lines = LINES; w->cols = COLS; widget_set_size (WIDGET (buttonbar), w->lines - 1, w->x, 1, w->cols); widget_set_size (WIDGET (menubar), w->y, w->x, 1, w->cols); menubar_arrange (menubar); g_list_foreach (h->widgets, (GFunc) edit_dialog_resize_cb, NULL); return MSG_HANDLED; case MSG_ACTION: { /* Handle shortcuts, menu, and buttonbar. */ cb_ret_t result; result = edit_dialog_command_execute (h, parm); /* We forward any commands coming from the menu, and which haven't been handled by the dialog, to the focused WEdit window. */ if (result == MSG_NOT_HANDLED && sender == WIDGET (find_menubar (h))) result = send_message (h->current->data, NULL, MSG_ACTION, parm, NULL); return result; } case MSG_KEY: { Widget *we = WIDGET (h->current->data); cb_ret_t ret = MSG_NOT_HANDLED; if (edit_widget_is_editor (we)) { WEdit *e = (WEdit *) we; long command; if (!e->extmod) command = keybind_lookup_keymap_command (editor_map, parm); else command = keybind_lookup_keymap_command (editor_x_map, parm); if (command == CK_IgnoreKey) e->extmod = FALSE; else { ret = edit_dialog_command_execute (h, command); /* if command was not handled, keep the extended mode for the further key processing */ if (ret == MSG_HANDLED) e->extmod = FALSE; } } /* * Due to the "end of bracket" escape the editor sees input with is_idle() == false * (expects more characters) and hence doesn't yet refresh the screen, but then * no further characters arrive (there's only an "end of bracket" which is swallowed * by tty_get_event()), so you end up with a screen that's not refreshed after pasting. * So let's trigger an IDLE signal. */ if (!is_idle ()) widget_idle (w, TRUE); return ret; } /* hardcoded menu hotkeys (see edit_drop_hotkey_menu) */ case MSG_UNHANDLED_KEY: return edit_drop_hotkey_menu (h, parm) ? MSG_HANDLED : MSG_NOT_HANDLED; case MSG_VALIDATE: edit_quit (h); return MSG_HANDLED; case MSG_END: edit_dlg_deinit (); return MSG_HANDLED; case MSG_IDLE: widget_idle (w, FALSE); return send_message (h->current->data, NULL, MSG_IDLE, 0, NULL); default: return dlg_default_callback (w, sender, msg, parm, data); } }
static cb_ret_t advanced_chown_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WDialog *h = DIALOG (w); int i; int f_pos; unsigned long id; id = dlg_get_current_widget_id (h); for (i = 0; i < BUTTONS_PERM; i++) if (chown_advanced_but[i].id == id) break; f_pos = i; i = 0; switch (msg) { case MSG_DRAW: chown_refresh (); chown_info_update (); return MSG_HANDLED; case MSG_POST_KEY: if (f_pos < 3) b_setpos (f_pos); return MSG_HANDLED; case MSG_FOCUS: if (f_pos < 3) { if ((flag_pos / 3) != f_pos) flag_pos = f_pos * 3; b_setpos (f_pos); } else if (f_pos < BUTTONS_PERM) flag_pos = f_pos + 6; return MSG_HANDLED; case MSG_KEY: switch (parm) { case XCTRL ('b'): case KEY_LEFT: if (f_pos < BUTTONS_PERM) return (dec_flag_pos (f_pos)); break; case XCTRL ('f'): case KEY_RIGHT: if (f_pos < BUTTONS_PERM) return (inc_flag_pos (f_pos)); break; case ' ': if (f_pos < 3) return MSG_HANDLED; break; case '\n': case KEY_ENTER: if (f_pos <= 2 || f_pos >= BUTTONS_PERM) break; do_enter_key (h, f_pos); return MSG_HANDLED; case ALT ('x'): i++; case ALT ('w'): i++; case ALT ('r'): parm = i + 3; for (i = 0; i < 3; i++) ch_flags[i * 3 + parm - 3] = (x_toggle & (1 << parm)) ? '-' : '+'; x_toggle ^= (1 << parm); update_mode (h); dlg_broadcast_msg (h, MSG_DRAW); send_message (h->current->data, NULL, MSG_FOCUS, 0, NULL); break; case XCTRL ('x'): i++; case XCTRL ('w'): i++; case XCTRL ('r'): parm = i; for (i = 0; i < 3; i++) ch_flags[i * 3 + parm] = (x_toggle & (1 << parm)) ? '-' : '+'; x_toggle ^= (1 << parm); update_mode (h); dlg_broadcast_msg (h, MSG_DRAW); send_message (h->current->data, NULL, MSG_FOCUS, 0, NULL); break; case 'x': i++; case 'w': i++; case 'r': if (f_pos > 2) break; flag_pos = f_pos * 3 + i; /* (strchr(ch_perm,parm)-ch_perm); */ if (BUTTON (h->current->data)->text.start[(flag_pos % 3)] == '-') ch_flags[flag_pos] = '+'; else ch_flags[flag_pos] = '-'; update_mode (h); break; case '4': i++; case '2': i++; case '1': if (f_pos <= 2) { flag_pos = i + f_pos * 3; ch_flags[flag_pos] = '='; update_mode (h); } break; case '-': if (f_pos > 2) break; case '*': if (parm == '*') parm = '='; case '=': case '+': if (f_pos <= 4) { ch_flags[flag_pos] = parm; update_mode (h); send_message (h, sender, MSG_KEY, KEY_RIGHT, NULL); if (flag_pos > 8 || (flag_pos % 3) == 0) dlg_one_down (h); } break; default: break; } return MSG_NOT_HANDLED; default: return dlg_default_callback (w, sender, msg, parm, data); } }