mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
widgets: Adapt brush previews to theme
We now check the current theme and draw the brush preview color and background to match.
This commit is contained in:
parent
7add94f868
commit
59685ce621
7 changed files with 60 additions and 10 deletions
|
@ -26,6 +26,9 @@
|
||||||
|
|
||||||
#include "core-types.h"
|
#include "core-types.h"
|
||||||
|
|
||||||
|
#include "config/gimpguiconfig.h"
|
||||||
|
|
||||||
|
#include "gimp.h"
|
||||||
#include "gimpbezierdesc.h"
|
#include "gimpbezierdesc.h"
|
||||||
#include "gimpbrush.h"
|
#include "gimpbrush.h"
|
||||||
#include "gimpbrush-boundary.h"
|
#include "gimpbrush-boundary.h"
|
||||||
|
@ -37,6 +40,7 @@
|
||||||
#include "gimpbrushcache.h"
|
#include "gimpbrushcache.h"
|
||||||
#include "gimpbrushgenerated.h"
|
#include "gimpbrushgenerated.h"
|
||||||
#include "gimpbrushpipe.h"
|
#include "gimpbrushpipe.h"
|
||||||
|
#include "gimpcontext.h"
|
||||||
#include "gimptagged.h"
|
#include "gimptagged.h"
|
||||||
#include "gimptempbuf.h"
|
#include "gimptempbuf.h"
|
||||||
|
|
||||||
|
@ -366,13 +370,21 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
GimpGuiConfig *config;
|
||||||
|
guint8 rgb[3] = {0, 0, 0};
|
||||||
|
|
||||||
|
config = GIMP_GUI_CONFIG (context->gimp->config);
|
||||||
|
|
||||||
|
if (config->theme_scheme == GIMP_THEME_DARK)
|
||||||
|
rgb[0] = rgb[1] = rgb[2] = 255;
|
||||||
|
|
||||||
for (y = 0; y < mask_height; y++)
|
for (y = 0; y < mask_height; y++)
|
||||||
{
|
{
|
||||||
for (x = 0; x < mask_width ; x++)
|
for (x = 0; x < mask_width ; x++)
|
||||||
{
|
{
|
||||||
*buf++ = 0;
|
*buf++ = rgb[0];
|
||||||
*buf++ = 0;
|
*buf++ = rgb[1];
|
||||||
*buf++ = 0;
|
*buf++ = rgb[2];
|
||||||
*buf++ = *mask++;
|
*buf++ = *mask++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,11 +81,14 @@ gimp_brush_editor_class_init (GimpBrushEditorClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);
|
GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);
|
||||||
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
|
|
||||||
object_class->constructed = gimp_brush_editor_constructed;
|
object_class->constructed = gimp_brush_editor_constructed;
|
||||||
|
|
||||||
editor_class->set_data = gimp_brush_editor_set_data;
|
editor_class->set_data = gimp_brush_editor_set_data;
|
||||||
editor_class->title = _("Brush Editor");
|
editor_class->title = _("Brush Editor");
|
||||||
|
|
||||||
|
gtk_widget_class_set_css_name (widget_class, "GimpBrushEditor");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -164,6 +164,8 @@ gimp_view_class_init (GimpViewClass *klass)
|
||||||
klass->clicked = NULL;
|
klass->clicked = NULL;
|
||||||
klass->double_clicked = NULL;
|
klass->double_clicked = NULL;
|
||||||
klass->context = NULL;
|
klass->context = NULL;
|
||||||
|
|
||||||
|
gtk_widget_class_set_css_name (widget_class, "GimpView");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1176,6 +1176,29 @@ gimp_view_render_temp_buf_to_surface (GimpViewRenderer *renderer,
|
||||||
case GIMP_VIEW_BG_WHITE:
|
case GIMP_VIEW_BG_WHITE:
|
||||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GIMP_VIEW_BG_USE_STYLE:
|
||||||
|
{
|
||||||
|
GtkStyleContext *style;
|
||||||
|
GdkRGBA *color = NULL;
|
||||||
|
|
||||||
|
style = gtk_widget_get_style_context (widget);
|
||||||
|
gtk_style_context_get (style, gtk_style_context_get_state (style),
|
||||||
|
GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &color,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (color)
|
||||||
|
{
|
||||||
|
cairo_set_source_rgb (cr, color->red, color->green, color->blue);
|
||||||
|
|
||||||
|
gdk_rgba_free (color);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_paint (cr);
|
cairo_paint (cr);
|
||||||
|
@ -1205,6 +1228,10 @@ gimp_view_render_temp_buf_to_surface (GimpViewRenderer *renderer,
|
||||||
case GIMP_VIEW_BG_WHITE:
|
case GIMP_VIEW_BG_WHITE:
|
||||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GIMP_VIEW_BG_USE_STYLE:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
|
@ -119,8 +119,8 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer,
|
||||||
gimp_view_renderer_render_temp_buf (renderer, widget, temp_buf,
|
gimp_view_renderer_render_temp_buf (renderer, widget, temp_buf,
|
||||||
temp_buf_x, temp_buf_y,
|
temp_buf_x, temp_buf_y,
|
||||||
-1,
|
-1,
|
||||||
GIMP_VIEW_BG_WHITE,
|
GIMP_VIEW_BG_USE_STYLE,
|
||||||
GIMP_VIEW_BG_WHITE);
|
GIMP_VIEW_BG_USE_STYLE);
|
||||||
|
|
||||||
gimp_temp_buf_unref (temp_buf);
|
gimp_temp_buf_unref (temp_buf);
|
||||||
|
|
||||||
|
@ -139,8 +139,8 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer,
|
||||||
gimp_view_renderer_render_temp_buf (renderer, widget, temp_buf,
|
gimp_view_renderer_render_temp_buf (renderer, widget, temp_buf,
|
||||||
temp_buf_x, temp_buf_y,
|
temp_buf_x, temp_buf_y,
|
||||||
-1,
|
-1,
|
||||||
GIMP_VIEW_BG_WHITE,
|
GIMP_VIEW_BG_USE_STYLE,
|
||||||
GIMP_VIEW_BG_WHITE);
|
GIMP_VIEW_BG_USE_STYLE);
|
||||||
|
|
||||||
gimp_temp_buf_unref (temp_buf);
|
gimp_temp_buf_unref (temp_buf);
|
||||||
}
|
}
|
||||||
|
@ -193,8 +193,8 @@ gimp_view_renderer_brush_render_timeout (gpointer data)
|
||||||
gimp_view_renderer_render_temp_buf (renderer, renderbrush->widget, temp_buf,
|
gimp_view_renderer_render_temp_buf (renderer, renderbrush->widget, temp_buf,
|
||||||
temp_buf_x, temp_buf_y,
|
temp_buf_x, temp_buf_y,
|
||||||
-1,
|
-1,
|
||||||
GIMP_VIEW_BG_WHITE,
|
GIMP_VIEW_BG_USE_STYLE,
|
||||||
GIMP_VIEW_BG_WHITE);
|
GIMP_VIEW_BG_USE_STYLE);
|
||||||
|
|
||||||
gimp_temp_buf_unref (temp_buf);
|
gimp_temp_buf_unref (temp_buf);
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,8 @@ typedef enum
|
||||||
typedef enum /*< skip >*/
|
typedef enum /*< skip >*/
|
||||||
{
|
{
|
||||||
GIMP_VIEW_BG_CHECKS,
|
GIMP_VIEW_BG_CHECKS,
|
||||||
GIMP_VIEW_BG_WHITE
|
GIMP_VIEW_BG_WHITE,
|
||||||
|
GIMP_VIEW_BG_USE_STYLE
|
||||||
} GimpViewBG;
|
} GimpViewBG;
|
||||||
|
|
||||||
typedef enum /*< skip >*/
|
typedef enum /*< skip >*/
|
||||||
|
|
|
@ -67,6 +67,11 @@ GimpDock .view:drop(active) {
|
||||||
border-top-color: @dimmed-fg-color;
|
border-top-color: @dimmed-fg-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Widget for various previews and icon tabs */
|
||||||
|
GimpView {
|
||||||
|
background-color: @extreme-bg-color;
|
||||||
|
}
|
||||||
|
|
||||||
/* Define the mouse-over color for the path
|
/* Define the mouse-over color for the path
|
||||||
* buttons in the various file dialogs.
|
* buttons in the various file dialogs.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue