app/actions/select-actions.c app/actions/select-commands.[ch]

2004-10-21  Michael Natterer  <mitch@gimp.org>

	* app/actions/select-actions.c
	* app/actions/select-commands.[ch]
	* app/actions/vectors-actions.c
	* app/actions/vectors-commands.[ch]: added actions and callbacks
	to stroke with the last values used without showing the stroke
	dialog. The actions have no menu entries but can be called via
	shortcuts. Fixes bug #135746.

	(Disclaimer: the uglyness of the callbacks shows the need for a
	stroke API overhaul).
This commit is contained in:
Michael Natterer
2004-10-20 23:14:24 +00:00
committed by Michael Natterer
parent 37995f3fc9
commit ff02c7af99
7 changed files with 120 additions and 35 deletions

View File

@ -1,3 +1,16 @@
2004-10-21 Michael Natterer <mitch@gimp.org>
* app/actions/select-actions.c
* app/actions/select-commands.[ch]
* app/actions/vectors-actions.c
* app/actions/vectors-commands.[ch]: added actions and callbacks
to stroke with the last values used without showing the stroke
dialog. The actions have no menu entries but can be called via
shortcuts. Fixes bug #135746.
(Disclaimer: the uglyness of the callbacks shows the need for a
stroke API overhaul).
2004-10-20 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable-stroke.c

View File

@ -104,6 +104,11 @@ static GimpActionEntry select_actions[] =
N_("_Stroke Selection..."), NULL,
N_("Stroke selection"),
G_CALLBACK (select_stroke_cmd_callback),
GIMP_HELP_SELECTION_STROKE },
{ "select-stroke-last-vals", GIMP_STOCK_SELECTION_STROKE,
"Stroke Selection with last Values", NULL, NULL,
G_CALLBACK (select_stroke_last_vals_cmd_callback),
GIMP_HELP_SELECTION_STROKE }
};
@ -136,10 +141,10 @@ select_actions_update (GimpActionGroup *group,
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
SET_SENSITIVE ("select-all", drawable);
SET_SENSITIVE ("select-none", drawable && sel);
SET_SENSITIVE ("select-invert", drawable);
SET_SENSITIVE ("select-float", drawable && sel);
SET_SENSITIVE ("select-all", drawable);
SET_SENSITIVE ("select-none", drawable && sel);
SET_SENSITIVE ("select-invert", drawable);
SET_SENSITIVE ("select-float", drawable && sel);
SET_SENSITIVE ("select-feather", drawable && sel);
SET_SENSITIVE ("select-sharpen", drawable && sel);
@ -147,8 +152,9 @@ select_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("select-grow", drawable && sel);
SET_SENSITIVE ("select-border", drawable && sel);
SET_SENSITIVE ("select-save", drawable && !fs);
SET_SENSITIVE ("select-stroke", drawable && sel);
SET_SENSITIVE ("select-save", drawable && !fs);
SET_SENSITIVE ("select-stroke", drawable && sel);
SET_SENSITIVE ("select-stroke-last-vals", drawable && sel);
#undef SET_SENSITIVE
}

View File

@ -289,7 +289,6 @@ select_stroke_last_vals_cmd_callback (GtkAction *action,
GimpDrawable *drawable;
GimpContext *context;
GimpObject *options;
GimpItem *item;
gboolean libart_stroking;
return_if_no_image (image, data);
@ -319,22 +318,22 @@ select_stroke_last_vals_cmd_callback (GtkAction *action,
libart_stroking = TRUE;
}
item = GIMP_ITEM (gimp_image_get_mask (image));
if (libart_stroking)
{
gimp_item_stroke (item, drawable, context, options, FALSE);
gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
drawable, context, options, FALSE);
}
else
{
gimp_item_stroke (item, drawable, context,
gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
drawable, context,
g_object_get_data (G_OBJECT (options),
"gimp-paint-info"), FALSE);
}
gimp_image_flush (image);
g_object_unref (options);
gimp_image_flush (image);
}

View File

@ -20,28 +20,30 @@
#define __SELECT_COMMANDS_H__
void select_invert_cmd_callback (GtkAction *action,
gpointer data);
void select_all_cmd_callback (GtkAction *action,
gpointer data);
void select_none_cmd_callback (GtkAction *action,
gpointer data);
void select_float_cmd_callback (GtkAction *action,
gpointer data);
void select_feather_cmd_callback (GtkAction *action,
gpointer data);
void select_sharpen_cmd_callback (GtkAction *action,
gpointer data);
void select_shrink_cmd_callback (GtkAction *action,
gpointer data);
void select_border_cmd_callback (GtkAction *action,
gpointer data);
void select_grow_cmd_callback (GtkAction *action,
gpointer data);
void select_save_cmd_callback (GtkAction *action,
gpointer data);
void select_stroke_cmd_callback (GtkAction *action,
gpointer data);
void select_invert_cmd_callback (GtkAction *action,
gpointer data);
void select_all_cmd_callback (GtkAction *action,
gpointer data);
void select_none_cmd_callback (GtkAction *action,
gpointer data);
void select_float_cmd_callback (GtkAction *action,
gpointer data);
void select_feather_cmd_callback (GtkAction *action,
gpointer data);
void select_sharpen_cmd_callback (GtkAction *action,
gpointer data);
void select_shrink_cmd_callback (GtkAction *action,
gpointer data);
void select_border_cmd_callback (GtkAction *action,
gpointer data);
void select_grow_cmd_callback (GtkAction *action,
gpointer data);
void select_save_cmd_callback (GtkAction *action,
gpointer data);
void select_stroke_cmd_callback (GtkAction *action,
gpointer data);
void select_stroke_last_vals_cmd_callback (GtkAction *action,
gpointer data);
#endif /* __SELECT_COMMANDS_H__ */

View File

@ -114,6 +114,11 @@ static GimpActionEntry vectors_actions[] =
G_CALLBACK (vectors_stroke_cmd_callback),
GIMP_HELP_PATH_STROKE },
{ "vectors-stroke-last-vals", GIMP_STOCK_PATH_STROKE,
"Stroke Path with last Values", NULL, NULL,
G_CALLBACK (vectors_stroke_last_vals_cmd_callback),
GIMP_HELP_PATH_STROKE },
{ "vectors-copy", GTK_STOCK_COPY,
N_("Co_py Path"), "", NULL,
G_CALLBACK (vectors_copy_cmd_callback),
@ -299,6 +304,7 @@ vectors_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("vectors-selection-to-vectors-short", gimage && !mask_empty);
SET_SENSITIVE ("vectors-selection-to-vectors-advanced", gimage && !mask_empty);
SET_SENSITIVE ("vectors-stroke", vectors);
SET_SENSITIVE ("vectors-stroke-last-vals", vectors);
SET_SENSITIVE ("vectors-selection-replace", vectors);
SET_SENSITIVE ("vectors-selection-from-vectors", vectors);

View File

@ -36,6 +36,7 @@
#include "core/gimpimage-undo.h"
#include "core/gimpitemundo.h"
#include "core/gimpprogress.h"
#include "core/gimpstrokeoptions.h"
#include "core/gimptoolinfo.h"
#include "pdb/procedural_db.h"
@ -366,6 +367,62 @@ vectors_stroke_cmd_callback (GtkAction *action,
gtk_widget_show (dialog);
}
void
vectors_stroke_last_vals_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpVectors *vectors;
GimpDrawable *drawable;
GimpContext *context;
GimpObject *options;
gboolean libart_stroking;
return_if_no_vectors (image, vectors, data);
drawable = gimp_image_active_drawable (image);
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
return;
}
context = gimp_get_user_context (image->gimp);
options = g_object_get_data (G_OBJECT (context), "saved-stroke-options");
if (options)
{
g_object_ref (options);
libart_stroking = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (options),
"libart-stroking"));
}
else
{
options = g_object_new (GIMP_TYPE_STROKE_OPTIONS,
"gimp", image->gimp,
NULL);
libart_stroking = TRUE;
}
if (libart_stroking)
{
gimp_item_stroke (GIMP_ITEM (vectors),
drawable, context, options, FALSE);
}
else
{
gimp_item_stroke (GIMP_ITEM (vectors),
drawable, context,
g_object_get_data (G_OBJECT (options),
"gimp-paint-info"), FALSE);
}
g_object_unref (options);
gimp_image_flush (image);
}
void
vectors_copy_cmd_callback (GtkAction *action,
gpointer data)

View File

@ -52,6 +52,8 @@ void vectors_selection_to_vectors_cmd_callback (GtkAction *action,
gpointer data);
void vectors_stroke_cmd_callback (GtkAction *action,
gpointer data);
void vectors_stroke_last_vals_cmd_callback (GtkAction *action,
gpointer data);
void vectors_copy_cmd_callback (GtkAction *action,
gpointer data);