1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Alx Sa
07c69f5448 2 pixel wide border 2025-05-14 09:22:29 -03:00
Alx Sa
d54c0eff04 widgets: Make FgBgEditor outline context sensitive 2025-05-14 09:22:29 -03:00
Alx Sa
c65d5c742f widgets: Highlight selected color in Color dockable
This patch adds an additional check if the foreground or
background color are selected, and only show the highlight
if that color is selected. This should make it more visually
apparent which color you have selected in the Color
dockable.
2025-05-14 09:22:29 -03:00

View File

@@ -27,6 +27,7 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "libgimpcolor/gimpcolor-private.h"
#include "libgimpconfig/gimpconfig.h"
#include "libgimpwidgets/gimpwidgets.h"
@@ -123,7 +124,8 @@ static void gimp_fg_bg_editor_draw_color_frame (GimpFgBgEditor *editor,
gint width,
gint height,
gint corner_dx,
gint corner_dy);
gint corner_dy,
gboolean is_active_color);
G_DEFINE_TYPE (GimpFgBgEditor, gimp_fg_bg_editor, GTK_TYPE_EVENT_BOX)
@@ -463,24 +465,33 @@ gimp_fg_bg_editor_draw (GtkWidget *widget,
if (editor->context)
{
GeglColor *color;
gboolean is_active_color;
is_active_color =
(editor->active_color == GIMP_ACTIVE_COLOR_FOREGROUND);
rect.width -= 4;
rect.height -= 4;
/* draw the background frame */
color = gimp_context_get_background (editor->context);
rect.x = width - rect.width - border.right;
rect.y = height - rect.height - border.bottom;
rect.x = width - rect.width - border.right - 2;
rect.y = height - rect.height - border.bottom - 2;
gimp_fg_bg_editor_draw_color_frame (editor, cr, color,
rect.x, rect.y,
rect.width, rect.height,
-1, -1);
-1, -1,
! is_active_color);
/* draw the foreground frame */
color = gimp_context_get_foreground (editor->context);
rect.x = border.left;
rect.y = border.top;
rect.x = border.left + 2;
rect.y = border.top + 2;
gimp_fg_bg_editor_draw_color_frame (editor, cr, color,
rect.x, rect.y,
rect.width, rect.height,
+1, +1);
+1, +1,
is_active_color);
}
gtk_style_context_restore (style);
@@ -864,7 +875,8 @@ gimp_fg_bg_editor_draw_color_frame (GimpFgBgEditor *editor,
gint width,
gint height,
gint corner_dx,
gint corner_dy)
gint corner_dy,
gboolean is_active_color)
{
GimpPalette *colormap_palette = NULL;
GimpImageBaseType base_type = GIMP_RGB;
@@ -926,15 +938,18 @@ gimp_fg_bg_editor_draw_color_frame (GimpFgBgEditor *editor,
g_object_unref (out_of_gamut_color);
}
if (is_active_color)
{
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
cairo_rectangle (cr, x - 1, y - 1, width + 2, height + 2);
cairo_stroke (cr);
}
cairo_set_line_width (cr, 1.0);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
cairo_rectangle (cr, x + 0.5, y + 0.5, width - 1.0, height - 1.0);
cairo_stroke (cr);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
cairo_rectangle (cr, x + 1.5, y + 1.5, width - 3.0, height - 3.0);
cairo_stroke (cr);
cairo_restore (cr);
}