Beispiel #1
0
void
editcmd_dialog_replace_show (WEdit * edit, const char *search_default, const char *replace_default,
                             /*@out@ */ char **search_text, /*@out@ */ char **replace_text)
{
    size_t num_of_types;
    gchar **list_of_types;

    if ((search_default == NULL) || (*search_default == '\0'))
        search_default = INPUT_LAST_TEXT;

    list_of_types = mc_search_get_types_strings_array (&num_of_types);

    {
        quick_widget_t quick_widgets[] = {
            /* *INDENT-OFF* */
            QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above, search_default,
                                 MC_HISTORY_SHARED_SEARCH, search_text, NULL, FALSE, FALSE,
                                 INPUT_COMPLETE_NONE),
            QUICK_LABELED_INPUT (N_("Enter replacement string:"), input_label_above, replace_default,
                                 "replace", replace_text, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE),
            QUICK_SEPARATOR (TRUE),
            QUICK_START_COLUMNS,
                QUICK_RADIO (num_of_types, (const char **) list_of_types,
                             (int *) &edit_search_options.type, NULL),
            QUICK_NEXT_COLUMN,
                QUICK_CHECKBOX (N_("Cas&e sensitive"), &edit_search_options.case_sens, NULL),
                QUICK_CHECKBOX (N_("&Backwards"), &edit_search_options.backwards, NULL),
                QUICK_CHECKBOX (N_("In se&lection"), &edit_search_options.only_in_selection, NULL),
                QUICK_CHECKBOX (N_("&Whole words"), &edit_search_options.whole_words, NULL),
#ifdef HAVE_CHARSET
                QUICK_CHECKBOX (N_("&All charsets"), &edit_search_options.all_codepages, NULL),
#endif
            QUICK_STOP_COLUMNS,
            QUICK_BUTTONS_OK_CANCEL,
            QUICK_END
            /* *INDENT-ON* */
        };

        quick_dialog_t qdlg = {
            -1, -1, 58,
            N_("Replace"), "[Input Line Keys]",
            quick_widgets, NULL, NULL
        };

        if (quick_dialog (&qdlg) != B_CANCEL)
            edit->replace_mode = 0;
        else
        {
            *replace_text = NULL;
            *search_text = NULL;
        }
    }

    g_strfreev (list_of_types);
}
Beispiel #2
0
const panel_field_t *
sort_box (dir_sort_options_t * op, const panel_field_t * sort_field)
{
    const char **sort_orders_names;
    gsize i;
    gsize sort_names_num = 0;
    int sort_idx = 0;
    const panel_field_t *result = NULL;

    sort_orders_names = panel_get_sortable_fields (&sort_names_num);

    for (i = 0; i < sort_names_num; i++)
        if (strcmp (sort_orders_names[i], _(sort_field->title_hotkey)) == 0)
        {
            sort_idx = i;
            break;
        }

    {
        quick_widget_t quick_widgets[] = {
            /* *INDENT-OFF* */
            QUICK_START_COLUMNS,
                QUICK_RADIO (sort_names_num, sort_orders_names, &sort_idx, NULL),
            QUICK_NEXT_COLUMN,
                QUICK_CHECKBOX (N_("Executable &first"), &op->exec_first, NULL),
                QUICK_CHECKBOX (N_("Cas&e sensitive"), &op->case_sensitive, NULL),
                QUICK_CHECKBOX (N_("&Reverse"), &op->reverse, NULL),
            QUICK_STOP_COLUMNS,
            QUICK_BUTTONS_OK_CANCEL,
            QUICK_END
            /* *INDENT-ON* */
        };

        quick_dialog_t qdlg = {
            -1, -1, 40,
            N_("Sort order"), "[Sort Order...]",
            quick_widgets, NULL, NULL
        };

        if (quick_dialog (&qdlg) != B_CANCEL)
            result = panel_get_field_by_title_hotkey (sort_orders_names[sort_idx]);

        if (result == NULL)
            result = sort_field;
    }

    g_strfreev ((gchar **) sort_orders_names);

    return result;
}
Beispiel #3
0
void
editcmd_dialog_replace_show (WEdit * edit, const char *search_default, const char *replace_default,
                             /*@out@ */ char **search_text, /*@out@ */ char **replace_text)
{
    if (*search_default == '\0')
        search_default = INPUT_LAST_TEXT;

    {
	size_t num_of_types;
	gchar **list_of_types = mc_search_get_types_strings_array (&num_of_types);
	int REPLACE_DLG_HEIGHT = REPLACE_DLG_MIN_HEIGHT + num_of_types - REPLACE_DLG_HEIGHT_SUPPLY;

	QuickWidget quick_widgets[] =
	{
	    /*  0 */ QUICK_BUTTON (6, 10, 13, REPLACE_DLG_HEIGHT, N_("&Cancel"), B_CANCEL, NULL),
	    /*  1 */ QUICK_BUTTON (2, 10, 13, REPLACE_DLG_HEIGHT, N_("&OK"),     B_ENTER,  NULL),
#ifdef HAVE_CHARSET
	    /*  2 */ QUICK_CHECKBOX (33, REPLACE_DLG_WIDTH, 11, REPLACE_DLG_HEIGHT, N_("All charsets"), &edit->all_codepages),
#endif
	    /*  3 */ QUICK_CHECKBOX (33, REPLACE_DLG_WIDTH, 10, REPLACE_DLG_HEIGHT, N_("&Whole words"), &edit->whole_words),
	    /*  4 */ QUICK_CHECKBOX (33, REPLACE_DLG_WIDTH,  9, REPLACE_DLG_HEIGHT, N_("In se&lection"), &edit->only_in_selection),
	    /*  5 */ QUICK_CHECKBOX (33, REPLACE_DLG_WIDTH,  8, REPLACE_DLG_HEIGHT, N_("&Backwards"), &edit->replace_backwards),
	    /*  6 */ QUICK_CHECKBOX (33, REPLACE_DLG_WIDTH,  7, REPLACE_DLG_HEIGHT, N_("case &Sensitive"), &edit->replace_case),
	    /*  7 */ QUICK_RADIO (3, REPLACE_DLG_WIDTH,   7, REPLACE_DLG_HEIGHT,
				num_of_types, (const char **) list_of_types, (int *) &edit->search_type),
	    /*  8 */ QUICK_LABEL (2, REPLACE_DLG_WIDTH,   4, REPLACE_DLG_HEIGHT, N_(" Enter replacement string:")),
	    /*  9 */ QUICK_INPUT (3, REPLACE_DLG_WIDTH,   5, REPLACE_DLG_HEIGHT,
				replace_default, REPLACE_DLG_WIDTH - 6, 0, "replace", replace_text),
	    /* 10 */ QUICK_LABEL (2, REPLACE_DLG_WIDTH,   2, REPLACE_DLG_HEIGHT, N_(" Enter search string:")),
	    /* 11 */ QUICK_INPUT (3, REPLACE_DLG_WIDTH,   3, REPLACE_DLG_HEIGHT,
				search_default, REPLACE_DLG_WIDTH - 6, 0, MC_HISTORY_SHARED_SEARCH, search_text),
	    QUICK_END
	};

	QuickDialog Quick_input =
	{
	    REPLACE_DLG_WIDTH, REPLACE_DLG_HEIGHT, -1, -1, N_(" Replace "),
	    "[Input Line Keys]", quick_widgets, FALSE
	};

	if (quick_dialog (&Quick_input) != B_CANCEL) {
	    edit->replace_mode = 0;
	} else {
	    *replace_text = NULL;
	    *search_text = NULL;
	}

	g_strfreev (list_of_types);
    }
}
Beispiel #4
0
void
display_bits_box (void)
{
    int new_meta;
    int current_mode;

    const char *display_bits_str[] = {
        N_("&UTF-8 output"),
        N_("&Full 8 bits output"),
        N_("&ISO 8859-1"),
        N_("7 &bits")
    };

    quick_widget_t quick_widgets[] = {
        /* *INDENT-OFF* */
        QUICK_RADIO (4, display_bits_str, &current_mode, NULL),
        QUICK_SEPARATOR (TRUE),
        QUICK_CHECKBOX (N_("F&ull 8 bits input"), &new_meta, NULL),
        QUICK_BUTTONS_OK_CANCEL,
        QUICK_END
        /* *INDENT-ON* */
    };

    quick_dialog_t qdlg = {
        -1, -1, 46,
        _("Display bits"), "[Display bits]",
        quick_widgets, NULL, NULL
    };

    if (mc_global.full_eight_bits)
        current_mode = 0;
    else if (mc_global.eight_bit_clean)
        current_mode = 1;
    else
        current_mode = 2;

    new_meta = !use_8th_bit_as_meta;

    if (quick_dialog (&qdlg) != B_CANCEL)
    {
        mc_global.eight_bit_clean = current_mode < 3;
        mc_global.full_eight_bits = current_mode < 2;
#ifndef HAVE_SLANG
        meta (stdscr, mc_global.eight_bit_clean);
#else
        SLsmg_Display_Eight_Bit = mc_global.full_eight_bits ? 128 : 160;
#endif
        use_8th_bit_as_meta = !new_meta;
    }
}
Beispiel #5
0
void
display_bits_box (void)         /* AB:FIXME: test dialog */
{
    /* dialog sizes */
    const int DISPY = 13;
    const int DISPX = 46;

    int new_meta = 0;
    int current_mode;

    const char *display_bits_str[] = {
        N_("UTF-8 output"),
        N_("Full 8 bits output"),
        N_("ISO 8859-1"),
        N_("7 bits")
    };

    QuickWidget display_widgets[] = {
        /* 0 */ QUICK_BUTTON (15, DISPX, DISPY - 3, DISPY, N_("&Cancel"), B_CANCEL, NULL),
        /* 1 */ QUICK_BUTTON (29, DISPX, DISPY - 3, DISPY, N_("&OK"), B_ENTER, NULL),
        /* 2 */ QUICK_CHECKBOX (3, DISPX, 8, DISPY, N_("F&ull 8 bits input"), &new_meta),
        /* 3 */ QUICK_RADIO (3, DISPX, 3, DISPY, 4, display_bits_str, &current_mode),
        QUICK_END
    };

    QuickDialog display_bits = {
        DISPX, DISPY, -1, -1, _("Display bits"),
        "[Display bits]", display_widgets, NULL, TRUE
    };

    int i;
    int l1, maxlen = 0;
    int ok_len, cancel_len;

#ifdef ENABLE_NLS
    static gboolean i18n_flag = FALSE;

    if (!i18n_flag)
    {
        for (i = 0; i < 3; i++)
        {
            display_bits_str[i] = _(display_bits_str[i]);
        }

        display_widgets[0].u.button.text = _(display_widgets[0].u.button.text);
        display_widgets[1].u.button.text = _(display_widgets[1].u.button.text);
        display_widgets[2].u.checkbox.text = _(display_widgets[2].u.checkbox.text);

        i18n_flag = TRUE;
    }
#endif /* ENABLE_NLS */

    /* radiobuttons */
    for (i = 0; i < 3; i++)
        maxlen = max (maxlen, str_term_width1 (display_bits_str[i]));

    /* buttons */
    cancel_len = str_term_width1 (display_widgets[0].u.button.text) + 2;
    ok_len = str_term_width1 (display_widgets[1].u.button.text) + 4;    /* default button */

    l1 = max (cancel_len, ok_len);

    display_bits.xlen = max (maxlen, l1) + 20;

    for (i = 0; i < 4; i++)
        display_widgets[i].x_divisions = display_bits.xlen;

    display_widgets[0].relative_x = display_bits.xlen * 2 / 3 - cancel_len / 2;
    display_widgets[1].relative_x = display_bits.xlen / 3 - ok_len / 2;

    if (full_eight_bits)
        current_mode = 0;
    else if (eight_bit_clean)
        current_mode = 1;
    else
        current_mode = 2;

    new_meta = !use_8th_bit_as_meta;

    if (quick_dialog (&display_bits) != B_CANCEL)
    {
        eight_bit_clean = current_mode < 3;
        full_eight_bits = current_mode < 2;
#ifndef HAVE_SLANG
        meta (stdscr, eight_bit_clean);
#else
        SLsmg_Display_Eight_Bit = full_eight_bits ? 128 : 160;
#endif
        use_8th_bit_as_meta = !new_meta;
    }
}
Beispiel #6
0
const panel_field_t *
sort_box (panel_sort_info_t *info)
{
    int dlg_width = 40, dlg_height = 7;

    const char **sort_orders_names;
    gsize sort_names_num;

    int sort_idx = 0;

    const panel_field_t *result = info->sort_field;

    sort_orders_names = panel_get_sortable_fields (&sort_names_num);
    dlg_height += sort_names_num;

    {
        int max_radio = 0, max_check = 0;
        int ok_len, cancel_len;
        gsize i;

        QuickWidget quick_widgets[] = {
            /* 0 */
            QUICK_BUTTON (0, dlg_width, dlg_height - 3, dlg_height, N_("&Cancel"), B_CANCEL, NULL),
            /* 1 */
            QUICK_BUTTON (0, dlg_width, dlg_height - 3, dlg_height, N_("&OK"), B_ENTER, NULL),
            /* 2 */
            QUICK_CHECKBOX (0, dlg_width, 5, dlg_height, N_("&Reverse"), &info->reverse),
            /* 3 */
            QUICK_CHECKBOX (0, dlg_width, 4, dlg_height, N_("Case sensi&tive"), &info->case_sensitive),
            /* 4 */
            QUICK_CHECKBOX (0, dlg_width, 3, dlg_height, N_("Executable &first"), &info->exec_first),
            /* 5 */
            QUICK_RADIO (4, dlg_width, 3, dlg_height, 0, NULL, &sort_idx),
            QUICK_END
        };

        QuickDialog quick_dlg = {
            dlg_width, dlg_height, -1, -1,
            N_("Sort order"), "[Sort Order...]",
            quick_widgets, NULL, TRUE
        };

        quick_widgets[5].u.radio.items = sort_orders_names;
        quick_widgets[5].u.radio.count = sort_names_num;

        for (i = 0; i < sort_names_num; i++)
            if (strcmp (sort_orders_names[i], _(info->sort_field->title_hotkey)) == 0)
            {
                sort_idx = i;
                break;
            }

#ifdef ENABLE_NLS
        quick_dlg.title = _(quick_dlg.title);
        /* buttons */
        for (i = 0; i < 2; i++)
            quick_widgets[i].u.button.text = _(quick_widgets[i].u.button.text);
        /* checkboxes */
        for (i = 2; i < 5; i++)
            quick_widgets[i].u.checkbox.text = _(quick_widgets[i].u.checkbox.text);
#endif /* ENABLE_NlS */

        /* buttons */
        cancel_len = str_term_width1 (quick_widgets[0].u.button.text) + 4;
        ok_len = str_term_width1 (quick_widgets[1].u.button.text) + 6;
        /* checkboxes */
        for (i = 2; i < 5; i++)
            max_check = max (max_check, str_term_width1 (quick_widgets[i].u.checkbox.text) + 4);
        /* radiobuttons */
        for (i = 0; i < sort_names_num; i++)
            max_radio = max (max_radio, str_term_width1 (sort_orders_names[i]) + 4);

        /* dialog width */
        dlg_width = max (dlg_width, str_term_width1 (quick_dlg.title) + 8);
        dlg_width = max (dlg_width, ok_len + cancel_len + 8);
        dlg_width = max (dlg_width, 2 * max (max_radio, max_check) + 8);

        /* fix widget and dialog parameters */
        /* dialog */
        quick_dlg.xlen = dlg_width;
        /* widgets */
        for (i = 0; (size_t) i < sizeof (quick_widgets) / sizeof (quick_widgets[0]) - 1; i++)
            quick_widgets[i].x_divisions = dlg_width;
        /* buttons */
        quick_widgets[0].relative_x = dlg_width * 2 / 3 - cancel_len / 2;
        quick_widgets[1].relative_x = dlg_width / 3 - ok_len / 2;
        /* checkboxes */
        for (i = 2; i < 5; i++)
            quick_widgets[i].relative_x = dlg_width / 2 + 2;

        if (quick_dialog (&quick_dlg) != B_CANCEL)
            result = panel_get_field_by_title_hotkey (sort_orders_names[sort_idx]);

        if (result == NULL)
            result = info->sort_field;
    }
    g_strfreev ((gchar **) sort_orders_names);
    return result;
}
Beispiel #7
0
gboolean
editcmd_dialog_search_show (WEdit * edit)
{
    char *search_text;
    size_t num_of_types;
    gchar **list_of_types;
    int dialog_result;

    list_of_types = mc_search_get_types_strings_array (&num_of_types);

    {
        quick_widget_t quick_widgets[] = {
            /* *INDENT-OFF* */
            QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above, INPUT_LAST_TEXT, 
                                 MC_HISTORY_SHARED_SEARCH, &search_text, NULL, FALSE, FALSE,
                                 INPUT_COMPLETE_NONE),
            QUICK_SEPARATOR (TRUE),
            QUICK_START_COLUMNS,
                QUICK_RADIO (num_of_types, (const char **) list_of_types,
                             (int *) &edit_search_options.type, NULL),
            QUICK_NEXT_COLUMN,
                QUICK_CHECKBOX (N_("Cas&e sensitive"), &edit_search_options.case_sens, NULL),
                QUICK_CHECKBOX (N_("&Backwards"), &edit_search_options.backwards, NULL),
                QUICK_CHECKBOX (N_("In se&lection"), &edit_search_options.only_in_selection, NULL),
                QUICK_CHECKBOX (N_("&Whole words"), &edit_search_options.whole_words, NULL),
#ifdef HAVE_CHARSET
                QUICK_CHECKBOX (N_("&All charsets"), &edit_search_options.all_codepages, NULL),
#endif
            QUICK_STOP_COLUMNS,
            QUICK_START_BUTTONS (TRUE, TRUE),
                QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
                QUICK_BUTTON (N_("&Find all"), B_USER, NULL, NULL),
                QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
            QUICK_END
            /* *INDENT-ON* */
        };

        quick_dialog_t qdlg = {
            -1, -1, 58,
            N_("Search"), "[Input Line Keys]",
            quick_widgets, NULL, NULL
        };

        dialog_result = quick_dialog (&qdlg);
    }

    g_strfreev (list_of_types);

    if ((dialog_result == B_CANCEL) || (search_text == NULL) || (search_text[0] == '\0'))
    {
        g_free (search_text);
        return FALSE;
    }

    if (dialog_result == B_USER)
        search_create_bookmark = TRUE;

#ifdef HAVE_CHARSET
    {
        GString *tmp;

        tmp = str_convert_to_input (search_text);
        if (tmp != NULL)
        {
            g_free (search_text);
            search_text = g_string_free (tmp, FALSE);
        }
    }
#endif

    g_free (edit->last_search_string);
    edit->last_search_string = search_text;
    mc_search_free (edit->search);

#ifdef HAVE_CHARSET
    edit->search = mc_search_new (edit->last_search_string, cp_source);
#else
    edit->search = mc_search_new (edit->last_search_string, NULL);
#endif
    if (edit->search != NULL)
    {
        edit->search->search_type = edit_search_options.type;
#ifdef HAVE_CHARSET
        edit->search->is_all_charsets = edit_search_options.all_codepages;
#endif
        edit->search->is_case_sensitive = edit_search_options.case_sens;
        edit->search->whole_words = edit_search_options.whole_words;
        edit->search->search_fn = edit_search_cmd_callback;
        edit->search->update_fn = edit_search_update_callback;
    }

    return (edit->search != NULL);
}
Beispiel #8
0
gboolean
mcview_dialog_search (mcview_t * view)
{
    int SEARCH_DLG_MIN_HEIGHT = 12;
    int SEARCH_DLG_HEIGHT_SUPPLY = 3;
    int SEARCH_DLG_WIDTH = 58;

    char *exp = NULL;
    int qd_result;

    size_t num_of_types;
    gchar **list_of_types = mc_search_get_types_strings_array (&num_of_types);
    int SEARCH_DLG_HEIGHT = SEARCH_DLG_MIN_HEIGHT + num_of_types - SEARCH_DLG_HEIGHT_SUPPLY;

    QuickWidget quick_widgets[] = {
        QUICK_BUTTON (6, 10, SEARCH_DLG_HEIGHT - 3, SEARCH_DLG_HEIGHT, N_("&Cancel"), B_CANCEL,
                      NULL),
        QUICK_BUTTON (2, 10, SEARCH_DLG_HEIGHT - 3, SEARCH_DLG_HEIGHT, N_("&OK"), B_ENTER, NULL),
#ifdef HAVE_CHARSET
        QUICK_CHECKBOX (SEARCH_DLG_WIDTH / 2 + 3, SEARCH_DLG_WIDTH, 8, SEARCH_DLG_HEIGHT,
                        N_("&All charsets"), &mcview_search_options.all_codepages),
#endif
        QUICK_CHECKBOX (SEARCH_DLG_WIDTH / 2 + 3, SEARCH_DLG_WIDTH, 7, SEARCH_DLG_HEIGHT,
                        N_("&Whole words"), &mcview_search_options.whole_words),
        QUICK_CHECKBOX (SEARCH_DLG_WIDTH / 2 + 3, SEARCH_DLG_WIDTH, 6, SEARCH_DLG_HEIGHT,
                        N_("&Backwards"), &mcview_search_options.backwards),
        QUICK_CHECKBOX (SEARCH_DLG_WIDTH / 2 + 3, SEARCH_DLG_WIDTH, 5, SEARCH_DLG_HEIGHT,
                        N_("Cas&e sensitive"), &mcview_search_options.case_sens),
        QUICK_RADIO (3, SEARCH_DLG_WIDTH, 5, SEARCH_DLG_HEIGHT,
                     num_of_types, (const char **) list_of_types,
                     (int *) &mcview_search_options.type),
        QUICK_INPUT (3, SEARCH_DLG_WIDTH, 3, SEARCH_DLG_HEIGHT,
                     INPUT_LAST_TEXT, SEARCH_DLG_WIDTH - 6, 0, MC_HISTORY_SHARED_SEARCH, &exp),
        QUICK_LABEL (3, SEARCH_DLG_WIDTH, 2, SEARCH_DLG_HEIGHT, N_("Enter search string:")),
        QUICK_END
    };

    QuickDialog Quick_input = {
        SEARCH_DLG_WIDTH, SEARCH_DLG_HEIGHT, -1, -1,
        N_("Search"), "[Input Line Keys]",
        quick_widgets, NULL, NULL, FALSE
    };

    qd_result = quick_dialog (&Quick_input);
    g_strfreev (list_of_types);

    if ((qd_result == B_CANCEL) || (exp == NULL) || (exp[0] == '\0'))
    {
        g_free (exp);
        return FALSE;
    }

#ifdef HAVE_CHARSET
    {
        GString *tmp = str_convert_to_input (exp);

        if (tmp)
        {
            g_free (exp);
            exp = g_string_free (tmp, FALSE);
        }
    }
#endif

    g_free (view->last_search_string);
    view->last_search_string = exp;
    mcview_nroff_seq_free (&view->search_nroff_seq);
    mc_search_free (view->search);

    view->search = mc_search_new (view->last_search_string, -1);
    view->search_nroff_seq = mcview_nroff_seq_new (view);
    if (view->search != NULL)
    {
        view->search->search_type = mcview_search_options.type;
        view->search->is_all_charsets = mcview_search_options.all_codepages;
        view->search->is_case_sensitive = mcview_search_options.case_sens;
        view->search->whole_words = mcview_search_options.whole_words;
        view->search->search_fn = mcview_search_cmd_callback;
        view->search->update_fn = mcview_search_update_cmd_callback;
    }

    return (view->search != NULL);
}
Beispiel #9
0
gboolean
mcview_dialog_goto (mcview_t * view, off_t * offset)
{
    typedef enum
    {
        MC_VIEW_GOTO_LINENUM = 0,
        MC_VIEW_GOTO_PERCENT = 1,
        MC_VIEW_GOTO_OFFSET_DEC = 2,
        MC_VIEW_GOTO_OFFSET_HEX = 3
    } mcview_goto_type_t;

    const char *mc_view_goto_str[] = {
        N_("&Line number (decimal)"),
        N_("Pe&rcents"),
        N_("&Decimal offset"),
        N_("He&xadecimal offset")
    };

    const int goto_dlg_height = 12;
    int goto_dlg_width = 40;

    static mcview_goto_type_t current_goto_type = MC_VIEW_GOTO_LINENUM;

    size_t i;

    size_t num_of_types = sizeof (mc_view_goto_str) / sizeof (mc_view_goto_str[0]);
    char *exp = NULL;
    int qd_result;
    gboolean res = FALSE;

    QuickWidget quick_widgets[] = {
        QUICK_BUTTON (6, 10, goto_dlg_height - 3, goto_dlg_height, N_("&Cancel"), B_CANCEL, NULL),
        QUICK_BUTTON (2, 10, goto_dlg_height - 3, goto_dlg_height, N_("&OK"), B_ENTER, NULL),
        QUICK_RADIO (3, goto_dlg_width, 4, goto_dlg_height,
                     num_of_types, (const char **) mc_view_goto_str, (int *) &current_goto_type),
        QUICK_INPUT (3, goto_dlg_width, 2, goto_dlg_height,
                     INPUT_LAST_TEXT, goto_dlg_width - 6, 0, MC_HISTORY_VIEW_GOTO, &exp),
        QUICK_END
    };

    QuickDialog Quick_input = {
        goto_dlg_width, goto_dlg_height, -1, -1,
        N_("Goto"), "[Input Line Keys]",
        quick_widgets, NULL, NULL, FALSE
    };

#ifdef ENABLE_NLS
    for (i = 0; i < num_of_types; i++)
        mc_view_goto_str[i] = _(mc_view_goto_str[i]);

    quick_widgets[0].u.button.text = _(quick_widgets[0].u.button.text);
    quick_widgets[1].u.button.text = _(quick_widgets[1].u.button.text);
#endif

    /* calculate widget coordinates */
    {
        int b0_len, b1_len, len;
        const int button_gap = 2;

        /* preliminary dialog width */
        goto_dlg_width = max (goto_dlg_width, str_term_width1 (Quick_input.title) + 4);

        /* length of radiobuttons */
        for (i = 0; i < num_of_types; i++)
            goto_dlg_width = max (goto_dlg_width, str_term_width1 (mc_view_goto_str[i]) + 10);

        /* length of buttons */
        b0_len = str_term_width1 (quick_widgets[0].u.button.text) + 3;
        b1_len = str_term_width1 (quick_widgets[1].u.button.text) + 5;  /* default button */
        len = b0_len + b1_len + button_gap * 2;

        /* dialog width */
        Quick_input.xlen = max (goto_dlg_width, len + 6);

        /* correct widget coordinates */
        for (i = sizeof (quick_widgets) / sizeof (quick_widgets[0]); i > 0; i--)
            quick_widgets[i - 1].x_divisions = Quick_input.xlen;

        /* input length */
        quick_widgets[3].u.input.len = Quick_input.xlen - 6;

        /* button positions */
        quick_widgets[1].relative_x = Quick_input.xlen / 2 - len / 2;
        quick_widgets[0].relative_x = quick_widgets[1].relative_x + b1_len + button_gap;
    }

    /* run dialog */
    qd_result = quick_dialog (&Quick_input);

    *offset = -1;

    /* check input line value */
    if ((qd_result != B_CANCEL) && (exp != NULL) && (exp[0] != '\0'))
    {
        int base = (current_goto_type == MC_VIEW_GOTO_OFFSET_HEX) ? 16 : 10;
        off_t addr;
        char *error;

        res = TRUE;

        addr = strtoll (exp, &error, base);
        if ((*error == '\0') && (addr >= 0))
        {
            switch (current_goto_type)
            {
            case MC_VIEW_GOTO_LINENUM:
                mcview_coord_to_offset (view, offset, addr, 0);
                *offset = mcview_bol (view, *offset, 0);
                break;
            case MC_VIEW_GOTO_PERCENT:
                if (addr > 100)
                    addr = 100;
                *offset = addr * mcview_get_filesize (view) / 100;
                if (!view->hex_mode)
                    *offset = mcview_bol (view, *offset, 0);
                break;
            case MC_VIEW_GOTO_OFFSET_DEC:
            case MC_VIEW_GOTO_OFFSET_HEX:
                *offset = addr;
                if (!view->hex_mode)
                    *offset = mcview_bol (view, *offset, 0);
                else
                {
                    addr = mcview_get_filesize (view);
                    if (*offset > addr)
                        *offset = addr;
                }
                break;
            default:
                *offset = 0;
                break;
            }
        }
    }

    g_free (exp);
    return res;
}
Beispiel #10
0
void
editcmd_dialog_search_show (WEdit * edit, char **search_text)
{
    if (*search_text == '\0')
        *search_text = INPUT_LAST_TEXT;

    {
	size_t num_of_types;
	gchar **list_of_types = mc_search_get_types_strings_array (&num_of_types);
	int SEARCH_DLG_HEIGHT = SEARCH_DLG_MIN_HEIGHT + num_of_types - SEARCH_DLG_HEIGHT_SUPPLY;
	size_t i;

	int dialog_result;

	QuickWidget quick_widgets[] =
	{
	    /* 0 */
	    QUICK_BUTTON (6, 10, 11, SEARCH_DLG_HEIGHT, N_("&Cancel"), B_CANCEL, NULL),
	    /* 1 */
	    QUICK_BUTTON (4, 10, 11, SEARCH_DLG_HEIGHT, N_("&Find all"), B_USER, NULL),
	    /* 2 */
	    QUICK_BUTTON (2, 10, 11, SEARCH_DLG_HEIGHT, N_("&OK"),     B_ENTER,  NULL),
#ifdef HAVE_CHARSET
	    /* 3 */
	    QUICK_CHECKBOX (33, SEARCH_DLG_WIDTH, 9, SEARCH_DLG_HEIGHT, N_("All charsets"), &edit->all_codepages),
#endif
	    /* 4 */
	    QUICK_CHECKBOX (33, SEARCH_DLG_WIDTH, 8, SEARCH_DLG_HEIGHT, N_("&Whole words"), &edit->whole_words),
	    /* 5 */
	    QUICK_CHECKBOX (33, SEARCH_DLG_WIDTH, 7, SEARCH_DLG_HEIGHT, N_("In se&lection"), &edit->only_in_selection),
	    /* 6 */
	    QUICK_CHECKBOX (33, SEARCH_DLG_WIDTH, 6, SEARCH_DLG_HEIGHT, N_("&Backwards"), &edit->replace_backwards),
	    /* 7 */
	    QUICK_CHECKBOX (33, SEARCH_DLG_WIDTH, 5, SEARCH_DLG_HEIGHT, N_("case &Sensitive"), &edit->replace_case),
	    /* 8 */
	    QUICK_RADIO ( 3, SEARCH_DLG_WIDTH, 5, SEARCH_DLG_HEIGHT,
				    num_of_types, (const char **) list_of_types, (int *) &edit->search_type),
	    /* 9 */
	    QUICK_INPUT (3, SEARCH_DLG_WIDTH, 3, SEARCH_DLG_HEIGHT,
				    *search_text, SEARCH_DLG_WIDTH - 6, 0, MC_HISTORY_SHARED_SEARCH, search_text),
	    /* 10 */
	    QUICK_LABEL (2, SEARCH_DLG_WIDTH, 2, SEARCH_DLG_HEIGHT, N_(" Enter search string:")),
	    QUICK_END
	};

#ifdef HAVE_CHARSET
	size_t last_checkbox = 7;
#else
	size_t last_checkbox = 6;
#endif

	QuickDialog Quick_input =
	{
	    SEARCH_DLG_WIDTH, SEARCH_DLG_HEIGHT, -1, -1, N_("Search"),
	    "[Input Line Keys]", quick_widgets, TRUE
	};

#ifdef ENABLE_NLS
	char **list_of_types_nls;

	/* header title */
	Quick_input.title = _(Quick_input.title);
	/* buttons */
	for (i = 0; i < 3; i++)
	    quick_widgets[i].u.button.text = _(quick_widgets[i].u.button.text);
	/* checkboxes */
	for (i = 3; i <= last_checkbox; i++)
	    quick_widgets[i].u.checkbox.text = _(quick_widgets[i].u.checkbox.text);
	/* label */
	quick_widgets[10].u.label.text = _(quick_widgets[10].u.label.text);

	/* radiobuttons */
	/* create copy of radio items to avoid memory leak */
	list_of_types_nls = g_new0 (char *, num_of_types + 1);
	for (i = 0; i < num_of_types; i++)
	    list_of_types_nls[i] = g_strdup (_(list_of_types[i]));
	g_strfreev (list_of_types);
	list_of_types = list_of_types_nls;
	quick_widgets[last_checkbox + 1].u.radio.items = (const char **) list_of_types;
#endif

	/* calculate widget coordinates */
	{
	    int len = 0;
	    int dlg_width;
	    gchar **radio = list_of_types;
	    int b0_len, b1_len, b2_len;
	    const int button_gap = 2;

	    /* length of radiobuttons */
            while (*radio != NULL) {
		len = max (len, str_term_width1 (*radio));
		radio++;
	    }
	    /* length of checkboxes */
	    for (i = 3; i <= last_checkbox; i++)
		len = max (len, str_term_width1 (quick_widgets[i].u.checkbox.text) + 4);

	    /* preliminary dialog width */
	    dlg_width = max (len * 2, str_term_width1 (Quick_input.title)) + 4;

	    /* length of buttons */
	    b0_len = str_term_width1 (quick_widgets[0].u.button.text) + 3;
	    b1_len = str_term_width1 (quick_widgets[1].u.button.text) + 3;
	    b2_len = str_term_width1 (quick_widgets[2].u.button.text) + 5; /* default button */
	    len = b0_len + b1_len + b2_len + button_gap * 2;

	    /* dialog width */
	    Quick_input.xlen = max (SEARCH_DLG_WIDTH, max (dlg_width, len + 6));

	    /* correct widget coordinates */
	    for (i = 0; i < sizeof (quick_widgets)/sizeof (quick_widgets[0]); i++)
		quick_widgets[i].x_divisions = Quick_input.xlen;

	    /* checkbox positions */
	    for (i = 3; i <= last_checkbox; i++)
		quick_widgets[i].relative_x = Quick_input.xlen/2 + 2;
	    /* input length */
	    quick_widgets[last_checkbox + 2].u.input.len = Quick_input.xlen - 6;
	    /* button positions */
	    quick_widgets[2].relative_x = Quick_input.xlen/2 - len/2;
	    quick_widgets[1].relative_x = quick_widgets[2].relative_x + b2_len + button_gap;
	    quick_widgets[0].relative_x = quick_widgets[1].relative_x + b1_len + button_gap;
	}

	dialog_result = quick_dialog (&Quick_input);

	g_strfreev (list_of_types);

	if (dialog_result == B_CANCEL)
	    *search_text = NULL;
	else if (dialog_result == B_USER)
	    search_create_bookmark = 1;
    }
}
Beispiel #11
0
/* return list type */
int
panel_listing_box (WPanel * panel, int num, char **userp, char **minip, int *use_msformat,
                   int *brief_cols)
{
    int result = -1;
    char *section = NULL;

    if (panel == NULL)
    {
        const char *p;
        size_t i;

        p = get_nth_panel_name (num);
        panel = g_new (WPanel, 1);
        panel->list_type = list_full;
        panel->user_format = g_strdup (DEFAULT_USER_FORMAT);
        panel->user_mini_status = 0;
        for (i = 0; i < LIST_TYPES; i++)
            panel->user_status_format[i] = g_strdup (DEFAULT_USER_FORMAT);
        section = g_strconcat ("Temporal:", p, (char *) NULL);
        if (!mc_config_has_group (mc_main_config, section))
        {
            g_free (section);
            section = g_strdup (p);
        }
        panel_load_setup (panel, section);
        g_free (section);
    }

    {
        int mini_user_status;
        char panel_brief_cols_in[BUF_TINY];
        char *panel_brief_cols_out = NULL;
        char *panel_user_format = NULL;
        char *mini_user_format = NULL;
        const char *cp;

        /* Controls whether the array strings have been translated */
        const char *list_types[LIST_TYPES] = {
            N_("&Full file list"),
            N_("&Brief file list:"),
            N_("&Long file list"),
            N_("&User defined:")
        };

        quick_widget_t quick_widgets[] = {
            /* *INDENT-OFF* */
            QUICK_START_COLUMNS,
                QUICK_RADIO (LIST_TYPES, list_types, &result, &panel_listing_types_id),
            QUICK_NEXT_COLUMN,
                QUICK_SEPARATOR (FALSE),
                QUICK_LABELED_INPUT (_ ("columns"), input_label_right, panel_brief_cols_in,
                                     "panel-brief-cols-input", &panel_brief_cols_out,
                                     &panel_brief_cols_id, FALSE, FALSE, INPUT_COMPLETE_NONE),
            QUICK_STOP_COLUMNS,
            QUICK_INPUT (panel->user_format, "user-fmt-input", &panel_user_format,
                         &panel_user_format_id, FALSE, FALSE, INPUT_COMPLETE_NONE),
            QUICK_SEPARATOR (TRUE),
            QUICK_CHECKBOX (N_("User &mini status"), &mini_user_status, &mini_user_status_id),
            QUICK_INPUT (panel->user_status_format[panel->list_type], "mini_input",
                         &mini_user_format, &mini_user_format_id, FALSE, FALSE, INPUT_COMPLETE_NONE),
            QUICK_BUTTONS_OK_CANCEL,
            QUICK_END
            /* *INDENT-ON* */
        };

        quick_dialog_t qdlg = {
            -1, -1, 48,
            N_("Listing mode"), "[Listing Mode...]",
            quick_widgets, panel_listing_callback, NULL
        };

        /* get hotkey of user-defined format string */
        cp = strchr (_(list_types[panel_listing_user_idx]), '&');
        if (cp != NULL && *++cp != '\0')
            listing_user_hotkey = g_ascii_tolower (*cp);

        mini_user_status = panel->user_mini_status;
        result = panel->list_type;
        status_format = panel->user_status_format;

        g_snprintf (panel_brief_cols_in, sizeof (panel_brief_cols_in), "%d", panel->brief_cols);

        if ((int) panel->list_type != panel_listing_brief_idx)
            quick_widgets[4].options = W_DISABLED;

        if ((int) panel->list_type != panel_listing_user_idx)
            quick_widgets[6].options = W_DISABLED;

        if (!mini_user_status)
            quick_widgets[9].options = W_DISABLED;

        if (quick_dialog (&qdlg) == B_CANCEL)
            result = -1;
        else
        {
            int cols;
            char *error = NULL;

            *userp = panel_user_format;
            *minip = mini_user_format;
            *use_msformat = mini_user_status;

            cols = strtol (panel_brief_cols_out, &error, 10);
            if (*error == '\0')
                *brief_cols = cols;
            else
                *brief_cols = panel->brief_cols;

            g_free (panel_brief_cols_out);
        }
    }

    if (section != NULL)
    {
        int i;

        g_free (panel->user_format);
        for (i = 0; i < LIST_TYPES; i++)
            g_free (panel->user_status_format[i]);
        g_free (panel);
    }

    return result;
}
Beispiel #12
0
void
panel_options_box (void)
{
    int simple_swap;

    simple_swap = mc_config_get_bool (mc_main_config, CONFIG_PANELS_SECTION,
                                      "simple_swap", FALSE) ? 1 : 0;
    {
        const char *qsearch_options[] = {
            N_("Case &insensitive"),
            N_("Cas&e sensitive"),
            N_("Use panel sort mo&de")
        };

        quick_widget_t quick_widgets[] = {
            /* *INDENT-OFF* */
            QUICK_START_COLUMNS,
                QUICK_START_GROUPBOX (N_("Main options")),
                    QUICK_CHECKBOX (N_("Show mi&ni-status"), &panels_options.show_mini_info, NULL),
                    QUICK_CHECKBOX (N_("Use SI si&ze units"), &panels_options.kilobyte_si, NULL),
                    QUICK_CHECKBOX (N_("Mi&x all files"), &panels_options.mix_all_files, NULL),
                    QUICK_CHECKBOX (N_("Show &backup files"), &panels_options.show_backups, NULL),
                    QUICK_CHECKBOX (N_("Show &hidden files"), &panels_options.show_dot_files, NULL),
                    QUICK_CHECKBOX (N_("&Fast dir reload"), &panels_options.fast_reload, NULL),
                    QUICK_CHECKBOX (N_("Ma&rk moves down"), &panels_options.mark_moves_down, NULL),
                    QUICK_CHECKBOX (N_("Re&verse files only"), &panels_options.reverse_files_only,
                                    NULL),
                    QUICK_CHECKBOX (N_("Simple s&wap"), &simple_swap, NULL),
                    QUICK_CHECKBOX (N_("A&uto save panels setup"), &panels_options.auto_save_setup,
                                    NULL),
                    QUICK_SEPARATOR (FALSE),
                    QUICK_SEPARATOR (FALSE),
                QUICK_STOP_GROUPBOX,
            QUICK_NEXT_COLUMN,
                QUICK_START_GROUPBOX (N_("Navigation")),
                    QUICK_CHECKBOX (N_("L&ynx-like motion"), &panels_options.navigate_with_arrows,
                                    NULL),
                    QUICK_CHECKBOX (N_("Pa&ge scrolling"), &panels_options.scroll_pages, NULL),
                    QUICK_CHECKBOX (N_("&Mouse page scrolling"), &panels_options.mouse_move_pages,
                                    NULL),
                QUICK_STOP_GROUPBOX,
                QUICK_START_GROUPBOX (N_("File highlight")),
                    QUICK_CHECKBOX (N_("File &types"), &panels_options.filetype_mode, NULL),
                    QUICK_CHECKBOX (N_("&Permissions"), &panels_options.permission_mode, NULL),
                QUICK_STOP_GROUPBOX,
                QUICK_START_GROUPBOX (N_("Quick search")),
                    QUICK_RADIO (QSEARCH_NUM, qsearch_options, (int *) &panels_options.qsearch_mode,
                                 NULL),
                QUICK_STOP_GROUPBOX,
            QUICK_STOP_COLUMNS,
            QUICK_BUTTONS_OK_CANCEL,
            QUICK_END
            /* *INDENT-ON* */
        };

        quick_dialog_t qdlg = {
            -1, -1, 60,
            N_("Panel options"), "[Panel options]",
            quick_widgets, NULL, NULL
        };

        if (quick_dialog (&qdlg) != B_ENTER)
            return;
    }

    mc_config_set_bool (mc_main_config, CONFIG_PANELS_SECTION,
                        "simple_swap", (gboolean) (simple_swap & C_BOOL));

    if (!panels_options.fast_reload_msg_shown && panels_options.fast_reload)
    {
        message (D_NORMAL, _("Information"),
                 _("Using the fast reload option may not reflect the exact\n"
                   "directory contents. In this case you'll need to do a\n"
                   "manual reload of the directory. See the man page for\n" "the details."));
        panels_options.fast_reload_msg_shown = TRUE;
    }

    update_panels (UP_RELOAD, UP_KEEPSEL);
}
Beispiel #13
0
void
configure_box (void)
{
    const char *pause_options[] = {
        N_("&Never"),
        N_("On dum&b terminals"),
        N_("Alwa&ys")
    };

    int pause_options_num;

    pause_options_num = G_N_ELEMENTS (pause_options);

    {
        char time_out[BUF_TINY] = "";
        char *time_out_new;

        quick_widget_t quick_widgets[] = {
            /* *INDENT-OFF* */
            QUICK_START_COLUMNS,
                QUICK_START_GROUPBOX (N_("File operations")),
                    QUICK_CHECKBOX (N_("&Verbose operation"), &verbose, NULL),
                    QUICK_CHECKBOX (N_("Compute tota&ls"), &file_op_compute_totals, NULL),
                    QUICK_CHECKBOX (N_("Classic pro&gressbar"), &classic_progressbar, NULL),
                    QUICK_CHECKBOX (N_("Mkdi&r autoname"), &auto_fill_mkdir_name, NULL),
                    QUICK_CHECKBOX (N_("&Preallocate space"), &mc_global.vfs.preallocate_space,
                                    NULL),
                QUICK_STOP_GROUPBOX,
                QUICK_START_GROUPBOX (N_("Esc key mode")),
                    QUICK_CHECKBOX (N_("S&ingle press"), &old_esc_mode, &configure_old_esc_mode_id),
                    QUICK_LABELED_INPUT (N_("Timeout:"), input_label_left,
                                         (const char *) time_out, MC_HISTORY_ESC_TIMEOUT,
                                         &time_out_new, &configure_time_out_id, FALSE, FALSE,
                                         INPUT_COMPLETE_NONE),
                QUICK_STOP_GROUPBOX,
                QUICK_START_GROUPBOX (N_("Pause after run")),
                    QUICK_RADIO (pause_options_num, pause_options, &pause_after_run, NULL),
                QUICK_STOP_GROUPBOX,
            QUICK_NEXT_COLUMN,
                QUICK_START_GROUPBOX (N_("Other options")),
                    QUICK_CHECKBOX (N_("Use internal edi&t"), &use_internal_edit, NULL),
                    QUICK_CHECKBOX (N_("Use internal vie&w"), &use_internal_view, NULL),
                    QUICK_CHECKBOX (N_("A&sk new file name"),
                                    &editor_ask_filename_before_edit, NULL),
                    QUICK_CHECKBOX (N_("Auto m&enus"), &auto_menu, NULL),
                    QUICK_CHECKBOX (N_("&Drop down menus"), &drop_menus, NULL),
                    QUICK_CHECKBOX (N_("S&hell patterns"), &easy_patterns, NULL),
                    QUICK_CHECKBOX (N_("Co&mplete: show all"),
                                    &mc_global.widget.show_all_if_ambiguous, NULL),
                    QUICK_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL),
                    QUICK_CHECKBOX (N_("Cd follows lin&ks"), &mc_global.vfs.cd_symlinks, NULL),
                    QUICK_CHECKBOX (N_("Sa&fe delete"), &safe_delete, NULL),
                    QUICK_CHECKBOX (N_("A&uto save setup"), &auto_save_setup, NULL),
                    QUICK_SEPARATOR (FALSE),
                    QUICK_SEPARATOR (FALSE),
                    QUICK_SEPARATOR (FALSE),
                QUICK_STOP_GROUPBOX,
            QUICK_STOP_COLUMNS,
            QUICK_BUTTONS_OK_CANCEL,
            QUICK_END
            /* *INDENT-ON* */
        };

        quick_dialog_t qdlg = {
            -1, -1, 60,
            N_("Configure options"), "[Configuration]",
            quick_widgets, configure_callback, NULL
        };

        g_snprintf (time_out, sizeof (time_out), "%d", old_esc_mode_timeout);

#ifndef USE_INTERNAL_EDIT
        quick_widgets[17].options = W_DISABLED;
#endif

        if (!old_esc_mode)
            quick_widgets[10].options = quick_widgets[11].options = W_DISABLED;

#ifndef HAVE_POSIX_FALLOCATE
        mc_global.vfs.preallocate_space = FALSE;
        quick_widgets[7].options = W_DISABLED;
#endif

        if (quick_dialog (&qdlg) == B_ENTER)
            old_esc_mode_timeout = atoi (time_out_new);

        g_free (time_out_new);
    }
}
Beispiel #14
0
void
panel_options_box (void)
{
    int dlg_width = 60;
    int dlg_height = 19;

    int simple_swap = mc_config_get_bool (mc_main_config, CONFIG_PANELS_SECTION,
                                          "simple_swap", FALSE) ? 1 : 0;

    const char *qsearch_options[] = {
        N_("Case &insensitive"),
        N_("Case s&ensitive"),
        N_("Use panel sort mo&de")
    };

    QuickWidget quick_widgets[] = {
        /* buttons */
        QUICK_BUTTON (38, dlg_width, dlg_height - 3, dlg_height, N_("&Cancel"), B_CANCEL, NULL),
        QUICK_BUTTON (14, dlg_width, dlg_height - 3, dlg_height, N_("&OK"), B_ENTER, NULL),
        /* quick search */
        QUICK_RADIO (dlg_width / 2 + 2, dlg_width, 12, dlg_height, QSEARCH_NUM, qsearch_options,
                     (int *) &panels_options.qsearch_mode),
        QUICK_GROUPBOX (dlg_width / 2, dlg_width, 11, dlg_height, dlg_width / 2 - 4,
                        QSEARCH_NUM + 2,
                        N_("Quick search")),
        /* file highlighting */
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 9, dlg_height, N_("&Permissions"),
                        &panels_options.permission_mode),
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 8, dlg_height, N_("File &types"),
                        &panels_options.filetype_mode),
        QUICK_GROUPBOX (dlg_width / 2, dlg_width, 7, dlg_height, dlg_width / 2 - 4, 4,
                        N_("File highlight")),
        /* navigation */
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 5, dlg_height, N_("&Mouse page scrolling"),
                        &panels_options.mouse_move_pages),
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 4, dlg_height, N_("Pa&ge scrolling"),
                        &panels_options.scroll_pages),
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 3, dlg_height, N_("L&ynx-like motion"),
                        &panels_options.navigate_with_arrows),
        QUICK_GROUPBOX (dlg_width / 2, dlg_width, 2, dlg_height, dlg_width / 2 - 4, 5,
                        N_("Navigation")),
        /* main panel options */
        QUICK_CHECKBOX (5, dlg_width, 12, dlg_height, N_("A&uto save panels setup"),
                        &panels_options.auto_save_setup),
        QUICK_CHECKBOX (5, dlg_width, 11, dlg_height, N_("Simple s&wap"),
                        &simple_swap),
        QUICK_CHECKBOX (5, dlg_width, 10, dlg_height, N_("Re&verse files only"),
                        &panels_options.reverse_files_only),
        QUICK_CHECKBOX (5, dlg_width, 9, dlg_height, N_("Ma&rk moves down"),
                        &panels_options.mark_moves_down),
        QUICK_CHECKBOX (5, dlg_width, 8, dlg_height, N_("&Fast dir reload"),
                        &panels_options.fast_reload),
        QUICK_CHECKBOX (5, dlg_width, 7, dlg_height, N_("Show &hidden files"),
                        &panels_options.show_dot_files),
        QUICK_CHECKBOX (5, dlg_width, 6, dlg_height, N_("Show &backup files"),
                        &panels_options.show_backups),
        QUICK_CHECKBOX (5, dlg_width, 5, dlg_height, N_("Mi&x all files"),
                        &panels_options.mix_all_files),
        QUICK_CHECKBOX (5, dlg_width, 4, dlg_height, N_("Use SI si&ze units"),
                        &panels_options.kilobyte_si),
        QUICK_CHECKBOX (5, dlg_width, 3, dlg_height, N_("Show mi&ni-status"),
                        &panels_options.show_mini_info),
        QUICK_GROUPBOX (3, dlg_width, 2, dlg_height, dlg_width / 2 - 4, 14,
                        N_("Main options")),
        QUICK_END
    };

    const size_t qw_num = G_N_ELEMENTS (quick_widgets) - 1;

    QuickDialog Quick_input = {
        dlg_width, dlg_height, -1, -1,
        N_("Panel options"), "[Panel options]",
        quick_widgets, NULL, TRUE
    };

    int b0_len, b1_len;
    int b_len, c_len, g_len;
    size_t i;

#ifdef ENABLE_NLS
    for (i = 0; i < qw_num; i++)
        switch (i)
        {
        case 0:
        case 1:
            /* buttons */
            quick_widgets[i].u.button.text = _(quick_widgets[i].u.button.text);
            break;
        case 2:
            {
                /* radio button */
                size_t j;
                for (j = 0; j < QSEARCH_NUM; j++)
                    qsearch_options[j] = _(qsearch_options[j]);
            }
            break;
        case 3:
        case 6:
        case 10:
        case 21:
            /* groupboxes */
            quick_widgets[i].u.groupbox.title = _(quick_widgets[i].u.groupbox.title);
            break;
        default:
            /* checkboxes */
            quick_widgets[i].u.checkbox.text = _(quick_widgets[i].u.checkbox.text);
            break;
        }

    Quick_input.title = _(Quick_input.title);
#endif /* ENABLE_NLS */

    /* calculate widget and dialog widths */
    /* dialog title */
    dlg_width = max (dlg_width, str_term_width1 (Quick_input.title) + 4);
    /* buttons */
    b0_len = str_term_width1 (quick_widgets[0].u.button.text) + 3;
    b1_len = str_term_width1 (quick_widgets[1].u.button.text) + 5;
    b_len = b0_len + b1_len + 1;

    /* checkboxes within groupboxes */
    c_len = 0;
    for (i = 4; i < 21; i++)
        if ((i != 6) && (i != 10))
            c_len = max (c_len, str_term_width1 (quick_widgets[i].u.checkbox.text) + 4);

    /* radiobuttons */
    for (i = 0; i < QSEARCH_NUM; i++)
        c_len = max (c_len, str_term_width1 (qsearch_options[i]) + 3);
    /* groupboxes */
    g_len = max (c_len + 2, str_term_width1 (quick_widgets[3].u.groupbox.title) + 4);
    g_len = max (g_len, str_term_width1 (quick_widgets[6].u.groupbox.title) + 4);
    g_len = max (g_len, str_term_width1 (quick_widgets[10].u.groupbox.title) + 4);
    g_len = max (g_len, str_term_width1 (quick_widgets[21].u.groupbox.title) + 4);
    /* dialog width */
    Quick_input.xlen = max (dlg_width, g_len * 2 + 9);
    Quick_input.xlen = max (Quick_input.xlen, b_len + 2);
    if ((Quick_input.xlen & 1) != 0)
        Quick_input.xlen++;

    /* fix widget parameters */
    for (i = 0; i < qw_num; i++)
        quick_widgets[i].x_divisions = Quick_input.xlen;

    /* groupboxes */
    quick_widgets[3].u.groupbox.width =
        quick_widgets[6].u.groupbox.width =
        quick_widgets[10].u.groupbox.width = Quick_input.xlen / 2 - 3;
    quick_widgets[21].u.groupbox.width = Quick_input.xlen / 2 - 4;

    /* right column */
    quick_widgets[3].relative_x =
        quick_widgets[6].relative_x = quick_widgets[10].relative_x = Quick_input.xlen / 2;
    for (i = 2; i < 10; i++)
        if ((i != 3) && (i != 6))
            quick_widgets[i].relative_x = quick_widgets[3].relative_x + 2;

    /* buttons */
    quick_widgets[1].relative_x = (Quick_input.xlen - b_len) / 3;
    quick_widgets[0].relative_x = 2 * quick_widgets[1].relative_x + b1_len + 1;

    if (quick_dialog (&Quick_input) != B_ENTER)
        return;

    mc_config_set_bool (mc_main_config, CONFIG_PANELS_SECTION,
                        "simple_swap", (gboolean) (simple_swap & C_BOOL));

    if (!panels_options.fast_reload_msg_shown && panels_options.fast_reload)
    {
        message (D_NORMAL, _("Information"),
                 _("Using the fast reload option may not reflect the exact\n"
                   "directory contents. In this case you'll need to do a\n"
                   "manual reload of the directory. See the man page for\n" "the details."));
        panels_options.fast_reload_msg_shown = TRUE;
    }

    update_panels (UP_RELOAD, UP_KEEPSEL);
}
Beispiel #15
0
void
configure_box (void)
{
    int dlg_width = 60;
    int dlg_height = 21;

    char time_out[BUF_TINY] = "";
    char *time_out_new;

    const char *pause_options[] = {
        N_("&Never"),
        N_("On dum&b terminals"),
        N_("Alwa&ys")
    };

    int pause_options_num = G_N_ELEMENTS (pause_options);

    QuickWidget quick_widgets[] = {
        /* buttons */
        QUICK_BUTTON (38, dlg_width, dlg_height - 3, dlg_height, N_("&Cancel"), B_CANCEL, NULL),
        QUICK_BUTTON (14, dlg_width, dlg_height - 3, dlg_height, N_("&OK"), B_ENTER, NULL),
        /* other options */
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 12, dlg_height, N_("A&uto save setup"),
                        &auto_save_setup),
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 11, dlg_height, N_("Sa&fe delete"),
                        &safe_delete),
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 10, dlg_height, N_("Cd follows lin&ks"),
                        &mc_global.vfs.cd_symlinks),
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 9, dlg_height, N_("Rotating d&ash"),
                        &nice_rotating_dash),
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 8, dlg_height, N_("Co&mplete: show all"),
                        &mc_global.widget.show_all_if_ambiguous),
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 7, dlg_height, N_("Shell &patterns"),
                        &easy_patterns),
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 6, dlg_height, N_("&Drop down menus"),
                        &drop_menus),
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 5, dlg_height, N_("Auto m&enus"), &auto_menu),
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 4, dlg_height, N_("Use internal vie&w"),
                        &use_internal_view),
        QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 3, dlg_height, N_("Use internal edi&t"),
                        &use_internal_edit),
        QUICK_GROUPBOX (dlg_width / 2, dlg_width, 2, dlg_height, dlg_width / 2 - 4, 16,
                        N_("Other options")),
        /* pause options */
        QUICK_RADIO (5, dlg_width, 14, dlg_height, pause_options_num, pause_options,
                     &pause_after_run),
        QUICK_GROUPBOX (3, dlg_width, 13, dlg_height, dlg_width / 2 - 4, 5, N_("Pause after run")),

        /* Esc key mode */
        QUICK_INPUT (10, dlg_width, 11, dlg_height, (const char *) time_out, 8, 0,
                     MC_HISTORY_ESC_TIMEOUT, &time_out_new),
        QUICK_LABEL (5, dlg_width, 11, dlg_height, N_("Timeout:")),
        QUICK_CHECKBOX (5, dlg_width, 10, dlg_height, N_("S&ingle press"), &old_esc_mode),
        QUICK_GROUPBOX (3, dlg_width, 9, dlg_height, dlg_width / 2 - 4, 4, N_("Esc key mode")),

        /* file operation options */
        QUICK_CHECKBOX (5, dlg_width, 7, dlg_height, N_("Preallocate &space"),
                        &mc_global.vfs.preallocate_space),
        QUICK_CHECKBOX (5, dlg_width, 6, dlg_height, N_("Mkdi&r autoname"), &auto_fill_mkdir_name),
        QUICK_CHECKBOX (5, dlg_width, 5, dlg_height, N_("Classic pro&gressbar"),
                        &classic_progressbar),
        QUICK_CHECKBOX (5, dlg_width, 4, dlg_height, N_("Compute tota&ls"),
                        &file_op_compute_totals),
        QUICK_CHECKBOX (5, dlg_width, 3, dlg_height, N_("&Verbose operation"), &verbose),
        QUICK_GROUPBOX (3, dlg_width, 2, dlg_height, dlg_width / 2 - 4, 7,
                        N_("File operation options")),
        QUICK_END
    };

    const size_t qw_num = G_N_ELEMENTS (quick_widgets) - 1;

    QuickDialog Quick_input = {
        dlg_width, dlg_height, -1, -1,
        N_("Configure options"), "[Configuration]",
        quick_widgets, configure_callback, TRUE
    };

    int b0_len, b1_len;
    int b_len, c_len, g_len, l_len;
    size_t i;

#ifdef ENABLE_NLS
    for (i = 0; i < qw_num; i++)
        switch (i)
        {
        case 0:
        case 1:
            /* buttons */
            quick_widgets[i].u.button.text = _(quick_widgets[i].u.button.text);
            break;
        case 12:
        case 14:
        case 18:
        case 24:
            /* groupboxes */
            quick_widgets[i].u.groupbox.title = _(quick_widgets[i].u.groupbox.title);
            break;
        case 13:
            {
                /* radio button */
                size_t j;
                for (j = 0; j < (size_t) pause_options_num; j++)
                    pause_options[j] = _(pause_options[j]);
            }
            break;
        case 15:
            /* input line */
            break;
        case 16:
            /* label */
            quick_widgets[i].u.label.text = _(quick_widgets[i].u.label.text);
            break;
        default:
            /* checkboxes */
            quick_widgets[i].u.checkbox.text = _(quick_widgets[i].u.checkbox.text);
            break;
        }

    Quick_input.title = _(Quick_input.title);
#endif /* ENABLE_NLS */

    /* calculate widget and dialog widths */
    /* dialog title */
    dlg_width = max (dlg_width, str_term_width1 (Quick_input.title) + 4);
    /* buttons */
    b0_len = str_term_width1 (quick_widgets[0].u.button.text) + 3;
    b1_len = str_term_width1 (quick_widgets[1].u.button.text) + 5;
    b_len = b0_len + b1_len + 1;

    /* checkboxes within groupboxes */
    c_len = 0;
    for (i = 2; i < 24; i++)
        if ((i < 12) || (i == 17) || (i > 18))
            c_len = max (c_len, str_term_width1 (quick_widgets[i].u.checkbox.text) + 3);
    /* radiobuttons */
    for (i = 0; i < (size_t) pause_options_num; i++)
        c_len = max (c_len, str_term_width1 (pause_options[i]) + 3);
    /* label + input */
    l_len = str_term_width1 (quick_widgets[16].u.label.text);
    c_len = max (c_len, l_len + 1 + 8);
    /* groupboxes */
    g_len = max (c_len + 2, str_term_width1 (quick_widgets[24].u.groupbox.title) + 4);
    g_len = max (g_len, str_term_width1 (quick_widgets[18].u.groupbox.title) + 4);
    g_len = max (g_len, str_term_width1 (quick_widgets[14].u.groupbox.title) + 4);
    g_len = max (g_len, str_term_width1 (quick_widgets[12].u.groupbox.title) + 4);
    /* dialog width */
    Quick_input.xlen = max (dlg_width, g_len * 2 + 9);
    Quick_input.xlen = max (Quick_input.xlen, b_len + 2);
    if ((Quick_input.xlen & 1) != 0)
        Quick_input.xlen++;

    /* fix widget parameters */
    for (i = 0; i < qw_num; i++)
        quick_widgets[i].x_divisions = Quick_input.xlen;

    /* groupboxes */
    quick_widgets[14].u.groupbox.width =
        quick_widgets[18].u.groupbox.width =
        quick_widgets[24].u.groupbox.width = Quick_input.xlen / 2 - 4;
    quick_widgets[12].u.groupbox.width = Quick_input.xlen / 2 - 3;

    /* input */
    quick_widgets[15].relative_x = quick_widgets[16].relative_x + l_len + 1;
    quick_widgets[15].u.input.len = quick_widgets[18].u.groupbox.width - l_len - 4;

    /* right column */
    quick_widgets[12].relative_x = Quick_input.xlen / 2;
    for (i = 2; i < 12; i++)
        quick_widgets[i].relative_x = quick_widgets[12].relative_x + 2;

    /* buttons */
    quick_widgets[1].relative_x = (Quick_input.xlen - b_len) / 3;
    quick_widgets[0].relative_x = 2 * quick_widgets[1].relative_x + b1_len + 1;

    g_snprintf (time_out, sizeof (time_out), "%d", old_esc_mode_timeout);

    if (!old_esc_mode)
        quick_widgets[15].options = quick_widgets[16].options = W_DISABLED;

#ifndef HAVE_POSIX_FALLOCATE
    mc_global.vfs.preallocate_space = FALSE;
    quick_widgets[19].options = W_DISABLED;
#endif

    if (quick_dialog (&Quick_input) == B_ENTER)
        old_esc_mode_timeout = atoi (time_out_new);

    g_free (time_out_new);
}
Beispiel #16
0
gboolean
mcview_dialog_goto (WView * view, off_t * offset)
{
    typedef enum
    {
        MC_VIEW_GOTO_LINENUM = 0,
        MC_VIEW_GOTO_PERCENT = 1,
        MC_VIEW_GOTO_OFFSET_DEC = 2,
        MC_VIEW_GOTO_OFFSET_HEX = 3
    } mcview_goto_type_t;

    const char *mc_view_goto_str[] = {
        N_("&Line number"),
        N_("Pe&rcents"),
        N_("&Decimal offset"),
        N_("He&xadecimal offset")
    };

    static mcview_goto_type_t current_goto_type = MC_VIEW_GOTO_LINENUM;

    size_t num_of_types;
    char *exp = NULL;
    int qd_result;
    gboolean res;

    num_of_types = G_N_ELEMENTS (mc_view_goto_str);

#ifdef ENABLE_NLS
    {
        size_t i;

        for (i = 0; i < num_of_types; i++)
            mc_view_goto_str[i] = _(mc_view_goto_str[i]);
    }
#endif

    {
        quick_widget_t quick_widgets[] = {
            /* *INDENT-OFF* */
            QUICK_INPUT (INPUT_LAST_TEXT, MC_HISTORY_VIEW_GOTO, &exp, NULL,
                         FALSE, FALSE, INPUT_COMPLETE_NONE),
            QUICK_RADIO (num_of_types, (const char **) mc_view_goto_str, (int *) &current_goto_type,
                         NULL),
            QUICK_BUTTONS_OK_CANCEL,
            QUICK_END
            /* *INDENT-ON* */
        };

        quick_dialog_t qdlg = {
            -1, -1, 40,
            N_("Goto"), "[Input Line Keys]",
            quick_widgets, NULL, NULL
        };

        /* run dialog */
        qd_result = quick_dialog (&qdlg);
    }

    *offset = -1;

    /* check input line value */
    res = (qd_result != B_CANCEL && exp != NULL && exp[0] != '\0');
    if (res)
    {
        int base = (current_goto_type == MC_VIEW_GOTO_OFFSET_HEX) ? 16 : 10;
        off_t addr;
        char *error;

        addr = (off_t) g_ascii_strtoll (exp, &error, base);
        if ((*error == '\0') && (addr >= 0))
        {
            switch (current_goto_type)
            {
            case MC_VIEW_GOTO_LINENUM:
                /* Line number entered by user is 1-based. */
                if (addr > 0)
                    addr--;
                mcview_coord_to_offset (view, offset, addr, 0);
                *offset = mcview_bol (view, *offset, 0);
                break;
            case MC_VIEW_GOTO_PERCENT:
                if (addr > 100)
                    addr = 100;
                /* read all data from pipe to get real size */
                if (view->growbuf_in_use)
                    mcview_growbuf_read_all_data (view);
                *offset = addr * mcview_get_filesize (view) / 100;
                if (!view->mode_flags.hex)
                    *offset = mcview_bol (view, *offset, 0);
                break;
            case MC_VIEW_GOTO_OFFSET_DEC:
            case MC_VIEW_GOTO_OFFSET_HEX:
                if (!view->mode_flags.hex)
                {
                    if (view->growbuf_in_use)
                        mcview_growbuf_read_until (view, addr);

                    *offset = mcview_bol (view, addr, 0);
                }
                else
                {
                    /* read all data from pipe to get real size */
                    if (view->growbuf_in_use)
                        mcview_growbuf_read_all_data (view);

                    *offset = addr;
                    addr = mcview_get_filesize (view);
                    if (*offset > addr)
                        *offset = addr;
                }
                break;
            default:
                *offset = 0;
                break;
            }
        }
    }

    g_free (exp);
    return res;
}
Beispiel #17
0
gboolean
mcview_dialog_search (WView * view)
{
    char *exp = NULL;
    int qd_result;
    size_t num_of_types = 0;
    gchar **list_of_types;

    list_of_types = mc_search_get_types_strings_array (&num_of_types);

    {
        quick_widget_t quick_widgets[] = {
            /* *INDENT-OFF* */
            QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above,
                                 INPUT_LAST_TEXT, MC_HISTORY_SHARED_SEARCH, &exp,
                                 NULL, FALSE, FALSE, INPUT_COMPLETE_NONE),
            QUICK_SEPARATOR (TRUE),
            QUICK_START_COLUMNS,
                QUICK_RADIO (num_of_types, (const char **) list_of_types,
                             (int *) &mcview_search_options.type, NULL),
            QUICK_NEXT_COLUMN,
                QUICK_CHECKBOX (N_("Cas&e sensitive"), &mcview_search_options.case_sens, NULL),
                QUICK_CHECKBOX (N_("&Backwards"), &mcview_search_options.backwards, NULL),
                QUICK_CHECKBOX (N_("&Whole words"), &mcview_search_options.whole_words, NULL),
#ifdef HAVE_CHARSET
                QUICK_CHECKBOX (N_("&All charsets"), &mcview_search_options.all_codepages, NULL),
#endif
            QUICK_STOP_COLUMNS,
            QUICK_BUTTONS_OK_CANCEL,
            QUICK_END
            /* *INDENT-ON* */
        };

        quick_dialog_t qdlg = {
            -1, -1, 58,
            N_("Search"), "[Input Line Keys]",
            quick_widgets, NULL, NULL
        };

        qd_result = quick_dialog (&qdlg);
    }

    g_strfreev (list_of_types);

    if ((qd_result == B_CANCEL) || (exp == NULL) || (exp[0] == '\0'))
    {
        g_free (exp);
        return FALSE;
    }

#ifdef HAVE_CHARSET
    {
        GString *tmp;

        tmp = str_convert_to_input (exp);
        g_free (exp);
        exp = g_string_free (tmp, FALSE);
    }
#endif

    g_free (view->last_search_string);
    view->last_search_string = exp;
    mcview_nroff_seq_free (&view->search_nroff_seq);
    mc_search_free (view->search);

#ifdef HAVE_CHARSET
    view->search = mc_search_new (view->last_search_string, cp_source);
#else
    view->search = mc_search_new (view->last_search_string, NULL);
#endif
    view->search_nroff_seq = mcview_nroff_seq_new (view);
    if (view->search != NULL)
    {
        view->search->search_type = mcview_search_options.type;
#ifdef HAVE_CHARSET
        view->search->is_all_charsets = mcview_search_options.all_codepages;
#endif
        view->search->is_case_sensitive = mcview_search_options.case_sens;
        view->search->whole_words = mcview_search_options.whole_words;
        view->search->search_fn = mcview_search_cmd_callback;
        view->search->update_fn = mcview_search_update_cmd_callback;
    }

    return (view->search != NULL);
}
Beispiel #18
0
void
edit_options_dialog (WDialog * h)
{
    char wrap_length[16], tab_spacing[16];
    char *p, *q;
    int wrap_mode = 0;
    int old_syntax_hl;

#ifdef ENABLE_NLS
    static gboolean i18n_flag = FALSE;

    if (!i18n_flag)
    {
        i18n_translate_array (wrap_str);
        i18n_flag = TRUE;
    }
#endif /* ENABLE_NLS */

    g_snprintf (wrap_length, sizeof (wrap_length), "%d", option_word_wrap_line_length);
    g_snprintf (tab_spacing, sizeof (tab_spacing), "%d", option_tab_spacing);

    if (option_auto_para_formatting)
        wrap_mode = 1;
    else if (option_typewriter_wrap)
        wrap_mode = 2;
    else
        wrap_mode = 0;

    {
        quick_widget_t quick_widgets[] = {
            /* *INDENT-OFF* */
            QUICK_START_COLUMNS,
                QUICK_START_GROUPBOX (N_("Wrap mode")),
                    QUICK_RADIO (3, wrap_str, &wrap_mode, NULL),
                QUICK_STOP_GROUPBOX,
                QUICK_SEPARATOR (FALSE),
                QUICK_SEPARATOR (FALSE),
                QUICK_START_GROUPBOX (N_("Tabulation")),
                    QUICK_CHECKBOX (N_("&Fake half tabs"), &option_fake_half_tabs, NULL),
                    QUICK_CHECKBOX (N_("&Backspace through tabs"), &option_backspace_through_tabs,
                                    NULL),
                    QUICK_CHECKBOX (N_("Fill tabs with &spaces"), &option_fill_tabs_with_spaces,
                                    NULL),
                    QUICK_LABELED_INPUT (N_("Tab spacing:"), input_label_left, tab_spacing,
                                          "edit-tab-spacing", &q, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE),
                QUICK_STOP_GROUPBOX,
            QUICK_NEXT_COLUMN,
                QUICK_START_GROUPBOX (N_("Other options")),
                    QUICK_CHECKBOX (N_("&Return does autoindent"), &option_return_does_auto_indent,
                                    NULL),
                    QUICK_CHECKBOX (N_("Confir&m before saving"), &edit_confirm_save, NULL),
                    QUICK_CHECKBOX (N_("Save file &position"), &option_save_position, NULL),
                    QUICK_CHECKBOX (N_("&Visible trailing spaces"), &visible_tws, NULL),
                    QUICK_CHECKBOX (N_("Visible &tabs"), &visible_tabs, NULL),
                    QUICK_CHECKBOX (N_("Synta&x highlighting"), &option_syntax_highlighting, NULL),
                    QUICK_CHECKBOX (N_("C&ursor after inserted block"), &option_cursor_after_inserted_block, NULL),
                    QUICK_CHECKBOX (N_("Pers&istent selection"), &option_persistent_selections,
                                     NULL),
                    QUICK_CHECKBOX (N_("Cursor be&yond end of line"), &option_cursor_beyond_eol,
                                     NULL),
                    QUICK_CHECKBOX (N_("&Group undo"), &option_group_undo, NULL),
                    QUICK_LABELED_INPUT (N_("Word wrap line length:"), input_label_left, wrap_length,
                                         "edit-word-wrap", &p, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE),
                QUICK_STOP_GROUPBOX,
            QUICK_STOP_COLUMNS,
            QUICK_BUTTONS_OK_CANCEL,
            QUICK_END
            /* *INDENT-ON* */
        };

        quick_dialog_t qdlg = {
            -1, -1, 74,
            N_("Editor options"), "[Editor options]",
            quick_widgets, NULL, NULL
        };

        if (quick_dialog (&qdlg) == B_CANCEL)
            return;
    }

    old_syntax_hl = option_syntax_highlighting;

    if (!option_cursor_beyond_eol)
        g_list_foreach (h->widgets, edit_reset_over_col, NULL);

    if (p != NULL)
    {
        option_word_wrap_line_length = atoi (p);
        if (option_word_wrap_line_length <= 0)
            option_word_wrap_line_length = DEFAULT_WRAP_LINE_LENGTH;
        g_free (p);
    }

    if (q != NULL)
    {
        option_tab_spacing = atoi (q);
        if (option_tab_spacing <= 0)
            option_tab_spacing = DEFAULT_TAB_SPACING;
        g_free (q);
    }

    if (wrap_mode == 1)
    {
        option_auto_para_formatting = 1;
        option_typewriter_wrap = 0;
    }
    else if (wrap_mode == 2)
    {
        option_auto_para_formatting = 0;
        option_typewriter_wrap = 1;
    }
    else
    {
        option_auto_para_formatting = 0;
        option_typewriter_wrap = 0;
    }

    /* Load or unload syntax rules if the option has changed */
    if (option_syntax_highlighting != old_syntax_hl)
        g_list_foreach (h->widgets, edit_reload_syntax, NULL);
}