Index: trunk/src/Makefile.dep =================================================================== --- trunk/src/Makefile.dep (revision 4625) +++ trunk/src/Makefile.dep (revision 4626) @@ -2918,7 +2918,7 @@ box.h move.h misc_util.h data.h crosshair.h rubberband.h vtonpoint.h \ hid.h error.h drc.h buffer.h draw.h rotate.h rtree.h stub_draw_fab.h \ obj_all.h obj_pad_draw.h obj_pinvia_draw.h obj_elem_draw.h \ - obj_line_draw.h obj_arc_draw.h obj_rat_draw.h + obj_line_draw.h obj_arc_draw.h obj_rat_draw.h obj_poly_draw.h error.o: error.c ../config.h data.h globalconst.h global_typedefs.h \ pcb_bool.h unit.h layer.h attrib.h obj_all_list.h obj_arc_list.h \ obj_common.h ../src_3rd/genlist/gendlist.h flag.h obj_arc.h \ @@ -3510,7 +3510,12 @@ box.h math_helper.h move.h misc_util.h data.h crosshair.h rubberband.h \ vtonpoint.h hid.h error.h drc.h buffer.h compat_nls.h undo.h polygon.h \ rtree.h rotate.h search.h rats.h netlist.h route_style.h set.h \ - obj_poly_op.h operation.h draw.h + conf_core.h conf.h pcb-printf.h ../src_3rd/genvector/gds_char.h \ + ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ + ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ + ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ + ../src_3rd/genvector/vtp0.h list_conf.h obj_poly_op.h operation.h \ + obj_poly_draw.h draw.h obj_poly_list.o: obj_poly_list.c obj_poly_list.h obj_poly.h obj_common.h \ ../src_3rd/genlist/gendlist.h flag.h globalconst.h ../config.h attrib.h \ global_typedefs.h pcb_bool.h unit.h polyarea.h \ Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 4625) +++ trunk/src/draw.c (revision 4626) @@ -46,6 +46,7 @@ #include "obj_line_draw.h" #include "obj_arc_draw.h" #include "obj_rat_draw.h" +#include "obj_poly_draw.h" #undef NDEBUG #include @@ -332,52 +333,6 @@ r_search(PCB->Data->pin_tree, drawn_area, NULL, draw_hole_callback, NULL, NULL); } -struct poly_info { - const BoxType *drawn_area; - LayerType *layer; -}; - -static r_dir_t poly_callback(const BoxType * b, void *cl) -{ - struct poly_info *i = cl; - PolygonType *polygon = (PolygonType *) b; - static const char *color; - char buf[sizeof("#XXXXXX")]; - - if (!polygon->Clipped) - return R_DIR_NOT_FOUND; - - if (TEST_FLAG(PCB_FLAG_WARN, polygon)) - color = PCB->WarnColor; - else if (TEST_FLAG(PCB_FLAG_SELECTED, polygon)) - color = i->layer->SelectedColor; - else if (TEST_FLAG(PCB_FLAG_FOUND, polygon)) - color = PCB->ConnectedColor; - else if (TEST_FLAG(PCB_FLAG_ONPOINT, polygon)) { - assert(color != NULL); - LightenColor(color, buf, 1.75); - color = buf; - } - else - color = i->layer->Color; - gui->set_color(Output.fgGC, color); - - if ((gui->thindraw_pcb_polygon != NULL) && (conf_core.editor.thin_draw || conf_core.editor.thin_draw_poly)) - gui->thindraw_pcb_polygon(Output.fgGC, polygon, i->drawn_area); - else - gui->fill_pcb_polygon(Output.fgGC, polygon, i->drawn_area); - - /* If checking planes, thin-draw any pieces which have been clipped away */ - if (gui->thindraw_pcb_polygon != NULL && conf_core.editor.check_planes && !TEST_FLAG(PCB_FLAG_FULLPOLY, polygon)) { - PolygonType poly = *polygon; - - for (poly.Clipped = polygon->Clipped->f; poly.Clipped != polygon->Clipped; poly.Clipped = poly.Clipped->f) - gui->thindraw_pcb_polygon(Output.fgGC, &poly, i->drawn_area); - } - - return R_DIR_FOUND_CONTINUE; -} - /* --------------------------------------------------------------------------- * Draws silk layer. */ @@ -495,13 +450,13 @@ void DrawLayer(LayerTypePtr Layer, const BoxType * screen) { - struct poly_info info; + struct draw_poly_info info; info.drawn_area = screen; info.layer = Layer; /* print the non-clearing polys */ - r_search(Layer->polygon_tree, screen, NULL, poly_callback, &info, NULL); + r_search(Layer->polygon_tree, screen, NULL, draw_poly_callback, &info, NULL); if (conf_core.editor.check_planes) return; Index: trunk/src/obj_poly.c =================================================================== --- trunk/src/obj_poly.c (revision 4625) +++ trunk/src/obj_poly.c (revision 4626) @@ -38,9 +38,12 @@ #include "search.h" #include "set.h" +#include "conf_core.h" + #include "obj_poly.h" #include "obj_poly_op.h" #include "obj_poly_list.h" +#include "obj_poly_draw.h" /* TODO: get rid of these: */ #include "draw.h" @@ -629,3 +632,45 @@ AddObjectToCreateUndoList(PCB_TYPE_POLYGON, Layer, polygon, polygon); return (polygon); } + +/*** draw ***/ +r_dir_t draw_poly_callback(const BoxType * b, void *cl) +{ + struct draw_poly_info *i = cl; + PolygonType *polygon = (PolygonType *) b; + static const char *color; + char buf[sizeof("#XXXXXX")]; + + if (!polygon->Clipped) + return R_DIR_NOT_FOUND; + + if (TEST_FLAG(PCB_FLAG_WARN, polygon)) + color = PCB->WarnColor; + else if (TEST_FLAG(PCB_FLAG_SELECTED, polygon)) + color = i->layer->SelectedColor; + else if (TEST_FLAG(PCB_FLAG_FOUND, polygon)) + color = PCB->ConnectedColor; + else if (TEST_FLAG(PCB_FLAG_ONPOINT, polygon)) { + assert(color != NULL); + LightenColor(color, buf, 1.75); + color = buf; + } + else + color = i->layer->Color; + gui->set_color(Output.fgGC, color); + + if ((gui->thindraw_pcb_polygon != NULL) && (conf_core.editor.thin_draw || conf_core.editor.thin_draw_poly)) + gui->thindraw_pcb_polygon(Output.fgGC, polygon, i->drawn_area); + else + gui->fill_pcb_polygon(Output.fgGC, polygon, i->drawn_area); + + /* If checking planes, thin-draw any pieces which have been clipped away */ + if (gui->thindraw_pcb_polygon != NULL && conf_core.editor.check_planes && !TEST_FLAG(PCB_FLAG_FULLPOLY, polygon)) { + PolygonType poly = *polygon; + + for (poly.Clipped = polygon->Clipped->f; poly.Clipped != polygon->Clipped; poly.Clipped = poly.Clipped->f) + gui->thindraw_pcb_polygon(Output.fgGC, &poly, i->drawn_area); + } + + return R_DIR_FOUND_CONTINUE; +} Index: trunk/src/obj_poly_draw.h =================================================================== --- trunk/src/obj_poly_draw.h (nonexistent) +++ trunk/src/obj_poly_draw.h (revision 4626) @@ -0,0 +1,35 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Contact addresses for paper mail and Email: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/*** Standard draw of polygons ***/ + +struct draw_poly_info { + const BoxType *drawn_area; + LayerType *layer; +}; + +r_dir_t draw_poly_callback(const BoxType * b, void *cl); +