SF.net SVN: geany:[2861] branches/custom-tab-width

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Aug 7 15:30:53 UTC 2008


Revision: 2861
          http://geany.svn.sourceforge.net/geany/?rev=2861&view=rev
Author:   ntrel
Date:     2008-08-07 15:30:52 +0000 (Thu, 07 Aug 2008)

Log Message:
-----------
Add editor_get_indent_prefs() to the API.
Make editor_get_indent_prefs() return default prefs if editor is
NULL.

Modified Paths:
--------------
    branches/custom-tab-width/ChangeLog
    branches/custom-tab-width/src/editor.c
    branches/custom-tab-width/src/plugindata.h
    branches/custom-tab-width/src/plugins.c

Modified: branches/custom-tab-width/ChangeLog
===================================================================
--- branches/custom-tab-width/ChangeLog	2008-08-07 12:03:56 UTC (rev 2860)
+++ branches/custom-tab-width/ChangeLog	2008-08-07 15:30:52 UTC (rev 2861)
@@ -6,6 +6,10 @@
  * src/editor.c:
    Remove opening-brace indent code from get_indent() as it's now in
    get_brace_indent().
+ * src/plugindata.h, src/plugins.c, src/editor.c:
+   Add editor_get_indent_prefs() to the API.
+   Make editor_get_indent_prefs() return default prefs if editor is
+   NULL.
 
 
 2008-08-05  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: branches/custom-tab-width/src/editor.c
===================================================================
--- branches/custom-tab-width/src/editor.c	2008-08-07 12:03:56 UTC (rev 2860)
+++ branches/custom-tab-width/src/editor.c	2008-08-07 15:30:52 UTC (rev 2861)
@@ -753,7 +753,7 @@
 static const GeanyIndentPrefs *
 get_default_indent_prefs(void)
 {
-	/* In future this might depend on project or filetype. */
+	/* In future this might depend on the current project. */
 	return editor_prefs.indentation;
 }
 
@@ -761,16 +761,19 @@
 /** Get the indentation prefs for the editor.
  * In future, the prefs might be different according to project or filetype.
  * @warning Always get a fresh result instead of keeping a pointer to it if the editor
- * settings may have changed, or if this function has been called for a different @a editor. */
+ * settings may have changed, or if this function has been called for a different @a editor.
+ * @param editor The editor, or @c NULL to get the default indent prefs.
+ * @return The indent prefs. */
 const GeanyIndentPrefs *
 editor_get_indent_prefs(GeanyEditor *editor)
 {
 	static GeanyIndentPrefs iprefs;
 
-	g_return_val_if_fail(editor != NULL, NULL);
-
 	iprefs = *get_default_indent_prefs();
 
+	if (!editor)
+		return &iprefs;
+
 	iprefs.type = editor->indent_type;
 	if (!editor->auto_indent)
 		iprefs.auto_indent_mode = GEANY_AUTOINDENT_NONE;

Modified: branches/custom-tab-width/src/plugindata.h
===================================================================
--- branches/custom-tab-width/src/plugindata.h	2008-08-07 12:03:56 UTC (rev 2860)
+++ branches/custom-tab-width/src/plugindata.h	2008-08-07 15:30:52 UTC (rev 2861)
@@ -444,6 +444,8 @@
 	void	(*set_indicator) (struct GeanyEditor *editor, gint start, gint end);
 	void	(*set_indicator_on_line) (struct GeanyEditor *editor, gint line);
 	void	(*clear_indicators) (struct GeanyEditor *editor);
+
+	const struct GeanyIndentPrefs* (*get_indent_prefs)(struct GeanyEditor *editor);
 	/* Remember to convert any GeanyDocument or ScintillaObject pointers in any
 	 * appended functions to GeanyEditor pointers. */
 }

Modified: branches/custom-tab-width/src/plugins.c
===================================================================
--- branches/custom-tab-width/src/plugins.c	2008-08-07 12:03:56 UTC (rev 2860)
+++ branches/custom-tab-width/src/plugins.c	2008-08-07 15:30:52 UTC (rev 2861)
@@ -114,7 +114,8 @@
 static EditorFuncs editor_funcs = {
 	&editor_set_indicator,
 	&editor_set_indicator_on_line,
-	&editor_clear_indicators
+	&editor_clear_indicators,
+	&editor_get_indent_prefs
 };
 
 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