Commit 43cdd54d authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

reoedered to somehow reflect the class hierarchy.

2004-05-23  Michael Natterer  <mitch@gimp.org>

	* app/widgets/widgets-types.h: reoedered to somehow reflect the
	class hierarchy.

	Some dockable context handling cleanup:

	* app/widgets/gimpdocked.[ch]: removed "prev_context" parameter
	from GimpDocked::set_context(). Widgets which need the old context
	to disconnect from should remember it themselves.

	* app/widgets/gimpdockable.c (gimp_dockable_set_context): don't
	pass the old context to gimp_docked_set_context().
	Some cleanup.

	* app/widgets/gimpcontainerbox.c
	* app/widgets/gimpcontainereditor.c: changed accordingly.

	* app/display/gimpnavigationview.[ch]
	* app/widgets/gimpimageeditor.[ch]
	* app/widgets/gimpitemtreeview.[ch]: added a "context" member
	which holds the context set by GimpDocked::set_context().

	* app/widgets/gimpdrawabletreeview.c: use the view's context
	instead of gimp_get_user_context().

	* app/widgets/gimpcoloreditor.[ch]: removed separate API to
	set the context because it implements the GimpDockedInterface.

	* app/widgets/gimpcomponenteditor.c
	* app/widgets/gimperrorconsole.c: pass "menu-factory",
	"menu-identifier" and "ui-path" to g_object_new() instead of
	calling gimp_editor_create_menu() later.

	Action cleanup partly related to the context stuff above:

	* app/actions/actions.c (action_data_get_gimp): get the Gimp from
	context->gimp, not gimage->gimp because gimage may be NULL.

	(action_data_get_context): changed to use the new context members
	added above.

	* app/actions/channels-actions.c (channels_actions_update): cleanup.

	* app/actions/edit-actions.c (edit_actions_update): fixed
	sensitivity of "edit-undo-clear".

	* app/actions/vectors-actions.c (vectors_actions_update): make
	"vectors-merge-visible" sensitive only if there is more than one
	GimpVectors in the image.

	* app/actions/colormap-editor-actions.c
	* app/actions/gradient-editor-actions.c
	* app/actions/palette-editor-actions.c: added FG/BG color previews
	to actions which take colors from them. Changed code to be safe
	against "context" being NULL.

	* app/actions/drawable-commands.c:
	s/active_drawable/drawable/g. Makes the code more readable.

	* app/actions/select-commands.[ch]
	* app/actions/vectors-commands.[ch]: removed public stroke utility
	functions and other stuff which is not needed any more because
	dialog buttons invoke the correct actions now. Moved the
	functions' code to the resp. action callbacks.
parent 92514b0d
2004-05-23 Michael Natterer <mitch@gimp.org>
* app/widgets/widgets-types.h: reoedered to somehow reflect the
class hierarchy.
Some dockable context handling cleanup:
* app/widgets/gimpdocked.[ch]: removed "prev_context" parameter
from GimpDocked::set_context(). Widgets which need the old context
to disconnect from should remember it themselves.
* app/widgets/gimpdockable.c (gimp_dockable_set_context): don't
pass the old context to gimp_docked_set_context().
Some cleanup.
* app/widgets/gimpcontainerbox.c
* app/widgets/gimpcontainereditor.c: changed accordingly.
* app/display/gimpnavigationview.[ch]
* app/widgets/gimpimageeditor.[ch]
* app/widgets/gimpitemtreeview.[ch]: added a "context" member
which holds the context set by GimpDocked::set_context().
* app/widgets/gimpdrawabletreeview.c: use the view's context
instead of gimp_get_user_context().
* app/widgets/gimpcoloreditor.[ch]: removed separate API to
set the context because it implements the GimpDockedInterface.
* app/widgets/gimpcomponenteditor.c
* app/widgets/gimperrorconsole.c: pass "menu-factory",
"menu-identifier" and "ui-path" to g_object_new() instead of
calling gimp_editor_create_menu() later.
Action cleanup partly related to the context stuff above:
* app/actions/actions.c (action_data_get_gimp): get the Gimp from
context->gimp, not gimage->gimp because gimage may be NULL.
(action_data_get_context): changed to use the new context members
added above.
* app/actions/channels-actions.c (channels_actions_update): cleanup.
* app/actions/edit-actions.c (edit_actions_update): fixed
sensitivity of "edit-undo-clear".
* app/actions/vectors-actions.c (vectors_actions_update): make
"vectors-merge-visible" sensitive only if there is more than one
GimpVectors in the image.
* app/actions/colormap-editor-actions.c
* app/actions/gradient-editor-actions.c
* app/actions/palette-editor-actions.c: added FG/BG color previews
to actions which take colors from them. Changed code to be safe
against "context" being NULL.
* app/actions/drawable-commands.c:
s/active_drawable/drawable/g. Makes the code more readable.
* app/actions/select-commands.[ch]
* app/actions/vectors-commands.[ch]: removed public stroke utility
functions and other stuff which is not needed any more because
dialog buttons invoke the correct actions now. Moved the
functions' code to the resp. action callbacks.
2004-05-21 Nathan Summers <rock@gimp.org>
Somehow some of the changes from my commit on 2004-05-18 seem to have
......
......@@ -32,6 +32,7 @@
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdock.h"
#include "widgets/gimpdockable.h"
#include "widgets/gimpimageeditor.h"
#include "widgets/gimpitemtreeview.h"
......@@ -225,9 +226,9 @@ action_data_get_gimp (gpointer data)
else if (GIMP_IS_DISPLAY_SHELL (data))
return ((GimpDisplayShell *) data)->gdisp->gimage->gimp;
else if (GIMP_IS_ITEM_TREE_VIEW (data))
return ((GimpItemTreeView *) data)->gimage->gimp;
return ((GimpItemTreeView *) data)->context->gimp;
else if (GIMP_IS_IMAGE_EDITOR (data))
return ((GimpImageEditor *) data)->gimage->gimp;
return ((GimpImageEditor *) data)->context->gimp;
else if (GIMP_IS_GIMP (data))
return data;
else if (GIMP_IS_DOCK (data))
......@@ -246,10 +247,14 @@ action_data_get_context (gpointer data)
return gimp_get_user_context (((GimpDisplay *) data)->gimage->gimp);
else if (GIMP_IS_DISPLAY_SHELL (data))
return gimp_get_user_context (((GimpDisplayShell *) data)->gdisp->gimage->gimp);
else if (GIMP_IS_ITEM_TREE_VIEW (data))
return ((GimpItemTreeView *) data)->context;
else if (GIMP_IS_CONTAINER_VIEW (data))
return gimp_container_view_get_context ((GimpContainerView *) data);
else if (GIMP_IS_CONTAINER_EDITOR (data))
return gimp_container_view_get_context (((GimpContainerEditor *) data)->view);
else if (GIMP_IS_IMAGE_EDITOR (data))
return ((GimpImageEditor *) data)->context;
else if (GIMP_IS_DOCK (data))
return ((GimpDock *) data)->context;
......
......@@ -132,21 +132,18 @@ channels_actions_update (GimpActionGroup *group,
GList *next = NULL;
GList *prev = NULL;
if (GIMP_IS_COMPONENT_EDITOR (data))
gimage = action_data_get_image (data);
if (gimage)
{
gimage = GIMP_IMAGE_EDITOR (data)->gimage;
fs = (gimp_image_floating_sel (gimage) != NULL);
if (gimage)
if (GIMP_IS_COMPONENT_EDITOR (data))
{
if (GIMP_COMPONENT_EDITOR (data)->clicked_component != -1)
component = TRUE;
}
}
else
{
gimage = action_data_get_image (data);
if (gimage)
else
{
GList *list;
......@@ -166,9 +163,6 @@ channels_actions_update (GimpActionGroup *group,
}
}
if (gimage)
fs = (gimp_image_floating_sel (gimage) != NULL);
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
......
......@@ -24,6 +24,7 @@
#include "actions-types.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpactiongroup.h"
......@@ -79,11 +80,15 @@ void
colormap_editor_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
gboolean indexed = FALSE;
gint num_colors = 0;
GimpImage *gimage;
GimpContext *context;
gboolean indexed = FALSE;
gint num_colors = 0;
GimpRGB fg;
GimpRGB bg;
gimage = action_data_get_image (data);
gimage = action_data_get_image (data);
context = action_data_get_context (data);
if (gimage)
{
......@@ -91,8 +96,16 @@ colormap_editor_actions_update (GimpActionGroup *group,
num_colors = gimage->num_cols;
}
if (context)
{
gimp_context_get_foreground (context, &fg);
gimp_context_get_background (context, &bg);
}
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_COLOR(action,color) \
gimp_action_group_set_action_color (group, action, color, FALSE);
SET_SENSITIVE ("colormap-editor-edit-color",
gimage && indexed);
......@@ -101,5 +114,9 @@ colormap_editor_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("colormap-editor-add-color-from-bg",
gimage && indexed && num_colors < 256);
SET_COLOR ("colormap-editor-add-color-from-fg", context ? &fg : NULL);
SET_COLOR ("colormap-editor-add-color-from-bg", context ? &bg : NULL);
#undef SET_SENSITIVE
#undef SET_COLOR
}
......@@ -24,6 +24,7 @@
#include "actions-types.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpactiongroup.h"
......@@ -79,11 +80,15 @@ void
colormap_editor_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
gboolean indexed = FALSE;
gint num_colors = 0;
GimpImage *gimage;
GimpContext *context;
gboolean indexed = FALSE;
gint num_colors = 0;
GimpRGB fg;
GimpRGB bg;
gimage = action_data_get_image (data);
gimage = action_data_get_image (data);
context = action_data_get_context (data);
if (gimage)
{
......@@ -91,8 +96,16 @@ colormap_editor_actions_update (GimpActionGroup *group,
num_colors = gimage->num_cols;
}
if (context)
{
gimp_context_get_foreground (context, &fg);
gimp_context_get_background (context, &bg);
}
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_COLOR(action,color) \
gimp_action_group_set_action_color (group, action, color, FALSE);
SET_SENSITIVE ("colormap-editor-edit-color",
gimage && indexed);
......@@ -101,5 +114,9 @@ colormap_editor_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("colormap-editor-add-color-from-bg",
gimage && indexed && num_colors < 256);
SET_COLOR ("colormap-editor-add-color-from-fg", context ? &fg : NULL);
SET_COLOR ("colormap-editor-add-color-from-bg", context ? &bg : NULL);
#undef SET_SENSITIVE
#undef SET_COLOR
}
......@@ -48,16 +48,16 @@ drawable_desaturate_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
return_if_no_drawable (gimage, active_drawable, data);
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
if (! gimp_drawable_is_rgb (active_drawable))
if (! gimp_drawable_is_rgb (drawable))
{
g_message (_("Desaturate operates only on RGB color layers."));
return;
}
gimp_drawable_desaturate (active_drawable);
gimp_drawable_desaturate (drawable);
gimp_image_flush (gimage);
}
......@@ -66,16 +66,16 @@ drawable_invert_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
return_if_no_drawable (gimage, active_drawable, data);
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
if (gimp_drawable_is_indexed (active_drawable))
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Invert does not operate on indexed layers."));
return;
}
gimp_drawable_invert (active_drawable);
gimp_drawable_invert (drawable);
gimp_image_flush (gimage);
}
......@@ -84,16 +84,16 @@ drawable_equalize_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
return_if_no_drawable (gimage, active_drawable, data);
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
if (gimp_drawable_is_indexed (active_drawable))
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Equalize does not operate on indexed layers."));
return;
}
gimp_drawable_equalize (active_drawable, TRUE);
gimp_drawable_equalize (drawable, TRUE);
gimp_image_flush (gimage);
}
......@@ -103,14 +103,15 @@ drawable_flip_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
GimpDrawable *drawable;
GimpItem *item;
GimpContext *context;
gint off_x, off_y;
gdouble axis = 0.0;
return_if_no_drawable (gimage, active_drawable, data);
return_if_no_drawable (gimage, drawable, data);
return_if_no_context (context, data);
item = GIMP_ITEM (active_drawable);
item = GIMP_ITEM (drawable);
gimp_item_offsets (item, &off_x, &off_y);
......@@ -128,8 +129,6 @@ drawable_flip_cmd_callback (GtkAction *action,
break;
}
context = gimp_get_user_context (gimage->gimp);
if (gimp_item_get_linked (item))
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Flip Layer"));
......@@ -152,22 +151,21 @@ drawable_rotate_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
GimpItem *item;
GimpDrawable *drawable;
GimpContext *context;
GimpItem *item;
gint off_x, off_y;
gdouble center_x, center_y;
return_if_no_drawable (gimage, active_drawable, data);
return_if_no_drawable (gimage, drawable, data);
return_if_no_context (context, data);
item = GIMP_ITEM (active_drawable);
item = GIMP_ITEM (drawable);
gimp_item_offsets (item, &off_x, &off_y);
center_x = ((gdouble) off_x + (gdouble) gimp_item_width (item) / 2.0);
center_y = ((gdouble) off_y + (gdouble) gimp_item_height (item) / 2.0);
context = gimp_get_user_context (gimage->gimp);
if (gimp_item_get_linked (item))
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Rotate Layer"));
......
......@@ -237,7 +237,7 @@ edit_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("edit-undo", undo_enabled && undo_name);
SET_SENSITIVE ("edit-redo", undo_enabled && redo_name);
SET_SENSITIVE ("edit-undo-clear", undo_enabled && (redo_name || redo_name));
SET_SENSITIVE ("edit-undo-clear", undo_enabled && (undo_name || redo_name));
g_free (undo_name);
g_free (redo_name);
......
......@@ -342,7 +342,7 @@ gradient_editor_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpGradientEditor *editor;
GimpContext *user_context;
GimpContext *context;
GimpGradientSegment *left_seg;
GimpGradientSegment *right_seg;
GimpRGB fg;
......@@ -354,7 +354,7 @@ gradient_editor_actions_update (GimpActionGroup *group,
editor = GIMP_GRADIENT_EDITOR (data);
user_context =
context =
gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp);
if (editor->control_sel_l->prev)
......@@ -367,8 +367,11 @@ gradient_editor_actions_update (GimpActionGroup *group,
else
right_seg = gimp_gradient_segment_get_first (editor->control_sel_r);
gimp_context_get_foreground (user_context, &fg);
gimp_context_get_background (user_context, &bg);
if (context)
{
gimp_context_get_foreground (context, &fg);
gimp_context_get_background (context, &bg);
}
{
GimpGradientSegmentType type;
......@@ -411,8 +414,9 @@ gradient_editor_actions_update (GimpActionGroup *group,
&left_seg->right_color, FALSE);
SET_COLOR ("gradient-editor-load-left-right-endpoint",
&editor->control_sel_r->right_color, FALSE);
SET_COLOR ("gradient-editor-load-left-fg", &fg, FALSE);
SET_COLOR ("gradient-editor-load-left-bg", &bg, FALSE);
SET_COLOR ("gradient-editor-load-left-fg", context ? &fg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-left-bg", context ? &bg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-left-01", &editor->saved_colors[0], TRUE);
SET_COLOR ("gradient-editor-load-left-02", &editor->saved_colors[1], TRUE);
......@@ -442,8 +446,9 @@ gradient_editor_actions_update (GimpActionGroup *group,
&right_seg->left_color, FALSE);
SET_COLOR ("gradient-editor-load-right-left-endpoint",
&editor->control_sel_l->left_color, FALSE);
SET_COLOR ("gradient-editor-load-right-fg", &fg, FALSE);
SET_COLOR ("gradient-editor-load-right-bg", &bg, FALSE);
SET_COLOR ("gradient-editor-load-right-fg", context ? &fg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-right-bg", context ? &bg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-right-01", &editor->saved_colors[0], TRUE);
SET_COLOR ("gradient-editor-load-right-02", &editor->saved_colors[1], TRUE);
......
......@@ -24,6 +24,9 @@
#include "actions-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimppaletteeditor.h"
......@@ -87,29 +90,52 @@ palette_editor_actions_setup (GimpActionGroup *group)
void
palette_editor_actions_update (GimpActionGroup *group,
gpointer data)
gpointer user_data)
{
GimpPaletteEditor *editor;
GimpDataEditor *data_editor;
GimpContext *context;
GimpData *data;
gboolean editable = FALSE;
GimpRGB fg;
GimpRGB bg;
editor = GIMP_PALETTE_EDITOR (user_data);
data_editor = GIMP_DATA_EDITOR (user_data);
context = gimp_get_user_context (group->gimp);
editor = GIMP_PALETTE_EDITOR (data);
data_editor = GIMP_DATA_EDITOR (data);
data = data_editor->data;
if (data_editor->data && data_editor->data_editable)
editable = TRUE;
if (data)
{
if (data_editor->data_editable)
editable = TRUE;
}
if (context)
{
gimp_context_get_foreground (context, &fg);
gimp_context_get_background (context, &bg);
}
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_COLOR(action,color) \
gimp_action_group_set_action_color (group, action, color, FALSE);
SET_SENSITIVE ("palette-editor-edit-color", editable && editor->color);
SET_SENSITIVE ("palette-editor-new-color-fg", editable);
SET_SENSITIVE ("palette-editor-new-color-bg", editable);
SET_SENSITIVE ("palette-editor-delete-color", editable && editor->color);
SET_SENSITIVE ("palette-editor-zoom-out", data_editor->data);
SET_SENSITIVE ("palette-editor-zoom-in", data_editor->data);
SET_SENSITIVE ("palette-editor-zoom-all", data_editor->data);
SET_SENSITIVE ("palette-editor-zoom-out", data);
SET_SENSITIVE ("palette-editor-zoom-in", data);
SET_SENSITIVE ("palette-editor-zoom-all", data);
SET_COLOR ("palette-editor-new-color-fg", context ? &fg : NULL);
SET_COLOR ("palette-editor-new-color-bg", context ? &bg : NULL);
#undef SET_SENSITIVE
#undef SET_COLOR
}
......@@ -282,36 +282,22 @@ select_stroke_cmd_callback (GtkAction *action,
GimpImage *gimage;
GimpDrawable *drawable;
GtkWidget *widget;
return_if_no_drawable (gimage, drawable, data);
return_if_no_widget (widget, data);
select_stroke (GIMP_ITEM (gimp_image_get_mask (gimage)), widget);
}
void
select_stroke (GimpItem *item,
GtkWidget *parent)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
GtkWidget *dialog;
return_if_no_image (gimage, data);
return_if_no_widget (widget, data);
g_return_if_fail (GIMP_IS_ITEM (item));
g_return_if_fail (GTK_IS_WIDGET (parent));
gimage = gimp_item_get_image (item);
active_drawable = gimp_image_active_drawable (gimage);
drawable = gimp_image_active_drawable (gimage);
if (! active_drawable)
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
return;
}
dialog = stroke_dialog_new (item, GIMP_STOCK_SELECTION_STROKE,
dialog = stroke_dialog_new (GIMP_ITEM (gimp_image_get_mask (gimage)),
GIMP_STOCK_SELECTION_STROKE,
GIMP_HELP_SELECTION_STROKE,
parent);
widget);
gtk_widget_show (dialog);
}
......
......@@ -45,8 +45,5 @@ void select_save_cmd_callback (GtkAction *action,
void select_stroke_cmd_callback (GtkAction *action,
gpointer data);
void select_stroke (GimpItem *item,
GtkWidget *parent);
#endif /* __SELECT_COMMANDS_H__ */
......@@ -181,6 +181,7 @@ vectors_actions_update (GimpActionGroup *group,
{
GimpImage *gimage;
GimpVectors *vectors = NULL;
gint n_vectors = 0;
gboolean mask_empty = TRUE;
gboolean global_buf = FALSE;
GList *next = NULL;
......@@ -194,6 +195,8 @@ vectors_actions_update (GimpActionGroup *group,
vectors = gimp_image_get_active_vectors (gimage);
n_vectors = gimp_container_num_children (gimage->vectors);
mask_empty = gimp_channel_is_empty (gimp_image_get_mask (gimage));
global_buf = FALSE;
......@@ -217,9 +220,10 @@ vectors_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("vectors-path-tool", vectors);
SET_SENSITIVE ("vectors-edit-attributes", vectors);
SET_SENSITIVE ("vectors-new", gimage);
SET_SENSITIVE ("vectors-duplicate", vectors);
SET_SENSITIVE ("vectors-delete", vectors);
SET_SENSITIVE ("vectors-new", gimage);
SET_SENSITIVE ("vectors-duplicate", vectors);
SET_SENSITIVE ("vectors-delete", vectors);
SET_SENSITIVE ("vectors-merge-visible", n_vectors > 1);
SET_SENSITIVE ("vectors-raise", vectors && prev);
SET_SENSITIVE ("vectors-raise-to-top", vectors && prev);
......
......@@ -197,23 +197,69 @@ vectors_selection_to_vectors_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpImage *gimage;
GimpImage *gimage;
ProcRecord *proc_rec;
Argument *args;
GimpDisplay *gdisp;
return_if_no_image (gimage, data);
vectors_selection_to_vectors (gimage, value);
if (value)
proc_rec = procedural_db_lookup (gimage->gimp,
"plug_in_sel2path_advanced");
else
proc_rec = procedural_db_lookup (gimage->gimp,
"plug_in_sel2path");
if (! proc_rec)
{
g_message ("Selection to path procedure lookup failed.");
return;
}
gdisp = gimp_context_get_display (gimp_get_user_context (gimage->gimp));
/* plug-in arguments as if called by <Image>/Filters/... */
args = g_new (Argument, 3);
args[0].arg_type = GIMP_PDB_INT32;
args[0].value.pdb_int = GIMP_RUN_INTERACTIVE;
args[1].arg_type = GIMP_PDB_IMAGE;
args[1].value.pdb_int = (gint32) gimp_image_get_ID (gimage);
args[2].arg_type = GIMP_PDB_DRAWABLE;
args[2].value.pdb_int = -1; /* unused */
plug_in_run (gimage->gimp, gimp_get_user_context (gimage->gimp),
proc_rec, args, 3, FALSE, TRUE,
gdisp ? gdisp->ID : 0);
g_free (args);
}
void
vectors_stroke_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
GtkWidget *widget;
return_if_no_vectors (gimage, active_vectors, data);
GimpImage *gimage;
GimpVectors *vectors;
GimpDrawable *drawable;
GtkWidget *widget;
GtkWidget *dialog;
return_if_no_vectors (gimage, vectors, data);
return_if_no_widget (widget, data);
vectors_stroke_vectors (GIMP_ITEM (active_vectors), widget);
drawable = gimp_image_active_drawable (gimage);
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
return;
}
dialog = stroke_dialog_new (GIMP_ITEM (vectors),
GIMP_STOCK_PATH_STROKE,
GIMP_HELP_PATH_STROKE,
widget);
gtk_widget_show (dialog);
}
void
......@@ -290,74 +336,6 @@ vectors_edit_attributes_cmd_callback (GtkAction *action,
vectors_edit_vectors_query (active_vectors, widget);
}
void
vectors_stroke_vectors (GimpItem *item,
GtkWidget *parent)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
GtkWidget *dialog;
g_return_if_fail (GIMP_IS_ITEM (item));
gimage = gimp_item_get_image (item);
active_drawable = gimp_image_active_drawable (gimage);
if (! active_drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
return;
}
dialog = stroke_dialog_new (item, GIMP_STOCK_PATH_STROKE,
GIMP_HELP_PATH_STROKE,
parent);
gtk_widget_show (dialog);
}
void
vectors_selection_to_vectors (GimpImage *gimage,
gboolean advanced)
{
ProcRecord *proc_rec;
Argument *args;
GimpDisplay *gdisp;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
if (advanced)
proc_rec = procedural_db_lookup (gimage->gimp,
"plug_in_sel2path_advanced");
else
proc_rec = procedural_db_lookup (gimage->gimp,
"plug_in_sel2path");
if (! proc_rec)
{
g_message ("Selection to path procedure lookup failed.");
return;