34 VERSION,
_(
"The Geany developer team"))
82static void on_unsplit(GtkMenuItem *menuitem, gpointer user_data);
94 g_snprintf(tmp_str, 15,
"_%d", len);
159 if (!
geany->editor_prefs->folding)
171 gtk_widget_destroy(GTK_WIDGET(editwin->
sci));
174 gtk_widget_show(GTK_WIDGET(editwin->
sci));
175 gtk_box_pack_start(GTK_BOX(editwin->
vbox), GTK_WIDGET(editwin->
sci), TRUE, TRUE, 0);
181 g_signal_connect(editwin->
sci,
"sci-notify",
190 gtk_widget_set_sensitive(
menu_items.horizontal,
210 if (stock_id && !
label)
219 gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(item), stock_id);
224 gtk_widget_set_tooltip_text(GTK_WIDGET(item), tooltip);
227 return GTK_WIDGET(item);
235 g_return_if_fail(doc);
252 gtk_container_foreach(GTK_CONTAINER(menu), (GtkCallback) gtk_widget_destroy,
NULL);
267 static gboolean block_next = FALSE;
271 g_signal_stop_emission_by_name(button,
"show-menu");
276 GtkWidget *menu = gtk_menu_tool_button_get_menu(button);
277 GtkWidget *parent = gtk_menu_get_attach_widget(GTK_MENU(menu));
279 if (parent && GTK_IS_TOGGLE_BUTTON(parent) && ! gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(parent)))
287 GtkWidget *toolbar, *item;
288 GtkToolItem *tool_item;
290 toolbar = gtk_toolbar_new();
291 gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar), GTK_ICON_SIZE_MENU);
292 gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
294 tool_item = gtk_menu_tool_button_new(
NULL,
NULL);
295 gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(tool_item), GTK_STOCK_JUMP_TO);
296 item = (GtkWidget*)tool_item;
297 gtk_widget_set_tooltip_text(item,
_(
"Show the current document"));
301 item = gtk_menu_new();
302 gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(tool_item), item);
304 if (! gtk_check_version(3, 15, 9) && gtk_check_version(3, 21, 4+1))
306 g_signal_connect(tool_item,
"show-menu", G_CALLBACK(
on_doc_show_menu), item);
308 tool_item = gtk_tool_item_new();
309 gtk_tool_item_set_expand(tool_item, TRUE);
312 item = gtk_label_new(
NULL);
313 gtk_label_set_ellipsize(GTK_LABEL(item), PANGO_ELLIPSIZE_START);
328 GtkWidget *parent = gtk_widget_get_parent(notebook);
329 GtkWidget *pane, *toolbar, *box, *splitwin_notebook;
331 gint width = gtk_widget_get_allocated_width(notebook) / 2;
332 gint height = gtk_widget_get_allocated_height(notebook) / 2;
334 g_return_if_fail(doc);
339 g_object_ref(notebook);
340 gtk_container_remove(GTK_CONTAINER(parent), notebook);
342 pane = gtk_paned_new(
horizontal ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);
346 g_object_unref(notebook);
348 box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
350 gtk_box_pack_start(GTK_BOX(box), toolbar, FALSE, FALSE, 0);
354 splitwin_notebook = gtk_notebook_new();
355 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(splitwin_notebook), FALSE);
356 gtk_notebook_append_page(GTK_NOTEBOOK(splitwin_notebook), box,
NULL);
363 gtk_paned_set_position(GTK_PANED(pane), width);
367 gtk_paned_set_position(GTK_PANED(pane), height);
385static void on_unsplit(GtkMenuItem *menuitem, gpointer user_data)
388 GtkWidget *pane = gtk_widget_get_parent(notebook);
389 GtkWidget *parent = gtk_widget_get_parent(pane);
395 g_object_ref(notebook);
396 gtk_container_remove(GTK_CONTAINER(pane), notebook);
398 gtk_widget_destroy(pane);
403 g_object_unref(notebook);
429 GtkWidget *item, *menu;
432 menu_items.main = item = gtk_menu_item_new_with_mnemonic(
_(
"_Split Window"));
436 menu = gtk_menu_new();
437 gtk_menu_item_set_submenu(GTK_MENU_ITEM(
menu_items.main), menu);
440 gtk_menu_item_new_with_mnemonic(
_(
"_Side by Side"));
442 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
445 gtk_menu_item_new_with_mnemonic(
_(
"_Top and Bottom"));
447 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
450 gtk_menu_item_new_with_mnemonic(
_(
"_Unsplit"));
452 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
461 0, 0,
"split_horizontal",
_(
"Side by Side"),
menu_items.horizontal);
463 0, 0,
"split_vertical",
_(
"Top and Bottom"),
menu_items.vertical);
465 0, 0,
"split_unsplit",
_(
"_Unsplit"),
menu_items.unsplit);
sptr_t scintilla_send_message(ScintillaObject *sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam)
#define SCI_SETDOCPOINTER
#define SCI_GETDOCPOINTER
#define SCI_SETMARGINSENSITIVEN
#define SCI_SETMARGINWIDTHN
#define SCI_GETMARGINWIDTHN
GeanyDocument * document_get_current(void)
Finds the current document.
#define DOC_FILENAME(doc)
Returns the filename of the document passed or GEANY_STRING_UNTITLED (e.g.
ScintillaObject * editor_create_widget(GeanyEditor *editor)
Creates a new Scintilla GtkWidget based on the settings for editor.
Single include for plugins.
void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft)
Sets up highlighting and other visual settings.
GeanyKeyBinding * keybindings_set_item(GeanyKeyGroup *group, gsize key_id, GeanyKeyCallback callback, guint key, GdkModifierType mod, const gchar *kf_name, const gchar *label, GtkWidget *menu_item)
<simplesect kind="geany:skip"></simplesect> Fills a GeanyKeyBinding struct item.
#define GEANY_API_VERSION
The Application Programming Interface (API) version, incremented whenever any plugin data types are m...
#define PLUGIN_SET_INFO(p_name, p_description, p_version, p_author)
Sets the plugin name and some other basic information about a plugin.
#define PLUGIN_VERSION_CHECK(api_required)
Defines a function to check the plugin is safe to load.
#define geany
Simple macro for geany_data that reduces typing.
guint plugin_idle_add(GeanyPlugin *plugin, GSourceFunc function, gpointer data)
<simplesect kind="geany:skip"></simplesect> Adds a GLib main loop IDLE callback that will be removed ...
GeanyKeyGroup * plugin_set_key_group(GeanyPlugin *plugin, const gchar *section_name, gsize count, GeanyKeyGroupCallback callback)
<simplesect kind="geany:skip"></simplesect> Sets up or resizes a keybinding group for the plugin.
void sci_set_marker_at_line(ScintillaObject *sci, gint line_number, gint marker)
Sets a line marker.
gboolean sci_is_marker_set_at_line(ScintillaObject *sci, gint line, gint marker)
Checks if a line has a marker set.
gint sci_get_current_position(ScintillaObject *sci)
Gets the cursor position.
void sci_delete_marker_at_line(ScintillaObject *sci, gint line_number, gint marker)
Deletes a line marker.
void sci_set_current_position(ScintillaObject *sci, gint position, gboolean scroll_to_caret)
Sets the cursor position.
gint sci_get_line_from_position(ScintillaObject *sci, gint position)
Gets the line number from position.
static void on_split_horizontally(GtkMenuItem *menuitem, gpointer user_data)
static struct @39 menu_items
static void on_unsplit(GtkMenuItem *menuitem, gpointer user_data)
static void on_sci_notify(ScintillaObject *sci, gint param, SCNotification *nt, gpointer data)
static EditWindow edit_window
static void set_editor(EditWindow *editwin, GeanyEditor *editor)
static gboolean do_select_current(gpointer data)
static void on_document_filetype_set(GObject *obj, GeanyDocument *doc, GeanyFiletype *filetype_old, gpointer user_data)
GeanyPlugin * geany_plugin
struct EditWindow EditWindow
void plugin_cleanup(void)
Called before unloading the plugin.
static void on_document_close(GObject *obj, GeanyDocument *doc, gpointer user_data)
PluginCallback plugin_callbacks[]
static void on_doc_show_menu(GtkMenuToolButton *button, GtkMenu *menu)
static void split_view(gboolean horizontal)
static GtkWidget * create_toolbar(void)
static void set_line_numbers(ScintillaObject *sci, gboolean set)
static void on_document_save(GObject *obj, GeanyDocument *doc, gpointer user_data)
static void on_split_vertically(GtkMenuItem *menuitem, gpointer user_data)
static GtkWidget * ui_tool_button_new(const gchar *stock_id, const gchar *label, const gchar *tooltip)
void plugin_init(GeanyData *data)
Called after loading the plugin.
static void set_state(enum State id)
static void kb_activate(guint key_id)
static void on_refresh(void)
static void sync_to_current(ScintillaObject *sci, ScintillaObject *current)
static enum State plugin_state
static void show_menu_gtk316_fix(GtkMenuToolButton *button, gpointer data)
static void on_doc_menu_item_clicked(gpointer item, GeanyDocument *doc)
gtk_container_add(GTK_CONTAINER(dialog->vbox), check_button)
gtk_widget_show_all(dialog)
This contains pointers to global variables owned by Geany for plugins to use.
struct GeanyMainWidgets * main_widgets
Important widgets in the main window.
Structure for representing an open tab with all its properties.
GeanyFiletype * file_type
The filetype for this document, it's only a reference to one of the elements of the global filetypes ...
gboolean is_valid
Flag used to check if this document is valid when iterating GeanyData::documents_array.
GeanyEditor * editor
The editor associated with the document.
Editor-owned fields for each document.
ScintillaObject * sci
The Scintilla editor GtkWidget.
struct GeanyDocument * document
The document associated with the editor.
GtkWidget * notebook
Document notebook.
GtkWidget * tools_menu
Most plugins add menu items to the Tools menu.
Basic information for the plugin and identification.
Callback array entry type used with the plugin_callbacks symbol.
const gchar * ui_lookup_stock_label(const gchar *stock_id)
Finds the label text associated with stock_id.
void ui_add_document_sensitive(GtkWidget *widget)
Adds a widget to the list of widgets that should be set sensitive/insensitive when some documents are...
void ui_menu_add_document_items(GtkMenu *menu, GeanyDocument *active, GCallback callback)
<simplesect kind="geany:skip"></simplesect> Adds a list of document items to menu.
gchar * utils_str_remove_chars(gchar *string, const gchar *chars)
Removes characters from a string, in place.