Index: trunk/src/Makefile.dep =================================================================== --- trunk/src/Makefile.dep (revision 4626) +++ trunk/src/Makefile.dep (revision 4627) @@ -2918,7 +2918,8 @@ 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_poly_draw.h + obj_line_draw.h obj_arc_draw.h obj_rat_draw.h obj_poly_draw.h \ + obj_text_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 \ @@ -3377,7 +3378,7 @@ ../src_3rd/genvector/vtp0.h list_conf.h conf_core.h compat_nls.h \ compat_misc.h rotate.h remove.h polygon.h rtree.h undo.h obj_pinvia_op.h \ operation.h obj_pad_op.h obj_pinvia_draw.h obj_pad_draw.h \ - obj_line_draw.h obj_arc_draw.h obj_elem_op.h draw.h + obj_line_draw.h obj_arc_draw.h obj_elem_op.h draw.h obj_text_draw.h obj_elem_list.o: obj_elem_list.c ../config.h obj_elem.h obj_common.h \ ../src_3rd/genlist/gendlist.h flag.h globalconst.h attrib.h \ global_typedefs.h pcb_bool.h unit.h obj_arc_list.h obj_arc.h \ @@ -3450,7 +3451,7 @@ ../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_pad_op.h operation.h draw.h + obj_pad_op.h operation.h draw.h obj_text_draw.h obj_pad_list.o: obj_pad_list.c obj_pad_list.h obj_pad.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 ../src_3rd/genlist/gentdlist_impl.h \ @@ -3475,7 +3476,8 @@ ../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 polygon.h rtree.h compat_nls.h \ - compat_misc.h stub_vendor.h obj_pinvia_op.h operation.h draw.h + compat_misc.h stub_vendor.h obj_pinvia_op.h operation.h draw.h \ + obj_text_draw.h obj_pinvia_list.o: obj_pinvia_list.c obj_pinvia_list.h obj_pinvia.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 \ @@ -3560,7 +3562,12 @@ obj_text_list.h obj_rat_list.h obj_rat.h library.h rats_patch.h font.h \ 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_misc.h compat_nls.h \ - undo.h polygon.h rtree.h obj_text_op.h operation.h draw.h + undo.h polygon.h rtree.h obj_text_op.h operation.h draw.h \ + obj_line_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_text_list.o: obj_text_list.c obj_text_list.h obj_text.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 ../src_3rd/genlist/gentdlist_impl.h \ @@ -3929,7 +3936,8 @@ compat_nls.h stub_draw_fab.o: stub_draw_fab.c ../config.h stub_draw_fab.h hid.h \ error.h drc.h unit.h global_typedefs.h pcb_bool.h attrib.h obj_text.h \ - obj_common.h ../src_3rd/genlist/gendlist.h flag.h globalconst.h draw.h + obj_common.h ../src_3rd/genlist/gendlist.h flag.h globalconst.h \ + obj_text_draw.h rtree.h stub_mincut.o: stub_mincut.c ../config.h stub_mincut.h global_typedefs.h \ pcb_bool.h unit.h obj_pinvia.h obj_common.h \ ../src_3rd/genlist/gendlist.h flag.h globalconst.h attrib.h obj_pad.h Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 4626) +++ trunk/src/draw.c (revision 4627) @@ -47,6 +47,7 @@ #include "obj_arc_draw.h" #include "obj_rat_draw.h" #include "obj_poly_draw.h" +#include "obj_text_draw.h" #undef NDEBUG #include @@ -430,24 +431,6 @@ gui->use_mask(HID_MASK_OFF); } -static r_dir_t text_callback(const BoxType * b, void *cl) -{ - LayerType *layer = cl; - TextType *text = (TextType *) b; - int min_silk_line; - - if (TEST_FLAG(PCB_FLAG_SELECTED, text)) - gui->set_color(Output.fgGC, layer->SelectedColor); - else - gui->set_color(Output.fgGC, layer->Color); - if (layer == &PCB->Data->SILKLAYER || layer == &PCB->Data->BACKSILKLAYER) - min_silk_line = PCB->minSlk; - else - min_silk_line = PCB->minWid; - DrawTextLowLevel(text, min_silk_line); - return R_DIR_FOUND_CONTINUE; -} - void DrawLayer(LayerTypePtr Layer, const BoxType * screen) { struct draw_poly_info info; @@ -468,7 +451,7 @@ r_search(Layer->arc_tree, screen, NULL, draw_arc_callback, Layer, NULL); /* draw the layer text on screen */ - r_search(Layer->text_tree, screen, NULL, text_callback, Layer, NULL); + r_search(Layer->text_tree, screen, NULL, draw_text_callback, Layer, NULL); /* We should check for gui->gui here, but it's kinda cool seeing the auto-outline magically disappear when you first add something to @@ -563,81 +546,6 @@ } /* --------------------------------------------------------------------------- - * lowlevel drawing routine for text objects - */ -void DrawTextLowLevel(TextTypePtr Text, Coord min_line_width) -{ - Coord x = 0; - unsigned char *string = (unsigned char *) Text->TextString; - pcb_cardinal_t n; - FontTypePtr font = &PCB->Font; - - while (string && *string) { - /* draw lines if symbol is valid and data is present */ - if (*string <= MAX_FONTPOSITION && font->Symbol[*string].Valid) { - LineTypePtr line = font->Symbol[*string].Line; - LineType newline; - - for (n = font->Symbol[*string].LineN; n; n--, line++) { - /* create one line, scale, move, rotate and swap it */ - newline = *line; - newline.Point1.X = PCB_SCALE_TEXT(newline.Point1.X + x, Text->Scale); - newline.Point1.Y = PCB_SCALE_TEXT(newline.Point1.Y, Text->Scale); - newline.Point2.X = PCB_SCALE_TEXT(newline.Point2.X + x, Text->Scale); - newline.Point2.Y = PCB_SCALE_TEXT(newline.Point2.Y, Text->Scale); - newline.Thickness = PCB_SCALE_TEXT(newline.Thickness, Text->Scale / 2); - if (newline.Thickness < min_line_width) - newline.Thickness = min_line_width; - - RotateLineLowLevel(&newline, 0, 0, Text->Direction); - - /* the labels of SMD objects on the bottom - * side haven't been swapped yet, only their offset - */ - if (TEST_FLAG(PCB_FLAG_ONSOLDER, Text)) { - newline.Point1.X = SWAP_SIGN_X(newline.Point1.X); - newline.Point1.Y = SWAP_SIGN_Y(newline.Point1.Y); - newline.Point2.X = SWAP_SIGN_X(newline.Point2.X); - newline.Point2.Y = SWAP_SIGN_Y(newline.Point2.Y); - } - /* add offset and draw line */ - newline.Point1.X += Text->X; - newline.Point1.Y += Text->Y; - newline.Point2.X += Text->X; - newline.Point2.Y += Text->Y; - _draw_line(&newline); - } - - /* move on to next cursor position */ - x += (font->Symbol[*string].Width + font->Symbol[*string].Delta); - } - else { - /* the default symbol is a filled box */ - BoxType defaultsymbol = PCB->Font.DefaultSymbol; - Coord size = (defaultsymbol.X2 - defaultsymbol.X1) * 6 / 5; - - defaultsymbol.X1 = PCB_SCALE_TEXT(defaultsymbol.X1 + x, Text->Scale); - defaultsymbol.Y1 = PCB_SCALE_TEXT(defaultsymbol.Y1, Text->Scale); - defaultsymbol.X2 = PCB_SCALE_TEXT(defaultsymbol.X2 + x, Text->Scale); - defaultsymbol.Y2 = PCB_SCALE_TEXT(defaultsymbol.Y2, Text->Scale); - - RotateBoxLowLevel(&defaultsymbol, 0, 0, Text->Direction); - - /* add offset and draw box */ - defaultsymbol.X1 += Text->X; - defaultsymbol.Y1 += Text->Y; - defaultsymbol.X2 += Text->X; - defaultsymbol.Y2 += Text->Y; - gui->fill_rect(Output.fgGC, defaultsymbol.X1, defaultsymbol.Y1, defaultsymbol.X2, defaultsymbol.Y2); - - /* move on to next cursor position */ - x += size; - } - string++; - } -} - -/* --------------------------------------------------------------------------- * draw a via object */ void DrawVia(PinTypePtr Via) Index: trunk/src/obj_elem.c =================================================================== --- trunk/src/obj_elem.c (revision 4626) +++ trunk/src/obj_elem.c (revision 4627) @@ -53,6 +53,7 @@ /* TODO: remove this: */ #include "draw.h" +#include "obj_text_draw.h" /*** allocation ***/ Index: trunk/src/obj_pad.c =================================================================== --- trunk/src/obj_pad.c (revision 4626) +++ trunk/src/obj_pad.c (revision 4627) @@ -42,6 +42,7 @@ /* TODO: remove this if draw.[ch] pads are moved */ #include "draw.h" +#include "obj_text_draw.h" /*** allocation ***/ /* get next slot for a pad, allocates memory if necessary */ Index: trunk/src/obj_pinvia.c =================================================================== --- trunk/src/obj_pinvia.c (revision 4626) +++ trunk/src/obj_pinvia.c (revision 4627) @@ -41,6 +41,7 @@ /* TODO: consider removing this by moving pin/via functions here: */ #include "draw.h" +#include "obj_text_draw.h" /*** allocation ***/ Index: trunk/src/obj_text.c =================================================================== --- trunk/src/obj_text.c (revision 4626) +++ trunk/src/obj_text.c (revision 4627) @@ -42,6 +42,8 @@ /* TODO: remove this if draw.c is moved here: */ #include "draw.h" +#include "obj_line_draw.h" +#include "conf_core.h" /*** allocation ***/ /* get next slot for a text object, allocates memory if necessary */ @@ -459,3 +461,99 @@ Draw(); return (Text); } + +/*** draw ***/ + +/* --------------------------------------------------------------------------- + * lowlevel drawing routine for text objects + */ +void DrawTextLowLevel(TextTypePtr Text, Coord min_line_width) +{ + Coord x = 0; + unsigned char *string = (unsigned char *) Text->TextString; + pcb_cardinal_t n; + FontTypePtr font = &PCB->Font; + + while (string && *string) { + /* draw lines if symbol is valid and data is present */ + if (*string <= MAX_FONTPOSITION && font->Symbol[*string].Valid) { + LineTypePtr line = font->Symbol[*string].Line; + LineType newline; + + for (n = font->Symbol[*string].LineN; n; n--, line++) { + /* create one line, scale, move, rotate and swap it */ + newline = *line; + newline.Point1.X = PCB_SCALE_TEXT(newline.Point1.X + x, Text->Scale); + newline.Point1.Y = PCB_SCALE_TEXT(newline.Point1.Y, Text->Scale); + newline.Point2.X = PCB_SCALE_TEXT(newline.Point2.X + x, Text->Scale); + newline.Point2.Y = PCB_SCALE_TEXT(newline.Point2.Y, Text->Scale); + newline.Thickness = PCB_SCALE_TEXT(newline.Thickness, Text->Scale / 2); + if (newline.Thickness < min_line_width) + newline.Thickness = min_line_width; + + RotateLineLowLevel(&newline, 0, 0, Text->Direction); + + /* the labels of SMD objects on the bottom + * side haven't been swapped yet, only their offset + */ + if (TEST_FLAG(PCB_FLAG_ONSOLDER, Text)) { + newline.Point1.X = SWAP_SIGN_X(newline.Point1.X); + newline.Point1.Y = SWAP_SIGN_Y(newline.Point1.Y); + newline.Point2.X = SWAP_SIGN_X(newline.Point2.X); + newline.Point2.Y = SWAP_SIGN_Y(newline.Point2.Y); + } + /* add offset and draw line */ + newline.Point1.X += Text->X; + newline.Point1.Y += Text->Y; + newline.Point2.X += Text->X; + newline.Point2.Y += Text->Y; + _draw_line(&newline); + } + + /* move on to next cursor position */ + x += (font->Symbol[*string].Width + font->Symbol[*string].Delta); + } + else { + /* the default symbol is a filled box */ + BoxType defaultsymbol = PCB->Font.DefaultSymbol; + Coord size = (defaultsymbol.X2 - defaultsymbol.X1) * 6 / 5; + + defaultsymbol.X1 = PCB_SCALE_TEXT(defaultsymbol.X1 + x, Text->Scale); + defaultsymbol.Y1 = PCB_SCALE_TEXT(defaultsymbol.Y1, Text->Scale); + defaultsymbol.X2 = PCB_SCALE_TEXT(defaultsymbol.X2 + x, Text->Scale); + defaultsymbol.Y2 = PCB_SCALE_TEXT(defaultsymbol.Y2, Text->Scale); + + RotateBoxLowLevel(&defaultsymbol, 0, 0, Text->Direction); + + /* add offset and draw box */ + defaultsymbol.X1 += Text->X; + defaultsymbol.Y1 += Text->Y; + defaultsymbol.X2 += Text->X; + defaultsymbol.Y2 += Text->Y; + gui->fill_rect(Output.fgGC, defaultsymbol.X1, defaultsymbol.Y1, defaultsymbol.X2, defaultsymbol.Y2); + + /* move on to next cursor position */ + x += size; + } + string++; + } +} + + +r_dir_t draw_text_callback(const BoxType * b, void *cl) +{ + LayerType *layer = cl; + TextType *text = (TextType *) b; + int min_silk_line; + + if (TEST_FLAG(PCB_FLAG_SELECTED, text)) + gui->set_color(Output.fgGC, layer->SelectedColor); + else + gui->set_color(Output.fgGC, layer->Color); + if (layer == &PCB->Data->SILKLAYER || layer == &PCB->Data->BACKSILKLAYER) + min_silk_line = PCB->minSlk; + else + min_silk_line = PCB->minWid; + DrawTextLowLevel(text, min_silk_line); + return R_DIR_FOUND_CONTINUE; +} Index: trunk/src/obj_text_draw.h =================================================================== --- trunk/src/obj_text_draw.h (nonexistent) +++ trunk/src/obj_text_draw.h (revision 4627) @@ -0,0 +1,31 @@ +/* + * 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 text ***/ +#include "rtree.h" +r_dir_t draw_text_callback(const BoxType * b, void *cl); +void DrawTextLowLevel(TextTypePtr Text, Coord min_line_width); + Index: trunk/src/stub_draw_fab.c =================================================================== --- trunk/src/stub_draw_fab.c (revision 4626) +++ trunk/src/stub_draw_fab.c (revision 4627) @@ -26,7 +26,7 @@ #include "config.h" #include "stub_draw_fab.h" #include "obj_text.h" -#include "draw.h" +#include "obj_text_draw.h" int dummy_DrawFab_overhang(void) {