plug-ins/gfig/gfig-arc.c plug-ins/gfig/gfig-bezier.c

* plug-ins/gfig/gfig-arc.c
* plug-ins/gfig/gfig-bezier.c
* plug-ins/gfig/gfig-circle.c
* plug-ins/gfig/gfig-dialog.c
* plug-ins/gfig/gfig-dobject.c
* plug-ins/gfig/gfig-ellipse.c
* plug-ins/gfig/gfig-line.c
* plug-ins/gfig/gfig-poly.c
* plug-ins/gfig/gfig-spiral.c
* plug-ins/gfig/gfig-star.c
* plug-ins/gfig/gfig.h: makes which object is selected more obvious by
  using filled handles for the selected object.  Not perfect, but
  certainly a good hint.
This commit is contained in:
David Odin 2004-11-21 19:50:18 +00:00
parent 0622500439
commit bac40a781f
12 changed files with 98 additions and 78 deletions

View file

@ -1,3 +1,19 @@
2004-11-21 DindinX <dindinx@gimp.org>
* plug-ins/gfig/gfig-arc.c
* plug-ins/gfig/gfig-bezier.c
* plug-ins/gfig/gfig-circle.c
* plug-ins/gfig/gfig-dialog.c
* plug-ins/gfig/gfig-dobject.c
* plug-ins/gfig/gfig-ellipse.c
* plug-ins/gfig/gfig-line.c
* plug-ins/gfig/gfig-poly.c
* plug-ins/gfig/gfig-spiral.c
* plug-ins/gfig/gfig-star.c
* plug-ins/gfig/gfig.h: makes which object is selected more obvious by
using filled handles for the selected object. Not perfect, but
certainly a good hint.
2004-11-21 DindinX <dindinx@gimp.org>
* plug-ins/gfig/gfig-preview.c: call gfig_grid_colours() in the

View file

@ -344,9 +344,9 @@ arc_drawing_details (GfigObject *obj,
if (draw_cnts)
{
draw_sqr (&pnt1->pnt);
draw_sqr (&pnt2->pnt);
draw_sqr (&pnt3->pnt);
draw_sqr (&pnt1->pnt, obj == gfig_context->selected_obj);
draw_sqr (&pnt2->pnt, obj == gfig_context->selected_obj);
draw_sqr (&pnt3->pnt, obj == gfig_context->selected_obj);
}
if (do_scale)
@ -564,7 +564,7 @@ d_arc_start (GdkPoint *pnt,
{
/* Draw lines to start with -- then convert to an arc */
if (!tmp_line)
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_line_start (pnt, TRUE); /* TRUE means multiple pointed line */
}

View file

@ -196,7 +196,7 @@ d_draw_bezier (GfigObject *obj)
/* Go around all the points drawing a line from one to the next */
for (spnt = obj->points; spnt; spnt = spnt->next)
{
draw_sqr (&spnt->pnt);
draw_sqr (&spnt->pnt, obj == gfig_context->selected_obj);
line_pnts[i][0] = spnt->pnt.x;
line_pnts[i][1] = spnt->pnt.y;
i++;
@ -322,7 +322,7 @@ d_update_bezier (GdkPoint *pnt)
l_pnt = l_pnt->next;
}
draw_circle (&l_pnt->pnt);
draw_circle (&l_pnt->pnt, TRUE);
selvals.opts.showcontrol = 0;
d_draw_bezier (tmp_bezier);
l_pnt->pnt = *pnt;
@ -341,7 +341,7 @@ d_update_bezier (GdkPoint *pnt)
selvals.opts.showcontrol = saved_cnt_pnt;
/* Realy draw the control points */
draw_circle (&l_pnt->pnt);
draw_circle (&l_pnt->pnt, TRUE);
}
void
@ -379,8 +379,8 @@ d_bezier_end (GdkPoint *pnt, gint shift_down)
if (l_pnt)
{
draw_circle (&l_pnt->pnt);
draw_sqr (&l_pnt->pnt);
draw_circle (&l_pnt->pnt, TRUE);
draw_sqr (&l_pnt->pnt, TRUE);
if (bezier_closed)
{
@ -414,8 +414,8 @@ d_bezier_end (GdkPoint *pnt, gint shift_down)
{
if (!tmp_bezier->points->next)
{
draw_circle (&tmp_bezier->points->pnt);
draw_sqr (&tmp_bezier->points->pnt);
draw_circle (&tmp_bezier->points->pnt, TRUE);
draw_sqr (&tmp_bezier->points->pnt, TRUE);
}
d_draw_bezier (tmp_bezier);

View file

@ -69,8 +69,8 @@ d_draw_circle (GfigObject *obj)
}
radius = calc_radius (&center_pnt->pnt, &edge_pnt->pnt);
draw_sqr (&center_pnt->pnt);
draw_sqr (&edge_pnt->pnt);
draw_sqr (&center_pnt->pnt, obj == gfig_context->selected_obj);
draw_sqr (&edge_pnt->pnt, obj == gfig_context->selected_obj);
gfig_draw_arc (center_pnt->pnt.x, center_pnt->pnt.y, radius, radius, 0, 360);
}
@ -167,7 +167,7 @@ d_update_circle (GdkPoint *pnt)
if ((edge_pnt = center_pnt->next))
{
/* Undraw current */
draw_circle (&edge_pnt->pnt);
draw_circle (&edge_pnt->pnt, TRUE);
radius = calc_radius (&center_pnt->pnt, &edge_pnt->pnt);
gdk_draw_arc (gfig_context->preview->window,
@ -181,7 +181,7 @@ d_update_circle (GdkPoint *pnt)
360 * 64);
}
draw_circle (pnt);
draw_circle (pnt, TRUE);
edge_pnt = new_dobjpoint (pnt->x, pnt->y);
radius = calc_radius (&center_pnt->pnt, &edge_pnt->pnt);
@ -218,7 +218,7 @@ d_circle_end (GdkPoint *pnt,
}
else
{
draw_circle (pnt);
draw_circle (pnt, TRUE);
add_to_all_obj (gfig_context->current_obj, obj_creating);
}

View file

@ -689,14 +689,15 @@ gfig_save_menu_callback (GtkWidget *widget,
/* Given a point x, y draw a circle */
void
draw_circle (GdkPoint *p)
draw_circle (GdkPoint *p,
gboolean selected)
{
if (!selvals.opts.showcontrol)
return;
gdk_draw_arc (gfig_context->preview->window,
gfig_gc,
0,
selected,
p->x - SQ_SIZE/2,
p->y - SQ_SIZE/2,
SQ_SIZE,
@ -705,6 +706,23 @@ draw_circle (GdkPoint *p)
360*64);
}
/* Given a point x, y draw a square around it */
void
draw_sqr (GdkPoint *p,
gboolean selected)
{
if (!selvals.opts.showcontrol)
return;
gdk_draw_rectangle (gfig_context->preview->window,
gfig_gc,
selected,
gfig_scale_x (p->x) - SQ_SIZE / 2,
gfig_scale_y (p->y) - SQ_SIZE / 2,
SQ_SIZE,
SQ_SIZE);
}
static void
gfig_list_load_all (const gchar *path)
{
@ -1802,22 +1820,6 @@ gfig_paint_callback (void)
gfig_preview_expose (gfig_context->preview, NULL);
}
/* Given a point x, y draw a square around it */
void
draw_sqr (GdkPoint *p)
{
if (!selvals.opts.showcontrol)
return;
gdk_draw_rectangle (gfig_context->preview->window,
gfig_gc,
0,
gfig_scale_x (p->x) - SQ_SIZE / 2,
gfig_scale_y (p->y) - SQ_SIZE / 2,
SQ_SIZE,
SQ_SIZE);
}
/* Draw the grid on the screen
*/

View file

@ -791,35 +791,35 @@ object_start (GdkPoint *pnt,
case LINE:
/* Shift means we are still drawing */
if (!shift_down || !obj_creating)
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_line_start (pnt, shift_down);
break;
case CIRCLE:
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_circle_start (pnt, shift_down);
break;
case ELLIPSE:
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_ellipse_start (pnt, shift_down);
break;
case POLY:
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_poly_start (pnt, shift_down);
break;
case ARC:
d_arc_start (pnt, shift_down);
break;
case STAR:
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_star_start (pnt, shift_down);
break;
case SPIRAL:
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_spiral_start (pnt, shift_down);
break;
case BEZIER:
if (!tmp_bezier)
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_bezier_start (pnt, shift_down);
break;
default:
@ -849,30 +849,30 @@ object_end (GdkPoint *pnt,
{
case LINE:
d_line_end (pnt, shift_down);
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
break;
case CIRCLE:
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_circle_end (pnt, shift_down);
break;
case ELLIPSE:
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_ellipse_end (pnt, shift_down);
break;
case POLY:
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_poly_end (pnt, shift_down);
break;
case STAR:
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_star_end (pnt, shift_down);
break;
case ARC:
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_arc_end (pnt, shift_down);
break;
case SPIRAL:
draw_sqr (pnt);
draw_sqr (pnt, TRUE);
d_spiral_end (pnt, shift_down);
break;
case BEZIER:

View file

@ -63,8 +63,8 @@ d_draw_ellipse (GfigObject * obj)
g_warning ("Internal error - ellipse no edge pnt");
}
draw_sqr (&center_pnt->pnt);
draw_sqr (&edge_pnt->pnt);
draw_sqr (&center_pnt->pnt, obj == gfig_context->selected_obj);
draw_sqr (&edge_pnt->pnt, obj == gfig_context->selected_obj);
bound_wx = abs (center_pnt->pnt.x - edge_pnt->pnt.x);
bound_wy = abs (center_pnt->pnt.y - edge_pnt->pnt.y);
@ -206,7 +206,7 @@ d_update_ellipse (GdkPoint *pnt)
else
top_y = edge_pnt->pnt.y;
draw_circle (&edge_pnt->pnt);
draw_circle (&edge_pnt->pnt, TRUE);
gdk_draw_arc (gfig_context->preview->window,
gfig_gc,
@ -219,7 +219,7 @@ d_update_ellipse (GdkPoint *pnt)
360 * 64);
}
draw_circle (pnt);
draw_circle (pnt, TRUE);
edge_pnt = new_dobjpoint (pnt->x, pnt->y);
@ -266,7 +266,7 @@ d_ellipse_end (GdkPoint *pnt, gint shift_down)
}
else
{
draw_circle (pnt);
draw_circle (pnt, TRUE);
add_to_all_obj (gfig_context->current_obj, obj_creating);
}

View file

@ -67,13 +67,13 @@ d_draw_line (GfigObject *obj)
while (spnt && epnt)
{
draw_sqr (&spnt->pnt);
draw_sqr (&spnt->pnt, obj == gfig_context->selected_obj);
/* Go around all the points drawing a line from one to the next */
gfig_draw_line (spnt->pnt.x, spnt->pnt.y, epnt->pnt.x, epnt->pnt.y);
spnt = epnt;
epnt = epnt->next;
}
draw_sqr (&spnt->pnt);
draw_sqr (&spnt->pnt, obj = gfig_context->selected_obj);
}
void
@ -211,7 +211,7 @@ d_update_line (GdkPoint *pnt)
{
/* undraw current */
/* Draw square on point */
draw_circle (&epnt->pnt);
draw_circle (&epnt->pnt, TRUE);
gdk_draw_line (gfig_context->preview->window,
/*gfig_context->preview->style->bg_gc[GTK_STATE_NORMAL],*/
@ -225,7 +225,7 @@ d_update_line (GdkPoint *pnt)
/* draw new */
/* Draw circle on point */
draw_circle (pnt);
draw_circle (pnt, TRUE);
epnt = new_dobjpoint (pnt->x, pnt->y);
@ -261,7 +261,7 @@ d_line_end (GdkPoint *pnt,
gboolean shift_down)
{
/* Undraw the last circle */
draw_circle (pnt);
draw_circle (pnt, TRUE);
if (shift_down)
{

View file

@ -80,7 +80,7 @@ d_draw_poly (GfigObject *obj)
/* First point is the center */
/* Just draw a control point around it */
draw_sqr (&center_pnt->pnt);
draw_sqr (&center_pnt->pnt, obj == gfig_context->selected_obj);
/* Next point defines the radius */
radius_pnt = center_pnt->next; /* this defines the vertices */
@ -94,7 +94,7 @@ d_draw_poly (GfigObject *obj)
}
/* Other control point */
draw_sqr (&radius_pnt->pnt);
draw_sqr (&radius_pnt->pnt, obj == gfig_context->selected_obj);
/* Have center and radius - draw polygon */
@ -517,7 +517,7 @@ d_update_poly (GdkPoint *pnt)
if ((edge_pnt = center_pnt->next))
{
/* Undraw */
draw_circle (&edge_pnt->pnt);
draw_circle (&edge_pnt->pnt, TRUE);
selvals.opts.showcontrol = 0;
d_draw_poly (obj_creating);
@ -537,7 +537,7 @@ d_update_poly (GdkPoint *pnt)
selvals.opts.showcontrol = saved_cnt_pnt;
/* Realy draw the control points */
draw_circle (&edge_pnt->pnt);
draw_circle (&edge_pnt->pnt, TRUE);
}
void
@ -552,7 +552,7 @@ void
d_poly_end (GdkPoint *pnt,
gboolean shift_down)
{
draw_circle (pnt);
draw_circle (pnt, TRUE);
add_to_all_obj (gfig_context->current_obj, obj_creating);
obj_creating = NULL;
}

View file

@ -84,7 +84,7 @@ d_draw_spiral (GfigObject *obj)
/* First point is the center */
/* Just draw a control point around it */
draw_sqr (&center_pnt->pnt);
draw_sqr (&center_pnt->pnt, obj == gfig_context->selected_obj);
/* Next point defines the radius */
radius_pnt = center_pnt->next; /* this defines the vetices */
@ -98,7 +98,7 @@ d_draw_spiral (GfigObject *obj)
}
/* Other control point */
draw_sqr (&radius_pnt->pnt);
draw_sqr (&radius_pnt->pnt, obj == gfig_context->selected_obj);
/* Have center and radius - draw spiral */
@ -304,7 +304,7 @@ d_update_spiral (GdkPoint *pnt)
if ((edge_pnt = center_pnt->next))
{
/* Undraw */
draw_circle (&edge_pnt->pnt);
draw_circle (&edge_pnt->pnt, TRUE);
selvals.opts.showcontrol = 0;
d_draw_spiral (obj_creating);
@ -324,7 +324,7 @@ d_update_spiral (GdkPoint *pnt)
selvals.opts.showcontrol = saved_cnt_pnt;
/* Realy draw the control points */
draw_circle (&edge_pnt->pnt);
draw_circle (&edge_pnt->pnt, TRUE);
}
void
@ -339,7 +339,7 @@ void
d_spiral_end (GdkPoint *pnt,
gint shift_down)
{
draw_circle (pnt);
draw_circle (pnt, TRUE);
add_to_all_obj (gfig_context->current_obj, obj_creating);
obj_creating = NULL;
}

View file

@ -82,7 +82,7 @@ d_draw_star (GfigObject *obj)
/* First point is the center */
/* Just draw a control point around it */
draw_sqr (&center_pnt->pnt);
draw_sqr (&center_pnt->pnt, obj == gfig_context->selected_obj);
/* Next point defines the radius */
outer_radius_pnt = center_pnt->next; /* this defines the vertices */
@ -106,8 +106,8 @@ d_draw_star (GfigObject *obj)
}
/* Other control points */
draw_sqr (&outer_radius_pnt->pnt);
draw_sqr (&inner_radius_pnt->pnt);
draw_sqr (&outer_radius_pnt->pnt, obj == gfig_context->selected_obj);
draw_sqr (&inner_radius_pnt->pnt, obj == gfig_context->selected_obj);
/* Have center and radius - draw star */
@ -358,8 +358,8 @@ d_update_star (GdkPoint *pnt)
{
/* Undraw */
inner_pnt = outer_pnt->next;
draw_circle (&inner_pnt->pnt);
draw_circle (&outer_pnt->pnt);
draw_circle (&inner_pnt->pnt, TRUE);
draw_circle (&outer_pnt->pnt, TRUE);
selvals.opts.showcontrol = 0;
d_draw_star (obj_creating);
outer_pnt->pnt = *pnt;
@ -386,8 +386,8 @@ d_update_star (GdkPoint *pnt)
selvals.opts.showcontrol = saved_cnt_pnt;
/* Realy draw the control points */
draw_circle (&outer_pnt->pnt);
draw_circle (&inner_pnt->pnt);
draw_circle (&outer_pnt->pnt, TRUE);
draw_circle (&inner_pnt->pnt, TRUE);
}
void
@ -402,7 +402,7 @@ void
d_star_end (GdkPoint *pnt,
gint shift_down)
{
draw_circle (pnt);
draw_circle (pnt, TRUE);
add_to_all_obj (gfig_context->current_obj, obj_creating);
obj_creating = NULL;
}

View file

@ -176,8 +176,10 @@ void gfig_paint (BrushType brush_type,
gint seg_count,
gdouble line_pnts[]);
void draw_circle (GdkPoint *p);
void draw_sqr (GdkPoint *p);
void draw_circle (GdkPoint *p,
gboolean selected);
void draw_sqr (GdkPoint *p,
gboolean selected);
void list_button_update (GFigObj *obj);