SF.net SVN: geany:[3238] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Nov 16 17:54:28 UTC 2008


Revision: 3238
          http://geany.svn.sourceforge.net/geany/?rev=3238&view=rev
Author:   eht16
Date:     2008-11-16 17:54:28 +0000 (Sun, 16 Nov 2008)

Log Message:
-----------
Note: this breaks the plugin API for Editor and Scintilla functions.
Rename all functions in editor.c and sciwrappers.c which are related to indicators for more consistency.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/build.c
    trunk/src/callbacks.c
    trunk/src/editor.c
    trunk/src/editor.h
    trunk/src/msgwindow.c
    trunk/src/plugindata.h
    trunk/src/plugins.c
    trunk/src/sciwrappers.c
    trunk/src/sciwrappers.h
    trunk/src/search.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-11-16 17:53:55 UTC (rev 3237)
+++ trunk/ChangeLog	2008-11-16 17:54:28 UTC (rev 3238)
@@ -11,6 +11,12 @@
    Add and use ui_combo_box_prepend_text_once() to add project's
    base_path to the Find in Files dialog even if another project was
    opened.
+ * src/build.c, src/callbacks.c, src/editor.c, src/editor.h,
+   src/msgwindow.c, src/plugindata.h, src/plugins.c, src/sciwrappers.c,
+   src/sciwrappers.h, src/search.c:
+   Note: this breaks the plugin API for Editor and Scintilla functions.
+   Rename all functions in editor.c and sciwrappers.c which are related
+   to indicators for more consistency.
 
 
 2008-11-15  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c	2008-11-16 17:53:55 UTC (rev 3237)
+++ trunk/src/build.c	2008-11-16 17:54:28 UTC (rev 3238)
@@ -381,7 +381,7 @@
 		case GBO_COMPILE:
 		case GBO_MAKE_OBJECT:
 			g_return_if_fail(doc);
-			editor_clear_indicators(doc->editor);
+			editor_indicator_clear_errors(doc->editor);
 			break;
 
 		case GBO_BUILD:
@@ -393,7 +393,7 @@
 			for (i = 0; i < documents_array->len; i++)
 			{
 				if (documents[i]->is_valid)
-					editor_clear_indicators(documents[i]->editor);
+					editor_indicator_clear_errors(documents[i]->editor);
 			}
 			break;
 		}
@@ -858,7 +858,7 @@
 					GeanyDocument *doc = document_find_by_filename(filename);
 
 					if (doc)
-						editor_set_indicator_on_line(doc->editor, line - 1);
+						editor_indicator_set_on_line(doc->editor, GEANY_INDICATOR_ERROR, line - 1);
 					color = COLOR_RED;	/* error message parsed on the line */
 				}
 				g_free(filename);

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2008-11-16 17:53:55 UTC (rev 3237)
+++ trunk/src/callbacks.c	2008-11-16 17:54:28 UTC (rev 3238)
@@ -1558,7 +1558,7 @@
 	GeanyDocument *doc = document_get_current();
 
 	if (doc != NULL)
-		editor_clear_indicators_full(doc->editor, GEANY_INDICATOR_ERROR);
+		editor_indicator_clear(doc->editor, GEANY_INDICATOR_ERROR);
 }
 
 
@@ -1918,7 +1918,7 @@
 
 	sci_marker_delete_all(doc->editor->sci, 0);	/* delete the yellow tag marker */
 	sci_marker_delete_all(doc->editor->sci, 1);	/* delete user markers */
-	editor_clear_indicators_full(doc->editor, GEANY_INDICATOR_SEARCH);
+	editor_indicator_clear(doc->editor, GEANY_INDICATOR_SEARCH);
 }
 
 

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2008-11-16 17:53:55 UTC (rev 3237)
+++ trunk/src/editor.c	2008-11-16 17:54:28 UTC (rev 3238)
@@ -3443,14 +3443,26 @@
 }
 
 
-/**
+ /*
  *  Deletes all currently set indicators in the @a editor window.
  *  Error indicators (red squiggly underlines) and usual line markers are removed.
  *
  *  @param editor The editor to operate on.
+ */
+void editor_indicator_clear_errors(GeanyEditor *editor)
+{
+	editor_indicator_clear(editor, GEANY_INDICATOR_ERROR);
+	sci_marker_delete_all(editor->sci, 0);	/* remove the yellow error line marker */
+}
+
+
+/**
+ *  Deletes all currently set indicators matching @a indic in the @a editor window.
+ *
+ *  @param editor The editor to operate on.
  *  @param indic The indicator number to clear, this is a value of @ref GeanyIndicator.
  **/
-void editor_clear_indicators_full(GeanyEditor *editor, gint indic)
+void editor_indicator_clear(GeanyEditor *editor, gint indic)
 {
 	glong last_pos;
 
@@ -3459,35 +3471,21 @@
 	last_pos = sci_get_length(editor->sci);
 	if (last_pos > 0)
 	{
-		sci_set_indicator(editor->sci, indic);
+		sci_indicator_set(editor->sci, indic);
 		sci_indicator_clear(editor->sci, 0, last_pos);
 	}
 }
 
 
 /**
- *  Deletes all currently set indicators in the @a editor window.
- *  Error indicators (red squiggly underlines) and usual line markers are removed.
- *
- *  @param editor The editor to operate on.
- **/
-void editor_clear_indicators(GeanyEditor *editor)
-{
-	editor_clear_indicators_full(editor, GEANY_INDICATOR_ERROR);
-	sci_marker_delete_all(editor->sci, 0);	/* remove the yellow error line marker */
-}
-
-
-/**
- *  This is a convenience function for editor_set_indicator_full(). It sets an indicator
- *  on the whole given line.
+ *  Sets an indicator @a indic on @a line.
  *  Whitespace at the start and the end of the line is not marked.
  *
  *  @param editor The editor to operate on.
  *  @param indic The indicator number to use, this is a value of @ref GeanyIndicator.
  *  @param line The line number which should be marked.
  **/
-void editor_set_indicator_on_line_full(GeanyEditor *editor, gint indic, gint line)
+void editor_indicator_set_on_line(GeanyEditor *editor, gint indic, gint line)
 {
 	gint start, end;
 	guint i = 0, len;
@@ -3504,10 +3502,10 @@
 		sci_get_line_length(editor->sci, line) == editor_get_eol_char_len(editor))
 		return;
 
-	/* don't set the indicator on whitespace */
 	len = end - start;
 	linebuf = sci_get_line(editor->sci, line);
 
+	/* don't set the indicator on whitespace */
 	while (isspace(linebuf[i])) i++;
 	while (len > 1 && len > i && isspace(linebuf[len-1]))
 	{
@@ -3516,40 +3514,11 @@
 	}
 	g_free(linebuf);
 
-	editor_set_indicator_full(editor, indic, start + i, end);
+	editor_indicator_set_on_range(editor, indic, start + i, end);
 }
 
 
 /**
- *  This is a convenience function for editor_set_indicator(). It sets an error indicator
- *  (red squiggly underline) on the whole given line.
- *  Whitespace at the start and the end of the line is not marked.
- *
- *  @param editor The editor to operate on.
- *  @param line The line number which should be marked.
- **/
-void editor_set_indicator_on_line(GeanyEditor *editor, gint line)
-{
-	editor_set_indicator_on_line_full(editor, GEANY_INDICATOR_ERROR, line);
-}
-
-
-/**
- *  Sets an error indicator (red squiggly underline) on the range specified by @c start and @c end.
- *  No error checking or whitespace removal is performed, this should be done by the calling
- *  function if necessary.
- *
- *  @param editor The editor to operate on.
- *  @param start The starting position for the marker.
- *  @param end The ending position for the marker.
- **/
-void editor_set_indicator(GeanyEditor *editor, gint start, gint end)
-{
-	editor_set_indicator_full(editor, GEANY_INDICATOR_ERROR, start, end);
-}
-
-
-/**
  *  Sets an indicator on the range specified by @c start and @c end.
  *  No error checking or whitespace removal is performed, this should be done by the calling
  *  function if necessary.
@@ -3559,12 +3528,12 @@
  *  @param start The starting position for the marker.
  *  @param end The ending position for the marker.
  **/
-void editor_set_indicator_full(GeanyEditor *editor, gint indic, gint start, gint end)
+void editor_indicator_set_on_range(GeanyEditor *editor, gint indic, gint start, gint end)
 {
 	if (editor == NULL || start >= end)
 		return;
 
-	sci_set_indicator(editor->sci, indic);
+	sci_indicator_set(editor->sci, indic);
 	sci_indicator_fill(editor->sci, start, end - start);
 }
 

Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h	2008-11-16 17:53:55 UTC (rev 3237)
+++ trunk/src/editor.h	2008-11-16 17:54:28 UTC (rev 3238)
@@ -210,20 +210,16 @@
 
 void editor_select_paragraph(GeanyEditor *editor);
 
-void editor_set_indicator_on_line(GeanyEditor *editor, gint line);
-
-void editor_set_indicator(GeanyEditor *editor, gint start, gint end);
-
-void editor_clear_indicators(GeanyEditor *editor);
-
 void editor_set_font(GeanyEditor *editor, const gchar *font);
 
-void editor_set_indicator_on_line_full(GeanyEditor *editor, gint indic, gint line);
+void editor_indicator_set_on_line(GeanyEditor *editor, gint indic, gint line);
 
-void editor_set_indicator_full(GeanyEditor *editor, gint indic, gint start, gint end);
+void editor_indicator_clear_errors(GeanyEditor *editor);
 
-void editor_clear_indicators_full(GeanyEditor *editor, gint indic);
+void editor_indicator_set_on_range(GeanyEditor *editor, gint indic, gint start, gint end);
 
+void editor_indicator_clear(GeanyEditor *editor, gint indic);
+
 const gchar *editor_get_eol_char_name(GeanyEditor *editor);
 
 gint editor_get_eol_char_len(GeanyEditor *editor);

Modified: trunk/src/msgwindow.c
===================================================================
--- trunk/src/msgwindow.c	2008-11-16 17:53:55 UTC (rev 3237)
+++ trunk/src/msgwindow.c	2008-11-16 17:54:28 UTC (rev 3238)
@@ -605,7 +605,7 @@
 				if (doc != NULL)
 				{
 					if (! doc->changed)	/* if modified, line may be wrong */
-						editor_set_indicator_on_line(doc->editor, line - 1);
+						editor_indicator_set_on_line(doc->editor, GEANY_INDICATOR_ERROR, line - 1);
 
 					ret = navqueue_goto_line(old_doc, doc, line);
 				}

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2008-11-16 17:53:55 UTC (rev 3237)
+++ trunk/src/plugindata.h	2008-11-16 17:54:28 UTC (rev 3238)
@@ -45,13 +45,13 @@
 enum {
 	/** The Application Programming Interface (API) version, incremented
 	 * whenever any plugin data types are modified or appended to. */
-	GEANY_API_VERSION = 107,
+	GEANY_API_VERSION = 108,
 
 	/** The Application Binary Interface (ABI) version, incremented whenever
 	 * existing fields in the plugin data types have to be changed or reordered. */
 	/* This should usually stay the same if fields are only appended, assuming only pointers to
 	 * structs and not structs themselves are declared by plugins. */
-	GEANY_ABI_VERSION = 49
+	GEANY_ABI_VERSION = 50
 };
 
 /** Check the plugin can be loaded by Geany.
@@ -293,7 +293,7 @@
 	gboolean (*has_selection) (struct _ScintillaObject *sci);
 	gint	(*get_tab_width) (struct _ScintillaObject *sci);
 	void	(*indicator_clear) (struct _ScintillaObject *sci, gint start, gint end);
-	void	(*set_indicator) (struct _ScintillaObject *sci, gint indic);
+	void	(*indicator_set) (struct _ScintillaObject *sci, gint indic);
 }
 ScintillaFuncs;
 
@@ -475,16 +475,12 @@
 /* See editor.h */
 typedef struct EditorFuncs
 {
-	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);
 	struct _ScintillaObject* (*create_widget)(struct GeanyEditor *editor);
 
-	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	(*indicator_set_on_range) (struct GeanyEditor *editor, gint indic, gint start, gint end);
+	void	(*indicator_set_on_line) (struct GeanyEditor *editor, gint indic, gint line);
+	void	(*indicator_clear) (struct GeanyEditor *editor, gint indic);
 
 	void	(*set_indent_type)(struct GeanyEditor *editor, GeanyIndentType type);
 

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2008-11-16 17:53:55 UTC (rev 3237)
+++ trunk/src/plugins.c	2008-11-16 17:54:28 UTC (rev 3238)
@@ -130,14 +130,11 @@
 };
 
 static EditorFuncs editor_funcs = {
-	&editor_set_indicator,
-	&editor_set_indicator_on_line,
-	&editor_clear_indicators,
 	&editor_get_indent_prefs,
 	&editor_create_widget,
-	&editor_set_indicator_full,
-	&editor_set_indicator_on_line_full,
-	&editor_clear_indicators_full,
+	&editor_indicator_set_on_range,
+	&editor_indicator_set_on_line,
+	&editor_indicator_clear,
 	&editor_set_indent_type
 };
 
@@ -178,7 +175,7 @@
 	&sci_has_selection,
 	&sci_get_tab_width,
 	&sci_indicator_clear,
-	&sci_set_indicator
+	&sci_indicator_set
 };
 
 static TemplateFuncs template_funcs = {

Modified: trunk/src/sciwrappers.c
===================================================================
--- trunk/src/sciwrappers.c	2008-11-16 17:53:55 UTC (rev 3237)
+++ trunk/src/sciwrappers.c	2008-11-16 17:54:28 UTC (rev 3238)
@@ -967,7 +967,7 @@
 	SSM(sci, SCI_STARTSTYLING, pos, mask);
 }
 
-gint sci_get_indicator(ScintillaObject *sci)
+gint sci_indicator_get(ScintillaObject *sci)
 {
 	return SSM(sci, SCI_GETINDICATORCURRENT, 0, 0);
 }
@@ -981,7 +981,7 @@
  *
  *  @see sci_indicator_clear
  **/
-void sci_set_indicator(ScintillaObject *sci, gint indic)
+void sci_indicator_set(ScintillaObject *sci, gint indic)
 {
 	SSM(sci, SCI_SETINDICATORCURRENT, indic, 0);
 }

Modified: trunk/src/sciwrappers.h
===================================================================
--- trunk/src/sciwrappers.h	2008-11-16 17:53:55 UTC (rev 3237)
+++ trunk/src/sciwrappers.h	2008-11-16 17:54:28 UTC (rev 3238)
@@ -162,8 +162,8 @@
 void				sci_set_styling				(ScintillaObject * sci, gint len, gint style);
 void				sci_start_styling			(ScintillaObject * sci, gint pos, gint mask);
 
-gint				sci_get_indicator			(ScintillaObject * sci);
-void				sci_set_indicator			(ScintillaObject * sci, gint indic);
+gint				sci_indicator_get			(ScintillaObject * sci);
+void				sci_indicator_set			(ScintillaObject * sci, gint indic);
 void				sci_indicator_fill			(ScintillaObject * sci, gint pos, gint len);
 void				sci_indicator_clear			(ScintillaObject * sci, gint pos, gint len);
 

Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c	2008-11-16 17:53:55 UTC (rev 3237)
+++ trunk/src/search.c	2008-11-16 17:54:28 UTC (rev 3238)
@@ -857,7 +857,7 @@
 	g_return_val_if_fail(doc != NULL, 0);
 
 	/* clear previous search indicators */
-	editor_clear_indicators_full(doc->editor, GEANY_INDICATOR_SEARCH);
+	editor_indicator_clear(doc->editor, GEANY_INDICATOR_SEARCH);
 	
 	len = strlen(search_text);
 	
@@ -869,7 +869,7 @@
 		pos = sci_find_text(doc->editor->sci, flags, &ttf);
 		if (pos == -1) break;
 
-		editor_set_indicator_full(doc->editor, GEANY_INDICATOR_SEARCH, pos, pos + len);
+		editor_indicator_set_on_range(doc->editor, GEANY_INDICATOR_SEARCH, pos, pos + len);
 
 		ttf.chrg.cpMin = ttf.chrgText.cpMax + 1;
 		count++;


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