Version bump.
[geany-mirror.git] / src / plugindata.h
blob0dcfedba8df58b01f52023f643b0e2521569412b
1 /*
2 * plugindata.h - this file is part of Geany, a fast and lightweight IDE
4 * Copyright 2007-2010 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
5 * Copyright 2007-2010 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 * MA 02110-1301, USA.
22 * $Id$
25 /**
26 * @file plugindata.h
27 * This file defines the plugin API, the interface between Geany and its plugins.
28 * For detailed documentation of the plugin system please read the plugin
29 * API documentation.
30 **/
31 /* Note: Remember to increment GEANY_API_VERSION (and GEANY_ABI_VERSION if necessary)
32 * when making changes (see 'Keeping the plugin ABI stable' in the HACKING file). */
35 #ifndef PLUGINDATA_H
36 #define PLUGINDATA_H
38 /* Compatibility for sharing macros between API and core.
39 * First include geany.h, then plugindata.h, then other API headers. */
40 #undef GEANY
41 #define GEANY(symbol_name) geany->symbol_name
43 #include "editor.h" /* GeanyIndentType */
46 /* Note: We use enum instead of 'static const gint' to allow its use in global variable
47 * initializing, otherwise we get errors like:
48 * error: initializer element is not constant */
49 /** Versioning data */
50 enum {
51 /** The Application Programming Interface (API) version, incremented
52 * whenever any plugin data types are modified or appended to. */
53 GEANY_API_VERSION = 189,
55 /** The Application Binary Interface (ABI) version, incremented whenever
56 * existing fields in the plugin data types have to be changed or reordered. */
57 /* This should usually stay the same if fields are only appended, assuming only pointers to
58 * structs and not structs themselves are declared by plugins. */
59 GEANY_ABI_VERSION = 66
62 /** Defines a function to check the plugin is safe to load.
63 * This performs runtime checks that try to ensure:
64 * - Geany ABI data types are compatible with this plugin.
65 * - Geany sources provide the required API for this plugin.
66 * @param api_required The minimum API number your plugin requires.
67 * Look at the source for the value of @c GEANY_API_VERSION to use if you
68 * want your plugin to require the current Geany version on your machine.
69 * You should update this value when using any new API features. */
70 #define PLUGIN_VERSION_CHECK(api_required) \
71 gint plugin_version_check(gint abi_ver) \
72 { \
73 if (abi_ver != GEANY_ABI_VERSION) \
74 return -1; \
75 return (api_required); \
79 /** Basic information about a plugin available to Geany without loading the plugin.
80 * The fields are set in plugin_set_info(), usually with the PLUGIN_SET_INFO() macro. */
81 typedef struct PluginInfo
83 /** The name of the plugin. */
84 const gchar *name;
85 /** The description of the plugin. */
86 const gchar *description;
87 /** The version of the plugin. */
88 const gchar *version;
89 /** The author of the plugin. */
90 const gchar *author;
92 PluginInfo;
95 /** Basic information for the plugin and identification.
96 * @see geany_plugin. */
97 typedef struct GeanyPlugin
99 PluginInfo *info; /**< Fields set in plugin_set_info(). */
101 struct GeanyPluginPrivate *priv; /* private */
103 GeanyPlugin;
106 /** Sets the plugin name and some other basic information about a plugin.
108 * @note If you want some of the arguments to be translated, see @ref PLUGIN_SET_TRANSLATABLE_INFO()
110 * Example:
111 * @code PLUGIN_SET_INFO("Cool Feature", "Adds cool feature support.", "0.1", "Joe Author") @endcode */
112 /* plugin_set_info() could be written manually for plugins if we want to add any
113 * extra PluginInfo features (such as an icon), so we don't need to break API
114 * compatibility. Alternatively just add a new macro, PLUGIN_SET_INFO_FULL(). -ntrel */
115 #define PLUGIN_SET_INFO(p_name, p_description, p_version, p_author) \
116 void plugin_set_info(PluginInfo* info) \
118 info->name = (p_name); \
119 info->description = (p_description); \
120 info->version = (p_version); \
121 info->author = (p_author); \
124 /** Sets the plugin name and some other basic information about a plugin.
125 * This macro is like @ref PLUGIN_SET_INFO() but allows the passed information to be translated
126 * by setting up the translation mechanism with @ref main_locale_init().
127 * You therefore don't need to call it manually in plugin_init().
129 * Example:
130 * @code PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE, _("Cool Feature"), _("Adds a cool feature."), "0.1", "John Doe") @endcode
132 * @since 0.19 */
133 #define PLUGIN_SET_TRANSLATABLE_INFO(localedir, package, p_name, p_description, p_version, p_author) \
134 void plugin_set_info(PluginInfo* info) \
136 main_locale_init(localedir, package); \
137 info->name = (p_name); \
138 info->description = (p_description); \
139 info->version = (p_version); \
140 info->author = (p_author); \
143 /** @deprecated - use plugin_set_key_group() instead.
144 * @see PLUGIN_KEY_GROUP() macro. */
145 typedef struct GeanyKeyGroupInfo
147 const gchar *name; /**< Group name used in the configuration file, such as @c "html_chars" */
148 gsize count; /**< The number of keybindings the group will hold */
150 GeanyKeyGroupInfo;
152 /** @deprecated - use plugin_set_key_group() instead.
153 * Declare and initialise a keybinding group.
154 * @code GeanyKeyGroup *plugin_key_group; @endcode
155 * You must then set the @c plugin_key_group::keys[] entries for the group in plugin_init(),
156 * normally using keybindings_set_item().
157 * The @c plugin_key_group::label field is set by Geany after @c plugin_init()
158 * is called, to the name of the plugin.
159 * @param group_name A unique group name (without quotes) to be used in the
160 * configuration file, such as @c html_chars.
161 * @param key_count The number of keybindings the group will hold. */
162 #define PLUGIN_KEY_GROUP(group_name, key_count) \
163 /* We have to declare this as a single element array.
164 * Declaring as a pointer to a struct doesn't work with g_module_symbol(). */ \
165 GeanyKeyGroupInfo plugin_key_group_info[1] = \
167 {G_STRINGIFY(group_name), key_count} \
169 GeanyKeyGroup *plugin_key_group = NULL;
172 /** Callback array entry type used with the @ref plugin_callbacks symbol. */
173 typedef struct PluginCallback
175 /** The name of signal, must be an existing signal. For a list of available signals,
176 * please see the @link signals Signal documentation @endlink. */
177 const gchar *signal_name;
178 /** A callback function which is called when the signal is emitted. */
179 GCallback callback;
180 /** Set to TRUE to connect your handler with g_signal_connect_after(). */
181 gboolean after;
182 /** The user data passed to the signal handler. */
183 gpointer user_data;
185 PluginCallback;
188 /** @deprecated Use @ref ui_add_document_sensitive() instead.
189 * Flags to be set by plugins in PluginFields struct. */
190 typedef enum
192 /** Whether a plugin's menu item should be disabled when there are no open documents */
193 PLUGIN_IS_DOCUMENT_SENSITIVE = 1 << 0
195 PluginFlags;
197 /** @deprecated Use @ref ui_add_document_sensitive() instead.
198 * Fields set and owned by the plugin. */
199 typedef struct PluginFields
201 /** Bitmask of @c PluginFlags. */
202 PluginFlags flags;
203 /** Pointer to a plugin's menu item which will be automatically enabled/disabled when there
204 * are no open documents and @c PLUGIN_IS_DOCUMENT_SENSITIVE is set.
205 * This is required if using @c PLUGIN_IS_DOCUMENT_SENSITIVE, ignored otherwise */
206 GtkWidget *menu_item;
208 PluginFields;
211 /** This contains pointers to global variables owned by Geany for plugins to use.
212 * Core variable pointers can be appended when needed by plugin authors, if appropriate. */
213 typedef struct GeanyData
215 struct GeanyApp *app; /**< Geany application data fields */
216 struct GeanyMainWidgets *main_widgets; /**< Important widgets in the main window */
217 GPtrArray *documents_array; /**< See document.h#documents_array. */
218 GPtrArray *filetypes_array; /**< Dynamic array of GeanyFiletype pointers */
219 struct GeanyPrefs *prefs; /**< General settings */
220 struct GeanyInterfacePrefs *interface_prefs; /**< Interface settings */
221 struct GeanyToolbarPrefs *toolbar_prefs; /**< Toolbar settings */
222 struct GeanyEditorPrefs *editor_prefs; /**< Editor settings */
223 struct GeanyFilePrefs *file_prefs; /**< File-related settings */
224 struct GeanySearchPrefs *search_prefs; /**< Search-related settings */
225 struct GeanyToolPrefs *tool_prefs; /**< Tool settings */
226 struct GeanyTemplatePrefs *template_prefs; /**< Template settings */
227 struct GeanyBuildInfo *build_info; /**< Current build information */
228 GSList *filetypes_by_title; /**< See filetypes.h#filetypes_by_title. */
230 GeanyData;
232 #define geany geany_data /**< Simple macro for @c geany_data that reduces typing. */
235 /** This contains pointers to functions owned by Geany for plugins to use.
236 * Functions from the core can be appended when needed by plugin authors, but may
237 * require some changes. */
238 typedef struct GeanyFunctions
240 struct DocumentFuncs *p_document; /**< See document.h */
241 struct SciFuncs *p_sci; /**< See sciwrappers.h */
242 struct TemplateFuncs *p_templates; /**< See templates.h */
243 struct UtilsFuncs *p_utils; /**< See utils.h */
244 struct UIUtilsFuncs *p_ui; /**< See ui_utils.h */
245 /** @deprecated Use ui_lookup_widget() instead. */
246 struct SupportFuncs *p_support;
247 struct DialogFuncs *p_dialogs; /**< See dialogs.h */
248 /** @deprecated Use @ref GeanyFunctions::p_msgwin instead. */
249 struct MsgWinFuncs *p_msgwindow;
250 struct EncodingFuncs *p_encodings; /**< See encodings.h */
251 struct KeybindingFuncs *p_keybindings; /**< See keybindings.h */
252 struct TagManagerFuncs *p_tm; /**< See tagmanager/include */
253 struct SearchFuncs *p_search; /**< See search.h */
254 struct HighlightingFuncs *p_highlighting; /**< See highlighting.h */
255 struct FiletypeFuncs *p_filetypes; /**< See filetypes.h */
256 struct NavQueueFuncs *p_navqueue; /**< See navqueue.h */
257 struct EditorFuncs *p_editor; /**< See editor.h */
258 struct MainFuncs *p_main; /**< See main.h */
259 struct PluginFuncs *p_plugin; /**< See pluginutils.c */
260 struct ScintillaFuncs *p_scintilla; /**< See ScintillaFuncs */
261 struct MsgWinFuncs *p_msgwin; /**< See msgwindow.h */
262 struct StashFuncs *p_stash; /**< See stash.h */
263 struct SymbolsFuncs *p_symbols; /**< See symbols.h */
265 GeanyFunctions;
268 /* For more information about these functions, see the main source code.
269 * E.g. for p_document->new_file(), see document_new_file() in document.c. */
272 /* See document.h */
273 typedef struct DocumentFuncs
275 struct GeanyDocument* (*document_new_file) (const gchar *utf8_filename, struct GeanyFiletype *ft,
276 const gchar *text);
277 struct GeanyDocument* (*document_get_current) (void);
278 struct GeanyDocument* (*document_get_from_page) (guint page_num);
279 struct GeanyDocument* (*document_find_by_filename) (const gchar *utf8_filename);
280 struct GeanyDocument* (*document_find_by_real_path) (const gchar *realname);
281 gboolean (*document_save_file) (struct GeanyDocument *doc, gboolean force);
282 struct GeanyDocument* (*document_open_file) (const gchar *locale_filename, gboolean readonly,
283 struct GeanyFiletype *ft, const gchar *forced_enc);
284 void (*document_open_files) (const GSList *filenames, gboolean readonly,
285 struct GeanyFiletype *ft, const gchar *forced_enc);
286 gboolean (*document_remove_page) (guint page_num);
287 gboolean (*document_reload_file) (struct GeanyDocument *doc, const gchar *forced_enc);
288 void (*document_set_encoding) (struct GeanyDocument *doc, const gchar *new_encoding);
289 void (*document_set_text_changed) (struct GeanyDocument *doc, gboolean changed);
290 void (*document_set_filetype) (struct GeanyDocument *doc, struct GeanyFiletype *type);
291 gboolean (*document_close) (struct GeanyDocument *doc);
292 struct GeanyDocument* (*document_index)(gint idx);
293 gboolean (*document_save_file_as) (struct GeanyDocument *doc, const gchar *utf8_fname);
294 void (*document_rename_file) (struct GeanyDocument *doc, const gchar *new_filename);
295 const GdkColor* (*document_get_status_color) (struct GeanyDocument *doc);
296 gchar* (*document_get_basename_for_display) (struct GeanyDocument *doc, gint length);
297 gint (*document_get_notebook_page) (struct GeanyDocument *doc);
299 DocumentFuncs;
302 struct _ScintillaObject;
304 /** See http://scintilla.org for the full documentation. */
305 typedef struct ScintillaFuncs
307 /** Send Scintilla a message. */
308 long int (*scintilla_send_message) (struct _ScintillaObject* sci, unsigned int iMessage,
309 long unsigned int wParam, long int lParam);
310 /** Create a new ScintillaObject widget. */
311 GtkWidget* (*scintilla_new)(void);
313 ScintillaFuncs;
316 /** Wrapper functions for Scintilla messages.
317 * See sciwrappers.h for the list of functions. */
318 typedef struct SciFuncs
320 /** @deprecated Use @c scintilla_send_message() instead. */
321 long int (*sci_send_message) (struct _ScintillaObject *sci, unsigned int iMessage,
322 long unsigned int wParam, long int lParam);
323 void (*sci_send_command) (struct _ScintillaObject *sci, gint cmd);
325 void (*sci_start_undo_action) (struct _ScintillaObject *sci);
326 void (*sci_end_undo_action) (struct _ScintillaObject *sci);
327 void (*sci_set_text) (struct _ScintillaObject *sci, const gchar *text);
328 void (*sci_insert_text) (struct _ScintillaObject *sci, gint pos, const gchar *text);
329 void (*sci_get_text) (struct _ScintillaObject *sci, gint len, gchar *text);
330 gint (*sci_get_length) (struct _ScintillaObject *sci);
331 gint (*sci_get_current_position) (struct _ScintillaObject *sci);
332 void (*sci_set_current_position) (struct _ScintillaObject *sci, gint position,
333 gboolean scroll_to_caret);
334 gint (*sci_get_col_from_position) (struct _ScintillaObject *sci, gint position);
335 gint (*sci_get_line_from_position) (struct _ScintillaObject *sci, gint position);
336 gint (*sci_get_position_from_line) (struct _ScintillaObject *sci, gint line);
337 void (*sci_replace_sel) (struct _ScintillaObject *sci, const gchar *text);
338 void (*sci_get_selected_text) (struct _ScintillaObject *sci, gchar *text);
339 gint (*sci_get_selected_text_length) (struct _ScintillaObject *sci);
340 gint (*sci_get_selection_start) (struct _ScintillaObject *sci);
341 gint (*sci_get_selection_end) (struct _ScintillaObject *sci);
342 gint (*sci_get_selection_mode) (struct _ScintillaObject *sci);
343 void (*sci_set_selection_mode) (struct _ScintillaObject *sci, gint mode);
344 void (*sci_set_selection_start) (struct _ScintillaObject *sci, gint position);
345 void (*sci_set_selection_end) (struct _ScintillaObject *sci, gint position);
346 void (*sci_get_text_range) (struct _ScintillaObject *sci, gint start, gint end, gchar *text);
347 gchar* (*sci_get_line) (struct _ScintillaObject *sci, gint line_num);
348 gint (*sci_get_line_length) (struct _ScintillaObject *sci, gint line);
349 gint (*sci_get_line_count) (struct _ScintillaObject *sci);
350 gboolean (*sci_get_line_is_visible) (struct _ScintillaObject *sci, gint line);
351 void (*sci_ensure_line_is_visible) (struct _ScintillaObject *sci, gint line);
352 void (*sci_scroll_caret) (struct _ScintillaObject *sci);
353 gint (*sci_find_matching_brace) (struct _ScintillaObject *sci, gint pos);
354 gint (*sci_get_style_at) (struct _ScintillaObject *sci, gint position);
355 gchar (*sci_get_char_at) (struct _ScintillaObject *sci, gint pos);
356 gint (*sci_get_current_line) (struct _ScintillaObject *sci);
357 gboolean (*sci_has_selection) (struct _ScintillaObject *sci);
358 gint (*sci_get_tab_width) (struct _ScintillaObject *sci);
359 void (*sci_indicator_clear) (struct _ScintillaObject *sci, gint start, gint end);
360 void (*sci_indicator_set) (struct _ScintillaObject *sci, gint indic);
361 gchar* (*sci_get_contents) (struct _ScintillaObject *sci, gint len);
362 gchar* (*sci_get_contents_range) (struct _ScintillaObject *sci, gint start, gint end);
363 gchar* (*sci_get_selection_contents) (struct _ScintillaObject *sci);
364 void (*sci_set_font) (struct _ScintillaObject *sci, gint style, const gchar *font, gint size);
365 gint (*sci_get_line_end_position) (struct _ScintillaObject *sci, gint line);
366 void (*sci_set_target_start) (struct _ScintillaObject *sci, gint start);
367 void (*sci_set_target_end) (struct _ScintillaObject *sci, gint end);
368 gint (*sci_replace_target) (struct _ScintillaObject *sci, const gchar *text, gboolean regex);
369 void (*sci_set_marker_at_line) (struct _ScintillaObject *sci, gint line_number, gint marker);
370 void (*sci_delete_marker_at_line) (struct _ScintillaObject *sci, gint line_number, gint marker);
371 gboolean (*sci_is_marker_set_at_line) (struct _ScintillaObject *sci, gint line, gint marker);
372 void (*sci_goto_line) (struct _ScintillaObject *sci, gint line, gboolean unfold);
373 gint (*sci_find_text) (struct _ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf);
374 void (*sci_set_line_indentation) (struct _ScintillaObject *sci, gint line, gint indent);
375 gint (*sci_get_line_indentation) (struct _ScintillaObject *sci, gint line);
377 SciFuncs;
380 /* See templates.h */
381 typedef struct TemplateFuncs
383 gchar* (*templates_get_template_fileheader) (gint filetype_idx, const gchar *fname);
385 TemplateFuncs;
388 /* See utils.h */
389 typedef struct UtilsFuncs
391 gboolean (*utils_str_equal) (const gchar *a, const gchar *b);
392 guint (*utils_string_replace_all) (GString *haystack, const gchar *needle,
393 const gchar *replacement);
394 GSList* (*utils_get_file_list) (const gchar *path, guint *length, GError **error);
395 gint (*utils_write_file) (const gchar *filename, const gchar *text);
396 gchar* (*utils_get_locale_from_utf8) (const gchar *utf8_text);
397 gchar* (*utils_get_utf8_from_locale) (const gchar *locale_text);
398 gchar* (*utils_remove_ext_from_filename) (const gchar *filename);
399 gint (*utils_mkdir) (const gchar *path, gboolean create_parent_dirs);
400 gboolean (*utils_get_setting_boolean) (GKeyFile *config, const gchar *section, const gchar *key,
401 const gboolean default_value);
402 gint (*utils_get_setting_integer) (GKeyFile *config, const gchar *section, const gchar *key,
403 const gint default_value);
404 gchar* (*utils_get_setting_string) (GKeyFile *config, const gchar *section, const gchar *key,
405 const gchar *default_value);
406 gboolean (*utils_spawn_sync) (const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags,
407 GSpawnChildSetupFunc child_setup, gpointer user_data, gchar **std_out,
408 gchar **std_err, gint *exit_status, GError **error);
409 gboolean (*utils_spawn_async) (const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags,
410 GSpawnChildSetupFunc child_setup, gpointer user_data, GPid *child_pid,
411 GError **error);
412 gint (*utils_str_casecmp) (const gchar *s1, const gchar *s2);
413 gchar* (*utils_get_date_time) (const gchar *format, time_t *time_to_use);
414 void (*utils_open_browser) (const gchar *uri);
415 guint (*utils_string_replace_first) (GString *haystack, const gchar *needle,
416 const gchar *replace);
417 gchar* (*utils_str_middle_truncate) (const gchar *string, guint truncate_length);
418 gchar* (*utils_str_remove_chars) (gchar *string, const gchar *chars);
419 GSList* (*utils_get_file_list_full)(const gchar *path, gboolean full_path, gboolean sort,
420 GError **error);
421 gchar** (*utils_copy_environment)(const gchar **exclude_vars, const gchar *first_varname, ...);
424 UtilsFuncs;
427 /* See main.h */
428 typedef struct MainFuncs
430 void (*main_reload_configuration) (void);
431 void (*main_locale_init) (const gchar *locale_dir, const gchar *package);
432 gboolean (*main_is_realized) (void);
434 MainFuncs;
437 /* See ui_utils.h */
438 typedef struct UIUtilsFuncs
440 GtkWidget* (*ui_dialog_vbox_new) (GtkDialog *dialog);
441 GtkWidget* (*ui_frame_new_with_alignment) (const gchar *label_text, GtkWidget **alignment);
442 void (*ui_set_statusbar) (gboolean log, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
443 void (*ui_table_add_row) (GtkTable *table, gint row, ...) G_GNUC_NULL_TERMINATED;
444 GtkWidget* (*ui_path_box_new) (const gchar *title, GtkFileChooserAction action, GtkEntry *entry);
445 GtkWidget* (*ui_button_new_with_image) (const gchar *stock_id, const gchar *text);
446 void (*ui_add_document_sensitive) (GtkWidget *widget);
447 void (*ui_widget_set_tooltip_text) (GtkWidget *widget, const gchar *text);
448 GtkWidget* (*ui_image_menu_item_new) (const gchar *stock_id, const gchar *label);
449 GtkWidget* (*ui_lookup_widget) (GtkWidget *widget, const gchar *widget_name);
450 void (*ui_progress_bar_start) (const gchar *text);
451 void (*ui_progress_bar_stop) (void);
452 void (*ui_entry_add_clear_icon) (GtkEntry *entry);
453 void (*ui_menu_add_document_items) (GtkMenu *menu, struct GeanyDocument *active,
454 GCallback callback);
455 void (*ui_widget_modify_font_from_string) (GtkWidget *widget, const gchar *str);
456 gboolean (*ui_is_keyval_enter_or_return) (guint keyval);
457 gint (*ui_get_gtk_settings_integer) (const gchar *property_name, gint default_value);
459 UIUtilsFuncs;
462 /* See dialogs.h */
463 typedef struct DialogFuncs
465 gboolean (*dialogs_show_question) (const gchar *text, ...) G_GNUC_PRINTF (1, 2);
466 void (*dialogs_show_msgbox) (GtkMessageType type, const gchar *text, ...) G_GNUC_PRINTF (2, 3);
467 gboolean (*dialogs_show_save_as) (void);
468 gboolean (*dialogs_show_input_numeric) (const gchar *title, const gchar *label_text,
469 gdouble *value, gdouble min, gdouble max, gdouble step);
471 DialogFuncs;
474 /* @deprecated Use ui_lookup_widget() instead. */
475 typedef struct SupportFuncs
477 GtkWidget* (*support_lookup_widget) (GtkWidget *widget, const gchar *widget_name);
479 SupportFuncs;
482 /* See msgwindow.h */
483 typedef struct MsgWinFuncs
485 /* status_add() does not set the status bar - use ui->set_statusbar() instead. */
486 void (*msgwin_status_add) (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
487 void (*msgwin_compiler_add) (gint msg_color, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
488 void (*msgwin_msg_add) (gint msg_color, gint line, struct GeanyDocument *doc,
489 const gchar *format, ...) G_GNUC_PRINTF (4, 5);
490 void (*msgwin_clear_tab) (gint tabnum);
491 void (*msgwin_switch_tab) (gint tabnum, gboolean show);
493 MsgWinFuncs;
496 /* See encodings.h */
497 typedef struct EncodingFuncs
499 gchar* (*encodings_convert_to_utf8) (const gchar *buffer, gsize size, gchar **used_encoding);
500 gchar* (*encodings_convert_to_utf8_from_charset) (const gchar *buffer, gsize size,
501 const gchar *charset, gboolean fast);
502 const gchar* (*encodings_get_charset_from_index) (gint idx);
504 EncodingFuncs;
507 struct GeanyKeyGroup;
508 /* avoid including keybindings.h */
509 typedef void (*_GeanyKeyCallback) (guint key_id);
511 /* See keybindings.h */
512 typedef struct KeybindingFuncs
514 void (*keybindings_send_command) (guint group_id, guint key_id);
515 struct GeanyKeyBinding* (*keybindings_set_item) (struct GeanyKeyGroup *group, gsize key_id,
516 _GeanyKeyCallback callback, guint key, GdkModifierType mod,
517 const gchar *name, const gchar *label, GtkWidget *menu_item);
518 struct GeanyKeyBinding* (*keybindings_get_item)(struct GeanyKeyGroup *group, gsize key_id);
521 KeybindingFuncs;
524 /* See highlighting.h */
525 typedef struct HighlightingFuncs
527 const struct GeanyLexerStyle* (*highlighting_get_style) (gint ft_id, gint style_id);
528 void (*highlighting_set_styles) (struct _ScintillaObject *sci, struct GeanyFiletype *ft);
530 HighlightingFuncs;
533 /* See filetypes.h */
534 typedef struct FiletypeFuncs
536 GeanyFiletype* (*filetypes_detect_from_file) (const gchar *utf8_filename);
537 GeanyFiletype* (*filetypes_lookup_by_name) (const gchar *name);
538 GeanyFiletype* (*filetypes_index)(gint idx);
539 /* Remember to convert any filetype_id arguments to GeanyFiletype pointers in any
540 * appended functions */
542 FiletypeFuncs;
545 /* See search.h */
546 typedef struct SearchFuncs
548 void (*search_show_find_in_files_dialog) (const gchar *dir);
550 SearchFuncs;
553 /* See tagmanager/include */
554 typedef struct TagManagerFuncs
556 gchar* (*tm_get_real_path) (const gchar *file_name);
557 TMWorkObject* (*tm_source_file_new) (const char *file_name, gboolean update, const char *name);
558 gboolean (*tm_workspace_add_object) (TMWorkObject *work_object);
559 gboolean (*tm_source_file_update) (TMWorkObject *source_file, gboolean force,
560 gboolean recurse, gboolean update_parent);
561 void (*tm_work_object_free) (gpointer work_object);
562 gboolean (*tm_workspace_remove_object) (TMWorkObject *w, gboolean do_free, gboolean update);
564 TagManagerFuncs;
567 /* See navqueue.h */
568 typedef struct NavQueueFuncs
570 gboolean (*navqueue_goto_line) (struct GeanyDocument *old_doc, struct GeanyDocument *new_doc,
571 gint line);
573 NavQueueFuncs;
576 struct GeanyEditor;
578 /* See editor.h */
579 typedef struct EditorFuncs
581 const struct GeanyIndentPrefs* (*editor_get_indent_prefs)(struct GeanyEditor *editor);
582 struct _ScintillaObject* (*editor_create_widget)(struct GeanyEditor *editor);
584 void (*editor_indicator_set_on_range) (struct GeanyEditor *editor, gint indic, gint start, gint end);
585 void (*editor_indicator_set_on_line) (struct GeanyEditor *editor, gint indic, gint line);
586 void (*editor_indicator_clear) (struct GeanyEditor *editor, gint indic);
588 void (*editor_set_indent_type)(struct GeanyEditor *editor, GeanyIndentType type);
589 gchar* (*editor_get_word_at_pos) (struct GeanyEditor *editor, gint pos, const gchar *wordchars);
591 const gchar* (*editor_get_eol_char_name) (struct GeanyEditor *editor);
592 gint (*editor_get_eol_char_len) (struct GeanyEditor *editor);
593 const gchar* (*editor_get_eol_char) (struct GeanyEditor *editor);
595 void (*editor_insert_text_block) (struct GeanyEditor *editor, const gchar *text,
596 gint insert_pos, gint cursor_index, gint newline_indent_size,
597 gboolean replace_newlines);
599 EditorFuncs;
602 /* avoid including keybindings.h */
603 typedef gboolean (*_GeanyKeyGroupCallback) (guint key_id);
605 /* See pluginutils.c */
606 typedef struct PluginFuncs
608 void (*plugin_add_toolbar_item)(GeanyPlugin *plugin, GtkToolItem *item);
609 void (*plugin_module_make_resident) (GeanyPlugin *plugin);
610 void (*plugin_signal_connect) (GeanyPlugin *plugin,
611 GObject *object, const gchar *signal_name, gboolean after,
612 GCallback callback, gpointer user_data);
613 struct GeanyKeyGroup* (*plugin_set_key_group)(GeanyPlugin *plugin,
614 const gchar *section_name, gsize count, _GeanyKeyGroupCallback callback);
615 void (*plugin_show_configure)(GeanyPlugin *plugin);
617 PluginFuncs;
620 struct StashGroup;
622 /* See stash.h */
623 typedef struct StashFuncs
625 struct StashGroup *(*stash_group_new)(const gchar *name);
626 void (*stash_group_add_boolean)(struct StashGroup *group, gboolean *setting,
627 const gchar *key_name, gboolean default_value);
628 void (*stash_group_add_integer)(struct StashGroup *group, gint *setting,
629 const gchar *key_name, gint default_value);
630 void (*stash_group_add_string)(struct StashGroup *group, gchar **setting,
631 const gchar *key_name, const gchar *default_value);
632 void (*stash_group_add_string_vector)(struct StashGroup *group, gchar ***setting,
633 const gchar *key_name, const gchar **default_value);
634 void (*stash_group_load_from_key_file)(struct StashGroup *group, GKeyFile *keyfile);
635 void (*stash_group_save_to_key_file)(struct StashGroup *group, GKeyFile *keyfile);
636 void (*stash_group_free)(struct StashGroup *group);
637 gboolean (*stash_group_load_from_file)(struct StashGroup *group, const gchar *filename);
638 gint (*stash_group_save_to_file)(struct StashGroup *group, const gchar *filename,
639 GKeyFileFlags flags);
640 void (*stash_group_add_toggle_button)(struct StashGroup *group, gboolean *setting,
641 const gchar *key_name, gboolean default_value, gpointer widget_id);
642 void (*stash_group_add_radio_buttons)(struct StashGroup *group, gint *setting,
643 const gchar *key_name, gint default_value,
644 gpointer widget_id, gint enum_id, ...) G_GNUC_NULL_TERMINATED;
645 void (*stash_group_add_spin_button_integer)(struct StashGroup *group, gint *setting,
646 const gchar *key_name, gint default_value, gpointer widget_id);
647 void (*stash_group_add_combo_box)(struct StashGroup *group, gint *setting,
648 const gchar *key_name, gint default_value, gpointer widget_id);
649 void (*stash_group_add_combo_box_entry)(struct StashGroup *group, gchar **setting,
650 const gchar *key_name, const gchar *default_value, gpointer widget_id);
651 void (*stash_group_add_entry)(struct StashGroup *group, gchar **setting,
652 const gchar *key_name, const gchar *default_value, gpointer widget_id);
653 void (*stash_group_add_widget_property)(struct StashGroup *group, gpointer setting,
654 const gchar *key_name, gpointer default_value, gpointer widget_id,
655 const gchar *property_name, GType type);
656 void (*stash_group_display)(struct StashGroup *group, GtkWidget *owner);
657 void (*stash_group_update)(struct StashGroup *group, GtkWidget *owner);
659 StashFuncs;
662 /* See symbols.h */
663 typedef struct SymbolsFuncs
665 const gchar* (*symbols_get_context_separator)(gint ft_id);
667 SymbolsFuncs;
670 /* Deprecated aliases */
671 #ifndef GEANY_DISABLE_DEPRECATED
673 /** @deprecated - copy into your plugin code if needed.
674 * @c NULL-safe way to get the index of @a doc_ptr in the documents array. */
675 #define DOC_IDX(doc_ptr) \
676 (doc_ptr ? doc_ptr->index : -1)
677 #define DOC_IDX_VALID(doc_idx) \
678 ((doc_idx) >= 0 && (guint)(doc_idx) < documents_array->len && documents[doc_idx]->is_valid)
680 #define GEANY_WINDOW_MINIMAL_WIDTH 550
681 #define GEANY_WINDOW_MINIMAL_HEIGHT GEANY_DEFAULT_DIALOG_HEIGHT
683 #endif /* GEANY_DISABLE_DEPRECATED */
685 #endif