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,
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
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). */
38 /* Compatibility for sharing macros between API and core.
39 * First include geany.h, then plugindata.h, then other API headers. */
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 */
51 /** The Application Programming Interface (API) version, incremented
52 * whenever any plugin data types are modified or appended to. */
53 GEANY_API_VERSION
= 185,
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 /** Checks the plugin can be loaded by Geany.
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 #define PLUGIN_VERSION_CHECK(api_required) \
67 gint plugin_version_check(gint abi_ver) \
69 if (abi_ver != GEANY_ABI_VERSION) \
71 if (GEANY_API_VERSION < (api_required)) \
72 return (api_required); \
77 /** Basic information about a plugin available to Geany without loading the plugin.
78 * The fields are set in plugin_set_info(), usually with the PLUGIN_SET_INFO() macro. */
79 typedef struct PluginInfo
81 /** The name of the plugin. */
83 /** The description of the plugin. */
84 const gchar
*description
;
85 /** The version of the plugin. */
87 /** The author of the plugin. */
93 /** Basic information for the plugin and identification.
94 * @see geany_plugin. */
95 typedef struct GeanyPlugin
97 PluginInfo
*info
; /**< Fields set in plugin_set_info(). */
99 struct GeanyPluginPrivate
*priv
; /* private */
104 /** Sets the plugin name and some other basic information about a plugin.
105 * This declares a function, so you can use the _() translation macro for arguments.
108 * @code PLUGIN_SET_INFO(_("Cool Feature"), _("Adds cool feature support."), "0.1", "Joe Author") @endcode */
109 /* plugin_set_info() could be written manually for plugins if we want to add any
110 * extra PluginInfo features (such as an icon), so we don't need to break API
111 * compatibility. Alternatively just add a new macro, PLUGIN_SET_INFO_FULL(). -ntrel */
112 #define PLUGIN_SET_INFO(p_name, p_description, p_version, p_author) \
113 void plugin_set_info(PluginInfo* info) \
115 info->name = (p_name); \
116 info->description = (p_description); \
117 info->version = (p_version); \
118 info->author = (p_author); \
122 /** @deprecated - use plugin_set_key_group() instead.
123 * @see PLUGIN_KEY_GROUP() macro. */
124 typedef struct GeanyKeyGroupInfo
126 const gchar
*name
; /**< Group name used in the configuration file, such as @c "html_chars" */
127 gsize count
; /**< The number of keybindings the group will hold */
131 /** @deprecated - use plugin_set_key_group() instead.
132 * Declare and initialise a keybinding group.
133 * @code GeanyKeyGroup *plugin_key_group; @endcode
134 * You must then set the @c plugin_key_group::keys[] entries for the group in plugin_init(),
135 * normally using keybindings_set_item().
136 * The @c plugin_key_group::label field is set by Geany after @c plugin_init()
137 * is called, to the name of the plugin.
138 * @param group_name A unique group name (without quotes) to be used in the
139 * configuration file, such as @c html_chars.
140 * @param key_count The number of keybindings the group will hold. */
141 #define PLUGIN_KEY_GROUP(group_name, key_count) \
142 /* We have to declare this as a single element array.
143 * Declaring as a pointer to a struct doesn't work with g_module_symbol(). */ \
144 GeanyKeyGroupInfo plugin_key_group_info[1] = \
146 {G_STRINGIFY(group_name), key_count} \
148 GeanyKeyGroup *plugin_key_group = NULL;
151 /** Callback array entry type used with the @ref plugin_callbacks symbol. */
152 typedef struct PluginCallback
154 /** The name of signal, must be an existing signal. For a list of available signals,
155 * please see the @link signals Signal documentation @endlink. */
156 const gchar
*signal_name
;
157 /** A callback function which is called when the signal is emitted. */
159 /** Set to TRUE to connect your handler with g_signal_connect_after(). */
161 /** The user data passed to the signal handler. */
167 /** @deprecated Use @ref ui_add_document_sensitive() instead.
168 * Flags to be set by plugins in PluginFields struct. */
171 /** Whether a plugin's menu item should be disabled when there are no open documents */
172 PLUGIN_IS_DOCUMENT_SENSITIVE
= 1 << 0
176 /** @deprecated Use @ref ui_add_document_sensitive() instead.
177 * Fields set and owned by the plugin. */
178 typedef struct PluginFields
180 /** Bitmask of @c PluginFlags. */
182 /** Pointer to a plugin's menu item which will be automatically enabled/disabled when there
183 * are no open documents and @c PLUGIN_IS_DOCUMENT_SENSITIVE is set.
184 * This is required if using @c PLUGIN_IS_DOCUMENT_SENSITIVE, ignored otherwise */
185 GtkWidget
*menu_item
;
190 /** This contains pointers to global variables owned by Geany for plugins to use.
191 * Core variable pointers can be appended when needed by plugin authors, if appropriate. */
192 typedef struct GeanyData
194 struct GeanyApp
*app
; /**< Geany application data fields */
195 struct GeanyMainWidgets
*main_widgets
; /**< Important widgets in the main window */
196 GPtrArray
*documents_array
; /**< See document.h#documents_array. */
197 GPtrArray
*filetypes_array
; /**< Dynamic array of GeanyFiletype pointers */
198 struct GeanyPrefs
*prefs
; /**< General settings */
199 struct GeanyInterfacePrefs
*interface_prefs
; /**< Interface settings */
200 struct GeanyToolbarPrefs
*toolbar_prefs
; /**< Toolbar settings */
201 struct GeanyEditorPrefs
*editor_prefs
; /**< Editor settings */
202 struct GeanyFilePrefs
*file_prefs
; /**< File-related settings */
203 struct GeanySearchPrefs
*search_prefs
; /**< Search-related settings */
204 struct GeanyToolPrefs
*tool_prefs
; /**< Tool settings */
205 struct GeanyTemplatePrefs
*template_prefs
; /**< Template settings */
206 struct GeanyBuildInfo
*build_info
; /**< Current build information */
207 GSList
*filetypes_by_title
; /**< See filetypes.h#filetypes_by_title. */
211 #define geany geany_data /**< Simple macro for @c geany_data that reduces typing. */
214 /** This contains pointers to functions owned by Geany for plugins to use.
215 * Functions from the core can be appended when needed by plugin authors, but may
216 * require some changes. */
217 typedef struct GeanyFunctions
219 struct DocumentFuncs
*p_document
; /**< See document.h */
220 struct SciFuncs
*p_sci
; /**< See sciwrappers.h */
221 struct TemplateFuncs
*p_templates
; /**< See templates.h */
222 struct UtilsFuncs
*p_utils
; /**< See utils.h */
223 struct UIUtilsFuncs
*p_ui
; /**< See ui_utils.h */
224 /** @deprecated Use ui_lookup_widget() instead. */
225 struct SupportFuncs
*p_support
;
226 struct DialogFuncs
*p_dialogs
; /**< See dialogs.h */
227 /** @deprecated Use @ref GeanyFunctions::p_msgwin instead. */
228 struct MsgWinFuncs
*p_msgwindow
;
229 struct EncodingFuncs
*p_encodings
; /**< See encodings.h */
230 struct KeybindingFuncs
*p_keybindings
; /**< See keybindings.h */
231 struct TagManagerFuncs
*p_tm
; /**< See tagmanager/include */
232 struct SearchFuncs
*p_search
; /**< See search.h */
233 struct HighlightingFuncs
*p_highlighting
; /**< See highlighting.h */
234 struct FiletypeFuncs
*p_filetypes
; /**< See filetypes.h */
235 struct NavQueueFuncs
*p_navqueue
; /**< See navqueue.h */
236 struct EditorFuncs
*p_editor
; /**< See editor.h */
237 struct MainFuncs
*p_main
; /**< See main.h */
238 struct PluginFuncs
*p_plugin
; /**< See pluginutils.c */
239 struct ScintillaFuncs
*p_scintilla
; /**< See ScintillaFuncs */
240 struct MsgWinFuncs
*p_msgwin
; /**< See msgwindow.h */
241 struct StashFuncs
*p_stash
; /**< See stash.h */
242 struct SymbolsFuncs
*p_symbols
; /**< See symbols.h */
247 /* For more information about these functions, see the main source code.
248 * E.g. for p_document->new_file(), see document_new_file() in document.c. */
252 typedef struct DocumentFuncs
254 struct GeanyDocument
* (*document_new_file
) (const gchar
*utf8_filename
, struct GeanyFiletype
*ft
,
256 struct GeanyDocument
* (*document_get_current
) (void);
257 struct GeanyDocument
* (*document_get_from_page
) (guint page_num
);
258 struct GeanyDocument
* (*document_find_by_filename
) (const gchar
*utf8_filename
);
259 struct GeanyDocument
* (*document_find_by_real_path
) (const gchar
*realname
);
260 gboolean (*document_save_file
) (struct GeanyDocument
*doc
, gboolean force
);
261 struct GeanyDocument
* (*document_open_file
) (const gchar
*locale_filename
, gboolean readonly
,
262 struct GeanyFiletype
*ft
, const gchar
*forced_enc
);
263 void (*document_open_files
) (const GSList
*filenames
, gboolean readonly
,
264 struct GeanyFiletype
*ft
, const gchar
*forced_enc
);
265 gboolean (*document_remove_page
) (guint page_num
);
266 gboolean (*document_reload_file
) (struct GeanyDocument
*doc
, const gchar
*forced_enc
);
267 void (*document_set_encoding
) (struct GeanyDocument
*doc
, const gchar
*new_encoding
);
268 void (*document_set_text_changed
) (struct GeanyDocument
*doc
, gboolean changed
);
269 void (*document_set_filetype
) (struct GeanyDocument
*doc
, struct GeanyFiletype
*type
);
270 gboolean (*document_close
) (struct GeanyDocument
*doc
);
271 struct GeanyDocument
* (*document_index
)(gint idx
);
272 gboolean (*document_save_file_as
) (struct GeanyDocument
*doc
, const gchar
*utf8_fname
);
273 void (*document_rename_file
) (struct GeanyDocument
*doc
, const gchar
*new_filename
);
274 const GdkColor
* (*document_get_status_color
) (struct GeanyDocument
*doc
);
275 gchar
* (*document_get_basename_for_display
) (struct GeanyDocument
*doc
, gint length
);
276 gint (*document_get_notebook_page
) (struct GeanyDocument
*doc
);
281 struct _ScintillaObject
;
283 /** See http://scintilla.org for the full documentation. */
284 typedef struct ScintillaFuncs
286 /** Send Scintilla a message. */
287 long int (*scintilla_send_message
) (struct _ScintillaObject
* sci
, unsigned int iMessage
,
288 long unsigned int wParam
, long int lParam
);
289 /** Create a new ScintillaObject widget. */
290 GtkWidget
* (*scintilla_new
)(void);
295 /** Wrapper functions for Scintilla messages.
296 * See sciwrappers.h for the list of functions. */
297 typedef struct SciFuncs
299 /** @deprecated Use @c scintilla_send_message() instead. */
300 long int (*sci_send_message
) (struct _ScintillaObject
*sci
, unsigned int iMessage
,
301 long unsigned int wParam
, long int lParam
);
302 void (*sci_send_command
) (struct _ScintillaObject
*sci
, gint cmd
);
304 void (*sci_start_undo_action
) (struct _ScintillaObject
*sci
);
305 void (*sci_end_undo_action
) (struct _ScintillaObject
*sci
);
306 void (*sci_set_text
) (struct _ScintillaObject
*sci
, const gchar
*text
);
307 void (*sci_insert_text
) (struct _ScintillaObject
*sci
, gint pos
, const gchar
*text
);
308 void (*sci_get_text
) (struct _ScintillaObject
*sci
, gint len
, gchar
*text
);
309 gint (*sci_get_length
) (struct _ScintillaObject
*sci
);
310 gint (*sci_get_current_position
) (struct _ScintillaObject
*sci
);
311 void (*sci_set_current_position
) (struct _ScintillaObject
*sci
, gint position
,
312 gboolean scroll_to_caret
);
313 gint (*sci_get_col_from_position
) (struct _ScintillaObject
*sci
, gint position
);
314 gint (*sci_get_line_from_position
) (struct _ScintillaObject
*sci
, gint position
);
315 gint (*sci_get_position_from_line
) (struct _ScintillaObject
*sci
, gint line
);
316 void (*sci_replace_sel
) (struct _ScintillaObject
*sci
, const gchar
*text
);
317 void (*sci_get_selected_text
) (struct _ScintillaObject
*sci
, gchar
*text
);
318 gint (*sci_get_selected_text_length
) (struct _ScintillaObject
*sci
);
319 gint (*sci_get_selection_start
) (struct _ScintillaObject
*sci
);
320 gint (*sci_get_selection_end
) (struct _ScintillaObject
*sci
);
321 gint (*sci_get_selection_mode
) (struct _ScintillaObject
*sci
);
322 void (*sci_set_selection_mode
) (struct _ScintillaObject
*sci
, gint mode
);
323 void (*sci_set_selection_start
) (struct _ScintillaObject
*sci
, gint position
);
324 void (*sci_set_selection_end
) (struct _ScintillaObject
*sci
, gint position
);
325 void (*sci_get_text_range
) (struct _ScintillaObject
*sci
, gint start
, gint end
, gchar
*text
);
326 gchar
* (*sci_get_line
) (struct _ScintillaObject
*sci
, gint line_num
);
327 gint (*sci_get_line_length
) (struct _ScintillaObject
*sci
, gint line
);
328 gint (*sci_get_line_count
) (struct _ScintillaObject
*sci
);
329 gboolean (*sci_get_line_is_visible
) (struct _ScintillaObject
*sci
, gint line
);
330 void (*sci_ensure_line_is_visible
) (struct _ScintillaObject
*sci
, gint line
);
331 void (*sci_scroll_caret
) (struct _ScintillaObject
*sci
);
332 gint (*sci_find_matching_brace
) (struct _ScintillaObject
*sci
, gint pos
);
333 gint (*sci_get_style_at
) (struct _ScintillaObject
*sci
, gint position
);
334 gchar (*sci_get_char_at
) (struct _ScintillaObject
*sci
, gint pos
);
335 gint (*sci_get_current_line
) (struct _ScintillaObject
*sci
);
336 gboolean (*sci_has_selection
) (struct _ScintillaObject
*sci
);
337 gint (*sci_get_tab_width
) (struct _ScintillaObject
*sci
);
338 void (*sci_indicator_clear
) (struct _ScintillaObject
*sci
, gint start
, gint end
);
339 void (*sci_indicator_set
) (struct _ScintillaObject
*sci
, gint indic
);
340 gchar
* (*sci_get_contents
) (struct _ScintillaObject
*sci
, gint len
);
341 gchar
* (*sci_get_contents_range
) (struct _ScintillaObject
*sci
, gint start
, gint end
);
342 gchar
* (*sci_get_selection_contents
) (struct _ScintillaObject
*sci
);
343 void (*sci_set_font
) (struct _ScintillaObject
*sci
, gint style
, const gchar
*font
, gint size
);
344 gint (*sci_get_line_end_position
) (struct _ScintillaObject
*sci
, gint line
);
345 void (*sci_set_target_start
) (struct _ScintillaObject
*sci
, gint start
);
346 void (*sci_set_target_end
) (struct _ScintillaObject
*sci
, gint end
);
347 gint (*sci_replace_target
) (struct _ScintillaObject
*sci
, const gchar
*text
, gboolean regex
);
348 void (*sci_set_marker_at_line
) (struct _ScintillaObject
*sci
, gint line_number
, gint marker
);
349 void (*sci_delete_marker_at_line
) (struct _ScintillaObject
*sci
, gint line_number
, gint marker
);
350 gboolean (*sci_is_marker_set_at_line
) (struct _ScintillaObject
*sci
, gint line
, gint marker
);
351 void (*sci_goto_line
) (struct _ScintillaObject
*sci
, gint line
, gboolean unfold
);
352 gint (*sci_find_text
) (struct _ScintillaObject
*sci
, gint flags
, struct Sci_TextToFind
*ttf
);
353 void (*sci_set_line_indentation
) (struct _ScintillaObject
*sci
, gint line
, gint indent
);
354 gint (*sci_get_line_indentation
) (struct _ScintillaObject
*sci
, gint line
);
359 /* See templates.h */
360 typedef struct TemplateFuncs
362 gchar
* (*templates_get_template_fileheader
) (gint filetype_idx
, const gchar
*fname
);
368 typedef struct UtilsFuncs
370 gboolean (*utils_str_equal
) (const gchar
*a
, const gchar
*b
);
371 guint (*utils_string_replace_all
) (GString
*haystack
, const gchar
*needle
,
372 const gchar
*replacement
);
373 GSList
* (*utils_get_file_list
) (const gchar
*path
, guint
*length
, GError
**error
);
374 gint (*utils_write_file
) (const gchar
*filename
, const gchar
*text
);
375 gchar
* (*utils_get_locale_from_utf8
) (const gchar
*utf8_text
);
376 gchar
* (*utils_get_utf8_from_locale
) (const gchar
*locale_text
);
377 gchar
* (*utils_remove_ext_from_filename
) (const gchar
*filename
);
378 gint (*utils_mkdir
) (const gchar
*path
, gboolean create_parent_dirs
);
379 gboolean (*utils_get_setting_boolean
) (GKeyFile
*config
, const gchar
*section
, const gchar
*key
,
380 const gboolean default_value
);
381 gint (*utils_get_setting_integer
) (GKeyFile
*config
, const gchar
*section
, const gchar
*key
,
382 const gint default_value
);
383 gchar
* (*utils_get_setting_string
) (GKeyFile
*config
, const gchar
*section
, const gchar
*key
,
384 const gchar
*default_value
);
385 gboolean (*utils_spawn_sync
) (const gchar
*dir
, gchar
**argv
, gchar
**env
, GSpawnFlags flags
,
386 GSpawnChildSetupFunc child_setup
, gpointer user_data
, gchar
**std_out
,
387 gchar
**std_err
, gint
*exit_status
, GError
**error
);
388 gboolean (*utils_spawn_async
) (const gchar
*dir
, gchar
**argv
, gchar
**env
, GSpawnFlags flags
,
389 GSpawnChildSetupFunc child_setup
, gpointer user_data
, GPid
*child_pid
,
391 gint (*utils_str_casecmp
) (const gchar
*s1
, const gchar
*s2
);
392 gchar
* (*utils_get_date_time
) (const gchar
*format
, time_t *time_to_use
);
393 void (*utils_open_browser
) (const gchar
*uri
);
394 guint (*utils_string_replace_first
) (GString
*haystack
, const gchar
*needle
,
395 const gchar
*replace
);
396 gchar
* (*utils_str_middle_truncate
) (const gchar
*string
, guint truncate_length
);
397 gchar
* (*utils_str_remove_chars
) (gchar
*string
, const gchar
*chars
);
398 GSList
* (*utils_get_file_list_full
)(const gchar
*path
, gboolean full_path
, gboolean sort
,
400 gchar
** (*utils_copy_environment
)(const gchar
**exclude_vars
, const gchar
*first_varname
, ...);
407 typedef struct MainFuncs
409 void (*main_reload_configuration
) (void);
410 void (*main_locale_init
) (const gchar
*locale_dir
, const gchar
*package
);
411 gboolean (*main_is_realized
) (void);
417 typedef struct UIUtilsFuncs
419 GtkWidget
* (*ui_dialog_vbox_new
) (GtkDialog
*dialog
);
420 GtkWidget
* (*ui_frame_new_with_alignment
) (const gchar
*label_text
, GtkWidget
**alignment
);
421 void (*ui_set_statusbar
) (gboolean log
, const gchar
*format
, ...) G_GNUC_PRINTF (2, 3);
422 void (*ui_table_add_row
) (GtkTable
*table
, gint row
, ...) G_GNUC_NULL_TERMINATED
;
423 GtkWidget
* (*ui_path_box_new
) (const gchar
*title
, GtkFileChooserAction action
, GtkEntry
*entry
);
424 GtkWidget
* (*ui_button_new_with_image
) (const gchar
*stock_id
, const gchar
*text
);
425 void (*ui_add_document_sensitive
) (GtkWidget
*widget
);
426 void (*ui_widget_set_tooltip_text
) (GtkWidget
*widget
, const gchar
*text
);
427 GtkWidget
* (*ui_image_menu_item_new
) (const gchar
*stock_id
, const gchar
*label
);
428 GtkWidget
* (*ui_lookup_widget
) (GtkWidget
*widget
, const gchar
*widget_name
);
429 void (*ui_progress_bar_start
) (const gchar
*text
);
430 void (*ui_progress_bar_stop
) (void);
431 void (*ui_entry_add_clear_icon
) (GtkEntry
*entry
);
432 void (*ui_menu_add_document_items
) (GtkMenu
*menu
, struct GeanyDocument
*active
,
434 void (*ui_widget_modify_font_from_string
) (GtkWidget
*widget
, const gchar
*str
);
435 gboolean (*ui_is_keyval_enter_or_return
) (guint keyval
);
436 gint (*ui_get_gtk_settings_integer
) (const gchar
*property_name
, gint default_value
);
442 typedef struct DialogFuncs
444 gboolean (*dialogs_show_question
) (const gchar
*text
, ...) G_GNUC_PRINTF (1, 2);
445 void (*dialogs_show_msgbox
) (GtkMessageType type
, const gchar
*text
, ...) G_GNUC_PRINTF (2, 3);
446 gboolean (*dialogs_show_save_as
) (void);
447 gboolean (*dialogs_show_input_numeric
) (const gchar
*title
, const gchar
*label_text
,
448 gdouble
*value
, gdouble min
, gdouble max
, gdouble step
);
453 /* @deprecated Use ui_lookup_widget() instead. */
454 typedef struct SupportFuncs
456 GtkWidget
* (*support_lookup_widget
) (GtkWidget
*widget
, const gchar
*widget_name
);
461 /* See msgwindow.h */
462 typedef struct MsgWinFuncs
464 /* status_add() does not set the status bar - use ui->set_statusbar() instead. */
465 void (*msgwin_status_add
) (const gchar
*format
, ...) G_GNUC_PRINTF (1, 2);
466 void (*msgwin_compiler_add
) (gint msg_color
, const gchar
*format
, ...) G_GNUC_PRINTF (2, 3);
467 void (*msgwin_msg_add
) (gint msg_color
, gint line
, struct GeanyDocument
*doc
,
468 const gchar
*format
, ...) G_GNUC_PRINTF (4, 5);
469 void (*msgwin_clear_tab
) (gint tabnum
);
470 void (*msgwin_switch_tab
) (gint tabnum
, gboolean show
);
475 /* See encodings.h */
476 typedef struct EncodingFuncs
478 gchar
* (*encodings_convert_to_utf8
) (const gchar
*buffer
, gsize size
, gchar
**used_encoding
);
479 gchar
* (*encodings_convert_to_utf8_from_charset
) (const gchar
*buffer
, gsize size
,
480 const gchar
*charset
, gboolean fast
);
481 const gchar
* (*encodings_get_charset_from_index
) (gint idx
);
486 struct GeanyKeyGroup
;
487 /* avoid including keybindings.h */
488 typedef void (*_GeanyKeyCallback
) (guint key_id
);
490 /* See keybindings.h */
491 typedef struct KeybindingFuncs
493 void (*keybindings_send_command
) (guint group_id
, guint key_id
);
494 struct GeanyKeyBinding
* (*keybindings_set_item
) (struct GeanyKeyGroup
*group
, gsize key_id
,
495 _GeanyKeyCallback callback
, guint key
, GdkModifierType mod
,
496 const gchar
*name
, const gchar
*label
, GtkWidget
*menu_item
);
497 struct GeanyKeyBinding
* (*keybindings_get_item
)(struct GeanyKeyGroup
*group
, gsize key_id
);
503 /* See highlighting.h */
504 typedef struct HighlightingFuncs
506 const struct GeanyLexerStyle
* (*highlighting_get_style
) (gint ft_id
, gint style_id
);
507 void (*highlighting_set_styles
) (struct _ScintillaObject
*sci
, struct GeanyFiletype
*ft
);
512 /* See filetypes.h */
513 typedef struct FiletypeFuncs
515 GeanyFiletype
* (*filetypes_detect_from_file
) (const gchar
*utf8_filename
);
516 GeanyFiletype
* (*filetypes_lookup_by_name
) (const gchar
*name
);
517 GeanyFiletype
* (*filetypes_index
)(gint idx
);
518 /* Remember to convert any filetype_id arguments to GeanyFiletype pointers in any
519 * appended functions */
525 typedef struct SearchFuncs
527 void (*search_show_find_in_files_dialog
) (const gchar
*dir
);
532 /* See tagmanager/include */
533 typedef struct TagManagerFuncs
535 gchar
* (*tm_get_real_path
) (const gchar
*file_name
);
536 TMWorkObject
* (*tm_source_file_new
) (const char *file_name
, gboolean update
, const char *name
);
537 gboolean (*tm_workspace_add_object
) (TMWorkObject
*work_object
);
538 gboolean (*tm_source_file_update
) (TMWorkObject
*source_file
, gboolean force
,
539 gboolean recurse
, gboolean update_parent
);
540 void (*tm_work_object_free
) (gpointer work_object
);
541 gboolean (*tm_workspace_remove_object
) (TMWorkObject
*w
, gboolean do_free
, gboolean update
);
547 typedef struct NavQueueFuncs
549 gboolean (*navqueue_goto_line
) (struct GeanyDocument
*old_doc
, struct GeanyDocument
*new_doc
,
558 typedef struct EditorFuncs
560 const struct GeanyIndentPrefs
* (*editor_get_indent_prefs
)(struct GeanyEditor
*editor
);
561 struct _ScintillaObject
* (*editor_create_widget
)(struct GeanyEditor
*editor
);
563 void (*editor_indicator_set_on_range
) (struct GeanyEditor
*editor
, gint indic
, gint start
, gint end
);
564 void (*editor_indicator_set_on_line
) (struct GeanyEditor
*editor
, gint indic
, gint line
);
565 void (*editor_indicator_clear
) (struct GeanyEditor
*editor
, gint indic
);
567 void (*editor_set_indent_type
)(struct GeanyEditor
*editor
, GeanyIndentType type
);
568 gchar
* (*editor_get_word_at_pos
) (struct GeanyEditor
*editor
, gint pos
, const gchar
*wordchars
);
570 const gchar
* (*editor_get_eol_char_name
) (struct GeanyEditor
*editor
);
571 gint (*editor_get_eol_char_len
) (struct GeanyEditor
*editor
);
572 const gchar
* (*editor_get_eol_char
) (struct GeanyEditor
*editor
);
574 void (*editor_insert_text_block
) (struct GeanyEditor
*editor
, const gchar
*text
,
575 gint insert_pos
, gint cursor_index
, gint newline_indent_size
,
576 gboolean replace_newlines
);
581 /* avoid including keybindings.h */
582 typedef gboolean (*_GeanyKeyGroupCallback
) (guint key_id
);
584 /* See pluginutils.c */
585 typedef struct PluginFuncs
587 void (*plugin_add_toolbar_item
)(GeanyPlugin
*plugin
, GtkToolItem
*item
);
588 void (*plugin_module_make_resident
) (GeanyPlugin
*plugin
);
589 void (*plugin_signal_connect
) (GeanyPlugin
*plugin
,
590 GObject
*object
, const gchar
*signal_name
, gboolean after
,
591 GCallback callback
, gpointer user_data
);
592 struct GeanyKeyGroup
* (*plugin_set_key_group
)(GeanyPlugin
*plugin
,
593 const gchar
*section_name
, gsize count
, _GeanyKeyGroupCallback callback
);
594 void (*plugin_show_configure
)(GeanyPlugin
*plugin
);
602 typedef struct StashFuncs
604 struct StashGroup
*(*stash_group_new
)(const gchar
*name
);
605 void (*stash_group_add_boolean
)(struct StashGroup
*group
, gboolean
*setting
,
606 const gchar
*key_name
, gboolean default_value
);
607 void (*stash_group_add_integer
)(struct StashGroup
*group
, gint
*setting
,
608 const gchar
*key_name
, gint default_value
);
609 void (*stash_group_add_string
)(struct StashGroup
*group
, gchar
**setting
,
610 const gchar
*key_name
, const gchar
*default_value
);
611 void (*stash_group_add_string_vector
)(struct StashGroup
*group
, gchar
***setting
,
612 const gchar
*key_name
, const gchar
**default_value
);
613 void (*stash_group_load_from_key_file
)(struct StashGroup
*group
, GKeyFile
*keyfile
);
614 void (*stash_group_save_to_key_file
)(struct StashGroup
*group
, GKeyFile
*keyfile
);
615 void (*stash_group_free
)(struct StashGroup
*group
);
616 gboolean (*stash_group_load_from_file
)(struct StashGroup
*group
, const gchar
*filename
);
617 gint (*stash_group_save_to_file
)(struct StashGroup
*group
, const gchar
*filename
,
618 GKeyFileFlags flags
);
619 void (*stash_group_add_toggle_button
)(struct StashGroup
*group
, gboolean
*setting
,
620 const gchar
*key_name
, gboolean default_value
, gpointer widget_id
);
621 void (*stash_group_add_radio_buttons
)(struct StashGroup
*group
, gint
*setting
,
622 const gchar
*key_name
, gint default_value
,
623 gpointer widget_id
, gint enum_id
, ...) G_GNUC_NULL_TERMINATED
;
624 void (*stash_group_add_spin_button_integer
)(struct StashGroup
*group
, gint
*setting
,
625 const gchar
*key_name
, gint default_value
, gpointer widget_id
);
626 void (*stash_group_add_combo_box
)(struct StashGroup
*group
, gint
*setting
,
627 const gchar
*key_name
, gint default_value
, gpointer widget_id
);
628 void (*stash_group_add_combo_box_entry
)(struct StashGroup
*group
, gchar
**setting
,
629 const gchar
*key_name
, const gchar
*default_value
, gpointer widget_id
);
630 void (*stash_group_add_entry
)(struct StashGroup
*group
, gchar
**setting
,
631 const gchar
*key_name
, const gchar
*default_value
, gpointer widget_id
);
632 void (*stash_group_add_widget_property
)(struct StashGroup
*group
, gpointer setting
,
633 const gchar
*key_name
, gpointer default_value
, gpointer widget_id
,
634 const gchar
*property_name
, GType type
);
635 void (*stash_group_display
)(struct StashGroup
*group
, GtkWidget
*owner
);
636 void (*stash_group_update
)(struct StashGroup
*group
, GtkWidget
*owner
);
642 typedef struct SymbolsFuncs
644 const gchar
* (*symbols_get_context_separator
)(gint ft_id
);
649 /* Deprecated aliases */
650 #ifndef GEANY_DISABLE_DEPRECATED
652 /** @deprecated - copy into your plugin code if needed.
653 * @c NULL-safe way to get the index of @a doc_ptr in the documents array. */
654 #define DOC_IDX(doc_ptr) \
655 (doc_ptr ? doc_ptr->index : -1)
656 #define DOC_IDX_VALID(doc_idx) \
657 ((doc_idx) >= 0 && (guint)(doc_idx) < documents_array->len && documents[doc_idx]->is_valid)
659 #define GEANY_WINDOW_MINIMAL_WIDTH 550
660 #define GEANY_WINDOW_MINIMAL_HEIGHT GEANY_DEFAULT_DIALOG_HEIGHT
662 #endif /* GEANY_DISABLE_DEPRECATED */