Commit df68aba3 authored by BST 1999 Andy Thomas's avatar BST 1999 Andy Thomas Committed by Andy Thomas

Changed:- app/bezier_select.c app/bezier_selectP.h app/cursorutil.c


Thu May 13 22:41:26 BST 1999 Andy Thomas <alt@gimp.org>

	Changed:-
	* app/bezier_select.c
	* app/bezier_selectP.h
	* app/cursorutil.c
	* app/cursorutil.h
	* app/curves.c
	* app/paths_dialog.c

	New:-
	* cursor/mouse1_ap
	* cursor/mouse1_apmsk
	* cursor/mouse1_cp
	* cursor/mouse1_cpmsk
	* cursor/mouse1_mm
	* cursor/mouse1_mmmsk
	* cursor/mouse1_sel
	* cursor/mouse1_selm
	* cursor/mouse1_selmmsk
	* cursor/mouse1_selmsk
	* cursor/mouse1_selp
	* cursor/mouse1_selpmsk

	Paths changes:-
	Implemented multi-part paths.
	(Import the path (RMB in paths dialog brings menu up)
	http://www.picnic.demon.co.uk/tmp/gimp.path
	into a 600x256 (WxH) for an example).

	Can copy/paste paths.
	Fully custom cursors when using the Bezier tool. A number of bug
	fixes re boundary problems also fixed.

	Note that heavy use is made of the modifier keys in the bezier tool.
	MB1 inside a closed curve converts it to a selection. The modifiers
	change how the selection interacts with any current selection (in
	much the same way as the selection tool does).

	MB1 + ALT on control point will move a curve, if shift modifier active
	then single curve is moved.


	Curves:-

	In curves dialog you can now press MB1 + shift will add point to
	curves dialog corresponding to the current position in
	the currently selected channel. MB1 + CNTRL will add the point
	to all channels. (Thanks to Carey Bunks for the initial idea).
parent ea884180
Thu May 13 22:41:26 BST 1999 Andy Thomas <alt@gimp.org>
Changed:-
* app/bezier_select.c
* app/bezier_selectP.h
* app/cursorutil.c
* app/cursorutil.h
* app/curves.c
* app/paths_dialog.c
New:-
* cursor/mouse1_ap
* cursor/mouse1_apmsk
* cursor/mouse1_cp
* cursor/mouse1_cpmsk
* cursor/mouse1_mm
* cursor/mouse1_mmmsk
* cursor/mouse1_sel
* cursor/mouse1_selm
* cursor/mouse1_selmmsk
* cursor/mouse1_selmsk
* cursor/mouse1_selp
* cursor/mouse1_selpmsk
Paths changes:-
Implemented multi-part paths.
(Import the path (RMB in paths dialog brings menu up)
http://www.picnic.demon.co.uk/tmp/gimp.path
into a 600x256 (WxH) for an example).
Can copy/paste paths.
Fully custom cursors when using the Bezier tool. A number of bug
fixes re boundary problems also fixed.
Note that heavy use is made of the modifier keys in the bezier tool.
MB1 inside a closed curve converts it to a selection. The modifiers
change how the selection interacts with any current selection (in
much the same way as the selection tool does).
MB1 + ALT on control point will move a curve, if shift modifier active
then single curve is moved.
Curves:-
In curves dialog you can now press MB1 + shift will add point to
curves dialog corresponding to the current position in
the currently selected channel. MB1 + CNTRL will add the point
to all channels. (Thanks to Carey Bunks for the initial idea).
1999-05-12 Scott Goehring <scott@poverty.bloomington.in.us>
* configure.in: fixed variable clobber for thread & MP options
......
......@@ -7,12 +7,26 @@ bin_SCRIPTS = gimptool
EXTRA_DIST = \
cursors/bigcirc \
cursors/bigcircmsk \
cursors/dropper \
cursors/droppermsk \
cursors/mouse1 \
cursors/mouse1msk \
cursors/mouse1_ap \
cursors/mouse1_apmsk \
cursors/mouse1_cp \
cursors/mouse1_cpmsk \
cursors/mouse1_m \
cursors/mouse1_mmsk \
cursors/mouse1_mm \
cursors/mouse1_mmmsk \
cursors/mouse1_p \
cursors/mouse1_pmsk \
cursors/mouse1_sel \
cursors/mouse1_selmsk \
cursors/mouse1_selm \
cursors/mouse1_selmmsk \
cursors/mouse1_selp \
cursors/mouse1_selpmsk \
cursors/picker \
cursors/pickermsk \
pixmaps/anchor.xpm \
......
......@@ -232,8 +232,34 @@ curves_colour_update(Tool *tool,
curves_dialog->col_value[HISTOGRAM_VALUE] = MAXIMUM(maxval,color[BLUE_PIX]);
g_free(color);
}
curves_update (curves_dialog, GRAPH | DRAW);
static void
curves_add_point(GimpDrawable * drawable,gint x, gint y,gint cchan)
{
/* Add point onto the curve */
int closest_point = 0;
int distance;
int curvex;
int i;
curvex = curves_dialog->col_value[cchan];
distance = G_MAXINT;
for (i = 0; i < 17; i++)
{
if (curves_dialog->points[cchan][i][0] != -1)
if (abs (curvex - curves_dialog->points[cchan][i][0]) < distance)
{
distance = abs (curvex - curves_dialog->points[cchan][i][0]);
closest_point = i;
}
}
if (distance > MIN_DISTANCE)
closest_point = (curvex + 8) / 16;
curves_dialog->points[cchan][closest_point][0] = curvex;
curves_dialog->points[cchan][closest_point][1] = curves_dialog->curve[cchan][curvex];
}
static void
......@@ -254,6 +280,23 @@ curves_button_release (Tool *tool,
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y, FALSE, FALSE);
curves_colour_update(tool,gdisp,drawable,x,y);
if(bevent->state & GDK_SHIFT_MASK)
{
curves_add_point(drawable,x,y,curves_dialog->channel);
curves_calculate_curve(curves_dialog);
}
else if(bevent->state & GDK_CONTROL_MASK)
{
curves_add_point(drawable,x,y,HISTOGRAM_VALUE);
curves_add_point(drawable,x,y,HISTOGRAM_RED);
curves_add_point(drawable,x,y,HISTOGRAM_GREEN);
curves_add_point(drawable,x,y,HISTOGRAM_BLUE);
curves_add_point(drawable,x,y,HISTOGRAM_ALPHA);
curves_calculate_curve(curves_dialog);
}
curves_update (curves_dialog, GRAPH | DRAW);
}
static void
......@@ -274,6 +317,7 @@ curves_motion (Tool *tool,
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, FALSE, FALSE);
curves_colour_update(tool,gdisp,drawable,x,y);
curves_update (curves_dialog, GRAPH | DRAW);
}
static void
......@@ -732,8 +776,8 @@ curves_update (CurvesDialog *cd,
/* draw the colour line */
gdk_draw_line(cd->pixmap, cd->graph->style->black_gc,
cd->col_value[cd->channel],RADIUS,
cd->col_value[cd->channel],GRAPH_HEIGHT + RADIUS);
cd->col_value[cd->channel]+RADIUS,RADIUS,
cd->col_value[cd->channel]+RADIUS,GRAPH_HEIGHT + RADIUS);
gdk_draw_pixmap (cd->graph->window, cd->graph->style->black_gc, cd->pixmap,
0, 0, 0, 0, GRAPH_WIDTH + RADIUS * 2, GRAPH_HEIGHT + RADIUS * 2);
......@@ -1006,7 +1050,11 @@ curves_free_callback (GtkWidget *w,
if (cd->curve_type != GFREE)
{
cd->curve_type = GFREE;
curves_calculate_curve (cd);
curves_update (cd, GRAPH | DRAW);
if (cd->preview)
curves_preview (cd);
}
}
......@@ -1034,6 +1082,7 @@ curves_reset_callback (GtkWidget *widget,
cd->points[cd->channel][16][0] = 255;
cd->points[cd->channel][16][1] = 255;
curves_calculate_curve (cd);
curves_update (cd, GRAPH | XRANGE_TOP | DRAW);
if (cd->preview)
curves_preview (cd);
......
This diff is collapsed.
......@@ -26,6 +26,7 @@
#define BEZIER_ANCHOR 1
#define BEZIER_CONTROL 2
#define BEZIER_MOVE 3
#define IMAGE_COORDS 1
#define AA_IMAGE_COORDS 2
......@@ -39,11 +40,12 @@ typedef struct _bezier_point BezierPoint;
struct _bezier_point
{
int type; /* type of point (anchor or control) */
int x, y; /* location of point in image space */
int type; /* type of point (anchor/control/move) */
double x, y; /* location of point in image space */
int sx, sy; /* location of point in screen space */
BezierPoint *next; /* next point on curve */
BezierPoint *prev; /* prev point on curve */
BezierPoint *next_curve; /* Next curve segment */
};
typedef struct _bezier_select BezierSelect;
......@@ -52,7 +54,7 @@ struct _bezier_select
{
int state; /* start, add, edit or drag */
int draw; /* all or part */
int closed; /* is the curve closed */
int closed; /* is the last curve closed */
DrawCore *core; /* Core drawing object */
BezierPoint *points; /* the curve */
BezierPoint *cur_anchor; /* the current active anchor point */
......@@ -63,13 +65,21 @@ struct _bezier_select
GSList **scanlines; /* used in converting a curve */
};
/* All udata that are passed to the bezier_draw_curve must
* have this structure as the first element.
*/
typedef struct {
gint count;
} CountCurves;
typedef void (*BezierPointsFunc) (BezierSelect *, GdkPoint *, int,gpointer);
/* Functions */
int bezier_select_load (void *, BezierPoint *, int, int);
void bezier_draw_curve (BezierSelect *,BezierPointsFunc, int,gpointer);
void bezier_select_reset (BezierSelect *);
void bezier_add_point (BezierSelect *, int, int, int);
void bezier_add_point (BezierSelect *, int, gdouble, gdouble);
void bezier_paste_bezierselect_to_current (GDisplay *,BezierSelect *);
void bezier_select_mode (gint);
void bezier_stroke (BezierSelect *, GDisplay *, int, int);
......
......@@ -29,6 +29,18 @@
#include "../cursors/bigcircmsk"
#include "../cursors/dropper"
#include "../cursors/droppermsk"
#include "../cursors/mouse1_ap"
#include "../cursors/mouse1_apmsk"
#include "../cursors/mouse1_cp"
#include "../cursors/mouse1_cpmsk"
#include "../cursors/mouse1_mm"
#include "../cursors/mouse1_mmmsk"
#include "../cursors/mouse1_sel"
#include "../cursors/mouse1_selmsk"
#include "../cursors/mouse1_selm"
#include "../cursors/mouse1_selmmsk"
#include "../cursors/mouse1_selp"
#include "../cursors/mouse1_selpmsk"
typedef struct
{
......@@ -52,6 +64,18 @@ static BM_Cursor gimp_cursors[] =
bigcirc_x_hot, bigcirc_y_hot, NULL},
{ dropper_bits, droppermsk_bits, dropper_width, dropper_height,
dropper_x_hot, dropper_y_hot, NULL},
{ mouse1_ap_bits, mouse1_apmsk_bits, mouse1_ap_width, mouse1_ap_height,
mouse1_ap_x_hot, mouse1_ap_y_hot, NULL},
{ mouse1_cp_bits, mouse1_cpmsk_bits, mouse1_cp_width, mouse1_cp_height,
mouse1_cp_x_hot, mouse1_cp_y_hot, NULL},
{ mouse1_mm_bits, mouse1_mmmsk_bits, mouse1_mm_width, mouse1_mm_height,
mouse1_mm_x_hot, mouse1_mm_y_hot, NULL},
{ mouse1_selp_bits, mouse1_selpmsk_bits, mouse1_selp_width, mouse1_selp_height,
mouse1_selp_x_hot, mouse1_selp_y_hot, NULL},
{ mouse1_selm_bits, mouse1_selmmsk_bits, mouse1_selm_width, mouse1_selm_height,
mouse1_selm_x_hot, mouse1_selm_y_hot, NULL},
{ mouse1_sel_bits, mouse1_selmsk_bits, mouse1_sel_width, mouse1_sel_height,
mouse1_sel_x_hot, mouse1_sel_y_hot, NULL},
};
......
......@@ -27,6 +27,12 @@ typedef enum
GIMP_MOUSE1M_CURSOR,
GIMP_BIGCIRC_CURSOR,
GIMP_COLOR_PICKER_CURSOR,
GIMP_MOUSE1AP_CURSOR,
GIMP_MOUSE1CP_CURSOR,
GIMP_MOUSE1MM_CURSOR,
GIMP_MOUSE1SELP_CURSOR,
GIMP_MOUSE1SELM_CURSOR,
GIMP_MOUSE1SEL_CURSOR,
GIMP_LAST_CURSOR_ENTRY
} GimpCursorType;
......
......@@ -232,8 +232,34 @@ curves_colour_update(Tool *tool,
curves_dialog->col_value[HISTOGRAM_VALUE] = MAXIMUM(maxval,color[BLUE_PIX]);
g_free(color);
}
curves_update (curves_dialog, GRAPH | DRAW);
static void
curves_add_point(GimpDrawable * drawable,gint x, gint y,gint cchan)
{
/* Add point onto the curve */
int closest_point = 0;
int distance;
int curvex;
int i;
curvex = curves_dialog->col_value[cchan];
distance = G_MAXINT;
for (i = 0; i < 17; i++)
{
if (curves_dialog->points[cchan][i][0] != -1)
if (abs (curvex - curves_dialog->points[cchan][i][0]) < distance)
{
distance = abs (curvex - curves_dialog->points[cchan][i][0]);
closest_point = i;
}
}
if (distance > MIN_DISTANCE)
closest_point = (curvex + 8) / 16;
curves_dialog->points[cchan][closest_point][0] = curvex;
curves_dialog->points[cchan][closest_point][1] = curves_dialog->curve[cchan][curvex];
}
static void
......@@ -254,6 +280,23 @@ curves_button_release (Tool *tool,
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y, FALSE, FALSE);
curves_colour_update(tool,gdisp,drawable,x,y);
if(bevent->state & GDK_SHIFT_MASK)
{
curves_add_point(drawable,x,y,curves_dialog->channel);
curves_calculate_curve(curves_dialog);
}
else if(bevent->state & GDK_CONTROL_MASK)
{
curves_add_point(drawable,x,y,HISTOGRAM_VALUE);
curves_add_point(drawable,x,y,HISTOGRAM_RED);
curves_add_point(drawable,x,y,HISTOGRAM_GREEN);
curves_add_point(drawable,x,y,HISTOGRAM_BLUE);
curves_add_point(drawable,x,y,HISTOGRAM_ALPHA);
curves_calculate_curve(curves_dialog);
}
curves_update (curves_dialog, GRAPH | DRAW);
}
static void
......@@ -274,6 +317,7 @@ curves_motion (Tool *tool,
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, FALSE, FALSE);
curves_colour_update(tool,gdisp,drawable,x,y);
curves_update (curves_dialog, GRAPH | DRAW);
}
static void
......@@ -732,8 +776,8 @@ curves_update (CurvesDialog *cd,
/* draw the colour line */
gdk_draw_line(cd->pixmap, cd->graph->style->black_gc,
cd->col_value[cd->channel],RADIUS,
cd->col_value[cd->channel],GRAPH_HEIGHT + RADIUS);
cd->col_value[cd->channel]+RADIUS,RADIUS,
cd->col_value[cd->channel]+RADIUS,GRAPH_HEIGHT + RADIUS);
gdk_draw_pixmap (cd->graph->window, cd->graph->style->black_gc, cd->pixmap,
0, 0, 0, 0, GRAPH_WIDTH + RADIUS * 2, GRAPH_HEIGHT + RADIUS * 2);
......@@ -1006,7 +1050,11 @@ curves_free_callback (GtkWidget *w,
if (cd->curve_type != GFREE)
{
cd->curve_type = GFREE;
curves_calculate_curve (cd);
curves_update (cd, GRAPH | DRAW);
if (cd->preview)
curves_preview (cd);
}
}
......@@ -1034,6 +1082,7 @@ curves_reset_callback (GtkWidget *widget,
cd->points[cd->channel][16][0] = 255;
cd->points[cd->channel][16][1] = 255;
curves_calculate_curve (cd);
curves_update (cd, GRAPH | XRANGE_TOP | DRAW);
if (cd->preview)
curves_preview (cd);
......
......@@ -98,6 +98,7 @@ typedef struct {
} PATHSLIST, *PATHSLISTP;
static PATHSLISTP paths_dialog = NULL;
static PATHP copy_pp = NULL;
typedef struct {
GdkPixmap *paths_pixmap;
......@@ -110,6 +111,11 @@ typedef struct {
PATHP copy_path;
} PATHUNDO;
typedef struct {
CountCurves c_count; /* Must be the first element */
gint total_count; /* Total number of curves */
} PATHCOUNTS, *PATHCOUNTSP;
static gchar * unique_name(GimpImage *,gchar *);
static gint path_widget_preview_events (GtkWidget *, GdkEvent *);
......@@ -122,6 +128,8 @@ static void paths_dialog_delete_path_callback (GtkWidget *, gpointer);
static void paths_dialog_map_callback (GtkWidget *w,gpointer client_data);
static void paths_dialog_unmap_callback(GtkWidget *w,gpointer client_data);
static void paths_dialog_dup_path_callback(GtkWidget *w,gpointer client_data);
static void paths_dialog_copy_path_callback(GtkWidget *w,gpointer client_data);
static void paths_dialog_paste_path_callback(GtkWidget *w,gpointer client_data);
static void paths_dialog_stroke_path_callback(GtkWidget *w,gpointer client_data);
static void paths_dialog_path_to_sel_callback(GtkWidget *w,gpointer client_data);
static void paths_dialog_destroy_cb (GimpImage *image);
......@@ -136,18 +144,14 @@ static void paths_dialog_delete_point_callback (GtkWidget *, gpointer);
static void paths_dialog_edit_point_callback (GtkWidget *, gpointer);
static void paths_dialog_import_path_callback (GtkWidget *, gpointer);
static void paths_dialog_export_path_callback (GtkWidget *, gpointer);
static void path_close(PATHP);
#define NEW_PATH_BUTTON 1
#define DUP_PATH_BUTTON 2
#define PATH_TO_SEL_BUTTON 3
#define STROKE_PATH_BUTTON 4
#define DEL_PATH_BUTTON 5
static MenuItem paths_ops[] =
{
{ N_("New Path"), 'N', GDK_CONTROL_MASK,
paths_dialog_new_path_callback, NULL, NULL, NULL },
{ N_("Duplicate Path"), 'C', GDK_CONTROL_MASK,
{ N_("Duplicate Path"), 'U', GDK_CONTROL_MASK,
paths_dialog_dup_path_callback, NULL, NULL, NULL },
{ N_("Path to Selection"), 'S', GDK_CONTROL_MASK,
paths_dialog_path_to_sel_callback, NULL, NULL, NULL },
......@@ -159,9 +163,21 @@ static MenuItem paths_ops[] =
paths_dialog_import_path_callback, NULL, NULL, NULL },
{ N_("Export Path"), 'E', GDK_CONTROL_MASK,
paths_dialog_export_path_callback, NULL, NULL, NULL },
{ N_("Copy Path"), 'C', GDK_CONTROL_MASK,
paths_dialog_copy_path_callback, NULL, NULL, NULL },
{ N_("Paste Path"), 'P', GDK_CONTROL_MASK,
paths_dialog_paste_path_callback, NULL, NULL, NULL },
{ NULL, 0, 0, NULL, NULL, NULL, NULL }
};
#define NEW_PATH_BUTTON 1
#define DUP_PATH_BUTTON 2
#define PATH_TO_SEL_BUTTON 3
#define STROKE_PATH_BUTTON 4
#define DEL_PATH_BUTTON 5
#define COPY_PATH_BUTTON 8
#define PASTE_PATH_BUTTON 9
static OpsButton paths_ops_buttons[] =
{
{ new_xpm, paths_dialog_new_path_callback, NULL, N_("New Path"), NULL, 0 },
......@@ -211,6 +227,12 @@ paths_ops_button_set_sensitive(gint but,gboolean sensitive)
gtk_widget_set_sensitive(paths_ops[4].widget,sensitive);
gtk_widget_set_sensitive(paths_ops_buttons[4].widget,sensitive);
break;
case COPY_PATH_BUTTON:
gtk_widget_set_sensitive(paths_ops[7].widget,sensitive);
break;
case PASTE_PATH_BUTTON:
gtk_widget_set_sensitive(paths_ops[8].widget,sensitive);
break;
default:
g_warning(_("paths_ops_button_set_sensitive:: invalid button specified"));
break;
......@@ -342,6 +364,8 @@ GtkWidget * paths_dialog_create()
paths_ops_button_set_sensitive(DEL_PATH_BUTTON,FALSE);
paths_ops_button_set_sensitive(STROKE_PATH_BUTTON,FALSE);
paths_ops_button_set_sensitive(PATH_TO_SEL_BUTTON,FALSE);
paths_ops_button_set_sensitive(COPY_PATH_BUTTON,FALSE);
paths_ops_button_set_sensitive(PASTE_PATH_BUTTON,FALSE);
point_ops_button_set_sensitive(POINT_ADD_BUTTON,FALSE);
point_ops_button_set_sensitive(POINT_DEL_BUTTON,FALSE);
point_ops_button_set_sensitive(POINT_NEW_BUTTON,FALSE);
......@@ -528,6 +552,23 @@ path_copy(GimpImage *gimage,PATHP p)
return p_copy;
}
static PATHPOINTP
path_start_last_seg(GSList *plist)
{
PATHPOINTP retp = plist->data;
while(plist)
{
if(((PATHPOINTP)(plist->data))->type == BEZIER_MOVE &&
g_slist_next(plist))
{
plist = g_slist_next(plist);
retp = plist->data;
}
plist = g_slist_next(plist);
}
return retp;
}
static void
path_close(PATHP bzp)
{
......@@ -552,11 +593,13 @@ path_close(PATHP bzp)
}
}
pathpoint = g_new0(PATHPOINT,1);
pdata = (PATHPOINTP)bzp->path_details->data;
pdata = path_start_last_seg(bzp->path_details);
pathpoint->type = BEZIER_CONTROL;
pathpoint->x = pdata->x;
pathpoint->y = pdata->y;
/* printf("Closing to x,y %d,%d\n",(gint)pdata->x,(gint)pdata->y); */
bzp->path_details = g_slist_append(bzp->path_details,pathpoint);
bzp->state = BEZIER_EDIT;
}
static void
......@@ -570,7 +613,8 @@ static BezierSelect *
path_to_beziersel(PATHP bzp)
{
BezierSelect *bezier_sel;
GSList *list;
BezierPoint *bpnt = NULL;
GSList *list;
if(!bzp)
{
......@@ -592,14 +636,28 @@ path_to_beziersel(PATHP bzp)
{
PATHPOINTP pdata;
pdata = (PATHPOINTP)list->data;
bezier_add_point(bezier_sel,(gint)pdata->type,(gint)pdata->x,pdata->y);
if(pdata->type == BEZIER_MOVE)
{
/* printf("Close last curve off\n"); */
bezier_sel->last_point->next = bpnt;
bpnt->prev = bezier_sel->last_point;
bezier_sel->cur_anchor = NULL;
bezier_sel->cur_control = NULL;
bpnt = NULL;
}
bezier_add_point(bezier_sel,
(gint)pdata->type,
rint(pdata->x), /* ALT add rint() */
rint(pdata->y));
if(bpnt == NULL)
bpnt = bezier_sel->last_point;
list = g_slist_next(list);
}
if ( bezier_sel->closed )
{
bezier_sel->last_point->next = bezier_sel->points;
bezier_sel->points->prev = bezier_sel->last_point;
bezier_sel->last_point->next = bpnt;
bpnt->prev = bezier_sel->last_point;
bezier_sel->cur_anchor = bezier_sel->points;
bezier_sel->cur_control = bezier_sel-> points->next;
}
......@@ -975,6 +1033,8 @@ paths_dialog_update (GimpImage* gimage)
paths_ops_button_set_sensitive(DEL_PATH_BUTTON,FALSE);
paths_ops_button_set_sensitive(STROKE_PATH_BUTTON,FALSE);
paths_ops_button_set_sensitive(PATH_TO_SEL_BUTTON,FALSE);
paths_ops_button_set_sensitive(COPY_PATH_BUTTON,FALSE);
paths_ops_button_set_sensitive(PASTE_PATH_BUTTON,FALSE);
point_ops_button_set_sensitive(POINT_ADD_BUTTON,FALSE);
point_ops_button_set_sensitive(POINT_DEL_BUTTON,FALSE);
point_ops_button_set_sensitive(POINT_NEW_BUTTON,FALSE);
......@@ -1013,6 +1073,8 @@ paths_dialog_update (GimpImage* gimage)
paths_ops_button_set_sensitive(DEL_PATH_BUTTON,FALSE);
paths_ops_button_set_sensitive(STROKE_PATH_BUTTON,FALSE);
paths_ops_button_set_sensitive(PATH_TO_SEL_BUTTON,FALSE);
paths_ops_button_set_sensitive(COPY_PATH_BUTTON,FALSE);
paths_ops_button_set_sensitive(PASTE_PATH_BUTTON,FALSE);
point_ops_button_set_sensitive(POINT_ADD_BUTTON,FALSE);
point_ops_button_set_sensitive(POINT_DEL_BUTTON,FALSE);
point_ops_button_set_sensitive(POINT_NEW_BUTTON,FALSE);
......@@ -1025,6 +1087,8 @@ paths_dialog_update (GimpImage* gimage)
paths_ops_button_set_sensitive(DEL_PATH_BUTTON,TRUE);
paths_ops_button_set_sensitive(STROKE_PATH_BUTTON,TRUE);
paths_ops_button_set_sensitive(PATH_TO_SEL_BUTTON,TRUE);
paths_ops_button_set_sensitive(COPY_PATH_BUTTON,TRUE);
paths_ops_button_set_sensitive(PASTE_PATH_BUTTON,(copy_pp)?TRUE:FALSE);
point_ops_button_set_sensitive(POINT_ADD_BUTTON,TRUE);
point_ops_button_set_sensitive(POINT_DEL_BUTTON,TRUE);
point_ops_button_set_sensitive(POINT_NEW_BUTTON,TRUE);
......@@ -1255,6 +1319,8 @@ paths_dialog_new_path_callback (GtkWidget * widget, gpointer udata)
paths_ops_button_set_sensitive(DEL_PATH_BUTTON,TRUE);
paths_ops_button_set_sensitive(STROKE_PATH_BUTTON,TRUE);
paths_ops_button_set_sensitive(PATH_TO_SEL_BUTTON,TRUE);
paths_ops_button_set_sensitive(COPY_PATH_BUTTON,TRUE);
paths_ops_button_set_sensitive(PASTE_PATH_BUTTON,(copy_pp)?TRUE:FALSE);
point_ops_button_set_sensitive(POINT_NEW_BUTTON,TRUE);
point_ops_button_set_sensitive(POINT_DEL_BUTTON,TRUE);
point_ops_button_set_sensitive(POINT_ADD_BUTTON,TRUE);
......@@ -1302,12 +1368,104 @@ paths_dialog_delete_path_callback (GtkWidget * widget, gpointer udata)
paths_ops_button_set_sensitive(DEL_PATH_BUTTON,new_sz);
paths_ops_button_set_sensitive(STROKE_PATH_BUTTON,new_sz);
paths_ops_button_set_sensitive(PATH_TO_SEL_BUTTON,new_sz);
paths_ops_button_set_sensitive(COPY_PATH_BUTTON,new_sz);
paths_ops_button_set_sensitive(PASTE_PATH_BUTTON,new_sz);
point_ops_button_set_sensitive(POINT_ADD_BUTTON,new_sz);
point_ops_button_set_sensitive(POINT_DEL_BUTTON,new_sz);
point_ops_button_set_sensitive(POINT_NEW_BUTTON,new_sz);
point_ops_button_set_sensitive(POINT_EDIT_BUTTON,new_sz);
}
static void
paths_dialog_paste_path_callback (GtkWidget * widget, gpointer udata)
{
PATHP bzp;
PATHIMAGELISTP plp;
PATHPOINTP pp;
BezierSelect * bezier_sel;
gint tmprow;
GDisplay *gdisp;
gint row = paths_dialog->selected_row_num;
g_return_if_fail(paths_dialog->current_path_list != NULL);
if(!copy_pp)
return;
/* Get current selection... ignore if none */
if(paths_dialog->selected_row_num < 0)
return;
/* Get bzpath structure */
plp = paths_dialog->current_path_list;
if(!plp)
return;
bzp = (PATHP)g_slist_nth_data(plp->bz_paths,row);
if(bzp->path_details)
{
pp = bzp->path_details->data;
pp->type = BEZIER_MOVE;
bzp->path_details = g_slist_concat(copy_pp->path_details,bzp->path_details);
}
else
{
bzp->closed = TRUE;
bzp->path_details = copy_pp->path_details;
bzp->state = copy_pp->state;
}
/* First point on new curve is a moveto */
copy_pp->path_details = NULL;
path_free(copy_pp,NULL);
copy_pp = NULL;