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.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2145 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2008-01-02 21:20:33 +00:00
parent ce8102c8c8
commit 697195c4fe
6 changed files with 55 additions and 7 deletions

View File

@ -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>

View File

@ -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

View File

@ -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 @@ typedef struct GeanyData
struct TagManagerFuncs *tm;
struct SearchFuncs *search;
struct HighlightingFuncs *highlighting;
struct FiletypeFuncs *filetype;
}
GeanyData;
@ -284,6 +285,12 @@ typedef struct UtilsFuncs
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 @@ typedef struct HighlightingFuncs
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;

View File

@ -148,7 +148,10 @@ static UtilsFuncs utils_funcs = {
&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 KeybindingFuncs keybindings_funcs = {
};
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 HighlightingFuncs highlighting_funcs = {
};
static FiletypeFuncs filetype_funcs = {
&filetypes_detect_from_filename
};
static GeanyData geany_data = {
NULL,
NULL,
@ -215,7 +228,8 @@ static GeanyData geany_data = {
&keybindings_funcs,
&tagmanager_funcs,
&search_funcs,
&highlighting_funcs
&highlighting_funcs,
&filetype_funcs
};

View File

@ -25,7 +25,6 @@
#ifndef GEANY_PROJECT_H
#define GEANY_PROJECT_H 1
/* structure for representing a project. */
struct _GeanyProject
{
@ -38,6 +37,9 @@ struct _GeanyProject
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
};

View File

@ -1081,6 +1081,11 @@ gboolean symbols_goto_tag(const gchar *name, gboolean definition)
{
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;