GTK4 added a new widgit GtkPicture that is almost identical to GtkImage.
The main difference appears to be that GtkImage now scales down the size
of the given pixbuf using some undocumented algorithm. It's filling
some of the space available, but not all of it. But it isn't a hard
size limit because making the window bigger continues to make the image
bigger.
GtkPicture shows the pixbuf unscaled as expected. So use GtkPicture for
the preview image :*(
gtk_label_set_text(GTK_LABEL(widget), "");
widget = GHB_WIDGET(ud->builder, "dimensions_summary");
gtk_label_set_text(GTK_LABEL(widget), "--");
+ widget = GHB_WIDGET(ud->builder, "summary_image");
+ gtk_widget_show(widget);
widget = GHB_WIDGET(ud->builder, "preview_button_image");
- ghb_image_set_from_icon_name(GTK_IMAGE(widget), "hb-icon", 128);
+ gtk_widget_hide(widget);
return;
}
+ widget = GHB_WIDGET(ud->builder, "summary_image");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "preview_button_image");
+ gtk_widget_show(widget);
+
// Video Track
const hb_encoder_t * video_encoder;
const hb_rate_t * fps;
</packing>
</child>
<child>
- <object class="GtkBox" id="vbox9">
- <property name="orientation">vertical</property>
+ <object class="GtkImage" id="summary_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="margin-bottom">4</property>
+ <property name="margin-start">4</property>
+ <property name="margin-end">4</property>
+ <property name="vexpand">True</property>
+ <property name="valign">fill</property>
<property name="expand">True</property>
- <property name="margin-top">12</property>
- <property name="margin-end">0</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <child>
- <object class="GtkImage" id="preview_button_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin-bottom">4</property>
- <property name="margin-start">4</property>
- <property name="margin-end">4</property>
- <property name="expand">True</property>
- <property name="pixel_size">128</property>
- <property name="icon_name">hb-icon</property>
- <signal name="size-allocate" handler="preview_button_size_allocate_cb" swapped="no"/>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="pixel_size">128</property>
+ <property name="icon_name">hb-icon</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkImage" id="preview_button_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin-bottom">4</property>
+ <property name="margin-start">4</property>
+ <property name="margin-end">4</property>
+ <property name="expand">True</property>
+ <property name="pixel_size">128</property>
+ <property name="icon_name">hb-icon</property>
+ <signal name="size-allocate" handler="preview_button_size_allocate_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="position">0</property>
</object>
</child>
<child>
- <object class="GtkBox" id="vbox9">
- <property name="orientation">vertical</property>
+ <object class="GtkImage" id="summary_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="margin-bottom">4</property>
+ <property name="margin-start">4</property>
+ <property name="margin-end">4</property>
+ <property name="vexpand">True</property>
+ <property name="valign">fill</property>
<property name="expand">True</property>
- <property name="margin-top">12</property>
- <property name="margin-end">0</property>
- <child>
- <object class="GtkImage" id="preview_button_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin-bottom">4</property>
- <property name="margin-start">4</property>
- <property name="margin-end">4</property>
- <property name="expand">True</property>
- <property name="pixel_size">128</property>
- <property name="icon_name">hb-icon</property>
- <signal name="size-allocate" handler="preview_button_size_allocate_cb" swapped="no"/>
- </object>
- </child>
+ <property name="pixel_size">128</property>
+ <property name="icon_name">hb-icon</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkPicture" id="preview_button_image">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ <property name="margin-bottom">4</property>
+ <property name="margin-start">4</property>
+ <property name="margin-end">4</property>
+ <property name="vexpand">True</property>
+ <property name="valign">fill</property>
+ <property name="expand">True</property>
+ <signal name="size-allocate" handler="preview_button_size_allocate_cb" swapped="no"/>
</object>
</child>
</object>
GtkWidget * widget;
widget = GHB_WIDGET (ud->builder, "preview_button_image");
+#if GTK_CHECK_VERSION(3, 90, 0)
+ gtk_picture_set_pixbuf(GTK_PICTURE(widget), scaled_preview);
+#else
gtk_image_set_from_pixbuf(GTK_IMAGE(widget), scaled_preview);
+#endif
g_object_unref(scaled_preview);
}
}
GtkWidget *widget;
gint width, height;
- g_debug("set_preview_button_image ()");
gint title_id, titleindex;
const hb_title_t *title;
g_debug("nothing to do");
return;
}
- g_debug("prev allocate %d x %d", ud->preview->button_width,
- ud->preview->button_height);
ud->preview->button_width = width;
ud->preview->button_height = height;
set_mini_preview_image(ud, ud->preview->pix);