From bac40a781f65b77e631b57bbd63cb23ef47cbb65 Mon Sep 17 00:00:00 2001 From: David Odin Date: Sun, 21 Nov 2004 19:50:18 +0000 Subject: [PATCH] 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. --- ChangeLog | 16 +++++++++++++++ plug-ins/gfig/gfig-arc.c | 8 ++++---- plug-ins/gfig/gfig-bezier.c | 14 ++++++------- plug-ins/gfig/gfig-circle.c | 10 +++++----- plug-ins/gfig/gfig-dialog.c | 38 +++++++++++++++++++----------------- plug-ins/gfig/gfig-dobject.c | 28 +++++++++++++------------- plug-ins/gfig/gfig-ellipse.c | 10 +++++----- plug-ins/gfig/gfig-line.c | 10 +++++----- plug-ins/gfig/gfig-poly.c | 10 +++++----- plug-ins/gfig/gfig-spiral.c | 10 +++++----- plug-ins/gfig/gfig-star.c | 16 +++++++-------- plug-ins/gfig/gfig.h | 6 ++++-- 12 files changed, 98 insertions(+), 78 deletions(-) diff --git a/ChangeLog b/ChangeLog index fede60aec8..ba2e746603 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2004-11-21 DindinX + + * 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 * plug-ins/gfig/gfig-preview.c: call gfig_grid_colours() in the diff --git a/plug-ins/gfig/gfig-arc.c b/plug-ins/gfig/gfig-arc.c index e80402b270..7b9030fceb 100644 --- a/plug-ins/gfig/gfig-arc.c +++ b/plug-ins/gfig/gfig-arc.c @@ -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 */ } diff --git a/plug-ins/gfig/gfig-bezier.c b/plug-ins/gfig/gfig-bezier.c index e152845a73..b0e15207de 100644 --- a/plug-ins/gfig/gfig-bezier.c +++ b/plug-ins/gfig/gfig-bezier.c @@ -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); diff --git a/plug-ins/gfig/gfig-circle.c b/plug-ins/gfig/gfig-circle.c index ddde296289..9d28245c26 100644 --- a/plug-ins/gfig/gfig-circle.c +++ b/plug-ins/gfig/gfig-circle.c @@ -69,8 +69,8 @@ d_draw_circle (GfigObject *obj) } radius = calc_radius (¢er_pnt->pnt, &edge_pnt->pnt); - draw_sqr (¢er_pnt->pnt); - draw_sqr (&edge_pnt->pnt); + draw_sqr (¢er_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 (¢er_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 (¢er_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); } diff --git a/plug-ins/gfig/gfig-dialog.c b/plug-ins/gfig/gfig-dialog.c index b7f135a6d7..66c9615a95 100644 --- a/plug-ins/gfig/gfig-dialog.c +++ b/plug-ins/gfig/gfig-dialog.c @@ -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 */ diff --git a/plug-ins/gfig/gfig-dobject.c b/plug-ins/gfig/gfig-dobject.c index 26e8ae8515..02ff71d3f9 100644 --- a/plug-ins/gfig/gfig-dobject.c +++ b/plug-ins/gfig/gfig-dobject.c @@ -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: diff --git a/plug-ins/gfig/gfig-ellipse.c b/plug-ins/gfig/gfig-ellipse.c index 9787958635..0b54854a98 100644 --- a/plug-ins/gfig/gfig-ellipse.c +++ b/plug-ins/gfig/gfig-ellipse.c @@ -63,8 +63,8 @@ d_draw_ellipse (GfigObject * obj) g_warning ("Internal error - ellipse no edge pnt"); } - draw_sqr (¢er_pnt->pnt); - draw_sqr (&edge_pnt->pnt); + draw_sqr (¢er_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); } diff --git a/plug-ins/gfig/gfig-line.c b/plug-ins/gfig/gfig-line.c index 4c02e1dec6..f1e1c814e3 100644 --- a/plug-ins/gfig/gfig-line.c +++ b/plug-ins/gfig/gfig-line.c @@ -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) { diff --git a/plug-ins/gfig/gfig-poly.c b/plug-ins/gfig/gfig-poly.c index fe07140a14..567a02cf4f 100644 --- a/plug-ins/gfig/gfig-poly.c +++ b/plug-ins/gfig/gfig-poly.c @@ -80,7 +80,7 @@ d_draw_poly (GfigObject *obj) /* First point is the center */ /* Just draw a control point around it */ - draw_sqr (¢er_pnt->pnt); + draw_sqr (¢er_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; } diff --git a/plug-ins/gfig/gfig-spiral.c b/plug-ins/gfig/gfig-spiral.c index c0462e23b4..a4cb064ff3 100644 --- a/plug-ins/gfig/gfig-spiral.c +++ b/plug-ins/gfig/gfig-spiral.c @@ -84,7 +84,7 @@ d_draw_spiral (GfigObject *obj) /* First point is the center */ /* Just draw a control point around it */ - draw_sqr (¢er_pnt->pnt); + draw_sqr (¢er_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; } diff --git a/plug-ins/gfig/gfig-star.c b/plug-ins/gfig/gfig-star.c index b369dbfe06..2e5051941a 100644 --- a/plug-ins/gfig/gfig-star.c +++ b/plug-ins/gfig/gfig-star.c @@ -82,7 +82,7 @@ d_draw_star (GfigObject *obj) /* First point is the center */ /* Just draw a control point around it */ - draw_sqr (¢er_pnt->pnt); + draw_sqr (¢er_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; } diff --git a/plug-ins/gfig/gfig.h b/plug-ins/gfig/gfig.h index d6d5b8d8cd..241eabc2bb 100644 --- a/plug-ins/gfig/gfig.h +++ b/plug-ins/gfig/gfig.h @@ -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);