app: move all guide styling to gimpcanvas-style.

This commit is contained in:
Jehan 2016-02-03 19:38:32 +01:00
parent 3415d22e58
commit e01d56969d
14 changed files with 158 additions and 300 deletions

View File

@ -118,6 +118,19 @@ typedef enum /*< pdb-skip >*/
} GimpGravityType;
#define GIMP_TYPE_GUIDE_STYLE (gimp_guide_style_get_type ())
GType gimp_guide_style_get_type (void) G_GNUC_CONST;
typedef enum /*< pdb-skip >*/
{
GIMP_GUIDE_STYLE_NONE,
GIMP_GUIDE_STYLE_NORMAL,
GIMP_GUIDE_STYLE_MIRROR,
GIMP_GUIDE_STYLE_MANDALA
} GimpGuideStyle;
#define GIMP_TYPE_HISTOGRAM_CHANNEL (gimp_histogram_channel_get_type ())
GType gimp_histogram_channel_get_type (void) G_GNUC_CONST;

View File

@ -47,11 +47,7 @@ enum
PROP_ID,
PROP_ORIENTATION,
PROP_POSITION,
PROP_NORMAL_FOREGROUND,
PROP_NORMAL_BACKGROUND,
PROP_ACTIVE_FOREGROUND,
PROP_ACTIVE_BACKGROUND,
PROP_LINE_WIDTH
PROP_STYLE
};
@ -61,12 +57,7 @@ struct _GimpGuidePrivate
GimpOrientationType orientation;
gint position;
GimpRGB normal_foreground;
GimpRGB normal_background;
GimpRGB active_foreground;
GimpRGB active_background;
gdouble line_width;
gboolean custom;
GimpGuideStyle style;
};
@ -123,32 +114,11 @@ gimp_guide_class_init (GimpGuideClass *klass)
GIMP_GUIDE_POSITION_UNDEFINED,
0);
g_object_class_install_property (object_class, PROP_NORMAL_FOREGROUND,
g_param_spec_boxed ("normal-foreground", NULL, NULL,
GIMP_TYPE_RGB,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_NORMAL_BACKGROUND,
g_param_spec_boxed ("normal-background", NULL, NULL,
GIMP_TYPE_RGB,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_ACTIVE_FOREGROUND,
g_param_spec_boxed ("active-foreground", NULL, NULL,
GIMP_TYPE_RGB,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_ACTIVE_BACKGROUND,
g_param_spec_boxed ("active-background", NULL, NULL,
GIMP_TYPE_RGB,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_LINE_WIDTH,
g_param_spec_double ("line-width", NULL, NULL,
0, GIMP_MAX_IMAGE_SIZE,
1.0,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_STYLE,
"style", NULL,
GIMP_TYPE_GUIDE_STYLE,
GIMP_GUIDE_STYLE_NONE,
0);
g_type_class_add_private (klass, sizeof (GimpGuidePrivate));
}
@ -179,20 +149,8 @@ gimp_guide_get_property (GObject *object,
case PROP_POSITION:
g_value_set_int (value, guide->priv->position);
break;
case PROP_NORMAL_FOREGROUND:
g_value_set_boxed (value, &guide->priv->normal_foreground);
break;
case PROP_NORMAL_BACKGROUND:
g_value_set_boxed (value, &guide->priv->normal_background);
break;
case PROP_ACTIVE_FOREGROUND:
g_value_set_boxed (value, &guide->priv->active_foreground);
break;
case PROP_ACTIVE_BACKGROUND:
g_value_set_boxed (value, &guide->priv->active_background);
break;
case PROP_LINE_WIDTH:
g_value_set_double (value, guide->priv->line_width);
case PROP_STYLE:
g_value_set_enum (value, guide->priv->style);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -219,38 +177,8 @@ gimp_guide_set_property (GObject *object,
case PROP_POSITION:
guide->priv->position = g_value_get_int (value);
break;
case PROP_NORMAL_FOREGROUND:
{
GimpRGB *color = g_value_get_boxed (value);
guide->priv->normal_foreground = *color;
}
break;
case PROP_NORMAL_BACKGROUND:
{
GimpRGB *color = g_value_get_boxed (value);
guide->priv->normal_background = *color;
}
break;
case PROP_ACTIVE_FOREGROUND:
{
GimpRGB *color = g_value_get_boxed (value);
guide->priv->active_foreground = *color;
}
break;
case PROP_ACTIVE_BACKGROUND:
{
GimpRGB *color = g_value_get_boxed (value);
guide->priv->active_background = *color;
}
break;
case PROP_LINE_WIDTH:
guide->priv->line_width = g_value_get_double (value);
if (guide->priv->line_width != 1.0)
guide->priv->custom = TRUE;
case PROP_STYLE:
guide->priv->style = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -262,19 +190,10 @@ GimpGuide *
gimp_guide_new (GimpOrientationType orientation,
guint32 guide_ID)
{
const GimpRGB normal_fg = { 0.0, 0.0, 0.0, 1.0 };
const GimpRGB normal_bg = { 0.0, 0.5, 1.0, 1.0 };
const GimpRGB active_fg = { 0.0, 0.0, 0.0, 1.0 };
const GimpRGB active_bg = { 1.0, 0.0, 0.0, 1.0 };
return g_object_new (GIMP_TYPE_GUIDE,
"id", guide_ID,
"orientation", orientation,
"normal-foreground", &normal_fg,
"normal-background", &normal_bg,
"active-foreground", &active_fg,
"active-background", &active_bg,
"line-width", 1.0,
"id", guide_ID,
"orientation", orientation,
"style", GIMP_GUIDE_STYLE_NORMAL,
NULL);
}
@ -282,11 +201,7 @@ gimp_guide_new (GimpOrientationType orientation,
* gimp_guide_custom_new:
* @orientation: the #GimpOrientationType
* @guide_ID: the unique guide ID
* @normal_foreground: foreground color for normal state
* @normal_background: background color for normal state
* @active_foreground: foreground color for active state
* @active_background: background color for active state
* @line_width: the width of the guide line
* @guide_style: the #GimpGuideStyle
*
* This function returns a new guide and will flag it as "custom".
* Custom guides are used for purpose "other" than the basic guides
@ -300,24 +215,15 @@ gimp_guide_new (GimpOrientationType orientation,
GimpGuide *
gimp_guide_custom_new (GimpOrientationType orientation,
guint32 guide_ID,
GimpRGB *normal_foreground,
GimpRGB *normal_background,
GimpRGB *active_foreground,
GimpRGB *active_background,
gdouble line_width)
GimpGuideStyle guide_style)
{
GimpGuide *guide;
guide = g_object_new (GIMP_TYPE_GUIDE,
"id", guide_ID,
"orientation", orientation,
"normal-foreground", normal_foreground,
"normal-background", normal_background,
"active-foreground", active_foreground,
"active-background", active_background,
"line-width", line_width,
"style", guide_style,
NULL);
guide->priv->custom = TRUE;
return guide;
}
@ -376,32 +282,15 @@ gimp_guide_removed (GimpGuide *guide)
g_signal_emit (guide, gimp_guide_signals[REMOVED], 0);
}
void
gimp_guide_get_normal_style (GimpGuide *guide,
GimpRGB *foreground,
GimpRGB *background)
{
*foreground = guide->priv->normal_foreground;
*background = guide->priv->normal_background;
}
void
gimp_guide_get_active_style (GimpGuide *guide,
GimpRGB *foreground,
GimpRGB *background)
GimpGuideStyle
gimp_guide_get_style (GimpGuide *guide)
{
*foreground = guide->priv->active_foreground;
*background = guide->priv->active_background;
}
gdouble
gimp_guide_get_line_width (GimpGuide *guide)
{
return guide->priv->line_width;
return guide->priv->style;
}
gboolean
gimp_guide_is_custom (GimpGuide *guide)
{
return guide->priv->custom;
return (guide->priv->style != GIMP_GUIDE_STYLE_NORMAL);
}

View File

@ -61,11 +61,7 @@ GimpGuide * gimp_guide_new (GimpOrientationType orientatio
guint32 guide_ID);
GimpGuide * gimp_guide_custom_new (GimpOrientationType orientation,
guint32 guide_ID,
GimpRGB *normal_foreground,
GimpRGB *normal_background,
GimpRGB *active_foreground,
GimpRGB *active_background,
gdouble line_width);
GimpGuideStyle guide_style);
guint32 gimp_guide_get_ID (GimpGuide *guide);
@ -78,13 +74,7 @@ void gimp_guide_set_position (GimpGuide *guide,
gint position);
void gimp_guide_removed (GimpGuide *guide);
void gimp_guide_get_normal_style (GimpGuide *guide,
GimpRGB *foreground,
GimpRGB *background);
void gimp_guide_get_active_style (GimpGuide *guide,
GimpRGB *foreground,
GimpRGB *background);
gdouble gimp_guide_get_line_width (GimpGuide *guide);
GimpGuideStyle gimp_guide_get_style (GimpGuide *guide);
gboolean gimp_guide_is_custom (GimpGuide *guide);

View File

@ -280,24 +280,18 @@ static void
gimp_mandala_add_guide (GimpMandala *mandala,
GimpOrientationType orientation)
{
static GimpRGB normal_fg = { 1.0, 1.0, 1.0, 1.0 };
static GimpRGB normal_bg = { 0.0, 1.0, 1.0, 1.0 };
static GimpRGB active_fg = { 0.0, 1.0, 1.0, 1.0 };
static GimpRGB active_bg = { 1.0, 0.0, 0.0, 1.0 };
GimpSymmetry *sym = GIMP_SYMMETRY (mandala);
GimpImage *image;
Gimp *gimp;
GimpGuide *guide;
gint position;
GimpSymmetry *sym = GIMP_SYMMETRY (mandala);
GimpImage *image;
Gimp *gimp;
GimpGuide *guide;
gint position;
image = sym->image;
gimp = image->gimp;
guide = gimp_guide_custom_new (orientation,
gimp->next_guide_ID++,
&normal_fg, &normal_bg,
&active_fg, &active_bg,
1.0);
GIMP_GUIDE_STYLE_MANDALA);
if (orientation == GIMP_ORIENTATION_HORIZONTAL)
{

View File

@ -394,24 +394,18 @@ static void
gimp_mirror_add_guide (GimpMirror *mirror,
GimpOrientationType orientation)
{
static GimpRGB normal_fg = { 1.0, 1.0, 1.0, 1.0 };
static GimpRGB normal_bg = { 0.0, 1.0, 0.0, 1.0 };
static GimpRGB active_fg = { 0.0, 1.0, 0.0, 1.0 };
static GimpRGB active_bg = { 1.0, 0.0, 0.0, 1.0 };
GimpSymmetry *sym = GIMP_SYMMETRY (mirror);
GimpImage *image;
Gimp *gimp;
GimpGuide *guide;
gint position;
GimpSymmetry *sym = GIMP_SYMMETRY (mirror);
GimpImage *image;
Gimp *gimp;
GimpGuide *guide;
gint position;
image = sym->image;
gimp = image->gimp;
guide = gimp_guide_custom_new (orientation,
gimp->next_guide_ID++,
&normal_fg, &normal_bg,
&active_fg, &active_bg,
1.0);
GIMP_GUIDE_STYLE_MIRROR);
if (orientation == GIMP_ORIENTATION_HORIZONTAL)
{

View File

@ -31,18 +31,6 @@ typedef enum
} GimpCursorPrecision;
#define GIMP_TYPE_GUIDE_STYLE (gimp_guide_style_get_type ())
GType gimp_guide_style_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_GUIDE_STYLE_NONE,
GIMP_GUIDE_STYLE_NORMAL,
GIMP_GUIDE_STYLE_MIRROR
} GimpGuideStyle;
#define GIMP_TYPE_GUIDES_TYPE (gimp_guides_type_get_type ())
GType gimp_guides_type_get_type (void) G_GNUC_CONST;

View File

@ -34,7 +34,23 @@
#include "gimpcanvas-style.h"
/* Styles for common and custom guides. */
static const GimpRGB guide_normal_fg = { 0.0, 0.0, 0.0, 1.0 };
static const GimpRGB guide_normal_bg = { 0.0, 0.5, 1.0, 1.0 };
static const GimpRGB guide_active_fg = { 0.0, 0.0, 0.0, 1.0 };
static const GimpRGB guide_active_bg = { 1.0, 0.0, 0.0, 1.0 };
static const GimpRGB guide_mirror_normal_fg = { 1.0, 1.0, 1.0, 1.0 };
static const GimpRGB guide_mirror_normal_bg = { 0.0, 1.0, 0.0, 1.0 };
static const GimpRGB guide_mirror_active_fg = { 0.0, 1.0, 0.0, 1.0 };
static const GimpRGB guide_mirror_active_bg = { 1.0, 0.0, 0.0, 1.0 };
static const GimpRGB guide_mandala_normal_fg = { 1.0, 1.0, 1.0, 1.0 };
static const GimpRGB guide_mandala_normal_bg = { 0.0, 1.0, 1.0, 1.0 };
static const GimpRGB guide_mandala_active_fg = { 0.0, 1.0, 1.0, 1.0 };
static const GimpRGB guide_mandala_active_bg = { 1.0, 0.0, 0.0, 1.0 };
/* Styles for other canvas items. */
static const GimpRGB sample_point_normal = { 0.0, 0.5, 1.0, 1.0 };
static const GimpRGB sample_point_active = { 1.0, 0.0, 0.0, 1.0 };
@ -71,6 +87,65 @@ static const GimpRGB tool_fg_highlight = { 1.0, 0.8, 0.2, 0.8 };
/* public functions */
void
gimp_canvas_set_guide_style (GtkWidget *canvas,
cairo_t *cr,
GimpGuideStyle style,
gboolean active)
{
cairo_pattern_t *pattern;
GimpRGB normal_fg;
GimpRGB normal_bg;
GimpRGB active_fg;
GimpRGB active_bg;
gdouble line_width;
g_return_if_fail (GTK_IS_WIDGET (canvas));
g_return_if_fail (cr != NULL);
switch (style)
{
case GIMP_GUIDE_STYLE_NORMAL:
normal_fg = guide_normal_fg;
normal_bg = guide_normal_bg;
active_fg = guide_active_fg;
active_bg = guide_active_bg;
line_width = 1.0;
break;
case GIMP_GUIDE_STYLE_MIRROR:
normal_fg = guide_mirror_normal_fg;
normal_bg = guide_mirror_normal_bg;
active_fg = guide_mirror_active_fg;
active_bg = guide_mirror_active_bg;
line_width = 1.0;
break;
case GIMP_GUIDE_STYLE_MANDALA:
normal_fg = guide_mandala_normal_fg;
normal_bg = guide_mandala_normal_bg;
active_fg = guide_mandala_active_fg;
active_bg = guide_mandala_active_bg;
line_width = 1.0;
break;
default: /* GIMP_GUIDE_STYLE_NONE */
/* This should not happen. */
g_return_if_reached ();
}
cairo_set_line_width (cr, line_width);
if (active)
pattern = gimp_cairo_stipple_pattern_create (&active_fg,
&active_bg,
0);
else
pattern = gimp_cairo_stipple_pattern_create (&normal_fg,
&normal_bg,
0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
}
void
gimp_canvas_set_sample_point_style (GtkWidget *canvas,
cairo_t *cr,

View File

@ -22,6 +22,10 @@
#define __GIMP_CANVAS_STYLE_H__
void gimp_canvas_set_guide_style (GtkWidget *canvas,
cairo_t *cr,
GimpGuideStyle style,
gboolean active);
void gimp_canvas_set_sample_point_style (GtkWidget *canvas,
cairo_t *cr,
gboolean active);

View File

@ -38,9 +38,7 @@ enum
PROP_0,
PROP_ORIENTATION,
PROP_POSITION,
PROP_NORMAL_STYLE,
PROP_ACTIVE_STYLE,
PROP_LINE_WIDTH
PROP_STYLE
};
@ -51,9 +49,7 @@ struct _GimpCanvasGuidePrivate
GimpOrientationType orientation;
gint position;
cairo_pattern_t *active_style;
cairo_pattern_t *normal_style;
gdouble line_width;
GimpGuideStyle style;
};
#define GET_PRIVATE(guide) \
@ -64,7 +60,6 @@ struct _GimpCanvasGuidePrivate
/* local function prototypes */
static void gimp_canvas_guide_finalize (GObject *object);
static void gimp_canvas_guide_set_property (GObject *object,
guint property_id,
const GValue *value,
@ -91,7 +86,6 @@ gimp_canvas_guide_class_init (GimpCanvasGuideClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpCanvasItemClass *item_class = GIMP_CANVAS_ITEM_CLASS (klass);
object_class->finalize = gimp_canvas_guide_finalize;
object_class->set_property = gimp_canvas_guide_set_property;
object_class->get_property = gimp_canvas_guide_get_property;
@ -111,20 +105,11 @@ gimp_canvas_guide_class_init (GimpCanvasGuideClass *klass)
GIMP_MAX_IMAGE_SIZE, 0,
GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_NORMAL_STYLE,
g_param_spec_pointer ("normal-style", NULL, NULL,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_ACTIVE_STYLE,
g_param_spec_pointer ("active-style", NULL, NULL,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_LINE_WIDTH,
g_param_spec_double ("line-width", NULL, NULL,
0, GIMP_MAX_IMAGE_SIZE,
1.0,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_STYLE,
g_param_spec_enum ("style", NULL, NULL,
GIMP_TYPE_GUIDE_STYLE,
GIMP_GUIDE_STYLE_NONE,
GIMP_PARAM_READWRITE));
g_type_class_add_private (klass, sizeof (GimpCanvasGuidePrivate));
}
@ -134,17 +119,6 @@ gimp_canvas_guide_init (GimpCanvasGuide *guide)
{
}
static void
gimp_canvas_guide_finalize (GObject *object)
{
GimpCanvasGuidePrivate *private = GET_PRIVATE (object);
cairo_pattern_destroy (private->normal_style);
cairo_pattern_destroy (private->active_style);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_canvas_guide_set_property (GObject *object,
guint property_id,
@ -161,18 +135,8 @@ gimp_canvas_guide_set_property (GObject *object,
case PROP_POSITION:
private->position = g_value_get_int (value);
break;
case PROP_NORMAL_STYLE:
if (private->normal_style)
cairo_pattern_destroy (private->normal_style);
private->normal_style = g_value_get_pointer (value);
break;
case PROP_ACTIVE_STYLE:
if (private->active_style)
cairo_pattern_destroy (private->active_style);
private->active_style = g_value_get_pointer (value);
break;
case PROP_LINE_WIDTH:
private->line_width = g_value_get_double (value);
case PROP_STYLE:
private->style = g_value_get_enum (value);
break;
default:
@ -197,14 +161,8 @@ gimp_canvas_guide_get_property (GObject *object,
case PROP_POSITION:
g_value_set_int (value, private->position);
break;
case PROP_NORMAL_STYLE:
g_value_set_pointer (value, private->normal_style);
break;
case PROP_ACTIVE_STYLE:
g_value_set_pointer (value, private->active_style);
break;
case PROP_LINE_WIDTH:
g_value_set_double (value, private->line_width);
case PROP_STYLE:
g_value_set_enum (value, private->style);
break;
default:
@ -290,18 +248,11 @@ gimp_canvas_guide_stroke (GimpCanvasItem *item,
{
GimpCanvasGuidePrivate *private = GET_PRIVATE (item);
if (private->active_style &&
gimp_canvas_item_get_highlight (item))
if (private->style != GIMP_GUIDE_STYLE_NONE)
{
cairo_set_line_width (cr, private->line_width);
cairo_set_source (cr, private->active_style);
cairo_stroke (cr);
}
else if (private->normal_style &&
! gimp_canvas_item_get_highlight (item))
{
cairo_set_line_width (cr, private->line_width);
cairo_set_source (cr, private->normal_style);
gimp_canvas_set_guide_style (gimp_canvas_item_get_canvas (item), cr,
private->style,
gimp_canvas_item_get_highlight (item));
cairo_stroke (cr);
}
else
@ -314,9 +265,7 @@ GimpCanvasItem *
gimp_canvas_guide_new (GimpDisplayShell *shell,
GimpOrientationType orientation,
gint position,
cairo_pattern_t *normal_style,
cairo_pattern_t *active_style,
gdouble line_width)
GimpGuideStyle style)
{
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
@ -324,9 +273,7 @@ gimp_canvas_guide_new (GimpDisplayShell *shell,
"shell", shell,
"orientation", orientation,
"position", position,
"normal-style", normal_style,
"active-style", active_style,
"line-width", line_width,
"style", style,
NULL);
}

View File

@ -52,9 +52,7 @@ GType gimp_canvas_guide_get_type (void) G_GNUC_CONST;
GimpCanvasItem * gimp_canvas_guide_new (GimpDisplayShell *shell,
GimpOrientationType orientation,
gint position,
cairo_pattern_t *normal_style,
cairo_pattern_t *active_style,
gdouble line_width);
GimpGuideStyle style);
void gimp_canvas_guide_set (GimpCanvasItem *guide,
GimpOrientationType orientation,

View File

@ -630,26 +630,13 @@ gimp_display_shell_guide_add_handler (GimpImage *image,
{
GimpCanvasProxyGroup *group = GIMP_CANVAS_PROXY_GROUP (shell->guides);
GimpCanvasItem *item;
cairo_pattern_t *normal_style;
cairo_pattern_t *active_style;
GimpRGB normal_foreground;
GimpRGB normal_background;
GimpRGB active_foreground;
GimpRGB active_background;
GimpGuideStyle style;
gimp_guide_get_normal_style (guide, &normal_foreground, &normal_background);
gimp_guide_get_active_style (guide, &active_foreground, &active_background);
normal_style = gimp_cairo_stipple_pattern_create (&normal_foreground,
&normal_background,
0);
active_style = gimp_cairo_stipple_pattern_create (&active_foreground,
&active_background,
0);
style = gimp_guide_get_style (guide);
item = gimp_canvas_guide_new (shell,
gimp_guide_get_orientation (guide),
gimp_guide_get_position (guide),
normal_style, active_style,
gimp_guide_get_line_width (guide));
style);
gimp_canvas_proxy_group_add_item (group, guide, item);
g_object_unref (item);

View File

@ -583,9 +583,7 @@ GimpCanvasItem *
gimp_draw_tool_add_guide (GimpDrawTool *draw_tool,
GimpOrientationType orientation,
gint position,
cairo_pattern_t *normal_style,
cairo_pattern_t *active_style,
gdouble line_width)
GimpGuideStyle style)
{
GimpCanvasItem *item;
@ -593,7 +591,7 @@ gimp_draw_tool_add_guide (GimpDrawTool *draw_tool,
item = gimp_canvas_guide_new (gimp_display_get_shell (draw_tool->display),
orientation, position,
normal_style, active_style, line_width);
style);
gimp_draw_tool_add_item (draw_tool, item);
g_object_unref (item);
@ -621,10 +619,10 @@ gimp_draw_tool_add_crosshair (GimpDrawTool *draw_tool,
gimp_draw_tool_push_group (draw_tool, group);
gimp_draw_tool_add_guide (draw_tool,
GIMP_ORIENTATION_VERTICAL, position_x,
NULL, NULL, 1.0);
GIMP_GUIDE_STYLE_NONE);
gimp_draw_tool_add_guide (draw_tool,
GIMP_ORIENTATION_HORIZONTAL, position_y,
NULL, NULL, 1.0);
GIMP_GUIDE_STYLE_NONE);
gimp_draw_tool_pop_group (draw_tool);
return GIMP_CANVAS_ITEM (group);

View File

@ -115,9 +115,7 @@ GimpCanvasItem * gimp_draw_tool_add_line (GimpDrawTool *draw_too
GimpCanvasItem * gimp_draw_tool_add_guide (GimpDrawTool *draw_tool,
GimpOrientationType orientation,
gint position,
cairo_pattern_t *normal_style,
cairo_pattern_t *active_style,
gdouble line_width);
GimpGuideStyle style);
GimpCanvasItem * gimp_draw_tool_add_crosshair (GimpDrawTool *draw_tool,
gint position_x,
gint position_y);

View File

@ -835,32 +835,15 @@ gimp_move_tool_draw (GimpDrawTool *draw_tool)
if (move->guide)
{
GimpCanvasItem *item;
cairo_pattern_t *normal_style;
cairo_pattern_t *active_style;
GimpRGB normal_foreground;
GimpRGB normal_background;
GimpRGB active_foreground;
GimpRGB active_background;
GimpCanvasItem *item;
GimpGuideStyle style;
gimp_guide_get_normal_style (move->guide,
&normal_foreground,
&normal_background);
gimp_guide_get_active_style (move->guide,
&active_foreground,
&active_background);
normal_style = gimp_cairo_stipple_pattern_create (&normal_foreground,
&normal_background,
0);
active_style = gimp_cairo_stipple_pattern_create (&active_foreground,
&active_background,
0);
style = gimp_guide_get_style (move->guide);
item = gimp_draw_tool_add_guide (draw_tool,
gimp_guide_get_orientation (move->guide),
gimp_guide_get_position (move->guide),
normal_style, active_style,
gimp_guide_get_line_width (move->guide));
style);
gimp_canvas_item_set_highlight (item, TRUE);
}
@ -870,7 +853,7 @@ gimp_move_tool_draw (GimpDrawTool *draw_tool)
gimp_draw_tool_add_guide (draw_tool,
move->guide_orientation,
move->guide_position,
NULL, NULL, 1.0);
GIMP_GUIDE_STYLE_NONE);
}
}