Index: trunk/src/conf_core.h =================================================================== --- trunk/src/conf_core.h (revision 24055) +++ trunk/src/conf_core.h (revision 24056) @@ -53,6 +53,7 @@ CFT_BOOLEAN only_names; /* lock down everything else but text so only text objects can be moved or selected */ CFT_BOOLEAN thin_draw; /* if set, objects on the screen are drawn as outlines (lines are drawn as center-lines). This lets you see line endpoints hidden under pins, for example. */ CFT_BOOLEAN thin_draw_poly; /* if set, polygons on the screen are drawn as outlines. */ + CFT_BOOLEAN as_drawn_poly; /* if set, also draw the as-drawn outline of polygons */ CFT_BOOLEAN wireframe_draw; /* if set, lines and arcs on the screen are drawn as outlines. */ CFT_BOOLEAN local_ref; /* use local reference for moves, by setting the mark at the beginning of each move. */ CFT_BOOLEAN check_planes; /* when set, only polygons and their clearances are drawn, to see if polygons have isolated regions. */ Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 24055) +++ trunk/src/draw.c (revision 24056) @@ -66,7 +66,7 @@ int pcb_draw_force_termlab = 0; pcb_bool pcb_draw_doing_assy = pcb_false; -static vtp0_t delayed_labels, delayed_objs; +static vtp0_t delayed_labels, delayed_objs, annot_objs; pcb_bool delayed_labels_enabled = pcb_false; pcb_bool delayed_terms_enabled = pcb_false; @@ -98,7 +98,12 @@ vtp0_append(&delayed_objs, obj); } +void pcb_draw_annotation_add(pcb_any_obj_t *obj) +{ + vtp0_append(&annot_objs, obj); +} + TODO("cleanup: this should be cached") void pcb_lighten_color(const pcb_color_t *orig, pcb_color_t *dst, double factor) { @@ -560,6 +565,21 @@ vtp0_truncate(&delayed_objs, 0); } +static void pcb_draw_annotations(pcb_draw_info_t *info) +{ + size_t n; + + for(n = 0; n < annot_objs.used; n++) { + pcb_any_obj_t *o = annot_objs.array[n]; + switch(o->type) { + case PCB_OBJ_POLY: pcb_poly_draw_annotation(info, (pcb_poly_t *)o); break; + default: + assert(!"Don't know how to draw annotation for object"); + } + } + vtp0_truncate(&annot_objs, 0); +} + #include "draw_composite.c" #include "draw_ly_spec.c" @@ -658,6 +678,7 @@ if (may_have_delayed) pcb_draw_delayed_objs(info); + pcb_draw_annotations(info); out:; pcb_draw_out.active_padGC = NULL; Index: trunk/src/draw.h =================================================================== --- trunk/src/draw.h (revision 24055) +++ trunk/src/draw.h (revision 24056) @@ -93,6 +93,10 @@ extern pcb_bool delayed_terms_enabled; void pcb_draw_delay_obj_add(pcb_any_obj_t *obj); +/* Append an object to the annotatation list; annotations are drawn at the + end, after labels */ +void pcb_draw_annotation_add(pcb_any_obj_t *obj); + /* the minimum box that needs to be redrawn */ extern pcb_box_t pcb_draw_invalidated; Index: trunk/src/obj_poly.c =================================================================== --- trunk/src/obj_poly.c (revision 24055) +++ trunk/src/obj_poly.c (revision 24056) @@ -1092,6 +1092,31 @@ conf_core.appearance.term_label_size, is_poly_term_vert(poly), pcb_true, poly->term, poly->intconn); } +void pcb_poly_draw_annotation(pcb_draw_info_t *info, pcb_poly_t *poly) +{ + pcb_cardinal_t n, np; + + if (!conf_core.editor.as_drawn_poly) + return; + + if (PCB_FLAG_TEST(PCB_FLAG_SELECTED, poly)) + pcb_gui->set_color(pcb_draw_out.fgGC, &conf_core.appearance.color.selected); + else + pcb_gui->set_color(pcb_draw_out.fgGC, &conf_core.appearance.color.pin_name); + + pcb_hid_set_line_width(pcb_draw_out.fgGC, -1); + pcb_hid_set_line_cap(pcb_draw_out.fgGC, pcb_cap_round); + + if (poly->HoleIndexN > 0) + np = poly->HoleIndex[0]; + else + np = poly->PointN; + + for(n = 1; n < np; n++) + pcb_gui->draw_line(pcb_draw_out.fgGC, poly->Points[n-1].X, poly->Points[n-1].Y, poly->Points[n].X, poly->Points[n].Y); + pcb_gui->draw_line(pcb_draw_out.fgGC, poly->Points[n-1].X, poly->Points[n-1].Y, poly->Points[0].X, poly->Points[0].Y); +} + static void pcb_poly_draw_tr_offs(pcb_poly_it_t *it, pcb_coord_t offs) { int go; @@ -1165,6 +1190,9 @@ return; } + if (conf_core.editor.as_drawn_poly) + pcb_draw_annotation_add((pcb_any_obj_t *)polygon); + if ((info != NULL) && (info->xform != NULL) && (info->xform->bloat != 0)) { /* Slow dupping and recalculation every time; if we ever need this on-screen, we should cache */ trpoly = pcb_poly_draw_tr(info, polygon); Index: trunk/src/obj_poly_draw.h =================================================================== --- trunk/src/obj_poly_draw.h (revision 24055) +++ trunk/src/obj_poly_draw.h (revision 24056) @@ -40,4 +40,6 @@ void pcb_poly_invalidate_draw(pcb_layer_t *Layer, pcb_poly_t *Polygon); void pcb_poly_name_invalidate_draw(pcb_poly_t *poly); void pcb_poly_draw_label(pcb_draw_info_t *info, pcb_poly_t *poly); +void pcb_poly_draw_annotation(pcb_draw_info_t *info, pcb_poly_t *poly); + Index: trunk/src/pcb-conf.lht =================================================================== --- trunk/src/pcb-conf.lht (revision 24055) +++ trunk/src/pcb-conf.lht (revision 24056) @@ -39,6 +39,7 @@ only_names = 0 thin_draw = 0 thin_draw_poly = 0 + as_drawn_poly = 0 wireframe_draw = 0 local_ref = 0 check_planes = 0 Index: trunk/src/pcb-menu-default.lht =================================================================== --- trunk/src/pcb-menu-default.lht (revision 24055) +++ trunk/src/pcb-menu-default.lht (revision 24056) @@ -316,6 +316,7 @@ ha:Wireframe draw = { li:a={{m; d; w}; {|};}; checked=editor/wireframe_draw; action=conf(toggle, editor/wireframe_draw, design) } ha:Thin draw = { a={m; d; t}; checked=editor/thin_draw; action=conf(toggle, editor/thin_draw, design) } ha:Thin draw poly = { a={m; d; p}; checked=editor/thin_draw_poly; action=conf(toggle, editor/thin_draw_poly, design); update_on={editor/thin_draw_poly} } + ha:poly as-drawn frame annotation = { a={m; d; d}; checked=editor/as_drawn_poly; action=conf(toggle, editor/as_drawn_poly, design); update_on={editor/as_drawn_poly} } ha:Check polygons = { a={m; d; c}; checked=editor/check_planes; action=conf(toggle, editor/check_planes, design) } - ha:Lock floaters = { a={m; f; l}; checked=editor/lock_names; action=conf(toggle, editor/lock_names, design) }