mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
app, libgimp*, plug-ins: GimpColorButton now space-invaded.
The invasion extended to some core widgets too, in particular GimpColorPanel (a subclass of GimpColorButton). There was quite a lot of code depending on these widgets.
This commit is contained in:
parent
8eb56586aa
commit
916d032f67
37 changed files with 626 additions and 535 deletions
|
@ -125,8 +125,6 @@ colormap_actions_update (GimpActionGroup *group,
|
||||||
gboolean indexed = FALSE;
|
gboolean indexed = FALSE;
|
||||||
gboolean drawable_indexed = FALSE;
|
gboolean drawable_indexed = FALSE;
|
||||||
gint num_colors = 0;
|
gint num_colors = 0;
|
||||||
GimpRGB fg;
|
|
||||||
GimpRGB bg;
|
|
||||||
|
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
|
@ -145,16 +143,6 @@ colormap_actions_update (GimpActionGroup *group,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context)
|
|
||||||
{
|
|
||||||
GeglColor *color;
|
|
||||||
|
|
||||||
color = gimp_context_get_foreground (context);
|
|
||||||
gegl_color_get_rgba_with_space (color, &fg.r, &fg.g, &fg.b, &fg.a, NULL);
|
|
||||||
color = gimp_context_get_background (context);
|
|
||||||
gegl_color_get_rgba_with_space (color, &bg.r, &bg.g, &bg.b, &bg.a, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SET_SENSITIVE(action,condition) \
|
#define SET_SENSITIVE(action,condition) \
|
||||||
gimp_action_group_set_action_sensitive (group, action, (condition) != 0, NULL)
|
gimp_action_group_set_action_sensitive (group, action, (condition) != 0, NULL)
|
||||||
#define SET_COLOR(action,color) \
|
#define SET_COLOR(action,color) \
|
||||||
|
@ -171,8 +159,8 @@ colormap_actions_update (GimpActionGroup *group,
|
||||||
SET_SENSITIVE ("colormap-add-color-from-bg",
|
SET_SENSITIVE ("colormap-add-color-from-bg",
|
||||||
indexed && num_colors < 256);
|
indexed && num_colors < 256);
|
||||||
|
|
||||||
SET_COLOR ("colormap-add-color-from-fg", context ? &fg : NULL);
|
SET_COLOR ("colormap-add-color-from-fg", context ? gimp_context_get_foreground (context) : NULL);
|
||||||
SET_COLOR ("colormap-add-color-from-bg", context ? &bg : NULL);
|
SET_COLOR ("colormap-add-color-from-bg", context ? gimp_context_get_background (context) : NULL);
|
||||||
|
|
||||||
SET_SENSITIVE ("colormap-selection-replace",
|
SET_SENSITIVE ("colormap-selection-replace",
|
||||||
drawable_indexed && num_colors > 0);
|
drawable_indexed && num_colors > 0);
|
||||||
|
|
|
@ -383,10 +383,7 @@ edit_actions_foreground_changed (GimpContext *context,
|
||||||
GeglColor *color,
|
GeglColor *color,
|
||||||
GimpActionGroup *group)
|
GimpActionGroup *group)
|
||||||
{
|
{
|
||||||
GimpRGB rgb;
|
gimp_action_group_set_action_color (group, "edit-fill-fg", color, FALSE);
|
||||||
|
|
||||||
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
|
||||||
gimp_action_group_set_action_color (group, "edit-fill-fg", &rgb, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -394,10 +391,7 @@ edit_actions_background_changed (GimpContext *context,
|
||||||
GeglColor *color,
|
GeglColor *color,
|
||||||
GimpActionGroup *group)
|
GimpActionGroup *group)
|
||||||
{
|
{
|
||||||
GimpRGB rgb;
|
gimp_action_group_set_action_color (group, "edit-fill-bg", color, FALSE);
|
||||||
|
|
||||||
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
|
||||||
gimp_action_group_set_action_color (group, "edit-fill-bg", &rgb, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -465,12 +465,11 @@ gradient_editor_actions_update (GimpActionGroup *group,
|
||||||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data);
|
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data);
|
||||||
GimpGradient *gradient;
|
GimpGradient *gradient;
|
||||||
gboolean editable = FALSE;
|
gboolean editable = FALSE;
|
||||||
|
GeglColor *color;
|
||||||
GimpRGB left_color;
|
GimpRGB left_color;
|
||||||
GimpRGB right_color;
|
GimpRGB right_color;
|
||||||
GimpRGB left_seg_color;
|
GimpRGB left_seg_color;
|
||||||
GimpRGB right_seg_color;
|
GimpRGB right_seg_color;
|
||||||
GimpRGB fg;
|
|
||||||
GimpRGB bg;
|
|
||||||
gboolean blending_equal = TRUE;
|
gboolean blending_equal = TRUE;
|
||||||
gboolean coloring_equal = TRUE;
|
gboolean coloring_equal = TRUE;
|
||||||
gboolean left_editable = TRUE;
|
gboolean left_editable = TRUE;
|
||||||
|
@ -546,16 +545,6 @@ gradient_editor_actions_update (GimpActionGroup *group,
|
||||||
delete = (editor->control_sel_l->prev || editor->control_sel_r->next);
|
delete = (editor->control_sel_l->prev || editor->control_sel_r->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data_editor->context)
|
|
||||||
{
|
|
||||||
GeglColor *color;
|
|
||||||
|
|
||||||
color = gimp_context_get_foreground (data_editor->context);
|
|
||||||
gegl_color_get_rgba_with_space (color, &fg.r, &fg.g, &fg.b, &fg.a, NULL);
|
|
||||||
color = gimp_context_get_background (data_editor->context);
|
|
||||||
gegl_color_get_rgba_with_space (color, &bg.r, &bg.g, &bg.b, &bg.a, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* pretend the gradient not being editable while the dialog is
|
/* pretend the gradient not being editable while the dialog is
|
||||||
* insensitive. prevents the gradient from being modified while a
|
* insensitive. prevents the gradient from being modified while a
|
||||||
* dialog is running. bug #161411 --mitch
|
* dialog is running. bug #161411 --mitch
|
||||||
|
@ -617,23 +606,25 @@ gradient_editor_actions_update (GimpActionGroup *group,
|
||||||
SET_SENSITIVE ("gradient-editor-load-left-left-neighbor", editable);
|
SET_SENSITIVE ("gradient-editor-load-left-left-neighbor", editable);
|
||||||
SET_SENSITIVE ("gradient-editor-load-left-right-endpoint", editable);
|
SET_SENSITIVE ("gradient-editor-load-left-right-endpoint", editable);
|
||||||
|
|
||||||
|
color = gegl_color_new (NULL);
|
||||||
|
|
||||||
if (gradient)
|
if (gradient)
|
||||||
{
|
{
|
||||||
SET_COLOR ("gradient-editor-left-color",
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &left_color);
|
||||||
&left_color, FALSE);
|
SET_COLOR ("gradient-editor-left-color", color, FALSE);
|
||||||
SET_COLOR ("gradient-editor-load-left-left-neighbor",
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &left_seg_color);
|
||||||
&left_seg_color, FALSE);
|
SET_COLOR ("gradient-editor-load-left-left-neighbor", color, FALSE);
|
||||||
SET_COLOR ("gradient-editor-load-left-right-endpoint",
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &right_color);
|
||||||
&right_color, FALSE);
|
SET_COLOR ("gradient-editor-load-left-right-endpoint", color, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
SET_SENSITIVE ("gradient-editor-load-left-fg", left_editable);
|
SET_SENSITIVE ("gradient-editor-load-left-fg", left_editable);
|
||||||
SET_SENSITIVE ("gradient-editor-load-left-bg", left_editable);
|
SET_SENSITIVE ("gradient-editor-load-left-bg", left_editable);
|
||||||
|
|
||||||
SET_COLOR ("gradient-editor-load-left-fg",
|
SET_COLOR ("gradient-editor-load-left-fg",
|
||||||
data_editor->context ? &fg : NULL, FALSE);
|
data_editor->context ? gimp_context_get_foreground (data_editor->context) : NULL, FALSE);
|
||||||
SET_COLOR ("gradient-editor-load-left-bg",
|
SET_COLOR ("gradient-editor-load-left-bg",
|
||||||
data_editor->context ? &bg : NULL, FALSE);
|
data_editor->context ? gimp_context_get_background (data_editor->context) : NULL, FALSE);
|
||||||
|
|
||||||
SET_SENSITIVE ("gradient-editor-load-left-01", left_editable);
|
SET_SENSITIVE ("gradient-editor-load-left-01", left_editable);
|
||||||
SET_SENSITIVE ("gradient-editor-load-left-02", left_editable);
|
SET_SENSITIVE ("gradient-editor-load-left-02", left_editable);
|
||||||
|
@ -646,16 +637,26 @@ gradient_editor_actions_update (GimpActionGroup *group,
|
||||||
SET_SENSITIVE ("gradient-editor-load-left-09", left_editable);
|
SET_SENSITIVE ("gradient-editor-load-left-09", left_editable);
|
||||||
SET_SENSITIVE ("gradient-editor-load-left-10", left_editable);
|
SET_SENSITIVE ("gradient-editor-load-left-10", left_editable);
|
||||||
|
|
||||||
SET_COLOR ("gradient-editor-load-left-01", &editor->saved_colors[0], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[0]);
|
||||||
SET_COLOR ("gradient-editor-load-left-02", &editor->saved_colors[1], TRUE);
|
SET_COLOR ("gradient-editor-load-left-01", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-load-left-03", &editor->saved_colors[2], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[1]);
|
||||||
SET_COLOR ("gradient-editor-load-left-04", &editor->saved_colors[3], TRUE);
|
SET_COLOR ("gradient-editor-load-left-02", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-load-left-05", &editor->saved_colors[4], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[2]);
|
||||||
SET_COLOR ("gradient-editor-load-left-06", &editor->saved_colors[5], TRUE);
|
SET_COLOR ("gradient-editor-load-left-03", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-load-left-07", &editor->saved_colors[6], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[3]);
|
||||||
SET_COLOR ("gradient-editor-load-left-08", &editor->saved_colors[7], TRUE);
|
SET_COLOR ("gradient-editor-load-left-04", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-load-left-09", &editor->saved_colors[8], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[4]);
|
||||||
SET_COLOR ("gradient-editor-load-left-10", &editor->saved_colors[9], TRUE);
|
SET_COLOR ("gradient-editor-load-left-05", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[5]);
|
||||||
|
SET_COLOR ("gradient-editor-load-left-06", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[6]);
|
||||||
|
SET_COLOR ("gradient-editor-load-left-07", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[7]);
|
||||||
|
SET_COLOR ("gradient-editor-load-left-08", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[8]);
|
||||||
|
SET_COLOR ("gradient-editor-load-left-09", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[9]);
|
||||||
|
SET_COLOR ("gradient-editor-load-left-10", color, TRUE);
|
||||||
|
|
||||||
SET_SENSITIVE ("gradient-editor-save-left-01", gradient);
|
SET_SENSITIVE ("gradient-editor-save-left-01", gradient);
|
||||||
SET_SENSITIVE ("gradient-editor-save-left-02", gradient);
|
SET_SENSITIVE ("gradient-editor-save-left-02", gradient);
|
||||||
|
@ -668,16 +669,26 @@ gradient_editor_actions_update (GimpActionGroup *group,
|
||||||
SET_SENSITIVE ("gradient-editor-save-left-09", gradient);
|
SET_SENSITIVE ("gradient-editor-save-left-09", gradient);
|
||||||
SET_SENSITIVE ("gradient-editor-save-left-10", gradient);
|
SET_SENSITIVE ("gradient-editor-save-left-10", gradient);
|
||||||
|
|
||||||
SET_COLOR ("gradient-editor-save-left-01", &editor->saved_colors[0], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[0]);
|
||||||
SET_COLOR ("gradient-editor-save-left-02", &editor->saved_colors[1], TRUE);
|
SET_COLOR ("gradient-editor-save-left-01", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-save-left-03", &editor->saved_colors[2], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[1]);
|
||||||
SET_COLOR ("gradient-editor-save-left-04", &editor->saved_colors[3], TRUE);
|
SET_COLOR ("gradient-editor-save-left-02", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-save-left-05", &editor->saved_colors[4], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[2]);
|
||||||
SET_COLOR ("gradient-editor-save-left-06", &editor->saved_colors[5], TRUE);
|
SET_COLOR ("gradient-editor-save-left-03", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-save-left-07", &editor->saved_colors[6], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[3]);
|
||||||
SET_COLOR ("gradient-editor-save-left-08", &editor->saved_colors[7], TRUE);
|
SET_COLOR ("gradient-editor-save-left-04", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-save-left-09", &editor->saved_colors[8], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[4]);
|
||||||
SET_COLOR ("gradient-editor-save-left-10", &editor->saved_colors[9], TRUE);
|
SET_COLOR ("gradient-editor-save-left-05", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[5]);
|
||||||
|
SET_COLOR ("gradient-editor-save-left-06", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[6]);
|
||||||
|
SET_COLOR ("gradient-editor-save-left-07", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[7]);
|
||||||
|
SET_COLOR ("gradient-editor-save-left-08", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[8]);
|
||||||
|
SET_COLOR ("gradient-editor-save-left-09", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[9]);
|
||||||
|
SET_COLOR ("gradient-editor-save-left-10", color, TRUE);
|
||||||
|
|
||||||
SET_SENSITIVE ("gradient-editor-right-color-fixed", editable);
|
SET_SENSITIVE ("gradient-editor-right-color-fixed", editable);
|
||||||
SET_SENSITIVE ("gradient-editor-right-color-foreground", editable);
|
SET_SENSITIVE ("gradient-editor-right-color-foreground", editable);
|
||||||
|
@ -713,21 +724,21 @@ gradient_editor_actions_update (GimpActionGroup *group,
|
||||||
|
|
||||||
if (gradient)
|
if (gradient)
|
||||||
{
|
{
|
||||||
SET_COLOR ("gradient-editor-right-color",
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &right_color);
|
||||||
&right_color, FALSE);
|
SET_COLOR ("gradient-editor-right-color", color, FALSE);
|
||||||
SET_COLOR ("gradient-editor-load-right-right-neighbor",
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &right_seg_color);
|
||||||
&right_seg_color, FALSE);
|
SET_COLOR ("gradient-editor-load-right-right-neighbor", color, FALSE);
|
||||||
SET_COLOR ("gradient-editor-load-right-left-endpoint",
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &left_color);
|
||||||
&left_color, FALSE);
|
SET_COLOR ("gradient-editor-load-right-left-endpoint", color, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
SET_SENSITIVE ("gradient-editor-load-right-fg", right_editable);
|
SET_SENSITIVE ("gradient-editor-load-right-fg", right_editable);
|
||||||
SET_SENSITIVE ("gradient-editor-load-right-bg", right_editable);
|
SET_SENSITIVE ("gradient-editor-load-right-bg", right_editable);
|
||||||
|
|
||||||
SET_COLOR ("gradient-editor-load-right-fg",
|
SET_COLOR ("gradient-editor-load-right-fg",
|
||||||
data_editor->context ? &fg : NULL, FALSE);
|
data_editor->context ? gimp_context_get_foreground (data_editor->context) : NULL, FALSE);
|
||||||
SET_COLOR ("gradient-editor-load-right-bg",
|
SET_COLOR ("gradient-editor-load-right-bg",
|
||||||
data_editor->context ? &bg : NULL, FALSE);
|
data_editor->context ? gimp_context_get_background (data_editor->context) : NULL, FALSE);
|
||||||
|
|
||||||
SET_SENSITIVE ("gradient-editor-load-right-01", right_editable);
|
SET_SENSITIVE ("gradient-editor-load-right-01", right_editable);
|
||||||
SET_SENSITIVE ("gradient-editor-load-right-02", right_editable);
|
SET_SENSITIVE ("gradient-editor-load-right-02", right_editable);
|
||||||
|
@ -740,16 +751,26 @@ gradient_editor_actions_update (GimpActionGroup *group,
|
||||||
SET_SENSITIVE ("gradient-editor-load-right-09", right_editable);
|
SET_SENSITIVE ("gradient-editor-load-right-09", right_editable);
|
||||||
SET_SENSITIVE ("gradient-editor-load-right-10", right_editable);
|
SET_SENSITIVE ("gradient-editor-load-right-10", right_editable);
|
||||||
|
|
||||||
SET_COLOR ("gradient-editor-load-right-01", &editor->saved_colors[0], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[0]);
|
||||||
SET_COLOR ("gradient-editor-load-right-02", &editor->saved_colors[1], TRUE);
|
SET_COLOR ("gradient-editor-load-right-01", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-load-right-03", &editor->saved_colors[2], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[1]);
|
||||||
SET_COLOR ("gradient-editor-load-right-04", &editor->saved_colors[3], TRUE);
|
SET_COLOR ("gradient-editor-load-right-02", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-load-right-05", &editor->saved_colors[4], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[2]);
|
||||||
SET_COLOR ("gradient-editor-load-right-06", &editor->saved_colors[5], TRUE);
|
SET_COLOR ("gradient-editor-load-right-03", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-load-right-07", &editor->saved_colors[6], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[3]);
|
||||||
SET_COLOR ("gradient-editor-load-right-08", &editor->saved_colors[7], TRUE);
|
SET_COLOR ("gradient-editor-load-right-04", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-load-right-09", &editor->saved_colors[8], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[4]);
|
||||||
SET_COLOR ("gradient-editor-load-right-10", &editor->saved_colors[9], TRUE);
|
SET_COLOR ("gradient-editor-load-right-05", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[5]);
|
||||||
|
SET_COLOR ("gradient-editor-load-right-06", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[6]);
|
||||||
|
SET_COLOR ("gradient-editor-load-right-07", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[7]);
|
||||||
|
SET_COLOR ("gradient-editor-load-right-08", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[8]);
|
||||||
|
SET_COLOR ("gradient-editor-load-right-09", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[9]);
|
||||||
|
SET_COLOR ("gradient-editor-load-right-10", color, TRUE);
|
||||||
|
|
||||||
SET_SENSITIVE ("gradient-editor-save-right-01", gradient);
|
SET_SENSITIVE ("gradient-editor-save-right-01", gradient);
|
||||||
SET_SENSITIVE ("gradient-editor-save-right-02", gradient);
|
SET_SENSITIVE ("gradient-editor-save-right-02", gradient);
|
||||||
|
@ -762,16 +783,26 @@ gradient_editor_actions_update (GimpActionGroup *group,
|
||||||
SET_SENSITIVE ("gradient-editor-save-right-09", gradient);
|
SET_SENSITIVE ("gradient-editor-save-right-09", gradient);
|
||||||
SET_SENSITIVE ("gradient-editor-save-right-10", gradient);
|
SET_SENSITIVE ("gradient-editor-save-right-10", gradient);
|
||||||
|
|
||||||
SET_COLOR ("gradient-editor-save-right-01", &editor->saved_colors[0], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[0]);
|
||||||
SET_COLOR ("gradient-editor-save-right-02", &editor->saved_colors[1], TRUE);
|
SET_COLOR ("gradient-editor-save-right-01", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-save-right-03", &editor->saved_colors[2], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[1]);
|
||||||
SET_COLOR ("gradient-editor-save-right-04", &editor->saved_colors[3], TRUE);
|
SET_COLOR ("gradient-editor-save-right-02", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-save-right-05", &editor->saved_colors[4], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[2]);
|
||||||
SET_COLOR ("gradient-editor-save-right-06", &editor->saved_colors[5], TRUE);
|
SET_COLOR ("gradient-editor-save-right-03", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-save-right-07", &editor->saved_colors[6], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[3]);
|
||||||
SET_COLOR ("gradient-editor-save-right-08", &editor->saved_colors[7], TRUE);
|
SET_COLOR ("gradient-editor-save-right-04", color, TRUE);
|
||||||
SET_COLOR ("gradient-editor-save-right-09", &editor->saved_colors[8], TRUE);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[4]);
|
||||||
SET_COLOR ("gradient-editor-save-right-10", &editor->saved_colors[9], TRUE);
|
SET_COLOR ("gradient-editor-save-right-05", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[5]);
|
||||||
|
SET_COLOR ("gradient-editor-save-right-06", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[6]);
|
||||||
|
SET_COLOR ("gradient-editor-save-right-07", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[7]);
|
||||||
|
SET_COLOR ("gradient-editor-save-right-08", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[8]);
|
||||||
|
SET_COLOR ("gradient-editor-save-right-09", color, TRUE);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &editor->saved_colors[9]);
|
||||||
|
SET_COLOR ("gradient-editor-save-right-10", color, TRUE);
|
||||||
|
|
||||||
SET_SENSITIVE ("gradient-editor-flip", editable);
|
SET_SENSITIVE ("gradient-editor-flip", editable);
|
||||||
SET_SENSITIVE ("gradient-editor-replicate", editable);
|
SET_SENSITIVE ("gradient-editor-replicate", editable);
|
||||||
|
@ -906,4 +937,6 @@ gradient_editor_actions_update (GimpActionGroup *group,
|
||||||
#undef SET_LABEL
|
#undef SET_LABEL
|
||||||
#undef SET_SENSITIVE
|
#undef SET_SENSITIVE
|
||||||
#undef SET_VISIBLE
|
#undef SET_VISIBLE
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,10 +55,14 @@ items_actions_setup (GimpActionGroup *group,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
gimp_get_color_tag_color (value->value, &color, FALSE);
|
gimp_get_color_tag_color (value->value, &rgb, FALSE);
|
||||||
gimp_action_group_set_action_color (group, action, &color, FALSE);
|
color = gegl_color_new (NULL);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
gimp_action_group_set_action_color (group, action, color, FALSE);
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,8 +131,6 @@ palette_editor_actions_update (GimpActionGroup *group,
|
||||||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (user_data);
|
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (user_data);
|
||||||
GimpData *data;
|
GimpData *data;
|
||||||
gboolean editable = FALSE;
|
gboolean editable = FALSE;
|
||||||
GimpRGB fg;
|
|
||||||
GimpRGB bg;
|
|
||||||
gboolean edit_active = FALSE;
|
gboolean edit_active = FALSE;
|
||||||
|
|
||||||
data = data_editor->data;
|
data = data_editor->data;
|
||||||
|
@ -143,16 +141,6 @@ palette_editor_actions_update (GimpActionGroup *group,
|
||||||
editable = TRUE;
|
editable = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data_editor->context)
|
|
||||||
{
|
|
||||||
GeglColor *color;
|
|
||||||
|
|
||||||
color = gimp_context_get_foreground (data_editor->context);
|
|
||||||
gegl_color_get_rgba_with_space (color, &fg.r, &fg.g, &fg.b, &fg.a, NULL);
|
|
||||||
color = gimp_context_get_background (data_editor->context);
|
|
||||||
gegl_color_get_rgba_with_space (color, &bg.r, &bg.g, &bg.b, &bg.a, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
edit_active = gimp_data_editor_get_edit_active (data_editor);
|
edit_active = gimp_data_editor_get_edit_active (data_editor);
|
||||||
|
|
||||||
#define SET_SENSITIVE(action,condition) \
|
#define SET_SENSITIVE(action,condition) \
|
||||||
|
@ -168,8 +156,8 @@ palette_editor_actions_update (GimpActionGroup *group,
|
||||||
SET_SENSITIVE ("palette-editor-new-color-fg", editable);
|
SET_SENSITIVE ("palette-editor-new-color-fg", editable);
|
||||||
SET_SENSITIVE ("palette-editor-new-color-bg", editable);
|
SET_SENSITIVE ("palette-editor-new-color-bg", editable);
|
||||||
|
|
||||||
SET_COLOR ("palette-editor-new-color-fg", data_editor->context ? &fg : NULL);
|
SET_COLOR ("palette-editor-new-color-fg", data_editor->context ? gimp_context_get_foreground (data_editor->context) : NULL);
|
||||||
SET_COLOR ("palette-editor-new-color-bg", data_editor->context ? &bg : NULL);
|
SET_COLOR ("palette-editor-new-color-bg", data_editor->context ? gimp_context_get_background (data_editor->context) : NULL);
|
||||||
|
|
||||||
SET_SENSITIVE ("palette-editor-zoom-out", data);
|
SET_SENSITIVE ("palette-editor-zoom-out", data);
|
||||||
SET_SENSITIVE ("palette-editor-zoom-in", data);
|
SET_SENSITIVE ("palette-editor-zoom-in", data);
|
||||||
|
|
|
@ -125,13 +125,8 @@ quick_mask_actions_update (GimpActionGroup *group,
|
||||||
|
|
||||||
SET_SENSITIVE ("quick-mask-configure", image);
|
SET_SENSITIVE ("quick-mask-configure", image);
|
||||||
|
|
||||||
if (image)
|
if (quick_mask_color)
|
||||||
{
|
SET_COLOR ("quick-mask-configure", quick_mask_color);
|
||||||
GimpRGB rgb;
|
|
||||||
|
|
||||||
gegl_color_get_pixel (quick_mask_color, babl_format ("R'G'B'A double"), &rgb);
|
|
||||||
SET_COLOR ("quick-mask-configure", &rgb);
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef SET_SENSITIVE
|
#undef SET_SENSITIVE
|
||||||
#undef SET_ACTIVE
|
#undef SET_ACTIVE
|
||||||
|
|
|
@ -1053,10 +1053,8 @@ view_actions_check_type_notify (GimpDisplayConfig *config,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
GimpActionGroup *group)
|
GimpActionGroup *group)
|
||||||
{
|
{
|
||||||
GimpRGB rgb;
|
gimp_action_group_set_action_color (group, "view-padding-color-light-check",
|
||||||
|
(GeglColor *) gimp_render_check_color1 (), FALSE);
|
||||||
gegl_color_get_pixel ((GeglColor *) gimp_render_check_color1 (), babl_format ("R'G'B'A double"), &rgb);
|
gimp_action_group_set_action_color (group, "view-padding-color-dark-check",
|
||||||
gimp_action_group_set_action_color (group, "view-padding-color-light-check", &rgb, FALSE);
|
(GeglColor *) gimp_render_check_color2 (), FALSE);
|
||||||
gegl_color_get_pixel ((GeglColor *) gimp_render_check_color2 (), babl_format ("R'G'B'A double"), &rgb);
|
|
||||||
gimp_action_group_set_action_color (group, "view-padding-color-dark-check", &rgb, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,8 +148,7 @@ channel_options_dialog_new (GimpImage *image,
|
||||||
item_options_dialog_add_widget (dialog,
|
item_options_dialog_add_widget (dialog,
|
||||||
opacity_label, scale);
|
opacity_label, scale);
|
||||||
|
|
||||||
private->color_panel = gimp_color_panel_new (color_label,
|
private->color_panel = gimp_color_panel_new (color_label, channel_color,
|
||||||
&rgb,
|
|
||||||
GIMP_COLOR_AREA_LARGE_CHECKS,
|
GIMP_COLOR_AREA_LARGE_CHECKS,
|
||||||
24, 24);
|
24, 24);
|
||||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (private->color_panel),
|
gimp_color_panel_set_context (GIMP_COLOR_PANEL (private->color_panel),
|
||||||
|
@ -201,12 +200,10 @@ channel_options_dialog_callback (GtkWidget *dialog,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
ChannelOptionsDialog *private = user_data;
|
ChannelOptionsDialog *private = user_data;
|
||||||
GeglColor *color = gegl_color_new (NULL);
|
GeglColor *color;
|
||||||
GimpRGB rgb;
|
|
||||||
gboolean save_selection = FALSE;
|
gboolean save_selection = FALSE;
|
||||||
|
|
||||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (private->color_panel), &rgb);
|
color = gimp_color_button_get_color (GIMP_COLOR_BUTTON (private->color_panel));
|
||||||
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
|
||||||
|
|
||||||
if (private->save_sel_toggle)
|
if (private->save_sel_toggle)
|
||||||
save_selection =
|
save_selection =
|
||||||
|
@ -225,25 +222,31 @@ channel_options_dialog_callback (GtkWidget *dialog,
|
||||||
item_lock_position,
|
item_lock_position,
|
||||||
item_lock_visibility,
|
item_lock_visibility,
|
||||||
private->user_data);
|
private->user_data);
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
channel_options_opacity_changed (GtkAdjustment *adjustment,
|
channel_options_opacity_changed (GtkAdjustment *adjustment,
|
||||||
GimpColorButton *color_button)
|
GimpColorButton *color_button)
|
||||||
{
|
{
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
|
||||||
gimp_color_button_get_color (color_button, &color);
|
color = gimp_color_button_get_color (color_button);
|
||||||
gimp_rgb_set_alpha (&color, gtk_adjustment_get_value (adjustment) / 100.0);
|
gimp_color_set_alpha (color, gtk_adjustment_get_value (adjustment) / 100.0);
|
||||||
gimp_color_button_set_color (color_button, &color);
|
gimp_color_button_set_color (color_button, color);
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
channel_options_color_changed (GimpColorButton *button,
|
channel_options_color_changed (GimpColorButton *button,
|
||||||
GtkAdjustment *adjustment)
|
GtkAdjustment *adjustment)
|
||||||
{
|
{
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
gdouble rgba[4];
|
||||||
|
|
||||||
gimp_color_button_get_color (button, &color);
|
color = gimp_color_button_get_color (button);
|
||||||
gtk_adjustment_set_value (adjustment, color.a * 100.0);
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), rgba);
|
||||||
|
gtk_adjustment_set_value (adjustment, rgba[3] * 100.0);
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ gimp_display_shell_set_action_active (GimpDisplayShell *shell,
|
||||||
void
|
void
|
||||||
gimp_display_shell_set_action_color (GimpDisplayShell *shell,
|
gimp_display_shell_set_action_color (GimpDisplayShell *shell,
|
||||||
const gchar *action,
|
const gchar *action,
|
||||||
const GimpRGB *color)
|
GeglColor *color)
|
||||||
{
|
{
|
||||||
GimpImageWindow *window;
|
GimpImageWindow *window;
|
||||||
GimpContext *context;
|
GimpContext *context;
|
||||||
|
|
|
@ -27,7 +27,7 @@ void gimp_display_shell_set_action_active (GimpDisplayShell *shell,
|
||||||
gboolean active);
|
gboolean active);
|
||||||
void gimp_display_shell_set_action_color (GimpDisplayShell *shell,
|
void gimp_display_shell_set_action_color (GimpDisplayShell *shell,
|
||||||
const gchar *action,
|
const gchar *action,
|
||||||
const GimpRGB *color);
|
GeglColor *color);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_DISPLAY_SHELL_ACTIONS_H__ */
|
#endif /* __GIMP_DISPLAY_SHELL_ACTIONS_H__ */
|
||||||
|
|
|
@ -400,7 +400,8 @@ gimp_gradient_tool_editor_color_entry_color_changed (GimpColorButton *button,
|
||||||
GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
|
GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
|
||||||
GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (options);
|
GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (options);
|
||||||
gint selection;
|
gint selection;
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
Direction direction;
|
Direction direction;
|
||||||
GtkWidget *chain_button;
|
GtkWidget *chain_button;
|
||||||
GimpGradientSegment *seg;
|
GimpGradientSegment *seg;
|
||||||
|
@ -411,7 +412,9 @@ gimp_gradient_tool_editor_color_entry_color_changed (GimpColorButton *button,
|
||||||
selection =
|
selection =
|
||||||
gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
|
gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
|
||||||
|
|
||||||
gimp_color_button_get_color (button, &color);
|
color = gimp_color_button_get_color (button);
|
||||||
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
g_object_unref (color);
|
||||||
|
|
||||||
direction =
|
direction =
|
||||||
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
|
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
|
||||||
|
@ -442,12 +445,12 @@ gimp_gradient_tool_editor_color_entry_color_changed (GimpColorButton *button,
|
||||||
switch (selection)
|
switch (selection)
|
||||||
{
|
{
|
||||||
case GIMP_TOOL_LINE_HANDLE_START:
|
case GIMP_TOOL_LINE_HANDLE_START:
|
||||||
seg->left_color = color;
|
seg->left_color = rgb;
|
||||||
seg->left_color_type = GIMP_GRADIENT_COLOR_FIXED;
|
seg->left_color_type = GIMP_GRADIENT_COLOR_FIXED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_TOOL_LINE_HANDLE_END:
|
case GIMP_TOOL_LINE_HANDLE_END:
|
||||||
seg->right_color = color;
|
seg->right_color = rgb;
|
||||||
seg->right_color_type = GIMP_GRADIENT_COLOR_FIXED;
|
seg->right_color_type = GIMP_GRADIENT_COLOR_FIXED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -456,7 +459,7 @@ gimp_gradient_tool_editor_color_entry_color_changed (GimpColorButton *button,
|
||||||
(chain_button &&
|
(chain_button &&
|
||||||
gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (chain_button))))
|
gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (chain_button))))
|
||||||
{
|
{
|
||||||
seg->right_color = color;
|
seg->right_color = rgb;
|
||||||
seg->right_color_type = GIMP_GRADIENT_COLOR_FIXED;
|
seg->right_color_type = GIMP_GRADIENT_COLOR_FIXED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,7 +467,7 @@ gimp_gradient_tool_editor_color_entry_color_changed (GimpColorButton *button,
|
||||||
(chain_button &&
|
(chain_button &&
|
||||||
gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (chain_button))))
|
gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (chain_button))))
|
||||||
{
|
{
|
||||||
seg->next->left_color = color;
|
seg->next->left_color = rgb;
|
||||||
seg->next->left_color_type = GIMP_GRADIENT_COLOR_FIXED;
|
seg->next->left_color_type = GIMP_GRADIENT_COLOR_FIXED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1202,14 +1205,15 @@ gimp_gradient_tool_editor_color_entry_new (GimpGradientTool *gradient_tool,
|
||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GtkWidget *combo;
|
GtkWidget *combo;
|
||||||
GimpRGB color = {};
|
GeglColor *color = gegl_color_new ("transparent");
|
||||||
|
|
||||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
||||||
|
|
||||||
/* the color panel */
|
/* the color panel */
|
||||||
*color_panel = button = gimp_color_panel_new (title, &color,
|
*color_panel = button = gimp_color_panel_new (title, color,
|
||||||
GIMP_COLOR_AREA_SMALL_CHECKS,
|
GIMP_COLOR_AREA_SMALL_CHECKS,
|
||||||
24, 24);
|
24, 24);
|
||||||
|
g_object_unref (color);
|
||||||
gimp_color_button_set_update (GIMP_COLOR_BUTTON (button), TRUE);
|
gimp_color_button_set_update (GIMP_COLOR_BUTTON (button), TRUE);
|
||||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (button), context);
|
gimp_color_panel_set_context (GIMP_COLOR_PANEL (button), context);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||||
|
@ -1570,7 +1574,8 @@ gimp_gradient_tool_editor_update_endpoint_gui (GimpGradientTool *gradient_tool,
|
||||||
const gchar *title;
|
const gchar *title;
|
||||||
gdouble x;
|
gdouble x;
|
||||||
gdouble y;
|
gdouble y;
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
GimpGradientColor color_type;
|
GimpGradientColor color_type;
|
||||||
|
|
||||||
editable = gimp_gradient_tool_editor_is_gradient_editable (gradient_tool);
|
editable = gimp_gradient_tool_editor_is_gradient_editable (gradient_tool);
|
||||||
|
@ -1618,7 +1623,7 @@ gimp_gradient_tool_editor_update_endpoint_gui (GimpGradientTool *gradient_tool,
|
||||||
title = _("Start Endpoint");
|
title = _("Start Endpoint");
|
||||||
|
|
||||||
gimp_gradient_segment_get_left_flat_color (gradient_tool->gradient, context,
|
gimp_gradient_segment_get_left_flat_color (gradient_tool->gradient, context,
|
||||||
seg, &color);
|
seg, &rgb);
|
||||||
color_type = seg->left_color_type;
|
color_type = seg->left_color_type;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1626,7 +1631,7 @@ gimp_gradient_tool_editor_update_endpoint_gui (GimpGradientTool *gradient_tool,
|
||||||
title = _("End Endpoint");
|
title = _("End Endpoint");
|
||||||
|
|
||||||
gimp_gradient_segment_get_right_flat_color (gradient_tool->gradient, context,
|
gimp_gradient_segment_get_right_flat_color (gradient_tool->gradient, context,
|
||||||
seg, &color);
|
seg, &rgb);
|
||||||
color_type = seg->right_color_type;
|
color_type = seg->right_color_type;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1639,8 +1644,11 @@ gimp_gradient_tool_editor_update_endpoint_gui (GimpGradientTool *gradient_tool,
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (gradient_tool->endpoint_se), 0, x);
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (gradient_tool->endpoint_se), 0, x);
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (gradient_tool->endpoint_se), 1, y);
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (gradient_tool->endpoint_se), 1, y);
|
||||||
|
|
||||||
|
color = gegl_color_new (NULL);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
gimp_color_button_set_color (
|
gimp_color_button_set_color (
|
||||||
GIMP_COLOR_BUTTON (gradient_tool->endpoint_color_panel), &color);
|
GIMP_COLOR_BUTTON (gradient_tool->endpoint_color_panel), color);
|
||||||
|
g_object_unref (color);
|
||||||
gimp_int_combo_box_set_active (
|
gimp_int_combo_box_set_active (
|
||||||
GIMP_INT_COMBO_BOX (gradient_tool->endpoint_type_combo), color_type);
|
GIMP_INT_COMBO_BOX (gradient_tool->endpoint_type_combo), color_type);
|
||||||
|
|
||||||
|
@ -1663,6 +1671,7 @@ gimp_gradient_tool_editor_update_stop_gui (GimpGradientTool *gradient_tool,
|
||||||
gdouble min;
|
gdouble min;
|
||||||
gdouble max;
|
gdouble max;
|
||||||
gdouble value;
|
gdouble value;
|
||||||
|
GeglColor *color;
|
||||||
GimpRGB left_color;
|
GimpRGB left_color;
|
||||||
GimpGradientColor left_color_type;
|
GimpGradientColor left_color_type;
|
||||||
GimpRGB right_color;
|
GimpRGB right_color;
|
||||||
|
@ -1697,13 +1706,17 @@ gimp_gradient_tool_editor_update_stop_gui (GimpGradientTool *gradient_tool,
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (gradient_tool->stop_se),
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (gradient_tool->stop_se),
|
||||||
0, 100.0 * value);
|
0, 100.0 * value);
|
||||||
|
|
||||||
|
color = gegl_color_new (NULL);
|
||||||
|
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &left_color);
|
||||||
gimp_color_button_set_color (
|
gimp_color_button_set_color (
|
||||||
GIMP_COLOR_BUTTON (gradient_tool->stop_left_color_panel), &left_color);
|
GIMP_COLOR_BUTTON (gradient_tool->stop_left_color_panel), color);
|
||||||
gimp_int_combo_box_set_active (
|
gimp_int_combo_box_set_active (
|
||||||
GIMP_INT_COMBO_BOX (gradient_tool->stop_left_type_combo), left_color_type);
|
GIMP_INT_COMBO_BOX (gradient_tool->stop_left_type_combo), left_color_type);
|
||||||
|
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &right_color);
|
||||||
gimp_color_button_set_color (
|
gimp_color_button_set_color (
|
||||||
GIMP_COLOR_BUTTON (gradient_tool->stop_right_color_panel), &right_color);
|
GIMP_COLOR_BUTTON (gradient_tool->stop_right_color_panel), color);
|
||||||
gimp_int_combo_box_set_active (
|
gimp_int_combo_box_set_active (
|
||||||
GIMP_INT_COMBO_BOX (gradient_tool->stop_right_type_combo), right_color_type);
|
GIMP_INT_COMBO_BOX (gradient_tool->stop_right_type_combo), right_color_type);
|
||||||
|
|
||||||
|
@ -1718,6 +1731,7 @@ gimp_gradient_tool_editor_update_stop_gui (GimpGradientTool *gradient_tool,
|
||||||
editable);
|
editable);
|
||||||
|
|
||||||
g_free (title);
|
g_free (title);
|
||||||
|
g_object_unref (color);
|
||||||
|
|
||||||
gtk_widget_show (gradient_tool->stop_editor);
|
gtk_widget_show (gradient_tool->stop_editor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ struct _GimpActionPrivate
|
||||||
|
|
||||||
gchar *menu_path;
|
gchar *menu_path;
|
||||||
|
|
||||||
GimpRGB *color;
|
GeglColor *color;
|
||||||
GimpViewable *viewable;
|
GimpViewable *viewable;
|
||||||
PangoEllipsizeMode ellipsize;
|
PangoEllipsizeMode ellipsize;
|
||||||
gint max_width_chars;
|
gint max_width_chars;
|
||||||
|
@ -114,8 +114,6 @@ static guint action_signals[LAST_SIGNAL];
|
||||||
static void
|
static void
|
||||||
gimp_action_default_init (GimpActionInterface *iface)
|
gimp_action_default_init (GimpActionInterface *iface)
|
||||||
{
|
{
|
||||||
GimpRGB black;
|
|
||||||
|
|
||||||
action_signals[ACTIVATE] =
|
action_signals[ACTIVATE] =
|
||||||
g_signal_new ("activate",
|
g_signal_new ("activate",
|
||||||
G_TYPE_FROM_INTERFACE (iface),
|
G_TYPE_FROM_INTERFACE (iface),
|
||||||
|
@ -182,11 +180,10 @@ gimp_action_default_init (GimpActionInterface *iface)
|
||||||
GIMP_PARAM_READWRITE |
|
GIMP_PARAM_READWRITE |
|
||||||
G_PARAM_EXPLICIT_NOTIFY));
|
G_PARAM_EXPLICIT_NOTIFY));
|
||||||
|
|
||||||
gimp_rgba_set (&black, 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE);
|
|
||||||
g_object_interface_install_property (iface,
|
g_object_interface_install_property (iface,
|
||||||
gimp_param_spec_rgb ("color",
|
gegl_param_spec_color_from_string ("color",
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
TRUE, &black,
|
"black",
|
||||||
GIMP_PARAM_READWRITE));
|
GIMP_PARAM_READWRITE));
|
||||||
g_object_interface_install_property (iface,
|
g_object_interface_install_property (iface,
|
||||||
g_param_spec_object ("viewable",
|
g_param_spec_object ("viewable",
|
||||||
|
@ -899,7 +896,7 @@ gimp_action_get_property (GObject *object,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_ACTION_PROP_COLOR:
|
case GIMP_ACTION_PROP_COLOR:
|
||||||
g_value_set_boxed (value, priv->color);
|
g_value_set_object (value, priv->color);
|
||||||
break;
|
break;
|
||||||
case GIMP_ACTION_PROP_VIEWABLE:
|
case GIMP_ACTION_PROP_VIEWABLE:
|
||||||
g_value_set_object (value, priv->viewable);
|
g_value_set_object (value, priv->viewable);
|
||||||
|
@ -959,8 +956,10 @@ gimp_action_set_property (GObject *object,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_ACTION_PROP_COLOR:
|
case GIMP_ACTION_PROP_COLOR:
|
||||||
g_clear_pointer (&priv->color, g_free);
|
g_clear_object (&priv->color);
|
||||||
priv->color = g_value_dup_boxed (value);
|
if (g_value_get_object (value))
|
||||||
|
priv->color = gegl_color_duplicate (g_value_get_object (value));
|
||||||
|
|
||||||
set_proxy = TRUE;
|
set_proxy = TRUE;
|
||||||
break;
|
break;
|
||||||
case GIMP_ACTION_PROP_VIEWABLE:
|
case GIMP_ACTION_PROP_VIEWABLE:
|
||||||
|
@ -1009,26 +1008,21 @@ gimp_action_set_proxy (GimpAction *action,
|
||||||
{
|
{
|
||||||
if (priv->color)
|
if (priv->color)
|
||||||
{
|
{
|
||||||
GeglColor *color;
|
|
||||||
|
|
||||||
if (GTK_IS_MENU_ITEM (proxy))
|
if (GTK_IS_MENU_ITEM (proxy))
|
||||||
proxy_image = gimp_menu_item_get_image (GTK_MENU_ITEM (proxy));
|
proxy_image = gimp_menu_item_get_image (GTK_MENU_ITEM (proxy));
|
||||||
else
|
else
|
||||||
proxy_image = gtk_tool_button_get_label_widget (GTK_TOOL_BUTTON (proxy));
|
proxy_image = gtk_tool_button_get_label_widget (GTK_TOOL_BUTTON (proxy));
|
||||||
|
|
||||||
color = gegl_color_new (NULL);
|
|
||||||
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), priv->color);
|
|
||||||
|
|
||||||
if (GIMP_IS_COLOR_AREA (proxy_image))
|
if (GIMP_IS_COLOR_AREA (proxy_image))
|
||||||
{
|
{
|
||||||
gimp_color_area_set_color (GIMP_COLOR_AREA (proxy_image), color);
|
gimp_color_area_set_color (GIMP_COLOR_AREA (proxy_image), priv->color);
|
||||||
proxy_image = NULL;
|
proxy_image = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
|
||||||
proxy_image = gimp_color_area_new (color, GIMP_COLOR_AREA_SMALL_CHECKS, 0);
|
proxy_image = gimp_color_area_new (priv->color, GIMP_COLOR_AREA_SMALL_CHECKS, 0);
|
||||||
gimp_color_area_set_draw_border (GIMP_COLOR_AREA (proxy_image), TRUE);
|
gimp_color_area_set_draw_border (GIMP_COLOR_AREA (proxy_image), TRUE);
|
||||||
|
|
||||||
if (priv->context)
|
if (priv->context)
|
||||||
|
@ -1039,8 +1033,6 @@ gimp_action_set_proxy (GimpAction *action,
|
||||||
gtk_widget_set_size_request (proxy_image, width, height);
|
gtk_widget_set_size_request (proxy_image, width, height);
|
||||||
gtk_widget_show (proxy_image);
|
gtk_widget_show (proxy_image);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (color);
|
|
||||||
}
|
}
|
||||||
else if (priv->viewable)
|
else if (priv->viewable)
|
||||||
{
|
{
|
||||||
|
@ -1296,7 +1288,7 @@ gimp_action_private_finalize (GimpActionPrivate *priv)
|
||||||
{
|
{
|
||||||
g_clear_pointer (&priv->disable_reason, g_free);
|
g_clear_pointer (&priv->disable_reason, g_free);
|
||||||
g_clear_object (&priv->context);
|
g_clear_object (&priv->context);
|
||||||
g_clear_pointer (&priv->color, g_free);
|
g_clear_object (&priv->color);
|
||||||
g_clear_object (&priv->viewable);
|
g_clear_object (&priv->viewable);
|
||||||
|
|
||||||
g_free (priv->label);
|
g_free (priv->label);
|
||||||
|
|
|
@ -1161,7 +1161,7 @@ gimp_action_group_get_action_tooltip (GimpActionGroup *group,
|
||||||
void
|
void
|
||||||
gimp_action_group_set_action_color (GimpActionGroup *group,
|
gimp_action_group_set_action_color (GimpActionGroup *group,
|
||||||
const gchar *action_name,
|
const gchar *action_name,
|
||||||
const GimpRGB *color,
|
GeglColor *color,
|
||||||
gboolean set_label)
|
gboolean set_label)
|
||||||
{
|
{
|
||||||
GimpAction *action;
|
GimpAction *action;
|
||||||
|
@ -1192,10 +1192,18 @@ gimp_action_group_set_action_color (GimpActionGroup *group,
|
||||||
gchar *label;
|
gchar *label;
|
||||||
|
|
||||||
if (color)
|
if (color)
|
||||||
label = g_strdup_printf (_("RGBA (%0.3f, %0.3f, %0.3f, %0.3f)"),
|
{
|
||||||
color->r, color->g, color->b, color->a);
|
gfloat rgba[4];
|
||||||
|
|
||||||
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A float"), rgba);
|
||||||
|
|
||||||
|
label = g_strdup_printf (_("sRGB+A (%0.3f, %0.3f, %0.3f, %0.3f)"),
|
||||||
|
rgba[0], rgba[1], rgba[2], rgba[3]);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
label = g_strdup (_("(none)"));
|
label = g_strdup (_("(none)"));
|
||||||
|
}
|
||||||
|
|
||||||
g_object_set (action,
|
g_object_set (action,
|
||||||
"color", color,
|
"color", color,
|
||||||
|
|
|
@ -242,7 +242,7 @@ const gchar * gimp_action_group_get_action_tooltip (GimpActionGroup *group,
|
||||||
const gchar *action_name);
|
const gchar *action_name);
|
||||||
void gimp_action_group_set_action_color (GimpActionGroup *group,
|
void gimp_action_group_set_action_color (GimpActionGroup *group,
|
||||||
const gchar *action_name,
|
const gchar *action_name,
|
||||||
const GimpRGB *color,
|
GeglColor *color,
|
||||||
gboolean set_label);
|
gboolean set_label);
|
||||||
void gimp_action_group_set_action_viewable (GimpActionGroup *group,
|
void gimp_action_group_set_action_viewable (GimpActionGroup *group,
|
||||||
const gchar *action_name,
|
const gchar *action_name,
|
||||||
|
|
|
@ -176,9 +176,11 @@ static void
|
||||||
gimp_color_panel_clicked (GtkButton *button)
|
gimp_color_panel_clicked (GtkButton *button)
|
||||||
{
|
{
|
||||||
GimpColorPanel *panel = GIMP_COLOR_PANEL (button);
|
GimpColorPanel *panel = GIMP_COLOR_PANEL (button);
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (button), &color);
|
color = gimp_color_button_get_color (GIMP_COLOR_BUTTON (button));
|
||||||
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
|
||||||
if (! panel->color_dialog)
|
if (! panel->color_dialog)
|
||||||
{
|
{
|
||||||
|
@ -190,7 +192,7 @@ gimp_color_panel_clicked (GtkButton *button)
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
GTK_WIDGET (button),
|
GTK_WIDGET (button),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
&color,
|
&rgb,
|
||||||
gimp_color_button_get_update (color_button),
|
gimp_color_button_get_update (color_button),
|
||||||
gimp_color_button_has_alpha (color_button));
|
gimp_color_button_has_alpha (color_button));
|
||||||
|
|
||||||
|
@ -205,10 +207,12 @@ gimp_color_panel_clicked (GtkButton *button)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gimp_color_dialog_set_color (GIMP_COLOR_DIALOG (panel->color_dialog),
|
gimp_color_dialog_set_color (GIMP_COLOR_DIALOG (panel->color_dialog),
|
||||||
&color);
|
&rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_window_present (GTK_WINDOW (panel->color_dialog));
|
gtk_window_present (GTK_WINDOW (panel->color_dialog));
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GType
|
static GType
|
||||||
|
@ -222,7 +226,7 @@ gimp_color_panel_get_action_type (GimpColorButton *button)
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gimp_color_panel_new (const gchar *title,
|
gimp_color_panel_new (const gchar *title,
|
||||||
const GimpRGB *color,
|
GeglColor *color,
|
||||||
GimpColorAreaType type,
|
GimpColorAreaType type,
|
||||||
gint width,
|
gint width,
|
||||||
gint height)
|
gint height)
|
||||||
|
@ -245,22 +249,27 @@ static void
|
||||||
gimp_color_panel_color_changed (GimpColorButton *button)
|
gimp_color_panel_color_changed (GimpColorButton *button)
|
||||||
{
|
{
|
||||||
GimpColorPanel *panel = GIMP_COLOR_PANEL (button);
|
GimpColorPanel *panel = GIMP_COLOR_PANEL (button);
|
||||||
GimpRGB color;
|
|
||||||
|
|
||||||
if (panel->color_dialog)
|
if (panel->color_dialog)
|
||||||
{
|
{
|
||||||
|
GeglColor *color;
|
||||||
GimpRGB dialog_color;
|
GimpRGB dialog_color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
|
color = gimp_color_button_get_color (GIMP_COLOR_BUTTON (button));
|
||||||
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
|
||||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (button), &color);
|
|
||||||
gimp_color_dialog_get_color (GIMP_COLOR_DIALOG (panel->color_dialog),
|
gimp_color_dialog_get_color (GIMP_COLOR_DIALOG (panel->color_dialog),
|
||||||
&dialog_color);
|
&dialog_color);
|
||||||
|
|
||||||
if (gimp_rgba_distance (&color, &dialog_color) > RGBA_EPSILON ||
|
if (gimp_rgba_distance (&rgb, &dialog_color) > RGBA_EPSILON ||
|
||||||
color.a != dialog_color.a)
|
rgb.a != dialog_color.a)
|
||||||
{
|
{
|
||||||
gimp_color_dialog_set_color (GIMP_COLOR_DIALOG (panel->color_dialog),
|
gimp_color_dialog_set_color (GIMP_COLOR_DIALOG (panel->color_dialog),
|
||||||
&color);
|
&rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,10 +304,14 @@ gimp_color_panel_dialog_response (GimpColorPanel *panel,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_color_panel_dialog_update (GimpColorDialog *dialog,
|
gimp_color_panel_dialog_update (GimpColorDialog *dialog,
|
||||||
const GimpRGB *color,
|
const GimpRGB *rgb,
|
||||||
GimpColorDialogState state,
|
GimpColorDialogState state,
|
||||||
GimpColorPanel *panel)
|
GimpColorPanel *panel)
|
||||||
{
|
{
|
||||||
|
GeglColor *color = gegl_color_new (NULL);
|
||||||
|
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), rgb);
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case GIMP_COLOR_DIALOG_UPDATE:
|
case GIMP_COLOR_DIALOG_UPDATE:
|
||||||
|
@ -318,4 +331,6 @@ gimp_color_panel_dialog_update (GimpColorDialog *dialog,
|
||||||
state);
|
state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct _GimpColorPanelClass
|
||||||
GType gimp_color_panel_get_type (void) G_GNUC_CONST;
|
GType gimp_color_panel_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GtkWidget * gimp_color_panel_new (const gchar *title,
|
GtkWidget * gimp_color_panel_new (const gchar *title,
|
||||||
const GimpRGB *color,
|
GeglColor *color,
|
||||||
GimpColorAreaType type,
|
GimpColorAreaType type,
|
||||||
gint width,
|
gint width,
|
||||||
gint height);
|
gint height);
|
||||||
|
|
|
@ -376,6 +376,7 @@ gimp_prop_color_button_new (GObject *config,
|
||||||
{
|
{
|
||||||
GParamSpec *param_spec;
|
GParamSpec *param_spec;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
|
GeglColor *color;
|
||||||
GimpRGB *value;
|
GimpRGB *value;
|
||||||
|
|
||||||
param_spec = check_param_spec_w (config, property_name,
|
param_spec = check_param_spec_w (config, property_name,
|
||||||
|
@ -390,8 +391,11 @@ gimp_prop_color_button_new (GObject *config,
|
||||||
property_name, &value,
|
property_name, &value,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
button = gimp_color_panel_new (title, value, type, width, height);
|
color = gegl_color_new (NULL);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), value);
|
||||||
|
button = gimp_color_panel_new (title, color, type, width, height);
|
||||||
g_free (value);
|
g_free (value);
|
||||||
|
g_object_unref (color);
|
||||||
|
|
||||||
set_param_spec (G_OBJECT (button), button, param_spec);
|
set_param_spec (G_OBJECT (button), button, param_spec);
|
||||||
|
|
||||||
|
@ -440,7 +444,6 @@ gimp_prop_gegl_color_button_new (GObject *config,
|
||||||
GParamSpec *param_spec;
|
GParamSpec *param_spec;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GeglColor *color = NULL;
|
GeglColor *color = NULL;
|
||||||
GimpRGB value;
|
|
||||||
|
|
||||||
param_spec = check_param_spec_w (config, property_name,
|
param_spec = check_param_spec_w (config, property_name,
|
||||||
GEGL_TYPE_PARAM_COLOR, G_STRFUNC);
|
GEGL_TYPE_PARAM_COLOR, G_STRFUNC);
|
||||||
|
@ -454,10 +457,7 @@ gimp_prop_gegl_color_button_new (GObject *config,
|
||||||
property_name, &color,
|
property_name, &color,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (color != NULL)
|
button = gimp_color_panel_new (title, color, type, width, height);
|
||||||
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &value);
|
|
||||||
|
|
||||||
button = gimp_color_panel_new (title, &value, type, width, height);
|
|
||||||
g_clear_object (&color);
|
g_clear_object (&color);
|
||||||
|
|
||||||
set_param_spec (G_OBJECT (button), button, param_spec);
|
set_param_spec (G_OBJECT (button), button, param_spec);
|
||||||
|
@ -481,25 +481,29 @@ gimp_prop_color_button_callback (GtkWidget *button,
|
||||||
GObject *config)
|
GObject *config)
|
||||||
{
|
{
|
||||||
GParamSpec *param_spec;
|
GParamSpec *param_spec;
|
||||||
GimpRGB value;
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
param_spec = get_param_spec (G_OBJECT (button));
|
param_spec = get_param_spec (G_OBJECT (button));
|
||||||
if (! param_spec)
|
if (! param_spec)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (button), &value);
|
color = gimp_color_button_get_color (GIMP_COLOR_BUTTON (button));
|
||||||
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
|
||||||
g_signal_handlers_block_by_func (config,
|
g_signal_handlers_block_by_func (config,
|
||||||
gimp_prop_color_button_notify,
|
gimp_prop_color_button_notify,
|
||||||
button);
|
button);
|
||||||
|
|
||||||
g_object_set (config,
|
g_object_set (config,
|
||||||
param_spec->name, &value,
|
param_spec->name, &rgb,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func (config,
|
g_signal_handlers_unblock_by_func (config,
|
||||||
gimp_prop_color_button_notify,
|
gimp_prop_color_button_notify,
|
||||||
button);
|
button);
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -507,19 +511,23 @@ gimp_prop_color_button_notify (GObject *config,
|
||||||
GParamSpec *param_spec,
|
GParamSpec *param_spec,
|
||||||
GtkWidget *button)
|
GtkWidget *button)
|
||||||
{
|
{
|
||||||
GimpRGB *value;
|
GeglColor *color;
|
||||||
|
GimpRGB *rgb;
|
||||||
|
|
||||||
g_object_get (config,
|
g_object_get (config,
|
||||||
param_spec->name, &value,
|
param_spec->name, &rgb,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_signal_handlers_block_by_func (button,
|
g_signal_handlers_block_by_func (button,
|
||||||
gimp_prop_color_button_callback,
|
gimp_prop_color_button_callback,
|
||||||
config);
|
config);
|
||||||
|
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (button), value);
|
color = gegl_color_new (NULL);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), rgb);
|
||||||
|
gimp_color_button_set_color (GIMP_COLOR_BUTTON (button), color);
|
||||||
|
|
||||||
g_free (value);
|
g_object_unref (color);
|
||||||
|
g_free (rgb);
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func (button,
|
g_signal_handlers_unblock_by_func (button,
|
||||||
gimp_prop_color_button_callback,
|
gimp_prop_color_button_callback,
|
||||||
|
@ -532,29 +540,24 @@ gimp_prop_gegl_color_button_callback (GtkWidget *button,
|
||||||
{
|
{
|
||||||
GParamSpec *param_spec;
|
GParamSpec *param_spec;
|
||||||
GeglColor *color;
|
GeglColor *color;
|
||||||
GimpRGB value;
|
|
||||||
|
|
||||||
param_spec = get_param_spec (G_OBJECT (button));
|
param_spec = get_param_spec (G_OBJECT (button));
|
||||||
if (! param_spec)
|
if (! param_spec)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (button), &value);
|
|
||||||
|
|
||||||
color = gegl_color_new (NULL);
|
|
||||||
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &value);
|
|
||||||
g_signal_handlers_block_by_func (config,
|
g_signal_handlers_block_by_func (config,
|
||||||
gimp_prop_color_button_notify,
|
gimp_prop_gegl_color_button_notify,
|
||||||
button);
|
button);
|
||||||
|
|
||||||
|
color = gimp_color_button_get_color (GIMP_COLOR_BUTTON (button));
|
||||||
g_object_set (config,
|
g_object_set (config,
|
||||||
param_spec->name, color,
|
param_spec->name, color,
|
||||||
NULL);
|
NULL);
|
||||||
|
g_object_unref (color);
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func (config,
|
g_signal_handlers_unblock_by_func (config,
|
||||||
gimp_prop_color_button_notify,
|
gimp_prop_gegl_color_button_notify,
|
||||||
button);
|
button);
|
||||||
|
|
||||||
g_object_unref (color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -563,7 +566,6 @@ gimp_prop_gegl_color_button_notify (GObject *config,
|
||||||
GtkWidget *button)
|
GtkWidget *button)
|
||||||
{
|
{
|
||||||
GeglColor *color;
|
GeglColor *color;
|
||||||
GimpRGB value;
|
|
||||||
|
|
||||||
g_object_get (config,
|
g_object_get (config,
|
||||||
param_spec->name, &color,
|
param_spec->name, &color,
|
||||||
|
@ -573,9 +575,7 @@ gimp_prop_gegl_color_button_notify (GObject *config,
|
||||||
gimp_prop_color_button_callback,
|
gimp_prop_color_button_callback,
|
||||||
config);
|
config);
|
||||||
|
|
||||||
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &value);
|
gimp_color_button_set_color (GIMP_COLOR_BUTTON (button), color);
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (button), &value);
|
|
||||||
|
|
||||||
g_clear_object (&color);
|
g_clear_object (&color);
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func (button,
|
g_signal_handlers_unblock_by_func (button,
|
||||||
|
|
|
@ -189,7 +189,7 @@ static void
|
||||||
gimp_text_style_editor_init (GimpTextStyleEditor *editor)
|
gimp_text_style_editor_init (GimpTextStyleEditor *editor)
|
||||||
{
|
{
|
||||||
GtkWidget *image;
|
GtkWidget *image;
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
|
||||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (editor),
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (editor),
|
||||||
GTK_ORIENTATION_VERTICAL);
|
GTK_ORIENTATION_VERTICAL);
|
||||||
|
@ -247,11 +247,12 @@ gimp_text_style_editor_init (GimpTextStyleEditor *editor)
|
||||||
gtk_container_add (GTK_CONTAINER (editor->clear_button), image);
|
gtk_container_add (GTK_CONTAINER (editor->clear_button), image);
|
||||||
gtk_widget_show (image);
|
gtk_widget_show (image);
|
||||||
|
|
||||||
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0);
|
color = gegl_color_new ("black");
|
||||||
editor->color_button = gimp_color_panel_new (_("Change color of selected text"),
|
editor->color_button = gimp_color_panel_new (_("Change color of selected text"),
|
||||||
&color,
|
color,
|
||||||
GIMP_COLOR_AREA_FLAT, 20, 20);
|
GIMP_COLOR_AREA_FLAT, 20, 20);
|
||||||
gimp_widget_set_fully_opaque (editor->color_button, TRUE);
|
gimp_widget_set_fully_opaque (editor->color_button, TRUE);
|
||||||
|
g_object_unref (color);
|
||||||
|
|
||||||
gtk_box_pack_end (GTK_BOX (editor->lower_hbox), editor->color_button,
|
gtk_box_pack_end (GTK_BOX (editor->lower_hbox), editor->color_button,
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
|
@ -596,21 +597,24 @@ gimp_text_style_editor_list_tags (GimpTextStyleEditor *editor,
|
||||||
|
|
||||||
{
|
{
|
||||||
GList *list;
|
GList *list;
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
|
||||||
for (list = editor->buffer->color_tags; list; list = g_list_next (list))
|
for (list = editor->buffer->color_tags; list; list = g_list_next (list))
|
||||||
*remove_tags = g_list_prepend (*remove_tags, list->data);
|
*remove_tags = g_list_prepend (*remove_tags, list->data);
|
||||||
|
|
||||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (editor->color_button),
|
color = gimp_color_button_get_color (GIMP_COLOR_BUTTON (editor->color_button));
|
||||||
&color);
|
|
||||||
|
|
||||||
if (TRUE) /* FIXME should have "inconsistent" state as for font and size */
|
if (TRUE) /* FIXME should have "inconsistent" state as for font and size */
|
||||||
{
|
{
|
||||||
GtkTextTag *tag;
|
GtkTextTag *tag;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
tag = gimp_text_buffer_get_color_tag (editor->buffer, &color);
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
tag = gimp_text_buffer_get_color_tag (editor->buffer, &rgb);
|
||||||
tags = g_list_prepend (tags, tag);
|
tags = g_list_prepend (tags, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
*remove_tags = g_list_reverse (*remove_tags);
|
*remove_tags = g_list_reverse (*remove_tags);
|
||||||
|
@ -740,13 +744,18 @@ gimp_text_style_editor_color_changed (GimpColorButton *button,
|
||||||
|
|
||||||
if (gtk_text_buffer_get_has_selection (buffer))
|
if (gtk_text_buffer_get_has_selection (buffer))
|
||||||
{
|
{
|
||||||
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
GtkTextIter start, end;
|
GtkTextIter start, end;
|
||||||
GimpRGB color;
|
|
||||||
|
|
||||||
gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
|
gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
|
||||||
|
|
||||||
gimp_color_button_get_color (button, &color);
|
color = gimp_color_button_get_color (button);
|
||||||
gimp_text_buffer_set_color (editor->buffer, &start, &end, &color);
|
|
||||||
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
gimp_text_buffer_set_color (editor->buffer, &start, &end, &rgb);
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
insert_tags = gimp_text_style_editor_list_tags (editor, &remove_tags);
|
insert_tags = gimp_text_style_editor_list_tags (editor, &remove_tags);
|
||||||
|
@ -757,19 +766,22 @@ static void
|
||||||
gimp_text_style_editor_set_color (GimpTextStyleEditor *editor,
|
gimp_text_style_editor_set_color (GimpTextStyleEditor *editor,
|
||||||
GtkTextTag *color_tag)
|
GtkTextTag *color_tag)
|
||||||
{
|
{
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0);
|
gimp_rgba_set (&rgb, 0.0, 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
if (color_tag)
|
if (color_tag)
|
||||||
gimp_text_tag_get_fg_color (color_tag, &color);
|
gimp_text_tag_get_fg_color (color_tag, &rgb);
|
||||||
|
|
||||||
g_signal_handlers_block_by_func (editor->color_button,
|
g_signal_handlers_block_by_func (editor->color_button,
|
||||||
gimp_text_style_editor_color_changed,
|
gimp_text_style_editor_color_changed,
|
||||||
editor);
|
editor);
|
||||||
|
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (editor->color_button),
|
color = gegl_color_new (NULL);
|
||||||
&color);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
gimp_color_button_set_color (GIMP_COLOR_BUTTON (editor->color_button), color);
|
||||||
|
g_object_unref (color);
|
||||||
|
|
||||||
/* FIXME should have "inconsistent" state as for font and size */
|
/* FIXME should have "inconsistent" state as for font and size */
|
||||||
|
|
||||||
|
@ -781,14 +793,11 @@ gimp_text_style_editor_set_color (GimpTextStyleEditor *editor,
|
||||||
static void
|
static void
|
||||||
gimp_text_style_editor_set_default_color (GimpTextStyleEditor *editor)
|
gimp_text_style_editor_set_default_color (GimpTextStyleEditor *editor)
|
||||||
{
|
{
|
||||||
GimpRGB rgb;
|
|
||||||
|
|
||||||
g_signal_handlers_block_by_func (editor->color_button,
|
g_signal_handlers_block_by_func (editor->color_button,
|
||||||
gimp_text_style_editor_color_changed,
|
gimp_text_style_editor_color_changed,
|
||||||
editor);
|
editor);
|
||||||
|
|
||||||
gegl_color_get_pixel (editor->text->color, babl_format ("R'G'B'A double"), &rgb);
|
gimp_color_button_set_color (GIMP_COLOR_BUTTON (editor->color_button), editor->text->color);
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (editor->color_button), &rgb);
|
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func (editor->color_button,
|
g_signal_handlers_unblock_by_func (editor->color_button,
|
||||||
gimp_text_style_editor_color_changed,
|
gimp_text_style_editor_color_changed,
|
||||||
|
|
|
@ -601,12 +601,11 @@ gimp_procedure_dialog_set_ok_label (GimpProcedureDialog *dialog,
|
||||||
* * %GIMP_TYPE_LABEL_ENTRY (default): an entry with a label.
|
* * %GIMP_TYPE_LABEL_ENTRY (default): an entry with a label.
|
||||||
* * %GTK_TYPE_ENTRY: an entry with no label.
|
* * %GTK_TYPE_ENTRY: an entry with no label.
|
||||||
* * %GTK_TYPE_TEXT_VIEW: a text view with no label.
|
* * %GTK_TYPE_TEXT_VIEW: a text view with no label.
|
||||||
* - %GIMP_TYPE_PARAM_RGB:
|
* - %GEGL_TYPE_COLOR:
|
||||||
* * %GIMP_TYPE_LABEL_COLOR (default): a color button with a label.
|
* * %GIMP_TYPE_LABEL_COLOR (default): a color button with a label.
|
||||||
* Please use gimp_procedure_dialog_get_color_widget() for a
|
* Please use gimp_procedure_dialog_get_color_widget() for a
|
||||||
* non-editable color area with a label.
|
* non-editable color area with a label.
|
||||||
* * %GIMP_TYPE_COLOR_BUTTON: a color button with no label.
|
* * %GIMP_TYPE_COLOR_BUTTON: a color button with no label.
|
||||||
* - %GEGL_TYPE_COLOR:
|
|
||||||
* * %GIMP_TYPE_COLOR_AREA: a color area with no label.
|
* * %GIMP_TYPE_COLOR_AREA: a color area with no label.
|
||||||
* - %G_TYPE_PARAM_FILE:
|
* - %G_TYPE_PARAM_FILE:
|
||||||
* * %GTK_FILE_CHOOSER_BUTTON (default): generic file chooser button
|
* * %GTK_FILE_CHOOSER_BUTTON (default): generic file chooser button
|
||||||
|
@ -741,17 +740,6 @@ gimp_procedure_dialog_get_widget (GimpProcedureDialog *dialog,
|
||||||
property, -1);
|
property, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (G_PARAM_SPEC_TYPE (pspec) == GIMP_TYPE_PARAM_RGB)
|
|
||||||
{
|
|
||||||
if (widget_type == G_TYPE_NONE || widget_type == GIMP_TYPE_COLOR_BUTTON)
|
|
||||||
{
|
|
||||||
widget = gimp_prop_color_select_new (G_OBJECT (dialog->priv->config),
|
|
||||||
property, 20, 20,
|
|
||||||
GIMP_COLOR_AREA_SMALL_CHECKS);
|
|
||||||
gtk_widget_set_vexpand (widget, FALSE);
|
|
||||||
gtk_widget_set_hexpand (widget, FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (G_PARAM_SPEC_TYPE (pspec) == GEGL_TYPE_PARAM_COLOR)
|
else if (G_PARAM_SPEC_TYPE (pspec) == GEGL_TYPE_PARAM_COLOR)
|
||||||
{
|
{
|
||||||
if (widget_type == G_TYPE_NONE || widget_type == GIMP_TYPE_LABEL_COLOR)
|
if (widget_type == G_TYPE_NONE || widget_type == GIMP_TYPE_LABEL_COLOR)
|
||||||
|
@ -767,6 +755,14 @@ gimp_procedure_dialog_get_widget (GimpProcedureDialog *dialog,
|
||||||
gtk_widget_set_vexpand (widget, FALSE);
|
gtk_widget_set_vexpand (widget, FALSE);
|
||||||
gtk_widget_set_hexpand (widget, FALSE);
|
gtk_widget_set_hexpand (widget, FALSE);
|
||||||
}
|
}
|
||||||
|
else if (widget_type == GIMP_TYPE_COLOR_BUTTON)
|
||||||
|
{
|
||||||
|
widget = gimp_prop_color_select_new (G_OBJECT (dialog->priv->config),
|
||||||
|
property, 20, 20,
|
||||||
|
GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||||
|
gtk_widget_set_vexpand (widget, FALSE);
|
||||||
|
gtk_widget_set_hexpand (widget, FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (G_IS_PARAM_SPEC_OBJECT (pspec) && pspec->value_type == G_TYPE_FILE)
|
else if (G_IS_PARAM_SPEC_OBJECT (pspec) && pspec->value_type == G_TYPE_FILE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -190,7 +190,6 @@ gimp_color_button_class_init (GimpColorButtonClass *klass)
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
GtkButtonClass *button_class = GTK_BUTTON_CLASS (klass);
|
GtkButtonClass *button_class = GTK_BUTTON_CLASS (klass);
|
||||||
GimpRGB color;
|
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
|
@ -216,8 +215,6 @@ gimp_color_button_class_init (GimpColorButtonClass *klass)
|
||||||
klass->color_changed = NULL;
|
klass->color_changed = NULL;
|
||||||
klass->get_action_type = gimp_color_button_get_action_type;
|
klass->get_action_type = gimp_color_button_get_action_type;
|
||||||
|
|
||||||
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GimpColorButton:title:
|
* GimpColorButton:title:
|
||||||
*
|
*
|
||||||
|
@ -240,10 +237,10 @@ gimp_color_button_class_init (GimpColorButtonClass *klass)
|
||||||
* Since: 2.4
|
* Since: 2.4
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class, PROP_COLOR,
|
g_object_class_install_property (object_class, PROP_COLOR,
|
||||||
gimp_param_spec_rgb ("color",
|
gegl_param_spec_color_from_string ("color",
|
||||||
"Color",
|
"Color",
|
||||||
"The color displayed in the button's color area",
|
"The color displayed in the button's color area",
|
||||||
TRUE, &color,
|
"black",
|
||||||
GIMP_PARAM_READWRITE |
|
GIMP_PARAM_READWRITE |
|
||||||
G_PARAM_CONSTRUCT));
|
G_PARAM_CONSTRUCT));
|
||||||
/**
|
/**
|
||||||
|
@ -542,7 +539,8 @@ gimp_color_button_clicked (GtkButton *button)
|
||||||
{
|
{
|
||||||
GimpColorButton *color_button = GIMP_COLOR_BUTTON (button);
|
GimpColorButton *color_button = GIMP_COLOR_BUTTON (button);
|
||||||
GimpColorButtonPrivate *priv = GET_PRIVATE (button);
|
GimpColorButtonPrivate *priv = GET_PRIVATE (button);
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
if (! priv->dialog)
|
if (! priv->dialog)
|
||||||
{
|
{
|
||||||
|
@ -589,21 +587,24 @@ gimp_color_button_clicked (GtkButton *button)
|
||||||
button);
|
button);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_color_button_get_color (color_button, &color);
|
color = gimp_color_button_get_color (color_button);
|
||||||
|
|
||||||
g_signal_handlers_block_by_func (priv->selection,
|
g_signal_handlers_block_by_func (priv->selection,
|
||||||
gimp_color_button_selection_changed,
|
gimp_color_button_selection_changed,
|
||||||
button);
|
button);
|
||||||
|
|
||||||
gimp_color_selection_set_color (GIMP_COLOR_SELECTION (priv->selection), &color);
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
gimp_color_selection_set_color (GIMP_COLOR_SELECTION (priv->selection), &rgb);
|
||||||
gimp_color_selection_set_old_color (GIMP_COLOR_SELECTION (priv->selection),
|
gimp_color_selection_set_old_color (GIMP_COLOR_SELECTION (priv->selection),
|
||||||
&color);
|
&rgb);
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func (priv->selection,
|
g_signal_handlers_unblock_by_func (priv->selection,
|
||||||
gimp_color_button_selection_changed,
|
gimp_color_button_selection_changed,
|
||||||
button);
|
button);
|
||||||
|
|
||||||
gtk_window_present (GTK_WINDOW (priv->dialog));
|
gtk_window_present (GTK_WINDOW (priv->dialog));
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GType
|
static GType
|
||||||
|
@ -620,7 +621,7 @@ gimp_color_button_get_action_type (GimpColorButton *button)
|
||||||
* @title: String that will be used as title for the color_selector.
|
* @title: String that will be used as title for the color_selector.
|
||||||
* @width: Width of the colorpreview in pixels.
|
* @width: Width of the colorpreview in pixels.
|
||||||
* @height: Height of the colorpreview in pixels.
|
* @height: Height of the colorpreview in pixels.
|
||||||
* @color: A pointer to a #GimpRGB color.
|
* @color: A [class@Gegl.Color].
|
||||||
* @type: The type of transparency to be displayed.
|
* @type: The type of transparency to be displayed.
|
||||||
*
|
*
|
||||||
* Creates a new #GimpColorButton widget.
|
* Creates a new #GimpColorButton widget.
|
||||||
|
@ -637,10 +638,10 @@ GtkWidget *
|
||||||
gimp_color_button_new (const gchar *title,
|
gimp_color_button_new (const gchar *title,
|
||||||
gint width,
|
gint width,
|
||||||
gint height,
|
gint height,
|
||||||
const GimpRGB *color,
|
GeglColor *color,
|
||||||
GimpColorAreaType type)
|
GimpColorAreaType type)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (color != NULL, NULL);
|
g_return_val_if_fail (GEGL_IS_COLOR (color), NULL);
|
||||||
g_return_val_if_fail (width > 0, NULL);
|
g_return_val_if_fail (width > 0, NULL);
|
||||||
g_return_val_if_fail (height > 0, NULL);
|
g_return_val_if_fail (height > 0, NULL);
|
||||||
|
|
||||||
|
@ -705,26 +706,22 @@ gimp_color_button_get_title (GimpColorButton *button)
|
||||||
/**
|
/**
|
||||||
* gimp_color_button_set_color:
|
* gimp_color_button_set_color:
|
||||||
* @button: Pointer to a #GimpColorButton.
|
* @button: Pointer to a #GimpColorButton.
|
||||||
* @color: Pointer to the new #GimpRGB color.
|
* @color: A new [class@Gegl.Color].
|
||||||
*
|
*
|
||||||
* Sets the @button to the given @color.
|
* Sets the @button to the given @color.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gimp_color_button_set_color (GimpColorButton *button,
|
gimp_color_button_set_color (GimpColorButton *button,
|
||||||
const GimpRGB *rgb)
|
GeglColor *color)
|
||||||
{
|
{
|
||||||
GimpColorButtonPrivate *priv;
|
GimpColorButtonPrivate *priv;
|
||||||
GeglColor *color;
|
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_COLOR_BUTTON (button));
|
g_return_if_fail (GIMP_IS_COLOR_BUTTON (button));
|
||||||
g_return_if_fail (rgb != NULL);
|
g_return_if_fail (GEGL_IS_COLOR (color));
|
||||||
|
|
||||||
priv = GET_PRIVATE (button);
|
priv = GET_PRIVATE (button);
|
||||||
|
|
||||||
color = gegl_color_new (NULL);
|
|
||||||
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), rgb);
|
|
||||||
gimp_color_area_set_color (GIMP_COLOR_AREA (priv->color_area), color);
|
gimp_color_area_set_color (GIMP_COLOR_AREA (priv->color_area), color);
|
||||||
g_object_unref (color);
|
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (button), "color");
|
g_object_notify (G_OBJECT (button), "color");
|
||||||
}
|
}
|
||||||
|
@ -732,26 +729,21 @@ gimp_color_button_set_color (GimpColorButton *button,
|
||||||
/**
|
/**
|
||||||
* gimp_color_button_get_color:
|
* gimp_color_button_get_color:
|
||||||
* @button: Pointer to a #GimpColorButton.
|
* @button: Pointer to a #GimpColorButton.
|
||||||
* @color: (out caller-allocates): Pointer to a #GimpRGB struct
|
|
||||||
* used to return the color.
|
|
||||||
*
|
*
|
||||||
* Retrieves the currently set color from the @button.
|
* Retrieves the currently set color from the @button.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): a copy of @button's [class@Gegl.Color].
|
||||||
**/
|
**/
|
||||||
void
|
GeglColor *
|
||||||
gimp_color_button_get_color (GimpColorButton *button,
|
gimp_color_button_get_color (GimpColorButton *button)
|
||||||
GimpRGB *rgb)
|
|
||||||
{
|
{
|
||||||
GimpColorButtonPrivate *priv;
|
GimpColorButtonPrivate *priv;
|
||||||
GeglColor *color;
|
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_COLOR_BUTTON (button));
|
g_return_val_if_fail (GIMP_IS_COLOR_BUTTON (button), NULL);
|
||||||
g_return_if_fail (rgb != NULL);
|
|
||||||
|
|
||||||
priv = GET_PRIVATE (button);
|
priv = GET_PRIVATE (button);
|
||||||
|
|
||||||
color = gimp_color_area_get_color (GIMP_COLOR_AREA (priv->color_area));
|
return gimp_color_area_get_color (GIMP_COLOR_AREA (priv->color_area));
|
||||||
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), rgb);
|
|
||||||
g_object_unref (color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -842,20 +834,19 @@ gimp_color_button_set_update (GimpColorButton *button,
|
||||||
|
|
||||||
if (priv->selection)
|
if (priv->selection)
|
||||||
{
|
{
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
|
color = gegl_color_new (NULL);
|
||||||
|
|
||||||
if (priv->continuous_update)
|
if (priv->continuous_update)
|
||||||
{
|
gimp_color_selection_get_color (GIMP_COLOR_SELECTION (priv->selection), &rgb);
|
||||||
gimp_color_selection_get_color (GIMP_COLOR_SELECTION (priv->selection),
|
|
||||||
&color);
|
|
||||||
gimp_color_button_set_color (button, &color);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
gimp_color_selection_get_old_color (GIMP_COLOR_SELECTION (priv->selection), &rgb);
|
||||||
gimp_color_selection_get_old_color (GIMP_COLOR_SELECTION (priv->selection),
|
|
||||||
&color);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
gimp_color_button_set_color (button, &color);
|
gimp_color_button_set_color (button, color);
|
||||||
}
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (button), "continuous-update");
|
g_object_notify (G_OBJECT (button), "continuous-update");
|
||||||
|
@ -924,7 +915,10 @@ gimp_color_button_dialog_response (GtkWidget *dialog,
|
||||||
GimpColorButton *button)
|
GimpColorButton *button)
|
||||||
{
|
{
|
||||||
GimpColorButtonPrivate *priv = GET_PRIVATE (button);
|
GimpColorButtonPrivate *priv = GET_PRIVATE (button);
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
|
color = gegl_color_new (NULL);
|
||||||
|
|
||||||
switch (response_id)
|
switch (response_id)
|
||||||
{
|
{
|
||||||
|
@ -936,8 +930,9 @@ gimp_color_button_dialog_response (GtkWidget *dialog,
|
||||||
if (! priv->continuous_update)
|
if (! priv->continuous_update)
|
||||||
{
|
{
|
||||||
gimp_color_selection_get_color (GIMP_COLOR_SELECTION (priv->selection),
|
gimp_color_selection_get_color (GIMP_COLOR_SELECTION (priv->selection),
|
||||||
&color);
|
&rgb);
|
||||||
gimp_color_button_set_color (button, &color);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
gimp_color_button_set_color (button, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_hide (dialog);
|
gtk_widget_hide (dialog);
|
||||||
|
@ -947,13 +942,16 @@ gimp_color_button_dialog_response (GtkWidget *dialog,
|
||||||
if (priv->continuous_update)
|
if (priv->continuous_update)
|
||||||
{
|
{
|
||||||
gimp_color_selection_get_old_color (GIMP_COLOR_SELECTION (priv->selection),
|
gimp_color_selection_get_old_color (GIMP_COLOR_SELECTION (priv->selection),
|
||||||
&color);
|
&rgb);
|
||||||
gimp_color_button_set_color (button, &color);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
gimp_color_button_set_color (button, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_hide (dialog);
|
gtk_widget_hide (dialog);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -962,46 +960,38 @@ gimp_color_button_use_color (GAction *action,
|
||||||
GimpColorButton *button)
|
GimpColorButton *button)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
GeglColor *color = NULL;
|
GeglColor *color;
|
||||||
GimpRGB rgb;
|
|
||||||
|
|
||||||
name = g_action_get_name (action);
|
name = g_action_get_name (action);
|
||||||
gimp_color_button_get_color (button, &rgb);
|
|
||||||
|
|
||||||
if (! strcmp (name, GIMP_COLOR_BUTTON_COLOR_FG))
|
if (! strcmp (name, GIMP_COLOR_BUTTON_COLOR_FG))
|
||||||
{
|
{
|
||||||
if (_gimp_get_foreground_func)
|
if (_gimp_get_foreground_func)
|
||||||
{
|
|
||||||
color = _gimp_get_foreground_func ();
|
color = _gimp_get_foreground_func ();
|
||||||
gegl_color_get_pixel (color, babl_format_with_space ("R'G'B'A double", NULL), &rgb);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
color = gegl_color_new ("black");
|
||||||
gimp_rgba_set (&rgb, 0.0, 0.0, 0.0, 1.0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (! strcmp (name, GIMP_COLOR_BUTTON_COLOR_BG))
|
else if (! strcmp (name, GIMP_COLOR_BUTTON_COLOR_BG))
|
||||||
{
|
{
|
||||||
if (_gimp_get_background_func)
|
if (_gimp_get_background_func)
|
||||||
{
|
|
||||||
color = _gimp_get_background_func ();
|
color = _gimp_get_background_func ();
|
||||||
gegl_color_get_pixel (color, babl_format_with_space ("R'G'B'A double", NULL), &rgb);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
color = gegl_color_new ("white");
|
||||||
gimp_rgba_set (&rgb, 1.0, 1.0, 1.0, 1.0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (! strcmp (name, GIMP_COLOR_BUTTON_COLOR_BLACK))
|
else if (! strcmp (name, GIMP_COLOR_BUTTON_COLOR_BLACK))
|
||||||
{
|
{
|
||||||
gimp_rgba_set (&rgb, 0.0, 0.0, 0.0, 1.0);
|
color = gegl_color_new ("black");
|
||||||
}
|
}
|
||||||
else if (! strcmp (name, GIMP_COLOR_BUTTON_COLOR_WHITE))
|
else if (! strcmp (name, GIMP_COLOR_BUTTON_COLOR_WHITE))
|
||||||
{
|
{
|
||||||
gimp_rgba_set (&rgb, 1.0, 1.0, 1.0, 1.0);
|
color = gegl_color_new ("white");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
color = gimp_color_button_get_color (button);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_color_button_set_color (button, &rgb);
|
gimp_color_button_set_color (button, color);
|
||||||
|
|
||||||
g_clear_object (&color);
|
g_clear_object (&color);
|
||||||
}
|
}
|
||||||
|
@ -1014,20 +1004,24 @@ gimp_color_button_area_changed (GtkWidget *color_area,
|
||||||
|
|
||||||
if (priv->selection)
|
if (priv->selection)
|
||||||
{
|
{
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
gimp_color_button_get_color (button, &color);
|
color = gimp_color_button_get_color (button);
|
||||||
|
|
||||||
g_signal_handlers_block_by_func (priv->selection,
|
g_signal_handlers_block_by_func (priv->selection,
|
||||||
gimp_color_button_selection_changed,
|
gimp_color_button_selection_changed,
|
||||||
button);
|
button);
|
||||||
|
|
||||||
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
gimp_color_selection_set_color (GIMP_COLOR_SELECTION (priv->selection),
|
gimp_color_selection_set_color (GIMP_COLOR_SELECTION (priv->selection),
|
||||||
&color);
|
&rgb);
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func (priv->selection,
|
g_signal_handlers_unblock_by_func (priv->selection,
|
||||||
gimp_color_button_selection_changed,
|
gimp_color_button_selection_changed,
|
||||||
button);
|
button);
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_signal_emit (button, gimp_color_button_signals[COLOR_CHANGED], 0);
|
g_signal_emit (button, gimp_color_button_signals[COLOR_CHANGED], 0);
|
||||||
|
|
|
@ -82,7 +82,7 @@ GType gimp_color_button_get_type (void) G_GNUC_CONST;
|
||||||
GtkWidget * gimp_color_button_new (const gchar *title,
|
GtkWidget * gimp_color_button_new (const gchar *title,
|
||||||
gint width,
|
gint width,
|
||||||
gint height,
|
gint height,
|
||||||
const GimpRGB *color,
|
GeglColor *color,
|
||||||
GimpColorAreaType type);
|
GimpColorAreaType type);
|
||||||
|
|
||||||
void gimp_color_button_set_title (GimpColorButton *button,
|
void gimp_color_button_set_title (GimpColorButton *button,
|
||||||
|
@ -90,9 +90,8 @@ void gimp_color_button_set_title (GimpColorButton *button,
|
||||||
const gchar * gimp_color_button_get_title (GimpColorButton *button);
|
const gchar * gimp_color_button_get_title (GimpColorButton *button);
|
||||||
|
|
||||||
void gimp_color_button_set_color (GimpColorButton *button,
|
void gimp_color_button_set_color (GimpColorButton *button,
|
||||||
const GimpRGB *color);
|
GeglColor *color);
|
||||||
void gimp_color_button_get_color (GimpColorButton *button,
|
GeglColor * gimp_color_button_get_color (GimpColorButton *button);
|
||||||
GimpRGB *color);
|
|
||||||
|
|
||||||
gboolean gimp_color_button_has_alpha (GimpColorButton *button);
|
gboolean gimp_color_button_has_alpha (GimpColorButton *button);
|
||||||
void gimp_color_button_set_type (GimpColorButton *button,
|
void gimp_color_button_set_type (GimpColorButton *button,
|
||||||
|
|
|
@ -4177,12 +4177,12 @@ gimp_prop_color_area_notify (GObject *config,
|
||||||
/**
|
/**
|
||||||
* gimp_prop_color_select_new:
|
* gimp_prop_color_select_new:
|
||||||
* @config: Object to which property is attached.
|
* @config: Object to which property is attached.
|
||||||
* @property_name: Name of RGB property.
|
* @property_name: Name of [class@Gegl.Color] property.
|
||||||
* @width: Width of the colorpreview in pixels.
|
* @width: Width of the colorpreview in pixels.
|
||||||
* @height: Height of the colorpreview in pixels.
|
* @height: Height of the colorpreview in pixels.
|
||||||
* @type: How transparency is represented.
|
* @type: How transparency is represented.
|
||||||
*
|
*
|
||||||
* Creates a #GimpColorButton to set and display the value of an RGB
|
* Creates a #GimpColorButton to set and display the value of a color
|
||||||
* property.
|
* property.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): A new #GimpColorButton widget.
|
* Returns: (transfer full): A new #GimpColorButton widget.
|
||||||
|
@ -4198,10 +4198,10 @@ gimp_prop_color_select_new (GObject *config,
|
||||||
{
|
{
|
||||||
GParamSpec *param_spec;
|
GParamSpec *param_spec;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GimpRGB *value;
|
GeglColor *value = NULL;
|
||||||
|
|
||||||
param_spec = check_param_spec_w (config, property_name,
|
param_spec = check_param_spec_w (config, property_name,
|
||||||
GIMP_TYPE_PARAM_RGB, G_STRFUNC);
|
GEGL_TYPE_PARAM_COLOR, G_STRFUNC);
|
||||||
if (! param_spec)
|
if (! param_spec)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -4212,7 +4212,7 @@ gimp_prop_color_select_new (GObject *config,
|
||||||
button = gimp_color_button_new (g_param_spec_get_nick (param_spec),
|
button = gimp_color_button_new (g_param_spec_get_nick (param_spec),
|
||||||
width, height, value, type);
|
width, height, value, type);
|
||||||
|
|
||||||
g_free (value);
|
g_clear_object (&value);
|
||||||
|
|
||||||
g_object_bind_property (config, property_name,
|
g_object_bind_property (config, property_name,
|
||||||
button, "color",
|
button, "color",
|
||||||
|
|
|
@ -1087,7 +1087,13 @@ gimp_widget_get_render_space (GtkWidget *widget,
|
||||||
|
|
||||||
g_return_val_if_fail (widget == NULL || GTK_IS_WIDGET (widget), NULL);
|
g_return_val_if_fail (widget == NULL || GTK_IS_WIDGET (widget), NULL);
|
||||||
|
|
||||||
|
if (config)
|
||||||
_gimp_widget_get_profiles (widget, config, NULL, &dest_profile);
|
_gimp_widget_get_profiles (widget, config, NULL, &dest_profile);
|
||||||
|
else
|
||||||
|
/* When no GimpColorConfig is given, we just return the monitor's color
|
||||||
|
* profile, disregarding any user preferences.
|
||||||
|
*/
|
||||||
|
dest_profile = gimp_widget_get_color_profile (gtk_widget_get_toplevel (widget));
|
||||||
|
|
||||||
if (dest_profile)
|
if (dest_profile)
|
||||||
space = gimp_color_profile_get_space (dest_profile,
|
space = gimp_color_profile_get_space (dest_profile,
|
||||||
|
|
|
@ -616,7 +616,8 @@ static void
|
||||||
update_values (Grid *grid)
|
update_values (Grid *grid)
|
||||||
{
|
{
|
||||||
GtkWidget *entry;
|
GtkWidget *entry;
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
entry = g_object_get_data (G_OBJECT (main_dialog), "width");
|
entry = g_object_get_data (G_OBJECT (main_dialog), "width");
|
||||||
g_object_set (grid->config,
|
g_object_set (grid->config,
|
||||||
|
@ -648,12 +649,20 @@ update_values (Grid *grid)
|
||||||
(gint) RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 2)),
|
(gint) RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 2)),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (grid->hcolor_button), &color);
|
color = gimp_color_button_get_color (GIMP_COLOR_BUTTON (grid->hcolor_button));
|
||||||
g_object_set (grid->config, "hcolor", &color, NULL);
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (grid->vcolor_button), &color);
|
g_object_set (grid->config, "hcolor", &rgb, NULL);
|
||||||
g_object_set (grid->config, "vcolor", &color, NULL);
|
g_object_unref (color);
|
||||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (grid->icolor_button), &color);
|
|
||||||
g_object_set (grid->config, "icolor", &color, NULL);
|
color = gimp_color_button_get_color (GIMP_COLOR_BUTTON (grid->vcolor_button));
|
||||||
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
g_object_set (grid->config, "vcolor", &rgb, NULL);
|
||||||
|
g_object_unref (color);
|
||||||
|
|
||||||
|
color = gimp_color_button_get_color (GIMP_COLOR_BUTTON (grid->icolor_button));
|
||||||
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
g_object_set (grid->config, "icolor", &rgb, NULL);
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -704,18 +713,29 @@ color_callback (GtkWidget *widget,
|
||||||
{
|
{
|
||||||
Grid *grid = GRID (data);
|
Grid *grid = GRID (data);
|
||||||
GtkWidget *chain_button = grid->color_chain;
|
GtkWidget *chain_button = grid->color_chain;
|
||||||
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
|
color = gimp_color_button_get_color (GIMP_COLOR_BUTTON (widget));
|
||||||
|
|
||||||
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (chain_button)))
|
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (chain_button)))
|
||||||
{
|
{
|
||||||
GimpRGB color;
|
|
||||||
|
|
||||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (widget), &color);
|
|
||||||
|
|
||||||
if (widget == grid->vcolor_button)
|
if (widget == grid->vcolor_button)
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (grid->hcolor_button), &color);
|
gimp_color_button_set_color (GIMP_COLOR_BUTTON (grid->hcolor_button), color);
|
||||||
else if (widget == grid->hcolor_button)
|
else if (widget == grid->hcolor_button)
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (grid->vcolor_button), &color);
|
gimp_color_button_set_color (GIMP_COLOR_BUTTON (grid->vcolor_button), color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
|
||||||
|
if (widget == grid->hcolor_button)
|
||||||
|
g_object_set (grid->config, "hcolor", &rgb, NULL);
|
||||||
|
else if (widget == grid->vcolor_button)
|
||||||
|
g_object_set (grid->config, "vcolor", &rgb, NULL);
|
||||||
|
else if (widget == grid->icolor_button)
|
||||||
|
g_object_set (grid->config, "icolor", &rgb, NULL);
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -756,6 +776,7 @@ dialog (GimpImage *image,
|
||||||
gint ispace;
|
gint ispace;
|
||||||
gint ioffset;
|
gint ioffset;
|
||||||
GimpRGB *icolor;
|
GimpRGB *icolor;
|
||||||
|
GeglColor *color;
|
||||||
|
|
||||||
g_return_val_if_fail (main_dialog == NULL, FALSE);
|
g_return_val_if_fail (main_dialog == NULL, FALSE);
|
||||||
|
|
||||||
|
@ -1030,9 +1051,11 @@ dialog (GimpImage *image,
|
||||||
gtk_widget_show (grid->color_chain);
|
gtk_widget_show (grid->color_chain);
|
||||||
|
|
||||||
/* attach color selectors */
|
/* attach color selectors */
|
||||||
|
color = gegl_color_new (NULL);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), hcolor);
|
||||||
grid->hcolor_button = gimp_color_button_new (_("Horizontal Color"),
|
grid->hcolor_button = gimp_color_button_new (_("Horizontal Color"),
|
||||||
COLOR_BUTTON_WIDTH, 16,
|
COLOR_BUTTON_WIDTH, 16,
|
||||||
hcolor,
|
color,
|
||||||
GIMP_COLOR_AREA_SMALL_CHECKS);
|
GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||||
gimp_color_button_set_update (GIMP_COLOR_BUTTON (grid->hcolor_button), TRUE);
|
gimp_color_button_set_update (GIMP_COLOR_BUTTON (grid->hcolor_button), TRUE);
|
||||||
gtk_grid_attach (GTK_GRID (offset), grid->hcolor_button, 1, 3, 1, 1);
|
gtk_grid_attach (GTK_GRID (offset), grid->hcolor_button, 1, 3, 1, 1);
|
||||||
|
@ -1042,9 +1065,6 @@ dialog (GimpImage *image,
|
||||||
gimp_color_button_set_color_config (GIMP_COLOR_BUTTON (grid->hcolor_button),
|
gimp_color_button_set_color_config (GIMP_COLOR_BUTTON (grid->hcolor_button),
|
||||||
color_config);
|
color_config);
|
||||||
|
|
||||||
g_signal_connect (grid->hcolor_button, "color-changed",
|
|
||||||
G_CALLBACK (gimp_color_button_get_color),
|
|
||||||
hcolor);
|
|
||||||
g_signal_connect (grid->hcolor_button, "color-changed",
|
g_signal_connect (grid->hcolor_button, "color-changed",
|
||||||
G_CALLBACK (color_callback),
|
G_CALLBACK (color_callback),
|
||||||
grid);
|
grid);
|
||||||
|
@ -1052,9 +1072,10 @@ dialog (GimpImage *image,
|
||||||
G_CALLBACK (gimp_preview_invalidate),
|
G_CALLBACK (gimp_preview_invalidate),
|
||||||
preview);
|
preview);
|
||||||
|
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), vcolor);
|
||||||
grid->vcolor_button = gimp_color_button_new (_("Vertical Color"),
|
grid->vcolor_button = gimp_color_button_new (_("Vertical Color"),
|
||||||
COLOR_BUTTON_WIDTH, 16,
|
COLOR_BUTTON_WIDTH, 16,
|
||||||
vcolor,
|
color,
|
||||||
GIMP_COLOR_AREA_SMALL_CHECKS);
|
GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||||
gimp_color_button_set_update (GIMP_COLOR_BUTTON (grid->vcolor_button), TRUE);
|
gimp_color_button_set_update (GIMP_COLOR_BUTTON (grid->vcolor_button), TRUE);
|
||||||
gtk_grid_attach (GTK_GRID (offset), grid->vcolor_button, 2, 3, 1, 1);
|
gtk_grid_attach (GTK_GRID (offset), grid->vcolor_button, 2, 3, 1, 1);
|
||||||
|
@ -1063,9 +1084,6 @@ dialog (GimpImage *image,
|
||||||
gimp_color_button_set_color_config (GIMP_COLOR_BUTTON (grid->vcolor_button),
|
gimp_color_button_set_color_config (GIMP_COLOR_BUTTON (grid->vcolor_button),
|
||||||
color_config);
|
color_config);
|
||||||
|
|
||||||
g_signal_connect (grid->vcolor_button, "color-changed",
|
|
||||||
G_CALLBACK (gimp_color_button_get_color),
|
|
||||||
vcolor);
|
|
||||||
g_signal_connect (grid->vcolor_button, "color-changed",
|
g_signal_connect (grid->vcolor_button, "color-changed",
|
||||||
G_CALLBACK (color_callback),
|
G_CALLBACK (color_callback),
|
||||||
grid);
|
grid);
|
||||||
|
@ -1073,9 +1091,10 @@ dialog (GimpImage *image,
|
||||||
G_CALLBACK (gimp_preview_invalidate),
|
G_CALLBACK (gimp_preview_invalidate),
|
||||||
preview);
|
preview);
|
||||||
|
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), icolor);
|
||||||
grid->icolor_button = gimp_color_button_new (_("Intersection Color"),
|
grid->icolor_button = gimp_color_button_new (_("Intersection Color"),
|
||||||
COLOR_BUTTON_WIDTH, 16,
|
COLOR_BUTTON_WIDTH, 16,
|
||||||
icolor,
|
color,
|
||||||
GIMP_COLOR_AREA_SMALL_CHECKS);
|
GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||||
gimp_color_button_set_update (GIMP_COLOR_BUTTON (grid->icolor_button), TRUE);
|
gimp_color_button_set_update (GIMP_COLOR_BUTTON (grid->icolor_button), TRUE);
|
||||||
gtk_grid_attach (GTK_GRID (offset), grid->icolor_button, 3, 3, 1, 1);
|
gtk_grid_attach (GTK_GRID (offset), grid->icolor_button, 3, 3, 1, 1);
|
||||||
|
@ -1084,10 +1103,11 @@ dialog (GimpImage *image,
|
||||||
gimp_color_button_set_color_config (GIMP_COLOR_BUTTON (grid->icolor_button),
|
gimp_color_button_set_color_config (GIMP_COLOR_BUTTON (grid->icolor_button),
|
||||||
color_config);
|
color_config);
|
||||||
g_object_unref (color_config);
|
g_object_unref (color_config);
|
||||||
|
g_object_unref (color);
|
||||||
|
|
||||||
g_signal_connect (grid->icolor_button, "color-changed",
|
g_signal_connect (grid->icolor_button, "color-changed",
|
||||||
G_CALLBACK (gimp_color_button_get_color),
|
G_CALLBACK (color_callback),
|
||||||
icolor);
|
grid);
|
||||||
g_signal_connect_swapped (grid->icolor_button, "color-changed",
|
g_signal_connect_swapped (grid->icolor_button, "color-changed",
|
||||||
G_CALLBACK (gimp_preview_invalidate),
|
G_CALLBACK (gimp_preview_invalidate),
|
||||||
preview);
|
preview);
|
||||||
|
|
|
@ -2485,16 +2485,20 @@ color1_changed (GimpColorButton *button)
|
||||||
|
|
||||||
if (t)
|
if (t)
|
||||||
{
|
{
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
gimp_color_button_get_color (button, &color);
|
color = gimp_color_button_get_color (button);
|
||||||
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
|
||||||
t->color1.x = color.r;
|
t->color1.x = rgb.r;
|
||||||
t->color1.y = color.g;
|
t->color1.y = rgb.g;
|
||||||
t->color1.z = color.b;
|
t->color1.z = rgb.b;
|
||||||
t->color1.w = color.a;
|
t->color1.w = rgb.a;
|
||||||
|
|
||||||
restartrender ();
|
restartrender ();
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2505,16 +2509,20 @@ color2_changed (GimpColorButton *button)
|
||||||
|
|
||||||
if (t)
|
if (t)
|
||||||
{
|
{
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
gimp_color_button_get_color (button, &color);
|
color = gimp_color_button_get_color (button);
|
||||||
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
|
||||||
t->color2.x = color.r;
|
t->color2.x = rgb.r;
|
||||||
t->color2.y = color.g;
|
t->color2.y = rgb.g;
|
||||||
t->color2.z = color.b;
|
t->color2.z = rgb.b;
|
||||||
t->color2.w = color.a;
|
t->color2.w = rgb.a;
|
||||||
|
|
||||||
restartrender ();
|
restartrender ();
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2522,8 +2530,8 @@ static void
|
||||||
drawcolor1 (GtkWidget *w)
|
drawcolor1 (GtkWidget *w)
|
||||||
{
|
{
|
||||||
static GtkWidget *lastw = NULL;
|
static GtkWidget *lastw = NULL;
|
||||||
|
GeglColor *color;
|
||||||
GimpRGB color;
|
GimpRGB rgb;
|
||||||
texture *t = currenttexture ();
|
texture *t = currenttexture ();
|
||||||
|
|
||||||
if (w)
|
if (w)
|
||||||
|
@ -2536,18 +2544,21 @@ drawcolor1 (GtkWidget *w)
|
||||||
if (!t)
|
if (!t)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gimp_rgba_set (&color,
|
color = gegl_color_new (NULL);
|
||||||
|
gimp_rgba_set (&rgb,
|
||||||
t->color1.x, t->color1.y, t->color1.z, t->color1.w);
|
t->color1.x, t->color1.y, t->color1.z, t->color1.w);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (w), &color);
|
gimp_color_button_set_color (GIMP_COLOR_BUTTON (w), color);
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drawcolor2 (GtkWidget *w)
|
drawcolor2 (GtkWidget *w)
|
||||||
{
|
{
|
||||||
static GtkWidget *lastw = NULL;
|
static GtkWidget *lastw = NULL;
|
||||||
|
GeglColor *color;
|
||||||
GimpRGB color;
|
GimpRGB rgb;
|
||||||
texture *t = currenttexture ();
|
texture *t = currenttexture ();
|
||||||
|
|
||||||
if (w)
|
if (w)
|
||||||
|
@ -2560,10 +2571,13 @@ drawcolor2 (GtkWidget *w)
|
||||||
if (!t)
|
if (!t)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gimp_rgba_set (&color,
|
color = gegl_color_new (NULL);
|
||||||
|
gimp_rgba_set (&rgb,
|
||||||
t->color2.x, t->color2.y, t->color2.z, t->color2.w);
|
t->color2.x, t->color2.y, t->color2.z, t->color2.w);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (w), &color);
|
gimp_color_button_set_color (GIMP_COLOR_BUTTON (w), color);
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean do_run = FALSE;
|
static gboolean do_run = FALSE;
|
||||||
|
@ -2627,7 +2641,7 @@ makewindow (void)
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GtkWidget *list;
|
GtkWidget *list;
|
||||||
GimpRGB rgb = { 0, 0, 0, 0 };
|
GeglColor *color = gegl_color_new ("transparent");
|
||||||
|
|
||||||
window = gimp_dialog_new (_("Sphere Designer"), PLUG_IN_ROLE,
|
window = gimp_dialog_new (_("Sphere Designer"), PLUG_IN_ROLE,
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
|
@ -2814,8 +2828,8 @@ makewindow (void)
|
||||||
hbox, 2);
|
hbox, 2);
|
||||||
|
|
||||||
button = gimp_color_button_new (_("Color Selection Dialog"),
|
button = gimp_color_button_new (_("Color Selection Dialog"),
|
||||||
COLORBUTTONWIDTH, COLORBUTTONHEIGHT, &rgb,
|
COLORBUTTONWIDTH, COLORBUTTONHEIGHT,
|
||||||
GIMP_COLOR_AREA_FLAT);
|
color, GIMP_COLOR_AREA_FLAT);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
drawcolor1 (button);
|
drawcolor1 (button);
|
||||||
|
@ -2825,8 +2839,8 @@ makewindow (void)
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
button = gimp_color_button_new (_("Color Selection Dialog"),
|
button = gimp_color_button_new (_("Color Selection Dialog"),
|
||||||
COLORBUTTONWIDTH, COLORBUTTONHEIGHT, &rgb,
|
COLORBUTTONWIDTH, COLORBUTTONHEIGHT,
|
||||||
GIMP_COLOR_AREA_FLAT);
|
color, GIMP_COLOR_AREA_FLAT);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
drawcolor2 (button);
|
drawcolor2 (button);
|
||||||
|
@ -2956,6 +2970,8 @@ makewindow (void)
|
||||||
|
|
||||||
gtk_widget_show (window);
|
gtk_widget_show (window);
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -490,7 +490,7 @@ gfig_dialog (GimpGfig *gfig)
|
||||||
vbox);
|
vbox);
|
||||||
|
|
||||||
/* foreground color button in Stroke frame*/
|
/* foreground color button in Stroke frame*/
|
||||||
gfig_context->fg_color = g_new0 (GimpRGB, 1);
|
gfig_context->fg_color = gegl_color_duplicate (gfig_context->default_style.foreground);
|
||||||
gfig_context->fg_color_button = gimp_color_button_new (_("Foreground"),
|
gfig_context->fg_color_button = gimp_color_button_new (_("Foreground"),
|
||||||
SEL_BUTTON_WIDTH,
|
SEL_BUTTON_WIDTH,
|
||||||
SEL_BUTTON_HEIGHT,
|
SEL_BUTTON_HEIGHT,
|
||||||
|
@ -499,8 +499,6 @@ gfig_dialog (GimpGfig *gfig)
|
||||||
g_signal_connect (gfig_context->fg_color_button, "color-changed",
|
g_signal_connect (gfig_context->fg_color_button, "color-changed",
|
||||||
G_CALLBACK (set_foreground_callback),
|
G_CALLBACK (set_foreground_callback),
|
||||||
gfig_context->fg_color);
|
gfig_context->fg_color);
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (gfig_context->fg_color_button),
|
|
||||||
&gfig_context->default_style.foreground);
|
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), gfig_context->fg_color_button,
|
gtk_box_pack_start (GTK_BOX (vbox), gfig_context->fg_color_button,
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
gtk_widget_show (gfig_context->fg_color_button);
|
gtk_widget_show (gfig_context->fg_color_button);
|
||||||
|
@ -557,7 +555,7 @@ gfig_dialog (GimpGfig *gfig)
|
||||||
empty_label, NULL);
|
empty_label, NULL);
|
||||||
|
|
||||||
/* A page for the fill color button */
|
/* A page for the fill color button */
|
||||||
gfig_context->bg_color = g_new0 (GimpRGB, 1);
|
gfig_context->bg_color = gegl_color_duplicate (gfig_context->default_style.background);
|
||||||
gfig_context->bg_color_button = gimp_color_button_new (_("Background"),
|
gfig_context->bg_color_button = gimp_color_button_new (_("Background"),
|
||||||
SEL_BUTTON_WIDTH, SEL_BUTTON_HEIGHT,
|
SEL_BUTTON_WIDTH, SEL_BUTTON_HEIGHT,
|
||||||
gfig_context->bg_color,
|
gfig_context->bg_color,
|
||||||
|
@ -565,8 +563,6 @@ gfig_dialog (GimpGfig *gfig)
|
||||||
g_signal_connect (gfig_context->bg_color_button, "color-changed",
|
g_signal_connect (gfig_context->bg_color_button, "color-changed",
|
||||||
G_CALLBACK (set_background_callback),
|
G_CALLBACK (set_background_callback),
|
||||||
gfig_context->bg_color);
|
gfig_context->bg_color);
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (gfig_context->bg_color_button),
|
|
||||||
&gfig_context->default_style.background);
|
|
||||||
gtk_widget_show (gfig_context->bg_color_button);
|
gtk_widget_show (gfig_context->bg_color_button);
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (fill_type_notebook),
|
gtk_notebook_append_page (GTK_NOTEBOOK (fill_type_notebook),
|
||||||
gfig_context->bg_color_button, NULL);
|
gfig_context->bg_color_button, NULL);
|
||||||
|
|
|
@ -56,7 +56,7 @@ static void gfig_read_parameter_double (gchar **text,
|
||||||
static void gfig_read_parameter_gimp_rgb (gchar **text,
|
static void gfig_read_parameter_gimp_rgb (gchar **text,
|
||||||
gint nitems,
|
gint nitems,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
GimpRGB *style_entry);
|
GeglColor **style_entry);
|
||||||
|
|
||||||
/* From a style string, read a resource name,
|
/* From a style string, read a resource name,
|
||||||
* create a resource object, and put it in
|
* create a resource object, and put it in
|
||||||
|
@ -168,7 +168,7 @@ static void
|
||||||
gfig_read_parameter_gimp_rgb (gchar **text,
|
gfig_read_parameter_gimp_rgb (gchar **text,
|
||||||
gint nitems,
|
gint nitems,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
GimpRGB *style_entry)
|
GeglColor **style_entry)
|
||||||
{
|
{
|
||||||
gint n = 0;
|
gint n = 0;
|
||||||
gchar *ptr;
|
gchar *ptr;
|
||||||
|
@ -180,7 +180,10 @@ gfig_read_parameter_gimp_rgb (gchar **text,
|
||||||
gchar colorstr_b[G_ASCII_DTOSTR_BUF_SIZE];
|
gchar colorstr_b[G_ASCII_DTOSTR_BUF_SIZE];
|
||||||
gchar colorstr_a[G_ASCII_DTOSTR_BUF_SIZE];
|
gchar colorstr_a[G_ASCII_DTOSTR_BUF_SIZE];
|
||||||
|
|
||||||
style_entry->r = style_entry->g = style_entry->b = style_entry->a = 0.;
|
if (*style_entry == NULL)
|
||||||
|
*style_entry = gegl_color_new (NULL);
|
||||||
|
|
||||||
|
gegl_color_set_rgba_with_space (*style_entry, 0.0, 0.0, 0.0, 0.0, NULL);
|
||||||
|
|
||||||
snprintf (fmt_str, sizeof (fmt_str),
|
snprintf (fmt_str, sizeof (fmt_str),
|
||||||
"%%%" G_GSIZE_FORMAT "s"
|
"%%%" G_GSIZE_FORMAT "s"
|
||||||
|
@ -201,10 +204,12 @@ gfig_read_parameter_gimp_rgb (gchar **text,
|
||||||
{
|
{
|
||||||
sscanf (ptr, fmt_str,
|
sscanf (ptr, fmt_str,
|
||||||
colorstr_r, colorstr_g, colorstr_b, colorstr_a);
|
colorstr_r, colorstr_g, colorstr_b, colorstr_a);
|
||||||
style_entry->r = g_ascii_strtod (colorstr_r, &endptr);
|
gegl_color_set_rgba_with_space (*style_entry,
|
||||||
style_entry->g = g_ascii_strtod (colorstr_g, &endptr);
|
g_ascii_strtod (colorstr_r, &endptr),
|
||||||
style_entry->b = g_ascii_strtod (colorstr_b, &endptr);
|
g_ascii_strtod (colorstr_g, &endptr),
|
||||||
style_entry->a = g_ascii_strtod (colorstr_a, &endptr);
|
g_ascii_strtod (colorstr_b, &endptr),
|
||||||
|
g_ascii_strtod (colorstr_a, &endptr),
|
||||||
|
NULL);
|
||||||
g_free (tmpstr);
|
g_free (tmpstr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -363,6 +368,7 @@ gfig_save_style (Style *style,
|
||||||
gchar buffer_b[G_ASCII_DTOSTR_BUF_SIZE];
|
gchar buffer_b[G_ASCII_DTOSTR_BUF_SIZE];
|
||||||
gchar buffer_a[G_ASCII_DTOSTR_BUF_SIZE];
|
gchar buffer_a[G_ASCII_DTOSTR_BUF_SIZE];
|
||||||
gint blen = G_ASCII_DTOSTR_BUF_SIZE;
|
gint blen = G_ASCII_DTOSTR_BUF_SIZE;
|
||||||
|
gdouble rgba[4];
|
||||||
|
|
||||||
if (gfig_context->debug_styles)
|
if (gfig_context->debug_styles)
|
||||||
g_printerr ("Saving style %s, brush name '%s'\n", style->name,
|
g_printerr ("Saving style %s, brush name '%s'\n", style->name,
|
||||||
|
@ -386,17 +392,19 @@ gfig_save_style (Style *style,
|
||||||
g_string_append_printf (string, "Gradient: %s\n",
|
g_string_append_printf (string, "Gradient: %s\n",
|
||||||
gimp_resource_get_name (GIMP_RESOURCE (style->gradient)));
|
gimp_resource_get_name (GIMP_RESOURCE (style->gradient)));
|
||||||
|
|
||||||
|
gegl_color_get_pixel (style->foreground, babl_format ("R'G'B'A double"), rgba);
|
||||||
g_string_append_printf (string, "Foreground: %s %s %s %s\n",
|
g_string_append_printf (string, "Foreground: %s %s %s %s\n",
|
||||||
g_ascii_dtostr (buffer_r, blen, style->foreground.r),
|
g_ascii_dtostr (buffer_r, blen, rgba[0]),
|
||||||
g_ascii_dtostr (buffer_g, blen, style->foreground.g),
|
g_ascii_dtostr (buffer_g, blen, rgba[1]),
|
||||||
g_ascii_dtostr (buffer_b, blen, style->foreground.b),
|
g_ascii_dtostr (buffer_b, blen, rgba[2]),
|
||||||
g_ascii_dtostr (buffer_a, blen, style->foreground.a));
|
g_ascii_dtostr (buffer_a, blen, rgba[3]));
|
||||||
|
|
||||||
|
gegl_color_get_pixel (style->background, babl_format ("R'G'B'A double"), rgba);
|
||||||
g_string_append_printf (string, "Background: %s %s %s %s\n",
|
g_string_append_printf (string, "Background: %s %s %s %s\n",
|
||||||
g_ascii_dtostr (buffer_r, blen, style->background.r),
|
g_ascii_dtostr (buffer_r, blen, rgba[0]),
|
||||||
g_ascii_dtostr (buffer_g, blen, style->background.g),
|
g_ascii_dtostr (buffer_g, blen, rgba[1]),
|
||||||
g_ascii_dtostr (buffer_b, blen, style->background.b),
|
g_ascii_dtostr (buffer_b, blen, rgba[2]),
|
||||||
g_ascii_dtostr (buffer_a, blen, style->background.a));
|
g_ascii_dtostr (buffer_a, blen, rgba[3]));
|
||||||
|
|
||||||
g_string_append_printf (string, "</Style>\n");
|
g_string_append_printf (string, "</Style>\n");
|
||||||
}
|
}
|
||||||
|
@ -411,6 +419,7 @@ gfig_style_save_as_attributes (Style *style,
|
||||||
gchar buffer_b[G_ASCII_DTOSTR_BUF_SIZE];
|
gchar buffer_b[G_ASCII_DTOSTR_BUF_SIZE];
|
||||||
gchar buffer_a[G_ASCII_DTOSTR_BUF_SIZE];
|
gchar buffer_a[G_ASCII_DTOSTR_BUF_SIZE];
|
||||||
gint blen = G_ASCII_DTOSTR_BUF_SIZE;
|
gint blen = G_ASCII_DTOSTR_BUF_SIZE;
|
||||||
|
gdouble rgba[4];
|
||||||
|
|
||||||
if (gfig_context->debug_styles)
|
if (gfig_context->debug_styles)
|
||||||
g_printerr ("Saving style %s as attributes\n", style->name);
|
g_printerr ("Saving style %s as attributes\n", style->name);
|
||||||
|
@ -420,17 +429,19 @@ gfig_style_save_as_attributes (Style *style,
|
||||||
gimp_resource_get_name (GIMP_RESOURCE (style->brush)));
|
gimp_resource_get_name (GIMP_RESOURCE (style->brush)));
|
||||||
/* Why only brush and not pattern and gradient? */
|
/* Why only brush and not pattern and gradient? */
|
||||||
|
|
||||||
|
gegl_color_get_pixel (style->foreground, babl_format ("R'G'B'A double"), rgba);
|
||||||
g_string_append_printf (string, "Foreground=\"%s %s %s %s\" ",
|
g_string_append_printf (string, "Foreground=\"%s %s %s %s\" ",
|
||||||
g_ascii_dtostr (buffer_r, blen, style->foreground.r),
|
g_ascii_dtostr (buffer_r, blen, rgba[0]),
|
||||||
g_ascii_dtostr (buffer_g, blen, style->foreground.g),
|
g_ascii_dtostr (buffer_g, blen, rgba[1]),
|
||||||
g_ascii_dtostr (buffer_b, blen, style->foreground.b),
|
g_ascii_dtostr (buffer_b, blen, rgba[2]),
|
||||||
g_ascii_dtostr (buffer_a, blen, style->foreground.a));
|
g_ascii_dtostr (buffer_a, blen, rgba[3]));
|
||||||
|
|
||||||
|
gegl_color_get_pixel (style->background, babl_format ("R'G'B'A double"), rgba);
|
||||||
g_string_append_printf (string, "Background=\"%s %s %s %s\" ",
|
g_string_append_printf (string, "Background=\"%s %s %s %s\" ",
|
||||||
g_ascii_dtostr (buffer_r, blen, style->background.r),
|
g_ascii_dtostr (buffer_r, blen, rgba[0]),
|
||||||
g_ascii_dtostr (buffer_g, blen, style->background.g),
|
g_ascii_dtostr (buffer_g, blen, rgba[1]),
|
||||||
g_ascii_dtostr (buffer_b, blen, style->background.b),
|
g_ascii_dtostr (buffer_b, blen, rgba[2]),
|
||||||
g_ascii_dtostr (buffer_a, blen, style->background.a));
|
g_ascii_dtostr (buffer_a, blen, rgba[3]));
|
||||||
|
|
||||||
g_string_append_printf (string, "FillType=%d ", style->fill_type);
|
g_string_append_printf (string, "FillType=%d ", style->fill_type);
|
||||||
|
|
||||||
|
@ -438,8 +449,6 @@ gfig_style_save_as_attributes (Style *style,
|
||||||
|
|
||||||
g_string_append_printf (string, "FillOpacity=%s ",
|
g_string_append_printf (string, "FillOpacity=%s ",
|
||||||
g_ascii_dtostr (buffer, blen, style->fill_opacity));
|
g_ascii_dtostr (buffer, blen, style->fill_opacity));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -461,7 +470,6 @@ void
|
||||||
set_foreground_callback (GimpColorButton *button,
|
set_foreground_callback (GimpColorButton *button,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GimpRGB color2;
|
|
||||||
Style *current_style;
|
Style *current_style;
|
||||||
|
|
||||||
if (gfig_context->debug_styles)
|
if (gfig_context->debug_styles)
|
||||||
|
@ -469,10 +477,8 @@ set_foreground_callback (GimpColorButton *button,
|
||||||
|
|
||||||
current_style = gfig_context_get_current_style ();
|
current_style = gfig_context_get_current_style ();
|
||||||
|
|
||||||
gimp_color_button_get_color (button, &color2);
|
g_clear_object (¤t_style->foreground);
|
||||||
|
current_style->foreground = gimp_color_button_get_color (button);
|
||||||
gimp_rgba_set (¤t_style->foreground,
|
|
||||||
color2.r, color2.g, color2.b, color2.a);
|
|
||||||
|
|
||||||
gfig_paint_callback ();
|
gfig_paint_callback ();
|
||||||
}
|
}
|
||||||
|
@ -481,7 +487,6 @@ void
|
||||||
set_background_callback (GimpColorButton *button,
|
set_background_callback (GimpColorButton *button,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GimpRGB color2;
|
|
||||||
Style *current_style;
|
Style *current_style;
|
||||||
|
|
||||||
if (gfig_context->debug_styles)
|
if (gfig_context->debug_styles)
|
||||||
|
@ -489,9 +494,8 @@ set_background_callback (GimpColorButton *button,
|
||||||
|
|
||||||
current_style = gfig_context_get_current_style ();
|
current_style = gfig_context_get_current_style ();
|
||||||
|
|
||||||
gimp_color_button_get_color (button, &color2);
|
g_clear_object (¤t_style->background);
|
||||||
gimp_rgba_set (¤t_style->background,
|
current_style->background = gimp_color_button_get_color (button);
|
||||||
color2.r, color2.g, color2.b, color2.a);
|
|
||||||
|
|
||||||
gfig_paint_callback ();
|
gfig_paint_callback ();
|
||||||
}
|
}
|
||||||
|
@ -563,16 +567,6 @@ gfig_gradient_changed_callback (gpointer user_data,
|
||||||
gfig_paint_callback ();
|
gfig_paint_callback ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gfig_rgba_copy (GimpRGB *color1,
|
|
||||||
GimpRGB *color2)
|
|
||||||
{
|
|
||||||
color1->r = color2->r;
|
|
||||||
color1->g = color2->g;
|
|
||||||
color1->b = color2->b;
|
|
||||||
color1->a = color2->a;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gfig_style_copy (Style *style1,
|
gfig_style_copy (Style *style1,
|
||||||
Style *style0,
|
Style *style0,
|
||||||
|
@ -586,8 +580,10 @@ gfig_style_copy (Style *style1,
|
||||||
if (gfig_context->debug_styles)
|
if (gfig_context->debug_styles)
|
||||||
g_printerr ("Copying style %s as style %s\n", style0->name, name);
|
g_printerr ("Copying style %s as style %s\n", style0->name, name);
|
||||||
|
|
||||||
gfig_rgba_copy (&style1->foreground, &style0->foreground);
|
g_clear_object (&style1->foreground);
|
||||||
gfig_rgba_copy (&style1->background, &style0->background);
|
style1->foreground = gegl_color_duplicate (style0->foreground);
|
||||||
|
g_clear_object (&style1->background);
|
||||||
|
style1->background = gegl_color_duplicate (style0->background);
|
||||||
|
|
||||||
if (!style0->brush)
|
if (!style0->brush)
|
||||||
g_message ("Error copying style %s: brush name is NULL.", style0->name);
|
g_message ("Error copying style %s: brush name is NULL.", style0->name);
|
||||||
|
@ -610,17 +606,11 @@ gfig_style_copy (Style *style1,
|
||||||
void
|
void
|
||||||
gfig_style_apply (Style *style)
|
gfig_style_apply (Style *style)
|
||||||
{
|
{
|
||||||
GeglColor *color = gegl_color_new ("black");
|
|
||||||
|
|
||||||
if (gfig_context->debug_styles)
|
if (gfig_context->debug_styles)
|
||||||
g_printerr ("Applying style '%s' -- ", style->name);
|
g_printerr ("Applying style '%s' -- ", style->name);
|
||||||
|
|
||||||
gegl_color_set_rgba_with_space (color, style->foreground.r, style->foreground.g, style->foreground.b, style->foreground.a, NULL);
|
gimp_context_set_foreground (style->foreground);
|
||||||
gimp_context_set_foreground (color);
|
gimp_context_set_background (style->background);
|
||||||
|
|
||||||
gegl_color_set_rgba_with_space (color, style->background.r, style->background.g, style->background.b, style->background.a, NULL);
|
|
||||||
gimp_context_set_background (color);
|
|
||||||
g_object_unref (color);
|
|
||||||
|
|
||||||
if (! gimp_context_set_brush (style->brush))
|
if (! gimp_context_set_brush (style->brush))
|
||||||
g_message ("Style apply: Failed to set brush to '%s' in style '%s'",
|
g_message ("Style apply: Failed to set brush to '%s' in style '%s'",
|
||||||
|
@ -648,7 +638,6 @@ void
|
||||||
gfig_read_gimp_style (Style *style,
|
gfig_read_gimp_style (Style *style,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
{
|
{
|
||||||
GeglColor *color;
|
|
||||||
gint dummy;
|
gint dummy;
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
|
@ -658,12 +647,11 @@ gfig_read_gimp_style (Style *style,
|
||||||
g_printerr ("Reading Gimp settings as style %s\n", name);
|
g_printerr ("Reading Gimp settings as style %s\n", name);
|
||||||
style->name = g_strdup (name);
|
style->name = g_strdup (name);
|
||||||
|
|
||||||
color = gimp_context_get_foreground ();
|
g_clear_object (&style->foreground);
|
||||||
gegl_color_get_pixel (color, babl_format_with_space ("R'G'B'A double", NULL), &style->foreground);
|
style->foreground = gimp_context_get_foreground ();
|
||||||
g_object_unref (color);
|
|
||||||
color = gimp_context_get_background ();
|
g_clear_object (&style->background);
|
||||||
gegl_color_get_pixel (color, babl_format_with_space ("R'G'B'A double", NULL), &style->background);
|
style->background = gimp_context_get_background ();
|
||||||
g_object_unref (color);
|
|
||||||
|
|
||||||
style->brush = gimp_context_get_brush ();
|
style->brush = gimp_context_get_brush ();
|
||||||
style->gradient = gimp_context_get_gradient ();
|
style->gradient = gimp_context_get_gradient ();
|
||||||
|
@ -699,9 +687,9 @@ gfig_style_set_context_from_style (Style *style)
|
||||||
gfig_context->enable_repaint = FALSE;
|
gfig_context->enable_repaint = FALSE;
|
||||||
|
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (gfig_context->fg_color_button),
|
gimp_color_button_set_color (GIMP_COLOR_BUTTON (gfig_context->fg_color_button),
|
||||||
&style->foreground);
|
style->foreground);
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (gfig_context->bg_color_button),
|
gimp_color_button_set_color (GIMP_COLOR_BUTTON (gfig_context->bg_color_button),
|
||||||
&style->background);
|
style->background);
|
||||||
if (! gimp_context_set_brush (style->brush))
|
if (! gimp_context_set_brush (style->brush))
|
||||||
g_message ("Style from context: Failed to set brush");
|
g_message ("Style from context: Failed to set brush");
|
||||||
|
|
||||||
|
@ -737,22 +725,24 @@ void
|
||||||
gfig_style_set_style_from_context (Style *style)
|
gfig_style_set_style_from_context (Style *style)
|
||||||
{
|
{
|
||||||
Style *current_style;
|
Style *current_style;
|
||||||
GimpRGB color;
|
|
||||||
gint value;
|
gint value;
|
||||||
|
|
||||||
style->name = "object";
|
style->name = "object";
|
||||||
current_style = gfig_context_get_current_style ();
|
current_style = gfig_context_get_current_style ();
|
||||||
|
|
||||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (gfig_context->fg_color_button),
|
g_clear_object (&style->foreground);
|
||||||
&color);
|
style->foreground = gimp_color_button_get_color (GIMP_COLOR_BUTTON (gfig_context->fg_color_button));
|
||||||
if (gfig_context->debug_styles)
|
if (gfig_context->debug_styles)
|
||||||
g_printerr ("Setting foreground color to %lg %lg %lg\n",
|
{
|
||||||
color.r, color.g, color.b);
|
gdouble rgb[3];
|
||||||
|
|
||||||
gfig_rgba_copy (&style->foreground, &color);
|
gegl_color_get_pixel (style->foreground, babl_format ("R'G'B' double"), rgb);
|
||||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (gfig_context->bg_color_button),
|
g_printerr ("Setting foreground color to %lg %lg %lg\n",
|
||||||
&color);
|
rgb[0], rgb[1], rgb[2]);
|
||||||
gfig_rgba_copy (&style->background, &color);
|
}
|
||||||
|
|
||||||
|
g_clear_object (&style->background);
|
||||||
|
style->background = gimp_color_button_get_color (GIMP_COLOR_BUTTON (gfig_context->bg_color_button));
|
||||||
|
|
||||||
/* FIXME: issues of ownership.
|
/* FIXME: issues of ownership.
|
||||||
* A resource is a pointer to an object.
|
* A resource is a pointer to an object.
|
||||||
|
|
|
@ -46,8 +46,8 @@ struct _Style
|
||||||
gdouble fill_opacity;
|
gdouble fill_opacity;
|
||||||
|
|
||||||
PaintType paint_type;
|
PaintType paint_type;
|
||||||
GimpRGB foreground;
|
GeglColor *foreground;
|
||||||
GimpRGB background;
|
GeglColor *background;
|
||||||
gboolean reverselines;
|
gboolean reverselines;
|
||||||
gint ref_count;
|
gint ref_count;
|
||||||
};
|
};
|
||||||
|
@ -88,9 +88,6 @@ void gfig_gradient_changed_callback (gpointer user_data,
|
||||||
GimpGradient *gradient,
|
GimpGradient *gradient,
|
||||||
gboolean dialog_closing);
|
gboolean dialog_closing);
|
||||||
|
|
||||||
void gfig_rgba_copy (GimpRGB *color1,
|
|
||||||
GimpRGB *color2);
|
|
||||||
|
|
||||||
void gfig_style_copy (Style *style1,
|
void gfig_style_copy (Style *style1,
|
||||||
Style *style0,
|
Style *style0,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
|
|
|
@ -163,8 +163,8 @@ typedef struct
|
||||||
GtkWidget *gradient_select;
|
GtkWidget *gradient_select;
|
||||||
GtkWidget *fillstyle_combo;
|
GtkWidget *fillstyle_combo;
|
||||||
GtkWidget *paint_type_toggle;
|
GtkWidget *paint_type_toggle;
|
||||||
GimpRGB *fg_color;
|
GeglColor *fg_color;
|
||||||
GimpRGB *bg_color;
|
GeglColor *bg_color;
|
||||||
gboolean enable_repaint;
|
gboolean enable_repaint;
|
||||||
gboolean using_new_layer;
|
gboolean using_new_layer;
|
||||||
} GFigContext;
|
} GFigContext;
|
||||||
|
|
|
@ -99,7 +99,7 @@ general_restore (void)
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (general_tileable),
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (general_tileable),
|
||||||
pcvals.general_tileable);
|
pcvals.general_tileable);
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (general_color_button),
|
gimp_color_button_set_color (GIMP_COLOR_BUTTON (general_color_button),
|
||||||
&pcvals.color);
|
pcvals.color);
|
||||||
gimp_label_spin_set_value (GIMP_LABEL_SPIN (dev_thresh_scale),
|
gimp_label_spin_set_value (GIMP_LABEL_SPIN (dev_thresh_scale),
|
||||||
pcvals.devthresh);
|
pcvals.devthresh);
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,14 @@ select_color (GtkWidget *widget, gpointer data)
|
||||||
TRUE);
|
TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
color_changed (GimpColorButton *button,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
g_clear_object (&pcvals.color);
|
||||||
|
pcvals.color = gimp_color_button_get_color (button);
|
||||||
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
create_general_button (GtkWidget *box,
|
create_general_button (GtkWidget *box,
|
||||||
int idx,
|
int idx,
|
||||||
|
@ -166,15 +174,17 @@ create_generalpage (GtkNotebook *notebook)
|
||||||
_("Solid colored background"),
|
_("Solid colored background"),
|
||||||
&radio_group);
|
&radio_group);
|
||||||
|
|
||||||
|
pcvals.color = gegl_color_new ("black");
|
||||||
|
|
||||||
general_color_button = gimp_color_button_new (_("Color"),
|
general_color_button = gimp_color_button_new (_("Color"),
|
||||||
COLORBUTTONWIDTH,
|
COLORBUTTONWIDTH,
|
||||||
COLORBUTTONHEIGHT,
|
COLORBUTTONHEIGHT,
|
||||||
&pcvals.color,
|
pcvals.color,
|
||||||
GIMP_COLOR_AREA_FLAT);
|
GIMP_COLOR_AREA_FLAT);
|
||||||
g_signal_connect (general_color_button, "clicked",
|
g_signal_connect (general_color_button, "clicked",
|
||||||
G_CALLBACK (select_color), NULL);
|
G_CALLBACK (select_color), NULL);
|
||||||
g_signal_connect (general_color_button, "color-changed",
|
g_signal_connect (general_color_button, "color-changed",
|
||||||
G_CALLBACK (gimp_color_button_get_color),
|
G_CALLBACK (color_changed),
|
||||||
&pcvals.color);
|
&pcvals.color);
|
||||||
gtk_box_pack_start (GTK_BOX (box4), general_color_button, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (box4), general_color_button, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (general_color_button);
|
gtk_widget_show (general_color_button);
|
||||||
|
|
|
@ -70,7 +70,7 @@ typedef struct
|
||||||
int run;
|
int run;
|
||||||
char selected_brush[200];
|
char selected_brush[200];
|
||||||
char selected_paper[200];
|
char selected_paper[200];
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
int general_paint_edges;
|
int general_paint_edges;
|
||||||
int place_type;
|
int place_type;
|
||||||
vector_t orient_vectors[MAXORIENTVECT];
|
vector_t orient_vectors[MAXORIENTVECT];
|
||||||
|
|
|
@ -47,7 +47,7 @@ static const gimpressionist_vals_t defaultpcvals = {
|
||||||
0,
|
0,
|
||||||
"defaultbrush.pgm",
|
"defaultbrush.pgm",
|
||||||
"defaultpaper.pgm",
|
"defaultpaper.pgm",
|
||||||
{0,0,0,1.0},
|
NULL,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
{ { 0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 0 } },
|
{ { 0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 0 } },
|
||||||
|
|
|
@ -429,7 +429,11 @@ set_values (const gchar *key, const gchar *val)
|
||||||
else if (!strcmp (key, "color"))
|
else if (!strcmp (key, "color"))
|
||||||
{
|
{
|
||||||
char *c = parse_rgb_string (val);
|
char *c = parse_rgb_string (val);
|
||||||
gimp_rgba_set_uchar (&pcvals.color, c[0], c[1], c[2], 255);
|
|
||||||
|
if (pcvals.color == NULL)
|
||||||
|
pcvals.color = gegl_color_new (NULL);
|
||||||
|
|
||||||
|
gegl_color_set_pixel (pcvals.color, babl_format ("R'G'B' u8"), c);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!strcmp (key, "numorientvector"))
|
else if (!strcmp (key, "numorientvector"))
|
||||||
|
@ -820,7 +824,7 @@ save_preset (void)
|
||||||
fprintf (f, "selectedbrush=%s\n", pcvals.selected_brush);
|
fprintf (f, "selectedbrush=%s\n", pcvals.selected_brush);
|
||||||
fprintf (f, "selectedpaper=%s\n", pcvals.selected_paper);
|
fprintf (f, "selectedpaper=%s\n", pcvals.selected_paper);
|
||||||
|
|
||||||
gimp_rgb_get_uchar (&pcvals.color, &color[0], &color[1], &color[2]);
|
gegl_color_get_pixel (pcvals.color, babl_format ("R'G'B' u8"), color);
|
||||||
fprintf (f, "color=%02x%02x%02x\n", color[0], color[1], color[2]);
|
fprintf (f, "color=%02x%02x%02x\n", color[0], color[1], color[2]);
|
||||||
|
|
||||||
fprintf (f, "placetype=%d\n", pcvals.place_type);
|
fprintf (f, "placetype=%d\n", pcvals.place_type);
|
||||||
|
|
|
@ -543,8 +543,7 @@ repaint (ppm_t *p, ppm_t *a)
|
||||||
guchar tmpcol[3];
|
guchar tmpcol[3];
|
||||||
|
|
||||||
ppm_new (&tmp, p->width, p->height);
|
ppm_new (&tmp, p->width, p->height);
|
||||||
gimp_rgb_get_uchar (&runningvals.color,
|
gegl_color_get_pixel (runningvals.color, babl_format ("R'G'B' u8"), tmpcol);
|
||||||
&tmpcol[0], &tmpcol[1], &tmpcol[2]);
|
|
||||||
fill (&tmp, tmpcol);
|
fill (&tmp, tmpcol);
|
||||||
}
|
}
|
||||||
else if (runningvals.general_background_type == BG_TYPE_KEEP_ORIGINAL)
|
else if (runningvals.general_background_type == BG_TYPE_KEEP_ORIGINAL)
|
||||||
|
|
|
@ -96,7 +96,7 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GimpRGB *color;
|
GeglColor *color;
|
||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
GtkWidget *orig_preview;
|
GtkWidget *orig_preview;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
|
@ -2023,7 +2023,8 @@ color_map_create (const gchar *name,
|
||||||
GeglColor *color;
|
GeglColor *color;
|
||||||
|
|
||||||
gimp_rgb_set_alpha (data, 1.0);
|
gimp_rgb_set_alpha (data, 1.0);
|
||||||
color_map->color = data;
|
color_map->color = gegl_color_new (NULL);
|
||||||
|
gegl_color_set_pixel (color_map->color, babl_format ("R'G'B'A double"), data);
|
||||||
color_map->fixed_point = fixed_point;
|
color_map->fixed_point = fixed_point;
|
||||||
color_map->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
color_map->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
||||||
|
|
||||||
|
@ -2050,16 +2051,12 @@ color_map_create (const gchar *name,
|
||||||
color_map->button = gimp_color_button_new (name,
|
color_map->button = gimp_color_button_new (name,
|
||||||
COLOR_SAMPLE_SIZE,
|
COLOR_SAMPLE_SIZE,
|
||||||
COLOR_SAMPLE_SIZE,
|
COLOR_SAMPLE_SIZE,
|
||||||
data,
|
color_map->color,
|
||||||
GIMP_COLOR_AREA_FLAT);
|
GIMP_COLOR_AREA_FLAT);
|
||||||
gtk_box_pack_start (GTK_BOX (color_map->hbox), color_map->button,
|
gtk_box_pack_start (GTK_BOX (color_map->hbox), color_map->button,
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
gtk_widget_show (color_map->button);
|
gtk_widget_show (color_map->button);
|
||||||
|
|
||||||
g_signal_connect (color_map->button, "color-changed",
|
|
||||||
G_CALLBACK (gimp_color_button_get_color),
|
|
||||||
data);
|
|
||||||
|
|
||||||
g_signal_connect (color_map->button, "color-changed",
|
g_signal_connect (color_map->button, "color-changed",
|
||||||
G_CALLBACK (color_map_color_changed_cb),
|
G_CALLBACK (color_map_color_changed_cb),
|
||||||
color_map);
|
color_map);
|
||||||
|
@ -2084,6 +2081,9 @@ color_map_color_changed_cb (GtkWidget *widget,
|
||||||
update_values ();
|
update_values ();
|
||||||
|
|
||||||
ifs_compose_preview ();
|
ifs_compose_preview ();
|
||||||
|
|
||||||
|
g_clear_object (&color_map->color);
|
||||||
|
color_map->color = gimp_color_button_get_color (GIMP_COLOR_BUTTON (widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2093,14 +2093,7 @@ color_map_update (ColorMap *color_map)
|
||||||
color_map->color);
|
color_map->color);
|
||||||
|
|
||||||
if (color_map->fixed_point)
|
if (color_map->fixed_point)
|
||||||
{
|
gimp_color_area_set_color (GIMP_COLOR_AREA (color_map->orig_preview), color_map->color);
|
||||||
GeglColor *color;
|
|
||||||
|
|
||||||
color = gegl_color_new (NULL);
|
|
||||||
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), color_map->color);
|
|
||||||
gimp_color_area_set_color (GIMP_COLOR_AREA (color_map->orig_preview), color);
|
|
||||||
g_object_unref (color);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -313,14 +313,19 @@ preferences_ok_cb (gpointer data)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_button_color (GtkWidget *button,
|
get_button_color (GtkWidget *button,
|
||||||
GdkRGBA *color)
|
GdkRGBA *rgba)
|
||||||
{
|
{
|
||||||
GimpRGB rgb;
|
GeglColor *color;
|
||||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (button), &rgb);
|
gdouble rgb[3];
|
||||||
color->red = rgb.r;
|
|
||||||
color->green = rgb.g;
|
color = gimp_color_button_get_color (GIMP_COLOR_BUTTON (button));
|
||||||
color->blue = rgb.b;
|
gegl_color_get_pixel (color, babl_format ("R'G'B' double"), rgb);
|
||||||
color->alpha = 1.0;
|
rgba->red = rgb[0];
|
||||||
|
rgba->green = rgb[1];
|
||||||
|
rgba->blue = rgb[2];
|
||||||
|
rgba->alpha = 1.0;
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -336,10 +341,13 @@ get_button_colors(PreferencesDialog_t *dialog, ColorSelData_t *colors)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_button_color (GtkWidget *button,
|
set_button_color (GtkWidget *button,
|
||||||
GdkRGBA *color)
|
GdkRGBA *rgba)
|
||||||
{
|
{
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (button),
|
GeglColor *color = gegl_color_new (NULL);
|
||||||
(GimpRGB *) color);
|
|
||||||
|
gegl_color_set_rgba_with_space (color, rgba->red, rgba->green, rgba->blue, rgba->alpha, NULL);
|
||||||
|
gimp_color_button_set_color (GIMP_COLOR_BUTTON (button), color);
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -437,13 +445,15 @@ static GtkWidget*
|
||||||
create_color_field (PreferencesDialog_t *data, GtkWidget *grid, gint row,
|
create_color_field (PreferencesDialog_t *data, GtkWidget *grid, gint row,
|
||||||
gint col)
|
gint col)
|
||||||
{
|
{
|
||||||
GimpRGB color = {0.0, 0.0, 0.0, 1.0};
|
GeglColor *color = gegl_color_new ("black");
|
||||||
GtkWidget *area = gimp_color_button_new (_("Select Color"), 16, 8, &color,
|
GtkWidget *area = gimp_color_button_new (_("Select Color"), 16, 8, color,
|
||||||
GIMP_COLOR_AREA_FLAT);
|
GIMP_COLOR_AREA_FLAT);
|
||||||
gimp_color_button_set_update (GIMP_COLOR_BUTTON (area), TRUE);
|
gimp_color_button_set_update (GIMP_COLOR_BUTTON (area), TRUE);
|
||||||
gtk_grid_attach (GTK_GRID (grid), area, col, row, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), area, col, row, 1, 1);
|
||||||
gtk_widget_show (area);
|
gtk_widget_show (area);
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
|
|
||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,8 @@ static void script_fu_file_callback (GtkWidget *widget,
|
||||||
SFFilename *file);
|
SFFilename *file);
|
||||||
static void script_fu_combo_callback (GtkWidget *widget,
|
static void script_fu_combo_callback (GtkWidget *widget,
|
||||||
SFOption *option);
|
SFOption *option);
|
||||||
|
static void script_fu_color_button_update (GimpColorButton *button,
|
||||||
|
GimpRGB *rgb);
|
||||||
|
|
||||||
static void script_fu_resource_set_handler (gpointer data,
|
static void script_fu_resource_set_handler (gpointer data,
|
||||||
gpointer resource,
|
gpointer resource,
|
||||||
|
@ -321,13 +323,14 @@ script_fu_interface (SFScript *script,
|
||||||
case SF_COLOR:
|
case SF_COLOR:
|
||||||
{
|
{
|
||||||
GimpColorConfig *config;
|
GimpColorConfig *config;
|
||||||
|
GeglColor *color = gegl_color_new (NULL);
|
||||||
|
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &arg->value.sfa_color);
|
||||||
|
|
||||||
left_align = TRUE;
|
left_align = TRUE;
|
||||||
widget = gimp_color_button_new (_("Script-Fu Color Selection"),
|
widget = gimp_color_button_new (_("Script-Fu Color Selection"),
|
||||||
COLOR_SAMPLE_WIDTH,
|
COLOR_SAMPLE_WIDTH, COLOR_SAMPLE_HEIGHT,
|
||||||
COLOR_SAMPLE_HEIGHT,
|
color, GIMP_COLOR_AREA_FLAT);
|
||||||
&arg->value.sfa_color,
|
|
||||||
GIMP_COLOR_AREA_FLAT);
|
|
||||||
|
|
||||||
gimp_color_button_set_update (GIMP_COLOR_BUTTON (widget), TRUE);
|
gimp_color_button_set_update (GIMP_COLOR_BUTTON (widget), TRUE);
|
||||||
|
|
||||||
|
@ -335,9 +338,10 @@ script_fu_interface (SFScript *script,
|
||||||
gimp_color_button_set_color_config (GIMP_COLOR_BUTTON (widget),
|
gimp_color_button_set_color_config (GIMP_COLOR_BUTTON (widget),
|
||||||
config);
|
config);
|
||||||
g_object_unref (config);
|
g_object_unref (config);
|
||||||
|
g_object_unref (color);
|
||||||
|
|
||||||
g_signal_connect (widget, "color-changed",
|
g_signal_connect (widget, "color-changed",
|
||||||
G_CALLBACK (gimp_color_button_get_color),
|
G_CALLBACK (script_fu_color_button_update),
|
||||||
&arg->value.sfa_color);
|
&arg->value.sfa_color);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -694,6 +698,17 @@ script_fu_combo_callback (GtkWidget *widget,
|
||||||
option->history = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
|
option->history = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
script_fu_color_button_update (GimpColorButton *button,
|
||||||
|
GimpRGB *rgb)
|
||||||
|
{
|
||||||
|
GeglColor *color = gimp_color_button_get_color (button);
|
||||||
|
|
||||||
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), rgb);
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
|
}
|
||||||
|
|
||||||
/* Handle resource-set signal.
|
/* Handle resource-set signal.
|
||||||
* Store id of newly chosen resource in SF local cache of args,
|
* Store id of newly chosen resource in SF local cache of args,
|
||||||
* at the integer location passed by pointer in "data"
|
* at the integer location passed by pointer in "data"
|
||||||
|
@ -887,8 +902,13 @@ script_fu_reset (SFScript *script)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SF_COLOR:
|
case SF_COLOR:
|
||||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (widget),
|
{
|
||||||
&value->sfa_color);
|
GeglColor *color = gegl_color_new (NULL);
|
||||||
|
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &value->sfa_color);
|
||||||
|
gimp_color_button_set_color (GIMP_COLOR_BUTTON (widget), color);
|
||||||
|
g_object_unref (color);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SF_TOGGLE:
|
case SF_TOGGLE:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue