SF.net SVN: geany:[2863] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Aug 7 16:36:08 UTC 2008


Revision: 2863
          http://geany.svn.sourceforge.net/geany/?rev=2863&view=rev
Author:   ntrel
Date:     2008-08-07 16:36:06 +0000 (Thu, 07 Aug 2008)

Log Message:
-----------
Merge changes from the custom-tab-width branch (closes #1662173).
Thanks to Joerg Desch for explaining how it needs to work.
Note: this breaks the plugin API for indentation editor_prefs.
Add separate Width indent pref (as well as the Tab Width pref).
Add 'Tabs & Spaces' Indent Type radio option pref.
Add 'Tabs and Spaces' Document menu indent option.
Note: Tabs & Spaces cannot be detected (yet) when opening files;
default file templates still only use tabs.
Set 'Detect from file' indent type setting insensitive when Tabs &
Spaces is set.
Don't change per-document auto-indent setting after changing default
auto-indentation type.
- API changes:
Add GeanyIndentPrefs struct from some GeanyEditorPrefs fields.
Replace GeanyIndentPrefs::use_tabs with GeanyIndentType field 'type'.
Add editor_get_indent_prefs() to the API, which should be used to
get the right settings for a document/editor instead of reading
any struct fields. This could also support project/filetype
indentation prefs quite easily.
- Core code changes:
Move toggle_prefs to a function toggle_items_foreach(), which takes
a PREF_DISPLAY or PREF_UPDATE argument. This means the PrefEntry
array can contain runtime fields, so can read pointer contents.
Add pref_item_callbacks array of functions to call;
toggle_items_foreach(), spin_items_foreach(), radio_items_foreach(),
combo_items_foreach().
Update keyfile.c to use foreach-style functions for SettingEntry
arrays, like the new PrefEntry code in prefs.c.
Add get_indent_size_after_line() to replace get_indent() for
clarity, and to fix Tabs & Spaces auto-indentation > basic.
Remove opening-brace indent code from get_indent() as it's now in
get_brace_indent().
Change editor_close_block() to use sci_get_line_indentation() for
clarity.
Make editor_close_block() static.
Add editor_init().

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/TODO
    trunk/geany.glade
    trunk/plugins/export.c
    trunk/src/callbacks.c
    trunk/src/callbacks.h
    trunk/src/document.c
    trunk/src/editor.c
    trunk/src/editor.h
    trunk/src/interface.c
    trunk/src/keyfile.c
    trunk/src/main.c
    trunk/src/plugindata.h
    trunk/src/plugins.c
    trunk/src/prefs.c
    trunk/src/ui_utils.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-08-07 15:32:56 UTC (rev 2862)
+++ trunk/ChangeLog	2008-08-07 16:36:06 UTC (rev 2863)
@@ -1,3 +1,47 @@
+2008-08-07  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/interface.c, src/prefs.c, src/plugindata.h, src/callbacks.c,
+   src/callbacks.h, src/keyfile.c, src/document.c, src/plugins.c,
+   src/main.c, src/editor.c, src/editor.h, src/ui_utils.c, geany.glade,
+   plugins/export.c, TODO:
+   Merge changes from the custom-tab-width branch (closes #1662173).
+   Thanks to Joerg Desch for explaining how it needs to work.
+   Note: this breaks the plugin API for indentation editor_prefs.
+   Add separate Width indent pref (as well as the Tab Width pref).
+   Add 'Tabs & Spaces' Indent Type radio option pref.
+   Add 'Tabs and Spaces' Document menu indent option.
+   Note: Tabs & Spaces cannot be detected (yet) when opening files;
+   default file templates still only use tabs.
+   Set 'Detect from file' indent type setting insensitive when Tabs &
+   Spaces is set.
+   Don't change per-document auto-indent setting after changing default
+   auto-indentation type.
+ - API changes:
+   Add GeanyIndentPrefs struct from some GeanyEditorPrefs fields.
+   Replace GeanyIndentPrefs::use_tabs with GeanyIndentType field 'type'.
+   Add editor_get_indent_prefs() to the API, which should be used to
+   get the right settings for a document/editor instead of reading
+   any struct fields. This could also support project/filetype
+   indentation prefs quite easily.
+ - Core code changes:
+   Move toggle_prefs to a function toggle_items_foreach(), which takes
+   a PREF_DISPLAY or PREF_UPDATE argument. This means the PrefEntry
+   array can contain runtime fields, so can read pointer contents.
+   Add pref_item_callbacks array of functions to call;
+   toggle_items_foreach(), spin_items_foreach(), radio_items_foreach(),
+   combo_items_foreach().
+   Update keyfile.c to use foreach-style functions for SettingEntry
+   arrays, like the new PrefEntry code in prefs.c.
+   Add get_indent_size_after_line() to replace get_indent() for
+   clarity, and to fix Tabs & Spaces auto-indentation > basic.
+   Remove opening-brace indent code from get_indent() as it's now in
+   get_brace_indent().
+   Change editor_close_block() to use sci_get_line_indentation() for
+   clarity.
+   Make editor_close_block() static.
+   Add editor_init().
+
+
 2008-08-05  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/vte.c:

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2008-08-07 15:32:56 UTC (rev 2862)
+++ trunk/TODO	2008-08-07 16:36:06 UTC (rev 2863)
@@ -18,9 +18,6 @@
 	o recent projects menu
 	o project indentation settings support
 	o improve Compile toolbar button for Make (drop down radio list?)
-	o (for spaces indentation, distinguish between tab width vs. indent
-	  width, e.g. GTK code uses indent width of 2 spaces, and any tabs are
-	  worth 8 spaces.)
 	o (selectable menu of arguments to use for Make, from Make Custom)
 	o (DBUS)
 	o (indent wrapped lines  - Scintilla issue)

Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade	2008-08-07 15:32:56 UTC (rev 2862)
+++ trunk/geany.glade	2008-08-07 16:36:06 UTC (rev 2863)
@@ -58,7 +58,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2548">
+			<widget class="GtkImage" id="image2576">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-new</property>
 			  <property name="icon_size">1</property>
@@ -148,7 +148,7 @@
 		      <signal name="activate" handler="on_save_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2549">
+			<widget class="GtkImage" id="image2577">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-save</property>
 			  <property name="icon_size">1</property>
@@ -169,7 +169,7 @@
 		      <signal name="activate" handler="on_toolbutton23_clicked" last_modification_time="Mon, 24 Jul 2006 19:26:04 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2550">
+			<widget class="GtkImage" id="image2578">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-revert-to-saved</property>
 			  <property name="icon_size">1</property>
@@ -189,7 +189,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2551">
+			<widget class="GtkImage" id="image2579">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-revert-to-saved</property>
 			  <property name="icon_size">1</property>
@@ -277,7 +277,7 @@
 		      <signal name="activate" handler="on_close_other_documents1_activate" last_modification_time="Fri, 27 Jun 2008 15:19:28 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2552">
+			<widget class="GtkImage" id="image2580">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-close</property>
 			  <property name="icon_size">1</property>
@@ -299,7 +299,7 @@
 		      <signal name="activate" handler="on_close_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2553">
+			<widget class="GtkImage" id="image2581">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-close</property>
 			  <property name="icon_size">1</property>
@@ -498,7 +498,7 @@
 			      <signal name="activate" handler="on_menu_increase_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
 
 			      <child internal-child="image">
-				<widget class="GtkImage" id="image2554">
+				<widget class="GtkImage" id="image2582">
 				  <property name="visible">True</property>
 				  <property name="stock">gtk-indent</property>
 				  <property name="icon_size">1</property>
@@ -519,7 +519,7 @@
 			      <signal name="activate" handler="on_menu_decrease_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
 
 			      <child internal-child="image">
-				<widget class="GtkImage" id="image2555">
+				<widget class="GtkImage" id="image2583">
 				  <property name="visible">True</property>
 				  <property name="stock">gtk-unindent</property>
 				  <property name="icon_size">1</property>
@@ -575,7 +575,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2556">
+			<widget class="GtkImage" id="image2584">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-add</property>
 			  <property name="icon_size">1</property>
@@ -660,7 +660,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2557">
+			<widget class="GtkImage" id="image2585">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-add</property>
 			  <property name="icon_size">1</property>
@@ -692,7 +692,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2558">
+			<widget class="GtkImage" id="image2586">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-add</property>
 			  <property name="icon_size">1</property>
@@ -790,7 +790,7 @@
 		      <signal name="activate" handler="on_replace1_activate" last_modification_time="Sun, 23 Oct 2005 13:22:36 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2559">
+			<widget class="GtkImage" id="image2587">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-find-and-replace</property>
 			  <property name="icon_size">1</property>
@@ -865,7 +865,7 @@
 		      <signal name="activate" handler="on_go_to_line1_activate" last_modification_time="Tue, 23 May 2006 17:10:49 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2560">
+			<widget class="GtkImage" id="image2588">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-jump-to</property>
 			  <property name="icon_size">1</property>
@@ -900,7 +900,7 @@
 		      <signal name="activate" handler="on_change_font1_activate" last_modification_time="Fri, 22 Apr 2005 18:58:45 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2561">
+			<widget class="GtkImage" id="image2589">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-select-font</property>
 			  <property name="icon_size">1</property>
@@ -1098,6 +1098,17 @@
 			      <signal name="activate" handler="on_spaces1_activate" last_modification_time="Thu, 04 Oct 2007 16:07:51 GMT"/>
 			    </widget>
 			  </child>
+
+			  <child>
+			    <widget class="GtkRadioMenuItem" id="tabs_and_spaces1">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">T_abs and Spaces</property>
+			      <property name="use_underline">True</property>
+			      <property name="active">False</property>
+			      <property name="group">tabs1</property>
+			      <signal name="activate" handler="on_tabs_and_spaces1_activate" last_modification_time="Thu, 31 Jul 2008 14:23:06 GMT"/>
+			    </widget>
+			  </child>
 			</widget>
 		      </child>
 		    </widget>
@@ -1329,7 +1340,7 @@
 		      <signal name="activate" handler="on_project_new1_activate" last_modification_time="Thu, 18 Jan 2007 22:16:24 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2562">
+			<widget class="GtkImage" id="image2590">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-new</property>
 			  <property name="icon_size">1</property>
@@ -1350,7 +1361,7 @@
 		      <signal name="activate" handler="on_project_open1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2563">
+			<widget class="GtkImage" id="image2591">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-open</property>
 			  <property name="icon_size">1</property>
@@ -1371,7 +1382,7 @@
 		      <signal name="activate" handler="on_project_close1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2564">
+			<widget class="GtkImage" id="image2592">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-close</property>
 			  <property name="icon_size">1</property>
@@ -1430,7 +1441,7 @@
 		      <signal name="activate" handler="on_show_color_chooser1_activate" last_modification_time="Wed, 22 Jun 2005 18:10:21 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2565">
+			<widget class="GtkImage" id="image2593">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-select-color</property>
 			  <property name="icon_size">1</property>
@@ -1472,7 +1483,7 @@
 		      <signal name="activate" handler="on_menu_reload_configuration1_activate" last_modification_time="Mon, 30 Jun 2008 16:19:40 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2566">
+			<widget class="GtkImage" id="image2594">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-refresh</property>
 			  <property name="icon_size">1</property>
@@ -1506,7 +1517,7 @@
 		      <signal name="activate" handler="on_help1_activate" last_modification_time="Sun, 24 Jul 2005 15:23:11 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2567">
+			<widget class="GtkImage" id="image2595">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-help</property>
 			  <property name="icon_size">1</property>
@@ -5358,7 +5369,7 @@
 			      <child>
 				<widget class="GtkTable" id="table13">
 				  <property name="visible">True</property>
-				  <property name="n_rows">4</property>
+				  <property name="n_rows">7</property>
 				  <property name="n_columns">2</property>
 				  <property name="homogeneous">False</property>
 				  <property name="row_spacing">3</property>
@@ -5373,7 +5384,7 @@
 				      <property name="justify">GTK_JUSTIFY_LEFT</property>
 				      <property name="wrap">False</property>
 				      <property name="selectable">False</property>
-				      <property name="xalign">0.5</property>
+				      <property name="xalign">0</property>
 				      <property name="yalign">0.5</property>
 				      <property name="xpad">0</property>
 				      <property name="ypad">0</property>
@@ -5385,8 +5396,8 @@
 				    <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="top_attach">6</property>
+				      <property name="bottom_attach">7</property>
 				      <property name="x_options">fill</property>
 				      <property name="y_options"></property>
 				    </packing>
@@ -5405,40 +5416,45 @@
 				    <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="top_attach">6</property>
+				      <property name="bottom_attach">7</property>
 				      <property name="x_options">fill</property>
 				      <property name="y_options">fill</property>
 				    </packing>
 				  </child>
 
 				  <child>
-				    <widget class="GtkSpinButton" id="spin_tab_width">
+				    <widget class="GtkLabel" id="label200">
 				      <property name="visible">True</property>
-				      <property name="tooltip" translatable="yes">The width in chars, which one tab character will take</property>
-				      <property name="can_focus">True</property>
-				      <property name="climb_rate">1</property>
-				      <property name="digits">0</property>
-				      <property name="numeric">True</property>
-				      <property name="update_policy">GTK_UPDATE_IF_VALID</property>
-				      <property name="snap_to_ticks">False</property>
-				      <property name="wrap">True</property>
-				      <property name="adjustment">1 1 99 1 10 10</property>
+				      <property name="label" translatable="yes">Type:</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">1</property>
-				      <property name="right_attach">2</property>
-				      <property name="top_attach">2</property>
-				      <property name="bottom_attach">3</property>
+				      <property name="left_attach">0</property>
+				      <property name="right_attach">1</property>
+				      <property name="top_attach">1</property>
+				      <property name="bottom_attach">2</property>
 				      <property name="x_options">fill</property>
 				      <property name="y_options"></property>
 				    </packing>
 				  </child>
 
 				  <child>
-				    <widget class="GtkLabel" id="label116">
+				    <widget class="GtkLabel" id="label222">
 				      <property name="visible">True</property>
-				      <property name="label" translatable="yes">Tab width:</property>
+				      <property name="label" translatable="yes">Width:</property>
 				      <property name="use_underline">False</property>
 				      <property name="use_markup">False</property>
 				      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -5456,6 +5472,51 @@
 				    <packing>
 				      <property name="left_attach">0</property>
 				      <property name="right_attach">1</property>
+				      <property name="top_attach">0</property>
+				      <property name="bottom_attach">1</property>
+				      <property name="x_options">fill</property>
+				      <property name="y_options"></property>
+				    </packing>
+				  </child>
+
+				  <child>
+				    <widget class="GtkSpinButton" id="spin_indent_width">
+				      <property name="visible">True</property>
+				      <property name="tooltip" translatable="yes">The width in chars of a single indent</property>
+				      <property name="can_focus">True</property>
+				      <property name="climb_rate">1</property>
+				      <property name="digits">0</property>
+				      <property name="numeric">True</property>
+				      <property name="update_policy">GTK_UPDATE_IF_VALID</property>
+				      <property name="snap_to_ticks">False</property>
+				      <property name="wrap">True</property>
+				      <property name="adjustment">1 1 99 1 10 10</property>
+				    </widget>
+				    <packing>
+				      <property name="left_attach">1</property>
+				      <property name="right_attach">2</property>
+				      <property name="top_attach">0</property>
+				      <property name="bottom_attach">1</property>
+				      <property name="y_options"></property>
+				    </packing>
+				  </child>
+
+				  <child>
+				    <widget class="GtkRadioButton" id="radio_indent_spaces">
+				      <property name="visible">True</property>
+				      <property name="tooltip" translatable="yes">Use spaces when inserting indentation</property>
+				      <property name="can_focus">True</property>
+				      <property name="label" translatable="yes">_Spaces</property>
+				      <property name="use_underline">True</property>
+				      <property name="relief">GTK_RELIEF_NORMAL</property>
+				      <property name="focus_on_click">True</property>
+				      <property name="active">False</property>
+				      <property name="inconsistent">False</property>
+				      <property name="draw_indicator">True</property>
+				    </widget>
+				    <packing>
+				      <property name="left_attach">1</property>
+				      <property name="right_attach">2</property>
 				      <property name="top_attach">2</property>
 				      <property name="bottom_attach">3</property>
 				      <property name="x_options">fill</property>
@@ -5464,86 +5525,125 @@
 				  </child>
 
 				  <child>
-				    <widget class="GtkHBox" id="hbox8">
+				    <widget class="GtkRadioButton" id="radio_indent_tabs">
 				      <property name="visible">True</property>
-				      <property name="homogeneous">False</property>
-				      <property name="spacing">12</property>
+				      <property name="tooltip" translatable="yes">Use one tab per indent</property>
+				      <property name="can_focus">True</property>
+				      <property name="label" translatable="yes">_Tabs</property>
+				      <property name="use_underline">True</property>
+				      <property name="relief">GTK_RELIEF_NORMAL</property>
+				      <property name="focus_on_click">True</property>
+				      <property name="active">False</property>
+				      <property name="inconsistent">False</property>
+				      <property name="draw_indicator">True</property>
+				      <property name="group">radio_indent_spaces</property>
+				    </widget>
+				    <packing>
+				      <property name="left_attach">1</property>
+				      <property name="right_attach">2</property>
+				      <property name="top_attach">1</property>
+				      <property name="bottom_attach">2</property>
+				      <property name="x_options">fill</property>
+				      <property name="y_options"></property>
+				    </packing>
+				  </child>
 
-				      <child>
-					<widget class="GtkRadioButton" id="radio_indent_tabs">
-					  <property name="visible">True</property>
-					  <property name="tooltip" translatable="yes">Whether to use tabs or spaces when indentation is inserted.</property>
-					  <property name="can_focus">True</property>
-					  <property name="label" translatable="yes">_Tabs</property>
-					  <property name="use_underline">True</property>
-					  <property name="relief">GTK_RELIEF_NORMAL</property>
-					  <property name="focus_on_click">True</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="GtkRadioButton" id="radio_indent_spaces">
-					  <property name="visible">True</property>
-					  <property name="tooltip" translatable="yes">Whether to use tabs or spaces when indentation is inserted.</property>
-					  <property name="can_focus">True</property>
-					  <property name="label" translatable="yes">_Spaces</property>
-					  <property name="use_underline">True</property>
-					  <property name="relief">GTK_RELIEF_NORMAL</property>
-					  <property name="focus_on_click">True</property>
-					  <property name="active">False</property>
-					  <property name="inconsistent">False</property>
-					  <property name="draw_indicator">True</property>
-					  <property name="group">radio_indent_tabs</property>
-					</widget>
-					<packing>
-					  <property name="padding">0</property>
-					  <property name="expand">False</property>
-					  <property name="fill">False</property>
-					</packing>
-				      </child>
+				  <child>
+				    <widget class="GtkRadioButton" id="radio_indent_both">
+				      <property name="visible">True</property>
+				      <property name="tooltip" translatable="yes">Use spaces if the total indent is less than the tab width, otherwise use both</property>
+				      <property name="can_focus">True</property>
+				      <property name="label" translatable="yes">T_abs and Spaces</property>
+				      <property name="use_underline">True</property>
+				      <property name="relief">GTK_RELIEF_NORMAL</property>
+				      <property name="focus_on_click">True</property>
+				      <property name="active">False</property>
+				      <property name="inconsistent">False</property>
+				      <property name="draw_indicator">True</property>
+				      <property name="group">radio_indent_spaces</property>
+				      <signal name="toggled" handler="on_radio_indent_both_toggled" last_modification_time="Tue, 05 Aug 2008 15:14:37 GMT"/>
 				    </widget>
 				    <packing>
 				      <property name="left_attach">1</property>
 				      <property name="right_attach">2</property>
-				      <property name="top_attach">0</property>
-				      <property name="bottom_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="GtkLabel" id="label200">
+				    <widget class="GtkAlignment" id="alignment41">
 				      <property name="visible">True</property>
-				      <property name="label" translatable="yes">Type:</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="xalign">0.5</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>
+				      <property name="xscale">1</property>
+				      <property name="yscale">1</property>
+				      <property name="top_padding">0</property>
+				      <property name="bottom_padding">0</property>
+				      <property name="left_padding">24</property>
+				      <property name="right_padding">0</property>
+
+				      <child>
+					<widget class="GtkHBox" id="hbox13">
+					  <property name="visible">True</property>
+					  <property name="homogeneous">False</property>
+					  <property name="spacing">12</property>
+
+					  <child>
+					    <widget class="GtkLabel" id="label221">
+					      <property name="visible">True</property>
+					      <property name="label" translatable="yes">Tab Width:</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.5</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="padding">0</property>
+					      <property name="expand">False</property>
+					      <property name="fill">False</property>
+					    </packing>
+					  </child>
+
+					  <child>
+					    <widget class="GtkSpinButton" id="spin_tab_width">
+					      <property name="visible">True</property>
+					      <property name="tooltip" translatable="yes">The width of a tab when Tabs & Spaces is set for a document</property>
+					      <property name="can_focus">True</property>
+					      <property name="climb_rate">1</property>
+					      <property name="digits">0</property>
+					      <property name="numeric">True</property>
+					      <property name="update_policy">GTK_UPDATE_IF_VALID</property>
+					      <property name="snap_to_ticks">False</property>
+					      <property name="wrap">True</property>
+					      <property name="adjustment">8 1 99 1 10 10</property>
+					    </widget>
+					    <packing>
+					      <property name="padding">0</property>
+					      <property name="expand">True</property>
+					      <property name="fill">True</property>
+					    </packing>
+					  </child>
+					</widget>
+				      </child>
 				    </widget>
 				    <packing>
-				      <property name="left_attach">0</property>
-				      <property name="right_attach">1</property>
-				      <property name="top_attach">0</property>
-				      <property name="bottom_attach">1</property>
+				      <property name="left_attach">1</property>
+				      <property name="right_attach">2</property>
+				      <property name="top_attach">4</property>
+				      <property name="bottom_attach">5</property>
 				      <property name="x_options">fill</property>
-				      <property name="y_options"></property>
 				    </packing>
 				  </child>
 
@@ -5563,8 +5663,8 @@
 				    <packing>
 				      <property name="left_attach">1</property>
 				      <property name="right_attach">2</property>
-				      <property name="top_attach">1</property>
-				      <property name="bottom_attach">2</property>
+				      <property name="top_attach">5</property>
+				      <property name="bottom_attach">6</property>
 				      <property name="x_options">fill</property>
 				      <property name="y_options"></property>
 				    </packing>

Modified: trunk/plugins/export.c
===================================================================
--- trunk/plugins/export.c	2008-08-07 15:32:56 UTC (rev 2862)
+++ trunk/plugins/export.c	2008-08-07 16:36:06 UTC (rev 2863)
@@ -347,6 +347,7 @@
 
 static void write_latex_file(GeanyDocument *doc, const gchar *filename, gboolean use_zoom)
 {
+	GeanyEditor *editor = doc->editor;
 	gint i, style = -1, old_style = 0, column = 0;
 	gchar c, c_next, *tmp;
 	/* 0 - fore, 1 - back, 2 - bold, 3 - italic, 4 - font size, 5 - used(0/1) */
@@ -408,8 +409,8 @@
 			}
 			case '\t':
 			{
-				gint tab_stop = geany->editor_prefs->tab_width -
-					(column % geany->editor_prefs->tab_width);
+				gint tab_width = p_editor->get_indent_prefs(editor)->tab_width;
+				gint tab_stop = tab_width - (column % tab_width);
 
 				column += tab_stop - 1; /* -1 because we add 1 at the end of the loop */
 				g_string_append_printf(body, "\\hspace*{%dem}", tab_stop);
@@ -551,6 +552,7 @@
 
 static void write_html_file(GeanyDocument *doc, const gchar *filename, gboolean use_zoom)
 {
+	GeanyEditor *editor = doc->editor;
 	gint i, style = -1, old_style = 0, column = 0;
 	gchar c, c_next;
 	/* 0 - fore, 1 - back, 2 - bold, 3 - italic, 4 - font size, 5 - used(0/1) */
@@ -625,8 +627,8 @@
 			case '\t':
 			{
 				gint j;
-				gint tab_stop = geany->editor_prefs->tab_width -
-					(column % geany->editor_prefs->tab_width);
+				gint tab_width = p_editor->get_indent_prefs(editor)->tab_width;
+				gint tab_stop = tab_width - (column % tab_width);
 
 				column += tab_stop - 1; /* -1 because we add 1 at the end of the loop */
 				for (j = 0; j < tab_stop; j++)

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2008-08-07 15:32:56 UTC (rev 2862)
+++ trunk/src/callbacks.c	2008-08-07 16:36:06 UTC (rev 2863)
@@ -1685,6 +1685,18 @@
 }
 
 
+static void change_line_indent(GeanyEditor *editor, gboolean increase)
+{
+	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
+	ScintillaObject	*sci = editor->sci;
+	gint line = sci_get_current_line(sci);
+	gint width = sci_get_line_indentation(sci, line);
+
+	width += increase ? iprefs->width : -iprefs->width;
+	sci_set_line_indentation(sci, line, width);
+}
+
+
 void
 on_menu_increase_indent1_activate      (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
@@ -1699,18 +1711,7 @@
 	}
 	else
 	{
-		gint line, ind_pos, old_pos, new_pos, step;
-
-		old_pos = sci_get_current_position(doc->editor->sci);
-		line = sci_get_line_from_position(doc->editor->sci, old_pos);
-		ind_pos = sci_get_line_indent_position(doc->editor->sci, line);
-		/* when using tabs increase cur pos by 1, when using space increase it by tab_width */
-		step = (doc->editor->use_tabs) ? 1 : editor_prefs.tab_width;
-		new_pos = (old_pos > ind_pos) ? old_pos + step : old_pos;
-
-		sci_set_current_position(doc->editor->sci, ind_pos, TRUE);
-		sci_cmd(doc->editor->sci, SCI_TAB);
-		sci_set_current_position(doc->editor->sci, new_pos, TRUE);
+		change_line_indent(doc->editor, TRUE);
 	}
 }
 
@@ -1729,25 +1730,7 @@
 	}
 	else
 	{
-		gint line, ind_pos, old_pos, new_pos, step, indent;
-
-		old_pos = sci_get_current_position(doc->editor->sci);
-		line = sci_get_line_from_position(doc->editor->sci, old_pos);
-		ind_pos = sci_get_line_indent_position(doc->editor->sci, line);
-		step = (doc->editor->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->editor->sci, line))
-			return;
-
-		sci_set_current_position(doc->editor->sci, ind_pos, TRUE);
-		indent = sci_get_line_indentation(doc->editor->sci, line);
-		indent -= editor_prefs.tab_width;
-		if (indent < 0)
-			indent = 0;
-		sci_set_line_indentation(doc->editor->sci, line, indent);
-
-		sci_set_current_position(doc->editor->sci, new_pos, TRUE);
+		change_line_indent(doc->editor, FALSE);
 	}
 }
 
@@ -2063,31 +2046,39 @@
 }
 
 
-void
-on_tabs1_activate                      (GtkMenuItem     *menuitem,
-                                        gpointer         user_data)
+static void set_indent_type(GeanyIndentType type)
 {
 	GeanyDocument *doc = document_get_current();
 
 	if (doc == NULL || ignore_callback)
 		return;
 
-	editor_set_use_tabs(doc->editor, TRUE);
+	editor_set_indent_type(doc->editor, type);
 	ui_update_statusbar(doc, -1);
 }
 
 
 void
+on_tabs1_activate                      (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+	set_indent_type(GEANY_INDENT_TYPE_TABS);
+}
+
+
+void
 on_spaces1_activate                    (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
-	GeanyDocument *doc = document_get_current();
+	set_indent_type(GEANY_INDENT_TYPE_SPACES);
+}
 
-	if (doc == NULL || ignore_callback)
-		return;
 
-	editor_set_use_tabs(doc->editor, FALSE);
-	ui_update_statusbar(doc, -1);
+void
+on_tabs_and_spaces1_activate           (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+	set_indent_type(GEANY_INDENT_TYPE_BOTH);
 }
 
 
@@ -2209,3 +2200,15 @@
 	main_reload_configuration();
 }
 
+
+void
+on_radio_indent_both_toggled           (GtkToggleButton *togglebutton,
+                                        gpointer         user_data)
+{
+	GtkWidget *check = lookup_widget(ui_widgets.prefs_dialog, "check_detect_indent");
+	gboolean active;
+
+	active = gtk_toggle_button_get_active(togglebutton);
+	gtk_widget_set_sensitive(check, !active);
+}
+

Modified: trunk/src/callbacks.h
===================================================================
--- trunk/src/callbacks.h	2008-08-07 15:32:56 UTC (rev 2862)
+++ trunk/src/callbacks.h	2008-08-07 16:36:06 UTC (rev 2863)
@@ -626,3 +626,11 @@
 void
 on_find_document_usage1_activate       (GtkMenuItem     *menuitem,
                                         gpointer         user_data);
+
+void
+on_tabs_and_spaces1_activate           (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_radio_indent_both_toggled           (GtkToggleButton *togglebutton,
+                                        gpointer         user_data);

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2008-08-07 15:32:56 UTC (rev 2862)
+++ trunk/src/document.c	2008-08-07 16:36:06 UTC (rev 2863)
@@ -303,15 +303,18 @@
 void document_apply_update_prefs(GeanyDocument *doc)
 {
 	ScintillaObject *sci;
+	GeanyEditor *editor;
 
 	g_return_if_fail(doc != NULL);
 
-	sci = doc->editor->sci;
+	editor = doc->editor;
+	sci = editor->sci;
 
 	sci_set_mark_long_lines(sci, editor_prefs.long_line_type,
 		editor_prefs.long_line_column, editor_prefs.long_line_color);
 
-	sci_set_tab_width(sci, editor_prefs.tab_width);
+	/* update indent width, tab width */
+	editor_set_indent_type(editor, editor->indent_type);
 
 	sci_set_autoc_max_height(sci, editor_prefs.symbolcompletion_max_height);
 
@@ -321,8 +324,6 @@
 
 	sci_set_folding_margin_visible(sci, editor_prefs.folding);
 
-	doc->editor->auto_indent = (editor_prefs.indent_mode != INDENT_NONE);
-
 	sci_assign_cmdkey(sci, SCK_HOME,
 		editor_prefs.smart_home_key ? SCI_VCHOMEWRAP : SCI_HOMEWRAP);
 	sci_assign_cmdkey(sci, SCK_END,  SCI_LINEENDWRAP);
@@ -571,7 +572,6 @@
 	if (text != NULL)
 		sci_convert_eols(doc->editor->sci, file_prefs.default_eol_character);
 
-	editor_set_use_tabs(doc->editor, editor_prefs.use_tabs);
 	sci_set_undo_collection(doc->editor->sci, TRUE);
 	sci_empty_undo_buffer(doc->editor->sci);
 
@@ -883,11 +883,18 @@
 }
 
 
-static gboolean detect_use_tabs(ScintillaObject *sci)
+static GeanyIndentType detect_indent_type(GeanyEditor *editor)
 {
+	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
+	ScintillaObject *sci = editor->sci;
 	gint line;
+	gboolean use_tabs;
 	gsize tabs = 0, spaces = 0;
 
+	/* TODO: tabs & spaces detection */
+	if (iprefs->type == GEANY_INDENT_TYPE_BOTH)
+		return GEANY_INDENT_TYPE_BOTH;
+
 	for (line = 0; line < sci_get_line_count(sci); line++)
 	{
 		gint pos = sci_get_position_from_line(sci, line);
@@ -905,34 +912,42 @@
 		}
 	}
 	if (spaces == 0 && tabs == 0)
-		return editor_prefs.use_tabs;
+		return iprefs->type;
 
 	/* Skew comparison by a factor of 2 in favour of default editor pref */
-	if (editor_prefs.use_tabs)
-		return ! (spaces > tabs * 2);
+	if (iprefs->type == GEANY_INDENT_TYPE_TABS)
+		use_tabs = ! (spaces > tabs * 2);
 	else
-		return (tabs > spaces * 2);
+		use_tabs = (tabs > spaces * 2);
+
+	return use_tabs ? GEANY_INDENT_TYPE_TABS : GEANY_INDENT_TYPE_SPACES;
 }
 
 
-static void set_indentation(GeanyDocument *doc)
+static void set_indentation(GeanyEditor *editor)
 {
-	/* force using tabs for indentation for Makefiles */
-	if (FILETYPE_ID(doc->file_type) == GEANY_FILETYPES_MAKE)
-		editor_set_use_tabs(doc->editor, TRUE);
-	/* force using spaces for indentation for Fortran 77 */
-	else if (FILETYPE_ID(doc->file_type) == GEANY_FILETYPES_F77)
-		editor_set_use_tabs(doc->editor, FALSE);
-	else if (! editor_prefs.detect_tab_mode)
-		editor_set_use_tabs(doc->editor, editor_prefs.use_tabs);
-	else
-	{	/* detect & set tabs/spaces */
-		gboolean use_tabs = detect_use_tabs(doc->editor->sci);
+	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
 
-		if (use_tabs != editor_prefs.use_tabs)
-			ui_set_statusbar(TRUE, _("Setting %s indentation mode."),
-				(use_tabs) ? _("Tabs") : _("Spaces"));
-		editor_set_use_tabs(doc->editor, use_tabs);
+	switch (FILETYPE_ID(editor->document->file_type))
+	{
+		case GEANY_FILETYPES_MAKE:
+			/* force using tabs for indentation for Makefiles */
+			editor_set_indent_type(editor, GEANY_INDENT_TYPE_TABS);
+			break;
+		case GEANY_FILETYPES_F77:
+			/* force using spaces for indentation for Fortran 77 */
+			editor_set_indent_type(editor, GEANY_INDENT_TYPE_SPACES);
+			break;
+		default:
+			if (iprefs->detect_type)
+			{	/* detect & set tabs/spaces */
+				GeanyIndentType type = detect_indent_type(editor);
+
+				if (type != iprefs->type)
+					ui_set_statusbar(TRUE, _("Setting %s indentation mode."),
+						(type == GEANY_INDENT_TYPE_TABS) ? _("Tabs") : _("Spaces"));
+				editor_set_indent_type(editor, type);
+			}
 	}
 }
 
@@ -1061,9 +1076,9 @@
 
 	/* set indentation settings after setting the filetype */
 	if (reload)
-		editor_set_use_tabs(doc->editor, doc->editor->use_tabs); /* resetup sci */
+		editor_set_indent_type(doc->editor, doc->editor->indent_type); /* resetup sci */
 	else
-		set_indentation(doc);
+		set_indentation(doc->editor);
 
 	document_set_text_changed(doc, FALSE);	/* also updates tab state */
 	ui_document_show_hide(doc);	/* update the document menu */

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2008-08-07 15:32:56 UTC (rev 2862)
+++ trunk/src/editor.c	2008-08-07 16:36:06 UTC (rev 2863)
@@ -74,14 +74,15 @@
 
 static void on_new_line_added(GeanyEditor *editor);
 static gboolean handle_xml(GeanyEditor *editor, gchar ch);
-static void get_indent(GeanyEditor *editor, gint pos, gboolean use_this_line);
+static void get_indent(GeanyEditor *editor, gint pos);
+static void insert_indent_after_line(GeanyEditor *editor, gint line);
 static void auto_multiline(GeanyEditor *editor, gint pos);
 static gboolean is_comment(gint lexer, gint prev_style, gint style);
 static void auto_close_bracket(ScintillaObject *sci, gint pos, gchar c);
 static void auto_table(GeanyEditor *editor, gint pos);
+static void close_block(GeanyEditor *editor, gint pos);
 
 
-
 void editor_snippets_free()
 {
 	g_hash_table_destroy(editor_prefs.snippets);
@@ -437,7 +438,7 @@
 		case '}':
 		{	/* closing bracket handling */
 			if (editor->auto_indent)
-				editor_close_block(editor->document, pos - 1);
+				close_block(editor, pos - 1);
 			break;
 		}
 		default:
@@ -706,54 +707,88 @@
 }
 
 
+static gint get_tab_width(const GeanyIndentPrefs *indent_prefs)
+{
+	if (indent_prefs->type == GEANY_INDENT_TYPE_BOTH)
+		return indent_prefs->tab_width;
+
+	return indent_prefs->width;	/* tab width = indent width */
+}
+
+
 /* Returns a string containing width chars of whitespace, filled with simple space
- * characters or with the right number of tab characters, according to the
- * use_tabs setting. (Result is filled with tabs *and* spaces if width isn't a multiple of
+ * characters or with the right number of tab characters, according to the indent prefs.
+ * (Result is filled with tabs *and* spaces if width isn't a multiple of
  * editor_prefs.tab_width). */
 static gchar *
-get_whitespace(gint width, gboolean use_tabs)
+get_whitespace(const GeanyIndentPrefs *iprefs, gint width)
 {
-	gchar *str;
+	g_return_val_if_fail(width >= 0, NULL);
 
-	g_return_val_if_fail(width > 0, NULL);
+	if (width == 0)
+		return g_strdup("");
 
-	if (use_tabs)
+	if (iprefs->type == GEANY_INDENT_TYPE_SPACES)
+	{
+		return g_strnfill(width, ' ');
+	}
+	else
 	{	/* first fill text with tabs and fill the rest with spaces */
-		gint tabs = width / editor_prefs.tab_width;
-		gint spaces = width % editor_prefs.tab_width;
+		const gint tab_width = get_tab_width(iprefs);
+		gint tabs = width / tab_width;
+		gint spaces = width % tab_width;
 		gint len = tabs + spaces;
+		gchar *str;
 
 		str = g_malloc(len + 1);
 
 		memset(str, '\t', tabs);
 		memset(str + tabs, ' ', spaces);
 		str[len] = '\0';
+		return str;
  	}
-	else
-		str = g_strnfill(width, ' ');
+}
 
-	return str;
+
+static const GeanyIndentPrefs *
+get_default_indent_prefs(void)
+{
+	/* In future this might depend on the current project. */
+	return editor_prefs.indentation;
 }
 
 
-static void check_python_indent(GeanyEditor *editor, gint pos)
+/** Get the indentation prefs for the editor.
+ * In future, the prefs might be different according to project or filetype.
+ * @warning Always get a fresh result instead of keeping a pointer to it if the editor
+ * settings may have changed, or if this function has been called for a different @a editor.
+ * @param editor The editor, or @c NULL to get the default indent prefs.
+ * @return The indent prefs. */
+const GeanyIndentPrefs *
+editor_get_indent_prefs(GeanyEditor *editor)
 {
-	ScintillaObject *sci = editor->sci;
-	gint last_char = pos - editor_get_eol_char_len(editor->document) - 1;
+	static GeanyIndentPrefs iprefs;
 
-	/* add extra indentation for Python after colon */
-	if (sci_get_char_at(sci, last_char) == ':' &&
-		sci_get_style_at(sci, last_char) == SCE_P_OPERATOR)
-	{
-		/* creates and inserts one tabulator sign or
-		 * whitespace of the amount of the tab width */
-		gchar *text = get_whitespace(editor_prefs.tab_width, editor->use_tabs);
-		sci_add_text(sci, text);
-		g_free(text);
-	}
+	iprefs = *get_default_indent_prefs();
+
+	if (!editor)
+		return &iprefs;
+
+	iprefs.type = editor->indent_type;
+	if (!editor->auto_indent)
+		iprefs.auto_indent_mode = GEANY_AUTOINDENT_NONE;
+	return &iprefs;
 }
 
 
+static gchar *get_single_indent(GeanyEditor *editor)
+{
+	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
+
+	return get_whitespace(iprefs, iprefs->width);
+}
+
+
 static void on_new_line_added(GeanyEditor *editor)
 {
 	ScintillaObject *sci = editor->sci;
@@ -763,12 +798,7 @@
 	/* simple indentation */
 	if (editor->auto_indent)
 	{
-		get_indent(editor, pos, FALSE);
-		sci_add_text(sci, indent);
-
-		if (editor_prefs.indent_mode > INDENT_BASIC &&
-			FILETYPE_ID(editor->document->file_type) == GEANY_FILETYPES_PYTHON)
-			check_python_indent(editor, pos);
+		insert_indent_after_line(editor, line - 1);
 	}
 
 	if (editor_prefs.auto_continue_multiline)
@@ -808,83 +838,124 @@
 }
 
 
-/* in place indentation of one tab or equivalent spaces */
-static void do_indent(gchar *buf, gsize len, guint *idx, gboolean use_tabs)
+/* Read indent chars for the line that pos is on into indent global variable.
+ * Note: Use sci_get_line_indentation() and get_whitespace() instead in any new code.  */
+static void get_indent(GeanyEditor *editor, gint pos)
 {
-	guint j = *idx;
+	ScintillaObject *sci = editor->sci;
+	guint i, len, j = 0;
+	gint line;
+	gchar *linebuf;
+	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
 
-	if (use_tabs)
+	line = sci_get_line_from_position(sci, pos);
+
+	len = sci_get_line_length(sci, line);
+	linebuf = sci_get_line(sci, line);
+
+	for (i = 0; i < len && j <= (sizeof(indent) - 1); i++)
 	{
-		if (j < len - 1)	/* leave room for a \0 terminator. */
-			buf[j++] = '\t';
+		if (linebuf[i] == ' ' || linebuf[i] == '\t')	/* simple indentation */
+			indent[j++] = linebuf[i];
+		else if (iprefs->auto_indent_mode <= GEANY_AUTOINDENT_BASIC)
+			break;
 	}
-	else
-	{	/* insert as many spaces as a tab would take */
-		guint k;
-		for (k = 0; k < (guint) editor_prefs.tab_width && k < len - 1; k++)
-			buf[j++] = ' ';
-	}
-	*idx = j;
+	indent[j] = '\0';
+	g_free(linebuf);
 }
 
 
-/* "use_this_line" to auto-indent only if it is a real new line
- * and ignore the case of editor_close_block */
-static void get_indent(GeanyEditor *editor, gint pos, gboolean use_this_line)
+static gint get_brace_indent(ScintillaObject *sci, gint line)
 {
-	ScintillaObject *sci = editor->sci;
-	guint i, len, j = 0;
-	gint prev_line;
+	guint i, len;
+	gint ret = 0;
 	gchar *linebuf;
 
-	prev_line = sci_get_line_from_position(sci, pos);
+	len = sci_get_line_length(sci, line);
+	linebuf = sci_get_line(sci, line);
 
-	if (! use_this_line)
-		prev_line--;
-	len = sci_get_line_length(sci, prev_line);
-	linebuf = sci_get_line(sci, prev_line);
-
-	for (i = 0; i < len && j <= (sizeof(indent) - 1); i++)
+	for (i = 0; i < len; i++)
 	{
-		if (linebuf[i] == ' ' || linebuf[i] == '\t')	/* simple indentation */
-			indent[j++] = linebuf[i];
-		else if (editor_prefs.indent_mode <= INDENT_BASIC)
+		/* i == (len - 1) prevents wrong indentation after lines like
+		 * "	{ return bless({}, shift); }" (Perl) */
+		if (linebuf[i] == '{' && i == (len - 1))
+		{
+			ret++;
 			break;
-		else if (use_this_line)
-			break;
-		else	/* editor_close_block */
+		}
+		else
 		{
-			if (! lexer_has_braces(sci))
-				break;
+			gint k = len - 1;
 
-			/* i == (len - 1) prevents wrong indentation after lines like
-			 * "	{ return bless({}, shift); }" (Perl) */
-			if (linebuf[i] == '{' && i == (len - 1))
+			while (k > 0 && isspace(linebuf[k])) k--;
+
+			/* if last non-whitespace character is a { increase indentation by a tab
+			 * e.g. for (...) { */
+			if (linebuf[k] == '{')
 			{
-				do_indent(indent, sizeof(indent), &j, editor->use_tabs);
-				break;
+				ret++;
 			}
-			else
-			{
-				gint k = len - 1;
-
-				while (k > 0 && isspace(linebuf[k])) k--;
-
-				/* if last non-whitespace character is a { increase indentation by a tab
-				 * e.g. for (...) { */
-				if (linebuf[k] == '{')
-				{
-					do_indent(indent, sizeof(indent), &j, editor->use_tabs);
-				}
-				break;
-			}
+			break;
 		}
 	}
-	indent[j] = '\0';
 	g_free(linebuf);
+	return ret;
 }
 
 
+static gint get_python_indent(ScintillaObject *sci, gint line)
+{
+	gint last_char = sci_get_line_end_position(sci, line) - 1;
+
+	/* add extra indentation for Python after colon */
+	if (sci_get_char_at(sci, last_char) == ':' &&
+		sci_get_style_at(sci, last_char) == SCE_P_OPERATOR)
+	{
+		return 1;
+	}
+	return 0;
+}
+
+
+static gint get_indent_size_after_line(GeanyEditor *editor, gint line)
+{
+	ScintillaObject *sci = editor->sci;
+	gint size;
+	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
+
+	g_return_val_if_fail(line >= 0, 0);
+
+	size = sci_get_line_indentation(sci, line);
+
+	if (iprefs->auto_indent_mode > GEANY_AUTOINDENT_BASIC)
+	{
+		if (lexer_has_braces(sci))
+			size += iprefs->width * get_brace_indent(sci, line);
+		else
+		if (FILETYPE_ID(editor->document->file_type) == GEANY_FILETYPES_PYTHON)
+			size += iprefs->width * get_python_indent(sci, line);
+	}
+	return size;
+}
+
+
+static void insert_indent_after_line(GeanyEditor *editor, gint line)
+{
+	ScintillaObject *sci = editor->sci;
+	gint size = get_indent_size_after_line(editor, line);
+	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
+
+	if (size > 0)
+	{
+		gchar *text;
+
+		text = get_whitespace(iprefs, size);
+		sci_add_text(sci, text);
+		g_free(text);
+	}
+}
+
+
 static void auto_close_bracket(ScintillaObject *sci, gint pos, gchar c)
 {
 	if (! editor_prefs.complete_snippets || SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_LATEX)
@@ -904,7 +975,7 @@
 
 /* Finds a corresponding matching brace to the given pos
  * (this is taken from Scintilla Editor.cxx,
- * fit to work with editor_close_block) */
+ * fit to work with close_block) */
 static gint brace_match(ScintillaObject *sci, gint pos)
 {
 	gchar chBrace = sci_get_char_at(sci, pos);
@@ -942,15 +1013,17 @@
 
 
 /* Called after typing '}'. */
-void editor_close_block(GeanyDocument *doc, gint pos)
+static void close_block(GeanyEditor *editor, gint pos)
 {
+	GeanyDocument *doc = editor->document;
+	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
 	gint x = 0, cnt = 0;
 	gint line, line_len, eol_char_len;
 	gchar *text, *line_buf;
 	ScintillaObject *sci;
 	gint line_indent, last_indent;
 
-	if (editor_prefs.indent_mode < INDENT_CURRENTCHARS)
+	if (iprefs->auto_indent_mode < GEANY_AUTOINDENT_CURRENTCHARS)
 		return;
 	if (doc == NULL || doc->file_type == NULL)
 		return;
@@ -979,32 +1052,35 @@
 	if ((line_len - eol_char_len - 1) != cnt)
 		return;
 
-	if (editor_prefs.indent_mode == INDENT_MATCHBRACES)
+	if (iprefs->auto_indent_mode == GEANY_AUTOINDENT_MATCHBRACES)
 	{
 		gint start_brace = brace_match(sci, pos);
 
 		if (start_brace >= 0)
 		{
 			gint line_start;
+			gint brace_line = sci_get_line_from_position(sci, start_brace);
+			gint size = sci_get_line_indentation(sci, brace_line);
+			gchar *ind = get_whitespace(iprefs, size);
 
-			get_indent(doc->editor, start_brace, TRUE);
-			text = g_strconcat(indent, "}", NULL);
+			text = g_strconcat(ind, "}", NULL);
 			line_start = sci_get_position_from_line(sci, line);
 			sci_set_anchor(sci, line_start);
 			SSM(sci, SCI_REPLACESEL, 0, (sptr_t) text);
 			g_free(text);
+			g_free(ind);
 			return;
 		}
 		/* fall through - unmatched brace (possibly because of TCL, PHP lexer bugs) */
 	}
 
-	/* INDENT_CURRENTCHARS */
+	/* GEANY_AUTOINDENT_CURRENTCHARS */
 	line_indent = sci_get_line_indentation(sci, line);
 	last_indent = sci_get_line_indentation(sci, line - 1);
 
 	if (line_indent < last_indent)
 		return;
-	line_indent -= editor_prefs.tab_width;
+	line_indent -= iprefs->width;
 	line_indent = MAX(0, line_indent);
 	sci_set_line_indentation(sci, line, line_indent);
 }
@@ -1469,7 +1545,7 @@
 
 			/* get the indentation */
 			if (editor->auto_indent)
-				get_indent(editor, pos, TRUE);
+				get_indent(editor, pos);
 			eol = g_strconcat(editor_get_eol_char(doc), indent, NULL);
 
 			construct = g_strdup_printf("%s\\end%s{%s}", eol, full_cmd, env);
@@ -1576,9 +1652,9 @@
 		return FALSE;
 	}
 
-	get_indent(editor, pos, TRUE);
+	get_indent(editor, pos);
 	lindent = g_strconcat(editor_get_eol_char(editor->document), indent, NULL);
-	whitespace = get_whitespace(editor_prefs.tab_width, editor->use_tabs);
+	whitespace = get_single_indent(editor);
 
 	/* remove the typed word, it will be added again by the used auto completion
 	 * (not really necessary but this makes the auto completion more flexible,
@@ -1806,7 +1882,7 @@
 
 	if (SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_HTML) return;
 
-	get_indent(editor, pos, TRUE);
+	get_indent(editor, pos);
 	indent_pos = sci_get_line_indent_position(sci, sci_get_line_from_position(sci, pos));
 	if ((pos - 7) != indent_pos) /* 7 == strlen("<table>") */
 	{
@@ -1825,10 +1901,10 @@
 	}
 
 	/* get indent string for generated code */
-	if (editor_prefs.indent_mode == INDENT_NONE)
+	if (editor->auto_indent)
 		indent_str = g_strdup("");
 	else
-		indent_str = get_whitespace(editor_prefs.tab_width, editor->use_tabs);
+		indent_str = get_single_indent(editor);
 
 	table = g_strconcat("\n", indent, indent_str, "<tr>\n",
 						indent, indent_str, indent_str, "<td>\n",
@@ -2198,7 +2274,7 @@
 			gint a = (first_line_was_comment) ? - co_len : co_len;
 
 			/* don't modify sel_start when the selection starts within indentation */
-			get_indent(doc->editor, sel_start, TRUE);
+			get_indent(doc->editor, sel_start);
 			if ((sel_start - first_line_start) <= (gint) strlen(indent))
 				a = 0;
 
@@ -2434,10 +2510,11 @@
 			gint cur_line = sci_get_current_line(sci);
 			gint indent_pos = sci_get_line_indent_position(sci, cur_line);
 			gint indent_len = sci_get_col_from_position(sci, indent_pos);
+			gint indent_width = editor_get_indent_prefs(editor)->width;
 
 			/* 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 % editor_prefs.tab_width == 1)
+			if (indent_len % indent_width == 1)
 				SSM(sci, SCI_DELETEBACKNOTLINE, 0, 0);	/* remove whitespace indent */
 			g_free(previous_line);
 			return;
@@ -2704,7 +2781,7 @@
 	if (editor->auto_indent &&
 		! have_multiline_comment &&	doc->file_type->comment_use_indent)
 	{
-		get_indent(editor, editor_info.click_pos, TRUE);
+		get_indent(editor, editor_info.click_pos);
 		text = g_strdup_printf("%s\n%s\n%s\n", indent, indent, indent);
 		text_len = strlen(text);
 	}
@@ -2764,10 +2841,23 @@
 }
 
 
+/* creates and inserts one tab or whitespace of the amount of the tab width */
 void editor_insert_alternative_whitespace(GeanyEditor *editor)
 {
-	/* creates and inserts one tab or whitespace of the amount of the tab width */
-	gchar *text = get_whitespace(editor_prefs.tab_width, ! editor->use_tabs);
+	gchar *text;
+	GeanyIndentPrefs iprefs = *editor_get_indent_prefs(editor);
+
+	switch (iprefs.type)
+	{
+		case GEANY_INDENT_TYPE_TABS:
+			iprefs.type = GEANY_INDENT_TYPE_SPACES;
+			break;
+		case GEANY_INDENT_TYPE_SPACES:
+		case GEANY_INDENT_TYPE_BOTH:	/* most likely we want a tab */
+			iprefs.type = GEANY_INDENT_TYPE_TABS;
+			break;
+	}
+	text = get_whitespace(&iprefs, iprefs.width);
 	sci_add_text(editor->sci, text);
 	g_free(text);
 }
@@ -2951,7 +3041,7 @@
 
 	/* get previous line and use it for get_indent to use that line
 	 * (otherwise it would fail on a line only containing "{" in advanced indentation mode) */
-	get_indent(doc->editor, sci_get_position_from_line(sci, first_line - 1), TRUE);
+	get_indent(doc->editor, sci_get_position_from_line(sci, first_line - 1));
 
 	smart_line_indentation(doc, first_line, last_line);
 
@@ -3489,14 +3579,24 @@
 }
 
 
-void editor_set_use_tabs(GeanyEditor *editor, gboolean use_tabs)
+/* Also sets indent width, tab width. */
+void editor_set_indent_type(GeanyEditor *editor, GeanyIndentType type)
 {
-	g_return_if_fail(editor != NULL);
+	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
+	ScintillaObject *sci = editor->sci;
+	gboolean use_tabs = type != GEANY_INDENT_TYPE_SPACES;
 
-	editor->use_tabs = use_tabs;
-	sci_set_use_tabs(editor->sci, use_tabs);
-	/* remove indent spaces on backspace, if using spaces to indent */
-	SSM(editor->sci, SCI_SETBACKSPACEUNINDENTS, ! use_tabs, 0);
+	editor->indent_type = type;
+	sci_set_use_tabs(sci, use_tabs);
+
+	if (type == GEANY_INDENT_TYPE_BOTH)
+		sci_set_tab_width(sci, iprefs->tab_width);
+	else
+		sci_set_tab_width(sci, iprefs->width);
+	SSM(sci, SCI_SETINDENT, iprefs->width, 0);
+
+	/* remove indent spaces on backspace, if using any spaces to indent */
+	SSM(sci, SCI_SETBACKSPACEUNINDENTS, type != GEANY_INDENT_TYPE_TABS, 0);
 }
 
 
@@ -3647,17 +3747,29 @@
 
 GeanyEditor *editor_create(GeanyDocument *doc)
 {
+	const GeanyIndentPrefs *iprefs = get_default_indent_prefs();
 	GeanyEditor *editor = g_new0(GeanyEditor, 1);
 
 	editor->document = doc;
 
-	editor->auto_indent = (editor_prefs.indent_mode != INDENT_NONE);
+	editor->sci = create_new_sci(doc);
+	editor_set_indent_type(editor, iprefs->type);
+	editor_set_font(editor, interface_prefs.editor_font);
+
+	editor->auto_indent = (iprefs->auto_indent_mode != GEANY_AUTOINDENT_NONE);
 	editor->line_wrapping = editor_prefs.line_wrapping;
 	editor->scroll_percent = -1.0F;
 	editor->line_breaking = FALSE;
-
-	editor->sci = create_new_sci(doc);
-	editor_set_font(editor, interface_prefs.editor_font);
 	return editor;
 }
 
+
+void editor_init(void)
+{
+	static GeanyIndentPrefs indent_prefs;
+
+	memset(&editor_prefs, 0, sizeof(GeanyEditorPrefs));
+	memset(&indent_prefs, 0, sizeof(GeanyIndentPrefs));
+	editor_prefs.indentation = &indent_prefs;
+}
+

Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h	2008-08-07 15:32:56 UTC (rev 2862)
+++ trunk/src/editor.h	2008-08-07 16:36:06 UTC (rev 2863)
@@ -45,20 +45,43 @@
 #define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
 
 
+/** Whether to use tabs, spaces or both to indent. */
 typedef enum
 {
-	INDENT_NONE = 0,
-	INDENT_BASIC,
-	INDENT_CURRENTCHARS,
-	INDENT_MATCHBRACES
-} IndentMode;
+	GEANY_INDENT_TYPE_SPACES,	/**< Spaces. */
+	GEANY_INDENT_TYPE_TABS,		/**< Tabs. */
+	GEANY_INDENT_TYPE_BOTH		/**< Both. */
+}
+GeanyIndentType;
 
-/* These are the default prefs when creating a new editor window.
- * Some of these can be overridden per document.
- * Remember to increment abi_version in plugindata.h when changing items. */
+typedef enum
+{
+	GEANY_AUTOINDENT_NONE = 0,
+	GEANY_AUTOINDENT_BASIC,
+	GEANY_AUTOINDENT_CURRENTCHARS,
+	GEANY_AUTOINDENT_MATCHBRACES
+}
+GeanyAutoIndent;
+
+
+/** Indentation prefs that might be different according to project or filetype.
+ * Use @c editor_get_indent_prefs() to lookup the prefs for a particular document. */
+typedef struct GeanyIndentPrefs
+{
+	gint			width;				/**< Indent width. */
+	GeanyIndentType	type;				/**< Whether to use tabs, spaces or both to indent. */
+	gint			tab_width;			/**< Width of a tab, when using GEANY_INDENT_TYPE_BOTH. */
+	GeanyAutoIndent	auto_indent_mode;
+	gboolean		detect_type;
+}
+GeanyIndentPrefs;
+
+
+/* Default prefs when creating a new editor window.
+ * Some of these can be overridden per document. */
 typedef struct GeanyEditorPrefs
 {
-	/* display */
+	GeanyIndentPrefs *indentation;	/*< Default indentation prefs. @see editor_get_indent_prefs(). */
 	gboolean	show_white_space;
 	gboolean	show_indent_guide;
 	gboolean	show_line_endings;
@@ -69,17 +92,12 @@
 	gboolean	show_linenumber_margin;		/* view menu */
 	gboolean	show_scrollbars;			/* hidden pref */
 	gboolean	scroll_stop_at_last_line;	/* hidden pref */
-
-	/* behaviour */
 	gboolean	line_wrapping;
 	gboolean	use_indicators;
 	gboolean	folding;
 	gboolean	unfold_all_children;
-	gint		tab_width;
-	gboolean	use_tabs;
-	gboolean	use_tab_to_indent;	/* hidden pref */
-	IndentMode	indent_mode;
 	gboolean	disable_dnd;
+	gboolean	use_tab_to_indent;	/* hidden pref makes pressing Tab key like Ctrl-I */
 	gboolean	smart_home_key;
 	gboolean	newline_strip;
 	gboolean	auto_complete_symbols;
@@ -91,7 +109,6 @@
 	gboolean	brace_match_ltgt;	/* whether to highlight < and > chars (hidden pref) */
 	gboolean	use_gtk_word_boundaries;	/* hidden pref */
 	gboolean	complete_snippets_whilst_editing;	/* hidden pref */
-	gboolean	detect_tab_mode;
 	gint		line_break_column;
 	gboolean	auto_continue_multiline;
 	gchar		*comment_toggle_mark;
@@ -109,7 +126,7 @@
 	gboolean		 auto_indent;	/**< @c TRUE if auto-indentation is enabled. */
 	/** Percentage to scroll view by on paint, if positive. */
 	gfloat			 scroll_percent;
-	gboolean		 use_tabs;		/**< @c TRUE if tabs are used for indentation. */
+	GeanyIndentType	 indent_type;	/* Use editor_get_indent_prefs() instead. */
 	gboolean		 line_breaking;	/**< Whether to split long lines as you type. */
 }
 GeanyEditor;
@@ -126,14 +143,14 @@
 
 
 
+void editor_init(void);
+
 GeanyEditor *editor_create(GeanyDocument *doc);
 
 void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user_data);
 
 gboolean editor_start_auto_complete(GeanyDocument *doc, gint pos, gboolean force);
 
-void editor_close_block(GeanyDocument *doc, gint pos);
-
 gboolean editor_complete_snippet(GeanyDocument *doc, gint pos);
 
 void editor_auto_latex(GeanyDocument *doc, gint pos);
@@ -217,8 +234,10 @@
 
 void editor_insert_color(GeanyDocument *doc, const gchar *colour);
 
-void editor_set_use_tabs(GeanyEditor *editor, gboolean use_tabs);
+const GeanyIndentPrefs *editor_get_indent_prefs(GeanyEditor *editor);
 
+void editor_set_indent_type(GeanyEditor *editor, GeanyIndentType type);
+
 void editor_set_line_wrapping(GeanyEditor *editor, gboolean wrap);
 
 gboolean editor_goto_pos(GeanyEditor *editor, gint pos, gboolean mark);

Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c	2008-08-07 15:32:56 UTC (rev 2862)
+++ trunk/src/interface.c	2008-08-07 16:36:06 UTC (rev 2863)
@@ -37,7 +37,7 @@
   GtkWidget *file1_menu;
   GtkWidget *menu_new1;
   GtkWidget *menu_new_with_template1;
-  GtkWidget *image2548;
+  GtkWidget *image2576;
   GtkWidget *menu_new_with_template1_menu;
   GtkWidget *invisible2;
   GtkWidget *separator12;
@@ -48,11 +48,11 @@
   GtkWidget *menu_save1;
   GtkWidget *menu_save_as1;
   GtkWidget *menu_save_all1;
-  GtkWidget *image2549;
+  GtkWidget *image2577;
   GtkWidget *menu_reload1;
-  GtkWidget *image2550;
+  GtkWidget *image2578;
   GtkWidget *menu_reload_as1;
-  GtkWidget *image2551;
+  GtkWidget *image2579;
   GtkWidget *menu_reload_as1_menu;
   GtkWidget *invisible7;
   GtkWidget *separator21;
@@ -63,9 +63,9 @@
   GtkWidget *separator14;
   GtkWidget *menu_close1;
   GtkWidget *close_other_documents1;
-  GtkWidget *image2552;
+  GtkWidget *image2580;
   GtkWidget *menu_close_all1;
-  GtkWidget *image2553;
+  GtkWidget *image2581;
   GtkWidget *menu_separatormenuitem1;
   GtkWidget *menu_quit1;
   GtkWidget *edit1;
@@ -90,16 +90,16 @@
   GtkWidget *menu_duplicate_line1;
   GtkWidget *separator29;
   GtkWidget *menu_increase_indent1;
-  GtkWidget *image2554;
+  GtkWidget *image2582;
   GtkWidget *menu_decrease_indent1;
-  GtkWidget *image2555;
+  GtkWidget *image2583;
   GtkWidget *separator37;
   GtkWidget *send_selection_to2;
   GtkWidget *send_selection_to2_menu;
   GtkWidget *invisible13;
   GtkWidget *separator18;
   GtkWidget *add_comments1;
-  GtkWidget *image2556;
+  GtkWidget *image2584;
   GtkWidget *add_comments1_menu;
   GtkWidget *menu_add_changelog_entry1;
   GtkWidget *insert_file_header1;
@@ -108,11 +108,11 @@
   GtkWidget *insert_gpl_notice2;
   GtkWidget *insert_bsd_license_notice2;
   GtkWidget *insert_date1;
-  GtkWidget *image2557;
+  GtkWidget *image2585;
   GtkWidget *insert_date1_menu;
   GtkWidget *invisible8;
   GtkWidget *insert_include2;
-  GtkWidget *image2558;
+  GtkWidget *image2586;
   GtkWidget *insert_include2_menu;
   GtkWidget *invisible4;
   GtkWidget *separator9;
@@ -124,7 +124,7 @@
   GtkWidget *find_previous1;
   GtkWidget *find_in_files1;
   GtkWidget *replace1;
-  GtkWidget *image2559;
+  GtkWidget *image2587;
   GtkWidget *separator33;
   GtkWidget *find_nextsel1;
   GtkWidget *find_prevsel1;
@@ -133,11 +133,11 @@
   GtkWidget *previous_message1;
   GtkWidget *separator32;
   GtkWidget *go_to_line1;
-  GtkWidget *image2560;
+  GtkWidget *image2588;
   GtkWidget *menu_view1;
   GtkWidget *menu_view1_menu;
   GtkWidget *menu_change_font1;
-  GtkWidget *image2561;
+  GtkWidget *image2589;
   GtkWidget *menu_separator4;
   GtkWidget *menu_toggle_all_additional_widgets1;
   GtkWidget *menu_fullscreen1;
@@ -160,6 +160,7 @@
   GSList *tabs1_group = NULL;
   GtkWidget *tabs1;
   GtkWidget *spaces1;
+  GtkWidget *tabs_and_spaces1;
   GtkWidget *separator45;
   GtkWidget *set_file_readonly1;
   GtkWidget *menu_write_unicode_bom1;
@@ -189,26 +190,26 @@
   GtkWidget *menu_project1;
   GtkWidget *menu_project1_menu;
   GtkWidget *project_new1;
-  GtkWidget *image2562;
+  GtkWidget *image2590;
   GtkWidget *project_open1;
-  GtkWidget *image2563;
+  GtkWidget *image2591;
   GtkWidget *project_close1;
-  GtkWidget *image2564;
+  GtkWidget *image2592;
   GtkWidget *separator34;
   GtkWidget *project_properties1;
   GtkWidget *menu_build1;
   GtkWidget *tools1;
   GtkWidget *tools1_menu;
   GtkWidget *menu_choose_color1;
-  GtkWidget *image2565;
+  GtkWidget *image2593;
   GtkWidget *menu_count_words1;
   GtkWidget *load_tags1;
   GtkWidget *menu_reload_configuration1;
-  GtkWidget *image2566;
+  GtkWidget *image2594;
   GtkWidget *menu_help1;
   GtkWidget *menu_help1_menu;
   GtkWidget *help1;
-  GtkWidget *image2567;
+  GtkWidget *image2595;
   GtkWidget *keyboard_shortcuts1;
   GtkWidget *website1;
   GtkWidget *separator16;
@@ -311,9 +312,9 @@
   gtk_widget_show (menu_new_with_template1);
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_new_with_template1);
 
-  image2548 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2548);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image2548);
+  image2576 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2576);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image2576);
 
   menu_new_with_template1_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_new_with_template1), menu_new_with_template1_menu);
@@ -356,25 +357,25 @@
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_save_all1);
   gtk_tooltips_set_tip (tooltips, menu_save_all1, _("Saves all open files"), NULL);
 
-  image2549 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2549);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image2549);
+  image2577 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2577);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image2577);
 
   menu_reload1 = gtk_image_menu_item_new_with_mnemonic (_("_Reload"));
   gtk_widget_show (menu_reload1);
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_reload1);
 
-  image2550 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2550);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image2550);
+  image2578 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2578);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image2578);
 
   menu_reload_as1 = gtk_image_menu_item_new_with_mnemonic (_("R_eload As"));
   gtk_widget_show (menu_reload_as1);
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_reload_as1);
 
-  image2551 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2551);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image2551);
+  image2579 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2579);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image2579);
 
   menu_reload_as1_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_reload_as1), menu_reload_as1_menu);
@@ -418,18 +419,18 @@
   gtk_widget_show (close_other_documents1);
   gtk_container_add (GTK_CONTAINER (file1_menu), close_other_documents1);
 
-  image2552 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2552);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (close_other_documents1), image2552);
+  image2580 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2580);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (close_other_documents1), image2580);
 
   menu_close_all1 = gtk_image_menu_item_new_with_mnemonic (_("C_lose All"));
   gtk_widget_show (menu_close_all1);
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_close_all1);
   gtk_tooltips_set_tip (tooltips, menu_close_all1, _("Closes all open files"), NULL);
 
-  image2553 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2553);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image2553);
+  image2581 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2581);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image2581);
 
   menu_separatormenuitem1 = gtk_separator_menu_item_new ();
   gtk_widget_show (menu_separatormenuitem1);
@@ -533,17 +534,17 @@
   gtk_widget_show (menu_increase_indent1);
   gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_increase_indent1);
 
-  image2554 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2554);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image2554);
+  image2582 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2582);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image2582);
 
   menu_decrease_indent1 = gtk_image_menu_item_new_with_mnemonic (_("_Decrease Indent"));
   gtk_widget_show (menu_decrease_indent1);
   gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_decrease_indent1);
 
-  image2555 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2555);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image2555);
+  image2583 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2583);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image2583);
 
   separator37 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator37);
@@ -569,9 +570,9 @@
   gtk_widget_show (add_comments1);
   gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1);
 
-  image2556 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2556);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image2556);
+  image2584 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2584);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image2584);
 
   add_comments1_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu);
@@ -610,9 +611,9 @@
   gtk_widget_show (insert_date1);
   gtk_container_add (GTK_CONTAINER (edit1_menu), insert_date1);
 
-  image2557 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2557);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date1), image2557);
+  image2585 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2585);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date1), image2585);
 
   insert_date1_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_date1), insert_date1_menu);
@@ -624,9 +625,9 @@
   gtk_widget_show (insert_include2);
   gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2);
 
-  image2558 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2558);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image2558);
+  image2586 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2586);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image2586);
 
   insert_include2_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu);
@@ -670,9 +671,9 @@
   gtk_widget_show (replace1);
   gtk_container_add (GTK_CONTAINER (search1_menu), replace1);
 
-  image2559 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2559);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image2559);
+  image2587 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2587);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image2587);
 
   separator33 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator33);
@@ -709,9 +710,9 @@
   gtk_widget_show (go_to_line1);
   gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1);
 
-  image2560 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2560);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image2560);
+  image2588 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2588);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image2588);
 
   menu_view1 = gtk_menu_item_new_with_mnemonic (_("_View"));
   gtk_widget_show (menu_view1);
@@ -725,9 +726,9 @@
   gtk_container_add (GTK_CONTAINER (menu_view1_menu), menu_change_font1);
   gtk_tooltips_set_tip (tooltips, menu_change_font1, _("Change the default font"), NULL);
 
-  image2561 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2561);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image2561);
+  image2589 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2589);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image2589);
 
   menu_separator4 = gtk_separator_menu_item_new ();
   gtk_widget_show (menu_separator4);
@@ -829,6 +830,11 @@
   gtk_container_add (GTK_CONTAINER (indent_type1_menu), spaces1);
   gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (spaces1), TRUE);
 
+  tabs_and_spaces1 = gtk_radio_menu_item_new_with_mnemonic (tabs1_group, _("T_abs and Spaces"));
+  tabs1_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (tabs_and_spaces1));
+  gtk_widget_show (tabs_and_spaces1);
+  gtk_container_add (GTK_CONTAINER (indent_type1_menu), tabs_and_spaces1);
+
   separator45 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator45);
   gtk_container_add (GTK_CONTAINER (menu_document1_menu), separator45);
@@ -952,25 +958,25 @@
   gtk_widget_show (project_new1);
   gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_new1);
 
-  image2562 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2562);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image2562);
+  image2590 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2590);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image2590);
 
   project_open1 = gtk_image_menu_item_new_with_mnemonic (_("_Open"));
   gtk_widget_show (project_open1);
   gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_open1);
 
-  image2563 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2563);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image2563);
+  image2591 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2591);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image2591);
 
   project_close1 = gtk_image_menu_item_new_with_mnemonic (_("_Close"));
   gtk_widget_show (project_close1);
   gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_close1);
 
-  image2564 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2564);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image2564);
+  image2592 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2592);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image2592);
 
   separator34 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator34);
@@ -997,9 +1003,9 @@
   gtk_container_add (GTK_CONTAINER (tools1_menu), menu_choose_color1);
   gtk_tooltips_set_tip (tooltips, menu_choose_color1, _("Open a color chooser dialog, to interactively pick colors from a palette."), NULL);
 
-  image2565 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2565);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image2565);
+  image2593 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2593);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image2593);
 
   menu_count_words1 = gtk_menu_item_new_with_mnemonic (_("_Word Count"));
   gtk_widget_show (menu_count_words1);
@@ -1016,9 +1022,9 @@
   gtk_container_add (GTK_CONTAINER (tools1_menu), menu_reload_configuration1);
   gtk_tooltips_set_tip (tooltips, menu_reload_configuration1, _("Reload configuration data like snippets, templates and filetype extensions."), NULL);
 
-  image2566 = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2566);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_configuration1), image2566);
+  image2594 = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2594);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_configuration1), image2594);
 
   menu_help1 = gtk_menu_item_new_with_mnemonic (_("_Help"));
   gtk_widget_show (menu_help1);
@@ -1031,9 +1037,9 @@
   gtk_widget_show (help1);
   gtk_container_add (GTK_CONTAINER (menu_help1_menu), help1);
 
-  image2567 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2567);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image2567);
+  image2595 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2595);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image2595);
 
   keyboard_shortcuts1 = gtk_menu_item_new_with_mnemonic (_("_Keyboard Shortcuts"));
   gtk_widget_show (keyboard_shortcuts1);
@@ -1556,6 +1562,9 @@
   g_signal_connect ((gpointer) spaces1, "activate",
                     G_CALLBACK (on_spaces1_activate),
                     NULL);
+  g_signal_connect ((gpointer) tabs_and_spaces1, "activate",
+                    G_CALLBACK (on_tabs_and_spaces1_activate),
+                    NULL);
   g_signal_connect ((gpointer) set_file_readonly1, "toggled",
                     G_CALLBACK (on_set_file_readonly1_toggled),
                     NULL);
@@ -1734,7 +1743,7 @@
   GLADE_HOOKUP_OBJECT (window1, file1_menu, "file1_menu");
   GLADE_HOOKUP_OBJECT (window1, menu_new1, "menu_new1");
   GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1, "menu_new_with_template1");
-  GLADE_HOOKUP_OBJECT (window1, image2548, "image2548");
+  GLADE_HOOKUP_OBJECT (window1, image2576, "image2576");
   GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1_menu, "menu_new_with_template1_menu");
   GLADE_HOOKUP_OBJECT (window1, invisible2, "invisible2");
   GLADE_HOOKUP_OBJECT (window1, separator12, "separator12");
@@ -1745,11 +1754,11 @@
   GLADE_HOOKUP_OBJECT (window1, menu_save1, "menu_save1");
   GLADE_HOOKUP_OBJECT (window1, menu_save_as1, "menu_save_as1");
   GLADE_HOOKUP_OBJECT (window1, menu_save_all1, "menu_save_all1");
-  GLADE_HOOKUP_OBJECT (window1, image2549, "image2549");
+  GLADE_HOOKUP_OBJECT (window1, image2577, "image2577");
   GLADE_HOOKUP_OBJECT (window1, menu_reload1, "menu_reload1");
-  GLADE_HOOKUP_OBJECT (window1, image2550, "image2550");
+  GLADE_HOOKUP_OBJECT (window1, image2578, "image2578");
   GLADE_HOOKUP_OBJECT (window1, menu_reload_as1, "menu_reload_as1");
-  GLADE_HOOKUP_OBJECT (window1, image2551, "image2551");
+  GLADE_HOOKUP_OBJECT (window1, image2579, "image2579");
   GLADE_HOOKUP_OBJECT (window1, menu_reload_as1_menu, "menu_reload_as1_menu");
   GLADE_HOOKUP_OBJECT (window1, invisible7, "invisible7");
   GLADE_HOOKUP_OBJECT (window1, separator21, "separator21");
@@ -1760,9 +1769,9 @@
   GLADE_HOOKUP_OBJECT (window1, separator14, "separator14");
   GLADE_HOOKUP_OBJECT (window1, menu_close1, "menu_close1");
   GLADE_HOOKUP_OBJECT (window1, close_other_documents1, "close_other_documents1");
-  GLADE_HOOKUP_OBJECT (window1, image2552, "image2552");
+  GLADE_HOOKUP_OBJECT (window1, image2580, "image2580");
   GLADE_HOOKUP_OBJECT (window1, menu_close_all1, "menu_close_all1");
-  GLADE_HOOKUP_OBJECT (window1, image2553, "image2553");
+  GLADE_HOOKUP_OBJECT (window1, image2581, "image2581");
   GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1");
   GLADE_HOOKUP_OBJECT (window1, menu_quit1, "menu_quit1");
   GLADE_HOOKUP_OBJECT (window1, edit1, "edit1");
@@ -1787,16 +1796,16 @@
   GLADE_HOOKUP_OBJECT (window1, menu_duplicate_line1, "menu_duplicate_line1");
   GLADE_HOOKUP_OBJECT (window1, separator29, "separator29");
   GLADE_HOOKUP_OBJECT (window1, menu_increase_indent1, "menu_increase_indent1");
-  GLADE_HOOKUP_OBJECT (window1, image2554, "image2554");
+  GLADE_HOOKUP_OBJECT (window1, image2582, "image2582");
   GLADE_HOOKUP_OBJECT (window1, menu_decrease_indent1, "menu_decrease_indent1");
-  GLADE_HOOKUP_OBJECT (window1, image2555, "image2555");
+  GLADE_HOOKUP_OBJECT (window1, image2583, "image2583");
   GLADE_HOOKUP_OBJECT (window1, separator37, "separator37");
   GLADE_HOOKUP_OBJECT (window1, send_selection_to2, "send_selection_to2");
   GLADE_HOOKUP_OBJECT (window1, send_selection_to2_menu, "send_selection_to2_menu");
   GLADE_HOOKUP_OBJECT (window1, invisible13, "invisible13");
   GLADE_HOOKUP_OBJECT (window1, separator18, "separator18");
   GLADE_HOOKUP_OBJECT (window1, add_comments1, "add_comments1");
-  GLADE_HOOKUP_OBJECT (window1, image2556, "image2556");
+  GLADE_HOOKUP_OBJECT (window1, image2584, "image2584");
   GLADE_HOOKUP_OBJECT (window1, add_comments1_menu, "add_comments1_menu");
   GLADE_HOOKUP_OBJECT (window1, menu_add_changelog_entry1, "menu_add_changelog_entry1");
   GLADE_HOOKUP_OBJECT (window1, insert_file_header1, "insert_file_header1");
@@ -1805,11 +1814,11 @@
   GLADE_HOOKUP_OBJECT (window1, insert_gpl_notice2, "insert_gpl_notice2");
   GLADE_HOOKUP_OBJECT (window1, insert_bsd_license_notice2, "insert_bsd_license_notice2");
   GLADE_HOOKUP_OBJECT (window1, insert_date1, "insert_date1");
-  GLADE_HOOKUP_OBJECT (window1, image2557, "image2557");
+  GLADE_HOOKUP_OBJECT (window1, image2585, "image2585");
   GLADE_HOOKUP_OBJECT (window1, insert_date1_menu, "insert_date1_menu");
   GLADE_HOOKUP_OBJECT (window1, invisible8, "invisible8");
   GLADE_HOOKUP_OBJECT (window1, insert_include2, "insert_include2");
-  GLADE_HOOKUP_OBJECT (window1, image2558, "image2558");
+  GLADE_HOOKUP_OBJECT (window1, image2586, "image2586");
   GLADE_HOOKUP_OBJECT (window1, insert_include2_menu, "insert_include2_menu");
   GLADE_HOOKUP_OBJECT (window1, invisible4, "invisible4");
   GLADE_HOOKUP_OBJECT (window1, separator9, "separator9");
@@ -1821,7 +1830,7 @@
   GLADE_HOOKUP_OBJECT (window1, find_previous1, "find_previous1");
   GLADE_HOOKUP_OBJECT (window1, find_in_files1, "find_in_files1");
   GLADE_HOOKUP_OBJECT (window1, replace1, "replace1");
-  GLADE_HOOKUP_OBJECT (window1, image2559, "image2559");
+  GLADE_HOOKUP_OBJECT (window1, image2587, "image2587");
   GLADE_HOOKUP_OBJECT (window1, separator33, "separator33");
   GLADE_HOOKUP_OBJECT (window1, find_nextsel1, "find_nextsel1");
   GLADE_HOOKUP_OBJECT (window1, find_prevsel1, "find_prevsel1");
@@ -1830,11 +1839,11 @@
   GLADE_HOOKUP_OBJECT (window1, previous_message1, "previous_message1");
   GLADE_HOOKUP_OBJECT (window1, separator32, "separator32");
   GLADE_HOOKUP_OBJECT (window1, go_to_line1, "go_to_line1");
-  GLADE_HOOKUP_OBJECT (window1, image2560, "image2560");
+  GLADE_HOOKUP_OBJECT (window1, image2588, "image2588");
   GLADE_HOOKUP_OBJECT (window1, menu_view1, "menu_view1");
   GLADE_HOOKUP_OBJECT (window1, menu_view1_menu, "menu_view1_menu");
   GLADE_HOOKUP_OBJECT (window1, menu_change_font1, "menu_change_font1");
-  GLADE_HOOKUP_OBJECT (window1, image2561, "image2561");
+  GLADE_HOOKUP_OBJECT (window1, image2589, "image2589");
   GLADE_HOOKUP_OBJECT (window1, menu_separator4, "menu_separator4");
   GLADE_HOOKUP_OBJECT (window1, menu_toggle_all_additional_widgets1, "menu_toggle_all_additional_widgets1");
   GLADE_HOOKUP_OBJECT (window1, menu_fullscreen1, "menu_fullscreen1");
@@ -1856,6 +1865,7 @@
   GLADE_HOOKUP_OBJECT (window1, indent_type1_menu, "indent_type1_menu");
   GLADE_HOOKUP_OBJECT (window1, tabs1, "tabs1");
   GLADE_HOOKUP_OBJECT (window1, spaces1, "spaces1");
+  GLADE_HOOKUP_OBJECT (window1, tabs_and_spaces1, "tabs_and_spaces1");
   GLADE_HOOKUP_OBJECT (window1, separator45, "separator45");
   GLADE_HOOKUP_OBJECT (window1, set_file_readonly1, "set_file_readonly1");
   GLADE_HOOKUP_OBJECT (window1, menu_write_unicode_bom1, "menu_write_unicode_bom1");
@@ -1884,26 +1894,26 @@
   GLADE_HOOKUP_OBJECT (window1, menu_project1, "menu_project1");
   GLADE_HOOKUP_OBJECT (window1, menu_project1_menu, "menu_project1_menu");
   GLADE_HOOKUP_OBJECT (window1, project_new1, "project_new1");
-  GLADE_HOOKUP_OBJECT (window1, image2562, "image2562");
+  GLADE_HOOKUP_OBJECT (window1, image2590, "image2590");
   GLADE_HOOKUP_OBJECT (window1, project_open1, "project_open1");
-  GLADE_HOOKUP_OBJECT (window1, image2563, "image2563");
+  GLADE_HOOKUP_OBJECT (window1, image2591, "image2591");
   GLADE_HOOKUP_OBJECT (window1, project_close1, "project_close1");
-  GLADE_HOOKUP_OBJECT (window1, image2564, "image2564");
+  GLADE_HOOKUP_OBJECT (window1, image2592, "image2592");
   GLADE_HOOKUP_OBJECT (window1, separator34, "separator34");
   GLADE_HOOKUP_OBJECT (window1, project_properties1, "project_properties1");
   GLADE_HOOKUP_OBJECT (window1, menu_build1, "menu_build1");
   GLADE_HOOKUP_OBJECT (window1, tools1, "tools1");
   GLADE_HOOKUP_OBJECT (window1, tools1_menu, "tools1_menu");
   GLADE_HOOKUP_OBJECT (window1, menu_choose_color1, "menu_choose_color1");
-  GLADE_HOOKUP_OBJECT (window1, image2565, "image2565");
+  GLADE_HOOKUP_OBJECT (window1, image2593, "image2593");
   GLADE_HOOKUP_OBJECT (window1, menu_count_words1, "menu_count_words1");
   GLADE_HOOKUP_OBJECT (window1, load_tags1, "load_tags1");
   GLADE_HOOKUP_OBJECT (window1, menu_reload_configuration1, "menu_reload_configuration1");
-  GLADE_HOOKUP_OBJECT (window1, image2566, "image2566");
+  GLADE_HOOKUP_OBJECT (window1, image2594, "image2594");
   GLADE_HOOKUP_OBJECT (window1, menu_help1, "menu_help1");
   GLADE_HOOKUP_OBJECT (window1, menu_help1_menu, "menu_help1_menu");
   GLADE_HOOKUP_OBJECT (window1, help1, "help1");
-  GLADE_HOOKUP_OBJECT (window1, image2567, "image2567");
+  GLADE_HOOKUP_OBJECT (window1, image2595, "image2595");
   GLADE_HOOKUP_OBJECT (window1, keyboard_shortcuts1, "keyboard_shortcuts1");
   GLADE_HOOKUP_OBJECT (window1, website1, "website1");
   GLADE_HOOKUP_OBJECT (window1, separator16, "separator16");
@@ -2669,14 +2679,19 @@
   GtkWidget *table13;
   GtkWidget *label183;
   GtkWidget *combo_auto_indent_mode;
+  GtkWidget *label200;
+  GtkWidget *label222;
+  GtkObject *spin_indent_width_adj;
+  GtkWidget *spin_indent_width;
+  GtkWidget *radio_indent_spaces;
+  GSList *radio_indent_spaces_group = NULL;
+  GtkWidget *radio_indent_tabs;
+  GtkWidget *radio_indent_both;
+  GtkWidget *alignment41;
+  GtkWidget *hbox13;
+  GtkWidget *label221;
   GtkObject *spin_tab_width_adj;
   GtkWidget *spin_tab_width;
-  GtkWidget *label116;
-  GtkWidget *hbox8;
-  GtkWidget *radio_indent_tabs;
-  GSList *radio_indent_tabs_group = NULL;
-  GtkWidget *radio_indent_spaces;
-  GtkWidget *label200;
   GtkWidget *check_detect_indent;
   GtkWidget *label195;
   GtkWidget *frame14;
@@ -3595,7 +3610,7 @@
   gtk_widget_show (vbox25);
   gtk_container_add (GTK_CONTAINER (alignment30), vbox25);
 
-  table13 = gtk_table_new (4, 2, FALSE);
+  table13 = gtk_table_new (7, 2, FALSE);
   gtk_widget_show (table13);
   gtk_box_pack_start (GTK_BOX (vbox25), table13, FALSE, TRUE, 0);
   gtk_table_set_row_spacings (GTK_TABLE (table13), 3);
@@ -3603,13 +3618,14 @@
 
   label183 = gtk_label_new (_("Auto-indent mode:"));
   gtk_widget_show (label183);
-  gtk_table_attach (GTK_TABLE (table13), label183, 0, 1, 3, 4,
+  gtk_table_attach (GTK_TABLE (table13), label183, 0, 1, 6, 7,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label183), 0, 0.5);
 
   combo_auto_indent_mode = gtk_combo_box_new_text ();
   gtk_widget_show (combo_auto_indent_mode);
-  gtk_table_attach (GTK_TABLE (table13), combo_auto_indent_mode, 1, 2, 3, 4,
+  gtk_table_attach (GTK_TABLE (table13), combo_auto_indent_mode, 1, 2, 6, 7,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (GTK_FILL), 0, 0);
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("None"));
@@ -3617,54 +3633,85 @@
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("Current chars"));
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("Match braces"));
 
-  spin_tab_width_adj = gtk_adjustment_new (1, 1, 99, 1, 10, 10);
-  spin_tab_width = gtk_spin_button_new (GTK_ADJUSTMENT (spin_tab_width_adj), 1, 0);
-  gtk_widget_show (spin_tab_width);
-  gtk_table_attach (GTK_TABLE (table13), spin_tab_width, 1, 2, 2, 3,
+  label200 = gtk_label_new (_("Type:"));
+  gtk_widget_show (label200);
+  gtk_table_attach (GTK_TABLE (table13), label200, 0, 1, 1, 2,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 0);
-  gtk_tooltips_set_tip (tooltips, spin_tab_width, _("The width in chars, which one tab character will take"), NULL);
-  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_tab_width), TRUE);
-  gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin_tab_width), GTK_UPDATE_IF_VALID);
-  gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_tab_width), TRUE);
+  gtk_misc_set_alignment (GTK_MISC (label200), 0, 0.5);
 
-  label116 = gtk_label_new (_("Tab width:"));
-  gtk_widget_show (label116);
-  gtk_table_attach (GTK_TABLE (table13), label116, 0, 1, 2, 3,
+  label222 = gtk_label_new (_("Width:"));
+  gtk_widget_show (label222);
+  gtk_table_attach (GTK_TABLE (table13), label222, 0, 1, 0, 1,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label116), 0, 0.5);
+  gtk_misc_set_alignment (GTK_MISC (label222), 0, 0.5);
 
-  hbox8 = gtk_hbox_new (FALSE, 12);
-  gtk_widget_show (hbox8);
-  gtk_table_attach (GTK_TABLE (table13), hbox8, 1, 2, 0, 1,
+  spin_indent_width_adj = gtk_adjustment_new (1, 1, 99, 1, 10, 10);
+  spin_indent_width = gtk_spin_button_new (GTK_ADJUSTMENT (spin_indent_width_adj), 1, 0);
+  gtk_widget_show (spin_indent_width);
+  gtk_table_attach (GTK_TABLE (table13), spin_indent_width, 1, 2, 0, 1,
+                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_tooltips_set_tip (tooltips, spin_indent_width, _("The width in chars of a single indent"), NULL);
+  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_indent_width), TRUE);
+  gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin_indent_width), GTK_UPDATE_IF_VALID);
+  gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_indent_width), TRUE);
+
+  radio_indent_spaces = gtk_radio_button_new_with_mnemonic (NULL, _("_Spaces"));
+  gtk_widget_show (radio_indent_spaces);
+  gtk_table_attach (GTK_TABLE (table13), radio_indent_spaces, 1, 2, 2, 3,
                     (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_tooltips_set_tip (tooltips, radio_indent_spaces, _("Use spaces when inserting indentation"), NULL);
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_spaces), radio_indent_spaces_group);
+  radio_indent_spaces_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_spaces));
 
   radio_indent_tabs = gtk_radio_button_new_with_mnemonic (NULL, _("_Tabs"));
   gtk_widget_show (radio_indent_tabs);
-  gtk_box_pack_start (GTK_BOX (hbox8), radio_indent_tabs, FALSE, FALSE, 0);
-  gtk_tooltips_set_tip (tooltips, radio_indent_tabs, _("Whether to use tabs or spaces when indentation is inserted."), NULL);
-  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_tabs), radio_indent_tabs_group);
-  radio_indent_tabs_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_tabs));
+  gtk_table_attach (GTK_TABLE (table13), radio_indent_tabs, 1, 2, 1, 2,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_tooltips_set_tip (tooltips, radio_indent_tabs, _("Use one tab per indent"), NULL);
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_tabs), radio_indent_spaces_group);
+  radio_indent_spaces_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_tabs));
 
-  radio_indent_spaces = gtk_radio_button_new_with_mnemonic (NULL, _("_Spaces"));
-  gtk_widget_show (radio_indent_spaces);
-  gtk_box_pack_start (GTK_BOX (hbox8), radio_indent_spaces, FALSE, FALSE, 0);
-  gtk_tooltips_set_tip (tooltips, radio_indent_spaces, _("Whether to use tabs or spaces when indentation is inserted."), NULL);
-  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_spaces), radio_indent_tabs_group);
-  radio_indent_tabs_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_spaces));
-
-  label200 = gtk_label_new (_("Type:"));
-  gtk_widget_show (label200);
-  gtk_table_attach (GTK_TABLE (table13), label200, 0, 1, 0, 1,
+  radio_indent_both = gtk_radio_button_new_with_mnemonic (NULL, _("T_abs and Spaces"));
+  gtk_widget_show (radio_indent_both);
+  gtk_table_attach (GTK_TABLE (table13), radio_indent_both, 1, 2, 3, 4,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label200), 0, 0.5);
+  gtk_tooltips_set_tip (tooltips, radio_indent_both, _("Use spaces if the total indent is less than the tab width, otherwise use both"), NULL);
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_both), radio_indent_spaces_group);
+  radio_indent_spaces_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_both));
 
+  alignment41 = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_widget_show (alignment41);
+  gtk_table_attach (GTK_TABLE (table13), alignment41, 1, 2, 4, 5,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment41), 0, 0, 24, 0);
+
+  hbox13 = gtk_hbox_new (FALSE, 12);
+  gtk_widget_show (hbox13);
+  gtk_container_add (GTK_CONTAINER (alignment41), hbox13);
+
+  label221 = gtk_label_new (_("Tab Width:"));
+  gtk_widget_show (label221);
+  gtk_box_pack_start (GTK_BOX (hbox13), label221, FALSE, FALSE, 0);
+
+  spin_tab_width_adj = gtk_adjustment_new (8, 1, 99, 1, 10, 10);
+  spin_tab_width = gtk_spin_button_new (GTK_ADJUSTMENT (spin_tab_width_adj), 1, 0);
+  gtk_widget_show (spin_tab_width);
+  gtk_box_pack_start (GTK_BOX (hbox13), spin_tab_width, TRUE, TRUE, 0);
+  gtk_tooltips_set_tip (tooltips, spin_tab_width, _("The width of a tab when Tabs & Spaces is set for a document"), NULL);
+  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_tab_width), TRUE);
+  gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin_tab_width), GTK_UPDATE_IF_VALID);
+  gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_tab_width), TRUE);
+
   check_detect_indent = gtk_check_button_new_with_mnemonic (_("Detect from file"));
   gtk_widget_show (check_detect_indent);
-  gtk_table_attach (GTK_TABLE (table13), check_detect_indent, 1, 2, 1, 2,
+  gtk_table_attach (GTK_TABLE (table13), check_detect_indent, 1, 2, 5, 6,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 0);
   gtk_tooltips_set_tip (tooltips, check_detect_indent, _("Whether to detect the indentation type from file contents when a file is opened."), NULL);
@@ -4766,6 +4813,10 @@
   gtk_dialog_add_action_widget (GTK_DIALOG (prefs_dialog), button5, GTK_RESPONSE_OK);
   GTK_WIDGET_SET_FLAGS (button5, GTK_CAN_DEFAULT);
 
+  g_signal_connect ((gpointer) radio_indent_both, "toggled",
+                    G_CALLBACK (on_radio_indent_both_toggled),
+                    NULL);
+
   /* Store pointers to all widgets, for use by lookup_widget(). */
   GLADE_HOOKUP_OBJECT_NO_REF (prefs_dialog, prefs_dialog, "prefs_dialog");
   GLADE_HOOKUP_OBJECT_NO_REF (prefs_dialog, dialog_vbox3, "dialog_vbox3");
@@ -4893,12 +4944,16 @@
   GLADE_HOOKUP_OBJECT (prefs_dialog, table13, "table13");
   GLADE_HOOKUP_OBJECT (prefs_dialog, label183, "label183");
   GLADE_HOOKUP_OBJECT (prefs_dialog, combo_auto_indent_mode, "combo_auto_indent_mode");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, label200, "label200");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, label222, "label222");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, spin_indent_width, "spin_indent_width");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, radio_indent_spaces, "radio_indent_spaces");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, radio_indent_tabs, "radio_indent_tabs");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, radio_indent_both, "radio_indent_both");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, alignment41, "alignment41");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, hbox13, "hbox13");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, label221, "label221");
   GLADE_HOOKUP_OBJECT (prefs_dialog, spin_tab_width, "spin_tab_width");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, label116, "label116");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, hbox8, "hbox8");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, radio_indent_tabs, "radio_indent_tabs");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, radio_indent_spaces, "radio_indent_spaces");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, label200, "label200");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_detect_indent, "check_detect_indent");
   GLADE_HOOKUP_OBJECT (prefs_dialog, label195, "label195");
   GLADE_HOOKUP_OBJECT (prefs_dialog, frame14, "frame14");

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2008-08-07 15:32:56 UTC (rev 2862)
+++ trunk/src/keyfile.c	2008-08-07 16:36:06 UTC (rev 2863)
@@ -89,27 +89,107 @@
 static gint vpan_position;
 
 
-/* Used in e.g. save_bool_prefs(). */
+typedef enum SettingCallbackAction
+{
+	SETTING_READ,
+	SETTING_WRITE
+}
+SettingCallbackAction;
+
+
 typedef struct SettingEntry
 {
+	gpointer setting;
 	const gchar *group;
 	const gchar *key_name;
-	gpointer setting;
 	gpointer default_value;
 }
 SettingEntry;
 
-static SettingEntry bool_prefs[] =
+
+static void bool_settings_foreach(GKeyFile *config, SettingCallbackAction action)
 {
-	{PACKAGE, "cmdline_new_files", &file_prefs.cmdline_new_files, GINT_TO_POINTER(TRUE)},
+	guint i;
+	SettingEntry items[] =
+	{
+		{&file_prefs.cmdline_new_files, PACKAGE, "cmdline_new_files", (gpointer)TRUE},
 
-	{PACKAGE, "pref_main_suppress_search_dialogs", &search_prefs.suppress_dialogs, GINT_TO_POINTER(FALSE)},
-	{PACKAGE, "pref_main_search_use_current_word", &search_prefs.use_current_word, GINT_TO_POINTER(TRUE)},
-	{"search", "pref_search_current_file_dir", &search_prefs.use_current_file_dir, GINT_TO_POINTER(TRUE)},
-	{NULL, NULL, NULL, NULL}	/* must be terminated */
+		{&search_prefs.suppress_dialogs, PACKAGE, "pref_main_suppress_search_dialogs", (gpointer)FALSE},
+		{&search_prefs.use_current_word, PACKAGE, "pref_main_search_use_current_word", (gpointer)TRUE},
+		{&search_prefs.use_current_file_dir, "search", "pref_search_current_file_dir", (gpointer)TRUE},
+
+		{&editor_prefs.indentation->detect_type, PACKAGE, "check_detect_indent", (gpointer)FALSE},
+	};
+
+	for (i = 0; i < G_N_ELEMENTS(items); i++)
+	{
+		SettingEntry *se = &items[i];
+		gboolean *setting = se->setting;
+
+		switch (action)
+		{
+			case SETTING_READ:
+				*setting = utils_get_setting_boolean(config, se->group, se->key_name,
+					GPOINTER_TO_INT(se->default_value));
+				break;
+			case SETTING_WRITE:
+				g_key_file_set_boolean(config, se->group, se->key_name, *setting);
+				break;
+		}
+	}
+}
+
+
+static void int_settings_foreach(GKeyFile *config, SettingCallbackAction action)
+{
+	guint i;
+	SettingEntry items[] =
+	{
+		{&editor_prefs.indentation->width, PACKAGE, "pref_editor_tab_width", (gpointer)4},
+		{&editor_prefs.indentation->tab_width, PACKAGE, "indent_tab_width", (gpointer)8},
+		{&editor_prefs.indentation->auto_indent_mode, PACKAGE, "indent_mode",
+			(gpointer)GEANY_AUTOINDENT_CURRENTCHARS},
+		{&editor_prefs.indentation->type, PACKAGE, "indent_type", (gpointer)GEANY_INDENT_TYPE_TABS},
+	};
+
+	for (i = 0; i < G_N_ELEMENTS(items); i++)
+	{
+		SettingEntry *se = &items[i];
+		gboolean *setting = se->setting;
+
+		switch (action)
+		{
+			case SETTING_READ:
+				*setting = utils_get_setting_integer(config, se->group, se->key_name,
+					GPOINTER_TO_INT(se->default_value));
+				break;
+			case SETTING_WRITE:
+				g_key_file_set_integer(config, se->group, se->key_name, *setting);
+				break;
+		}
+	}
+}
+
+
+typedef void (*SettingItemsCallback)(GKeyFile *config, SettingCallbackAction action);
+
+/* List of functions which hold the SettingEntry arrays. These allow access to
+ * runtime setting fields like EditorPrefs::indentation->width. */
+SettingItemsCallback setting_item_callbacks[] = {
+	bool_settings_foreach,
+	int_settings_foreach
 };
 
 
+static void settings_action(GKeyFile *config, SettingCallbackAction action)
+{
+	guint i;
+
+	for (i = 0; i < G_N_ELEMENTS(setting_item_callbacks); i++)
+		setting_item_callbacks[i](config, action);
+}
+
+

@@ Diff output truncated at 100000 characters. @@

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