static void chmod_refresh (Dlg_head *h) { common_dialog_repaint (h); attrset (COLOR_NORMAL); draw_box (h, PY, PX, PERMISSIONS + 2, 33); draw_box (h, FY, FX, 10, 25); dlg_move (h, FY + 1, FX + 2); addstr (_("Name")); dlg_move (h, FY + 3, FX + 2); addstr (_("Permissions (Octal)")); dlg_move (h, FY + 5, FX + 2); addstr (_("Owner name")); dlg_move (h, FY + 7, FX + 2); addstr (_("Group name")); dlg_move (h, TY, TX); addstr (_("Use SPACE to change")); dlg_move (h, TY + 1, TX); addstr (_("an option, ARROW KEYS")); dlg_move (h, TY + 2, TX); addstr (_("to move between options")); dlg_move (h, TY + 3, TX); addstr (_("and T or INS to mark")); attrset (COLOR_HOT_NORMAL); dlg_move (h, PY, PX + 1); addstr (_(" Permission ")); dlg_move (h, FY, FX + 1); addstr (_(" File ")); }
static void print_flags (void) { int i; tty_setcolor (COLOR_NORMAL); for (i = 0; i < 3; i++){ dlg_move (ch_dlg, BY+1, 9+i); tty_print_char (ch_flags [i]); } for (i = 0; i < 3; i++){ dlg_move (ch_dlg, BY + 1, 17 + i); tty_print_char (ch_flags [i+3]); } for (i = 0; i < 3; i++){ dlg_move (ch_dlg, BY + 1, 25 + i); tty_print_char (ch_flags [i+6]); } update_permissions (); for (i = 0; i < 15; i++){ dlg_move (ch_dlg, BY+1, 35+i); tty_print_char (ch_flags[9]); } for (i = 0; i < 15; i++){ dlg_move (ch_dlg, BY + 1, 53 + i); tty_print_char (ch_flags[10]); } }
static int configure_callback (struct Dlg_head *h, int Id, int Msg) { switch (Msg) { case DLG_DRAW: #ifndef HAVE_X attrset (COLOR_NORMAL); dlg_erase (h); draw_box (h, 1, 2, h->lines - 2, h->cols - 4); draw_box (h, PY, PX, 8, first_width); draw_box (h, RY, RX, 5, first_width); draw_box (h, OY, OX, 15, second_width); attrset (COLOR_HOT_NORMAL); dlg_move (h, 1, (h->cols - strlen(configure_title))/2); addstr (configure_title); dlg_move (h, OY, OX+1); addstr (title3); dlg_move (h, RY, RX+1); addstr (title2); dlg_move (h, PY, PX+1); addstr (title1); #endif break; case DLG_END: r_but = Id; break; } return 0; }
static void chmod_toggle_select (Dlg_head *h, int Id) { attrset (COLOR_NORMAL); check_perm[Id].selected ^= 1; dlg_move (h, PY + PERMISSIONS - Id, PX + 1); addch ((check_perm[Id].selected) ? '*' : ' '); dlg_move (h, PY + PERMISSIONS - Id, PX + 3); }
static void chmod_toggle_select (Dlg_head * h, int Id) { tty_setcolor (COLOR_NORMAL); check_perm[Id].selected = !check_perm[Id].selected; dlg_move (h, PY + check_perm_num - Id, PX + 1); tty_print_char (check_perm[Id].selected ? '*' : ' '); dlg_move (h, PY + check_perm_num - Id, PX + 3); }
static void chmod_toggle_select (Dlg_head * h, int Id) { tty_setcolor (COLOR_NORMAL); check_perm[Id].selected ^= 1; dlg_move (h, PY + PERMISSIONS - Id, PX + 1); tty_print_char ((check_perm[Id].selected) ? '*' : ' '); dlg_move (h, PY + PERMISSIONS - Id, PX + 3); }
static void chown_refresh (void) { attrset (COLOR_NORMAL); dlg_erase (ch_dlg); draw_box (ch_dlg, 1, 2, 16, 70); draw_box (ch_dlg, UY, UX, 12, 21); draw_box (ch_dlg, GY, GX, 12, 21); draw_box (ch_dlg, TY, TX, 12, 19); attrset (COLOR_NORMAL); dlg_move (ch_dlg, TY + 1, TX + 1); addstr (N_(" Name ")); dlg_move (ch_dlg, TY + 3, TX + 1); addstr (N_(" Owner name ")); dlg_move (ch_dlg, TY + 5, TX + 1); addstr (N_(" Group name ")); dlg_move (ch_dlg, TY + 7, TX + 1); addstr (N_(" Size ")); dlg_move (ch_dlg, TY + 9, TX + 1); addstr (N_(" Permission ")); attrset (COLOR_HOT_NORMAL); dlg_move (ch_dlg, 1, 28); addstr (N_(" Chown command ")); dlg_move (ch_dlg, UY, UX + 1); addstr (N_(" User name ")); dlg_move (ch_dlg, GY, GX + 1); addstr (N_(" Group name ")); dlg_move (ch_dlg, TY, TX + 1); addstr (N_(" File ")); }
static void chown_refresh (void) { common_dialog_repaint (ch_dlg); tty_setcolor (COLOR_NORMAL); dlg_move (ch_dlg, BY - 1, 8); tty_print_string (_("owner")); dlg_move (ch_dlg, BY - 1, 16); tty_print_string (_("group")); dlg_move (ch_dlg, BY - 1, 24); tty_print_string (_("other")); dlg_move (ch_dlg, BY - 1, 35); tty_print_string (_("owner")); dlg_move (ch_dlg, BY - 1, 53); tty_print_string (_("group")); dlg_move (ch_dlg, 3, 4); tty_print_string (_("On")); dlg_move (ch_dlg, BY + 1, 4); tty_print_string (_("Flag")); dlg_move (ch_dlg, BY + 2, 4); tty_print_string (_("Mode")); if (!single_set){ dlg_move (ch_dlg, 3, 54); tty_printf (_("%6d of %d"), files_on_begin - (current_panel->marked) + 1, files_on_begin); } print_flags (); }
static void chown_info_update (void) { /* display file info */ tty_setcolor (COLOR_NORMAL); /* name && mode */ dlg_move (ch_dlg, 3, 8); tty_print_string (str_fit_to_term (fname, 45, J_LEFT_FIT)); dlg_move (ch_dlg, BY + 2, 9); tty_printf ("%12o", get_mode ()); /* permissions */ update_permissions (); }
static void chmod_refresh (Dlg_head * h) { common_dialog_repaint (h); tty_setcolor (COLOR_NORMAL); dlg_move (h, FY + 1, FX + 2); tty_print_string (_("Name")); dlg_move (h, FY + 3, FX + 2); tty_print_string (_("Permissions (Octal)")); dlg_move (h, FY + 5, FX + 2); tty_print_string (_("Owner name")); dlg_move (h, FY + 7, FX + 2); tty_print_string (_("Group name")); dlg_move (h, TY, TX); tty_print_string (_("Use SPACE to change")); dlg_move (h, TY + 1, TX); tty_print_string (_("an option, ARROW KEYS")); dlg_move (h, TY + 2, TX); tty_print_string (_("to move between options")); dlg_move (h, TY + 3, TX); tty_print_string (_("and T or INS to mark")); }
static void chown_refresh (Dlg_head *h) { common_dialog_repaint (h); attrset (COLOR_NORMAL); draw_box (h, UY, UX, 12, 21); draw_box (h, GY, GX, 12, 21); draw_box (h, TY, TX, 12, 19); dlg_move (h, TY + 1, TX + 1); addstr (_(" Name ")); dlg_move (h, TY + 3, TX + 1); addstr (_(" Owner name ")); dlg_move (h, TY + 5, TX + 1); addstr (_(" Group name ")); dlg_move (h, TY + 7, TX + 1); addstr (_(" Size ")); dlg_move (h, TY + 9, TX + 1); addstr (_(" Permission ")); attrset (COLOR_HOT_NORMAL); dlg_move (h, UY, UX + 1); addstr (_(" User name ")); dlg_move (h, GY, GX + 1); addstr (_(" Group name ")); dlg_move (h, TY, TX + 1); addstr (_(" File ")); }
/** Draw the status line at the top of the screen. The size of the filename * field varies depending on the width of the screen and the length of * the filename. */ void edit_status (WEdit * edit) { const int w = edit->widget.owner->cols; const size_t status_size = w + 1; char *const status = g_malloc (status_size); int status_len; const char *fname = ""; int fname_len; const int gap = 3; /* between the filename and the status */ const int right_gap = 5; /* at the right end of the screen */ const int preferred_fname_len = 16; status_string (edit, status, status_size); status_len = (int) str_term_width1 (status); if (edit->filename_vpath != NULL) fname = vfs_path_get_last_path_str (edit->filename_vpath); fname_len = str_term_width1 (fname); if (fname_len < preferred_fname_len) fname_len = preferred_fname_len; if (fname_len + gap + status_len + right_gap >= w) { if (preferred_fname_len + gap + status_len + right_gap >= w) fname_len = preferred_fname_len; else fname_len = w - (gap + status_len + right_gap); fname = str_trunc (fname, fname_len); } dlg_move (edit->widget.owner, 0, 0); tty_setcolor (STATUSBAR_COLOR); printwstr (fname, fname_len + gap); printwstr (status, w - (fname_len + gap)); if (simple_statusbar && w > EDITOR_MINIMUM_TERMINAL_WIDTH) { size_t percent = 100; if (edit->total_lines + 1 != 0) percent = (edit->curs_line + 1) * 100 / (edit->total_lines + 1); dlg_move (edit->widget.owner, 0, w - 5); tty_printf (" %3d%%", percent); } g_free (status); }
static void update_mode (Dlg_head * h) { print_flags (); tty_setcolor (COLOR_NORMAL); dlg_move (h, BY + 2, 9); tty_printf ("%12o", get_mode ()); send_message (h->current, WIDGET_FOCUS, 0); }
static void chown_refresh (Dlg_head * h) { common_dialog_repaint (h); tty_setcolor (COLOR_NORMAL); dlg_move (h, TY + 1, TX + 2); tty_print_string (_("Name")); dlg_move (h, TY + 3, TX + 2); tty_print_string (_("Owner name")); dlg_move (h, TY + 5, TX + 2); tty_print_string (_("Group name")); dlg_move (h, TY + 7, TX + 2); tty_print_string (_("Size")); dlg_move (h, TY + 9, TX + 2); tty_print_string (_("Permission")); }
static int display_callback (struct Dlg_head *h, int id, int Msg) { #ifndef HAVE_X switch (Msg){ case DLG_DRAW: attrset (COLOR_NORMAL); dlg_erase (h); draw_box (h, 1, 2, h->lines - 2, h->cols - 4); attrset (COLOR_HOT_NORMAL); dlg_move (h, 1, (h->cols - strlen(display_title))/2); addstr (display_title); attrset (COLOR_NORMAL); break; case DLG_UNFOCUS: if((WRadio *) h->current->widget == my_radio){ assign_text (status, displays_status [my_radio->sel]); input_set_point (status, 0); } break; case DLG_KEY: if (id == '\n'){ if((WRadio *) h->current->widget == my_radio){ assign_text (status, displays_status [my_radio->sel]); dlg_stop (h); break; } if ((WInput *) h->current->widget == user){ h->ret_value = B_USER + 6; dlg_stop (h); break; } if ((WInput *) h->current->widget == status){ h->ret_value = B_USER + 7; dlg_stop (h); break; } } if (tolower(id) == user_hotkey && h->current->widget != (Widget *) user && h->current->widget != (Widget *) status){ my_radio->sel = 3; dlg_select_widget (h, my_radio); /* force redraw */ dlg_select_widget (h, user); return MSG_HANDLED; } } #endif return MSG_NOT_HANDLED; }
static void learn_refresh (void) { attrset (COLOR_NORMAL); dlg_erase (learn_dlg); draw_box (learn_dlg, 1, 2, learn_dlg->lines - 2, learn_dlg->cols - 4); attrset (COLOR_HOT_NORMAL); dlg_move (learn_dlg, 1, (learn_dlg->cols - strlen (learn_title)) / 2); addstr (learn_title); }
static void update_split (const Dlg_head * h) { /* Check split has to be done before testing if it changed, since it can change due to calling _check_split() as well */ _check_split (); tty_setcolor (check_options[6].widget->state & C_BOOL ? DISABLED_COLOR : COLOR_NORMAL); dlg_move (h, 6, 5); tty_printf ("%03d", _first_panel_size); dlg_move (h, 6, 17); if (_horizontal_split) tty_printf ("%03d", height - _first_panel_size); else tty_printf ("%03d", COLS - _first_panel_size); dlg_move (h, 6, 12); tty_print_char ('='); }
static inline void edit_draw_window_icons (const WEdit * edit, int color) { const Widget *w = (const Widget *) edit; char tmp[17]; tty_setcolor (color); if (edit->fullscreen) dlg_move (w->owner, 0, w->owner->cols - 6); else widget_move (w, 0, edit->widget.cols - 8); g_snprintf (tmp, sizeof (tmp), "[%s][%s]", edit_window_state_char, edit_window_close_char); tty_print_string (tmp); }
static void update_split (void) { /* Check split has to be done before testing if it changed, since it can change due to calling _check_split() as well*/ _check_split (); /* To avoid setting the cursor to the wrong place */ if ((old_first_panel_size == _first_panel_size) && (old_horizontal_split == _horizontal_split)){ return; } old_first_panel_size = _first_panel_size; old_horizontal_split = _horizontal_split; attrset (COLOR_NORMAL); dlg_move (layout_dlg, 6, 6); printw ("%03d", _first_panel_size); dlg_move (layout_dlg, 6, 18); if (_horizontal_split) printw ("%03d", height - _first_panel_size); else printw ("%03d", COLS - _first_panel_size); }
static int listmode_callback (Dlg_head * h, int Par, int Msg) { switch (Msg) { #ifndef HAVE_X case DLG_DRAW: listmode_refresh (); break; #endif case DLG_POST_KEY: /* fall */ case DLG_INIT: attrset (COLOR_NORMAL); dlg_move (h, UY+13, UX+35); printw ("%02d", 99); attrset (MENU_ENTRY_COLOR); break; } return 0; }
/** Clean the dialog area, draw the frame and the title */ void common_dialog_repaint (Dlg_head * h) { int space; if (h->state != DLG_ACTIVE) return; space = (h->flags & DLG_COMPACT) ? 0 : 1; tty_setcolor (h->color[DLG_COLOR_NORMAL]); dlg_erase (h); draw_box (h, space, space, h->lines - 2 * space, h->cols - 2 * space, FALSE); if (h->title != NULL) { tty_setcolor (h->color[DLG_COLOR_TITLE]); dlg_move (h, space, (h->cols - str_term_width1 (h->title)) / 2); tty_print_string (h->title); } }
static cb_ret_t groupbox_callback (Widget * w, widget_msg_t msg, int parm) { WGroupbox *g = (WGroupbox *) w; switch (msg) { case WIDGET_INIT: return MSG_HANDLED; case WIDGET_FOCUS: return MSG_NOT_HANDLED; case WIDGET_DRAW: { gboolean disabled = (w->options & W_DISABLED) != 0; tty_setcolor (disabled ? DISABLED_COLOR : COLOR_NORMAL); draw_box (g->widget.owner, g->widget.y - g->widget.owner->y, g->widget.x - g->widget.owner->x, g->widget.lines, g->widget.cols, TRUE); if (g->title != NULL) { tty_setcolor (disabled ? DISABLED_COLOR : COLOR_TITLE); dlg_move (g->widget.owner, g->widget.y - g->widget.owner->y, g->widget.x - g->widget.owner->x + 1); tty_print_string (g->title); } return MSG_HANDLED; } case WIDGET_DESTROY: g_free (g->title); return MSG_HANDLED; default: return default_proc (msg, parm); } }
static cb_ret_t layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data) { switch (msg) { case DLG_DRAW: /*When repainting the whole dialog (e.g. with C-l) we have to update everything */ common_dialog_repaint (h); old_first_panel_size = -1; old_horizontal_split = -1; 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 ? COLOR_NORMAL : DISABLED_COLOR); dlg_move (h, 9, 5); tty_print_string (output_lines_label); dlg_move (h, 9, 5 + 3 + output_lines_label_len); tty_printf ("%02d", _output_lines); } return MSG_HANDLED; case DLG_POST_KEY: _menubar_visible = check_options[5].widget->state & C_BOOL; _command_prompt = check_options[4].widget->state & C_BOOL; _keybar_visible = check_options[3].widget->state & C_BOOL; _message_visible = check_options[2].widget->state & C_BOOL; _xterm_title = check_options[1].widget->state & C_BOOL; _free_space = check_options[0].widget->state & C_BOOL; if (mc_global.tty.console_flag) { int minimum; if (_output_lines < 0) _output_lines = 0; height = LINES - _keybar_visible - _command_prompt - _menubar_visible - _output_lines - _message_visible; minimum = MINHEIGHT * (1 + _horizontal_split); if (height < minimum) { _output_lines -= minimum - height; height = minimum; } } else height = LINES - _keybar_visible - _command_prompt - _menubar_visible - _output_lines - _message_visible; if (old_output_lines != _output_lines) { old_output_lines = _output_lines; tty_setcolor (mc_global.tty.console_flag ? COLOR_NORMAL : DISABLED_COLOR); dlg_move (h, 9, 5 + 3 + output_lines_label_len); tty_printf ("%02d", _output_lines); } return MSG_HANDLED; case DLG_ACTION: if (sender == (Widget *) radio_widget) { if (_horizontal_split != radio_widget->sel) { _horizontal_split = radio_widget->sel; if (_equal_split) { if (_horizontal_split) _first_panel_size = height / 2; else _first_panel_size = COLS / 2; } } update_split (h); return MSG_HANDLED; } if (sender == (Widget *) check_options[6].widget) { _equal_split = check_options[6].widget->state & C_BOOL; widget_disable (bleft_widget->widget, _equal_split); send_message ((Widget *) bleft_widget, WIDGET_DRAW, 0); widget_disable (bright_widget->widget, _equal_split); send_message ((Widget *) bright_widget, WIDGET_DRAW, 0); update_split (h); return MSG_HANDLED; } return MSG_NOT_HANDLED; default: return default_dlg_callback (h, sender, msg, parm, data); } }
static int layout_callback (struct Dlg_head *h, int Id, int Msg) { switch (Msg){ case DLG_DRAW: #ifndef HAVE_X /*When repainting the whole dialog (e.g. with C-l) we have to update everything*/ old_first_panel_size = -1; old_horizontal_split = -1; old_output_lines = -1; attrset (COLOR_NORMAL); dlg_erase (h); draw_box (h, 1, 2, h->lines - 2, h->cols - 4); draw_box (h, 2, 4, 6, first_width); draw_box (h, 8, 4, 4, first_width); draw_box (h, 2, 5 + first_width, 10, second_width); attrset (COLOR_HOT_NORMAL); dlg_move (h, 1, (h->cols - strlen(layout_title))/2); addstr (layout_title); dlg_move (h, 2, 5); addstr (title1); dlg_move (h, 8, 5); addstr (title2); dlg_move (h, 2, 6 + first_width); addstr (title3); update_split (); dlg_move (h, 6, 13); addch ('='); if (console_flag){ if (old_output_lines != _output_lines){ old_output_lines = _output_lines; attrset (COLOR_NORMAL); dlg_move (h, 9, 16 + first_width); addstr (output_lines_label); dlg_move (h, 9, 10 + first_width); printw ("%02d", _output_lines); } } #endif break; case DLG_POST_KEY: _filetype_mode = check_options [8].widget->state & C_BOOL; _permission_mode = check_options [7].widget->state & C_BOOL; #ifndef HAVE_X _equal_split = check_options [6].widget->state & C_BOOL; #endif _menubar_visible = check_options [5].widget->state & C_BOOL; _command_prompt = check_options [4].widget->state & C_BOOL; _keybar_visible = check_options [2].widget->state & C_BOOL; _message_visible = check_options [1].widget->state & C_BOOL; _xterm_hintbar = check_options [0].widget->state & C_BOOL; if (console_flag){ int minimum; if (_output_lines < 0) _output_lines = 0; height = LINES - _keybar_visible - _command_prompt - _menubar_visible - _output_lines - _message_visible; if (_message_visible && _xterm_hintbar && xterm_flag) height++; minimum = MINHEIGHT * (1 + _horizontal_split); if (height < minimum){ _output_lines -= minimum - height; height = minimum; } } else { height = LINES - _keybar_visible - _command_prompt - _menubar_visible - _output_lines - _message_visible; if (_message_visible && _xterm_hintbar && xterm_flag) height++; } if (_horizontal_split != radio_widget->sel){ _horizontal_split = radio_widget->sel; if (_horizontal_split) _first_panel_size = height / 2; else _first_panel_size = COLS / 2; } update_split (); if (console_flag){ if (old_output_lines != _output_lines){ old_output_lines = _output_lines; attrset (COLOR_NORMAL); dlg_move (h, 9, 10 + first_width); printw ("%02d", _output_lines); } } break; case DLG_END: break; } return 0; }
static cb_ret_t layout_callback (struct Dlg_head *h, dlg_msg_t msg, int parm) { switch (msg) { case DLG_DRAW: /*When repainting the whole dialog (e.g. with C-l) we have to update everything*/ common_dialog_repaint (h); old_first_panel_size = -1; old_horizontal_split = -1; old_output_lines = -1; attrset (COLOR_HOT_NORMAL); update_split (); dlg_move (h, 6, 13); addch ('='); if (console_flag){ if (old_output_lines != _output_lines){ old_output_lines = _output_lines; attrset (COLOR_NORMAL); dlg_move (h, 9, 16 + first_width); addstr (output_lines_label); dlg_move (h, 9, 10 + first_width); printw ("%02d", _output_lines); } } return MSG_HANDLED; case DLG_POST_KEY: _filetype_mode = check_options [8].widget->state & C_BOOL; _permission_mode = check_options [7].widget->state & C_BOOL; _equal_split = check_options [6].widget->state & C_BOOL; /* _menubar_visible = check_options [5].widget->state & C_BOOL; */ /* _command_prompt = check_options [4].widget->state & C_BOOL; */ /* _keybar_visible = check_options [2].widget->state & C_BOOL; */ _message_visible = check_options [1].widget->state & C_BOOL; /* _xterm_title = check_options [0].widget->state & C_BOOL; */ if (console_flag){ int minimum; if (_output_lines < 0) _output_lines = 0; height = LINES - _keybar_visible - _command_prompt - _menubar_visible - _output_lines - _message_visible; minimum = MINHEIGHT * (1 + _horizontal_split); if (height < minimum){ _output_lines -= minimum - height; height = minimum; } } else { height = LINES - _keybar_visible - _command_prompt - _menubar_visible - _output_lines - _message_visible; } if (_horizontal_split != radio_widget->sel){ _horizontal_split = radio_widget->sel; if (_horizontal_split) _first_panel_size = height / 2; else _first_panel_size = COLS / 2; } update_split (); if (console_flag){ if (old_output_lines != _output_lines){ old_output_lines = _output_lines; attrset (COLOR_NORMAL); dlg_move (h, 9, 10 + first_width); printw ("%02d", _output_lines); } } return MSG_HANDLED; default: return default_dlg_callback (h, msg, parm); } }