mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-10-06 09:32:41 +02:00
app: size the GimpFgBgEditor relatively to the toolbox icon size.
Until now we were sizing the FG/BG area with hardcoded size ((40, 38) which I'm not sure where it came from!). Now this allocation size will depend on the toolbox icon size (I made so that the FG/BG area is more or less the same size as former hardcoded values with large toolbar icons). I had to tweak a bit the size of the default FG/BG icons and the swap icons, which were also hardcoded. They now also depend on the allocation size, hence the icons size. Note that this code still has a limitation: it won't resize when you switch from a theme with one size to another size of icons. A restart will be necessary. This is something we should improve.
This commit is contained in:
@@ -234,7 +234,7 @@ gimp_fg_bg_editor_init (GimpFgBgEditor *editor)
|
||||
G_CALLBACK (gimp_fg_bg_editor_destroy_transform),
|
||||
NULL, NULL);
|
||||
|
||||
gtk_widget_set_size_request (GTK_WIDGET (editor), 32, 24);
|
||||
gtk_widget_set_size_request (GTK_WIDGET (editor), 24, 24);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -357,7 +357,8 @@ gimp_fg_bg_editor_draw (GtkWidget *widget,
|
||||
/* draw the default colors pixbuf */
|
||||
if (! editor->default_icon)
|
||||
editor->default_icon = gimp_widget_load_icon (widget,
|
||||
GIMP_ICON_COLORS_DEFAULT, 12);
|
||||
GIMP_ICON_COLORS_DEFAULT,
|
||||
MAX (MIN (width * 0.3, 12), 6));
|
||||
|
||||
default_w = gdk_pixbuf_get_width (editor->default_icon) / scale_factor;
|
||||
default_h = gdk_pixbuf_get_height (editor->default_icon) / scale_factor;
|
||||
@@ -383,7 +384,8 @@ gimp_fg_bg_editor_draw (GtkWidget *widget,
|
||||
/* draw the swap colors pixbuf */
|
||||
if (! editor->swap_icon)
|
||||
editor->swap_icon = gimp_widget_load_icon (widget,
|
||||
GIMP_ICON_COLORS_SWAP, 12);
|
||||
GIMP_ICON_COLORS_SWAP,
|
||||
MAX (MIN (width * 0.3, 12), 6));
|
||||
|
||||
swap_w = gdk_pixbuf_get_width (editor->swap_icon) / scale_factor;
|
||||
swap_h = gdk_pixbuf_get_height (editor->swap_icon) / scale_factor;
|
||||
|
@@ -593,9 +593,18 @@ static GtkWidget *
|
||||
toolbox_create_color_area (GimpToolbox *toolbox,
|
||||
GimpContext *context)
|
||||
{
|
||||
GtkWidget *col_area;
|
||||
GtkWidget *col_area;
|
||||
GtkIconSize tool_icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
|
||||
gint icon_width = 40;
|
||||
gint icon_height = 38;
|
||||
|
||||
col_area = gimp_toolbox_color_area_create (toolbox, 40, 38);
|
||||
gtk_widget_style_get (GTK_WIDGET (toolbox->p->tool_palette),
|
||||
"tool-icon-size", &tool_icon_size,
|
||||
NULL);
|
||||
gtk_icon_size_lookup (tool_icon_size, &icon_width, &icon_height);
|
||||
col_area = gimp_toolbox_color_area_create (toolbox,
|
||||
(gint) (icon_width * 1.75),
|
||||
(gint) (icon_height * 1.75));
|
||||
g_object_set (col_area,
|
||||
"halign", GTK_ALIGN_CENTER,
|
||||
"valign", GTK_ALIGN_CENTER,
|
||||
|
Reference in New Issue
Block a user