[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (2faae748e25224686be089375c7ea4fd4e67d86d)
The branch, master has been updated
via 2faae748e25224686be089375c7ea4fd4e67d86d (commit)
via 4341d2300851ed673b9e126092c08b6c9a4f2d4a (commit)
via 56eab5efc335a94c573dc22e79608d77cb9e727a (commit)
via 4f2631050d7980f1a9f5f30f8782ccf666a07d5d (commit)
via 4d5478cb99e6aa8689722096fb537b5f957aa117 (commit)
via a626d525b3f746ed72775b4b154bdb75afaac5e8 (commit)
via 935ae7d3248dfea3ae962ac48893630f3829a99b (commit)
via 10bcefc32529deead4e9976b8f722d7a035765aa (commit)
via b6098d179e6d571a86305d8e3e1b5a366ac73cc7 (commit)
via ec53d352153e3497a5fe3d890dd36a1d666ba121 (commit)
via a36d6037a67fb6bd5447aa6e5b569775406268a6 (commit)
from 1a7b45893e69bddff69a7d1238127a91987a51d1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
src/draw.c | 1083 +++++++++++++++++++++++++++++-------------------------------
1 files changed, 531 insertions(+), 552 deletions(-)
=================
Commit Messages
=================
commit 2faae748e25224686be089375c7ea4fd4e67d86d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" routines from real drawing routines (Text)
Moves code from DrawRegularText() into its only caller text_callback()
:100644 100644 beb607c... e3c79e3... M src/draw.c
commit 4341d2300851ed673b9e126092c08b6c9a4f2d4a
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" routines from real drawing routines (Polygons)
Moves code from DrawPlainPolygon() into its only caller poly_callback()
:100644 100644 2183dc9... beb607c... M src/draw.c
commit 56eab5efc335a94c573dc22e79608d77cb9e727a
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" routines from real drawing routines (Arcs)
:100644 100644 279108c... 2183dc9... M src/draw.c
commit 4f2631050d7980f1a9f5f30f8782ccf666a07d5d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" routines from real drawing routines (Lines)
:100644 100644 b31f6fd... 279108c... M src/draw.c
commit 4d5478cb99e6aa8689722096fb537b5f957aa117
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" from real drawing routines (Rats)
:100644 100644 9051686... b31f6fd... M src/draw.c
commit a626d525b3f746ed72775b4b154bdb75afaac5e8
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" routines from real drawing routines (Pads)
:100644 100644 f40f06d... 9051686... M src/draw.c
commit 935ae7d3248dfea3ae962ac48893630f3829a99b
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" routines from real drawing routines (Pins + Vias)
:100644 100644 b9a812e... f40f06d... M src/draw.c
commit 10bcefc32529deead4e9976b8f722d7a035765aa
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" from real drawing routines (Element Pins and Pads)
:100644 100644 d71982f... b9a812e... M src/draw.c
commit b6098d179e6d571a86305d8e3e1b5a366ac73cc7
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" from real drawing routines (Element names)
:100644 100644 75a6c8e... d71982f... M src/draw.c
commit ec53d352153e3497a5fe3d890dd36a1d666ba121
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" from real drawing routines (Element Package)
:100644 100644 2aeefc1... 75a6c8e... M src/draw.c
commit a36d6037a67fb6bd5447aa6e5b569775406268a6
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" from real drawing routines (Element)
:100644 100644 7e8690f... 2aeefc1... M src/draw.c
=========
Changes
=========
commit 2faae748e25224686be089375c7ea4fd4e67d86d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" routines from real drawing routines (Text)
Moves code from DrawRegularText() into its only caller text_callback()
diff --git a/src/draw.c b/src/draw.c
index beb607c..e3c79e3 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -89,7 +89,6 @@ static const BoxType *clip_box = NULL;
static void DrawEverything (BoxTypePtr);
static void DrawPPV (int group, const BoxType *);
static int DrawLayerGroup (int, const BoxType *);
-static void DrawRegularText (LayerTypePtr, TextTypePtr);
static void AddPart (void *);
static void SetPVColor (PinTypePtr, int);
static void DrawEMark (ElementTypePtr, LocationType, LocationType, bool);
@@ -1037,7 +1036,20 @@ DrawRats (BoxTypePtr drawn_area)
static int
text_callback (const BoxType * b, void *cl)
{
- DrawRegularText ((LayerTypePtr) cl, (TextTypePtr) b);
+ LayerType *layer = cl;
+ TextType *text = (TextType *)b;
+ int min_silk_line;
+
+ if (TEST_FLAG (SELECTEDFLAG, 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 1;
}
@@ -1188,12 +1200,6 @@ DrawTextLowLevel (TextTypePtr Text, int min_line_width)
Cardinal n;
FontTypePtr font = &PCB->Font;
- if (Gathering)
- {
- AddPart (Text);
- return;
- }
-
while (string && *string)
{
/* draw lines if symbol is valid and data is present */
@@ -1394,40 +1400,12 @@ DrawArc (LayerTypePtr Layer, ArcTypePtr Arc)
void
DrawText (LayerTypePtr Layer, TextTypePtr Text)
{
- int min_silk_line;
- if (!Layer->On)
- return;
- if (TEST_FLAG (SELECTEDFLAG, 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);
-}
+ assert (Gathering);
-/* ---------------------------------------------------------------------------
- * draws text on a layer
- */
-static void
-DrawRegularText (LayerTypePtr Layer, TextTypePtr Text)
-{
- int min_silk_line;
- if (TEST_FLAG (SELECTEDFLAG, 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);
+ AddPart (Text);
}
+
/* ---------------------------------------------------------------------------
* draws a polygon on a layer
*/
@@ -1490,7 +1468,7 @@ DrawElementName (ElementTypePtr Element)
if (TEST_FLAG (HIDENAMEFLAG, Element))
return;
- DrawTextLowLevel (&ELEMENT_TEXT (PCB, Element), PCB->minSlk);
+ DrawText (NULL, &ELEMENT_TEXT (PCB, Element));
}
/* ---------------------------------------------------------------------------
@@ -1658,13 +1636,9 @@ EraseArc (ArcTypePtr Arc)
void
EraseText (LayerTypePtr Layer, TextTypePtr Text)
{
- int min_silk_line;
- 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);
+ assert (Gathering);
+
+ AddPart (Text);
}
/* ---------------------------------------------------------------------------
@@ -1694,8 +1668,7 @@ EraseElement (ElementTypePtr Element)
EraseArc (arc);
}
END_LOOP;
- if (!TEST_FLAG (HIDENAMEFLAG, Element))
- DrawTextLowLevel (&ELEMENT_TEXT (PCB, Element), PCB->minSlk);
+ EraseElementName (Element);
EraseElementPinsAndPads (Element);
}
@@ -1729,7 +1702,7 @@ EraseElementName (ElementTypePtr Element)
if (TEST_FLAG (HIDENAMEFLAG, Element))
return;
- DrawTextLowLevel (&ELEMENT_TEXT (PCB, Element), PCB->minSlk);
+ DrawText (NULL, &ELEMENT_TEXT (PCB, Element));
}
commit 4341d2300851ed673b9e126092c08b6c9a4f2d4a
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" routines from real drawing routines (Polygons)
Moves code from DrawPlainPolygon() into its only caller poly_callback()
diff --git a/src/draw.c b/src/draw.c
index 2183dc9..beb607c 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -90,8 +90,6 @@ static void DrawEverything (BoxTypePtr);
static void DrawPPV (int group, const BoxType *);
static int DrawLayerGroup (int, const BoxType *);
static void DrawRegularText (LayerTypePtr, TextTypePtr);
-static void DrawPolygonLowLevel (PolygonTypePtr);
-static void DrawPlainPolygon (LayerTypePtr Layer, PolygonTypePtr Polygon);
static void AddPart (void *);
static void SetPVColor (PinTypePtr, int);
static void DrawEMark (ElementTypePtr, LocationType, LocationType, bool);
@@ -858,12 +856,45 @@ clearPin_callback (const BoxType * b, void *cl)
gui->fill_pcb_pv (Output.pmGC, Output.pmGC, pin, false, true);
return 1;
}
+
static int
poly_callback (const BoxType * b, void *cl)
{
LayerType *layer = cl;
+ PolygonType *polygon = (PolygonType *)b;
+ static char *color;
+
+ if (!polygon->Clipped)
+ return 0;
+
+ if (TEST_FLAG (SELECTEDFLAG, polygon))
+ color = layer->SelectedColor;
+ else if (TEST_FLAG (FOUNDFLAG, polygon))
+ color = PCB->ConnectedColor;
+ else
+ color = layer->Color;
+ gui->set_color (Output.fgGC, color);
+
+ if (gui->thindraw_pcb_polygon != NULL &&
+ (TEST_FLAG (THINDRAWFLAG, PCB) ||
+ TEST_FLAG (THINDRAWPOLYFLAG, PCB)))
+ gui->thindraw_pcb_polygon (Output.fgGC, polygon, clip_box);
+ else
+ gui->fill_pcb_polygon (Output.fgGC, polygon, clip_box);
+
+ /* If checking planes, thin-draw any pieces which have been clipped away */
+ if (gui->thindraw_pcb_polygon != NULL &&
+ TEST_FLAG (CHECKPLANESFLAG, PCB) &&
+ !TEST_FLAG (FULLPOLYFLAG, 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, clip_box);
+ }
- DrawPlainPolygon (layer, (PolygonTypePtr) b);
return 1;
}
@@ -1236,24 +1267,6 @@ DrawTextLowLevel (TextTypePtr Text, int min_line_width)
}
/* ---------------------------------------------------------------------------
- * lowlevel drawing routine for polygons
- */
-static void
-DrawPolygonLowLevel (PolygonTypePtr Polygon)
-{
- if (!Polygon->Clipped)
- return;
-
- if (Gathering)
- {
- AddPart (Polygon);
- return;
- }
-
- printf ("DrawPolygonLowLevel: Called without Gathering set!\n");
-}
-
-/* ---------------------------------------------------------------------------
* draw a via object
*/
void
@@ -1421,7 +1434,9 @@ DrawRegularText (LayerTypePtr Layer, TextTypePtr Text)
void
DrawPolygon (LayerTypePtr Layer, PolygonTypePtr Polygon)
{
- DrawPolygonLowLevel (Polygon);
+ assert (Gathering);
+
+ AddPart (Polygon);
}
int
@@ -1452,53 +1467,6 @@ thin_callback (PLINE * pl, LayerTypePtr lay, PolygonTypePtr poly)
return 0;
}
-
-/* ---------------------------------------------------------------------------
- * draws a polygon
- */
-static void
-DrawPlainPolygon (LayerTypePtr Layer, PolygonTypePtr Polygon)
-{
- static char *color;
-
- if (!Polygon->Clipped)
- return;
-
- if (Gathering)
- {
- AddPart (Polygon);
- return;
- }
-
- if (TEST_FLAG (SELECTEDFLAG, Polygon))
- color = Layer->SelectedColor;
- else if (TEST_FLAG (FOUNDFLAG, Polygon))
- color = PCB->ConnectedColor;
- else
- color = Layer->Color;
- gui->set_color (Output.fgGC, color);
-
- if (gui->thindraw_pcb_polygon != NULL &&
- (TEST_FLAG (THINDRAWFLAG, PCB) ||
- TEST_FLAG (THINDRAWPOLYFLAG, PCB)))
- gui->thindraw_pcb_polygon (Output.fgGC, Polygon, clip_box);
- else
- gui->fill_pcb_polygon (Output.fgGC, Polygon, clip_box);
-
- /* If checking planes, thin-draw any pieces which have been clipped away */
- if (gui->thindraw_pcb_polygon != NULL &&
- TEST_FLAG (CHECKPLANESFLAG, PCB) &&
- !TEST_FLAG (FULLPOLYFLAG, 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, clip_box);
- }
-}
-
/* ---------------------------------------------------------------------------
* draws an element
*/
@@ -1705,7 +1673,9 @@ EraseText (LayerTypePtr Layer, TextTypePtr Text)
void
ErasePolygon (PolygonTypePtr Polygon)
{
- DrawPolygonLowLevel (Polygon);
+ assert (Gathering);
+
+ AddPart (Polygon);
}
/* ---------------------------------------------------------------------------
commit 56eab5efc335a94c573dc22e79608d77cb9e727a
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" routines from real drawing routines (Arcs)
diff --git a/src/draw.c b/src/draw.c
index 279108c..2183dc9 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -91,7 +91,6 @@ static void DrawPPV (int group, const BoxType *);
static int DrawLayerGroup (int, const BoxType *);
static void DrawRegularText (LayerTypePtr, TextTypePtr);
static void DrawPolygonLowLevel (PolygonTypePtr);
-static void DrawArcLowLevel (ArcTypePtr);
static void DrawPlainPolygon (LayerTypePtr Layer, PolygonTypePtr Polygon);
static void AddPart (void *);
static void SetPVColor (PinTypePtr, int);
@@ -548,6 +547,45 @@ rat_callback (const BoxType * b, void *cl)
}
static void
+_draw_arc (ArcType *arc)
+{
+ if (!arc->Thickness)
+ return;
+
+ if (TEST_FLAG (THINDRAWFLAG, PCB))
+ gui->set_line_width (Output.fgGC, 0);
+ else
+ gui->set_line_width (Output.fgGC, arc->Thickness);
+ gui->set_line_cap (Output.fgGC, Trace_Cap);
+
+ gui->draw_arc (Output.fgGC, arc->X, arc->Y, arc->Width,
+ arc->Height, arc->StartAngle, arc->Delta);
+}
+
+static void
+draw_arc (LayerType *layer, ArcType *arc)
+{
+ if (TEST_FLAG (SELECTEDFLAG | FOUNDFLAG, arc))
+ {
+ if (TEST_FLAG (SELECTEDFLAG, arc))
+ gui->set_color (Output.fgGC, layer->SelectedColor);
+ else
+ gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ }
+ else
+ gui->set_color (Output.fgGC, layer->Color);
+
+ _draw_arc (arc);
+}
+
+static int
+arc_callback (const BoxType * b, void *cl)
+{
+ draw_arc ((LayerTypePtr) cl, (ArcTypePtr) b);
+ return 1;
+}
+
+static void
draw_element_package (ElementType *element)
{
/* set color and draw lines, arcs, text and pins */
@@ -568,7 +606,7 @@ draw_element_package (ElementType *element)
END_LOOP;
ARC_LOOP (element);
{
- DrawArcLowLevel (arc);
+ _draw_arc (arc);
}
END_LOOP;
}
@@ -966,13 +1004,6 @@ DrawRats (BoxTypePtr drawn_area)
}
static int
-arc_callback (const BoxType * b, void *cl)
-{
- DrawArc ((LayerTypePtr) cl, (ArcTypePtr) b);
- return 1;
-}
-
-static int
text_callback (const BoxType * b, void *cl)
{
DrawRegularText ((LayerTypePtr) cl, (TextTypePtr) b);
@@ -1223,30 +1254,6 @@ DrawPolygonLowLevel (PolygonTypePtr Polygon)
}
/* ---------------------------------------------------------------------------
- * lowlevel routine to element arcs
- */
-static void
-DrawArcLowLevel (ArcTypePtr Arc)
-{
- if (!Arc->Thickness)
- return;
- if (Gathering)
- {
- AddPart (Arc);
- return;
- }
-
- if (TEST_FLAG (THINDRAWFLAG, PCB))
- gui->set_line_width (Output.fgGC, 0);
- else
- gui->set_line_width (Output.fgGC, Arc->Thickness);
- gui->set_line_cap (Output.fgGC, Trace_Cap);
-
- gui->draw_arc (Output.fgGC, Arc->X, Arc->Y, Arc->Width,
- Arc->Height, Arc->StartAngle, Arc->Delta);
-}
-
-/* ---------------------------------------------------------------------------
* draw a via object
*/
void
@@ -1363,21 +1370,9 @@ DrawRat (RatTypePtr Line)
void
DrawArc (LayerTypePtr Layer, ArcTypePtr Arc)
{
- if (!Arc->Thickness)
- return;
- if (!Gathering)
- {
- if (TEST_FLAG (SELECTEDFLAG | FOUNDFLAG, Arc))
- {
- if (TEST_FLAG (SELECTEDFLAG, Arc))
- gui->set_color (Output.fgGC, Layer->SelectedColor);
- else
- gui->set_color (Output.fgGC, PCB->ConnectedColor);
- }
- else
- gui->set_color (Output.fgGC, Layer->Color);
- }
- DrawArcLowLevel (Arc);
+ assert (Gathering);
+
+ AddPart (Arc);
}
/* ---------------------------------------------------------------------------
@@ -1545,7 +1540,7 @@ DrawElementPackage (ElementTypePtr Element)
END_LOOP;
ARC_LOOP (Element);
{
- DrawArcLowLevel (arc);
+ DrawArc (NULL, arc);
}
END_LOOP;
}
@@ -1682,9 +1677,11 @@ EraseLine (LineTypePtr Line)
void
EraseArc (ArcTypePtr Arc)
{
+ assert (Gathering);
+
if (!Arc->Thickness)
return;
- DrawArcLowLevel (Arc);
+ AddPart (Arc);
}
/* ---------------------------------------------------------------------------
@@ -1724,7 +1721,7 @@ EraseElement (ElementTypePtr Element)
END_LOOP;
ARC_LOOP (Element);
{
- DrawArcLowLevel (arc);
+ EraseArc (arc);
}
END_LOOP;
if (!TEST_FLAG (HIDENAMEFLAG, Element))
commit 4f2631050d7980f1a9f5f30f8782ccf666a07d5d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" routines from real drawing routines (Lines)
diff --git a/src/draw.c b/src/draw.c
index b31f6fd..279108c 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -89,7 +89,6 @@ static const BoxType *clip_box = NULL;
static void DrawEverything (BoxTypePtr);
static void DrawPPV (int group, const BoxType *);
static int DrawLayerGroup (int, const BoxType *);
-static void DrawLineLowLevel (LineTypePtr);
static void DrawRegularText (LayerTypePtr, TextTypePtr);
static void DrawPolygonLowLevel (PolygonTypePtr);
static void DrawArcLowLevel (ArcTypePtr);
@@ -478,6 +477,42 @@ hole_counting_callback (const BoxType * b, void *cl)
return 1;
}
+static void
+_draw_line (LineType *line)
+{
+ gui->set_line_cap (Output.fgGC, Trace_Cap);
+ if (TEST_FLAG (THINDRAWFLAG, PCB))
+ gui->set_line_width (Output.fgGC, 0);
+ else
+ gui->set_line_width (Output.fgGC, line->Thickness);
+
+ gui->draw_line (Output.fgGC,
+ line->Point1.X, line->Point1.Y,
+ line->Point2.X, line->Point2.Y);
+}
+
+static void
+draw_line (LayerType *layer, LineType *line)
+{
+ if (TEST_FLAG (SELECTEDFLAG | FOUNDFLAG, line))
+ {
+ if (TEST_FLAG (SELECTEDFLAG, line))
+ gui->set_color (Output.fgGC, layer->SelectedColor);
+ else
+ gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ }
+ else
+ gui->set_color (Output.fgGC, layer->Color);
+ _draw_line (line);
+}
+
+static int
+line_callback (const BoxType * b, void *cl)
+{
+ draw_line ((LayerType *) cl, (LineType *) b);
+ return 1;
+}
+
static int
rat_callback (const BoxType * b, void *cl)
{
@@ -508,7 +543,7 @@ rat_callback (const BoxType * b, void *cl)
w * 2, w * 2, 0, 360);
}
else
- DrawLineLowLevel ((LineType *) rat);
+ _draw_line ((LineType *) rat);
return 1;
}
@@ -528,7 +563,7 @@ draw_element_package (ElementType *element)
/* draw lines, arcs, text and pins */
ELEMENTLINE_LOOP (element);
{
- DrawLineLowLevel (line);
+ _draw_line (line);
}
END_LOOP;
ARC_LOOP (element);
@@ -931,13 +966,6 @@ DrawRats (BoxTypePtr drawn_area)
}
static int
-line_callback (const BoxType * b, void *cl)
-{
- DrawLine ((LayerTypePtr) cl, (LineTypePtr) b);
- return 1;
-}
-
-static int
arc_callback (const BoxType * b, void *cl)
{
DrawArc ((LayerTypePtr) cl, (ArcTypePtr) b);
@@ -1088,29 +1116,6 @@ GatherPadName (PadTypePtr Pad)
}
/* ---------------------------------------------------------------------------
- * lowlevel drawing routine for lines
- */
-static void
-DrawLineLowLevel (LineTypePtr Line)
-{
- if (Gathering)
- {
- AddPart (Line);
- return;
- }
-
- gui->set_line_cap (Output.fgGC, Trace_Cap);
- if (TEST_FLAG (THINDRAWFLAG, PCB))
- gui->set_line_width (Output.fgGC, 0);
- else
- gui->set_line_width (Output.fgGC, Line->Thickness);
-
- gui->draw_line (Output.fgGC,
- Line->Point1.X, Line->Point1.Y,
- Line->Point2.X, Line->Point2.Y);
-}
-
-/* ---------------------------------------------------------------------------
* lowlevel drawing routine for text objects
*/
void
@@ -1164,7 +1169,7 @@ DrawTextLowLevel (TextTypePtr Text, int min_line_width)
newline.Point1.Y += Text->Y;
newline.Point2.X += Text->X;
newline.Point2.Y += Text->Y;
- DrawLineLowLevel (&newline);
+ _draw_line (&newline);
}
/* move on to next cursor position */
@@ -1320,19 +1325,9 @@ DrawPadName (PadTypePtr Pad)
void
DrawLine (LayerTypePtr Layer, LineTypePtr Line)
{
- if (!Gathering)
- {
- if (TEST_FLAG (SELECTEDFLAG | FOUNDFLAG, Line))
- {
- if (TEST_FLAG (SELECTEDFLAG, Line))
- gui->set_color (Output.fgGC, Layer->SelectedColor);
- else
- gui->set_color (Output.fgGC, PCB->ConnectedColor);
- }
- else
- gui->set_color (Output.fgGC, Layer->Color);
- }
- DrawLineLowLevel (Line);
+ assert (Gathering);
+
+ AddPart (Line);
}
/* ---------------------------------------------------------------------------
@@ -1359,7 +1354,7 @@ DrawRat (RatTypePtr Line)
AddPart(&b);
}
else
- DrawLineLowLevel ((LineType *) Line);
+ DrawLine (NULL, (LineType *) Line);
}
/* ---------------------------------------------------------------------------
@@ -1545,7 +1540,7 @@ DrawElementPackage (ElementTypePtr Element)
ELEMENTLINE_LOOP (Element);
{
- DrawLineLowLevel (line);
+ DrawLine (NULL, line);
}
END_LOOP;
ARC_LOOP (Element);
@@ -1607,7 +1602,7 @@ EraseRat (RatTypePtr Rat)
w * 2, w * 2, 0, 360);
}
else
- DrawLineLowLevel ((LineTypePtr) Rat);
+ _draw_line ((LineTypePtr) Rat);
}
@@ -1676,7 +1671,9 @@ ErasePinName (PinTypePtr Pin)
void
EraseLine (LineTypePtr Line)
{
- DrawLineLowLevel (Line);
+ assert (Gathering);
+
+ AddPart (Line);
}
/* ---------------------------------------------------------------------------
@@ -1722,7 +1719,7 @@ EraseElement (ElementTypePtr Element)
{
ELEMENTLINE_LOOP (Element);
{
- DrawLineLowLevel (line);
+ EraseLine (line);
}
END_LOOP;
ARC_LOOP (Element);
commit 4d5478cb99e6aa8689722096fb537b5f957aa117
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" from real drawing routines (Rats)
diff --git a/src/draw.c b/src/draw.c
index 9051686..b31f6fd 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -481,7 +481,34 @@ hole_counting_callback (const BoxType * b, void *cl)
static int
rat_callback (const BoxType * b, void *cl)
{
- DrawRat ((RatTypePtr) b);
+ RatType *rat = (RatType *)b;
+
+ if (TEST_FLAG (SELECTEDFLAG | FOUNDFLAG, rat))
+ {
+ if (TEST_FLAG (SELECTEDFLAG, rat))
+ gui->set_color (Output.fgGC, PCB->RatSelectedColor);
+ else
+ gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ }
+ else
+ gui->set_color (Output.fgGC, PCB->RatColor);
+
+ if (Settings.RatThickness < 20)
+ rat->Thickness = pixel_slop * Settings.RatThickness;
+ /* rats.c set VIAFLAG if this rat goes to a containing poly: draw a donut */
+ if (TEST_FLAG(VIAFLAG, rat))
+ {
+ int w = rat->Thickness;
+
+ if (TEST_FLAG (THINDRAWFLAG, PCB))
+ gui->set_line_width (Output.fgGC, 0);
+ else
+ gui->set_line_width (Output.fgGC, w);
+ gui->draw_arc (Output.fgGC, rat->Point1.X, rat->Point1.Y,
+ w * 2, w * 2, 0, 360);
+ }
+ else
+ DrawLineLowLevel ((LineType *) rat);
return 1;
}
@@ -1314,18 +1341,8 @@ DrawLine (LayerTypePtr Layer, LineTypePtr Line)
void
DrawRat (RatTypePtr Line)
{
- if (!Gathering)
- {
- if (TEST_FLAG (SELECTEDFLAG | FOUNDFLAG, Line))
- {
- if (TEST_FLAG (SELECTEDFLAG, Line))
- gui->set_color (Output.fgGC, PCB->RatSelectedColor);
- else
- gui->set_color (Output.fgGC, PCB->ConnectedColor);
- }
- else
- gui->set_color (Output.fgGC, PCB->RatColor);
- }
+ assert (Gathering);
+
if (Settings.RatThickness < 20)
Line->Thickness = pixel_slop * Settings.RatThickness;
/* rats.c set VIAFLAG if this rat goes to a containing poly: draw a donut */
@@ -1333,28 +1350,16 @@ DrawRat (RatTypePtr Line)
{
int w = Line->Thickness;
- if (Gathering)
- {
- BoxType b;
+ BoxType b;
- b.X1 = Line->Point1.X - w * 2 - w / 2;
- b.X2 = Line->Point1.X + w * 2 + w / 2;
- b.Y1 = Line->Point1.Y - w * 2 - w / 2;
- b.Y2 = Line->Point1.Y + w * 2 + w / 2;
- AddPart(&b);
- }
- else
- {
- if (TEST_FLAG (THINDRAWFLAG, PCB))
- gui->set_line_width (Output.fgGC, 0);
- else
- gui->set_line_width (Output.fgGC, w);
- gui->draw_arc (Output.fgGC, Line->Point1.X, Line->Point1.Y,
- w * 2, w * 2, 0, 360);
- }
+ b.X1 = Line->Point1.X - w * 2 - w / 2;
+ b.X2 = Line->Point1.X + w * 2 + w / 2;
+ b.Y1 = Line->Point1.Y - w * 2 - w / 2;
+ b.Y2 = Line->Point1.Y + w * 2 + w / 2;
+ AddPart(&b);
}
else
- DrawLineLowLevel ((LineTypePtr) Line);
+ DrawLineLowLevel ((LineType *) Line);
}
/* ---------------------------------------------------------------------------
commit a626d525b3f746ed72775b4b154bdb75afaac5e8
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" routines from real drawing routines (Pads)
diff --git a/src/draw.c b/src/draw.c
index f40f06d..9051686 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -89,8 +89,6 @@ static const BoxType *clip_box = NULL;
static void DrawEverything (BoxTypePtr);
static void DrawPPV (int group, const BoxType *);
static int DrawLayerGroup (int, const BoxType *);
-static void DrawPadLowLevel (hidGC, PadTypePtr, bool, bool);
-static void DrawPadNameLowLevel (PadTypePtr);
static void DrawLineLowLevel (LineTypePtr);
static void DrawRegularText (LayerTypePtr, TextTypePtr);
static void DrawPolygonLowLevel (PolygonTypePtr);
@@ -99,12 +97,10 @@ static void DrawPlainPolygon (LayerTypePtr Layer, PolygonTypePtr Polygon);
static void AddPart (void *);
static void SetPVColor (PinTypePtr, int);
static void DrawEMark (ElementTypePtr, LocationType, LocationType, bool);
-static void ClearPad (PadTypePtr, bool);
static void DrawMask (int side, BoxType *);
static void DrawPaste (int side, BoxType *);
static void DrawRats (BoxType *);
static void DrawSilk (int side, const BoxType *);
-static int pad_callback (const BoxType * b, void *cl);
/*--------------------------------------------------------------------------------------
* setup color for pin or via
@@ -275,6 +271,95 @@ via_callback (const BoxType * b, void *cl)
return 1;
}
+static void
+draw_pad_name (PadType *pad)
+{
+ BoxType box;
+ bool vert;
+ TextType text;
+
+ if (!pad->Name || !pad->Name[0])
+ text.TextString = EMPTY (pad->Number);
+ else
+ text.TextString = EMPTY (TEST_FLAG (SHOWNUMBERFLAG, PCB) ? pad->Number : pad->Name);
+
+ /* should text be vertical ? */
+ vert = (pad->Point1.X == pad->Point2.X);
+
+ if (vert)
+ {
+ box.X1 = pad->Point1.X - pad->Thickness / 2;
+ box.Y1 = MAX (pad->Point1.Y, pad->Point2.Y) + pad->Thickness / 2;
+ box.X1 += Settings.PinoutTextOffsetY;
+ box.Y1 -= Settings.PinoutTextOffsetX;
+ }
+ else
+ {
+ box.X1 = MIN (pad->Point1.X, pad->Point2.X) - pad->Thickness / 2;
+ box.Y1 = pad->Point1.Y - pad->Thickness / 2;
+ box.X1 += Settings.PinoutTextOffsetX;
+ box.Y1 += Settings.PinoutTextOffsetY;
+ }
+
+ gui->set_color (Output.fgGC, PCB->PinNameColor);
+
+ text.Flags = NoFlags ();
+ text.Scale = pad->Thickness / 50;
+ text.X = box.X1;
+ text.Y = box.Y1;
+ text.Direction = vert ? 1 : 0;
+
+ DrawTextLowLevel (&text, 0);
+}
+
+static void
+_draw_pad (hidGC gc, PadType *pad, bool clear, bool mask)
+{
+ if (clear && !mask && pad->Clearance <= 0)
+ return;
+
+ if (TEST_FLAG (THINDRAWFLAG, PCB) ||
+ (clear && TEST_FLAG (THINDRAWPOLYFLAG, PCB)))
+ gui->thindraw_pcb_pad (gc, pad, clear, mask);
+ else
+ gui->fill_pcb_pad (gc, pad, clear, mask);
+}
+
+static void
+draw_pad (PadType *pad)
+{
+ if (doing_pinout)
+ gui->set_color (Output.fgGC, PCB->PinColor);
+ else if (TEST_FLAG (WARNFLAG | SELECTEDFLAG | FOUNDFLAG, pad))
+ {
+ if (TEST_FLAG (WARNFLAG, pad))
+ gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pad))
+ gui->set_color (Output.fgGC, PCB->PinSelectedColor);
+ else
+ gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ }
+ else if (FRONT (pad))
+ gui->set_color (Output.fgGC, PCB->PinColor);
+ else
+ gui->set_color (Output.fgGC, PCB->InvisibleObjectsColor);
+
+ _draw_pad (Output.fgGC, pad, false, false);
+
+ if (doing_pinout || TEST_FLAG (DISPLAYNAMEFLAG, pad))
+ draw_pad_name (pad);
+}
+
+static int
+pad_callback (const BoxType * b, void *cl)
+{
+ PadTypePtr pad = (PadTypePtr) b;
+ int *side = cl;
+
+ if (ON_SIDE (pad, *side))
+ draw_pad (pad);
+ return 1;
+}
static void
draw_element_name (ElementType *element)
@@ -314,7 +399,7 @@ draw_element_pins_and_pads (ElementType *element)
PAD_LOOP (element);
{
if (doing_pinout || doing_assy || FRONT (pad) || PCB->InvisibleObjectsOn)
- DrawPad (pad);
+ draw_pad (pad);
}
END_LOOP;
PIN_LOOP (element);
@@ -623,17 +708,6 @@ DrawEMark (ElementTypePtr e, LocationType X, LocationType Y,
}
}
-static int
-pad_callback (const BoxType * b, void *cl)
-{
- PadTypePtr pad = (PadTypePtr) b;
- int *side = cl;
-
- if (ON_SIDE (pad, *side))
- DrawPad (pad);
- return 1;
-}
-
/* ---------------------------------------------------------------------------
* Draws pins pads and vias - Always draws for non-gui HIDs,
* otherwise drawing depends on PCB->PinOn and PCB->ViaOn
@@ -699,7 +773,7 @@ clearPad_callback (const BoxType * b, void *cl)
PadTypePtr pad = (PadTypePtr) b;
int *side = cl;
if (ON_SIDE (pad, *side) && pad->Mask)
- ClearPad (pad, true);
+ _draw_pad (Output.pmGC, pad, true, true);
return 1;
}
@@ -804,9 +878,9 @@ DrawPaste (int side, BoxType *drawn_area)
if (ON_SIDE (pad, side) && !TEST_FLAG (NOPASTEFLAG, pad) && pad->Mask > 0)
{
if (pad->Mask < pad->Thickness)
- DrawPadLowLevel (Output.fgGC, pad, true, true);
+ _draw_pad (Output.fgGC, pad, true, true);
else
- DrawPadLowLevel (Output.fgGC, pad, false, false);
+ _draw_pad (Output.fgGC, pad, false, false);
}
}
ENDALL_LOOP;
@@ -924,9 +998,6 @@ DrawLayerGroup (int group, const BoxType *drawn_area)
return rv;
}
-/* ---------------------------------------------------------------------------
- * lowlevel drawing routine for pin and via names
- */
static void
GatherPVName (PinTypePtr Ptr)
{
@@ -957,107 +1028,36 @@ GatherPVName (PinTypePtr Ptr)
AddPart (&box);
}
-/* ---------------------------------------------------------------------------
- * lowlevel drawing routine for pads
- */
-
-static void
-DrawPadLowLevel (hidGC gc, PadTypePtr Pad, bool clear, bool mask)
-{
- if (Gathering)
- {
- AddPart (Pad);
- return;
- }
-
- if (clear && !mask && Pad->Clearance <= 0)
- return;
-
- if (TEST_FLAG (THINDRAWFLAG, PCB) ||
- (clear && TEST_FLAG (THINDRAWPOLYFLAG, PCB)))
- gui->thindraw_pcb_pad (gc, Pad, clear, mask);
- else
- gui->fill_pcb_pad (gc, Pad, clear, mask);
-}
-
-/* ---------------------------------------------------------------------------
- * lowlevel drawing routine for pad names
- */
-
static void
-DrawPadNameLowLevel (PadTypePtr Pad)
+GatherPadName (PadTypePtr Pad)
{
BoxType box;
- char *name;
bool vert;
- TextType text;
-
- if (!Pad->Name || !Pad->Name[0])
- name = (char *)EMPTY (Pad->Number);
- else
- name = (char *)EMPTY (TEST_FLAG (SHOWNUMBERFLAG, PCB) ? Pad->Number : Pad->Name);
/* should text be vertical ? */
vert = (Pad->Point1.X == Pad->Point2.X);
if (vert)
{
- box.X1 = Pad->Point1.X - Pad->Thickness / 2;
+ box.X1 = Pad->Point1.X - Pad->Thickness / 2;
box.Y1 = MAX (Pad->Point1.Y, Pad->Point2.Y) + Pad->Thickness / 2;
- }
- else
- {
- box.X1 = MIN (Pad->Point1.X, Pad->Point2.X) - Pad->Thickness / 2;
- box.Y1 = Pad->Point1.Y - Pad->Thickness / 2;
- }
-
- if (vert)
- {
box.X1 += Settings.PinoutTextOffsetY;
box.Y1 -= Settings.PinoutTextOffsetX;
+ box.X2 = box.X1;
+ box.Y2 = box.Y1;
}
else
{
+ box.X1 = MIN (Pad->Point1.X, Pad->Point2.X) - Pad->Thickness / 2;
+ box.Y1 = Pad->Point1.Y - Pad->Thickness / 2;
box.X1 += Settings.PinoutTextOffsetX;
box.Y1 += Settings.PinoutTextOffsetY;
+ box.X2 = box.X1;
+ box.Y2 = box.Y1;
}
- if (Gathering)
- {
- if (vert)
- {
- box.X2 = box.X1;
- box.Y2 = box.Y1;
- }
- else
- {
- box.X2 = box.X1;
- box.Y2 = box.Y1;
- }
- AddPart (&box);
- return;
- }
-
- gui->set_color (Output.fgGC, PCB->PinNameColor);
-
- text.Flags = NoFlags ();
- text.Scale = Pad->Thickness / 50;
- text.X = box.X1;
- text.Y = box.Y1;
- text.Direction = vert ? 1 : 0;
- text.TextString = name;
-
- DrawTextLowLevel (&text, 0);
-
-}
-
-/* ---------------------------------------------------------------------------
- * clearance for pads
- */
-static void
-ClearPad (PadTypePtr Pad, bool mask)
-{
- DrawPadLowLevel(Output.pmGC, Pad, true, mask);
+ AddPart (&box);
+ return;
}
/* ---------------------------------------------------------------------------
@@ -1269,27 +1269,11 @@ DrawPinName (PinTypePtr Pin)
void
DrawPad (PadTypePtr Pad)
{
- if (!Gathering)
- {
- if (doing_pinout)
- gui->set_color (Output.fgGC, PCB->PinColor);
- else if (TEST_FLAG (WARNFLAG | SELECTEDFLAG | FOUNDFLAG, Pad))
- {
- if (TEST_FLAG (WARNFLAG, Pad))
- gui->set_color (Output.fgGC, PCB->WarnColor);
- else if (TEST_FLAG (SELECTEDFLAG, Pad))
- gui->set_color (Output.fgGC, PCB->PinSelectedColor);
- else
- gui->set_color (Output.fgGC, PCB->ConnectedColor);
- }
- else if (FRONT (Pad))
- gui->set_color (Output.fgGC, PCB->PinColor);
- else
- gui->set_color (Output.fgGC, PCB->InvisibleObjectsColor);
- }
- DrawPadLowLevel (Output.fgGC, Pad, false, false);
+ assert (Gathering);
+
+ AddPart (Pad);
if (doing_pinout || TEST_FLAG (DISPLAYNAMEFLAG, Pad))
- DrawPadNameLowLevel (Pad);
+ DrawPadName (Pad);
}
/* ---------------------------------------------------------------------------
@@ -1298,16 +1282,9 @@ DrawPad (PadTypePtr Pad)
void
DrawPadName (PadTypePtr Pad)
{
- if (!Gathering)
- {
- if (TEST_FLAG (SELECTEDFLAG, Pad))
- gui->set_color (Output.fgGC, PCB->PinSelectedColor);
- else if (FRONT (Pad))
- gui->set_color (Output.fgGC, PCB->PinColor);
- else
- gui->set_color (Output.fgGC, PCB->InvisibleObjectsColor);
- }
- DrawPadNameLowLevel (Pad);
+ assert (Gathering);
+
+ GatherPadName (Pad);
}
/* ---------------------------------------------------------------------------
@@ -1646,9 +1623,11 @@ EraseViaName (PinTypePtr Via)
void
ErasePad (PadTypePtr Pad)
{
- DrawPadLowLevel (Output.fgGC, Pad, false, false);
+ assert (Gathering);
+
+ AddPart (Pad);
if (TEST_FLAG (DISPLAYNAMEFLAG, Pad))
- DrawPadNameLowLevel (Pad);
+ ErasePadName (Pad);
}
/* ---------------------------------------------------------------------------
@@ -1657,7 +1636,9 @@ ErasePad (PadTypePtr Pad)
void
ErasePadName (PadTypePtr Pad)
{
- DrawPadNameLowLevel (Pad);
+ assert (Gathering);
+
+ GatherPadName (Pad);
}
/* ---------------------------------------------------------------------------
@@ -1764,9 +1745,7 @@ EraseElementPinsAndPads (ElementTypePtr Element)
END_LOOP;
PAD_LOOP (Element);
{
- DrawPadLowLevel (Output.fgGC, pad, false, false);
- if (TEST_FLAG (DISPLAYNAMEFLAG, pad))
- DrawPadNameLowLevel (pad);
+ ErasePad (pad);
}
END_LOOP;
}
commit 935ae7d3248dfea3ae962ac48893630f3829a99b
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" routines from real drawing routines (Pins + Vias)
diff --git a/src/draw.c b/src/draw.c
index b9a812e..f40f06d 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -34,6 +34,9 @@
#include "config.h"
#endif
+#undef NDEBUG
+#include <assert.h>
+
#include "global.h"
/*#include "clip.h"*/
@@ -86,8 +89,6 @@ static const BoxType *clip_box = NULL;
static void DrawEverything (BoxTypePtr);
static void DrawPPV (int group, const BoxType *);
static int DrawLayerGroup (int, const BoxType *);
-static void DrawPinOrViaLowLevel (PinTypePtr, bool);
-static void DrawPinOrViaNameLowLevel (PinTypePtr);
static void DrawPadLowLevel (hidGC, PadTypePtr, bool, bool);
static void DrawPadNameLowLevel (PadTypePtr);
static void DrawLineLowLevel (LineTypePtr);
@@ -103,8 +104,6 @@ static void DrawMask (int side, BoxType *);
static void DrawPaste (int side, BoxType *);
static void DrawRats (BoxType *);
static void DrawSilk (int side, const BoxType *);
-static int via_callback (const BoxType * b, void *cl);
-static int pin_callback (const BoxType * b, void *cl);
static int pad_callback (const BoxType * b, void *cl);
/*--------------------------------------------------------------------------------------
@@ -195,6 +194,89 @@ Redraw (void)
}
static void
+_draw_pv_name (PinType *pv)
+{
+ BoxType box;
+ bool vert;
+ TextType text;
+
+ assert (!Gathering);
+
+ if (!pv->Name || !pv->Name[0])
+ text.TextString = EMPTY (pv->Number);
+ else
+ text.TextString = EMPTY (TEST_FLAG (SHOWNUMBERFLAG, PCB) ? pv->Number : pv->Name);
+
+ vert = TEST_FLAG (EDGE2FLAG, pv);
+
+ if (vert)
+ {
+ box.X1 = pv->X - pv->Thickness / 2 + Settings.PinoutTextOffsetY;
+ box.Y1 = pv->Y - pv->DrillingHole / 2 - Settings.PinoutTextOffsetX;
+ }
+ else
+ {
+ box.X1 = pv->X + pv->DrillingHole / 2 + Settings.PinoutTextOffsetX;
+ box.Y1 = pv->Y - pv->Thickness / 2 + Settings.PinoutTextOffsetY;
+ }
+
+ gui->set_color (Output.fgGC, PCB->PinNameColor);
+
+ text.Flags = NoFlags ();
+ text.Scale = pv->Thickness / 80;
+ text.X = box.X1;
+ text.Y = box.Y1;
+ text.Direction = vert ? 1 : 0;
+
+ if (gui->gui)
+ doing_pinout++;
+ DrawTextLowLevel (&text, 0);
+ if (gui->gui)
+ doing_pinout--;
+}
+
+static void
+_draw_pv (PinTypePtr pv, bool draw_hole)
+{
+ if (TEST_FLAG (THINDRAWFLAG, PCB))
+ gui->thindraw_pcb_pv (Output.fgGC, Output.fgGC, pv, draw_hole, false);
+ else
+ gui->fill_pcb_pv (Output.fgGC, Output.bgGC, pv, draw_hole, false);
+
+ if (!TEST_FLAG (HOLEFLAG, pv) && TEST_FLAG (DISPLAYNAMEFLAG, pv))
+ _draw_pv_name (pv);
+}
+
+static void
+draw_pin (PinTypePtr pin, bool draw_hole)
+{
+ SetPVColor (pin, PIN_TYPE);
+ _draw_pv (pin, draw_hole);
+}
+
+static int
+pin_callback (const BoxType * b, void *cl)
+{
+ draw_pin ((PinType *)b, false);
+ return 1;
+}
+
+static void
+draw_via (PinTypePtr via, bool draw_hole)
+{
+ SetPVColor (via, VIA_TYPE);
+ _draw_pv (via, draw_hole);
+}
+
+static int
+via_callback (const BoxType * b, void *cl)
+{
+ draw_via ((PinType *)b, false);
+ return 1;
+}
+
+
+static void
draw_element_name (ElementType *element)
{
if ((TEST_FLAG (HIDENAMESFLAG, PCB) && gui->gui) ||
@@ -237,7 +319,7 @@ draw_element_pins_and_pads (ElementType *element)
END_LOOP;
PIN_LOOP (element);
{
- DrawPin (pin);
+ draw_pin (pin, true);
}
END_LOOP;
}
@@ -539,29 +621,6 @@ DrawEMark (ElementTypePtr e, LocationType X, LocationType Y,
gui->draw_line (Output.fgGC, X, Y, X + 2 * mark_size, Y);
gui->draw_line (Output.fgGC, X, Y, X, Y - 4* mark_size);
}
-
-}
-
-static int
-via_callback (const BoxType * b, void *cl)
-{
- PinTypePtr via = (PinTypePtr) b;
- SetPVColor (via, VIA_TYPE);
- DrawPinOrViaLowLevel (via, false);
- if (!TEST_FLAG (HOLEFLAG, via) && TEST_FLAG (DISPLAYNAMEFLAG, via))
- DrawPinOrViaNameLowLevel (via);
- return 1;
-}
-
-static int
-pin_callback (const BoxType * b, void *cl)
-{
- PinTypePtr pin = (PinTypePtr) b;
- SetPVColor (pin, PIN_TYPE);
- DrawPinOrViaLowLevel (pin, false);
- if (!TEST_FLAG (HOLEFLAG, pin) && TEST_FLAG (DISPLAYNAMEFLAG, pin))
- DrawPinOrViaNameLowLevel (pin);
- return 1;
}
static int
@@ -866,40 +925,13 @@ DrawLayerGroup (int group, const BoxType *drawn_area)
}
/* ---------------------------------------------------------------------------
- * lowlevel drawing routine for pins and vias
- */
-static void
-DrawPinOrViaLowLevel (PinTypePtr pv, bool drawHole)
-{
- if (Gathering)
- {
- AddPart (pv);
- return;
- }
-
- if (TEST_FLAG (THINDRAWFLAG, PCB))
- gui->thindraw_pcb_pv (Output.fgGC, Output.fgGC, pv, drawHole, false);
- else
- gui->fill_pcb_pv (Output.fgGC, Output.bgGC, pv, drawHole, false);
-}
-
-/* ---------------------------------------------------------------------------
* lowlevel drawing routine for pin and via names
*/
static void
-DrawPinOrViaNameLowLevel (PinTypePtr Ptr)
+GatherPVName (PinTypePtr Ptr)
{
- char *name;
BoxType box;
- bool vert;
- TextType text;
-
- if (!Ptr->Name || !Ptr->Name[0])
- name = (char *)EMPTY (Ptr->Number);
- else
- name = (char *)EMPTY (TEST_FLAG (SHOWNUMBERFLAG, PCB) ? Ptr->Number : Ptr->Name);
-
- vert = TEST_FLAG (EDGE2FLAG, Ptr);
+ bool vert = TEST_FLAG (EDGE2FLAG, Ptr);
if (vert)
{
@@ -911,37 +943,18 @@ DrawPinOrViaNameLowLevel (PinTypePtr Ptr)
box.X1 = Ptr->X + Ptr->DrillingHole / 2 + Settings.PinoutTextOffsetX;
box.Y1 = Ptr->Y - Ptr->Thickness / 2 + Settings.PinoutTextOffsetY;
}
- if (Gathering)
+
+ if (vert)
{
- if (vert)
- {
- box.X2 = box.X1;
- box.Y2 = box.Y1;
- }
- else
- {
- box.X2 = box.X1;
- box.Y2 = box.Y1;
- }
-/*printf("AddPart: x1=%d y1=%d x2=%d y2=%d\n", box.X1, box.Y1, box.X2, box.Y2);*/
- AddPart (&box);
- return;
+ box.X2 = box.X1;
+ box.Y2 = box.Y1;
}
-
- gui->set_color (Output.fgGC, PCB->PinNameColor);
-
- text.Flags = NoFlags ();
- text.Scale = Ptr->Thickness / 80;
- text.X = box.X1;
- text.Y = box.Y1;
- text.Direction = vert ? 1 : 0;
- text.TextString = name;
-
- if (gui->gui)
- doing_pinout++;
- DrawTextLowLevel (&text, 0);
- if (gui->gui)
- doing_pinout--;
+ else
+ {
+ box.X2 = box.X1;
+ box.Y2 = box.Y1;
+ }
+ AddPart (&box);
}
/* ---------------------------------------------------------------------------
@@ -1207,11 +1220,11 @@ DrawArcLowLevel (ArcTypePtr Arc)
void
DrawVia (PinTypePtr Via)
{
- if (!Gathering)
- SetPVColor (Via, VIA_TYPE);
- DrawPinOrViaLowLevel (Via, true);
+ assert (Gathering);
+
+ AddPart (Via);
if (!TEST_FLAG (HOLEFLAG, Via) && TEST_FLAG (DISPLAYNAMEFLAG, Via))
- DrawPinOrViaNameLowLevel (Via);
+ DrawViaName (Via);
}
/* ---------------------------------------------------------------------------
@@ -1220,14 +1233,9 @@ DrawVia (PinTypePtr Via)
void
DrawViaName (PinTypePtr Via)
{
- if (!Gathering)
- {
- if (TEST_FLAG (SELECTEDFLAG, Via))
- gui->set_color (Output.fgGC, PCB->ViaSelectedColor);
- else
- gui->set_color (Output.fgGC, PCB->ViaColor);
- }
- DrawPinOrViaNameLowLevel (Via);
+ assert (Gathering);
+
+ GatherPVName (Via);
}
/* ---------------------------------------------------------------------------
@@ -1236,14 +1244,12 @@ DrawViaName (PinTypePtr Via)
void
DrawPin (PinTypePtr Pin)
{
- {
- if (!Gathering)
- SetPVColor (Pin, PIN_TYPE);
- DrawPinOrViaLowLevel (Pin, true);
- }
+ assert (Gathering);
+
+ AddPart (Pin);
if ((!TEST_FLAG (HOLEFLAG, Pin) && TEST_FLAG (DISPLAYNAMEFLAG, Pin))
|| doing_pinout)
- DrawPinOrViaNameLowLevel (Pin);
+ DrawPinName (Pin);
}
/* ---------------------------------------------------------------------------
@@ -1252,14 +1258,9 @@ DrawPin (PinTypePtr Pin)
void
DrawPinName (PinTypePtr Pin)
{
- if (!Gathering)
- {
- if (TEST_FLAG (SELECTEDFLAG, Pin))
- gui->set_color (Output.fgGC, PCB->PinSelectedColor);
- else
- gui->set_color (Output.fgGC, PCB->PinColor);
- }
- DrawPinOrViaNameLowLevel (Pin);
+ assert (Gathering);
+
+ GatherPVName (Pin);
}
/* ---------------------------------------------------------------------------
@@ -1599,9 +1600,11 @@ DrawElementPinsAndPads (ElementTypePtr Element)
void
EraseVia (PinTypePtr Via)
{
- DrawPinOrViaLowLevel (Via, false);
+ assert (Gathering);
+
+ AddPart (Via);
if (TEST_FLAG (DISPLAYNAMEFLAG, Via))
- DrawPinOrViaNameLowLevel (Via);
+ EraseViaName (Via);
}
/* ---------------------------------------------------------------------------
@@ -1632,7 +1635,9 @@ EraseRat (RatTypePtr Rat)
void
EraseViaName (PinTypePtr Via)
{
- DrawPinOrViaNameLowLevel (Via);
+ assert (Gathering);
+
+ GatherPVName (Via);
}
/* ---------------------------------------------------------------------------
@@ -1661,9 +1666,11 @@ ErasePadName (PadTypePtr Pad)
void
ErasePin (PinTypePtr Pin)
{
- DrawPinOrViaLowLevel (Pin, false);
+ assert (Gathering);
+
+ AddPart (Pin);
if (TEST_FLAG (DISPLAYNAMEFLAG, Pin))
- DrawPinOrViaNameLowLevel (Pin);
+ ErasePinName (Pin);
}
/* ---------------------------------------------------------------------------
@@ -1672,7 +1679,9 @@ ErasePin (PinTypePtr Pin)
void
ErasePinName (PinTypePtr Pin)
{
- DrawPinOrViaNameLowLevel (Pin);
+ assert (Gathering);
+
+ GatherPVName (Pin);
}
/* ---------------------------------------------------------------------------
@@ -1746,11 +1755,11 @@ EraseElement (ElementTypePtr Element)
void
EraseElementPinsAndPads (ElementTypePtr Element)
{
+ assert (Gathering);
+
PIN_LOOP (Element);
{
- DrawPinOrViaLowLevel (pin, false);
- if (TEST_FLAG (DISPLAYNAMEFLAG, pin))
- DrawPinOrViaNameLowLevel (pin);
+ ErasePin (pin);
}
END_LOOP;
PAD_LOOP (Element);
commit 10bcefc32529deead4e9976b8f722d7a035765aa
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" from real drawing routines (Element Pins and Pads)
diff --git a/src/draw.c b/src/draw.c
index d71982f..b9a812e 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -226,6 +226,22 @@ name_callback (const BoxType * b, void *cl)
return 0;
}
+static void
+draw_element_pins_and_pads (ElementType *element)
+{
+ PAD_LOOP (element);
+ {
+ if (doing_pinout || doing_assy || FRONT (pad) || PCB->InvisibleObjectsOn)
+ DrawPad (pad);
+ }
+ END_LOOP;
+ PIN_LOOP (element);
+ {
+ DrawPin (pin);
+ }
+ END_LOOP;
+}
+
static int
EMark_callback (const BoxType * b, void *cl)
{
@@ -1562,6 +1578,8 @@ DrawElementPackage (ElementTypePtr Element)
void
DrawElementPinsAndPads (ElementTypePtr Element)
{
+ assert (Gathering);
+
PAD_LOOP (Element);
{
if (doing_pinout || doing_assy || FRONT (pad) || PCB->InvisibleObjectsOn)
@@ -1851,7 +1869,7 @@ draw_element (ElementTypePtr element)
{
draw_element_package (element);
draw_element_name (element);
- DrawElementPinsAndPads (element);
+ draw_element_pins_and_pads (element);
}
/* ---------------------------------------------------------------------------
commit b6098d179e6d571a86305d8e3e1b5a366ac73cc7
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" from real drawing routines (Element names)
diff --git a/src/draw.c b/src/draw.c
index 75a6c8e..d71982f 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -194,6 +194,23 @@ Redraw (void)
gui->invalidate_all ();
}
+static void
+draw_element_name (ElementType *element)
+{
+ if ((TEST_FLAG (HIDENAMESFLAG, PCB) && gui->gui) ||
+ TEST_FLAG (HIDENAMEFLAG, element))
+ return;
+ if (doing_pinout || doing_assy)
+ gui->set_color (Output.fgGC, PCB->ElementColor);
+ else if (TEST_FLAG (SELECTEDFLAG, &ELEMENT_TEXT (PCB, element)))
+ gui->set_color (Output.fgGC, PCB->ElementSelectedColor);
+ else if (FRONT (element))
+ gui->set_color (Output.fgGC, PCB->ElementColor);
+ else
+ gui->set_color (Output.fgGC, PCB->InvisibleObjectsColor);
+ DrawTextLowLevel (&ELEMENT_TEXT (PCB, element), PCB->minSlk);
+}
+
static int
name_callback (const BoxType * b, void *cl)
{
@@ -205,7 +222,7 @@ name_callback (const BoxType * b, void *cl)
return 0;
if (ON_SIDE (element, *side))
- DrawElementName (element);
+ draw_element_name (element);
return 0;
}
@@ -1512,18 +1529,10 @@ DrawElement (ElementTypePtr Element)
void
DrawElementName (ElementTypePtr Element)
{
- if (gui->gui && TEST_FLAG (HIDENAMESFLAG, PCB))
- return;
+ assert (Gathering);
+
if (TEST_FLAG (HIDENAMEFLAG, Element))
return;
- if (doing_pinout || doing_assy)
- gui->set_color (Output.fgGC, PCB->ElementColor);
- else if (TEST_FLAG (SELECTEDFLAG, &ELEMENT_TEXT (PCB, Element)))
- gui->set_color (Output.fgGC, PCB->ElementSelectedColor);
- else if (FRONT (Element))
- gui->set_color (Output.fgGC, PCB->ElementColor);
- else
- gui->set_color (Output.fgGC, PCB->InvisibleObjectsColor);
DrawTextLowLevel (&ELEMENT_TEXT (PCB, Element), PCB->minSlk);
}
@@ -1741,6 +1750,8 @@ EraseElementPinsAndPads (ElementTypePtr Element)
void
EraseElementName (ElementTypePtr Element)
{
+ assert (Gathering);
+
if (TEST_FLAG (HIDENAMEFLAG, Element))
return;
DrawTextLowLevel (&ELEMENT_TEXT (PCB, Element), PCB->minSlk);
@@ -1839,7 +1850,7 @@ static void
draw_element (ElementTypePtr element)
{
draw_element_package (element);
- DrawElementName (element);
+ draw_element_name (element);
DrawElementPinsAndPads (element);
}
commit ec53d352153e3497a5fe3d890dd36a1d666ba121
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" from real drawing routines (Element Package)
diff --git a/src/draw.c b/src/draw.c
index 2aeefc1..75a6c8e 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -94,7 +94,6 @@ static void DrawLineLowLevel (LineTypePtr);
static void DrawRegularText (LayerTypePtr, TextTypePtr);
static void DrawPolygonLowLevel (PolygonTypePtr);
static void DrawArcLowLevel (ArcTypePtr);
-static void DrawElementPackageLowLevel (ElementTypePtr Element);
static void DrawPlainPolygon (LayerTypePtr Layer, PolygonTypePtr Polygon);
static void AddPart (void *);
static void SetPVColor (PinTypePtr, int);
@@ -196,17 +195,6 @@ Redraw (void)
}
static int
-element_callback (const BoxType * b, void *cl)
-{
- ElementTypePtr element = (ElementTypePtr) b;
- int *side = cl;
-
- if (ON_SIDE (element, *side))
- DrawElementPackage (element);
- return 1;
-}
-
-static int
name_callback (const BoxType * b, void *cl)
{
TextTypePtr text = (TextTypePtr) b;
@@ -297,6 +285,43 @@ rat_callback (const BoxType * b, void *cl)
return 1;
}
+static void
+draw_element_package (ElementType *element)
+{
+ /* set color and draw lines, arcs, text and pins */
+ if (doing_pinout || doing_assy)
+ gui->set_color (Output.fgGC, PCB->ElementColor);
+ else if (TEST_FLAG (SELECTEDFLAG, element))
+ gui->set_color (Output.fgGC, PCB->ElementSelectedColor);
+ else if (FRONT (element))
+ gui->set_color (Output.fgGC, PCB->ElementColor);
+ else
+ gui->set_color (Output.fgGC, PCB->InvisibleObjectsColor);
+
+ /* draw lines, arcs, text and pins */
+ ELEMENTLINE_LOOP (element);
+ {
+ DrawLineLowLevel (line);
+ }
+ END_LOOP;
+ ARC_LOOP (element);
+ {
+ DrawArcLowLevel (arc);
+ }
+ END_LOOP;
+}
+
+static int
+element_callback (const BoxType * b, void *cl)
+{
+ ElementTypePtr element = (ElementTypePtr) b;
+ int *side = cl;
+
+ if (ON_SIDE (element, *side))
+ draw_element_package (element);
+ return 1;
+}
+
/* ---------------------------------------------------------------------------
* prints assembly drawing.
*/
@@ -733,7 +758,6 @@ text_callback (const BoxType * b, void *cl)
return 1;
}
-
/* ---------------------------------------------------------------------------
* draws one non-copper layer
*/
@@ -1145,25 +1169,6 @@ DrawArcLowLevel (ArcTypePtr Arc)
}
/* ---------------------------------------------------------------------------
- * draws the package of an element
- */
-static void
-DrawElementPackageLowLevel (ElementTypePtr Element)
-{
- /* draw lines, arcs, text and pins */
- ELEMENTLINE_LOOP (Element);
- {
- DrawLineLowLevel (line);
- }
- END_LOOP;
- ARC_LOOP (Element);
- {
- DrawArcLowLevel (arc);
- }
- END_LOOP;
-}
-
-/* ---------------------------------------------------------------------------
* draw a via object
*/
void
@@ -1528,16 +1533,18 @@ DrawElementName (ElementTypePtr Element)
void
DrawElementPackage (ElementTypePtr Element)
{
- /* set color and draw lines, arcs, text and pins */
- if (doing_pinout || doing_assy)
- gui->set_color (Output.fgGC, PCB->ElementColor);
- else if (TEST_FLAG (SELECTEDFLAG, Element))
- gui->set_color (Output.fgGC, PCB->ElementSelectedColor);
- else if (FRONT (Element))
- gui->set_color (Output.fgGC, PCB->ElementColor);
- else
- gui->set_color (Output.fgGC, PCB->InvisibleObjectsColor);
- DrawElementPackageLowLevel (Element);
+ assert (Gathering);
+
+ ELEMENTLINE_LOOP (Element);
+ {
+ DrawLineLowLevel (line);
+ }
+ END_LOOP;
+ ARC_LOOP (Element);
+ {
+ DrawArcLowLevel (arc);
+ }
+ END_LOOP;
}
/* ---------------------------------------------------------------------------
@@ -1831,7 +1838,7 @@ DrawObject (int type, void *ptr1, void *ptr2)
static void
draw_element (ElementTypePtr element)
{
- DrawElementPackage (element);
+ draw_element_package (element);
DrawElementName (element);
DrawElementPinsAndPads (element);
}
commit a36d6037a67fb6bd5447aa6e5b569775406268a6
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
draw.c: Split "Gathering" from real drawing routines (Element)
diff --git a/src/draw.c b/src/draw.c
index 7e8690f..2aeefc1 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -54,6 +54,9 @@
#include <dmalloc.h>
#endif
+#undef NDEBUG
+#include <assert.h>
+
#ifndef MAXINT
#define MAXINT (((unsigned int)(~0))>>1)
#endif
@@ -1491,6 +1494,8 @@ DrawPlainPolygon (LayerTypePtr Layer, PolygonTypePtr Polygon)
void
DrawElement (ElementTypePtr Element)
{
+ assert (Gathering);
+
DrawElementPackage (Element);
DrawElementName (Element);
DrawElementPinsAndPads (Element);
@@ -1823,6 +1828,14 @@ DrawObject (int type, void *ptr1, void *ptr2)
}
}
+static void
+draw_element (ElementTypePtr element)
+{
+ DrawElementPackage (element);
+ DrawElementName (element);
+ DrawElementPinsAndPads (element);
+}
+
/* ---------------------------------------------------------------------------
* HID drawing callback.
*/
@@ -1850,7 +1863,7 @@ hid_expose_callback (HID * hid, BoxType * region, void *item)
if (item)
{
doing_pinout = true;
- DrawElement ((ElementTypePtr)item);
+ draw_element ((ElementType *)item);
doing_pinout = false;
}
else
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs