plug-ins/sel2path/sel2path.c app/paths_dialog.c app/paths_cmds.c

Tue Jul 13 22:48:37 BST 1999 Andy Thomas <alt@gimp.org>

	* plug-ins/sel2path/sel2path.c
	* app/paths_dialog.c
	* app/paths_cmds.c
	* tools/pdbgen/pdb/paths.pdb

	Selection is now cleared when converted to a path.
	Path is made the current one when created via the PDB.
	This made more sense than the previous behavior.
This commit is contained in:
BST 1999 Andy Thomas 1999-07-13 21:55:39 +00:00 committed by Andy Thomas
parent dcda2e1a2d
commit 48627bc821
6 changed files with 73 additions and 24 deletions

View File

@ -1,3 +1,14 @@
Tue Jul 13 22:48:37 BST 1999 Andy Thomas <alt@gimp.org>
* plug-ins/sel2path/sel2path.c
* app/paths_dialog.c
* app/paths_cmds.c
* tools/pdbgen/pdb/paths.pdb
Selection is now cleared when converted to a path.
Path is made the current one when created via the PDB.
This made more sense than the previous behavior.
Tue Jul 13 15:47:20 CEST 1999 Marc Lehmann <pcg@goof.com>
* gimptool.in, gimptool.1: implement --uninstall* options.

View File

@ -2726,6 +2726,7 @@ paths_set_path_points(GimpImage * gimage,
PathsList *plist = gimp_image_get_paths(gimage);
GSList *pts_list = NULL;
PATHP bzpath;
BezierSelect *bezier_sel;
gint pcount = 0;
gint this_path_count = 0;
gchar *suniq;
@ -2830,10 +2831,10 @@ paths_set_path_points(GimpImage * gimage,
}
}
bezier_sel = path_to_beziersel(bzpath);
if(paths_dialog)
{
gint tmprow;
BezierSelect *bezier_sel;
paths_dialog->current_path_list =
path_add_to_current(paths_dialog->current_path_list,
@ -2844,13 +2845,8 @@ paths_set_path_points(GimpImage * gimage,
paths_add_path(bzpath,0);
/* Update the preview */
bezier_sel = path_to_beziersel(bzpath);
tmprow = paths_dialog->current_path_list->last_selected_row;
paths_dialog->current_path_list->last_selected_row = 0;
paths_update_preview(bezier_sel);
beziersel_free(bezier_sel);
paths_dialog->current_path_list->last_selected_row = tmprow;
paths_dialog->selected_row_num = tmprow;
gtk_clist_select_row(GTK_CLIST(paths_dialog->paths_list),
paths_dialog->current_path_list->last_selected_row,
@ -2869,10 +2865,20 @@ paths_set_path_points(GimpImage * gimage,
}
else
{
GDisplay *gdisp;
/* This is a little HACK.. we need to find a display
* to put the path image on.
*/
gdisp = gdisplays_check_valid(NULL,gimage);
/* Mark this path as selected */
plist->last_selected_row = 0;
bezier_paste_bezierselect_to_current(gdisp,bezier_sel);
}
beziersel_free(bezier_sel);
return TRUE;
}

View File

@ -443,7 +443,7 @@ static ProcArg path_set_points_inargs[] =
{
PDB_STRING,
"pathname",
"The name of the path to create (if it exists then a unique name will be created - query the list of paths if you want to make sure that the name of the path you create is unique. This will not be set as the current path. You will have to do a gimp_set_current_path after creating the path to make it current."
"The name of the path to create (if it exists then a unique name will be created - query the list of paths if you want to make sure that the name of the path you create is unique. This will be set as the current path."
},
{
PDB_INT32,

View File

@ -2726,6 +2726,7 @@ paths_set_path_points(GimpImage * gimage,
PathsList *plist = gimp_image_get_paths(gimage);
GSList *pts_list = NULL;
PATHP bzpath;
BezierSelect *bezier_sel;
gint pcount = 0;
gint this_path_count = 0;
gchar *suniq;
@ -2830,10 +2831,10 @@ paths_set_path_points(GimpImage * gimage,
}
}
bezier_sel = path_to_beziersel(bzpath);
if(paths_dialog)
{
gint tmprow;
BezierSelect *bezier_sel;
paths_dialog->current_path_list =
path_add_to_current(paths_dialog->current_path_list,
@ -2844,13 +2845,8 @@ paths_set_path_points(GimpImage * gimage,
paths_add_path(bzpath,0);
/* Update the preview */
bezier_sel = path_to_beziersel(bzpath);
tmprow = paths_dialog->current_path_list->last_selected_row;
paths_dialog->current_path_list->last_selected_row = 0;
paths_update_preview(bezier_sel);
beziersel_free(bezier_sel);
paths_dialog->current_path_list->last_selected_row = tmprow;
paths_dialog->selected_row_num = tmprow;
gtk_clist_select_row(GTK_CLIST(paths_dialog->paths_list),
paths_dialog->current_path_list->last_selected_row,
@ -2869,10 +2865,20 @@ paths_set_path_points(GimpImage * gimage,
}
else
{
GDisplay *gdisp;
/* This is a little HACK.. we need to find a display
* to put the path image on.
*/
gdisp = gdisplays_check_valid(NULL,gimage);
/* Mark this path as selected */
plist->last_selected_row = 0;
bezier_paste_bezierselect_to_current(gdisp,bezier_sel);
}
beziersel_free(bezier_sel);
return TRUE;
}

View File

@ -63,9 +63,10 @@ static void sel2path_reset_callback (GtkWidget *,gpointer);
static void dialog_print_selVals(SELVALS *);
gboolean do_sel2path (gint32,gint32);
gint gimp_selection_bounds (gint32,gint *,gint *,gint *,gint *,gint *);
gint gimp_selection_is_empty (gint32);
gint gimp_path_set_points (gint32,gchar *,gint,gint,gdouble *);
static gint gimp_selection_bounds (gint32,gint *,gint *,gint *,gint *,gint *);
static gint gimp_selection_is_empty (gint32);
static gint gimp_selection_none (gint32);
static gint gimp_path_set_points (gint32,gchar *,gint,gint,gdouble *);
GPlugInInfo PLUG_IN_INFO =
@ -598,12 +599,16 @@ do_sel2path(gint32 drawable_ID,gint32 image_ID )
splines = fitted_splines (olt);
gimp_selection_none(image_ID);
gimp_displays_flush();
do_points(splines,image_ID);
return TRUE;
}
gint
static gint
gimp_selection_bounds (gint32 image_ID,
gint *has_sel,
gint *x1,
@ -636,7 +641,7 @@ gimp_selection_bounds (gint32 image_ID,
return result;
}
gint
static gint
gimp_path_set_points (gint32 image_ID,
gchar *name,
gint ptype,
@ -676,7 +681,7 @@ gimp_path_set_points (gint32 image_ID,
return result;
}
gint
static gint
gimp_selection_is_empty (gint32 image_ID)
{
GParam *return_vals;
@ -699,6 +704,29 @@ gimp_selection_is_empty (gint32 image_ID)
return result;
}
static gint
gimp_selection_none (gint32 image_ID)
{
GParam *return_vals;
gint nreturn_vals;
gint result;
return_vals = gimp_run_procedure ("gimp_selection_none",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_END);
result = FALSE;
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
result = return_vals[1].data.d_int32;
}
gimp_destroy_params (return_vals, nreturn_vals);
return result;
}
void
safe_free (address *item)
{

View File

@ -234,9 +234,7 @@ HELP
desc => 'The name of the path to create (if it exists then a unique
name will be created - query the list of paths if you want
to make sure that the name of the path you create is
unique. This will not be set as the
current path. You will have to do a gimp_set_current_path
after creating the path to make it current.',
unique. This will be set as the current path.',
alias => 'pname', init => 1 },
{ name => 'ptype', type => 'int32',
desc => 'The type of the path. Currently only one type (1 = Bezier)