SF.net SVN: geany: [1768] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Fri Aug 3 15:05:54 UTC 2007
Revision: 1768
http://geany.svn.sourceforge.net/geany/?rev=1768&view=rev
Author: ntrel
Date: 2007-08-03 08:05:53 -0700 (Fri, 03 Aug 2007)
Log Message:
-----------
Add filetypes, editor_prefs fields to plugin API.
Wrap scintilla_send_message(), sci_cmd(), lookup_widget().
Apply patch from Jeff Pohlmeyer to add more common scintilla wrappers
to the plugin API (thanks).
Increment plugin ABI version.
Modified Paths:
--------------
trunk/ChangeLog
trunk/HACKING
trunk/src/editor.h
trunk/src/plugindata.h
trunk/src/plugins.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-07-31 17:07:33 UTC (rev 1767)
+++ trunk/ChangeLog 2007-08-03 15:05:53 UTC (rev 1768)
@@ -1,3 +1,13 @@
+2007-08-03 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/plugindata.h, src/plugins.c, src/editor.h, HACKING:
+ Add filetypes, editor_prefs fields to plugin API.
+ Wrap scintilla_send_message(), sci_cmd(), lookup_widget().
+ Apply patch from Jeff Pohlmeyer to add more common scintilla wrappers
+ to the plugin API (thanks).
+ Increment plugin ABI version.
+
+
2007-07-31 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* po/Makefile.in.in: Removed.
Modified: trunk/HACKING
===================================================================
--- trunk/HACKING 2007-07-31 17:07:33 UTC (rev 1767)
+++ trunk/HACKING 2007-08-03 15:05:53 UTC (rev 1768)
@@ -67,6 +67,12 @@
Some of these notes below are brief (or maybe incomplete) - please contact
the mailing list for more information.
+Modifying data types
+--------------------
+When reordering or changing existing elements of structs that are used as part of the
+plugin API, you should increment abi_version in plugindata.h (and api_version if changing
+elements). This is not needed if you're just appending fields to structs.
+
Adding a file foo.[hc] in src/ or plugins/
------------------------------------------
Add foo.c, foo.h to SRCS in path/Makefile.am.
Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h 2007-07-31 17:07:33 UTC (rev 1767)
+++ trunk/src/editor.h 2007-08-03 15:05:53 UTC (rev 1768)
@@ -44,7 +44,7 @@
/* These are the default prefs when creating a new editor window.
* Some of these can be overridden per document. */
-typedef struct
+typedef struct EditorPrefs
{
gboolean line_breaking;
IndentMode indent_mode;
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2007-07-31 17:07:33 UTC (rev 1767)
+++ trunk/src/plugindata.h 2007-08-03 15:05:53 UTC (rev 1768)
@@ -51,12 +51,12 @@
/* The API version should be incremented whenever any plugin data types below are
* modified. */
-static const gint api_version = 7;
+static const gint api_version = 8;
/* 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
* are only appended, as this doesn't affect existing fields. */
-static const gint abi_version = 2;
+static const gint abi_version = 3;
/* This performs runtime checks that try to ensure:
* 1. Geany ABI data types are compatible with this plugin.
@@ -124,12 +124,15 @@
MyApp *app; // Geany application data fields
GtkWidget *tools_menu; // Almost all plugins should add menu items to the Tools menu only
GArray *doc_array; // array of document pointers
+ struct filetype **filetypes;
+ struct EditorPrefs *editor_prefs;
DocumentFuncs *document;
ScintillaFuncs *sci;
TemplateFuncs *templates;
UtilsFuncs *utils;
UIUtilsFuncs *ui;
+ struct SupportFuncs *support;
}
GeanyData;
@@ -152,14 +155,38 @@
struct ScintillaFuncs
{
+ long int (*send_message) (struct _ScintillaObject* sci, unsigned int iMessage,
+ long unsigned int wParam, long int lParam);
+ void (*send_command) (struct _ScintillaObject* sci, gint cmd);
+
+ void (*start_undo_action) (struct _ScintillaObject* sci);
+ void (*end_undo_action) (struct _ScintillaObject* sci);
void (*set_text) (struct _ScintillaObject *sci, const gchar *text);
void (*insert_text) (struct _ScintillaObject *sci, gint pos, const gchar *text);
- gint (*get_current_position) (struct _ScintillaObject *sci);
void (*get_text) (struct _ScintillaObject *sci, gint len, gchar* text);
gint (*get_length) (struct _ScintillaObject *sci);
+ gint (*get_current_position) (struct _ScintillaObject *sci);
+ void (*set_current_position) (struct _ScintillaObject* sci, gint position, gboolean scroll_to_caret);
+ gint (*get_col_from_position) (struct _ScintillaObject* sci, gint position);
+ gint (*get_line_from_position) (struct _ScintillaObject* sci, gint position);
+ gint (*get_position_from_line) (struct _ScintillaObject* sci, gint line);
void (*replace_sel) (struct _ScintillaObject* sci, const gchar* text);
void (*get_selected_text) (struct _ScintillaObject* sci, gchar* text);
gint (*get_selected_text_length) (struct _ScintillaObject* sci);
+ gint (*get_selection_start) (struct _ScintillaObject* sci);
+ gint (*get_selection_end) (struct _ScintillaObject* sci);
+ gint (*get_selection_mode) (struct _ScintillaObject* sci);
+ void (*set_selection_mode) (struct _ScintillaObject* sci, gint mode);
+ void (*set_selection_start) (struct _ScintillaObject* sci, gint position);
+ void (*set_selection_end) (struct _ScintillaObject* sci, gint position);
+ void (*get_text_range) (struct _ScintillaObject* sci, gint start, gint end, gchar*text);
+ gchar* (*get_line) (struct _ScintillaObject* sci, gint line_num);
+ gint (*get_line_length) (struct _ScintillaObject* sci, gint line);
+ gint (*get_line_count) (struct _ScintillaObject* sci);
+ gboolean (*get_line_is_visible) (struct _ScintillaObject* sci, gint line);
+ void (*ensure_line_is_visible) (struct _ScintillaObject* sci, gint line);
+ void (*scroll_caret) (struct _ScintillaObject* sci);
+ gint (*find_bracematch) (struct _ScintillaObject* sci, gint pos);
};
struct TemplateFuncs
@@ -180,4 +207,10 @@
GtkWidget* (*frame_new_with_alignment) (const gchar *label_text, GtkWidget **alignment);
};
+typedef struct SupportFuncs
+{
+ GtkWidget* (*lookup_widget) (GtkWidget *widget, const gchar *widget_name);
+}
+SupportFuncs;
+
#endif
Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c 2007-07-31 17:07:33 UTC (rev 1767)
+++ trunk/src/plugins.c 2007-08-03 15:05:53 UTC (rev 1768)
@@ -30,6 +30,13 @@
#include <string.h>
+#ifndef PLAT_GTK
+# define PLAT_GTK 1 // needed for ScintillaWidget.h
+#endif
+
+#include "Scintilla.h"
+#include "ScintillaWidget.h"
+
#include "plugins.h"
#include "plugindata.h"
#include "support.h"
@@ -38,6 +45,7 @@
#include "templates.h"
#include "sciwrappers.h"
#include "ui_utils.h"
+#include "editor.h"
#ifdef G_OS_WIN32
# define PLUGIN_EXT "dll"
@@ -68,14 +76,36 @@
};
static ScintillaFuncs sci_funcs = {
+ &scintilla_send_message,
+ &sci_cmd,
+ &sci_start_undo_action,
+ &sci_end_undo_action,
&sci_set_text,
&sci_insert_text,
- &sci_get_current_position,
&sci_get_text,
&sci_get_length,
+ &sci_get_current_position,
+ &sci_set_current_position,
+ &sci_get_col_from_position,
+ &sci_get_line_from_position,
+ &sci_get_position_from_line,
&sci_replace_sel,
&sci_get_selected_text,
- &sci_get_selected_text_length
+ &sci_get_selected_text_length,
+ &sci_get_selection_start,
+ &sci_get_selection_end,
+ &sci_get_selection_mode,
+ &sci_set_selection_mode,
+ &sci_set_selection_start,
+ &sci_set_selection_end,
+ &sci_get_text_range,
+ &sci_get_line,
+ &sci_get_line_length,
+ &sci_get_line_count,
+ &sci_get_line_is_visible,
+ &sci_ensure_line_is_visible,
+ &sci_scroll_caret,
+ &sci_find_bracematch
};
static TemplateFuncs template_funcs = {
@@ -93,17 +123,24 @@
&ui_frame_new_with_alignment
};
+static SupportFuncs support_funcs = {
+ &lookup_widget
+};
+
static GeanyData geany_data = {
NULL,
NULL,
NULL,
+ NULL,
+ NULL,
&doc_funcs,
&sci_funcs,
&template_funcs,
&utils_funcs,
&uiutils_funcs,
+ &support_funcs
};
@@ -113,6 +150,8 @@
geany_data.app = app;
geany_data.tools_menu = lookup_widget(app->window, "tools1_menu");
geany_data.doc_array = doc_array;
+ geany_data.filetypes = filetypes;
+ geany_data.editor_prefs = &editor_prefs;
}
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