コード例 #1
0
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 "));
}
コード例 #2
0
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;
}
コード例 #3
0
ファイル: layout.c プロジェクト: BackupTheBerlios/mcvox
void
clr_scr (void)
{
    standend ();
    dlg_erase (midnight_dlg);
    mc_refresh ();
    doupdate ();
}
コード例 #4
0
static void listmode_refresh (void)
{
    attrset (COLOR_NORMAL);
    dlg_erase (listmode_dlg);
    
    draw_box (listmode_dlg, 1, 2, 20, 70);
    draw_box (listmode_dlg, UY, UX, 4, 63);
    draw_box (listmode_dlg, UY + 4, UX, 11, 18);
    draw_box (listmode_dlg, UY + 4, UX+20, 11, 43);
}
コード例 #5
0
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;
}
コード例 #6
0
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);
}
コード例 #7
0
static int
op_win_callback (struct Dlg_head *h, int id, int msg)
{
    switch (msg){
#ifndef HAVE_X    
    case DLG_DRAW:
	attrset (COLOR_NORMAL);
	dlg_erase (h);
	draw_box (h, 1, 2, h->lines-2, h->cols-4);
	return 1;
#endif
    }
    return 0;
}
コード例 #8
0
ファイル: editwidget.c プロジェクト: artzub/mc
static cb_ret_t
edit_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
{
    WEdit *edit;
    WMenuBar *menubar;
    WButtonBar *buttonbar;

    edit = (WEdit *) find_widget_type (h, edit_callback);
    menubar = find_menubar (h);
    buttonbar = find_buttonbar (h);

    switch (msg)
    {
    case DLG_INIT:
        edit_set_buttonbar (edit, buttonbar);
        return MSG_HANDLED;

    case DLG_DRAW:
        /* don't use common_dialog_repaint() -- we don't need a frame */
        tty_setcolor (EDITOR_NORMAL_COLOR);
        dlg_erase (h);
        return MSG_HANDLED;

    case DLG_RESIZE:
        /* dlg_set_size() is surplus for this case */
        h->lines = LINES;
        h->cols = COLS;
        widget_set_size (&buttonbar->widget, h->lines - 1, h->x, 1, h->cols);
        widget_set_size (&menubar->widget, h->y, h->x, 1, h->cols);
        menubar_arrange (menubar);
        widget_set_size (&edit->widget, h->y + 1, h->x, h->lines - 2, h->cols);
        return MSG_HANDLED;

    case DLG_ACTION:
        if (sender == (Widget *) menubar)
            return send_message ((Widget *) edit, WIDGET_COMMAND, parm);
        if (sender == (Widget *) buttonbar)
            return send_message ((Widget *) edit, WIDGET_COMMAND, parm);
        return MSG_HANDLED;

    case DLG_VALIDATE:
        h->state = DLG_ACTIVE;  /* don't stop the dialog before final decision */
        if (edit_ok_to_exit (edit))
            h->state = DLG_CLOSED;
        return MSG_HANDLED;

    default:
        return default_dlg_callback (h, sender, msg, parm, data);
    }
}
コード例 #9
0
ファイル: dialog.c プロジェクト: ryanlee/mc
/** 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);
    }
}
コード例 #10
0
ファイル: dialog.c プロジェクト: GalaxyTab4/workbench
/** Clean the dialog area, draw the frame and the title */
void
dlg_default_repaint (WDialog * h)
{
    Widget *wh = WIDGET (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);
    tty_draw_box (wh->y + space, wh->x + space, wh->lines - 2 * space, wh->cols - 2 * space, FALSE);

    if (h->title != NULL)
    {
        tty_setcolor (h->color[DLG_COLOR_TITLE]);
        widget_move (h, space, (wh->cols - str_term_width1 (h->title)) / 2);
        tty_print_string (h->title);
    }
}
コード例 #11
0
ファイル: dialog.c プロジェクト: MidnightCommander/mc
/** Clean the dialog area, draw the frame and the title */
void
dlg_default_repaint (WDialog * h)
{
    Widget *wh = WIDGET (h);

    int space;

    if (!widget_get_state (wh, WST_ACTIVE))
        return;

    space = h->compact ? 0 : 1;

    tty_setcolor (h->color[DLG_COLOR_NORMAL]);
    dlg_erase (h);
    tty_draw_box (wh->y + space, wh->x + space, wh->lines - 2 * space, wh->cols - 2 * space, FALSE);

    if (h->title != NULL)
    {
        /* TODO: truncate long title */
        tty_setcolor (h->color[DLG_COLOR_TITLE]);
        widget_move (h, space, (wh->cols - str_term_width1 (h->title)) / 2);
        tty_print_string (h->title);
    }
}
コード例 #12
0
ファイル: layout.c プロジェクト: malikcjm/mc-nt
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;
}
コード例 #13
0
ファイル: editwidget.c プロジェクト: MidnightCommander/mc
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);
    }
}
コード例 #14
0
ファイル: editwidget.c プロジェクト: TomyLobo/mc
static cb_ret_t
edit_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
{
    WMenuBar *menubar;
    WButtonBar *buttonbar;

    switch (msg)
    {
    case DLG_INIT:
        edit_dlg_init ();
        return MSG_HANDLED;

    case DLG_DRAW:
        /* don't use common_dialog_repaint() -- we don't need a frame */
        tty_setcolor (EDITOR_BACKGROUND);
        dlg_erase (h);
        return MSG_HANDLED;

    case DLG_RESIZE:
        menubar = find_menubar (h);
        buttonbar = find_buttonbar (h);
        /* dlg_set_size() is surplus for this case */
        h->lines = LINES;
        h->cols = COLS;
        widget_set_size (&buttonbar->widget, h->lines - 1, h->x, 1, h->cols);
        widget_set_size (&menubar->widget, h->y, h->x, 1, h->cols);
        menubar_arrange (menubar);
        g_list_foreach (h->widgets, (GFunc) edit_dialog_resize_cb, NULL);
        return MSG_HANDLED;

    case DLG_ACTION:
        /* shortcut */
        if (sender == NULL)
            return edit_dialog_command_execute (h, parm);
        /* message from menu */
        menubar = find_menubar (h);
        if (sender == (Widget *) menubar)
        {
            if (edit_dialog_command_execute (h, parm) == MSG_HANDLED)
                return MSG_HANDLED;
            /* try send command to the current window */
            return send_message ((Widget *) h->current->data, WIDGET_COMMAND, parm);
        }
        /* message from buttonbar */
        buttonbar = find_buttonbar (h);
        if (sender == (Widget *) buttonbar)
        {
            if (data != NULL)
                return send_message ((Widget *) data, WIDGET_COMMAND, parm);
            return edit_dialog_command_execute (h, parm);
        }
        return MSG_NOT_HANDLED;

    case DLG_KEY:
        {
            Widget *w = h->current->data;
            cb_ret_t ret = MSG_NOT_HANDLED;

            if (edit_widget_is_editor (w))
            {
                WEdit *e = (WEdit *) w;
                unsigned long command;

                if (!e->extmod)
                    command = keybind_lookup_keymap_command (editor_map, parm);
                else
                {
                    e->extmod = FALSE;
                    command = keybind_lookup_keymap_command (editor_x_map, parm);
                }

                if (command != CK_IgnoreKey)
                    ret = edit_dialog_command_execute (h, command);
            }

            return ret;
        }

        /* hardcoded menu hotkeys (see edit_drop_hotkey_menu) */
    case DLG_UNHANDLED_KEY:
        return edit_drop_hotkey_menu (h, parm) ? MSG_HANDLED : MSG_NOT_HANDLED;

    case DLG_VALIDATE:
        edit_quit (h);
        return MSG_HANDLED;

    case DLG_END:
        edit_dlg_deinit ();
        return MSG_HANDLED;

    default:
        return default_dlg_callback (h, sender, msg, parm, data);
    }
}