How to write a plugin for Geany?
How to write a plugin for Geany?
How to write a plugin for Geany?
Re: How to write a plugin for Geany?
I tried, but the whole header file needs to be converted.
https://www.geany.org/manual/reference/howto.html
https://www.geany.org/manual/reference/howto.html
Code: Select all
; apt install geany-plugin-devhelp
EnableExplicit
; Структуры
Structure PluginInfo Align #PB_Structure_AlignC
*name
*description
*version
*author
EndStructure
Structure GeanyPlugin Align #PB_Structure_AlignC
*info.PluginInfo
*geany_data.GeanyData
*funcs.GeanyPluginFuncs
; *proxy_funcs.GeanyProxyFuncs
; *priv.GeanyPluginPrivate
EndStructure
Structure GeanyData Align #PB_Structure_AlignC
*app.GeanyApp
*main_widgets.GeanyMainWidgets
*filetypes_array
*prefs.GeanyPrefs
*interface_prefs.GeanyInterfacePrefs
*toolbar_prefs.GeanyToolbarPrefs
*editor_prefs.GeanyEditorPrefs
*file_prefs.GeanyFilePrefs
*search_prefs.GeanySearchPrefs
*tool_prefs.GeanyToolPrefs
*template_prefs.GeanyTemplatePrefs
*interface_prefs.GeanyInterfacePrefs
*_compat
*object
EndStructure
Structure GeanyApp Align #PB_Structure_AlignC
debug_mode.b
*configdir
*datadir
*docdir
*tm_workspace
*project.GeanyProject
EndStructure
Structure GeanyProject Align #PB_Structure_AlignC
*name
*description
*file_name
*base_path
type.i
file_patterns
*priv.GeanyProjectPrivate
EndStructure
Structure GeanyProjectPrivate Align #PB_Structure_AlignC
final_new_line.b
strip_trailing_spaces.b
replace_tabs.b
ensure_convert_new_lines.b
*indentation.GeanyIndentPrefs
line_wrapping.b
line_break_column.i
auto_continue_multiline.b
long_line_behaviour.i
long_line_column.i
*build_filetypes_list
EndStructure
Structure GeanyIndentPrefs Align #PB_Structure_AlignC
width.i
type
hard_tab_width.i
auto_indent_mode
detect_type.b
detect_width.b
EndStructure
; Лицензия будет тут
; #include <geanyplugin.h>
; XIncludeFile "geanyplugin.pbi"
; *plugin - структура GeanyPlugin
; pdata - указатель gpointer, возможно на структуру
Procedure.b hello_init(*plugin.GeanyPlugin, gpointer pdata)
; printf("Привет мир из плагина!\n");
MessageRequester("", "Привет мир из плагина!");
; Выполните расширенную настройку здесь
Return #True
EndProcedure
Procedure hello_cleanup(*plugin, pdata)
; printf("Bye World :-(\n");
MessageRequester("", "Прощай мир :-(");
EndProcedure
; G_MODULE_EXPORT
ProcedureCDLL geany_load_module(*plugin.GeanyPlugin)
; Шаг 1: Устанавливает метаданные
; *pPluginInfo=AllocateStructure(PluginInfo)
; *plugin\nfo=AllocateStructure(PluginInfo)
*plugin\nfo\name = "ПриветМир"
*plugin\info\description = "Просто еще один инструмент, чтобы сказать Привет мир"
*plugin\info\version = "1.0"
*plugin\info\author = "John Doe <john.doe@example.org>"
; Шаг 2: Устанавливает функции
*plugin\funcs\init = @hello_init()
*plugin\funcs\cleanup = @hello_cleanup()
; Шаг 3: Регистрация плагина
GEANY_PLUGIN_REGISTER(*plugin, 225);
; В качестве альтернативы:
; GEANY_PLUGIN_REGISTER_FULL(*plugin, 225, Data, free_func);
EndProcedure