Skip to content

Commit 503e764

Browse files
committed
fix headers button order
1 parent ff637a3 commit 503e764

File tree

5 files changed

+15
-23
lines changed

5 files changed

+15
-23
lines changed

src/bauhaus/bauhaus.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,7 @@ static int _show_pango_text(dt_bauhaus_widget_t *w,
304304
pango_layout_set_width(layout, (int)(PANGO_SCALE * max_width + 0.5f));
305305
}
306306

307-
PangoFontDescription *font_desc = 0;
308-
gtk_style_context_get(context,
309-
gtk_widget_get_state_flags(GTK_WIDGET(w)), "font",
310-
&font_desc, NULL);
311-
312-
pango_layout_set_font_description(layout, font_desc);
307+
pango_layout_set_font_description(layout, darktable.bauhaus->pango_font_desc);
313308

314309
PangoAttrList *attrlist = pango_attr_list_new();
315310
pango_attr_list_insert(attrlist, pango_attr_font_features_new("tnum"));
@@ -347,7 +342,6 @@ static int _show_pango_text(dt_bauhaus_widget_t *w,
347342
cairo_move_to(cr, x_pos, y_pos);
348343
pango_cairo_show_layout(cr, layout);
349344
}
350-
pango_font_description_free(font_desc);
351345
g_object_unref(layout);
352346

353347
return text_width;
@@ -821,11 +815,10 @@ void dt_bauhaus_load_theme()
821815
&bh->colorlabels[DT_COLORLABELS_PURPLE]);
822816

823817
// make sure we release previously loaded font
818+
PangoContext *pango_context = gtk_widget_get_pango_context(root_window);
824819
if(bh->pango_font_desc)
825820
pango_font_description_free(bh->pango_font_desc);
826-
bh->pango_font_desc = NULL;
827-
gtk_style_context_get(ctx, GTK_STATE_FLAG_NORMAL, "font",
828-
&bh->pango_font_desc, NULL);
821+
bh->pango_font_desc = pango_font_description_copy_static(pango_context_get_font_description(pango_context));
829822

830823
cairo_surface_t *cst = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 128, 128);
831824
cairo_t *cr = cairo_create(cst);

src/develop/imageop.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2993,7 +2993,7 @@ GtkWidget *dt_iop_gui_header_button(dt_iop_module_t *module,
29932993
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), module->enabled);
29942994

29952995
g_signal_connect(button, "toggled", G_CALLBACK(_gui_off_callback), module);
2996-
gtk_box_pack_start(GTK_BOX(header), button, FALSE, FALSE, 0);
2996+
gtk_box_pack_end(GTK_BOX(header), button, FALSE, FALSE, 0);
29972997
}
29982998
else
29992999
{
@@ -3208,6 +3208,10 @@ if(0) { // GTK4
32083208
gtk_widget_set_tooltip_text(module->presets_button,
32093209
_("presets\nright-click to apply on new instance"));
32103210

3211+
gtk_box_prepend(GTK_BOX(header), dt_gui_expand(module->instance_name));
3212+
gtk_box_prepend(GTK_BOX(header), lab);
3213+
gtk_box_prepend(GTK_BOX(header), icon);
3214+
32113215
/* add enabled button */
32123216
module->off = dt_iop_gui_header_button(module,
32133217
dtgtk_cairo_paint_switch,
@@ -3217,10 +3221,6 @@ if(0) { // GTK4
32173221
dt_iop_gui_set_enable_button_icon(module->off, module);
32183222
gtk_widget_set_sensitive(module->off, !module->hide_enable_button);
32193223

3220-
gtk_box_pack_start(GTK_BOX(header), icon, FALSE, FALSE, 0);
3221-
gtk_box_pack_start(GTK_BOX(header), lab, FALSE, FALSE, 0);
3222-
gtk_box_pack_start(GTK_BOX(header), module->instance_name, FALSE, FALSE, 0);
3223-
32243224
dt_gui_add_help_link(lab, module->op);
32253225
dt_gui_add_help_link(expander, module->op);
32263226
dt_gui_add_help_link(header, "module_header");

src/dtgtk/drawingarea.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
G_DEFINE_TYPE(GtkDarktableDrawingArea, dtgtk_drawing_area, GTK_TYPE_DRAWING_AREA);
2424

25-
static GtkSizeRequestMode dtgtk_drawing_area_get_request_mode(GtkWidget *widget)
25+
static GtkSizeRequestMode _widget_get_request_mode(GtkWidget *widget)
2626
{
2727
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
2828
};
@@ -47,7 +47,7 @@ static void _widget_measure(GtkWidget* widget,
4747
else if(da->height == -1)
4848
{
4949
// initialize with aspect ratio
50-
*minimum = *natural = for_size * da->aspect;
50+
*minimum = *natural = -1; // for_size * da->aspect;
5151
}
5252
else
5353
{
@@ -76,6 +76,7 @@ static void dtgtk_drawing_area_class_init(GtkDarktableDrawingAreaClass *class)
7676
{
7777
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(class);
7878

79+
widget_class->get_request_mode = _widget_get_request_mode;
7980
widget_class->measure = _widget_measure;
8081
widget_class->snapshot = _widget_snapshot;
8182

src/gui/gtk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3796,8 +3796,8 @@ GtkWidget *dt_ui_notebook_page(GtkNotebook *notebook,
37963796
}
37973797
GtkWidget *label = gtk_label_new(_(text));
37983798
GtkWidget *page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
3799-
if(strlen(text) > 2)
3800-
gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
3799+
// if(strlen(text) > 2) // GTK4
3800+
// gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
38013801
gtk_widget_set_tooltip_text(label, tooltip ? tooltip : _(text));
38023802
gtk_widget_set_has_tooltip(GTK_WIDGET(notebook), FALSE);
38033803

src/libs/lib.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,6 @@ if(0) { // GTK4
12751275
g_signal_connect(G_OBJECT(module->arrow), "button-press-event",
12761276
G_CALLBACK(_lib_plugin_arrow_button_press), module);
12771277
dt_action_define(&module->actions, NULL, NULL, module->arrow, NULL);
1278-
gtk_box_pack_start(GTK_BOX(header), module->arrow, FALSE, FALSE, 0);
12791278

12801279
/* add module label */
12811280
GtkWidget *label = gtk_label_new("");
@@ -1292,7 +1291,6 @@ if(0) { // GTK4
12921291
g_object_set(G_OBJECT(label), "halign", GTK_ALIGN_START, "xalign", 0.0, (gchar *)0);
12931292
gtk_widget_set_name(label, "lib-panel-label");
12941293
dt_action_define(&module->actions, NULL, NULL, label_evb, NULL);
1295-
gtk_box_pack_start(GTK_BOX(header), label_evb, FALSE, FALSE, 0);
12961294

12971295
/* add preset button if module has implementation */
12981296
module->presets_button = dtgtk_button_new(dtgtk_cairo_paint_presets, 0, NULL);
@@ -1307,7 +1305,6 @@ if(0) { // GTK4
13071305
gtk_widget_set_sensitive(GTK_WIDGET(module->presets_button), FALSE);
13081306

13091307
dt_action_define(&module->actions, NULL, NULL, module->presets_button, NULL);
1310-
gtk_box_pack_end(GTK_BOX(header), module->presets_button, FALSE, FALSE, 0);
13111308

13121309
/* add reset button if module has implementation */
13131310
module->reset_button = dtgtk_button_new(dtgtk_cairo_paint_reset, 0, NULL);
@@ -1318,7 +1315,8 @@ if(0) { // GTK4
13181315
GINT_TO_POINTER(DT_ACTION_ELEMENT_RESET));
13191316
if(!module->gui_reset) gtk_widget_set_sensitive(module->reset_button, FALSE);
13201317
dt_action_define(&module->actions, NULL, NULL, module->reset_button, NULL);
1321-
gtk_box_pack_end(GTK_BOX(header), module->reset_button, FALSE, FALSE, 0);
1318+
1319+
dt_gui_box_add(header, module->arrow, dt_gui_expand(label_evb), module->reset_button, module->presets_button);
13221320

13231321
/* add button box - for module's specific action button */
13241322
if(module->gui_tool_box)

0 commit comments

Comments
 (0)