mirror of https://github.com/GNOME/gimp.git
Issue #2898 - Gegl Operations - Color Wrap does not fit the screen on...
...1920*1980 resolution In GimpOperationTool, make the generated GUI scrollable if it is higher than half the monitor's workarea. This is meant as a last resort for generated GUIs that do not have a custom constructor that makes them usable using better layouts.
This commit is contained in:
parent
c71a887b08
commit
b85d7c2334
|
@ -282,16 +282,29 @@ gimp_operation_tool_dialog (GimpFilterTool *filter_tool)
|
|||
{
|
||||
GimpOperationTool *op_tool = GIMP_OPERATION_TOOL (filter_tool);
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *options_sw;
|
||||
GtkWidget *options_gui;
|
||||
GtkWidget *options_box;
|
||||
|
||||
main_vbox = gimp_filter_tool_dialog_get_vbox (filter_tool);
|
||||
|
||||
/* The options scrolled window */
|
||||
options_sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
g_weak_ref_set (&op_tool->options_sw_ref, options_sw);
|
||||
gtk_scrolled_window_set_overlay_scrolling (GTK_SCROLLED_WINDOW (options_sw),
|
||||
FALSE);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (options_sw),
|
||||
GTK_SHADOW_NONE);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (options_sw),
|
||||
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), options_sw,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (options_sw);
|
||||
|
||||
/* The options vbox */
|
||||
options_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
|
||||
g_weak_ref_set (&op_tool->options_box_ref, options_box);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), options_box,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (options_sw), options_box);
|
||||
gtk_widget_show (options_box);
|
||||
|
||||
options_gui = g_weak_ref_get (&op_tool->options_gui_ref);
|
||||
|
@ -573,14 +586,20 @@ gimp_operation_tool_create_gui (GimpOperationTool *op_tool)
|
|||
static void
|
||||
gimp_operation_tool_add_gui (GimpOperationTool *op_tool)
|
||||
{
|
||||
GtkSizeGroup *size_group = NULL;
|
||||
GtkWidget *options_gui;
|
||||
GtkWidget *options_box;
|
||||
GList *list;
|
||||
GtkSizeGroup *size_group = NULL;
|
||||
GtkWidget *options_gui;
|
||||
GtkWidget *options_box;
|
||||
GtkWidget *options_sw;
|
||||
GtkWidget *shell;
|
||||
GdkRectangle workarea;
|
||||
GtkRequisition minimum;
|
||||
GList *list;
|
||||
gboolean scrolling;
|
||||
|
||||
options_gui = g_weak_ref_get (&op_tool->options_gui_ref);
|
||||
options_box = g_weak_ref_get (&op_tool->options_box_ref);
|
||||
g_return_if_fail (options_gui && options_box);
|
||||
options_sw = g_weak_ref_get (&op_tool->options_sw_ref);
|
||||
g_return_if_fail (options_gui && options_box && options_sw);
|
||||
|
||||
for (list = op_tool->aux_inputs; list; list = g_list_next (list))
|
||||
{
|
||||
|
@ -606,8 +625,25 @@ gimp_operation_tool_add_gui (GimpOperationTool *op_tool)
|
|||
gtk_box_pack_start (GTK_BOX (options_box), options_gui, TRUE, TRUE, 0);
|
||||
gtk_widget_show (options_gui);
|
||||
|
||||
shell = GTK_WIDGET (gimp_display_get_shell (GIMP_TOOL (op_tool)->display));
|
||||
gdk_monitor_get_workarea (gimp_widget_get_monitor (shell), &workarea);
|
||||
gtk_widget_get_preferred_size (options_box, &minimum, NULL);
|
||||
|
||||
scrolling = minimum.height > workarea.height / 2;
|
||||
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (options_sw),
|
||||
GTK_POLICY_NEVER,
|
||||
scrolling ?
|
||||
GTK_POLICY_AUTOMATIC : GTK_POLICY_NEVER);
|
||||
|
||||
if (scrolling)
|
||||
gtk_widget_set_size_request (options_sw, -1, workarea.height / 2);
|
||||
else
|
||||
gtk_widget_set_size_request (options_sw, -1, -1);
|
||||
|
||||
g_object_unref (options_gui);
|
||||
g_object_unref (options_box);
|
||||
g_object_unref (options_sw);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ struct _GimpOperationTool
|
|||
GList *aux_inputs;
|
||||
|
||||
/* dialog */
|
||||
GWeakRef options_sw_ref;
|
||||
GWeakRef options_box_ref;
|
||||
GWeakRef options_gui_ref;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue