From 8fb4ae623d6fecc97b210088ccccd41464e0ba3c Mon Sep 17 00:00:00 2001 From: Diederik ter Rahe Date: Thu, 3 Oct 2024 08:50:22 -0400 Subject: [PATCH] prepare to migrate box This introduces new helper functions to create and fill GtkBoxes. In Gtk4 the functions used for This will change so preparing now makes the transition easier (and also reduces code size) Treat the converted instance of gtk_box_new and gtk_box_pack_start/_end in this commit as templates. The expand and fill parameters are not used anymore and often were irrelevant anyway. If necessary they can now be replaced with gtk_widget_set_h/vexpand and gtk_widget_set_h/valign. See https://docs.gtk.org/gtk4/migrating-3to4.html#adapt-to-gtkbox-api-changes For gtk_widget_set_hexpand there is a new helper function dt_gui_expand. --- src/develop/blend_gui.c | 39 ++++++----------- src/develop/imageop_gui.c | 6 +-- src/gui/accelerators.c | 2 + src/gui/gtk.c | 14 ++++++ src/gui/gtk.h | 21 +++++++-- src/gui/splash.c | 61 ++++++++------------------- src/imageio/format/avif.c | 22 ++-------- src/imageio/format/j2k.c | 5 +-- src/imageio/format/jpeg.c | 6 +-- src/imageio/format/jxl.c | 12 ++---- src/imageio/format/png.c | 6 +-- src/imageio/format/tiff.c | 10 +---- src/imageio/format/webp.c | 7 +-- src/imageio/format/xcf.c | 4 +- src/imageio/storage/disk.c | 9 +--- src/imageio/storage/gallery.c | 16 +++---- src/imageio/storage/latex.c | 17 ++------ src/imageio/storage/piwigo.c | 75 ++++++++++----------------------- src/iop/ashift.c | 7 +-- src/iop/atrous.c | 6 +-- src/iop/basecurve.c | 9 ++-- src/iop/blurs.c | 6 +-- src/iop/borders.c | 10 ++--- src/iop/channelmixerrgb.c | 75 +++++++++------------------------ src/iop/colorbalancergb.c | 36 +++++++--------- src/iop/colorchecker.c | 12 +----- src/iop/colorequal.c | 12 ++---- src/iop/colormapping.c | 12 ++---- src/iop/denoiseprofile.c | 39 +++++------------ src/iop/diffuse.c | 19 +++------ src/iop/filmicrgb.c | 17 +++----- src/iop/retouch.c | 43 +++---------------- src/iop/rgbcurve.c | 7 +-- src/iop/rgblevels.c | 50 ++++++---------------- src/libs/export.c | 66 +++++++++-------------------- src/libs/history.c | 22 +++------- src/libs/masks.c | 31 ++++---------- src/libs/metadata.c | 4 +- src/libs/styles.c | 38 +++++------------ src/libs/tools/global_toolbox.c | 10 ++--- src/libs/tools/lighttable.c | 19 +++------ src/views/darkroom.c | 25 ++++------- 42 files changed, 286 insertions(+), 621 deletions(-) diff --git a/src/develop/blend_gui.c b/src/develop/blend_gui.c index b5cf3202b031..8332ab292db3 100644 --- a/src/develop/blend_gui.c +++ b/src/develop/blend_gui.c @@ -2681,9 +2681,7 @@ void dt_iop_gui_init_blendif(GtkWidget *blendw, dt_iop_module_t *module) g_signal_connect(G_OBJECT(sl->polarity), "toggled", G_CALLBACK(_blendop_blendif_polarity_callback), bd); - sl->box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE)); - gtk_box_pack_start(GTK_BOX(sl->box), GTK_WIDGET(label_box), TRUE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(sl->box), GTK_WIDGET(slider_box), TRUE, FALSE, 0); + sl->box = GTK_BOX(dt_gui_vbox(label_box, slider_box)); gtk_box_pack_start(GTK_BOX(bd->blendif_box), GTK_WIDGET(sl->box), TRUE, FALSE, 0); } @@ -3722,34 +3720,25 @@ void dt_iop_gui_init_blending(GtkWidget *iopw, dt_gui_add_help_link(GTK_WIDGET(bd->masks_modes_box), "masks_blending"); gtk_widget_set_name(GTK_WIDGET(bd->masks_modes_box), "blending-tabs"); - bd->top_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0)); - gtk_box_pack_start(GTK_BOX(bd->top_box), gbox, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(bd->top_box), blend_modes_hbox, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(bd->top_box), bd->blend_mode_parameter_slider, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(bd->top_box), bd->opacity_slider, TRUE, TRUE, 0); + bd->top_box = GTK_BOX(dt_gui_vbox + (gbox, + blend_modes_hbox, + bd->blend_mode_parameter_slider, + bd->opacity_slider)); _add_wrapped_box(box, bd->top_box, NULL); dt_iop_gui_init_masks(iopw, module); dt_iop_gui_init_raster(iopw, module); dt_iop_gui_init_blendif(iopw, module); - bd->bottom_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0)); - gtk_box_pack_start(GTK_BOX(bd->bottom_box), - GTK_WIDGET(bd->masks_combine_combo), TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(bd->bottom_box), - hbox, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(bd->bottom_box), - bd->details_slider, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(bd->bottom_box), - bd->masks_feathering_guide_combo, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(bd->bottom_box), - bd->feathering_radius_slider, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(bd->bottom_box), - bd->blur_radius_slider, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(bd->bottom_box), - bd->brightness_slider, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(bd->bottom_box), - bd->contrast_slider, TRUE, TRUE, 0); + bd->bottom_box = GTK_BOX(dt_gui_vbox + (bd->masks_combine_combo, hbox, + bd->details_slider, + bd->masks_feathering_guide_combo, + bd->feathering_radius_slider, + bd->blur_radius_slider, + bd->brightness_slider, + bd->contrast_slider)); _add_wrapped_box(iopw, bd->bottom_box, "masks_refinement"); gtk_widget_set_name(GTK_WIDGET(bd->top_box), "blending-box"); diff --git a/src/develop/imageop_gui.c b/src/develop/imageop_gui.c index 8e5a8c29cd25..e9dc8e942cc6 100644 --- a/src/develop/imageop_gui.c +++ b/src/develop/imageop_gui.c @@ -173,7 +173,7 @@ GtkWidget *dt_bauhaus_slider_from_params(dt_iop_module_t *self, const char *para } if(!self->widget) self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - gtk_box_pack_start(GTK_BOX(self->widget), slider, FALSE, FALSE, 0); + dt_gui_box_add(self->widget, slider); g_free(param_name); @@ -230,7 +230,7 @@ GtkWidget *dt_bauhaus_combobox_from_params(dt_iop_module_t *self, const char *pa g_free(str); if(!self->widget) self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - gtk_box_pack_start(GTK_BOX(self->widget), combobox, FALSE, FALSE, 0); + dt_gui_box_add(self->widget, combobox); return combobox; } @@ -274,7 +274,7 @@ GtkWidget *dt_bauhaus_toggle_from_params(dt_iop_module_t *self, const char *para g_free(str); if(!self->widget) self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - gtk_box_pack_start(GTK_BOX(self->widget), button, FALSE, FALSE, 0); + dt_gui_box_add(self->widget, button); return button; } diff --git a/src/gui/accelerators.c b/src/gui/accelerators.c index 98cc5e3cabc4..0a1aca611697 100644 --- a/src/gui/accelerators.c +++ b/src/gui/accelerators.c @@ -5146,6 +5146,7 @@ GtkWidget *dt_action_button_new(dt_lib_module_t *self, GdkModifierType mods) { GtkWidget *button = gtk_button_new_with_label(Q_(label)); + gtk_widget_set_hexpand(button, TRUE); gtk_label_set_ellipsize(GTK_LABEL(gtk_bin_get_child(GTK_BIN(button))), PANGO_ELLIPSIZE_END); if(tooltip) gtk_widget_set_tooltip_text(button, tooltip); @@ -5172,6 +5173,7 @@ GtkWidget *dt_action_entry_new(dt_action_t *ac, const gchar *text) { GtkWidget *entry = dt_ui_entry_new(5); + gtk_widget_set_hexpand(entry, TRUE); if(text) gtk_entry_set_text (GTK_ENTRY(entry), text); if(tooltip) diff --git a/src/gui/gtk.c b/src/gui/gtk.c index f3f9a8e0e1f4..64d165f7d32b 100644 --- a/src/gui/gtk.c +++ b/src/gui/gtk.c @@ -4459,6 +4459,20 @@ void dt_gui_simulate_button_event(GtkWidget *widget, } } +GtkWidget *(dt_gui_box_add)(const char *file, const int line, const char *function, GtkBox *box, gpointer list[]) +{ + int i = 1; + for(; *list != (gpointer)-1; list++, i++) + { + if(GTK_IS_WIDGET(*list)) + gtk_container_add(GTK_CONTAINER(box), GTK_WIDGET(*list)); + else + dt_print(DT_DEBUG_ALWAYS, "%s:%d %s: trying to add invalid widget to box (#%d)", file, line, function, i); + } + + return GTK_WIDGET(box); +} + // clang-format off // modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py // vim: shiftwidth=2 expandtab tabstop=2 cindent diff --git a/src/gui/gtk.h b/src/gui/gtk.h index 516d87abff34..c01956514c28 100644 --- a/src/gui/gtk.h +++ b/src/gui/gtk.h @@ -406,9 +406,7 @@ static inline GtkWidget *dt_ui_section_label_new(const gchar *str) static inline GtkWidget *dt_ui_label_new(const gchar *str) { GtkWidget *label = gtk_label_new(str); - gtk_widget_set_halign(label, GTK_ALIGN_START); - gtk_label_set_xalign (GTK_LABEL(label), 0.0f); - gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); + g_object_set(label, "halign", GTK_ALIGN_START, "xalign", 0.0f, "ellipsize", PANGO_ELLIPSIZE_END, NULL); return label; }; @@ -548,6 +546,23 @@ void dt_gui_cursor_clear_busy(); // (i.e. the current function will do a lot of work before returning) void dt_gui_process_events(); +GtkWidget *(dt_gui_box_add)(const char *file, const int line, const char *function, GtkBox *box, gpointer list[]); +#define dt_gui_box_add(box, ...) dt_gui_box_add(__FILE__, __LINE__, __FUNCTION__, GTK_BOX(box), (gpointer[]){ __VA_ARGS__, (gpointer)-1 }) +#define dt_gui_hbox(...) dt_gui_box_add(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0), __VA_ARGS__) +#define dt_gui_vbox(...) dt_gui_box_add(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0), __VA_ARGS__) + +static inline GtkWidget *dt_gui_expand(GtkWidget *widget) +{ + gtk_widget_set_hexpand(widget, TRUE); + return widget; +} + +static inline GtkWidget *dt_gui_align_right(GtkWidget *widget) +{ + gtk_widget_set_halign(widget, GTK_ALIGN_END); + return dt_gui_expand(widget); +} + // Simulate a mouse button event (button is 1, 2, 3 - mouse button) sent to a Widget void dt_gui_simulate_button_event(GtkWidget *widget, const GdkEventType eventtype, diff --git a/src/gui/splash.c b/src/gui/splash.c index 7ece2cf6b015..1ad097f2c157 100644 --- a/src/gui/splash.c +++ b/src/gui/splash.c @@ -47,7 +47,7 @@ static GtkWidget *splash_screen = NULL; static GtkWidget *progress_text = NULL; static GtkWidget *remaining_text = NULL; static gboolean showing_remaining = FALSE; -static GtkBox *remaining_box = NULL; +static GtkWidget *remaining_box = NULL; static GtkWidget *exit_screen = NULL; @@ -177,15 +177,14 @@ void darktable_splash_screen_create(GtkWindow *parent_window, GtkWidget *logo = _get_logo(); GtkWidget *program_name = _get_program_name(); GtkBox *content = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(splash_screen))); - GtkBox *main_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); #ifdef USE_FEATURED_IMAGE // make a random selection of featured image based on the current // time const int imgnum = (int)(1 + (clock()%MAX_IMAGES)); //FIXME: if user overrides --datadir, we won't find the image... - image_file = g_strdup_printf("%s/pixmaps/splashscreen-%02d.jpg", - darktable.datadir, imgnum); + gchar *image_file = g_strdup_printf("%s/pixmaps/splashscreen-%02d.jpg", + darktable.datadir, imgnum); GtkWidget *image = gtk_image_new_from_file(image_file); g_free(image_file); gtk_widget_set_name(GTK_WIDGET(image), "splashscreen-image"); @@ -195,63 +194,39 @@ void darktable_splash_screen_create(GtkWindow *parent_window, GTK_WIDGET(gtk_label_new(_("Photography workflow\napplication and\nRAW developer"))); gtk_label_set_justify(GTK_LABEL(program_desc), GTK_JUSTIFY_CENTER); gtk_widget_set_name(program_desc, "splashscreen-description"); - GtkBox *title_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0)); - gtk_box_pack_start(title_box, logo, FALSE, FALSE, 0); - gtk_box_pack_start(title_box, version, FALSE, FALSE, 0); - gtk_box_pack_start(title_box, program_name, FALSE, FALSE, 0); - gtk_box_pack_start(title_box, program_desc, FALSE, FALSE, 0); - // now put the featured image to the right of the logo/name/description - gtk_box_pack_start(main_box, GTK_WIDGET(title_box), FALSE, FALSE, 0); - gtk_box_pack_start(main_box, image, FALSE, FALSE, 0); - gtk_box_pack_start(content, GTK_WIDGET(main_box), FALSE, FALSE, 0); + + dt_gui_box_add(content, dt_gui_hbox(dt_gui_vbox(logo, version, program_name, program_desc), image)); #else // put the darktable logo and version number together - GtkBox *logo_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0)); gtk_image_set_pixel_size(GTK_IMAGE(logo), 220); gtk_label_set_justify(GTK_LABEL(version), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(logo_box, logo, FALSE, FALSE, 0); - gtk_box_pack_start(logo_box, version, FALSE, FALSE, 0); - gtk_box_pack_start(logo_box, copyright, FALSE, FALSE, 0); + // put the darktable wordmark and description in a vertical stack GtkWidget *program_desc = GTK_WIDGET(gtk_label_new(_("Photography workflow application\nand RAW developer"))); gtk_label_set_justify(GTK_LABEL(program_desc), GTK_JUSTIFY_RIGHT); + gtk_widget_set_halign(program_desc, GTK_ALIGN_END); gtk_widget_set_name(program_desc, "splashscreen-description"); - GtkWidget *desc_padding = gtk_label_new(NULL); - GtkBox *desc_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); - gtk_box_pack_end(desc_box, desc_padding, FALSE, FALSE, 0); - gtk_box_pack_end(desc_box, program_desc, FALSE, FALSE, 0); - GtkBox *text_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0)); - GtkWidget *padding1 = gtk_label_new(NULL); // ensure that text is vertically centered - GtkWidget *padding2 = gtk_label_new(""); // with respect to logo + GtkWidget *prepare = gtk_label_new(_("get ready to unleash your creativity")); gtk_widget_set_name(prepare, "splashscreen-prepare"); - gtk_box_pack_start(text_box, padding1, TRUE, TRUE, 0); - gtk_box_pack_start(text_box, program_name, FALSE, FALSE, 0); - gtk_box_pack_start(text_box, GTK_WIDGET(desc_box), FALSE, FALSE, 0); - gtk_box_pack_start(text_box, padding2, TRUE, TRUE, 0); - gtk_box_pack_start(text_box, prepare, FALSE, FALSE, 0); - // put the text to the right of the logo/version - gtk_box_pack_start(main_box, GTK_WIDGET(logo_box), FALSE, FALSE, 0); - gtk_box_pack_start(main_box, GTK_WIDGET(text_box), FALSE, FALSE, 0); - // and make that the top portion of the splash screen - gtk_box_pack_start(content, GTK_WIDGET(main_box), FALSE, FALSE, 0); + + dt_gui_box_add(content, + dt_gui_hbox(dt_gui_vbox(logo, version, copyright), + dt_gui_vbox(gtk_label_new(NULL), program_name, program_desc, gtk_label_new(NULL), prepare))); #endif GtkWidget *hbar = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); gtk_widget_set_name(hbar, "splashscreen-separator"); gtk_widget_show(hbar); - gtk_box_pack_start(content, hbar, FALSE, FALSE, 0); - gtk_box_pack_start(content, progress_text, FALSE, FALSE, 0); - remaining_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); - gtk_box_pack_start(remaining_box, dtgtk_button_new(dtgtk_cairo_paint_clock, 0, 0), FALSE, FALSE, 0); - gtk_box_pack_start(remaining_box, remaining_text, FALSE, FALSE, 0); - gtk_box_pack_start(content, GTK_WIDGET(remaining_box), FALSE, FALSE, 0); + remaining_box = dt_gui_hbox(dtgtk_button_new(dtgtk_cairo_paint_clock, 0, 0), remaining_text); gtk_widget_set_halign(GTK_WIDGET(remaining_box), GTK_ALIGN_CENTER); + dt_gui_box_add(content, hbar, progress_text, remaining_box); + gtk_window_set_decorated(GTK_WINDOW(splash_screen), FALSE); gtk_widget_show_all(splash_screen); - gtk_widget_hide(GTK_WIDGET(remaining_box)); + gtk_widget_hide(remaining_box); _process_all_gui_events(); } @@ -263,7 +238,7 @@ void darktable_splash_screen_set_progress(const char *msg) gtk_widget_show(progress_text); if(showing_remaining) { - gtk_widget_hide(GTK_WIDGET(remaining_box)); + gtk_widget_hide(remaining_box); showing_remaining = FALSE; } _process_all_gui_events(); @@ -290,7 +265,7 @@ void darktable_splash_screen_set_progress_percent(const char *msg, char *rem_text = g_strdup_printf(" %4d:%02d", minutes, seconds); gtk_label_set_text(GTK_LABEL(remaining_text), rem_text); g_free(rem_text); - gtk_widget_queue_draw(GTK_WIDGET(remaining_box)); + gtk_widget_queue_draw(remaining_box); } else { diff --git a/src/imageio/format/avif.c b/src/imageio/format/avif.c index 834b0371df2f..bfcfdcc132b4 100644 --- a/src/imageio/format/avif.c +++ b/src/imageio/format/avif.c @@ -833,8 +833,6 @@ void gui_init(dt_imageio_module_format_t *self) self->gui_data = (void *)gui; - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - /* * Bit depth combo box */ @@ -855,8 +853,6 @@ void gui_init(dt_imageio_module_format_t *self) gtk_widget_set_tooltip_text(gui->bit_depth, _("color information stored in an image, higher is better")); - gtk_box_pack_start(GTK_BOX(self->widget), gui->bit_depth, TRUE, TRUE, 0); - /* * Color mode combo box */ @@ -867,8 +863,6 @@ void gui_init(dt_imageio_module_format_t *self) dt_bauhaus_combobox_set_default(gui->color_mode, dt_confgen_get_bool("plugins/imageio/format/avif/color_mode", DT_DEFAULT)); - gtk_box_pack_start(GTK_BOX(self->widget), gui->color_mode, TRUE, TRUE, 0); - /* * Tiling combo box */ @@ -878,11 +872,6 @@ void gui_init(dt_imageio_module_format_t *self) "the loss of image quality is negligible."), tiling, tiling_changed, self, N_("on"), N_("off")); - gtk_box_pack_start(GTK_BOX(self->widget), - gui->tiling, - TRUE, - TRUE, - 0); /* * Compression type combo box @@ -903,12 +892,6 @@ void gui_init(dt_imageio_module_format_t *self) dt_bauhaus_combobox_set_default(gui->compression_type, dt_confgen_get_int("plugins/imageio/format/avif/compression_type", DT_DEFAULT)); - gtk_box_pack_start(GTK_BOX(self->widget), - gui->compression_type, - TRUE, - TRUE, - 0); - /* * Quality combo box */ @@ -929,8 +912,6 @@ void gui_init(dt_imageio_module_format_t *self) dt_bauhaus_slider_set(gui->quality, quality); - gtk_box_pack_start(GTK_BOX(self->widget), gui->quality, TRUE, TRUE, 0); - gtk_widget_set_visible(gui->quality, compression_type != AVIF_COMP_LOSSLESS); gtk_widget_set_no_show_all(gui->quality, TRUE); @@ -946,6 +927,9 @@ void gui_init(dt_imageio_module_format_t *self) "value-changed", G_CALLBACK(quality_changed), NULL); + + self->widget = dt_gui_vbox(gui->bit_depth, gui->color_mode, gui->tiling, + gui->compression_type, gui->quality); } void gui_cleanup(dt_imageio_module_format_t *self) diff --git a/src/imageio/format/j2k.c b/src/imageio/format/j2k.c index 677625ddc7e9..a04135a6c69b 100644 --- a/src/imageio/format/j2k.c +++ b/src/imageio/format/j2k.c @@ -660,7 +660,6 @@ void gui_init(dt_imageio_module_format_t *self) { dt_imageio_j2k_gui_t *gui = malloc(sizeof(dt_imageio_j2k_gui_t)); self->gui_data = (void *)gui; - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); const int preset_last = dt_conf_get_int("plugins/imageio/format/j2k/preset"); const int quality_last = dt_conf_get_int("plugins/imageio/format/j2k/quality"); @@ -673,7 +672,6 @@ void gui_init(dt_imageio_module_format_t *self) 0); dt_bauhaus_widget_set_label(gui->quality, NULL, N_("quality")); dt_bauhaus_slider_set(gui->quality, quality_last); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(gui->quality), TRUE, TRUE, 0); g_signal_connect(G_OBJECT(gui->quality), "value-changed", G_CALLBACK(quality_changed), NULL); DT_BAUHAUS_COMBOBOX_NEW_FULL(gui->preset, self, NULL, N_("DCP mode"), NULL, @@ -682,7 +680,8 @@ void gui_init(dt_imageio_module_format_t *self) N_("Cinema2K, 24FPS"), N_("Cinema2K, 48FPS"), N_("Cinema4K, 24FPS")); - gtk_box_pack_start(GTK_BOX(self->widget), gui->preset, TRUE, TRUE, 0); + + self->widget = dt_gui_vbox(gui->quality, gui->preset); // TODO: options for "off" } diff --git a/src/imageio/format/jpeg.c b/src/imageio/format/jpeg.c index 6fa2ac611860..6498f2587c1b 100644 --- a/src/imageio/format/jpeg.c +++ b/src/imageio/format/jpeg.c @@ -569,8 +569,6 @@ void gui_init(dt_imageio_module_format_t *self) dt_conf_get_int("plugins/imageio/format/jpeg/subsample"); // construct gui with jpeg specific options: - GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - self->widget = box; // quality slider g->quality = dt_bauhaus_slider_new_with_range ((dt_iop_module_t*)self, @@ -582,7 +580,6 @@ void gui_init(dt_imageio_module_format_t *self) dt_bauhaus_widget_set_label(g->quality, NULL, N_("quality")); dt_bauhaus_slider_set(g->quality, dt_conf_get_int("plugins/imageio/format/jpeg/quality")); - gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(g->quality), TRUE, TRUE, 0); g_signal_connect(G_OBJECT(g->quality), "value-changed", G_CALLBACK(quality_changed), NULL); @@ -602,8 +599,7 @@ void gui_init(dt_imageio_module_format_t *self) self, N_("auto"), N_("4:4:4"), N_("4:4:0"), N_("4:2:2"), N_("4:2:0")); - gtk_box_pack_start(GTK_BOX(box), g->subsample, TRUE, TRUE, 0); - + self->widget = dt_gui_vbox(g->quality, g->subsample); } void gui_cleanup(dt_imageio_module_format_t *self) diff --git a/src/imageio/format/jxl.c b/src/imageio/format/jxl.c index 951ec105e83e..d80101b55c00 100644 --- a/src/imageio/format/jxl.c +++ b/src/imageio/format/jxl.c @@ -573,9 +573,6 @@ void gui_init(dt_imageio_module_format_t *self) if(!gui) return; self->gui_data = gui; - GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - self->widget = box; - // bits per sample combobox const int bpp_enum = _bpp_to_enum(dt_conf_get_int("plugins/imageio/format/jxl/bpp")); @@ -583,7 +580,6 @@ void gui_init(dt_imageio_module_format_t *self) NULL, bpp_enum, bpp_changed, gui, N_("8 bit"), N_("10 bit"), N_("12 bit"), N_("16 bit"), N_("32 bit (float)")); - gtk_box_pack_start(GTK_BOX(box), gui->bpp, TRUE, TRUE, 0); // pixel type combobox const int pixel_type = dt_conf_get_bool("plugins/imageio/format/jxl/pixel_type") & 1; @@ -594,7 +590,6 @@ void gui_init(dt_imageio_module_format_t *self) dt_bauhaus_combobox_set_default(gui->pixel_type, dt_confgen_get_bool("plugins/imageio/format/jxl/pixel_type", DT_DEFAULT) & 1); - gtk_box_pack_start(GTK_BOX(box), gui->pixel_type, TRUE, TRUE, 0); gtk_widget_set_visible(gui->pixel_type, bpp_enum == 3); gtk_widget_set_no_show_all(gui->pixel_type, TRUE); @@ -612,7 +607,6 @@ void gui_init(dt_imageio_module_format_t *self) _("the quality of the output image\n0-29 = very lossy\n30-99 = JPEG " "quality comparable\n100 = lossless")); g_signal_connect(G_OBJECT(gui->quality), "value-changed", G_CALLBACK(quality_changed), gui); - gtk_box_pack_start(GTK_BOX(box), gui->quality, TRUE, TRUE, 0); // encoding color profile combobox const int original = dt_conf_get_bool("plugins/imageio/format/jxl/original") & 1; @@ -626,7 +620,6 @@ void gui_init(dt_imageio_module_format_t *self) dt_bauhaus_combobox_set_default(gui->original, dt_confgen_get_bool("plugins/imageio/format/jxl/original", DT_DEFAULT) & 1); - gtk_box_pack_start(GTK_BOX(box), gui->original, TRUE, TRUE, 0); gtk_widget_set_visible(gui->original, quality < 100); gtk_widget_set_no_show_all(gui->original, TRUE); @@ -642,7 +635,6 @@ void gui_init(dt_imageio_module_format_t *self) _("the effort used to encode the image, higher efforts will have " "better results at the expense of longer encoding times")); g_signal_connect(G_OBJECT(gui->effort), "value-changed", G_CALLBACK(effort_changed), NULL); - gtk_box_pack_start(GTK_BOX(box), gui->effort, TRUE, TRUE, 0); // decoding speed (tier) slider gui->tier = dt_bauhaus_slider_new_with_range( @@ -654,7 +646,9 @@ void gui_init(dt_imageio_module_format_t *self) gtk_widget_set_tooltip_text(gui->tier, _("the preferred decoding speed with some sacrifice of quality")); g_signal_connect(G_OBJECT(gui->tier), "value-changed", G_CALLBACK(tier_changed), NULL); - gtk_box_pack_start(GTK_BOX(box), gui->tier, TRUE, TRUE, 0); + + self->widget = dt_gui_vbox(gui->bpp, gui->pixel_type, gui->quality, + gui->original, gui->effort, gui->tier); } void gui_cleanup(dt_imageio_module_format_t *self) diff --git a/src/imageio/format/png.c b/src/imageio/format/png.c index be8c1b26a9a9..dcafda40de64 100644 --- a/src/imageio/format/png.c +++ b/src/imageio/format/png.c @@ -680,15 +680,12 @@ void gui_init(dt_imageio_module_format_t *self) if(dt_conf_key_exists("plugins/imageio/format/png/compression")) compression = dt_conf_get_int("plugins/imageio/format/png/compression"); - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - // Bit depth combo box DT_BAUHAUS_COMBOBOX_NEW_FULL(gui->bit_depth, self, NULL, N_("bit depth"), NULL, 0, bit_depth_changed, self, N_("8 bit"), N_("16 bit")); if(bpp == 16) dt_bauhaus_combobox_set(gui->bit_depth, 1); - gtk_box_pack_start(GTK_BOX(self->widget), gui->bit_depth, TRUE, TRUE, 0); // Compression level slider gui->compression = dt_bauhaus_slider_new_with_range @@ -700,9 +697,10 @@ void gui_init(dt_imageio_module_format_t *self) 0); dt_bauhaus_widget_set_label(gui->compression, NULL, N_("compression")); dt_bauhaus_slider_set(gui->compression, compression); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(gui->compression), TRUE, TRUE, 0); g_signal_connect(G_OBJECT(gui->compression), "value-changed", G_CALLBACK(compression_level_changed), NULL); + + self->widget = dt_gui_vbox(gui->bit_depth, gui->compression); } void gui_cleanup(dt_imageio_module_format_t *self) diff --git a/src/imageio/format/tiff.c b/src/imageio/format/tiff.c index da86ac8b700b..0c3836fc2000 100644 --- a/src/imageio/format/tiff.c +++ b/src/imageio/format/tiff.c @@ -876,16 +876,12 @@ void gui_init(dt_imageio_module_format_t *self) const int compresslevel = dt_conf_get_int("plugins/imageio/format/tiff/compresslevel"); const int shortmode = dt_conf_get_bool("plugins/imageio/format/tiff/shortfile"); - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - // Bit depth combo box DT_BAUHAUS_COMBOBOX_NEW_FULL(gui->bpp, self, NULL, N_("bit depth"), NULL, bpp == 16 ? 1 : bpp == 32 ? 2 : 0, bpp_combobox_changed, gui, N_("8 bit"), N_("16 bit"), N_("32 bit (float)")); - gtk_box_pack_start(GTK_BOX(self->widget), gui->bpp, TRUE, TRUE, 0); - // Pixel format combo box DT_BAUHAUS_COMBOBOX_NEW_FULL(gui->pixelformat, self, NULL, N_("pixel type"), NULL, pixelformat, @@ -897,7 +893,6 @@ void gui_init(dt_imageio_module_format_t *self) #else gtk_widget_set_visible(gui->pixelformat, FALSE); #endif - gtk_box_pack_start(GTK_BOX(self->widget), gui->pixelformat, TRUE, TRUE, 0); gtk_widget_set_no_show_all(gui->pixelformat, TRUE); @@ -907,7 +902,6 @@ void gui_init(dt_imageio_module_format_t *self) N_("deflate with predictor")); dt_bauhaus_combobox_set_default(gui->compress, dt_confgen_get_int("plugins/imageio/format/tiff/compress", DT_DEFAULT)); - gtk_box_pack_start(GTK_BOX(self->widget), gui->compress, TRUE, TRUE, 0); // Compression level slider gui->compresslevel = dt_bauhaus_slider_new_with_range( @@ -916,7 +910,6 @@ void gui_init(dt_imageio_module_format_t *self) dt_confgen_get_int("plugins/imageio/format/tiff/compresslevel", DT_DEFAULT), 0); dt_bauhaus_widget_set_label(gui->compresslevel, NULL, N_("compression level")); dt_bauhaus_slider_set(gui->compresslevel, compresslevel); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(gui->compresslevel), TRUE, TRUE, 0); g_signal_connect(G_OBJECT(gui->compresslevel), "value-changed", G_CALLBACK(compress_level_changed), NULL); gtk_widget_set_visible(gui->compresslevel, compress != 0); @@ -928,7 +921,8 @@ void gui_init(dt_imageio_module_format_t *self) shortfile_combobox_changed, self, N_("no"), N_("yes")); dt_bauhaus_combobox_set_default(gui->shortfiles, dt_confgen_get_bool("plugins/imageio/format/tiff/shortfile", DT_DEFAULT)); - gtk_box_pack_start(GTK_BOX(self->widget), gui->shortfiles, TRUE, TRUE, 0); + + self->widget = dt_gui_vbox(gui->bpp, gui->pixelformat, gui->compress, gui->compresslevel, gui->shortfiles); } void gui_cleanup(dt_imageio_module_format_t *self) diff --git a/src/imageio/format/webp.c b/src/imageio/format/webp.c index a8acd18f7497..549c6a97e9ec 100644 --- a/src/imageio/format/webp.c +++ b/src/imageio/format/webp.c @@ -409,12 +409,9 @@ void gui_init(dt_imageio_module_format_t *self) const int quality = dt_conf_get_int("plugins/imageio/format/webp/quality"); const int hint = dt_conf_get_int("plugins/imageio/format/webp/hint"); - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - DT_BAUHAUS_COMBOBOX_NEW_FULL(gui->compression, self, NULL, N_("compression"), NULL, comp_type, compression_changed, self, N_("lossy"), N_("lossless")); - gtk_box_pack_start(GTK_BOX(self->widget), gui->compression, TRUE, TRUE, 0); gui->quality = dt_bauhaus_slider_new_with_range((dt_iop_module_t*)self, dt_confgen_get_int("plugins/imageio/format/webp/quality", DT_MIN), @@ -427,7 +424,6 @@ void gui_init(dt_imageio_module_format_t *self) "for lossless, 0 is the fastest but gives larger files compared\n" "to the slowest 100.")); dt_bauhaus_slider_set(gui->quality, quality); - gtk_box_pack_start(GTK_BOX(self->widget), gui->quality, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(gui->quality), "value-changed", G_CALLBACK(quality_changed), NULL); gtk_widget_set_visible(gui->quality, comp_type != webp_lossless); @@ -440,7 +436,8 @@ void gui_init(dt_imageio_module_format_t *self) "graphic: discrete tone image (graph, map-tile etc)"), hint, hint_combobox_changed, self, N_("default"), N_("picture"), N_("photo"), N_("graphic")); - gtk_box_pack_start(GTK_BOX(self->widget), gui->hint, TRUE, TRUE, 0); + + self->widget = dt_gui_vbox(gui->compression, gui->quality, gui->hint); } void gui_cleanup(dt_imageio_module_format_t *self) diff --git a/src/imageio/format/xcf.c b/src/imageio/format/xcf.c index 420e0b882d03..647d455ed62d 100644 --- a/src/imageio/format/xcf.c +++ b/src/imageio/format/xcf.c @@ -354,14 +354,12 @@ void gui_init(dt_imageio_module_format_t *self) bpp = atoi(conf_bpp); } - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - // Bit depth combo box DT_BAUHAUS_COMBOBOX_NEW_FULL(gui->bpp, self, NULL, N_("bit depth"), NULL, bpp == 16 ? 1 : bpp == 32 ? 2 : 0, bpp_combobox_changed, NULL, N_("8 bit"), N_("16 bit"), N_("32 bit (float)")); - gtk_box_pack_start(GTK_BOX(self->widget), gui->bpp, TRUE, TRUE, 0); + self->widget = dt_gui_vbox(gui->bpp); } void gui_cleanup(dt_imageio_module_format_t *self) diff --git a/src/imageio/storage/disk.c b/src/imageio/storage/disk.c index b0ef54b5f637..286c5cbaf61b 100644 --- a/src/imageio/storage/disk.c +++ b/src/imageio/storage/disk.c @@ -266,10 +266,6 @@ void gui_init(dt_imageio_module_storage_t *self) { disk_t *d = malloc(sizeof(disk_t)); self->gui_data = (void *)d; - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - - GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), TRUE, FALSE, 0); d->entry = GTK_ENTRY(dt_action_entry_new @@ -280,12 +276,10 @@ void gui_init(dt_imageio_module_storage_t *self) dt_conf_get_string_const("plugins/imageio/storage/disk/file_directory"))); dt_gtkentry_setup_completion(d->entry, dt_gtkentry_get_default_path_compl_list()); gtk_editable_set_position(GTK_EDITABLE(d->entry), -1); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(d->entry), TRUE, TRUE, 0); GtkWidget *widget = dtgtk_button_new(dtgtk_cairo_paint_directory, CPF_NONE, NULL); gtk_widget_set_name(widget, "non-flat"); gtk_widget_set_tooltip_text(widget, _("select directory")); - gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(button_clicked), self); DT_BAUHAUS_COMBOBOX_NEW_FULL(d->onsave_action, self, NULL, N_("on conflict"), NULL, @@ -295,7 +289,8 @@ void gui_init(dt_imageio_module_storage_t *self) N_("overwrite"), N_("overwrite if changed"), N_("skip")); - gtk_box_pack_start(GTK_BOX(self->widget), d->onsave_action, TRUE, TRUE, 0); + + self->widget = dt_gui_vbox(dt_gui_hbox(d->entry, widget), d->onsave_action); } void gui_cleanup(dt_imageio_module_storage_t *self) diff --git a/src/imageio/storage/gallery.c b/src/imageio/storage/gallery.c index 84445a826d93..f483d6a0dfc5 100644 --- a/src/imageio/storage/gallery.c +++ b/src/imageio/storage/gallery.c @@ -190,10 +190,6 @@ void gui_init(dt_imageio_module_storage_t *self) { gallery_t *d = malloc(sizeof(gallery_t)); self->gui_data = (void *)d; - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_pack_start(GTK_BOX(self->widget), hbox, TRUE, TRUE, 0); - GtkWidget *widget; d->entry = GTK_ENTRY @@ -205,24 +201,22 @@ void gui_init(dt_imageio_module_storage_t *self) "type '$(' to activate the completion and see the list of variables"), dt_conf_get_string_const("plugins/imageio/storage/gallery/file_directory"))); dt_gtkentry_setup_completion(d->entry, dt_gtkentry_get_default_path_compl_list()); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(d->entry), TRUE, TRUE, 0); - widget = dtgtk_button_new(dtgtk_cairo_paint_directory, CPF_NONE, NULL); + GtkWidget *widget = dtgtk_button_new(dtgtk_cairo_paint_directory, CPF_NONE, NULL); gtk_widget_set_name(widget, "non-flat"); gtk_widget_set_tooltip_text(widget, _("select directory")); - gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(button_clicked), self); - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_pack_start(GTK_BOX(self->widget), hbox, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(hbox), dt_ui_label_new(_("title")), FALSE, FALSE, 0); d->title_entry = GTK_ENTRY(dt_action_entry_new (DT_ACTION(self), N_("title"), G_CALLBACK(title_changed_callback), self, _("enter the title of the website"), dt_conf_get_string_const("plugins/imageio/storage/gallery/title"))); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(d->title_entry), TRUE, TRUE, 0); + + self->widget = dt_gui_vbox + (dt_gui_hbox(d->entry, widget), + dt_gui_hbox(dt_ui_label_new(_("title")), d->title_entry)); } void gui_cleanup(dt_imageio_module_storage_t *self) diff --git a/src/imageio/storage/latex.c b/src/imageio/storage/latex.c index 8aaeda24cbb4..edb9ede85e52 100644 --- a/src/imageio/storage/latex.c +++ b/src/imageio/storage/latex.c @@ -181,34 +181,25 @@ void gui_init(dt_imageio_module_storage_t *self) { latex_t *d = malloc(sizeof(latex_t)); self->gui_data = (void *)d; - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_pack_start(GTK_BOX(self->widget), hbox, TRUE, TRUE, 0); - GtkWidget *widget; d->entry = GTK_ENTRY(dt_action_entry_new(DT_ACTION(self), N_("path"), G_CALLBACK(entry_changed_callback), self, _("enter the path where to put exported images\nvariables support bash like string manipulation\n" "type '$(' to activate the completion and see the list of variables"), dt_conf_get_string_const("plugins/imageio/storage/latex/file_directory"))); dt_gtkentry_setup_completion(d->entry, dt_gtkentry_get_default_path_compl_list()); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(d->entry), TRUE, TRUE, 0); - widget = dtgtk_button_new(dtgtk_cairo_paint_directory, CPF_NONE, NULL); + GtkWidget *widget = dtgtk_button_new(dtgtk_cairo_paint_directory, CPF_NONE, NULL); gtk_widget_set_name(widget, "non-flat"); gtk_widget_set_tooltip_text(widget, _("select directory")); - gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(button_clicked), self); - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(10)); - gtk_box_pack_start(GTK_BOX(self->widget), hbox, TRUE, TRUE, 0); - - gtk_box_pack_start(GTK_BOX(hbox), dt_ui_label_new(_("title")), FALSE, FALSE, 0); - d->title_entry = GTK_ENTRY(dt_action_entry_new(DT_ACTION(self), N_("path"), G_CALLBACK(title_changed_callback), self, _("enter the title of the book"), dt_conf_get_string_const("plugins/imageio/storage/latex/title"))); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(d->title_entry), TRUE, TRUE, 0); + self->widget = dt_gui_vbox + (dt_gui_hbox(d->entry, widget), + dt_gui_hbox(dt_ui_label_new(_("title")), d->title_entry)); // TODO: support title, author, subject, keywords (collect tags?) } diff --git a/src/imageio/storage/piwigo.c b/src/imageio/storage/piwigo.c index 2535669380bc..b2130ebe4cb9 100644 --- a/src/imageio/storage/piwigo.c +++ b/src/imageio/storage/piwigo.c @@ -1015,8 +1015,6 @@ void gui_init(dt_imageio_module_storage_t *self) ui->accounts = NULL; ui->api = NULL; - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - _piwigo_load_account(ui); gchar *server = dt_conf_get_string("plugins/imageio/storage/export/piwigo/server"); @@ -1024,8 +1022,6 @@ void gui_init(dt_imageio_module_storage_t *self) // look for last server information _piwigo_account_t *last_account = _piwigo_get_account(ui, server); - GtkWidget *hbox, *label, *button; - // account ui->account_list = dt_bauhaus_combobox_new_action(DT_ACTION(self)); dt_bauhaus_widget_set_label(ui->account_list, NULL, N_("accounts")); @@ -1040,10 +1036,8 @@ void gui_init(dt_imageio_module_storage_t *self) gtk_widget_set_hexpand(ui->account_list, TRUE); g_signal_connect(G_OBJECT(ui->account_list), "value-changed", G_CALLBACK(_piwigo_account_changed), (gpointer)ui); - gtk_box_pack_start(GTK_BOX(self->widget), ui->account_list, FALSE, FALSE, 0); // server - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(10)); ui->server_entry = GTK_ENTRY (dt_action_entry_new (DT_ACTION(self), @@ -1056,13 +1050,9 @@ void gui_init(dt_imageio_module_storage_t *self) last_account ? last_account->server : "piwigo.com")); gtk_widget_set_hexpand(GTK_WIDGET(ui->server_entry), TRUE); - gtk_box_pack_start(GTK_BOX(hbox), dt_ui_label_new(_("server")), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui->server_entry), TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), TRUE, TRUE, 0); g_free(server); // login - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(10)); ui->user_entry = GTK_ENTRY (dt_action_entry_new (DT_ACTION(self), @@ -1073,12 +1063,8 @@ void gui_init(dt_imageio_module_storage_t *self) last_account ? last_account->username : "")); gtk_widget_set_hexpand(GTK_WIDGET(ui->user_entry), TRUE); - gtk_box_pack_start(GTK_BOX(hbox), dt_ui_label_new(_("user")), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui->user_entry), TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), TRUE, TRUE, 0); // password - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(10)); ui->pwd_entry = GTK_ENTRY(dt_action_entry_new(DT_ACTION(self), N_("password"), @@ -1086,23 +1072,17 @@ void gui_init(dt_imageio_module_storage_t *self) last_account ? last_account->password : "")); gtk_entry_set_visibility(GTK_ENTRY(ui->pwd_entry), FALSE); gtk_widget_set_hexpand(GTK_WIDGET(ui->pwd_entry), TRUE); - gtk_box_pack_start(GTK_BOX(hbox), dt_ui_label_new(_("password")), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui->pwd_entry), TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), TRUE, TRUE, 0); // login button - button = gtk_button_new_with_label(_("login")); - gtk_widget_set_tooltip_text(button, _("Piwigo login")); - g_signal_connect(G_OBJECT(button), "clicked", + GtkWidget *login_button = gtk_button_new_with_label(_("login")); + gtk_widget_set_tooltip_text(login_button, _("Piwigo login")); + g_signal_connect(G_OBJECT(login_button), "clicked", G_CALLBACK(_piwigo_login_clicked), self); - gtk_box_pack_start(GTK_BOX(self->widget), button, FALSE, FALSE, 0); // status area ui->status_label = GTK_LABEL(gtk_label_new(NULL)); gtk_label_set_ellipsize(ui->status_label, PANGO_ELLIPSIZE_END); gtk_widget_set_halign(GTK_WIDGET(ui->status_label), GTK_ALIGN_START); - gtk_box_pack_start(GTK_BOX(self->widget), - GTK_WIDGET(ui->status_label), FALSE, FALSE, 0); // select account if(account_index != -1) @@ -1116,56 +1096,38 @@ void gui_init(dt_imageio_module_storage_t *self) N_("friends"), N_("family"), N_("you")); - gtk_box_pack_start(GTK_BOX(self->widget), ui->permission_list, FALSE, FALSE, 0); // album list - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - ui->album_list = dt_bauhaus_combobox_new_action(DT_ACTION(self)); // Available albums dt_bauhaus_widget_set_label(ui->album_list, NULL, N_("album")); g_signal_connect(G_OBJECT(ui->album_list), "value-changed", G_CALLBACK(_piwigo_album_changed), (gpointer)ui); gtk_widget_set_sensitive(ui->album_list, FALSE); - gtk_box_pack_start(GTK_BOX(hbox), ui->album_list, TRUE, TRUE, 0); - button = dtgtk_button_new(dtgtk_cairo_paint_refresh, CPF_NONE, NULL); - gtk_widget_set_tooltip_text(button, _("refresh album list")); - g_signal_connect(G_OBJECT(button), "clicked", + GtkWidget *refresh_button = dtgtk_button_new(dtgtk_cairo_paint_refresh, CPF_NONE, NULL); + gtk_widget_set_tooltip_text(refresh_button, _("refresh album list")); + g_signal_connect(G_OBJECT(refresh_button), "clicked", G_CALLBACK(_piwigo_refresh_clicked), (gpointer)ui); - gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); - - gtk_box_pack_start(GTK_BOX(self->widget), hbox, FALSE, FALSE, 0); // new album - ui->create_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0)); - gtk_widget_set_no_show_all(GTK_WIDGET(ui->create_box), TRUE); - gtk_box_pack_start(GTK_BOX(self->widget), - GTK_WIDGET(ui->create_box), FALSE, FALSE, 0); - - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - - label = gtk_label_new(_("title")); - g_object_set(G_OBJECT(label), "xalign", 0.0, (gchar *)0); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - ui->new_album_entry = GTK_ENTRY(gtk_entry_new()); // Album title gtk_entry_set_text(ui->new_album_entry, _("new album")); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui->new_album_entry), TRUE, TRUE, 0); gtk_entry_set_width_chars(GTK_ENTRY(ui->new_album_entry), 0); - gtk_box_pack_start(ui->create_box, hbox, FALSE, FALSE, 0); - // parent album list ui->parent_album_list = dt_bauhaus_combobox_new_action(DT_ACTION(self)); // Available albums dt_bauhaus_widget_set_label(ui->parent_album_list, NULL, N_("parent album")); gtk_widget_set_sensitive(ui->parent_album_list, TRUE); - gtk_box_pack_start(ui->create_box, ui->parent_album_list, TRUE, TRUE, 0); + + ui->create_box = GTK_BOX(dt_gui_vbox + (dt_gui_hbox(dt_ui_label_new(_("title")), ui->new_album_entry), + ui->parent_album_list)); + gtk_widget_set_no_show_all(GTK_WIDGET(ui->create_box), TRUE); _piwigo_set_status(ui, _("click login button to start"), "#ffffff"); // filename pattern - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(10)); ui->filename_pattern_entry = GTK_ENTRY(dt_action_entry_new (DT_ACTION(self), @@ -1178,9 +1140,6 @@ void gui_init(dt_imageio_module_storage_t *self) dt_conf_get_string_const("plugins/imageio/storage/export/piwigo/filename_pattern"))); dt_gtkentry_setup_completion(ui->filename_pattern_entry, dt_gtkentry_get_default_path_compl_list()); gtk_editable_set_position(GTK_EDITABLE(ui->filename_pattern_entry), -1); - gtk_box_pack_start(GTK_BOX(hbox), dt_ui_label_new(_("filename pattern")), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui->filename_pattern_entry), TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), TRUE, TRUE, 0); // action on conflict ui->conflict_action = dt_bauhaus_combobox_new(NULL); @@ -1189,10 +1148,20 @@ void gui_init(dt_imageio_module_storage_t *self) dt_bauhaus_combobox_add(ui->conflict_action, _("skip")); dt_bauhaus_combobox_add(ui->conflict_action, _("update metadata")); dt_bauhaus_combobox_add(ui->conflict_action, _("overwrite")); - gtk_box_pack_start(GTK_BOX(self->widget), ui->conflict_action, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(ui->conflict_action), "value-changed", G_CALLBACK(_piwigo_conflict_changed), self); dt_bauhaus_combobox_set(ui->conflict_action, dt_conf_get_int("storage/piwigo/conflict")); + + self->widget = dt_gui_vbox + (ui->account_list, + dt_gui_hbox(dt_ui_label_new(_("server")), ui->server_entry), + dt_gui_hbox(dt_ui_label_new(_("user")), ui->user_entry), + dt_gui_hbox(dt_ui_label_new(_("password")), ui->pwd_entry), + login_button, ui->status_label, ui->permission_list, + dt_gui_hbox(ui->album_list, refresh_button), + ui->create_box, + dt_gui_hbox(dt_ui_label_new(_("filename pattern")), ui->filename_pattern_entry), + ui->conflict_action); } void gui_cleanup(dt_imageio_module_storage_t *self) diff --git a/src/iop/ashift.c b/src/iop/ashift.c index 4112f48a3d63..41cc0695a540 100644 --- a/src/iop/ashift.c +++ b/src/iop/ashift.c @@ -6037,8 +6037,7 @@ void gui_init(dt_iop_module_t *self) self->widget = main_box; - GtkWidget *helpers = dt_ui_section_label_new(C_("section", "perspective")); - gtk_box_pack_start(GTK_BOX(self->widget), helpers, TRUE, TRUE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "perspective"))); GtkGrid *auto_grid = GTK_GRID(gtk_grid_new()); gtk_grid_set_row_spacing(auto_grid, 2 * DT_BAUHAUS_SPACE); @@ -6073,9 +6072,7 @@ void gui_init(dt_iop_module_t *self) gtk_grid_attach(auto_grid, g->fit_both, 3, 1, 1, 1); gtk_widget_show_all(GTK_WIDGET(auto_grid)); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(auto_grid), TRUE, TRUE, 0); - - self->widget = main_box; + dt_gui_box_add(self->widget, auto_grid); gtk_widget_set_tooltip_text (g->rotation, diff --git a/src/iop/atrous.c b/src/iop/atrous.c index 587aba8142ec..b0dade2b8912 100644 --- a/src/iop/atrous.c +++ b/src/iop/atrous.c @@ -1782,8 +1782,6 @@ void gui_init(dt_iop_module_t *self) g->mouse_radius = 1.0 / BANDS; g->in_curve = FALSE; - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - static struct dt_action_def_t notebook_def = { }; g->channel_tabs = dt_ui_notebook_new(¬ebook_def); dt_action_define_iop(self, NULL, N_("channel"), @@ -1799,14 +1797,12 @@ void gui_init(dt_iop_module_t *self) gtk_widget_show(gtk_notebook_get_nth_page(g->channel_tabs, g->channel)); gtk_notebook_set_current_page(g->channel_tabs, g->channel); g_signal_connect(G_OBJECT(g->channel_tabs), "switch_page", G_CALLBACK(tab_switch), self); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->channel_tabs), FALSE, FALSE, 0); // graph g->area = GTK_DRAWING_AREA(dt_ui_resize_wrap (NULL, 0, "plugins/darkroom/atrous/graphheight")); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->area), TRUE, TRUE, 0); g_object_set_data(G_OBJECT(g->area), "iop-instance", self); dt_action_define_iop(self, NULL, N_("graph"), @@ -1825,6 +1821,8 @@ void gui_init(dt_iop_module_t *self) g_signal_connect(G_OBJECT(g->area), "scroll-event", G_CALLBACK(area_scrolled), self); + self->widget = dt_gui_vbox(g->channel_tabs, g->area); + // mix slider g->mix = dt_bauhaus_slider_from_params(self, N_("mix")); gtk_widget_set_tooltip_text(g->mix, _("make effect stronger or weaker")); diff --git a/src/iop/basecurve.c b/src/iop/basecurve.c index eeff2a01e454..c1dcc2460db3 100644 --- a/src/iop/basecurve.c +++ b/src/iop/basecurve.c @@ -2138,13 +2138,12 @@ void gui_init(dt_iop_module_t *self) g->selected = -1; g->loglogscale = 0; - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - g->area = GTK_DRAWING_AREA(dtgtk_drawing_area_new_with_height(0)); gtk_widget_set_tooltip_text(GTK_WIDGET(g->area), _("abscissa: input, ordinate: output. works on RGB channels")); g_object_set_data(G_OBJECT(g->area), "iop-instance", self); dt_action_define_iop(self, NULL, N_("curve"), GTK_WIDGET(g->area), NULL); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->area), TRUE, TRUE, 0); + + self->widget = dt_gui_vbox(g->area); g->cmb_preserve_colors = dt_bauhaus_combobox_from_params(self, "preserve_colors"); gtk_widget_set_tooltip_text(g->cmb_preserve_colors, _("method to preserve colors when applying contrast")); @@ -2171,9 +2170,11 @@ void gui_init(dt_iop_module_t *self) "(-1: reduce highlight, +1: reduce shadows)")); gtk_widget_set_no_show_all(g->exposure_bias, TRUE); gtk_widget_set_visible(g->exposure_bias, p->exposure_fusion != 0 ? TRUE : FALSE); + g->logbase = dt_bauhaus_slider_new_with_range(self, 0.0f, 40.0f, 0, 0.0f, 2); dt_bauhaus_widget_set_label(g->logbase, NULL, N_("scale for graph")); - gtk_box_pack_start(GTK_BOX(self->widget), g->logbase , TRUE, TRUE, 0); g_signal_connect(G_OBJECT(g->logbase), "value-changed", G_CALLBACK(logbase_callback), self); + g_signal_connect(G_OBJECT(g->logbase), "value-changed", G_CALLBACK(logbase_callback), self); + dt_gui_box_add(self->widget, g->logbase); gtk_widget_add_events(GTK_WIDGET(g->area), GDK_POINTER_MOTION_MASK | darktable.gui->scroll_mask | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK diff --git a/src/iop/blurs.c b/src/iop/blurs.c index e1dda21f3b23..876c792f7b9c 100644 --- a/src/iop/blurs.c +++ b/src/iop/blurs.c @@ -755,8 +755,6 @@ void gui_init(dt_iop_module_t *self) { dt_iop_blurs_gui_data_t *g = IOP_GUI_ALLOC(blurs); - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - // Image buffer to store the kernel look // Don't recompute it in the drawing function, only when a param is changed // then serve it from cache to the drawing function. @@ -766,7 +764,7 @@ void gui_init(dt_iop_module_t *self) g->area = GTK_DRAWING_AREA(dtgtk_drawing_area_new_with_height(0)); g_signal_connect(G_OBJECT(g->area), "draw", G_CALLBACK(dt_iop_tonecurve_draw), self); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->area), TRUE, TRUE, 0); + self->widget = dt_gui_vbox(g->area); g->radius = dt_bauhaus_slider_from_params(self, "radius"); dt_bauhaus_slider_set_format(g->radius, " px"); @@ -776,6 +774,7 @@ void gui_init(dt_iop_module_t *self) g->blades = dt_bauhaus_slider_from_params(self, "blades"); g->concavity = dt_bauhaus_slider_from_params(self, "concavity"); g->linearity = dt_bauhaus_slider_from_params(self, "linearity"); + g->rotation = dt_bauhaus_slider_from_params(self, "rotation"); dt_bauhaus_slider_set_factor(g->rotation, DEG_TO_RAD); dt_bauhaus_slider_set_format(g->rotation, "°"); @@ -784,7 +783,6 @@ void gui_init(dt_iop_module_t *self) dt_bauhaus_slider_set_factor(g->angle, DEG_TO_RAD); dt_bauhaus_slider_set_format(g->angle, "°"); - g->curvature = dt_bauhaus_slider_from_params(self, "curvature"); g->offset = dt_bauhaus_slider_from_params(self, "offset"); diff --git a/src/iop/borders.c b/src/iop/borders.c index 9e7967b1e6dd..f1acab974a75 100644 --- a/src/iop/borders.c +++ b/src/iop/borders.c @@ -958,7 +958,7 @@ void gui_init(dt_iop_module_t *self) N_("square"), N_("constant border"), N_("custom...")); - gtk_box_pack_start(GTK_BOX(self->widget), g->aspect, TRUE, TRUE, 0); + dt_gui_box_add(self->widget, g->aspect); g->aspect_slider = dt_bauhaus_slider_from_params(self, "aspect"); gtk_widget_set_tooltip_text(g->aspect_slider, _("set the custom aspect ratio\n" @@ -974,7 +974,7 @@ void gui_init(dt_iop_module_t *self) 0, _position_h_changed, self, N_("center"), N_("1/3"), N_("3/8"), N_("5/8"), N_("2/3"), N_("custom...")); - gtk_box_pack_start(GTK_BOX(self->widget), g->pos_h, TRUE, TRUE, 0); + dt_gui_box_add(self->widget, g->pos_h); g->pos_h_slider = dt_bauhaus_slider_from_params(self, "pos_h"); gtk_widget_set_tooltip_text(g->pos_h_slider, _("custom horizontal position")); @@ -985,7 +985,7 @@ void gui_init(dt_iop_module_t *self) 0, _position_v_changed, self, N_("center"), N_("1/3"), N_("3/8"), N_("5/8"), N_("2/3"), N_("custom...")); - gtk_box_pack_start(GTK_BOX(self->widget), g->pos_v, TRUE, TRUE, 0); + dt_gui_box_add(self->widget, g->pos_v); g->pos_v_slider = dt_bauhaus_slider_from_params(self, "pos_v"); gtk_widget_set_tooltip_text(g->pos_v_slider, _("custom vertical position")); @@ -1028,7 +1028,7 @@ void gui_init(dt_iop_module_t *self) _("pick border color from image")); dt_action_define_iop(self, N_("pickers"), N_("border color"), g->border_picker, &dt_action_def_toggle); - gtk_box_pack_start(GTK_BOX(self->widget), box, TRUE, TRUE, 0); + dt_gui_box_add(self->widget, box); box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); label = dtgtk_reset_label_new(_("frame line color"), self, &p->frame_color, 3 * sizeof(float)); @@ -1045,7 +1045,7 @@ void gui_init(dt_iop_module_t *self) _("pick frame line color from image")); dt_action_define_iop(self, N_("pickers"), N_("frame line color"), g->frame_picker, &dt_action_def_toggle); - gtk_box_pack_start(GTK_BOX(self->widget), box, TRUE, TRUE, 0); + dt_gui_box_add(self->widget, box); } // clang-format off diff --git a/src/iop/channelmixerrgb.c b/src/iop/channelmixerrgb.c index 8f4422e5afd5..5fe7352f23ea 100644 --- a/src/iop/channelmixerrgb.c +++ b/src/iop/channelmixerrgb.c @@ -4462,7 +4462,7 @@ void gui_init(dt_iop_module_t *self) gtk_widget_set_tooltip_text(g->color_picker, _("set white balance to detected from area")); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), FALSE, FALSE, 0); + dt_gui_box_add(self->widget, hbox); g->illuminant = dt_bauhaus_combobox_from_params(self, N_("illuminant")); @@ -4482,7 +4482,6 @@ void gui_init(dt_iop_module_t *self) dt_bauhaus_slider_set_format(g->illum_x, "°"); g_signal_connect(G_OBJECT(g->illum_x), "value-changed", G_CALLBACK(_illum_xy_callback), self); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->illum_x), FALSE, FALSE, 0); g->illum_y = dt_bauhaus_slider_new_with_range(self, 0., 100., 0, 0, 1); dt_bauhaus_widget_set_label(g->illum_y, NULL, N_("chroma")); @@ -4490,7 +4489,8 @@ void gui_init(dt_iop_module_t *self) dt_bauhaus_slider_set_hard_max(g->illum_y, ILLUM_Y_MAX); g_signal_connect(G_OBJECT(g->illum_y), "value-changed", G_CALLBACK(_illum_xy_callback), self); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->illum_y), FALSE, FALSE, 0); + + dt_gui_box_add(self->widget, g->illum_x, g->illum_y); g->gamut = dt_bauhaus_slider_from_params(self, "gamut"); dt_bauhaus_slider_set_soft_max(g->gamut, 4.f); @@ -4523,8 +4523,6 @@ void gui_init(dt_iop_module_t *self) 0, NULL, self, N_("correction"), N_("measure")); - gtk_box_pack_start(GTK_BOX(g->csspot.container), - GTK_WIDGET(g->spot_mode), TRUE, TRUE, 0); g_signal_connect(G_OBJECT(g->spot_mode), "value-changed", G_CALLBACK(_spot_settings_changed_callback), self); @@ -4537,57 +4535,31 @@ void gui_init(dt_iop_module_t *self) (g->use_mixing, _("compute the target by taking the channel mixing into account.\n" "if disabled, only the CAT is considered.")); - gtk_box_pack_start(GTK_BOX(g->csspot.container), - GTK_WIDGET(g->use_mixing), TRUE, TRUE, 0); g_signal_connect(G_OBJECT(g->use_mixing), "toggled", G_CALLBACK(_spot_settings_changed_callback), self); - GtkWidget *hhbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, - DT_PIXEL_APPLY_DPI(darktable.bauhaus->quad_width)); - GtkWidget *vvbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - - gtk_box_pack_start(GTK_BOX(vvbox), - dt_ui_section_label_new(C_("section", "input")), FALSE, FALSE, 0); - - g->origin_spot = GTK_WIDGET(gtk_drawing_area_new()); - gtk_widget_set_size_request - (g->origin_spot, 2 * DT_PIXEL_APPLY_DPI(darktable.bauhaus->quad_width), - DT_PIXEL_APPLY_DPI(darktable.bauhaus->quad_width)); + g->origin_spot = gtk_drawing_area_new(); + gtk_widget_set_vexpand(g->origin_spot, TRUE); gtk_widget_set_tooltip_text(GTK_WIDGET(g->origin_spot), _("the input color that should be mapped to the target")); - g_signal_connect(G_OBJECT(g->origin_spot), "draw", G_CALLBACK(_origin_color_draw), self); - gtk_box_pack_start(GTK_BOX(vvbox), g->origin_spot, TRUE, TRUE, 0); g->Lch_origin = gtk_label_new(_("L: \tN/A\nh: \tN/A\nc: \tN/A")); gtk_widget_set_tooltip_text (GTK_WIDGET(g->Lch_origin), _("these LCh coordinates are computed from CIE Lab 1976 coordinates")); - gtk_box_pack_start(GTK_BOX(vvbox), GTK_WIDGET(g->Lch_origin), FALSE, FALSE, 0); - - gtk_box_pack_start(GTK_BOX(hhbox), GTK_WIDGET(vvbox), FALSE, FALSE, DT_BAUHAUS_SPACE); - - vvbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - - gtk_box_pack_start(GTK_BOX(vvbox), - dt_ui_section_label_new(C_("section", "target")), TRUE, TRUE, 0); g->target_spot = GTK_WIDGET(gtk_drawing_area_new()); - gtk_widget_set_size_request - (g->target_spot, 2 * DT_PIXEL_APPLY_DPI(darktable.bauhaus->quad_width), - DT_PIXEL_APPLY_DPI(darktable.bauhaus->quad_width)); + gtk_widget_set_size_request(g->target_spot, -1, DT_PIXEL_APPLY_DPI(darktable.bauhaus->quad_width)); gtk_widget_set_tooltip_text(GTK_WIDGET(g->target_spot), _("the desired target color after mapping")); - g_signal_connect(G_OBJECT(g->target_spot), "draw", G_CALLBACK(_target_color_draw), self); - gtk_box_pack_start(GTK_BOX(vvbox), g->target_spot, TRUE, TRUE, 0); g->lightness_spot = dt_bauhaus_slider_new_with_range(self, 0., LIGHTNESS_MAX, 0, 0, 1); dt_bauhaus_widget_set_label(g->lightness_spot, N_("mapping"), N_("lightness")); dt_bauhaus_slider_set_format(g->lightness_spot, "%"); dt_bauhaus_slider_set_default(g->lightness_spot, 50.f); - gtk_box_pack_start(GTK_BOX(vvbox), GTK_WIDGET(g->lightness_spot), TRUE, TRUE, 0); g_signal_connect(G_OBJECT(g->lightness_spot), "value-changed", G_CALLBACK(_spot_settings_changed_callback), self); @@ -4596,20 +4568,26 @@ void gui_init(dt_iop_module_t *self) dt_bauhaus_widget_set_label(g->hue_spot, N_("mapping"), N_("hue")); dt_bauhaus_slider_set_format(g->hue_spot, "°"); dt_bauhaus_slider_set_default(g->hue_spot, 0.f); - gtk_box_pack_start(GTK_BOX(vvbox), GTK_WIDGET(g->hue_spot), TRUE, TRUE, 0); g_signal_connect(G_OBJECT(g->hue_spot), "value-changed", G_CALLBACK(_spot_settings_changed_callback), self); g->chroma_spot = dt_bauhaus_slider_new_with_range(self, 0., CHROMA_MAX, 0, 0, 1); dt_bauhaus_widget_set_label(g->chroma_spot, N_("mapping"), N_("chroma")); dt_bauhaus_slider_set_default(g->chroma_spot, 0.f); - gtk_box_pack_start(GTK_BOX(vvbox), GTK_WIDGET(g->chroma_spot), TRUE, TRUE, 0); g_signal_connect(G_OBJECT(g->chroma_spot), "value-changed", G_CALLBACK(_spot_settings_changed_callback), self); - gtk_box_pack_start(GTK_BOX(hhbox), GTK_WIDGET(vvbox), TRUE, TRUE, DT_BAUHAUS_SPACE); - - gtk_box_pack_start(GTK_BOX(g->csspot.container), GTK_WIDGET(hhbox), FALSE, FALSE, 0); + dt_gui_box_add(g->csspot.container, + g->spot_mode, g->use_mixing, + dt_gui_hbox( + dt_gui_vbox(dt_ui_section_label_new(C_("section", "input")), + g->origin_spot, g->Lch_origin), + dt_gui_expand( + dt_gui_vbox(dt_ui_section_label_new(C_("section", "target")), + g->target_spot, g->lightness_spot, g->hue_spot, g->chroma_spot) + ))); + + gtk_widget_set_margin_end(gtk_widget_get_parent(g->origin_spot), DT_PIXEL_APPLY_DPI(darktable.bauhaus->quad_width)); dt_gui_collapsible_section_set_label(&g->csspot, _area_mapping_section_text(g)); GtkWidget *first, *second, *third; @@ -4652,9 +4630,7 @@ void gui_init(dt_iop_module_t *self) N_("gray"), N_("output gray"), N_("gray"), FALSE, TRUE, 0.0, 1.0) // start building top level widget - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->notebook), FALSE, FALSE, 0); + self->widget = dt_gui_vbox(g->notebook); const int active_page = dt_conf_get_int("plugins/darkroom/channelmixerrgb/gui_page"); gtk_widget_show(gtk_notebook_get_nth_page(g->notebook, active_page)); gtk_notebook_set_current_page(g->notebook, active_page); @@ -4673,8 +4649,6 @@ void gui_init(dt_iop_module_t *self) g_signal_connect(G_OBJECT(g->cs.toggle), "toggled", G_CALLBACK(_start_profiling_callback), self); - GtkWidget *collapsible = GTK_WIDGET(g->cs.container); - DT_BAUHAUS_COMBOBOX_NEW_FULL (g->checkers_list, self, N_("calibrate"), N_("chart"), _("choose the vendor and the type of your chart"), @@ -4686,7 +4660,6 @@ void gui_init(dt_iop_module_t *self) N_("Datacolor SpyderCheckr 48 pre-2018"), N_("Datacolor SpyderCheckr 48 post-2018"), N_("Datacolor SpyderCheckr Photo")); - gtk_box_pack_start(GTK_BOX(collapsible), GTK_WIDGET(g->checkers_list), TRUE, TRUE, 0); DT_BAUHAUS_COMBOBOX_NEW_FULL (g->optimize, self, N_("calibrate"), N_("optimize for"), @@ -4704,7 +4677,6 @@ void gui_init(dt_iop_module_t *self) N_("sky and water colors"), N_("average delta E"), N_("maximum delta E")); - gtk_box_pack_start(GTK_BOX(collapsible), GTK_WIDGET(g->optimize), TRUE, TRUE, 0); g->safety = dt_bauhaus_slider_new_with_range_and_feedback(self, 0., 1., 0, 0.5, 3, TRUE); dt_bauhaus_widget_set_label(g->safety, N_("calibrate"), N_("patch scale")); @@ -4715,21 +4687,16 @@ void gui_init(dt_iop_module_t *self) "the patches frame cast a shadows on the edges of the patch." )); g_signal_connect(G_OBJECT(g->safety), "value-changed", G_CALLBACK(_safety_changed_callback), self); - gtk_box_pack_start(GTK_BOX(collapsible), GTK_WIDGET(g->safety), TRUE, TRUE, 0); g->label_delta_E = dt_ui_label_new(""); - gtk_box_pack_start(GTK_BOX(collapsible), GTK_WIDGET(g->label_delta_E), TRUE, TRUE, 0); gtk_widget_set_tooltip_text(g->label_delta_E, _("the delta E is using the CIE 2000 formula")); - GtkWidget *toolbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_BAUHAUS_SPACE); - g->button_commit = dtgtk_button_new(dtgtk_cairo_paint_check_mark, 0, NULL); dt_action_define_iop(self, N_("calibrate"), N_("accept"), g->button_commit, &dt_action_def_button); g_signal_connect(G_OBJECT(g->button_commit), "button-press-event", G_CALLBACK(_commit_profile_callback), (gpointer)self); - gtk_box_pack_end(GTK_BOX(toolbar), GTK_WIDGET(g->button_commit), FALSE, FALSE, 0); gtk_widget_set_tooltip_text(g->button_commit, _("accept the computed profile and set it in the module")); @@ -4739,7 +4706,6 @@ void gui_init(dt_iop_module_t *self) g_signal_connect(G_OBJECT(g->button_profile), "button-press-event", G_CALLBACK(_run_profile_callback), (gpointer)self); gtk_widget_set_tooltip_text(g->button_profile, _("recompute the profile")); - gtk_box_pack_end(GTK_BOX(toolbar), GTK_WIDGET(g->button_profile), FALSE, FALSE, 0); g->button_validate = dtgtk_button_new(dtgtk_cairo_paint_softproof, 0, NULL); dt_action_define_iop(self, N_("calibrate"), N_("validate"), @@ -4747,9 +4713,10 @@ void gui_init(dt_iop_module_t *self) g_signal_connect(G_OBJECT(g->button_validate), "button-press-event", G_CALLBACK(_run_validation_callback), (gpointer)self); gtk_widget_set_tooltip_text(g->button_validate, _("check the output delta E")); - gtk_box_pack_end(GTK_BOX(toolbar), GTK_WIDGET(g->button_validate), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(collapsible), GTK_WIDGET(toolbar), FALSE, FALSE, 0); + dt_gui_box_add(g->cs.container, g->checkers_list, g->optimize, g->safety, + g->label_delta_E, dt_gui_hbox(dt_gui_align_right(g->button_validate), + g->button_profile, g->button_commit)); } void gui_cleanup(dt_iop_module_t *self) diff --git a/src/iop/colorbalancergb.c b/src/iop/colorbalancergb.c index 40e6715383b4..91bd90ac39bf 100644 --- a/src/iop/colorbalancergb.c +++ b/src/iop/colorbalancergb.c @@ -1800,7 +1800,7 @@ void gui_init(dt_iop_module_t *self) dt_bauhaus_slider_set_format(g->contrast, "%"); gtk_widget_set_tooltip_text(g->contrast, _("increase the contrast at constant chromaticity")); - gtk_box_pack_start(GTK_BOX(self->widget), dt_ui_section_label_new(C_("section", "linear chroma grading")), FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "linear chroma grading"))); sect = DT_IOP_SECTION_FOR_PARAMS(self, N_("chroma")); g->chroma_global = dt_bauhaus_slider_from_params(self, "chroma_global"); @@ -1824,7 +1824,7 @@ void gui_init(dt_iop_module_t *self) dt_bauhaus_slider_set_format(g->chroma_highlights, "%"); gtk_widget_set_tooltip_text(g->chroma_highlights, _("increase colorfulness at same luminance mostly in highlights")); - gtk_box_pack_start(GTK_BOX(self->widget), dt_ui_section_label_new(C_("section", "perceptual saturation grading")), FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "perceptual saturation grading"))); sect = DT_IOP_SECTION_FOR_PARAMS(self, N_("saturation")); g->saturation_global = dt_bauhaus_slider_from_params(self, "saturation_global"); @@ -1847,7 +1847,7 @@ void gui_init(dt_iop_module_t *self) dt_bauhaus_slider_set_format(g->saturation_highlights, "%"); gtk_widget_set_tooltip_text(g->saturation_highlights, _("increase or decrease saturation proportionally to the original pixel saturation")); - gtk_box_pack_start(GTK_BOX(self->widget), dt_ui_section_label_new(C_("section", "perceptual brilliance grading")), FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "perceptual brilliance grading"))); sect = DT_IOP_SECTION_FOR_PARAMS(self, N_("brilliance")); g->brilliance_global = dt_bauhaus_slider_from_params(self, "brilliance_global"); @@ -1873,7 +1873,7 @@ void gui_init(dt_iop_module_t *self) // Page 4-ways self->widget = dt_ui_notebook_page(g->notebook, N_("4 ways"), _("selective color grading")); - gtk_box_pack_start(GTK_BOX(self->widget), dt_ui_section_label_new(C_("section", "global offset")), FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "global offset"))); sect = DT_IOP_SECTION_FOR_PARAMS(self, N_("offset")); g->global_Y = dt_bauhaus_slider_from_params(sect, "global_Y"); @@ -1893,7 +1893,7 @@ void gui_init(dt_iop_module_t *self) dt_bauhaus_slider_set_format(g->global_C, "%"); gtk_widget_set_tooltip_text(g->global_C, _("chroma of the global color offset")); - gtk_box_pack_start(GTK_BOX(self->widget), dt_ui_section_label_new(C_("section", "shadows lift")), FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "shadows lift"))); sect = DT_IOP_SECTION_FOR_PARAMS(self, N_("lift")); g->shadows_Y = dt_bauhaus_slider_from_params(sect, "shadows_Y"); @@ -1913,7 +1913,7 @@ void gui_init(dt_iop_module_t *self) dt_bauhaus_slider_set_format(g->shadows_C, "%"); gtk_widget_set_tooltip_text(g->shadows_C, _("chroma of the color gain in shadows")); - gtk_box_pack_start(GTK_BOX(self->widget), dt_ui_section_label_new(C_("section", "highlights gain")), FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "highlights gain"))); sect = DT_IOP_SECTION_FOR_PARAMS(self, N_("gain")); g->highlights_Y = dt_bauhaus_slider_from_params(sect, "highlights_Y"); @@ -1933,7 +1933,7 @@ void gui_init(dt_iop_module_t *self) dt_bauhaus_slider_set_format(g->highlights_C, "%"); gtk_widget_set_tooltip_text(g->highlights_C, _("chroma of the color gain in highlights")); - gtk_box_pack_start(GTK_BOX(self->widget), dt_ui_section_label_new(C_("section", "power")), FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "power"))); sect = DT_IOP_SECTION_FOR_PARAMS(self, N_("power")); g->midtones_Y = dt_bauhaus_slider_from_params(sect, "midtones_Y"); @@ -1960,7 +1960,7 @@ void gui_init(dt_iop_module_t *self) gtk_widget_set_tooltip_text(g->saturation_formula, _("choose in which uniform color space the saturation is computed")); - gtk_box_pack_start(GTK_BOX(self->widget), dt_ui_section_label_new(C_("section", "luminance ranges")), FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "luminance ranges"))); g->area = GTK_DRAWING_AREA(dt_ui_resize_wrap(NULL, 0, @@ -1968,7 +1968,7 @@ void gui_init(dt_iop_module_t *self) g_object_set_data(G_OBJECT(g->area), "iop-instance", self); dt_action_define_iop(self, NULL, N_("graph"), GTK_WIDGET(g->area), NULL); g_signal_connect(G_OBJECT(g->area), "draw", G_CALLBACK(dt_iop_tonecurve_draw), self); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->area), FALSE, FALSE, 0); + dt_gui_box_add(self->widget, GTK_WIDGET(g->area)); g->shadows_weight = dt_bauhaus_slider_from_params(self, "shadows_weight"); dt_bauhaus_slider_set_digits(g->shadows_weight, 4); @@ -1994,7 +1994,7 @@ void gui_init(dt_iop_module_t *self) dt_bauhaus_widget_set_quad_toggle(g->highlights_weight, TRUE); g_signal_connect(G_OBJECT(g->highlights_weight), "quad-pressed", G_CALLBACK(mask_callback), self); - gtk_box_pack_start(GTK_BOX(self->widget), dt_ui_section_label_new(C_("section", "threshold")), FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "threshold"))); g->white_fulcrum = dt_color_picker_new(self, DT_COLOR_PICKER_AREA, dt_bauhaus_slider_from_params(self, "white_fulcrum")); dt_bauhaus_slider_set_soft_range(g->white_fulcrum, -2., +2.); @@ -2007,31 +2007,27 @@ void gui_init(dt_iop_module_t *self) dt_bauhaus_slider_set_format(g->grey_fulcrum, "%"); gtk_widget_set_tooltip_text(g->grey_fulcrum, _("peak gray luminance value used to normalize the power function")); - gtk_box_pack_start(GTK_BOX(self->widget), dt_ui_section_label_new(C_("section", "mask preview settings")), FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "mask preview settings"))); - GtkWidget *row1 = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); - gtk_box_pack_start(GTK_BOX(row1), dt_ui_label_new(_("checkerboard color 1")), TRUE, TRUE, 0); g->checker_color_1_picker = gtk_color_button_new(); gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(g->checker_color_1_picker), FALSE); gtk_color_button_set_title(GTK_COLOR_BUTTON(g->checker_color_1_picker), _("select color of the checkerboard from a swatch")); - gtk_box_pack_start(GTK_BOX(row1), GTK_WIDGET(g->checker_color_1_picker), FALSE, FALSE, 0); g_signal_connect(G_OBJECT(g->checker_color_1_picker), "color-set", G_CALLBACK(checker_1_picker_callback), self); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(row1), FALSE, FALSE, 0); - GtkWidget *row2 = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); - gtk_box_pack_start(GTK_BOX(row2), dt_ui_label_new(_("checkerboard color 2")), TRUE, TRUE, 0); g->checker_color_2_picker = gtk_color_button_new(); gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(g->checker_color_2_picker), FALSE); gtk_color_button_set_title(GTK_COLOR_BUTTON(g->checker_color_2_picker), _("select color of the checkerboard from a swatch")); - gtk_box_pack_start(GTK_BOX(row2), GTK_WIDGET(g->checker_color_2_picker), FALSE, FALSE, 0); g_signal_connect(G_OBJECT(g->checker_color_2_picker), "color-set", G_CALLBACK(checker_2_picker_callback), self); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(row2), FALSE, FALSE, 0); g->checker_size = dt_bauhaus_slider_new_with_range(self, 2., 32., 0, 8., 0); dt_bauhaus_slider_set_format(g->checker_size, _(" px")); dt_bauhaus_widget_set_label(g->checker_size, NULL, _("checkerboard size")); g_signal_connect(G_OBJECT(g->checker_size), "value-changed", G_CALLBACK(checker_size_callback), self); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->checker_size), FALSE, FALSE, 0); + + dt_gui_box_add(self->widget, + dt_gui_hbox(dt_gui_expand(dt_ui_label_new(_("checkerboard color 1"))), g->checker_color_1_picker), + dt_gui_hbox(dt_gui_expand(dt_ui_label_new(_("checkerboard color 2"))), g->checker_color_2_picker), + g->checker_size); // Init the conf keys if they don't exist if(!dt_conf_key_exists("plugins/darkroom/colorbalancergb/checker1/red")) diff --git a/src/iop/colorchecker.c b/src/iop/colorchecker.c index c29cc0d918b6..1dd88e7d4879 100644 --- a/src/iop/colorchecker.c +++ b/src/iop/colorchecker.c @@ -1531,12 +1531,8 @@ void gui_init(dt_iop_module_t *self) dt_iop_colorchecker_gui_data_t *g = IOP_GUI_ALLOC(colorchecker); const dt_iop_colorchecker_params_t *const p = self->default_params; - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - // custom 24-patch widget in addition to combo box g->area = dtgtk_drawing_area_new_with_aspect_ratio(4.0/6.0); - gtk_box_pack_start(GTK_BOX(self->widget), g->area, TRUE, TRUE, 0); - gtk_widget_add_events(GTK_WIDGET(g->area), GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -1616,12 +1612,8 @@ void gui_init(dt_iop_module_t *self) dt_bauhaus_combobox_add(g->combobox_target, _("relative")); dt_bauhaus_combobox_add(g->combobox_target, _("absolute")); - gtk_box_pack_start(GTK_BOX(self->widget), g->combobox_patch, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), g->scale_L, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), g->scale_a, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), g->scale_b, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), g->scale_C, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), g->combobox_target, TRUE, TRUE, 0); + self->widget = dt_gui_vbox(g->area, g->combobox_patch, g->scale_L, g->scale_a, + g->scale_b, g->scale_C, g->combobox_target); g_signal_connect(G_OBJECT(g->combobox_patch), "value-changed", G_CALLBACK(patch_callback), self); diff --git a/src/iop/colorequal.c b/src/iop/colorequal.c index e276ffa9d9fc..03b2201a1350 100644 --- a/src/iop/colorequal.c +++ b/src/iop/colorequal.c @@ -3015,15 +3015,12 @@ void gui_init(dt_iop_module_t *self) dt_UCS_22_build_gamut_LUT(input_matrix, g->gamut_LUT); g->max_saturation = get_minimum_saturation(g->gamut_LUT, 0.2f, 1.f); - GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - // start building top level widget static dt_action_def_t notebook_def = { }; g->notebook = dt_ui_notebook_new(¬ebook_def); dt_action_define_iop(self, NULL, N_("page"), GTK_WIDGET(g->notebook), ¬ebook_def); g_signal_connect(G_OBJECT(g->notebook), "switch_page", G_CALLBACK(_channel_tabs_switch_callback), self); - gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(g->notebook), TRUE, TRUE, 0); // graph g->area = GTK_DRAWING_AREA @@ -3052,9 +3049,8 @@ void gui_init(dt_iop_module_t *self) G_CALLBACK(_area_scrolled_callback), self); g_signal_connect(G_OBJECT(g->area), "size_allocate", G_CALLBACK(_area_size_callback), self); - gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(g->area), TRUE, TRUE, 0); - self->widget = box; + GtkWidget *box = self->widget = dt_gui_vbox(g->notebook, g->area); g->hue_shift = dt_color_picker_new_with_cst(self, DT_COLOR_PICKER_POINT_AREA | DT_COLOR_PICKER_DENOISE, dt_bauhaus_slider_from_params(self, "hue_shift"), IOP_CS_JZCZHZ); dt_bauhaus_slider_set_format(g->hue_shift, "°"); @@ -3069,7 +3065,7 @@ void gui_init(dt_iop_module_t *self) g->picking = FALSE; g->stack = GTK_STACK(gtk_stack_new()); - gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(g->stack), TRUE, TRUE, 0); + dt_gui_box_add(box, g->stack); dt_action_define_iop(self, NULL, N_("sliders"), GTK_WIDGET(g->stack), NULL); gtk_stack_set_homogeneous(g->stack, FALSE); // this should really be set in gui_update depending on whether sliders are @@ -3079,10 +3075,10 @@ void gui_init(dt_iop_module_t *self) // not a requirement here dt_iop_module_t *sect = NULL; -#define GROUP_SLIDERS(num, page, tooltip) \ +#define GROUP_SLIDERS(num, page, tooltip) \ dt_ui_notebook_page(g->notebook, page, tooltip); \ self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); \ - gtk_stack_add_named(g->stack, self->widget, num); \ + gtk_stack_add_named(g->stack, self->widget, num); \ sect = DT_IOP_SECTION_FOR_PARAMS(self, page); GROUP_SLIDERS("0", N_("hue"), _("change hue hue-wise")) diff --git a/src/iop/colormapping.c b/src/iop/colormapping.c index 8d5487910a7d..123e922ce994 100644 --- a/src/iop/colormapping.c +++ b/src/iop/colormapping.c @@ -992,22 +992,13 @@ void gui_init(dt_iop_module_t *self) g->xform = cmsCreateTransform(hLab, TYPE_Lab_DBL, hsRGB, TYPE_RGB_DBL, INTENT_PERCEPTUAL, 0); g->buffer = NULL; - self->widget = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE)); - - gtk_box_pack_start(GTK_BOX(self->widget), dt_ui_label_new(_("source clusters:")), TRUE, TRUE, 0); - g->source_area = dtgtk_drawing_area_new_with_aspect_ratio(1.0 / 3.0); - gtk_box_pack_start(GTK_BOX(self->widget), g->source_area, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(g->source_area), "draw", G_CALLBACK(cluster_preview_draw), self); - gtk_box_pack_start(GTK_BOX(self->widget), dt_ui_label_new(_("target clusters:")), TRUE, TRUE, 0); - g->target_area = dtgtk_drawing_area_new_with_aspect_ratio(1.0 / 3.0); - gtk_box_pack_start(GTK_BOX(self->widget), g->target_area, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(g->target_area), "draw", G_CALLBACK(cluster_preview_draw), self); GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); - gtk_box_pack_start(GTK_BOX(self->widget), box, TRUE, TRUE, 0); g->acquire_source_button = dt_iop_button_new(self, N_("acquire as source"), G_CALLBACK(acquire_source_button_pressed), FALSE, 0, 0, @@ -1021,6 +1012,9 @@ void gui_init(dt_iop_module_t *self) gtk_label_set_ellipsize(GTK_LABEL(gtk_bin_get_child(GTK_BIN(g->acquire_target_button))), PANGO_ELLIPSIZE_START); gtk_widget_set_tooltip_text(g->acquire_target_button, _("analyze this image as a target image")); + self->widget = dt_gui_vbox(dt_ui_label_new(_("source clusters:")), g->source_area, + dt_ui_label_new(_("target clusters:")), g->target_area, box); + g->clusters = dt_bauhaus_slider_from_params(self, "n"); gtk_widget_set_tooltip_text(g->clusters, _("number of clusters to find in image. value change resets all clusters")); diff --git a/src/iop/denoiseprofile.c b/src/iop/denoiseprofile.c index 2bf175275f1a..33d306eb8d38 100644 --- a/src/iop/denoiseprofile.c +++ b/src/iop/denoiseprofile.c @@ -3676,16 +3676,12 @@ void gui_init(dt_iop_module_t *self) dt_ui_notebook_page(g->channel_tabs, N_("B"), NULL); g_signal_connect(G_OBJECT(g->channel_tabs), "switch_page", G_CALLBACK(denoiseprofile_tab_switch), self); - gtk_box_pack_start(GTK_BOX(g->box_wavelets), - GTK_WIDGET(g->channel_tabs), FALSE, FALSE, 0); g->channel_tabs_Y0U0V0 = GTK_NOTEBOOK(gtk_notebook_new()); dt_ui_notebook_page(g->channel_tabs_Y0U0V0, N_("Y0"), NULL); dt_ui_notebook_page(g->channel_tabs_Y0U0V0, N_("U0V0"), NULL); g_signal_connect(G_OBJECT(g->channel_tabs_Y0U0V0), "switch_page", G_CALLBACK(denoiseprofile_tab_switch), self); - gtk_box_pack_start(GTK_BOX(g->box_wavelets), - GTK_WIDGET(g->channel_tabs_Y0U0V0), FALSE, FALSE, 0); const int ch = (int)g->channel; g->transition_curve = dt_draw_curve_new(0.0, 1.0, CATMULL_ROM); @@ -3717,53 +3713,41 @@ void gui_init(dt_iop_module_t *self) G_CALLBACK(denoiseprofile_leave_notify), self); g_signal_connect(G_OBJECT(g->area), "scroll-event", G_CALLBACK(denoiseprofile_scrolled), self); - gtk_box_pack_start(GTK_BOX(g->box_wavelets), GTK_WIDGET(g->area), FALSE, FALSE, 0); - g->box_variance = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); + dt_gui_box_add(g->box_wavelets, g->channel_tabs, g->channel_tabs_Y0U0V0, g->area); + g->label_var = GTK_LABEL(dt_ui_label_new(_("use only with a perfectly\n" "uniform image if you want to\n" "estimate the noise variance."))); - gtk_box_pack_start(GTK_BOX(g->box_variance), GTK_WIDGET(g->label_var), TRUE, TRUE, 0); - GtkBox *hboxR = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); - GtkLabel *labelR = GTK_LABEL(dt_ui_label_new(_("variance red: "))); - gtk_box_pack_start(GTK_BOX(hboxR), GTK_WIDGET(labelR), FALSE, FALSE, 0); g->label_var_R = GTK_LABEL(dt_ui_label_new("")); // This gets filled in by process gtk_widget_set_tooltip_text(GTK_WIDGET(g->label_var_R), _("variance computed on the red channel")); - gtk_box_pack_start(GTK_BOX(hboxR), GTK_WIDGET(g->label_var_R), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(g->box_variance), GTK_WIDGET(hboxR), TRUE, TRUE, 0); - GtkBox *hboxG = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); - GtkLabel *labelG = GTK_LABEL(dt_ui_label_new(_("variance green: "))); - gtk_box_pack_start(GTK_BOX(hboxG), GTK_WIDGET(labelG), FALSE, FALSE, 0); g->label_var_G = GTK_LABEL(dt_ui_label_new("")); // This gets filled in by process gtk_widget_set_tooltip_text(GTK_WIDGET(g->label_var_G), _("variance computed on the green channel")); - gtk_box_pack_start(GTK_BOX(hboxG), GTK_WIDGET(g->label_var_G), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(g->box_variance), GTK_WIDGET(hboxG), TRUE, TRUE, 0); - GtkBox *hboxB = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); - GtkLabel *labelB = GTK_LABEL(dt_ui_label_new(_("variance blue: "))); - gtk_box_pack_start(GTK_BOX(hboxB), GTK_WIDGET(labelB), FALSE, FALSE, 0); + g->label_var_B = GTK_LABEL(dt_ui_label_new("")); // This gets filled in by process gtk_widget_set_tooltip_text(GTK_WIDGET(g->label_var_B), _("variance computed on the blue channel")); - gtk_box_pack_start(GTK_BOX(hboxB), GTK_WIDGET(g->label_var_B), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(g->box_variance), GTK_WIDGET(hboxB), TRUE, TRUE, 0); + + g->box_variance = dt_gui_vbox(g->label_var, + dt_gui_hbox(dt_ui_label_new(_("variance red: ")), g->label_var_R), + dt_gui_hbox(dt_ui_label_new(_("variance green: ")), g->label_var_G), + dt_gui_hbox(dt_ui_label_new(_("variance blue: ")), g->label_var_B)); g_signal_connect(G_OBJECT(g->box_variance), "draw", G_CALLBACK(denoiseprofile_draw_variance), self); // start building top level widget - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - g->profile = dt_bauhaus_combobox_new(self); dt_bauhaus_widget_set_label(g->profile, NULL, N_("profile")); g_signal_connect(G_OBJECT(g->profile), "value-changed", G_CALLBACK(profile_callback), self); - gtk_box_pack_start(GTK_BOX(self->widget), g->profile, TRUE, TRUE, 0); + self->widget = dt_gui_vbox(g->profile); g->wb_adaptive_anscombe = dt_bauhaus_toggle_from_params(self, "wb_adaptive_anscombe"); @@ -3774,8 +3758,7 @@ void gui_init(dt_iop_module_t *self) if(!compute_variance && pos != -1) dt_bauhaus_combobox_remove_at(g->mode, pos); - gtk_box_pack_start(GTK_BOX(self->widget), g->box_nlm, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), g->box_wavelets, TRUE, TRUE, 0); + dt_gui_box_add(self->widget, g->box_nlm, g->box_wavelets); g->overshooting = dt_bauhaus_slider_from_params(self, "overshooting"); dt_bauhaus_slider_set_soft_max(g->overshooting, 4.0f); @@ -3786,7 +3769,7 @@ void gui_init(dt_iop_module_t *self) g->bias = dt_bauhaus_slider_from_params(self, "bias"); dt_bauhaus_slider_set_soft_range(g->bias, -10.0f, 10.0f); - gtk_box_pack_start(GTK_BOX(self->widget), g->box_variance, TRUE, TRUE, 0); + dt_gui_box_add(self->widget, g->box_variance); g->fix_anscombe_and_nlmeans_norm = dt_bauhaus_toggle_from_params (self, "fix_anscombe_and_nlmeans_norm"); diff --git a/src/iop/diffuse.c b/src/iop/diffuse.c index 85fc734e3ca0..fe1699820702 100644 --- a/src/iop/diffuse.c +++ b/src/iop/diffuse.c @@ -1769,10 +1769,8 @@ void cleanup_global(dt_iop_module_so_t *self) void gui_init(dt_iop_module_t *self) { dt_iop_diffuse_gui_data_t *g = IOP_GUI_ALLOC(diffuse); - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - gtk_box_pack_start(GTK_BOX(self->widget), - dt_ui_section_label_new(C_("section", "properties")), FALSE, FALSE, 0); + self->widget = dt_gui_vbox(dt_ui_section_label_new(C_("section", "properties"))); g->iterations = dt_bauhaus_slider_from_params(self, "iterations"); dt_bauhaus_slider_set_soft_range(g->iterations, 1., 128); @@ -1803,9 +1801,7 @@ void gui_init(dt_iop_module_t *self) "if you plan on deblurring, \n" "the radius should be around the width of your lens blur.")); - GtkWidget *label_speed = - dt_ui_section_label_new(C_("section", "speed (sharpen ↔ diffuse)")); - gtk_box_pack_start(GTK_BOX(self->widget), label_speed, FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "speed (sharpen ↔ diffuse)"))); g->first = dt_bauhaus_slider_from_params(self, "first"); dt_bauhaus_slider_set_digits(g->first, 4); @@ -1847,8 +1843,7 @@ void gui_init(dt_iop_module_t *self) "positive values diffuse and blur, \n" "zero does nothing.")); - GtkWidget *label_direction = dt_ui_section_label_new(C_("section", "direction")); - gtk_box_pack_start(GTK_BOX(self->widget), label_direction, FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "direction"))); g->anisotropy_first = dt_bauhaus_slider_from_params(self, "anisotropy_first"); dt_bauhaus_slider_set_digits(g->anisotropy_first, 4); @@ -1886,9 +1881,7 @@ void gui_init(dt_iop_module_t *self) "positive values rather avoid edges (isophotes), \n" "zero affects both equally (isotropic).")); - gtk_box_pack_start(GTK_BOX(self->widget), - dt_ui_section_label_new(C_("section", "edge management")), - FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "edge management"))); g->sharpness = dt_bauhaus_slider_from_params(self, "sharpness"); dt_bauhaus_slider_set_digits(g->sharpness, 3); @@ -1915,9 +1908,7 @@ void gui_init(dt_iop_module_t *self) "increase if you see noise appear on smooth surfaces or\n" "if dark areas seem oversharpened compared to bright areas.")); - gtk_box_pack_start(GTK_BOX(self->widget), - dt_ui_section_label_new(C_("section", "diffusion spatiality")), - FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "diffusion spatiality"))); g->threshold = dt_bauhaus_slider_from_params(self, "threshold"); dt_bauhaus_slider_set_format(g->threshold, "%"); diff --git a/src/iop/filmicrgb.c b/src/iop/filmicrgb.c index 5f34718378c8..54b977fba7e5 100644 --- a/src/iop/filmicrgb.c +++ b/src/iop/filmicrgb.c @@ -4433,13 +4433,12 @@ void gui_init(dt_iop_module_t *self) "but fails for high-keys, low-keys and high-ISO images.\n" "this is not an artificial intelligence, but a simple guess.\n" "ensure you understand its assumptions before using it.")); - gtk_box_pack_start(GTK_BOX(self->widget), g->auto_button, FALSE, FALSE, 0); + dt_gui_box_add(self->widget, g->auto_button); // Page RECONSTRUCT self->widget = dt_ui_notebook_page(g->notebook, N_("reconstruct"), NULL); - GtkWidget *label = dt_ui_section_label_new(C_("section", "highlights clipping")); - gtk_box_pack_start(GTK_BOX(self->widget), label, FALSE, FALSE, 0); + dt_gui_box_add(self->widget, dt_ui_section_label_new(C_("section", "highlights clipping"))); g->enable_highlight_reconstruction = dt_bauhaus_toggle_from_params(self, "enable_highlight_reconstruction"); @@ -4461,17 +4460,14 @@ void gui_init(dt_iop_module_t *self) "increase to make the transition softer and blurrier.")); // Highlight Reconstruction Mask - GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_pack_start(GTK_BOX(hbox), dt_ui_label_new(_("display highlight reconstruction mask")), TRUE, TRUE, 0); + GtkWidget *hbox = dt_gui_hbox(dt_ui_label_new(_("display highlight reconstruction mask"))); g->show_highlight_mask = dt_iop_togglebutton_new(self, NULL, N_("display highlight reconstruction mask"), NULL, G_CALLBACK(show_mask_callback), FALSE, 0, 0, dtgtk_cairo_paint_showmask, hbox); dtgtk_togglebutton_set_paint(DTGTK_TOGGLEBUTTON(g->show_highlight_mask), dtgtk_cairo_paint_showmask, 0, NULL); dt_gui_add_class(g->show_highlight_mask, "dt_bauhaus_alignment"); dt_gui_add_class(g->show_highlight_mask, "dt_transparent_background"); - gtk_box_pack_start(GTK_BOX(self->widget), hbox, FALSE, FALSE, 0); - label = dt_ui_section_label_new(C_("section", "balance")); - gtk_box_pack_start(GTK_BOX(self->widget), label, FALSE, FALSE, 0); + dt_gui_box_add(self->widget, hbox, dt_ui_section_label_new(C_("section", "balance"))); g->reconstruct_structure_vs_texture = dt_bauhaus_slider_from_params(self, "reconstruct_structure_vs_texture"); dt_bauhaus_slider_set_format(g->reconstruct_structure_vs_texture, "%"); @@ -4631,10 +4627,7 @@ void gui_init(dt_iop_module_t *self) "this is useful to match natural sensor noise pattern.")); // start building top level widget - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE); - - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->area), TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->notebook), FALSE, FALSE, 0); + self->widget = dt_gui_vbox(g->area, g->notebook); } void gui_changed(dt_iop_module_t *self, GtkWidget *w, void *previous) diff --git a/src/iop/retouch.c b/src/iop/retouch.c index 6a8899b95c8b..a5cc7d32f25c 100644 --- a/src/iop/retouch.c +++ b/src/iop/retouch.c @@ -2730,42 +2730,13 @@ void gui_init(dt_iop_module_t *self) G_CALLBACK(rt_mask_opacity_callback), self); // start building top level widget - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - - GtkWidget *lbl_rt_tools = dt_ui_section_label_new(C_("section", "retouch tools")); - gtk_box_pack_start(GTK_BOX(self->widget), lbl_rt_tools, FALSE, TRUE, 0); - - // shapes toolbar - gtk_box_pack_start(GTK_BOX(self->widget), hbox_shapes, TRUE, TRUE, 0); - // algorithms toolbar - gtk_box_pack_start(GTK_BOX(self->widget), hbox_algo, TRUE, TRUE, 0); - - // wavelet decompose - GtkWidget *lbl_wd = dt_ui_section_label_new(C_("section", "wavelet decompose")); - gtk_box_pack_start(GTK_BOX(self->widget), lbl_wd, FALSE, TRUE, 0); - - // wavelet decompose bar & labels - gtk_box_pack_start(GTK_BOX(self->widget), grid_wd_labels, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), g->wd_bar, TRUE, TRUE, DT_PIXEL_APPLY_DPI(3)); - - // preview scale & cut/paste scale - gtk_box_pack_start(GTK_BOX(self->widget), hbox_scale, TRUE, TRUE, 0); - - // preview single scale - gtk_box_pack_start(GTK_BOX(self->widget), g->vbox_preview_scale, TRUE, TRUE, 0); - - // shapes - GtkWidget *lbl_shapes = dt_ui_section_label_new(C_("section", "shapes")); - gtk_box_pack_start(GTK_BOX(self->widget), lbl_shapes, FALSE, TRUE, 0); - - // shape selected - gtk_box_pack_start(GTK_BOX(self->widget), hbox_shape_sel, TRUE, TRUE, 0); - // blur radius - gtk_box_pack_start(GTK_BOX(self->widget), g->vbox_blur, TRUE, TRUE, 0); - // fill color - gtk_box_pack_start(GTK_BOX(self->widget), g->vbox_fill, TRUE, TRUE, 0); - // mask (shape) opacity - gtk_box_pack_start(GTK_BOX(self->widget), g->sl_mask_opacity, TRUE, TRUE, 0); + self->widget = dt_gui_vbox + (dt_ui_section_label_new(C_("section", "retouch tools")), + hbox_shapes, hbox_algo, + dt_ui_section_label_new(C_("section", "wavelet decompose")), + grid_wd_labels, g->wd_bar, hbox_scale, g->vbox_preview_scale, + dt_ui_section_label_new(C_("section", "shapes")), + hbox_shape_sel, g->vbox_blur, g->vbox_fill, g->sl_mask_opacity); /* add signal handler for preview pipe finish to redraw the preview */ DT_CONTROL_SIGNAL_HANDLE(DT_SIGNAL_DEVELOP_UI_PIPE_FINISHED, rt_develop_ui_pipe_finished_callback); diff --git a/src/iop/rgbcurve.c b/src/iop/rgbcurve.c index 0fdf4331fbcd..d6ef7f52cc59 100644 --- a/src/iop/rgbcurve.c +++ b/src/iop/rgbcurve.c @@ -1528,14 +1528,11 @@ void gui_init(dt_iop_module_t *self) dt_action_define_iop(self, N_("pickers"), N_("create curve"), g->colorpicker_set_values, &dt_action_def_toggle); - GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_box_pack_start(GTK_BOX(self->widget), vbox, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox), TRUE, TRUE, 0); - g->area = GTK_DRAWING_AREA(dtgtk_drawing_area_new_with_height(0)); g_object_set_data(G_OBJECT(g->area), "iop-instance", self); dt_action_define_iop(self, NULL, N_("curve"), GTK_WIDGET(g->area), NULL); - gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(g->area), TRUE, TRUE, 0); + + dt_gui_box_add(self->widget, g->area); // FIXME: that tooltip goes in the way of the numbers when you hover // a node to get a reading diff --git a/src/iop/rgblevels.c b/src/iop/rgblevels.c index f91e5cbd9562..fbf9209c12f3 100644 --- a/src/iop/rgblevels.c +++ b/src/iop/rgblevels.c @@ -1044,14 +1044,11 @@ void gui_init(dt_iop_module_t *self) dt_ui_notebook_page(g->channel_tabs, N_("B"), _("curve nodes for b channel")); g_signal_connect(G_OBJECT(g->channel_tabs), "switch_page", G_CALLBACK(_tab_switch_callback), self); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->channel_tabs), FALSE, FALSE, 0); g->area = GTK_DRAWING_AREA(dt_ui_resize_wrap(NULL, 0, "plugins/darkroom/rgblevels/graphheight")); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->area), TRUE, TRUE, 0); - g_object_set_data(G_OBJECT(g->area), "iop-instance", self); dt_action_define_iop(self, NULL, N_("levels"), GTK_WIDGET(g->area), &_action_def_levels); @@ -1071,36 +1068,18 @@ void gui_init(dt_iop_module_t *self) g_signal_connect(G_OBJECT(g->area), "scroll-event", G_CALLBACK(_area_scroll_callback), self); - g->blackpick = dt_color_picker_new(self, DT_COLOR_PICKER_POINT, NULL); - dt_action_define_iop(self, N_("pickers"), N_("black"), g->blackpick, - &dt_action_def_toggle); - gtk_widget_set_tooltip_text(g->blackpick, _("pick black point from image")); - gtk_widget_set_name(GTK_WIDGET(g->blackpick), "picker-black"); - g_signal_connect(G_OBJECT(g->blackpick), "toggled", - G_CALLBACK(_color_picker_callback), self); - - g->greypick = dt_color_picker_new(self, DT_COLOR_PICKER_POINT, NULL); - dt_action_define_iop(self, N_("pickers"), N_("gray"), g->greypick, - &dt_action_def_toggle); - gtk_widget_set_tooltip_text(g->greypick, _("pick medium gray point from image")); - gtk_widget_set_name(GTK_WIDGET(g->greypick), "picker-grey"); - g_signal_connect(G_OBJECT(g->greypick), "toggled", - G_CALLBACK(_color_picker_callback), self); - - g->whitepick = dt_color_picker_new(self, DT_COLOR_PICKER_POINT, NULL); - dt_action_define_iop(self, N_("pickers"), N_("white"), g->whitepick, - &dt_action_def_toggle); - gtk_widget_set_tooltip_text(g->whitepick, _("pick white point from image")); - gtk_widget_set_name(GTK_WIDGET(g->whitepick), "picker-white"); - g_signal_connect(G_OBJECT(g->whitepick), "toggled", +#define PICKER_SETUP(color, name, tooltip) \ + g->color##pick = dt_color_picker_new(self, DT_COLOR_PICKER_POINT, NULL); \ + dt_action_define_iop(self, N_("pickers"), name, g->color##pick, \ + &dt_action_def_toggle); \ + gtk_widget_set_tooltip_text(g->color##pick, tooltip); \ + gtk_widget_set_name(GTK_WIDGET(g->color##pick), "picker-"#color); \ + g_signal_connect(dt_gui_expand(g->color##pick), "toggled", \ G_CALLBACK(_color_picker_callback), self); - GtkWidget *pick_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_pack_start(GTK_BOX(pick_hbox), GTK_WIDGET(g->blackpick), TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(pick_hbox), GTK_WIDGET(g->greypick ), TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(pick_hbox), GTK_WIDGET(g->whitepick), TRUE, TRUE, 0); - - gtk_box_pack_start(GTK_BOX(self->widget), pick_hbox, TRUE, TRUE, 0); + PICKER_SETUP(black, N_("black"), _("pick black point from image")); + PICKER_SETUP(grey, N_("gray"), _("pick medium gray point from image")); + PICKER_SETUP(white, N_("white"), _("pick white point from image")); g->bt_auto_levels = gtk_button_new_with_label(_("auto")); dt_action_define_iop(self, NULL, N_("auto levels"), g->bt_auto_levels, @@ -1116,12 +1095,9 @@ void gui_init(dt_iop_module_t *self) "click and drag to draw the area\n" "right-click to cancel")); - GtkWidget *autolevels_box = - gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(10)); - gtk_box_pack_start(GTK_BOX(autolevels_box), g->bt_auto_levels, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(autolevels_box), g->bt_select_region, TRUE, TRUE, 0); - - gtk_box_pack_start(GTK_BOX(self->widget), autolevels_box, TRUE, TRUE, 0); + dt_gui_box_add(self->widget, g->channel_tabs, g->area, + dt_gui_hbox(g->blackpick, g->greypick, g->whitepick), + dt_gui_hbox(dt_gui_expand(g->bt_auto_levels), dt_gui_expand(g->bt_select_region))); g_signal_connect(G_OBJECT(g->bt_auto_levels), "clicked", G_CALLBACK(_auto_levels_callback), self); diff --git a/src/libs/export.c b/src/libs/export.c index 3a2517594c93..db41f747adb0 100644 --- a/src/libs/export.c +++ b/src/libs/export.c @@ -1415,22 +1415,16 @@ void gui_init(dt_lib_module_t *self) { dt_lib_export_t *d = malloc(sizeof(dt_lib_export_t)); self->data = (void *)d; - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); dt_action_insert_sorted(DT_ACTION(self), &darktable.control->actions_format); dt_action_insert_sorted(DT_ACTION(self), &darktable.control->actions_storage); - GtkWidget *label = dt_ui_section_label_new(C_("section", "storage options")); - gtk_box_pack_start(GTK_BOX(self->widget), label, FALSE, TRUE, 0); - d->storage = dt_bauhaus_combobox_new_action(DT_ACTION(self)); dt_bauhaus_widget_set_label(d->storage, NULL, N_("target storage")); - gtk_box_pack_start(GTK_BOX(self->widget), d->storage, FALSE, TRUE, 0); // add all storage widgets to the stack widget d->storage_extra_container = gtk_stack_new(); gtk_stack_set_homogeneous(GTK_STACK(d->storage_extra_container),FALSE); - gtk_box_pack_start(GTK_BOX(self->widget), d->storage_extra_container, FALSE, TRUE, 0); for(const GList *it = darktable.imageio->plugins_storage; it; @@ -1449,9 +1443,6 @@ void gui_init(dt_lib_module_t *self) g_signal_connect(G_OBJECT(d->storage), "value-changed", G_CALLBACK(_storage_changed), self); - label = dt_ui_section_label_new(C_("section", "format options")); - gtk_box_pack_start(GTK_BOX(self->widget), label, FALSE, TRUE, 0); - d->format = dt_bauhaus_combobox_new_action(DT_ACTION(self)); dt_bauhaus_widget_set_label(d->format, NULL, N_("file format")); gtk_widget_set_tooltip_markup(GTK_WIDGET(d->format), @@ -1461,14 +1452,12 @@ void gui_init(dt_lib_module_t *self) "for these formats, no metadata fields will be included\n" "unless the user selects all of the metadata checkboxes in\n" "the export module preferences")); - gtk_box_pack_start(GTK_BOX(self->widget), d->format, FALSE, TRUE, 0); g_signal_connect(G_OBJECT(d->format), "value-changed", G_CALLBACK(_format_changed), (gpointer)d); // add all format widgets to the stack widget d->format_extra_container = gtk_stack_new(); gtk_stack_set_homogeneous(GTK_STACK(d->format_extra_container),FALSE); - gtk_box_pack_start(GTK_BOX(self->widget), d->format_extra_container, FALSE, TRUE, 0); for(const GList *it = darktable.imageio->plugins_format; it; it = g_list_next(it)) { const dt_imageio_module_format_t *module = it->data; @@ -1478,9 +1467,6 @@ void gui_init(dt_lib_module_t *self) } } - label = dt_ui_section_label_new(C_("section", "global options")); - gtk_box_pack_start(GTK_BOX(self->widget), label, FALSE, TRUE, 0); - DT_BAUHAUS_COMBOBOX_NEW_FULL(d->dimensions_type, self, NULL, N_("set size"), _("choose a method for setting the output size"), dt_conf_get_int(CONFIG_PREFIX "dimensions_type"), @@ -1564,17 +1550,6 @@ void gui_init(dt_lib_module_t *self) gtk_widget_set_halign(GTK_WIDGET(d->scale), GTK_ALIGN_FILL); gtk_widget_set_halign(GTK_WIDGET(d->size_in_px), GTK_ALIGN_END); - gtk_box_pack_start(GTK_BOX(self->widget), - GTK_WIDGET(d->dimensions_type), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), - GTK_WIDGET(d->px_size), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), - GTK_WIDGET(d->print_size), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), - GTK_WIDGET(d->scale), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), - GTK_WIDGET(d->size_in_px), FALSE, FALSE, 0); - DT_BAUHAUS_COMBOBOX_NEW_FULL (d->upscale, self, NULL, N_("allow upscaling"), NULL, @@ -1582,7 +1557,6 @@ void gui_init(dt_lib_module_t *self) _callback_bool, (gpointer)CONFIG_PREFIX "upscale", N_("no"), N_("yes")); - gtk_box_pack_start(GTK_BOX(self->widget), d->upscale, FALSE, TRUE, 0); DT_BAUHAUS_COMBOBOX_NEW_FULL (d->high_quality, self, NULL, @@ -1591,7 +1565,6 @@ void gui_init(dt_lib_module_t *self) dt_conf_get_bool(CONFIG_PREFIX "high_quality_processing") ? 1 : 0, _callback_bool, (gpointer)CONFIG_PREFIX "high_quality_processing", N_("no"), N_("yes")); - gtk_box_pack_start(GTK_BOX(self->widget), d->high_quality, FALSE, TRUE, 0); DT_BAUHAUS_COMBOBOX_NEW_FULL (d->export_masks, self, NULL, @@ -1600,13 +1573,11 @@ void gui_init(dt_lib_module_t *self) dt_conf_get_bool(CONFIG_PREFIX "export_masks") ? 1 : 0, _callback_bool, (gpointer)CONFIG_PREFIX "export_masks", N_("no"), N_("yes")); - gtk_box_pack_start(GTK_BOX(self->widget), d->export_masks, FALSE, TRUE, 0); // Add profile combo d->profile = dt_bauhaus_combobox_new_action(DT_ACTION(self)); dt_bauhaus_widget_set_label(d->profile, NULL, N_("profile")); - gtk_box_pack_start(GTK_BOX(self->widget), d->profile, FALSE, TRUE, 0); dt_bauhaus_combobox_add(d->profile, _("image settings")); for(GList *l = darktable.color_profiles->profiles; l; l = g_list_next(l)) { @@ -1647,7 +1618,6 @@ void gui_init(dt_lib_module_t *self) N_("relative colorimetric"), NC_("rendering intent", "saturation"), N_("absolute colorimetric")); - gtk_box_pack_start(GTK_BOX(self->widget), d->intent, FALSE, TRUE, 0); // Add check to control whether the style is to replace or append the current module @@ -1681,13 +1651,30 @@ void gui_init(dt_lib_module_t *self) d->style_name = NULL; const char *stored_style = dt_conf_get_string_const(CONFIG_PREFIX "style"); _update_style_label(d, stored_style ? stored_style : ""); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(style_box), FALSE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), d->style_mode, FALSE, TRUE, 0); // Set callback signals g_signal_connect(G_OBJECT(d->profile), "value-changed", G_CALLBACK(_profile_changed), (gpointer)d); + // Export button + d->export_button = GTK_BUTTON(dt_action_button_new + (self, NC_("actionbutton", "start export"), + _export_button_clicked, self, + NULL, + GDK_KEY_e, GDK_CONTROL_MASK)); + + self->widget = dt_gui_vbox + (dt_ui_section_label_new(C_("section", "storage options")), + d->storage, d->storage_extra_container, + dt_ui_section_label_new(C_("section", "format options")), + d->format, d->format_extra_container, + dt_ui_section_label_new(C_("section", "global options")), + d->dimensions_type, d->px_size, d->print_size, d->scale, d->size_in_px, + d->upscale, d->high_quality, d->export_masks, + d->profile, d->intent, + style_box, d->style_mode, + d->export_button); + // multi-preset export dt_gui_new_collapsible_section(&d->cs, "plugins/lighttable/export/batch_export_expanded", @@ -1718,28 +1705,15 @@ void gui_init(dt_lib_module_t *self) gtk_tree_view_column_pack_start(column, renderer, TRUE); gtk_tree_view_column_add_attribute(column, renderer, "text", DT_EXPORT_BATCH_COL_NAME); - gtk_box_pack_start(d->cs.container, view, FALSE, FALSE, 0); - // multi-preset export button - GtkBox *hbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); - gtk_box_pack_start(GTK_BOX(d->cs.container), GTK_WIDGET(hbox), FALSE, TRUE, 0); d->batch_export_button = GTK_BUTTON(gtk_button_new_with_label(_("start export"))); - gtk_box_pack_start(hbox, GTK_WIDGET(d->batch_export_button), TRUE, TRUE, 0); g_signal_connect(G_OBJECT(d->batch_export_button), "clicked", G_CALLBACK(_batch_export_button_clicked), self); d->batch_treeview = view; _fill_batch_export_list(self); - // Export button - hbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); - gtk_box_pack_end(GTK_BOX(self->widget), GTK_WIDGET(hbox), FALSE, TRUE, 0); - d->export_button = GTK_BUTTON(dt_action_button_new - (self, NC_("actionbutton", "start export"), - _export_button_clicked, self, - NULL, - GDK_KEY_e, GDK_CONTROL_MASK)); - gtk_box_pack_start(hbox, GTK_WIDGET(d->export_button), TRUE, TRUE, 0); + dt_gui_box_add(d->cs.container, view, d->batch_export_button); gtk_widget_add_events(d->width, GDK_BUTTON_PRESS_MASK); gtk_widget_add_events(d->height, GDK_BUTTON_PRESS_MASK); diff --git a/src/libs/history.c b/src/libs/history.c index 8b0cc5f3f15a..263852ab0c51 100644 --- a/src/libs/history.c +++ b/src/libs/history.c @@ -127,12 +127,8 @@ void gui_init(dt_lib_module_t *self) d->record_undo = TRUE; d->record_history_level = 0; - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_widget_set_name(self->widget, "history-ui"); - d->history_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - - GtkWidget *hhbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + gtk_widget_set_has_tooltip(d->history_box, FALSE); d->compress_button = dt_action_button_new (self, N_("compress history stack"), _lib_history_compress_clicked_callback, self, @@ -152,18 +148,10 @@ void gui_init(dt_lib_module_t *self) N_("create style from history"), d->create_button, &dt_action_def_button); - /* add buttons to buttonbox */ - gtk_box_pack_start(GTK_BOX(hhbox), d->compress_button, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(hhbox), d->create_button, FALSE, FALSE, 0); - - /* add history list and buttonbox to widget */ - gtk_box_pack_start(GTK_BOX(self->widget), - dt_ui_resize_wrap(d->history_box, 1, - "plugins/darkroom/history/windowheight"), - FALSE, FALSE, 0); - gtk_widget_set_has_tooltip(d->history_box, FALSE); - gtk_box_pack_start(GTK_BOX(self->widget), hhbox, FALSE, FALSE, 0); - + self->widget = dt_gui_vbox + (dt_ui_resize_wrap(d->history_box, 1, "plugins/darkroom/history/windowheight"), + dt_gui_hbox(dt_gui_expand(d->compress_button), d->create_button)); + gtk_widget_set_name(self->widget, "history-ui"); gtk_widget_show_all(self->widget); /* connect to history change signal for updating the history view */ diff --git a/src/libs/masks.c b/src/libs/masks.c index dc8e37365b23..58f351b5d13c 100644 --- a/src/libs/masks.c +++ b/src/libs/masks.c @@ -44,7 +44,6 @@ static void _lib_masks_update_list(dt_lib_module_t *self); typedef struct dt_lib_masks_t { /* vbox with managed history items */ - GtkWidget *hbox; GtkWidget *bt_circle, *bt_path, *bt_gradient, *bt_ellipse, *bt_brush; GtkWidget *treeview; dt_gui_collapsible_section_t cs; @@ -1798,13 +1797,6 @@ void gui_init(dt_lib_module_t *self) _get_pixbuf_from_cairo(dtgtk_cairo_paint_masks_exclusion, bs2 * 2, bs2); // initialise widgets - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - - GtkWidget *label = gtk_label_new(_("created shapes")); - gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); - d->bt_gradient = dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_gradient, 0, NULL); dt_action_define(DT_ACTION(self), N_("shapes"), N_("add gradient"), d->bt_gradient, &dt_action_def_toggle); @@ -1812,7 +1804,6 @@ void gui_init(dt_lib_module_t *self) G_CALLBACK(_bt_add_shape), GINT_TO_POINTER(DT_MASKS_GRADIENT)); gtk_widget_set_tooltip_text(d->bt_gradient, _("add gradient")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(d->bt_gradient), FALSE); - gtk_box_pack_end(GTK_BOX(hbox), d->bt_gradient, FALSE, FALSE, 0); d->bt_path = dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_path, 0, NULL); dt_action_define(DT_ACTION(self), N_("shapes"), N_("add path"), @@ -1821,7 +1812,6 @@ void gui_init(dt_lib_module_t *self) G_CALLBACK(_bt_add_shape), GINT_TO_POINTER(DT_MASKS_PATH)); gtk_widget_set_tooltip_text(d->bt_path, _("add path")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(d->bt_path), FALSE); - gtk_box_pack_end(GTK_BOX(hbox), d->bt_path, FALSE, FALSE, 0); d->bt_ellipse = dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_ellipse, 0, NULL); dt_action_define(DT_ACTION(self), N_("shapes"), N_("add ellipse"), @@ -1830,7 +1820,6 @@ void gui_init(dt_lib_module_t *self) G_CALLBACK(_bt_add_shape), GINT_TO_POINTER(DT_MASKS_ELLIPSE)); gtk_widget_set_tooltip_text(d->bt_ellipse, _("add ellipse")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(d->bt_ellipse), FALSE); - gtk_box_pack_end(GTK_BOX(hbox), d->bt_ellipse, FALSE, FALSE, 0); d->bt_circle = dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_circle, 0, NULL); dt_action_define(DT_ACTION(self), N_("shapes"), N_("add circle"), @@ -1839,7 +1828,6 @@ void gui_init(dt_lib_module_t *self) G_CALLBACK(_bt_add_shape), GINT_TO_POINTER(DT_MASKS_CIRCLE)); gtk_widget_set_tooltip_text(d->bt_circle, _("add circle")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(d->bt_circle), FALSE); - gtk_box_pack_end(GTK_BOX(hbox), d->bt_circle, FALSE, FALSE, 0); d->bt_brush = dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_brush, 0, NULL); dt_action_define(DT_ACTION(self), N_("shapes"), N_("add brush"), @@ -1848,9 +1836,7 @@ void gui_init(dt_lib_module_t *self) G_CALLBACK(_bt_add_shape), GINT_TO_POINTER(DT_MASKS_BRUSH)); gtk_widget_set_tooltip_text(d->bt_brush, _("add brush")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(d->bt_brush), FALSE); - gtk_box_pack_end(GTK_BOX(hbox), d->bt_brush, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), hbox, TRUE, TRUE, 0); d->treeview = gtk_tree_view_new(); GtkTreeViewColumn *col = gtk_tree_view_column_new(); @@ -1886,10 +1872,11 @@ void gui_init(dt_lib_module_t *self) g_signal_connect(d->treeview, "button-press-event", (GCallback)_tree_button_pressed, self); - gtk_box_pack_start - (GTK_BOX(self->widget), - dt_ui_resize_wrap(d->treeview, 200, "plugins/darkroom/masks/heightview"), - FALSE, FALSE, 0); + self->widget = dt_gui_vbox + (dt_gui_hbox + (dt_gui_expand(dt_ui_label_new(_("created shapes"))), + d->bt_brush, d->bt_circle, d->bt_ellipse, d->bt_path, d->bt_gradient), + dt_ui_resize_wrap(d->treeview, 200, "plugins/darkroom/masks/heightview")); dt_gui_new_collapsible_section (&d->cs, @@ -1898,7 +1885,7 @@ void gui_init(dt_lib_module_t *self) GTK_BOX(self->widget), DT_ACTION(self)); d->none_label = dt_ui_label_new(_("no shapes selected")); - gtk_box_pack_start(GTK_BOX(d->cs.container), d->none_label, FALSE, FALSE, 0); + dt_gui_box_add(d->cs.container, d->none_label); gtk_widget_show_all(GTK_WIDGET(d->cs.container)); gtk_widget_set_no_show_all(GTK_WIDGET(d->cs.container), TRUE); @@ -1917,18 +1904,16 @@ void gui_init(dt_lib_module_t *self) dt_bauhaus_slider_set_log_curve(slider); d->last_value[i] = dt_bauhaus_slider_get(slider); - gtk_box_pack_start(GTK_BOX(d->cs.container), slider, FALSE, FALSE, 0); + dt_gui_box_add(d->cs.container, slider); g_signal_connect(G_OBJECT(slider), "value-changed", G_CALLBACK(_property_changed), GINT_TO_POINTER(i)); } d->pressure = dt_gui_preferences_enum(DT_ACTION(self), "pressure_sensitivity"); dt_bauhaus_widget_set_label(d->pressure, N_("properties"), N_("pressure")); - gtk_box_pack_start(GTK_BOX(d->cs.container), d->pressure, FALSE, FALSE, 0); - d->smoothing = dt_gui_preferences_enum(DT_ACTION(self), "brush_smoothing"); dt_bauhaus_widget_set_label(d->smoothing, N_("properties"), N_("smoothing")); - gtk_box_pack_start(GTK_BOX(d->cs.container), d->smoothing, FALSE, FALSE, 0); + dt_gui_box_add(d->cs.container, d->pressure, d->smoothing); // set proxy functions darktable.develop->proxy.masks.module = self; diff --git a/src/libs/metadata.c b/src/libs/metadata.c index ffdd7f774659..f27d0e9ee2e6 100644 --- a/src/libs/metadata.c +++ b/src/libs/metadata.c @@ -743,9 +743,7 @@ void gui_init(dt_lib_module_t *self) _("write metadata for selected images"), 0, 0); d->cancel_button = dt_action_button_new(self, N_("cancel"), _cancel_button_clicked, self, _("ignore changed metadata"), 0, 0); - d->button_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_pack_start(GTK_BOX(d->button_box), d->apply_button, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(d->button_box), d->cancel_button, TRUE, TRUE, 0); + d->button_box = dt_gui_hbox(d->apply_button, d->cancel_button); gtk_grid_attach(grid, d->button_box, 0, DT_METADATA_NUMBER, 2, 1); /* lets signup for mouse over image change signals */ diff --git a/src/libs/styles.c b/src/libs/styles.c index 6614f482c989..0f7d75d420d7 100644 --- a/src/libs/styles.c +++ b/src/libs/styles.c @@ -829,8 +829,6 @@ void gui_init(dt_lib_module_t *self) dt_lib_styles_t *d = malloc(sizeof(dt_lib_styles_t)); self->data = (void *)d; d->edit_button = NULL; - self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - GtkWidget *w; /* tree */ d->tree = GTK_TREE_VIEW(gtk_tree_view_new()); @@ -855,25 +853,17 @@ void gui_init(dt_lib_module_t *self) G_CALLBACK(_tree_selection_changed), self); /* filter entry */ - w = dt_ui_entry_new(0); - d->entry = GTK_ENTRY(w); - gtk_entry_set_placeholder_text(GTK_ENTRY(d->entry), _("filter style names")); - gtk_widget_set_tooltip_text(w, _("filter style names")); + d->entry = GTK_ENTRY(dt_ui_entry_new(0)); + gtk_entry_set_placeholder_text(d->entry, _("filter style names")); + gtk_widget_set_tooltip_text(GTK_WIDGET(d->entry), _("filter style names")); g_signal_connect(d->entry, "changed", G_CALLBACK(_entry_callback), d); g_signal_connect(d->entry, "activate", G_CALLBACK(_entry_activated), d); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(d->entry), TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), - dt_ui_resize_wrap(GTK_WIDGET(d->tree), 250, - "plugins/lighttable/style/windowheight"), - FALSE, FALSE, 0); - d->duplicate = gtk_check_button_new_with_label(_("create duplicate")); dt_action_define(DT_ACTION(self), NULL, N_("create duplicate"), d->duplicate, &dt_action_def_toggle); gtk_label_set_ellipsize(GTK_LABEL(gtk_bin_get_child(GTK_BIN(d->duplicate))), PANGO_ELLIPSIZE_START); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(d->duplicate), TRUE, FALSE, 0); g_signal_connect(d->duplicate, "toggled", G_CALLBACK(_duplicate_callback), d); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(d->duplicate), dt_conf_get_bool("ui_last/styles_create_duplicate")); @@ -885,56 +875,42 @@ void gui_init(dt_lib_module_t *self) dt_conf_get_int("plugins/lighttable/style/applymode"), _applymode_combobox_changed, self, N_("append"), N_("overwrite")); - gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(d->applymode), TRUE, FALSE, 0); - - GtkWidget *hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - GtkWidget *hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - GtkWidget *hbox3 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_pack_start(GTK_BOX(self->widget), hbox1, TRUE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), hbox2, TRUE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(self->widget), hbox3, TRUE, FALSE, 0); // create d->create_button = dt_action_button_new (self, N_("create..."), _create_clicked, d, _("create styles from history stack of selected images"), 0, 0); - gtk_box_pack_start(GTK_BOX(hbox1), d->create_button, TRUE, TRUE, 0); // edit d->edit_button = dt_action_button_new (self, N_("edit..."), _edit_clicked, d, _("edit the selected styles in list above"), 0, 0); - gtk_box_pack_start(GTK_BOX(hbox1), d->edit_button, TRUE, TRUE, 0); // delete d->delete_button = dt_action_button_new (self, N_("remove"), _delete_clicked, d, _("removes the selected styles in list above"), 0, 0); - gtk_box_pack_start(GTK_BOX(hbox1), d->delete_button, TRUE, TRUE, 0); // import button d->import_button = dt_action_button_new (self, N_("import..."), _import_clicked, d, _("import styles from a style files"), 0, 0); - gtk_box_pack_start(GTK_BOX(hbox2), d->import_button, TRUE, TRUE, 0); // export button d->export_button = dt_action_button_new (self, N_("export..."), _export_clicked, d, _("export the selected styles into a style files"), 0, 0); - gtk_box_pack_start(GTK_BOX(hbox2), d->export_button, TRUE, TRUE, 0); // apply button d->apply_button = dt_action_button_new (self, N_("apply"), _apply_clicked, d, _("apply the selected styles in list above to selected images"), 0, 0); - gtk_box_pack_start(GTK_BOX(hbox3), d->apply_button, TRUE, TRUE, 0); // add entry completion GtkEntryCompletion *completion = gtk_entry_completion_new(); @@ -944,6 +920,14 @@ void gui_init(dt_lib_module_t *self) gtk_entry_completion_set_inline_completion(completion, TRUE); gtk_entry_set_completion(d->entry, completion); + self->widget = dt_gui_vbox + (d->entry, + dt_ui_resize_wrap(GTK_WIDGET(d->tree), 250, "plugins/lighttable/style/windowheight"), + d->duplicate, d->applymode, + dt_gui_hbox(d->create_button, d->edit_button, d->delete_button), + dt_gui_hbox(d->import_button, d->export_button), + d->apply_button); + /* update filtered list */ _gui_styles_update_view(d); diff --git a/src/libs/tools/global_toolbox.c b/src/libs/tools/global_toolbox.c index 59482346e963..c48a0ff563f1 100644 --- a/src/libs/tools/global_toolbox.c +++ b/src/libs/tools/global_toolbox.c @@ -384,12 +384,9 @@ void gui_init(dt_lib_module_t *self) dt_lib_tool_preferences_t *d = g_malloc0(sizeof(dt_lib_tool_preferences_t)); self->data = (void *)d; - self->widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - /* create the grouping button */ d->grouping_button = dtgtk_togglebutton_new(dtgtk_cairo_paint_grouping, 0, NULL); dt_action_define(&darktable.control->actions_global, NULL, N_("grouping"), d->grouping_button, &dt_action_def_toggle); - gtk_box_pack_start(GTK_BOX(self->widget), d->grouping_button, FALSE, FALSE, 0); if(darktable.gui->grouping) gtk_widget_set_tooltip_text(d->grouping_button, _("expand grouped images")); else @@ -402,7 +399,6 @@ void gui_init(dt_lib_module_t *self) d->overlays_button = dtgtk_button_new(dtgtk_cairo_paint_overlays, 0, NULL); dt_action_define(&darktable.control->actions_global, NULL, N_("thumbnail overlays options"), d->overlays_button, &dt_action_def_button); gtk_widget_set_tooltip_text(d->overlays_button, _("click to change the type of overlays shown on thumbnails")); - gtk_box_pack_start(GTK_BOX(self->widget), d->overlays_button, FALSE, FALSE, 0); d->over_popup = gtk_popover_new(d->overlays_button); gtk_widget_set_size_request(d->over_popup, 350, -1); g_object_set(G_OBJECT(d->over_popup), "transitions-enabled", FALSE, NULL); @@ -482,14 +478,12 @@ void gui_init(dt_lib_module_t *self) /* create the widget help button */ d->help_button = dtgtk_togglebutton_new(dtgtk_cairo_paint_help, 0, NULL); dt_action_define(&darktable.control->actions_global, NULL, N_("help"), d->help_button, &dt_action_def_toggle); - gtk_box_pack_start(GTK_BOX(self->widget), d->help_button, FALSE, FALSE, 0); gtk_widget_set_tooltip_text(d->help_button, _("enable this, then click on a control element to see its online help")); g_signal_connect(G_OBJECT(d->help_button), "clicked", G_CALLBACK(_lib_help_button_clicked), d); /* create the shortcuts button */ d->keymap_button = dtgtk_togglebutton_new(dtgtk_cairo_paint_shortcut, 0, NULL); dt_action_define(&darktable.control->actions_global, NULL, N_("shortcuts"), d->keymap_button, &dt_action_def_toggle); - gtk_box_pack_start(GTK_BOX(self->widget), d->keymap_button, FALSE, FALSE, 0); gtk_widget_set_tooltip_text(d->keymap_button, _("define keyboard shortcuts for on-screen controls\n" "ctrl+click to switch off overwrite confirmations\n" "\n" @@ -515,7 +509,6 @@ void gui_init(dt_lib_module_t *self) /* create the preference button */ d->preferences_button = dtgtk_button_new(dtgtk_cairo_paint_preferences, 0, NULL); ac = dt_action_define(&darktable.control->actions_global, NULL, N_("preferences"), d->preferences_button, &dt_action_def_button); - gtk_box_pack_end(GTK_BOX(self->widget), d->preferences_button, FALSE, FALSE, 0); gtk_widget_set_tooltip_text(d->preferences_button, _("show global preferences")); g_signal_connect(G_OBJECT(d->preferences_button), "clicked", G_CALLBACK(_lib_preferences_button_clicked), NULL); @@ -524,6 +517,9 @@ void gui_init(dt_lib_module_t *self) // Register CMD+, for preferences on macOS dt_shortcut_register(ac, 0, DT_ACTION_EFFECT_ACTIVATE, GDK_KEY_comma, GDK_CONTROL_MASK); #endif + + self->widget = dt_gui_hbox(d->grouping_button, d->overlays_button, + d->help_button, d->keymap_button, d->preferences_button); } void gui_cleanup(dt_lib_module_t *self) diff --git a/src/libs/tools/lighttable.c b/src/libs/tools/lighttable.c index ad58f2b3bff9..9f85615113b4 100644 --- a/src/libs/tools/lighttable.c +++ b/src/libs/tools/lighttable.c @@ -338,7 +338,6 @@ void gui_init(dt_lib_module_t *self) dt_lib_tool_lighttable_t *d = g_malloc0(sizeof(dt_lib_tool_lighttable_t)); self->data = (void *)d; - self->widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); d->layout = MIN(DT_LIGHTTABLE_LAYOUT_LAST - 1, dt_conf_get_int("plugins/lighttable/layout")); d->base_layout = MIN(DT_LIGHTTABLE_LAYOUT_LAST - 1, dt_conf_get_int("plugins/lighttable/base_layout")); @@ -354,10 +353,6 @@ void gui_init(dt_lib_module_t *self) d->current_zoom = dt_conf_get_int("plugins/lighttable/images_in_row"); // create the layouts icon list - d->layout_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_widget_set_name(d->layout_box, "lighttable-layouts-box"); - gtk_box_pack_start(GTK_BOX(self->widget), d->layout_box, TRUE, TRUE, 0); - dt_action_t *ltv = &darktable.view_manager->proxy.lighttable.view->actions; dt_action_t *ac = NULL; @@ -368,7 +363,6 @@ void gui_init(dt_lib_module_t *self) gtk_widget_set_tooltip_text(d->layout_filemanager, _("click to enter filemanager layout.")); g_signal_connect(G_OBJECT(d->layout_filemanager), "button-release-event", G_CALLBACK(_lib_lighttable_layout_btn_release), self); - gtk_box_pack_start(GTK_BOX(d->layout_box), d->layout_filemanager, TRUE, TRUE, 0); d->layout_zoomable = dtgtk_togglebutton_new(dtgtk_cairo_paint_lt_mode_zoom, 0, NULL); ac = dt_action_define(ltv, NULL, N_("toggle zoomable lighttable layout"), d->layout_zoomable, NULL); @@ -377,7 +371,6 @@ void gui_init(dt_lib_module_t *self) gtk_widget_set_tooltip_text(d->layout_zoomable, _("click to enter zoomable lighttable layout.")); g_signal_connect(G_OBJECT(d->layout_zoomable), "button-release-event", G_CALLBACK(_lib_lighttable_layout_btn_release), self); - gtk_box_pack_start(GTK_BOX(d->layout_box), d->layout_zoomable, TRUE, TRUE, 0); d->layout_culling_fix = dtgtk_togglebutton_new(dtgtk_cairo_paint_lt_mode_culling_fixed, 0, NULL); ac = dt_action_define(ltv, NULL, N_("toggle culling mode"), d->layout_culling_fix, NULL); @@ -385,7 +378,6 @@ void gui_init(dt_lib_module_t *self) dt_gui_add_help_link(d->layout_culling_fix, "layout_culling"); g_signal_connect(G_OBJECT(d->layout_culling_fix), "button-release-event", G_CALLBACK(_lib_lighttable_layout_btn_release), self); - gtk_box_pack_start(GTK_BOX(d->layout_box), d->layout_culling_fix, TRUE, TRUE, 0); d->layout_culling_dynamic = dtgtk_togglebutton_new(dtgtk_cairo_paint_lt_mode_culling_dynamic, 0, NULL); ac = dt_action_define(ltv, NULL, N_("toggle culling dynamic mode"), d->layout_culling_dynamic, NULL); @@ -393,7 +385,6 @@ void gui_init(dt_lib_module_t *self) dt_gui_add_help_link(d->layout_culling_dynamic, "layout_culling"); g_signal_connect(G_OBJECT(d->layout_culling_dynamic), "button-release-event", G_CALLBACK(_lib_lighttable_layout_btn_release), self); - gtk_box_pack_start(GTK_BOX(d->layout_box), d->layout_culling_dynamic, TRUE, TRUE, 0); d->layout_preview = dtgtk_togglebutton_new(dtgtk_cairo_paint_lt_mode_fullpreview, 0, NULL); ac = dt_action_define(ltv, NULL, N_("preview"), d->layout_preview, &_action_def_preview); @@ -403,14 +394,17 @@ void gui_init(dt_lib_module_t *self) dt_gui_add_help_link(d->layout_preview, "layout_preview"); g_signal_connect(G_OBJECT(d->layout_preview), "button-release-event", G_CALLBACK(_lib_lighttable_layout_btn_release), self); - gtk_box_pack_start(GTK_BOX(d->layout_box), d->layout_preview, TRUE, TRUE, 0); + + d->layout_box = dt_gui_hbox(d->layout_filemanager, d->layout_zoomable, + d->layout_culling_fix, d->layout_culling_dynamic, + d->layout_preview); + gtk_widget_set_name(d->layout_box, "lighttable-layouts-box"); /* create horizontal zoom slider */ d->zoom = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 1, DT_LIGHTTABLE_MAX_ZOOM, 1); gtk_widget_set_size_request(GTK_WIDGET(d->zoom), DT_PIXEL_APPLY_DPI(140), -1); gtk_scale_set_draw_value(GTK_SCALE(d->zoom), FALSE); gtk_range_set_increments(GTK_RANGE(d->zoom), 1, 1); - gtk_box_pack_start(GTK_BOX(self->widget), d->zoom, TRUE, TRUE, 0); /* manual entry of the zoom level */ d->zoom_entry = gtk_entry_new(); @@ -418,7 +412,8 @@ void gui_init(dt_lib_module_t *self) gtk_entry_set_max_length(GTK_ENTRY(d->zoom_entry), 2); gtk_entry_set_width_chars(GTK_ENTRY(d->zoom_entry), 3); gtk_entry_set_max_width_chars(GTK_ENTRY(d->zoom_entry), 3); - gtk_box_pack_start(GTK_BOX(self->widget), d->zoom_entry, TRUE, TRUE, 0); + + self->widget = dt_gui_hbox(d->layout_box, d->zoom, d->zoom_entry); _lib_lighttable_update_btn(self); diff --git a/src/views/darkroom.c b/src/views/darkroom.c index 4b39dda28dcc..915d2e8e8bd2 100644 --- a/src/views/darkroom.c +++ b/src/views/darkroom.c @@ -2640,9 +2640,6 @@ void gui_init(dt_view_t *self) gtk_popover_set_relative_to(GTK_POPOVER(dev->profile.floating_window), dev->second_wnd_button); - GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add(GTK_CONTAINER(dev->profile.floating_window), vbox); - /** let's fill the encapsulating widgets */ const int force_lcms2 = dt_conf_get_bool("plugins/lighttable/export/force_lcms2"); @@ -2700,20 +2697,6 @@ void gui_init(dt_view_t *self) display2_iso12646, &dt_action_def_toggle); dt_shortcut_register(ac, 0, 0, GDK_KEY_b, GDK_MOD1_MASK); - gtk_box_pack_start(GTK_BOX(vbox), display_profile, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), display_intent, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), - gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), TRUE, TRUE, 0); - - gtk_box_pack_start(GTK_BOX(vbox), display2_profile, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), display2_intent, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), display2_iso12646, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), - gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), TRUE, TRUE, 0); - - gtk_box_pack_start(GTK_BOX(vbox), softproof_profile, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), histogram_profile, TRUE, TRUE, 0); - for(const GList *l = darktable.color_profiles->profiles; l; l = g_list_next(l)) { dt_colorspaces_color_profile_t *prof = l->data; @@ -2799,7 +2782,15 @@ void gui_init(dt_view_t *self) DT_CONTROL_SIGNAL_CONNECT(DT_SIGNAL_CONTROL_PROFILE_USER_CHANGED, _display2_profile_changed, display2_profile); + GtkWidget *vbox = dt_gui_vbox + (display_profile, display_intent, + gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), + display2_profile, display2_intent, display2_iso12646, + gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), + softproof_profile, histogram_profile); + gtk_widget_show_all(vbox); + gtk_container_add(GTK_CONTAINER(dev->profile.floating_window), vbox); } /* create grid changer popup tool */