Revision: 2580 http://geany.svn.sourceforge.net/geany/?rev=2580&view=rev Author: eht16 Date: 2008-05-14 08:36:27 -0700 (Wed, 14 May 2008)
Log Message: ----------- Add preferences for default end of line characters for new files (closes #1895362) and to disable the automatic continuation of multi-line comments in C-like languages. Enable multi-line continuation also for CSS files.
Modified Paths: -------------- trunk/ChangeLog trunk/doc/geany.html trunk/doc/geany.txt trunk/geany.glade trunk/src/document.c trunk/src/document.h trunk/src/editor.c trunk/src/editor.h trunk/src/interface.c trunk/src/keyfile.c trunk/src/plugindata.h trunk/src/prefs.c trunk/src/prefs.h trunk/src/utils.c trunk/src/utils.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/ChangeLog 2008-05-14 15:36:27 UTC (rev 2580) @@ -1,3 +1,15 @@ +2008-05-14 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * geany.glade, src/document.c, src/document.h, src/editor.c, + src/editor.h, src/interface.c, src/keyfile.c, src/plugindata.h, + src/prefs.c, src/prefs.h, src/utils.c, src/utils.h, doc/geany.txt, + doc/geany.html: + Add preferences for default end of line characters for new files + (closes #1895362) and to disable the automatic continuation of + multi-line comments in C-like languages. + Enable multi-line continuation also for CSS files. + + 2008-05-14 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/templates.c:
Modified: trunk/doc/geany.html =================================================================== --- trunk/doc/geany.html 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/doc/geany.html 2008-05-14 15:36:27 UTC (rev 2580) @@ -3,10 +3,10 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" /> +<meta name="generator" content="Docutils 0.4.1: http://docutils.sourceforge.net/" /> <title>Geany</title> <meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" /> -<meta name="date" content="2008-05-09" /> +<meta name="date" content="2008-05-13" /> <style type="text/css">
/* @@ -133,7 +133,7 @@ <br />Nick Treleaven <br />Frank Lanitz</td></tr> <tr><th class="docinfo-name">Date:</th> -<td>2008-05-09</td></tr> +<td>2008-05-13</td></tr> <tr><th class="docinfo-name">Version:</th> <td>0.15</td></tr> </tbody> @@ -1747,6 +1747,23 @@ See <a class="reference" href="#user-definable-snippets">User-definable snippets</a>.</dd> <dt>XML tag autocompletion</dt> <dd>When you open an XML tag automatically generate its completion tag.</dd> +<dt>Automatic continuation multi-line comments</dt> +<dd><p class="first">Continue automatically multi-line comments in languages like C, C++ +and Java when a new line is entered inside such a comment. +With this option enabled, Geany will insert a <tt class="docutils literal"><span class="pre">*</span></tt> on every new line +inside a multi-line comment, for example when you press return in the +following C code:</p> +<pre class="literal-block"> +/* + * This is a C multi-line comment, press <Return> +</pre> +<p>then Geany would insert:</p> +<pre class="literal-block"> +* +</pre> +<p class="last">on the next line with the correct indentation based on the previous line, +as long as the multi-line is not closed by <tt class="docutils literal"><span class="pre">*/</span></tt>.</p> +</dd> <dt>Automatic symbol completion</dt> <dd>When you start to type a symbol name, look for the full string to allow it to be completed for you.</dd> @@ -1771,6 +1788,11 @@ <dt>Default encoding (existing files)</dt> <dd>Opens all files with the specified encoding instead of auto-detecting it. Use this option when it's not possible for Geany to detect the exact encoding.</dd> +<dt>Default end of line characters</dt> +<dd>The end of line characters to which should be used for new files. +On Windows systems, you generally want to use CR/LF which are the common +characters to mark line breaks. +On Unix-like systems, LF is default and CR is used on MAC systems.</dd> </dl> </div> <div class="section"> @@ -4085,7 +4107,7 @@ <div class="footer"> <hr class="footer" /> <a class="reference" href="geany.txt">View document source</a>. -Generated on: 2008-05-13 17:12 UTC. +Generated on: 2008-05-14 14:29 UTC. Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
Modified: trunk/doc/geany.txt =================================================================== --- trunk/doc/geany.txt 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/doc/geany.txt 2008-05-14 15:36:27 UTC (rev 2580) @@ -1535,6 +1535,23 @@ XML tag autocompletion When you open an XML tag automatically generate its completion tag.
+Automatic continuation multi-line comments + Continue automatically multi-line comments in languages like C, C++ + and Java when a new line is entered inside such a comment. + With this option enabled, Geany will insert a ``*`` on every new line + inside a multi-line comment, for example when you press return in the + following C code:: + + /* + * This is a C multi-line comment, press <Return> + + then Geany would insert:: + + * + + on the next line with the correct indentation based on the previous line, + as long as the multi-line is not closed by ``*/``. + Automatic symbol completion When you start to type a symbol name, look for the full string to allow it to be completed for you. @@ -1565,6 +1582,12 @@ Opens all files with the specified encoding instead of auto-detecting it. Use this option when it's not possible for Geany to detect the exact encoding.
+Default end of line characters + The end of line characters to which should be used for new files. + On Windows systems, you generally want to use CR/LF which are the common + characters to mark line breaks. + On Unix-like systems, LF is default and CR is used on MAC systems. + Saving files ```````````` Perform special formatting operations when a document is saved. These
Modified: trunk/geany.glade =================================================================== --- trunk/geany.glade 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/geany.glade 2008-05-14 15:36:27 UTC (rev 2580) @@ -6311,6 +6311,26 @@ </child>
<child> + <widget class="GtkCheckButton" id="check_auto_multiline"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Continue automatically multi-line comments in languages like C, C++ and Java when a new line is entered inside such a comment.</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Automatic continuation multi-line comments</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">False</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> <widget class="GtkCheckButton" id="check_symbol_auto_completion"> <property name="visible">True</property> <property name="tooltip" translatable="yes">Automatic completion of known symbols in open files (function names, global variables, ...)</property> @@ -6441,8 +6461,8 @@ </widget> <packing> <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="expand">True</property> + <property name="fill">True</property> </packing> </child> </widget> @@ -6543,7 +6563,7 @@ <child> <widget class="GtkTable" id="table5"> <property name="visible">True</property> - <property name="n_rows">3</property> + <property name="n_rows">4</property> <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">3</property> @@ -6676,6 +6696,50 @@ <property name="y_options"></property> </packing> </child> + + <child> + <widget class="GtkLabel" id="label210"> + <property name="visible">True</property> + <property name="label" translatable="yes">Default end of line characters:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkComboBox" id="combo_eol"> + <property name="visible">True</property> + <property name="add_tearoffs">False</property> + <property name="focus_on_click">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> </widget> <packing> <property name="padding">0</property>
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/src/document.c 2008-05-14 15:36:27 UTC (rev 2580) @@ -618,11 +618,12 @@ else sci_clear_all(doc_list[idx].sci);
-#ifdef G_OS_WIN32 - sci_set_eol_mode(doc_list[idx].sci, SC_EOL_CRLF); -#else - sci_set_eol_mode(doc_list[idx].sci, SC_EOL_LF); -#endif + sci_set_eol_mode(doc_list[idx].sci, prefs.default_eol_character); + /* convert the eol chars in the template text in case they are different from + * from prefs.default_eol */ + if (text != NULL) + sci_convert_eols(doc_list[idx].sci, prefs.default_eol_character); + document_set_use_tabs(idx, editor_prefs.use_tabs); sci_set_undo_collection(doc_list[idx].sci, TRUE); sci_empty_undo_buffer(doc_list[idx].sci);
Modified: trunk/src/document.h =================================================================== --- trunk/src/document.h 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/src/document.h 2008-05-14 15:36:27 UTC (rev 2580) @@ -34,7 +34,15 @@ #include "Scintilla.h" #include "ScintillaWidget.h"
+#if defined(G_OS_WIN32) +# define GEANY_DEFAULT_EOL_CHARACTER SC_EOL_CRLF +#elif defined(G_OS_UNIX) +# define GEANY_DEFAULT_EOL_CHARACTER SC_EOL_LF +#else +# define GEANY_DEFAULT_EOL_CHARACTER SC_EOL_CR +#endif
+ typedef struct FileEncoding { gchar *encoding;
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/src/editor.c 2008-05-14 15:36:27 UTC (rev 2580) @@ -614,17 +614,18 @@ check_python_indent(idx, pos); }
+ if (editor_prefs.auto_continue_multiline) + { /* " * " auto completion in multiline C/C++/D/Java comments */ + auto_multiline(idx, pos); + } + if (editor_prefs.complete_snippets) { - /* " * " auto completion in multiline C/C++/D/Java comments */ - auto_multiline(idx, pos); - editor_auto_latex(idx, pos); }
if (editor_prefs.newline_strip) - { - /* strip the trailing spaces on the previous line */ + { /* strip the trailing spaces on the previous line */ document_strip_line_trailing_spaces(idx, line - 1); } } @@ -2182,10 +2183,10 @@ ScintillaObject *sci = doc_list[idx].sci; gint style = SSM(sci, SCI_GETSTYLEAT, pos - 1 - utils_get_eol_char_len(idx), 0); gint lexer = SSM(sci, SCI_GETLEXER, 0, 0); - gint i;
if ((lexer == SCLEX_CPP && (style == SCE_C_COMMENT || style == SCE_C_COMMENTDOC)) || (lexer == SCLEX_HTML && style == SCE_HPHP_COMMENT) || + (lexer == SCLEX_CSS && style == SCE_CSS_COMMENT) || (lexer == SCLEX_D && (style == SCE_D_COMMENT || style == SCE_D_COMMENTDOC || style == SCE_D_COMMENTNESTED))) @@ -2196,6 +2197,7 @@ gchar *whitespace = ""; /* to hold whitespace if needed */ gchar *result; gint len = strlen(previous_line); + gint i;
/* find and stop at end of multi line comment */ i = len - 1;
Modified: trunk/src/editor.h =================================================================== --- trunk/src/editor.h 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/src/editor.h 2008-05-14 15:36:27 UTC (rev 2580) @@ -84,6 +84,7 @@ gboolean complete_snippets_whilst_editing; /* hidden pref */ gboolean detect_tab_mode; gint line_break_column; + gboolean auto_continue_multiline; } EditorPrefs;
extern EditorPrefs editor_prefs;
Modified: trunk/src/interface.c =================================================================== --- trunk/src/interface.c 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/src/interface.c 2008-05-14 15:36:27 UTC (rev 2580) @@ -2657,6 +2657,7 @@ GtkWidget *vbox19; GtkWidget *check_complete_snippets; GtkWidget *check_xmltag; + GtkWidget *check_auto_multiline; GtkWidget *check_symbol_auto_completion; GtkWidget *table14; GtkObject *spin_symbollistheight_adj; @@ -2679,6 +2680,8 @@ GtkWidget *eventbox3; GtkWidget *combo_open_encoding; GtkWidget *check_open_encoding; + GtkWidget *label210; + GtkWidget *combo_eol; GtkWidget *label109; GtkWidget *frame2; GtkWidget *alignment3; @@ -3819,6 +3822,12 @@ gtk_tooltips_set_tip (tooltips, check_xmltag, _("Automatic completion and closing of XML tags (includes HTML tags)"), NULL); gtk_button_set_focus_on_click (GTK_BUTTON (check_xmltag), FALSE);
+ check_auto_multiline = gtk_check_button_new_with_mnemonic (_("Automatic continuation multi-line comments")); + gtk_widget_show (check_auto_multiline); + gtk_box_pack_start (GTK_BOX (vbox19), check_auto_multiline, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, check_auto_multiline, _("Continue automatically multi-line comments in languages like C, C++ and Java when a new line is entered inside such a comment."), NULL); + gtk_button_set_focus_on_click (GTK_BUTTON (check_auto_multiline), FALSE); + check_symbol_auto_completion = gtk_check_button_new_with_mnemonic (_("Automatic symbol completion")); gtk_widget_show (check_symbol_auto_completion); gtk_box_pack_start (GTK_BOX (vbox19), check_symbol_auto_completion, FALSE, FALSE, 0); @@ -3827,7 +3836,7 @@
table14 = gtk_table_new (2, 2, FALSE); gtk_widget_show (table14); - gtk_box_pack_start (GTK_BOX (vbox19), table14, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox19), table14, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table14), 3); gtk_table_set_col_spacings (GTK_TABLE (table14), 12);
@@ -3890,7 +3899,7 @@ gtk_widget_show (vbox8); gtk_container_add (GTK_CONTAINER (alignment7), vbox8);
- table5 = gtk_table_new (3, 2, FALSE); + table5 = gtk_table_new (4, 2, FALSE); gtk_widget_show (table5); gtk_box_pack_start (GTK_BOX (vbox8), table5, FALSE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table5), 3); @@ -3939,6 +3948,19 @@ gtk_tooltips_set_tip (tooltips, check_open_encoding, _("This option disables the automatic detection of the file encoding when opening files and opens the file with the specified encoding (usually not needed)."), NULL); gtk_button_set_focus_on_click (GTK_BUTTON (check_open_encoding), FALSE);
+ label210 = gtk_label_new (_("Default end of line characters:")); + gtk_widget_show (label210); + gtk_table_attach (GTK_TABLE (table5), label210, 0, 1, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label210), 0, 0.5); + + combo_eol = gtk_combo_box_new_text (); + gtk_widget_show (combo_eol); + gtk_table_attach (GTK_TABLE (table5), combo_eol, 1, 2, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + label109 = gtk_label_new (_("<b>New files</b>")); gtk_widget_show (label109); gtk_frame_set_label_widget (GTK_FRAME (frame6), label109); @@ -4688,6 +4710,7 @@ GLADE_HOOKUP_OBJECT (prefs_dialog, vbox19, "vbox19"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_complete_snippets, "check_complete_snippets"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_xmltag, "check_xmltag"); + GLADE_HOOKUP_OBJECT (prefs_dialog, check_auto_multiline, "check_auto_multiline"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_symbol_auto_completion, "check_symbol_auto_completion"); GLADE_HOOKUP_OBJECT (prefs_dialog, table14, "table14"); GLADE_HOOKUP_OBJECT (prefs_dialog, spin_symbollistheight, "spin_symbollistheight"); @@ -4708,6 +4731,8 @@ GLADE_HOOKUP_OBJECT (prefs_dialog, eventbox3, "eventbox3"); GLADE_HOOKUP_OBJECT (prefs_dialog, combo_open_encoding, "combo_open_encoding"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_open_encoding, "check_open_encoding"); + GLADE_HOOKUP_OBJECT (prefs_dialog, label210, "label210"); + GLADE_HOOKUP_OBJECT (prefs_dialog, combo_eol, "combo_eol"); GLADE_HOOKUP_OBJECT (prefs_dialog, label109, "label109"); GLADE_HOOKUP_OBJECT (prefs_dialog, frame2, "frame2"); GLADE_HOOKUP_OBJECT (prefs_dialog, alignment3, "alignment3");
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/src/keyfile.c 2008-05-14 15:36:27 UTC (rev 2580) @@ -241,6 +241,7 @@ g_key_file_set_boolean(config, PACKAGE, "pref_editor_smart_home_key", editor_prefs.smart_home_key); g_key_file_set_boolean(config, PACKAGE, "pref_editor_newline_strip", editor_prefs.newline_strip); g_key_file_set_integer(config, PACKAGE, "line_break_column", editor_prefs.line_break_column); + g_key_file_set_boolean(config, PACKAGE, "auto_continue_multiline", editor_prefs.auto_continue_multiline);
/* files */ g_key_file_set_string(config, PACKAGE, "pref_editor_default_new_encoding", encodings[prefs.default_new_encoding].charset); @@ -248,6 +249,7 @@ g_key_file_set_string(config, PACKAGE, "pref_editor_default_open_encoding", "none"); else g_key_file_set_string(config, PACKAGE, "pref_editor_default_open_encoding", encodings[prefs.default_open_encoding].charset); + g_key_file_set_integer(config, PACKAGE, "default_eol_character", prefs.default_eol_character); g_key_file_set_boolean(config, PACKAGE, "pref_editor_new_line", prefs.final_new_line); g_key_file_set_boolean(config, PACKAGE, "pref_editor_replace_tabs", prefs.replace_tabs); g_key_file_set_boolean(config, PACKAGE, "pref_editor_trail_space", prefs.strip_trailing_spaces); @@ -548,6 +550,7 @@ editor_prefs.complete_snippets_whilst_editing = utils_get_setting_boolean(config, PACKAGE, "complete_snippets_whilst_editing", FALSE); editor_prefs.scroll_stop_at_last_line = utils_get_setting_boolean(config, PACKAGE, "scroll_stop_at_last_line", FALSE); editor_prefs.line_break_column = utils_get_setting_integer(config, PACKAGE, "line_break_column", 72); + editor_prefs.auto_continue_multiline = utils_get_setting_boolean(config, PACKAGE, "auto_continue_multiline", TRUE);
/* Files * use current locale encoding as default for new files (should be UTF-8 in most cases) */ @@ -576,6 +579,7 @@
g_free(tmp_string); } + prefs.default_eol_character = utils_get_setting_integer(config, PACKAGE, "default_eol_character", GEANY_DEFAULT_EOL_CHARACTER); prefs.replace_tabs = utils_get_setting_boolean(config, PACKAGE, "pref_editor_replace_tabs", FALSE); prefs.final_new_line = utils_get_setting_boolean(config, PACKAGE, "pref_editor_new_line", TRUE); prefs.strip_trailing_spaces = utils_get_setting_boolean(config, PACKAGE, "pref_editor_trail_space", FALSE);
Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/src/plugindata.h 2008-05-14 15:36:27 UTC (rev 2580) @@ -35,12 +35,12 @@
/* The API version should be incremented whenever any plugin data types below are * modified or appended to. */ -static const gint api_version = 57; +static const gint api_version = 58;
/* The ABI version should be incremented whenever existing fields in the plugin * data types below have to be changed or reordered. It should stay the same if fields * are only appended, as this doesn't affect existing fields. */ -static const gint abi_version = 27; +static const gint abi_version = 28;
/** Check the plugin can be loaded by Geany. * This performs runtime checks that try to ensure:
Modified: trunk/src/prefs.c =================================================================== --- trunk/src/prefs.c 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/src/prefs.c 2008-05-14 15:36:27 UTC (rev 2580) @@ -338,10 +338,6 @@ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), file_prefs.disk_check_timeout);
- /* Editor settings */ - widget = lookup_widget(ui_widgets.prefs_dialog, "spin_tab_width"); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.tab_width); - widget = lookup_widget(ui_widgets.prefs_dialog, "combo_new_encoding"); /* luckily the index of the combo box items match the index of the encodings array */ gtk_combo_box_set_active(GTK_COMBO_BOX(widget), prefs.default_new_encoding); @@ -359,12 +355,24 @@ else gtk_combo_box_set_active(GTK_COMBO_BOX(widget), GEANY_ENCODING_UTF_8);
+ widget = lookup_widget(ui_widgets.prefs_dialog, "combo_eol"); + if (prefs.default_eol_character >= 0 && prefs.default_eol_character < 3) + { + gtk_combo_box_set_active(GTK_COMBO_BOX(widget), prefs.default_eol_character); + } + else + gtk_combo_box_set_active(GTK_COMBO_BOX(widget), GEANY_DEFAULT_EOL_CHARACTER); + widget = lookup_widget(ui_widgets.prefs_dialog, "check_trailing_spaces"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.strip_trailing_spaces);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_new_line"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.final_new_line);
+ /* Editor settings */ + widget = lookup_widget(ui_widgets.prefs_dialog, "spin_tab_width"); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.tab_width); + widget = lookup_widget(ui_widgets.prefs_dialog, "check_replace_tabs"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.replace_tabs);
@@ -418,6 +426,9 @@ widget = lookup_widget(ui_widgets.prefs_dialog, "check_indicators"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.use_indicators);
+ widget = lookup_widget(ui_widgets.prefs_dialog, "check_auto_multiline"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_continue_multiline); + widget = lookup_widget(ui_widgets.prefs_dialog, "check_symbol_auto_completion"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_complete_symbols);
@@ -728,11 +739,6 @@ widget = lookup_widget(ui_widgets.prefs_dialog, "spin_disk_check"); file_prefs.disk_check_timeout = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
- - /* Editor settings */ - widget = lookup_widget(ui_widgets.prefs_dialog, "spin_tab_width"); - editor_prefs.tab_width = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); - widget = lookup_widget(ui_widgets.prefs_dialog, "combo_new_encoding"); prefs.default_new_encoding = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
@@ -745,6 +751,9 @@ else prefs.default_open_encoding = -1;
+ widget = lookup_widget(ui_widgets.prefs_dialog, "combo_eol"); + prefs.default_eol_character = gtk_combo_box_get_active(GTK_COMBO_BOX(widget)); + widget = lookup_widget(ui_widgets.prefs_dialog, "check_trailing_spaces"); prefs.strip_trailing_spaces = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -754,6 +763,11 @@ widget = lookup_widget(ui_widgets.prefs_dialog, "check_replace_tabs"); prefs.replace_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ + /* Editor settings */ + widget = lookup_widget(ui_widgets.prefs_dialog, "spin_tab_width"); + editor_prefs.tab_width = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); + widget = lookup_widget(ui_widgets.prefs_dialog, "spin_long_line"); editor_prefs.long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
@@ -816,6 +830,9 @@ widget = lookup_widget(ui_widgets.prefs_dialog, "check_detect_indent"); editor_prefs.detect_tab_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ widget = lookup_widget(ui_widgets.prefs_dialog, "check_auto_multiline"); + editor_prefs.auto_continue_multiline = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + widget = lookup_widget(ui_widgets.prefs_dialog, "check_symbol_auto_completion"); editor_prefs.auto_complete_symbols = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -1375,7 +1392,7 @@ { if (ui_widgets.prefs_dialog == NULL) { - GtkWidget *combo_new, *combo_open; + GtkWidget *combo_new, *combo_open, *combo_eol; GtkWidget *label; guint i; gchar *encoding_string; @@ -1397,6 +1414,12 @@ g_free(encoding_string); }
+ /* init the eol character combo box */ + combo_eol = lookup_widget(ui_widgets.prefs_dialog, "combo_eol"); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo_eol), utils_get_eol_name(SC_EOL_CRLF)); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo_eol), utils_get_eol_name(SC_EOL_CR)); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo_eol), utils_get_eol_name(SC_EOL_LF)); + /* add manually GeanyWrapLabels because it can't be added with Glade * page Tools */ label = geany_wrap_label_new(_("Enter tool paths below. Tools you do not need can be left blank."));
Modified: trunk/src/prefs.h =================================================================== --- trunk/src/prefs.h 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/src/prefs.h 2008-05-14 15:36:27 UTC (rev 2580) @@ -80,6 +80,7 @@ gboolean tab_order_ltr; gboolean show_tab_cross; guint mru_length; + gint default_eol_character;
/* tools */ gchar *tools_browser_cmd;
Modified: trunk/src/utils.c =================================================================== --- trunk/src/utils.c 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/src/utils.c 2008-05-14 15:36:27 UTC (rev 2580) @@ -669,6 +669,17 @@ }
+const gchar *utils_get_eol_name(gint eol_mode) +{ + switch (eol_mode) + { + case SC_EOL_CRLF: return _("Win (CRLF)"); break; + case SC_EOL_CR: return _("Mac (CR)"); break; + default: return _("Unix (LF)"); break; + } +} + + gboolean utils_atob(const gchar *str) { if (str == NULL) return FALSE;
Modified: trunk/src/utils.h =================================================================== --- trunk/src/utils.h 2008-05-14 12:11:01 UTC (rev 2579) +++ trunk/src/utils.h 2008-05-14 15:36:27 UTC (rev 2580) @@ -72,6 +72,8 @@
const gchar *utils_get_eol_char(gint idx);
+const gchar *utils_get_eol_name(gint eol_mode); + gboolean utils_atob(const gchar *str);
gboolean utils_is_absolute_path(const gchar *path);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.