SF.net SVN: geany: [1373] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Mar 8 18:02:09 UTC 2007


Revision: 1373
          http://svn.sourceforge.net/geany/?rev=1373&view=rev
Author:   eht16
Date:     2007-03-08 10:02:08 -0800 (Thu, 08 Mar 2007)

Log Message:
-----------
Added different auto indention modes to select who should Geany indent new lines (closes #1615605).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/geany.docbook
    trunk/geany.glade
    trunk/src/document.c
    trunk/src/document.h
    trunk/src/geany.h
    trunk/src/interface.c
    trunk/src/keyfile.c
    trunk/src/main.c
    trunk/src/prefs.c
    trunk/src/sci_cb.c
    trunk/src/ui_utils.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-03-08 17:03:26 UTC (rev 1372)
+++ trunk/ChangeLog	2007-03-08 18:02:08 UTC (rev 1373)
@@ -11,8 +11,14 @@
 2007-03-08  Enrico Tröger  <enrico.troeger at uvena.de>
 
  * geany.glade, src/interface.c: Fixed wrong tooltip.
+ * geany.glade, doc/geany.docbook, src/document.c, src/document.h,
+   src/geany.h, src/interface.c, src/keyfile.c, src/main.c, src/prefs.c,
+   src/sci_cb.c, src/ui_utils.c:
+   Added different auto indention modes to select who should Geany
+   indent new lines (closes #1615605).
 
 
+
 2007-03-06  Nick Treleaven  <nick.treleaven at btinternet.com>
 
  * src/win32.c, src/callbacks.c, src/keyfile.c, src/document.c,

Modified: trunk/doc/geany.docbook
===================================================================
--- trunk/doc/geany.docbook	2007-03-08 17:03:26 UTC (rev 1372)
+++ trunk/doc/geany.docbook	2007-03-08 18:02:08 UTC (rev 1373)
@@ -5,7 +5,7 @@
 <!ENTITY appversion "0.11">
 <!ENTITY appurl "http://geany.uvena.de">
 <!ENTITY author_mail "enrico.troeger at uvena.de">
-<!ENTITY date "February 18, 2007">
+<!ENTITY date "March 08, 2007">
 <!ENTITY legal SYSTEM "geany_gpl.docbook">
 <!ENTITY scikeybinding SYSTEM "scikeybinding.docbook">
 ]>
@@ -380,6 +380,37 @@
 					was copied to the new position.
 				</para>
 			</section>
+			<section id="general_indention">
+				<title>Auto indention</title>
+				<para>
+					<application>Geany</application> knows three types of auto indention:
+					None, Basic and Advanced.
+					<variablelist><title>Auto indention types</title>
+					<varlistentry><term>None</term>
+					<listitem>
+					<para>
+						Disables auto indention completely.
+					</para>
+					</listitem>
+					</varlistentry>
+					<varlistentry><term>Basic</term>
+					<listitem>
+					<para>
+						Adds the same amount of whitespace on a new line as on the last line.
+					</para>
+					</listitem>
+					</varlistentry>
+					<varlistentry><term>Advanced</term>
+					<listitem>
+					<para>
+						Does the same as Basic but also indents curly brackets and adds a tabulator
+						character (or spaces) on a new line after an opening '{' brace.
+					</para>
+					</listitem>
+					</varlistentry>
+					</variablelist>
+				</para>
+			</section>
 			<section id="general_vte">
 				<title>Virtual terminal emulator widget (VTE)</title>
 				<para>

Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade	2007-03-08 17:03:26 UTC (rev 1372)
+++ trunk/geany.glade	2007-03-08 18:02:08 UTC (rev 1373)
@@ -5311,17 +5311,60 @@
 			  <property name="spacing">0</property>
 
 			  <child>
-			    <widget class="GtkCheckButton" id="check_auto_indent">
+			    <widget class="GtkHBox" id="hbox7">
 			      <property name="visible">True</property>
-			      <property name="tooltip" translatable="yes">Add the same indentation as the previous line after pressing enter</property>
-			      <property name="can_focus">True</property>
-			      <property name="label" translatable="yes">Auto indentation</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="homogeneous">False</property>
+			      <property name="spacing">0</property>
+
+			      <child>
+				<widget class="GtkLabel" id="label183">
+				  <property name="visible">True</property>
+				  <property name="label" translatable="yes">Auto indention 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="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
+
+			      <child>
+				<widget class="GtkEventBox" id="eventbox2">
+				  <property name="visible">True</property>
+				  <property name="tooltip" translatable="yes">Selects the indention mode. Use None to disable auto indention completely. Basic indents new lines with the same indention as the previous line. Advanced does the same and indents also curly brackets.</property>
+				  <property name="visible_window">True</property>
+				  <property name="above_child">False</property>
+
+				  <child>
+				    <widget class="GtkComboBox" id="combo_auto_indent_mode">
+				      <property name="visible">True</property>
+				      <property name="items" translatable="yes">None
+Basic
+Advanced</property>
+				      <property name="add_tearoffs">False</property>
+				      <property name="focus_on_click">True</property>
+				    </widget>
+				  </child>
+				</widget>
+				<packing>
+				  <property name="padding">5</property>
+				  <property name="expand">False</property>
+				  <property name="fill">True</property>
+				</packing>
+			      </child>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2007-03-08 17:03:26 UTC (rev 1372)
+++ trunk/src/document.c	2007-03-08 18:02:08 UTC (rev 1373)
@@ -194,8 +194,9 @@
 
 
 // Apply just the prefs that can change in the Preferences dialog
-void document_apply_update_prefs(ScintillaObject *sci)
+void document_apply_update_prefs(gint idx)
 {
+	ScintillaObject *sci = doc_list[idx].sci;
 	sci_set_mark_long_lines(sci, app->long_line_type, app->long_line_column, app->long_line_color);
 
 	sci_set_tab_width(sci, app->pref_editor_tab_width);
@@ -208,6 +209,8 @@
 	sci_set_visible_eols(sci, app->pref_editor_show_line_endings);
 
 	sci_set_folding_margin_visible(sci, app->pref_editor_folding);
+
+	doc_list[idx].use_auto_indention = (app->pref_editor_indention_mode != INDENT_NONE);
 }
 
 
@@ -217,7 +220,7 @@
 {
 	new_doc->is_valid = FALSE;
 	new_doc->has_tags = FALSE;
-	new_doc->use_auto_indention = app->pref_editor_use_auto_indention;
+	new_doc->use_auto_indention = (app->pref_editor_indention_mode != INDENT_NONE);
 	new_doc->line_breaking = app->pref_editor_line_breaking;
 	new_doc->readonly = FALSE;
 	new_doc->tag_store = NULL;
@@ -296,7 +299,7 @@
 	// disable select all to be able to redefine it
 	sci_clear_cmdkey(sci, 'A' | (SCMOD_CTRL << 16));
 
-	document_apply_update_prefs(sci);
+	document_apply_update_prefs(new_idx);
 
 	sci_set_tab_indents(sci, app->use_tab_to_indent);
 	sci_set_symbol_margin(sci, app->show_markers_margin);
@@ -331,7 +334,7 @@
 	this->last_check = time(NULL);
 	this->readonly = FALSE;
 	this->line_breaking = app->pref_editor_line_breaking;
-	this->use_auto_indention = app->pref_editor_use_auto_indention;
+	this->use_auto_indention = (app->pref_editor_indention_mode != INDENT_NONE);
 	this->has_tags = FALSE;
 
 	treeviews_openfiles_add(new_idx);	// sets this->iter

Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h	2007-03-08 17:03:26 UTC (rev 1372)
+++ trunk/src/document.h	2007-03-08 18:02:08 UTC (rev 1373)
@@ -120,7 +120,7 @@
 
 
 // Apply just the prefs that can change in the Preferences dialog
-void document_apply_update_prefs(ScintillaObject *sci);
+void document_apply_update_prefs(gint idx);
 
 
 /* removes the given notebook tab and clears the related entry in the document list */

Modified: trunk/src/geany.h
===================================================================
--- trunk/src/geany.h	2007-03-08 17:03:26 UTC (rev 1372)
+++ trunk/src/geany.h	2007-03-08 18:02:08 UTC (rev 1373)
@@ -105,7 +105,7 @@
 	// I know, it is a bit confusing, but this line breaking is globally,
 	// to change the default value at startup, I think
 	gboolean			 pref_editor_line_breaking;
-	gboolean			 pref_editor_use_auto_indention;
+	gint			 	 pref_editor_indention_mode;
 	gboolean			 pref_editor_use_indicators;
 	gboolean			 pref_editor_show_white_space;
 	gboolean			 pref_editor_show_indent_guide;
@@ -214,7 +214,15 @@
 	RIGHT
 };
 
-enum {
+enum
+{
+	INDENT_NONE = 0,
+	INDENT_BASIC,
+	INDENT_ADVANCED
+};
+
+enum
+{
 	KILOBYTE = 1024,
 	MEGABYTE = (KILOBYTE*1024),
 	GIGABYTE = (MEGABYTE*1024)

Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c	2007-03-08 17:03:26 UTC (rev 1372)
+++ trunk/src/interface.c	2007-03-08 18:02:08 UTC (rev 1373)
@@ -2454,7 +2454,10 @@
   GtkWidget *frame14;
   GtkWidget *alignment17;
   GtkWidget *vbox17;
-  GtkWidget *check_auto_indent;
+  GtkWidget *hbox7;
+  GtkWidget *label183;
+  GtkWidget *eventbox2;
+  GtkWidget *combo_auto_indent_mode;
   GtkWidget *check_line_wrapping;
   GtkWidget *check_folding;
   GtkWidget *check_unfold_children;
@@ -3327,11 +3330,26 @@
   gtk_widget_show (vbox17);
   gtk_container_add (GTK_CONTAINER (alignment17), vbox17);
 
-  check_auto_indent = gtk_check_button_new_with_mnemonic (_("Auto indentation"));
-  gtk_widget_show (check_auto_indent);
-  gtk_box_pack_start (GTK_BOX (vbox17), check_auto_indent, FALSE, FALSE, 0);
-  gtk_tooltips_set_tip (tooltips, check_auto_indent, _("Add the same indentation as the previous line after pressing enter"), NULL);
+  hbox7 = gtk_hbox_new (FALSE, 0);
+  gtk_widget_show (hbox7);
+  gtk_box_pack_start (GTK_BOX (vbox17), hbox7, FALSE, FALSE, 0);
 
+  label183 = gtk_label_new (_("Auto indention mode:"));
+  gtk_widget_show (label183);
+  gtk_box_pack_start (GTK_BOX (hbox7), label183, FALSE, FALSE, 0);
+
+  eventbox2 = gtk_event_box_new ();
+  gtk_widget_show (eventbox2);
+  gtk_box_pack_start (GTK_BOX (hbox7), eventbox2, FALSE, TRUE, 5);
+  gtk_tooltips_set_tip (tooltips, eventbox2, _("Selects the indention mode. Use None to disable auto indention completely. Basic indents new lines with the same indention as the previous line. Advanced does the same and indents also curly brackets."), NULL);
+
+  combo_auto_indent_mode = gtk_combo_box_new_text ();
+  gtk_widget_show (combo_auto_indent_mode);
+  gtk_container_add (GTK_CONTAINER (eventbox2), combo_auto_indent_mode);
+  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), _("Advanced"));
+
   check_line_wrapping = gtk_check_button_new_with_mnemonic (_("Line wrapping"));
   gtk_widget_show (check_line_wrapping);
   gtk_box_pack_start (GTK_BOX (vbox17), check_line_wrapping, FALSE, FALSE, 0);
@@ -3902,7 +3920,10 @@
   GLADE_HOOKUP_OBJECT (prefs_dialog, frame14, "frame14");
   GLADE_HOOKUP_OBJECT (prefs_dialog, alignment17, "alignment17");
   GLADE_HOOKUP_OBJECT (prefs_dialog, vbox17, "vbox17");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, check_auto_indent, "check_auto_indent");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, hbox7, "hbox7");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, label183, "label183");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, eventbox2, "eventbox2");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, combo_auto_indent_mode, "combo_auto_indent_mode");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_line_wrapping, "check_line_wrapping");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_folding, "check_folding");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_unfold_children, "check_unfold_children");

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2007-03-08 17:03:26 UTC (rev 1372)
+++ trunk/src/keyfile.c	2007-03-08 18:02:08 UTC (rev 1373)
@@ -106,7 +106,7 @@
 	g_key_file_set_boolean(config, PACKAGE, "msgwindow_visible", app->msgwindow_visible);
 	g_key_file_set_boolean(config, PACKAGE, "use_folding", app->pref_editor_folding);
 	g_key_file_set_boolean(config, PACKAGE, "unfold_all_children", app->pref_editor_unfold_all_children);
-	g_key_file_set_boolean(config, PACKAGE, "use_auto_indention", app->pref_editor_use_auto_indention);
+	g_key_file_set_integer(config, PACKAGE, "indention_mode", app->pref_editor_indention_mode);
 	g_key_file_set_boolean(config, PACKAGE, "use_tab_to_indent", app->use_tab_to_indent);
 	g_key_file_set_boolean(config, PACKAGE, "use_indicators", app->pref_editor_use_indicators);
 	g_key_file_set_boolean(config, PACKAGE, "show_indent_guide", app->pref_editor_show_indent_guide);
@@ -322,7 +322,7 @@
 	app->sidebar_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_visible", TRUE);
 	app->msgwindow_visible = utils_get_setting_boolean(config, PACKAGE, "msgwindow_visible", TRUE);
 	app->pref_editor_line_breaking = utils_get_setting_boolean(config, PACKAGE, "line_breaking", FALSE); //default is off for better performance
-	app->pref_editor_use_auto_indention = utils_get_setting_boolean(config, PACKAGE, "use_auto_indention", TRUE);
+	app->pref_editor_indention_mode = utils_get_setting_integer(config, PACKAGE, "indention_mode", INDENT_ADVANCED);
 	app->use_tab_to_indent = utils_get_setting_boolean(config, PACKAGE, "use_tab_to_indent", FALSE);
 	app->pref_editor_use_indicators = utils_get_setting_boolean(config, PACKAGE, "use_indicators", TRUE);
 	app->pref_editor_show_indent_guide = utils_get_setting_boolean(config, PACKAGE, "show_indent_guide", FALSE);

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2007-03-08 17:03:26 UTC (rev 1372)
+++ trunk/src/main.c	2007-03-08 18:02:08 UTC (rev 1373)
@@ -209,7 +209,8 @@
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
 				lookup_widget(app->window, "menu_line_breaking1")), app->pref_editor_line_breaking);
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
-				lookup_widget(app->window, "menu_use_auto_indention1")), app->pref_editor_use_auto_indention);
+				lookup_widget(app->window, "menu_use_auto_indention1")),
+				(app->pref_editor_indention_mode != INDENT_NONE));
 	app->ignore_callback = FALSE;
 
 	// connect the toolbar dropdown menus

Modified: trunk/src/prefs.c
===================================================================
--- trunk/src/prefs.c	2007-03-08 17:03:26 UTC (rev 1372)
+++ trunk/src/prefs.c	2007-03-08 18:02:08 UTC (rev 1373)
@@ -232,8 +232,8 @@
 	widget = lookup_widget(app->prefs_dialog, "check_line_end");
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_show_line_endings);
 
-	widget = lookup_widget(app->prefs_dialog, "check_auto_indent");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_use_auto_indention);
+	widget = lookup_widget(app->prefs_dialog, "combo_auto_indent_mode");
+	gtk_combo_box_set_active(GTK_COMBO_BOX(widget), app->pref_editor_indention_mode);
 
 	widget = lookup_widget(app->prefs_dialog, "check_line_wrapping");
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_line_breaking);
@@ -550,8 +550,8 @@
 		widget = lookup_widget(app->prefs_dialog, "check_line_end");
 		app->pref_editor_show_line_endings = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
-		widget = lookup_widget(app->prefs_dialog, "check_auto_indent");
-		app->pref_editor_use_auto_indention = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+		widget = lookup_widget(app->prefs_dialog, "combo_auto_indent_mode");
+		app->pref_editor_indention_mode = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
 
 		widget = lookup_widget(app->prefs_dialog, "check_line_wrapping");
 		app->pref_editor_line_breaking = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -676,12 +676,14 @@
 		// re-colourise all open documents, if tab width or long line settings have changed
 		for (i = 0; i < doc_array->len; i++)
 		{
-			if (doc_list[i].is_valid)
+			if (DOC_IDX_VALID(i))
 			{
-				document_apply_update_prefs(doc_list[i].sci);
-				if (! app->pref_editor_folding) document_unfold_all(i);
+				document_apply_update_prefs(i);
+				if (! app->pref_editor_folding)
+					document_unfold_all(i);
 			}
 		}
+		ui_document_show_hide(-1);
 
 		// store all settings
 		configuration_save();

Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c	2007-03-08 17:03:26 UTC (rev 1372)
+++ trunk/src/sci_cb.c	2007-03-08 18:02:08 UTC (rev 1373)
@@ -248,7 +248,8 @@
 				}
 				case ' ':
 				{	// if and for autocompletion
-					if (app->pref_editor_auto_complete_constructs) sci_cb_auto_forif(idx, pos);
+					if (app->pref_editor_auto_complete_constructs)
+						sci_cb_auto_forif(idx, pos);
 					break;
 				}
 				case '[':
@@ -263,7 +264,9 @@
 				}
 				case '}':
 				{	// closing bracket handling
-					if (doc_list[idx].use_auto_indention) sci_cb_close_block(idx, pos - 1);
+					if (doc_list[idx].use_auto_indention &&
+						app->pref_editor_indention_mode == INDENT_ADVANCED)
+						sci_cb_close_block(idx, pos - 1);
 					break;
 				}
 				default: sci_cb_start_auto_complete(idx, pos, FALSE);
@@ -334,23 +337,27 @@
 		get_indent(sci, pos, FALSE);
 		sci_add_text(sci, indent);
 
-		// add extra indentation for Python after colon
-		if (doc_list[idx].file_type->id == GEANY_FILETYPES_PYTHON &&
-			sci_get_char_at(sci, pos - 2) == ':' &&
-			sci_get_style_at(sci, pos - 2) == SCE_P_OPERATOR)
-		{	// creates and inserts one tabulator sign or whitespace of the amount of the tab width
-			gchar *text = utils_get_whitespace(app->pref_editor_tab_width);
-			sci_add_text(sci, text);
-			g_free(text);
+		if (app->pref_editor_indention_mode == INDENT_ADVANCED)
+		{
+			// add extra indentation for Python after colon
+			if (doc_list[idx].file_type->id == GEANY_FILETYPES_PYTHON &&
+				sci_get_char_at(sci, pos - 2) == ':' &&
+				sci_get_style_at(sci, pos - 2) == SCE_P_OPERATOR)
+			{
+				// creates and inserts one tabulator sign or whitespace of the amount of the tab width
+				gchar *text = utils_get_whitespace(app->pref_editor_tab_width);
+				sci_add_text(sci, text);
+				g_free(text);
+			}
+
+			/// TODO on which option should auto_multiline() depend? indention vs. auto completion
+			// " * " auto completion in multiline C/C++/D/Java comments
+			auto_multiline(sci, pos);
 		}
 	}
 
 	if (app->pref_editor_auto_complete_constructs)
-	{
-		auto_multiline(sci, pos); // " * " auto completion in multiline C/C++/D/Java comments
-
 		sci_cb_auto_latex(idx, pos);
-	}
 }
 
 
@@ -366,13 +373,14 @@
 	len = sci_get_line_length(sci, prev_line);
 	linebuf = sci_get_line(sci, prev_line);
 
-	for (i = 0; i < len; i++)
+	for (i = 0; i < len && j <= (sizeof(indent) - 1); i++)
 	{
-		if (j == sizeof(indent) - 1) break;
-		else if (linebuf[i] == ' ' || linebuf[i] == '\t') indent[j++] = linebuf[i];
+		if (linebuf[i] == ' ' || linebuf[i] == '\t')
+			indent[j++] = linebuf[i];
 		// "&& ! use_this_line" to auto-indent only if it is a real new line
 		// and ignore the case of sci_cb_close_block
-		else if (linebuf[i] == '{' && ! use_this_line)
+		else if (linebuf[i] == '{' && ! use_this_line &&
+				 app->pref_editor_indention_mode == INDENT_ADVANCED)
 		{
 			if (app->pref_editor_use_tabs)
 			{
@@ -390,11 +398,15 @@
 		else
 		{
 			gint k = len - 1;
-			if (use_this_line) break;	// break immediately in the case of sci_cb_close_block
+
+			if (use_this_line)
+				break;	// break immediately in the case of sci_cb_close_block
+
 			while (k > 0 && isspace(linebuf[k])) k--;
+
 			// if last non-whitespace character is a { increase indention by a tab
 			// e.g. for (...) {
-			if (linebuf[k] == '{')
+			if (app->pref_editor_indention_mode == INDENT_ADVANCED && linebuf[k] == '{')
 			{
 				if (app->pref_editor_use_tabs)
 				{
@@ -403,7 +415,7 @@
 				else
 				{	// insert as many spaces as a tabulator would take
 					gint i;
-					for (i = 0; i < app->pref_editor_use_tabs; i++)
+					for (i = 0; i < app->pref_editor_tab_width; i++)
 						indent[j++] = ' ';
 				}
 			}

Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c	2007-03-08 17:03:26 UTC (rev 1372)
+++ trunk/src/ui_utils.c	2007-03-08 18:02:08 UTC (rev 1373)
@@ -537,15 +537,23 @@
 void ui_document_show_hide(gint idx)
 {
 	gchar *widget_name;
+	GtkWidget *indention;
 
-	if (idx == -1 || ! doc_list[idx].is_valid) return;
+	if (idx == -1)
+		idx = document_get_cur_idx();
+
+	if (! DOC_IDX_VALID(idx))
+		return;
+
 	app->ignore_callback = TRUE;
 
+	indention = lookup_widget(app->window, "menu_use_auto_indention1");
+
 	gtk_check_menu_item_set_active(
 			GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_line_breaking1")),
 			doc_list[idx].line_breaking);
 	gtk_check_menu_item_set_active(
-			GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_use_auto_indention1")),
+			GTK_CHECK_MENU_ITEM(indention),
 			doc_list[idx].use_auto_indention);
 	gtk_check_menu_item_set_active(
 			GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "set_file_readonly1")),
@@ -563,6 +571,8 @@
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, widget_name)),
 																					TRUE);
 
+	gtk_widget_set_sensitive(indention, app->pref_editor_indention_mode != INDENT_NONE);
+
 	gtk_widget_set_sensitive(lookup_widget(app->window, "menu_write_unicode_bom1"),
 			encodings_is_unicode_charset(doc_list[idx].encoding));
 


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