SF.net SVN: geany: [2145] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Wed Jan 2 21:20:34 UTC 2008


Revision: 2145
          http://geany.svn.sourceforge.net/geany/?rev=2145&view=rev
Author:   eht16
Date:     2008-01-02 13:20:33 -0800 (Wed, 02 Jan 2008)

Log Message:
-----------
Patch by Yura Siamashka:
Add project type field.
Go to tag definition/declaration will open the file with the tag if it isn't already open.
Add some utils and tagmanager functions to the plugin API.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-01-02 19:27:36 UTC (rev 2144)
+++ trunk/ChangeLog	2008-01-02 21:20:33 UTC (rev 2145)
@@ -3,6 +3,12 @@
  * README, src/makefile.win32:
    Add -lshfolder to linker flags on Windows.
    Add notice for Win9x users to install SHFolder.dll.
+ * plugins/pluginmacros.h, src/plugindata.h, src/plugins.c,
+   src/project.h, src/symbols.c: Patch by Yura Siamashka:
+   Add project type field.
+   Go to tag definition/declaration will open the file with the tag if
+   it isn't already open.
+   Add some utils and tagmanager functions to the plugin API.
 
 
 2008-01-02  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/plugins/pluginmacros.h
===================================================================
--- trunk/plugins/pluginmacros.h	2008-01-02 19:27:36 UTC (rev 2144)
+++ trunk/plugins/pluginmacros.h	2008-01-02 21:20:33 UTC (rev 2145)
@@ -35,6 +35,8 @@
 #define dialogs			geany_data->dialogs
 #define documents		geany_data->documents	// avoids conflict with document typedef
 #define encodings		geany_data->encoding	// avoids conflict with document::encoding
+/// TODO not sure whether "filetype" is good, might conflict with something
+#define filetype		geany_data->filetype
 #define highlighting	geany_data->highlighting
 #define keybindings		geany_data->keybindings
 #define msgwindow		geany_data->msgwindow

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2008-01-02 19:27:36 UTC (rev 2144)
+++ trunk/src/plugindata.h	2008-01-02 21:20:33 UTC (rev 2145)
@@ -93,7 +93,7 @@
 
 /* The API version should be incremented whenever any plugin data types below are
  * modified or appended to. */
-static const gint api_version = 36;
+static const gint api_version = 37;
 
 /* 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
@@ -197,6 +197,7 @@
 	struct TagManagerFuncs		*tm;
 	struct SearchFuncs			*search;
 	struct HighlightingFuncs	*highlighting;
+	struct FiletypeFuncs		*filetype;
 }
 GeanyData;
 
@@ -284,6 +285,12 @@
 	gchar*		(*get_utf8_from_locale) (const gchar *locale_text);
 	gchar*		(*remove_ext_from_filename) (const gchar *filename);
 	gint		(*mkdir) (const gchar *path, gboolean create_parent_dirs);
+	gboolean	(*get_setting_boolean) (GKeyFile *config, const gchar *section, const gchar *key,
+				 const gboolean default_value);
+	gint		(*get_setting_integer) (GKeyFile *config, const gchar *section, const gchar *key,
+				 const gint default_value);
+	gchar*		(*get_setting_string) (GKeyFile *config, const gchar *section, const gchar *key,
+				 const gchar *default_value);
 }
 UtilsFuncs;
 
@@ -345,16 +352,28 @@
 HighlightingFuncs;
 
 
+typedef struct FiletypeFuncs
+{
+	filetype*	(*detect_from_filename) (const gchar *utf8_filename);
+}
+FiletypeFuncs;
+
+
 typedef struct SearchFuncs
 {
 	void		(*show_find_in_files_dialog) (const gchar *dir);
 }
 SearchFuncs;
 
-
 typedef struct TagManagerFuncs
 {
-	gchar*		(*get_real_path) (const gchar *file_name);
+	gchar*			(*get_real_path) (const gchar *file_name);
+	TMWorkObject*	(*source_file_new) (const char *file_name, gboolean update, const char *name);
+	gboolean		(*workspace_add_object) (TMWorkObject *work_object);
+	gboolean		(*source_file_update) (TMWorkObject *source_file, gboolean force,
+					 gboolean recurse, gboolean update_parent);
+	void			(*work_object_free) (gpointer work_object);
+	gboolean		(*workspace_remove_object) (TMWorkObject *w, gboolean do_free);
 }
 TagManagerFuncs;
 

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2008-01-02 19:27:36 UTC (rev 2144)
+++ trunk/src/plugins.c	2008-01-02 21:20:33 UTC (rev 2145)
@@ -148,7 +148,10 @@
 	&utils_get_locale_from_utf8,
 	&utils_get_utf8_from_locale,
 	&utils_remove_ext_from_filename,
-	&utils_mkdir
+	&utils_mkdir,
+	&utils_get_setting_boolean,
+	&utils_get_setting_integer,
+	&utils_get_setting_string
 };
 
 static UIUtilsFuncs uiutils_funcs = {
@@ -182,7 +185,12 @@
 };
 
 static TagManagerFuncs tagmanager_funcs = {
-	&tm_get_real_path
+	&tm_get_real_path,
+	&tm_source_file_new,
+	&tm_workspace_add_object,
+	&tm_source_file_update,
+	&tm_work_object_free,
+	&tm_workspace_remove_object
 };
 
 static SearchFuncs search_funcs = {
@@ -194,6 +202,11 @@
 };
 
 
+static FiletypeFuncs filetype_funcs = {
+	&filetypes_detect_from_filename
+};
+
+
 static GeanyData geany_data = {
 	NULL,
 	NULL,
@@ -215,7 +228,8 @@
 	&keybindings_funcs,
 	&tagmanager_funcs,
 	&search_funcs,
-	&highlighting_funcs
+	&highlighting_funcs,
+	&filetype_funcs
 };
 
 

Modified: trunk/src/project.h
===================================================================
--- trunk/src/project.h	2008-01-02 19:27:36 UTC (rev 2144)
+++ trunk/src/project.h	2008-01-02 21:20:33 UTC (rev 2145)
@@ -25,7 +25,6 @@
 #ifndef GEANY_PROJECT_H
 #define GEANY_PROJECT_H 1
 
-
 /* structure for representing a project. */
 struct _GeanyProject
 {
@@ -38,6 +37,9 @@
 	gchar *run_cmd; 		// project run command (in UTF-8)
 	// ...					// fields for build process(run arguments and so on) should be added
 
+	gint type;				// identifier whether it is a pure Geany project or modified/extended
+							// by a plugin
+
 	gchar **file_patterns;	// array of filename extension patterns
 };
 

Modified: trunk/src/symbols.c
===================================================================
--- trunk/src/symbols.c	2008-01-02 19:27:36 UTC (rev 2144)
+++ trunk/src/symbols.c	2008-01-02 21:20:33 UTC (rev 2145)
@@ -1081,6 +1081,11 @@
 	{
 		gint new_idx = document_find_by_filename(
 			tmtag->atts.entry.file->work_object.file_name, TRUE);
+		// not found in opened document, should open
+		if (new_idx == -1)
+		{
+			new_idx = document_open_file(tmtag->atts.entry.file->work_object.file_name, FALSE, NULL, NULL);
+		}
 
 		if (navqueue_goto_line(new_idx, tmtag->atts.entry.line))
 			return TRUE;


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