libgimp/gimp_pdb.h libgimp/gimpmisc_pdb.[ch] added missing autogenerated

2000-06-08  Sven Neumann  <sven@gimp.org>

	* libgimp/Makefile.am:
	* libgimp/gimp_pdb.h
	* libgimp/gimpmisc_pdb.[ch]
	* libgimp/gimppaths_pdb.[ch]: added missing autogenerated
	files that define PDB wrappers

	* tools/pdbgen/pdb/misc.pdb
	* tools/pdbgen/pdb/paths.pdb: made them generate libgimp code

	* plug-ins/sel2path/sel2path.c
	* plug-ins/sel2path/sel2path_adv_dialog.c: code cleanup, nicer
	dialog layout, use new PDB wrappers
This commit is contained in:
Sven Neumann 2000-06-08 18:10:03 +00:00 committed by Sven Neumann
parent 81dcf82a8f
commit 78cfe78aaa
11 changed files with 987 additions and 736 deletions

View file

@ -1,3 +1,18 @@
2000-06-08 Sven Neumann <sven@gimp.org>
* libgimp/Makefile.am:
* libgimp/gimp_pdb.h
* libgimp/gimpmisc_pdb.[ch]
* libgimp/gimppaths_pdb.[ch]: added missing autogenerated
files that define PDB wrappers
* tools/pdbgen/pdb/misc.pdb
* tools/pdbgen/pdb/paths.pdb: made them generate libgimp code
* plug-ins/sel2path/sel2path.c
* plug-ins/sel2path/sel2path_adv_dialog.c: code cleanup, nicer
dialog layout, use new PDB wrappers
Thu Jun 8 15:45:40 CEST 2000 Marc Lehmann <pcg@goof.com>
* plug-ins/common/gif.c: gimp-comment's were wrongly assumed to be

View file

@ -44,8 +44,10 @@ PDB_WRAPPERS_C = \
gimpimage_pdb.c \
gimplayer_pdb.c \
gimpmessage_pdb.c \
gimpmisc_pdb.c \
gimppalette_pdb.c \
gimpparasite_pdb.c \
gimppaths_pdb.c \
gimppatterns_pdb.c \
gimppatternselect_pdb.c \
gimpplugin_pdb.c \
@ -77,8 +79,10 @@ PDB_WRAPPERS_H = \
gimpimage_pdb.h \
gimplayer_pdb.h \
gimpmessage_pdb.h \
gimpmisc_pdb.h \
gimppalette_pdb.h \
gimpparasite_pdb.h \
gimppaths_pdb.h \
gimppatterns_pdb.h \
gimppatternselect_pdb.h \
gimpplugin_pdb.h \

View file

@ -41,8 +41,10 @@
#include <libgimp/gimpimage_pdb.h>
#include <libgimp/gimplayer_pdb.h>
#include <libgimp/gimpmessage_pdb.h>
#include <libgimp/gimpmisc_pdb.h>
#include <libgimp/gimppalette_pdb.h>
#include <libgimp/gimpparasite_pdb.h>
#include <libgimp/gimppaths_pdb.h>
#include <libgimp/gimppatterns_pdb.h>
#include <libgimp/gimppatternselect_pdb.h>
#include <libgimp/gimpproceduraldb_pdb.h>

43
libgimp/gimpmisc_pdb.c Normal file
View file

@ -0,0 +1,43 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpmisc_pdb.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl */
#include "gimp.h"
gchar *
gimp_version (void)
{
GParam *return_vals;
gint nreturn_vals;
gchar *version = NULL;
return_vals = gimp_run_procedure ("gimp_version",
&nreturn_vals,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
version = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return version;
}

41
libgimp/gimpmisc_pdb.h Normal file
View file

@ -0,0 +1,41 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpmisc_pdb.h
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl */
#ifndef __GIMP_MISC_PDB_H__
#define __GIMP_MISC_PDB_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* For information look into the C source or the html documentation */
gchar* gimp_version (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GIMP_MISC_PDB_H__ */

305
libgimp/gimppaths_pdb.c Normal file
View file

@ -0,0 +1,305 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimppaths_pdb.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl */
#include "gimp.h"
gchar **
gimp_path_list (gint32 image_ID,
gint *num_paths)
{
GParam *return_vals;
gint nreturn_vals;
gchar **path_list = NULL;
gint i;
return_vals = gimp_run_procedure ("gimp_path_list",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_END);
*num_paths = 0;
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
*num_paths = return_vals[1].data.d_int32;
path_list = g_new (gchar *, *num_paths);
for (i = 0; i < *num_paths; i++)
path_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
}
gimp_destroy_params (return_vals, nreturn_vals);
return path_list;
}
gint
gimp_path_get_points (gint32 image_ID,
gchar *pathname,
gint *num_path_point_details,
gint *path_closed,
gdouble **points_pairs)
{
GParam *return_vals;
gint nreturn_vals;
gint path_type = 0;
return_vals = gimp_run_procedure ("gimp_path_get_points",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_STRING, pathname,
PARAM_END);
*num_path_point_details = 0;
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
path_type = return_vals[1].data.d_int32;
*path_closed = return_vals[2].data.d_int32;
*num_path_point_details = return_vals[3].data.d_int32;
*points_pairs = g_new (gdouble, *num_path_point_details);
memcpy (*points_pairs, return_vals[4].data.d_floatarray,
*num_path_point_details * sizeof (gdouble));
}
gimp_destroy_params (return_vals, nreturn_vals);
return path_type;
}
gchar *
gimp_path_get_current (gint32 image_ID)
{
GParam *return_vals;
gint nreturn_vals;
gchar *current_path_name = NULL;
return_vals = gimp_run_procedure ("gimp_path_get_current",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
current_path_name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return current_path_name;
}
void
gimp_path_set_current (gint32 image_ID,
gchar *set_current_path_name)
{
GParam *return_vals;
gint nreturn_vals;
return_vals = gimp_run_procedure ("gimp_path_set_current",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_STRING, set_current_path_name,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
void
gimp_path_set_points (gint32 image_ID,
gchar *pathname,
gint ptype,
gint num_path_points,
gdouble *points_pairs)
{
GParam *return_vals;
gint nreturn_vals;
return_vals = gimp_run_procedure ("gimp_path_set_points",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_STRING, pathname,
PARAM_INT32, ptype,
PARAM_INT32, num_path_points,
PARAM_FLOATARRAY, points_pairs,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
void
gimp_path_stroke_current (gint32 image_ID)
{
GParam *return_vals;
gint nreturn_vals;
return_vals = gimp_run_procedure ("gimp_path_stroke_current",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
gint
gimp_path_get_point_at_dist (gint32 image_ID,
gdouble distance,
gint *y_point,
gdouble *gradient)
{
GParam *return_vals;
gint nreturn_vals;
gint x_point = 0;
return_vals = gimp_run_procedure ("gimp_path_get_point_at_dist",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_FLOAT, distance,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
x_point = return_vals[1].data.d_int32;
*y_point = return_vals[2].data.d_int32;
*gradient = return_vals[3].data.d_float;
}
gimp_destroy_params (return_vals, nreturn_vals);
return x_point;
}
gint
gimp_path_get_tattoo (gint32 image_ID,
gchar *pathname)
{
GParam *return_vals;
gint nreturn_vals;
gint tattoo = 0;
return_vals = gimp_run_procedure ("gimp_path_get_tattoo",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_STRING, pathname,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
tattoo = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return tattoo;
}
gchar *
gimp_get_path_by_tattoo (gint32 image_ID,
gint tattoo)
{
GParam *return_vals;
gint nreturn_vals;
gchar *path_name = NULL;
return_vals = gimp_run_procedure ("gimp_get_path_by_tattoo",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_INT32, tattoo,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
path_name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return path_name;
}
void
gimp_path_delete (gint32 image_ID,
gchar *path_name_to_del)
{
GParam *return_vals;
gint nreturn_vals;
return_vals = gimp_run_procedure ("gimp_path_delete",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_STRING, path_name_to_del,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
gint
gimp_path_get_locked (gint32 image_ID,
gchar *pathname)
{
GParam *return_vals;
gint nreturn_vals;
gint lockstatus = 0;
return_vals = gimp_run_procedure ("gimp_path_get_locked",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_STRING, pathname,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
lockstatus = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return lockstatus;
}
void
gimp_path_set_locked (gint32 image_ID,
gchar *pathname,
gint lockstatus)
{
GParam *return_vals;
gint nreturn_vals;
return_vals = gimp_run_procedure ("gimp_path_set_locked",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_STRING, pathname,
PARAM_INT32, lockstatus,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
void
gimp_path_set_tattoo (gint32 image_ID,
gchar *pathname,
gint tattovalue)
{
GParam *return_vals;
gint nreturn_vals;
return_vals = gimp_run_procedure ("gimp_path_set_tattoo",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_STRING, pathname,
PARAM_INT32, tattovalue,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}

74
libgimp/gimppaths_pdb.h Normal file
View file

@ -0,0 +1,74 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimppaths_pdb.h
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl */
#ifndef __GIMP_PATHS_PDB_H__
#define __GIMP_PATHS_PDB_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* For information look into the C source or the html documentation */
gchar** gimp_path_list (gint32 image_ID,
gint *num_paths);
gint gimp_path_get_points (gint32 image_ID,
gchar *pathname,
gint *num_path_point_details,
gint *path_closed,
gdouble **points_pairs);
gchar* gimp_path_get_current (gint32 image_ID);
void gimp_path_set_current (gint32 image_ID,
gchar *set_current_path_name);
void gimp_path_set_points (gint32 image_ID,
gchar *pathname,
gint ptype,
gint num_path_points,
gdouble *points_pairs);
void gimp_path_stroke_current (gint32 image_ID);
gint gimp_path_get_point_at_dist (gint32 image_ID,
gdouble distance,
gint *y_point,
gdouble *gradient);
gint gimp_path_get_tattoo (gint32 image_ID,
gchar *pathname);
gchar* gimp_get_path_by_tattoo (gint32 image_ID,
gint tattoo);
void gimp_path_delete (gint32 image_ID,
gchar *path_name_to_del);
gint gimp_path_get_locked (gint32 image_ID,
gchar *pathname);
void gimp_path_set_locked (gint32 image_ID,
gchar *pathname,
gint lockstatus);
void gimp_path_set_tattoo (gint32 image_ID,
gchar *pathname,
gint tattovalue);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GIMP_PATHS_PDB_H__ */

View file

@ -64,14 +64,16 @@ static void run (gchar *name,
gint *nreturn_vals,
GParam **return_vals);
static gint sel2path_dialog (SELVALS *);
static void sel2path_ok_callback (GtkWidget *,gpointer);
static void sel2path_close_callback (GtkWidget *,gpointer);
static void sel2path_reset_callback (GtkWidget *,gpointer);
static void dialog_print_selVals(SELVALS *);
gboolean do_sel2path (gint32,gint32);
static gint gimp_path_set_points (gint32,gchar *,gint,gint,gdouble *);
static gint sel2path_dialog (SELVALS *sels);
static void sel2path_ok_callback (GtkWidget *widget,
gpointer data);
static void sel2path_close_callback (GtkWidget *widget,
gpointer data);
static void sel2path_reset_callback (GtkWidget *widget,
gpointer data);
static void dialog_print_selVals (SELVALS *sels);
gboolean do_sel2path (gint32 drawable_ID,
gint32 image_ID);
GPlugInInfo PLUG_IN_INFO =
@ -91,33 +93,33 @@ gboolean retVal = TRUE; /* Toggle if cancle button clicked */
MAIN ()
static void
query_2()
query_2 (void)
{
static GParamDef args[] =
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image (unused)" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ PARAM_FLOAT, "align_threshold","align_threshold"},
{ PARAM_FLOAT, "corner_always_threshold","corner_always_threshold"},
{ PARAM_INT8, "corner_surround","corner_surround"},
{ PARAM_FLOAT, "corner_threshold","corner_threshold"},
{ PARAM_FLOAT, "error_threshold","error_threshold"},
{ PARAM_INT8, "filter_alternative_surround","filter_alternative_surround"},
{ PARAM_FLOAT, "filter_epsilon","filter_epsilon"},
{ PARAM_INT8, "filter_iteration_count","filter_iteration_count"},
{ PARAM_FLOAT, "filter_percent","filter_percent"},
{ PARAM_INT8, "filter_secondary_surround","filter_secondary_surround"},
{ PARAM_INT8, "filter_surround","filter_surround"},
{ PARAM_INT8, "keep_knees","{1-Yes, 0-No}"},
{ PARAM_FLOAT, "line_reversion_threshold","line_reversion_threshold"},
{ PARAM_FLOAT,"line_threshold","line_threshold"},
{ PARAM_FLOAT,"reparameterize_improvement","reparameterize_improvement"},
{ PARAM_FLOAT,"reparameterize_threshold","reparameterize_threshold"},
{ PARAM_FLOAT,"subdivide_search","subdivide_search"},
{ PARAM_INT8, "subdivide_surround","subdivide_surround"},
{ PARAM_FLOAT,"subdivide_threshold","subdivide_threshold"},
{ PARAM_INT8, "tangent_surround","tangent_surround"},
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image (unused)" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ PARAM_FLOAT, "align_threshold", "align_threshold"},
{ PARAM_FLOAT, "corner_always_threshold", "corner_always_threshold"},
{ PARAM_INT8, "corner_surround", "corner_surround"},
{ PARAM_FLOAT, "corner_threshold", "corner_threshold"},
{ PARAM_FLOAT, "error_threshold", "error_threshold"},
{ PARAM_INT8, "filter_alternative_surround", "filter_alternative_surround"},
{ PARAM_FLOAT, "filter_epsilon", "filter_epsilon"},
{ PARAM_INT8, "filter_iteration_count", "filter_iteration_count"},
{ PARAM_FLOAT, "filter_percent", "filter_percent"},
{ PARAM_INT8, "filter_secondary_surround", "filter_secondary_surround"},
{ PARAM_INT8, "filter_surround", "filter_surround"},
{ PARAM_INT8, "keep_knees", "{1-Yes, 0-No}"},
{ PARAM_FLOAT, "line_reversion_threshold", "line_reversion_threshold"},
{ PARAM_FLOAT, "line_threshold", "line_threshold"},
{ PARAM_FLOAT, "reparameterize_improvement", "reparameterize_improvement"},
{ PARAM_FLOAT, "reparameterize_threshold", "reparameterize_threshold"},
{ PARAM_FLOAT, "subdivide_search", "subdivide_search"},
{ PARAM_INT8, "subdivide_surround", "subdivide_surround"},
{ PARAM_FLOAT, "subdivide_threshold", "subdivide_threshold"},
{ PARAM_INT8, "tangent_surround", "tangent_surround"},
};
static GParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
@ -137,12 +139,12 @@ query_2()
}
static void
query ()
query (void)
{
static GParamDef args[] =
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image (unused)" },
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image (unused)" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
};
static GParamDef *return_vals = NULL;
@ -163,15 +165,15 @@ query ()
nargs, nreturn_vals,
args, return_vals);
query_2();
query_2 ();
}
static void
run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals)
run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals)
{
static GParam values[1];
GDrawable * drawable;
@ -183,10 +185,12 @@ run (gchar *name,
run_mode = param[0].data.d_int32;
if(!strcmp(name,"plug_in_sel2path")) {
no_dialog = TRUE;
INIT_I18N();
} else
if(!strcmp(name,"plug_in_sel2path"))
{
no_dialog = TRUE;
INIT_I18N();
}
else
INIT_I18N_UI();
*nreturn_vals = 1;
@ -214,57 +218,58 @@ run (gchar *name,
switch (run_mode)
{
case RUN_INTERACTIVE:
if(gimp_get_data_size("plug_in_sel2path_advanced") > 0)
if (gimp_get_data_size ("plug_in_sel2path_advanced") > 0)
{
gimp_get_data("plug_in_sel2path_advanced", &selVals);
gimp_get_data ("plug_in_sel2path_advanced", &selVals);
}
if (!sel2path_dialog(&selVals))
if (!sel2path_dialog (&selVals))
{
gimp_drawable_detach (drawable);
return;
}
/* Get the current settings */
fit_set_params(&selVals);
fit_set_params (&selVals);
break;
case RUN_NONINTERACTIVE:
if (nparams != 23)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS) {
selVals.align_threshold = param[3].data.d_float;
selVals.corner_always_threshold = param[4].data.d_float;
selVals.corner_surround = param[5].data.d_int8;
selVals.corner_threshold = param[6].data.d_float;
selVals.error_threshold = param[7].data.d_float;
selVals.filter_alternative_surround = param[8].data.d_int8;
selVals.filter_epsilon = param[9].data.d_float;
selVals.filter_iteration_count = param[10].data.d_int8;
selVals.filter_percent = param[11].data.d_float;
selVals.filter_secondary_surround = param[12].data.d_int8;
selVals.filter_surround = param[13].data.d_int8;
selVals.keep_knees = param[14].data.d_int8;
selVals.line_reversion_threshold = param[15].data.d_float;
selVals.line_threshold = param[16].data.d_float;
selVals.reparameterize_improvement = param[17].data.d_float;
selVals.reparameterize_threshold = param[18].data.d_float;
selVals.subdivide_search = param[19].data.d_float;
selVals.subdivide_surround = param[20].data.d_int8;
selVals.subdivide_threshold = param[21].data.d_float;
selVals.tangent_surround = param[22].data.d_int8;
fit_set_params(&selVals);
if (status == STATUS_SUCCESS)
{
selVals.align_threshold = param[3].data.d_float;
selVals.corner_always_threshold = param[4].data.d_float;
selVals.corner_surround = param[5].data.d_int8;
selVals.corner_threshold = param[6].data.d_float;
selVals.error_threshold = param[7].data.d_float;
selVals.filter_alternative_surround = param[8].data.d_int8;
selVals.filter_epsilon = param[9].data.d_float;
selVals.filter_iteration_count = param[10].data.d_int8;
selVals.filter_percent = param[11].data.d_float;
selVals.filter_secondary_surround = param[12].data.d_int8;
selVals.filter_surround = param[13].data.d_int8;
selVals.keep_knees = param[14].data.d_int8;
selVals.line_reversion_threshold = param[15].data.d_float;
selVals.line_threshold = param[16].data.d_float;
selVals.reparameterize_improvement = param[17].data.d_float;
selVals.reparameterize_threshold = param[18].data.d_float;
selVals.subdivide_search = param[19].data.d_float;
selVals.subdivide_surround = param[20].data.d_int8;
selVals.subdivide_threshold = param[21].data.d_float;
selVals.tangent_surround = param[22].data.d_int8;
fit_set_params(&selVals);
}
break;
case RUN_WITH_LAST_VALS:
if(gimp_get_data_size("plug_in_sel2path_advanced") > 0)
if(gimp_get_data_size ("plug_in_sel2path_advanced") > 0)
{
gimp_get_data("plug_in_sel2path_advanced", &selVals);
gimp_get_data ("plug_in_sel2path_advanced", &selVals);
/* Set up the last values */
fit_set_params(&selVals);
fit_set_params (&selVals);
}
break;
@ -274,43 +279,43 @@ run (gchar *name,
}
}
do_sel2path(drawable_ID,image_ID);
do_sel2path (drawable_ID,image_ID);
values[0].data.d_status = status;
if(status == STATUS_SUCCESS)
if (status == STATUS_SUCCESS)
{
dialog_print_selVals(&selVals);
if (run_mode == RUN_INTERACTIVE && !no_dialog)
gimp_set_data("plug_in_sel2path_advanced", &selVals, sizeof(SELVALS));
gimp_set_data ("plug_in_sel2path_advanced", &selVals, sizeof(SELVALS));
}
gimp_drawable_detach (drawable);
}
static void
dialog_print_selVals(SELVALS *sels)
dialog_print_selVals (SELVALS *sels)
{
#if 0
printf("selVals.align_threshold %g\n",selVals.align_threshold);
printf("selVals.corner_always_threshol %g\n",selVals.corner_always_threshold);
printf("selVals.corner_surround %g\n",selVals.corner_surround);
printf("selVals.corner_threshold %g\n",selVals.corner_threshold);
printf("selVals.error_threshold %g\n",selVals.error_threshold);
printf("selVals.filter_alternative_surround %g\n",selVals.filter_alternative_surround);
printf("selVals.filter_epsilon %g\n",selVals.filter_epsilon);
printf("selVals.filter_iteration_count %g\n",selVals.filter_iteration_count);
printf("selVals.filter_percent %g\n",selVals.filter_percent);
printf("selVals.filter_secondary_surround %g\n",selVals.filter_secondary_surround);
printf("selVals.filter_surround %g\n",selVals.filter_surround);
printf("selVals.keep_knees %d\n",selVals.keep_knees);
printf("selVals.line_reversion_threshold %g\n",selVals.line_reversion_threshold);
printf("selVals.line_threshold %g\n",selVals.line_threshold);
printf("selVals.reparameterize_improvement %g\n",selVals.reparameterize_improvement);
printf("selVals.reparameterize_threshold %g\n",selVals.reparameterize_threshold);
printf("selVals.subdivide_search %g\n",selVals.subdivide_search);
printf("selVals.subdivide_surround %g\n",selVals.subdivide_surround);
printf("selVals.subdivide_threshold %g\n",selVals.subdivide_threshold);
printf("selVals.tangent_surround %g\n",selVals.tangent_surround);
printf ("selVals.align_threshold %g\n", selVals.align_threshold);
printf ("selVals.corner_always_threshol %g\n", selVals.corner_always_threshold);
printf ("selVals.corner_surround %g\n", selVals.corner_surround);
printf ("selVals.corner_threshold %g\n", selVals.corner_threshold);
printf ("selVals.error_threshold %g\n", selVals.error_threshold);
printf ("selVals.filter_alternative_surround %g\n", selVals.filter_alternative_surround);
printf ("selVals.filter_epsilon %g\n", selVals.filter_epsilon);
printf ("selVals.filter_iteration_count %g\n", selVals.filter_iteration_count);
printf ("selVals.filter_percent %g\n", selVals.filter_percent);
printf ("selVals.filter_secondary_surround %g\n", selVals.filter_secondary_surround);
printf ("selVals.filter_surround %g\n", selVals.filter_surround);
printf ("selVals.keep_knees %d\n", selVals.keep_knees);
printf ("selVals.line_reversion_threshold %g\n", selVals.line_reversion_threshold);
printf ("selVals.line_threshold %g\n", selVals.line_threshold);
printf ("selVals.reparameterize_improvement %g\n", selVals.reparameterize_improvement);
printf ("selVals.reparameterize_threshold %g\n", selVals.reparameterize_threshold);
printf ("selVals.subdivide_search %g\n" selVals.subdivide_search);
printf ("selVals.subdivide_surround %g\n", selVals.subdivide_surround);
printf ("selVals.subdivide_threshold %g\n", selVals.subdivide_threshold);
printf ("selVals.tangent_surround %g\n", selVals.tangent_surround);
#endif /* 0 */
}
@ -319,70 +324,44 @@ static gint
sel2path_dialog (SELVALS *sels)
{
GtkWidget *dlg;
GtkWidget *button;
GtkWidget *vbox;
GtkWidget *table;
retVal = FALSE;
gimp_ui_init ("sel2path", FALSE);
dlg = gtk_dialog_new ();
gtk_window_set_title (GTK_WINDOW (dlg), "Sel2path");
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
(GtkSignalFunc) sel2path_close_callback,
NULL);
dlg = gimp_dialog_new (_("Sel2Path Advanced Settings"), "sel2path",
gimp_standard_help_func, "filters/sel2path.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
vbox = gtk_vbox_new(FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), vbox,
FALSE, FALSE, 0);
gtk_widget_show(vbox);
_("OK"), sel2path_ok_callback,
NULL, NULL, NULL, TRUE, FALSE,
_("Reset"), sel2path_reset_callback,
NULL, NULL, NULL, FALSE, FALSE,
_("Cancel"), gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
NULL);
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit),
NULL);
table = dialog_create_selection_area(sels);
gtk_container_add (GTK_CONTAINER (vbox), table);
/* Action area */
button = gtk_button_new_with_label ( _("OK"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) sel2path_ok_callback,
dlg);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->action_area), button, TRUE, TRUE, 0);
gtk_widget_grab_default (button);
gtk_widget_show (button);
button = gtk_button_new_with_label ( _("Cancel"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) gtk_widget_destroy,
GTK_OBJECT (dlg));
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->action_area), button, TRUE, TRUE, 0);
gtk_widget_show (button);
button = gtk_button_new_with_label (_("Default Values"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) sel2path_reset_callback,
GTK_OBJECT (dlg));
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->action_area), button, TRUE, TRUE, 0);
gtk_widget_show (button);
gtk_container_set_border_width (GTK_CONTAINER (table), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dlg)->vbox), table);
gtk_widget_show (table);
gtk_widget_show (dlg);
gtk_main ();
gdk_flush ();
return retVal;
}
static void
sel2path_close_callback (GtkWidget *widget,
gpointer data)
{
retVal = FALSE;
gtk_main_quit ();
}
static void
sel2path_ok_callback (GtkWidget *widget,
gpointer data)
@ -400,7 +379,8 @@ sel2path_reset_callback (GtkWidget *widget,
}
guchar
sel_pixel_value(gint row, gint col)
sel_pixel_value (gint row,
gint col)
{
guchar ret;
@ -416,69 +396,76 @@ sel_pixel_value(gint row, gint col)
return ret;
}
gint
sel_pixel_is_white(gint row, gint col)
gboolean
sel_pixel_is_white (gint row,
gint col)
{
if(sel_pixel_value(row,col) < MID_POINT)
return 1;
if (sel_pixel_value (row, col) < MID_POINT)
return TRUE;
else
return 0;
return FALSE;
}
gint
sel_get_width()
sel_get_width (void)
{
return sel_width;
}
gint
sel_get_height()
sel_get_height (void)
{
return sel_height;
}
gint
sel_valid_pixel(gint row, gint col)
sel_valid_pixel (gint row,
gint col)
{
return (0 <= (row) && (row) < sel_get_height()
&& 0 <= (col) && (col) < sel_get_width());
return (0 <= (row) && (row) < sel_get_height ()
&& 0 <= (col) && (col) < sel_get_width ());
}
void
gen_anchor(gdouble *p,double x,double y,int is_newcurve)
gen_anchor (gdouble *p,
gdouble x,
gdouble y,
gboolean is_newcurve)
{
/* printf("TYPE: %s X: %d Y: %d\n", */
/* (is_newcurve)?"3":"1", */
/* sel_x1+(int)RINT(x), */
/* sel_y1 + sel_height - (int)RINT(y)+1); */
*p++ = (sel_x1+(int)RINT(x));
*p++ = sel_y1 + sel_height - (int)RINT(y)+1;
*p++ = (is_newcurve)?3.0:1.0;
*p++ = (sel_x1 + (gint)RINT(x));
*p++ = sel_y1 + sel_height - (gint)RINT(y) + 1;
*p++ = (is_newcurve) ? 3.0 : 1.0;
}
void
gen_control(gdouble *p,double x,double y)
gen_control (gdouble *p,
gdouble x,
gdouble y)
{
/* printf("TYPE: 2 X: %d Y: %d\n", */
/* sel_x1+(int)RINT(x), */
/* sel_y1 + sel_height - (int)RINT(y)+1); */
*p++ = sel_x1+(int)RINT(x);
*p++ = sel_y1 + sel_height - (int)RINT(y)+1;
*p++ = sel_x1 + (gint)RINT(x);
*p++ = sel_y1 + sel_height - (gint)RINT(y) + 1;
*p++ = 2.0;
}
void
do_points(spline_list_array_type in_splines,gint32 image_ID)
do_points (spline_list_array_type in_splines,
gint32 image_ID)
{
unsigned this_list;
int seg_count = 0;
int point_count = 0;
double last_x,last_y;
gint seg_count = 0;
gint point_count = 0;
gdouble last_x,last_y;
gdouble *parray;
gdouble *cur_parray;
gint path_point_count;
@ -527,28 +514,33 @@ do_points(spline_list_array_type in_splines,gint32 image_ID)
if (SPLINE_DEGREE (s) == LINEAR)
{
gen_anchor(cur_parray,START_POINT (s).x, START_POINT (s).y,seg_count && !point_count);
gen_anchor (cur_parray,
START_POINT (s).x, START_POINT (s).y,
seg_count && !point_count);
cur_parray += 3;
gen_control(cur_parray,START_POINT (s).x, START_POINT (s).y);
gen_control (cur_parray, START_POINT (s).x, START_POINT (s).y);
cur_parray += 3;
gen_control(cur_parray,END_POINT (s).x, END_POINT (s).y);
gen_control (cur_parray,END_POINT (s).x, END_POINT (s).y);
cur_parray += 3;
last_x = END_POINT (s).x;
last_y = END_POINT (s).y;
}
else if (SPLINE_DEGREE (s) == CUBIC)
{
gen_anchor(cur_parray,START_POINT (s).x, START_POINT (s).y,seg_count && !point_count);
gen_anchor (cur_parray,
START_POINT (s).x, START_POINT (s).y,
seg_count && !point_count);
cur_parray += 3;
gen_control(cur_parray,CONTROL1 (s).x, CONTROL1 (s).y);
gen_control (cur_parray,CONTROL1 (s).x, CONTROL1 (s).y);
cur_parray += 3;
gen_control(cur_parray,CONTROL2 (s).x, CONTROL2 (s).y);
gen_control (cur_parray,CONTROL2 (s).x, CONTROL2 (s).y);
cur_parray += 3;
last_x = END_POINT (s).x;
last_y = END_POINT (s).y;
}
else
g_message ( _("print_spline: strange degree (%d)"), SPLINE_DEGREE (s));
g_message ( _("print_spline: strange degree (%d)"),
SPLINE_DEGREE (s));
point_count++;
}
@ -564,14 +556,16 @@ do_points(spline_list_array_type in_splines,gint32 image_ID)
gboolean
do_sel2path(gint32 drawable_ID,gint32 image_ID )
do_sel2path (gint32 drawable_ID,
gint32 image_ID)
{
gint32 selection_ID;
GDrawable *sel_drawable;
pixel_outline_list_type olt;
spline_list_array_type splines;
gimp_selection_bounds(image_ID,&has_sel,&sel_x1, &sel_y1, &sel_x2, &sel_y2);
gimp_selection_bounds (image_ID, &has_sel,
&sel_x1, &sel_y1, &sel_x2, &sel_y2);
sel_width = sel_x2 - sel_x1;
sel_height = sel_y2 - sel_y1;
@ -594,63 +588,25 @@ do_sel2path(gint32 drawable_ID,gint32 image_ID )
return FALSE;
}
gimp_pixel_rgn_init(&selection_rgn,sel_drawable,sel_x1,sel_y1,sel_width,sel_height,FALSE,FALSE);
gimp_pixel_rgn_init (&selection_rgn, sel_drawable,
sel_x1, sel_y1, sel_width, sel_height,
FALSE, FALSE);
gimp_tile_cache_ntiles(2 * (sel_drawable->width + gimp_tile_width() - 1) / gimp_tile_width());
gimp_tile_cache_ntiles (2 * (sel_drawable->width + gimp_tile_width () - 1) /
gimp_tile_width ());
olt = find_outline_pixels();
olt = find_outline_pixels ();
splines = fitted_splines (olt);
gimp_selection_none(image_ID);
gimp_selection_none (image_ID);
gimp_displays_flush ();
gimp_displays_flush();
do_points(splines,image_ID);
do_points (splines, image_ID);
return TRUE;
}
static gint
gimp_path_set_points (gint32 image_ID,
gchar *name,
gint ptype,
gint num_path_points,
gdouble *point_pairs)
{
GParam *return_vals;
int nreturn_vals;
int result;
#if 0
int count;
for(count = 0; count < num_path_points; count++)
{
printf("[%d] %g\n",count,point_pairs[count]);
}
#endif /* 0 */
return_vals = gimp_run_procedure ("gimp_path_set_points",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_STRING, name,
PARAM_INT32, ptype,
PARAM_INT32, num_path_points,
PARAM_FLOATARRAY, point_pairs,
PARAM_END);
result = FALSE;
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
result = TRUE;
}
gimp_destroy_params (return_vals, nreturn_vals);
return result;
}
void
safe_free (address *item)
{

View file

@ -29,548 +29,358 @@
#include <stdio.h>
#include <stdlib.h>
#include <types.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "types.h"
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#define SCALE_WIDTH 100
static GSList * adjust_widgets = NULL;
typedef struct dVal
{
gdouble value;
} dVal;
/* Reset to recommended defaults */
void
reset_adv_dialog()
reset_adv_dialog (void)
{
GSList *list = adjust_widgets;
while(list)
GSList *list;
GtkObject *widget;
gdouble *value;
for (list = adjust_widgets; list; list = g_slist_next (list))
{
GtkObject *w = GTK_OBJECT(list->data);
dVal *valptr = (dVal *)gtk_object_get_data(GTK_OBJECT(w),"default_value");
if(GTK_IS_ADJUSTMENT(w))
widget = GTK_OBJECT (list->data);
value = (gdouble *) gtk_object_get_data (widget ,"default_value");
if (GTK_IS_ADJUSTMENT (widget))
{
(GTK_ADJUSTMENT(w))->value = valptr->value;
gtk_signal_emit_by_name(GTK_OBJECT(w), "value_changed");
gtk_adjustment_set_value (GTK_ADJUSTMENT (widget),
*value);
}
else if(GTK_IS_TOGGLE_BUTTON(w))
else if (GTK_IS_TOGGLE_BUTTON (widget))
{
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(w),valptr->value);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (widget),
(gboolean)(*value));
}
else
g_warning("Internal widget list error");
list = g_slist_next(list);
g_warning ("Internal widget list error");
}
}
gpointer
def_val(gdouble default_value)
def_val (gdouble default_value)
{
dVal *valptr = g_new0(dVal,1);
valptr->value = default_value;
return(valptr);
gdouble *value = g_new0 (gdouble, 1);
*value = default_value;
return (value);
}
static void
dialog_scale_update(GtkAdjustment * adjustment, gdouble * value)
{
if (*value != adjustment->value) {
*value = adjustment->value;
}
}
static void
on_keep_knees_checkbutton_toggled(GtkToggleButton *togglebutton,
gpointer user_data)
{
int *toggle_val;
toggle_val = (int *) user_data;
if (GTK_TOGGLE_BUTTON (togglebutton)->active)
{
/* Only do for event that sets a toggle button to true */
/* This will break if any more toggles are added? */
*toggle_val = TRUE;
}
else
*toggle_val = FALSE;
}
GtkWidget *
dialog_create_selection_area(SELVALS *sels)
dialog_create_selection_area (SELVALS *sels)
{
GtkWidget *table1;
GtkWidget *align_threshold_scale;
GtkWidget *align_threshold;
GtkWidget *line_reversion_threshold_scale;
GtkWidget *subdivide_threshold_scale;
GtkWidget *tangent_surround_scale;
GtkWidget *subdivide_surround_scale;
GtkWidget *reparameterize_threshold_scale;
GtkWidget *corner_surround_scale;
GtkWidget *corner_threshold_scale;
GtkWidget *filter_percent_scale;
GtkWidget *filter_secondary_surround_scale;
GtkWidget *filter_surround_scale;
GtkWidget *keep_knees_checkbutton;
GtkWidget *subdivide_search_scale;
GtkWidget *reparameterize_improvement_scale;
GtkWidget *line_threshold_scale;
GtkWidget *filter_iteration_count_scale;
GtkWidget *filter_epsilon_scale;
GtkWidget *subdivide_threshold;
GtkWidget *tangent_surround;
GtkWidget *subdivide_surround;
GtkWidget *subdivide_search;
GtkWidget *reparameterize_threshold;
GtkWidget *reparameterize_improvement;
GtkWidget *line_threshold;
GtkWidget *line_reversion_threshold;
GtkWidget *keep_knees;
GtkWidget *filter_surround;
GtkWidget *filter_secondary_surround;
GtkWidget *filter_percent;
GtkWidget *filter_iteration_count;
GtkWidget *filter_epsilon;
GtkWidget *corner_always_threshold_scale;
GtkWidget *error_threshold_scale;
GtkWidget *filter_alternative_surround_scale;
GtkWidget *filter_alternative_surround;
GtkWidget *error_threshold;
GtkWidget *corner_threshold;
GtkWidget *corner_surround;
GtkWidget *corner_always_threshold;
GtkTooltips *tooltips;
GtkObject *size_data;
GtkWidget *table;
GtkWidget *check;
GtkObject *adj;
gint row;
tooltips = gtk_tooltips_new ();
gimp_help_init ();
table1 = gtk_table_new (20, 2, FALSE);
gtk_widget_show (table1);
gtk_table_set_row_spacings (GTK_TABLE (table1), 2);
table = gtk_table_new (20, 3, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
row = 0;
align_threshold_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->align_threshold, 0.2, 2, 0.1, 0.1, 0)));
gtk_widget_show (align_threshold_scale);
gtk_table_attach (GTK_TABLE (table1), align_threshold_scale, 1, 2, 0, 1,
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Align Threshold:", SCALE_WIDTH, 0,
sels->align_threshold,
0.2, 2.0, 0.1, 0.1, 2,
TRUE, 0, 0,
"If two endpoints are closer than this,"
"they are made to be equal.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->align_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (0.5));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Corner Always Threshold:", SCALE_WIDTH, 0,
sels->corner_always_threshold,
30, 180, 1, 1, 2,
TRUE, 0, 0,
"If the angle defined by a point and its predecessors "
"and successors is smaller than this, it's a corner, "
"even if it's within `corner_surround' pixels of a "
"point with a smaller angle.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->corner_always_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (60.0));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Corner Surround:", SCALE_WIDTH, 0,
sels->corner_surround,
3, 8, 1, 1, 0,
TRUE, 0, 0,
"Number of points to consider when determining if a "
"point is a corner or not.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->corner_surround);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (4.0));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Corner Threshold:", SCALE_WIDTH, 0,
sels->corner_threshold,
0, 180, 1, 1, 2,
TRUE, 0, 0,
"If a point, its predecessors, and its successors "
"define an angle smaller than this, it's a corner.",
NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->corner_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (100.0));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Error Threshold:", SCALE_WIDTH, 0,
sels->error_threshold,
0.2, 10, 0.1, 0.1, 2,
TRUE, 0, 0,
"Amount of error at which a fitted spline is "
"unacceptable. If any pixel is further away "
"than this from the fitted curve, we try again.",
NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->error_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (0.40));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Filter Alternative Surround:", SCALE_WIDTH, 0,
sels->filter_alternative_surround,
1, 10, 1, 1, 0,
TRUE, 0, 0,
"A second number of adjacent points to consider "
"when filtering.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->filter_alternative_surround);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (1.0));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Filter Epsilon:", SCALE_WIDTH, 0,
sels->filter_epsilon,
5, 40, 1, 1, 2,
TRUE, 0, 0,
"If the angles between the vectors produced by "
"filter_surround and filter_alternative_surround "
"points differ by more than this, use the one from "
"filter_alternative_surround.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->filter_epsilon);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (10.0));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Filter Iteration Count:", SCALE_WIDTH, 0,
sels->filter_iteration_count,
4, 70, 1, 1, 0,
TRUE, 0, 0,
"Number of times to smooth original data points. "
"Increasing this number dramatically --- to 50 or "
"so --- can produce vastly better results. But if "
"any points that ``should'' be corners aren't found, "
"the curve goes to hell around that point.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->filter_iteration_count);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (4.0));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Filter Percent:", SCALE_WIDTH, 0,
sels->filter_percent,
0, 1, 0.05, 0.01, 2,
TRUE, 0, 0,
"To produce the new point, use the old point plus "
"this times the neighbors.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->filter_percent);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (0.33));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Filter Secondary Surround:", SCALE_WIDTH, 0,
sels->filter_secondary_surround,
3, 10, 1, 1, 0,
TRUE, 0, 0,
"Number of adjacent points to consider if "
"`filter_surround' points defines a straight line.",
NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->filter_secondary_surround);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (3.0));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Filter Surround:", SCALE_WIDTH, 0,
sels->filter_surround,
2, 10, 1, 1, 0,
TRUE, 0, 0,
"Number of adjacent points to consider when filtering.",
NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->filter_surround);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (2.0));
check = gtk_check_button_new_with_label ("Keep Knees");
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check), sels->keep_knees);
gtk_table_attach (GTK_TABLE (table), check, 1, 3, row, row + 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, align_threshold_scale, "If two endpoints are closer than this, they are made to be equal.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (align_threshold_scale), GTK_POS_LEFT);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->align_threshold);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(0.5));
gimp_help_set_help_data (GTK_WIDGET (check),
"Says whether or not to remove ``knee'' "
"points after finding the outline.", NULL);
gtk_signal_connect (GTK_OBJECT (check), "toggled",
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
&sels->keep_knees);
gtk_widget_show (check);
adjust_widgets = g_slist_append (adjust_widgets, check);
gtk_object_set_data (GTK_OBJECT (check), "default_value", def_val ((gdouble)FALSE));
row++;
align_threshold = gtk_label_new ("align_threshold: ");
gtk_widget_show (align_threshold);
gtk_table_attach (GTK_TABLE (table1), align_threshold, 0, 1, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
GTK_WIDGET_SET_FLAGS (align_threshold, GTK_CAN_FOCUS);
gtk_tooltips_set_tip (tooltips, align_threshold, "If two endpoints are closer than this, they are made to be equal.\n (-align-threshold)", NULL);
gtk_misc_set_alignment (GTK_MISC (align_threshold), 1, 0.5);
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Line Reversion Threshold:", SCALE_WIDTH, 0,
sels->line_reversion_threshold,
0.01, 0.2, 0.01, 0.01, 3,
TRUE, 0, 0,
"If a spline is closer to a straight line than this, "
"it remains a straight line, even if it would otherwise "
"be changed back to a curve. This is weighted by the "
"square of the curve length, to make shorter curves "
"more likely to be reverted.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->line_reversion_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (0.01));
line_reversion_threshold_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->line_reversion_threshold, 0.01, 0.2, 0.01, 0.01, 0)));
gtk_widget_show (line_reversion_threshold_scale);
gtk_table_attach (GTK_TABLE (table1), line_reversion_threshold_scale, 1, 2, 12, 13,
GTK_EXPAND, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, line_reversion_threshold_scale, "If a spline is closer to a straight line than this, it remains a straight line, even if it would otherwise be changed back to a curve. This is weighted by the square of the curve length, to make shorter curves more likely to be reverted.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (line_reversion_threshold_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (line_reversion_threshold_scale), 3);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->line_reversion_threshold);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(0.01));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Line Threshold:", SCALE_WIDTH, 0,
sels->line_threshold,
0.2, 4, 0.1, 0.01, 2,
TRUE, 0, 0,
"How many pixels (on the average) a spline can "
"diverge from the line determined by its endpoints "
"before it is changed to a straight line.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->line_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (0.5));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Reparametrize Improvement:", SCALE_WIDTH, 0,
sels->reparameterize_improvement,
0, 1, 0.05, 0.01, 2,
TRUE, 0, 0,
"If reparameterization doesn't improve the fit by this "
"much percent, stop doing it. ""Amount of error at which "
"it is pointless to reparameterize.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->reparameterize_improvement);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (0.01));
subdivide_threshold_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->subdivide_threshold, 0.01, 1, 0.01, 0.01, 0)));
gtk_widget_show (subdivide_threshold_scale);
gtk_table_attach (GTK_TABLE (table1), subdivide_threshold_scale, 1, 2, 19, 20,
0, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, subdivide_threshold_scale, "How many pixels a point can diverge from a straight line and still be considered a better place to subdivide.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (subdivide_threshold_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (subdivide_threshold_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->subdivide_threshold);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(0.03));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Reparametrize Threshold:", SCALE_WIDTH, 0,
sels->reparameterize_threshold,
1, 50, 0.5, 0.5, 2,
TRUE, 0, 0,
"Amount of error at which it is pointless to reparameterize. "
"This happens, for example, when we are trying to fit the "
"outline of the outside of an `O' with a single spline. "
"The initial fit is not good enough for the Newton-Raphson "
"iteration to improve it. It may be that it would be better "
"to detect the cases where we didn't find any corners.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->reparameterize_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (1.0));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Subdivide Search:", SCALE_WIDTH, 0,
sels->subdivide_search,
0.05, 1, 0.05, 0.01, 2,
TRUE, 0, 0,
"Percentage of the curve away from the worst point "
"to look for a better place to subdivide.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->subdivide_search);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (0.1));
tangent_surround_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->tangent_surround, 2, 10, 1, 1, 0)));
gtk_widget_show (tangent_surround_scale);
gtk_table_attach (GTK_TABLE (table1), tangent_surround_scale, 1, 2, 18, 19,
0, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, tangent_surround_scale, "Number of points to look at on either side of a point when computing the approximation to the tangent at that point.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (tangent_surround_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (tangent_surround_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->tangent_surround);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(3.0));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Subdivide Surround:", SCALE_WIDTH, 0,
sels->subdivide_surround,
2, 10, 1, 1, 0,
TRUE, 0, 0,
"Number of points to consider when deciding whether "
"a given point is a better place to subdivide.",
NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->subdivide_surround);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (4.0));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Subdivide Threshold:", SCALE_WIDTH, 0,
sels->subdivide_threshold,
0.01, 1, 0.01, 0.01, 2,
TRUE, 0, 0,
"How many pixels a point can diverge from a straight "
"line and still be considered a better place to "
"subdivide.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->subdivide_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (0.03));
subdivide_surround_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->subdivide_surround, 2, 10, 1, 1, 0)));
gtk_widget_show (subdivide_surround_scale);
gtk_table_attach (GTK_TABLE (table1), subdivide_surround_scale, 1, 2, 17, 18,
0, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, subdivide_surround_scale, "Number of points to consider when deciding whether a given point is a better place to subdivide.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (subdivide_surround_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (subdivide_surround_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->subdivide_surround);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(4.0));
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
"Tangent Surround:", SCALE_WIDTH, 0,
sels->tangent_surround,
2, 10, 1, 1, 0,
TRUE, 0, 0,
"Number of points to look at on either side of a "
"point when computing the approximation to the "
"tangent at that point.", NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&sels->tangent_surround);
adjust_widgets = g_slist_append (adjust_widgets, adj);
gtk_object_set_data (GTK_OBJECT (adj), "default_value", def_val (3.0));
reparameterize_threshold_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->reparameterize_threshold, 1, 50, 0.5, 0.5, 0)));
gtk_widget_show (reparameterize_threshold_scale);
gtk_table_attach (GTK_TABLE (table1), reparameterize_threshold_scale, 1, 2, 15, 16,
0, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, reparameterize_threshold_scale, "Amount of error at which it is pointless to reparameterize. This happens, for example, when we are trying to fit the outline of the outside of an `O' with a single spline. The initial fit is not good enough for the Newton-Raphson iteration to improve it. It may be that it would be better to detect the cases where we didn't find any corners.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (reparameterize_threshold_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (reparameterize_threshold_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->reparameterize_threshold);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(1.0));
corner_surround_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->corner_surround, 3, 8, 1, 1, 0)));
gtk_widget_show (corner_surround_scale);
gtk_table_attach (GTK_TABLE (table1), corner_surround_scale, 1, 2, 2, 3,
GTK_EXPAND, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, corner_surround_scale, "Number of points to consider when determining if a point is a corner or not.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (corner_surround_scale), GTK_POS_LEFT);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->corner_surround);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(4.0));
corner_threshold_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->corner_threshold, 0, 180, 1, 1, 0)));
gtk_widget_show (corner_threshold_scale);
gtk_table_attach (GTK_TABLE (table1), corner_threshold_scale, 1, 2, 3, 4,
0, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, corner_threshold_scale, "If a point, its predecessors, and its successors define an angle smaller than this, it's a corner. Should be in range 0..180.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (corner_threshold_scale), GTK_POS_LEFT);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->corner_threshold);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(100.0));
filter_percent_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->filter_percent, 0, 1, 0.05, 0.01, 0)));
gtk_widget_show (filter_percent_scale);
gtk_table_attach (GTK_TABLE (table1), filter_percent_scale, 1, 2, 8, 9,
GTK_EXPAND, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, filter_percent_scale, "To produce the new point, use the old point plus this times the neighbors.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (filter_percent_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (filter_percent_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->filter_percent);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(0.33));
filter_secondary_surround_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->filter_secondary_surround, 3, 10, 1, 1, 0)));
gtk_widget_show (filter_secondary_surround_scale);
gtk_table_attach (GTK_TABLE (table1), filter_secondary_surround_scale, 1, 2, 9, 10,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, filter_secondary_surround_scale, "Number of adjacent points to consider if `filter_surround' points defines a straight line.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (filter_secondary_surround_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (filter_secondary_surround_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->filter_secondary_surround);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(3.0));
filter_surround_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->filter_surround, 2, 10, 1, 1, 0)));
gtk_widget_show (filter_surround_scale);
gtk_table_attach (GTK_TABLE (table1), filter_surround_scale, 1, 2, 10, 11,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, filter_surround_scale, "Number of adjacent points to consider when filtering.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (filter_surround_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (filter_surround_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->filter_surround);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(2.0));
keep_knees_checkbutton = gtk_check_button_new_with_label ("");
gtk_widget_show (keep_knees_checkbutton);
gtk_table_attach (GTK_TABLE (table1), keep_knees_checkbutton, 1, 2, 11, 12,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, keep_knees_checkbutton, "Says whether or not to remove ``knee'' points after finding the outline.", NULL);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (keep_knees_checkbutton), sels->keep_knees);
gtk_signal_connect (GTK_OBJECT (keep_knees_checkbutton), "toggled",
GTK_SIGNAL_FUNC (on_keep_knees_checkbutton_toggled),
&sels->keep_knees);
adjust_widgets = g_slist_append(adjust_widgets,keep_knees_checkbutton);
gtk_object_set_data(GTK_OBJECT(keep_knees_checkbutton),"default_value",def_val(FALSE));
subdivide_search_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new(sels->subdivide_search, 0.05, 1, 0.05, 0.01, 0)));
gtk_widget_show (subdivide_search_scale);
gtk_table_attach (GTK_TABLE (table1), subdivide_search_scale, 1, 2, 16, 17,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, subdivide_search_scale, "Percentage of the curve away from the worst point to look for a better place to subdivide.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (subdivide_search_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (subdivide_search_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->subdivide_search);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(0.10));
reparameterize_improvement_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->reparameterize_improvement, 0, 1, 0.05, 0.01, 0)));
gtk_widget_show (reparameterize_improvement_scale);
gtk_table_attach (GTK_TABLE (table1), reparameterize_improvement_scale, 1, 2, 14, 15,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, reparameterize_improvement_scale, "If reparameterization doesn't improve the fit by this much percent, stop doing it. ", NULL);
gtk_scale_set_value_pos (GTK_SCALE (reparameterize_improvement_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (reparameterize_improvement_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->reparameterize_improvement);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(0.01));
line_threshold_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->line_threshold, 0.2, 4, 0.1, 0.01, 0)));
gtk_widget_show (line_threshold_scale);
gtk_table_attach (GTK_TABLE (table1), line_threshold_scale, 1, 2, 13, 14,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, line_threshold_scale, "How many pixels (on the average) a spline can diverge from the line determined by its endpoints before it is changed to a straight line.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (line_threshold_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (line_threshold_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->line_threshold);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(0.5));
filter_iteration_count_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->filter_iteration_count, 4, 70, 1, 0.01, 0)));
gtk_widget_show (filter_iteration_count_scale);
gtk_table_attach (GTK_TABLE (table1), filter_iteration_count_scale, 1, 2, 7, 8,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, filter_iteration_count_scale, "Number of times to smooth original data points. Increasing this number dramatically---to 50 or so---can produce vastly better results. But if any points that ``should'' be corners aren't found, the curve goes to hell around that point.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (filter_iteration_count_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (filter_iteration_count_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->filter_iteration_count);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(4.0));
filter_epsilon_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->filter_epsilon, 5, 40, 1, 1, 0)));
gtk_widget_show (filter_epsilon_scale);
gtk_table_attach (GTK_TABLE (table1), filter_epsilon_scale, 1, 2, 6, 7,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, filter_epsilon_scale, "If the angles between the vectors produced by filter_surround and filter_alternative_surround points differ by more than this, use the one from filter_alternative_surround.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (filter_epsilon_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (filter_epsilon_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->filter_epsilon);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(10.0));
subdivide_threshold = gtk_label_new ("subdivide_threshold: ");
gtk_widget_show (subdivide_threshold);
gtk_table_attach (GTK_TABLE (table1), subdivide_threshold, 0, 1, 19, 20,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (subdivide_threshold), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (subdivide_threshold), 0, 2);
tangent_surround = gtk_label_new ("tangent_surround: ");
gtk_widget_show (tangent_surround);
gtk_table_attach (GTK_TABLE (table1), tangent_surround, 0, 1, 18, 19,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (tangent_surround), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (tangent_surround), 0, 2);
subdivide_surround = gtk_label_new ("subdivide_surround: ");
gtk_widget_show (subdivide_surround);
gtk_table_attach (GTK_TABLE (table1), subdivide_surround, 0, 1, 17, 18,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (subdivide_surround), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (subdivide_surround), 0, 2);
subdivide_search = gtk_label_new ("subdivide_search: ");
gtk_widget_show (subdivide_search);
gtk_table_attach (GTK_TABLE (table1), subdivide_search, 0, 1, 16, 17,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (subdivide_search), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (subdivide_search), 0, 2);
reparameterize_threshold = gtk_label_new ("reparameterize_threshold: ");
gtk_widget_show (reparameterize_threshold);
gtk_table_attach (GTK_TABLE (table1), reparameterize_threshold, 0, 1, 15, 16,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (reparameterize_threshold), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (reparameterize_threshold), 0, 2);
reparameterize_improvement = gtk_label_new ("reparameterize_improvement: ");
gtk_widget_show (reparameterize_improvement);
gtk_table_attach (GTK_TABLE (table1), reparameterize_improvement, 0, 1, 14, 15,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (reparameterize_improvement), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (reparameterize_improvement), 0, 2);
line_threshold = gtk_label_new ("line_threshold: ");
gtk_widget_show (line_threshold);
gtk_table_attach (GTK_TABLE (table1), line_threshold, 0, 1, 13, 14,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (line_threshold), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (line_threshold), 0, 2);
line_reversion_threshold = gtk_label_new ("line_reversion_threshold: ");
gtk_widget_show (line_reversion_threshold);
gtk_table_attach (GTK_TABLE (table1), line_reversion_threshold, 0, 1, 12, 13,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (line_reversion_threshold), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (line_reversion_threshold), 0, 2);
keep_knees = gtk_label_new ("keep_knees: ");
gtk_widget_show (keep_knees);
gtk_table_attach (GTK_TABLE (table1), keep_knees, 0, 1, 11, 12,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (keep_knees), 1, 0.5);
filter_surround = gtk_label_new ("filter_surround: ");
gtk_widget_show (filter_surround);
gtk_table_attach (GTK_TABLE (table1), filter_surround, 0, 1, 10, 11,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (filter_surround), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (filter_surround), 0, 2);
filter_secondary_surround = gtk_label_new ("filter_secondary_surround: ");
gtk_widget_show (filter_secondary_surround);
gtk_table_attach (GTK_TABLE (table1), filter_secondary_surround, 0, 1, 9, 10,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (filter_secondary_surround), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (filter_secondary_surround), 0, 2);
filter_percent = gtk_label_new ("filter_percent: ");
gtk_widget_show (filter_percent);
gtk_table_attach (GTK_TABLE (table1), filter_percent, 0, 1, 8, 9,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (filter_percent), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (filter_percent), 0, 2);
filter_iteration_count = gtk_label_new ("filter_iteration_count: ");
gtk_widget_show (filter_iteration_count);
gtk_table_attach (GTK_TABLE (table1), filter_iteration_count, 0, 1, 7, 8,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (filter_iteration_count), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (filter_iteration_count), 0, 2);
filter_epsilon = gtk_label_new ("filter_epsilon: ");
gtk_widget_show (filter_epsilon);
gtk_table_attach (GTK_TABLE (table1), filter_epsilon, 0, 1, 6, 7,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, filter_epsilon, "If the angles between the vectors produced by filter_surround and\nfilter_alternative_surround points differ by more than this, use\nthe one from filter_alternative_surround.", NULL);
gtk_label_set_justify (GTK_LABEL (filter_epsilon), GTK_JUSTIFY_LEFT);
gtk_misc_set_alignment (GTK_MISC (filter_epsilon), 0.999999, 0.5);
gtk_misc_set_padding (GTK_MISC (filter_epsilon), 0, 2);
corner_always_threshold_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->corner_always_threshold, 30, 180, 1, 1, 0)));
gtk_widget_show (corner_always_threshold_scale);
gtk_table_attach (GTK_TABLE (table1), corner_always_threshold_scale, 1, 2, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, corner_always_threshold_scale, "If the angle defined by a point and its predecessors and successors is smaller than this, it's a corner, even if it's within `corner_surround' pixels of a point with a smaller angle.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (corner_always_threshold_scale), GTK_POS_LEFT);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->corner_always_threshold);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(60.0));
error_threshold_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->error_threshold, 0.2, 10, 0.1, 0.1, 0)));
gtk_widget_show (error_threshold_scale);
gtk_table_attach (GTK_TABLE (table1), error_threshold_scale, 1, 2, 4, 5,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, error_threshold_scale, "Amount of error at which a fitted spline is unacceptable. If any pixel is further away than this from the fitted curve, we try again.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (error_threshold_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (error_threshold_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->error_threshold);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(0.40));
filter_alternative_surround_scale = gtk_hscale_new (GTK_ADJUSTMENT(size_data =gtk_adjustment_new (sels->filter_alternative_surround, 1, 10, 1, 1, 0)));
gtk_widget_show (filter_alternative_surround_scale);
gtk_table_attach (GTK_TABLE (table1), filter_alternative_surround_scale, 1, 2, 5, 6,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_tooltips_set_tip (tooltips, filter_alternative_surround_scale, "A second number of adjacent points to consider when filtering.", NULL);
gtk_scale_set_value_pos (GTK_SCALE (filter_alternative_surround_scale), GTK_POS_LEFT);
gtk_scale_set_digits (GTK_SCALE (filter_alternative_surround_scale), 2);
gtk_signal_connect(GTK_OBJECT(size_data), "value_changed",
(GtkSignalFunc) dialog_scale_update,
&sels->filter_alternative_surround);
adjust_widgets = g_slist_append(adjust_widgets,size_data);
gtk_object_set_data(GTK_OBJECT(size_data),"default_value",def_val(1.0));
filter_alternative_surround = gtk_label_new ("filter_alternative_surround: ");
gtk_widget_show (filter_alternative_surround);
gtk_table_attach (GTK_TABLE (table1), filter_alternative_surround, 0, 1, 5, 6,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_label_set_justify (GTK_LABEL (filter_alternative_surround), GTK_JUSTIFY_LEFT);
gtk_misc_set_alignment (GTK_MISC (filter_alternative_surround), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (filter_alternative_surround), 0, 2);
error_threshold = gtk_label_new ("error_threshold: ");
gtk_widget_show (error_threshold);
gtk_table_attach (GTK_TABLE (table1), error_threshold, 0, 1, 4, 5,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (error_threshold), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (error_threshold), 0, 2);
corner_threshold = gtk_label_new ("corner_threshold: ");
gtk_widget_show (corner_threshold);
gtk_table_attach (GTK_TABLE (table1), corner_threshold, 0, 1, 3, 4,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (corner_threshold), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (corner_threshold), 0, 2);
corner_surround = gtk_label_new ("corner_surround: ");
gtk_widget_show (corner_surround);
gtk_table_attach (GTK_TABLE (table1), corner_surround, 0, 1, 2, 3,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (corner_surround), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (corner_surround), 0, 2);
corner_always_threshold = gtk_label_new ("corner_always_threshold: ");
gtk_widget_show (corner_always_threshold);
gtk_table_attach (GTK_TABLE (table1), corner_always_threshold, 0, 1, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment (GTK_MISC (corner_always_threshold), 1, 0.5);
gtk_misc_set_padding (GTK_MISC (corner_always_threshold), 0, 2);
return GTK_WIDGET(table1);
return GTK_WIDGET(table);
}

View file

@ -62,8 +62,9 @@ HELP
}
@procs = qw(version quit);
%exports = (app => [@procs]);
%exports = (app => [@procs], lib => [$procs[0]]);
$desc = 'Miscellaneous';
1;

View file

@ -769,7 +769,7 @@ CODE
path_set_points path_stroke_current path_get_point_at_dist
path_get_tattoo get_path_by_tattoo path_delete path_get_locked
path_set_locked path_set_tattoo);
%exports = (app => [@procs]);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Paths';