mirror of https://github.com/GNOME/gimp.git
Fixed some selection editor problems (bug #127644):
2003-11-22 Sven Neumann <sven@gimp.org> Fixed some selection editor problems (bug #127644): * plug-ins/sel2path/sel2path.c: use the given image_ID, ignore the drawable_ID. This plug-in doesn't operate on a drawable at all. * plug-ins/imagemap/imap_main.c: pass a valid image_ID to sel2path. * app/gui/vectors-commands.c: don't attempt to create a valid drawable_ID for the call to sel2path since it isn't used anyway. * app/core/gimpdrawable-stroke.c (gimp_drawable_stroke_boundary): just return when being called with an empty boundary.
This commit is contained in:
parent
c0c1043a6d
commit
722fb64dbd
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2003-11-22 Sven Neumann <sven@gimp.org>
|
||||
|
||||
Fixed some selection editor problems (bug #127644):
|
||||
|
||||
* plug-ins/sel2path/sel2path.c: use the given image_ID, ignore the
|
||||
drawable_ID. This plug-in doesn't operate on a drawable at all.
|
||||
|
||||
* plug-ins/imagemap/imap_main.c: pass a valid image_ID to sel2path.
|
||||
|
||||
* app/gui/vectors-commands.c: don't attempt to create a valid
|
||||
drawable_ID for the call to sel2path since it isn't used anyway.
|
||||
|
||||
* app/core/gimpdrawable-stroke.c (gimp_drawable_stroke_boundary):
|
||||
just return when being called with an empty boundary.
|
||||
|
||||
2003-11-22 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpwidgets/gimpwidgets.def: added symbols for
|
||||
|
|
|
@ -302,14 +302,10 @@ vectors_selection_to_vectors (GimpImage *gimage,
|
|||
{
|
||||
ProcRecord *proc_rec;
|
||||
Argument *args;
|
||||
GimpDrawable *drawable;
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
|
||||
drawable = gimp_image_active_drawable (gimage);
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (gimage->gimp));
|
||||
|
||||
if (advanced)
|
||||
proc_rec = procedural_db_lookup (gimage->gimp,
|
||||
"plug_in_sel2path_advanced");
|
||||
|
@ -323,6 +319,8 @@ vectors_selection_to_vectors (GimpImage *gimage,
|
|||
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);
|
||||
|
||||
|
@ -331,7 +329,7 @@ vectors_selection_to_vectors (GimpImage *gimage,
|
|||
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 = (gint32) gimp_item_get_ID (GIMP_ITEM (drawable));
|
||||
args[2].value.pdb_int = -1; /* unused */
|
||||
|
||||
plug_in_run (gimage->gimp,
|
||||
proc_rec, args, 3, FALSE, TRUE,
|
||||
|
|
|
@ -78,8 +78,11 @@ gimp_drawable_stroke_boundary (GimpDrawable *drawable,
|
|||
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (GIMP_IS_STROKE_OPTIONS (options));
|
||||
|
||||
if (n_bound_segs == 0)
|
||||
return;
|
||||
|
||||
g_return_if_fail (bound_segs != NULL);
|
||||
g_return_if_fail (n_bound_segs > 0);
|
||||
|
||||
sorted_segs = sort_boundary (bound_segs, n_bound_segs, &n_stroke_segs);
|
||||
stroke_segs = simplify_boundary (sorted_segs, n_stroke_segs, &n_bound_segs);
|
||||
|
|
|
@ -302,14 +302,10 @@ vectors_selection_to_vectors (GimpImage *gimage,
|
|||
{
|
||||
ProcRecord *proc_rec;
|
||||
Argument *args;
|
||||
GimpDrawable *drawable;
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
|
||||
drawable = gimp_image_active_drawable (gimage);
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (gimage->gimp));
|
||||
|
||||
if (advanced)
|
||||
proc_rec = procedural_db_lookup (gimage->gimp,
|
||||
"plug_in_sel2path_advanced");
|
||||
|
@ -323,6 +319,8 @@ vectors_selection_to_vectors (GimpImage *gimage,
|
|||
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);
|
||||
|
||||
|
@ -331,7 +329,7 @@ vectors_selection_to_vectors (GimpImage *gimage,
|
|||
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 = (gint32) gimp_item_get_ID (GIMP_ITEM (drawable));
|
||||
args[2].value.pdb_int = -1; /* unused */
|
||||
|
||||
plug_in_run (gimage->gimp,
|
||||
proc_rec, args, 3, FALSE, TRUE,
|
||||
|
|
|
@ -416,13 +416,14 @@ set_arrow_func(void)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
fuzzy_select_on_button_press(GtkWidget *widget, GdkEventButton *event,
|
||||
fuzzy_select_on_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
gpointer data)
|
||||
{
|
||||
if (event->button == 1) {
|
||||
gdouble rx = get_real_coord((gint) event->x);
|
||||
gdouble ry = get_real_coord((gint) event->y);
|
||||
gint32 image_ID = gimp_drawable_image(_drawable->drawable_id);
|
||||
gint32 image_ID = gimp_drawable_image (_drawable->drawable_id);
|
||||
gint32 channel_ID;
|
||||
|
||||
/* Save the old selection first */
|
||||
|
@ -435,14 +436,15 @@ fuzzy_select_on_button_press(GtkWidget *widget, GdkEventButton *event,
|
|||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
return_vals = gimp_run_procedure("plug_in_sel2path",
|
||||
return_vals = gimp_run_procedure ("plug_in_sel2path",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_INT32, TRUE,
|
||||
GIMP_PDB_IMAGE, 0,
|
||||
GIMP_PDB_DRAWABLE,
|
||||
_drawable->drawable_id,
|
||||
GIMP_PDB_IMAGE, image_ID,
|
||||
GIMP_PDB_DRAWABLE, -1,
|
||||
GIMP_PDB_END);
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) {
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
gdouble distance;
|
||||
gchar *path_name = gimp_path_get_current(image_ID);
|
||||
Object_t *object = create_polygon(NULL);
|
||||
|
|
|
@ -67,8 +67,7 @@ static void sel2path_response (GtkWidget *widget,
|
|||
gint response_id,
|
||||
gpointer data);
|
||||
static void dialog_print_selVals (SELVALS *sels);
|
||||
gboolean do_sel2path (gint32 drawable_ID,
|
||||
gint32 image_ID);
|
||||
gboolean do_sel2path (gint32 image_ID);
|
||||
|
||||
|
||||
GimpPlugInInfo PLUG_IN_INFO =
|
||||
|
@ -93,15 +92,15 @@ query (void)
|
|||
static GimpParamDef args[] =
|
||||
{
|
||||
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
||||
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
|
||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
|
||||
{ GIMP_PDB_IMAGE, "image", "Input image" },
|
||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable (unused)" },
|
||||
};
|
||||
|
||||
static GimpParamDef advanced_args[] =
|
||||
{
|
||||
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
||||
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
|
||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
|
||||
{ GIMP_PDB_IMAGE, "image", "Input image" },
|
||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable (unused)" },
|
||||
{ GIMP_PDB_FLOAT, "align_threshold", "align_threshold"},
|
||||
{ GIMP_PDB_FLOAT, "corner_always_threshold", "corner_always_threshold"},
|
||||
{ GIMP_PDB_INT8, "corner_surround", "corner_surround"},
|
||||
|
@ -157,8 +156,6 @@ run (const gchar *name,
|
|||
GimpParam **return_vals)
|
||||
{
|
||||
static GimpParam values[1];
|
||||
GimpDrawable *drawable;
|
||||
gint32 drawable_ID;
|
||||
gint32 image_ID;
|
||||
GimpRunMode run_mode;
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
|
@ -176,19 +173,20 @@ run (const gchar *name,
|
|||
values[0].type = GIMP_PDB_STATUS;
|
||||
values[0].data.d_status = status;
|
||||
|
||||
drawable_ID = param[2].data.d_drawable;
|
||||
drawable = gimp_drawable_get (drawable_ID);
|
||||
|
||||
image_ID = gimp_drawable_image_id (drawable_ID);
|
||||
image_ID = param[1].data.d_image;
|
||||
if (image_ID < 0)
|
||||
{
|
||||
g_warning ("plug_in_sel2path needs a valid image ID");
|
||||
return;
|
||||
}
|
||||
|
||||
if (gimp_selection_is_empty (image_ID))
|
||||
{
|
||||
g_message (_("No selection to convert"));
|
||||
gimp_drawable_detach (drawable);
|
||||
return;
|
||||
}
|
||||
|
||||
fit_set_default_params(&selVals);
|
||||
fit_set_default_params (&selVals);
|
||||
|
||||
if (!no_dialog)
|
||||
{
|
||||
|
@ -201,10 +199,8 @@ run (const gchar *name,
|
|||
}
|
||||
|
||||
if (!sel2path_dialog (&selVals))
|
||||
{
|
||||
gimp_drawable_detach (drawable);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the current settings */
|
||||
fit_set_params (&selVals);
|
||||
break;
|
||||
|
@ -254,7 +250,7 @@ run (const gchar *name,
|
|||
}
|
||||
}
|
||||
|
||||
do_sel2path (drawable_ID,image_ID);
|
||||
do_sel2path (image_ID);
|
||||
values[0].data.d_status = status;
|
||||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
|
@ -263,8 +259,6 @@ run (const gchar *name,
|
|||
if (run_mode == GIMP_RUN_INTERACTIVE && !no_dialog)
|
||||
gimp_set_data ("plug_in_sel2path_advanced", &selVals, sizeof(SELVALS));
|
||||
}
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -531,8 +525,7 @@ do_points (spline_list_array_type in_splines,
|
|||
|
||||
|
||||
gboolean
|
||||
do_sel2path (gint32 drawable_ID,
|
||||
gint32 image_ID)
|
||||
do_sel2path (gint32 image_ID)
|
||||
{
|
||||
gint32 selection_ID;
|
||||
GimpDrawable *sel_drawable;
|
||||
|
@ -547,13 +540,10 @@ do_sel2path (gint32 drawable_ID,
|
|||
|
||||
/* Now get the selection channel */
|
||||
|
||||
selection_ID = gimp_image_get_selection(image_ID);
|
||||
selection_ID = gimp_image_get_selection (image_ID);
|
||||
|
||||
if (selection_ID < 0)
|
||||
{
|
||||
g_warning ("gimp_image_get_selection failed");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
sel_drawable = gimp_drawable_get (selection_ID);
|
||||
|
||||
|
@ -576,6 +566,8 @@ do_sel2path (gint32 drawable_ID,
|
|||
|
||||
do_points (splines, image_ID);
|
||||
|
||||
gimp_drawable_detach (sel_drawable);
|
||||
|
||||
gimp_displays_flush ();
|
||||
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in New Issue