From 3d1ae24c4d288f873c8186214f77f4718d119c8b Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Mon, 23 Sep 2019 12:35:56 +0100 Subject: [PATCH 1/4] Prefs dialog: Disable overridden pref widgets when project is open --- data/geany.glade | 32 +++++++++++++++++++++++++++++--- src/prefs.c | 9 +++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/data/geany.glade b/data/geany.glade index 3864a0ad17..37f1621a06 100644 --- a/data/geany.glade +++ b/data/geany.glade @@ -4606,11 +4606,37 @@ - + True False - <b>Saving files</b> - True + These preferences can be overridden when a project is open + 6 + + + True + False + <b>Saving files</b> + True + + + True + True + 0 + + + + + True + False + gtk-info + 1 + + + True + True + 1 + + diff --git a/src/prefs.c b/src/prefs.c index 5d1b5fc970..cbd4e22db9 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -803,6 +803,15 @@ static void prefs_init_dialog(void) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->cursor_blinks); } #endif + // note some widgets are only *optionally* overridden, don't include them + const gchar *proj_overrides[] = { + "vbox6" + }; + for (guint i = 0; i < G_N_ELEMENTS(proj_overrides); i++) + { + GtkWidget *w = ui_lookup_widget(ui_widgets.prefs_dialog, proj_overrides[i]); + gtk_widget_set_sensitive(w, !app->project); + } } From 509f716955a59b8bcc87e27207f8c98f07be9b15 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Tue, 24 Sep 2019 15:52:34 +0100 Subject: [PATCH 2/4] Tweak tooltip text & allow clicking icon to enable overridden widgets --- data/geany.glade | 16 ++++++++++++---- src/prefs.c | 21 +++++++++++++++++---- src/prefs.h | 4 +++- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/data/geany.glade b/data/geany.glade index 37f1621a06..26b6769021 100644 --- a/data/geany.glade +++ b/data/geany.glade @@ -4609,7 +4609,8 @@ True False - These preferences can be overridden when a project is open + These preferences can be overridden by project properties. +Click the info icon to force editing. 6 @@ -4625,11 +4626,18 @@ - + True False - gtk-info - 1 + + + + True + False + gtk-info + 2 + + True diff --git a/src/prefs.c b/src/prefs.c index cbd4e22db9..c6dfbca5f4 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -393,6 +393,11 @@ static void kb_init(KbData *kbdata) } +// pref dialog widget names that should start off disabled when project open +const gchar *proj_overrides[] = { + "vbox6" +}; + /* note: new 'simple' prefs should use Stash code in keyfile.c */ static void prefs_init_dialog(void) { @@ -803,10 +808,6 @@ static void prefs_init_dialog(void) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->cursor_blinks); } #endif - // note some widgets are only *optionally* overridden, don't include them - const gchar *proj_overrides[] = { - "vbox6" - }; for (guint i = 0; i < G_N_ELEMENTS(proj_overrides); i++) { GtkWidget *w = ui_lookup_widget(ui_widgets.prefs_dialog, proj_overrides[i]); @@ -815,6 +816,18 @@ static void prefs_init_dialog(void) } +gboolean on_prefs_edit_override(GtkWidget *widget, GdkEventButton *event, gpointer data) +{ + // all overridden widgets will stay enabled until dialog is closed + for (guint i = 0; i < G_N_ELEMENTS(proj_overrides); i++) + { + GtkWidget *w = ui_lookup_widget(ui_widgets.prefs_dialog, proj_overrides[i]); + gtk_widget_set_sensitive(w, TRUE); + } + return TRUE; +} + + /* note: uses group index, not group id, unlike keybindings_lookup_item(). */ static GeanyKeyBinding *kb_index(guint gidx, guint kid) { diff --git a/src/prefs.h b/src/prefs.h index dcf33a5029..654460c9ee 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -21,7 +21,7 @@ #ifndef GEANY_PREFS_H #define GEANY_PREFS_H 1 -#include +#include G_BEGIN_DECLS @@ -63,6 +63,8 @@ void prefs_show_dialog(void); void prefs_kb_search_name(const gchar *search); +gboolean on_prefs_edit_override(GtkWidget *widget, GdkEventButton *event, gpointer data); + #endif /* GEANY_PRIVATE */ G_END_DECLS From 32f99badc0db3a99285ad359d341aa86b98a22c9 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 25 Sep 2019 10:42:14 +0100 Subject: [PATCH 3/4] Add info icons for other overridden project prefs --- data/geany.glade | 244 ++++++++++++++++++++++++++++++++++++++++------- src/prefs.c | 3 +- 2 files changed, 209 insertions(+), 38 deletions(-) diff --git a/data/geany.glade b/data/geany.glade index 26b6769021..adc4b77ffd 100644 --- a/data/geany.glade +++ b/data/geany.glade @@ -2811,18 +2811,52 @@ True False - - Line wrapping + True - True - False - Wrap the line at the window border and continue it on the next line. Note: line wrapping has a high performance cost for large documents so should be disabled on slow machines. - True - True + False + These preferences can be overridden by project properties. +Click the info icon to force editing when disabled. + 6 + + + Line wrapping + True + True + False + Wrap the line at the window border and continue it on the next line. Note: line wrapping has a high performance cost for large documents so should be disabled on slow machines. + True + True + + + False + False + 0 + + + + + True + False + + + + True + False + gtk-info + 2 + + + + + False + True + 1 + + - False - False + True + True 0 @@ -2925,31 +2959,65 @@ True False - 12 + These preferences can be overridden by project properties. +Click the info icon to force editing when disabled. + 6 - + True False - Line breaking column: - spin_line_break + 12 + + + True + False + Line breaking column: + spin_line_break + + + False + False + 0 + + + + + True + True + False + False + True + True + adjustment1 + 1 + True + + + False + True + 1 + + False - False + True 0 - + True - True - False - False - True - True - adjustment1 - 1 - True + False + + + + True + False + gtk-info + 2 + + False @@ -3317,11 +3385,45 @@ - + True False - <b>Indentation</b> - True + These preferences can be overridden by project properties. +Click the info icon to force editing when disabled. + 6 + + + True + False + <b>Indentation</b> + True + + + True + True + 0 + + + + + True + False + + + + True + False + gtk-info + 2 + + + + + True + True + 1 + + @@ -3401,14 +3503,48 @@ - - Automatic continuation of multi-line comments + True - True - False - Continue automatically multi-line comments in languages like C, C++ and Java when a new line is entered inside such a comment - True - True + False + These preferences can be overridden by project properties. +Click the info icon to force editing when disabled. + 6 + + + Automatic continuation of multi-line comments + True + True + False + Continue automatically multi-line comments in languages like C, C++ and Java when a new line is entered inside such a comment + True + True + + + False + True + 0 + + + + + True + False + + + + True + False + gtk-info + 2 + + + + + False + True + 1 + + False @@ -4135,11 +4271,45 @@ - + True False - <b>Long line marker</b> - True + These preferences can be overridden by project properties. +Click the info icon to force editing when disabled. + 6 + + + True + False + <b>Long line marker</b> + True + + + False + True + 0 + + + + + True + False + + + + True + False + gtk-info + 2 + + + + + False + True + 1 + + @@ -4610,7 +4780,7 @@ True False These preferences can be overridden by project properties. -Click the info icon to force editing. +Click the info icon to force editing when disabled. 6 diff --git a/src/prefs.c b/src/prefs.c index c6dfbca5f4..b7405172f3 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -395,7 +395,8 @@ static void kb_init(KbData *kbdata) // pref dialog widget names that should start off disabled when project open const gchar *proj_overrides[] = { - "vbox6" + "vbox6", "table13", "check_line_wrapping", "hbox14", + "check_auto_multiline", "table7" }; /* note: new 'simple' prefs should use Stash code in keyfile.c */ From 48e24553bea346e4f717a6c0eddcd71c94bf5482 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Sat, 28 Sep 2019 12:12:03 +0100 Subject: [PATCH 4/4] [docs] Describe info icons for Preferences --- doc/geany.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/geany.txt b/doc/geany.txt index e418ebe815..71525d5a43 100644 --- a/doc/geany.txt +++ b/doc/geany.txt @@ -1786,17 +1786,22 @@ that items like G_GNUC_PRINTF+ get parsed correctly. Preferences ----------- -You may adjust Geany's settings using the Edit --> Preferences +You may adjust Geany's settings using the Preferences dialog. Any changes you make there can be applied by hitting either the Apply or the OK button. These settings will persist between Geany sessions. Note that most settings here have descriptive popup bubble help -- just hover the mouse over the item in question to get help -on it. +on it. (Known as tooltips). You may also adjust some View settings (under the View menu) that persist between Geany sessions. The settings under the Document menu, however, are only for the current document and revert to defaults -when restarting Geany. +when opening a new document. + +Some preferences are overridden when a project is open, and will be +disabled. These have info icons next to them with a tooltip reminder. +Clicking the icon will enable editing of all overridden preferences +until the dialog is closed. .. note:: In the paragraphs that follow, the text describing a dialog tab