-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Allow double click on tab headers to also reset checkboxes #21550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ | |
| #include "bauhaus/bauhaus.h" | ||
| #include "develop/develop.h" | ||
| #include "develop/imageop.h" | ||
| #include "develop/imageop_gui.h" | ||
| #include "dtgtk/drawingarea.h" | ||
| #include "dtgtk/expander.h" | ||
| #include "dtgtk/sidepanel.h" | ||
|
|
@@ -3837,13 +3838,32 @@ GdkModifierType dt_key_modifier_state() | |
| static void _reset_all_bauhaus(GtkNotebook *notebook, | ||
| GtkWidget *box) | ||
| { | ||
| // Two passes rather than one: some modules react to a slider/combobox | ||
| // changing by programmatically changing a checkbox too (e.g. turning a | ||
| // feature back on when one of its own settings is touched). If a | ||
| // checkbox were reset in the same pass as sliders/comboboxes, a slider | ||
| // reset that runs afterwards could still trigger that kind of side | ||
| // effect and silently undo the checkbox reset that already ran earlier | ||
| // in the same pass. Resetting every checkbox only after every slider/ | ||
| // combobox on the page has already settled avoids that regardless of | ||
| // what order the widgets happen to appear in. | ||
| GList *toggles = NULL; | ||
| for(GList *c = gtk_container_get_children(GTK_CONTAINER(box)); | ||
| c; | ||
| c = g_list_delete_link(c, c)) | ||
| { | ||
| if(DT_IS_BAUHAUS_WIDGET(c->data)) | ||
| dt_bauhaus_widget_reset(GTK_WIDGET(c->data)); | ||
| // dt_bauhaus_toggle_from_params() checkbuttons are plain GtkCheckButtons, | ||
| // not bauhaus widgets, so they're otherwise silently skipped by the | ||
| // check above; dt_bauhaus_toggle_widget_reset() no-ops for any other | ||
| // GtkToggleButton (e.g. one not created by that function). | ||
| else if(GTK_IS_TOGGLE_BUTTON(c->data)) | ||
| toggles = g_list_prepend(toggles, c->data); | ||
| } | ||
| for(GList *c = toggles; c; c = c->next) | ||
| dt_bauhaus_toggle_widget_reset(GTK_WIDGET(c->data)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, the toggle is not a bauhaus widget but we have bauhaus in the name. All this is confusing and the toggle should probably have been a real bauhaus widget since day one. Do you fill like doing this? This will have us access to the default as for all other widgets and will avoid having to pass the module's param:
Also, I'm not sure at what will happen if we first reset the module and then reset by double clicking on the tab. The
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will take a look |
||
| g_list_free(toggles); | ||
|
|
||
| dt_gui_remove_class(gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), box), "changed"); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not call
dt_bauhaus_toggle_widget_reset()directly here instead of adding all toggles into a list and deferring the reset to another for loop?Is the comment on top of
GListtoggles above real? And a check box could probably also trigger a slider change anyway. My guess is that we probably want to use GUI reset state (DT_ENTER_GUI_UPDATE / DT_LEAVE_GUI_UPDATE) during the while process, no?