mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-20 19:43:01 +00:00
Add keyboard shortcut support for reseting to default value of e.g. brush
2008-05-31 Martin Nordholts <martinn@svn.gnome.org> Add keyboard shortcut support for reseting to default value of e.g. brush scale. Fixes bug #493030. * app/actions/actions.[ch]: Make action_select_value() take a default-parameter and add support for it. Also use default_value from gint and gdouble param specs. * app/actions/actions-types.h: Added GIMP_ACTION_SELECT_SET_TO_DEFAULT. * app/actions/tools-actions.c: Add _SET_TO_DEFAULT actions. * app/actions/view-commands.c: * app/actions/layers-commands.c: * app/actions/context-commands.c: Pass defaults to action_select_property(). svn path=/trunk/; revision=25874
This commit is contained in:
parent
c827f0cd84
commit
368c855c90
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2008-05-31 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
Add keyboard shortcut support for reseting to default value of
|
||||
e.g. brush scale. Fixes bug #493030.
|
||||
|
||||
* app/actions/actions.[ch]: Make action_select_value() take a
|
||||
default-parameter and add support for it. Also use default_value
|
||||
from gint and gdouble param specs.
|
||||
|
||||
* app/actions/actions-types.h: Added
|
||||
GIMP_ACTION_SELECT_SET_TO_DEFAULT.
|
||||
|
||||
* app/actions/tools-actions.c: Add _SET_TO_DEFAULT actions.
|
||||
|
||||
* app/actions/view-commands.c:
|
||||
* app/actions/layers-commands.c:
|
||||
* app/actions/context-commands.c: Pass defaults to
|
||||
action_select_property().
|
||||
|
||||
2008-05-31 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
* app/tools/gimprotatetool.c (gimp_rotate_tool_key_press):
|
||||
|
@ -112,7 +131,7 @@
|
|||
* libgimpwidgets/gimpwidgets.def: updated.
|
||||
|
||||
2008-05-28 Sven Neumann <sven@gimp.org>
|
||||
|
||||
|
||||
* libgimpwidgets/gimpruler.[ch]
|
||||
* libgimpwidgets/gimphruler.c
|
||||
* libgimpwidgets/gimpvruler.c: enlarge the array of scales to
|
||||
|
|
|
@ -27,16 +27,17 @@
|
|||
typedef enum
|
||||
{
|
||||
GIMP_ACTION_SELECT_SET = 0,
|
||||
GIMP_ACTION_SELECT_FIRST = -1,
|
||||
GIMP_ACTION_SELECT_LAST = -2,
|
||||
GIMP_ACTION_SELECT_SMALL_PREVIOUS = -3,
|
||||
GIMP_ACTION_SELECT_SMALL_NEXT = -4,
|
||||
GIMP_ACTION_SELECT_PREVIOUS = -5,
|
||||
GIMP_ACTION_SELECT_NEXT = -6,
|
||||
GIMP_ACTION_SELECT_SKIP_PREVIOUS = -7,
|
||||
GIMP_ACTION_SELECT_SKIP_NEXT = -8,
|
||||
GIMP_ACTION_SELECT_PERCENT_PREVIOUS = -9,
|
||||
GIMP_ACTION_SELECT_PERCENT_NEXT = -10
|
||||
GIMP_ACTION_SELECT_SET_TO_DEFAULT = -1,
|
||||
GIMP_ACTION_SELECT_FIRST = -2,
|
||||
GIMP_ACTION_SELECT_LAST = -3,
|
||||
GIMP_ACTION_SELECT_SMALL_PREVIOUS = -4,
|
||||
GIMP_ACTION_SELECT_SMALL_NEXT = -5,
|
||||
GIMP_ACTION_SELECT_PREVIOUS = -6,
|
||||
GIMP_ACTION_SELECT_NEXT = -7,
|
||||
GIMP_ACTION_SELECT_SKIP_PREVIOUS = -8,
|
||||
GIMP_ACTION_SELECT_SKIP_NEXT = -9,
|
||||
GIMP_ACTION_SELECT_PERCENT_PREVIOUS = -10,
|
||||
GIMP_ACTION_SELECT_PERCENT_NEXT = -11
|
||||
} GimpActionSelectType;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -376,6 +376,7 @@ action_select_value (GimpActionSelectType select_type,
|
|||
gdouble value,
|
||||
gdouble min,
|
||||
gdouble max,
|
||||
gdouble def,
|
||||
gdouble small_inc,
|
||||
gdouble inc,
|
||||
gdouble skip_inc,
|
||||
|
@ -384,6 +385,10 @@ action_select_value (GimpActionSelectType select_type,
|
|||
{
|
||||
switch (select_type)
|
||||
{
|
||||
case GIMP_ACTION_SELECT_SET_TO_DEFAULT:
|
||||
value = def;
|
||||
break;
|
||||
|
||||
case GIMP_ACTION_SELECT_FIRST:
|
||||
value = min;
|
||||
break;
|
||||
|
@ -477,6 +482,7 @@ action_select_property (GimpActionSelectType select_type,
|
|||
value,
|
||||
G_PARAM_SPEC_DOUBLE (pspec)->minimum,
|
||||
G_PARAM_SPEC_DOUBLE (pspec)->maximum,
|
||||
G_PARAM_SPEC_DOUBLE (pspec)->default_value,
|
||||
small_inc, inc, skip_inc, 0, wrap);
|
||||
|
||||
g_object_set (object, property_name, value, NULL);
|
||||
|
@ -491,6 +497,7 @@ action_select_property (GimpActionSelectType select_type,
|
|||
value,
|
||||
G_PARAM_SPEC_INT (pspec)->minimum,
|
||||
G_PARAM_SPEC_INT (pspec)->maximum,
|
||||
G_PARAM_SPEC_INT (pspec)->default_value,
|
||||
small_inc, inc, skip_inc, 0, wrap);
|
||||
|
||||
g_object_set (object, property_name, value, NULL);
|
||||
|
|
|
@ -36,6 +36,7 @@ gdouble action_select_value (GimpActionSelectType select_type,
|
|||
gdouble value,
|
||||
gdouble min,
|
||||
gdouble max,
|
||||
gdouble def,
|
||||
gdouble small_inc,
|
||||
gdouble inc,
|
||||
gdouble skip_inc,
|
||||
|
|
|
@ -152,7 +152,7 @@ context_foreground_red_cmd_callback (GtkAction *action,
|
|||
gimp_context_get_foreground (context, &color);
|
||||
color.r = action_select_value ((GimpActionSelectType) value,
|
||||
color.r,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_context_set_foreground (context, &color);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ context_foreground_green_cmd_callback (GtkAction *action,
|
|||
gimp_context_get_foreground (context, &color);
|
||||
color.g = action_select_value ((GimpActionSelectType) value,
|
||||
color.g,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_context_set_foreground (context, &color);
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ context_foreground_blue_cmd_callback (GtkAction *action,
|
|||
gimp_context_get_foreground (context, &color);
|
||||
color.b = action_select_value ((GimpActionSelectType) value,
|
||||
color.b,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_context_set_foreground (context, &color);
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ context_background_red_cmd_callback (GtkAction *action,
|
|||
gimp_context_get_background (context, &color);
|
||||
color.r = action_select_value ((GimpActionSelectType) value,
|
||||
color.r,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_context_set_background (context, &color);
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ context_background_green_cmd_callback (GtkAction *action,
|
|||
gimp_context_get_background (context, &color);
|
||||
color.g = action_select_value ((GimpActionSelectType) value,
|
||||
color.g,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_context_set_background (context, &color);
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ context_background_blue_cmd_callback (GtkAction *action,
|
|||
gimp_context_get_background (context, &color);
|
||||
color.b = action_select_value ((GimpActionSelectType) value,
|
||||
color.b,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_context_set_background (context, &color);
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ context_foreground_hue_cmd_callback (GtkAction *action,
|
|||
gimp_rgb_to_hsv (&color, &hsv);
|
||||
hsv.h = action_select_value ((GimpActionSelectType) value,
|
||||
hsv.h,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 360.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_hsv_to_rgb (&hsv, &color);
|
||||
gimp_context_set_foreground (context, &color);
|
||||
|
@ -276,7 +276,7 @@ context_foreground_saturation_cmd_callback (GtkAction *action,
|
|||
gimp_rgb_to_hsv (&color, &hsv);
|
||||
hsv.s = action_select_value ((GimpActionSelectType) value,
|
||||
hsv.s,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
0.01, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_hsv_to_rgb (&hsv, &color);
|
||||
gimp_context_set_foreground (context, &color);
|
||||
|
@ -296,7 +296,7 @@ context_foreground_value_cmd_callback (GtkAction *action,
|
|||
gimp_rgb_to_hsv (&color, &hsv);
|
||||
hsv.v = action_select_value ((GimpActionSelectType) value,
|
||||
hsv.v,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
0.01, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_hsv_to_rgb (&hsv, &color);
|
||||
gimp_context_set_foreground (context, &color);
|
||||
|
@ -316,7 +316,7 @@ context_background_hue_cmd_callback (GtkAction *action,
|
|||
gimp_rgb_to_hsv (&color, &hsv);
|
||||
hsv.h = action_select_value ((GimpActionSelectType) value,
|
||||
hsv.h,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 360.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_hsv_to_rgb (&hsv, &color);
|
||||
gimp_context_set_background (context, &color);
|
||||
|
@ -336,7 +336,7 @@ context_background_saturation_cmd_callback (GtkAction *action,
|
|||
gimp_rgb_to_hsv (&color, &hsv);
|
||||
hsv.s = action_select_value ((GimpActionSelectType) value,
|
||||
hsv.s,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
0.01, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_hsv_to_rgb (&hsv, &color);
|
||||
gimp_context_set_background (context, &color);
|
||||
|
@ -356,7 +356,7 @@ context_background_value_cmd_callback (GtkAction *action,
|
|||
gimp_rgb_to_hsv (&color, &hsv);
|
||||
hsv.v = action_select_value ((GimpActionSelectType) value,
|
||||
hsv.v,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
0.01, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_hsv_to_rgb (&hsv, &color);
|
||||
gimp_context_set_background (context, &color);
|
||||
|
@ -375,6 +375,7 @@ context_opacity_cmd_callback (GtkAction *action,
|
|||
gimp_context_get_opacity (context),
|
||||
GIMP_OPACITY_TRANSPARENT,
|
||||
GIMP_OPACITY_OPAQUE,
|
||||
GIMP_OPACITY_OPAQUE,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_context_set_opacity (context, opacity);
|
||||
}
|
||||
|
@ -393,7 +394,7 @@ context_paint_mode_cmd_callback (GtkAction *action,
|
|||
|
||||
index = action_select_value ((GimpActionSelectType) value,
|
||||
context_paint_mode_index (paint_mode),
|
||||
0, G_N_ELEMENTS (paint_modes) - 1,
|
||||
0, G_N_ELEMENTS (paint_modes) - 1, 0,
|
||||
0.0, 1.0, 1.0, 0.0, FALSE);
|
||||
gimp_context_set_paint_mode (context, paint_modes[index]);
|
||||
}
|
||||
|
@ -484,7 +485,7 @@ context_brush_spacing_cmd_callback (GtkAction *action,
|
|||
spacing = gimp_brush_get_spacing (brush);
|
||||
spacing = action_select_value ((GimpActionSelectType) value,
|
||||
spacing,
|
||||
1.0, 5000.0,
|
||||
1.0, 5000.0, 20.0,
|
||||
1.0, 5.0, 20.0, 0.0, FALSE);
|
||||
gimp_brush_set_spacing (brush, spacing);
|
||||
|
||||
|
@ -554,7 +555,7 @@ context_brush_radius_cmd_callback (GtkAction *action,
|
|||
|
||||
radius = action_select_value ((GimpActionSelectType) value,
|
||||
radius,
|
||||
min_radius, 4000.0,
|
||||
min_radius, 4000.0, min_radius,
|
||||
0.1, 1.0, 10.0, 0.05, FALSE);
|
||||
gimp_brush_generated_set_radius (generated, radius);
|
||||
}
|
||||
|
@ -579,7 +580,7 @@ context_brush_spikes_cmd_callback (GtkAction *action,
|
|||
spikes = gimp_brush_generated_get_spikes (generated);
|
||||
spikes = action_select_value ((GimpActionSelectType) value,
|
||||
spikes,
|
||||
2.0, 20.0,
|
||||
2.0, 20.0, 2.0,
|
||||
0.0, 1.0, 4.0, 0.0, FALSE);
|
||||
gimp_brush_generated_set_spikes (generated, spikes);
|
||||
}
|
||||
|
@ -604,7 +605,7 @@ context_brush_hardness_cmd_callback (GtkAction *action,
|
|||
hardness = gimp_brush_generated_get_hardness (generated);
|
||||
hardness = action_select_value ((GimpActionSelectType) value,
|
||||
hardness,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
0.001, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_brush_generated_set_hardness (generated, hardness);
|
||||
}
|
||||
|
@ -629,7 +630,7 @@ context_brush_aspect_cmd_callback (GtkAction *action,
|
|||
aspect = gimp_brush_generated_get_aspect_ratio (generated);
|
||||
aspect = action_select_value ((GimpActionSelectType) value,
|
||||
aspect,
|
||||
1.0, 20.0,
|
||||
1.0, 20.0, 1.0,
|
||||
0.1, 1.0, 4.0, 0.0, FALSE);
|
||||
gimp_brush_generated_set_aspect_ratio (generated, aspect);
|
||||
}
|
||||
|
@ -660,7 +661,7 @@ context_brush_angle_cmd_callback (GtkAction *action,
|
|||
else
|
||||
angle = action_select_value ((GimpActionSelectType) value,
|
||||
angle,
|
||||
0.0, 180.0,
|
||||
0.0, 180.0, 0.0,
|
||||
0.1, 1.0, 15.0, 0.0, TRUE);
|
||||
|
||||
gimp_brush_generated_set_angle (generated, angle);
|
||||
|
@ -710,7 +711,7 @@ context_select_color (GimpActionSelectType select_type,
|
|||
|
||||
index = action_select_value (select_type,
|
||||
index,
|
||||
0, max,
|
||||
0, max, 0,
|
||||
0, 1, 4, 0, FALSE);
|
||||
|
||||
context_set_color_index (index, use_colormap, use_palette, color);
|
||||
|
|
|
@ -839,7 +839,7 @@ layers_opacity_cmd_callback (GtkAction *action,
|
|||
|
||||
opacity = action_select_value ((GimpActionSelectType) value,
|
||||
gimp_layer_get_opacity (layer),
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 1.0,
|
||||
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
|
||||
gimp_layer_set_opacity (layer, opacity, push_undo);
|
||||
gimp_image_flush (image);
|
||||
|
@ -868,7 +868,7 @@ layers_mode_cmd_callback (GtkAction *action,
|
|||
|
||||
index = action_select_value ((GimpActionSelectType) value,
|
||||
layers_mode_index (layer_mode),
|
||||
0, G_N_ELEMENTS (layer_modes) - 1,
|
||||
0, G_N_ELEMENTS (layer_modes) - 1, 0,
|
||||
0.0, 1.0, 1.0, 0.0, FALSE);
|
||||
gimp_layer_set_mode (layer, layer_modes[index], push_undo);
|
||||
gimp_image_flush (image);
|
||||
|
|
|
@ -347,6 +347,10 @@ static const GimpEnumActionEntry tools_value_1_actions[] =
|
|||
"Set Value 1", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_SET, TRUE,
|
||||
NULL },
|
||||
{ "tools-value-1-set-to-default", GIMP_STOCK_TOOL_OPTIONS,
|
||||
"Set Value 1 To Default", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_SET_TO_DEFAULT, FALSE,
|
||||
NULL },
|
||||
{ "tools-value-1-minimum", GIMP_STOCK_TOOL_OPTIONS,
|
||||
"Minimize Value 1", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_FIRST, FALSE,
|
||||
|
@ -379,6 +383,10 @@ static const GimpEnumActionEntry tools_value_2_actions[] =
|
|||
"Set Value 2", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_SET, TRUE,
|
||||
NULL },
|
||||
{ "tools-value-2-set-to-default", GIMP_STOCK_TOOL_OPTIONS,
|
||||
"Set Value 2 To Default", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_SET_TO_DEFAULT, FALSE,
|
||||
NULL },
|
||||
{ "tools-value-2-minimum", GIMP_STOCK_TOOL_OPTIONS,
|
||||
"Minimize Value 2", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_FIRST, FALSE,
|
||||
|
@ -411,6 +419,10 @@ static const GimpEnumActionEntry tools_value_3_actions[] =
|
|||
"Set Value 3", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_SET, TRUE,
|
||||
NULL },
|
||||
{ "tools-value-3-set-to-default", GIMP_STOCK_TOOL_OPTIONS,
|
||||
"Set Value 3 To Default", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_SET_TO_DEFAULT, FALSE,
|
||||
NULL },
|
||||
{ "tools-value-3-minimum", GIMP_STOCK_TOOL_OPTIONS,
|
||||
"Minimize Value 3", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_FIRST, FALSE,
|
||||
|
@ -443,6 +455,10 @@ static const GimpEnumActionEntry tools_value_4_actions[] =
|
|||
"Set Value 4", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_SET, TRUE,
|
||||
NULL },
|
||||
{ "tools-value-4-set-to-default", GIMP_STOCK_TOOL_OPTIONS,
|
||||
"Set Value 4 To Default", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_SET_TO_DEFAULT, FALSE,
|
||||
NULL },
|
||||
{ "tools-value-4-minimum", GIMP_STOCK_TOOL_OPTIONS,
|
||||
"Minimize Value 4", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_FIRST, FALSE,
|
||||
|
|
|
@ -161,7 +161,7 @@ view_zoom_cmd_callback (GtkAction *action,
|
|||
|
||||
scale = action_select_value ((GimpActionSelectType) value,
|
||||
scale,
|
||||
0.0, 512.0,
|
||||
0.0, 512.0, 1.0,
|
||||
1.0 / 8.0, 1.0, 16.0, 0.0,
|
||||
FALSE);
|
||||
|
||||
|
@ -259,6 +259,7 @@ view_scroll_horizontal_cmd_callback (GtkAction *action,
|
|||
shell->hsbdata->lower,
|
||||
shell->hsbdata->upper -
|
||||
shell->hsbdata->page_size,
|
||||
shell->hsbdata->lower,
|
||||
1,
|
||||
shell->hsbdata->step_increment,
|
||||
shell->hsbdata->page_increment,
|
||||
|
@ -284,6 +285,7 @@ view_scroll_vertical_cmd_callback (GtkAction *action,
|
|||
shell->vsbdata->lower,
|
||||
shell->vsbdata->upper -
|
||||
shell->vsbdata->page_size,
|
||||
shell->vsbdata->lower,
|
||||
1,
|
||||
shell->vsbdata->step_increment,
|
||||
shell->vsbdata->page_increment,
|
||||
|
|
Loading…
Reference in a new issue