SF.net SVN: geany: [1587] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Tue May 29 16:30:55 UTC 2007


Revision: 1587
          http://svn.sourceforge.net/geany/?rev=1587&view=rev
Author:   ntrel
Date:     2007-05-29 09:30:54 -0700 (Tue, 29 May 2007)

Log Message:
-----------
Move MyApp::pref_editor_* to editor.h, using editor_prefs struct.
Move INDENT_* enums to editor.h.
Move utils_get_whitespace() to editor.c.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/build.c
    trunk/src/callbacks.c
    trunk/src/document.c
    trunk/src/editor.c
    trunk/src/editor.h
    trunk/src/geany.h
    trunk/src/keybindings.c
    trunk/src/keyfile.c
    trunk/src/main.c
    trunk/src/prefs.c
    trunk/src/ui_utils.c
    trunk/src/utils.c
    trunk/src/utils.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/ChangeLog	2007-05-29 16:30:54 UTC (rev 1587)
@@ -1,3 +1,14 @@
+2007-05-29  Nick Treleaven  <nick.treleaven at btinternet.com>
+
+ * src/build.c, src/utils.c, src/utils.h, src/keybindings.c,
+   src/prefs.c, src/geany.h, src/callbacks.c, src/keyfile.c,
+   src/document.c, src/main.c, src/editor.c, src/editor.h,
+   src/ui_utils.c:
+   Move MyApp::pref_editor_* to editor.h, using editor_prefs struct.
+   Move INDENT_* enums to editor.h.
+   Move utils_get_whitespace() to editor.c.
+
+
 2007-05-29  Enrico Tröger  <enrico.troeger at uvena.de>
 
  * doc/geany.docbook:

Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/src/build.c	2007-05-29 16:30:54 UTC (rev 1587)
@@ -50,6 +50,7 @@
 #include "keybindings.h"
 #include "vte.h"
 #include "project.h"
+#include "editor.h"
 
 
 BuildInfo build_info = {GBO_COMPILE, 0, NULL, GEANY_FILETYPES_ALL, NULL};
@@ -797,7 +798,7 @@
 				dir = tmp;
 			}
 
-			if (app->pref_editor_use_indicators)
+			if (editor_prefs.use_indicators)
 			{
 				gchar *filename;
 				gint line;

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/src/callbacks.c	2007-05-29 16:30:54 UTC (rev 1587)
@@ -1886,7 +1886,7 @@
 		line = sci_get_current_line(doc_list[idx].sci, old_pos);
 		ind_pos = sci_get_line_indent_position(doc_list[idx].sci, line);
 		// when using tabs increase cur pos by 1, when using space increase it by tab_width
-		step = (app->pref_editor_use_tabs) ? 1 : app->pref_editor_tab_width;
+		step = (editor_prefs.use_tabs) ? 1 : editor_prefs.tab_width;
 		new_pos = (old_pos > ind_pos) ? old_pos + step : old_pos;
 
 		sci_set_current_position(doc_list[idx].sci, ind_pos, TRUE);
@@ -1914,7 +1914,7 @@
 		old_pos = sci_get_current_position(doc_list[idx].sci);
 		line = sci_get_current_line(doc_list[idx].sci, old_pos);
 		ind_pos = sci_get_line_indent_position(doc_list[idx].sci, line);
-		step = (app->pref_editor_use_tabs) ? 1 : app->pref_editor_tab_width;
+		step = (editor_prefs.use_tabs) ? 1 : editor_prefs.tab_width;
 		new_pos = (old_pos >= ind_pos) ? old_pos - step : old_pos;
 
 		if (ind_pos == sci_get_position_from_line(doc_list[idx].sci, line))
@@ -1922,7 +1922,7 @@
 
 		sci_set_current_position(doc_list[idx].sci, ind_pos, TRUE);
 		indent = sci_get_line_indentation(doc_list[idx].sci, line);
-		indent -= app->pref_editor_tab_width;
+		indent -= editor_prefs.tab_width;
 		if (indent < 0)
 			indent = 0;
 		sci_set_line_indentation(doc_list[idx].sci, line, indent);

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/src/document.c	2007-05-29 16:30:54 UTC (rev 1587)
@@ -200,21 +200,21 @@
 	ScintillaObject *sci = doc_list[idx].sci;
 	sci_set_mark_long_lines(sci, app->long_line_type, app->long_line_column, app->long_line_color);
 
-	sci_set_tab_width(sci, app->pref_editor_tab_width);
+	sci_set_tab_width(sci, editor_prefs.tab_width);
 
-	sci_set_use_tabs(sci, app->pref_editor_use_tabs);
+	sci_set_use_tabs(sci, editor_prefs.use_tabs);
 	// remove indent spaces on backspace, if using spaces to indent
-	SSM(sci, SCI_SETBACKSPACEUNINDENTS, ! app->pref_editor_use_tabs, 0);
+	SSM(sci, SCI_SETBACKSPACEUNINDENTS, ! editor_prefs.use_tabs, 0);
 
 	sci_set_autoc_max_height(sci, app->autocompletion_max_height);
 
-	sci_set_indentionguides(sci, app->pref_editor_show_indent_guide);
-	sci_set_visible_white_spaces(sci, app->pref_editor_show_white_space);
-	sci_set_visible_eols(sci, app->pref_editor_show_line_endings);
+	sci_set_indentionguides(sci, editor_prefs.show_indent_guide);
+	sci_set_visible_white_spaces(sci, editor_prefs.show_white_space);
+	sci_set_visible_eols(sci, editor_prefs.show_line_endings);
 
-	sci_set_folding_margin_visible(sci, app->pref_editor_folding);
+	sci_set_folding_margin_visible(sci, editor_prefs.folding);
 
-	doc_list[idx].use_auto_indention = (app->pref_editor_indention_mode != INDENT_NONE);
+	doc_list[idx].use_auto_indention = (editor_prefs.indention_mode != INDENT_NONE);
 }
 
 
@@ -224,8 +224,8 @@
 {
 	new_doc->is_valid = FALSE;
 	new_doc->has_tags = FALSE;
-	new_doc->use_auto_indention = (app->pref_editor_indention_mode != INDENT_NONE);
-	new_doc->line_breaking = app->pref_editor_line_breaking;
+	new_doc->use_auto_indention = (editor_prefs.indention_mode != INDENT_NONE);
+	new_doc->line_breaking = editor_prefs.line_breaking;
 	new_doc->readonly = FALSE;
 	new_doc->tag_store = NULL;
 	new_doc->tag_tree = NULL;
@@ -308,8 +308,8 @@
 	sci_set_tab_indents(sci, app->use_tab_to_indent);
 	sci_set_symbol_margin(sci, app->show_markers_margin);
 	sci_set_line_numbers(sci, app->show_linenumber_margin, 0);
-	sci_set_lines_wrapped(sci, app->pref_editor_line_breaking);
-	sci_set_scrollbar_mode(sci, app->pref_editor_show_scrollbars);
+	sci_set_lines_wrapped(sci, editor_prefs.line_breaking);
+	sci_set_scrollbar_mode(sci, editor_prefs.show_scrollbars);
 
 	// signal for insert-key(works without too, but to update the right status bar)
 	//g_signal_connect((GtkWidget*) sci, "key-press-event",
@@ -338,8 +338,8 @@
 	this->changed = FALSE;
 	this->last_check = time(NULL);
 	this->readonly = FALSE;
-	this->line_breaking = app->pref_editor_line_breaking;
-	this->use_auto_indention = (app->pref_editor_indention_mode != INDENT_NONE);
+	this->line_breaking = editor_prefs.line_breaking;
+	this->use_auto_indention = (editor_prefs.indention_mode != INDENT_NONE);
 	this->has_tags = FALSE;
 
 	treeviews_openfiles_add(new_idx);	// sets this->iter
@@ -440,7 +440,7 @@
 	sci_set_undo_collection(doc_list[idx].sci, TRUE);
 	sci_empty_undo_buffer(doc_list[idx].sci);
 
-	doc_list[idx].encoding = g_strdup(encodings[app->pref_editor_default_encoding].charset);
+	doc_list[idx].encoding = g_strdup(encodings[editor_prefs.default_encoding].charset);
 	// store the opened encoding for undo/redo
 	store_saved_encoding(idx);
 
@@ -977,11 +977,11 @@
 	}
 
 	// replaces tabs by spaces
-	if (app->pref_editor_replace_tabs) document_replace_tabs(idx);
+	if (editor_prefs.replace_tabs) document_replace_tabs(idx);
 	// strip trailing spaces
-	if (app->pref_editor_trail_space) document_strip_trailing_spaces(idx);
+	if (editor_prefs.trail_space) document_strip_trailing_spaces(idx);
 	// ensure the file has a newline at the end
-	if (app->pref_editor_new_line) document_ensure_final_newline(idx);
+	if (editor_prefs.new_line) document_ensure_final_newline(idx);
 	// ensure there a really the same EOL chars
 	sci_convert_eols(doc_list[idx].sci, sci_get_eol_mode(doc_list[idx].sci));
 

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/src/editor.c	2007-05-29 16:30:54 UTC (rev 1587)
@@ -44,6 +44,9 @@
 
 static gchar current_word[GEANY_MAX_WORD_LENGTH];	// holds word under the mouse or keyboard cursor
 
+// Initialised in keyfile.c.
+EditorPrefs editor_prefs;
+
 EditorInfo editor_info = {current_word, -1};
 
 static struct
@@ -77,7 +80,7 @@
 
 	if (event->button == 1)
 	{
-		if (GDK_BUTTON_PRESS==event->type && app->pref_editor_disable_dnd)
+		if (GDK_BUTTON_PRESS == event->type && editor_prefs.disable_dnd)
 		{
 			gint ss = sci_get_selection_start(doc_list[idx].sci);
 			sci_set_selection_end(doc_list[idx].sci, ss);
@@ -115,12 +118,12 @@
 		sci_set_marker_at_line(sci, line, ! set, 1);	// toggle the marker
 	}
 	// left click on the folding margin to toggle folding state of current line
-	else if (nt->margin == 2 && app->pref_editor_folding)
+	else if (nt->margin == 2 && editor_prefs.folding)
 	{
 		gint line = SSM(sci, SCI_LINEFROMPOSITION, nt->position, 0);
 
 		SSM(sci, SCI_TOGGLEFOLD, line, 0);
-		if (app->pref_editor_unfold_all_children &&
+		if (editor_prefs.unfold_all_children &&
 			SSM(sci, SCI_GETLINEVISIBLE, line + 1, 0))
 		{	// unfold all children of the current fold point
 			gint last_line = SSM(sci, SCI_GETLASTCHILD, line, -1);
@@ -230,7 +233,7 @@
 		case '}':
 		{	// closing bracket handling
 			if (doc_list[idx].use_auto_indention &&
-				app->pref_editor_indention_mode == INDENT_ADVANCED)
+				editor_prefs.indention_mode == INDENT_ADVANCED)
 				editor_close_block(idx, pos - 1);
 			break;
 		}
@@ -359,6 +362,40 @@
 }
 
 
+/* Returns a string containing width chars of whitespace according to the
+ * setting editor_prefs.use_tabs filled with simple space characters or with the right number
+ * of tab characters. (Result is filled with tabs *and* spaces if width isn't a multiple of
+ * editor_prefs.tab_width).
+ * If alternative is set to TRUE, it uses the opposite of editor_prefs.use_tabs. */
+static gchar *
+get_whitespace(gint width, gboolean alternative)
+{
+	gchar *str;
+	gboolean use_tabs;
+
+	g_return_val_if_fail(width > 0, NULL);
+
+	use_tabs = (alternative) ? ! editor_prefs.use_tabs : editor_prefs.use_tabs;
+
+	if (use_tabs)
+	{	// first fill text with tabluators and fill the rest with spaces
+		gint tabs = width / editor_prefs.tab_width;
+		gint spaces = width % editor_prefs.tab_width;
+		gint len = tabs + spaces;
+
+		str = g_malloc(len + 1);
+
+		memset(str, '\t', tabs);
+		memset(str + tabs, ' ', spaces);
+		str[len] = '\0';
+ 	}
+	else
+		str = g_strnfill(width, ' ');
+
+	return str;
+}
+
+
 static void on_new_line_added(ScintillaObject *sci, gint idx)
 {
 	gint pos = sci_get_current_position(sci);
@@ -369,7 +406,7 @@
 		get_indent(sci, pos, FALSE);
 		sci_add_text(sci, indent);
 
-		if (app->pref_editor_indention_mode == INDENT_ADVANCED)
+		if (editor_prefs.indention_mode == INDENT_ADVANCED)
 		{
 			// add extra indentation for Python after colon
 			if (FILETYPE_ID(doc_list[idx].file_type) == GEANY_FILETYPES_PYTHON &&
@@ -377,14 +414,14 @@
 				sci_get_style_at(sci, pos - 2) == SCE_P_OPERATOR)
 			{
 				// creates and inserts one tabulator sign or whitespace of the amount of the tab width
-				gchar *text = utils_get_whitespace(app->pref_editor_tab_width, FALSE);
+				gchar *text = get_whitespace(editor_prefs.tab_width, FALSE);
 				sci_add_text(sci, text);
 				g_free(text);
 			}
 		}
 	}
 
-	if (app->pref_editor_auto_complete_constructs)
+	if (editor_prefs.auto_complete_constructs)
 	{
 		// " * " auto completion in multiline C/C++/D/Java comments
 		auto_multiline(sci, pos);
@@ -419,7 +456,7 @@
 {
 	guint j = *idx;
 
-	if (app->pref_editor_use_tabs)
+	if (editor_prefs.use_tabs)
 	{
 		if (j < len - 1)	// leave room for a \0 terminator.
 			buf[j++] = '\t';
@@ -427,7 +464,7 @@
 	else
 	{	// insert as many spaces as a tab would take
 		guint k;
-		for (k = 0; k < (guint) app->pref_editor_tab_width && k < len - 1; k++)
+		for (k = 0; k < (guint) editor_prefs.tab_width && k < len - 1; k++)
 			buf[j++] = ' ';
 	}
 	*idx = j;
@@ -452,7 +489,7 @@
 	{
 		if (linebuf[i] == ' ' || linebuf[i] == '\t')	// simple indentation
 			indent[j++] = linebuf[i];
-		else if (app->pref_editor_indention_mode != INDENT_ADVANCED)
+		else if (editor_prefs.indention_mode != INDENT_ADVANCED)
 			break;
 		else if (use_this_line)
 			break;
@@ -489,7 +526,7 @@
 
 static void auto_close_bracket(ScintillaObject *sci, gint pos, gchar c)
 {
-	if (! app->pref_editor_auto_complete_constructs || SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_LATEX)
+	if (! editor_prefs.auto_complete_constructs || SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_LATEX)
 		return;
 
 	if (c == '[')
@@ -598,7 +635,7 @@
 
 		if (line_indent < last_indent)
 			return;
-		line_indent -= app->pref_editor_tab_width;
+		line_indent -= editor_prefs.tab_width;
 		line_indent = MAX(0, line_indent);
 		sci_set_line_indentation(sci, line, line_indent);
 	}
@@ -917,7 +954,7 @@
 	gchar *wordchars;
 	filetype *ft;
 
-	if ((! app->pref_editor_auto_complete_symbols && ! force) ||
+	if ((! editor_prefs.auto_complete_symbols && ! force) ||
 		! DOC_IDX_VALID(idx) || doc_list[idx].file_type == NULL)
 		return FALSE;
 
@@ -1245,7 +1282,7 @@
 	eol = g_strconcat(utils_get_eol_char(idx), indent, NULL);
 
 	// get the whitespace for additional indentation
-	space = utils_get_whitespace(app->pref_editor_tab_width, FALSE);
+	space = get_whitespace(editor_prefs.tab_width, FALSE);
 
 	sci_start_undo_action(sci);	// needed while we insert a space separately from construct
 	result = complete_constructs(idx, pos, buf, space, eol);
@@ -1284,7 +1321,7 @@
 
 	// If the user has turned us off, quit now.
 	// This may make sense only in certain languages
-	if (! app->pref_editor_auto_close_xml_tags || (lexer != SCLEX_HTML && lexer != SCLEX_XML))
+	if (! editor_prefs.auto_close_xml_tags || (lexer != SCLEX_HTML && lexer != SCLEX_XML))
 		return FALSE;
 
 	pos = sci_get_current_position(sci);
@@ -1970,7 +2007,7 @@
 
 			/* if there is one too many spaces, delete the last space,
 			 * to return to the indent used before the multiline comment was started. */
-			if (indent_len % app->pref_editor_tab_width == 1)
+			if (indent_len % editor_prefs.tab_width == 1)
 				SSM(sci, SCI_DELETEBACKNOTLINE, 0, 0);	// remove whitespace indent
 			g_free(previous_line);
 			return;
@@ -2262,7 +2299,7 @@
 void editor_insert_alternative_whitespace(ScintillaObject *sci)
 {
 	// creates and inserts one tabulator sign or whitespace of the amount of the tab width
-	gchar *text = utils_get_whitespace(app->pref_editor_tab_width, TRUE);
+	gchar *text = get_whitespace(editor_prefs.tab_width, TRUE);
 	sci_add_text(sci, text);
 	g_free(text);
 }

Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/src/editor.h	2007-05-29 16:30:54 UTC (rev 1587)
@@ -34,8 +34,43 @@
 #define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
 
 
+enum
+{
+	INDENT_NONE = 0,
+	INDENT_BASIC,
+	INDENT_ADVANCED
+};
+
+/* These are the default prefs when creating a new editor window.
+ * Some of these can be overridden per document. */
 typedef struct
 {
+	gboolean	line_breaking;
+	gint		indention_mode;
+	gboolean	use_indicators;
+	gboolean	show_white_space;
+	gboolean	show_indent_guide;
+	gboolean	show_line_endings;
+	gboolean	auto_complete_symbols;
+	gboolean	auto_close_xml_tags;
+	gboolean	auto_complete_constructs;
+	gboolean	folding;
+	gboolean	unfold_all_children;
+	gboolean	show_scrollbars;
+	gint		tab_width;
+	gboolean	use_tabs;
+	gint		default_encoding;
+	gboolean	new_line;
+	gboolean	replace_tabs;
+	gboolean	trail_space;
+	gboolean	disable_dnd;
+} EditorPrefs;
+
+extern EditorPrefs editor_prefs;
+
+
+typedef struct
+{
 	gchar *current_word;	// holds word under the mouse or keyboard cursor
 	gint click_pos;			// text position where the mouse was clicked
 } EditorInfo;

Modified: trunk/src/geany.h
===================================================================
--- trunk/src/geany.h	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/src/geany.h	2007-05-29 16:30:54 UTC (rev 1587)
@@ -103,27 +103,6 @@
 	gboolean			 brace_match_ltgt;
 	gboolean			 use_tab_to_indent;
 	gboolean			 main_window_realized;
-	// I know, it is a bit confusing, but this line breaking is globally,
-	// to change the default value at startup, I think
-	gboolean			 pref_editor_line_breaking;
-	gint			 	 pref_editor_indention_mode;
-	gboolean			 pref_editor_use_indicators;
-	gboolean			 pref_editor_show_white_space;
-	gboolean			 pref_editor_show_indent_guide;
-	gboolean			 pref_editor_show_line_endings;
-	gboolean			 pref_editor_auto_complete_symbols;
-	gboolean			 pref_editor_auto_close_xml_tags;
-	gboolean			 pref_editor_auto_complete_constructs;
-	gboolean			 pref_editor_folding;
-	gboolean			 pref_editor_unfold_all_children;
-	gboolean			 pref_editor_show_scrollbars;
-	gint				 pref_editor_tab_width;
-	gboolean			 pref_editor_use_tabs;
-	gint				 pref_editor_default_encoding;
-	gboolean			 pref_editor_new_line;
-	gboolean			 pref_editor_replace_tabs;
-	gboolean			 pref_editor_trail_space;
-	gboolean			 pref_editor_disable_dnd;
 	gboolean			 pref_main_load_session;
 	gboolean			 pref_main_save_winpos;
 	gboolean			 pref_main_confirm_exit;
@@ -221,13 +200,6 @@
 
 enum
 {
-	INDENT_NONE = 0,
-	INDENT_BASIC,
-	INDENT_ADVANCED
-};
-
-enum
-{
 	KILOBYTE = 1024,
 	MEGABYTE = (KILOBYTE*1024),
 	GIGABYTE = (MEGABYTE*1024)

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/src/keybindings.c	2007-05-29 16:30:54 UTC (rev 1587)
@@ -616,7 +616,7 @@
 			ScintillaObject *sci = doc_list[idx].sci;
 			gint pos = sci_get_current_position(sci);
 
-			if (app->pref_editor_auto_complete_constructs)
+			if (editor_prefs.auto_complete_constructs)
 				return editor_auto_forif(idx, pos);
 		}
 	}

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/src/keyfile.c	2007-05-29 16:30:54 UTC (rev 1587)
@@ -48,6 +48,7 @@
 #include "msgwindow.h"
 #include "search.h"
 #include "project.h"
+#include "editor.h"
 
 
 static gchar *scribble_text = NULL;
@@ -174,26 +175,26 @@
 	g_key_file_set_boolean(config, PACKAGE, "sidebar_visible", app->sidebar_visible);
 	g_key_file_set_boolean(config, PACKAGE, "statusbar_visible", app->statusbar_visible);
 	g_key_file_set_boolean(config, PACKAGE, "msgwindow_visible", app->msgwindow_visible);
-	g_key_file_set_boolean(config, PACKAGE, "use_folding", app->pref_editor_folding);
-	g_key_file_set_boolean(config, PACKAGE, "unfold_all_children", app->pref_editor_unfold_all_children);
-	g_key_file_set_boolean(config, PACKAGE, "show_editor_scrollbars", app->pref_editor_show_scrollbars);
-	g_key_file_set_integer(config, PACKAGE, "indention_mode", app->pref_editor_indention_mode);
+	g_key_file_set_boolean(config, PACKAGE, "use_folding", editor_prefs.folding);
+	g_key_file_set_boolean(config, PACKAGE, "unfold_all_children", editor_prefs.unfold_all_children);
+	g_key_file_set_boolean(config, PACKAGE, "show_editor_scrollbars", editor_prefs.show_scrollbars);
+	g_key_file_set_integer(config, PACKAGE, "indention_mode", editor_prefs.indention_mode);
 	g_key_file_set_boolean(config, PACKAGE, "use_tab_to_indent", app->use_tab_to_indent);
-	g_key_file_set_boolean(config, PACKAGE, "use_indicators", app->pref_editor_use_indicators);
-	g_key_file_set_boolean(config, PACKAGE, "show_indent_guide", app->pref_editor_show_indent_guide);
-	g_key_file_set_boolean(config, PACKAGE, "show_white_space", app->pref_editor_show_white_space);
+	g_key_file_set_boolean(config, PACKAGE, "use_indicators", editor_prefs.use_indicators);
+	g_key_file_set_boolean(config, PACKAGE, "show_indent_guide", editor_prefs.show_indent_guide);
+	g_key_file_set_boolean(config, PACKAGE, "show_white_space", editor_prefs.show_white_space);
 	g_key_file_set_boolean(config, PACKAGE, "show_markers_margin", app->show_markers_margin);
 	g_key_file_set_boolean(config, PACKAGE, "show_linenumber_margin", app->show_linenumber_margin);
-	g_key_file_set_boolean(config, PACKAGE, "line_breaking", app->pref_editor_line_breaking);
-	g_key_file_set_boolean(config, PACKAGE, "show_line_endings", app->pref_editor_show_line_endings);
+	g_key_file_set_boolean(config, PACKAGE, "line_breaking", editor_prefs.line_breaking);
+	g_key_file_set_boolean(config, PACKAGE, "show_line_endings", editor_prefs.show_line_endings);
 	g_key_file_set_boolean(config, PACKAGE, "fullscreen", app->fullscreen);
 	g_key_file_set_boolean(config, PACKAGE, "tab_order_ltr", app->tab_order_ltr);
 	g_key_file_set_boolean(config, PACKAGE, "show_notebook_tabs", app->show_notebook_tabs);
 	g_key_file_set_boolean(config, PACKAGE, "brace_match_ltgt", app->brace_match_ltgt);
 	g_key_file_set_boolean(config, PACKAGE, "switch_msgwin_pages", app->switch_msgwin_pages);
-	g_key_file_set_boolean(config, PACKAGE, "auto_close_xml_tags", app->pref_editor_auto_close_xml_tags);
-	g_key_file_set_boolean(config, PACKAGE, "auto_complete_constructs", app->pref_editor_auto_complete_constructs);
-	g_key_file_set_boolean(config, PACKAGE, "auto_complete_symbols", app->pref_editor_auto_complete_symbols);
+	g_key_file_set_boolean(config, PACKAGE, "auto_close_xml_tags", editor_prefs.auto_close_xml_tags);
+	g_key_file_set_boolean(config, PACKAGE, "auto_complete_constructs", editor_prefs.auto_complete_constructs);
+	g_key_file_set_boolean(config, PACKAGE, "auto_complete_symbols", editor_prefs.auto_complete_symbols);
 #ifdef HAVE_VTE
 	g_key_file_set_boolean(config, "VTE", "load_vte", vte_info.load_vte);
 	if (vte_info.load_vte && vc != NULL)
@@ -239,8 +240,8 @@
 		gtk_window_get_size(GTK_WINDOW(app->window), &app->geometry[2], &app->geometry[3]);
 		g_key_file_set_integer_list(config, PACKAGE, "geometry", app->geometry, 4);
 	}
-	g_key_file_set_integer(config, PACKAGE, "pref_editor_tab_width", app->pref_editor_tab_width);
-	g_key_file_set_boolean(config, PACKAGE, "pref_editor_use_tabs", app->pref_editor_use_tabs);
+	g_key_file_set_integer(config, PACKAGE, "pref_editor_tab_width", editor_prefs.tab_width);
+	g_key_file_set_boolean(config, PACKAGE, "pref_editor_use_tabs", editor_prefs.use_tabs);
 	g_key_file_set_boolean(config, PACKAGE, "pref_main_confirm_exit", app->pref_main_confirm_exit);
 	g_key_file_set_boolean(config, PACKAGE, "pref_main_suppress_search_dialogs", app->pref_main_suppress_search_dialogs);
 	g_key_file_set_boolean(config, PACKAGE, "pref_main_load_session", app->pref_main_load_session);
@@ -256,11 +257,11 @@
 	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_quit", app->pref_toolbar_show_quit);
 	g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_style", app->toolbar_icon_style);
 	g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_size", app->toolbar_icon_size);
-	g_key_file_set_boolean(config, PACKAGE, "pref_editor_new_line", app->pref_editor_new_line);
-	g_key_file_set_boolean(config, PACKAGE, "pref_editor_replace_tabs", app->pref_editor_replace_tabs);
-	g_key_file_set_boolean(config, PACKAGE, "pref_editor_trail_space", app->pref_editor_trail_space);
-	g_key_file_set_boolean(config, PACKAGE, "pref_editor_disable_dnd", app->pref_editor_disable_dnd);
-	g_key_file_set_string(config, PACKAGE, "pref_editor_default_encoding", encodings[app->pref_editor_default_encoding].charset);
+	g_key_file_set_boolean(config, PACKAGE, "pref_editor_new_line", editor_prefs.new_line);
+	g_key_file_set_boolean(config, PACKAGE, "pref_editor_replace_tabs", editor_prefs.replace_tabs);
+	g_key_file_set_boolean(config, PACKAGE, "pref_editor_trail_space", editor_prefs.trail_space);
+	g_key_file_set_boolean(config, PACKAGE, "pref_editor_disable_dnd", editor_prefs.disable_dnd);
+	g_key_file_set_string(config, PACKAGE, "pref_editor_default_encoding", encodings[editor_prefs.default_encoding].charset);
 	g_key_file_set_string(config, PACKAGE, "pref_template_developer", app->pref_template_developer);
 	g_key_file_set_string(config, PACKAGE, "pref_template_company", app->pref_template_company);
 	g_key_file_set_string(config, PACKAGE, "pref_template_mail", app->pref_template_mail);
@@ -382,19 +383,19 @@
 	app->sidebar_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_visible", TRUE);
 	app->statusbar_visible = utils_get_setting_boolean(config, PACKAGE, "statusbar_visible", TRUE);
 	app->msgwindow_visible = utils_get_setting_boolean(config, PACKAGE, "msgwindow_visible", TRUE);
-	app->pref_editor_line_breaking = utils_get_setting_boolean(config, PACKAGE, "line_breaking", FALSE); //default is off for better performance
-	app->pref_editor_indention_mode = utils_get_setting_integer(config, PACKAGE, "indention_mode", INDENT_ADVANCED);
+	editor_prefs.line_breaking = utils_get_setting_boolean(config, PACKAGE, "line_breaking", FALSE); //default is off for better performance
+	editor_prefs.indention_mode = utils_get_setting_integer(config, PACKAGE, "indention_mode", INDENT_ADVANCED);
 	app->use_tab_to_indent = utils_get_setting_boolean(config, PACKAGE, "use_tab_to_indent", FALSE);
-	app->pref_editor_use_indicators = utils_get_setting_boolean(config, PACKAGE, "use_indicators", TRUE);
-	app->pref_editor_show_indent_guide = utils_get_setting_boolean(config, PACKAGE, "show_indent_guide", FALSE);
-	app->pref_editor_show_white_space = utils_get_setting_boolean(config, PACKAGE, "show_white_space", FALSE);
-	app->pref_editor_show_line_endings = utils_get_setting_boolean(config, PACKAGE, "show_line_endings", FALSE);
-	app->pref_editor_auto_close_xml_tags = utils_get_setting_boolean(config, PACKAGE, "auto_close_xml_tags", TRUE);
-	app->pref_editor_auto_complete_constructs = utils_get_setting_boolean(config, PACKAGE, "auto_complete_constructs", TRUE);
-	app->pref_editor_auto_complete_symbols = utils_get_setting_boolean(config, PACKAGE, "auto_complete_symbols", TRUE);
-	app->pref_editor_folding = utils_get_setting_boolean(config, PACKAGE, "use_folding", TRUE);
-	app->pref_editor_unfold_all_children = utils_get_setting_boolean(config, PACKAGE, "unfold_all_children", FALSE);
-	app->pref_editor_show_scrollbars = utils_get_setting_boolean(config, PACKAGE, "show_editor_scrollbars", TRUE);
+	editor_prefs.use_indicators = utils_get_setting_boolean(config, PACKAGE, "use_indicators", TRUE);
+	editor_prefs.show_indent_guide = utils_get_setting_boolean(config, PACKAGE, "show_indent_guide", FALSE);
+	editor_prefs.show_white_space = utils_get_setting_boolean(config, PACKAGE, "show_white_space", FALSE);
+	editor_prefs.show_line_endings = utils_get_setting_boolean(config, PACKAGE, "show_line_endings", FALSE);
+	editor_prefs.auto_close_xml_tags = utils_get_setting_boolean(config, PACKAGE, "auto_close_xml_tags", TRUE);
+	editor_prefs.auto_complete_constructs = utils_get_setting_boolean(config, PACKAGE, "auto_complete_constructs", TRUE);
+	editor_prefs.auto_complete_symbols = utils_get_setting_boolean(config, PACKAGE, "auto_complete_symbols", TRUE);
+	editor_prefs.folding = utils_get_setting_boolean(config, PACKAGE, "use_folding", TRUE);
+	editor_prefs.unfold_all_children = utils_get_setting_boolean(config, PACKAGE, "unfold_all_children", FALSE);
+	editor_prefs.show_scrollbars = utils_get_setting_boolean(config, PACKAGE, "show_editor_scrollbars", TRUE);
 	app->show_markers_margin = utils_get_setting_boolean(config, PACKAGE, "show_markers_margin", TRUE);
 	app->show_linenumber_margin = utils_get_setting_boolean(config, PACKAGE, "show_linenumber_margin", TRUE);
 	app->fullscreen = utils_get_setting_boolean(config, PACKAGE, "fullscreen", FALSE);
@@ -432,8 +433,8 @@
 				(GEANY_MSGWIN_HEIGHT + GEANY_WINDOW_DEFAULT_HEIGHT - 440));
 
 
-	app->pref_editor_tab_width = utils_get_setting_integer(config, PACKAGE, "pref_editor_tab_width", 4);
-	app->pref_editor_use_tabs = utils_get_setting_boolean(config, PACKAGE, "pref_editor_use_tabs", TRUE);
+	editor_prefs.tab_width = utils_get_setting_integer(config, PACKAGE, "pref_editor_tab_width", 4);
+	editor_prefs.use_tabs = utils_get_setting_boolean(config, PACKAGE, "pref_editor_use_tabs", TRUE);
 	// use current locale encoding as default for new files (should be in most cases UTF-8)
 	g_get_charset(&default_charset);
 	tmp_string = utils_get_setting_string(config, PACKAGE, "pref_editor_default_encoding",
@@ -442,9 +443,9 @@
 	{
 		const GeanyEncoding *enc = encodings_get_from_charset(tmp_string);
 		if (enc != NULL)
-			app->pref_editor_default_encoding = enc->idx;
+			editor_prefs.default_encoding = enc->idx;
 		else
-			app->pref_editor_default_encoding = GEANY_ENCODING_UTF_8;
+			editor_prefs.default_encoding = GEANY_ENCODING_UTF_8;
 
 		g_free(tmp_string);
 	}
@@ -509,10 +510,10 @@
 	g_free(tmp_string);
 	g_free(tmp_string2);
 
-	app->pref_editor_replace_tabs = utils_get_setting_boolean(config, PACKAGE, "pref_editor_replace_tabs", FALSE);
-	app->pref_editor_new_line = utils_get_setting_boolean(config, PACKAGE, "pref_editor_new_line", TRUE);
-	app->pref_editor_trail_space = utils_get_setting_boolean(config, PACKAGE, "pref_editor_trail_space", FALSE);
-	app->pref_editor_disable_dnd = utils_get_setting_boolean(config, PACKAGE, "pref_editor_disable_dnd", FALSE);
+	editor_prefs.replace_tabs = utils_get_setting_boolean(config, PACKAGE, "pref_editor_replace_tabs", FALSE);
+	editor_prefs.new_line = utils_get_setting_boolean(config, PACKAGE, "pref_editor_new_line", TRUE);
+	editor_prefs.trail_space = utils_get_setting_boolean(config, PACKAGE, "pref_editor_trail_space", FALSE);
+	editor_prefs.disable_dnd = utils_get_setting_boolean(config, PACKAGE, "pref_editor_disable_dnd", FALSE);
 
 	tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_MAKE);
 	app->tools_make_cmd = utils_get_setting_string(config, "tools", "make_cmd", tmp_string);

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/src/main.c	2007-05-29 16:30:54 UTC (rev 1587)
@@ -215,10 +215,10 @@
 
 	app->ignore_callback = TRUE;
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
-				lookup_widget(app->window, "menu_line_breaking1")), app->pref_editor_line_breaking);
+				lookup_widget(app->window, "menu_line_breaking1")), editor_prefs.line_breaking);
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
 				lookup_widget(app->window, "menu_use_auto_indention1")),
-				(app->pref_editor_indention_mode != INDENT_NONE));
+				(editor_prefs.indention_mode != INDENT_NONE));
 	app->ignore_callback = FALSE;
 
 	// connect the toolbar dropdown menu for the new button

Modified: trunk/src/prefs.c
===================================================================
--- trunk/src/prefs.c	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/src/prefs.c	2007-05-29 16:30:54 UTC (rev 1587)
@@ -43,6 +43,7 @@
 #include "interface.h"
 #include "encodings.h"
 #include "project.h"
+#include "editor.h"
 
 #ifdef HAVE_VTE
 # include "vte.h"
@@ -222,61 +223,61 @@
 
 	// Editor settings
 	widget = lookup_widget(app->prefs_dialog, "spin_tab_width");
-	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), app->pref_editor_tab_width);
+	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.tab_width);
 
 	widget = lookup_widget(app->prefs_dialog, "combo_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), app->pref_editor_default_encoding);
+	gtk_combo_box_set_active(GTK_COMBO_BOX(widget), editor_prefs.default_encoding);
 
 	widget = lookup_widget(app->prefs_dialog, "check_trailing_spaces");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_trail_space);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.trail_space);
 
 	widget = lookup_widget(app->prefs_dialog, "check_new_line");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_new_line);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.new_line);
 
 	widget = lookup_widget(app->prefs_dialog, "check_replace_tabs");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_replace_tabs);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.replace_tabs);
 
 	widget = lookup_widget(app->prefs_dialog, "check_indent");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_show_indent_guide);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.show_indent_guide);
 
 	widget = lookup_widget(app->prefs_dialog, "check_white_space");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_show_white_space);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.show_white_space);
 
 	widget = lookup_widget(app->prefs_dialog, "check_line_end");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_show_line_endings);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.show_line_endings);
 
 	widget = lookup_widget(app->prefs_dialog, "combo_auto_indent_mode");
-	gtk_combo_box_set_active(GTK_COMBO_BOX(widget), app->pref_editor_indention_mode);
+	gtk_combo_box_set_active(GTK_COMBO_BOX(widget), editor_prefs.indention_mode);
 
 	widget = lookup_widget(app->prefs_dialog, "check_line_wrapping");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_line_breaking);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.line_breaking);
 
 	widget = lookup_widget(app->prefs_dialog, "check_auto_complete");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_auto_complete_constructs);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_complete_constructs);
 
 	widget = lookup_widget(app->prefs_dialog, "check_xmltag");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_auto_close_xml_tags);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_close_xml_tags);
 
 	widget = lookup_widget(app->prefs_dialog, "check_folding");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_folding);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.folding);
 
 	widget = lookup_widget(app->prefs_dialog, "check_unfold_children");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_unfold_all_children);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.unfold_all_children);
 	on_use_folding_toggled(GTK_TOGGLE_BUTTON(
 					lookup_widget(app->prefs_dialog, "check_folding")), NULL);
 
 	widget = lookup_widget(app->prefs_dialog, "check_disable_dnd");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_disable_dnd);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.disable_dnd);
 
 	widget = lookup_widget(app->prefs_dialog, "check_use_tabs");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_use_tabs);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.use_tabs);
 
 	widget = lookup_widget(app->prefs_dialog, "check_indicators");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_use_indicators);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.use_indicators);
 
 	widget = lookup_widget(app->prefs_dialog, "check_symbol_auto_completion");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_auto_complete_symbols);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_complete_symbols);
 	on_symbol_auto_completion_toggled(GTK_TOGGLE_BUTTON(widget), NULL);
 
 	widget = lookup_widget(app->prefs_dialog, "spin_autocheight");
@@ -546,62 +547,62 @@
 
 		// Editor settings
 		widget = lookup_widget(app->prefs_dialog, "spin_tab_width");
-		app->pref_editor_tab_width = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+		editor_prefs.tab_width = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "combo_encoding");
-		app->pref_editor_default_encoding = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
+		editor_prefs.default_encoding = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_trailing_spaces");
-		app->pref_editor_trail_space = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.trail_space = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_new_line");
-		app->pref_editor_new_line = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.new_line = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_replace_tabs");
-		app->pref_editor_replace_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.replace_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "spin_long_line");
 		app->long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_folding");
-		app->pref_editor_folding = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.folding = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 		ui_update_fold_items();
 
 		widget = lookup_widget(app->prefs_dialog, "check_unfold_children");
-		app->pref_editor_unfold_all_children = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.unfold_all_children = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_indent");
-		app->pref_editor_show_indent_guide = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.show_indent_guide = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_white_space");
-		app->pref_editor_show_white_space = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.show_white_space = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_line_end");
-		app->pref_editor_show_line_endings = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.show_line_endings = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "combo_auto_indent_mode");
-		app->pref_editor_indention_mode = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
+		editor_prefs.indention_mode = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_line_wrapping");
-		app->pref_editor_line_breaking = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.line_breaking = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_auto_complete");
-		app->pref_editor_auto_complete_constructs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.auto_complete_constructs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_xmltag");
-		app->pref_editor_auto_close_xml_tags = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.auto_close_xml_tags = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_indicators");
-		app->pref_editor_use_indicators = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.use_indicators = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_disable_dnd");
-		app->pref_editor_disable_dnd = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.disable_dnd = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_use_tabs");
-		app->pref_editor_use_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.use_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_symbol_auto_completion");
-		app->pref_editor_auto_complete_symbols = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		editor_prefs.auto_complete_symbols = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "spin_autocheight");
 		app->autocompletion_max_height = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
@@ -709,7 +710,7 @@
 			if (doc_list[i].is_valid)
 			{
 				document_apply_update_prefs(i);
-				if (! app->pref_editor_folding)
+				if (! editor_prefs.folding)
 					document_unfold_all(i);
 			}
 		}

Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/src/ui_utils.c	2007-05-29 16:30:54 UTC (rev 1587)
@@ -41,6 +41,7 @@
 #include "treeviews.h"
 #include "win32.h"
 #include "project.h"
+#include "editor.h"
 
 
 static gchar *menu_item_get_text(GtkMenuItem *menu_item);
@@ -325,8 +326,8 @@
 
 void ui_update_fold_items()
 {
-	gtk_widget_set_sensitive(lookup_widget(app->window, "menu_fold_all1"), app->pref_editor_folding);
-	gtk_widget_set_sensitive(lookup_widget(app->window, "menu_unfold_all1"), app->pref_editor_folding);
+	gtk_widget_set_sensitive(lookup_widget(app->window, "menu_fold_all1"), editor_prefs.folding);
+	gtk_widget_set_sensitive(lookup_widget(app->window, "menu_unfold_all1"), editor_prefs.folding);
 }
 
 
@@ -593,7 +594,7 @@
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, widget_name)),
 																					TRUE);
 
-	gtk_widget_set_sensitive(indention, app->pref_editor_indention_mode != INDENT_NONE);
+	gtk_widget_set_sensitive(indention, editor_prefs.indention_mode != INDENT_NONE);
 
 	gtk_widget_set_sensitive(lookup_widget(app->window, "menu_write_unicode_bom1"),
 			encodings_is_unicode_charset(doc_list[idx].encoding));

Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/src/utils.c	2007-05-29 16:30:54 UTC (rev 1587)
@@ -1463,39 +1463,6 @@
 }
 
 
-/* Returns a string containing whitespace of the amount a according to the
- * setting app->pref_editor_use_tabs filled with simple space characters or with the right amount
- * of tabulator characters (a is filled with tabulators *and* spaces if a isn't a multiple of
- * app->pref_editor_tab_width).
- * If alternative is set to TRUE, it returns the opposite of app->pref_editor_use_tabs. */
-gchar *utils_get_whitespace(gint a, gboolean alternative)
-{
-	gchar *str;
-	gboolean use_tabs;
-
-	g_return_val_if_fail(a > 0, NULL);
-
-	use_tabs = (alternative) ? ! app->pref_editor_use_tabs : app->pref_editor_use_tabs;
-
-	if (use_tabs)
-	{	// first fill text with tabluators and fill the rest with spaces
-		gint tabs = a / app->pref_editor_tab_width;
-		gint spaces = a % app->pref_editor_tab_width;
-		gint len = tabs + spaces;
-
-		str = g_malloc(len + 1);
-
-		memset(str, '\t', tabs);
-		memset(str + tabs, ' ', spaces);
-		str[len] = '\0';
- 	}
-	else
-		str = g_strnfill(a, ' ');
-
-	return str;
-}
-
-
 /* Frees all passed pointers if they are non-NULL, the first argument is nothing special,
  * it will also be freed, the list should be ended with NULL */
 void utils_free_pointers(gpointer first, ...)

Modified: trunk/src/utils.h
===================================================================
--- trunk/src/utils.h	2007-05-29 12:40:43 UTC (rev 1586)
+++ trunk/src/utils.h	2007-05-29 16:30:54 UTC (rev 1587)
@@ -25,6 +25,10 @@
 #ifndef GEANY_UTILS_H
 #define GEANY_UTILS_H 1
 
+#if ! GLIB_CHECK_VERSION(2, 8, 0)
+#define G_GNUC_NULL_TERMINATED
+#endif
+
 // Returns: TRUE if ptr points to a non-zero value.
 #define NZV(ptr) \
 	((ptr) && (ptr)[0])
@@ -159,18 +163,7 @@
 /* Simple wrapper for g_locale_to_utf8; returns a copy of locale_text on failure. */
 gchar *utils_get_utf8_from_locale(const gchar *locale_text);
 
-/* Returns a string containing whitespace of the amount a according to the
- * setting app->pref_editor_use_tabs filled with simple space characters or with the right amount
- * of tabulator characters (a is filled with tabulators *and* spaces if a isn't a multiple of
- * app->pref_editor_tab_width).
- * If alternative is set to TRUE, it returns the opposite of app->pref_editor_use_tabs. */
-gchar *utils_get_whitespace(gint amount, gboolean alternative);
 
-
-#if ! GLIB_CHECK_VERSION(2, 8, 0)
-#define G_GNUC_NULL_TERMINATED
-#endif
-
 /* Frees all passed pointers if they are non-NULL, the first argument is nothing special,
  * it will also be freed, the list should be ended with NULL */
 void utils_free_pointers(gpointer first, ...) G_GNUC_NULL_TERMINATED;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list