If the current word's tag is on the current line, make Go to Tag
[geany-mirror.git] / src / plugindata.h
blob89c45d938fd085f40dd075c2f5e4438c167bed5e
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 /** The Application Programming Interface (API) version, incremented
47 * whenever any plugin data types are modified or appended to.
49 * You can protect code that needs a higher API than e.g. 200 with:
50 * @code #if GEANY_API_VERSION >= 200
51 * some_newer_function();
52 * #endif @endcode
54 * @warning You should not test for values below 200 as previously
55 * @c GEANY_API_VERSION was defined as an enum value, not a macro.
57 #define GEANY_API_VERSION 200
59 /** The Application Binary Interface (ABI) version, incremented whenever
60 * existing fields in the plugin data types have to be changed or reordered.
61 * Changing this forces all plugins to be recompiled before Geany can load them. */
62 /* This should usually stay the same if fields are only appended, assuming only pointers to
63 * structs and not structs themselves are declared by plugins. */
64 #define GEANY_ABI_VERSION 68
67 /** Defines a function to check the plugin is safe to load.
68 * This performs runtime checks that try to ensure:
69 * - Geany ABI data types are compatible with this plugin.
70 * - Geany sources provide the required API for this plugin.
71 * @param api_required The minimum API number your plugin requires.
72 * Look at the source for the value of @c GEANY_API_VERSION to use if you
73 * want your plugin to require the current Geany version on your machine.
74 * You should update this value when using any new API features. */
75 #define PLUGIN_VERSION_CHECK(api_required) \
76 gint plugin_version_check(gint abi_ver) \
77 { \
78 if (abi_ver != GEANY_ABI_VERSION) \
79 return -1; \
80 return (api_required); \
84 /** Basic information about a plugin available to Geany without loading the plugin.
85 * The fields are set in plugin_set_info(), usually with the PLUGIN_SET_INFO() macro. */
86 typedef struct PluginInfo
88 /** The name of the plugin. */
89 const gchar *name;
90 /** The description of the plugin. */
91 const gchar *description;
92 /** The version of the plugin. */
93 const gchar *version;
94 /** The author of the plugin. */
95 const gchar *author;
97 PluginInfo;
100 /** Basic information for the plugin and identification.
101 * @see geany_plugin. */
102 typedef struct GeanyPlugin
104 PluginInfo *info; /**< Fields set in plugin_set_info(). */
106 struct GeanyPluginPrivate *priv; /* private */
108 GeanyPlugin;
111 /** Sets the plugin name and some other basic information about a plugin.
113 * @note If you want some of the arguments to be translated, see @ref PLUGIN_SET_TRANSLATABLE_INFO()
115 * Example:
116 * @code PLUGIN_SET_INFO("Cool Feature", "Adds cool feature support.", "0.1", "Joe Author") @endcode */
117 /* plugin_set_info() could be written manually for plugins if we want to add any
118 * extra PluginInfo features (such as an icon), so we don't need to break API
119 * compatibility. Alternatively just add a new macro, PLUGIN_SET_INFO_FULL(). -ntrel */
120 #define PLUGIN_SET_INFO(p_name, p_description, p_version, p_author) \
121 void plugin_set_info(PluginInfo *info) \
123 info->name = (p_name); \
124 info->description = (p_description); \
125 info->version = (p_version); \
126 info->author = (p_author); \
129 /** Sets the plugin name and some other basic information about a plugin.
130 * This macro is like @ref PLUGIN_SET_INFO() but allows the passed information to be translated
131 * by setting up the translation mechanism with @ref main_locale_init().
132 * You therefore don't need to call it manually in plugin_init().
134 * Example:
135 * @code PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE, _("Cool Feature"), _("Adds a cool feature."), "0.1", "John Doe") @endcode
137 * @since 0.19 */
138 #define PLUGIN_SET_TRANSLATABLE_INFO(localedir, package, p_name, p_description, p_version, p_author) \
139 void plugin_set_info(PluginInfo *info) \
141 main_locale_init((localedir), (package)); \
142 info->name = (p_name); \
143 info->description = (p_description); \
144 info->version = (p_version); \
145 info->author = (p_author); \
149 #ifndef GEANY_PRIVATE
151 /* Prototypes for building plugins with -Wmissing-prototypes */
152 gint plugin_version_check(gint abi_ver);
153 void plugin_set_info(PluginInfo *info);
155 #endif
158 /** @deprecated - use plugin_set_key_group() instead.
159 * @see PLUGIN_KEY_GROUP() macro. */
160 typedef struct GeanyKeyGroupInfo
162 const gchar *name; /**< Group name used in the configuration file, such as @c "html_chars" */
163 gsize count; /**< The number of keybindings the group will hold */
165 GeanyKeyGroupInfo;
167 /** @deprecated - use plugin_set_key_group() instead.
168 * Declare and initialise a keybinding group.
169 * @code GeanyKeyGroup *plugin_key_group; @endcode
170 * You must then set the @c plugin_key_group::keys[] entries for the group in plugin_init(),
171 * normally using keybindings_set_item().
172 * The @c plugin_key_group::label field is set by Geany after @c plugin_init()
173 * is called, to the name of the plugin.
174 * @param group_name A unique group name (without quotes) to be used in the
175 * configuration file, such as @c html_chars.
176 * @param key_count The number of keybindings the group will hold. */
177 #define PLUGIN_KEY_GROUP(group_name, key_count) \
178 /* We have to declare this as a single element array.
179 * Declaring as a pointer to a struct doesn't work with g_module_symbol(). */ \
180 GeanyKeyGroupInfo plugin_key_group_info[1] = \
182 {G_STRINGIFY(group_name), key_count} \
184 GeanyKeyGroup *plugin_key_group = NULL;
187 /** Callback array entry type used with the @ref plugin_callbacks symbol. */
188 typedef struct PluginCallback
190 /** The name of signal, must be an existing signal. For a list of available signals,
191 * please see the @link pluginsignals.c Signal documentation @endlink. */
192 const gchar *signal_name;
193 /** A callback function which is called when the signal is emitted. */
194 GCallback callback;
195 /** Set to TRUE to connect your handler with g_signal_connect_after(). */
196 gboolean after;
197 /** The user data passed to the signal handler. */
198 gpointer user_data;
200 PluginCallback;
203 /** @deprecated Use @ref ui_add_document_sensitive() instead.
204 * Flags to be set by plugins in PluginFields struct. */
205 typedef enum
207 /** Whether a plugin's menu item should be disabled when there are no open documents */
208 PLUGIN_IS_DOCUMENT_SENSITIVE = 1 << 0
210 PluginFlags;
212 /** @deprecated Use @ref ui_add_document_sensitive() instead.
213 * Fields set and owned by the plugin. */
214 typedef struct PluginFields
216 /** Bitmask of @c PluginFlags. */
217 PluginFlags flags;
218 /** Pointer to a plugin's menu item which will be automatically enabled/disabled when there
219 * are no open documents and @c PLUGIN_IS_DOCUMENT_SENSITIVE is set.
220 * This is required if using @c PLUGIN_IS_DOCUMENT_SENSITIVE, ignored otherwise */
221 GtkWidget *menu_item;
223 PluginFields;
226 /** This contains pointers to global variables owned by Geany for plugins to use.
227 * Core variable pointers can be appended when needed by plugin authors, if appropriate. */
228 typedef struct GeanyData
230 struct GeanyApp *app; /**< Geany application data fields */
231 struct GeanyMainWidgets *main_widgets; /**< Important widgets in the main window */
232 GPtrArray *documents_array; /**< See document.h#documents_array. */
233 GPtrArray *filetypes_array; /**< Dynamic array of GeanyFiletype pointers */
234 struct GeanyPrefs *prefs; /**< General settings */
235 struct GeanyInterfacePrefs *interface_prefs; /**< Interface settings */
236 struct GeanyToolbarPrefs *toolbar_prefs; /**< Toolbar settings */
237 struct GeanyEditorPrefs *editor_prefs; /**< Editor settings */
238 struct GeanyFilePrefs *file_prefs; /**< File-related settings */
239 struct GeanySearchPrefs *search_prefs; /**< Search-related settings */
240 struct GeanyToolPrefs *tool_prefs; /**< Tool settings */
241 struct GeanyTemplatePrefs *template_prefs; /**< Template settings */
242 struct GeanyBuildInfo *build_info; /**< Current build information */
243 GSList *filetypes_by_title; /**< See filetypes.h#filetypes_by_title. */
245 GeanyData;
247 #define geany geany_data /**< Simple macro for @c geany_data that reduces typing. */
250 /** This contains pointers to functions owned by Geany for plugins to use.
251 * Functions from the core can be appended when needed by plugin authors, but may
252 * require some changes. */
253 typedef struct GeanyFunctions
255 struct DocumentFuncs *p_document; /**< See document.h */
256 struct SciFuncs *p_sci; /**< See sciwrappers.h */
257 struct TemplateFuncs *p_templates; /**< See templates.h */
258 struct UtilsFuncs *p_utils; /**< See utils.h */
259 struct UIUtilsFuncs *p_ui; /**< See ui_utils.h */
260 /** @deprecated Use ui_lookup_widget() instead. */
261 struct SupportFuncs *p_support;
262 struct DialogFuncs *p_dialogs; /**< See dialogs.h */
263 /** @deprecated Use @ref GeanyFunctions::p_msgwin instead. */
264 struct MsgWinFuncs *p_msgwindow;
265 struct EncodingFuncs *p_encodings; /**< See encodings.h */
266 struct KeybindingFuncs *p_keybindings; /**< See keybindings.h */
267 struct TagManagerFuncs *p_tm; /**< See tagmanager/include */
268 struct SearchFuncs *p_search; /**< See search.h */
269 struct HighlightingFuncs *p_highlighting; /**< See highlighting.h */
270 struct FiletypeFuncs *p_filetypes; /**< See filetypes.h */
271 struct NavQueueFuncs *p_navqueue; /**< See navqueue.h */
272 struct EditorFuncs *p_editor; /**< See editor.h */
273 struct MainFuncs *p_main; /**< See main.h */
274 struct PluginFuncs *p_plugin; /**< See pluginutils.c */
275 struct ScintillaFuncs *p_scintilla; /**< See ScintillaFuncs */
276 struct MsgWinFuncs *p_msgwin; /**< See msgwindow.h */
277 struct StashFuncs *p_stash; /**< See stash.h */
278 struct SymbolsFuncs *p_symbols; /**< See symbols.h */
280 GeanyFunctions;
283 /* For more information about these functions, see the main source code.
284 * E.g. for p_document->new_file(), see document_new_file() in document.c. */
287 /* See document.h */
288 typedef struct DocumentFuncs
290 struct GeanyDocument* (*document_new_file) (const gchar *utf8_filename, struct GeanyFiletype *ft,
291 const gchar *text);
292 struct GeanyDocument* (*document_get_current) (void);
293 struct GeanyDocument* (*document_get_from_page) (guint page_num);
294 struct GeanyDocument* (*document_find_by_filename) (const gchar *utf8_filename);
295 struct GeanyDocument* (*document_find_by_real_path) (const gchar *realname);
296 gboolean (*document_save_file) (struct GeanyDocument *doc, gboolean force);
297 struct GeanyDocument* (*document_open_file) (const gchar *locale_filename, gboolean readonly,
298 struct GeanyFiletype *ft, const gchar *forced_enc);
299 void (*document_open_files) (const GSList *filenames, gboolean readonly,
300 struct GeanyFiletype *ft, const gchar *forced_enc);
301 gboolean (*document_remove_page) (guint page_num);
302 gboolean (*document_reload_file) (struct GeanyDocument *doc, const gchar *forced_enc);
303 void (*document_set_encoding) (struct GeanyDocument *doc, const gchar *new_encoding);
304 void (*document_set_text_changed) (struct GeanyDocument *doc, gboolean changed);
305 void (*document_set_filetype) (struct GeanyDocument *doc, struct GeanyFiletype *type);
306 gboolean (*document_close) (struct GeanyDocument *doc);
307 struct GeanyDocument* (*document_index)(gint idx);
308 gboolean (*document_save_file_as) (struct GeanyDocument *doc, const gchar *utf8_fname);
309 void (*document_rename_file) (struct GeanyDocument *doc, const gchar *new_filename);
310 const GdkColor* (*document_get_status_color) (struct GeanyDocument *doc);
311 gchar* (*document_get_basename_for_display) (struct GeanyDocument *doc, gint length);
312 gint (*document_get_notebook_page) (struct GeanyDocument *doc);
314 DocumentFuncs;
317 struct _ScintillaObject;
319 /** See http://scintilla.org for the full documentation. */
320 typedef struct ScintillaFuncs
322 /** Send Scintilla a message. */
323 long int (*scintilla_send_message) (struct _ScintillaObject *sci, unsigned int iMessage,
324 long unsigned int wParam, long int lParam);
325 /** Create a new ScintillaObject widget. */
326 GtkWidget* (*scintilla_new)(void);
328 ScintillaFuncs;
331 /** Wrapper functions for Scintilla messages.
332 * See sciwrappers.h for the list of functions. */
333 typedef struct SciFuncs
335 /** @deprecated Use @c scintilla_send_message() instead. */
336 long int (*sci_send_message) (struct _ScintillaObject *sci, unsigned int iMessage,
337 long unsigned int wParam, long int lParam);
338 void (*sci_send_command) (struct _ScintillaObject *sci, gint cmd);
340 void (*sci_start_undo_action) (struct _ScintillaObject *sci);
341 void (*sci_end_undo_action) (struct _ScintillaObject *sci);
342 void (*sci_set_text) (struct _ScintillaObject *sci, const gchar *text);
343 void (*sci_insert_text) (struct _ScintillaObject *sci, gint pos, const gchar *text);
344 void (*sci_get_text) (struct _ScintillaObject *sci, gint len, gchar *text);
345 gint (*sci_get_length) (struct _ScintillaObject *sci);
346 gint (*sci_get_current_position) (struct _ScintillaObject *sci);
347 void (*sci_set_current_position) (struct _ScintillaObject *sci, gint position,
348 gboolean scroll_to_caret);
349 gint (*sci_get_col_from_position) (struct _ScintillaObject *sci, gint position);
350 gint (*sci_get_line_from_position) (struct _ScintillaObject *sci, gint position);
351 gint (*sci_get_position_from_line) (struct _ScintillaObject *sci, gint line);
352 void (*sci_replace_sel) (struct _ScintillaObject *sci, const gchar *text);
353 void (*sci_get_selected_text) (struct _ScintillaObject *sci, gchar *text);
354 gint (*sci_get_selected_text_length) (struct _ScintillaObject *sci);
355 gint (*sci_get_selection_start) (struct _ScintillaObject *sci);
356 gint (*sci_get_selection_end) (struct _ScintillaObject *sci);
357 gint (*sci_get_selection_mode) (struct _ScintillaObject *sci);
358 void (*sci_set_selection_mode) (struct _ScintillaObject *sci, gint mode);
359 void (*sci_set_selection_start) (struct _ScintillaObject *sci, gint position);
360 void (*sci_set_selection_end) (struct _ScintillaObject *sci, gint position);
361 void (*sci_get_text_range) (struct _ScintillaObject *sci, gint start, gint end, gchar *text);
362 gchar* (*sci_get_line) (struct _ScintillaObject *sci, gint line_num);
363 gint (*sci_get_line_length) (struct _ScintillaObject *sci, gint line);
364 gint (*sci_get_line_count) (struct _ScintillaObject *sci);
365 gboolean (*sci_get_line_is_visible) (struct _ScintillaObject *sci, gint line);
366 void (*sci_ensure_line_is_visible) (struct _ScintillaObject *sci, gint line);
367 void (*sci_scroll_caret) (struct _ScintillaObject *sci);
368 gint (*sci_find_matching_brace) (struct _ScintillaObject *sci, gint pos);
369 gint (*sci_get_style_at) (struct _ScintillaObject *sci, gint position);
370 gchar (*sci_get_char_at) (struct _ScintillaObject *sci, gint pos);
371 gint (*sci_get_current_line) (struct _ScintillaObject *sci);
372 gboolean (*sci_has_selection) (struct _ScintillaObject *sci);
373 gint (*sci_get_tab_width) (struct _ScintillaObject *sci);
374 void (*sci_indicator_clear) (struct _ScintillaObject *sci, gint start, gint end);
375 void (*sci_indicator_set) (struct _ScintillaObject *sci, gint indic);
376 gchar* (*sci_get_contents) (struct _ScintillaObject *sci, gint len);
377 gchar* (*sci_get_contents_range) (struct _ScintillaObject *sci, gint start, gint end);
378 gchar* (*sci_get_selection_contents) (struct _ScintillaObject *sci);
379 void (*sci_set_font) (struct _ScintillaObject *sci, gint style, const gchar *font, gint size);
380 gint (*sci_get_line_end_position) (struct _ScintillaObject *sci, gint line);
381 void (*sci_set_target_start) (struct _ScintillaObject *sci, gint start);
382 void (*sci_set_target_end) (struct _ScintillaObject *sci, gint end);
383 gint (*sci_replace_target) (struct _ScintillaObject *sci, const gchar *text, gboolean regex);
384 void (*sci_set_marker_at_line) (struct _ScintillaObject *sci, gint line_number, gint marker);
385 void (*sci_delete_marker_at_line) (struct _ScintillaObject *sci, gint line_number, gint marker);
386 gboolean (*sci_is_marker_set_at_line) (struct _ScintillaObject *sci, gint line, gint marker);
387 void (*sci_goto_line) (struct _ScintillaObject *sci, gint line, gboolean unfold);
388 gint (*sci_find_text) (struct _ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf);
389 void (*sci_set_line_indentation) (struct _ScintillaObject *sci, gint line, gint indent);
390 gint (*sci_get_line_indentation) (struct _ScintillaObject *sci, gint line);
391 gint (*sci_get_lexer) (struct _ScintillaObject *sci);
393 SciFuncs;
396 /* See templates.h */
397 typedef struct TemplateFuncs
399 gchar* (*templates_get_template_fileheader) (gint filetype_idx, const gchar *fname);
401 TemplateFuncs;
404 /* See utils.h */
405 typedef struct UtilsFuncs
407 gboolean (*utils_str_equal) (const gchar *a, const gchar *b);
408 guint (*utils_string_replace_all) (GString *haystack, const gchar *needle,
409 const gchar *replacement);
410 GSList* (*utils_get_file_list) (const gchar *path, guint *length, GError **error);
411 gint (*utils_write_file) (const gchar *filename, const gchar *text);
412 gchar* (*utils_get_locale_from_utf8) (const gchar *utf8_text);
413 gchar* (*utils_get_utf8_from_locale) (const gchar *locale_text);
414 gchar* (*utils_remove_ext_from_filename) (const gchar *filename);
415 gint (*utils_mkdir) (const gchar *path, gboolean create_parent_dirs);
416 gboolean (*utils_get_setting_boolean) (GKeyFile *config, const gchar *section, const gchar *key,
417 const gboolean default_value);
418 gint (*utils_get_setting_integer) (GKeyFile *config, const gchar *section, const gchar *key,
419 const gint default_value);
420 gchar* (*utils_get_setting_string) (GKeyFile *config, const gchar *section, const gchar *key,
421 const gchar *default_value);
422 gboolean (*utils_spawn_sync) (const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags,
423 GSpawnChildSetupFunc child_setup, gpointer user_data, gchar **std_out,
424 gchar **std_err, gint *exit_status, GError **error);
425 gboolean (*utils_spawn_async) (const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags,
426 GSpawnChildSetupFunc child_setup, gpointer user_data, GPid *child_pid,
427 GError **error);
428 gint (*utils_str_casecmp) (const gchar *s1, const gchar *s2);
429 gchar* (*utils_get_date_time) (const gchar *format, time_t *time_to_use);
430 void (*utils_open_browser) (const gchar *uri);
431 guint (*utils_string_replace_first) (GString *haystack, const gchar *needle,
432 const gchar *replace);
433 gchar* (*utils_str_middle_truncate) (const gchar *string, guint truncate_length);
434 gchar* (*utils_str_remove_chars) (gchar *string, const gchar *chars);
435 GSList* (*utils_get_file_list_full)(const gchar *path, gboolean full_path, gboolean sort,
436 GError **error);
437 gchar** (*utils_copy_environment)(const gchar **exclude_vars, const gchar *first_varname, ...);
438 gchar* (*utils_find_open_xml_tag) (const gchar sel[], gint size);
440 UtilsFuncs;
443 /* See main.h */
444 typedef struct MainFuncs
446 void (*main_reload_configuration) (void);
447 void (*main_locale_init) (const gchar *locale_dir, const gchar *package);
448 gboolean (*main_is_realized) (void);
450 MainFuncs;
453 /* See ui_utils.h */
454 typedef struct UIUtilsFuncs
456 GtkWidget* (*ui_dialog_vbox_new) (GtkDialog *dialog);
457 GtkWidget* (*ui_frame_new_with_alignment) (const gchar *label_text, GtkWidget **alignment);
458 void (*ui_set_statusbar) (gboolean log, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
459 void (*ui_table_add_row) (GtkTable *table, gint row, ...) G_GNUC_NULL_TERMINATED;
460 GtkWidget* (*ui_path_box_new) (const gchar *title, GtkFileChooserAction action, GtkEntry *entry);
461 GtkWidget* (*ui_button_new_with_image) (const gchar *stock_id, const gchar *text);
462 void (*ui_add_document_sensitive) (GtkWidget *widget);
463 void (*ui_widget_set_tooltip_text) (GtkWidget *widget, const gchar *text);
464 GtkWidget* (*ui_image_menu_item_new) (const gchar *stock_id, const gchar *label);
465 GtkWidget* (*ui_lookup_widget) (GtkWidget *widget, const gchar *widget_name);
466 void (*ui_progress_bar_start) (const gchar *text);
467 void (*ui_progress_bar_stop) (void);
468 void (*ui_entry_add_clear_icon) (GtkEntry *entry);
469 void (*ui_menu_add_document_items) (GtkMenu *menu, struct GeanyDocument *active,
470 GCallback callback);
471 void (*ui_widget_modify_font_from_string) (GtkWidget *widget, const gchar *str);
472 gboolean (*ui_is_keyval_enter_or_return) (guint keyval);
473 gint (*ui_get_gtk_settings_integer) (const gchar *property_name, gint default_value);
474 void (*ui_combo_box_add_to_history) (GtkComboBoxEntry *combo_entry,
475 const gchar *text, gint history_len);
477 UIUtilsFuncs;
480 /* See dialogs.h */
481 typedef struct DialogFuncs
483 gboolean (*dialogs_show_question) (const gchar *text, ...) G_GNUC_PRINTF (1, 2);
484 void (*dialogs_show_msgbox) (GtkMessageType type, const gchar *text, ...) G_GNUC_PRINTF (2, 3);
485 gboolean (*dialogs_show_save_as) (void);
486 gboolean (*dialogs_show_input_numeric) (const gchar *title, const gchar *label_text,
487 gdouble *value, gdouble min, gdouble max, gdouble step);
488 gchar* (*dialogs_show_input)(const gchar *title, GtkWindow *parent, const gchar *label_text,
489 const gchar *default_text);
491 DialogFuncs;
494 /* @deprecated Use ui_lookup_widget() instead. */
495 typedef struct SupportFuncs
497 GtkWidget* (*support_lookup_widget) (GtkWidget *widget, const gchar *widget_name);
499 SupportFuncs;
502 /* See msgwindow.h */
503 typedef struct MsgWinFuncs
505 /* status_add() does not set the status bar - use ui->set_statusbar() instead. */
506 void (*msgwin_status_add) (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
507 void (*msgwin_compiler_add) (gint msg_color, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
508 void (*msgwin_msg_add) (gint msg_color, gint line, struct GeanyDocument *doc,
509 const gchar *format, ...) G_GNUC_PRINTF (4, 5);
510 void (*msgwin_clear_tab) (gint tabnum);
511 void (*msgwin_switch_tab) (gint tabnum, gboolean show);
512 void (*msgwin_set_messages_dir) (const gchar *messages_dir);
514 MsgWinFuncs;
517 /* See encodings.h */
518 typedef struct EncodingFuncs
520 gchar* (*encodings_convert_to_utf8) (const gchar *buffer, gsize size, gchar **used_encoding);
521 gchar* (*encodings_convert_to_utf8_from_charset) (const gchar *buffer, gsize size,
522 const gchar *charset, gboolean fast);
523 const gchar* (*encodings_get_charset_from_index) (gint idx);
525 EncodingFuncs;
528 struct GeanyKeyGroup;
529 /* avoid including keybindings.h */
530 typedef void (*_GeanyKeyCallback) (guint key_id);
532 /* See keybindings.h */
533 typedef struct KeybindingFuncs
535 void (*keybindings_send_command) (guint group_id, guint key_id);
536 struct GeanyKeyBinding* (*keybindings_set_item) (struct GeanyKeyGroup *group, gsize key_id,
537 _GeanyKeyCallback callback, guint key, GdkModifierType mod,
538 const gchar *name, const gchar *label, GtkWidget *menu_item);
539 struct GeanyKeyBinding* (*keybindings_get_item)(struct GeanyKeyGroup *group, gsize key_id);
542 KeybindingFuncs;
545 /* See highlighting.h */
546 typedef struct HighlightingFuncs
548 const struct GeanyLexerStyle* (*highlighting_get_style) (gint ft_id, gint style_id);
549 void (*highlighting_set_styles) (struct _ScintillaObject *sci, struct GeanyFiletype *ft);
550 gboolean (*highlighting_is_string_style) (gint lexer, gint style);
551 gboolean (*highlighting_is_comment_style) (gint lexer, gint style);
552 gboolean (*highlighting_is_code_style) (gint lexer, gint style);
554 HighlightingFuncs;
557 /* See filetypes.h */
558 typedef struct FiletypeFuncs
560 GeanyFiletype* (*filetypes_detect_from_file) (const gchar *utf8_filename);
561 GeanyFiletype* (*filetypes_lookup_by_name) (const gchar *name);
562 GeanyFiletype* (*filetypes_index)(gint idx);
563 /* Remember to convert any filetype_id arguments to GeanyFiletype pointers in any
564 * appended functions */
566 FiletypeFuncs;
569 /* See search.h */
570 typedef struct SearchFuncs
572 void (*search_show_find_in_files_dialog) (const gchar *dir);
574 SearchFuncs;
577 /* See tagmanager/include */
578 typedef struct TagManagerFuncs
580 gchar* (*tm_get_real_path) (const gchar *file_name);
581 TMWorkObject* (*tm_source_file_new) (const char *file_name, gboolean update, const char *name);
582 gboolean (*tm_workspace_add_object) (TMWorkObject *work_object);
583 gboolean (*tm_source_file_update) (TMWorkObject *source_file, gboolean force,
584 gboolean recurse, gboolean update_parent);
585 void (*tm_work_object_free) (gpointer work_object);
586 gboolean (*tm_workspace_remove_object) (TMWorkObject *w, gboolean do_free, gboolean update);
588 TagManagerFuncs;
591 /* See navqueue.h */
592 typedef struct NavQueueFuncs
594 gboolean (*navqueue_goto_line) (struct GeanyDocument *old_doc, struct GeanyDocument *new_doc,
595 gint line);
597 NavQueueFuncs;
600 struct GeanyEditor;
602 /* See editor.h */
603 typedef struct EditorFuncs
605 const struct GeanyIndentPrefs* (*editor_get_indent_prefs)(struct GeanyEditor *editor);
606 struct _ScintillaObject* (*editor_create_widget)(struct GeanyEditor *editor);
608 void (*editor_indicator_set_on_range) (struct GeanyEditor *editor, gint indic, gint start, gint end);
609 void (*editor_indicator_set_on_line) (struct GeanyEditor *editor, gint indic, gint line);
610 void (*editor_indicator_clear) (struct GeanyEditor *editor, gint indic);
612 void (*editor_set_indent_type)(struct GeanyEditor *editor, GeanyIndentType type);
613 gchar* (*editor_get_word_at_pos) (struct GeanyEditor *editor, gint pos, const gchar *wordchars);
615 const gchar* (*editor_get_eol_char_name) (struct GeanyEditor *editor);
616 gint (*editor_get_eol_char_len) (struct GeanyEditor *editor);
617 const gchar* (*editor_get_eol_char) (struct GeanyEditor *editor);
619 void (*editor_insert_text_block) (struct GeanyEditor *editor, const gchar *text,
620 gint insert_pos, gint cursor_index, gint newline_indent_size,
621 gboolean replace_newlines);
623 gint (*editor_get_eol_char_mode) (struct GeanyEditor *editor);
624 gboolean (*editor_goto_pos) (struct GeanyEditor *editor, gint pos, gboolean mark);
626 const gchar* (*editor_find_snippet) (struct GeanyEditor *editor, const gchar *snippet_name);
627 void (*editor_insert_snippet) (struct GeanyEditor *editor, gint pos, const gchar *snippet);
629 EditorFuncs;
632 /* avoid including keybindings.h */
633 typedef gboolean (*_GeanyKeyGroupCallback) (guint key_id);
635 /* See pluginutils.c */
636 typedef struct PluginFuncs
638 void (*plugin_add_toolbar_item)(GeanyPlugin *plugin, GtkToolItem *item);
639 void (*plugin_module_make_resident) (GeanyPlugin *plugin);
640 void (*plugin_signal_connect) (GeanyPlugin *plugin,
641 GObject *object, const gchar *signal_name, gboolean after,
642 GCallback callback, gpointer user_data);
643 struct GeanyKeyGroup* (*plugin_set_key_group)(GeanyPlugin *plugin,
644 const gchar *section_name, gsize count, _GeanyKeyGroupCallback callback);
645 void (*plugin_show_configure)(GeanyPlugin *plugin);
647 PluginFuncs;
650 struct StashGroup;
652 /* See stash.h */
653 typedef struct StashFuncs
655 struct StashGroup *(*stash_group_new)(const gchar *name);
656 void (*stash_group_add_boolean)(struct StashGroup *group, gboolean *setting,
657 const gchar *key_name, gboolean default_value);
658 void (*stash_group_add_integer)(struct StashGroup *group, gint *setting,
659 const gchar *key_name, gint default_value);
660 void (*stash_group_add_string)(struct StashGroup *group, gchar **setting,
661 const gchar *key_name, const gchar *default_value);
662 void (*stash_group_add_string_vector)(struct StashGroup *group, gchar ***setting,
663 const gchar *key_name, const gchar **default_value);
664 void (*stash_group_load_from_key_file)(struct StashGroup *group, GKeyFile *keyfile);
665 void (*stash_group_save_to_key_file)(struct StashGroup *group, GKeyFile *keyfile);
666 void (*stash_group_free)(struct StashGroup *group);
667 gboolean (*stash_group_load_from_file)(struct StashGroup *group, const gchar *filename);
668 gint (*stash_group_save_to_file)(struct StashGroup *group, const gchar *filename,
669 GKeyFileFlags flags);
670 void (*stash_group_add_toggle_button)(struct StashGroup *group, gboolean *setting,
671 const gchar *key_name, gboolean default_value, gpointer widget_id);
672 void (*stash_group_add_radio_buttons)(struct StashGroup *group, gint *setting,
673 const gchar *key_name, gint default_value,
674 gpointer widget_id, gint enum_id, ...) G_GNUC_NULL_TERMINATED;
675 void (*stash_group_add_spin_button_integer)(struct StashGroup *group, gint *setting,
676 const gchar *key_name, gint default_value, gpointer widget_id);
677 void (*stash_group_add_combo_box)(struct StashGroup *group, gint *setting,
678 const gchar *key_name, gint default_value, gpointer widget_id);
679 void (*stash_group_add_combo_box_entry)(struct StashGroup *group, gchar **setting,
680 const gchar *key_name, const gchar *default_value, gpointer widget_id);
681 void (*stash_group_add_entry)(struct StashGroup *group, gchar **setting,
682 const gchar *key_name, const gchar *default_value, gpointer widget_id);
683 void (*stash_group_add_widget_property)(struct StashGroup *group, gpointer setting,
684 const gchar *key_name, gpointer default_value, gpointer widget_id,
685 const gchar *property_name, GType type);
686 void (*stash_group_display)(struct StashGroup *group, GtkWidget *owner);
687 void (*stash_group_update)(struct StashGroup *group, GtkWidget *owner);
689 StashFuncs;
692 /* See symbols.h */
693 typedef struct SymbolsFuncs
695 const gchar* (*symbols_get_context_separator)(gint ft_id);
697 SymbolsFuncs;
700 /* Deprecated aliases */
701 #ifndef GEANY_DISABLE_DEPRECATED
703 /** @deprecated - copy into your plugin code if needed.
704 * @c NULL-safe way to get the index of @a doc_ptr in the documents array. */
705 #define DOC_IDX(doc_ptr) \
706 (doc_ptr ? doc_ptr->index : -1)
707 #define DOC_IDX_VALID(doc_idx) \
708 ((doc_idx) >= 0 && (guint)(doc_idx) < documents_array->len && documents[doc_idx]->is_valid)
710 #define GEANY_WINDOW_MINIMAL_WIDTH 550
711 #define GEANY_WINDOW_MINIMAL_HEIGHT GEANY_DEFAULT_DIALOG_HEIGHT
713 #endif /* GEANY_DISABLE_DEPRECATED */
715 #endif