Note: this commit breaks the plugin API.
Split widget fields out of GeanyApp into GeanyMainWidgets, so other data items can be added without breaking the plugin ABI. Add GeanyData::main_widgets, and macro. Rename treeview_notebook sidebar_notebook in GeanyMainWidgets. Move tools_menu from GeanyData to GeanyMainWidgets. Move statusbar out of GeanyApp (shouldn't be used directly). Move ignore_callback out of GeanyApp. Rename sci_goto_line() argument unfold, like sci_goto_pos(). Make utils_goto_file_pos(), utils_goto_line(), utils_switch_document() into static functions (they are UI-related, so shouldn't be in utils.c). Move utils_goto_pos() to editor.c, add mark argument. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2609 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
cb20ec4e53
commit
398efbd373
28
ChangeLog
28
ChangeLog
@ -1,3 +1,31 @@
|
||||
2008-05-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* src/templates.c, src/build.c, src/utils.c, src/ui_utils.h,
|
||||
src/win32.c, src/utils.h, src/keybindings.c, src/printing.c,
|
||||
src/tools.c, src/sciwrappers.c, src/project.c, src/sciwrappers.h,
|
||||
src/encodings.c, src/prefs.c, src/dialogs.c, src/navqueue.c,
|
||||
src/plugindata.h, src/geany.h, src/about.c, src/treeviews.c,
|
||||
src/msgwindow.c, src/callbacks.c, src/notebook.c, src/keyfile.c,
|
||||
src/filetypes.c, src/search.c, src/document.c, src/plugins.c,
|
||||
src/main.c, src/editor.c, src/symbols.c, src/socket.c,
|
||||
src/editor.h, src/ui_utils.c, plugins/export.c, plugins/vcdiff.c,
|
||||
plugins/demoplugin.c, plugins/filebrowser.c, plugins/htmlchars.c,
|
||||
plugins/autosave.c, plugins/pluginmacros.h, plugins/classbuilder.c:
|
||||
Note: this commit breaks the plugin API.
|
||||
Split widget fields out of GeanyApp into GeanyMainWidgets, so other
|
||||
data items can be added without breaking the plugin ABI.
|
||||
Add GeanyData::main_widgets, and macro.
|
||||
Rename treeview_notebook sidebar_notebook in GeanyMainWidgets.
|
||||
Move tools_menu from GeanyData to GeanyMainWidgets.
|
||||
Move statusbar out of GeanyApp (shouldn't be used directly).
|
||||
Move ignore_callback out of GeanyApp.
|
||||
Rename sci_goto_line() argument unfold, like sci_goto_pos().
|
||||
Make utils_goto_file_pos(), utils_goto_line(),
|
||||
utils_switch_document() into static functions (they are UI-related,
|
||||
so shouldn't be in utils.c).
|
||||
Move utils_goto_pos() to editor.c, add mark argument.
|
||||
|
||||
|
||||
2008-05-21 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
|
||||
* plugins/Makefile.am:
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "geany.h"
|
||||
#include "support.h"
|
||||
#include "document.h"
|
||||
#include "ui_utils.h"
|
||||
|
||||
#include "plugindata.h"
|
||||
#include "pluginmacros.h"
|
||||
@ -52,7 +53,7 @@ static gchar *config_file;
|
||||
gboolean auto_save(gpointer data)
|
||||
{
|
||||
gint cur_idx = p_document->get_cur_idx();
|
||||
gint i, idx, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook));
|
||||
gint i, idx, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets->notebook));
|
||||
gint saved_files = 0;
|
||||
|
||||
if (save_all)
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "support.h"
|
||||
#include "filetypes.h"
|
||||
#include "document.h"
|
||||
#include "ui_utils.h"
|
||||
#include "pluginmacros.h"
|
||||
|
||||
|
||||
@ -354,7 +355,7 @@ void show_dialog_create_class(gint type)
|
||||
cc_dlg->class_type = type;
|
||||
|
||||
cc_dlg->dialog = gtk_dialog_new_with_buttons(_("Create Class"),
|
||||
GTK_WINDOW(app->window),
|
||||
GTK_WINDOW(main_widgets->window),
|
||||
GTK_DIALOG_MODAL,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
||||
@ -777,7 +778,7 @@ void init(GeanyData *data)
|
||||
GtkWidget *menu_create_gtk_class;
|
||||
|
||||
menu_create_class1 = gtk_image_menu_item_new_with_mnemonic (_("Create Cla_ss"));
|
||||
gtk_container_add (GTK_CONTAINER (data->tools_menu), menu_create_class1);
|
||||
gtk_container_add (GTK_CONTAINER (main_widgets->tools_menu), menu_create_class1);
|
||||
|
||||
image1861 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_create_class1), image1861);
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#include "geany.h" /* for the GeanyApp data type */
|
||||
#include "support.h" /* for the _() translation macro (see also po/POTFILES.in) */
|
||||
#include "ui_utils.h"
|
||||
|
||||
#include "plugindata.h" /* this defines the plugin API */
|
||||
#include "pluginmacros.h" /* some useful macros to avoid typing geany_data so often */
|
||||
@ -67,7 +68,7 @@ item_activate(GtkMenuItem *menuitem, gpointer gdata)
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new(
|
||||
GTK_WINDOW(app->window),
|
||||
GTK_WINDOW(main_widgets->window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK,
|
||||
@ -89,7 +90,7 @@ void init(GeanyData *data)
|
||||
/* Add an item to the Tools menu */
|
||||
demo_item = gtk_menu_item_new_with_mnemonic(_("_Demo Plugin"));
|
||||
gtk_widget_show(demo_item);
|
||||
gtk_container_add(GTK_CONTAINER(geany_data->tools_menu), demo_item);
|
||||
gtk_container_add(GTK_CONTAINER(main_widgets->tools_menu), demo_item);
|
||||
g_signal_connect(G_OBJECT(demo_item), "activate", G_CALLBACK(item_activate), NULL);
|
||||
|
||||
welcome_text = g_strdup(_("Hello World!"));
|
||||
|
@ -163,14 +163,14 @@ static void create_file_save_as_dialog(const gchar *extension, ExportFunc func,
|
||||
return;
|
||||
|
||||
idx = p_document->get_cur_idx();
|
||||
tooltips = GTK_TOOLTIPS(p_support->lookup_widget(app->window, "tooltips"));
|
||||
tooltips = GTK_TOOLTIPS(p_support->lookup_widget(main_widgets->window, "tooltips"));
|
||||
|
||||
exi = g_new(ExportInfo, 1);
|
||||
exi->idx = idx;
|
||||
exi->export_func = func;
|
||||
exi->have_zoom_level_checkbox = FALSE;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new(_("Export File"), GTK_WINDOW(app->window),
|
||||
dialog = gtk_file_chooser_dialog_new(_("Export File"), GTK_WINDOW(main_widgets->window),
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE, NULL, NULL);
|
||||
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
|
||||
gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
|
||||
@ -205,7 +205,7 @@ static void create_file_save_as_dialog(const gchar *extension, ExportFunc func,
|
||||
g_signal_connect((gpointer) dialog, "response",
|
||||
G_CALLBACK(on_file_save_dialog_response), exi);
|
||||
|
||||
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(app->window));
|
||||
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(main_widgets->window));
|
||||
|
||||
/* if the current document has a filename we use it as the default. */
|
||||
gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(dialog));
|
||||
@ -712,7 +712,7 @@ void init(GeanyData *data)
|
||||
GtkWidget *menu_create_latex;
|
||||
|
||||
menu_export = gtk_image_menu_item_new_with_mnemonic(_("_Export"));
|
||||
gtk_container_add(GTK_CONTAINER(data->tools_menu), menu_export);
|
||||
gtk_container_add(GTK_CONTAINER(main_widgets->tools_menu), menu_export);
|
||||
|
||||
menu_export_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_export), menu_export_menu);
|
||||
|
@ -738,7 +738,7 @@ static GtkWidget *make_toolbar(void)
|
||||
{
|
||||
GtkWidget *wid, *toolbar;
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(p_support->lookup_widget(
|
||||
app->window, "tooltips"));
|
||||
main_widgets->window, "tooltips"));
|
||||
|
||||
toolbar = gtk_toolbar_new();
|
||||
gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar), GTK_ICON_SIZE_MENU);
|
||||
@ -938,7 +938,7 @@ void init(GeanyData *data)
|
||||
gtk_container_add(GTK_CONTAINER(file_view_vbox), scrollwin);
|
||||
|
||||
gtk_widget_show_all(file_view_vbox);
|
||||
gtk_notebook_append_page(GTK_NOTEBOOK(app->treeview_notebook), file_view_vbox,
|
||||
gtk_notebook_append_page(GTK_NOTEBOOK(main_widgets->sidebar_notebook), file_view_vbox,
|
||||
gtk_label_new(_("Files")));
|
||||
|
||||
load_settings();
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "plugindata.h"
|
||||
#include "document.h"
|
||||
#include "keybindings.h"
|
||||
#include "ui_utils.h"
|
||||
#include "pluginmacros.h"
|
||||
|
||||
|
||||
@ -83,7 +84,7 @@ static void tools_show_dialog_insert_special_chars(void)
|
||||
GtkWidget *swin, *vbox, *label;
|
||||
|
||||
sc_dialog = gtk_dialog_new_with_buttons(
|
||||
_("Special Characters"), GTK_WINDOW(app->window),
|
||||
_("Special Characters"), GTK_WINDOW(main_widgets->window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
_("_Insert"), GTK_RESPONSE_OK, NULL);
|
||||
vbox = p_ui->dialog_vbox_new(GTK_DIALOG(sc_dialog));
|
||||
@ -531,7 +532,7 @@ void init(GeanyData *data)
|
||||
/* Add an item to the Tools menu */
|
||||
demo_item = gtk_menu_item_new_with_mnemonic(menu_text);
|
||||
gtk_widget_show(demo_item);
|
||||
gtk_container_add(GTK_CONTAINER(geany_data->tools_menu), demo_item);
|
||||
gtk_container_add(GTK_CONTAINER(main_widgets->tools_menu), demo_item);
|
||||
g_signal_connect(G_OBJECT(demo_item), "activate", G_CALLBACK(item_activate), NULL);
|
||||
|
||||
/* disable menu_item when there are no documents open */
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
/* common data structs */
|
||||
#define app geany_data->app
|
||||
#define main_widgets geany_data->main_widgets
|
||||
#define doc_array geany_data->doc_array /**< Allows use of @c doc_list[] macro */
|
||||
#define filetypes_array geany_data->filetypes_array /**< Allows use of @c filetypes[] macro */
|
||||
#define prefs geany_data->prefs
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "filetypes.h"
|
||||
#include "utils.h"
|
||||
#include "project.h"
|
||||
#include "ui_utils.h"
|
||||
#include "pluginmacros.h"
|
||||
|
||||
|
||||
@ -293,7 +294,7 @@ static void show_output(const gchar *std_output, const gchar *name_prefix,
|
||||
else
|
||||
{
|
||||
p_sci->set_text(doc_list[idx].sci, text);
|
||||
book = GTK_NOTEBOOK(app->notebook);
|
||||
book = GTK_NOTEBOOK(main_widgets->notebook);
|
||||
page = gtk_notebook_page_num(book, GTK_WIDGET(doc_list[idx].sci));
|
||||
gtk_notebook_set_current_page(book, page);
|
||||
doc_list[idx].changed = FALSE;
|
||||
@ -508,7 +509,7 @@ void init(GeanyData *data)
|
||||
tooltips = gtk_tooltips_new();
|
||||
|
||||
menu_vcdiff = gtk_image_menu_item_new_with_mnemonic(_("_Version Diff"));
|
||||
gtk_container_add(GTK_CONTAINER(data->tools_menu), menu_vcdiff);
|
||||
gtk_container_add(GTK_CONTAINER(main_widgets->tools_menu), menu_vcdiff);
|
||||
|
||||
g_signal_connect((gpointer) menu_vcdiff, "activate",
|
||||
G_CALLBACK(update_menu_items), NULL);
|
||||
|
@ -118,7 +118,7 @@ static GtkWidget *create_dialog(void)
|
||||
dialog = gtk_dialog_new();
|
||||
|
||||
/* configure dialog */
|
||||
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(app->window));
|
||||
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(main_widgets.window));
|
||||
gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
|
||||
gtk_window_set_title(GTK_WINDOW(dialog), _("About Geany"));
|
||||
gtk_widget_set_name(dialog, "GeanyDialog");
|
||||
|
22
src/build.c
22
src/build.c
@ -1027,7 +1027,7 @@ static void create_build_menu_gen(BuildMenuItems *menu_items)
|
||||
{
|
||||
GtkWidget *menu, *item = NULL, *image, *separator;
|
||||
GtkAccelGroup *accel_group = gtk_accel_group_new();
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
|
||||
KeyBindingGroup *group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_BUILD);
|
||||
|
||||
menu = gtk_menu_new();
|
||||
@ -1144,7 +1144,7 @@ static void create_build_menu_tex(BuildMenuItems *menu_items)
|
||||
{
|
||||
GtkWidget *menu, *item, *image, *separator;
|
||||
GtkAccelGroup *accel_group = gtk_accel_group_new();
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
|
||||
KeyBindingGroup *group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_BUILD);
|
||||
|
||||
menu = gtk_menu_new();
|
||||
@ -1264,7 +1264,7 @@ static void create_build_menu_tex(BuildMenuItems *menu_items)
|
||||
G_CALLBACK(on_build_arguments_activate), filetypes[GEANY_FILETYPES_LATEX]);
|
||||
menu_items->item_set_args = item;
|
||||
|
||||
gtk_window_add_accel_group(GTK_WINDOW(app->window), accel_group);
|
||||
gtk_window_add_accel_group(GTK_WINDOW(main_widgets.window), accel_group);
|
||||
|
||||
menu_items->menu = menu;
|
||||
g_object_ref((gpointer)menu_items->menu); /* to hold it after removing */
|
||||
@ -1330,7 +1330,7 @@ static void show_includes_arguments_tex(void)
|
||||
if (DOC_IDX_VALID(idx)) ft = doc_list[idx].file_type;
|
||||
g_return_if_fail(ft != NULL);
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons(_("Set Arguments"), GTK_WINDOW(app->window),
|
||||
dialog = gtk_dialog_new_with_buttons(_("Set Arguments"), GTK_WINDOW(main_widgets.window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
|
||||
@ -1499,7 +1499,7 @@ static void show_includes_arguments_gen(void)
|
||||
if (DOC_IDX_VALID(idx)) ft = doc_list[idx].file_type;
|
||||
g_return_if_fail(ft != NULL);
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons(_("Set Includes and Arguments"), GTK_WINDOW(app->window),
|
||||
dialog = gtk_dialog_new_with_buttons(_("Set Includes and Arguments"), GTK_WINDOW(main_widgets.window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
|
||||
@ -1645,14 +1645,14 @@ void build_menu_update(gint idx)
|
||||
(FILETYPE_ID(doc_list[idx].file_type) == GEANY_FILETYPES_NONE &&
|
||||
doc_list[idx].file_name == NULL))
|
||||
{
|
||||
gtk_widget_set_sensitive(lookup_widget(app->window, "menu_build1"), FALSE);
|
||||
gtk_menu_item_remove_submenu(GTK_MENU_ITEM(lookup_widget(app->window, "menu_build1")));
|
||||
gtk_widget_set_sensitive(lookup_widget(main_widgets.window, "menu_build1"), FALSE);
|
||||
gtk_menu_item_remove_submenu(GTK_MENU_ITEM(lookup_widget(main_widgets.window, "menu_build1")));
|
||||
gtk_widget_set_sensitive(widgets.compile_button, FALSE);
|
||||
gtk_widget_set_sensitive(widgets.run_button, FALSE);
|
||||
return;
|
||||
}
|
||||
else
|
||||
gtk_widget_set_sensitive(lookup_widget(app->window, "menu_build1"), TRUE);
|
||||
gtk_widget_set_sensitive(lookup_widget(main_widgets.window, "menu_build1"), TRUE);
|
||||
|
||||
ft = doc_list[idx].file_type;
|
||||
g_return_if_fail(ft != NULL);
|
||||
@ -1660,7 +1660,7 @@ void build_menu_update(gint idx)
|
||||
menu_items = build_get_menu_items(ft->id);
|
||||
/* Note: don't remove the submenu first because it can now cause an X hang if
|
||||
* the menu is already open when called from build_exit_cb(). */
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(lookup_widget(app->window, "menu_build1")),
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(lookup_widget(main_widgets.window, "menu_build1")),
|
||||
menu_items->menu);
|
||||
|
||||
have_path = (doc_list[idx].file_name != NULL);
|
||||
@ -2041,6 +2041,6 @@ on_build_next_error (GtkMenuItem *menuitem,
|
||||
|
||||
void build_init()
|
||||
{
|
||||
widgets.compile_button = lookup_widget(app->window, "toolbutton13");
|
||||
widgets.run_button = lookup_widget(app->window, "toolbutton26");
|
||||
widgets.compile_button = lookup_widget(main_widgets.window, "toolbutton13");
|
||||
widgets.run_button = lookup_widget(main_widgets.window, "toolbutton26");
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ void
|
||||
on_save1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->notebook));
|
||||
gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
gint idx = document_get_cur_idx();
|
||||
|
||||
if (cur_page >= 0)
|
||||
@ -200,7 +200,7 @@ void
|
||||
on_save_all1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint i, idx, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook));
|
||||
gint i, idx, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
gint cur_idx = document_get_cur_idx();
|
||||
|
||||
document_delay_colourise(); /* avoid recolourising all C files after each save */
|
||||
@ -212,7 +212,7 @@ on_save_all1_activate (GtkMenuItem *menuitem,
|
||||
if (doc_list[idx].file_name == NULL)
|
||||
{
|
||||
/* display unnamed document */
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook),
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
document_get_notebook_page(idx));
|
||||
dialogs_show_save_as();
|
||||
}
|
||||
@ -237,7 +237,7 @@ void
|
||||
on_close1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->notebook));
|
||||
guint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
document_remove(cur_page);
|
||||
}
|
||||
|
||||
@ -301,7 +301,7 @@ on_cut1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
||||
|
||||
if (GTK_IS_EDITABLE(focusw))
|
||||
gtk_editable_cut_clipboard(GTK_EDITABLE(focusw));
|
||||
@ -323,7 +323,7 @@ on_copy1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
||||
|
||||
if (GTK_IS_EDITABLE(focusw))
|
||||
gtk_editable_copy_clipboard(GTK_EDITABLE(focusw));
|
||||
@ -345,7 +345,7 @@ on_paste1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
||||
|
||||
if (GTK_IS_EDITABLE(focusw))
|
||||
gtk_editable_paste_clipboard(GTK_EDITABLE(focusw));
|
||||
@ -386,7 +386,7 @@ on_delete1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
||||
|
||||
if (GTK_IS_EDITABLE(focusw))
|
||||
gtk_editable_delete_selection(GTK_EDITABLE(focusw));
|
||||
@ -484,7 +484,7 @@ on_images_and_text2_activate (GtkMenuItem *menuitem,
|
||||
{
|
||||
if (ignore_toolbar_toggle) return;
|
||||
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), GTK_TOOLBAR_BOTH);
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(main_widgets.toolbar), GTK_TOOLBAR_BOTH);
|
||||
toolbar_prefs.icon_style = GTK_TOOLBAR_BOTH;
|
||||
}
|
||||
|
||||
@ -495,7 +495,7 @@ on_images_only2_activate (GtkMenuItem *menuitem,
|
||||
{
|
||||
if (ignore_toolbar_toggle) return;
|
||||
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), GTK_TOOLBAR_ICONS);
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(main_widgets.toolbar), GTK_TOOLBAR_ICONS);
|
||||
toolbar_prefs.icon_style = GTK_TOOLBAR_ICONS;
|
||||
}
|
||||
|
||||
@ -506,7 +506,7 @@ on_text_only2_activate (GtkMenuItem *menuitem,
|
||||
{
|
||||
if (ignore_toolbar_toggle) return;
|
||||
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), GTK_TOOLBAR_TEXT);
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(main_widgets.toolbar), GTK_TOOLBAR_TEXT);
|
||||
toolbar_prefs.icon_style = GTK_TOOLBAR_TEXT;
|
||||
}
|
||||
|
||||
@ -550,7 +550,7 @@ static void set_search_bar_background(gboolean success)
|
||||
const GdkColor red = {0, 0xffff, 0x6666, 0x6666};
|
||||
const GdkColor white = {0, 0xffff, 0xffff, 0xffff};
|
||||
static gboolean old_value = TRUE;
|
||||
GtkWidget *widget = lookup_widget(app->window, "entry1");
|
||||
GtkWidget *widget = lookup_widget(main_widgets.window, "entry1");
|
||||
|
||||
/* only update if really needed */
|
||||
if (search_data.search_bar && old_value != success)
|
||||
@ -609,7 +609,7 @@ on_toolbutton18_clicked (GtkToolButton *toolbutton,
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
gboolean result;
|
||||
GtkWidget *entry = lookup_widget(GTK_WIDGET(app->window), "entry1");
|
||||
GtkWidget *entry = lookup_widget(GTK_WIDGET(main_widgets.window), "entry1");
|
||||
|
||||
setup_find_next(GTK_EDITABLE(entry));
|
||||
result = document_search_bar_find(idx, search_data.text, 0, FALSE);
|
||||
@ -644,7 +644,7 @@ void
|
||||
on_hide_toolbar1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *tool_item = lookup_widget(GTK_WIDGET(app->window), "menu_show_toolbar1");
|
||||
GtkWidget *tool_item = lookup_widget(GTK_WIDGET(main_widgets.window), "menu_show_toolbar1");
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tool_item), FALSE);
|
||||
}
|
||||
|
||||
@ -698,7 +698,7 @@ void
|
||||
on_toolbutton15_clicked (GtkToolButton *toolbutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->notebook));
|
||||
gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
document_remove(cur_page);
|
||||
}
|
||||
|
||||
@ -761,7 +761,7 @@ on_tv_notebook_switch_page (GtkNotebook *notebook,
|
||||
gpointer user_data)
|
||||
{
|
||||
/* suppress selection changed signal when switching to the open files list */
|
||||
app->ignore_callback = TRUE;
|
||||
ignore_callback = TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -771,7 +771,7 @@ on_tv_notebook_switch_page_after (GtkNotebook *notebook,
|
||||
guint page_num,
|
||||
gpointer user_data)
|
||||
{
|
||||
app->ignore_callback = FALSE;
|
||||
ignore_callback = FALSE;
|
||||
}
|
||||
|
||||
|
||||
@ -780,7 +780,7 @@ on_crlf_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
if (app->ignore_callback || idx == -1 || ! doc_list[idx].is_valid) return;
|
||||
if (ignore_callback || idx == -1 || ! doc_list[idx].is_valid) return;
|
||||
sci_convert_eols(doc_list[idx].sci, SC_EOL_CRLF);
|
||||
sci_set_eol_mode(doc_list[idx].sci, SC_EOL_CRLF);
|
||||
}
|
||||
@ -791,7 +791,7 @@ on_lf_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
if (app->ignore_callback || idx == -1 || ! doc_list[idx].is_valid) return;
|
||||
if (ignore_callback || idx == -1 || ! doc_list[idx].is_valid) return;
|
||||
sci_convert_eols(doc_list[idx].sci, SC_EOL_LF);
|
||||
sci_set_eol_mode(doc_list[idx].sci, SC_EOL_LF);
|
||||
}
|
||||
@ -802,7 +802,7 @@ on_cr_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
if (app->ignore_callback || idx == -1 || ! doc_list[idx].is_valid) return;
|
||||
if (ignore_callback || idx == -1 || ! doc_list[idx].is_valid) return;
|
||||
sci_convert_eols(doc_list[idx].sci, SC_EOL_CR);
|
||||
sci_set_eol_mode(doc_list[idx].sci, SC_EOL_CR);
|
||||
}
|
||||
@ -918,10 +918,10 @@ void
|
||||
on_show_toolbar1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (app->ignore_callback) return;
|
||||
if (ignore_callback) return;
|
||||
|
||||
toolbar_prefs.visible = (toolbar_prefs.visible) ? FALSE : TRUE;;
|
||||
ui_widget_show_hide(GTK_WIDGET(app->toolbar), toolbar_prefs.visible);
|
||||
ui_widget_show_hide(GTK_WIDGET(main_widgets.toolbar), toolbar_prefs.visible);
|
||||
}
|
||||
|
||||
|
||||
@ -938,10 +938,10 @@ void
|
||||
on_show_messages_window1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (app->ignore_callback) return;
|
||||
if (ignore_callback) return;
|
||||
|
||||
ui_prefs.msgwindow_visible = (ui_prefs.msgwindow_visible) ? FALSE : TRUE;
|
||||
ui_widget_show_hide(lookup_widget(app->window, "scrolledwindow1"), ui_prefs.msgwindow_visible);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "scrolledwindow1"), ui_prefs.msgwindow_visible);
|
||||
}
|
||||
|
||||
|
||||
@ -967,7 +967,7 @@ void
|
||||
on_line_wrapping1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (! app->ignore_callback)
|
||||
if (! ignore_callback)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
if (! DOC_IDX_VALID(idx)) return;
|
||||
@ -980,7 +980,7 @@ void
|
||||
on_set_file_readonly1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (! app->ignore_callback)
|
||||
if (! ignore_callback)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
if (! DOC_IDX_VALID(idx)) return;
|
||||
@ -996,7 +996,7 @@ void
|
||||
on_use_auto_indentation1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (! app->ignore_callback)
|
||||
if (! ignore_callback)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
if (! DOC_IDX_VALID(idx)) return;
|
||||
@ -1037,7 +1037,7 @@ on_goto_tag_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean definition = (menuitem ==
|
||||
GTK_MENU_ITEM(lookup_widget(app->popup_menu, "goto_tag_definition1")));
|
||||
GTK_MENU_ITEM(lookup_widget(main_widgets.editor_menu, "goto_tag_definition1")));
|
||||
GeanyDocument *doc = document_get_current();
|
||||
|
||||
g_return_if_fail(doc);
|
||||
@ -1187,15 +1187,19 @@ on_goto_line_dialog_response (GtkDialog *dialog,
|
||||
|
||||
if (line > 0 && line <= sci_get_line_count(doc_list[idx].sci))
|
||||
{
|
||||
utils_goto_line(idx, line);
|
||||
gint pos;
|
||||
|
||||
line--; /* the user counts lines from 1, we begin at 0 so bring the user line to our one */
|
||||
pos = sci_get_position_from_line(doc_list[idx].sci, line);
|
||||
editor_goto_pos(idx, pos, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
utils_beep();
|
||||
}
|
||||
|
||||
}
|
||||
if (dialog) gtk_widget_destroy(GTK_WIDGET(dialog));
|
||||
if (dialog)
|
||||
gtk_widget_destroy(GTK_WIDGET(dialog));
|
||||
}
|
||||
|
||||
|
||||
@ -1220,7 +1224,7 @@ on_toolbutton_goto_clicked (GtkToolButton *toolbutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
on_goto_line_dialog_response(NULL, GTK_RESPONSE_ACCEPT,
|
||||
lookup_widget(app->window, "entry_goto_line"));
|
||||
lookup_widget(main_widgets.window, "entry_goto_line"));
|
||||
}
|
||||
|
||||
|
||||
@ -1546,7 +1550,7 @@ on_encoding_change (GtkMenuItem *menuitem,
|
||||
gint idx = document_get_cur_idx();
|
||||
guint i = GPOINTER_TO_INT(user_data);
|
||||
|
||||
if (app->ignore_callback || ! DOC_IDX_VALID(idx) || encodings[i].charset == NULL ||
|
||||
if (ignore_callback || ! DOC_IDX_VALID(idx) || encodings[i].charset == NULL ||
|
||||
utils_str_equal(encodings[i].charset, doc_list[idx].encoding)) return;
|
||||
|
||||
if (doc_list[idx].readonly)
|
||||
@ -1589,13 +1593,13 @@ on_menu_show_sidebar1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
{
|
||||
static gint active_page = -1;
|
||||
|
||||
if (app->ignore_callback) return;
|
||||
if (ignore_callback) return;
|
||||
|
||||
if (ui_prefs.sidebar_visible)
|
||||
{
|
||||
/* to remember the active page because GTK (e.g. 2.8.18) doesn't do it and shows always
|
||||
* the last page (for unknown reason, with GTK 2.6.4 it works) */
|
||||
active_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->treeview_notebook));
|
||||
active_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.sidebar_notebook));
|
||||
}
|
||||
|
||||
ui_prefs.sidebar_visible = ! ui_prefs.sidebar_visible;
|
||||
@ -1607,7 +1611,7 @@ on_menu_show_sidebar1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
}
|
||||
|
||||
ui_sidebar_show_hide();
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->treeview_notebook), active_page);
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.sidebar_notebook), active_page);
|
||||
}
|
||||
|
||||
|
||||
@ -1615,7 +1619,7 @@ void
|
||||
on_menu_write_unicode_bom1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (! app->ignore_callback)
|
||||
if (! ignore_callback)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
|
||||
@ -1835,8 +1839,8 @@ on_menu_project1_activate (GtkMenuItem *menuitem,
|
||||
|
||||
if (item_close == NULL)
|
||||
{
|
||||
item_close = lookup_widget(app->window, "project_close1");
|
||||
item_properties = lookup_widget(app->window, "project_properties1");
|
||||
item_close = lookup_widget(main_widgets.window, "project_close1");
|
||||
item_properties = lookup_widget(main_widgets.window, "project_properties1");
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive(item_close, (app->project != NULL));
|
||||
@ -1966,9 +1970,9 @@ on_menu_toggle_all_additional_widgets1_activate
|
||||
{
|
||||
static gint hide_all = -1;
|
||||
GtkCheckMenuItem *msgw = GTK_CHECK_MENU_ITEM(
|
||||
lookup_widget(app->window, "menu_show_messages_window1"));
|
||||
lookup_widget(main_widgets.window, "menu_show_messages_window1"));
|
||||
GtkCheckMenuItem *toolbari = GTK_CHECK_MENU_ITEM(
|
||||
lookup_widget(app->window, "menu_show_toolbar1"));
|
||||
lookup_widget(main_widgets.window, "menu_show_toolbar1"));
|
||||
|
||||
/* get the initial state (necessary if Geany was closed with hide_all = TRUE) */
|
||||
if (hide_all == -1)
|
||||
@ -1991,7 +1995,7 @@ on_menu_toggle_all_additional_widgets1_activate
|
||||
gtk_check_menu_item_set_active(msgw, ! gtk_check_menu_item_get_active(msgw));
|
||||
|
||||
interface_prefs.show_notebook_tabs = FALSE;
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), interface_prefs.show_notebook_tabs);
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs);
|
||||
|
||||
ui_statusbar_showhide(FALSE);
|
||||
|
||||
@ -2005,7 +2009,7 @@ on_menu_toggle_all_additional_widgets1_activate
|
||||
gtk_check_menu_item_set_active(msgw, ! gtk_check_menu_item_get_active(msgw));
|
||||
|
||||
interface_prefs.show_notebook_tabs = TRUE;
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), interface_prefs.show_notebook_tabs);
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs);
|
||||
|
||||
ui_statusbar_showhide(TRUE);
|
||||
|
||||
@ -2113,7 +2117,7 @@ on_line_breaking1_activate (GtkMenuItem *menuitem,
|
||||
{
|
||||
GeanyDocument *doc;
|
||||
|
||||
if (app->ignore_callback)
|
||||
if (ignore_callback)
|
||||
return;
|
||||
|
||||
doc = document_get_current();
|
||||
|
@ -169,11 +169,11 @@ static void create_open_file_dialog(void)
|
||||
{
|
||||
GtkWidget *filetype_combo, *encoding_combo;
|
||||
GtkWidget *viewbtn;
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
|
||||
guint i;
|
||||
gchar *encoding_string;
|
||||
|
||||
ui_widgets.open_filesel = gtk_file_chooser_dialog_new(_("Open File"), GTK_WINDOW(app->window),
|
||||
ui_widgets.open_filesel = gtk_file_chooser_dialog_new(_("Open File"), GTK_WINDOW(main_widgets.window),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN, NULL, NULL);
|
||||
gtk_widget_set_name(ui_widgets.open_filesel, "GeanyDialog");
|
||||
|
||||
@ -192,7 +192,7 @@ static void create_open_file_dialog(void)
|
||||
gtk_window_set_destroy_with_parent(GTK_WINDOW(ui_widgets.open_filesel), TRUE);
|
||||
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(ui_widgets.open_filesel), FALSE);
|
||||
gtk_window_set_type_hint(GTK_WINDOW(ui_widgets.open_filesel), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.open_filesel), GTK_WINDOW(app->window));
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.open_filesel), GTK_WINDOW(main_widgets.window));
|
||||
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(ui_widgets.open_filesel), TRUE);
|
||||
|
||||
/* add checkboxes and filename entry */
|
||||
@ -283,7 +283,7 @@ static GtkWidget *add_file_open_extra_widget()
|
||||
GtkWidget *vbox, *table, *file_entry, *check_hidden;
|
||||
GtkWidget *filetype_ebox, *filetype_label, *filetype_combo;
|
||||
GtkWidget *encoding_ebox, *encoding_label, *encoding_combo;
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 6);
|
||||
|
||||
@ -472,9 +472,9 @@ on_file_save_dialog_response (GtkDialog *dialog,
|
||||
static void create_save_file_dialog(void)
|
||||
{
|
||||
GtkWidget *vbox, *check_open_new_tab, *rename_btn;
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
|
||||
|
||||
ui_widgets.save_filesel = gtk_file_chooser_dialog_new(_("Save File"), GTK_WINDOW(app->window),
|
||||
ui_widgets.save_filesel = gtk_file_chooser_dialog_new(_("Save File"), GTK_WINDOW(main_widgets.window),
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE, NULL, NULL);
|
||||
gtk_window_set_modal(GTK_WINDOW(ui_widgets.save_filesel), TRUE);
|
||||
gtk_window_set_destroy_with_parent(GTK_WINDOW(ui_widgets.save_filesel), TRUE);
|
||||
@ -512,7 +512,7 @@ static void create_save_file_dialog(void)
|
||||
g_signal_connect((gpointer) ui_widgets.save_filesel, "response",
|
||||
G_CALLBACK(on_file_save_dialog_response), NULL);
|
||||
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.save_filesel), GTK_WINDOW(app->window));
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.save_filesel), GTK_WINDOW(main_widgets.window));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -631,7 +631,7 @@ void dialogs_show_msgbox(gint type, const gchar *text, ...)
|
||||
#ifdef G_OS_WIN32
|
||||
win32_message_dialog(NULL, type, string);
|
||||
#else
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(app->window), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(main_widgets.window), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
type, GTK_BUTTONS_OK, "%s", string);
|
||||
gtk_widget_set_name(dialog, "GeanyDialog");
|
||||
gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
@ -650,7 +650,7 @@ void dialogs_show_msgbox_with_secondary(gint type, const gchar *text, const gcha
|
||||
g_free(string);
|
||||
#else
|
||||
GtkWidget *dialog;
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(app->window), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(main_widgets.window), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
type, GTK_BUTTONS_OK, "%s", text);
|
||||
gtk_widget_set_name(dialog, "GeanyDialog");
|
||||
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), "%s", secondary);
|
||||
@ -669,7 +669,7 @@ gboolean dialogs_show_unsaved_file(gint idx)
|
||||
gint ret;
|
||||
|
||||
/* display the file tab to remind the user of the document */
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook),
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
document_get_notebook_page(idx));
|
||||
|
||||
if (doc_list[idx].file_name != NULL)
|
||||
@ -686,7 +686,7 @@ gboolean dialogs_show_unsaved_file(gint idx)
|
||||
setptr(msg, g_strconcat(msg, "\n", msg2, NULL));
|
||||
ret = win32_message_dialog_unsaved(msg);
|
||||
#else
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(app->window), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(main_widgets.window), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "%s", msg);
|
||||
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), "%s", msg2);
|
||||
gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
|
||||
@ -789,7 +789,7 @@ void dialogs_show_open_font()
|
||||
|
||||
gtk_font_selection_dialog_set_font_name(
|
||||
GTK_FONT_SELECTION_DIALOG(ui_widgets.open_fontsel), interface_prefs.editor_font);
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.open_fontsel), GTK_WINDOW(app->window));
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.open_fontsel), GTK_WINDOW(main_widgets.window));
|
||||
}
|
||||
/* We make sure the dialog is visible. */
|
||||
gtk_window_present(GTK_WINDOW(ui_widgets.open_fontsel));
|
||||
@ -890,7 +890,7 @@ dialogs_show_input(const gchar *title, const gchar *label_text, const gchar *def
|
||||
{
|
||||
GtkWidget *dialog, *vbox;
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(app->window),
|
||||
dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(main_widgets.window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
|
||||
vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
|
||||
@ -918,7 +918,7 @@ void dialogs_show_goto_line()
|
||||
{
|
||||
GtkWidget *dialog, *label, *entry, *vbox;
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons(_("Go to Line"), GTK_WINDOW(app->window),
|
||||
dialog = gtk_dialog_new_with_buttons(_("Go to Line"), GTK_WINDOW(main_widgets.window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
|
||||
@ -1006,7 +1006,7 @@ void dialogs_show_file_properties(gint idx)
|
||||
|
||||
base_name = g_path_get_basename(doc_list[idx].file_name);
|
||||
title = g_strconcat(base_name, " ", _("Properties"), NULL);
|
||||
dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(app->window),
|
||||
dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(main_widgets.window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL, NULL);
|
||||
g_free(title);
|
||||
@ -1319,7 +1319,7 @@ static gboolean show_question(GtkWidget *parent, const gchar *yes_btn, const gch
|
||||
GtkWidget *dialog;
|
||||
|
||||
if (parent == NULL)
|
||||
parent = app->window;
|
||||
parent = main_widgets.window;
|
||||
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION,
|
||||
@ -1362,14 +1362,14 @@ gboolean dialogs_show_question(const gchar *text, ...)
|
||||
va_start(args, text);
|
||||
g_vsnprintf(string, 511, text, args);
|
||||
va_end(args);
|
||||
ret = show_question(app->window, GTK_STOCK_YES, GTK_STOCK_NO, string, NULL);
|
||||
ret = show_question(main_widgets.window, GTK_STOCK_YES, GTK_STOCK_NO, string, NULL);
|
||||
g_free(string);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* extra_text can be NULL; otherwise it is displayed below main_text.
|
||||
* if parent is NULL, app->window will be used */
|
||||
* if parent is NULL, main_widgets.window will be used */
|
||||
gboolean dialogs_show_question_full(GtkWidget *parent, const gchar *yes_btn, const gchar *no_btn,
|
||||
const gchar *extra_text, const gchar *main_text, ...)
|
||||
{
|
||||
|
@ -193,7 +193,7 @@ gint document_get_notebook_page(gint doc_idx)
|
||||
{
|
||||
if (! DOC_IDX_VALID(doc_idx)) return -1;
|
||||
|
||||
return gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook),
|
||||
return gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
GTK_WIDGET(doc_list[doc_idx].sci));
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ gint document_get_n_idx(guint page_num)
|
||||
if (page_num >= doc_array->len) return -1;
|
||||
|
||||
sci = (ScintillaObject*)gtk_notebook_get_nth_page(
|
||||
GTK_NOTEBOOK(app->notebook), page_num);
|
||||
GTK_NOTEBOOK(main_widgets.notebook), page_num);
|
||||
|
||||
return document_find_by_sci(sci);
|
||||
}
|
||||
@ -226,14 +226,14 @@ gint document_get_n_idx(guint page_num)
|
||||
**/
|
||||
gint document_get_cur_idx()
|
||||
{
|
||||
gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->notebook));
|
||||
gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
|
||||
if (cur_page == -1)
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
ScintillaObject *sci = (ScintillaObject*)
|
||||
gtk_notebook_get_nth_page(GTK_NOTEBOOK(app->notebook), cur_page);
|
||||
gtk_notebook_get_nth_page(GTK_NOTEBOOK(main_widgets.notebook), cur_page);
|
||||
|
||||
return document_find_by_sci(sci);
|
||||
}
|
||||
@ -434,7 +434,7 @@ static gint document_create(const gchar *utf8_filename)
|
||||
gint new_idx;
|
||||
GeanyDocument *this;
|
||||
gint tabnum;
|
||||
gint cur_pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook));
|
||||
gint cur_pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
|
||||
if (cur_pages == 1)
|
||||
{
|
||||
@ -524,10 +524,10 @@ gboolean document_remove(guint page_num)
|
||||
doc_list[idx].tm_file = NULL;
|
||||
doc_list[idx].scroll_percent = -1.0F;
|
||||
document_undo_clear(idx);
|
||||
if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0)
|
||||
if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) == 0)
|
||||
{
|
||||
treeviews_update_tag_list(-1, FALSE);
|
||||
/*on_notebook1_switch_page(GTK_NOTEBOOK(app->notebook), NULL, 0, NULL);*/
|
||||
/*on_notebook1_switch_page(GTK_NOTEBOOK(main_widgets.notebook), NULL, 0, NULL);*/
|
||||
ui_set_window_title(-1);
|
||||
ui_save_buttons_toggle(FALSE);
|
||||
ui_document_buttons_update();
|
||||
@ -556,7 +556,7 @@ static void store_saved_encoding(gint idx)
|
||||
/* Opens a new empty document only if there are no other documents open */
|
||||
gint document_new_file_if_non_open()
|
||||
{
|
||||
if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0)
|
||||
if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) == 0)
|
||||
return document_new_file(NULL, NULL, NULL);
|
||||
|
||||
return -1;
|
||||
@ -1020,8 +1020,8 @@ gint document_open_file_full(gint idx, const gchar *filename, gint pos, gboolean
|
||||
if (idx >= 0)
|
||||
{
|
||||
ui_add_recent_file(utf8_filename); /* either add or reorder recent item */
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook),
|
||||
gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook),
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
(GtkWidget*) doc_list[idx].sci));
|
||||
g_free(utf8_filename);
|
||||
g_free(locale_filename);
|
||||
@ -1116,7 +1116,7 @@ gint document_open_file_full(gint idx, const gchar *filename, gint pos, gboolean
|
||||
ui_set_statusbar(TRUE, _("File %s reloaded."), utf8_filename);
|
||||
else
|
||||
msgwin_status_add(_("File %s opened(%d%s)."),
|
||||
utf8_filename, gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)),
|
||||
utf8_filename, gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)),
|
||||
(readonly) ? _(", read-only") : "");
|
||||
|
||||
g_free(utf8_filename);
|
||||
@ -1285,9 +1285,9 @@ gboolean document_save_file_as(gint idx)
|
||||
document_set_filetype(idx, ft);
|
||||
if (document_get_cur_idx() == idx)
|
||||
{
|
||||
app->ignore_callback = TRUE;
|
||||
ignore_callback = TRUE;
|
||||
filetypes_select_radio_item(doc_list[idx].file_type);
|
||||
app->ignore_callback = FALSE;
|
||||
ignore_callback = FALSE;
|
||||
}
|
||||
}
|
||||
utils_replace_filename(idx);
|
||||
@ -2135,7 +2135,7 @@ void document_set_encoding(gint idx, const gchar *new_encoding)
|
||||
doc_list[idx].encoding = g_strdup(new_encoding);
|
||||
|
||||
ui_update_statusbar(idx, -1);
|
||||
gtk_widget_set_sensitive(lookup_widget(app->window, "menu_write_unicode_bom1"),
|
||||
gtk_widget_set_sensitive(lookup_widget(main_widgets.window, "menu_write_unicode_bom1"),
|
||||
encodings_is_unicode_charset(doc_list[idx].encoding));
|
||||
}
|
||||
|
||||
@ -2272,9 +2272,9 @@ void document_undo(gint idx)
|
||||
|
||||
document_set_encoding(idx, (const gchar*)action->data);
|
||||
|
||||
app->ignore_callback = TRUE;
|
||||
ignore_callback = TRUE;
|
||||
encodings_select_radio_item((const gchar*)action->data);
|
||||
app->ignore_callback = FALSE;
|
||||
ignore_callback = FALSE;
|
||||
|
||||
g_free(action->data);
|
||||
break;
|
||||
@ -2341,9 +2341,9 @@ void document_redo(gint idx)
|
||||
|
||||
document_set_encoding(idx, (const gchar*)action->data);
|
||||
|
||||
app->ignore_callback = TRUE;
|
||||
ignore_callback = TRUE;
|
||||
encodings_select_radio_item((const gchar*)action->data);
|
||||
app->ignore_callback = FALSE;
|
||||
ignore_callback = FALSE;
|
||||
|
||||
g_free(action->data);
|
||||
break;
|
||||
@ -2509,7 +2509,7 @@ gboolean document_account_for_unsaved(void)
|
||||
gint p;
|
||||
guint i, len = doc_array->len;
|
||||
|
||||
for (p = 0; p < gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)); p++)
|
||||
for (p = 0; p < gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)); p++)
|
||||
{
|
||||
gint idx = document_get_n_idx(p);
|
||||
|
||||
@ -2545,7 +2545,7 @@ static void force_close_all(void)
|
||||
}
|
||||
main_status.closing_all = TRUE;
|
||||
|
||||
while (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) > 0)
|
||||
while (gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) > 0)
|
||||
{
|
||||
document_remove(0);
|
||||
}
|
||||
|
35
src/editor.c
35
src/editor.c
@ -101,7 +101,7 @@ on_editor_button_press_event (GtkWidget *widget,
|
||||
ui_update_popup_goto_items((current_word[0] != '\0') ? TRUE : FALSE);
|
||||
ui_update_popup_copy_items(idx);
|
||||
ui_update_insert_include_item(idx, 0);
|
||||
gtk_menu_popup(GTK_MENU(app->popup_menu), NULL, NULL, NULL, NULL, event->button, event->time);
|
||||
gtk_menu_popup(GTK_MENU(main_widgets.editor_menu), NULL, NULL, NULL, NULL, event->button, event->time);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -460,7 +460,7 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer
|
||||
|
||||
case SCN_MODIFIED:
|
||||
{
|
||||
if (nt->modificationType & SC_STARTACTION && ! app->ignore_callback)
|
||||
if (nt->modificationType & SC_STARTACTION && ! ignore_callback)
|
||||
{
|
||||
/* get notified about undo changes */
|
||||
document_undo_add(idx, UNDO_SCINTILLA, NULL);
|
||||
@ -3211,3 +3211,34 @@ void editor_set_use_tabs(gint idx, gboolean use_tabs)
|
||||
/* remove indent spaces on backspace, if using spaces to indent */
|
||||
SSM(doc->sci, SCI_SETBACKSPACEUNINDENTS, ! use_tabs, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Move to position @a pos, switching to the document at @a idx if necessary,
|
||||
* setting a marker if @a mark is set. */
|
||||
gboolean editor_goto_pos(gint idx, gint pos, gboolean mark)
|
||||
{
|
||||
gint page_num;
|
||||
|
||||
if (! DOC_IDX_VALID(idx) || pos < 0)
|
||||
return FALSE;
|
||||
|
||||
if (mark)
|
||||
{
|
||||
gint line = sci_get_line_from_position(doc_list[idx].sci, pos);
|
||||
|
||||
/* mark the tag with the yellow arrow */
|
||||
sci_marker_delete_all(doc_list[idx].sci, 0);
|
||||
sci_set_marker_at_line(doc_list[idx].sci, line, TRUE, 0);
|
||||
}
|
||||
|
||||
sci_goto_pos(doc_list[idx].sci, pos, TRUE);
|
||||
doc_list[idx].scroll_percent = 0.25F;
|
||||
|
||||
/* finally switch to the page */
|
||||
page_num = gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook), GTK_WIDGET(doc_list[idx].sci));
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), page_num);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -201,4 +201,6 @@ void editor_set_use_tabs(gint idx, gboolean use_tabs);
|
||||
|
||||
void editor_set_line_wrapping(gint idx, gboolean wrap);
|
||||
|
||||
gboolean editor_goto_pos(gint idx, gint pos, gboolean mark);
|
||||
|
||||
#endif
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "msgwindow.h"
|
||||
#include "encodings.h"
|
||||
#include "callbacks.h"
|
||||
#include "ui_utils.h"
|
||||
|
||||
|
||||
#ifdef HAVE_REGCOMP
|
||||
@ -239,7 +240,7 @@ void encodings_select_radio_item(const gchar *charset)
|
||||
}
|
||||
if (i == GEANY_ENCODINGS_MAX) i = GEANY_ENCODING_UTF_8; /* fallback to UTF-8 */
|
||||
|
||||
/* app->ignore_callback has to be set by the caller */
|
||||
/* ignore_callback has to be set by the caller */
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(radio_items[i]), TRUE);
|
||||
}
|
||||
|
||||
@ -329,8 +330,8 @@ void encodings_init(void)
|
||||
#endif
|
||||
|
||||
/* create encodings submenu in document menu */
|
||||
menu[0] = lookup_widget(app->window, "set_encoding1_menu");
|
||||
menu[1] = lookup_widget(app->window, "menu_reload_as1_menu");
|
||||
menu[0] = lookup_widget(main_widgets.window, "set_encoding1_menu");
|
||||
menu[1] = lookup_widget(main_widgets.window, "menu_reload_as1_menu");
|
||||
cb_func[0] = G_CALLBACK(on_encoding_change);
|
||||
cb_func[1] = G_CALLBACK(on_reload_as_activate);
|
||||
|
||||
|
@ -443,7 +443,7 @@ void filetypes_init_types()
|
||||
static void create_set_filetype_menu()
|
||||
{
|
||||
filetype_id ft_id;
|
||||
GtkWidget *filetype_menu = lookup_widget(app->window, "set_filetype1_menu");
|
||||
GtkWidget *filetype_menu = lookup_widget(main_widgets.window, "set_filetype1_menu");
|
||||
GtkWidget *sub_menu = filetype_menu;
|
||||
GtkWidget *sub_menu_programming, *sub_menu_scripts, *sub_menu_markup, *sub_menu_misc;
|
||||
GtkWidget *sub_item_programming, *sub_item_scripts, *sub_item_markup, *sub_item_misc;
|
||||
@ -700,8 +700,8 @@ void filetypes_select_radio_item(const GeanyFiletype *ft)
|
||||
{
|
||||
FullFileType *fft;
|
||||
|
||||
/* app->ignore_callback has to be set by the caller */
|
||||
g_return_if_fail(app->ignore_callback);
|
||||
/* ignore_callback has to be set by the caller */
|
||||
g_return_if_fail(ignore_callback);
|
||||
|
||||
if (ft == NULL)
|
||||
ft = filetypes[GEANY_FILETYPES_NONE];
|
||||
@ -716,7 +716,7 @@ on_filetype_change (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
if (app->ignore_callback || idx < 0 || ! doc_list[idx].is_valid) return;
|
||||
if (ignore_callback || idx < 0 || ! doc_list[idx].is_valid) return;
|
||||
|
||||
document_set_filetype(idx, (GeanyFiletype*)user_data);
|
||||
}
|
||||
|
16
src/geany.h
16
src/geany.h
@ -59,8 +59,7 @@ typedef struct _GeanyFiletype GeanyFiletype;
|
||||
typedef struct _GeanyProject GeanyProject;
|
||||
|
||||
|
||||
/* Commonly used items.
|
||||
* Remember to increment abi_version in plugindata.h when changing items. */
|
||||
/* Important commonly-used items. */
|
||||
typedef struct GeanyApp
|
||||
{
|
||||
gboolean debug_mode;
|
||||
@ -69,22 +68,15 @@ typedef struct GeanyApp
|
||||
gchar *docdir;
|
||||
const TMWorkspace *tm_workspace;
|
||||
GeanyProject *project; /* currently active project or NULL if none is open */
|
||||
gboolean ignore_callback; /* should not be used in new code
|
||||
(use clicked instead of toggled signal) */
|
||||
|
||||
/* Important widgets */
|
||||
GtkWidget *window;
|
||||
GtkWidget *toolbar;
|
||||
GtkWidget *treeview_notebook;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *statusbar; /* use ui_set_statusbar() to set */
|
||||
GtkWidget *popup_menu;
|
||||
}
|
||||
GeanyApp;
|
||||
|
||||
extern GeanyApp *app;
|
||||
|
||||
|
||||
extern gboolean ignore_callback;
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
GEANY_IMAGE_SMALL_CROSS,
|
||||
|
@ -137,7 +137,7 @@ static KeyBindingGroup *add_kb_group(KeyBindingGroup *group,
|
||||
|
||||
/* Lookup a widget in the main window */
|
||||
#define LW(widget_name) \
|
||||
lookup_widget(app->window, G_STRINGIFY(widget_name))
|
||||
lookup_widget(main_widgets.window, G_STRINGIFY(widget_name))
|
||||
|
||||
/* Expansion for group_id = FILE:
|
||||
* static KeyBinding FILE_keys[GEANY_KEYS_FILE_COUNT]; */
|
||||
@ -456,7 +456,7 @@ void keybindings_init(void)
|
||||
|
||||
init_default_kb();
|
||||
|
||||
gtk_window_add_accel_group(GTK_WINDOW(app->window), kb_accel_group);
|
||||
gtk_window_add_accel_group(GTK_WINDOW(main_widgets.window), kb_accel_group);
|
||||
}
|
||||
|
||||
|
||||
@ -542,7 +542,7 @@ static void add_menu_accel(KeyBindingGroup *group, guint kb_id,
|
||||
|
||||
|
||||
#define GEANY_ADD_POPUP_ACCEL(kb_id, wid) \
|
||||
add_menu_accel(group, kb_id, accel_group, lookup_widget(app->popup_menu, G_STRINGIFY(wid)))
|
||||
add_menu_accel(group, kb_id, accel_group, lookup_widget(main_widgets.editor_menu, G_STRINGIFY(wid)))
|
||||
|
||||
/* set the menu item accelerator shortcuts (just for visibility, they are handled anyway) */
|
||||
static void add_popup_menu_accels(void)
|
||||
@ -583,7 +583,7 @@ static void add_popup_menu_accels(void)
|
||||
|
||||
/* the build menu items are set if the build menus are created */
|
||||
|
||||
gtk_window_add_accel_group(GTK_WINDOW(app->window), accel_group);
|
||||
gtk_window_add_accel_group(GTK_WINDOW(main_widgets.window), accel_group);
|
||||
}
|
||||
|
||||
|
||||
@ -676,7 +676,7 @@ void keybindings_show_shortcuts(void)
|
||||
GString *text_keys;
|
||||
gint height, response;
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons(_("Keyboard Shortcuts"), GTK_WINDOW(app->window),
|
||||
dialog = gtk_dialog_new_with_buttons(_("Keyboard Shortcuts"), GTK_WINDOW(main_widgets.window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_EDIT, GTK_RESPONSE_APPLY,
|
||||
GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL, NULL);
|
||||
@ -745,7 +745,7 @@ static gboolean check_fixed_kb(guint keyval, guint state)
|
||||
if (state & GDK_MOD1_MASK && keyval >= GDK_0 && keyval <= GDK_9)
|
||||
{
|
||||
gint page = keyval - GDK_0 - 1;
|
||||
gint npages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook));
|
||||
gint npages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
|
||||
/* alt-0 is for the rightmost tab */
|
||||
if (keyval == GDK_0)
|
||||
@ -754,7 +754,7 @@ static gboolean check_fixed_kb(guint keyval, guint state)
|
||||
if (swap_alt_tab_order && ! file_prefs.tab_order_ltr)
|
||||
page = (npages - 1) - page;
|
||||
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), page);
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), page);
|
||||
return TRUE;
|
||||
}
|
||||
if (keyval == GDK_Page_Up || keyval == GDK_Page_Down)
|
||||
@ -763,10 +763,10 @@ static gboolean check_fixed_kb(guint keyval, guint state)
|
||||
if (state == (GDK_CONTROL_MASK | GDK_SHIFT_MASK))
|
||||
{
|
||||
if (keyval == GDK_Page_Up)
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), 0);
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), 0);
|
||||
if (keyval == GDK_Page_Down)
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook),
|
||||
gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) - 1);
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) - 1);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -784,7 +784,7 @@ static gboolean check_snippet_completion(guint keyval, guint state)
|
||||
if (kb->key == keyval && kb->mods == state)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
||||
|
||||
/* keybinding only valid when scintilla widget has focus */
|
||||
if (DOC_IDX_VALID(idx) && focusw == GTK_WIDGET(doc_list[idx].sci))
|
||||
@ -815,7 +815,7 @@ static gboolean check_vte(GdkModifierType state, guint keyval)
|
||||
|
||||
if (! vc->enable_bash_keys)
|
||||
return FALSE;
|
||||
if (gtk_window_get_focus(GTK_WINDOW(app->window)) != vc->vte)
|
||||
if (gtk_window_get_focus(GTK_WINDOW(main_widgets.window)) != vc->vte)
|
||||
return FALSE;
|
||||
/* prevent menubar flickering: */
|
||||
if (state == GDK_SHIFT_MASK && (keyval >= GDK_a && keyval <= GDK_z))
|
||||
@ -836,10 +836,10 @@ static gboolean check_vte(GdkModifierType state, guint keyval)
|
||||
* from overriding the VTE bash shortcuts.
|
||||
* Ideally we would just somehow disable the menubar without redrawing it,
|
||||
* but maybe that's not possible. */
|
||||
widget = lookup_widget(app->window, "menubar1");
|
||||
widget = lookup_widget(main_widgets.window, "menubar1");
|
||||
gtk_widget_set_sensitive(widget, FALSE);
|
||||
g_idle_add(&set_sensitive, (gpointer) widget);
|
||||
widget = app->popup_menu;
|
||||
widget = main_widgets.editor_menu;
|
||||
gtk_widget_set_sensitive(widget, FALSE);
|
||||
g_idle_add(&set_sensitive, (gpointer) widget);
|
||||
return TRUE;
|
||||
@ -1042,14 +1042,14 @@ static void cb_func_menu_opencolorchooser(G_GNUC_UNUSED guint key_id)
|
||||
|
||||
static void cb_func_menu_fullscreen(G_GNUC_UNUSED guint key_id)
|
||||
{
|
||||
GtkCheckMenuItem *c = GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_fullscreen1"));
|
||||
GtkCheckMenuItem *c = GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "menu_fullscreen1"));
|
||||
|
||||
gtk_check_menu_item_set_active(c, ! gtk_check_menu_item_get_active(c));
|
||||
}
|
||||
|
||||
static void cb_func_menu_messagewindow(G_GNUC_UNUSED guint key_id)
|
||||
{
|
||||
GtkCheckMenuItem *c = GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_messages_window1"));
|
||||
GtkCheckMenuItem *c = GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "menu_show_messages_window1"));
|
||||
|
||||
gtk_check_menu_item_set_active(c, ! gtk_check_menu_item_get_active(c));
|
||||
}
|
||||
@ -1175,15 +1175,15 @@ static void cb_func_switch_scribble(G_GNUC_UNUSED guint key_id)
|
||||
static void cb_func_switch_search_bar(G_GNUC_UNUSED guint key_id)
|
||||
{
|
||||
if (toolbar_prefs.visible && toolbar_prefs.show_search)
|
||||
gtk_widget_grab_focus(lookup_widget(app->window, "entry1"));
|
||||
gtk_widget_grab_focus(lookup_widget(main_widgets.window, "entry1"));
|
||||
}
|
||||
|
||||
static void cb_func_switch_sidebar(G_GNUC_UNUSED guint key_id)
|
||||
{
|
||||
if (ui_prefs.sidebar_visible)
|
||||
{
|
||||
gint page_num = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->treeview_notebook));
|
||||
GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(app->treeview_notebook), page_num);
|
||||
gint page_num = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.sidebar_notebook));
|
||||
GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(main_widgets.sidebar_notebook), page_num);
|
||||
|
||||
/* gtk_widget_grab_focus() won't work because of the scrolled window containers */
|
||||
gtk_widget_child_focus(page, GTK_DIR_TAB_FORWARD);
|
||||
@ -1195,14 +1195,37 @@ static void cb_func_switch_vte(G_GNUC_UNUSED guint key_id)
|
||||
msgwin_switch_tab(MSG_VTE, TRUE);
|
||||
}
|
||||
|
||||
|
||||
static void switch_document(gint direction)
|
||||
{
|
||||
gint page_count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
|
||||
if (direction == LEFT)
|
||||
{
|
||||
if (cur_page > 0)
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), cur_page - 1);
|
||||
else
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), page_count - 1);
|
||||
}
|
||||
else if (direction == RIGHT)
|
||||
{
|
||||
if (cur_page < page_count - 1)
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), cur_page + 1);
|
||||
else
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void cb_func_switch_tableft(G_GNUC_UNUSED guint key_id)
|
||||
{
|
||||
utils_switch_document(LEFT);
|
||||
switch_document(LEFT);
|
||||
}
|
||||
|
||||
static void cb_func_switch_tabright(G_GNUC_UNUSED guint key_id)
|
||||
{
|
||||
utils_switch_document(RIGHT);
|
||||
switch_document(RIGHT);
|
||||
}
|
||||
|
||||
static void cb_func_switch_tablastused(G_GNUC_UNUSED guint key_id)
|
||||
@ -1210,7 +1233,7 @@ static void cb_func_switch_tablastused(G_GNUC_UNUSED guint key_id)
|
||||
gint last_doc_idx = callbacks_data.last_doc_idx;
|
||||
|
||||
if (DOC_IDX_VALID(last_doc_idx))
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook),
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
document_get_notebook_page(last_doc_idx));
|
||||
}
|
||||
|
||||
@ -1219,7 +1242,7 @@ static void cb_func_move_tab(guint key_id)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
GtkWidget *sci = GTK_WIDGET(doc_list[idx].sci);
|
||||
GtkNotebook *nb = GTK_NOTEBOOK(app->notebook);
|
||||
GtkNotebook *nb = GTK_NOTEBOOK(main_widgets.notebook);
|
||||
gint cur_page = gtk_notebook_get_current_page(nb);
|
||||
|
||||
if (! DOC_IDX_VALID(idx))
|
||||
@ -1397,7 +1420,7 @@ static void delete_lines(ScintillaObject *sci)
|
||||
static void cb_func_editor_action(guint key_id)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
||||
|
||||
/* edit keybindings only valid when scintilla widget has focus */
|
||||
if (! DOC_IDX_VALID(idx) || focusw != GTK_WIDGET(doc_list[idx].sci)) return;
|
||||
@ -1439,7 +1462,7 @@ static void cb_func_editor_action(guint key_id)
|
||||
break;
|
||||
case GEANY_KEYS_EDITOR_CONTEXTACTION:
|
||||
if (check_current_word())
|
||||
on_context_action1_activate(GTK_MENU_ITEM(lookup_widget(app->popup_menu,
|
||||
on_context_action1_activate(GTK_MENU_ITEM(lookup_widget(main_widgets.editor_menu,
|
||||
"context_action1")), NULL);
|
||||
break;
|
||||
case GEANY_KEYS_EDITOR_SUPPRESSSNIPPETCOMPLETION:
|
||||
@ -1468,7 +1491,7 @@ static void cb_func_editor_action(guint key_id)
|
||||
static void cb_func_format_action(guint key_id)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
||||
|
||||
/* keybindings only valid when scintilla widget has focus */
|
||||
if (! DOC_IDX_VALID(idx) || focusw != GTK_WIDGET(doc_list[idx].sci)) return;
|
||||
@ -1522,12 +1545,12 @@ static void cb_func_format_action(guint key_id)
|
||||
static void cb_func_select_action(guint key_id)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
||||
static GtkWidget *scribble_widget = NULL;
|
||||
|
||||
/* special case for Select All in the scribble widget */
|
||||
if (scribble_widget == NULL) /* lookup the scribble widget only once */
|
||||
scribble_widget = lookup_widget(app->window, "textview_scribble");
|
||||
scribble_widget = lookup_widget(main_widgets.window, "textview_scribble");
|
||||
if (key_id == GEANY_KEYS_SELECT_ALL && focusw == scribble_widget)
|
||||
{
|
||||
g_signal_emit_by_name(scribble_widget, "select-all", TRUE);
|
||||
@ -1565,7 +1588,7 @@ static void cb_func_menu_replacetabs(G_GNUC_UNUSED guint key_id)
|
||||
static void cb_func_insert_action(guint key_id)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
||||
|
||||
/* keybindings only valid when scintilla widget has focus */
|
||||
if (! DOC_IDX_VALID(idx) || focusw != GTK_WIDGET(doc_list[idx].sci)) return;
|
||||
@ -1576,7 +1599,7 @@ static void cb_func_insert_action(guint key_id)
|
||||
editor_insert_alternative_whitespace(idx);
|
||||
break;
|
||||
case GEANY_KEYS_INSERT_DATE:
|
||||
gtk_menu_item_activate(GTK_MENU_ITEM(lookup_widget(app->window, "insert_date_custom1")));
|
||||
gtk_menu_item_activate(GTK_MENU_ITEM(lookup_widget(main_widgets.window, "insert_date_custom1")));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -144,11 +144,11 @@ void configuration_save_session_files(GKeyFile *config)
|
||||
gchar entry[14];
|
||||
guint i = 0, j = 0, max;
|
||||
|
||||
npage = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->notebook));
|
||||
npage = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
g_key_file_set_integer(config, "files", "current_page", npage);
|
||||
|
||||
/* store the filenames to reopen them the next time */
|
||||
max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook));
|
||||
max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
for (i = 0; i < max; i++)
|
||||
{
|
||||
idx = document_get_n_idx(i);
|
||||
@ -339,7 +339,7 @@ static void save_ui_prefs(GKeyFile *config)
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, end;
|
||||
|
||||
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(lookup_widget(app->window, "textview_scribble")));
|
||||
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(lookup_widget(main_widgets.window, "textview_scribble")));
|
||||
gtk_text_buffer_get_bounds(buffer, &start, &end);
|
||||
scribble_text = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
|
||||
g_key_file_set_string(config, PACKAGE, "scribble_text", scribble_text);
|
||||
@ -349,16 +349,16 @@ static void save_ui_prefs(GKeyFile *config)
|
||||
if (prefs.save_winpos)
|
||||
{
|
||||
g_key_file_set_integer(config, PACKAGE, "treeview_position",
|
||||
gtk_paned_get_position(GTK_PANED(lookup_widget(app->window, "hpaned1"))));
|
||||
gtk_paned_get_position(GTK_PANED(lookup_widget(main_widgets.window, "hpaned1"))));
|
||||
g_key_file_set_integer(config, PACKAGE, "msgwindow_position",
|
||||
gtk_paned_get_position(GTK_PANED(lookup_widget(app->window, "vpaned1"))));
|
||||
gtk_paned_get_position(GTK_PANED(lookup_widget(main_widgets.window, "vpaned1"))));
|
||||
}
|
||||
|
||||
if (prefs.save_winpos)
|
||||
{
|
||||
gtk_window_get_position(GTK_WINDOW(app->window), &ui_prefs.geometry[0], &ui_prefs.geometry[1]);
|
||||
gtk_window_get_size(GTK_WINDOW(app->window), &ui_prefs.geometry[2], &ui_prefs.geometry[3]);
|
||||
if (gdk_window_get_state(app->window->window) & GDK_WINDOW_STATE_MAXIMIZED)
|
||||
gtk_window_get_position(GTK_WINDOW(main_widgets.window), &ui_prefs.geometry[0], &ui_prefs.geometry[1]);
|
||||
gtk_window_get_size(GTK_WINDOW(main_widgets.window), &ui_prefs.geometry[2], &ui_prefs.geometry[3]);
|
||||
if (gdk_window_get_state(main_widgets.window->window) & GDK_WINDOW_STATE_MAXIMIZED)
|
||||
ui_prefs.geometry[4] = 1;
|
||||
else
|
||||
ui_prefs.geometry[4] = 0;
|
||||
@ -913,7 +913,7 @@ void configuration_open_files(void)
|
||||
main_status.opening_session_files = FALSE;
|
||||
/** TODO if session_notebook_page is equal to the current notebook tab(the last opened)
|
||||
** the notebook switch page callback isn't triggered and e.g. menu items are not updated */
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), session_notebook_page);
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), session_notebook_page);
|
||||
}
|
||||
main_status.opening_session_files = FALSE;
|
||||
}
|
||||
@ -926,7 +926,7 @@ void configuration_apply_settings(void)
|
||||
if (scribble_text)
|
||||
{ /* update the scribble widget, because now it's realized */
|
||||
gtk_text_buffer_set_text(
|
||||
gtk_text_view_get_buffer(GTK_TEXT_VIEW(lookup_widget(app->window, "textview_scribble"))),
|
||||
gtk_text_view_get_buffer(GTK_TEXT_VIEW(lookup_widget(main_widgets.window, "textview_scribble"))),
|
||||
scribble_text, -1);
|
||||
}
|
||||
g_free(scribble_text);
|
||||
@ -934,15 +934,15 @@ void configuration_apply_settings(void)
|
||||
/* set the position of the hpaned and vpaned */
|
||||
if (prefs.save_winpos)
|
||||
{
|
||||
gtk_paned_set_position(GTK_PANED(lookup_widget(app->window, "hpaned1")), hpan_position);
|
||||
gtk_paned_set_position(GTK_PANED(lookup_widget(app->window, "vpaned1")), vpan_position);
|
||||
gtk_paned_set_position(GTK_PANED(lookup_widget(main_widgets.window, "hpaned1")), hpan_position);
|
||||
gtk_paned_set_position(GTK_PANED(lookup_widget(main_widgets.window, "vpaned1")), vpan_position);
|
||||
}
|
||||
|
||||
/* set fullscreen after initial draw so that returning to normal view is the right size.
|
||||
* fullscreen mode is disabled by default, so act only if it is true */
|
||||
if (ui_prefs.fullscreen)
|
||||
{
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_fullscreen1")), TRUE);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "menu_fullscreen1")), TRUE);
|
||||
ui_prefs.fullscreen = TRUE;
|
||||
ui_set_fullscreen();
|
||||
}
|
||||
|
161
src/main.c
161
src/main.c
@ -83,7 +83,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
GeanyApp *app;
|
||||
GeanyApp *app;
|
||||
gboolean ignore_callback; /* hack workaround for GTK+ toggle button callback problem */
|
||||
|
||||
GeanyStatus main_status;
|
||||
CommandLineOptions cl_options; /* fields initialised in parse_command_line_options */
|
||||
@ -171,23 +172,23 @@ static void apply_settings(void)
|
||||
/* toolbar, message window and sidebar are by default visible, so don't change it if it is true */
|
||||
if (! toolbar_prefs.visible)
|
||||
{
|
||||
app->ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_toolbar1")), FALSE);
|
||||
gtk_widget_hide(app->toolbar);
|
||||
app->ignore_callback = FALSE;
|
||||
ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "menu_show_toolbar1")), FALSE);
|
||||
gtk_widget_hide(main_widgets.toolbar);
|
||||
ignore_callback = FALSE;
|
||||
}
|
||||
if (! ui_prefs.msgwindow_visible)
|
||||
{
|
||||
app->ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_messages_window1")), FALSE);
|
||||
gtk_widget_hide(lookup_widget(app->window, "scrolledwindow1"));
|
||||
app->ignore_callback = FALSE;
|
||||
ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "menu_show_messages_window1")), FALSE);
|
||||
gtk_widget_hide(lookup_widget(main_widgets.window, "scrolledwindow1"));
|
||||
ignore_callback = FALSE;
|
||||
}
|
||||
if (! ui_prefs.sidebar_visible)
|
||||
{
|
||||
app->ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_sidebar1")), FALSE);
|
||||
app->ignore_callback = FALSE;
|
||||
ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "menu_show_sidebar1")), FALSE);
|
||||
ignore_callback = FALSE;
|
||||
}
|
||||
ui_sidebar_show_hide();
|
||||
/* sets the icon style of the toolbar */
|
||||
@ -195,88 +196,88 @@ static void apply_settings(void)
|
||||
{
|
||||
case GTK_TOOLBAR_BOTH:
|
||||
{
|
||||
/*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "images_and_text1")), TRUE);*/
|
||||
/*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "images_and_text1")), TRUE);*/
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(ui_widgets.toolbar_menu, "images_and_text2")), TRUE);
|
||||
break;
|
||||
}
|
||||
case GTK_TOOLBAR_ICONS:
|
||||
{
|
||||
/*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "images_only1")), TRUE);*/
|
||||
/*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "images_only1")), TRUE);*/
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(ui_widgets.toolbar_menu, "images_only2")), TRUE);
|
||||
break;
|
||||
}
|
||||
case GTK_TOOLBAR_TEXT:
|
||||
{
|
||||
/*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "text_only1")), TRUE);*/
|
||||
/*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "text_only1")), TRUE);*/
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(ui_widgets.toolbar_menu, "text_only2")), TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), toolbar_prefs.icon_style);
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(main_widgets.toolbar), toolbar_prefs.icon_style);
|
||||
|
||||
/* sets the icon size of the toolbar, use user preferences (.gtkrc) if not set */
|
||||
if (toolbar_prefs.icon_size == GTK_ICON_SIZE_SMALL_TOOLBAR ||
|
||||
toolbar_prefs.icon_size == GTK_ICON_SIZE_LARGE_TOOLBAR)
|
||||
{
|
||||
gtk_toolbar_set_icon_size(GTK_TOOLBAR(app->toolbar), toolbar_prefs.icon_size);
|
||||
gtk_toolbar_set_icon_size(GTK_TOOLBAR(main_widgets.toolbar), toolbar_prefs.icon_size);
|
||||
}
|
||||
ui_update_toolbar_icons(toolbar_prefs.icon_size);
|
||||
|
||||
/* line number and markers margin are by default enabled */
|
||||
if (! editor_prefs.show_markers_margin)
|
||||
{
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_markers_margin1")), FALSE);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "menu_markers_margin1")), FALSE);
|
||||
editor_prefs.show_markers_margin = FALSE;
|
||||
}
|
||||
if (! editor_prefs.show_linenumber_margin)
|
||||
{
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_linenumber_margin1")), FALSE);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "menu_linenumber_margin1")), FALSE);
|
||||
editor_prefs.show_linenumber_margin = FALSE;
|
||||
}
|
||||
|
||||
/* interprets the saved window geometry */
|
||||
if (prefs.save_winpos && ui_prefs.geometry[0] != -1)
|
||||
{
|
||||
gtk_window_move(GTK_WINDOW(app->window), ui_prefs.geometry[0], ui_prefs.geometry[1]);
|
||||
gtk_window_set_default_size(GTK_WINDOW(app->window), ui_prefs.geometry[2], ui_prefs.geometry[3]);
|
||||
gtk_window_move(GTK_WINDOW(main_widgets.window), ui_prefs.geometry[0], ui_prefs.geometry[1]);
|
||||
gtk_window_set_default_size(GTK_WINDOW(main_widgets.window), ui_prefs.geometry[2], ui_prefs.geometry[3]);
|
||||
if (ui_prefs.geometry[4] == 1)
|
||||
gtk_window_maximize(GTK_WINDOW(app->window));
|
||||
gtk_window_maximize(GTK_WINDOW(main_widgets.window));
|
||||
}
|
||||
|
||||
/* hide statusbar if desired */
|
||||
if (! interface_prefs.statusbar_visible)
|
||||
{
|
||||
gtk_widget_hide(app->statusbar);
|
||||
gtk_widget_hide(ui_widgets.statusbar);
|
||||
}
|
||||
|
||||
app->ignore_callback = TRUE;
|
||||
ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
|
||||
lookup_widget(app->window, "menu_line_wrapping1")), editor_prefs.line_wrapping);
|
||||
lookup_widget(main_widgets.window, "menu_line_wrapping1")), editor_prefs.line_wrapping);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
|
||||
lookup_widget(app->window, "menu_use_auto_indentation1")),
|
||||
lookup_widget(main_widgets.window, "menu_use_auto_indentation1")),
|
||||
(editor_prefs.indent_mode != INDENT_NONE));
|
||||
app->ignore_callback = FALSE;
|
||||
ignore_callback = FALSE;
|
||||
|
||||
/* connect the toolbar dropdown menu for the new button */
|
||||
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(
|
||||
lookup_widget(app->window, "menutoolbutton1")), ui_widgets.new_file_menu);
|
||||
lookup_widget(main_widgets.window, "menutoolbutton1")), ui_widgets.new_file_menu);
|
||||
|
||||
/* set the tab placements of the notebooks */
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->notebook), interface_prefs.tab_pos_editor);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.tab_pos_editor);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), interface_prefs.tab_pos_msgwin);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->treeview_notebook), interface_prefs.tab_pos_sidebar);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.sidebar_notebook), interface_prefs.tab_pos_sidebar);
|
||||
|
||||
ui_update_toolbar_items();
|
||||
|
||||
/* whether to show notebook tabs or not */
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), interface_prefs.show_notebook_tabs);
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs);
|
||||
}
|
||||
|
||||
|
||||
static void main_init(void)
|
||||
{
|
||||
/* inits */
|
||||
app->window = NULL;
|
||||
main_widgets.window = NULL;
|
||||
app->project = NULL;
|
||||
ui_widgets.open_fontsel = NULL;
|
||||
ui_widgets.open_colorsel = NULL;
|
||||
@ -287,55 +288,57 @@ static void main_init(void)
|
||||
main_status.main_window_realized= FALSE;
|
||||
file_prefs.tab_order_ltr = FALSE;
|
||||
main_status.quitting = FALSE;
|
||||
app->ignore_callback = FALSE;
|
||||
ignore_callback = FALSE;
|
||||
app->tm_workspace = tm_get_workspace();
|
||||
ui_prefs.recent_queue = g_queue_new();
|
||||
main_status.opening_session_files = FALSE;
|
||||
|
||||
app->window = create_window1();
|
||||
main_widgets.window = create_window1();
|
||||
ui_widgets.new_file_menu = gtk_menu_new();
|
||||
ui_widgets.recent_files_toolbar = gtk_menu_new();
|
||||
ui_widgets.recent_files_menuitem = lookup_widget(app->window, "recent_files1");
|
||||
ui_widgets.recent_files_menuitem = lookup_widget(main_widgets.window, "recent_files1");
|
||||
ui_widgets.recent_files_menubar = gtk_menu_new();
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(ui_widgets.recent_files_menuitem),
|
||||
ui_widgets.recent_files_menubar);
|
||||
|
||||
/* store important pointers for later reference */
|
||||
app->toolbar = lookup_widget(app->window, "toolbar1");
|
||||
app->treeview_notebook = lookup_widget(app->window, "notebook3");
|
||||
app->notebook = lookup_widget(app->window, "notebook1");
|
||||
app->statusbar = lookup_widget(app->window, "statusbar");
|
||||
app->popup_menu = create_edit_menu1();
|
||||
main_widgets.toolbar = lookup_widget(main_widgets.window, "toolbar1");
|
||||
main_widgets.sidebar_notebook = lookup_widget(main_widgets.window, "notebook3");
|
||||
main_widgets.notebook = lookup_widget(main_widgets.window, "notebook1");
|
||||
main_widgets.editor_menu = create_edit_menu1();
|
||||
main_widgets.tools_menu = lookup_widget(main_widgets.window, "tools1_menu");
|
||||
|
||||
ui_widgets.statusbar = lookup_widget(main_widgets.window, "statusbar");
|
||||
ui_widgets.toolbar_menu = create_toolbar_popup_menu1();
|
||||
ui_widgets.print_page_setup = lookup_widget(app->window, "page_setup1");
|
||||
ui_widgets.popup_goto_items[0] = lookup_widget(app->popup_menu, "goto_tag_definition1");
|
||||
ui_widgets.popup_goto_items[1] = lookup_widget(app->popup_menu, "goto_tag_declaration1");
|
||||
ui_widgets.popup_goto_items[2] = lookup_widget(app->popup_menu, "find_usage1");
|
||||
ui_widgets.popup_copy_items[0] = lookup_widget(app->popup_menu, "cut1");
|
||||
ui_widgets.popup_copy_items[1] = lookup_widget(app->popup_menu, "copy1");
|
||||
ui_widgets.popup_copy_items[2] = lookup_widget(app->popup_menu, "delete1");
|
||||
ui_widgets.menu_copy_items[0] = lookup_widget(app->window, "menu_cut1");
|
||||
ui_widgets.menu_copy_items[1] = lookup_widget(app->window, "menu_copy1");
|
||||
ui_widgets.menu_copy_items[2] = lookup_widget(app->window, "menu_delete1");
|
||||
ui_widgets.menu_insert_include_items[0] = lookup_widget(app->popup_menu, "insert_include1");
|
||||
ui_widgets.menu_insert_include_items[1] = lookup_widget(app->window, "insert_include2");
|
||||
ui_widgets.save_buttons[0] = lookup_widget(app->window, "menu_save1");
|
||||
ui_widgets.save_buttons[1] = lookup_widget(app->window, "toolbutton10");
|
||||
ui_widgets.save_buttons[2] = lookup_widget(app->window, "menu_save_all1");
|
||||
ui_widgets.save_buttons[3] = lookup_widget(app->window, "toolbutton22");
|
||||
ui_widgets.redo_items[0] = lookup_widget(app->popup_menu, "redo1");
|
||||
ui_widgets.redo_items[1] = lookup_widget(app->window, "menu_redo2");
|
||||
ui_widgets.redo_items[2] = lookup_widget(app->window, "toolbutton_redo");
|
||||
ui_widgets.undo_items[0] = lookup_widget(app->popup_menu, "undo1");
|
||||
ui_widgets.undo_items[1] = lookup_widget(app->window, "menu_undo2");
|
||||
ui_widgets.undo_items[2] = lookup_widget(app->window, "toolbutton_undo");
|
||||
ui_widgets.print_page_setup = lookup_widget(main_widgets.window, "page_setup1");
|
||||
ui_widgets.popup_goto_items[0] = lookup_widget(main_widgets.editor_menu, "goto_tag_definition1");
|
||||
ui_widgets.popup_goto_items[1] = lookup_widget(main_widgets.editor_menu, "goto_tag_declaration1");
|
||||
ui_widgets.popup_goto_items[2] = lookup_widget(main_widgets.editor_menu, "find_usage1");
|
||||
ui_widgets.popup_copy_items[0] = lookup_widget(main_widgets.editor_menu, "cut1");
|
||||
ui_widgets.popup_copy_items[1] = lookup_widget(main_widgets.editor_menu, "copy1");
|
||||
ui_widgets.popup_copy_items[2] = lookup_widget(main_widgets.editor_menu, "delete1");
|
||||
ui_widgets.menu_copy_items[0] = lookup_widget(main_widgets.window, "menu_cut1");
|
||||
ui_widgets.menu_copy_items[1] = lookup_widget(main_widgets.window, "menu_copy1");
|
||||
ui_widgets.menu_copy_items[2] = lookup_widget(main_widgets.window, "menu_delete1");
|
||||
ui_widgets.menu_insert_include_items[0] = lookup_widget(main_widgets.editor_menu, "insert_include1");
|
||||
ui_widgets.menu_insert_include_items[1] = lookup_widget(main_widgets.window, "insert_include2");
|
||||
ui_widgets.save_buttons[0] = lookup_widget(main_widgets.window, "menu_save1");
|
||||
ui_widgets.save_buttons[1] = lookup_widget(main_widgets.window, "toolbutton10");
|
||||
ui_widgets.save_buttons[2] = lookup_widget(main_widgets.window, "menu_save_all1");
|
||||
ui_widgets.save_buttons[3] = lookup_widget(main_widgets.window, "toolbutton22");
|
||||
ui_widgets.redo_items[0] = lookup_widget(main_widgets.editor_menu, "redo1");
|
||||
ui_widgets.redo_items[1] = lookup_widget(main_widgets.window, "menu_redo2");
|
||||
ui_widgets.redo_items[2] = lookup_widget(main_widgets.window, "toolbutton_redo");
|
||||
ui_widgets.undo_items[0] = lookup_widget(main_widgets.editor_menu, "undo1");
|
||||
ui_widgets.undo_items[1] = lookup_widget(main_widgets.window, "menu_undo2");
|
||||
ui_widgets.undo_items[2] = lookup_widget(main_widgets.window, "toolbutton_undo");
|
||||
|
||||
ui_init();
|
||||
|
||||
/* set widget names for matching with .gtkrc-2.0 */
|
||||
gtk_widget_set_name(app->window, "GeanyMainWindow");
|
||||
gtk_widget_set_name(main_widgets.window, "GeanyMainWindow");
|
||||
gtk_widget_set_name(ui_widgets.toolbar_menu, "GeanyToolbarMenu");
|
||||
gtk_widget_set_name(app->popup_menu, "GeanyEditMenu");
|
||||
gtk_widget_set_name(main_widgets.editor_menu, "GeanyEditMenu");
|
||||
|
||||
#if ! GTK_CHECK_VERSION(2, 10, 0)
|
||||
/* hide Page setup menu item, it isn't supported with non-GTK printing */
|
||||
@ -814,8 +817,8 @@ gint main(gint argc, gchar **argv)
|
||||
|
||||
/* inits */
|
||||
main_init();
|
||||
gtk_widget_set_size_request(app->window, GEANY_WINDOW_MINIMAL_WIDTH, GEANY_WINDOW_MINIMAL_HEIGHT);
|
||||
gtk_window_set_default_size(GTK_WINDOW(app->window), GEANY_WINDOW_DEFAULT_WIDTH, GEANY_WINDOW_DEFAULT_HEIGHT);
|
||||
gtk_widget_set_size_request(main_widgets.window, GEANY_WINDOW_MINIMAL_WIDTH, GEANY_WINDOW_MINIMAL_HEIGHT);
|
||||
gtk_window_set_default_size(GTK_WINDOW(main_widgets.window), GEANY_WINDOW_DEFAULT_WIDTH, GEANY_WINDOW_DEFAULT_HEIGHT);
|
||||
encodings_init();
|
||||
|
||||
load_settings();
|
||||
@ -841,19 +844,19 @@ gint main(gint argc, gchar **argv)
|
||||
GdkPixbuf *pb;
|
||||
|
||||
pb = ui_new_pixbuf_from_inline(GEANY_IMAGE_LOGO, FALSE);
|
||||
gtk_window_set_icon(GTK_WINDOW(app->window), pb);
|
||||
gtk_window_set_icon(GTK_WINDOW(main_widgets.window), pb);
|
||||
g_object_unref(pb); /* free our reference */
|
||||
}
|
||||
|
||||
/* registering some basic events */
|
||||
g_signal_connect(G_OBJECT(app->window), "delete_event", G_CALLBACK(on_exit_clicked), NULL);
|
||||
g_signal_connect(G_OBJECT(app->window), "key-press-event", G_CALLBACK(keybindings_got_event), NULL);
|
||||
g_signal_connect(G_OBJECT(app->toolbar), "button-press-event", G_CALLBACK(toolbar_popup_menu), NULL);
|
||||
g_signal_connect(G_OBJECT(lookup_widget(app->window, "textview_scribble")),
|
||||
g_signal_connect(G_OBJECT(main_widgets.window), "delete_event", G_CALLBACK(on_exit_clicked), NULL);
|
||||
g_signal_connect(G_OBJECT(main_widgets.window), "key-press-event", G_CALLBACK(keybindings_got_event), NULL);
|
||||
g_signal_connect(G_OBJECT(main_widgets.toolbar), "button-press-event", G_CALLBACK(toolbar_popup_menu), NULL);
|
||||
g_signal_connect(G_OBJECT(lookup_widget(main_widgets.window, "textview_scribble")),
|
||||
"motion-notify-event", G_CALLBACK(on_motion_event), NULL);
|
||||
g_signal_connect(G_OBJECT(lookup_widget(app->window, "entry1")),
|
||||
g_signal_connect(G_OBJECT(lookup_widget(main_widgets.window, "entry1")),
|
||||
"motion-notify-event", G_CALLBACK(on_motion_event), NULL);
|
||||
g_signal_connect(G_OBJECT(lookup_widget(app->window, "entry_goto_line")),
|
||||
g_signal_connect(G_OBJECT(lookup_widget(main_widgets.window, "entry_goto_line")),
|
||||
"motion-notify-event", G_CALLBACK(on_motion_event), NULL);
|
||||
|
||||
#ifdef HAVE_VTE
|
||||
@ -894,7 +897,7 @@ gint main(gint argc, gchar **argv)
|
||||
/* load session files into tabs, as they are found in the session_files variable */
|
||||
configuration_open_files();
|
||||
|
||||
if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0)
|
||||
if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) == 0)
|
||||
{
|
||||
ui_update_popup_copy_items(-1);
|
||||
ui_update_popup_reundo_items(-1);
|
||||
@ -916,7 +919,7 @@ gint main(gint argc, gchar **argv)
|
||||
treeviews_update_tag_list(idx, FALSE);
|
||||
|
||||
/* finally realize the window to show the user what we have done */
|
||||
gtk_widget_show(app->window);
|
||||
gtk_widget_show(main_widgets.window);
|
||||
main_status.main_window_realized = TRUE;
|
||||
|
||||
configuration_apply_settings();
|
||||
@ -927,7 +930,7 @@ gint main(gint argc, gchar **argv)
|
||||
{
|
||||
socket_info.read_ioc = g_io_channel_unix_new(socket_info.lock_socket);
|
||||
socket_info.lock_socket_tag = g_io_add_watch(socket_info.read_ioc,
|
||||
G_IO_IN|G_IO_PRI|G_IO_ERR, socket_lock_input_cb, app->window);
|
||||
G_IO_IN|G_IO_PRI|G_IO_ERR, socket_lock_input_cb, main_widgets.window);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1008,11 +1011,11 @@ void main_quit()
|
||||
g_free(vte_info.lib_vte);
|
||||
g_free(vte_info.dir);
|
||||
#endif
|
||||
gtk_widget_destroy(app->window);
|
||||
gtk_widget_destroy(main_widgets.window);
|
||||
|
||||
/* destroy popup menus */
|
||||
if (app->popup_menu && GTK_IS_WIDGET(app->popup_menu))
|
||||
gtk_widget_destroy(app->popup_menu);
|
||||
if (main_widgets.editor_menu && GTK_IS_WIDGET(main_widgets.editor_menu))
|
||||
gtk_widget_destroy(main_widgets.editor_menu);
|
||||
if (ui_widgets.toolbar_menu && GTK_IS_WIDGET(ui_widgets.toolbar_menu))
|
||||
gtk_widget_destroy(ui_widgets.toolbar_menu);
|
||||
if (tv.popup_taglist && GTK_IS_WIDGET(tv.popup_taglist))
|
||||
|
@ -75,13 +75,13 @@ static void on_scribble_populate(GtkTextView *textview, GtkMenu *arg1, gpointer
|
||||
|
||||
void msgwin_init()
|
||||
{
|
||||
msgwindow.notebook = lookup_widget(app->window, "notebook_info");
|
||||
msgwindow.tree_status = lookup_widget(app->window, "treeview3");
|
||||
msgwindow.tree_msg = lookup_widget(app->window, "treeview4");
|
||||
msgwindow.tree_compiler = lookup_widget(app->window, "treeview5");
|
||||
msgwindow.notebook = lookup_widget(main_widgets.window, "notebook_info");
|
||||
msgwindow.tree_status = lookup_widget(main_widgets.window, "treeview3");
|
||||
msgwindow.tree_msg = lookup_widget(main_widgets.window, "treeview4");
|
||||
msgwindow.tree_compiler = lookup_widget(main_widgets.window, "treeview5");
|
||||
msgwindow.find_in_files_dir = NULL;
|
||||
|
||||
gtk_widget_set_sensitive(lookup_widget(app->window, "next_message1"), FALSE);
|
||||
gtk_widget_set_sensitive(lookup_widget(main_widgets.window, "next_message1"), FALSE);
|
||||
|
||||
prepare_status_tree_view();
|
||||
prepare_msg_tree_view();
|
||||
@ -90,7 +90,7 @@ void msgwin_init()
|
||||
msgwindow.popup_msg_menu = create_message_popup_menu(MSG_MESSAGE);
|
||||
msgwindow.popup_compiler_menu = create_message_popup_menu(MSG_COMPILER);
|
||||
|
||||
g_signal_connect(G_OBJECT(lookup_widget(app->window, "textview_scribble")),
|
||||
g_signal_connect(G_OBJECT(lookup_widget(main_widgets.window, "textview_scribble")),
|
||||
"populate-popup", G_CALLBACK(on_scribble_populate), NULL);
|
||||
}
|
||||
|
||||
@ -258,12 +258,12 @@ void msgwin_compiler_add(gint msg_color, const gchar *msg)
|
||||
void msgwin_show_hide(gboolean show)
|
||||
{
|
||||
ui_prefs.msgwindow_visible = show;
|
||||
app->ignore_callback = TRUE;
|
||||
ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(
|
||||
GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_messages_window1")),
|
||||
GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "menu_show_messages_window1")),
|
||||
show);
|
||||
app->ignore_callback = FALSE;
|
||||
ui_widget_show_hide(lookup_widget(app->window, "scrolledwindow1"), show);
|
||||
ignore_callback = FALSE;
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "scrolledwindow1"), show);
|
||||
}
|
||||
|
||||
|
||||
@ -311,7 +311,7 @@ void msgwin_msg_add(gint msg_color, gint line, gint idx, const gchar *string)
|
||||
gtk_list_store_append(msgwindow.store_msg, &iter);
|
||||
gtk_list_store_set(msgwindow.store_msg, &iter, 0, line, 1, idx, 2, color, 3, tmp, -1);
|
||||
|
||||
gtk_widget_set_sensitive(lookup_widget(app->window, "next_message1"), TRUE);
|
||||
gtk_widget_set_sensitive(lookup_widget(main_widgets.window, "next_message1"), TRUE);
|
||||
|
||||
g_free(tmp);
|
||||
}
|
||||
@ -919,7 +919,7 @@ void msgwin_switch_tab(gint tabnum, gboolean show)
|
||||
|
||||
switch (tabnum)
|
||||
{
|
||||
case MSG_SCRATCH: widget = lookup_widget(app->window, "textview_scribble"); break;
|
||||
case MSG_SCRATCH: widget = lookup_widget(main_widgets.window, "textview_scribble"); break;
|
||||
#ifdef HAVE_VTE
|
||||
case MSG_VTE: widget = (vte_info.have_vte) ? vc->vte : NULL; break;
|
||||
#endif
|
||||
@ -948,7 +948,7 @@ void msgwin_clear_tab(gint tabnum)
|
||||
switch (tabnum)
|
||||
{
|
||||
case MSG_MESSAGE:
|
||||
gtk_widget_set_sensitive(lookup_widget(app->window, "next_message1"), FALSE);
|
||||
gtk_widget_set_sensitive(lookup_widget(main_widgets.window, "next_message1"), FALSE);
|
||||
store = msgwindow.store_msg;
|
||||
break;
|
||||
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include "document.h"
|
||||
#include "utils.h"
|
||||
#include "support.h"
|
||||
#include "ui_utils.h"
|
||||
#include "editor.h"
|
||||
|
||||
|
||||
/* for the navigation history queue */
|
||||
@ -54,8 +56,8 @@ void navqueue_init()
|
||||
navigation_queue = g_queue_new();
|
||||
nav_queue_pos = 0;
|
||||
|
||||
navigation_buttons[0] = lookup_widget(app->window, "toolbutton_back");
|
||||
navigation_buttons[1] = lookup_widget(app->window, "toolbutton_forward");
|
||||
navigation_buttons[0] = lookup_widget(main_widgets.window, "toolbutton_back");
|
||||
navigation_buttons[1] = lookup_widget(main_widgets.window, "toolbutton_forward");
|
||||
}
|
||||
|
||||
|
||||
@ -165,7 +167,17 @@ gboolean navqueue_goto_line(gint old_idx, gint new_idx, gint line)
|
||||
add_new_position(doc_list[new_idx].file_name, pos);
|
||||
}
|
||||
|
||||
return utils_goto_pos(new_idx, pos);
|
||||
return editor_goto_pos(new_idx, pos, TRUE);
|
||||
}
|
||||
|
||||
|
||||
static gboolean goto_file_pos(const gchar *file, gboolean is_tm_filename, gint pos)
|
||||
{
|
||||
gint file_idx = document_find_by_filename(file, is_tm_filename);
|
||||
|
||||
if (file_idx < 0) return FALSE;
|
||||
|
||||
return editor_goto_pos(file_idx, pos, TRUE);
|
||||
}
|
||||
|
||||
|
||||
@ -180,7 +192,7 @@ void navqueue_go_back()
|
||||
|
||||
/* jump back */
|
||||
fprev = g_queue_peek_nth(navigation_queue, nav_queue_pos + 1);
|
||||
if (utils_goto_file_pos(fprev->file, FALSE, fprev->pos))
|
||||
if (goto_file_pos(fprev->file, FALSE, fprev->pos))
|
||||
{
|
||||
nav_queue_pos++;
|
||||
}
|
||||
@ -203,7 +215,7 @@ void navqueue_go_forward()
|
||||
|
||||
/* jump forward */
|
||||
fnext = g_queue_peek_nth(navigation_queue, nav_queue_pos - 1);
|
||||
if (utils_goto_file_pos(fnext->file, FALSE, fnext->pos))
|
||||
if (goto_file_pos(fnext->file, FALSE, fnext->pos))
|
||||
{
|
||||
nav_queue_pos--;
|
||||
}
|
||||
|
@ -89,10 +89,10 @@ static void focus_sci(GtkWidget *widget, gpointer user_data)
|
||||
void notebook_init()
|
||||
{
|
||||
/* focus the current document after clicking on a tab */
|
||||
g_signal_connect_after(G_OBJECT(app->notebook), "button-release-event",
|
||||
g_signal_connect_after(G_OBJECT(main_widgets.notebook), "button-release-event",
|
||||
G_CALLBACK(focus_sci), NULL);
|
||||
|
||||
g_signal_connect(G_OBJECT(app->notebook), "drag-data-received",
|
||||
g_signal_connect(G_OBJECT(main_widgets.notebook), "drag-data-received",
|
||||
G_CALLBACK(on_window_drag_data_received), NULL);
|
||||
|
||||
setup_tab_dnd();
|
||||
@ -101,7 +101,7 @@ void notebook_init()
|
||||
|
||||
static void setup_tab_dnd()
|
||||
{
|
||||
GtkWidget *notebook = app->notebook;
|
||||
GtkWidget *notebook = main_widgets.notebook;
|
||||
|
||||
/* Due to a segfault with manual tab DnD setup on GTK 2.10, we must
|
||||
* use the built in gtk_notebook_set_tab_reorderable from GTK 2.10.
|
||||
@ -157,8 +157,8 @@ notebook_motion_notify_event_cb(GtkWidget *widget, GdkEventMotion *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
static gboolean drag_enabled = TRUE; /* stores current state */
|
||||
GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(app->notebook),
|
||||
gtk_notebook_get_current_page(GTK_NOTEBOOK(app->notebook)));
|
||||
GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook)));
|
||||
|
||||
if (page == NULL || event->x < 0 || event->y < 0) return FALSE;
|
||||
|
||||
@ -278,14 +278,14 @@ notebook_find_tab_num_at_pos(GtkNotebook *notebook, gint x, gint y)
|
||||
}
|
||||
|
||||
|
||||
/* call this after the number of tabs in app->notebook changes. */
|
||||
/* call this after the number of tabs in main_widgets.notebook changes. */
|
||||
static void tab_count_changed(void)
|
||||
{
|
||||
switch (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)))
|
||||
switch (gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)))
|
||||
{
|
||||
case 0:
|
||||
/* Enables DnD for dropping files into the empty notebook widget */
|
||||
gtk_drag_dest_set(app->notebook, GTK_DEST_DEFAULT_ALL,
|
||||
gtk_drag_dest_set(main_widgets.notebook, GTK_DEST_DEFAULT_ALL,
|
||||
files_drop_targets, G_N_ELEMENTS(files_drop_targets),
|
||||
GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK);
|
||||
break;
|
||||
@ -294,7 +294,7 @@ static void tab_count_changed(void)
|
||||
/* Disables DnD for dropping files into the notebook widget and enables the DnD for moving file
|
||||
* tabs. Files can still be dropped into the notebook widget because it will be handled by the
|
||||
* active Scintilla Widget (only dropping to the tab bar is not possible but it should be ok) */
|
||||
gtk_drag_dest_set(app->notebook, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
|
||||
gtk_drag_dest_set(main_widgets.notebook, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
|
||||
drag_targets, G_N_ELEMENTS(drag_targets), GDK_ACTION_MOVE);
|
||||
break;
|
||||
}
|
||||
@ -307,7 +307,7 @@ gboolean notebook_tab_label_cb(GtkWidget *widget, GdkEventButton *event, gpointe
|
||||
on_menu_toggle_all_additional_widgets1_activate(NULL, NULL);
|
||||
/* close tab on middle click */
|
||||
if (event->button == 2)
|
||||
document_remove(gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook), GTK_WIDGET(user_data)));
|
||||
document_remove(gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook), GTK_WIDGET(user_data)));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -376,10 +376,10 @@ gint notebook_new_tab(gint doc_idx)
|
||||
gtk_misc_set_alignment(GTK_MISC(this->tabmenu_label), 0.0, 0);
|
||||
|
||||
if (file_prefs.tab_order_ltr)
|
||||
tabnum = gtk_notebook_append_page_menu(GTK_NOTEBOOK(app->notebook), page,
|
||||
tabnum = gtk_notebook_append_page_menu(GTK_NOTEBOOK(main_widgets.notebook), page,
|
||||
hbox, this->tabmenu_label);
|
||||
else
|
||||
tabnum = gtk_notebook_insert_page_menu(GTK_NOTEBOOK(app->notebook), page,
|
||||
tabnum = gtk_notebook_insert_page_menu(GTK_NOTEBOOK(main_widgets.notebook), page,
|
||||
hbox, this->tabmenu_label, 0);
|
||||
|
||||
tab_count_changed();
|
||||
@ -388,7 +388,7 @@ gint notebook_new_tab(gint doc_idx)
|
||||
#if GTK_CHECK_VERSION(2, 10, 0)
|
||||
if (gtk_check_version(2, 10, 0) == NULL) /* null means version ok */
|
||||
{
|
||||
gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(app->notebook), page, TRUE);
|
||||
gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(main_widgets.notebook), page, TRUE);
|
||||
}
|
||||
#endif
|
||||
g_free(title);
|
||||
@ -399,7 +399,7 @@ gint notebook_new_tab(gint doc_idx)
|
||||
static void
|
||||
notebook_tab_close_clicked_cb(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
gint cur_page = gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook),
|
||||
gint cur_page = gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
GTK_WIDGET(user_data));
|
||||
document_remove(cur_page);
|
||||
}
|
||||
@ -408,16 +408,16 @@ notebook_tab_close_clicked_cb(GtkButton *button, gpointer user_data)
|
||||
/* Always use this instead of gtk_notebook_remove_page(). */
|
||||
void notebook_remove_page(gint page_num)
|
||||
{
|
||||
gint curpage = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->notebook));
|
||||
gint curpage = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
|
||||
/* Focus the next page, not the previous */
|
||||
if (curpage == page_num && file_prefs.tab_order_ltr)
|
||||
{
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), curpage + 1);
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), curpage + 1);
|
||||
}
|
||||
|
||||
/* now remove the page (so we don't temporarily switch to the previous page) */
|
||||
gtk_notebook_remove_page(GTK_NOTEBOOK(app->notebook), page_num);
|
||||
gtk_notebook_remove_page(GTK_NOTEBOOK(main_widgets.notebook), page_num);
|
||||
|
||||
tab_count_changed();
|
||||
}
|
||||
|
@ -35,12 +35,12 @@
|
||||
|
||||
/* The API version should be incremented whenever any plugin data types below are
|
||||
* modified or appended to. */
|
||||
static const gint api_version = 60;
|
||||
static const gint api_version = 61;
|
||||
|
||||
/* The ABI version should be incremented whenever existing fields in the plugin
|
||||
* data types below have to be changed or reordered. It should stay the same if fields
|
||||
* are only appended, as this doesn't affect existing fields. */
|
||||
static const gint abi_version = 30;
|
||||
static const gint abi_version = 31;
|
||||
|
||||
/** Check the plugin can be loaded by Geany.
|
||||
* This performs runtime checks that try to ensure:
|
||||
@ -153,8 +153,8 @@ PluginFields;
|
||||
* Core variable pointers can be appended when needed by plugin authors, if appropriate. */
|
||||
typedef struct GeanyData
|
||||
{
|
||||
GeanyApp *app; /**< Geany application data fields */
|
||||
GtkWidget *tools_menu; /**< Most plugins should add menu items to the Tools menu only */
|
||||
struct GeanyApp *app; /**< Geany application data fields */
|
||||
struct GeanyMainWidgets *main_widgets; /**< Important widgets in the main window. */
|
||||
GArray *doc_array; /**< Dynamic array of document structs */
|
||||
GPtrArray *filetypes_array; /**< Dynamic array of filetype pointers */
|
||||
struct GeanyPrefs *prefs; /**< General settings */
|
||||
|
@ -88,7 +88,7 @@ static GList *active_plugin_list = NULL; /* list of only actually loaded plugins
|
||||
static gchar **active_plugins_pref = NULL; /* list of plugin filenames to load at startup */
|
||||
static GList *failed_plugins_list = NULL; /* plugins the user wants active but can't be used */
|
||||
|
||||
static GtkWidget *separator = NULL;
|
||||
static GtkWidget *menu_separator = NULL;
|
||||
|
||||
static void pm_show_dialog(GtkMenuItem *menuitem, gpointer user_data);
|
||||
|
||||
@ -271,7 +271,7 @@ geany_data_init(void)
|
||||
{
|
||||
GeanyData gd = {
|
||||
app,
|
||||
lookup_widget(app->window, "tools1_menu"),
|
||||
&main_widgets,
|
||||
doc_array,
|
||||
filetypes_array,
|
||||
&prefs,
|
||||
@ -435,7 +435,7 @@ plugin_init(Plugin *plugin)
|
||||
|
||||
if (plugin->fields.flags & PLUGIN_IS_DOCUMENT_SENSITIVE)
|
||||
{
|
||||
gboolean enable = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) ? TRUE : FALSE;
|
||||
gboolean enable = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) ? TRUE : FALSE;
|
||||
gtk_widget_set_sensitive(plugin->fields.menu_item, enable);
|
||||
}
|
||||
|
||||
@ -705,15 +705,15 @@ void plugins_init()
|
||||
|
||||
widget = gtk_separator_menu_item_new();
|
||||
gtk_widget_show(widget);
|
||||
gtk_container_add(GTK_CONTAINER(geany_data.tools_menu), widget);
|
||||
gtk_container_add(GTK_CONTAINER(main_widgets.tools_menu), widget);
|
||||
|
||||
widget = gtk_menu_item_new_with_mnemonic(_("_Plugin Manager"));
|
||||
gtk_container_add(GTK_CONTAINER (geany_data.tools_menu), widget);
|
||||
gtk_container_add(GTK_CONTAINER(main_widgets.tools_menu), widget);
|
||||
gtk_widget_show(widget);
|
||||
g_signal_connect((gpointer) widget, "activate", G_CALLBACK(pm_show_dialog), NULL);
|
||||
|
||||
separator = gtk_separator_menu_item_new();
|
||||
gtk_container_add(GTK_CONTAINER(geany_data.tools_menu), separator);
|
||||
menu_separator = gtk_separator_menu_item_new();
|
||||
gtk_container_add(GTK_CONTAINER(main_widgets.tools_menu), menu_separator);
|
||||
|
||||
load_active_plugins();
|
||||
|
||||
@ -826,11 +826,11 @@ void plugins_update_tools_menu()
|
||||
{
|
||||
gboolean found;
|
||||
|
||||
if (separator == NULL)
|
||||
if (menu_separator == NULL)
|
||||
return;
|
||||
|
||||
found = (g_list_find_custom(active_plugin_list, NULL, (GCompareFunc) plugin_has_menu) != NULL);
|
||||
ui_widget_show_hide(separator, found);
|
||||
ui_widget_show_hide(menu_separator, found);
|
||||
}
|
||||
|
||||
|
||||
@ -1029,7 +1029,7 @@ static void pm_show_dialog(GtkMenuItem *menuitem, gpointer user_data)
|
||||
/* before showing the dialog, we need to create the list of available plugins */
|
||||
load_all_plugins();
|
||||
|
||||
pm_widgets.dialog = gtk_dialog_new_with_buttons(_("Plugins"), GTK_WINDOW(app->window),
|
||||
pm_widgets.dialog = gtk_dialog_new_with_buttons(_("Plugins"), GTK_WINDOW(main_widgets.window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_CANCEL, NULL);
|
||||
vbox = ui_dialog_vbox_new(GTK_DIALOG(pm_widgets.dialog));
|
||||
|
14
src/prefs.c
14
src/prefs.c
@ -965,13 +965,13 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
|
||||
treeviews_openfiles_update_all(); /* to update if full path setting has changed */
|
||||
ui_update_toolbar_items();
|
||||
ui_update_toolbar_icons(toolbar_prefs.icon_size);
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), toolbar_prefs.icon_style);
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(main_widgets.toolbar), toolbar_prefs.icon_style);
|
||||
ui_sidebar_show_hide();
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), interface_prefs.show_notebook_tabs);
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs);
|
||||
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->notebook), interface_prefs.tab_pos_editor);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.tab_pos_editor);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), interface_prefs.tab_pos_msgwin);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->treeview_notebook), interface_prefs.tab_pos_sidebar);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.sidebar_notebook), interface_prefs.tab_pos_sidebar);
|
||||
|
||||
/* re-colourise all open documents, if tab width or long line settings have changed */
|
||||
for (i = 0; i < doc_array->len; i++)
|
||||
@ -1049,7 +1049,7 @@ void on_prefs_font_choosed(GtkFontButton *widget, gpointer user_data)
|
||||
}
|
||||
if (GTK_IS_WIDGET(tv.default_tag_tree))
|
||||
ui_widget_modify_font_from_string(tv.default_tag_tree, interface_prefs.tagbar_font);
|
||||
ui_widget_modify_font_from_string(lookup_widget(app->window, "entry1"),
|
||||
ui_widget_modify_font_from_string(lookup_widget(main_widgets.window, "entry1"),
|
||||
interface_prefs.tagbar_font);
|
||||
break;
|
||||
}
|
||||
@ -1310,7 +1310,7 @@ static gboolean find_duplicate(KeyBinding *search_kb,
|
||||
if (kb->key == key && kb->mods == mods
|
||||
&& ! (kb->key == search_kb->key && kb->mods == search_kb->mods))
|
||||
{
|
||||
if (dialogs_show_question_full(app->window, _("_Override"), GTK_STOCK_CANCEL,
|
||||
if (dialogs_show_question_full(main_widgets.window, _("_Override"), GTK_STOCK_CANCEL,
|
||||
_("Override that keybinding?"),
|
||||
_("The combination '%s' is already used for \"%s\"."),
|
||||
action, kb->label))
|
||||
@ -1401,7 +1401,7 @@ void prefs_show_dialog(void)
|
||||
|
||||
ui_widgets.prefs_dialog = create_prefs_dialog();
|
||||
gtk_widget_set_name(ui_widgets.prefs_dialog, "GeanyPrefsDialog");
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.prefs_dialog), GTK_WINDOW(app->window));
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.prefs_dialog), GTK_WINDOW(main_widgets.window));
|
||||
|
||||
/* init the default file encoding combo box */
|
||||
combo_new = lookup_widget(ui_widgets.prefs_dialog, "combo_new_encoding");
|
||||
|
@ -777,7 +777,7 @@ static void printing_print_gtk(gint idx)
|
||||
gtk_print_operation_set_default_page_setup(op, page_setup);
|
||||
|
||||
res = gtk_print_operation_run(
|
||||
op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW(app->window), &error);
|
||||
op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW(main_widgets.window), &error);
|
||||
|
||||
if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
|
||||
{
|
||||
@ -807,7 +807,7 @@ void printing_page_setup_gtk(void)
|
||||
settings = gtk_print_settings_new();
|
||||
|
||||
new_page_setup = gtk_print_run_page_setup_dialog(
|
||||
GTK_WINDOW(app->window), page_setup, settings);
|
||||
GTK_WINDOW(main_widgets.window), page_setup, settings);
|
||||
|
||||
if (page_setup != NULL)
|
||||
g_object_unref(page_setup);
|
||||
|
@ -97,7 +97,7 @@ void project_new()
|
||||
GtkWidget *button;
|
||||
GtkWidget *bbox;
|
||||
GtkWidget *label;
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
|
||||
PropertyDialogElements *e;
|
||||
gint response;
|
||||
|
||||
@ -106,7 +106,7 @@ void project_new()
|
||||
g_return_if_fail(app->project == NULL);
|
||||
|
||||
e = g_new0(PropertyDialogElements, 1);
|
||||
e->dialog = gtk_dialog_new_with_buttons(_("New Project"), GTK_WINDOW(app->window),
|
||||
e->dialog = gtk_dialog_new_with_buttons(_("New Project"), GTK_WINDOW(main_widgets.window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
|
||||
|
||||
@ -236,7 +236,7 @@ void project_open()
|
||||
if (! close_open_project()) return;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
file = win32_show_project_open_dialog(app->window, _("Open Project"), dir, FALSE, TRUE);
|
||||
file = win32_show_project_open_dialog(main_widgets.window, _("Open Project"), dir, FALSE, TRUE);
|
||||
if (file != NULL)
|
||||
{
|
||||
/* try to load the config */
|
||||
@ -254,7 +254,7 @@ void project_open()
|
||||
}
|
||||
#else
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new(_("Open Project"), GTK_WINDOW(app->window),
|
||||
dialog = gtk_file_chooser_dialog_new(_("Open Project"), GTK_WINDOW(main_widgets.window),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
|
||||
@ -265,7 +265,7 @@ void project_open()
|
||||
gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
|
||||
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), TRUE);
|
||||
gtk_window_set_type_hint(GTK_WINDOW(dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(app->window));
|
||||
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(main_widgets.window));
|
||||
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE);
|
||||
|
||||
/* add FileFilters */
|
||||
@ -353,9 +353,9 @@ static void create_properties_dialog(PropertyDialogElements *e)
|
||||
GtkWidget *bbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *swin;
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
|
||||
|
||||
e->dialog = gtk_dialog_new_with_buttons(_("Project Properties"), GTK_WINDOW(app->window),
|
||||
e->dialog = gtk_dialog_new_with_buttons(_("Project Properties"), GTK_WINDOW(main_widgets.window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(e->dialog), GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
|
||||
|
@ -710,9 +710,9 @@ void sci_set_font(ScintillaObject *sci, gint style, const gchar* font, gint size
|
||||
}
|
||||
|
||||
|
||||
void sci_goto_line(ScintillaObject *sci, gint line, gboolean ensure_visibility)
|
||||
void sci_goto_line(ScintillaObject *sci, gint line, gboolean unfold)
|
||||
{
|
||||
if (ensure_visibility) SSM(sci,SCI_ENSUREVISIBLE,line,0);
|
||||
if (unfold) SSM(sci, SCI_ENSUREVISIBLE, line, 0);
|
||||
SSM(sci, SCI_GOTOLINE, line, 0);
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ gint sci_search_next (ScintillaObject * sci, gint flags, const gchar *text
|
||||
gint sci_search_prev (ScintillaObject * sci, gint flags, const gchar *text);
|
||||
gint sci_find_text (ScintillaObject * sci, gint flags, struct TextToFind *ttf);
|
||||
void sci_set_font (ScintillaObject * sci, gint style, const gchar* font, gint size);
|
||||
void sci_goto_line (ScintillaObject * sci, gint line, gboolean ensure_visibility);
|
||||
void sci_goto_line (ScintillaObject * sci, gint line, gboolean unfold);
|
||||
void sci_marker_delete_all (ScintillaObject * sci, gint marker);
|
||||
gint sci_get_style_at (ScintillaObject * sci, gint position);
|
||||
void sci_set_symbol_margin (ScintillaObject * sci, gboolean set);
|
||||
|
16
src/search.c
16
src/search.c
@ -134,7 +134,7 @@ static GtkWidget *add_find_checkboxes(GtkDialog *dialog)
|
||||
{
|
||||
GtkWidget *checkbox1, *checkbox2, *check_regexp, *check_back, *checkbox5,
|
||||
*checkbox7, *hbox, *fbox, *mbox;
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
|
||||
|
||||
check_regexp = gtk_check_button_new_with_mnemonic(_("_Use regular expressions"));
|
||||
g_object_set_data_full(G_OBJECT(dialog), "check_regexp",
|
||||
@ -297,12 +297,12 @@ void search_show_find_dialog(void)
|
||||
{
|
||||
GtkWidget *label, *entry, *sbox, *vbox;
|
||||
GtkWidget *exp, *bbox, *button, *check_close;
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
|
||||
|
||||
load_monospace_style();
|
||||
|
||||
widgets.find_dialog = gtk_dialog_new_with_buttons(_("Find"),
|
||||
GTK_WINDOW(app->window), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_WINDOW(main_widgets.window), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL, NULL);
|
||||
vbox = ui_dialog_vbox_new(GTK_DIALOG(widgets.find_dialog));
|
||||
gtk_widget_set_name(widgets.find_dialog, "GeanyDialogSearch");
|
||||
@ -419,12 +419,12 @@ void search_show_replace_dialog(void)
|
||||
GtkWidget *label_find, *label_replace, *entry_find, *entry_replace,
|
||||
*check_close, *button, *rbox, *fbox, *vbox, *exp, *bbox;
|
||||
GtkSizeGroup *label_size;
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
|
||||
|
||||
load_monospace_style();
|
||||
|
||||
widgets.replace_dialog = gtk_dialog_new_with_buttons(_("Replace"),
|
||||
GTK_WINDOW(app->window), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_WINDOW(main_widgets.window), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL, NULL);
|
||||
vbox = ui_dialog_vbox_new(GTK_DIALOG(widgets.replace_dialog));
|
||||
gtk_box_set_spacing(GTK_BOX(vbox), 9);
|
||||
@ -569,12 +569,12 @@ void search_show_find_in_files_dialog(const gchar *dir)
|
||||
*check_recursive, *check_extra, *entry_extra;
|
||||
GtkWidget *dbox, *sbox, *cbox, *rbox, *rbtn, *hbox, *vbox;
|
||||
GtkSizeGroup *size_group;
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
|
||||
|
||||
load_monospace_style();
|
||||
|
||||
widgets.find_in_files_dialog = gtk_dialog_new_with_buttons(
|
||||
_("Find in Files"), GTK_WINDOW(app->window), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
_("Find in Files"), GTK_WINDOW(main_widgets.window), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
|
||||
vbox = ui_dialog_vbox_new(GTK_DIALOG(widgets.find_in_files_dialog));
|
||||
gtk_box_set_spacing(GTK_BOX(vbox), 9);
|
||||
@ -1007,7 +1007,7 @@ on_replace_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
|
||||
guint n, count = 0;
|
||||
|
||||
/* replace in all documents following notebook tab order */
|
||||
for (n = 0; (gint) n < gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)); n++)
|
||||
for (n = 0; (gint) n < gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)); n++)
|
||||
{
|
||||
gint ix = document_get_n_idx(n);
|
||||
|
||||
|
@ -514,10 +514,10 @@ gboolean socket_lock_input_cb(GIOChannel *source, GIOCondition condition, gpoint
|
||||
/* we need to bring the main window up with gtk_window_present() but this is not
|
||||
* enough, instead we need to iconify it so that gtk_window_deiconify() will
|
||||
* bring it in the foreground */
|
||||
gtk_window_present(GTK_WINDOW(app->window));
|
||||
gtk_window_iconify(GTK_WINDOW(app->window));
|
||||
gtk_window_present(GTK_WINDOW(main_widgets.window));
|
||||
gtk_window_iconify(GTK_WINDOW(main_widgets.window));
|
||||
#endif
|
||||
gtk_window_deiconify(GTK_WINDOW(app->window));
|
||||
gtk_window_deiconify(GTK_WINDOW(main_widgets.window));
|
||||
}
|
||||
else if (strncmp(buf, "line", 4) == 0)
|
||||
{
|
||||
|
@ -1048,7 +1048,7 @@ void symbols_show_load_tags_dialog(void)
|
||||
GtkWidget *dialog;
|
||||
GtkFileFilter *filter;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new(_("Load Tags"), GTK_WINDOW(app->window),
|
||||
dialog = gtk_file_chooser_dialog_new(_("Load Tags"), GTK_WINDOW(main_widgets.window),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
|
||||
|
@ -475,7 +475,7 @@ static void create_file_template_menus(void)
|
||||
{
|
||||
GtkWidget *sep1, *sep2;
|
||||
|
||||
new_with_template_menu = lookup_widget(app->window, "menu_new_with_template1_menu");
|
||||
new_with_template_menu = lookup_widget(main_widgets.window, "menu_new_with_template1_menu");
|
||||
create_new_menu_items();
|
||||
|
||||
sep1 = gtk_separator_menu_item_new();
|
||||
|
14
src/tools.c
14
src/tools.c
@ -300,7 +300,7 @@ static void cc_show_dialog_custom_commands(void)
|
||||
guint i;
|
||||
struct cc_dialog cc;
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons(_("Set Custom Commands"), GTK_WINDOW(app->window),
|
||||
dialog = gtk_dialog_new_with_buttons(_("Set Custom Commands"), GTK_WINDOW(main_widgets.window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
|
||||
vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
|
||||
@ -480,8 +480,8 @@ static void cc_insert_custom_command_items(GtkMenu *me, GtkMenu *mp, gchar *labe
|
||||
|
||||
void tools_create_insert_custom_command_menu_items(void)
|
||||
{
|
||||
GtkMenu *menu_edit = GTK_MENU(lookup_widget(app->window, "send_selection_to2_menu"));
|
||||
GtkMenu *menu_popup = GTK_MENU(lookup_widget(app->popup_menu, "send_selection_to1_menu"));
|
||||
GtkMenu *menu_edit = GTK_MENU(lookup_widget(main_widgets.window, "send_selection_to2_menu"));
|
||||
GtkMenu *menu_popup = GTK_MENU(lookup_widget(main_widgets.editor_menu, "send_selection_to1_menu"));
|
||||
GtkWidget *item;
|
||||
GList *me_children;
|
||||
GList *mp_children;
|
||||
@ -537,9 +537,9 @@ void tools_create_insert_custom_command_menu_items(void)
|
||||
|
||||
if (! signal_set)
|
||||
{
|
||||
g_signal_connect((gpointer) lookup_widget(app->popup_menu, "send_selection_to1"),
|
||||
g_signal_connect((gpointer) lookup_widget(main_widgets.editor_menu, "send_selection_to1"),
|
||||
"activate", G_CALLBACK(cc_on_custom_command_menu_activate), menu_popup);
|
||||
g_signal_connect((gpointer) lookup_widget(app->window, "send_selection_to2"),
|
||||
g_signal_connect((gpointer) lookup_widget(main_widgets.window, "send_selection_to2"),
|
||||
"activate", G_CALLBACK(cc_on_custom_command_menu_activate), menu_edit);
|
||||
signal_set = TRUE;
|
||||
}
|
||||
@ -607,7 +607,7 @@ void tools_word_count(void)
|
||||
idx = document_get_cur_idx();
|
||||
if (idx == -1 || ! doc_list[idx].is_valid) return;
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons(_("Word Count"), GTK_WINDOW(app->window),
|
||||
dialog = gtk_dialog_new_with_buttons(_("Word Count"), GTK_WINDOW(main_widgets.window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL, NULL);
|
||||
vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
|
||||
@ -739,7 +739,7 @@ void tools_color_chooser(gchar *color)
|
||||
{
|
||||
ui_widgets.open_colorsel = gtk_color_selection_dialog_new(_("Color Chooser"));
|
||||
gtk_widget_set_name(ui_widgets.open_colorsel, "GeanyDialog");
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.open_colorsel), GTK_WINDOW(app->window));
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.open_colorsel), GTK_WINDOW(main_widgets.window));
|
||||
gtk_color_selection_set_has_palette(
|
||||
GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(ui_widgets.open_colorsel)->colorsel), TRUE);
|
||||
|
||||
|
@ -244,7 +244,7 @@ static void prepare_openfiles(void)
|
||||
PangoFontDescription *pfd;
|
||||
GtkTreeSortable *sortable;
|
||||
|
||||
tv.tree_openfiles = lookup_widget(app->window, "treeview6");
|
||||
tv.tree_openfiles = lookup_widget(main_widgets.window, "treeview6");
|
||||
|
||||
/* store the short filename to show, and the index as reference,
|
||||
* the colour (black/red/green) and the full name for the tooltip */
|
||||
@ -258,7 +258,7 @@ static void prepare_openfiles(void)
|
||||
/* set policy settings for the scolledwindow around the treeview again, because glade
|
||||
* doesn't keep the settings */
|
||||
gtk_scrolled_window_set_policy(
|
||||
GTK_SCROLLED_WINDOW(lookup_widget(app->window, "scrolledwindow7")),
|
||||
GTK_SCROLLED_WINDOW(lookup_widget(main_widgets.window, "scrolledwindow7")),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
@ -331,7 +331,7 @@ void treeviews_openfiles_update_all()
|
||||
gint idx;
|
||||
|
||||
gtk_list_store_clear(store_openfiles);
|
||||
for (i = 0; i < (guint) gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)); i++)
|
||||
for (i = 0; i < (guint) gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)); i++)
|
||||
{
|
||||
idx = document_get_n_idx(i);
|
||||
if (! doc_list[idx].is_valid) continue;
|
||||
@ -537,7 +537,7 @@ static void on_openfiles_document_action(GtkMenuItem *menuitem, gpointer user_da
|
||||
{
|
||||
case OPENFILES_ACTION_REMOVE:
|
||||
{
|
||||
document_remove(gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook), GTK_WIDGET(doc_list[idx].sci)));
|
||||
document_remove(gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook), GTK_WIDGET(doc_list[idx].sci)));
|
||||
break;
|
||||
}
|
||||
case OPENFILES_ACTION_SAVE:
|
||||
@ -570,7 +570,7 @@ static gboolean change_focus(gpointer data)
|
||||
/* idx might not be valid e.g. if user closed a tab whilst Geany is opening files */
|
||||
if (DOC_IDX_VALID(idx))
|
||||
{
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
||||
GtkWidget *sci = GTK_WIDGET(doc_list[idx].sci);
|
||||
|
||||
if (focusw == tv.tree_openfiles)
|
||||
@ -587,11 +587,11 @@ static void on_openfiles_tree_selection_changed(GtkTreeSelection *selection, gpo
|
||||
gint idx = 0;
|
||||
|
||||
/* use switch_notebook_page to ignore changing the notebook page because it is already done */
|
||||
if (gtk_tree_selection_get_selected(selection, &model, &iter) && ! app->ignore_callback)
|
||||
if (gtk_tree_selection_get_selected(selection, &model, &iter) && ! ignore_callback)
|
||||
{
|
||||
gtk_tree_model_get(model, &iter, 1, &idx, -1);
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook),
|
||||
gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook),
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
(GtkWidget*) doc_list[idx].sci));
|
||||
g_idle_add((GSourceFunc) change_focus, GINT_TO_POINTER(idx));
|
||||
}
|
||||
@ -733,7 +733,7 @@ static gboolean on_treeviews_button_press_event(GtkWidget *widget, GdkEventButto
|
||||
void treeviews_init()
|
||||
{
|
||||
tv.default_tag_tree = NULL;
|
||||
tag_window = lookup_widget(app->window, "scrolledwindow2");
|
||||
tag_window = lookup_widget(main_widgets.window, "scrolledwindow2");
|
||||
|
||||
prepare_openfiles();
|
||||
create_taglist_popup_menu();
|
||||
|
246
src/ui_utils.c
246
src/ui_utils.c
@ -49,6 +49,8 @@
|
||||
|
||||
GeanyInterfacePrefs interface_prefs;
|
||||
GeanyToolbarPrefs toolbar_prefs;
|
||||
GeanyMainWidgets main_widgets;
|
||||
|
||||
UIPrefs ui_prefs;
|
||||
UIWidgets ui_widgets;
|
||||
|
||||
@ -82,15 +84,15 @@ static void set_statusbar(const gchar *text, gboolean allow_override)
|
||||
|
||||
if (! allow_override)
|
||||
{
|
||||
gtk_statusbar_pop(GTK_STATUSBAR(app->statusbar), 1);
|
||||
gtk_statusbar_push(GTK_STATUSBAR(app->statusbar), 1, text);
|
||||
gtk_statusbar_pop(GTK_STATUSBAR(ui_widgets.statusbar), 1);
|
||||
gtk_statusbar_push(GTK_STATUSBAR(ui_widgets.statusbar), 1, text);
|
||||
last_time = timeval.tv_sec;
|
||||
}
|
||||
else
|
||||
if (timeval.tv_sec > last_time + GEANY_STATUS_TIMEOUT)
|
||||
{
|
||||
gtk_statusbar_pop(GTK_STATUSBAR(app->statusbar), 1);
|
||||
gtk_statusbar_push(GTK_STATUSBAR(app->statusbar), 1, text);
|
||||
gtk_statusbar_pop(GTK_STATUSBAR(ui_widgets.statusbar), 1);
|
||||
gtk_statusbar_push(GTK_STATUSBAR(ui_widgets.statusbar), 1, text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,7 +234,7 @@ void ui_set_window_title(gint idx)
|
||||
g_string_append(str, "] - ");
|
||||
}
|
||||
g_string_append(str, "Geany");
|
||||
gtk_window_set_title(GTK_WINDOW(app->window), str->str);
|
||||
gtk_window_set_title(GTK_WINDOW(main_widgets.window), str->str);
|
||||
g_string_free(str, TRUE);
|
||||
}
|
||||
|
||||
@ -276,11 +278,11 @@ void ui_set_fullscreen(void)
|
||||
{
|
||||
if (ui_prefs.fullscreen)
|
||||
{
|
||||
gtk_window_fullscreen(GTK_WINDOW(app->window));
|
||||
gtk_window_fullscreen(GTK_WINDOW(main_widgets.window));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_window_unfullscreen(GTK_WINDOW(app->window));
|
||||
gtk_window_unfullscreen(GTK_WINDOW(main_widgets.window));
|
||||
}
|
||||
}
|
||||
|
||||
@ -337,7 +339,7 @@ void ui_update_menu_copy_items(gint idx)
|
||||
{
|
||||
gboolean enable = FALSE;
|
||||
guint i;
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
|
||||
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
||||
|
||||
if (IS_SCINTILLA(focusw))
|
||||
enable = (idx == -1) ? FALSE : sci_can_copy(doc_list[idx].sci);
|
||||
@ -373,9 +375,9 @@ void ui_update_insert_include_item(gint idx, gint item)
|
||||
|
||||
void ui_update_fold_items(void)
|
||||
{
|
||||
ui_widget_show_hide(lookup_widget(app->window, "menu_fold_all1"), editor_prefs.folding);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "menu_unfold_all1"), editor_prefs.folding);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separator22"), editor_prefs.folding);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "menu_fold_all1"), editor_prefs.folding);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "menu_unfold_all1"), editor_prefs.folding);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "separator22"), editor_prefs.folding);
|
||||
}
|
||||
|
||||
|
||||
@ -415,8 +417,8 @@ static void insert_include_items(GtkMenu *me, GtkMenu *mp, gchar **includes, gch
|
||||
|
||||
void ui_create_insert_menu_items(void)
|
||||
{
|
||||
GtkMenu *menu_edit = GTK_MENU(lookup_widget(app->window, "insert_include2_menu"));
|
||||
GtkMenu *menu_popup = GTK_MENU(lookup_widget(app->popup_menu, "insert_include1_menu"));
|
||||
GtkMenu *menu_edit = GTK_MENU(lookup_widget(main_widgets.window, "insert_include2_menu"));
|
||||
GtkMenu *menu_popup = GTK_MENU(lookup_widget(main_widgets.editor_menu, "insert_include1_menu"));
|
||||
GtkWidget *blank;
|
||||
const gchar *c_includes_stdlib[] = {
|
||||
"assert.h", "ctype.h", "errno.h", "float.h", "limits.h", "locale.h", "math.h", "setjmp.h",
|
||||
@ -482,8 +484,8 @@ static void insert_date_items(GtkMenu *me, GtkMenu *mp, gchar *label)
|
||||
|
||||
void ui_create_insert_date_menu_items(void)
|
||||
{
|
||||
GtkMenu *menu_edit = GTK_MENU(lookup_widget(app->window, "insert_date1_menu"));
|
||||
GtkMenu *menu_popup = GTK_MENU(lookup_widget(app->popup_menu, "insert_date2_menu"));
|
||||
GtkMenu *menu_edit = GTK_MENU(lookup_widget(main_widgets.window, "insert_date1_menu"));
|
||||
GtkMenu *menu_popup = GTK_MENU(lookup_widget(main_widgets.editor_menu, "insert_date2_menu"));
|
||||
GtkWidget *item;
|
||||
gchar *str;
|
||||
|
||||
@ -515,7 +517,7 @@ void ui_create_insert_date_menu_items(void)
|
||||
gtk_widget_show(item);
|
||||
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_menu_insert_date_activate),
|
||||
str);
|
||||
g_object_set_data_full(G_OBJECT(app->window), "insert_date_custom1", gtk_widget_ref(item),
|
||||
g_object_set_data_full(G_OBJECT(main_widgets.window), "insert_date_custom1", gtk_widget_ref(item),
|
||||
(GDestroyNotify)gtk_widget_unref);
|
||||
|
||||
item = gtk_menu_item_new_with_mnemonic(str);
|
||||
@ -523,7 +525,7 @@ void ui_create_insert_date_menu_items(void)
|
||||
gtk_widget_show(item);
|
||||
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_insert_date_activate),
|
||||
str);
|
||||
g_object_set_data_full(G_OBJECT(app->popup_menu), "insert_date_custom2", gtk_widget_ref(item),
|
||||
g_object_set_data_full(G_OBJECT(main_widgets.editor_menu), "insert_date_custom2", gtk_widget_ref(item),
|
||||
(GDestroyNotify)gtk_widget_unref);
|
||||
|
||||
insert_date_items(menu_edit, menu_popup, _("_Set Custom Date Format"));
|
||||
@ -559,58 +561,58 @@ static void init_document_widgets(void)
|
||||
{
|
||||
/* Cache the document-sensitive widgets so we don't have to keep looking them up
|
||||
* when using ui_document_buttons_update(). */
|
||||
widgets.document_buttons[0] = lookup_widget(app->window, "menu_close1");
|
||||
widgets.document_buttons[1] = lookup_widget(app->window, "toolbutton15");
|
||||
widgets.document_buttons[2] = lookup_widget(app->window, "menu_change_font1");
|
||||
widgets.document_buttons[3] = lookup_widget(app->window, "entry1");
|
||||
widgets.document_buttons[4] = lookup_widget(app->window, "toolbutton18");
|
||||
widgets.document_buttons[5] = lookup_widget(app->window, "toolbutton20");
|
||||
widgets.document_buttons[6] = lookup_widget(app->window, "toolbutton21");
|
||||
widgets.document_buttons[7] = lookup_widget(app->window, "menu_close_all1");
|
||||
widgets.document_buttons[8] = lookup_widget(app->window, "menu_save_all1");
|
||||
widgets.document_buttons[9] = lookup_widget(app->window, "toolbutton22");
|
||||
widgets.document_buttons[10] = lookup_widget(app->window, "toolbutton13"); /* compile_button */
|
||||
widgets.document_buttons[11] = lookup_widget(app->window, "menu_save_as1");
|
||||
widgets.document_buttons[12] = lookup_widget(app->window, "toolbutton23");
|
||||
widgets.document_buttons[13] = lookup_widget(app->window, "menu_count_words1");
|
||||
widgets.document_buttons[14] = lookup_widget(app->window, "menu_build1");
|
||||
widgets.document_buttons[15] = lookup_widget(app->window, "add_comments1");
|
||||
widgets.document_buttons[16] = lookup_widget(app->window, "menu_paste1");
|
||||
widgets.document_buttons[17] = lookup_widget(app->window, "menu_undo2");
|
||||
widgets.document_buttons[18] = lookup_widget(app->window, "preferences2");
|
||||
widgets.document_buttons[19] = lookup_widget(app->window, "menu_reload1");
|
||||
widgets.document_buttons[20] = lookup_widget(app->window, "menu_document1");
|
||||
widgets.document_buttons[21] = lookup_widget(app->window, "menu_markers_margin1");
|
||||
widgets.document_buttons[22] = lookup_widget(app->window, "menu_linenumber_margin1");
|
||||
widgets.document_buttons[23] = lookup_widget(app->window, "menu_choose_color1");
|
||||
widgets.document_buttons[24] = lookup_widget(app->window, "menu_zoom_in1");
|
||||
widgets.document_buttons[25] = lookup_widget(app->window, "menu_zoom_out1");
|
||||
widgets.document_buttons[26] = lookup_widget(app->window, "normal_size1");
|
||||
widgets.document_buttons[27] = lookup_widget(app->window, "toolbutton24");
|
||||
widgets.document_buttons[28] = lookup_widget(app->window, "toolbutton25");
|
||||
widgets.document_buttons[29] = lookup_widget(app->window, "entry_goto_line");
|
||||
widgets.document_buttons[30] = lookup_widget(app->window, "treeview6");
|
||||
widgets.document_buttons[31] = lookup_widget(app->window, "print1");
|
||||
widgets.document_buttons[32] = lookup_widget(app->window, "menu_reload_as1");
|
||||
widgets.document_buttons[33] = lookup_widget(app->window, "menu_select_all1");
|
||||
widgets.document_buttons[34] = lookup_widget(app->window, "insert_date1");
|
||||
widgets.document_buttons[35] = lookup_widget(app->window, "menu_format1");
|
||||
widgets.document_buttons[36] = lookup_widget(app->window, "menu_open_selected_file1");
|
||||
widgets.document_buttons[37] = lookup_widget(app->window, "page_setup1");
|
||||
widgets.document_buttons[38] = lookup_widget(app->window, "find1");
|
||||
widgets.document_buttons[39] = lookup_widget(app->window, "find_next1");
|
||||
widgets.document_buttons[40] = lookup_widget(app->window, "find_previous1");
|
||||
widgets.document_buttons[41] = lookup_widget(app->window, "replace1");
|
||||
widgets.document_buttons[42] = lookup_widget(app->window, "find_nextsel1");
|
||||
widgets.document_buttons[43] = lookup_widget(app->window, "find_prevsel1");
|
||||
widgets.document_buttons[44] = lookup_widget(app->window, "go_to_line1");
|
||||
widgets.document_buttons[0] = lookup_widget(main_widgets.window, "menu_close1");
|
||||
widgets.document_buttons[1] = lookup_widget(main_widgets.window, "toolbutton15");
|
||||
widgets.document_buttons[2] = lookup_widget(main_widgets.window, "menu_change_font1");
|
||||
widgets.document_buttons[3] = lookup_widget(main_widgets.window, "entry1");
|
||||
widgets.document_buttons[4] = lookup_widget(main_widgets.window, "toolbutton18");
|
||||
widgets.document_buttons[5] = lookup_widget(main_widgets.window, "toolbutton20");
|
||||
widgets.document_buttons[6] = lookup_widget(main_widgets.window, "toolbutton21");
|
||||
widgets.document_buttons[7] = lookup_widget(main_widgets.window, "menu_close_all1");
|
||||
widgets.document_buttons[8] = lookup_widget(main_widgets.window, "menu_save_all1");
|
||||
widgets.document_buttons[9] = lookup_widget(main_widgets.window, "toolbutton22");
|
||||
widgets.document_buttons[10] = lookup_widget(main_widgets.window, "toolbutton13"); /* compile_button */
|
||||
widgets.document_buttons[11] = lookup_widget(main_widgets.window, "menu_save_as1");
|
||||
widgets.document_buttons[12] = lookup_widget(main_widgets.window, "toolbutton23");
|
||||
widgets.document_buttons[13] = lookup_widget(main_widgets.window, "menu_count_words1");
|
||||
widgets.document_buttons[14] = lookup_widget(main_widgets.window, "menu_build1");
|
||||
widgets.document_buttons[15] = lookup_widget(main_widgets.window, "add_comments1");
|
||||
widgets.document_buttons[16] = lookup_widget(main_widgets.window, "menu_paste1");
|
||||
widgets.document_buttons[17] = lookup_widget(main_widgets.window, "menu_undo2");
|
||||
widgets.document_buttons[18] = lookup_widget(main_widgets.window, "preferences2");
|
||||
widgets.document_buttons[19] = lookup_widget(main_widgets.window, "menu_reload1");
|
||||
widgets.document_buttons[20] = lookup_widget(main_widgets.window, "menu_document1");
|
||||
widgets.document_buttons[21] = lookup_widget(main_widgets.window, "menu_markers_margin1");
|
||||
widgets.document_buttons[22] = lookup_widget(main_widgets.window, "menu_linenumber_margin1");
|
||||
widgets.document_buttons[23] = lookup_widget(main_widgets.window, "menu_choose_color1");
|
||||
widgets.document_buttons[24] = lookup_widget(main_widgets.window, "menu_zoom_in1");
|
||||
widgets.document_buttons[25] = lookup_widget(main_widgets.window, "menu_zoom_out1");
|
||||
widgets.document_buttons[26] = lookup_widget(main_widgets.window, "normal_size1");
|
||||
widgets.document_buttons[27] = lookup_widget(main_widgets.window, "toolbutton24");
|
||||
widgets.document_buttons[28] = lookup_widget(main_widgets.window, "toolbutton25");
|
||||
widgets.document_buttons[29] = lookup_widget(main_widgets.window, "entry_goto_line");
|
||||
widgets.document_buttons[30] = lookup_widget(main_widgets.window, "treeview6");
|
||||
widgets.document_buttons[31] = lookup_widget(main_widgets.window, "print1");
|
||||
widgets.document_buttons[32] = lookup_widget(main_widgets.window, "menu_reload_as1");
|
||||
widgets.document_buttons[33] = lookup_widget(main_widgets.window, "menu_select_all1");
|
||||
widgets.document_buttons[34] = lookup_widget(main_widgets.window, "insert_date1");
|
||||
widgets.document_buttons[35] = lookup_widget(main_widgets.window, "menu_format1");
|
||||
widgets.document_buttons[36] = lookup_widget(main_widgets.window, "menu_open_selected_file1");
|
||||
widgets.document_buttons[37] = lookup_widget(main_widgets.window, "page_setup1");
|
||||
widgets.document_buttons[38] = lookup_widget(main_widgets.window, "find1");
|
||||
widgets.document_buttons[39] = lookup_widget(main_widgets.window, "find_next1");
|
||||
widgets.document_buttons[40] = lookup_widget(main_widgets.window, "find_previous1");
|
||||
widgets.document_buttons[41] = lookup_widget(main_widgets.window, "replace1");
|
||||
widgets.document_buttons[42] = lookup_widget(main_widgets.window, "find_nextsel1");
|
||||
widgets.document_buttons[43] = lookup_widget(main_widgets.window, "find_prevsel1");
|
||||
widgets.document_buttons[44] = lookup_widget(main_widgets.window, "go_to_line1");
|
||||
}
|
||||
|
||||
|
||||
void ui_document_buttons_update(void)
|
||||
{
|
||||
guint i;
|
||||
gboolean enable = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) ? TRUE : FALSE;
|
||||
gboolean enable = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) ? TRUE : FALSE;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS(widgets.document_buttons); i++)
|
||||
gtk_widget_set_sensitive(widgets.document_buttons[i], enable);
|
||||
@ -641,25 +643,25 @@ void ui_sidebar_show_hide(void)
|
||||
/* check that there are no other notebook pages before hiding the sidebar completely
|
||||
* other pages could be e.g. the file browser plugin */
|
||||
if (! interface_prefs.sidebar_openfiles_visible && ! interface_prefs.sidebar_symbol_visible &&
|
||||
gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->treeview_notebook)) <= 2)
|
||||
gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.sidebar_notebook)) <= 2)
|
||||
{
|
||||
ui_prefs.sidebar_visible = FALSE;
|
||||
}
|
||||
|
||||
widget = lookup_widget(app->window, "menu_show_sidebar1");
|
||||
widget = lookup_widget(main_widgets.window, "menu_show_sidebar1");
|
||||
if (ui_prefs.sidebar_visible != gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
|
||||
{
|
||||
app->ignore_callback = TRUE;
|
||||
ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), ui_prefs.sidebar_visible);
|
||||
app->ignore_callback = FALSE;
|
||||
ignore_callback = FALSE;
|
||||
}
|
||||
|
||||
ui_widget_show_hide(app->treeview_notebook, ui_prefs.sidebar_visible);
|
||||
ui_widget_show_hide(main_widgets.sidebar_notebook, ui_prefs.sidebar_visible);
|
||||
|
||||
ui_widget_show_hide(gtk_notebook_get_nth_page(
|
||||
GTK_NOTEBOOK(app->treeview_notebook), 0), interface_prefs.sidebar_symbol_visible);
|
||||
GTK_NOTEBOOK(main_widgets.sidebar_notebook), 0), interface_prefs.sidebar_symbol_visible);
|
||||
ui_widget_show_hide(gtk_notebook_get_nth_page(
|
||||
GTK_NOTEBOOK(app->treeview_notebook), 1), interface_prefs.sidebar_openfiles_visible);
|
||||
GTK_NOTEBOOK(main_widgets.sidebar_notebook), 1), interface_prefs.sidebar_openfiles_visible);
|
||||
}
|
||||
|
||||
|
||||
@ -674,30 +676,30 @@ void ui_document_show_hide(gint idx)
|
||||
if (! DOC_IDX_VALID(idx))
|
||||
return;
|
||||
|
||||
app->ignore_callback = TRUE;
|
||||
ignore_callback = TRUE;
|
||||
|
||||
gtk_check_menu_item_set_active(
|
||||
GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_line_wrapping1")),
|
||||
GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "menu_line_wrapping1")),
|
||||
doc_list[idx].line_wrapping);
|
||||
|
||||
gtk_check_menu_item_set_active(
|
||||
GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "line_breaking1")),
|
||||
GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "line_breaking1")),
|
||||
doc_list[idx].line_breaking);
|
||||
|
||||
item = lookup_widget(app->window, "menu_use_auto_indentation1");
|
||||
item = lookup_widget(main_widgets.window, "menu_use_auto_indentation1");
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
|
||||
doc_list[idx].auto_indent);
|
||||
gtk_widget_set_sensitive(item, editor_prefs.indent_mode != INDENT_NONE);
|
||||
|
||||
item = lookup_widget(app->window,
|
||||
item = lookup_widget(main_widgets.window,
|
||||
doc_list[idx].use_tabs ? "tabs1" : "spaces1");
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
|
||||
|
||||
gtk_check_menu_item_set_active(
|
||||
GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "set_file_readonly1")),
|
||||
GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "set_file_readonly1")),
|
||||
doc_list[idx].readonly);
|
||||
|
||||
item = lookup_widget(app->window, "menu_write_unicode_bom1");
|
||||
item = lookup_widget(main_widgets.window, "menu_write_unicode_bom1");
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
|
||||
doc_list[idx].has_bom);
|
||||
gtk_widget_set_sensitive(item, encodings_is_unicode_charset(doc_list[idx].encoding));
|
||||
@ -709,12 +711,12 @@ void ui_document_show_hide(gint idx)
|
||||
default: widget_name = "crlf"; break;
|
||||
}
|
||||
gtk_check_menu_item_set_active(
|
||||
GTK_CHECK_MENU_ITEM(lookup_widget(app->window, widget_name)), TRUE);
|
||||
GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, widget_name)), TRUE);
|
||||
|
||||
encodings_select_radio_item(doc_list[idx].encoding);
|
||||
filetypes_select_radio_item(doc_list[idx].file_type);
|
||||
|
||||
app->ignore_callback = FALSE;
|
||||
ignore_callback = FALSE;
|
||||
}
|
||||
|
||||
|
||||
@ -725,7 +727,7 @@ void ui_update_toolbar_icons(GtkIconSize size)
|
||||
GtkWidget *oldwidget = NULL;
|
||||
|
||||
/* destroy old widget */
|
||||
widget = lookup_widget(app->window, "toolbutton22");
|
||||
widget = lookup_widget(main_widgets.window, "toolbutton22");
|
||||
oldwidget = gtk_tool_button_get_icon_widget(GTK_TOOL_BUTTON(widget));
|
||||
if (oldwidget && GTK_IS_WIDGET(oldwidget)) gtk_widget_destroy(oldwidget);
|
||||
/* create new widget */
|
||||
@ -733,14 +735,14 @@ void ui_update_toolbar_icons(GtkIconSize size)
|
||||
gtk_widget_show(button_image);
|
||||
gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(widget), button_image);
|
||||
|
||||
gtk_toolbar_set_icon_size(GTK_TOOLBAR(app->toolbar), size);
|
||||
gtk_toolbar_set_icon_size(GTK_TOOLBAR(main_widgets.toolbar), size);
|
||||
}
|
||||
|
||||
|
||||
void ui_update_toolbar_items(void)
|
||||
{
|
||||
/* show toolbar */
|
||||
GtkWidget *widget = lookup_widget(app->window, "menu_show_toolbar1");
|
||||
GtkWidget *widget = lookup_widget(main_widgets.window, "menu_show_toolbar1");
|
||||
if (toolbar_prefs.visible && ! gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
|
||||
{ /* will be changed by the toggled callback */
|
||||
toolbar_prefs.visible = ! toolbar_prefs.visible;
|
||||
@ -753,48 +755,48 @@ void ui_update_toolbar_items(void)
|
||||
}
|
||||
|
||||
/* fileops */
|
||||
ui_widget_show_hide(lookup_widget(app->window, "menutoolbutton1"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton9"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton10"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton22"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton23"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton15"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem7"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem2"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "menutoolbutton1"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton9"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton10"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton22"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton23"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton15"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem7"), toolbar_prefs.show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem2"), toolbar_prefs.show_fileops);
|
||||
/* search */
|
||||
ui_widget_show_hide(lookup_widget(app->window, "entry1"), toolbar_prefs.show_search);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton18"), toolbar_prefs.show_search);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem5"), toolbar_prefs.show_search);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "entry1"), toolbar_prefs.show_search);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton18"), toolbar_prefs.show_search);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem5"), toolbar_prefs.show_search);
|
||||
/* goto line */
|
||||
ui_widget_show_hide(lookup_widget(app->window, "entry_goto_line"), toolbar_prefs.show_goto);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton25"), toolbar_prefs.show_goto);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem8"), toolbar_prefs.show_goto);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "entry_goto_line"), toolbar_prefs.show_goto);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton25"), toolbar_prefs.show_goto);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem8"), toolbar_prefs.show_goto);
|
||||
/* compile */
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton13"), toolbar_prefs.show_compile);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton26"), toolbar_prefs.show_compile);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem6"), toolbar_prefs.show_compile);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton13"), toolbar_prefs.show_compile);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton26"), toolbar_prefs.show_compile);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem6"), toolbar_prefs.show_compile);
|
||||
/* colour */
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton24"), toolbar_prefs.show_colour);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem3"), toolbar_prefs.show_colour);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton24"), toolbar_prefs.show_colour);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem3"), toolbar_prefs.show_colour);
|
||||
/* zoom */
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton20"), toolbar_prefs.show_zoom);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton21"), toolbar_prefs.show_zoom);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem4"), toolbar_prefs.show_zoom);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton20"), toolbar_prefs.show_zoom);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton21"), toolbar_prefs.show_zoom);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem4"), toolbar_prefs.show_zoom);
|
||||
/* indent */
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_indent_dec"), toolbar_prefs.show_indent);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_indent_inc"), toolbar_prefs.show_indent);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem11"), toolbar_prefs.show_indent);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_indent_dec"), toolbar_prefs.show_indent);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_indent_inc"), toolbar_prefs.show_indent);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem11"), toolbar_prefs.show_indent);
|
||||
/* undo */
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_undo"), toolbar_prefs.show_undo);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_redo"), toolbar_prefs.show_undo);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem9"), toolbar_prefs.show_undo);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_undo"), toolbar_prefs.show_undo);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_redo"), toolbar_prefs.show_undo);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem9"), toolbar_prefs.show_undo);
|
||||
/* navigation */
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_back"), toolbar_prefs.show_navigation);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_forward"), toolbar_prefs.show_navigation);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem10"), toolbar_prefs.show_navigation);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_back"), toolbar_prefs.show_navigation);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_forward"), toolbar_prefs.show_navigation);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem10"), toolbar_prefs.show_navigation);
|
||||
/* quit */
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton19"), toolbar_prefs.show_quit);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem8"), toolbar_prefs.show_quit);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton19"), toolbar_prefs.show_quit);
|
||||
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem8"), toolbar_prefs.show_quit);
|
||||
}
|
||||
|
||||
|
||||
@ -859,7 +861,7 @@ void ui_create_recent_menu(void)
|
||||
if (g_queue_get_length(ui_prefs.recent_queue) > 0)
|
||||
{
|
||||
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(
|
||||
lookup_widget(app->window, "toolbutton9")), ui_widgets.recent_files_toolbar);
|
||||
lookup_widget(main_widgets.window, "toolbutton9")), ui_widgets.recent_files_toolbar);
|
||||
}
|
||||
|
||||
for (i = 0; i < MIN(file_prefs.mru_length, g_queue_get_length(ui_prefs.recent_queue)); i++)
|
||||
@ -999,7 +1001,7 @@ static void update_recent_menu(void)
|
||||
GList *children, *item;
|
||||
|
||||
if (menu == NULL)
|
||||
menu = GTK_MENU_TOOL_BUTTON(lookup_widget(app->window, "toolbutton9"));
|
||||
menu = GTK_MENU_TOOL_BUTTON(lookup_widget(main_widgets.window, "toolbutton9"));
|
||||
|
||||
if (gtk_menu_tool_button_get_menu(menu) == NULL)
|
||||
{
|
||||
@ -1048,7 +1050,7 @@ static void update_recent_menu(void)
|
||||
|
||||
void ui_show_markers_margin(void)
|
||||
{
|
||||
gint i, idx, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook));
|
||||
gint i, idx, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
|
||||
for(i = 0; i < max; i++)
|
||||
{
|
||||
@ -1060,7 +1062,7 @@ void ui_show_markers_margin(void)
|
||||
|
||||
void ui_show_linenumber_margin(void)
|
||||
{
|
||||
gint i, idx, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook));
|
||||
gint i, idx, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
|
||||
for(i = 0; i < max; i++)
|
||||
{
|
||||
@ -1320,7 +1322,7 @@ static gchar *run_file_chooser(const gchar *title, GtkFileChooserAction action,
|
||||
const gchar *utf8_path)
|
||||
{
|
||||
GtkWidget *dialog = gtk_file_chooser_dialog_new(title,
|
||||
GTK_WINDOW(app->window), action,
|
||||
GTK_WINDOW(main_widgets.window), action,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL);
|
||||
gchar *locale_path;
|
||||
@ -1386,11 +1388,11 @@ void ui_statusbar_showhide(gboolean state)
|
||||
/* handle statusbar visibility */
|
||||
if (state)
|
||||
{
|
||||
gtk_widget_show(app->statusbar);
|
||||
gtk_widget_show(ui_widgets.statusbar);
|
||||
ui_update_statusbar(-1, -1);
|
||||
}
|
||||
else
|
||||
gtk_widget_hide(app->statusbar);
|
||||
gtk_widget_hide(ui_widgets.statusbar);
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,6 +65,21 @@ GeanyToolbarPrefs;
|
||||
extern GeanyToolbarPrefs toolbar_prefs;
|
||||
|
||||
|
||||
/** Important widgets in the main window. */
|
||||
typedef struct GeanyMainWidgets
|
||||
{
|
||||
GtkWidget *window; /**< Main window. */
|
||||
GtkWidget *toolbar; /**< Main toolbar. */
|
||||
GtkWidget *sidebar_notebook; /**< Sidebar notebook. */
|
||||
GtkWidget *notebook; /**< Document notebook. */
|
||||
GtkWidget *editor_menu; /**< Popup editor menu. */
|
||||
GtkWidget *tools_menu; /**< Most plugins add menu items to the Tools menu. */
|
||||
}
|
||||
GeanyMainWidgets;
|
||||
|
||||
extern GeanyMainWidgets main_widgets;
|
||||
|
||||
|
||||
/* User Interface settings not shown in the Prefs dialog. */
|
||||
typedef struct UIPrefs
|
||||
{
|
||||
@ -108,6 +123,9 @@ typedef struct UIWidgets
|
||||
GtkWidget *open_filesel;
|
||||
GtkWidget *save_filesel;
|
||||
GtkWidget *prefs_dialog;
|
||||
|
||||
/* other widgets not needed in GeanyMainWidgets */
|
||||
GtkWidget *statusbar; /* use ui_set_statusbar() to set */
|
||||
}
|
||||
UIWidgets;
|
||||
|
||||
|
83
src/utils.c
83
src/utils.c
@ -185,67 +185,6 @@ gboolean utils_is_opening_brace(gchar c, gboolean include_angles)
|
||||
}
|
||||
|
||||
|
||||
/* line is counted with 1 as the first line, not 0 */
|
||||
gboolean utils_goto_file_pos(const gchar *file, gboolean is_tm_filename, gint pos)
|
||||
{
|
||||
gint file_idx = document_find_by_filename(file, is_tm_filename);
|
||||
|
||||
if (file_idx < 0) return FALSE;
|
||||
|
||||
return utils_goto_pos(file_idx, pos);
|
||||
}
|
||||
|
||||
|
||||
/* line is counted with 1 as the first line, not 0 */
|
||||
gboolean utils_goto_line(gint idx, gint line)
|
||||
{
|
||||
gint page_num;
|
||||
|
||||
line--; /* the user counts lines from 1, we begin at 0 so bring the user line to our one */
|
||||
|
||||
if (! DOC_IDX_VALID(idx) || line < 0)
|
||||
return FALSE;
|
||||
|
||||
/* mark the tag */
|
||||
sci_marker_delete_all(doc_list[idx].sci, 0);
|
||||
sci_set_marker_at_line(doc_list[idx].sci, line, TRUE, 0);
|
||||
|
||||
sci_goto_line(doc_list[idx].sci, line, TRUE);
|
||||
doc_list[idx].scroll_percent = 0.25F;
|
||||
|
||||
/* finally switch to the page */
|
||||
page_num = gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook), GTK_WIDGET(doc_list[idx].sci));
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), page_num);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
gboolean utils_goto_pos(gint idx, gint pos)
|
||||
{
|
||||
gint page_num;
|
||||
gint line;
|
||||
|
||||
if (! DOC_IDX_VALID(idx) || pos < 0)
|
||||
return FALSE;
|
||||
|
||||
line = sci_get_line_from_position(doc_list[idx].sci, pos);
|
||||
|
||||
/* mark the tag */
|
||||
sci_marker_delete_all(doc_list[idx].sci, 0);
|
||||
sci_set_marker_at_line(doc_list[idx].sci, line, TRUE, 0);
|
||||
|
||||
sci_goto_pos(doc_list[idx].sci, pos, TRUE);
|
||||
doc_list[idx].scroll_percent = 0.25F;
|
||||
|
||||
/* finally switch to the page */
|
||||
page_num = gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook), GTK_WIDGET(doc_list[idx].sci));
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), page_num);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Write the given @c text into a file with @c filename.
|
||||
* If the file doesn't exist, it will be created.
|
||||
@ -1082,28 +1021,6 @@ gchar *utils_get_setting_string(GKeyFile *config, const gchar *section, const gc
|
||||
}
|
||||
|
||||
|
||||
void utils_switch_document(gint direction)
|
||||
{
|
||||
gint page_count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook));
|
||||
gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->notebook));
|
||||
|
||||
if (direction == LEFT)
|
||||
{
|
||||
if (cur_page > 0)
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), cur_page - 1);
|
||||
else
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), page_count - 1);
|
||||
}
|
||||
else if (direction == RIGHT)
|
||||
{
|
||||
if (cur_page < page_count - 1)
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), cur_page + 1);
|
||||
else
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void utils_replace_filename(gint idx)
|
||||
{
|
||||
gchar *filebase;
|
||||
|
@ -54,12 +54,6 @@ gboolean utils_isbrace(gchar c, gboolean include_angles);
|
||||
|
||||
gboolean utils_is_opening_brace(gchar c, gboolean include_angles);
|
||||
|
||||
gboolean utils_goto_file_pos(const gchar *file, gboolean is_tm_filename, gint pos);
|
||||
|
||||
gboolean utils_goto_line(gint idx, gint line);
|
||||
|
||||
gboolean utils_goto_pos(gint idx, gint pos);
|
||||
|
||||
gint utils_write_file(const gchar *filename, const gchar *text);
|
||||
|
||||
gchar *utils_find_open_xml_tag(const gchar sel[], gint size, gboolean check_tag);
|
||||
@ -102,8 +96,6 @@ gint utils_get_setting_integer(GKeyFile *config, const gchar *section, const gch
|
||||
|
||||
gchar *utils_get_setting_string(GKeyFile *config, const gchar *section, const gchar *key, const gchar *default_value);
|
||||
|
||||
void utils_switch_document(gint direction);
|
||||
|
||||
void utils_replace_filename(gint idx);
|
||||
|
||||
gchar *utils_get_hex_from_color(GdkColor *color);
|
||||
|
20
src/win32.c
20
src/win32.c
@ -211,7 +211,7 @@ gchar *win32_show_project_folder_dialog(GtkWidget *parent, const gchar *title,
|
||||
gchar *result = NULL;
|
||||
|
||||
if (parent == NULL)
|
||||
parent = app->window;
|
||||
parent = main_widgets.window;
|
||||
|
||||
memset(&bi, 0, sizeof bi);
|
||||
bi.hwndOwner = GDK_WINDOW_HWND(parent->window);
|
||||
@ -264,7 +264,7 @@ gchar *win32_show_project_open_dialog(GtkWidget *parent, const gchar *title,
|
||||
fname[0] = '\0';
|
||||
|
||||
if (parent == NULL)
|
||||
parent = app->window;
|
||||
parent = main_widgets.window;
|
||||
|
||||
/* initialise file dialog info struct */
|
||||
memset(&of, 0, sizeof of);
|
||||
@ -329,7 +329,7 @@ gboolean win32_show_file_dialog(gboolean file_open, const gchar *initial_dir)
|
||||
#else
|
||||
of.lStructSize = sizeof of;
|
||||
#endif
|
||||
of.hwndOwner = GDK_WINDOW_HWND(app->window->window);
|
||||
of.hwndOwner = GDK_WINDOW_HWND(main_widgets.window->window);
|
||||
of.lpstrFilter = filters;
|
||||
|
||||
of.lpstrCustomFilter = NULL;
|
||||
@ -422,7 +422,7 @@ void win32_show_font_dialog(void)
|
||||
|
||||
memset(&cf, 0, sizeof cf);
|
||||
cf.lStructSize = sizeof cf;
|
||||
cf.hwndOwner = GDK_WINDOW_HWND(app->window->window);
|
||||
cf.hwndOwner = GDK_WINDOW_HWND(main_widgets.window->window);
|
||||
cf.lpLogFont = &lf;
|
||||
cf.Flags = CF_APPLY | CF_NOSCRIPTSEL | CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
|
||||
|
||||
@ -458,7 +458,7 @@ void win32_show_color_dialog(const gchar *colour)
|
||||
/* Initialize CHOOSECOLOR */
|
||||
memset(&cc, 0, sizeof cc);
|
||||
cc.lStructSize = sizeof(cc);
|
||||
cc.hwndOwner = GDK_WINDOW_HWND(app->window->window);
|
||||
cc.hwndOwner = GDK_WINDOW_HWND(main_widgets.window->window);
|
||||
cc.lpCustColors = (LPDWORD) acr_cust_clr;
|
||||
cc.rgbResult = (colour != NULL) ? utils_strtod(colour, NULL, colour[0] == '#') : 0;
|
||||
cc.Flags = CC_FULLOPEN | CC_RGBINIT;
|
||||
@ -603,8 +603,8 @@ gboolean win32_message_dialog(GtkWidget *parent, GtkMessageType type, const gcha
|
||||
|
||||
if (parent != NULL)
|
||||
parent_hwnd = GDK_WINDOW_HWND(parent->window);
|
||||
else if (app->window != NULL)
|
||||
parent_hwnd = GDK_WINDOW_HWND(app->window->window);
|
||||
else if (main_widgets.window != NULL)
|
||||
parent_hwnd = GDK_WINDOW_HWND(main_widgets.window->window);
|
||||
|
||||
/* display the message box */
|
||||
rc = MessageBoxW(parent_hwnd, w_msg, w_title, t);
|
||||
@ -640,8 +640,8 @@ gint win32_message_dialog_unsaved(const gchar *msg)
|
||||
MultiByteToWideChar(CP_UTF8, 0, msg, -1, w_msg, G_N_ELEMENTS(w_msg));
|
||||
MultiByteToWideChar(CP_UTF8, 0, _("Question"), -1, w_title, G_N_ELEMENTS(w_title));
|
||||
|
||||
if (app->window != NULL)
|
||||
parent_hwnd = GDK_WINDOW_HWND(app->window->window);
|
||||
if (main_widgets.window != NULL)
|
||||
parent_hwnd = GDK_WINDOW_HWND(main_widgets.window->window);
|
||||
|
||||
ret = MessageBoxW(parent_hwnd, w_msg, w_title, MB_YESNOCANCEL | MB_ICONQUESTION);
|
||||
switch(ret)
|
||||
@ -1214,7 +1214,7 @@ gchar *win32_get_shortcut_target(const gchar *file_name)
|
||||
gchar *path = NULL;
|
||||
wchar_t *wfilename = g_utf8_to_utf16(file_name, -1, NULL, NULL, NULL);
|
||||
|
||||
resolve_link(GDK_WINDOW_HWND(app->window->window), wfilename, &path);
|
||||
resolve_link(GDK_WINDOW_HWND(main_widgets.window->window), wfilename, &path);
|
||||
g_free(wfilename);
|
||||
|
||||
if (path == NULL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user