2007-06-26 16:17:16 +00:00
|
|
|
/*
|
|
|
|
* plugindata.h - this file is part of Geany, a fast and lightweight IDE
|
|
|
|
*
|
2008-01-06 18:11:57 +00:00
|
|
|
* Copyright 2007-2008 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
|
|
|
* Copyright 2007-2008 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
2007-06-26 16:17:16 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
* MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*/
|
|
|
|
|
2007-08-10 16:11:17 +00:00
|
|
|
/**
|
2008-03-12 17:07:43 +00:00
|
|
|
* @file plugindata.h
|
|
|
|
* This file defines the plugin API, the interface between Geany and its plugins.
|
|
|
|
* For detailed documentation of the plugin system please read the plugin
|
|
|
|
* API documentation.
|
2008-02-17 18:00:42 +00:00
|
|
|
**/
|
2008-08-14 15:50:40 +00:00
|
|
|
/* Note: Remember to increment GEANY_API_VERSION (and GEANY_ABI_VERSION if necessary)
|
|
|
|
* when making changes (see 'Keeping the plugin ABI stable' in the HACKING file). */
|
2007-08-10 16:11:17 +00:00
|
|
|
|
2007-07-23 15:41:08 +00:00
|
|
|
|
2008-05-01 17:25:18 +00:00
|
|
|
#ifndef PLUGINDATA_H
|
|
|
|
#define PLUGINDATA_H
|
2008-03-10 13:35:30 +00:00
|
|
|
|
2008-11-08 13:32:55 +00:00
|
|
|
#include "editor.h" /* GeanyIndentType */
|
|
|
|
|
|
|
|
|
2008-08-14 15:50:40 +00:00
|
|
|
/* Note: We use enum instead of 'static const gint' to allow its use in global variable
|
|
|
|
* initializing, otherwise we get errors like:
|
|
|
|
* error: initializer element is not constant */
|
2008-11-11 19:19:26 +00:00
|
|
|
/** Versioning data */
|
2008-08-14 15:50:40 +00:00
|
|
|
enum {
|
|
|
|
/** The Application Programming Interface (API) version, incremented
|
|
|
|
* whenever any plugin data types are modified or appended to. */
|
2008-11-16 17:54:28 +00:00
|
|
|
GEANY_API_VERSION = 108,
|
2008-08-14 15:50:40 +00:00
|
|
|
|
|
|
|
/** 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. */
|
2008-11-16 17:54:28 +00:00
|
|
|
GEANY_ABI_VERSION = 50
|
2008-08-14 15:50:40 +00:00
|
|
|
};
|
2007-06-26 16:17:16 +00:00
|
|
|
|
2008-03-26 17:10:18 +00:00
|
|
|
/** Check the plugin can be loaded by Geany.
|
|
|
|
* This performs runtime checks that try to ensure:
|
|
|
|
* - Geany ABI data types are compatible with this plugin.
|
|
|
|
* - Geany sources provide the required API for this plugin. */
|
|
|
|
#define PLUGIN_VERSION_CHECK(api_required) \
|
2008-05-26 17:09:43 +00:00
|
|
|
gint plugin_version_check(gint abi_ver) \
|
2007-06-26 16:17:16 +00:00
|
|
|
{ \
|
2008-08-14 15:50:40 +00:00
|
|
|
if (abi_ver != GEANY_ABI_VERSION) \
|
2007-06-26 16:17:16 +00:00
|
|
|
return -1; \
|
2008-08-14 15:50:40 +00:00
|
|
|
if (GEANY_API_VERSION < (api_required)) \
|
2007-06-26 16:17:16 +00:00
|
|
|
return (api_required); \
|
|
|
|
else return 0; \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-13 12:38:32 +00:00
|
|
|
/** Basic information about a plugin available to Geany without loading the plugin.
|
|
|
|
* The fields are set in plugin_set_info(), usually with the PLUGIN_SET_INFO() macro. */
|
2007-06-27 15:56:42 +00:00
|
|
|
typedef struct PluginInfo
|
2007-06-26 16:17:16 +00:00
|
|
|
{
|
2008-02-27 13:17:29 +00:00
|
|
|
/** The name of the plugin. */
|
|
|
|
gchar *name;
|
|
|
|
/** The description of the plugin. */
|
|
|
|
gchar *description;
|
|
|
|
/** The version of the plugin. */
|
|
|
|
gchar *version;
|
|
|
|
/** The author of the plugin. */
|
|
|
|
gchar *author;
|
2007-06-27 15:56:42 +00:00
|
|
|
}
|
|
|
|
PluginInfo;
|
2007-06-26 16:17:16 +00:00
|
|
|
|
2008-10-13 12:38:32 +00:00
|
|
|
|
|
|
|
/** Basic information for the plugin and identification. */
|
|
|
|
typedef struct GeanyPlugin
|
|
|
|
{
|
|
|
|
PluginInfo *info; /**< Fields set in plugin_set_info(). */
|
|
|
|
|
|
|
|
struct GeanyPluginPrivate *priv; /* private */
|
|
|
|
}
|
|
|
|
GeanyPlugin;
|
|
|
|
|
|
|
|
|
2008-05-23 17:08:58 +00:00
|
|
|
/** Set the plugin name and some other basic information about a plugin.
|
|
|
|
* This declares a function, so you can use the _() translation macro for arguments.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code PLUGIN_SET_INFO(_("Cool Feature"), _("Adds cool feature support."), "0.1", "Joe Author") @endcode */
|
|
|
|
/* plugin_set_info() could be written manually for plugins if we want to add any
|
|
|
|
* extra PluginInfo features (such as an icon), so we don't need to break API
|
|
|
|
* compatibility. Alternatively just add a new macro, PLUGIN_SET_INFO_FULL(). -ntrel */
|
|
|
|
#define PLUGIN_SET_INFO(p_name, p_description, p_version, p_author) \
|
|
|
|
void plugin_set_info(PluginInfo* info) \
|
2007-06-27 15:56:42 +00:00
|
|
|
{ \
|
2008-05-23 17:08:58 +00:00
|
|
|
info->name = (p_name); \
|
|
|
|
info->description = (p_description); \
|
|
|
|
info->version = (p_version); \
|
|
|
|
info->author = (p_author); \
|
2007-06-27 15:56:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-03-07 18:00:22 +00:00
|
|
|
/** Declare and initialise a keybinding group.
|
2008-08-08 18:05:53 +00:00
|
|
|
* @code GeanyKeyGroup plugin_key_group[1]; @endcode
|
2008-05-26 17:09:43 +00:00
|
|
|
* You must then set the @c plugin_key_group::keys[] entries for the group in plugin_init().
|
|
|
|
* The @c plugin_key_group::label field is set by Geany after @c plugin_init()
|
2008-03-07 18:00:22 +00:00
|
|
|
* is called, to the name of the plugin.
|
|
|
|
* @param group_name A unique group name (without quotes) to be used in the
|
|
|
|
* configuration file, such as @c html_chars.
|
2008-03-13 13:36:18 +00:00
|
|
|
* @param key_count The number of keybindings the group will hold. */
|
2008-03-07 18:00:22 +00:00
|
|
|
#define PLUGIN_KEY_GROUP(group_name, key_count) \
|
2008-08-08 18:05:53 +00:00
|
|
|
static GeanyKeyBinding plugin_keys[key_count]; \
|
2008-03-07 18:00:22 +00:00
|
|
|
\
|
|
|
|
/* We have to declare plugin_key_group as a single element array.
|
|
|
|
* Declaring as a pointer to a struct doesn't work with g_module_symbol(). */ \
|
2008-08-08 18:05:53 +00:00
|
|
|
GeanyKeyGroup plugin_key_group[1] = \
|
2008-03-07 18:00:22 +00:00
|
|
|
{ \
|
|
|
|
{G_STRINGIFY(group_name), NULL, key_count, plugin_keys} \
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-02-17 18:00:42 +00:00
|
|
|
/** callback array entry */
|
2008-05-23 12:29:32 +00:00
|
|
|
typedef struct PluginCallback
|
2007-10-22 12:42:19 +00:00
|
|
|
{
|
2008-02-17 18:00:42 +00:00
|
|
|
/** The name of signal, must be an existing signal. For a list of available signals,
|
|
|
|
* please see the @link signals Signal documentation @endlink. */
|
2007-10-22 12:42:19 +00:00
|
|
|
gchar *signal_name;
|
2008-02-17 18:00:42 +00:00
|
|
|
/** A callback function which is called when the signal is emitted. */
|
2007-10-22 12:42:19 +00:00
|
|
|
GCallback callback;
|
2008-02-17 18:00:42 +00:00
|
|
|
/** Set to TRUE to connect your handler with g_signal_connect_after(). */
|
2007-10-22 12:42:19 +00:00
|
|
|
gboolean after;
|
2008-02-17 18:00:42 +00:00
|
|
|
/** The user data passed to the signal handler. */
|
2007-10-22 12:42:19 +00:00
|
|
|
gpointer user_data;
|
|
|
|
}
|
2008-05-23 12:29:32 +00:00
|
|
|
PluginCallback;
|
2007-10-22 12:42:19 +00:00
|
|
|
|
|
|
|
|
2008-10-14 14:49:41 +00:00
|
|
|
/** @deprecated Use @ref ui_add_document_sensitive() instead.
|
|
|
|
* Flags to be set by plugins in PluginFields struct. */
|
2007-07-23 15:41:08 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2008-02-27 13:17:29 +00:00
|
|
|
/** Whether a plugin's menu item should be disabled when there are no open documents */
|
|
|
|
PLUGIN_IS_DOCUMENT_SENSITIVE = 1 << 0
|
2007-07-23 15:41:08 +00:00
|
|
|
}
|
|
|
|
PluginFlags;
|
|
|
|
|
2008-10-14 14:49:41 +00:00
|
|
|
/** @deprecated Use @ref ui_add_document_sensitive() instead.
|
|
|
|
* Fields set and owned by the plugin. */
|
2007-07-23 15:41:08 +00:00
|
|
|
typedef struct PluginFields
|
|
|
|
{
|
2008-02-27 13:17:29 +00:00
|
|
|
/** Bitmask of PluginFlags. */
|
2007-07-23 15:41:08 +00:00
|
|
|
PluginFlags flags;
|
2008-02-27 13:17:29 +00:00
|
|
|
/** Pointer to a plugin's menu item which will be automatically enabled/disabled when there
|
|
|
|
* are no open documents and PLUGIN_IS_DOCUMENT_SENSITIVE is set.
|
|
|
|
* This is required if using PLUGIN_IS_DOCUMENT_SENSITIVE, ignored otherwise */
|
|
|
|
GtkWidget *menu_item;
|
2007-07-23 15:41:08 +00:00
|
|
|
}
|
|
|
|
PluginFields;
|
|
|
|
|
|
|
|
|
2008-05-19 12:35:35 +00:00
|
|
|
/** This contains pointers to global variables owned by Geany for plugins to use.
|
|
|
|
* Core variable pointers can be appended when needed by plugin authors, if appropriate. */
|
2007-07-27 10:37:22 +00:00
|
|
|
typedef struct GeanyData
|
2007-06-27 15:56:42 +00:00
|
|
|
{
|
2008-05-22 14:41:28 +00:00
|
|
|
struct GeanyApp *app; /**< Geany application data fields */
|
2008-05-29 17:00:54 +00:00
|
|
|
struct GeanyMainWidgets *main_widgets; /**< Important widgets in the main window */
|
2008-07-24 15:17:55 +00:00
|
|
|
GPtrArray *documents_array; /**< See document.h#documents_array. */
|
2008-05-29 17:00:54 +00:00
|
|
|
GPtrArray *filetypes_array; /**< Dynamic array of GeanyFiletype pointers */
|
2008-05-19 12:35:35 +00:00
|
|
|
struct GeanyPrefs *prefs; /**< General settings */
|
|
|
|
struct GeanyInterfacePrefs *interface_prefs; /**< Interface settings */
|
|
|
|
struct GeanyToolbarPrefs *toolbar_prefs; /**< Toolbar settings */
|
|
|
|
struct GeanyEditorPrefs *editor_prefs; /**< Editor settings */
|
|
|
|
struct GeanyFilePrefs *file_prefs; /**< File-related settings */
|
|
|
|
struct GeanySearchPrefs *search_prefs; /**< Search-related settings */
|
|
|
|
struct GeanyToolPrefs *tool_prefs; /**< Tool settings */
|
|
|
|
struct GeanyTemplatePrefs *template_prefs; /**< Template settings */
|
|
|
|
struct GeanyBuildInfo *build_info; /**< Current build information */
|
2007-06-27 15:56:42 +00:00
|
|
|
}
|
2007-07-27 10:37:22 +00:00
|
|
|
GeanyData;
|
|
|
|
|
2007-06-26 16:17:16 +00:00
|
|
|
|
2008-05-19 12:35:35 +00:00
|
|
|
/** This contains pointers to functions owned by Geany for plugins to use.
|
|
|
|
* Functions from the core can be appended when needed by plugin authors, but may
|
|
|
|
* require some changes. */
|
|
|
|
typedef struct GeanyFunctions
|
|
|
|
{
|
|
|
|
struct DocumentFuncs *p_document; /**< See document.h */
|
|
|
|
struct ScintillaFuncs *p_sci; /**< See sciwrappers.h */
|
|
|
|
struct TemplateFuncs *p_templates; /**< See templates.h */
|
|
|
|
struct UtilsFuncs *p_utils; /**< See utils.h */
|
|
|
|
struct UIUtilsFuncs *p_ui; /**< See ui_utils.h */
|
|
|
|
struct SupportFuncs *p_support; /**< See support.h */
|
|
|
|
struct DialogFuncs *p_dialogs; /**< See dialogs.h */
|
|
|
|
struct MsgWinFuncs *p_msgwindow; /**< See msgwindow.h */
|
|
|
|
struct EncodingFuncs *p_encodings; /**< See encodings.h */
|
|
|
|
struct KeybindingFuncs *p_keybindings; /**< See keybindings.h */
|
|
|
|
struct TagManagerFuncs *p_tm; /**< See tagmanager/include */
|
|
|
|
struct SearchFuncs *p_search; /**< See search.h */
|
|
|
|
struct HighlightingFuncs *p_highlighting; /**< See highlighting.h */
|
|
|
|
struct FiletypeFuncs *p_filetypes; /**< See filetypes.h */
|
|
|
|
struct NavQueueFuncs *p_navqueue; /**< See navqueue.h */
|
|
|
|
struct EditorFuncs *p_editor; /**< See editor.h */
|
2008-07-23 11:46:02 +00:00
|
|
|
struct MainFuncs *p_main; /**< See main.h */
|
2008-10-13 12:38:32 +00:00
|
|
|
struct PluginFuncs *p_plugin; /**< See plugins.c */
|
2008-05-19 12:35:35 +00:00
|
|
|
}
|
|
|
|
GeanyFunctions;
|
|
|
|
|
|
|
|
|
|
|
|
/* For more information about these functions, see the main source code.
|
|
|
|
* E.g. for p_document->new_file(), see document_new_file() in document.c. */
|
2007-07-13 14:54:11 +00:00
|
|
|
|
2007-07-04 11:32:33 +00:00
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
/* See document.h */
|
2007-08-10 11:45:20 +00:00
|
|
|
typedef struct DocumentFuncs
|
2007-07-04 11:32:33 +00:00
|
|
|
{
|
2008-07-24 12:12:47 +00:00
|
|
|
struct GeanyDocument* (*new_file) (const gchar *utf8_filename, struct GeanyFiletype *ft,
|
2008-06-12 16:50:01 +00:00
|
|
|
const gchar *text);
|
|
|
|
struct GeanyDocument* (*get_current) (void);
|
|
|
|
struct GeanyDocument* (*get_from_page) (guint page_num);
|
|
|
|
struct GeanyDocument* (*find_by_filename) (const gchar *utf8_filename);
|
|
|
|
struct GeanyDocument* (*find_by_real_path) (const gchar *realname);
|
|
|
|
gboolean (*save_file) (struct GeanyDocument *doc, gboolean force);
|
|
|
|
struct GeanyDocument* (*open_file) (const gchar *locale_filename, gboolean readonly,
|
2008-05-29 18:02:20 +00:00
|
|
|
struct GeanyFiletype *ft, const gchar *forced_enc);
|
2008-06-12 16:50:01 +00:00
|
|
|
void (*open_files) (const GSList *filenames, gboolean readonly,
|
|
|
|
struct GeanyFiletype *ft, const gchar *forced_enc);
|
|
|
|
gboolean (*remove_page) (guint page_num);
|
|
|
|
gboolean (*reload_file) (struct GeanyDocument *doc, const gchar *forced_enc);
|
|
|
|
void (*set_encoding) (struct GeanyDocument *doc, const gchar *new_encoding);
|
|
|
|
void (*set_text_changed) (struct GeanyDocument *doc, gboolean changed);
|
|
|
|
void (*set_filetype) (struct GeanyDocument *doc, struct GeanyFiletype *type);
|
2008-07-02 13:40:06 +00:00
|
|
|
gboolean (*close) (GeanyDocument *doc);
|
2007-08-10 11:45:20 +00:00
|
|
|
}
|
|
|
|
DocumentFuncs;
|
2007-07-04 11:32:33 +00:00
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
|
2007-07-04 11:32:33 +00:00
|
|
|
struct _ScintillaObject;
|
|
|
|
|
2008-07-25 14:18:49 +00:00
|
|
|
/** See sciwrappers.h. */
|
2007-08-10 11:45:20 +00:00
|
|
|
typedef struct ScintillaFuncs
|
2007-07-04 11:32:33 +00:00
|
|
|
{
|
2008-07-25 14:18:49 +00:00
|
|
|
/** Send Scintilla a message.
|
|
|
|
* @see http://scintilla.org for the documentation. */
|
2007-09-12 11:17:53 +00:00
|
|
|
long int (*send_message) (struct _ScintillaObject* sci, unsigned int iMessage,
|
|
|
|
long unsigned int wParam, long int lParam);
|
2007-08-03 15:05:53 +00:00
|
|
|
void (*send_command) (struct _ScintillaObject* sci, gint cmd);
|
|
|
|
|
|
|
|
void (*start_undo_action) (struct _ScintillaObject* sci);
|
|
|
|
void (*end_undo_action) (struct _ScintillaObject* sci);
|
2007-07-13 14:54:11 +00:00
|
|
|
void (*set_text) (struct _ScintillaObject *sci, const gchar *text);
|
2007-07-23 15:41:08 +00:00
|
|
|
void (*insert_text) (struct _ScintillaObject *sci, gint pos, const gchar *text);
|
2007-07-24 11:43:46 +00:00
|
|
|
void (*get_text) (struct _ScintillaObject *sci, gint len, gchar* text);
|
|
|
|
gint (*get_length) (struct _ScintillaObject *sci);
|
2007-08-03 15:05:53 +00:00
|
|
|
gint (*get_current_position) (struct _ScintillaObject *sci);
|
2008-06-12 20:09:57 +00:00
|
|
|
void (*set_current_position) (struct _ScintillaObject* sci, gint position,
|
|
|
|
gboolean scroll_to_caret);
|
2007-08-03 15:05:53 +00:00
|
|
|
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);
|
2007-07-24 11:43:46 +00:00
|
|
|
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);
|
2007-08-03 15:05:53 +00:00
|
|
|
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);
|
2007-09-12 11:17:53 +00:00
|
|
|
gboolean (*get_line_is_visible) (struct _ScintillaObject* sci, gint line);
|
2007-08-03 15:05:53 +00:00
|
|
|
void (*ensure_line_is_visible) (struct _ScintillaObject* sci, gint line);
|
|
|
|
void (*scroll_caret) (struct _ScintillaObject* sci);
|
2008-09-17 18:02:55 +00:00
|
|
|
gint (*find_matching_brace) (struct _ScintillaObject* sci, gint pos);
|
2007-08-19 17:40:19 +00:00
|
|
|
gint (*get_style_at) (struct _ScintillaObject *sci, gint position);
|
|
|
|
gchar (*get_char_at) (struct _ScintillaObject *sci, gint pos);
|
2008-02-04 12:49:14 +00:00
|
|
|
gint (*get_current_line) (struct _ScintillaObject *sci);
|
2008-09-17 18:02:55 +00:00
|
|
|
gboolean (*has_selection) (struct _ScintillaObject *sci);
|
2008-08-08 14:46:31 +00:00
|
|
|
gint (*get_tab_width) (struct _ScintillaObject *sci);
|
2008-09-18 11:47:48 +00:00
|
|
|
void (*indicator_clear) (struct _ScintillaObject *sci, gint start, gint end);
|
2008-11-16 17:54:28 +00:00
|
|
|
void (*indicator_set) (struct _ScintillaObject *sci, gint indic);
|
2007-08-10 11:45:20 +00:00
|
|
|
}
|
|
|
|
ScintillaFuncs;
|
2007-07-04 11:32:33 +00:00
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
|
|
|
|
/* See templates.h */
|
2007-08-10 11:45:20 +00:00
|
|
|
typedef struct TemplateFuncs
|
2007-07-04 11:32:33 +00:00
|
|
|
{
|
2007-09-17 11:16:48 +00:00
|
|
|
gchar* (*get_template_fileheader) (gint filetype_idx, const gchar *fname);
|
2007-08-10 11:45:20 +00:00
|
|
|
}
|
|
|
|
TemplateFuncs;
|
2007-07-04 11:32:33 +00:00
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
|
|
|
|
/* See utils.h */
|
2007-08-10 11:45:20 +00:00
|
|
|
typedef struct UtilsFuncs
|
2007-07-04 11:32:33 +00:00
|
|
|
{
|
2007-07-13 14:54:11 +00:00
|
|
|
gboolean (*str_equal) (const gchar *a, const gchar *b);
|
2007-09-11 15:21:11 +00:00
|
|
|
gboolean (*string_replace_all) (GString *haystack, const gchar *needle,
|
2007-10-16 09:01:13 +00:00
|
|
|
const gchar *replacement);
|
2007-07-24 11:43:46 +00:00
|
|
|
GSList* (*get_file_list) (const gchar *path, guint *length, GError **error);
|
2007-08-19 17:40:19 +00:00
|
|
|
gint (*write_file) (const gchar *filename, const gchar *text);
|
|
|
|
gchar* (*get_locale_from_utf8) (const gchar *utf8_text);
|
|
|
|
gchar* (*get_utf8_from_locale) (const gchar *locale_text);
|
|
|
|
gchar* (*remove_ext_from_filename) (const gchar *filename);
|
2007-11-21 18:54:12 +00:00
|
|
|
gint (*mkdir) (const gchar *path, gboolean create_parent_dirs);
|
2008-01-02 21:20:33 +00:00
|
|
|
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);
|
2008-02-24 10:27:32 +00:00
|
|
|
gboolean (*spawn_sync) (const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags,
|
|
|
|
GSpawnChildSetupFunc child_setup, gpointer user_data, gchar **std_out,
|
|
|
|
gchar **std_err, gint *exit_status, GError **error);
|
|
|
|
gboolean (*spawn_async) (const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags,
|
|
|
|
GSpawnChildSetupFunc child_setup, gpointer user_data, GPid *child_pid,
|
|
|
|
GError **error);
|
2008-11-11 19:18:51 +00:00
|
|
|
gint (*utils_str_casecmp) (const gchar *s1, const gchar *s2);
|
2007-08-10 11:45:20 +00:00
|
|
|
}
|
|
|
|
UtilsFuncs;
|
2007-07-13 14:54:11 +00:00
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
|
2008-07-23 11:46:02 +00:00
|
|
|
/* See main.h */
|
|
|
|
typedef struct MainFuncs
|
|
|
|
{
|
|
|
|
void (*reload_configuration) (void);
|
2008-10-25 18:56:27 +00:00
|
|
|
void (*locale_init) (const gchar *locale_dir, const gchar *package);
|
|
|
|
|
2008-07-23 11:46:02 +00:00
|
|
|
}
|
|
|
|
MainFuncs;
|
|
|
|
|
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
/* See ui_utils.h */
|
2007-08-10 11:45:20 +00:00
|
|
|
typedef struct UIUtilsFuncs
|
2007-07-13 14:54:11 +00:00
|
|
|
{
|
|
|
|
GtkWidget* (*dialog_vbox_new) (GtkDialog *dialog);
|
|
|
|
GtkWidget* (*frame_new_with_alignment) (const gchar *label_text, GtkWidget **alignment);
|
2007-09-25 16:21:35 +00:00
|
|
|
|
|
|
|
/* set_statusbar() also appends to the message window status tab if log is TRUE. */
|
|
|
|
void (*set_statusbar) (gboolean log, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
|
2008-02-04 13:40:14 +00:00
|
|
|
|
2008-02-04 12:49:14 +00:00
|
|
|
void (*table_add_row) (GtkTable *table, gint row, ...) G_GNUC_NULL_TERMINATED;
|
|
|
|
GtkWidget* (*path_box_new) (const gchar *title, GtkFileChooserAction action, GtkEntry *entry);
|
2008-02-04 13:40:14 +00:00
|
|
|
GtkWidget* (*button_new_with_image) (const gchar *stock_id, const gchar *text);
|
2008-10-14 14:49:41 +00:00
|
|
|
void (*add_document_sensitive) (GtkWidget *widget);
|
2007-08-10 11:45:20 +00:00
|
|
|
}
|
|
|
|
UIUtilsFuncs;
|
2007-07-04 11:32:33 +00:00
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
|
|
|
|
/* See dialogs.h */
|
2007-08-19 17:40:19 +00:00
|
|
|
typedef struct DialogFuncs
|
|
|
|
{
|
|
|
|
gboolean (*show_question) (const gchar *text, ...);
|
|
|
|
void (*show_msgbox) (gint type, const gchar *text, ...);
|
2008-02-20 11:24:23 +00:00
|
|
|
gboolean (*show_save_as) (void);
|
2007-08-19 17:40:19 +00:00
|
|
|
}
|
|
|
|
DialogFuncs;
|
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
|
|
|
|
/* See support.h */
|
2007-08-03 15:05:53 +00:00
|
|
|
typedef struct SupportFuncs
|
|
|
|
{
|
|
|
|
GtkWidget* (*lookup_widget) (GtkWidget *widget, const gchar *widget_name);
|
|
|
|
}
|
|
|
|
SupportFuncs;
|
|
|
|
|
2007-08-10 16:11:17 +00:00
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
/* See msgwindow.h */
|
2007-08-19 17:40:19 +00:00
|
|
|
typedef struct MsgWinFuncs
|
|
|
|
{
|
2007-09-25 16:21:35 +00:00
|
|
|
/* status_add() does not set the status bar - use ui->set_statusbar() instead. */
|
2007-08-19 17:40:19 +00:00
|
|
|
void (*status_add) (const gchar *format, ...);
|
2007-09-17 11:16:48 +00:00
|
|
|
void (*compiler_add) (gint msg_color, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
|
2008-06-12 20:09:57 +00:00
|
|
|
void (*msg_add) (gint msg_color, gint line, struct GeanyDocument *doc,
|
|
|
|
const gchar *format, ...) G_GNUC_PRINTF (4, 5);
|
2008-05-14 15:46:48 +00:00
|
|
|
void (*clear_tab) (gint tabnum);
|
|
|
|
void (*switch_tab) (gint tabnum, gboolean show);
|
2007-08-19 17:40:19 +00:00
|
|
|
}
|
|
|
|
MsgWinFuncs;
|
|
|
|
|
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
/* See encodings.h */
|
2007-10-18 18:03:28 +00:00
|
|
|
typedef struct EncodingFuncs
|
|
|
|
{
|
2008-01-16 16:50:10 +00:00
|
|
|
gchar* (*convert_to_utf8) (const gchar *buffer, gsize size, gchar **used_encoding);
|
|
|
|
gchar* (*convert_to_utf8_from_charset) (const gchar *buffer, gsize size,
|
|
|
|
const gchar *charset, gboolean fast);
|
|
|
|
const gchar* (*get_charset_from_index) (gint idx);
|
2007-10-18 18:03:28 +00:00
|
|
|
}
|
|
|
|
EncodingFuncs;
|
|
|
|
|
|
|
|
|
2008-08-08 18:05:53 +00:00
|
|
|
struct GeanyKeyGroup;
|
2008-08-14 15:50:40 +00:00
|
|
|
/* avoid including keybindings.h */
|
|
|
|
typedef void (*_GeanyKeyCallback) (guint key_id);
|
2008-03-10 13:35:30 +00:00
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
/* See keybindings.h */
|
2007-10-22 12:42:19 +00:00
|
|
|
typedef struct KeybindingFuncs
|
2007-08-10 16:11:17 +00:00
|
|
|
{
|
2008-03-10 13:29:35 +00:00
|
|
|
void (*send_command) (guint group_id, guint key_id);
|
2008-08-08 18:05:53 +00:00
|
|
|
void (*set_item) (struct GeanyKeyGroup *group, gsize key_id,
|
2008-08-14 15:50:40 +00:00
|
|
|
_GeanyKeyCallback callback, guint key, GdkModifierType mod,
|
2008-03-14 17:23:24 +00:00
|
|
|
gchar *name, gchar *label, GtkWidget *menu_item);
|
2007-08-10 16:11:17 +00:00
|
|
|
}
|
2007-10-22 12:42:19 +00:00
|
|
|
KeybindingFuncs;
|
|
|
|
|
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
/* See highlighting.h */
|
2007-12-16 11:27:59 +00:00
|
|
|
typedef struct HighlightingFuncs
|
|
|
|
{
|
2008-08-26 12:43:46 +00:00
|
|
|
const struct GeanyLexerStyle* (*get_style) (gint ft_id, gint style_id);
|
2007-12-16 11:27:59 +00:00
|
|
|
}
|
|
|
|
HighlightingFuncs;
|
|
|
|
|
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
/* See filetypes.h */
|
2008-01-02 21:20:33 +00:00
|
|
|
typedef struct FiletypeFuncs
|
|
|
|
{
|
2008-07-24 11:23:12 +00:00
|
|
|
GeanyFiletype* (*detect_from_file) (const gchar *utf8_filename);
|
2008-05-16 14:17:54 +00:00
|
|
|
GeanyFiletype* (*lookup_by_name) (const gchar *name);
|
2008-09-26 12:23:59 +00:00
|
|
|
/* Remember to convert any filetype_id arguments to GeanyFiletype pointers in any
|
|
|
|
* appended functions */
|
2008-01-02 21:20:33 +00:00
|
|
|
}
|
|
|
|
FiletypeFuncs;
|
|
|
|
|
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
/* See search.h */
|
2007-12-02 10:52:19 +00:00
|
|
|
typedef struct SearchFuncs
|
|
|
|
{
|
|
|
|
void (*show_find_in_files_dialog) (const gchar *dir);
|
|
|
|
}
|
|
|
|
SearchFuncs;
|
|
|
|
|
2008-03-27 13:13:09 +00:00
|
|
|
|
|
|
|
/* See tagmanager/include */
|
2007-10-22 12:42:19 +00:00
|
|
|
typedef struct TagManagerFuncs
|
|
|
|
{
|
2008-01-02 21:20:33 +00:00
|
|
|
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);
|
2008-01-11 17:09:23 +00:00
|
|
|
gboolean (*workspace_remove_object) (TMWorkObject *w, gboolean do_free, gboolean update);
|
2007-10-22 12:42:19 +00:00
|
|
|
}
|
|
|
|
TagManagerFuncs;
|
2007-08-10 16:11:17 +00:00
|
|
|
|
2008-05-14 17:58:56 +00:00
|
|
|
|
|
|
|
/* See navqueue.h */
|
2008-04-17 17:48:12 +00:00
|
|
|
typedef struct NavQueueFuncs
|
|
|
|
{
|
2008-06-12 20:09:57 +00:00
|
|
|
gboolean (*goto_line) (struct GeanyDocument *old_doc, struct GeanyDocument *new_doc,
|
|
|
|
gint line);
|
2008-05-07 14:01:30 +00:00
|
|
|
}
|
|
|
|
NavQueueFuncs;
|
2008-04-17 17:48:12 +00:00
|
|
|
|
2008-03-26 17:10:18 +00:00
|
|
|
|
2008-07-11 14:49:09 +00:00
|
|
|
struct GeanyEditor;
|
|
|
|
|
2008-05-14 17:58:56 +00:00
|
|
|
/* See editor.h */
|
|
|
|
typedef struct EditorFuncs
|
|
|
|
{
|
2008-08-07 15:30:52 +00:00
|
|
|
const struct GeanyIndentPrefs* (*get_indent_prefs)(struct GeanyEditor *editor);
|
2008-09-16 15:21:46 +00:00
|
|
|
struct _ScintillaObject* (*create_widget)(struct GeanyEditor *editor);
|
2008-10-25 18:57:00 +00:00
|
|
|
|
2008-11-16 17:54:28 +00:00
|
|
|
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);
|
2008-11-11 16:33:20 +00:00
|
|
|
|
2008-11-08 13:32:55 +00:00
|
|
|
void (*set_indent_type)(struct GeanyEditor *editor, GeanyIndentType type);
|
2008-11-11 16:33:20 +00:00
|
|
|
|
2008-11-08 13:32:55 +00:00
|
|
|
/* Remember to convert any GeanyDocument or ScintillaObject pointers in any
|
|
|
|
* appended functions to GeanyEditor pointers. */
|
2008-05-14 17:58:56 +00:00
|
|
|
}
|
|
|
|
EditorFuncs;
|
|
|
|
|
|
|
|
|
2008-10-13 12:38:32 +00:00
|
|
|
/* See plugins.c */
|
|
|
|
typedef struct PluginFuncs
|
|
|
|
{
|
|
|
|
void (*add_toolbar_item)(GeanyPlugin *plugin, GtkToolItem *item);
|
|
|
|
}
|
|
|
|
PluginFuncs;
|
|
|
|
|
|
|
|
|
2008-03-26 17:10:18 +00:00
|
|
|
/* Deprecated aliases */
|
|
|
|
#ifndef GEANY_DISABLE_DEPRECATED
|
2008-03-27 13:13:09 +00:00
|
|
|
|
2008-06-18 14:18:26 +00:00
|
|
|
/** NULL-safe way to get the index of @a doc_ptr in the documents array. */
|
|
|
|
#define DOC_IDX(doc_ptr) \
|
|
|
|
(doc_ptr ? doc_ptr->index : -1)
|
|
|
|
#define DOC_IDX_VALID(doc_idx) \
|
|
|
|
((doc_idx) >= 0 && (guint)(doc_idx) < documents_array->len && documents[doc_idx]->is_valid)
|
|
|
|
|
2008-05-07 14:01:30 +00:00
|
|
|
#endif /* GEANY_DISABLE_DEPRECATED */
|
2008-03-26 17:10:18 +00:00
|
|
|
|
2007-06-26 16:17:16 +00:00
|
|
|
#endif
|