Remove struct/macro/funcptr linkage control for plugin API

Add rest of headers needed for declarations of all public API
functions. Add HAVE_PLUGINS define to geanyplugins.h since some headers
need this and it should always be valid for this header.
geanyfunctions.h left for source-level backwards compatibility for
plugins which might `#include` this header directly. I don't know why
they do it, but some Geany-Plugins do this.
This commit is contained in:
Matthew Brush 2014-10-13 19:08:57 -07:00 committed by Thomas Martitz
parent 1e630e6f12
commit 860df27696
10 changed files with 47 additions and 1374 deletions

View File

@ -775,7 +775,6 @@ WARN_LOGFILE =
INPUT = @top_srcdir@/src/ \
@top_srcdir@/doc/ \
@top_srcdir@/plugins/geanyplugin.h \
@top_srcdir@/plugins/geanyfunctions.h \
@top_srcdir@/tagmanager/src/tm_source_file.c \
@top_srcdir@/tagmanager/src/tm_source_file.h \
@top_srcdir@/tagmanager/src/tm_workspace.c \

View File

@ -96,7 +96,6 @@ doxygen_sources = \
$(srcdir)/*.dox \
$(top_srcdir)/src/*.[ch] \
$(top_srcdir)/plugins/geanyplugin.h \
$(top_srcdir)/plugins/geanyfunctions.h \
$(top_srcdir)/tagmanager/src/tm_source_file.[ch] \
$(top_srcdir)/tagmanager/src/tm_workspace.[ch]

View File

@ -187,14 +187,12 @@ so there is no need to include @a gtk/gtk.h yourself.
@note
@a plugindata.h contains the biggest part of the plugin API and provides some basic macros.
@a geanyfunctions.h provides some macros for convenient access to plugin API functions.
Then you should define three basic variables which will give access to data fields and
functions provided by the plugin API.
Then you should define two basic variables which will give access to data fields
provided by the plugin API.
@code
GeanyPlugin *geany_plugin;
GeanyData *geany_data;
GeanyFunctions *geany_functions;
@endcode
Now you can go on and write your first lines for your new plugin. As mentioned before,
@ -363,7 +361,6 @@ Once this is done, your first plugin is ready. Congratulations!
GeanyPlugin *geany_plugin;
GeanyData *geany_data;
GeanyFunctions *geany_functions;
PLUGIN_VERSION_CHECK(211)

View File

@ -1,22 +1,14 @@
# Adapted from Pidgin's plugins/Makefile.am, thanks
EXTRA_DIST = \
makefile.win32 \
genapi.py
makefile.win32
plugindir = $(libdir)/geany
plugins_includedir = $(includedir)/geany
plugins_include_HEADERS = \
geanyplugin.h \
geanyfunctions.h
# systems without python should continue to build OK
geanyfunctions.h: genapi.py ../src/plugins.c
python genapi.py || true
all: geanyfunctions.h
geanyfunctions.h \
geanyplugin.h
demoplugin_la_LDFLAGS = -module -avoid-version -no-undefined
classbuilder_la_LDFLAGS = -module -avoid-version -no-undefined

View File

@ -1,448 +1,31 @@
/* This file is generated automatically by genapi.py - do not edit. */
/** @file geanyfunctions.h @ref geany_functions wrappers.
* This allows the use of normal API function names in plugins by defining macros.
/*
* geanyfunctions.h - this file is part of Geany, a fast and lightweight IDE
*
* E.g.:@code
* #define plugin_add_toolbar_item \
* geany_functions->p_plugin->plugin_add_toolbar_item @endcode
* Copyright 2014 Matthew Brush <mbrush@codebrainz.ca>
*
* You need to declare the @ref geany_functions symbol yourself.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Note: This must be included after all other API headers to prevent conflicts with
* other header's function prototypes - this is done for you when using geanyplugin.h.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* This file exists purely for backwards compatibility. */
#ifndef GEANY_FUNCTIONS_H
#define GEANY_FUNCTIONS_H
#define GEANY_FUNCTIONS_H 1
#define plugin_add_toolbar_item \
geany_functions->p_plugin->plugin_add_toolbar_item
#define plugin_module_make_resident \
geany_functions->p_plugin->plugin_module_make_resident
#define plugin_signal_connect \
geany_functions->p_plugin->plugin_signal_connect
#define plugin_set_key_group \
geany_functions->p_plugin->plugin_set_key_group
#define plugin_show_configure \
geany_functions->p_plugin->plugin_show_configure
#define plugin_timeout_add \
geany_functions->p_plugin->plugin_timeout_add
#define plugin_timeout_add_seconds \
geany_functions->p_plugin->plugin_timeout_add_seconds
#define plugin_idle_add \
geany_functions->p_plugin->plugin_idle_add
#define plugin_builder_connect_signals \
geany_functions->p_plugin->plugin_builder_connect_signals
#define document_new_file \
geany_functions->p_document->document_new_file
#define document_get_current \
geany_functions->p_document->document_get_current
#define document_get_from_page \
geany_functions->p_document->document_get_from_page
#define document_find_by_filename \
geany_functions->p_document->document_find_by_filename
#define document_find_by_real_path \
geany_functions->p_document->document_find_by_real_path
#define document_save_file \
geany_functions->p_document->document_save_file
#define document_open_file \
geany_functions->p_document->document_open_file
#define document_open_files \
geany_functions->p_document->document_open_files
#define document_remove_page \
geany_functions->p_document->document_remove_page
#define document_reload_force \
geany_functions->p_document->document_reload_force
#define document_set_encoding \
geany_functions->p_document->document_set_encoding
#define document_set_text_changed \
geany_functions->p_document->document_set_text_changed
#define document_set_filetype \
geany_functions->p_document->document_set_filetype
#define document_close \
geany_functions->p_document->document_close
#define document_index \
geany_functions->p_document->document_index
#define document_save_file_as \
geany_functions->p_document->document_save_file_as
#define document_rename_file \
geany_functions->p_document->document_rename_file
#define document_get_status_color \
geany_functions->p_document->document_get_status_color
#define document_get_basename_for_display \
geany_functions->p_document->document_get_basename_for_display
#define document_get_notebook_page \
geany_functions->p_document->document_get_notebook_page
#define document_compare_by_display_name \
geany_functions->p_document->document_compare_by_display_name
#define document_compare_by_tab_order \
geany_functions->p_document->document_compare_by_tab_order
#define document_compare_by_tab_order_reverse \
geany_functions->p_document->document_compare_by_tab_order_reverse
#define document_find_by_id \
geany_functions->p_document->document_find_by_id
#define editor_get_indent_prefs \
geany_functions->p_editor->editor_get_indent_prefs
#define editor_create_widget \
geany_functions->p_editor->editor_create_widget
#define editor_indicator_set_on_range \
geany_functions->p_editor->editor_indicator_set_on_range
#define editor_indicator_set_on_line \
geany_functions->p_editor->editor_indicator_set_on_line
#define editor_indicator_clear \
geany_functions->p_editor->editor_indicator_clear
#define editor_set_indent_type \
geany_functions->p_editor->editor_set_indent_type
#define editor_get_word_at_pos \
geany_functions->p_editor->editor_get_word_at_pos
#define editor_get_eol_char_name \
geany_functions->p_editor->editor_get_eol_char_name
#define editor_get_eol_char_len \
geany_functions->p_editor->editor_get_eol_char_len
#define editor_get_eol_char \
geany_functions->p_editor->editor_get_eol_char
#define editor_insert_text_block \
geany_functions->p_editor->editor_insert_text_block
#define editor_get_eol_char_mode \
geany_functions->p_editor->editor_get_eol_char_mode
#define editor_goto_pos \
geany_functions->p_editor->editor_goto_pos
#define editor_find_snippet \
geany_functions->p_editor->editor_find_snippet
#define editor_insert_snippet \
geany_functions->p_editor->editor_insert_snippet
#define scintilla_send_message \
geany_functions->p_scintilla->scintilla_send_message
#define scintilla_new \
geany_functions->p_scintilla->scintilla_new
#define sci_send_command \
geany_functions->p_sci->sci_send_command
#define sci_start_undo_action \
geany_functions->p_sci->sci_start_undo_action
#define sci_end_undo_action \
geany_functions->p_sci->sci_end_undo_action
#define sci_set_text \
geany_functions->p_sci->sci_set_text
#define sci_insert_text \
geany_functions->p_sci->sci_insert_text
#define sci_get_text \
geany_functions->p_sci->sci_get_text
#define sci_get_length \
geany_functions->p_sci->sci_get_length
#define sci_get_current_position \
geany_functions->p_sci->sci_get_current_position
#define sci_set_current_position \
geany_functions->p_sci->sci_set_current_position
#define sci_get_col_from_position \
geany_functions->p_sci->sci_get_col_from_position
#define sci_get_line_from_position \
geany_functions->p_sci->sci_get_line_from_position
#define sci_get_position_from_line \
geany_functions->p_sci->sci_get_position_from_line
#define sci_replace_sel \
geany_functions->p_sci->sci_replace_sel
#define sci_get_selected_text \
geany_functions->p_sci->sci_get_selected_text
#define sci_get_selected_text_length \
geany_functions->p_sci->sci_get_selected_text_length
#define sci_get_selection_start \
geany_functions->p_sci->sci_get_selection_start
#define sci_get_selection_end \
geany_functions->p_sci->sci_get_selection_end
#define sci_get_selection_mode \
geany_functions->p_sci->sci_get_selection_mode
#define sci_set_selection_mode \
geany_functions->p_sci->sci_set_selection_mode
#define sci_set_selection_start \
geany_functions->p_sci->sci_set_selection_start
#define sci_set_selection_end \
geany_functions->p_sci->sci_set_selection_end
#define sci_get_text_range \
geany_functions->p_sci->sci_get_text_range
#define sci_get_line \
geany_functions->p_sci->sci_get_line
#define sci_get_line_length \
geany_functions->p_sci->sci_get_line_length
#define sci_get_line_count \
geany_functions->p_sci->sci_get_line_count
#define sci_get_line_is_visible \
geany_functions->p_sci->sci_get_line_is_visible
#define sci_ensure_line_is_visible \
geany_functions->p_sci->sci_ensure_line_is_visible
#define sci_scroll_caret \
geany_functions->p_sci->sci_scroll_caret
#define sci_find_matching_brace \
geany_functions->p_sci->sci_find_matching_brace
#define sci_get_style_at \
geany_functions->p_sci->sci_get_style_at
#define sci_get_char_at \
geany_functions->p_sci->sci_get_char_at
#define sci_get_current_line \
geany_functions->p_sci->sci_get_current_line
#define sci_has_selection \
geany_functions->p_sci->sci_has_selection
#define sci_get_tab_width \
geany_functions->p_sci->sci_get_tab_width
#define sci_indicator_clear \
geany_functions->p_sci->sci_indicator_clear
#define sci_indicator_set \
geany_functions->p_sci->sci_indicator_set
#define sci_get_contents \
geany_functions->p_sci->sci_get_contents
#define sci_get_contents_range \
geany_functions->p_sci->sci_get_contents_range
#define sci_get_selection_contents \
geany_functions->p_sci->sci_get_selection_contents
#define sci_set_font \
geany_functions->p_sci->sci_set_font
#define sci_get_line_end_position \
geany_functions->p_sci->sci_get_line_end_position
#define sci_set_target_start \
geany_functions->p_sci->sci_set_target_start
#define sci_set_target_end \
geany_functions->p_sci->sci_set_target_end
#define sci_replace_target \
geany_functions->p_sci->sci_replace_target
#define sci_set_marker_at_line \
geany_functions->p_sci->sci_set_marker_at_line
#define sci_delete_marker_at_line \
geany_functions->p_sci->sci_delete_marker_at_line
#define sci_is_marker_set_at_line \
geany_functions->p_sci->sci_is_marker_set_at_line
#define sci_goto_line \
geany_functions->p_sci->sci_goto_line
#define sci_find_text \
geany_functions->p_sci->sci_find_text
#define sci_set_line_indentation \
geany_functions->p_sci->sci_set_line_indentation
#define sci_get_line_indentation \
geany_functions->p_sci->sci_get_line_indentation
#define sci_get_lexer \
geany_functions->p_sci->sci_get_lexer
#define templates_get_template_fileheader \
geany_functions->p_templates->templates_get_template_fileheader
#define utils_str_equal \
geany_functions->p_utils->utils_str_equal
#define utils_string_replace_all \
geany_functions->p_utils->utils_string_replace_all
#define utils_get_file_list \
geany_functions->p_utils->utils_get_file_list
#define utils_write_file \
geany_functions->p_utils->utils_write_file
#define utils_get_locale_from_utf8 \
geany_functions->p_utils->utils_get_locale_from_utf8
#define utils_get_utf8_from_locale \
geany_functions->p_utils->utils_get_utf8_from_locale
#define utils_remove_ext_from_filename \
geany_functions->p_utils->utils_remove_ext_from_filename
#define utils_mkdir \
geany_functions->p_utils->utils_mkdir
#define utils_get_setting_boolean \
geany_functions->p_utils->utils_get_setting_boolean
#define utils_get_setting_integer \
geany_functions->p_utils->utils_get_setting_integer
#define utils_get_setting_string \
geany_functions->p_utils->utils_get_setting_string
#define utils_spawn_sync \
geany_functions->p_utils->utils_spawn_sync
#define utils_spawn_async \
geany_functions->p_utils->utils_spawn_async
#define utils_str_casecmp \
geany_functions->p_utils->utils_str_casecmp
#define utils_get_date_time \
geany_functions->p_utils->utils_get_date_time
#define utils_open_browser \
geany_functions->p_utils->utils_open_browser
#define utils_string_replace_first \
geany_functions->p_utils->utils_string_replace_first
#define utils_str_middle_truncate \
geany_functions->p_utils->utils_str_middle_truncate
#define utils_str_remove_chars \
geany_functions->p_utils->utils_str_remove_chars
#define utils_get_file_list_full \
geany_functions->p_utils->utils_get_file_list_full
#define utils_copy_environment \
geany_functions->p_utils->utils_copy_environment
#define utils_find_open_xml_tag \
geany_functions->p_utils->utils_find_open_xml_tag
#define utils_find_open_xml_tag_pos \
geany_functions->p_utils->utils_find_open_xml_tag_pos
#define ui_dialog_vbox_new \
geany_functions->p_ui->ui_dialog_vbox_new
#define ui_frame_new_with_alignment \
geany_functions->p_ui->ui_frame_new_with_alignment
#define ui_set_statusbar \
geany_functions->p_ui->ui_set_statusbar
#define ui_table_add_row \
geany_functions->p_ui->ui_table_add_row
#define ui_path_box_new \
geany_functions->p_ui->ui_path_box_new
#define ui_button_new_with_image \
geany_functions->p_ui->ui_button_new_with_image
#define ui_add_document_sensitive \
geany_functions->p_ui->ui_add_document_sensitive
#define ui_widget_set_tooltip_text \
geany_functions->p_ui->ui_widget_set_tooltip_text
#define ui_image_menu_item_new \
geany_functions->p_ui->ui_image_menu_item_new
#define ui_lookup_widget \
geany_functions->p_ui->ui_lookup_widget
#define ui_progress_bar_start \
geany_functions->p_ui->ui_progress_bar_start
#define ui_progress_bar_stop \
geany_functions->p_ui->ui_progress_bar_stop
#define ui_entry_add_clear_icon \
geany_functions->p_ui->ui_entry_add_clear_icon
#define ui_menu_add_document_items \
geany_functions->p_ui->ui_menu_add_document_items
#define ui_widget_modify_font_from_string \
geany_functions->p_ui->ui_widget_modify_font_from_string
#define ui_is_keyval_enter_or_return \
geany_functions->p_ui->ui_is_keyval_enter_or_return
#define ui_get_gtk_settings_integer \
geany_functions->p_ui->ui_get_gtk_settings_integer
#define ui_combo_box_add_to_history \
geany_functions->p_ui->ui_combo_box_add_to_history
#define ui_menu_add_document_items_sorted \
geany_functions->p_ui->ui_menu_add_document_items_sorted
#define ui_lookup_stock_label \
geany_functions->p_ui->ui_lookup_stock_label
#define ui_tree_view_set_tooltip_text_column \
geany_functions->p_ui->ui_tree_view_set_tooltip_text_column
#define dialogs_show_question \
geany_functions->p_dialogs->dialogs_show_question
#define dialogs_show_msgbox \
geany_functions->p_dialogs->dialogs_show_msgbox
#define dialogs_show_save_as \
geany_functions->p_dialogs->dialogs_show_save_as
#define dialogs_show_input_numeric \
geany_functions->p_dialogs->dialogs_show_input_numeric
#define dialogs_show_input \
geany_functions->p_dialogs->dialogs_show_input
#define msgwin_status_add \
geany_functions->p_msgwin->msgwin_status_add
#define msgwin_compiler_add \
geany_functions->p_msgwin->msgwin_compiler_add
#define msgwin_msg_add \
geany_functions->p_msgwin->msgwin_msg_add
#define msgwin_clear_tab \
geany_functions->p_msgwin->msgwin_clear_tab
#define msgwin_switch_tab \
geany_functions->p_msgwin->msgwin_switch_tab
#define msgwin_set_messages_dir \
geany_functions->p_msgwin->msgwin_set_messages_dir
#define encodings_convert_to_utf8 \
geany_functions->p_encodings->encodings_convert_to_utf8
#define encodings_convert_to_utf8_from_charset \
geany_functions->p_encodings->encodings_convert_to_utf8_from_charset
#define encodings_get_charset_from_index \
geany_functions->p_encodings->encodings_get_charset_from_index
#define keybindings_send_command \
geany_functions->p_keybindings->keybindings_send_command
#define keybindings_set_item \
geany_functions->p_keybindings->keybindings_set_item
#define keybindings_get_item \
geany_functions->p_keybindings->keybindings_get_item
#define keybindings_get_modifiers \
geany_functions->p_keybindings->keybindings_get_modifiers
#define tm_get_real_path \
geany_functions->p_tm->tm_get_real_path
#define tm_source_file_new \
geany_functions->p_tm->tm_source_file_new
#define tm_source_file_free \
geany_functions->p_tm->tm_source_file_free
#define tm_workspace_add_source_file \
geany_functions->p_tm->tm_workspace_add_source_file
#define tm_workspace_remove_source_file \
geany_functions->p_tm->tm_workspace_remove_source_file
#define tm_workspace_add_source_files \
geany_functions->p_tm->tm_workspace_add_source_files
#define tm_workspace_remove_source_files \
geany_functions->p_tm->tm_workspace_remove_source_files
#define search_show_find_in_files_dialog \
geany_functions->p_search->search_show_find_in_files_dialog
#define highlighting_get_style \
geany_functions->p_highlighting->highlighting_get_style
#define highlighting_set_styles \
geany_functions->p_highlighting->highlighting_set_styles
#define highlighting_is_string_style \
geany_functions->p_highlighting->highlighting_is_string_style
#define highlighting_is_comment_style \
geany_functions->p_highlighting->highlighting_is_comment_style
#define highlighting_is_code_style \
geany_functions->p_highlighting->highlighting_is_code_style
#define filetypes_detect_from_file \
geany_functions->p_filetypes->filetypes_detect_from_file
#define filetypes_lookup_by_name \
geany_functions->p_filetypes->filetypes_lookup_by_name
#define filetypes_index \
geany_functions->p_filetypes->filetypes_index
#define filetypes_get_display_name \
geany_functions->p_filetypes->filetypes_get_display_name
#define filetypes_get_sorted_by_name \
geany_functions->p_filetypes->filetypes_get_sorted_by_name
#define navqueue_goto_line \
geany_functions->p_navqueue->navqueue_goto_line
#define main_reload_configuration \
geany_functions->p_main->main_reload_configuration
#define main_locale_init \
geany_functions->p_main->main_locale_init
#define main_is_realized \
geany_functions->p_main->main_is_realized
#define stash_group_new \
geany_functions->p_stash->stash_group_new
#define stash_group_add_boolean \
geany_functions->p_stash->stash_group_add_boolean
#define stash_group_add_integer \
geany_functions->p_stash->stash_group_add_integer
#define stash_group_add_string \
geany_functions->p_stash->stash_group_add_string
#define stash_group_add_string_vector \
geany_functions->p_stash->stash_group_add_string_vector
#define stash_group_load_from_key_file \
geany_functions->p_stash->stash_group_load_from_key_file
#define stash_group_save_to_key_file \
geany_functions->p_stash->stash_group_save_to_key_file
#define stash_group_free \
geany_functions->p_stash->stash_group_free
#define stash_group_load_from_file \
geany_functions->p_stash->stash_group_load_from_file
#define stash_group_save_to_file \
geany_functions->p_stash->stash_group_save_to_file
#define stash_group_add_toggle_button \
geany_functions->p_stash->stash_group_add_toggle_button
#define stash_group_add_radio_buttons \
geany_functions->p_stash->stash_group_add_radio_buttons
#define stash_group_add_spin_button_integer \
geany_functions->p_stash->stash_group_add_spin_button_integer
#define stash_group_add_combo_box \
geany_functions->p_stash->stash_group_add_combo_box
#define stash_group_add_combo_box_entry \
geany_functions->p_stash->stash_group_add_combo_box_entry
#define stash_group_add_entry \
geany_functions->p_stash->stash_group_add_entry
#define stash_group_add_widget_property \
geany_functions->p_stash->stash_group_add_widget_property
#define stash_group_display \
geany_functions->p_stash->stash_group_display
#define stash_group_update \
geany_functions->p_stash->stash_group_update
#define stash_group_free_settings \
geany_functions->p_stash->stash_group_free_settings
#define symbols_get_context_separator \
geany_functions->p_symbols->symbols_get_context_separator
#define build_activate_menu_item \
geany_functions->p_build->build_activate_menu_item
#define build_get_current_menu_item \
geany_functions->p_build->build_get_current_menu_item
#define build_remove_menu_item \
geany_functions->p_build->build_remove_menu_item
#define build_set_menu_item \
geany_functions->p_build->build_set_menu_item
#define build_get_group_count \
geany_functions->p_build->build_get_group_count
#define project_write_config \
geany_functions->p_project->project_write_config
/* This remains so that older plugins that contain a `GeanyFunctions *geany_functions;`
* variable in their plugin - as was previously required - will still compile
* without changes. */
typedef struct GeanyFunctionsUndefined GeanyFunctions;
#endif
#endif /* GEANY_FUNCTIONS */

View File

@ -28,27 +28,36 @@
#ifndef GEANY_PLUGIN_H
#define GEANY_PLUGIN_H 1
/* Note: only include headers that define types or macros, not just functions */
#ifndef HAVE_PLUGINS
# define HAVE_PLUGINS 1
#endif
/* Only include public headers here */
#include "app.h"
#include "dialogs.h"
#include "document.h"
#include "editor.h"
#include "encodings.h"
#include "filetypes.h"
#include "geany.h"
#include "geanyfunctions.h"
#include "highlighting.h"
#include "keybindings.h"
#include "main.h"
#include "msgwindow.h"
#include "navqueue.h"
#include "plugindata.h"
#include "pluginutils.h"
#include "prefs.h"
#include "project.h"
#include "sciwrappers.h"
#include "search.h"
#include "stash.h"
#include "support.h"
#include "symbols.h"
#include "templates.h"
#include "toolbar.h"
#include "ui_utils.h"
#include "utils.h"
#include "geanyfunctions.h"
#endif

View File

@ -1,98 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# genapi.py - this file is part of Geany, a fast and lightweight IDE
#
# Copyright 2008-2011 Nick Treleaven <nick.treleaven<at>btinternet.com>
# Copyright 2008-2011 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# $(Id)
r"""
Creates macros for each plugin API function pointer, e.g.:
#define plugin_add_toolbar_item \
geany_functions->p_plugin->plugin_add_toolbar_item
"""
import re
import sys
def get_function_names():
names = []
filep = open('../src/plugins.c')
while 1:
line = filep.readline()
if line == "":
break
match = re.match("^\t&([a-z][a-z0-9_]+)", line)
if match:
symbol = match.group(1)
if not symbol.endswith('_funcs'):
names.append(symbol)
filep.close()
return names
def get_api_tuple(source):
match = re.match("^([a-z]+)_([a-z][a-z0-9_]+)$", source)
return 'p_' + match.group(1), match.group(2)
header = \
r'''/* This file is generated automatically by genapi.py - do not edit. */
/** @file %s @ref geany_functions wrappers.
* This allows the use of normal API function names in plugins by defining macros.
*
* E.g.:@code
* #define plugin_add_toolbar_item \
* geany_functions->p_plugin->plugin_add_toolbar_item @endcode
*
* You need to declare the @ref geany_functions symbol yourself.
*
* Note: This must be included after all other API headers to prevent conflicts with
* other header's function prototypes - this is done for you when using geanyplugin.h.
*/
#ifndef GEANY_FUNCTIONS_H
#define GEANY_FUNCTIONS_H
'''
if __name__ == "__main__":
outfile = 'geanyfunctions.h'
fnames = get_function_names()
if not fnames:
sys.exit("No function names read!")
f = open(outfile, 'w')
f.write(header % (outfile))
for fname in fnames:
ptr, name = get_api_tuple(fname)
# note: name no longer needed
f.write('#define %s \\\n\tgeany_functions->%s->%s\n' % (fname, ptr, fname))
f.write('\n#endif\n')
f.close()
if not '-q' in sys.argv:
sys.stdout.write('Generated %s\n' % outfile)

View File

@ -67,6 +67,7 @@ geany_includedir = $(includedir)/geany
geany_include_HEADERS = \
app.h \
build.h \
dialogs.h \
document.h \
editor.h \
encodings.h \
@ -75,13 +76,18 @@ geany_include_HEADERS = \
gtkcompat.h \
highlighting.h \
keybindings.h \
main.h \
msgwindow.h \
navqueue.h \
plugindata.h \
pluginutils.h \
prefs.h \
project.h \
sciwrappers.h \
search.h \
stash.h \
support.h \
symbols.h \
templates.h \
toolbar.h \
ui_utils.h \

View File

@ -265,496 +265,6 @@ void plugin_cleanup(void);
#endif
/** This contains pointers to functions owned by Geany for plugins to use.
* Functions from the core can be appended when needed by plugin authors, but may
* require some changes. */
typedef struct GeanyFunctions
{
struct DocumentFuncs *p_document; /**< See document.h */
struct SciFuncs *p_sci; /**< See sciwrappers.h */
struct TemplateFuncs *p_templates; /**< See templates.h */
struct UtilsFuncs *p_utils; /**< See utils.h */
struct UIUtilsFuncs *p_ui; /**< See ui_utils.h */
/** @deprecated Use ui_lookup_widget() instead. */
struct SupportFuncs *p_support;
struct DialogFuncs *p_dialogs; /**< See dialogs.h */
/** @deprecated Use @ref GeanyFunctions::p_msgwin instead. */
struct MsgWinFuncs *p_msgwindow;
struct EncodingFuncs *p_encodings; /**< See encodings.h */
struct KeybindingFuncs *p_keybindings; /**< See keybindings.h */
struct TagManagerFuncs *p_tm; /**< See tagmanager/src */
struct SearchFuncs *p_search; /**< See search.h */
struct HighlightingFuncs *p_highlighting; /**< See highlighting.h */
struct FiletypeFuncs *p_filetypes; /**< See filetypes.h */
struct NavQueueFuncs *p_navqueue; /**< See navqueue.h */
struct EditorFuncs *p_editor; /**< See editor.h */
struct MainFuncs *p_main; /**< See main.h */
struct PluginFuncs *p_plugin; /**< See pluginutils.c */
struct ScintillaFuncs *p_scintilla; /**< See ScintillaFuncs */
struct MsgWinFuncs *p_msgwin; /**< See msgwindow.h */
struct StashFuncs *p_stash; /**< See stash.h */
struct SymbolsFuncs *p_symbols; /**< See symbols.h */
struct BuildFuncs *p_build; /**< See build.h */
struct ProjectFuncs *p_project; /**< See project.h */
}
GeanyFunctions;
/* For more information about these functions, see the main source code.
* E.g. for p_document->new_file(), see document_new_file() in document.c. */
/* See document.h */
typedef struct DocumentFuncs
{
struct GeanyDocument* (*document_new_file) (const gchar *utf8_filename, struct GeanyFiletype *ft,
const gchar *text);
struct GeanyDocument* (*document_get_current) (void);
struct GeanyDocument* (*document_get_from_page) (guint page_num);
struct GeanyDocument* (*document_find_by_filename) (const gchar *utf8_filename);
struct GeanyDocument* (*document_find_by_real_path) (const gchar *realname);
gboolean (*document_save_file) (struct GeanyDocument *doc, gboolean force);
struct GeanyDocument* (*document_open_file) (const gchar *locale_filename, gboolean readonly,
struct GeanyFiletype *ft, const gchar *forced_enc);
void (*document_open_files) (const GSList *filenames, gboolean readonly,
struct GeanyFiletype *ft, const gchar *forced_enc);
gboolean (*document_remove_page) (guint page_num);
gboolean (*document_reload_force) (struct GeanyDocument *doc, const gchar *forced_enc);
void (*document_set_encoding) (struct GeanyDocument *doc, const gchar *new_encoding);
void (*document_set_text_changed) (struct GeanyDocument *doc, gboolean changed);
void (*document_set_filetype) (struct GeanyDocument *doc, struct GeanyFiletype *type);
gboolean (*document_close) (struct GeanyDocument *doc);
struct GeanyDocument* (*document_index)(gint idx);
gboolean (*document_save_file_as) (struct GeanyDocument *doc, const gchar *utf8_fname);
void (*document_rename_file) (struct GeanyDocument *doc, const gchar *new_filename);
const GdkColor* (*document_get_status_color) (struct GeanyDocument *doc);
gchar* (*document_get_basename_for_display) (struct GeanyDocument *doc, gint length);
gint (*document_get_notebook_page) (struct GeanyDocument *doc);
gint (*document_compare_by_display_name) (gconstpointer a, gconstpointer b);
gint (*document_compare_by_tab_order) (gconstpointer a, gconstpointer b);
gint (*document_compare_by_tab_order_reverse) (gconstpointer a, gconstpointer b);
GeanyDocument* (*document_find_by_id)(guint id);
}
DocumentFuncs;
struct _ScintillaObject;
/** See http://scintilla.org for the full documentation. */
typedef struct ScintillaFuncs
{
/** Send Scintilla a message. */
long int (*scintilla_send_message) (struct _ScintillaObject *sci, unsigned int iMessage,
long unsigned int wParam, long int lParam);
/** Create a new ScintillaObject widget. */
GtkWidget* (*scintilla_new)(void);
}
ScintillaFuncs;
/** Wrapper functions for Scintilla messages.
* See sciwrappers.h for the list of functions. */
typedef struct SciFuncs
{
/** @deprecated Use @c scintilla_send_message() instead. */
long int (*sci_send_message) (struct _ScintillaObject *sci, unsigned int iMessage,
long unsigned int wParam, long int lParam);
void (*sci_send_command) (struct _ScintillaObject *sci, gint cmd);
void (*sci_start_undo_action) (struct _ScintillaObject *sci);
void (*sci_end_undo_action) (struct _ScintillaObject *sci);
void (*sci_set_text) (struct _ScintillaObject *sci, const gchar *text);
void (*sci_insert_text) (struct _ScintillaObject *sci, gint pos, const gchar *text);
void (*sci_get_text) (struct _ScintillaObject *sci, gint len, gchar *text);
gint (*sci_get_length) (struct _ScintillaObject *sci);
gint (*sci_get_current_position) (struct _ScintillaObject *sci);
void (*sci_set_current_position) (struct _ScintillaObject *sci, gint position,
gboolean scroll_to_caret);
gint (*sci_get_col_from_position) (struct _ScintillaObject *sci, gint position);
gint (*sci_get_line_from_position) (struct _ScintillaObject *sci, gint position);
gint (*sci_get_position_from_line) (struct _ScintillaObject *sci, gint line);
void (*sci_replace_sel) (struct _ScintillaObject *sci, const gchar *text);
void (*sci_get_selected_text) (struct _ScintillaObject *sci, gchar *text);
gint (*sci_get_selected_text_length) (struct _ScintillaObject *sci);
gint (*sci_get_selection_start) (struct _ScintillaObject *sci);
gint (*sci_get_selection_end) (struct _ScintillaObject *sci);
gint (*sci_get_selection_mode) (struct _ScintillaObject *sci);
void (*sci_set_selection_mode) (struct _ScintillaObject *sci, gint mode);
void (*sci_set_selection_start) (struct _ScintillaObject *sci, gint position);
void (*sci_set_selection_end) (struct _ScintillaObject *sci, gint position);
void (*sci_get_text_range) (struct _ScintillaObject *sci, gint start, gint end, gchar *text);
gchar* (*sci_get_line) (struct _ScintillaObject *sci, gint line_num);
gint (*sci_get_line_length) (struct _ScintillaObject *sci, gint line);
gint (*sci_get_line_count) (struct _ScintillaObject *sci);
gboolean (*sci_get_line_is_visible) (struct _ScintillaObject *sci, gint line);
void (*sci_ensure_line_is_visible) (struct _ScintillaObject *sci, gint line);
void (*sci_scroll_caret) (struct _ScintillaObject *sci);
gint (*sci_find_matching_brace) (struct _ScintillaObject *sci, gint pos);
gint (*sci_get_style_at) (struct _ScintillaObject *sci, gint position);
gchar (*sci_get_char_at) (struct _ScintillaObject *sci, gint pos);
gint (*sci_get_current_line) (struct _ScintillaObject *sci);
gboolean (*sci_has_selection) (struct _ScintillaObject *sci);
gint (*sci_get_tab_width) (struct _ScintillaObject *sci);
void (*sci_indicator_clear) (struct _ScintillaObject *sci, gint start, gint end);
void (*sci_indicator_set) (struct _ScintillaObject *sci, gint indic);
gchar* (*sci_get_contents) (struct _ScintillaObject *sci, gint len);
gchar* (*sci_get_contents_range) (struct _ScintillaObject *sci, gint start, gint end);
gchar* (*sci_get_selection_contents) (struct _ScintillaObject *sci);
void (*sci_set_font) (struct _ScintillaObject *sci, gint style, const gchar *font, gint size);
gint (*sci_get_line_end_position) (struct _ScintillaObject *sci, gint line);
void (*sci_set_target_start) (struct _ScintillaObject *sci, gint start);
void (*sci_set_target_end) (struct _ScintillaObject *sci, gint end);
gint (*sci_replace_target) (struct _ScintillaObject *sci, const gchar *text, gboolean regex);
void (*sci_set_marker_at_line) (struct _ScintillaObject *sci, gint line_number, gint marker);
void (*sci_delete_marker_at_line) (struct _ScintillaObject *sci, gint line_number, gint marker);
gboolean (*sci_is_marker_set_at_line) (struct _ScintillaObject *sci, gint line, gint marker);
void (*sci_goto_line) (struct _ScintillaObject *sci, gint line, gboolean unfold);
gint (*sci_find_text) (struct _ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf);
void (*sci_set_line_indentation) (struct _ScintillaObject *sci, gint line, gint indent);
gint (*sci_get_line_indentation) (struct _ScintillaObject *sci, gint line);
gint (*sci_get_lexer) (struct _ScintillaObject *sci);
}
SciFuncs;
/* See templates.h */
typedef struct TemplateFuncs
{
gchar* (*templates_get_template_fileheader) (gint filetype_idx, const gchar *fname);
}
TemplateFuncs;
/* See utils.h */
typedef struct UtilsFuncs
{
gboolean (*utils_str_equal) (const gchar *a, const gchar *b);
guint (*utils_string_replace_all) (GString *haystack, const gchar *needle,
const gchar *replacement);
GSList* (*utils_get_file_list) (const gchar *path, guint *length, GError **error);
gint (*utils_write_file) (const gchar *filename, const gchar *text);
gchar* (*utils_get_locale_from_utf8) (const gchar *utf8_text);
gchar* (*utils_get_utf8_from_locale) (const gchar *locale_text);
gchar* (*utils_remove_ext_from_filename) (const gchar *filename);
gint (*utils_mkdir) (const gchar *path, gboolean create_parent_dirs);
gboolean (*utils_get_setting_boolean) (GKeyFile *config, const gchar *section, const gchar *key,
const gboolean default_value);
gint (*utils_get_setting_integer) (GKeyFile *config, const gchar *section, const gchar *key,
const gint default_value);
gchar* (*utils_get_setting_string) (GKeyFile *config, const gchar *section, const gchar *key,
const gchar *default_value);
gboolean (*utils_spawn_sync) (const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags,
GSpawnChildSetupFunc child_setup, gpointer user_data, gchar **std_out,
gchar **std_err, gint *exit_status, GError **error);
gboolean (*utils_spawn_async) (const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags,
GSpawnChildSetupFunc child_setup, gpointer user_data, GPid *child_pid,
GError **error);
gint (*utils_str_casecmp) (const gchar *s1, const gchar *s2);
gchar* (*utils_get_date_time) (const gchar *format, time_t *time_to_use);
void (*utils_open_browser) (const gchar *uri);
guint (*utils_string_replace_first) (GString *haystack, const gchar *needle,
const gchar *replace);
gchar* (*utils_str_middle_truncate) (const gchar *string, guint truncate_length);
gchar* (*utils_str_remove_chars) (gchar *string, const gchar *chars);
GSList* (*utils_get_file_list_full)(const gchar *path, gboolean full_path, gboolean sort,
GError **error);
gchar** (*utils_copy_environment)(const gchar **exclude_vars, const gchar *first_varname, ...);
gchar* (*utils_find_open_xml_tag) (const gchar sel[], gint size);
const gchar* (*utils_find_open_xml_tag_pos) (const gchar sel[], gint size);
}
UtilsFuncs;
/* See main.h */
typedef struct MainFuncs
{
void (*main_reload_configuration) (void);
void (*main_locale_init) (const gchar *locale_dir, const gchar *package);
gboolean (*main_is_realized) (void);
}
MainFuncs;
/* See ui_utils.h */
typedef struct UIUtilsFuncs
{
GtkWidget* (*ui_dialog_vbox_new) (GtkDialog *dialog);
GtkWidget* (*ui_frame_new_with_alignment) (const gchar *label_text, GtkWidget **alignment);
void (*ui_set_statusbar) (gboolean log, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
void (*ui_table_add_row) (GtkTable *table, gint row, ...) G_GNUC_NULL_TERMINATED;
GtkWidget* (*ui_path_box_new) (const gchar *title, GtkFileChooserAction action, GtkEntry *entry);
GtkWidget* (*ui_button_new_with_image) (const gchar *stock_id, const gchar *text);
void (*ui_add_document_sensitive) (GtkWidget *widget);
void (*ui_widget_set_tooltip_text) (GtkWidget *widget, const gchar *text);
GtkWidget* (*ui_image_menu_item_new) (const gchar *stock_id, const gchar *label);
GtkWidget* (*ui_lookup_widget) (GtkWidget *widget, const gchar *widget_name);
void (*ui_progress_bar_start) (const gchar *text);
void (*ui_progress_bar_stop) (void);
void (*ui_entry_add_clear_icon) (GtkEntry *entry);
void (*ui_menu_add_document_items) (GtkMenu *menu, struct GeanyDocument *active,
GCallback callback);
void (*ui_widget_modify_font_from_string) (GtkWidget *widget, const gchar *str);
gboolean (*ui_is_keyval_enter_or_return) (guint keyval);
gint (*ui_get_gtk_settings_integer) (const gchar *property_name, gint default_value);
void (*ui_combo_box_add_to_history) (GtkComboBoxText *combo_entry,
const gchar *text, gint history_len);
void (*ui_menu_add_document_items_sorted) (GtkMenu *menu, struct GeanyDocument *active,
GCallback callback, GCompareFunc compare_func);
const gchar* (*ui_lookup_stock_label)(const gchar *stock_id);
void (*ui_tree_view_set_tooltip_text_column) (GtkTreeView *tree_view, gint column);
}
UIUtilsFuncs;
/* See dialogs.h */
typedef struct DialogFuncs
{
gboolean (*dialogs_show_question) (const gchar *text, ...) G_GNUC_PRINTF (1, 2);
void (*dialogs_show_msgbox) (GtkMessageType type, const gchar *text, ...) G_GNUC_PRINTF (2, 3);
gboolean (*dialogs_show_save_as) (void);
gboolean (*dialogs_show_input_numeric) (const gchar *title, const gchar *label_text,
gdouble *value, gdouble min, gdouble max, gdouble step);
gchar* (*dialogs_show_input)(const gchar *title, GtkWindow *parent, const gchar *label_text,
const gchar *default_text);
}
DialogFuncs;
/* @deprecated Use ui_lookup_widget() instead. */
typedef struct SupportFuncs
{
GtkWidget* (*support_lookup_widget) (GtkWidget *widget, const gchar *widget_name);
}
SupportFuncs;
/* See msgwindow.h */
typedef struct MsgWinFuncs
{
/* status_add() does not set the status bar - use ui->set_statusbar() instead. */
void (*msgwin_status_add) (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
void (*msgwin_compiler_add) (gint msg_color, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
void (*msgwin_msg_add) (gint msg_color, gint line, struct GeanyDocument *doc,
const gchar *format, ...) G_GNUC_PRINTF (4, 5);
void (*msgwin_clear_tab) (gint tabnum);
void (*msgwin_switch_tab) (gint tabnum, gboolean show);
void (*msgwin_set_messages_dir) (const gchar *messages_dir);
}
MsgWinFuncs;
/* See encodings.h */
typedef struct EncodingFuncs
{
gchar* (*encodings_convert_to_utf8) (const gchar *buffer, gssize size, gchar **used_encoding);
gchar* (*encodings_convert_to_utf8_from_charset) (const gchar *buffer, gssize size,
const gchar *charset, gboolean fast);
const gchar* (*encodings_get_charset_from_index) (gint idx);
}
EncodingFuncs;
struct GeanyKeyGroup;
/* avoid including keybindings.h */
typedef void (*_GeanyKeyCallback) (guint key_id);
/* See keybindings.h */
typedef struct KeybindingFuncs
{
void (*keybindings_send_command) (guint group_id, guint key_id);
struct GeanyKeyBinding* (*keybindings_set_item) (struct GeanyKeyGroup *group, gsize key_id,
_GeanyKeyCallback callback, guint key, GdkModifierType mod,
const gchar *name, const gchar *label, GtkWidget *menu_item);
struct GeanyKeyBinding* (*keybindings_get_item)(struct GeanyKeyGroup *group, gsize key_id);
GdkModifierType (*keybindings_get_modifiers)(GdkModifierType mods);
}
KeybindingFuncs;
/* See highlighting.h */
typedef struct HighlightingFuncs
{
const struct GeanyLexerStyle* (*highlighting_get_style) (gint ft_id, gint style_id);
void (*highlighting_set_styles) (struct _ScintillaObject *sci, struct GeanyFiletype *ft);
gboolean (*highlighting_is_string_style) (gint lexer, gint style);
gboolean (*highlighting_is_comment_style) (gint lexer, gint style);
gboolean (*highlighting_is_code_style) (gint lexer, gint style);
}
HighlightingFuncs;
/* See filetypes.h */
typedef struct FiletypeFuncs
{
GeanyFiletype* (*filetypes_detect_from_file) (const gchar *utf8_filename);
GeanyFiletype* (*filetypes_lookup_by_name) (const gchar *name);
GeanyFiletype* (*filetypes_index)(gint idx);
const gchar* (*filetypes_get_display_name)(GeanyFiletype *ft);
const GSList* (*filetypes_get_sorted_by_name)(void);
/* Remember to convert any filetype_id arguments to GeanyFiletype pointers in any
* appended functions */
}
FiletypeFuncs;
/* See search.h */
typedef struct SearchFuncs
{
void (*search_show_find_in_files_dialog) (const gchar *dir);
}
SearchFuncs;
/* See tagmanager/include */
typedef struct TagManagerFuncs
{
gchar* (*tm_get_real_path) (const gchar *file_name);
TMSourceFile* (*tm_source_file_new) (const char *file_name, const char *name);
void (*tm_source_file_free) (TMSourceFile *source_file);
void (*tm_workspace_add_source_file) (TMSourceFile *source_file);
void (*tm_workspace_remove_source_file) (TMSourceFile *source_file);
void (*tm_workspace_add_source_files) (GPtrArray *source_files);
void (*tm_workspace_remove_source_files) (GPtrArray *source_files);
}
TagManagerFuncs;
/* See navqueue.h */
typedef struct NavQueueFuncs
{
gboolean (*navqueue_goto_line) (struct GeanyDocument *old_doc, struct GeanyDocument *new_doc,
gint line);
}
NavQueueFuncs;
struct GeanyEditor;
/* See editor.h */
typedef struct EditorFuncs
{
const struct GeanyIndentPrefs* (*editor_get_indent_prefs)(struct GeanyEditor *editor);
struct _ScintillaObject* (*editor_create_widget)(struct GeanyEditor *editor);
void (*editor_indicator_set_on_range) (struct GeanyEditor *editor, gint indic, gint start, gint end);
void (*editor_indicator_set_on_line) (struct GeanyEditor *editor, gint indic, gint line);
void (*editor_indicator_clear) (struct GeanyEditor *editor, gint indic);
void (*editor_set_indent_type)(struct GeanyEditor *editor, GeanyIndentType type);
gchar* (*editor_get_word_at_pos) (struct GeanyEditor *editor, gint pos, const gchar *wordchars);
const gchar* (*editor_get_eol_char_name) (struct GeanyEditor *editor);
gint (*editor_get_eol_char_len) (struct GeanyEditor *editor);
const gchar* (*editor_get_eol_char) (struct GeanyEditor *editor);
void (*editor_insert_text_block) (struct GeanyEditor *editor, const gchar *text,
gint insert_pos, gint cursor_index, gint newline_indent_size,
gboolean replace_newlines);
gint (*editor_get_eol_char_mode) (struct GeanyEditor *editor);
gboolean (*editor_goto_pos) (struct GeanyEditor *editor, gint pos, gboolean mark);
const gchar* (*editor_find_snippet) (struct GeanyEditor *editor, const gchar *snippet_name);
void (*editor_insert_snippet) (struct GeanyEditor *editor, gint pos, const gchar *snippet);
}
EditorFuncs;
/* avoid including keybindings.h */
typedef gboolean (*_GeanyKeyGroupCallback) (guint key_id);
/* See pluginutils.c */
typedef struct PluginFuncs
{
void (*plugin_add_toolbar_item)(GeanyPlugin *plugin, GtkToolItem *item);
void (*plugin_module_make_resident) (GeanyPlugin *plugin);
void (*plugin_signal_connect) (GeanyPlugin *plugin,
GObject *object, const gchar *signal_name, gboolean after,
GCallback callback, gpointer user_data);
struct GeanyKeyGroup* (*plugin_set_key_group)(GeanyPlugin *plugin,
const gchar *section_name, gsize count, _GeanyKeyGroupCallback callback);
void (*plugin_show_configure)(GeanyPlugin *plugin);
guint (*plugin_timeout_add) (GeanyPlugin *plugin, guint interval, GSourceFunc function,
gpointer data);
guint (*plugin_timeout_add_seconds) (GeanyPlugin *plugin, guint interval,
GSourceFunc function, gpointer data);
guint (*plugin_idle_add) (GeanyPlugin *plugin, GSourceFunc function, gpointer data);
void (*plugin_builder_connect_signals) (GeanyPlugin *plugin, GtkBuilder *builder, gpointer user_data);
}
PluginFuncs;
struct StashGroup;
/* See stash.h */
typedef struct StashFuncs
{
struct StashGroup *(*stash_group_new)(const gchar *name);
void (*stash_group_add_boolean)(struct StashGroup *group, gboolean *setting,
const gchar *key_name, gboolean default_value);
void (*stash_group_add_integer)(struct StashGroup *group, gint *setting,
const gchar *key_name, gint default_value);
void (*stash_group_add_string)(struct StashGroup *group, gchar **setting,
const gchar *key_name, const gchar *default_value);
void (*stash_group_add_string_vector)(struct StashGroup *group, gchar ***setting,
const gchar *key_name, const gchar **default_value);
void (*stash_group_load_from_key_file)(struct StashGroup *group, GKeyFile *keyfile);
void (*stash_group_save_to_key_file)(struct StashGroup *group, GKeyFile *keyfile);
void (*stash_group_free)(struct StashGroup *group);
gboolean (*stash_group_load_from_file)(struct StashGroup *group, const gchar *filename);
gint (*stash_group_save_to_file)(struct StashGroup *group, const gchar *filename,
GKeyFileFlags flags);
void (*stash_group_add_toggle_button)(struct StashGroup *group, gboolean *setting,
const gchar *key_name, gboolean default_value, gconstpointer widget_id);
void (*stash_group_add_radio_buttons)(struct StashGroup *group, gint *setting,
const gchar *key_name, gint default_value,
gconstpointer widget_id, gint enum_id, ...) G_GNUC_NULL_TERMINATED;
void (*stash_group_add_spin_button_integer)(struct StashGroup *group, gint *setting,
const gchar *key_name, gint default_value, gconstpointer widget_id);
void (*stash_group_add_combo_box)(struct StashGroup *group, gint *setting,
const gchar *key_name, gint default_value, gconstpointer widget_id);
void (*stash_group_add_combo_box_entry)(struct StashGroup *group, gchar **setting,
const gchar *key_name, const gchar *default_value, gconstpointer widget_id);
void (*stash_group_add_entry)(struct StashGroup *group, gchar **setting,
const gchar *key_name, const gchar *default_value, gconstpointer widget_id);
void (*stash_group_add_widget_property)(struct StashGroup *group, gpointer setting,
const gchar *key_name, gpointer default_value, gconstpointer widget_id,
const gchar *property_name, GType type);
void (*stash_group_display)(struct StashGroup *group, GtkWidget *owner);
void (*stash_group_update)(struct StashGroup *group, GtkWidget *owner);
void (*stash_group_free_settings)(struct StashGroup *group);
}
StashFuncs;
/* See symbols.h */
typedef struct SymbolsFuncs
{
const gchar* (*symbols_get_context_separator)(gint ft_id);
}
SymbolsFuncs;
/* See build.h */
typedef struct BuildFuncs
{
void (*build_activate_menu_item)(const GeanyBuildGroup grp, const guint cmd);
const gchar *(*build_get_current_menu_item)(const GeanyBuildGroup grp, const guint cmd,
const GeanyBuildCmdEntries field);
void (*build_remove_menu_item)(const GeanyBuildSource src, const GeanyBuildGroup grp,
const gint cmd);
void (*build_set_menu_item)(const GeanyBuildSource src, const GeanyBuildGroup grp,
const guint cmd, const GeanyBuildCmdEntries field, const gchar *value);
guint (*build_get_group_count)(const GeanyBuildGroup grp);
}
BuildFuncs;
/* See project.h */
typedef struct ProjectFuncs
{
void (*project_write_config)(void);
}
ProjectFuncs;
/* Deprecated aliases */
#ifndef GEANY_DISABLE_DEPRECATED

View File

@ -75,326 +75,6 @@ static GtkWidget *menu_separator = NULL;
static gchar *get_plugin_path(void);
static void pm_show_dialog(GtkMenuItem *menuitem, gpointer user_data);
static PluginFuncs plugin_funcs = {
&plugin_add_toolbar_item,
&plugin_module_make_resident,
&plugin_signal_connect,
&plugin_set_key_group,
&plugin_show_configure,
&plugin_timeout_add,
&plugin_timeout_add_seconds,
&plugin_idle_add,
&plugin_builder_connect_signals
};
static DocumentFuncs doc_funcs = {
&document_new_file,
&document_get_current,
&document_get_from_page,
&document_find_by_filename,
&document_find_by_real_path,
&document_save_file,
&document_open_file,
&document_open_files,
&document_remove_page,
&document_reload_force,
&document_set_encoding,
&document_set_text_changed,
&document_set_filetype,
&document_close,
&document_index,
&document_save_file_as,
&document_rename_file,
&document_get_status_color,
&document_get_basename_for_display,
&document_get_notebook_page,
&document_compare_by_display_name,
&document_compare_by_tab_order,
&document_compare_by_tab_order_reverse,
&document_find_by_id
};
static EditorFuncs editor_funcs = {
&editor_get_indent_prefs,
&editor_create_widget,
&editor_indicator_set_on_range,
&editor_indicator_set_on_line,
&editor_indicator_clear,
&editor_set_indent_type,
&editor_get_word_at_pos,
&editor_get_eol_char_name,
&editor_get_eol_char_len,
&editor_get_eol_char,
&editor_insert_text_block,
&editor_get_eol_char_mode,
&editor_goto_pos,
&editor_find_snippet,
&editor_insert_snippet
};
static ScintillaFuncs scintilla_funcs = {
&scintilla_send_message,
&scintilla_new
};
/* Macro to prevent a duplicate macro being generated in geanyfunctions.h */
#define _scintilla_send_message_macro scintilla_send_message
static SciFuncs sci_funcs = {
&_scintilla_send_message_macro,
&sci_send_command,
&sci_start_undo_action,
&sci_end_undo_action,
&sci_set_text,
&sci_insert_text,
&sci_get_text,
&sci_get_length,
&sci_get_current_position,
&sci_set_current_position,
&sci_get_col_from_position,
&sci_get_line_from_position,
&sci_get_position_from_line,
&sci_replace_sel,
&sci_get_selected_text,
&sci_get_selected_text_length,
&sci_get_selection_start,
&sci_get_selection_end,
&sci_get_selection_mode,
&sci_set_selection_mode,
&sci_set_selection_start,
&sci_set_selection_end,
&sci_get_text_range,
&sci_get_line,
&sci_get_line_length,
&sci_get_line_count,
&sci_get_line_is_visible,
&sci_ensure_line_is_visible,
&sci_scroll_caret,
&sci_find_matching_brace,
&sci_get_style_at,
&sci_get_char_at,
&sci_get_current_line,
&sci_has_selection,
&sci_get_tab_width,
&sci_indicator_clear,
&sci_indicator_set,
&sci_get_contents,
&sci_get_contents_range,
&sci_get_selection_contents,
&sci_set_font,
&sci_get_line_end_position,
&sci_set_target_start,
&sci_set_target_end,
&sci_replace_target,
&sci_set_marker_at_line,
&sci_delete_marker_at_line,
&sci_is_marker_set_at_line,
&sci_goto_line,
&sci_find_text,
&sci_set_line_indentation,
&sci_get_line_indentation,
&sci_get_lexer
};
static TemplateFuncs template_funcs = {
&templates_get_template_fileheader
};
static UtilsFuncs utils_funcs = {
&utils_str_equal,
&utils_string_replace_all,
&utils_get_file_list,
&utils_write_file,
&utils_get_locale_from_utf8,
&utils_get_utf8_from_locale,
&utils_remove_ext_from_filename,
&utils_mkdir,
&utils_get_setting_boolean,
&utils_get_setting_integer,
&utils_get_setting_string,
&utils_spawn_sync,
&utils_spawn_async,
&utils_str_casecmp,
&utils_get_date_time,
&utils_open_browser,
&utils_string_replace_first,
&utils_str_middle_truncate,
&utils_str_remove_chars,
&utils_get_file_list_full,
&utils_copy_environment,
&utils_find_open_xml_tag,
&utils_find_open_xml_tag_pos
};
static UIUtilsFuncs uiutils_funcs = {
&ui_dialog_vbox_new,
&ui_frame_new_with_alignment,
&ui_set_statusbar,
&ui_table_add_row,
&ui_path_box_new,
&ui_button_new_with_image,
&ui_add_document_sensitive,
&ui_widget_set_tooltip_text,
&ui_image_menu_item_new,
&ui_lookup_widget,
&ui_progress_bar_start,
&ui_progress_bar_stop,
&ui_entry_add_clear_icon,
&ui_menu_add_document_items,
&ui_widget_modify_font_from_string,
&ui_is_keyval_enter_or_return,
&ui_get_gtk_settings_integer,
&ui_combo_box_add_to_history,
&ui_menu_add_document_items_sorted,
&ui_lookup_stock_label,
&ui_tree_view_set_tooltip_text_column
};
static DialogFuncs dialog_funcs = {
&dialogs_show_question,
&dialogs_show_msgbox,
&dialogs_show_save_as,
&dialogs_show_input_numeric,
&dialogs_show_input
};
/* Macro to prevent confusing macro being generated in geanyfunctions.h */
#define _lookup_widget_macro ui_lookup_widget
/* deprecated */
static SupportFuncs support_funcs = {
&_lookup_widget_macro
};
static MsgWinFuncs msgwin_funcs = {
&msgwin_status_add,
&msgwin_compiler_add,
&msgwin_msg_add,
&msgwin_clear_tab,
&msgwin_switch_tab,
&msgwin_set_messages_dir
};
static EncodingFuncs encoding_funcs = {
&encodings_convert_to_utf8,
&encodings_convert_to_utf8_from_charset,
&encodings_get_charset_from_index
};
static KeybindingFuncs keybindings_funcs = {
&keybindings_send_command,
&keybindings_set_item,
&keybindings_get_item,
&keybindings_get_modifiers
};
static TagManagerFuncs tagmanager_funcs = {
&tm_get_real_path,
&tm_source_file_new,
&tm_source_file_free,
&tm_workspace_add_source_file,
&tm_workspace_remove_source_file,
&tm_workspace_add_source_files,
&tm_workspace_remove_source_files
};
static SearchFuncs search_funcs = {
&search_show_find_in_files_dialog
};
static HighlightingFuncs highlighting_funcs = {
&highlighting_get_style,
&highlighting_set_styles,
&highlighting_is_string_style,
&highlighting_is_comment_style,
&highlighting_is_code_style
};
static FiletypeFuncs filetype_funcs = {
&filetypes_detect_from_file,
&filetypes_lookup_by_name,
&filetypes_index,
&filetypes_get_display_name,
&filetypes_get_sorted_by_name
};
static NavQueueFuncs navqueue_funcs = {
&navqueue_goto_line
};
static MainFuncs main_funcs = {
&main_reload_configuration,
&main_locale_init,
&main_is_realized
};
static StashFuncs stash_funcs = {
&stash_group_new,
&stash_group_add_boolean,
&stash_group_add_integer,
&stash_group_add_string,
&stash_group_add_string_vector,
&stash_group_load_from_key_file,
&stash_group_save_to_key_file,
&stash_group_free,
&stash_group_load_from_file,
&stash_group_save_to_file,
&stash_group_add_toggle_button,
&stash_group_add_radio_buttons,
&stash_group_add_spin_button_integer,
&stash_group_add_combo_box,
&stash_group_add_combo_box_entry,
&stash_group_add_entry,
&stash_group_add_widget_property,
&stash_group_display,
&stash_group_update,
&stash_group_free_settings
};
static SymbolsFuncs symbols_funcs = {
&symbols_get_context_separator
};
static BuildFuncs build_funcs = {
&build_activate_menu_item,
&build_get_current_menu_item,
&build_remove_menu_item,
&build_set_menu_item,
&build_get_group_count
};
static ProjectFuncs project_funcs = {
&project_write_config
};
static GeanyFunctions geany_functions = {
&doc_funcs,
&sci_funcs,
&template_funcs,
&utils_funcs,
&uiutils_funcs,
&support_funcs,
&dialog_funcs,
&msgwin_funcs,
&encoding_funcs,
&keybindings_funcs,
&tagmanager_funcs,
&search_funcs,
&highlighting_funcs,
&filetype_funcs,
&navqueue_funcs,
&editor_funcs,
&main_funcs,
&plugin_funcs,
&scintilla_funcs,
&msgwin_funcs,
&stash_funcs,
&symbols_funcs,
&build_funcs,
&project_funcs
};
static GeanyData geany_data;
@ -598,7 +278,7 @@ plugin_load(Plugin *plugin)
PluginFields **plugin_fields;
/* set these symbols before plugin_init() is called
* we don't set geany_functions and geany_data since they are set directly by plugin_new() */
* we don't set geany_data since it is set directly by plugin_new() */
g_module_symbol(plugin->module, "geany_plugin", (void *) &p_geany_plugin);
if (p_geany_plugin)
*p_geany_plugin = &plugin->public;
@ -663,7 +343,6 @@ plugin_new(const gchar *fname, gboolean load_plugin, gboolean add_to_list)
Plugin *plugin;
GModule *module;
GeanyData **p_geany_data;
GeanyFunctions **p_geany_functions;
void (*plugin_set_info)(PluginInfo*);
g_return_val_if_fail(fname, NULL);
@ -731,9 +410,6 @@ plugin_new(const gchar *fname, gboolean load_plugin, gboolean add_to_list)
g_module_symbol(module, "geany_data", (void *) &p_geany_data);
if (p_geany_data)
*p_geany_data = &geany_data;
g_module_symbol(module, "geany_functions", (void *) &p_geany_functions);
if (p_geany_functions)
*p_geany_functions = &geany_functions;
/* read plugin name, etc. */
plugin_set_info(&plugin->info);