コード例 #1
0
ファイル: layout.c プロジェクト: BackupTheBerlios/mcvox
static void
layout_change (void)
{
    setup_panels ();
    layout_do_change = 0;
    /* re-init the menu, because perhaps there was a change in the way 
       how the panel are split (horizontal/vertical). */
    done_menu ();
    init_menu ();
    menubar_arrange (the_menubar);
}
コード例 #2
0
ファイル: menu.c プロジェクト: BpArCuCTeMbI/mc
void
menubar_add_menu (WMenuBar * menubar, menu_t * menu)
{
    if (menu != NULL)
    {
        menu_arrange (menu, WIDGET (menubar)->owner->get_shortcut);
        menubar->menu = g_list_append (menubar->menu, menu);
    }

    menubar_arrange (menubar);
}
コード例 #3
0
ファイル: menu.c プロジェクト: ryanlee/mc
void
menubar_add_menu (WMenuBar * menubar, Menu * menu)
{
    if (menu != NULL)
    {
        menu_arrange (menu, menubar->widget.owner->get_shortcut);
        menubar->menu = g_list_append (menubar->menu, menu);
    }

    menubar_arrange (menubar);
}
コード例 #4
0
ファイル: menu.c プロジェクト: BpArCuCTeMbI/mc
void
menubar_set_menu (WMenuBar * menubar, GList * menu)
{
    /* delete previous menu */
    if (menubar->menu != NULL)
        g_list_free_full (menubar->menu, (GDestroyNotify) destroy_menu);

    /* add new menu */
    menubar->is_active = FALSE;
    menubar->is_dropped = FALSE;
    menubar->menu = menu;
    menubar->selected = 0;
    menubar_arrange (menubar);
}
コード例 #5
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);
    }
}
コード例 #6
0
ファイル: menu.c プロジェクト: ryanlee/mc
void
menubar_set_menu (WMenuBar * menubar, GList * menu)
{
    /* delete previous menu */
    if (menubar->menu != NULL)
    {
        g_list_foreach (menubar->menu, (GFunc) destroy_menu, NULL);
        g_list_free (menubar->menu);
    }
    /* add new menu */
    menubar->is_active = FALSE;
    menubar->is_dropped = FALSE;
    menubar->menu = menu;
    menubar->selected = 0;
    menubar_arrange (menubar);
}
コード例 #7
0
ファイル: layout.c プロジェクト: malikcjm/mc-nt
void change_screen_size (void)
{
#if defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4
#if defined TIOCGWINSZ && !defined SCO_FLAVOR
    extern Dlg_head *view_dlg;
    extern Dlg_head *edit_dlg;
    
#ifndef NCURSES_VERSION
    mc_noraw_mode ();
    endwin ();
#endif
    low_level_change_screen_size ();
    check_split ();
#ifndef NCURSES_VERSION
    /* XSI Curses spec states that portable applications shall not invoke
     * initscr() more than once.  This kludge could be done within the scope
     * of the specification by using endwin followed by a refresh (in fact,
     * more than one curses implementation does this); it is guaranteed to work
     * only with slang.
     */
    init_curses ();
#endif
    setup_panels ();
    if (current_dlg == view_dlg)
	view_adjust_size (view_dlg);
#ifdef USE_INTERNAL_EDIT
    if (current_dlg == edit_dlg)
	edit_adjust_size (edit_dlg);
#endif
    
#ifdef RESIZABLE_MENUBAR
	menubar_arrange(the_menubar);
#endif
		
    /* Now, force the redraw */
    do_refresh ();
    touchwin (stdscr);
#endif /* TIOCGWINSZ && !SCO_FLAVOR */
#endif /* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */
    winch_flag = 0;
}
コード例 #8
0
ファイル: layout.c プロジェクト: BackupTheBerlios/mcvox
void
change_screen_size (void)
{
#if defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4
#if defined TIOCGWINSZ

#ifndef NCURSES_VERSION
    mc_noraw_mode ();
    endwin ();
#endif
    low_level_change_screen_size ();
    check_split ();
#ifndef NCURSES_VERSION
    /* XSI Curses spec states that portable applications shall not invoke
     * initscr() more than once.  This kludge could be done within the scope
     * of the specification by using endwin followed by a refresh (in fact,
     * more than one curses implementation does this); it is guaranteed to work
     * only with slang.
     */
    init_curses ();
#endif
    setup_panels ();

    /* Inform currently running dialog */
    (*current_dlg->callback) (current_dlg, DLG_RESIZE, 0);

#ifdef RESIZABLE_MENUBAR
    menubar_arrange (the_menubar);
#endif

    /* Now, force the redraw */
    do_refresh ();
    touchwin (stdscr);
#endif				/* TIOCGWINSZ */
#endif				/* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */
    winch_flag = 0;
}
コード例 #9
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);
    }
}
コード例 #10
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);
    }
}