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:

committed by
Michael Natterer

parent
37995f3fc9
commit
ff02c7af99
13
ChangeLog
13
ChangeLog
@ -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>
|
2004-10-20 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/core/gimpdrawable-stroke.c
|
* app/core/gimpdrawable-stroke.c
|
||||||
|
@ -104,6 +104,11 @@ static GimpActionEntry select_actions[] =
|
|||||||
N_("_Stroke Selection..."), NULL,
|
N_("_Stroke Selection..."), NULL,
|
||||||
N_("Stroke selection"),
|
N_("Stroke selection"),
|
||||||
G_CALLBACK (select_stroke_cmd_callback),
|
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 }
|
GIMP_HELP_SELECTION_STROKE }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -149,6 +154,7 @@ select_actions_update (GimpActionGroup *group,
|
|||||||
|
|
||||||
SET_SENSITIVE ("select-save", drawable && !fs);
|
SET_SENSITIVE ("select-save", drawable && !fs);
|
||||||
SET_SENSITIVE ("select-stroke", drawable && sel);
|
SET_SENSITIVE ("select-stroke", drawable && sel);
|
||||||
|
SET_SENSITIVE ("select-stroke-last-vals", drawable && sel);
|
||||||
|
|
||||||
#undef SET_SENSITIVE
|
#undef SET_SENSITIVE
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,6 @@ select_stroke_last_vals_cmd_callback (GtkAction *action,
|
|||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
GimpContext *context;
|
GimpContext *context;
|
||||||
GimpObject *options;
|
GimpObject *options;
|
||||||
GimpItem *item;
|
|
||||||
gboolean libart_stroking;
|
gboolean libart_stroking;
|
||||||
return_if_no_image (image, data);
|
return_if_no_image (image, data);
|
||||||
|
|
||||||
@ -319,22 +318,22 @@ select_stroke_last_vals_cmd_callback (GtkAction *action,
|
|||||||
libart_stroking = TRUE;
|
libart_stroking = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
item = GIMP_ITEM (gimp_image_get_mask (image));
|
|
||||||
|
|
||||||
if (libart_stroking)
|
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
|
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),
|
g_object_get_data (G_OBJECT (options),
|
||||||
"gimp-paint-info"), FALSE);
|
"gimp-paint-info"), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_image_flush (image);
|
|
||||||
|
|
||||||
g_object_unref (options);
|
g_object_unref (options);
|
||||||
|
|
||||||
|
gimp_image_flush (image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,6 +42,8 @@ void select_save_cmd_callback (GtkAction *action,
|
|||||||
gpointer data);
|
gpointer data);
|
||||||
void select_stroke_cmd_callback (GtkAction *action,
|
void select_stroke_cmd_callback (GtkAction *action,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
void select_stroke_last_vals_cmd_callback (GtkAction *action,
|
||||||
|
gpointer data);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __SELECT_COMMANDS_H__ */
|
#endif /* __SELECT_COMMANDS_H__ */
|
||||||
|
@ -114,6 +114,11 @@ static GimpActionEntry vectors_actions[] =
|
|||||||
G_CALLBACK (vectors_stroke_cmd_callback),
|
G_CALLBACK (vectors_stroke_cmd_callback),
|
||||||
GIMP_HELP_PATH_STROKE },
|
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,
|
{ "vectors-copy", GTK_STOCK_COPY,
|
||||||
N_("Co_py Path"), "", NULL,
|
N_("Co_py Path"), "", NULL,
|
||||||
G_CALLBACK (vectors_copy_cmd_callback),
|
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-short", gimage && !mask_empty);
|
||||||
SET_SENSITIVE ("vectors-selection-to-vectors-advanced", gimage && !mask_empty);
|
SET_SENSITIVE ("vectors-selection-to-vectors-advanced", gimage && !mask_empty);
|
||||||
SET_SENSITIVE ("vectors-stroke", vectors);
|
SET_SENSITIVE ("vectors-stroke", vectors);
|
||||||
|
SET_SENSITIVE ("vectors-stroke-last-vals", vectors);
|
||||||
|
|
||||||
SET_SENSITIVE ("vectors-selection-replace", vectors);
|
SET_SENSITIVE ("vectors-selection-replace", vectors);
|
||||||
SET_SENSITIVE ("vectors-selection-from-vectors", vectors);
|
SET_SENSITIVE ("vectors-selection-from-vectors", vectors);
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "core/gimpimage-undo.h"
|
#include "core/gimpimage-undo.h"
|
||||||
#include "core/gimpitemundo.h"
|
#include "core/gimpitemundo.h"
|
||||||
#include "core/gimpprogress.h"
|
#include "core/gimpprogress.h"
|
||||||
|
#include "core/gimpstrokeoptions.h"
|
||||||
#include "core/gimptoolinfo.h"
|
#include "core/gimptoolinfo.h"
|
||||||
|
|
||||||
#include "pdb/procedural_db.h"
|
#include "pdb/procedural_db.h"
|
||||||
@ -366,6 +367,62 @@ vectors_stroke_cmd_callback (GtkAction *action,
|
|||||||
gtk_widget_show (dialog);
|
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
|
void
|
||||||
vectors_copy_cmd_callback (GtkAction *action,
|
vectors_copy_cmd_callback (GtkAction *action,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -52,6 +52,8 @@ void vectors_selection_to_vectors_cmd_callback (GtkAction *action,
|
|||||||
gpointer data);
|
gpointer data);
|
||||||
void vectors_stroke_cmd_callback (GtkAction *action,
|
void vectors_stroke_cmd_callback (GtkAction *action,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
void vectors_stroke_last_vals_cmd_callback (GtkAction *action,
|
||||||
|
gpointer data);
|
||||||
|
|
||||||
void vectors_copy_cmd_callback (GtkAction *action,
|
void vectors_copy_cmd_callback (GtkAction *action,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
Reference in New Issue
Block a user