mirror of https://github.com/GNOME/gimp.git
app/bezier_select.c app/bezier_selectP.h app/paths_dialog.c
Wed May 26 21:14:15 BST 1999 Andy Thomas <alt@gimp.org> * app/bezier_select.c * app/bezier_selectP.h * app/paths_dialog.c * app/rotate_tool.c * app/scale_tool.c * app/transform_core.c * app/transform_core.h * app/transform_tool.c * app/transform_tool.h Add option to show currently selected path to be displayed during the transform tool operations. (Note if > 1 path locked only the last selected path will be shown). Reduced flashing of control points during update drawing of paths. Fixed problem in transform tool rotate/scale when changing layer (used to get many gdk assert failures about "gc != NULL")
This commit is contained in:
parent
65e5597a71
commit
8fb9f79459
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
Wed May 26 21:14:15 BST 1999 Andy Thomas <alt@gimp.org>
|
||||
|
||||
* app/bezier_select.c
|
||||
* app/bezier_selectP.h
|
||||
* app/paths_dialog.c
|
||||
* app/rotate_tool.c
|
||||
* app/scale_tool.c
|
||||
* app/transform_core.c
|
||||
* app/transform_core.h
|
||||
* app/transform_tool.c
|
||||
* app/transform_tool.h
|
||||
|
||||
Add option to show currently selected path to be displayed
|
||||
during the transform tool operations. (Note if > 1 path locked
|
||||
only the last selected path will be shown).
|
||||
|
||||
Reduced flashing of control points during update drawing of paths.
|
||||
|
||||
Fixed problem in transform tool rotate/scale when changing
|
||||
layer (used to get many gdk assert failures about "gc != NULL")
|
||||
|
||||
Tue May 25 20:02:42 1999 ape@lrdpf.spacetec.no (Asbjorn Pettersen)
|
||||
|
||||
* plug-ins/gdyntext/gdyntext_ui.c: Add include <sys/types.h> for OS/2
|
||||
|
|
|
@ -163,7 +163,7 @@ static void bezier_select_draw (Tool *);
|
|||
|
||||
static void bezier_offset_point (BezierPoint *, int, int);
|
||||
static int bezier_check_point (BezierPoint *, int, int, int);
|
||||
static void bezier_draw_handles (BezierSelect *);
|
||||
static void bezier_draw_handles (BezierSelect *, gint);
|
||||
static void bezier_draw_current (BezierSelect *);
|
||||
static void bezier_draw_point (BezierSelect *, BezierPoint *, int);
|
||||
static void bezier_draw_line (BezierSelect *, BezierPoint *, BezierPoint *);
|
||||
|
@ -626,7 +626,12 @@ bezier_edit_point_on_curve(int x,
|
|||
|
||||
if (ModeEdit== EXTEND_REMOVE)
|
||||
{
|
||||
if (point_counts <= 7)
|
||||
|
||||
if(bevent->state & GDK_SHIFT_MASK)
|
||||
{
|
||||
delete_whole_curve(bezier_sel,start_pt);
|
||||
}
|
||||
else if (point_counts <= 7)
|
||||
{
|
||||
/* If we've got less then 7 points ie: 2 anchors points 4 controls
|
||||
Then the curve is minimal closed curve.
|
||||
|
@ -637,11 +642,6 @@ bezier_edit_point_on_curve(int x,
|
|||
*/
|
||||
return(0);
|
||||
}
|
||||
|
||||
if(bevent->state & GDK_SHIFT_MASK)
|
||||
{
|
||||
delete_whole_curve(bezier_sel,start_pt);
|
||||
}
|
||||
else if(!finded->prev || !finded->prev->prev)
|
||||
{
|
||||
/* This is the first point on the curve */
|
||||
|
@ -911,8 +911,8 @@ bezier_select_button_press (Tool *tool,
|
|||
|
||||
if(ModeEdit == EXTEND_REMOVE)
|
||||
{
|
||||
if(bezier_sel->num_points < 6)
|
||||
return;
|
||||
/* if(bezier_sel->num_points < 6) */
|
||||
/* return; */
|
||||
|
||||
/* erase the handles */
|
||||
bezier_sel->draw = BEZIER_DRAW_ALL;
|
||||
|
@ -985,8 +985,10 @@ bezier_select_button_press (Tool *tool,
|
|||
}
|
||||
else
|
||||
{
|
||||
bezier_sel->draw = BEZIER_DRAW_HANDLES;
|
||||
draw_core_pause (bezier_sel->core, tool);
|
||||
if(bezier_sel->cur_anchor)
|
||||
bezier_sel->cur_anchor->pointflags = 1;
|
||||
bezier_sel->draw = BEZIER_DRAW_HANDLES;
|
||||
draw_core_pause (bezier_sel->core, tool);
|
||||
|
||||
bezier_add_point (bezier_sel, BEZIER_CONTROL, (gdouble)x, (gdouble)y);
|
||||
bezier_add_point (bezier_sel, BEZIER_ANCHOR, (gdouble)x, (gdouble)y);
|
||||
|
@ -1084,6 +1086,58 @@ bezier_select_button_release (Tool *tool,
|
|||
paths_newpoint_current(bezier_sel,gdisp);
|
||||
}
|
||||
|
||||
static void
|
||||
bez_copy_points(BezierSelect *tobez,
|
||||
BezierSelect *frombez)
|
||||
{
|
||||
BezierPoint *pts;
|
||||
gint i;
|
||||
BezierPoint *bpnt = NULL;
|
||||
int need_move = 0;
|
||||
|
||||
pts = (BezierPoint *) frombez->points;
|
||||
|
||||
for (i=0; i< frombez->num_points; i++)
|
||||
{
|
||||
if(need_move)
|
||||
{
|
||||
bezier_add_point( tobez, BEZIER_MOVE, pts->x, pts->y);
|
||||
need_move = 0;
|
||||
}
|
||||
else
|
||||
bezier_add_point( tobez, pts->type, pts->x, pts->y);
|
||||
|
||||
if(pts == frombez->cur_anchor)
|
||||
tobez->cur_anchor = tobez->last_point;
|
||||
else if(pts == frombez->cur_control)
|
||||
tobez->cur_control = tobez->last_point;
|
||||
|
||||
if(bpnt == NULL)
|
||||
bpnt = tobez->last_point;
|
||||
|
||||
if(pts->next_curve)
|
||||
{
|
||||
/* printf("bezier_paste_bezierselect_to_current:: Close last curve off \n"); */
|
||||
tobez->last_point->next = bpnt;
|
||||
bpnt->prev = tobez->last_point;
|
||||
bpnt = NULL;
|
||||
need_move = 1;
|
||||
pts = pts->next_curve;
|
||||
}
|
||||
else
|
||||
{
|
||||
pts = pts->next;
|
||||
}
|
||||
}
|
||||
|
||||
if ( frombez->closed )
|
||||
{
|
||||
tobez->last_point->next = bpnt;
|
||||
bpnt->prev = tobez->last_point;
|
||||
tobez->closed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bezier_select_motion (Tool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
|
@ -1117,7 +1171,8 @@ bezier_select_motion (Tool *tool,
|
|||
bezier_sel->draw = BEZIER_DRAW_CURRENT | BEZIER_DRAW_HANDLES;
|
||||
}
|
||||
|
||||
draw_core_pause (bezier_sel->core, tool);
|
||||
|
||||
draw_core_pause (bezier_sel->core, tool);
|
||||
|
||||
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, TRUE, 0);
|
||||
|
||||
|
@ -1569,19 +1624,15 @@ bezier_select_control (Tool *tool,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bezier_select_draw (Tool *tool)
|
||||
void
|
||||
bezier_draw(GDisplay * gdisp,BezierSelect * bezier_sel)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
BezierSelect * bezier_sel;
|
||||
BezierPoint * points;
|
||||
int num_points;
|
||||
int draw_curve;
|
||||
int draw_handles;
|
||||
int draw_current;
|
||||
|
||||
gdisp = tool->gdisp_ptr;
|
||||
bezier_sel = tool->private;
|
||||
|
||||
if (!bezier_sel->draw)
|
||||
return;
|
||||
|
@ -1609,14 +1660,34 @@ bezier_select_draw (Tool *tool)
|
|||
}
|
||||
|
||||
if (draw_curve)
|
||||
bezier_draw_curve (bezier_sel,bezier_draw_segment_points,SCREEN_COORDS,NULL);
|
||||
if (draw_handles)
|
||||
bezier_draw_handles (bezier_sel);
|
||||
if (draw_current)
|
||||
bezier_draw_current (bezier_sel);
|
||||
{
|
||||
bezier_draw_curve (bezier_sel,bezier_draw_segment_points,SCREEN_COORDS,NULL);
|
||||
bezier_draw_handles (bezier_sel,1);
|
||||
}
|
||||
else if (draw_current)
|
||||
{
|
||||
bezier_draw_current (bezier_sel);
|
||||
bezier_draw_handles (bezier_sel,0);
|
||||
}
|
||||
else if (draw_handles)
|
||||
bezier_draw_handles (bezier_sel,0);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
bezier_select_draw (Tool *tool)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
BezierSelect * bezier_sel;
|
||||
|
||||
gdisp = tool->gdisp_ptr;
|
||||
bezier_sel = tool->private;
|
||||
|
||||
bezier_draw(gdisp,bezier_sel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
bezier_add_point (BezierSelect *bezier_sel,
|
||||
int type,
|
||||
|
@ -1711,7 +1782,7 @@ bezier_check_point (BezierPoint *pt,
|
|||
|
||||
|
||||
static void
|
||||
bezier_draw_handles (BezierSelect *bezier_sel)
|
||||
bezier_draw_handles (BezierSelect *bezier_sel,gint doAll)
|
||||
{
|
||||
BezierPoint * points;
|
||||
int num_points;
|
||||
|
@ -1738,7 +1809,11 @@ bezier_draw_handles (BezierSelect *bezier_sel)
|
|||
else
|
||||
{
|
||||
/* printf("bezier_draw_handles:: not found cur_anchor %p\n",points); */
|
||||
bezier_draw_point (bezier_sel, points, 1);
|
||||
if(doAll || points->pointflags == 1)
|
||||
{
|
||||
bezier_draw_point (bezier_sel, points, 1);
|
||||
points->pointflags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(points)
|
||||
|
|
|
@ -46,6 +46,9 @@ struct _bezier_point
|
|||
BezierPoint *next; /* next point on curve */
|
||||
BezierPoint *prev; /* prev point on curve */
|
||||
BezierPoint *next_curve; /* Next curve segment */
|
||||
gint pointflags; /* Status of point 0 = not selected
|
||||
* 1 = selected
|
||||
*/
|
||||
};
|
||||
|
||||
typedef struct _bezier_select BezierSelect;
|
||||
|
@ -85,5 +88,6 @@ void bezier_select_mode (gint);
|
|||
void bezier_stroke (BezierSelect *, GDisplay *, int, int);
|
||||
void bezier_to_selection (BezierSelect *, GDisplay *);
|
||||
gint bezier_distance_along (BezierSelect *, gint, gdouble,gint *,gint *,gdouble *);
|
||||
void bezier_draw (GDisplay *,BezierSelect *);
|
||||
|
||||
#endif /* __BEZIER_SELECTP_H__ */
|
||||
|
|
|
@ -2473,6 +2473,59 @@ paths_transform_current_path(GimpImage *gimage,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
paths_draw_current(GDisplay * gdisp,
|
||||
DrawCore *core,
|
||||
GimpMatrix transform)
|
||||
{
|
||||
PATHIMAGELISTP plp;
|
||||
PATHP bzp;
|
||||
BezierSelect * bezier_sel;
|
||||
PATHP p_copy;
|
||||
GSList * points_list;
|
||||
|
||||
/* Get bzpath structure */
|
||||
plp = (PATHIMAGELISTP)gimp_image_get_paths(gdisp->gimage);
|
||||
|
||||
if(!plp)
|
||||
return;
|
||||
|
||||
bzp = (PATHP)g_slist_nth_data(plp->bz_paths,plp->last_selected_row);
|
||||
|
||||
/* This image path is locked */
|
||||
if(bzp->locked)
|
||||
{
|
||||
p_copy = path_copy(NULL,bzp); /* NULL means dont want new tattoo */
|
||||
|
||||
points_list = p_copy->path_details;
|
||||
|
||||
while (points_list)
|
||||
{
|
||||
gdouble newx,newy;
|
||||
PATHPOINTP ppoint = points_list->data;
|
||||
|
||||
/* printf("[x,y] = [%g,%g]\n",ppoint->x, ppoint->y); */
|
||||
|
||||
gimp_matrix_transform_point (transform,
|
||||
ppoint->x,
|
||||
ppoint->y,
|
||||
&newx,&newy);
|
||||
|
||||
/* printf("->[x,y] = [%g,%g]\n", newx, newy); */
|
||||
|
||||
ppoint->x = newx;
|
||||
ppoint->y = newy;
|
||||
points_list = points_list->next;
|
||||
}
|
||||
|
||||
bezier_sel = path_to_beziersel(p_copy);
|
||||
bezier_sel->core = core; /* A bit hacky */
|
||||
bezier_draw(gdisp,bezier_sel);
|
||||
beziersel_free(bezier_sel);
|
||||
path_free(p_copy,NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* PDB function aids */
|
||||
/*************************************/
|
||||
|
|
|
@ -2473,6 +2473,59 @@ paths_transform_current_path(GimpImage *gimage,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
paths_draw_current(GDisplay * gdisp,
|
||||
DrawCore *core,
|
||||
GimpMatrix transform)
|
||||
{
|
||||
PATHIMAGELISTP plp;
|
||||
PATHP bzp;
|
||||
BezierSelect * bezier_sel;
|
||||
PATHP p_copy;
|
||||
GSList * points_list;
|
||||
|
||||
/* Get bzpath structure */
|
||||
plp = (PATHIMAGELISTP)gimp_image_get_paths(gdisp->gimage);
|
||||
|
||||
if(!plp)
|
||||
return;
|
||||
|
||||
bzp = (PATHP)g_slist_nth_data(plp->bz_paths,plp->last_selected_row);
|
||||
|
||||
/* This image path is locked */
|
||||
if(bzp->locked)
|
||||
{
|
||||
p_copy = path_copy(NULL,bzp); /* NULL means dont want new tattoo */
|
||||
|
||||
points_list = p_copy->path_details;
|
||||
|
||||
while (points_list)
|
||||
{
|
||||
gdouble newx,newy;
|
||||
PATHPOINTP ppoint = points_list->data;
|
||||
|
||||
/* printf("[x,y] = [%g,%g]\n",ppoint->x, ppoint->y); */
|
||||
|
||||
gimp_matrix_transform_point (transform,
|
||||
ppoint->x,
|
||||
ppoint->y,
|
||||
&newx,&newy);
|
||||
|
||||
/* printf("->[x,y] = [%g,%g]\n", newx, newy); */
|
||||
|
||||
ppoint->x = newx;
|
||||
ppoint->y = newy;
|
||||
points_list = points_list->next;
|
||||
}
|
||||
|
||||
bezier_sel = path_to_beziersel(p_copy);
|
||||
bezier_sel->core = core; /* A bit hacky */
|
||||
bezier_draw(gdisp,bezier_sel);
|
||||
beziersel_free(bezier_sel);
|
||||
path_free(p_copy,NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* PDB function aids */
|
||||
/*************************************/
|
||||
|
|
|
@ -246,10 +246,12 @@ rotate_angle_changed (GtkWidget *w,
|
|||
|
||||
if (value != transform_core->trans_info[ANGLE])
|
||||
{
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
transform_core->trans_info[ANGLE] = value;
|
||||
rotate_tool_recalc (tool, gdisp);
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -277,11 +279,13 @@ rotate_center_changed (GtkWidget *w,
|
|||
if ((cx != transform_core->cx) ||
|
||||
(cy != transform_core->cy))
|
||||
{
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
transform_core->cx = cx;
|
||||
transform_core->cy = cy;
|
||||
rotate_tool_recalc (tool, gdisp);
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -277,13 +277,15 @@ scale_size_changed (GtkWidget *w,
|
|||
(height != (transform_core->trans_info[Y1] -
|
||||
transform_core->trans_info[Y0])))
|
||||
{
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
transform_core->trans_info[X1] =
|
||||
transform_core->trans_info[X0] + width;
|
||||
transform_core->trans_info[Y1] =
|
||||
transform_core->trans_info[Y0] + height;
|
||||
scale_tool_recalc (tool, gdisp);
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ static void bezier_select_draw (Tool *);
|
|||
|
||||
static void bezier_offset_point (BezierPoint *, int, int);
|
||||
static int bezier_check_point (BezierPoint *, int, int, int);
|
||||
static void bezier_draw_handles (BezierSelect *);
|
||||
static void bezier_draw_handles (BezierSelect *, gint);
|
||||
static void bezier_draw_current (BezierSelect *);
|
||||
static void bezier_draw_point (BezierSelect *, BezierPoint *, int);
|
||||
static void bezier_draw_line (BezierSelect *, BezierPoint *, BezierPoint *);
|
||||
|
@ -626,7 +626,12 @@ bezier_edit_point_on_curve(int x,
|
|||
|
||||
if (ModeEdit== EXTEND_REMOVE)
|
||||
{
|
||||
if (point_counts <= 7)
|
||||
|
||||
if(bevent->state & GDK_SHIFT_MASK)
|
||||
{
|
||||
delete_whole_curve(bezier_sel,start_pt);
|
||||
}
|
||||
else if (point_counts <= 7)
|
||||
{
|
||||
/* If we've got less then 7 points ie: 2 anchors points 4 controls
|
||||
Then the curve is minimal closed curve.
|
||||
|
@ -637,11 +642,6 @@ bezier_edit_point_on_curve(int x,
|
|||
*/
|
||||
return(0);
|
||||
}
|
||||
|
||||
if(bevent->state & GDK_SHIFT_MASK)
|
||||
{
|
||||
delete_whole_curve(bezier_sel,start_pt);
|
||||
}
|
||||
else if(!finded->prev || !finded->prev->prev)
|
||||
{
|
||||
/* This is the first point on the curve */
|
||||
|
@ -911,8 +911,8 @@ bezier_select_button_press (Tool *tool,
|
|||
|
||||
if(ModeEdit == EXTEND_REMOVE)
|
||||
{
|
||||
if(bezier_sel->num_points < 6)
|
||||
return;
|
||||
/* if(bezier_sel->num_points < 6) */
|
||||
/* return; */
|
||||
|
||||
/* erase the handles */
|
||||
bezier_sel->draw = BEZIER_DRAW_ALL;
|
||||
|
@ -985,8 +985,10 @@ bezier_select_button_press (Tool *tool,
|
|||
}
|
||||
else
|
||||
{
|
||||
bezier_sel->draw = BEZIER_DRAW_HANDLES;
|
||||
draw_core_pause (bezier_sel->core, tool);
|
||||
if(bezier_sel->cur_anchor)
|
||||
bezier_sel->cur_anchor->pointflags = 1;
|
||||
bezier_sel->draw = BEZIER_DRAW_HANDLES;
|
||||
draw_core_pause (bezier_sel->core, tool);
|
||||
|
||||
bezier_add_point (bezier_sel, BEZIER_CONTROL, (gdouble)x, (gdouble)y);
|
||||
bezier_add_point (bezier_sel, BEZIER_ANCHOR, (gdouble)x, (gdouble)y);
|
||||
|
@ -1084,6 +1086,58 @@ bezier_select_button_release (Tool *tool,
|
|||
paths_newpoint_current(bezier_sel,gdisp);
|
||||
}
|
||||
|
||||
static void
|
||||
bez_copy_points(BezierSelect *tobez,
|
||||
BezierSelect *frombez)
|
||||
{
|
||||
BezierPoint *pts;
|
||||
gint i;
|
||||
BezierPoint *bpnt = NULL;
|
||||
int need_move = 0;
|
||||
|
||||
pts = (BezierPoint *) frombez->points;
|
||||
|
||||
for (i=0; i< frombez->num_points; i++)
|
||||
{
|
||||
if(need_move)
|
||||
{
|
||||
bezier_add_point( tobez, BEZIER_MOVE, pts->x, pts->y);
|
||||
need_move = 0;
|
||||
}
|
||||
else
|
||||
bezier_add_point( tobez, pts->type, pts->x, pts->y);
|
||||
|
||||
if(pts == frombez->cur_anchor)
|
||||
tobez->cur_anchor = tobez->last_point;
|
||||
else if(pts == frombez->cur_control)
|
||||
tobez->cur_control = tobez->last_point;
|
||||
|
||||
if(bpnt == NULL)
|
||||
bpnt = tobez->last_point;
|
||||
|
||||
if(pts->next_curve)
|
||||
{
|
||||
/* printf("bezier_paste_bezierselect_to_current:: Close last curve off \n"); */
|
||||
tobez->last_point->next = bpnt;
|
||||
bpnt->prev = tobez->last_point;
|
||||
bpnt = NULL;
|
||||
need_move = 1;
|
||||
pts = pts->next_curve;
|
||||
}
|
||||
else
|
||||
{
|
||||
pts = pts->next;
|
||||
}
|
||||
}
|
||||
|
||||
if ( frombez->closed )
|
||||
{
|
||||
tobez->last_point->next = bpnt;
|
||||
bpnt->prev = tobez->last_point;
|
||||
tobez->closed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bezier_select_motion (Tool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
|
@ -1117,7 +1171,8 @@ bezier_select_motion (Tool *tool,
|
|||
bezier_sel->draw = BEZIER_DRAW_CURRENT | BEZIER_DRAW_HANDLES;
|
||||
}
|
||||
|
||||
draw_core_pause (bezier_sel->core, tool);
|
||||
|
||||
draw_core_pause (bezier_sel->core, tool);
|
||||
|
||||
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, TRUE, 0);
|
||||
|
||||
|
@ -1569,19 +1624,15 @@ bezier_select_control (Tool *tool,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bezier_select_draw (Tool *tool)
|
||||
void
|
||||
bezier_draw(GDisplay * gdisp,BezierSelect * bezier_sel)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
BezierSelect * bezier_sel;
|
||||
BezierPoint * points;
|
||||
int num_points;
|
||||
int draw_curve;
|
||||
int draw_handles;
|
||||
int draw_current;
|
||||
|
||||
gdisp = tool->gdisp_ptr;
|
||||
bezier_sel = tool->private;
|
||||
|
||||
if (!bezier_sel->draw)
|
||||
return;
|
||||
|
@ -1609,14 +1660,34 @@ bezier_select_draw (Tool *tool)
|
|||
}
|
||||
|
||||
if (draw_curve)
|
||||
bezier_draw_curve (bezier_sel,bezier_draw_segment_points,SCREEN_COORDS,NULL);
|
||||
if (draw_handles)
|
||||
bezier_draw_handles (bezier_sel);
|
||||
if (draw_current)
|
||||
bezier_draw_current (bezier_sel);
|
||||
{
|
||||
bezier_draw_curve (bezier_sel,bezier_draw_segment_points,SCREEN_COORDS,NULL);
|
||||
bezier_draw_handles (bezier_sel,1);
|
||||
}
|
||||
else if (draw_current)
|
||||
{
|
||||
bezier_draw_current (bezier_sel);
|
||||
bezier_draw_handles (bezier_sel,0);
|
||||
}
|
||||
else if (draw_handles)
|
||||
bezier_draw_handles (bezier_sel,0);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
bezier_select_draw (Tool *tool)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
BezierSelect * bezier_sel;
|
||||
|
||||
gdisp = tool->gdisp_ptr;
|
||||
bezier_sel = tool->private;
|
||||
|
||||
bezier_draw(gdisp,bezier_sel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
bezier_add_point (BezierSelect *bezier_sel,
|
||||
int type,
|
||||
|
@ -1711,7 +1782,7 @@ bezier_check_point (BezierPoint *pt,
|
|||
|
||||
|
||||
static void
|
||||
bezier_draw_handles (BezierSelect *bezier_sel)
|
||||
bezier_draw_handles (BezierSelect *bezier_sel,gint doAll)
|
||||
{
|
||||
BezierPoint * points;
|
||||
int num_points;
|
||||
|
@ -1738,7 +1809,11 @@ bezier_draw_handles (BezierSelect *bezier_sel)
|
|||
else
|
||||
{
|
||||
/* printf("bezier_draw_handles:: not found cur_anchor %p\n",points); */
|
||||
bezier_draw_point (bezier_sel, points, 1);
|
||||
if(doAll || points->pointflags == 1)
|
||||
{
|
||||
bezier_draw_point (bezier_sel, points, 1);
|
||||
points->pointflags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(points)
|
||||
|
|
|
@ -46,6 +46,9 @@ struct _bezier_point
|
|||
BezierPoint *next; /* next point on curve */
|
||||
BezierPoint *prev; /* prev point on curve */
|
||||
BezierPoint *next_curve; /* Next curve segment */
|
||||
gint pointflags; /* Status of point 0 = not selected
|
||||
* 1 = selected
|
||||
*/
|
||||
};
|
||||
|
||||
typedef struct _bezier_select BezierSelect;
|
||||
|
@ -85,5 +88,6 @@ void bezier_select_mode (gint);
|
|||
void bezier_stroke (BezierSelect *, GDisplay *, int, int);
|
||||
void bezier_to_selection (BezierSelect *, GDisplay *);
|
||||
gint bezier_distance_along (BezierSelect *, gint, gdouble,gint *,gint *,gdouble *);
|
||||
void bezier_draw (GDisplay *,BezierSelect *);
|
||||
|
||||
#endif /* __BEZIER_SELECTP_H__ */
|
||||
|
|
|
@ -246,10 +246,12 @@ rotate_angle_changed (GtkWidget *w,
|
|||
|
||||
if (value != transform_core->trans_info[ANGLE])
|
||||
{
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
transform_core->trans_info[ANGLE] = value;
|
||||
rotate_tool_recalc (tool, gdisp);
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -277,11 +279,13 @@ rotate_center_changed (GtkWidget *w,
|
|||
if ((cx != transform_core->cx) ||
|
||||
(cy != transform_core->cy))
|
||||
{
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
transform_core->cx = cx;
|
||||
transform_core->cy = cy;
|
||||
rotate_tool_recalc (tool, gdisp);
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -277,13 +277,15 @@ scale_size_changed (GtkWidget *w,
|
|||
(height != (transform_core->trans_info[Y1] -
|
||||
transform_core->trans_info[Y0])))
|
||||
{
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
transform_core->trans_info[X1] =
|
||||
transform_core->trans_info[X0] + width;
|
||||
transform_core->trans_info[Y1] =
|
||||
transform_core->trans_info[Y0] + height;
|
||||
scale_tool_recalc (tool, gdisp);
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -246,10 +246,12 @@ rotate_angle_changed (GtkWidget *w,
|
|||
|
||||
if (value != transform_core->trans_info[ANGLE])
|
||||
{
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
transform_core->trans_info[ANGLE] = value;
|
||||
rotate_tool_recalc (tool, gdisp);
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -277,11 +279,13 @@ rotate_center_changed (GtkWidget *w,
|
|||
if ((cx != transform_core->cx) ||
|
||||
(cy != transform_core->cy))
|
||||
{
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
transform_core->cx = cx;
|
||||
transform_core->cy = cy;
|
||||
rotate_tool_recalc (tool, gdisp);
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -277,13 +277,15 @@ scale_size_changed (GtkWidget *w,
|
|||
(height != (transform_core->trans_info[Y1] -
|
||||
transform_core->trans_info[Y0])))
|
||||
{
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_pause (transform_core->core, tool);
|
||||
transform_core->trans_info[X1] =
|
||||
transform_core->trans_info[X0] + width;
|
||||
transform_core->trans_info[Y1] =
|
||||
transform_core->trans_info[Y0] + height;
|
||||
scale_tool_recalc (tool, gdisp);
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
if(transform_core->core->draw_state != INVISIBLE)
|
||||
draw_core_resume (transform_core->core, tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,9 @@ static double cubic (double, int, int, int, int);
|
|||
static void transform_core_setup_grid (Tool *);
|
||||
static void transform_core_grid_recalc (TransformCore *);
|
||||
|
||||
/* Hmmm... Should be in a headerfile but which? */
|
||||
void paths_draw_current(GDisplay *,DrawCore *,GimpMatrix);
|
||||
|
||||
|
||||
#define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \
|
||||
((1-dy) * ((1-dx)*jk + dx*j1k) + \
|
||||
|
@ -668,6 +671,9 @@ transform_core_draw (tool)
|
|||
transform_core->scy - (srh >> 1),
|
||||
srw, srh, 0, 23040);
|
||||
}
|
||||
|
||||
if(transform_tool_showpath())
|
||||
paths_draw_current(gdisp,transform_core->core,transform_core->transform);
|
||||
}
|
||||
|
||||
Tool *
|
||||
|
@ -884,6 +890,22 @@ transform_core_grid_density_changed ()
|
|||
draw_core_resume (transform_core->core, active_tool);
|
||||
}
|
||||
|
||||
void
|
||||
transform_core_showpath_changed (gint type)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
|
||||
transform_core = (TransformCore *) active_tool->private;
|
||||
|
||||
if (transform_core->function == CREATING)
|
||||
return;
|
||||
|
||||
if(type)
|
||||
draw_core_pause (transform_core->core, active_tool);
|
||||
else
|
||||
draw_core_resume (transform_core->core, active_tool);
|
||||
}
|
||||
|
||||
static void
|
||||
transform_core_grid_recalc (TransformCore *transform_core)
|
||||
{
|
||||
|
|
|
@ -140,6 +140,7 @@ Tool * transform_core_new (int, int);
|
|||
void transform_core_free (Tool *);
|
||||
void transform_core_reset (Tool *, void *);
|
||||
void transform_core_grid_density_changed (void);
|
||||
void transform_core_showpath_changed (gint);
|
||||
|
||||
/* transform functions */
|
||||
TileManager * transform_core_do (GImage *, GimpDrawable *, TileManager *, int, GimpMatrix, progress_func_t, gpointer);
|
||||
|
|
|
@ -61,6 +61,11 @@ struct _TransformOptions
|
|||
int clip;
|
||||
int clip_d;
|
||||
GtkWidget *clip_w;
|
||||
|
||||
int showpath;
|
||||
int showpath_d;
|
||||
GtkWidget *showpath_w;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -90,6 +95,23 @@ transform_show_grid_update (GtkWidget *widget,
|
|||
transform_core_grid_density_changed ();
|
||||
}
|
||||
|
||||
static void
|
||||
transform_show_path_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
static gboolean first_call = TRUE; /* eek, this hack avoids a segfult */
|
||||
|
||||
if (first_call)
|
||||
{
|
||||
first_call = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
transform_core_showpath_changed(1); /* pause */
|
||||
tool_options_toggle_update (widget, data);
|
||||
transform_core_showpath_changed(0); /* resume */
|
||||
}
|
||||
|
||||
static void
|
||||
transform_type_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -133,6 +155,8 @@ transform_options_reset (void)
|
|||
TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w),
|
||||
options->smoothing_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->showpath_w),
|
||||
options->showpath_d);
|
||||
gtk_toggle_button_set_active (((options->direction_d == TRANSFORM_TRADITIONAL) ?
|
||||
GTK_TOGGLE_BUTTON (options->direction_w[0]) :
|
||||
GTK_TOGGLE_BUTTON (options->direction_w[1])),
|
||||
|
@ -181,6 +205,7 @@ transform_options_new (void)
|
|||
transform_options_reset);
|
||||
options->type = options->type_d = ROTATE;
|
||||
options->smoothing = options->smoothing_d = TRUE;
|
||||
options->showpath = options->showpath_d = TRUE;
|
||||
options->clip = options->clip_d = FALSE;
|
||||
options->direction = options->direction_d = TRANSFORM_TRADITIONAL;
|
||||
options->grid_size = options->grid_size_d = 32;
|
||||
|
@ -230,6 +255,13 @@ transform_options_new (void)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), options->smoothing_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->smoothing_w);
|
||||
|
||||
options->showpath_w = gtk_check_button_new_with_label (_("Showpath"));
|
||||
gtk_signal_connect (GTK_OBJECT (options->showpath_w), "toggled",
|
||||
(GtkSignalFunc) transform_show_path_update,
|
||||
&options->showpath);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->showpath_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->showpath_w);
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* the right vbox */
|
||||
|
@ -388,6 +420,15 @@ transform_tool_smoothing ()
|
|||
return transform_options->smoothing;
|
||||
}
|
||||
|
||||
int
|
||||
transform_tool_showpath ()
|
||||
{
|
||||
if (!transform_options)
|
||||
return TRUE;
|
||||
else
|
||||
return transform_options->showpath;
|
||||
}
|
||||
|
||||
int
|
||||
transform_tool_clip ()
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
Tool * tools_new_transform_tool (void);
|
||||
void tools_free_transform_tool (Tool *);
|
||||
int transform_tool_smoothing (void);
|
||||
int transform_tool_showpath (void);
|
||||
int transform_tool_clip (void);
|
||||
int transform_tool_direction (void);
|
||||
int transform_tool_grid_size (void);
|
||||
|
|
|
@ -62,6 +62,9 @@ static double cubic (double, int, int, int, int);
|
|||
static void transform_core_setup_grid (Tool *);
|
||||
static void transform_core_grid_recalc (TransformCore *);
|
||||
|
||||
/* Hmmm... Should be in a headerfile but which? */
|
||||
void paths_draw_current(GDisplay *,DrawCore *,GimpMatrix);
|
||||
|
||||
|
||||
#define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \
|
||||
((1-dy) * ((1-dx)*jk + dx*j1k) + \
|
||||
|
@ -668,6 +671,9 @@ transform_core_draw (tool)
|
|||
transform_core->scy - (srh >> 1),
|
||||
srw, srh, 0, 23040);
|
||||
}
|
||||
|
||||
if(transform_tool_showpath())
|
||||
paths_draw_current(gdisp,transform_core->core,transform_core->transform);
|
||||
}
|
||||
|
||||
Tool *
|
||||
|
@ -884,6 +890,22 @@ transform_core_grid_density_changed ()
|
|||
draw_core_resume (transform_core->core, active_tool);
|
||||
}
|
||||
|
||||
void
|
||||
transform_core_showpath_changed (gint type)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
|
||||
transform_core = (TransformCore *) active_tool->private;
|
||||
|
||||
if (transform_core->function == CREATING)
|
||||
return;
|
||||
|
||||
if(type)
|
||||
draw_core_pause (transform_core->core, active_tool);
|
||||
else
|
||||
draw_core_resume (transform_core->core, active_tool);
|
||||
}
|
||||
|
||||
static void
|
||||
transform_core_grid_recalc (TransformCore *transform_core)
|
||||
{
|
||||
|
|
|
@ -140,6 +140,7 @@ Tool * transform_core_new (int, int);
|
|||
void transform_core_free (Tool *);
|
||||
void transform_core_reset (Tool *, void *);
|
||||
void transform_core_grid_density_changed (void);
|
||||
void transform_core_showpath_changed (gint);
|
||||
|
||||
/* transform functions */
|
||||
TileManager * transform_core_do (GImage *, GimpDrawable *, TileManager *, int, GimpMatrix, progress_func_t, gpointer);
|
||||
|
|
|
@ -61,6 +61,11 @@ struct _TransformOptions
|
|||
int clip;
|
||||
int clip_d;
|
||||
GtkWidget *clip_w;
|
||||
|
||||
int showpath;
|
||||
int showpath_d;
|
||||
GtkWidget *showpath_w;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -90,6 +95,23 @@ transform_show_grid_update (GtkWidget *widget,
|
|||
transform_core_grid_density_changed ();
|
||||
}
|
||||
|
||||
static void
|
||||
transform_show_path_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
static gboolean first_call = TRUE; /* eek, this hack avoids a segfult */
|
||||
|
||||
if (first_call)
|
||||
{
|
||||
first_call = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
transform_core_showpath_changed(1); /* pause */
|
||||
tool_options_toggle_update (widget, data);
|
||||
transform_core_showpath_changed(0); /* resume */
|
||||
}
|
||||
|
||||
static void
|
||||
transform_type_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -133,6 +155,8 @@ transform_options_reset (void)
|
|||
TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w),
|
||||
options->smoothing_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->showpath_w),
|
||||
options->showpath_d);
|
||||
gtk_toggle_button_set_active (((options->direction_d == TRANSFORM_TRADITIONAL) ?
|
||||
GTK_TOGGLE_BUTTON (options->direction_w[0]) :
|
||||
GTK_TOGGLE_BUTTON (options->direction_w[1])),
|
||||
|
@ -181,6 +205,7 @@ transform_options_new (void)
|
|||
transform_options_reset);
|
||||
options->type = options->type_d = ROTATE;
|
||||
options->smoothing = options->smoothing_d = TRUE;
|
||||
options->showpath = options->showpath_d = TRUE;
|
||||
options->clip = options->clip_d = FALSE;
|
||||
options->direction = options->direction_d = TRANSFORM_TRADITIONAL;
|
||||
options->grid_size = options->grid_size_d = 32;
|
||||
|
@ -230,6 +255,13 @@ transform_options_new (void)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), options->smoothing_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->smoothing_w);
|
||||
|
||||
options->showpath_w = gtk_check_button_new_with_label (_("Showpath"));
|
||||
gtk_signal_connect (GTK_OBJECT (options->showpath_w), "toggled",
|
||||
(GtkSignalFunc) transform_show_path_update,
|
||||
&options->showpath);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->showpath_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->showpath_w);
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* the right vbox */
|
||||
|
@ -388,6 +420,15 @@ transform_tool_smoothing ()
|
|||
return transform_options->smoothing;
|
||||
}
|
||||
|
||||
int
|
||||
transform_tool_showpath ()
|
||||
{
|
||||
if (!transform_options)
|
||||
return TRUE;
|
||||
else
|
||||
return transform_options->showpath;
|
||||
}
|
||||
|
||||
int
|
||||
transform_tool_clip ()
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
Tool * tools_new_transform_tool (void);
|
||||
void tools_free_transform_tool (Tool *);
|
||||
int transform_tool_smoothing (void);
|
||||
int transform_tool_showpath (void);
|
||||
int transform_tool_clip (void);
|
||||
int transform_tool_direction (void);
|
||||
int transform_tool_grid_size (void);
|
||||
|
|
Loading…
Reference in New Issue