SF.net SVN: geany: [1953] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Oct 17 12:27:10 UTC 2007


Revision: 1953
          http://geany.svn.sourceforge.net/geany/?rev=1953&view=rev
Author:   ntrel
Date:     2007-10-17 05:27:07 -0700 (Wed, 17 Oct 2007)

Log Message:
-----------
Add Indent Type option in the Document menu.
Add 'Detect from file' Editor indentation pref.
Show TAB or SP for current document's indent type.
Minor editing of Document menu and editor Indentation prefs group.
Use GString for statusbar statistics.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/geany.glade
    trunk/src/callbacks.c
    trunk/src/callbacks.h
    trunk/src/document.c
    trunk/src/document.h
    trunk/src/editor.c
    trunk/src/editor.h
    trunk/src/interface.c
    trunk/src/keybindings.c
    trunk/src/keyfile.c
    trunk/src/prefs.c
    trunk/src/ui_utils.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-10-17 11:55:59 UTC (rev 1952)
+++ trunk/ChangeLog	2007-10-17 12:27:07 UTC (rev 1953)
@@ -4,6 +4,14 @@
    Parse arrays, const and pointers in C-like function return types
    (and store in varType).
    Fix some indentation.
+ * src/interface.c, src/keybindings.c, src/prefs.c, src/callbacks.c,
+   src/callbacks.h, src/keyfile.c, src/document.c, src/document.h,
+   src/editor.c, src/editor.h, src/ui_utils.c, geany.glade:
+   Add Indent Type option in the Document menu.
+   Add 'Detect from file' Editor indentation pref.
+   Show TAB or SP for current document's indent type.
+   Minor editing of Document menu and editor Indentation prefs group.
+   Use GString for statusbar statistics.
 
 
 2007-10-16  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade	2007-10-17 11:55:59 UTC (rev 1952)
+++ trunk/geany.glade	2007-10-17 12:27:07 UTC (rev 1953)
@@ -58,7 +58,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2010">
+			<widget class="GtkImage" id="image2248">
 			  <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="image2011">
+			<widget class="GtkImage" id="image2249">
 			  <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="image2012">
+			<widget class="GtkImage" id="image2250">
 			  <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="image2013">
+			<widget class="GtkImage" id="image2251">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-revert-to-saved</property>
 			  <property name="icon_size">1</property>
@@ -285,7 +285,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="image2014">
+			<widget class="GtkImage" id="image2252">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-close</property>
 			  <property name="icon_size">1</property>
@@ -484,7 +484,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="image2015">
+				<widget class="GtkImage" id="image2253">
 				  <property name="visible">True</property>
 				  <property name="stock">gtk-indent</property>
 				  <property name="icon_size">1</property>
@@ -505,7 +505,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="image2016">
+				<widget class="GtkImage" id="image2254">
 				  <property name="visible">True</property>
 				  <property name="stock">gtk-unindent</property>
 				  <property name="icon_size">1</property>
@@ -561,7 +561,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2017">
+			<widget class="GtkImage" id="image2255">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-add</property>
 			  <property name="icon_size">1</property>
@@ -646,7 +646,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2018">
+			<widget class="GtkImage" id="image2256">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-add</property>
 			  <property name="icon_size">1</property>
@@ -678,7 +678,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2019">
+			<widget class="GtkImage" id="image2257">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-add</property>
 			  <property name="icon_size">1</property>
@@ -775,7 +775,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="image2020">
+			<widget class="GtkImage" id="image2258">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-find-and-replace</property>
 			  <property name="icon_size">1</property>
@@ -841,7 +841,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="image2021">
+			<widget class="GtkImage" id="image2259">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-jump-to</property>
 			  <property name="icon_size">1</property>
@@ -876,7 +876,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="image2022">
+			<widget class="GtkImage" id="image2260">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-select-font</property>
 			  <property name="icon_size">1</property>
@@ -1028,7 +1028,7 @@
 		  <child>
 		    <widget class="GtkCheckMenuItem" id="menu_use_auto_indentation1">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_Use Auto-indentation</property>
+		      <property name="label" translatable="yes">_Auto-indentation</property>
 		      <property name="use_underline">True</property>
 		      <property name="active">True</property>
 		      <signal name="toggled" handler="on_use_auto_indentation1_toggled" last_modification_time="Tue, 29 May 2007 17:05:42 GMT"/>
@@ -1036,6 +1036,46 @@
 		  </child>
 
 		  <child>
+		    <widget class="GtkMenuItem" id="indent_type1">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">In_dent Type</property>
+		      <property name="use_underline">True</property>
+
+		      <child>
+			<widget class="GtkMenu" id="indent_type1_menu">
+
+			  <child>
+			    <widget class="GtkRadioMenuItem" id="tabs1">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">Tabs</property>
+			      <property name="use_underline">True</property>
+			      <property name="active">False</property>
+			      <signal name="activate" handler="on_tabs1_activate" last_modification_time="Thu, 04 Oct 2007 16:07:51 GMT"/>
+			    </widget>
+			  </child>
+
+			  <child>
+			    <widget class="GtkRadioMenuItem" id="spaces1">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">Spaces</property>
+			      <property name="use_underline">True</property>
+			      <property name="active">True</property>
+			      <property name="group">tabs1</property>
+			      <signal name="activate" handler="on_spaces1_activate" last_modification_time="Thu, 04 Oct 2007 16:07:51 GMT"/>
+			    </widget>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkSeparatorMenuItem" id="separator45">
+		      <property name="visible">True</property>
+		    </widget>
+		  </child>
+
+		  <child>
 		    <widget class="GtkCheckMenuItem" id="set_file_readonly1">
 		      <property name="visible">True</property>
 		      <property name="tooltip" translatable="yes">Treat this file as read-only. No changes can be made.</property>
@@ -1057,7 +1097,7 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkSeparatorMenuItem" id="separator10">
+		    <widget class="GtkSeparatorMenuItem" id="separator46">
 		      <property name="visible">True</property>
 		    </widget>
 		  </child>
@@ -1116,7 +1156,7 @@
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes">Convert and Set to _CR/LF (Win)</property>
 			      <property name="use_underline">True</property>
-			      <property name="active">True</property>
+			      <property name="active">False</property>
 			      <signal name="activate" handler="on_crlf_activate" last_modification_time="Thu, 28 Apr 2005 16:27:24 GMT"/>
 			    </widget>
 			  </child>
@@ -1126,7 +1166,7 @@
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes">Convert and Set to _LF (Unix)</property>
 			      <property name="use_underline">True</property>
-			      <property name="active">True</property>
+			      <property name="active">False</property>
 			      <property name="group">crlf</property>
 			      <signal name="activate" handler="on_lf_activate" last_modification_time="Thu, 28 Apr 2005 16:27:24 GMT"/>
 			    </widget>
@@ -1236,7 +1276,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="image2023">
+			<widget class="GtkImage" id="image2261">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-new</property>
 			  <property name="icon_size">1</property>
@@ -1257,7 +1297,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="image2024">
+			<widget class="GtkImage" id="image2262">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-open</property>
 			  <property name="icon_size">1</property>
@@ -1278,7 +1318,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="image2025">
+			<widget class="GtkImage" id="image2263">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-close</property>
 			  <property name="icon_size">1</property>
@@ -1336,7 +1376,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="image2026">
+			<widget class="GtkImage" id="image2264">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-select-color</property>
 			  <property name="icon_size">1</property>
@@ -1380,7 +1420,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="image2027">
+			<widget class="GtkImage" id="image2265">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-help</property>
 			  <property name="icon_size">1</property>
@@ -5451,71 +5491,89 @@
 			  <property name="spacing">0</property>
 
 			  <child>
-			    <widget class="GtkHBox" id="hbox8">
+			    <widget class="GtkTable" id="table13">
 			      <property name="visible">True</property>
+			      <property name="n_rows">4</property>
+			      <property name="n_columns">2</property>
 			      <property name="homogeneous">False</property>
-			      <property name="spacing">12</property>
+			      <property name="row_spacing">3</property>
+			      <property name="column_spacing">24</property>
 
 			      <child>
-				<widget class="GtkRadioButton" id="radio_indent_tabs">
+				<widget class="GtkLabel" id="label183">
 				  <property name="visible">True</property>
-				  <property name="tooltip" translatable="yes">Whenever some whitespace is inserted by Geany it will use tabs when enabled otherwise Geany will use just spaces.</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="label" translatable="yes">Auto-indent mode:</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="left_attach">0</property>
+				  <property name="right_attach">1</property>
+				  <property name="top_attach">3</property>
+				  <property name="bottom_attach">4</property>
+				  <property name="x_options">fill</property>
+				  <property name="y_options"></property>
+				</packing>
+			      </child>
+
+			      <child>
+				<widget class="GtkComboBox" id="combo_auto_indent_mode">
+				  <property name="visible">True</property>
+				  <property name="items" translatable="yes">None
+Basic
+Current chars
+Match braces</property>
+				  <property name="add_tearoffs">False</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>
+				  <property name="left_attach">1</property>
+				  <property name="right_attach">2</property>
+				  <property name="top_attach">3</property>
+				  <property name="bottom_attach">4</property>
+				  <property name="x_options">fill</property>
+				  <property name="y_options">fill</property>
 				</packing>
 			      </child>
 
 			      <child>
-				<widget class="GtkRadioButton" id="radio_indent_spaces">
+				<widget class="GtkSpinButton" id="spin_tab_width">
 				  <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="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>
+				  <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="padding">0</property>
-				  <property name="expand">False</property>
-				  <property name="fill">False</property>
+				  <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>
+				  <property name="y_options"></property>
 				</packing>
 			      </child>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
-			    </packing>
-			  </child>
 
-			  <child>
-			    <widget class="GtkTable" id="table13">
-			      <property name="visible">True</property>
-			      <property name="n_rows">2</property>
-			      <property name="n_columns">2</property>
-			      <property name="homogeneous">False</property>
-			      <property name="row_spacing">3</property>
-			      <property name="column_spacing">24</property>
-
 			      <child>
 				<widget class="GtkLabel" id="label116">
 				  <property name="visible">True</property>
-				  <property name="label" translatable="yes">Tab Width:</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>
@@ -5533,23 +5591,79 @@
 				<packing>
 				  <property name="left_attach">0</property>
 				  <property name="right_attach">1</property>
+				  <property name="top_attach">2</property>
+				  <property name="bottom_attach">3</property>
+				  <property name="x_options">fill</property>
+				  <property name="y_options"></property>
+				</packing>
+			      </child>
+
+			      <child>
+				<widget class="GtkHBox" id="hbox8">
+				  <property name="visible">True</property>
+				  <property name="homogeneous">False</property>
+				  <property name="spacing">12</property>
+
+				  <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>
+				</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="x_options">fill</property>
-				  <property name="y_options"></property>
 				</packing>
 			      </child>
 
 			      <child>
-				<widget class="GtkLabel" id="label183">
+				<widget class="GtkLabel" id="label200">
 				  <property name="visible">True</property>
-				  <property name="label" translatable="yes">Auto indentation mode:</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.5</property>
+				  <property name="xalign">0</property>
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">0</property>
 				  <property name="ypad">0</property>
@@ -5561,29 +5675,6 @@
 				<packing>
 				  <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="GtkSpinButton" id="spin_tab_width">
-				  <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>
-				</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="x_options">fill</property>
@@ -5592,14 +5683,17 @@
 			      </child>
 
 			      <child>
-				<widget class="GtkComboBox" id="combo_auto_indent_mode">
+				<widget class="GtkCheckButton" id="check_detect_indent">
 				  <property name="visible">True</property>
-				  <property name="items" translatable="yes">None
-Basic
-Current chars
-Match braces</property>
-				  <property name="add_tearoffs">False</property>
+				  <property name="tooltip" translatable="yes">Whether to detect the indentation type from file contents when a file is opened.</property>
+				  <property name="can_focus">True</property>
+				  <property name="label" translatable="yes">Detect from file</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>
@@ -5607,7 +5701,7 @@
 				  <property name="top_attach">1</property>
 				  <property name="bottom_attach">2</property>
 				  <property name="x_options">fill</property>
-				  <property name="y_options">fill</property>
+				  <property name="y_options"></property>
 				</packing>
 			      </child>
 			    </widget>

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2007-10-17 11:55:59 UTC (rev 1952)
+++ trunk/src/callbacks.c	2007-10-17 12:27:07 UTC (rev 1953)
@@ -1745,7 +1745,7 @@
 		line = sci_get_line_from_position(doc_list[idx].sci, old_pos);
 		ind_pos = sci_get_line_indent_position(doc_list[idx].sci, line);
 		// when using tabs increase cur pos by 1, when using space increase it by tab_width
-		step = (editor_prefs.use_tabs) ? 1 : editor_prefs.tab_width;
+		step = (doc_list[idx].use_tabs) ? 1 : editor_prefs.tab_width;
 		new_pos = (old_pos > ind_pos) ? old_pos + step : old_pos;
 
 		sci_set_current_position(doc_list[idx].sci, ind_pos, TRUE);
@@ -1773,7 +1773,7 @@
 		old_pos = sci_get_current_position(doc_list[idx].sci);
 		line = sci_get_line_from_position(doc_list[idx].sci, old_pos);
 		ind_pos = sci_get_line_indent_position(doc_list[idx].sci, line);
-		step = (editor_prefs.use_tabs) ? 1 : editor_prefs.tab_width;
+		step = (doc_list[idx].use_tabs) ? 1 : editor_prefs.tab_width;
 		new_pos = (old_pos >= ind_pos) ? old_pos - step : old_pos;
 
 		if (ind_pos == sci_get_position_from_line(doc_list[idx].sci, line))
@@ -2099,3 +2099,25 @@
 	return FALSE;
 }
 
+
+void
+on_tabs1_activate                      (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+	gint idx = document_get_cur_idx();
+
+	document_set_use_tabs(idx, TRUE);
+	ui_update_statusbar(idx, -1);
+}
+
+
+void
+on_spaces1_activate                    (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+	gint idx = document_get_cur_idx();
+
+	document_set_use_tabs(idx, FALSE);
+	ui_update_statusbar(idx, -1);
+}
+

Modified: trunk/src/callbacks.h
===================================================================
--- trunk/src/callbacks.h	2007-10-17 11:55:59 UTC (rev 1952)
+++ trunk/src/callbacks.h	2007-10-17 12:27:07 UTC (rev 1953)
@@ -578,3 +578,12 @@
                                         GtkNotebookPage *page,
                                         guint            page_num,
                                         gpointer         user_data);
+
+void
+on_tabs1_activate                      (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_spaces1_activate                    (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2007-10-17 11:55:59 UTC (rev 1952)
+++ trunk/src/document.c	2007-10-17 12:27:07 UTC (rev 1953)
@@ -251,18 +251,28 @@
 }
 
 
+void document_set_use_tabs(gint idx, gboolean use_tabs)
+{
+	document *doc = &doc_list[idx];
+
+	g_return_if_fail(DOC_IDX_VALID(idx));
+
+	doc->use_tabs = use_tabs;
+	sci_set_use_tabs(doc->sci, use_tabs);
+	// remove indent spaces on backspace, if using spaces to indent
+	SSM(doc->sci, SCI_SETBACKSPACEUNINDENTS, ! use_tabs, 0);
+}
+
+
 // Apply just the prefs that can change in the Preferences dialog
 void document_apply_update_prefs(gint idx)
 {
 	ScintillaObject *sci = doc_list[idx].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);
 
-	sci_set_use_tabs(sci, editor_prefs.use_tabs);
-	// remove indent spaces on backspace, if using spaces to indent
-	SSM(sci, SCI_SETBACKSPACEUNINDENTS, ! editor_prefs.use_tabs, 0);
-
 	sci_set_autoc_max_height(sci, editor_prefs.autocompletion_max_height);
 
 	sci_set_indentation_guides(sci, editor_prefs.show_indent_guide);
@@ -529,6 +539,7 @@
 #else
 	sci_set_eol_mode(doc_list[idx].sci, SC_EOL_LF);
 #endif
+	document_set_use_tabs(idx, editor_prefs.use_tabs);
 	sci_set_undo_collection(doc_list[idx].sci, TRUE);
 	sci_empty_undo_buffer(doc_list[idx].sci);
 
@@ -830,6 +841,38 @@
 }
 
 
+static gboolean detect_use_tabs(ScintillaObject *sci)
+{
+	gint line;
+	gsize tabs = 0, spaces = 0;
+
+	for (line = 0; line < sci_get_line_count(sci); line++)
+	{
+		gint pos = sci_get_position_from_line(sci, line);
+		gchar c;
+
+		c = sci_get_char_at(sci, pos);
+		if (c == '\t')
+			tabs++;
+		else
+		if (c == ' ')
+		{
+			// check at least 2 spaces
+			if (sci_get_char_at(sci, pos + 1) == ' ')
+				spaces++;
+		}
+	}
+	if (spaces == 0 && tabs == 0)
+		return editor_prefs.use_tabs;
+
+	// Skew comparison by a factor of 2 in favour of default editor pref
+	if (editor_prefs.use_tabs)
+		return ! (spaces > tabs * 2);
+	else
+		return (tabs > spaces * 2);
+}
+
+
 /* To open a new file, set idx to -1; filename should be locale encoded.
  * To reload a file, set the idx for the document to be reloaded; filename should be NULL.
  * pos is the cursor position, which can be overridden by --line and --column.
@@ -917,6 +960,21 @@
 	sci_set_eol_mode(doc_list[idx].sci, editor_mode);
 	g_free(filedata.data);
 
+	if (reload)
+		document_set_use_tabs(idx, doc_list[idx].use_tabs); // resetup sci
+	else
+	if (! editor_prefs.detect_tab_mode)
+		document_set_use_tabs(idx, editor_prefs.use_tabs);
+	else
+	{	// detect & set tabs/spaces
+		gboolean use_tabs = detect_use_tabs(doc_list[idx].sci);
+
+		if (use_tabs != editor_prefs.use_tabs)
+			msgwin_status_add(_("Setting %s indentation mode."),
+				(use_tabs) ? _("Tabs") : _("Spaces"));
+		document_set_use_tabs(idx, use_tabs);
+	}
+
 	sci_set_undo_collection(doc_list[idx].sci, TRUE);
 
 	doc_list[idx].mtime = filedata.mtime; // get the modification time from file and keep it

Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h	2007-10-17 11:55:59 UTC (rev 1952)
+++ trunk/src/document.h	2007-10-17 12:27:07 UTC (rev 1953)
@@ -36,7 +36,7 @@
 } FileEncoding;
 
 
-/* structure for representing an open tab with all its related stuff. */
+/* Structure for representing an open tab with all its related stuff. */
 typedef struct document
 {
 	gboolean		 is_valid;
@@ -52,7 +52,7 @@
 	GtkWidget		*tabmenu_label;
 	GtkWidget		*tag_tree;
 	GtkTreeStore	*tag_store;
-	GtkTreeIter		 iter;
+	GtkTreeIter		 iter;	// open files item for this document
 	gboolean		 readonly;
 	gboolean		 changed;
 	gboolean		 line_wrapping;
@@ -63,6 +63,7 @@
 	GTrashStack		*undo_actions;
 	GTrashStack		*redo_actions;
 	FileEncoding	 saved_encoding;
+	gboolean		 use_tabs;
 } document;
 
 
@@ -239,4 +240,6 @@
 
 void document_insert_colour(gint idx, const gchar *colour);
 
+void document_set_use_tabs(gint idx, gboolean use_tabs);
+
 #endif

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2007-10-17 11:55:59 UTC (rev 1952)
+++ trunk/src/editor.c	2007-10-17 12:27:07 UTC (rev 1953)
@@ -61,12 +61,13 @@
 static gchar indent[100];
 
 
-static void on_new_line_added(ScintillaObject *sci, gint idx);
-static gboolean handle_xml(ScintillaObject *sci, gchar ch, gint idx);
-static void get_indent(ScintillaObject *sci, gint pos, gboolean use_this_line);
+static void on_new_line_added(gint idx);
+static gboolean handle_xml(gint idx, gchar ch);
+static void get_indent(document *doc, gint pos, gboolean use_this_line);
 static void auto_multiline(ScintillaObject *sci, gint pos);
 static gboolean is_comment(gint lexer, gint style);
 static void auto_close_bracket(ScintillaObject *sci, gint pos, gchar c);
+static void editor_auto_table(document *doc, gint pos);
 
 
 // calls the edit popup menu in the editor
@@ -190,18 +191,18 @@
 		case '\r':
 		{	// simple indentation (only for CR format)
 			if (sci_get_eol_mode(sci) == SC_EOL_CR)
-				on_new_line_added(sci, idx);
+				on_new_line_added(idx);
 			break;
 		}
 		case '\n':
 		{	// simple indentation (for CR/LF and LF format)
-			on_new_line_added(sci, idx);
+			on_new_line_added(idx);
 			break;
 		}
 		case '>':
 		case '/':
 		{	// close xml-tags
-			handle_xml(sci, nt->ch, idx);
+			handle_xml(idx, nt->ch);
 			break;
 		}
 		case '(':
@@ -361,23 +362,19 @@
 }
 
 
-/* Returns a string containing width chars of whitespace according to the
- * setting editor_prefs.use_tabs filled with simple space characters or with the right number
- * of tab characters. (Result is filled with tabs *and* spaces if width isn't a multiple of
- * editor_prefs.tab_width).
- * If alternative is set to TRUE, it uses the opposite of editor_prefs.use_tabs. */
+/* 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
+ * editor_prefs.tab_width). */
 static gchar *
-get_whitespace(gint width, gboolean alternative)
+get_whitespace(gint width, gboolean use_tabs)
 {
 	gchar *str;
-	gboolean use_tabs;
 
 	g_return_val_if_fail(width > 0, NULL);
 
-	use_tabs = (alternative) ? ! editor_prefs.use_tabs : editor_prefs.use_tabs;
-
 	if (use_tabs)
-	{	// first fill text with tabluators and fill the rest with spaces
+	{	// 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;
 		gint len = tabs + spaces;
@@ -395,14 +392,15 @@
 }
 
 
-static void on_new_line_added(ScintillaObject *sci, gint idx)
+static void on_new_line_added(gint idx)
 {
+	ScintillaObject *sci = doc_list[idx].sci;
 	gint pos = sci_get_current_position(sci);
 
 	// simple indentation
 	if (doc_list[idx].auto_indent)
 	{
-		get_indent(sci, pos, FALSE);
+		get_indent(&doc_list[idx], pos, FALSE);
 		sci_add_text(sci, indent);
 
 		if (editor_prefs.indent_mode > INDENT_BASIC)
@@ -413,7 +411,7 @@
 				sci_get_style_at(sci, pos - 2) == SCE_P_OPERATOR)
 			{
 				// creates and inserts one tabulator sign or whitespace of the amount of the tab width
-				gchar *text = get_whitespace(editor_prefs.tab_width, FALSE);
+				gchar *text = get_whitespace(editor_prefs.tab_width, doc_list[idx].use_tabs);
 				sci_add_text(sci, text);
 				g_free(text);
 			}
@@ -451,11 +449,11 @@
 
 
 // in place indentation of one tab or equivalent spaces
-static void do_indent(gchar *buf, gsize len, guint *idx)
+static void do_indent(gchar *buf, gsize len, guint *idx, gboolean use_tabs)
 {
 	guint j = *idx;
 
-	if (editor_prefs.use_tabs)
+	if (use_tabs)
 	{
 		if (j < len - 1)	// leave room for a \0 terminator.
 			buf[j++] = '\t';
@@ -472,8 +470,9 @@
 
 /* "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(ScintillaObject *sci, gint pos, gboolean use_this_line)
+static void get_indent(document *doc, gint pos, gboolean use_this_line)
 {
+	ScintillaObject *sci = doc->sci;
 	guint i, len, j = 0;
 	gint prev_line;
 	gchar *linebuf;
@@ -499,7 +498,7 @@
 
 			if (linebuf[i] == '{')
 			{
-				do_indent(indent, sizeof(indent), &j);
+				do_indent(indent, sizeof(indent), &j, doc->use_tabs);
 				break;
 			}
 			else
@@ -512,7 +511,7 @@
 				// e.g. for (...) {
 				if (linebuf[k] == '{')
 				{
-					do_indent(indent, sizeof(indent), &j);
+					do_indent(indent, sizeof(indent), &j, doc->use_tabs);
 				}
 				break;
 			}
@@ -625,7 +624,7 @@
 		{
 			gint line_start;
 
-			get_indent(sci, start_brace, TRUE);
+			get_indent(&doc_list[idx], start_brace, TRUE);
 			text = g_strconcat(indent, "}", NULL);
 			line_start = sci_get_position_from_line(sci, line);
 			sci_set_anchor(sci, line_start);
@@ -1068,7 +1067,7 @@
 			}
 
 			// get the indentation
-			if (doc_list[idx].auto_indent) get_indent(sci, pos, TRUE);
+			if (doc_list[idx].auto_indent) get_indent(&doc_list[idx], pos, TRUE);
 			eol = g_strconcat(utils_get_eol_char(idx), indent, NULL);
 
 			construct = g_strdup_printf("%s\\end%s{%s}", eol, full_cmd, env);
@@ -1155,9 +1154,9 @@
 		return FALSE;
 	}
 
-	get_indent(sci, pos, TRUE);
+	get_indent(&doc_list[idx], pos, TRUE);
 	lindent = g_strconcat(utils_get_eol_char(idx), indent, NULL);
-	whitespace = get_whitespace(editor_prefs.tab_width, FALSE);
+	whitespace = get_whitespace(editor_prefs.tab_width, doc_list[idx].use_tabs);
 
 	// 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,
@@ -1272,8 +1271,9 @@
  * @param ch The character we are dealing with, currently only works with the '>' character
  * @return True if handled, false otherwise
  */
-static gboolean handle_xml(ScintillaObject *sci, gchar ch, gint idx)
+static gboolean handle_xml(gint idx, gchar ch)
 {
+	ScintillaObject *sci = doc_list[idx].sci;
 	gint lexer = SSM(sci, SCI_GETLEXER, 0, 0);
 	gint pos, min;
 	gchar *str_found, sel[512];
@@ -1343,7 +1343,8 @@
 		if (ch == '>')
 		{
 			SSM(sci, SCI_SETSEL, pos, pos);
-			if (utils_str_equal(str_found, "table")) editor_auto_table(sci, pos);
+			if (utils_str_equal(str_found, "table"))
+				editor_auto_table(&doc_list[idx], pos);
 		}
 		sci_end_undo_action(sci);
 		g_free(to_insert);
@@ -1357,14 +1358,15 @@
 }
 
 
-void editor_auto_table(ScintillaObject *sci, gint pos)
+static void editor_auto_table(document *doc, gint pos)
 {
+	ScintillaObject *sci = doc->sci;
 	gchar *table;
 	gint indent_pos;
 
 	if (SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_HTML) return;
 
-	get_indent(sci, pos, TRUE);
+	get_indent(doc, pos, TRUE);
 	indent_pos = sci_get_line_indent_position(sci, sci_get_line_from_position(sci, pos));
 	if ((pos - 7) != indent_pos) // 7 == strlen("<table>")
 	{
@@ -1747,7 +1749,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_list[idx].sci, sel_start, TRUE);
+			get_indent(&doc_list[idx], sel_start, TRUE);
 			if ((sel_start - first_line_start) <= (gint) strlen(indent))
 				a = 0;
 
@@ -2220,7 +2222,7 @@
 	if (doc_list[idx].auto_indent && ! have_multiline_comment &&
 		doc_list[idx].file_type->comment_use_indent)
 	{
-		get_indent(doc_list[idx].sci, editor_info.click_pos, TRUE);
+		get_indent(&doc_list[idx], editor_info.click_pos, TRUE);
 		text = g_strdup_printf("%s\n%s\n%s\n", indent, indent, indent);
 		text_len = strlen(text);
 	}
@@ -2280,11 +2282,11 @@
 }
 
 
-void editor_insert_alternative_whitespace(ScintillaObject *sci)
+void editor_insert_alternative_whitespace(gint idx)
 {
 	// creates and inserts one tabulator sign or whitespace of the amount of the tab width
-	gchar *text = get_whitespace(editor_prefs.tab_width, TRUE);
-	sci_add_text(sci, text);
+	gchar *text = get_whitespace(editor_prefs.tab_width, ! doc_list[idx].use_tabs);
+	sci_add_text(doc_list[idx].sci, text);
 	g_free(text);
 }
 
@@ -2438,7 +2440,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_list[idx].sci,
+	get_indent(&doc_list[idx],
 		sci_get_position_from_line(doc_list[idx].sci, first_line - 1), TRUE);
 	SSM(doc_list[idx].sci, SCI_BEGINUNDOACTION, 0, 0);
 

Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h	2007-10-17 11:55:59 UTC (rev 1952)
+++ trunk/src/editor.h	2007-10-17 12:27:07 UTC (rev 1953)
@@ -74,6 +74,7 @@
 	gboolean	brace_match_ltgt;	// whether to highlight < and > chars (hidden pref)
 	gboolean	use_gtk_word_boundaries;	// hidden pref
 	gboolean	auto_complete_whilst_editing;	// hidden pref
+	gboolean	detect_tab_mode;
 } EditorPrefs;
 
 extern EditorPrefs editor_prefs;
@@ -118,8 +119,6 @@
 
 void editor_highlight_braces(ScintillaObject *sci, gint cur_pos);
 
-void editor_auto_table(ScintillaObject *sci, gint pos);
-
 gboolean editor_lexer_is_c_like(gint lexer);
 
 gint editor_lexer_get_type_keyword_idx(gint lexer);
@@ -132,7 +131,7 @@
 
 void editor_select_paragraph(ScintillaObject *sci);
 
-void editor_insert_alternative_whitespace(ScintillaObject *sci);
+void editor_insert_alternative_whitespace(gint idx);
 
 void editor_auto_line_indentation(gint idx, gint pos);
 

Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c	2007-10-17 11:55:59 UTC (rev 1952)
+++ trunk/src/interface.c	2007-10-17 12:27:07 UTC (rev 1953)
@@ -37,7 +37,7 @@
   GtkWidget *file1_menu;
   GtkWidget *menu_new1;
   GtkWidget *menu_new_with_template1;
-  GtkWidget *image2010;
+  GtkWidget *image2248;
   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 *image2011;
+  GtkWidget *image2249;
   GtkWidget *menu_reload1;
-  GtkWidget *image2012;
+  GtkWidget *image2250;
   GtkWidget *menu_reload_as1;
-  GtkWidget *image2013;
+  GtkWidget *image2251;
   GtkWidget *menu_reload_as1_menu;
   GtkWidget *invisible7;
   GtkWidget *separator21;
@@ -64,7 +64,7 @@
   GtkWidget *separator14;
   GtkWidget *menu_close1;
   GtkWidget *menu_close_all1;
-  GtkWidget *image2014;
+  GtkWidget *image2252;
   GtkWidget *menu_separatormenuitem1;
   GtkWidget *menu_quit1;
   GtkWidget *edit1;
@@ -89,16 +89,16 @@
   GtkWidget *menu_duplicate_line1;
   GtkWidget *separator29;
   GtkWidget *menu_increase_indent1;
-  GtkWidget *image2015;
+  GtkWidget *image2253;
   GtkWidget *menu_decrease_indent1;
-  GtkWidget *image2016;
+  GtkWidget *image2254;
   GtkWidget *separator37;
   GtkWidget *send_selection_to2;
   GtkWidget *send_selection_to2_menu;
   GtkWidget *invisible13;
   GtkWidget *separator18;
   GtkWidget *add_comments1;
-  GtkWidget *image2017;
+  GtkWidget *image2255;
   GtkWidget *add_comments1_menu;
   GtkWidget *menu_add_changelog_entry1;
   GtkWidget *insert_file_header1;
@@ -107,11 +107,11 @@
   GtkWidget *insert_gpl_notice2;
   GtkWidget *insert_bsd_license_notice2;
   GtkWidget *insert_date1;
-  GtkWidget *image2018;
+  GtkWidget *image2256;
   GtkWidget *insert_date1_menu;
   GtkWidget *invisible8;
   GtkWidget *insert_include2;
-  GtkWidget *image2019;
+  GtkWidget *image2257;
   GtkWidget *insert_include2_menu;
   GtkWidget *invisible4;
   GtkWidget *separator9;
@@ -123,7 +123,7 @@
   GtkWidget *find_previous1;
   GtkWidget *find_in_files1;
   GtkWidget *replace1;
-  GtkWidget *image2020;
+  GtkWidget *image2258;
   GtkWidget *separator33;
   GtkWidget *find_nextsel1;
   GtkWidget *find_prevsel1;
@@ -131,11 +131,11 @@
   GtkWidget *next_message1;
   GtkWidget *separator32;
   GtkWidget *go_to_line1;
-  GtkWidget *image2021;
+  GtkWidget *image2259;
   GtkWidget *menu_view1;
   GtkWidget *menu_view1_menu;
   GtkWidget *menu_change_font1;
-  GtkWidget *image2022;
+  GtkWidget *image2260;
   GtkWidget *menu_separator4;
   GtkWidget *menu_toggle_all_additional_widgets1;
   GtkWidget *menu_fullscreen1;
@@ -152,9 +152,15 @@
   GtkWidget *menu_document1_menu;
   GtkWidget *menu_line_breaking1;
   GtkWidget *menu_use_auto_indentation1;
+  GtkWidget *indent_type1;
+  GtkWidget *indent_type1_menu;
+  GSList *tabs1_group = NULL;
+  GtkWidget *tabs1;
+  GtkWidget *spaces1;
+  GtkWidget *separator45;
   GtkWidget *set_file_readonly1;
   GtkWidget *menu_write_unicode_bom1;
-  GtkWidget *separator10;
+  GtkWidget *separator46;
   GtkWidget *set_filetype1;
   GtkWidget *set_filetype1_menu;
   GtkWidget *invisible1;
@@ -178,23 +184,23 @@
   GtkWidget *menu_project1;
   GtkWidget *menu_project1_menu;
   GtkWidget *project_new1;
-  GtkWidget *image2023;
+  GtkWidget *image2261;
   GtkWidget *project_open1;
-  GtkWidget *image2024;
+  GtkWidget *image2262;
   GtkWidget *project_close1;
-  GtkWidget *image2025;
+  GtkWidget *image2263;
   GtkWidget *separator34;
   GtkWidget *project_properties1;
   GtkWidget *menu_build1;
   GtkWidget *tools1;
   GtkWidget *tools1_menu;
   GtkWidget *menu_choose_color1;
-  GtkWidget *image2026;
+  GtkWidget *image2264;
   GtkWidget *menu_count_words1;
   GtkWidget *menu_help1;
   GtkWidget *menu_help1_menu;
   GtkWidget *help1;
-  GtkWidget *image2027;
+  GtkWidget *image2265;
   GtkWidget *keyboard_shortcuts1;
   GtkWidget *website1;
   GtkWidget *separator16;
@@ -294,9 +300,9 @@
   gtk_widget_show (menu_new_with_template1);
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_new_with_template1);
 
-  image2010 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2010);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image2010);
+  image2248 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2248);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image2248);
 
   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);
@@ -339,25 +345,25 @@
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_save_all1);
   gtk_tooltips_set_tip (tooltips, menu_save_all1, _("Saves all open files"), NULL);
 
-  image2011 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2011);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image2011);
+  image2249 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2249);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image2249);
 
   menu_reload1 = gtk_image_menu_item_new_with_mnemonic (_("_Reload"));
   gtk_widget_show (menu_reload1);
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_reload1);
 
-  image2012 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2012);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image2012);
+  image2250 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2250);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image2250);
 
   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);
 
-  image2013 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2013);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image2013);
+  image2251 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2251);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image2251);
 
   menu_reload_as1_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_reload_as1), menu_reload_as1_menu);
@@ -408,9 +414,9 @@
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_close_all1);
   gtk_tooltips_set_tip (tooltips, menu_close_all1, _("Closes all open files"), NULL);
 
-  image2014 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2014);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image2014);
+  image2252 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2252);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image2252);
 
   menu_separatormenuitem1 = gtk_separator_menu_item_new ();
   gtk_widget_show (menu_separatormenuitem1);
@@ -514,17 +520,17 @@
   gtk_widget_show (menu_increase_indent1);
   gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_increase_indent1);
 
-  image2015 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2015);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image2015);
+  image2253 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2253);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image2253);
 
   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);
 
-  image2016 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2016);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image2016);
+  image2254 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2254);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image2254);
 
   separator37 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator37);
@@ -550,9 +556,9 @@
   gtk_widget_show (add_comments1);
   gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1);
 
-  image2017 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2017);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image2017);
+  image2255 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2255);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image2255);
 
   add_comments1_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu);
@@ -591,9 +597,9 @@
   gtk_widget_show (insert_date1);
   gtk_container_add (GTK_CONTAINER (edit1_menu), insert_date1);
 
-  image2018 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2018);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date1), image2018);
+  image2256 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2256);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date1), image2256);
 
   insert_date1_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_date1), insert_date1_menu);
@@ -605,9 +611,9 @@
   gtk_widget_show (insert_include2);
   gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2);
 
-  image2019 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2019);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image2019);
+  image2257 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2257);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image2257);
 
   insert_include2_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu);
@@ -651,9 +657,9 @@
   gtk_widget_show (replace1);
   gtk_container_add (GTK_CONTAINER (search1_menu), replace1);
 
-  image2020 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2020);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image2020);
+  image2258 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2258);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image2258);
 
   separator33 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator33);
@@ -686,9 +692,9 @@
   gtk_widget_show (go_to_line1);
   gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1);
 
-  image2021 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2021);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image2021);
+  image2259 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2259);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image2259);
 
   menu_view1 = gtk_menu_item_new_with_mnemonic (_("_View"));
   gtk_widget_show (menu_view1);
@@ -702,9 +708,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);
 
-  image2022 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2022);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image2022);
+  image2260 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2260);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image2260);
 
   menu_separator4 = gtk_separator_menu_item_new ();
   gtk_widget_show (menu_separator4);
@@ -778,11 +784,34 @@
   gtk_tooltips_set_tip (tooltips, menu_line_breaking1, _("Wrap the line at the window border and continue it on the next line. Note: line wrapping has a high performance cost for large documents so should be disabled on slow machines."), NULL);
   gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_line_breaking1), TRUE);
 
-  menu_use_auto_indentation1 = gtk_check_menu_item_new_with_mnemonic (_("_Use Auto-indentation"));
+  menu_use_auto_indentation1 = gtk_check_menu_item_new_with_mnemonic (_("_Auto-indentation"));
   gtk_widget_show (menu_use_auto_indentation1);
   gtk_container_add (GTK_CONTAINER (menu_document1_menu), menu_use_auto_indentation1);
   gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_use_auto_indentation1), TRUE);
 
+  indent_type1 = gtk_menu_item_new_with_mnemonic (_("In_dent Type"));
+  gtk_widget_show (indent_type1);
+  gtk_container_add (GTK_CONTAINER (menu_document1_menu), indent_type1);
+
+  indent_type1_menu = gtk_menu_new ();
+  gtk_menu_item_set_submenu (GTK_MENU_ITEM (indent_type1), indent_type1_menu);
+
+  tabs1 = gtk_radio_menu_item_new_with_mnemonic (tabs1_group, _("Tabs"));
+  tabs1_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (tabs1));
+  gtk_widget_show (tabs1);
+  gtk_container_add (GTK_CONTAINER (indent_type1_menu), tabs1);
+
+  spaces1 = gtk_radio_menu_item_new_with_mnemonic (tabs1_group, _("Spaces"));
+  tabs1_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (spaces1));
+  gtk_widget_show (spaces1);
+  gtk_container_add (GTK_CONTAINER (indent_type1_menu), spaces1);
+  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (spaces1), TRUE);
+
+  separator45 = gtk_separator_menu_item_new ();
+  gtk_widget_show (separator45);
+  gtk_container_add (GTK_CONTAINER (menu_document1_menu), separator45);
+  gtk_widget_set_sensitive (separator45, FALSE);
+
   set_file_readonly1 = gtk_check_menu_item_new_with_mnemonic (_("Read _Only"));
   gtk_widget_show (set_file_readonly1);
   gtk_container_add (GTK_CONTAINER (menu_document1_menu), set_file_readonly1);
@@ -792,10 +821,10 @@
   gtk_widget_show (menu_write_unicode_bom1);
   gtk_container_add (GTK_CONTAINER (menu_document1_menu), menu_write_unicode_bom1);
 
-  separator10 = gtk_separator_menu_item_new ();
-  gtk_widget_show (separator10);
-  gtk_container_add (GTK_CONTAINER (menu_document1_menu), separator10);
-  gtk_widget_set_sensitive (separator10, FALSE);
+  separator46 = gtk_separator_menu_item_new ();
+  gtk_widget_show (separator46);
+  gtk_container_add (GTK_CONTAINER (menu_document1_menu), separator46);
+  gtk_widget_set_sensitive (separator46, FALSE);
 
   set_filetype1 = gtk_menu_item_new_with_mnemonic (_("Set File_type"));
   gtk_widget_show (set_filetype1);
@@ -828,13 +857,11 @@
   crlf_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (crlf));
   gtk_widget_show (crlf);
   gtk_container_add (GTK_CONTAINER (menu_line_endings1_menu), crlf);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (crlf), TRUE);
 
   lf = gtk_radio_menu_item_new_with_mnemonic (crlf_group, _("Convert and Set to _LF (Unix)"));
   crlf_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (lf));
   gtk_widget_show (lf);
   gtk_container_add (GTK_CONTAINER (menu_line_endings1_menu), lf);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lf), TRUE);
 
   cr = gtk_radio_menu_item_new_with_mnemonic (crlf_group, _("Convert and Set to CR (_Mac)"));
   crlf_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (cr));
@@ -892,25 +919,25 @@
   gtk_widget_show (project_new1);
   gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_new1);
 
-  image2023 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2023);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image2023);
+  image2261 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2261);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image2261);
 
   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);
 
-  image2024 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2024);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image2024);
+  image2262 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2262);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image2262);
 
   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);
 
-  image2025 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2025);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image2025);
+  image2263 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2263);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image2263);
 
   separator34 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator34);
@@ -937,9 +964,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);
 
-  image2026 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2026);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image2026);
+  image2264 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2264);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image2264);
 
   menu_count_words1 = gtk_menu_item_new_with_mnemonic (_("_Word Count"));
   gtk_widget_show (menu_count_words1);
@@ -957,9 +984,9 @@
   gtk_widget_show (help1);
   gtk_container_add (GTK_CONTAINER (menu_help1_menu), help1);
 
-  image2027 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2027);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image2027);
+  image2265 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2265);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image2265);
 
   keyboard_shortcuts1 = gtk_menu_item_new_with_mnemonic (_("_Keyboard Shortcuts"));
   gtk_widget_show (keyboard_shortcuts1);
@@ -1446,6 +1473,12 @@
   g_signal_connect ((gpointer) menu_use_auto_indentation1, "toggled",
                     G_CALLBACK (on_use_auto_indentation1_toggled),
                     NULL);
+  g_signal_connect ((gpointer) tabs1, "activate",
+                    G_CALLBACK (on_tabs1_activate),
+                    NULL);
+  g_signal_connect ((gpointer) spaces1, "activate",
+                    G_CALLBACK (on_spaces1_activate),
+                    NULL);
   g_signal_connect ((gpointer) set_file_readonly1, "toggled",
                     G_CALLBACK (on_set_file_readonly1_toggled),
                     NULL);
@@ -1603,7 +1636,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, image2010, "image2010");
+  GLADE_HOOKUP_OBJECT (window1, image2248, "image2248");
   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");
@@ -1614,11 +1647,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, image2011, "image2011");
+  GLADE_HOOKUP_OBJECT (window1, image2249, "image2249");
   GLADE_HOOKUP_OBJECT (window1, menu_reload1, "menu_reload1");
-  GLADE_HOOKUP_OBJECT (window1, image2012, "image2012");
+  GLADE_HOOKUP_OBJECT (window1, image2250, "image2250");
   GLADE_HOOKUP_OBJECT (window1, menu_reload_as1, "menu_reload_as1");
-  GLADE_HOOKUP_OBJECT (window1, image2013, "image2013");
+  GLADE_HOOKUP_OBJECT (window1, image2251, "image2251");
   GLADE_HOOKUP_OBJECT (window1, menu_reload_as1_menu, "menu_reload_as1_menu");
   GLADE_HOOKUP_OBJECT (window1, invisible7, "invisible7");
   GLADE_HOOKUP_OBJECT (window1, separator21, "separator21");
@@ -1630,7 +1663,7 @@
   GLADE_HOOKUP_OBJECT (window1, separator14, "separator14");
   GLADE_HOOKUP_OBJECT (window1, menu_close1, "menu_close1");
   GLADE_HOOKUP_OBJECT (window1, menu_close_all1, "menu_close_all1");
-  GLADE_HOOKUP_OBJECT (window1, image2014, "image2014");
+  GLADE_HOOKUP_OBJECT (window1, image2252, "image2252");
   GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1");
   GLADE_HOOKUP_OBJECT (window1, menu_quit1, "menu_quit1");
   GLADE_HOOKUP_OBJECT (window1, edit1, "edit1");
@@ -1655,16 +1688,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, image2015, "image2015");
+  GLADE_HOOKUP_OBJECT (window1, image2253, "image2253");
   GLADE_HOOKUP_OBJECT (window1, menu_decrease_indent1, "menu_decrease_indent1");
-  GLADE_HOOKUP_OBJECT (window1, image2016, "image2016");
+  GLADE_HOOKUP_OBJECT (window1, image2254, "image2254");
   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, image2017, "image2017");
+  GLADE_HOOKUP_OBJECT (window1, image2255, "image2255");
   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");
@@ -1673,11 +1706,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, image2018, "image2018");
+  GLADE_HOOKUP_OBJECT (window1, image2256, "image2256");
   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, image2019, "image2019");
+  GLADE_HOOKUP_OBJECT (window1, image2257, "image2257");
   GLADE_HOOKUP_OBJECT (window1, insert_include2_menu, "insert_include2_menu");
   GLADE_HOOKUP_OBJECT (window1, invisible4, "invisible4");
   GLADE_HOOKUP_OBJECT (window1, separator9, "separator9");
@@ -1689,7 +1722,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, image2020, "image2020");
+  GLADE_HOOKUP_OBJECT (window1, image2258, "image2258");
   GLADE_HOOKUP_OBJECT (window1, separator33, "separator33");
   GLADE_HOOKUP_OBJECT (window1, find_nextsel1, "find_nextsel1");
   GLADE_HOOKUP_OBJECT (window1, find_prevsel1, "find_prevsel1");
@@ -1697,11 +1730,11 @@
   GLADE_HOOKUP_OBJECT (window1, next_message1, "next_message1");
   GLADE_HOOKUP_OBJECT (window1, separator32, "separator32");
   GLADE_HOOKUP_OBJECT (window1, go_to_line1, "go_to_line1");
-  GLADE_HOOKUP_OBJECT (window1, image2021, "image2021");
+  GLADE_HOOKUP_OBJECT (window1, image2259, "image2259");
   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, image2022, "image2022");
+  GLADE_HOOKUP_OBJECT (window1, image2260, "image2260");
   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");
@@ -1718,9 +1751,14 @@
   GLADE_HOOKUP_OBJECT (window1, menu_document1_menu, "menu_document1_menu");
   GLADE_HOOKUP_OBJECT (window1, menu_line_breaking1, "menu_line_breaking1");
   GLADE_HOOKUP_OBJECT (window1, menu_use_auto_indentation1, "menu_use_auto_indentation1");
+  GLADE_HOOKUP_OBJECT (window1, indent_type1, "indent_type1");
+  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, separator45, "separator45");
   GLADE_HOOKUP_OBJECT (window1, set_file_readonly1, "set_file_readonly1");
   GLADE_HOOKUP_OBJECT (window1, menu_write_unicode_bom1, "menu_write_unicode_bom1");
-  GLADE_HOOKUP_OBJECT (window1, separator10, "separator10");
+  GLADE_HOOKUP_OBJECT (window1, separator46, "separator46");
   GLADE_HOOKUP_OBJECT (window1, set_filetype1, "set_filetype1");
   GLADE_HOOKUP_OBJECT (window1, set_filetype1_menu, "set_filetype1_menu");
   GLADE_HOOKUP_OBJECT (window1, invisible1, "invisible1");
@@ -1743,23 +1781,23 @@
   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, image2023, "image2023");
+  GLADE_HOOKUP_OBJECT (window1, image2261, "image2261");
   GLADE_HOOKUP_OBJECT (window1, project_open1, "project_open1");
-  GLADE_HOOKUP_OBJECT (window1, image2024, "image2024");
+  GLADE_HOOKUP_OBJECT (window1, image2262, "image2262");
   GLADE_HOOKUP_OBJECT (window1, project_close1, "project_close1");
-  GLADE_HOOKUP_OBJECT (window1, image2025, "image2025");
+  GLADE_HOOKUP_OBJECT (window1, image2263, "image2263");
   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, image2026, "image2026");
+  GLADE_HOOKUP_OBJECT (window1, image2264, "image2264");
   GLADE_HOOKUP_OBJECT (window1, menu_count_words1, "menu_count_words1");
   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, image2027, "image2027");
+  GLADE_HOOKUP_OBJECT (window1, image2265, "image2265");
   GLADE_HOOKUP_OBJECT (window1, keyboard_shortcuts1, "keyboard_shortcuts1");
   GLADE_HOOKUP_OBJECT (window1, website1, "website1");
   GLADE_HOOKUP_OBJECT (window1, separator16, "separator16");
@@ -2519,16 +2557,18 @@
   GtkWidget *frame27;
   GtkWidget *alignment30;
   GtkWidget *vbox25;
+  GtkWidget *table13;
+  GtkWidget *label183;
+  GtkWidget *combo_auto_indent_mode;
+  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 *table13;
-  GtkWidget *label116;
-  GtkWidget *label183;
-  GtkObject *spin_tab_width_adj;
-  GtkWidget *spin_tab_width;
-  GtkWidget *combo_auto_indent_mode;
+  GtkWidget *label200;
+  GtkWidget *check_detect_indent;
   GtkWidget *label195;
   GtkWidget *frame14;
   GtkWidget *alignment17;
@@ -3444,46 +3484,32 @@
   gtk_widget_show (vbox25);
   gtk_container_add (GTK_CONTAINER (alignment30), vbox25);
 
-  hbox8 = gtk_hbox_new (FALSE, 12);
-  gtk_widget_show (hbox8);
-  gtk_box_pack_start (GTK_BOX (vbox25), hbox8, FALSE, FALSE, 0);
-
-  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, _("Whenever some whitespace is inserted by Geany it will use tabs when enabled otherwise Geany will use just spaces."), 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));
-
-  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_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));
-
-  table13 = gtk_table_new (2, 2, FALSE);
+  table13 = gtk_table_new (4, 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);
   gtk_table_set_col_spacings (GTK_TABLE (table13), 24);
 
-  label116 = gtk_label_new (_("Tab Width:"));
-  gtk_widget_show (label116);
-  gtk_table_attach (GTK_TABLE (table13), label116, 0, 1, 0, 1,
+  label183 = gtk_label_new (_("Auto-indent mode:"));
+  gtk_widget_show (label183);
+  gtk_table_attach (GTK_TABLE (table13), label183, 0, 1, 3, 4,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label116), 0, 0.5);
 
-  label183 = gtk_label_new (_("Auto indentation mode:"));
-  gtk_widget_show (label183);
-  gtk_table_attach (GTK_TABLE (table13), label183, 0, 1, 1, 2,
+  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,
                     (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
+                    (GtkAttachOptions) (GTK_FILL), 0, 0);
+  gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("None"));
+  gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("Basic"));
+  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, 0, 1,
+  gtk_table_attach (GTK_TABLE (table13), spin_tab_width, 1, 2, 2, 3,
                     (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);
@@ -3491,16 +3517,47 @@
   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);
 
-  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, 1, 2,
+  label116 = gtk_label_new (_("Tab width:"));
+  gtk_widget_show (label116);
+  gtk_table_attach (GTK_TABLE (table13), label116, 0, 1, 2, 3,
                     (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (GTK_FILL), 0, 0);
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("None"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("Basic"));
-  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"));
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label116), 0, 0.5);
 
+  hbox8 = gtk_hbox_new (FALSE, 12);
+  gtk_widget_show (hbox8);
+  gtk_table_attach (GTK_TABLE (table13), hbox8, 1, 2, 0, 1,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
+
+  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));
+
+  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,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label200), 0, 0.5);
+
+  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,
+                    (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);
+
   label195 = gtk_label_new (_("<b>Indentation</b>"));
   gtk_widget_show (label195);
   gtk_frame_set_label_widget (GTK_FRAME (frame27), label195);
@@ -4295,14 +4352,16 @@
   GLADE_HOOKUP_OBJECT (prefs_dialog, frame27, "frame27");
   GLADE_HOOKUP_OBJECT (prefs_dialog, alignment30, "alignment30");
   GLADE_HOOKUP_OBJECT (prefs_dialog, vbox25, "vbox25");
+  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, 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, table13, "table13");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, label116, "label116");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, label183, "label183");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, spin_tab_width, "spin_tab_width");
-  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, check_detect_indent, "check_detect_indent");
   GLADE_HOOKUP_OBJECT (prefs_dialog, label195, "label195");
   GLADE_HOOKUP_OBJECT (prefs_dialog, frame14, "frame14");
   GLADE_HOOKUP_OBJECT (prefs_dialog, alignment17, "alignment17");

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2007-10-17 11:55:59 UTC (rev 1952)
+++ trunk/src/keybindings.c	2007-10-17 12:27:07 UTC (rev 1953)
@@ -1283,7 +1283,7 @@
 			editor_select_paragraph(doc_list[idx].sci);
 			break;
 		case GEANY_KEYS_EDIT_INSERTALTWHITESPACE:
-			editor_insert_alternative_whitespace(doc_list[idx].sci);
+			editor_insert_alternative_whitespace(idx);
 			break;
 		case GEANY_KEYS_EDIT_INCREASEINDENT:
 			on_menu_increase_indent1_activate(NULL, NULL);

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2007-10-17 11:55:59 UTC (rev 1952)
+++ trunk/src/keyfile.c	2007-10-17 12:27:07 UTC (rev 1953)
@@ -185,6 +185,7 @@
 	g_key_file_set_boolean(config, PACKAGE, "use_folding", editor_prefs.folding);
 	g_key_file_set_boolean(config, PACKAGE, "unfold_all_children", editor_prefs.unfold_all_children);
 	g_key_file_set_integer(config, PACKAGE, "indent_mode", editor_prefs.indent_mode);
+	g_key_file_set_integer(config, PACKAGE, "check_detect_indent", editor_prefs.detect_tab_mode);
 	g_key_file_set_boolean(config, PACKAGE, "use_indicators", editor_prefs.use_indicators);
 	g_key_file_set_boolean(config, PACKAGE, "line_breaking", editor_prefs.line_wrapping);
 	g_key_file_set_boolean(config, PACKAGE, "auto_close_xml_tags", editor_prefs.auto_close_xml_tags);
@@ -449,6 +450,7 @@
 	editor_prefs.autocompletion_max_height = utils_get_setting_integer(config, PACKAGE, "autocompletion_max_height", GEANY_MAX_AUTOCOMPLETE_HEIGHT);
 	editor_prefs.line_wrapping = utils_get_setting_boolean(config, PACKAGE, "line_breaking", FALSE); // default is off for better performance
 	editor_prefs.indent_mode = utils_get_setting_integer(config, PACKAGE, "indent_mode", INDENT_CURRENTCHARS);
+	editor_prefs.detect_tab_mode = utils_get_setting_integer(config, PACKAGE, "check_detect_indent", FALSE);
 	editor_prefs.use_tab_to_indent = utils_get_setting_boolean(config, PACKAGE, "use_tab_to_indent", FALSE);
 	editor_prefs.use_indicators = utils_get_setting_boolean(config, PACKAGE, "use_indicators", TRUE);
 	editor_prefs.show_indent_guide = utils_get_setting_boolean(config, PACKAGE, "show_indent_guide", FALSE);

Modified: trunk/src/prefs.c
===================================================================
--- trunk/src/prefs.c	2007-10-17 11:55:59 UTC (rev 1952)
+++ trunk/src/prefs.c	2007-10-17 12:27:07 UTC (rev 1953)
@@ -289,6 +289,9 @@
 	widget = lookup_widget(ui_widgets.prefs_dialog, "combo_auto_indent_mode");
 	gtk_combo_box_set_active(GTK_COMBO_BOX(widget), editor_prefs.indent_mode);
 
+	widget = lookup_widget(ui_widgets.prefs_dialog, "check_detect_indent");
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.detect_tab_mode);
+
 	widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_wrapping");
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.line_wrapping);
 
@@ -693,8 +696,26 @@
 		editor_prefs.smart_home_key = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
 		widget = lookup_widget(ui_widgets.prefs_dialog, "radio_indent_tabs");
-		editor_prefs.use_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		{
+			gboolean use_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
+			// override each document setting only if the default has changed
+			if (editor_prefs.use_tabs != use_tabs)
+			{
+				guint i;
+
+				editor_prefs.use_tabs = use_tabs;
+				for (i = 0; i < doc_array->len; i++)
+				{
+					if (doc_list[i].is_valid)
+						document_set_use_tabs(i, editor_prefs.use_tabs);
+				}
+			}
+		}
+
+		widget = lookup_widget(ui_widgets.prefs_dialog, "check_detect_indent");
+		editor_prefs.detect_tab_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
 		widget = lookup_widget(ui_widgets.prefs_dialog, "check_symbol_auto_completion");
 		editor_prefs.auto_complete_symbols = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 

Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c	2007-10-17 11:55:59 UTC (rev 1952)
+++ trunk/src/ui_utils.c	2007-10-17 12:27:07 UTC (rev 1953)
@@ -115,10 +115,6 @@
 /* updates the status bar document statistics */
 void ui_update_statusbar(gint idx, gint pos)
 {
-	gchar *text;
-	const gchar *cur_tag;
-	guint line, col;
-
 	if (! prefs.statusbar_visible)
 		return; // just do nothing if statusbar is not visible
 
@@ -126,8 +122,14 @@
 
 	if (DOC_IDX_VALID(idx))
 	{
-		utils_get_current_function(idx, &cur_tag);
+		static GString *stats_str = NULL;
+		const gchar sp[] = "      ";
+		guint line, col;
+		const gchar *cur_tag;
 
+		if (stats_str == NULL)
+			stats_str = g_string_sized_new(120);
+
 		if (pos == -1) pos = sci_get_current_position(doc_list[idx].sci);
 		line = sci_get_line_from_position(doc_list[idx].sci, pos);
 
@@ -139,26 +141,43 @@
 		else
 			col = 0;
 
-		/* Status bar statistics: col = column, sel = selection, RO = read-only,
-		 * OVR = overwrite/overtype, INS = insert, MOD = modified */
-		text = g_strdup_printf(_("line: %d\t col: %d\t sel: %d\t %s      %s      "
-			"mode: %s      encoding: %s %s      filetype: %s      scope: %s"),
+		/* Status bar statistics: col = column, sel = selection. */
+		g_string_printf(stats_str, _("line: %d\t col: %d\t sel: %d\t "),
 			(line + 1), col,
-			sci_get_selected_text_length(doc_list[idx].sci) - 1,
-			(doc_list[idx].readonly) ? _("RO ") :
-				(sci_get_overtype(doc_list[idx].sci) ? _("OVR") : _("INS")),
-			(doc_list[idx].changed) ? _("MOD") : "   ",
-			document_get_eol_mode(idx),
+			sci_get_selected_text_length(doc_list[idx].sci) - 1);
+
+		g_string_append(stats_str,
+			(doc_list[idx].readonly) ? _("RO ") :	// RO = read-only
+				(sci_get_overtype(doc_list[idx].sci) ? _("OVR") : _("INS")));	// OVR = overwrite/overtype, INS = insert
+		g_string_append(stats_str, sp);
+		g_string_append(stats_str,
+			(doc_list[idx].use_tabs) ? _("TAB") : _("SP "));	// SP = space
+		g_string_append(stats_str, sp);
+		g_string_append_printf(stats_str, "mode: %s",
+			document_get_eol_mode(idx));
+		g_string_append(stats_str, sp);
+		g_string_append_printf(stats_str, "encoding: %s %s",
 			(doc_list[idx].encoding) ? doc_list[idx].encoding : _("unknown"),
 			(encodings_is_unicode_charset(doc_list[idx].encoding)) ?
-				((doc_list[idx].has_bom) ? _("(with BOM)") : "") : "",
+				((doc_list[idx].has_bom) ? _("(with BOM)") : "") : "");	// BOM = byte order mark
+		g_string_append(stats_str, sp);
+		g_string_append_printf(stats_str, "filetype: %s",
 			(doc_list[idx].file_type) ? doc_list[idx].file_type->name :
-				filetypes[GEANY_FILETYPES_ALL]->name,
+				filetypes[GEANY_FILETYPES_ALL]->name);
+		g_string_append(stats_str, sp);
+		if (doc_list[idx].changed)
+		{
+			g_string_append(stats_str, _("MOD"));	// MOD = modified
+			g_string_append(stats_str, sp);
+		}
+
+		utils_get_current_function(idx, &cur_tag);
+		g_string_append_printf(stats_str, "scope: %s",
 			cur_tag);
-		set_statusbar(text, TRUE);	// can be overridden by status messages
-		g_free(text);
+
+		set_statusbar(stats_str->str, TRUE);	// can be overridden by status messages
 	}
-	else
+	else	// no documents
 	{
 		set_statusbar("", TRUE);	// can be overridden by status messages
 	}
@@ -626,7 +645,7 @@
 void ui_document_show_hide(gint idx)
 {
 	gchar *widget_name;
-	GtkWidget *check_indent;
+	GtkWidget *item;
 
 	if (idx == -1)
 		idx = document_get_cur_idx();
@@ -636,35 +655,37 @@
 
 	app->ignore_callback = TRUE;
 
-	check_indent = lookup_widget(app->window, "menu_use_auto_indentation1");
-
 	gtk_check_menu_item_set_active(
 			GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_line_breaking1")),
 			doc_list[idx].line_wrapping);
+
+	item = lookup_widget(app->window, "menu_use_auto_indentation1");
+	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
+		doc_list[idx].auto_indent);
+	gtk_widget_set_sensitive(item, editor_prefs.indent_mode != INDENT_NONE);
+
+	item = lookup_widget(app->window,
+		doc_list[idx].use_tabs ? "tabs1" : "spaces1");
+	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
+
 	gtk_check_menu_item_set_active(
-			GTK_CHECK_MENU_ITEM(check_indent),
-			doc_list[idx].auto_indent);
-	gtk_check_menu_item_set_active(
 			GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "set_file_readonly1")),
 			doc_list[idx].readonly);
-	gtk_check_menu_item_set_active(
-			GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_write_unicode_bom1")),
-			doc_list[idx].has_bom);
 
+	item = lookup_widget(app->window, "menu_write_unicode_bom1");
+	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
+		doc_list[idx].has_bom);
+	gtk_widget_set_sensitive(item, encodings_is_unicode_charset(doc_list[idx].encoding));
+
 	switch (sci_get_eol_mode(doc_list[idx].sci))
 	{
 		case SC_EOL_CR: widget_name = "cr"; break;
 		case SC_EOL_LF: widget_name = "lf"; break;
 		default: widget_name = "crlf"; break;
 	}
-	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, widget_name)),
-																					TRUE);
+	gtk_check_menu_item_set_active(
+		GTK_CHECK_MENU_ITEM(lookup_widget(app->window, widget_name)), TRUE);
 
-	gtk_widget_set_sensitive(check_indent, editor_prefs.indent_mode != INDENT_NONE);
-
-	gtk_widget_set_sensitive(lookup_widget(app->window, "menu_write_unicode_bom1"),
-			encodings_is_unicode_charset(doc_list[idx].encoding));
-
 	encodings_select_radio_item(doc_list[idx].encoding);
 	filetypes_select_radio_item(doc_list[idx].file_type);
 


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