From b54b45ea426c1fa80ed41ea08f0fa3c34585d410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sat, 13 Jan 2007 20:50:36 +0000 Subject: [PATCH] Applied patch from Jeff Pohlmeyer to add an option for disabling DnD in the editor widget. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1182 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 4 ++++ THANKS | 1 + geany.glade | 20 ++++++++++++++++++++ src/geany.h | 1 + src/interface.c | 8 ++++++++ src/keyfile.c | 2 ++ src/prefs.c | 6 ++++++ src/sci_cb.c | 5 +++++ 8 files changed, 47 insertions(+) diff --git a/ChangeLog b/ChangeLog index 83499745..dd2aabd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,10 @@ src/sci_cb.c, src/templates.c, tagmanager/js.c, tagmanager/lua.c, tagmanager/Makefile.am, tagmanager/makefile.win32, tagmanager/parsers.h: Added new filetypes Javascript and Lua. + * geany.glade, THANKS, src/geany.h, src/interface.c, src/keyfile.c, + src/prefs.c, src/sci_cb.c: + Applied patch from Jeff Pohlmeyer to add an option for disabling DnD + in the editor widget. 2007-01-13 Nick Treleaven diff --git a/THANKS b/THANKS index 5aa1f70a..f2188127 100644 --- a/THANKS +++ b/THANKS @@ -21,6 +21,7 @@ Stefan Oltmanns - es Bob Doan - some patches Rob van der Linde - fixed wrong vte height on some systems Josef Whiter - parse 'Entering directory' build messages. +Jeff Pohlmeyer - "Allow DnD" and "Use tabs" patches Translators: ---------------------------------- diff --git a/geany.glade b/geany.glade index 47b33365..c04515f3 100644 --- a/geany.glade +++ b/geany.glade @@ -5217,6 +5217,26 @@ Bottom False + + + + True + Disable drag and drop completely in the editor window so you can't drag and drop any selections within or outside of the editor window. + True + Disable Drag and Drop + True + GTK_RELIEF_NORMAL + False + False + False + True + + + 0 + False + False + + diff --git a/src/geany.h b/src/geany.h index 97c0eaf4..08e28118 100644 --- a/src/geany.h +++ b/src/geany.h @@ -114,6 +114,7 @@ typedef struct MyApp gboolean pref_editor_new_line; gboolean pref_editor_replace_tabs; gboolean pref_editor_trail_space; + gboolean pref_editor_disable_dnd; gboolean pref_main_load_session; gboolean pref_main_save_winpos; gboolean pref_main_confirm_exit; diff --git a/src/interface.c b/src/interface.c index 7f531461..92f8a945 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2303,6 +2303,7 @@ create_prefs_dialog (void) GtkWidget *check_folding; GtkWidget *check_unfold_children; GtkWidget *check_indicators; + GtkWidget *check_disable_dnd; GtkWidget *label172; GtkWidget *frame18; GtkWidget *alignment21; @@ -3195,6 +3196,12 @@ create_prefs_dialog (void) gtk_tooltips_set_tip (tooltips, check_indicators, _("Whether to use indicators (a squiggly underline) to highlight the lines where the compiler found a warning or an error."), NULL); gtk_button_set_focus_on_click (GTK_BUTTON (check_indicators), FALSE); + check_disable_dnd = gtk_check_button_new_with_mnemonic (_("Disable Drag and Drop")); + gtk_widget_show (check_disable_dnd); + gtk_box_pack_start (GTK_BOX (vbox17), check_disable_dnd, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, check_disable_dnd, _("Disable drag and drop completely in the editor window so you can't drag and drop any selections within or outside of the editor window."), NULL); + gtk_button_set_focus_on_click (GTK_BUTTON (check_disable_dnd), FALSE); + label172 = gtk_label_new (_("Features")); gtk_widget_show (label172); gtk_frame_set_label_widget (GTK_FRAME (frame14), label172); @@ -3725,6 +3732,7 @@ create_prefs_dialog (void) GLADE_HOOKUP_OBJECT (prefs_dialog, check_folding, "check_folding"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_unfold_children, "check_unfold_children"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_indicators, "check_indicators"); + GLADE_HOOKUP_OBJECT (prefs_dialog, check_disable_dnd, "check_disable_dnd"); GLADE_HOOKUP_OBJECT (prefs_dialog, label172, "label172"); GLADE_HOOKUP_OBJECT (prefs_dialog, frame18, "frame18"); GLADE_HOOKUP_OBJECT (prefs_dialog, alignment21, "alignment21"); diff --git a/src/keyfile.c b/src/keyfile.c index 4b440235..979d3da7 100644 --- a/src/keyfile.c +++ b/src/keyfile.c @@ -173,6 +173,7 @@ void configuration_save() g_key_file_set_boolean(config, PACKAGE, "pref_editor_new_line", app->pref_editor_new_line); g_key_file_set_boolean(config, PACKAGE, "pref_editor_replace_tabs", app->pref_editor_replace_tabs); g_key_file_set_boolean(config, PACKAGE, "pref_editor_trail_space", app->pref_editor_trail_space); + g_key_file_set_boolean(config, PACKAGE, "pref_editor_disable_dnd", app->pref_editor_disable_dnd); g_key_file_set_string(config, PACKAGE, "pref_editor_default_encoding", encodings[app->pref_editor_default_encoding].charset); g_key_file_set_string(config, PACKAGE, "pref_template_developer", app->pref_template_developer); g_key_file_set_string(config, PACKAGE, "pref_template_company", app->pref_template_company); @@ -429,6 +430,7 @@ gboolean configuration_load() app->pref_editor_replace_tabs = utils_get_setting_boolean(config, PACKAGE, "pref_editor_replace_tabs", FALSE); app->pref_editor_new_line = utils_get_setting_boolean(config, PACKAGE, "pref_editor_new_line", TRUE); app->pref_editor_trail_space = utils_get_setting_boolean(config, PACKAGE, "pref_editor_trail_space", FALSE); + app->pref_editor_disable_dnd = utils_get_setting_boolean(config, PACKAGE, "pref_editor_disable_dnd", FALSE); tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_MAKE); app->tools_make_cmd = utils_get_setting_string(config, "tools", "make_cmd", tmp_string); diff --git a/src/prefs.c b/src/prefs.c index ba41c280..1d80a56e 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -247,6 +247,9 @@ void prefs_init_dialog(void) on_pref_use_folding_toggled(GTK_TOGGLE_BUTTON( lookup_widget(app->prefs_dialog, "check_folding")), NULL); + widget = lookup_widget(app->prefs_dialog, "check_disable_dnd"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_disable_dnd); + widget = lookup_widget(app->prefs_dialog, "check_indicators"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_use_indicators); @@ -550,6 +553,9 @@ void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_dat widget = lookup_widget(app->prefs_dialog, "check_indicators"); app->pref_editor_use_indicators = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + widget = lookup_widget(app->prefs_dialog, "check_disable_dnd"); + app->pref_editor_disable_dnd = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + widget = lookup_widget(app->prefs_dialog, "spin_autocheight"); app->autocompletion_max_height = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); diff --git a/src/sci_cb.c b/src/sci_cb.c index 001c16be..e3ab2723 100644 --- a/src/sci_cb.c +++ b/src/sci_cb.c @@ -67,6 +67,11 @@ on_editor_button_press_event (GtkWidget *widget, if (event->button == 1) { + if (GDK_BUTTON_PRESS==event->type && app->pref_editor_disable_dnd) + { + gint ss = sci_get_selection_start(doc_list[idx].sci); + sci_set_selection_end(doc_list[idx].sci, ss); + } return utils_check_disk_status(idx, FALSE); }