SF.net SVN: geany:[3194] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Sat Nov 8 13:32:55 UTC 2008


Revision: 3194
          http://geany.svn.sourceforge.net/geany/?rev=3194&view=rev
Author:   ntrel
Date:     2008-11-08 13:32:55 +0000 (Sat, 08 Nov 2008)

Log Message:
-----------
Make Version Diff plugin set the indent type for diffs based on the 
current file's indent type.
Add editor_set_indent_type() to the API.
Note: uses editor.h plugindata.h include.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/plugins/vcdiff.c
    trunk/src/editor.c
    trunk/src/plugindata.h
    trunk/src/plugins.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-11-08 13:14:09 UTC (rev 3193)
+++ trunk/ChangeLog	2008-11-08 13:32:55 UTC (rev 3194)
@@ -1,7 +1,12 @@
 2008-11-08  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
- * src/editor.c:
+ * src/editor.c, doc/geany.txt, doc/geany.html:
    Make Ctrl-click go to matching brace if there's no current word.
+ * plugins/vcdiff.c, src/editor.c, src/plugindata.h, src/plugins.c:
+   Make Version Diff plugin set the indent type for diffs based on the 
+   current file's indent type.
+   Add editor_set_indent_type() to the API.
+   Note: uses editor.h plugindata.h include.
 
 
 2008-11-07  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/plugins/vcdiff.c
===================================================================
--- trunk/plugins/vcdiff.c	2008-11-08 13:14:09 UTC (rev 3193)
+++ trunk/plugins/vcdiff.c	2008-11-08 13:32:55 UTC (rev 3194)
@@ -279,6 +279,9 @@
 	}
 	if (text)
 	{
+		GeanyIndentType indent_type =
+			p_document->get_current()->editor->indent_type;
+			
 		doc = p_document->find_by_filename(filename);
 		if (doc == NULL)
 		{
@@ -293,6 +296,7 @@
 			gtk_notebook_set_current_page(book, page);
 			p_document->set_text_changed(doc, FALSE);
 		}
+		p_editor->set_indent_type(doc->editor, indent_type);
 
 		p_document->set_encoding(doc,
 			force_encoding ? force_encoding : detect_enc);

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2008-11-08 13:14:09 UTC (rev 3193)
+++ trunk/src/editor.c	2008-11-08 13:32:55 UTC (rev 3194)
@@ -3818,7 +3818,9 @@
 }
 
 
-/* Also sets indent width, tab width. */
+/** Set the indent type for @a editor.
+ * @param editor Editor.
+ * @param type Indent type. */
 void editor_set_indent_type(GeanyEditor *editor, GeanyIndentType type)
 {
 	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2008-11-08 13:14:09 UTC (rev 3193)
+++ trunk/src/plugindata.h	2008-11-08 13:32:55 UTC (rev 3194)
@@ -35,13 +35,16 @@
 #ifndef PLUGINDATA_H
 #define PLUGINDATA_H
 
+#include "editor.h"	/* GeanyIndentType */
+
+
 /* Note: We use enum instead of 'static const gint' to allow its use in global variable
  * initializing, otherwise we get errors like:
  * error: initializer element is not constant */
 enum {
 	/** The Application Programming Interface (API) version, incremented
 	 * whenever any plugin data types are modified or appended to. */
-	GEANY_API_VERSION = 105,
+	GEANY_API_VERSION = 106,
 
 	/** The Application Binary Interface (ABI) version, incremented whenever
 	 * existing fields in the plugin data types have to be changed or reordered. */
@@ -476,12 +479,15 @@
 
 	const struct GeanyIndentPrefs* (*get_indent_prefs)(struct GeanyEditor *editor);
 	struct _ScintillaObject* (*create_widget)(struct GeanyEditor *editor);
-	/* Remember to convert any GeanyDocument or ScintillaObject pointers in any
-	 * appended functions to GeanyEditor pointers. */
 
 	void	(*set_indicator_full) (struct GeanyEditor *editor, gint indic, gint start, gint end);
 	void	(*set_indicator_on_line_full) (struct GeanyEditor *editor, gint indic, gint line);
 	void	(*clear_indicators_full) (struct GeanyEditor *editor, gint indic);
+	
+	void	(*set_indent_type)(struct GeanyEditor *editor, GeanyIndentType type);
+	
+	/* Remember to convert any GeanyDocument or ScintillaObject pointers in any
+	 * appended functions to GeanyEditor pointers. */
 }
 EditorFuncs;
 

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2008-11-08 13:14:09 UTC (rev 3193)
+++ trunk/src/plugins.c	2008-11-08 13:32:55 UTC (rev 3194)
@@ -138,6 +138,7 @@
 	&editor_set_indicator_full,
 	&editor_set_indicator_on_line_full,
 	&editor_clear_indicators_full,
+	&editor_set_indent_type
 };
 
 static ScintillaFuncs sci_funcs = {


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