[anjuta] language-support: bgo#575926 – 'Maintain past indentation' disables itself



commit 4e485eb33683a32c5eae9f40810f5a35cb9718b5
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Sun Aug 2 15:56:33 2009 +0200

    language-support: bgo#575926 â?? 'Maintain past indentation' disables itself

 .../anjuta-language-cpp-java.ui                    |   33 +-------------------
 plugins/language-support-cpp-java/plugin.c         |   12 +++---
 plugins/language-support-cpp-java/plugin.h         |    1 +
 3 files changed, 8 insertions(+), 38 deletions(-)
---
diff --git a/plugins/language-support-cpp-java/anjuta-language-cpp-java.ui b/plugins/language-support-cpp-java/anjuta-language-cpp-java.ui
index 0039e27..8a28dd3 100644
--- a/plugins/language-support-cpp-java/anjuta-language-cpp-java.ui
+++ b/plugins/language-support-cpp-java/anjuta-language-cpp-java.ui
@@ -39,7 +39,7 @@
                   <object class="GtkTable" id="table15">
                     <property name="visible">True</property>
                     <property name="border_width">10</property>
-                    <property name="n_rows">3</property>
+                    <property name="n_rows">1</property>
                     <property name="column_spacing">5</property>
                     <property name="row_spacing">5</property>
                     <child>
@@ -57,37 +57,6 @@
                         <property name="y_options"></property>
                       </packing>
                     </child>
-                    <child>
-                      <object class="GtkCheckButton" id="preferences_toggle:bool:1:1:language.cpp.indent.adaptive">
-                        <property name="label" translatable="yes">Enable adaptive indentation</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_indicator">True</property>
-                      </object>
-                      <packing>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkCheckButton" id="preferences_toggle:bool:1:1:language.cpp.indent.tab.indents">
-                        <property name="label" translatable="yes">Pressing tab indents</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_indicator">True</property>
-                      </object>
-                      <packing>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
-                      </packing>
-                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
diff --git a/plugins/language-support-cpp-java/plugin.c b/plugins/language-support-cpp-java/plugin.c
index 360695b..a00ffdb 100644
--- a/plugins/language-support-cpp-java/plugin.c
+++ b/plugins/language-support-cpp-java/plugin.c
@@ -56,8 +56,6 @@
 /* Preferences keys */
 
 #define PREF_INDENT_AUTOMATIC "language.cpp.indent.automatic"
-#define PREF_INDENT_ADAPTIVE "language.cpp.indent.adaptive"
-#define PREF_INDENT_TAB_INDENTS "language.cpp.indent.tab.indents"
 #define PREF_INDENT_STATEMENT_SIZE "language.cpp.indent.statement.size"
 #define PREF_INDENT_BRACE_SIZE "language.cpp.indent.brace.size"
 #define PREF_INDENT_PARANTHESE_LINEUP "language.cpp.indent.paranthese.lineup"
@@ -587,6 +585,11 @@ initialize_indentation_params (CppJavaPlugin *plugin)
 	gboolean line_comment = FALSE;
 	gchar mini_buffer[MINI_BUFFER_SIZE] = {0};
 	
+	plugin->smart_indentation = anjuta_preferences_get_bool (plugin->prefs, PREF_INDENT_AUTOMATIC);
+	/* Disable editor intern auto-indent if smart indentation is enabled */
+	ianjuta_editor_set_auto_indent (IANJUTA_EDITOR(plugin->current_editor),
+								    !plugin->smart_indentation, NULL);
+
 	/* Initialize indentation parameters */
 	plugin->param_tab_size = -1;
 	plugin->param_statement_indentation = -1;
@@ -1414,7 +1417,7 @@ on_editor_char_inserted_cpp (IAnjutaEditor *editor,
 	iter = ianjuta_iterable_clone (insert_pos, NULL);
 	
 	/* If autoindent is enabled*/
-	if (anjuta_preferences_get_bool (plugin->prefs, PREF_INDENT_AUTOMATIC))
+	if (plugin->smart_indentation)
 	{
 	
 		/* DEBUG_PRINT ("Char added at position %d: '%c'", insert_pos, ch); */	
@@ -1618,9 +1621,6 @@ install_support (CppJavaPlugin *lang_plugin)
 	}
 	
 	initialize_indentation_params (lang_plugin);
-	/* Disable editor intern auto-indent */
-	ianjuta_editor_set_auto_indent (IANJUTA_EDITOR(lang_plugin->current_editor),
-								    FALSE, NULL);
 	
 	if (IANJUTA_IS_EDITOR_ASSIST (lang_plugin->current_editor) &&
 		!g_str_equal (lang_plugin->current_language, "Vala"))
diff --git a/plugins/language-support-cpp-java/plugin.h b/plugins/language-support-cpp-java/plugin.h
index 2a140ce..6f9b7bf 100644
--- a/plugins/language-support-cpp-java/plugin.h
+++ b/plugins/language-support-cpp-java/plugin.h
@@ -53,6 +53,7 @@ struct _CppJavaPlugin {
 	gint param_brace_indentation;
 	gint param_case_indentation;
 	gint param_label_indentation;
+	gboolean smart_indentation;
 	
 	/* Assist */
 	CppJavaAssist *assist;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]