SF.net SVN: geany: [2496] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Apr 17 17:48:18 UTC 2008


Revision: 2496
          http://geany.svn.sourceforge.net/geany/?rev=2496&view=rev
Author:   eht16
Date:     2008-04-17 10:48:12 -0700 (Thu, 17 Apr 2008)

Log Message:
-----------
Add navqueue_goto_line() to plugin API.
Make navqueue_goto_line() store document filename instead of tagmanager filename (patch by Yura Siamashka, thanks).
This makes it also possible to add navigation history items for files without a tagmanager filename.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/plugins/pluginmacros.h
    trunk/src/navqueue.c
    trunk/src/navqueue.h
    trunk/src/plugindata.h
    trunk/src/plugins.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-04-16 19:05:41 UTC (rev 2495)
+++ trunk/ChangeLog	2008-04-17 17:48:12 UTC (rev 2496)
@@ -1,3 +1,14 @@
+2008-04-17  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/navqueue.c, src/plugindata.h, src/navqueue.h, src/plugins.c,
+   plugins/pluginmacros.h:
+   Add navqueue_goto_line() to plugin API.
+   Make navqueue_goto_line() store document filename instead of
+   tagmanager filename (patch by Yura Siamashka, thanks).
+   This makes it also possible to add navigation history items for files
+   without a tagmanager filename.
+
+
 2008-04-16  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>
 
  * THANKS, NEWS, src/about.c, po/LINGUAS, po/ro.po:

Modified: trunk/plugins/pluginmacros.h
===================================================================
--- trunk/plugins/pluginmacros.h	2008-04-16 19:05:41 UTC (rev 2495)
+++ trunk/plugins/pluginmacros.h	2008-04-17 17:48:12 UTC (rev 2496)
@@ -37,6 +37,7 @@
  * but with a 'p_' prefix to prevent conflicts with other tag names.
  * Example: document_open_file() -> p_document->open_file() */
 #define p_filetypes		geany_data->filetype
+#define p_navqueue		geany_data->navqueue
 
 #ifdef GEANY_DISABLE_DEPRECATED
 

Modified: trunk/src/navqueue.c
===================================================================
--- trunk/src/navqueue.c	2008-04-16 19:05:41 UTC (rev 2495)
+++ trunk/src/navqueue.c	2008-04-17 17:48:12 UTC (rev 2496)
@@ -132,11 +132,16 @@
 }
 
 
-/* Adds old file position and new file position to the navqueue, then goes to the new position.
- * Currently navqueue positions are only be added for documents that have a tagmanager work
- * object.
- * @param if old_idx is not valid (e.g. -1), no old position is set.
- * @param line is counted with 1 as the first line, not 0. */
+/**
+ *  Add old file position and new file position to the navqueue, then goes to the new position.
+ *
+ *  @param old_idx the %document index of the previous position, if set as invalid (-1) then no old
+ *         position is set
+ *  @param new_idx the %document index of the new position, must be valid.
+ *  @param line the line number of the new position. It is counted with 1 as the first line, not 0.
+ *
+ *  @return @a TRUE if the cursor has changed the position to @a line or @a FALSE otherwise.
+ **/
 gboolean navqueue_goto_line(gint old_idx, gint new_idx, gint line)
 {
 	gint pos;
@@ -147,17 +152,17 @@
 	pos = sci_get_position_from_line(doc_list[new_idx].sci, line - 1);
 
 	/* first add old file position */
-	if (DOC_IDX_VALID(old_idx) && doc_list[old_idx].tm_file)
+	if (DOC_IDX_VALID(old_idx) && doc_list[old_idx].file_name)
 	{
 		gint cur_pos = sci_get_current_position(doc_list[old_idx].sci);
 
-		add_new_position(doc_list[old_idx].tm_file->file_name, cur_pos);
+		add_new_position(doc_list[old_idx].file_name, cur_pos);
 	}
 
 	/* now add new file position */
-	if (doc_list[new_idx].tm_file)
+	if (doc_list[new_idx].file_name)
 	{
-		add_new_position(doc_list[new_idx].tm_file->file_name, pos);
+		add_new_position(doc_list[new_idx].file_name, pos);
 	}
 
 	return utils_goto_pos(new_idx, pos);
@@ -175,7 +180,7 @@
 
 	/* jump back */
 	fprev = g_queue_peek_nth(navigation_queue, nav_queue_pos + 1);
-	if (utils_goto_file_pos(fprev->file, TRUE, fprev->pos))
+	if (utils_goto_file_pos(fprev->file, FALSE, fprev->pos))
 	{
 		nav_queue_pos++;
 	}
@@ -198,7 +203,7 @@
 
 	/* jump forward */
 	fnext = g_queue_peek_nth(navigation_queue, nav_queue_pos - 1);
-	if (utils_goto_file_pos(fnext->file, TRUE, fnext->pos))
+	if (utils_goto_file_pos(fnext->file, FALSE, fnext->pos))
 	{
 		nav_queue_pos--;
 	}

Modified: trunk/src/navqueue.h
===================================================================
--- trunk/src/navqueue.h	2008-04-16 19:05:41 UTC (rev 2495)
+++ trunk/src/navqueue.h	2008-04-17 17:48:12 UTC (rev 2496)
@@ -22,7 +22,12 @@
  * $Id$
  */
 
+/**
+ *  @file navqueue.h
+ * Simple code navigation
+ **/
 
+
 #ifndef GEANY_NAVQUEUE_H
 #define GEANY_NAVQUEUE_H 1
 

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2008-04-16 19:05:41 UTC (rev 2495)
+++ trunk/src/plugindata.h	2008-04-17 17:48:12 UTC (rev 2496)
@@ -35,7 +35,7 @@
 
 /* The API version should be incremented whenever any plugin data types below are
  * modified or appended to. */
-static const gint api_version = 52;
+static const gint api_version = 53;
 
 /* The ABI version should be incremented whenever existing fields in the plugin
  * data types below have to be changed or reordered. It should stay the same if fields
@@ -175,6 +175,7 @@
 	struct SearchFuncs			*search;		/**< See search.h */
 	struct HighlightingFuncs	*highlighting;	/**< See highlighting.h */
 	struct FiletypeFuncs		*filetype;		/**< See filetypes.h */
+	struct NavQueueFuncs        *navqueue;      /**< See navqueue.h */
 }
 GeanyData;
 
@@ -392,7 +393,12 @@
 }
 TagManagerFuncs;
 
+typedef struct NavQueueFuncs
+{
+	gboolean		(*goto_line) (gint old_idx, gint new_idx, gint line);
+}NavQueueFuncs;
 
+
 /* Deprecated aliases */
 #ifndef GEANY_DISABLE_DEPRECATED
 

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2008-04-16 19:05:41 UTC (rev 2495)
+++ trunk/src/plugins.c	2008-04-17 17:48:12 UTC (rev 2496)
@@ -54,6 +54,7 @@
 #include "search.h"
 #include "highlighting.h"
 #include "keybindings.h"
+#include "navqueue.h"
 
 
 #ifdef G_OS_WIN32
@@ -229,6 +230,9 @@
 	&filetypes_get_from_uid
 };
 
+static NavQueueFuncs navqueue_funcs = {
+	&navqueue_goto_line
+};
 
 static GeanyData geany_data = {
 	NULL,
@@ -252,7 +256,8 @@
 	&tagmanager_funcs,
 	&search_funcs,
 	&highlighting_funcs,
-	&filetype_funcs
+	&filetype_funcs,
+	&navqueue_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