1
1

Applied MC indentation policy.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
Andrew Borodin 2010-06-14 14:04:02 +04:00
родитель dce8010059
Коммит 8bcc49900b
3 изменённых файлов: 619 добавлений и 531 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
*/
/** \file
* \brief Source: editor options dialog box
@ -29,21 +29,20 @@
#include <config.h>
#include <stdlib.h> /* atoi(), NULL */
#include <stdlib.h> /* atoi(), NULL */
#include "lib/global.h"
#include "edit-widget.h"
#include "edit-impl.h"
#include "src/dialog.h" /* B_CANCEL */
#include "src/wtools.h" /* QuickDialog */
#include "src/setup.h" /* option_tab_spacing */
#include "src/dialog.h" /* B_CANCEL */
#include "src/wtools.h" /* QuickDialog */
#include "src/setup.h" /* option_tab_spacing */
#define OPT_DLG_H 16
#define OPT_DLG_W 74
static const char *wrap_str[] =
{
static const char *wrap_str[] = {
N_("None"),
N_("Dynamic paragraphing"),
N_("Type writer wrap"),
@ -54,119 +53,124 @@ static const char *wrap_str[] =
static void
i18n_translate_array (const char *array[])
{
while (*array != NULL) {
*array = _(*array);
while (*array != NULL)
{
*array = _(*array);
array++;
}
}
#endif /* ENABLE_NLS */
#endif /* ENABLE_NLS */
void
edit_options_dialog (WEdit *edit)
edit_options_dialog (WEdit * edit)
{
char wrap_length[16], tab_spacing[16], *p, *q;
int wrap_mode = 0;
int old_syntax_hl;
QuickWidget quick_widgets[] =
{
/* 0 */ QUICK_BUTTON (6, 10, OPT_DLG_H - 3, OPT_DLG_H, N_("&Cancel"), B_CANCEL, NULL),
/* 1 */ QUICK_BUTTON (2, 10, OPT_DLG_H - 3, OPT_DLG_H, N_("&OK"), B_ENTER, NULL),
/* 2 */ QUICK_LABEL (OPT_DLG_W / 2 + 1, OPT_DLG_W, 11, OPT_DLG_H,
N_("Word wrap line length:")),
/* 3 */ QUICK_INPUT (OPT_DLG_W / 2 + 25, OPT_DLG_W, 11, OPT_DLG_H,
wrap_length, OPT_DLG_W / 2 - 4 - 24, 0, "edit-word-wrap", &p),
/* 4 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 10, OPT_DLG_H,
N_("Cursor beyond end of line"), &option_cursor_beyond_eol),
/* 5 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 9, OPT_DLG_H,
N_("Pers&istent selection"), &option_persistent_selections),
/* 6 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 8, OPT_DLG_H,
N_("Synta&x highlighting"), &option_syntax_highlighting),
/* 7 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 7, OPT_DLG_H,
N_("Visible tabs"), &visible_tabs),
/* 8 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 6, OPT_DLG_H,
N_("Visible trailing spaces"), &visible_tws),
/* 9 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 5, OPT_DLG_H,
N_("Save file &position"), &option_save_position),
/* 10 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 4, OPT_DLG_H,
N_("Confir&m before saving"), &edit_confirm_save),
/* 11 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 3, OPT_DLG_H,
N_("&Return does autoindent"), &option_return_does_auto_indent),
/* 12 */ QUICK_LABEL (3, OPT_DLG_W, 11, OPT_DLG_H, N_("Tab spacing:")),
/* 13 */ QUICK_INPUT (3 + 24, OPT_DLG_W, 11, OPT_DLG_H,
tab_spacing, OPT_DLG_W / 2 - 4 - 24, 0, "edit-tab-spacing", &q),
/* 14 */ QUICK_CHECKBOX (3, OPT_DLG_W, 10, OPT_DLG_H,
N_("Fill tabs with &spaces"), &option_fill_tabs_with_spaces),
/* 15 */ QUICK_CHECKBOX (3, OPT_DLG_W, 9, OPT_DLG_H,
N_("&Backspace through tabs"), &option_backspace_through_tabs),
/* 16 */ QUICK_CHECKBOX (3, OPT_DLG_W, 8, OPT_DLG_H,
N_("&Fake half tabs"), &option_fake_half_tabs),
/* 17 */ QUICK_RADIO (4, OPT_DLG_W, 4, OPT_DLG_H, 3, wrap_str, &wrap_mode),
/* 18 */ QUICK_LABEL (3, OPT_DLG_W, 3, OPT_DLG_H, N_("Wrap mode")),
QUICK_END
QuickWidget quick_widgets[] = {
/* 0 */ QUICK_BUTTON (6, 10, OPT_DLG_H - 3, OPT_DLG_H, N_("&Cancel"), B_CANCEL, NULL),
/* 1 */ QUICK_BUTTON (2, 10, OPT_DLG_H - 3, OPT_DLG_H, N_("&OK"), B_ENTER, NULL),
/* 2 */ QUICK_LABEL (OPT_DLG_W / 2 + 1, OPT_DLG_W, 11, OPT_DLG_H,
N_("Word wrap line length:")),
/* 3 */ QUICK_INPUT (OPT_DLG_W / 2 + 25, OPT_DLG_W, 11, OPT_DLG_H,
wrap_length, OPT_DLG_W / 2 - 4 - 24, 0, "edit-word-wrap", &p),
/* 4 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 10, OPT_DLG_H,
N_("Cursor beyond end of line"), &option_cursor_beyond_eol),
/* 5 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 9, OPT_DLG_H,
N_("Pers&istent selection"), &option_persistent_selections),
/* 6 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 8, OPT_DLG_H,
N_("Synta&x highlighting"), &option_syntax_highlighting),
/* 7 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 7, OPT_DLG_H,
N_("Visible tabs"), &visible_tabs),
/* 8 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 6, OPT_DLG_H,
N_("Visible trailing spaces"), &visible_tws),
/* 9 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 5, OPT_DLG_H,
N_("Save file &position"), &option_save_position),
/* 10 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 4, OPT_DLG_H,
N_("Confir&m before saving"), &edit_confirm_save),
/* 11 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 3, OPT_DLG_H,
N_("&Return does autoindent"), &option_return_does_auto_indent),
/* 12 */ QUICK_LABEL (3, OPT_DLG_W, 11, OPT_DLG_H, N_("Tab spacing:")),
/* 13 */ QUICK_INPUT (3 + 24, OPT_DLG_W, 11, OPT_DLG_H,
tab_spacing, OPT_DLG_W / 2 - 4 - 24, 0, "edit-tab-spacing", &q),
/* 14 */ QUICK_CHECKBOX (3, OPT_DLG_W, 10, OPT_DLG_H,
N_("Fill tabs with &spaces"), &option_fill_tabs_with_spaces),
/* 15 */ QUICK_CHECKBOX (3, OPT_DLG_W, 9, OPT_DLG_H,
N_("&Backspace through tabs"), &option_backspace_through_tabs),
/* 16 */ QUICK_CHECKBOX (3, OPT_DLG_W, 8, OPT_DLG_H,
N_("&Fake half tabs"), &option_fake_half_tabs),
/* 17 */ QUICK_RADIO (4, OPT_DLG_W, 4, OPT_DLG_H, 3, wrap_str, &wrap_mode),
/* 18 */ QUICK_LABEL (3, OPT_DLG_W, 3, OPT_DLG_H, N_("Wrap mode")),
QUICK_END
};
QuickDialog Quick_options =
{
OPT_DLG_W, OPT_DLG_H, -1, -1, N_("Editor options"),
"[Editor options]", quick_widgets, FALSE
};
QuickDialog Quick_options = {
OPT_DLG_W, OPT_DLG_H, -1, -1, N_("Editor options"),
"[Editor options]", quick_widgets, FALSE
};
#ifdef ENABLE_NLS
static gboolean i18n_flag = FALSE;
if (!i18n_flag) {
i18n_translate_array (wrap_str);
i18n_flag = TRUE;
if (!i18n_flag)
{
i18n_translate_array (wrap_str);
i18n_flag = TRUE;
}
#endif /* ENABLE_NLS */
#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);
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;
wrap_mode = 1;
else if (option_typewriter_wrap)
wrap_mode = 2;
wrap_mode = 2;
else
wrap_mode = 0;
wrap_mode = 0;
if (quick_dialog (&Quick_options) == B_CANCEL)
return;
return;
old_syntax_hl = option_syntax_highlighting;
if (!option_cursor_beyond_eol)
edit->over_col = 0;
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 (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 (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;
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)
edit_load_syntax (edit, NULL, edit->syntax_type);
edit_load_syntax (edit, NULL, edit->syntax_type);
}

Просмотреть файл

@ -60,15 +60,15 @@ extern int clear_before_exec;
extern int source_codepage;
extern int default_source_codepage;
extern int display_codepage;
extern char* autodetect_codeset;
extern char *autodetect_codeset;
extern gboolean is_autodetect_codeset_enabled;
#else
extern int eight_bit_clean;
extern int full_eight_bits;
#endif /* !HAVE_CHARSET */
extern char* clipbord_store_path;
extern char* clipbord_paste_path;
extern char *clipbord_store_path;
extern char *clipbord_paste_path;
extern int utf8_display;
@ -76,7 +76,7 @@ extern int fast_refresh;
extern int drop_menus;
extern int cd_symlinks;
extern int show_all_if_ambiguous;
extern int update_prompt; /* To comunicate with subshell */
extern int update_prompt; /* To comunicate with subshell */
extern int safe_delete;
extern int confirm_delete;
extern int confirm_directory_hotlist_delete;
@ -94,7 +94,7 @@ extern int midnight_shutdown;
extern char *shell;
extern int auto_fill_mkdir_name;
/* Ugly hack in order to distinguish between left and right panel in menubar */
extern int is_right; /* If the selected menu was the right */
extern int is_right; /* If the selected menu was the right */
#define MENU_PANEL (is_right ? right_panel : left_panel)
#define MENU_PANEL_IDX (is_right ? 1 : 0)
#define SELECTED_IS_PANEL (get_display_type (is_right ? 1 : 0) == view_listing)
@ -104,23 +104,23 @@ void do_update_prompt (void);
int load_prompt (int fd, void *unused);
#endif
enum cd_enum {
enum cd_enum
{
cd_parse_command,
cd_exact
};
int do_cd (const char *new_dir, enum cd_enum cd_type); /* For find.c */
int do_cd (const char *new_dir, enum cd_enum cd_type); /* For find.c */
void sort_cmd (void);
void change_panel (void);
void change_panel (void);
void save_cwds_stat (void);
void quiet_quit_cmd (void); /* For cmd.c and command.c */
void quiet_quit_cmd (void); /* For cmd.c and command.c */
void touch_bar (void);
void touch_bar (void);
void update_xterm_title_path (void);
void load_hint (int force);
void load_hint (int force);
void print_vfs_message(const char *msg, ...)
__attribute__ ((format (__printf__, 1, 2)));
void print_vfs_message (const char *msg, ...) __attribute__ ((format (__printf__, 1, 2)));
extern const char *mc_prompt;
extern char *mc_home;
@ -141,4 +141,4 @@ struct WPanel;
void directory_history_add (struct WPanel *panel, const char *dir);
int do_panel_cd (struct WPanel *panel, const char *new_dir, enum cd_enum cd_type);
#endif /* MC_MAIN_H */
#endif /* MC_MAIN_H */