mirror of https://github.com/GNOME/gimp.git
app: create a new pixel-size-set action for Ink and Brush tools.
Once this is done, I got rid of the ugly hack I added over the already ugly hack used on "*-set" enum actions.
This commit is contained in:
parent
c7979e7f06
commit
ebf99132eb
|
@ -503,15 +503,12 @@ action_data_sel_count (gpointer data)
|
|||
* skip_inc:
|
||||
* delta_factor:
|
||||
* wrap:
|
||||
* set_to_value:
|
||||
*
|
||||
* For any valid enum @value (which are all negative), the corresponding
|
||||
* action computes the semantic value (default, first, next, etc.).
|
||||
* For a positive @value:
|
||||
* - if @set_to_value is used, then @value is used as-is (possibly
|
||||
* wrapped if @wrap is set, clamped otherwise).
|
||||
* - otherwise, @value is considered as a per-thousand value between the
|
||||
* @min and @max, allowing to compute the returned value.
|
||||
* For a positive @value, it is considered as a per-thousand value
|
||||
* between the @min and @max (possibly wrapped if @wrap is set, clamped
|
||||
* otherwise), allowing to compute the returned value.
|
||||
*
|
||||
* Returns: the computed value to use for the action.
|
||||
*/
|
||||
|
@ -525,8 +522,7 @@ action_select_value (GimpActionSelectType select_type,
|
|||
gdouble inc,
|
||||
gdouble skip_inc,
|
||||
gdouble delta_factor,
|
||||
gboolean wrap,
|
||||
gboolean set_to_value)
|
||||
gboolean wrap)
|
||||
{
|
||||
switch (select_type)
|
||||
{
|
||||
|
@ -578,16 +574,9 @@ action_select_value (GimpActionSelectType select_type,
|
|||
|
||||
default:
|
||||
if ((gint) select_type >= 0)
|
||||
{
|
||||
if (set_to_value)
|
||||
value = (gdouble) select_type;
|
||||
else
|
||||
value = (gdouble) select_type * (max - min) / 1000.0 + min;
|
||||
}
|
||||
value = (gdouble) select_type * (max - min) / 1000.0 + min;
|
||||
else
|
||||
{
|
||||
g_return_val_if_reached (value);
|
||||
}
|
||||
g_return_val_if_reached (value);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -616,8 +605,7 @@ action_select_property (GimpActionSelectType select_type,
|
|||
gdouble inc,
|
||||
gdouble skip_inc,
|
||||
gdouble delta_factor,
|
||||
gboolean wrap,
|
||||
gboolean set_to_value)
|
||||
gboolean wrap)
|
||||
{
|
||||
GParamSpec *pspec;
|
||||
|
||||
|
@ -639,8 +627,7 @@ action_select_property (GimpActionSelectType select_type,
|
|||
G_PARAM_SPEC_DOUBLE (pspec)->minimum,
|
||||
G_PARAM_SPEC_DOUBLE (pspec)->maximum,
|
||||
G_PARAM_SPEC_DOUBLE (pspec)->default_value,
|
||||
small_inc, inc, skip_inc, delta_factor, wrap,
|
||||
set_to_value);
|
||||
small_inc, inc, skip_inc, delta_factor, wrap);
|
||||
|
||||
g_object_set (object, property_name, value, NULL);
|
||||
|
||||
|
@ -666,8 +653,7 @@ action_select_property (GimpActionSelectType select_type,
|
|||
G_PARAM_SPEC_INT (pspec)->minimum,
|
||||
G_PARAM_SPEC_INT (pspec)->maximum,
|
||||
G_PARAM_SPEC_INT (pspec)->default_value,
|
||||
small_inc, inc, skip_inc, delta_factor, wrap,
|
||||
set_to_value);
|
||||
small_inc, inc, skip_inc, delta_factor, wrap);
|
||||
|
||||
g_object_set (object, property_name, value, NULL);
|
||||
|
||||
|
|
|
@ -42,8 +42,7 @@ gdouble action_select_value (GimpActionSelectType select_type,
|
|||
gdouble inc,
|
||||
gdouble skip_inc,
|
||||
gdouble delta_factor,
|
||||
gboolean wrap,
|
||||
gboolean set_to_value);
|
||||
gboolean wrap);
|
||||
void action_select_property (GimpActionSelectType select_type,
|
||||
GimpDisplay *display,
|
||||
GObject *object,
|
||||
|
@ -52,8 +51,7 @@ void action_select_property (GimpActionSelectType select_type,
|
|||
gdouble inc,
|
||||
gdouble skip_inc,
|
||||
gdouble delta_factor,
|
||||
gboolean wrap,
|
||||
gboolean set_to_value);
|
||||
gboolean wrap);
|
||||
GimpObject * action_select_object (GimpActionSelectType select_type,
|
||||
GimpContainer *container,
|
||||
GimpObject *current);
|
||||
|
|
|
@ -145,7 +145,7 @@ context_foreground_red_cmd_callback (GimpAction *action,
|
|||
color.r = action_select_value (select_type,
|
||||
color.r,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE, FALSE);
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_context_set_foreground (context, &color);
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ context_foreground_green_cmd_callback (GimpAction *action,
|
|||
color.g = action_select_value (select_type,
|
||||
color.g,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE, FALSE);
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_context_set_foreground (context, &color);
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ context_foreground_blue_cmd_callback (GimpAction *action,
|
|||
color.b = action_select_value (select_type,
|
||||
color.b,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE, FALSE);
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_context_set_foreground (context, &color);
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ context_background_red_cmd_callback (GimpAction *action,
|
|||
color.r = action_select_value (select_type,
|
||||
color.r,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE, FALSE);
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_context_set_background (context, &color);
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ context_background_green_cmd_callback (GimpAction *action,
|
|||
color.g = action_select_value (select_type,
|
||||
color.g,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE, FALSE);
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_context_set_background (context, &color);
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ context_background_blue_cmd_callback (GimpAction *action,
|
|||
color.b = action_select_value (select_type,
|
||||
color.b,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE, FALSE);
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_context_set_background (context, &color);
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ context_foreground_hue_cmd_callback (GimpAction *action,
|
|||
hsv.h = action_select_value (select_type,
|
||||
hsv.h,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 360.0, 0.01, 0.1, 0.0, FALSE, FALSE);
|
||||
1.0 / 360.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_hsv_to_rgb (&hsv, &color);
|
||||
gimp_context_set_foreground (context, &color);
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ context_foreground_saturation_cmd_callback (GimpAction *action,
|
|||
hsv.s = action_select_value (select_type,
|
||||
hsv.s,
|
||||
0.0, 1.0, 1.0,
|
||||
0.01, 0.01, 0.1, 0.0, FALSE, FALSE);
|
||||
0.01, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_hsv_to_rgb (&hsv, &color);
|
||||
gimp_context_set_foreground (context, &color);
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ context_foreground_value_cmd_callback (GimpAction *action,
|
|||
hsv.v = action_select_value (select_type,
|
||||
hsv.v,
|
||||
0.0, 1.0, 1.0,
|
||||
0.01, 0.01, 0.1, 0.0, FALSE, FALSE);
|
||||
0.01, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_hsv_to_rgb (&hsv, &color);
|
||||
gimp_context_set_foreground (context, &color);
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ context_background_hue_cmd_callback (GimpAction *action,
|
|||
hsv.h = action_select_value (select_type,
|
||||
hsv.h,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 360.0, 0.01, 0.1, 0.0, FALSE, FALSE);
|
||||
1.0 / 360.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_hsv_to_rgb (&hsv, &color);
|
||||
gimp_context_set_background (context, &color);
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ context_background_saturation_cmd_callback (GimpAction *action,
|
|||
hsv.s = action_select_value (select_type,
|
||||
hsv.s,
|
||||
0.0, 1.0, 1.0,
|
||||
0.01, 0.01, 0.1, 0.0, FALSE, FALSE);
|
||||
0.01, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_hsv_to_rgb (&hsv, &color);
|
||||
gimp_context_set_background (context, &color);
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ context_background_value_cmd_callback (GimpAction *action,
|
|||
hsv.v = action_select_value (select_type,
|
||||
hsv.v,
|
||||
0.0, 1.0, 1.0,
|
||||
0.01, 0.01, 0.1, 0.0, FALSE, FALSE);
|
||||
0.01, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_hsv_to_rgb (&hsv, &color);
|
||||
gimp_context_set_background (context, &color);
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ context_opacity_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"opacity",
|
||||
1.0 / 255.0, 0.01, 0.1, 0.1, FALSE, FALSE);
|
||||
1.0 / 255.0, 0.01, 0.1, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,7 +435,7 @@ context_paint_mode_cmd_callback (GimpAction *action,
|
|||
index = context_paint_mode_index (paint_mode, modes, n_modes);
|
||||
index = action_select_value (select_type,
|
||||
index, 0, n_modes - 1, 0,
|
||||
0.0, 1.0, 1.0, 0.0, FALSE, FALSE);
|
||||
0.0, 1.0, 1.0, 0.0, FALSE);
|
||||
paint_mode = modes[index];
|
||||
g_free (modes);
|
||||
|
||||
|
@ -576,7 +576,7 @@ context_brush_spacing_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (brush),
|
||||
"spacing",
|
||||
1.0, 5.0, 20.0, 0.1, FALSE, FALSE);
|
||||
1.0, 5.0, 20.0, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -665,7 +665,7 @@ context_brush_radius_cmd_callback (GimpAction *action,
|
|||
radius = action_select_value (select_type,
|
||||
radius,
|
||||
min_radius, 4000.0, min_radius,
|
||||
0.1, 1.0, 10.0, 0.05, FALSE, FALSE);
|
||||
0.1, 1.0, 10.0, 0.05, FALSE);
|
||||
gimp_brush_generated_set_radius (generated, radius);
|
||||
|
||||
display = action_data_get_display (data);
|
||||
|
@ -699,7 +699,7 @@ context_brush_spikes_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (brush),
|
||||
"spikes",
|
||||
0.0, 1.0, 4.0, 0.1, FALSE, FALSE);
|
||||
0.0, 1.0, 4.0, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,7 @@ context_brush_hardness_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (brush),
|
||||
"hardness",
|
||||
0.001, 0.01, 0.1, 0.1, FALSE, FALSE);
|
||||
0.001, 0.01, 0.1, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -749,7 +749,7 @@ context_brush_aspect_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (brush),
|
||||
"aspect-ratio",
|
||||
0.1, 1.0, 4.0, 0.1, FALSE, FALSE);
|
||||
0.1, 1.0, 4.0, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -784,7 +784,7 @@ context_brush_angle_cmd_callback (GimpAction *action,
|
|||
angle = action_select_value (select_type,
|
||||
angle,
|
||||
0.0, 180.0, 0.0,
|
||||
0.1, 1.0, 15.0, 0.1, TRUE, FALSE);
|
||||
0.1, 1.0, 15.0, 0.1, TRUE);
|
||||
|
||||
gimp_brush_generated_set_angle (generated, angle);
|
||||
|
||||
|
@ -881,7 +881,7 @@ context_select_color (GimpActionSelectType select_type,
|
|||
index = action_select_value (select_type,
|
||||
index,
|
||||
0, max, 0,
|
||||
0, 1, 4, 0, FALSE, FALSE);
|
||||
0, 1, 4, 0, FALSE);
|
||||
|
||||
context_set_color_index (index, use_colormap, use_palette, color);
|
||||
}
|
||||
|
|
|
@ -1788,7 +1788,7 @@ layers_opacity_cmd_callback (GimpAction *action,
|
|||
opacity = action_select_value (select_type,
|
||||
gimp_layer_get_opacity (iter->data),
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE, FALSE);
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_layer_set_opacity (iter->data, opacity, push_undo);
|
||||
}
|
||||
|
||||
|
@ -1842,7 +1842,7 @@ layers_mode_cmd_callback (GimpAction *action,
|
|||
index = layers_mode_index (layer_mode, modes, n_modes);
|
||||
index = action_select_value (select_type,
|
||||
index, 0, n_modes - 1, 0,
|
||||
0.0, 1.0, 1.0, 0.0, FALSE, FALSE);
|
||||
0.0, 1.0, 1.0, 0.0, FALSE);
|
||||
layer_mode = modes[index];
|
||||
g_free (modes);
|
||||
|
||||
|
|
|
@ -80,6 +80,13 @@ static const GimpEnumActionEntry tools_color_average_radius_actions[] =
|
|||
NULL }
|
||||
};
|
||||
|
||||
static const GimpDoubleActionEntry tools_paintbrush_pixel_size_actions[] =
|
||||
{
|
||||
{ "tools-paintbrush-pixel-size-set", GIMP_ICON_TOOL_MYPAINT_BRUSH,
|
||||
"Set Brush Size in Pixel", NULL, NULL,
|
||||
1.0, NULL }
|
||||
};
|
||||
|
||||
static const GimpEnumActionEntry tools_paintbrush_size_actions[] =
|
||||
{
|
||||
{ "tools-paintbrush-size-set", GIMP_ICON_TOOL_PAINTBRUSH,
|
||||
|
@ -128,6 +135,13 @@ static const GimpEnumActionEntry tools_paintbrush_force_actions[] =
|
|||
NULL }
|
||||
};
|
||||
|
||||
static const GimpDoubleActionEntry tools_ink_blob_pixel_size_actions[] =
|
||||
{
|
||||
{ "tools-ink-blob-pixel-size-set", GIMP_ICON_TOOL_INK,
|
||||
"Set Ink Blob Size in Pixel", NULL, NULL,
|
||||
1.0, NULL }
|
||||
};
|
||||
|
||||
static const GimpEnumActionEntry tools_ink_blob_size_actions[] =
|
||||
{
|
||||
{ "tools-ink-blob-size-set", GIMP_ICON_TOOL_INK,
|
||||
|
@ -227,7 +241,7 @@ static const GimpEnumActionEntry tools_mybrush_radius_actions[] =
|
|||
static const GimpDoubleActionEntry tools_mybrush_pixel_size_actions[] =
|
||||
{
|
||||
{ "tools-mypaint-brush-pixel-size-set", GIMP_ICON_TOOL_MYPAINT_BRUSH,
|
||||
"Set MyPaint Brush Diameter in pixel", NULL, NULL,
|
||||
"Set MyPaint Brush Diameter in Pixel", NULL, NULL,
|
||||
1.0, NULL }
|
||||
};
|
||||
|
||||
|
@ -653,6 +667,10 @@ tools_actions_setup (GimpActionGroup *group)
|
|||
G_N_ELEMENTS (tools_color_average_radius_actions),
|
||||
tools_color_average_radius_cmd_callback);
|
||||
|
||||
gimp_action_group_add_double_actions (group, NULL,
|
||||
tools_paintbrush_pixel_size_actions,
|
||||
G_N_ELEMENTS (tools_paintbrush_pixel_size_actions),
|
||||
tools_paintbrush_pixel_size_cmd_callback);
|
||||
gimp_action_group_add_enum_actions (group, NULL,
|
||||
tools_paintbrush_size_actions,
|
||||
G_N_ELEMENTS (tools_paintbrush_size_actions),
|
||||
|
@ -678,6 +696,10 @@ tools_actions_setup (GimpActionGroup *group)
|
|||
G_N_ELEMENTS (tools_paintbrush_force_actions),
|
||||
tools_paintbrush_force_cmd_callback);
|
||||
|
||||
gimp_action_group_add_double_actions (group, NULL,
|
||||
tools_ink_blob_pixel_size_actions,
|
||||
G_N_ELEMENTS (tools_ink_blob_pixel_size_actions),
|
||||
tools_ink_blob_pixel_size_cmd_callback);
|
||||
gimp_action_group_add_enum_actions (group, NULL,
|
||||
tools_ink_blob_size_actions,
|
||||
G_N_ELEMENTS (tools_ink_blob_size_actions),
|
||||
|
|
|
@ -171,7 +171,36 @@ tools_color_average_radius_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"average-radius",
|
||||
1.0, 1.0, 10.0, 0.1, FALSE, FALSE);
|
||||
1.0, 1.0, 10.0, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tools_paintbrush_pixel_size_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContext *context;
|
||||
GimpToolInfo *tool_info;
|
||||
gdouble dvalue;
|
||||
return_if_no_context (context, data);
|
||||
|
||||
dvalue = g_variant_get_double (value);
|
||||
tool_info = gimp_context_get_tool (context);
|
||||
|
||||
if (tool_info && GIMP_IS_PAINT_OPTIONS (tool_info->tool_options))
|
||||
{
|
||||
GParamSpec *pspec;
|
||||
|
||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_info->tool_options),
|
||||
"brush-size");
|
||||
dvalue = CLAMP (dvalue,
|
||||
G_PARAM_SPEC_DOUBLE (pspec)->minimum,
|
||||
G_PARAM_SPEC_DOUBLE (pspec)->maximum);
|
||||
|
||||
g_object_set (G_OBJECT (tool_info->tool_options),
|
||||
"brush-size", dvalue,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,7 +224,7 @@ tools_paintbrush_size_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"brush-size",
|
||||
0.1, 1.0, 10.0, 1.0, FALSE, TRUE);
|
||||
0.1, 1.0, 10.0, 1.0, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,7 +248,7 @@ tools_paintbrush_angle_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"brush-angle",
|
||||
0.1, 1.0, 15.0, 0.1, TRUE, FALSE);
|
||||
0.1, 1.0, 15.0, 0.1, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,7 +272,7 @@ tools_paintbrush_aspect_ratio_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"brush-aspect-ratio",
|
||||
0.01, 0.1, 1.0, 0.1, TRUE, FALSE);
|
||||
0.01, 0.1, 1.0, 0.1, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,7 +296,7 @@ tools_paintbrush_spacing_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"brush-spacing",
|
||||
0.001, 0.01, 0.1, 0.1, FALSE, FALSE);
|
||||
0.001, 0.01, 0.1, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,7 +320,7 @@ tools_paintbrush_hardness_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"brush-hardness",
|
||||
0.001, 0.01, 0.1, 0.1, FALSE, FALSE);
|
||||
0.001, 0.01, 0.1, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -315,7 +344,36 @@ tools_paintbrush_force_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"brush-force",
|
||||
0.001, 0.01, 0.1, 0.1, FALSE, FALSE);
|
||||
0.001, 0.01, 0.1, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tools_ink_blob_pixel_size_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContext *context;
|
||||
GimpToolInfo *tool_info;
|
||||
gdouble dvalue;
|
||||
return_if_no_context (context, data);
|
||||
|
||||
dvalue = g_variant_get_double (value);
|
||||
tool_info = gimp_context_get_tool (context);
|
||||
|
||||
if (tool_info && GIMP_IS_INK_OPTIONS (tool_info->tool_options))
|
||||
{
|
||||
GParamSpec *pspec;
|
||||
|
||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_info->tool_options),
|
||||
"size");
|
||||
dvalue = CLAMP (dvalue,
|
||||
G_PARAM_SPEC_DOUBLE (pspec)->minimum,
|
||||
G_PARAM_SPEC_DOUBLE (pspec)->maximum);
|
||||
|
||||
g_object_set (G_OBJECT (tool_info->tool_options),
|
||||
"size", dvalue,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,7 +397,7 @@ tools_ink_blob_size_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"size",
|
||||
0.1, 1.0, 10.0, 0.1, FALSE, TRUE);
|
||||
0.1, 1.0, 10.0, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -363,7 +421,7 @@ tools_ink_blob_aspect_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"blob-aspect",
|
||||
1.0, 0.1, 1.0, 0.1, FALSE, FALSE);
|
||||
1.0, 0.1, 1.0, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -390,7 +448,7 @@ tools_ink_blob_angle_cmd_callback (GimpAction *action,
|
|||
gimp_deg_to_rad (0.1),
|
||||
gimp_deg_to_rad (1.0),
|
||||
gimp_deg_to_rad (15.0),
|
||||
0.1, TRUE, FALSE);
|
||||
0.1, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -414,7 +472,7 @@ tools_airbrush_rate_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"rate",
|
||||
0.1, 1.0, 10.0, 0.1, FALSE, FALSE);
|
||||
0.1, 1.0, 10.0, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,7 +496,7 @@ tools_airbrush_flow_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"flow",
|
||||
0.1, 1.0, 10.0, 0.1, FALSE, FALSE);
|
||||
0.1, 1.0, 10.0, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,7 +520,7 @@ tools_mybrush_radius_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"radius",
|
||||
0.1, 0.1, 0.5, 1.0, FALSE, FALSE);
|
||||
0.1, 0.1, 0.5, 1.0, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -522,7 +580,7 @@ tools_mybrush_hardness_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"hardness",
|
||||
0.001, 0.01, 0.1, 1.0, FALSE, FALSE);
|
||||
0.001, 0.01, 0.1, 1.0, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,7 +604,7 @@ tools_fg_select_brush_size_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"stroke-width",
|
||||
1.0, 4.0, 16.0, 0.1, FALSE, FALSE);
|
||||
1.0, 4.0, 16.0, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -570,7 +628,7 @@ tools_transform_preview_opacity_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"preview-opacity",
|
||||
0.01, 0.1, 0.5, 0.1, FALSE, FALSE);
|
||||
0.01, 0.1, 0.5, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -594,7 +652,7 @@ tools_warp_effect_size_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"effect-size",
|
||||
1.0, 4.0, 16.0, 0.1, FALSE, FALSE);
|
||||
1.0, 4.0, 16.0, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -618,7 +676,7 @@ tools_warp_effect_hardness_cmd_callback (GimpAction *action,
|
|||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"effect-hardness",
|
||||
0.001, 0.01, 0.1, 0.1, FALSE, FALSE);
|
||||
0.001, 0.01, 0.1, 0.1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ void tools_color_average_radius_cmd_callback (GimpAction *action,
|
|||
GVariant *value,
|
||||
gpointer data);
|
||||
|
||||
void tools_paintbrush_pixel_size_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void tools_paintbrush_size_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
|
@ -48,6 +51,9 @@ void tools_paintbrush_force_cmd_callback (GimpAction *action,
|
|||
GVariant *value,
|
||||
gpointer data);
|
||||
|
||||
void tools_ink_blob_pixel_size_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void tools_ink_blob_size_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
|
|
|
@ -247,7 +247,7 @@ view_zoom_cmd_callback (GimpAction *action,
|
|||
scale,
|
||||
0.0, 512.0, 1.0,
|
||||
1.0 / 8.0, 1.0, 16.0, 0.0,
|
||||
FALSE, FALSE);
|
||||
FALSE);
|
||||
|
||||
/* min = 1.0 / 256, max = 256.0 */
|
||||
/* scale = min * (max / min)**(i/n), i = 0..n */
|
||||
|
@ -435,7 +435,7 @@ view_rotate_absolute_cmd_callback (GimpAction *action,
|
|||
0.0,
|
||||
-180.0, 180.0, 0.0,
|
||||
1.0, 15.0, 90.0, 0.0,
|
||||
TRUE, FALSE);
|
||||
TRUE);
|
||||
|
||||
gimp_display_shell_rotate_to (shell, angle);
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ view_rotate_relative_cmd_callback (GimpAction *action,
|
|||
0.0,
|
||||
-180.0, 180.0, 0.0,
|
||||
1.0, 15.0, 90.0, 0.0,
|
||||
TRUE, FALSE);
|
||||
TRUE);
|
||||
|
||||
gimp_display_shell_rotate (shell, delta);
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ view_scroll_horizontal_cmd_callback (GimpAction *action,
|
|||
gtk_adjustment_get_step_increment (adj),
|
||||
gtk_adjustment_get_page_increment (adj),
|
||||
0,
|
||||
FALSE, FALSE);
|
||||
FALSE);
|
||||
|
||||
gtk_adjustment_set_value (shell->hsbdata, offset);
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ view_scroll_vertical_cmd_callback (GimpAction *action,
|
|||
gtk_adjustment_get_step_increment (adj),
|
||||
gtk_adjustment_get_page_increment (adj),
|
||||
0,
|
||||
FALSE, FALSE);
|
||||
FALSE);
|
||||
|
||||
gtk_adjustment_set_value (shell->vsbdata, offset);
|
||||
}
|
||||
|
|
|
@ -113,20 +113,22 @@ gimp_brush_tool_init (GimpBrushTool *brush_tool)
|
|||
{
|
||||
GimpTool *tool = GIMP_TOOL (brush_tool);
|
||||
|
||||
gimp_tool_control_set_action_size (tool->control,
|
||||
"tools/tools-paintbrush-size-set");
|
||||
gimp_tool_control_set_action_aspect (tool->control,
|
||||
"tools/tools-paintbrush-aspect-ratio-set");
|
||||
gimp_tool_control_set_action_angle (tool->control,
|
||||
"tools/tools-paintbrush-angle-set");
|
||||
gimp_tool_control_set_action_spacing (tool->control,
|
||||
"tools/tools-paintbrush-spacing-set");
|
||||
gimp_tool_control_set_action_hardness (tool->control,
|
||||
"tools/tools-paintbrush-hardness-set");
|
||||
gimp_tool_control_set_action_force (tool->control,
|
||||
"tools/tools-paintbrush-force-set");
|
||||
gimp_tool_control_set_action_object_1 (tool->control,
|
||||
"context/context-brush-select-set");
|
||||
gimp_tool_control_set_action_pixel_size (tool->control,
|
||||
"tools/tools-paintbrush-pixel-size-set");
|
||||
gimp_tool_control_set_action_size (tool->control,
|
||||
"tools/tools-paintbrush-size-set");
|
||||
gimp_tool_control_set_action_aspect (tool->control,
|
||||
"tools/tools-paintbrush-aspect-ratio-set");
|
||||
gimp_tool_control_set_action_angle (tool->control,
|
||||
"tools/tools-paintbrush-angle-set");
|
||||
gimp_tool_control_set_action_spacing (tool->control,
|
||||
"tools/tools-paintbrush-spacing-set");
|
||||
gimp_tool_control_set_action_hardness (tool->control,
|
||||
"tools/tools-paintbrush-hardness-set");
|
||||
gimp_tool_control_set_action_force (tool->control,
|
||||
"tools/tools-paintbrush-force-set");
|
||||
gimp_tool_control_set_action_object_1 (tool->control,
|
||||
"context/context-brush-select-set");
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -92,12 +92,14 @@ gimp_ink_tool_init (GimpInkTool *ink_tool)
|
|||
GimpTool *tool = GIMP_TOOL (ink_tool);
|
||||
|
||||
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_INK);
|
||||
gimp_tool_control_set_action_size (tool->control,
|
||||
"tools/tools-ink-blob-size-set");
|
||||
gimp_tool_control_set_action_aspect (tool->control,
|
||||
"tools/tools-ink-blob-aspect-set");
|
||||
gimp_tool_control_set_action_angle (tool->control,
|
||||
"tools/tools-ink-blob-angle-set");
|
||||
gimp_tool_control_set_action_pixel_size (tool->control,
|
||||
"tools/tools-ink-blob-pixel-size-set");
|
||||
gimp_tool_control_set_action_size (tool->control,
|
||||
"tools/tools-ink-blob-size-set");
|
||||
gimp_tool_control_set_action_aspect (tool->control,
|
||||
"tools/tools-ink-blob-aspect-set");
|
||||
gimp_tool_control_set_action_angle (tool->control,
|
||||
"tools/tools-ink-blob-angle-set");
|
||||
|
||||
gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (ink_tool),
|
||||
GIMP_COLOR_PICK_TARGET_FOREGROUND);
|
||||
|
|
Loading…
Reference in New Issue