Beispiel #1
0
Datei: layout.c Projekt: m32/mc
void
setup_panels (void)
{
    int start_y;

    if (mc_global.tty.console_flag != '\0')
    {
        int minimum;

        if (output_lines < 0)
            output_lines = 0;
        height =
            LINES - mc_global.keybar_visible - (command_prompt ? 1 : 0) - menubar_visible -
            output_lines - mc_global.message_visible;
        minimum = MINHEIGHT * (1 + panels_layout.horizontal_split);
        if (height < minimum)
        {
            output_lines -= minimum - height;
            height = minimum;
        }
    }
    else
    {
        height =
            LINES - menubar_visible - (command_prompt ? 1 : 0) - mc_global.keybar_visible -
            mc_global.message_visible;
    }

    check_split (&panels_layout);
    start_y = menubar_visible;

    /* The column computing is deferred until panel_do_cols */
    if (panels_layout.horizontal_split)
    {
        widget_set_size (panels[0].widget, start_y, 0, panels_layout.top_panel_size, 0);
        widget_set_size (panels[1].widget, start_y + panels_layout.top_panel_size, 0,
                         height - panels_layout.top_panel_size, 0);
    }
    else
    {
        widget_set_size (panels[0].widget, start_y, 0, height, 0);
        widget_set_size (panels[1].widget, start_y, panels_layout.left_panel_size, height, 0);
    }

    panel_do_cols (0);
    panel_do_cols (1);

    widget_set_size (WIDGET (the_menubar), 0, 0, 1, COLS);

    if (command_prompt)
    {
#ifdef ENABLE_SUBSHELL
        if (!mc_global.tty.use_subshell || !do_load_prompt ())
#endif
            setup_cmdline ();
    }
    else
    {
        widget_set_size (WIDGET (cmdline), 0, 0, 0, 0);
        widget_set_size (WIDGET (the_prompt), LINES, COLS, 0, 0);
    }

    widget_set_size (WIDGET (the_bar), LINES - 1, 0, mc_global.keybar_visible, COLS);
    buttonbar_set_visible (the_bar, mc_global.keybar_visible);

    /* Output window */
    if (mc_global.tty.console_flag != '\0' && output_lines)
    {
        output_start_y = LINES - (command_prompt ? 1 : 0) - mc_global.keybar_visible - output_lines;
        show_console_contents (output_start_y,
                               LINES - output_lines - mc_global.keybar_visible - 1,
                               LINES - mc_global.keybar_visible - 1);
    }

    if (mc_global.message_visible)
        widget_set_size (WIDGET (the_hint), height + start_y, 0, 1, COLS);
    else
        widget_set_size (WIDGET (the_hint), 0, 0, 0, 0);

    update_xterm_title_path ();
}
Beispiel #2
0
void
setup_panels (void)
{
    int start_y;
    int promptl;                /* the prompt len */

    if (mc_global.tty.console_flag)
    {
        int minimum;
        if (output_lines < 0)
            output_lines = 0;
        height =
            LINES - mc_global.keybar_visible - command_prompt - menubar_visible -
            output_lines - mc_global.message_visible;
        minimum = MINHEIGHT * (1 + horizontal_split);
        if (height < minimum)
        {
            output_lines -= minimum - height;
            height = minimum;
        }
    }
    else
    {
        height =
            LINES - menubar_visible - command_prompt - mc_global.keybar_visible -
            mc_global.message_visible;
    }
    check_split ();
    start_y = menubar_visible;

    /* The column computing is defered until panel_do_cols */
    if (horizontal_split)
    {
        widget_set_size (panels[0].widget, start_y, 0, first_panel_size, 0);

        widget_set_size (panels[1].widget, start_y + first_panel_size, 0,
                         height - first_panel_size, 0);
    }
    else
    {
        int first_x = first_panel_size;

        widget_set_size (panels[0].widget, start_y, 0, height, 0);

        widget_set_size (panels[1].widget, start_y, first_x, height, 0);

    }
    panel_do_cols (0);
    panel_do_cols (1);

    promptl = str_term_width1 (mc_prompt);

    widget_set_size (&the_menubar->widget, 0, 0, 1, COLS);

    if (command_prompt)
    {
        widget_set_size (&cmdline->widget, LINES - 1 - mc_global.keybar_visible, promptl, 1,
                         COLS - promptl);
        input_set_origin (cmdline, promptl, COLS - promptl);
        widget_set_size (&the_prompt->widget, LINES - 1 - mc_global.keybar_visible, 0, 1, promptl);
    }
    else
    {
        widget_set_size (&cmdline->widget, 0, 0, 0, 0);
        input_set_origin (cmdline, 0, 0);
        widget_set_size (&the_prompt->widget, LINES, COLS, 0, 0);
    }

    widget_set_size (&the_bar->widget, LINES - 1, 0, mc_global.keybar_visible, COLS);
    buttonbar_set_visible (the_bar, mc_global.keybar_visible);

    /* Output window */
    if (mc_global.tty.console_flag && output_lines)
    {
        output_start_y = LINES - command_prompt - mc_global.keybar_visible - output_lines;
        show_console_contents (output_start_y,
                               LINES - output_lines - mc_global.keybar_visible - 1,
                               LINES - mc_global.keybar_visible - 1);
    }
    if (mc_global.message_visible)
        widget_set_size (&the_hint->widget, height + start_y, 0, 1, COLS);
    else
        widget_set_size (&the_hint->widget, 0, 0, 0, 0);

    update_xterm_title_path ();
}