You can subscribe to this list here.
| 2003 |
Jan
|
Feb
(4) |
Mar
(5) |
Apr
|
May
(5) |
Jun
(30) |
Jul
(2) |
Aug
(18) |
Sep
(14) |
Oct
(7) |
Nov
(21) |
Dec
(44) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(63) |
Feb
(94) |
Mar
(54) |
Apr
(39) |
May
(34) |
Jun
(25) |
Jul
(10) |
Aug
(33) |
Sep
(16) |
Oct
(62) |
Nov
(12) |
Dec
(2) |
| 2005 |
Jan
(71) |
Feb
(8) |
Mar
(50) |
Apr
|
May
(2) |
Jun
(12) |
Jul
(19) |
Aug
(8) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(8) |
| 2006 |
Jan
(10) |
Feb
(1) |
Mar
(301) |
Apr
(232) |
May
(26) |
Jun
(20) |
Jul
(26) |
Aug
(79) |
Sep
(92) |
Oct
(174) |
Nov
(17) |
Dec
(93) |
| 2007 |
Jan
(27) |
Feb
(179) |
Mar
(37) |
Apr
(81) |
May
(20) |
Jun
(5) |
Jul
|
Aug
(40) |
Sep
(68) |
Oct
(8) |
Nov
(47) |
Dec
(34) |
| 2008 |
Jan
(154) |
Feb
(15) |
Mar
(5) |
Apr
(21) |
May
(4) |
Jun
(1) |
Jul
(4) |
Aug
(6) |
Sep
(8) |
Oct
(9) |
Nov
(35) |
Dec
(50) |
| 2009 |
Jan
(8) |
Feb
(10) |
Mar
(6) |
Apr
(9) |
May
(7) |
Jun
(40) |
Jul
(7) |
Aug
(5) |
Sep
(2) |
Oct
(16) |
Nov
(42) |
Dec
(5) |
| 2010 |
Jan
(3) |
Feb
(15) |
Mar
(32) |
Apr
(18) |
May
(6) |
Jun
(9) |
Jul
|
Aug
(11) |
Sep
(16) |
Oct
|
Nov
(4) |
Dec
(35) |
| 2011 |
Jan
(24) |
Feb
(6) |
Mar
(27) |
Apr
(119) |
May
(72) |
Jun
(20) |
Jul
(31) |
Aug
(88) |
Sep
(86) |
Oct
(14) |
Nov
(11) |
Dec
(30) |
| 2012 |
Jan
(4) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <gi...@gp...> - 2011-04-28 00:03:55
|
The branch, master has been updated
via 162021537969b2e3d7752f1a803baf48e3af4cc5 (commit)
from 7283474c1d57a21bb6444c3e9f0b440f2d07cb18 (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/hid.h | 5 -----
src/hid/batch/batch.c | 6 ------
src/hid/common/extents.c | 6 ------
src/hid/common/hidnogui.c | 8 --------
src/hid/gcode/gcode.c | 7 -------
src/hid/gerber/gerber.c | 8 --------
src/hid/gtk/gtkhid-gdk.c | 6 ------
src/hid/gtk/gtkhid-main.c | 1 -
src/hid/gtk/gui.h | 1 -
src/hid/lesstif/main.c | 7 -------
src/hid/nelma/nelma.c | 7 -------
src/hid/png/png.c | 7 -------
src/hid/ps/eps.c | 8 --------
src/hid/ps/ps.c | 7 -------
14 files changed, 0 insertions(+), 84 deletions(-)
=================
Commit Messages
=================
commit 162021537969b2e3d7752f1a803baf48e3af4cc5
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid: Remove unused set_line_cap_angle API
:100644 100644 36aca75... 2b9ca40... M src/hid.h
:100644 100644 f14d75f... a32e89b... M src/hid/batch/batch.c
:100644 100644 5ac46ea... 37ff538... M src/hid/common/extents.c
:100644 100644 84ceda3... cc7d2fc... M src/hid/common/hidnogui.c
:100644 100644 50f22cb... 6514fe9... M src/hid/gcode/gcode.c
:100644 100644 9642579... 29eeafa... M src/hid/gerber/gerber.c
:100644 100644 cfbef00... 8c3af43... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 6cb6e56... 8d5e3d2... M src/hid/gtk/gtkhid-main.c
:100644 100644 8a52b5a... 1d5757f... M src/hid/gtk/gui.h
:100644 100644 b22328c... 554bbae... M src/hid/lesstif/main.c
:100644 100644 7d136d6... 9dbf24c... M src/hid/nelma/nelma.c
:100644 100644 cb38659... e47c641... M src/hid/png/png.c
:100644 100644 afcfb73... 0aca27e... M src/hid/ps/eps.c
:100644 100644 79459d6... 92f03fd... M src/hid/ps/ps.c
=========
Changes
=========
commit 162021537969b2e3d7752f1a803baf48e3af4cc5
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid: Remove unused set_line_cap_angle API
diff --git a/src/hid.h b/src/hid.h
index 36aca75..2b9ca40 100644
--- a/src/hid.h
+++ b/src/hid.h
@@ -366,11 +366,6 @@ typedef enum
assembly drawings so far. */
void (*set_draw_faded) (hidGC gc_, int faded_);
- /* When you pass the same x,y twice to draw_line, the end caps are
- drawn as if the "line" were parallel to the line defined by these
- coordinates. Use this for rotating non-round pads. */
- void (*set_line_cap_angle) (hidGC gc_, int x1_, int y1_, int x2_, int y2_);
-
/* The usual drawing functions. "draw" means to use segments of the
given width, whereas "fill" means to fill to a zero-width
outline. */
diff --git a/src/hid/batch/batch.c b/src/hid/batch/batch.c
index f14d75f..a32e89b 100644
--- a/src/hid/batch/batch.c
+++ b/src/hid/batch/batch.c
@@ -213,11 +213,6 @@ batch_set_draw_faded (hidGC gc, int faded)
}
static void
-batch_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2)
-{
-}
-
-static void
batch_draw_line (hidGC gc, int x1, int y1, int x2, int y2)
{
}
@@ -365,7 +360,6 @@ hid_batch_init ()
batch_hid.set_line_width = batch_set_line_width;
batch_hid.set_draw_xor = batch_set_draw_xor;
batch_hid.set_draw_faded = batch_set_draw_faded;
- batch_hid.set_line_cap_angle = batch_set_line_cap_angle;
batch_hid.draw_line = batch_draw_line;
batch_hid.draw_arc = batch_draw_arc;
batch_hid.draw_rect = batch_draw_rect;
diff --git a/src/hid/common/extents.c b/src/hid/common/extents.c
index 5ac46ea..37ff538 100644
--- a/src/hid/common/extents.c
+++ b/src/hid/common/extents.c
@@ -105,11 +105,6 @@ extents_set_draw_faded (hidGC gc, int faded)
{
}
-static void
-extents_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2)
-{
-}
-
#define PEX(x,w) if (box.X1 > (x)-(w)) box.X1 = (x)-(w); \
if (box.X2 < (x)+(w)) box.X2 = (x)+(w)
#define PEY(y,w) if (box.Y1 > (y)-(w)) box.Y1 = (y)-(w); \
@@ -197,7 +192,6 @@ hid_extents_init (void)
extents_hid.set_line_width = extents_set_line_width;
extents_hid.set_draw_xor = extents_set_draw_xor;
extents_hid.set_draw_faded = extents_set_draw_faded;
- extents_hid.set_line_cap_angle = extents_set_line_cap_angle;
extents_hid.draw_line = extents_draw_line;
extents_hid.draw_arc = extents_draw_arc;
extents_hid.draw_rect = extents_draw_rect;
diff --git a/src/hid/common/hidnogui.c b/src/hid/common/hidnogui.c
index 84ceda3..cc7d2fc 100644
--- a/src/hid/common/hidnogui.c
+++ b/src/hid/common/hidnogui.c
@@ -116,12 +116,6 @@ nogui_set_draw_faded (hidGC gc, int faded)
}
static void
-nogui_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2)
-{
- CRASH;
-}
-
-static void
nogui_draw_line (hidGC gc, int x1, int y1, int x2, int y2)
{
CRASH;
@@ -455,7 +449,6 @@ HID hid_nogui = {
nogui_set_line_width,
nogui_set_draw_xor,
nogui_set_draw_faded,
- nogui_set_line_cap_angle,
nogui_draw_line,
nogui_draw_arc,
nogui_draw_rect,
@@ -517,7 +510,6 @@ apply_default_hid (HID * d, HID * s)
AD (set_line_cap);
AD (set_line_width);
AD (set_draw_xor);
- AD (set_line_cap_angle);
AD (draw_line);
AD (draw_arc);
AD (fill_circle);
diff --git a/src/hid/gcode/gcode.c b/src/hid/gcode/gcode.c
index 50f22cb..6514fe9 100644
--- a/src/hid/gcode/gcode.c
+++ b/src/hid/gcode/gcode.c
@@ -741,12 +741,6 @@ gcode_set_draw_faded (hidGC gc, int faded)
}
static void
-gcode_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2)
-{
- CRASH;
-}
-
-static void
use_gc (hidGC gc)
{
int need_brush = 0;
@@ -1057,7 +1051,6 @@ hid_gcode_init ()
gcode_hid.set_line_width = gcode_set_line_width;
gcode_hid.set_draw_xor = gcode_set_draw_xor;
gcode_hid.set_draw_faded = gcode_set_draw_faded;
- gcode_hid.set_line_cap_angle = gcode_set_line_cap_angle;
gcode_hid.draw_line = gcode_draw_line;
gcode_hid.draw_arc = gcode_draw_arc;
gcode_hid.draw_rect = gcode_draw_rect;
diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
index 9642579..29eeafa 100644
--- a/src/hid/gerber/gerber.c
+++ b/src/hid/gerber/gerber.c
@@ -56,7 +56,6 @@ static void gerber_set_line_cap (hidGC gc, EndCapStyle style);
static void gerber_set_line_width (hidGC gc, int width);
static void gerber_set_draw_xor (hidGC gc, int _xor);
static void gerber_set_draw_faded (hidGC gc, int faded);
-static void gerber_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2);
static void gerber_draw_line (hidGC gc, int x1, int y1, int x2, int y2);
static void gerber_draw_arc (hidGC gc, int cx, int cy, int width, int height, int start_angle, int delta_angle);
static void gerber_draw_rect (hidGC gc, int x1, int y1, int x2, int y2);
@@ -809,12 +808,6 @@ gerber_set_draw_faded (hidGC gc, int faded)
}
static void
-gerber_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2)
-{
- CRASH;
-}
-
-static void
use_gc (hidGC gc, int radius)
{
int c;
@@ -1194,7 +1187,6 @@ hid_gerber_init ()
gerber_hid.set_line_width = gerber_set_line_width;
gerber_hid.set_draw_xor = gerber_set_draw_xor;
gerber_hid.set_draw_faded = gerber_set_draw_faded;
- gerber_hid.set_line_cap_angle = gerber_set_line_cap_angle;
gerber_hid.draw_line = gerber_draw_line;
gerber_hid.draw_arc = gerber_draw_arc;
gerber_hid.draw_rect = gerber_draw_rect;
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index cfbef00..8c3af43 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -481,12 +481,6 @@ ghid_set_draw_faded (hidGC gc, int faded)
printf ("ghid_set_draw_faded(%p,%d) -- not implemented\n", gc, faded);
}
-void
-ghid_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2)
-{
- printf ("ghid_set_line_cap_angle() -- not implemented\n");
-}
-
static int
use_gc (hidGC gc)
{
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 6cb6e56..8d5e3d2 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -2124,7 +2124,6 @@ hid_gtk_init ()
ghid_hid.set_line_width = ghid_set_line_width;
ghid_hid.set_draw_xor = ghid_set_draw_xor;
ghid_hid.set_draw_faded = ghid_set_draw_faded;
- ghid_hid.set_line_cap_angle = ghid_set_line_cap_angle;
ghid_hid.draw_line = ghid_draw_line;
ghid_hid.draw_arc = ghid_draw_arc;
ghid_hid.draw_rect = ghid_draw_rect;
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 8a52b5a..1d5757f 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -480,7 +480,6 @@ void ghid_set_line_cap (hidGC gc, EndCapStyle style);
void ghid_set_line_width (hidGC gc, int width);
void ghid_set_draw_xor (hidGC gc, int _xor);
void ghid_set_draw_faded (hidGC gc, int faded);
-void ghid_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2);
void ghid_draw_line (hidGC gc, int x1, int y1, int x2, int y2);
void ghid_draw_arc (hidGC gc, int cx, int cy, int xradius, int yradius,
int start_angle, int delta_angle);
diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index b22328c..554bbae 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -3243,12 +3243,6 @@ lesstif_set_draw_faded (hidGC gc, int faded)
/* We don't use this */
}
-static void
-lesstif_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2)
-{
- CRASH;
-}
-
#define ISORT(a,b) if (a>b) { a^=b; b^=a; a^=b; }
static void
@@ -3901,7 +3895,6 @@ hid_lesstif_init ()
lesstif_hid.set_line_width = lesstif_set_line_width;
lesstif_hid.set_draw_xor = lesstif_set_draw_xor;
lesstif_hid.set_draw_faded = lesstif_set_draw_faded;
- lesstif_hid.set_line_cap_angle = lesstif_set_line_cap_angle;
lesstif_hid.draw_line = lesstif_draw_line;
lesstif_hid.draw_arc = lesstif_draw_arc;
lesstif_hid.draw_rect = lesstif_draw_rect;
diff --git a/src/hid/nelma/nelma.c b/src/hid/nelma/nelma.c
index 7d136d6..9dbf24c 100644
--- a/src/hid/nelma/nelma.c
+++ b/src/hid/nelma/nelma.c
@@ -807,12 +807,6 @@ nelma_set_draw_faded(hidGC gc, int faded)
}
static void
-nelma_set_line_cap_angle(hidGC gc, int x1, int y1, int x2, int y2)
-{
- CRASH;
-}
-
-static void
use_gc(hidGC gc)
{
int need_brush = 0;
@@ -1072,7 +1066,6 @@ hid_nelma_init()
nelma_hid.set_line_width = nelma_set_line_width;
nelma_hid.set_draw_xor = nelma_set_draw_xor;
nelma_hid.set_draw_faded = nelma_set_draw_faded;
- nelma_hid.set_line_cap_angle = nelma_set_line_cap_angle;
nelma_hid.draw_line = nelma_draw_line;
nelma_hid.draw_arc = nelma_draw_arc;
nelma_hid.draw_rect = nelma_draw_rect;
diff --git a/src/hid/png/png.c b/src/hid/png/png.c
index cb38659..e47c641 100644
--- a/src/hid/png/png.c
+++ b/src/hid/png/png.c
@@ -1183,12 +1183,6 @@ png_set_draw_faded (hidGC gc, int faded)
}
static void
-png_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2)
-{
- CRASH;
-}
-
-static void
use_gc (hidGC gc)
{
int need_brush = 0;
@@ -1549,7 +1543,6 @@ hid_png_init ()
png_hid.set_line_width = png_set_line_width;
png_hid.set_draw_xor = png_set_draw_xor;
png_hid.set_draw_faded = png_set_draw_faded;
- png_hid.set_line_cap_angle = png_set_line_cap_angle;
png_hid.draw_line = png_draw_line;
png_hid.draw_arc = png_draw_arc;
png_hid.draw_rect = png_draw_rect;
diff --git a/src/hid/ps/eps.c b/src/hid/ps/eps.c
index afcfb73..0aca27e 100644
--- a/src/hid/ps/eps.c
+++ b/src/hid/ps/eps.c
@@ -43,7 +43,6 @@ static void eps_set_line_cap (hidGC gc, EndCapStyle style);
static void eps_set_line_width (hidGC gc, int width);
static void eps_set_draw_xor (hidGC gc, int _xor);
static void eps_set_draw_faded (hidGC gc, int faded);
-static void eps_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2);
static void eps_draw_rect (hidGC gc, int x1, int y1, int x2, int y2);
static void eps_draw_line (hidGC gc, int x1, int y1, int x2, int y2);
static void eps_draw_arc (hidGC gc, int cx, int cy, int width, int height, int start_angle, int delta_angle);
@@ -493,12 +492,6 @@ eps_set_draw_faded (hidGC gc, int faded)
}
static void
-eps_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2)
-{
- CRASH;
-}
-
-static void
use_gc (hidGC gc)
{
if (linewidth != gc->width)
@@ -662,7 +655,6 @@ hid_eps_init ()
eps_hid.set_line_width = eps_set_line_width;
eps_hid.set_draw_xor = eps_set_draw_xor;
eps_hid.set_draw_faded = eps_set_draw_faded;
- eps_hid.set_line_cap_angle = eps_set_line_cap_angle;
eps_hid.draw_line = eps_draw_line;
eps_hid.draw_arc = eps_draw_arc;
eps_hid.draw_rect = eps_draw_rect;
diff --git a/src/hid/ps/ps.c b/src/hid/ps/ps.c
index 79459d6..92f03fd 100644
--- a/src/hid/ps/ps.c
+++ b/src/hid/ps/ps.c
@@ -939,12 +939,6 @@ ps_set_draw_faded (hidGC gc, int faded)
}
static void
-ps_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2)
-{
- CRASH;
-}
-
-static void
use_gc (hidGC gc)
{
if (gc->me_pointer != &ps_hid)
@@ -1369,7 +1363,6 @@ hid_ps_init ()
ps_hid.set_line_width = ps_set_line_width;
ps_hid.set_draw_xor = ps_set_draw_xor;
ps_hid.set_draw_faded = ps_set_draw_faded;
- ps_hid.set_line_cap_angle = ps_set_line_cap_angle;
ps_hid.draw_line = ps_draw_line;
ps_hid.draw_arc = ps_draw_arc;
ps_hid.draw_rect = ps_draw_rect;
|
|
From: <gi...@gp...> - 2011-04-27 20:46:38
|
The branch, master has been updated
via 7283474c1d57a21bb6444c3e9f0b440f2d07cb18 (commit)
via b2f14020c01015a1eb9fa2d35f0783ae756fc269 (commit)
via e0f0bb85a4652a294b5897c072c92fd661827291 (commit)
via fa9249d625fbf66ae1276e6def5f0c38de47b9fe (commit)
from 4d239d983d96a13fcd48b837c5178af145ecca0c (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/hid/gtk/gtkhid-gdk.c | 19 ++++---------------
src/hid/gtk/gtkhid-main.c | 4 ++--
src/hid/gtk/gui-output-events.c | 18 +-----------------
src/hid/gtk/gui.h | 3 ---
4 files changed, 7 insertions(+), 37 deletions(-)
=================
Commit Messages
=================
commit 7283474c1d57a21bb6444c3e9f0b440f2d07cb18
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Make ghid_show_crosshair() local to the GDK implementation
:100644 100644 b583325... cfbef00... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 8b86396... 8a52b5a... M src/hid/gtk/gui.h
commit b2f14020c01015a1eb9fa2d35f0783ae756fc269
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Invalidate the crosshair rather than drawing it immediately
:100644 100644 0df478d... 6cb6e56... M src/hid/gtk/gtkhid-main.c
commit e0f0bb85a4652a294b5897c072c92fd661827291
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Revert "hid/gtk: Add hooks to tell the render when we start/stop drawing"
This reverts commit 332cb8ddc1cc032ac29c7d2b9a0051ccc228b6da.
Since crosshair updates are now handled by notifications to the GUI,
this isn't required for the forthcoming PCB+GL support.
:100644 100644 bd6e035... b583325... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 d3678b7... d969dd2... M src/hid/gtk/gui-output-events.c
:100644 100644 cfb9708... 8b86396... M src/hid/gtk/gui.h
commit fa9249d625fbf66ae1276e6def5f0c38de47b9fe
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Avoid extra crosshair and attached object redraws
The crosshair movement is handled by a notify_crosshair_change() call
in ghid_note_event_location().
:100644 100644 a0e8eb3... d3678b7... M src/hid/gtk/gui-output-events.c
=========
Changes
=========
commit 7283474c1d57a21bb6444c3e9f0b440f2d07cb18
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Make ghid_show_crosshair() local to the GDK implementation
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index b583325..cfbef00 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -958,8 +958,8 @@ draw_crosshair (GdkGC *xor_gc, gint x, gint y)
#define VCW 16
#define VCD 8
-void
-ghid_show_crosshair (gboolean paint_new_location)
+static void
+show_crosshair (gboolean paint_new_location)
{
gint x, y;
static gint x_prev = -1, y_prev = -1;
@@ -1067,7 +1067,7 @@ ghid_screen_update (void)
gdk_draw_drawable (gport->drawing_area->window, priv->bg_gc, gport->pixmap,
0, 0, 0, 0, gport->width, gport->height);
- ghid_show_crosshair (TRUE);
+ show_crosshair (TRUE);
}
gboolean
@@ -1080,7 +1080,7 @@ ghid_drawing_area_expose_cb (GtkWidget *widget,
gdk_draw_drawable (widget->window, priv->bg_gc, port->pixmap,
ev->area.x, ev->area.y, ev->area.x, ev->area.y,
ev->area.width, ev->area.height);
- ghid_show_crosshair (TRUE);
+ show_crosshair (TRUE);
return FALSE;
}
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 8b86396..8a52b5a 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -492,7 +492,6 @@ void ghid_invalidate_lr (int left, int right, int top, int bottom);
void ghid_invalidate_all ();
void ghid_notify_crosshair_change (bool changes_complete);
void ghid_notify_mark_change (bool changes_complete);
-void ghid_show_crosshair (gboolean show);
void ghid_init_renderer (int *, char ***, GHidPort *);
void ghid_init_drawing_widget (GtkWidget *widget, GHidPort *);
void ghid_drawing_area_configure_hook (GHidPort *port);
commit b2f14020c01015a1eb9fa2d35f0783ae756fc269
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Invalidate the crosshair rather than drawing it immediately
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 0df478d..6cb6e56 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -1893,9 +1893,9 @@ PanAction (int argc, char **argv, int x, int y)
}
else if (x == on_x && y == on_y)
{
- ghid_show_crosshair (FALSE);
+ notify_crosshair_change (false);
ghidgui->auto_pan_on = !ghidgui->auto_pan_on;
- ghid_show_crosshair (TRUE);
+ notify_crosshair_change (true);
}
return 0;
commit e0f0bb85a4652a294b5897c072c92fd661827291
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Revert "hid/gtk: Add hooks to tell the render when we start/stop drawing"
This reverts commit 332cb8ddc1cc032ac29c7d2b9a0051ccc228b6da.
Since crosshair updates are now handled by notifications to the GUI,
this isn't required for the forthcoming PCB+GL support.
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index bd6e035..b583325 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -1060,17 +1060,6 @@ ghid_drawing_area_configure_hook (GHidPort *port)
}
}
-gboolean
-ghid_start_drawing (GHidPort *port)
-{
- return TRUE;
-}
-
-void
-ghid_end_drawing (GHidPort *port)
-{
-}
-
void
ghid_screen_update (void)
{
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index d3678b7..d969dd2 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -646,13 +646,8 @@ ghid_port_window_motion_cb (GtkWidget * widget,
gdouble dx, dy;
static gint x_prev = -1, y_prev = -1;
-
gdk_event_request_motions (ev);
- if (!ghid_start_drawing (out))
- return FALSE;
-
-
if (out->panning)
{
dx = gport->zoom * (x_prev - ev->x);
@@ -670,7 +665,6 @@ ghid_port_window_motion_cb (GtkWidget * widget,
queue_tooltip_update (out);
#endif
- ghid_end_drawing (out);
return FALSE;
}
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index cfb9708..8b86396 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -496,8 +496,6 @@ void ghid_show_crosshair (gboolean show);
void ghid_init_renderer (int *, char ***, GHidPort *);
void ghid_init_drawing_widget (GtkWidget *widget, GHidPort *);
void ghid_drawing_area_configure_hook (GHidPort *port);
-gboolean ghid_start_drawing (GHidPort *port);
-void ghid_end_drawing (GHidPort *port);
void ghid_screen_update (void);
gboolean ghid_drawing_area_expose_cb (GtkWidget *, GdkEventExpose *,
GHidPort *);
commit fa9249d625fbf66ae1276e6def5f0c38de47b9fe
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Avoid extra crosshair and attached object redraws
The crosshair movement is handled by a notify_crosshair_change() call
in ghid_note_event_location().
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index a0e8eb3..d3678b7 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -335,8 +335,6 @@ ghid_port_key_press_cb (GtkWidget * drawing_area,
state = (GdkModifierType) (kev->state);
mk = ghid_modifier_keys_state (&state);
- ghid_show_crosshair (FALSE);
-
handled = TRUE; /* Start off assuming we handle it */
switch (ksym)
{
@@ -440,7 +438,6 @@ ghid_port_button_press_cb (GtkWidget * drawing_area,
ghid_note_event_location (ev);
state = (GdkModifierType) (ev->state);
mk = ghid_modifier_keys_state (&state);
- ghid_show_crosshair (FALSE);
do_mouse_action(ev->button, mk);
@@ -648,7 +645,6 @@ ghid_port_window_motion_cb (GtkWidget * widget,
{
gdouble dx, dy;
static gint x_prev = -1, y_prev = -1;
- gboolean moved;
gdk_event_request_motions (ev);
@@ -668,17 +664,12 @@ ghid_port_window_motion_cb (GtkWidget * widget,
return FALSE;
}
x_prev = y_prev = -1;
- moved = ghid_note_event_location ((GdkEventButton *)ev);
+ ghid_note_event_location ((GdkEventButton *)ev);
#if ENABLE_TOOLTIPS
queue_tooltip_update (out);
#endif
- ghid_show_crosshair (FALSE);
- ghid_show_crosshair (TRUE);
- if (moved && have_crosshair_attachments ())
- ghid_draw_area_update (gport, NULL);
-
ghid_end_drawing (out);
return FALSE;
}
@@ -804,7 +795,6 @@ ghid_port_window_leave_cb (GtkWidget * widget,
}
}
- ghid_show_crosshair (FALSE);
out->has_entered = FALSE;
ghid_screen_update ();
|
|
From: <gi...@gp...> - 2011-04-27 20:45:20
|
The branch, master has been updated
discards cdfeb9fe1dc994397bc7c3678e77eea2ca78cf95 (commit)
discards f4c2355b6c463fcaabc4b82d335edfa7ca2d8689 (commit)
discards a06c8d7e8c61415c3b49bcd210afc4506747191d (commit)
discards 427e04ec09da124a225a66884f35bcfb369aeb15 (commit)
from cdfeb9fe1dc994397bc7c3678e77eea2ca78cf95 (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/Makefile.am | 2 -
src/draw.c | 532 +++++++++++++++++++++++++++++++++------
src/draw.h | 1 +
src/draw_funcs.c | 404 -----------------------------
src/draw_funcs.h | 17 --
src/hid/gerber/gerber.c | 3 +-
src/hid/gtk/gtkhid-gdk.c | 11 +
src/hid/gtk/gui-output-events.c | 18 ++-
src/hid/gtk/gui.h | 2 +
src/hid/ps/ps.c | 3 +-
10 files changed, 482 insertions(+), 511 deletions(-)
delete mode 100644 src/draw_funcs.c
delete mode 100644 src/draw_funcs.h
=================
Commit Messages
=================
=========
Changes
=========
|
|
From: <gi...@gp...> - 2011-04-27 20:13:59
|
The branch, master has been updated
via cdfeb9fe1dc994397bc7c3678e77eea2ca78cf95 (commit)
from f4c2355b6c463fcaabc4b82d335edfa7ca2d8689 (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/hid/gtk/gtkhid-gdk.c | 11 -----------
src/hid/gtk/gui-output-events.c | 6 ------
src/hid/gtk/gui.h | 2 --
3 files changed, 0 insertions(+), 19 deletions(-)
=================
Commit Messages
=================
commit cdfeb9fe1dc994397bc7c3678e77eea2ca78cf95
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Revert "hid/gtk: Add hooks to tell the render when we start/stop drawing"
This reverts commit 332cb8ddc1cc032ac29c7d2b9a0051ccc228b6da.
Since crosshair updates are now handled by notifications to the GUI,
this isn't required for the forthcoming PCB+GL support.
:100644 100644 bd6e035... b583325... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 d3678b7... d969dd2... M src/hid/gtk/gui-output-events.c
:100644 100644 cfb9708... 8b86396... M src/hid/gtk/gui.h
=========
Changes
=========
commit cdfeb9fe1dc994397bc7c3678e77eea2ca78cf95
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Revert "hid/gtk: Add hooks to tell the render when we start/stop drawing"
This reverts commit 332cb8ddc1cc032ac29c7d2b9a0051ccc228b6da.
Since crosshair updates are now handled by notifications to the GUI,
this isn't required for the forthcoming PCB+GL support.
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index bd6e035..b583325 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -1060,17 +1060,6 @@ ghid_drawing_area_configure_hook (GHidPort *port)
}
}
-gboolean
-ghid_start_drawing (GHidPort *port)
-{
- return TRUE;
-}
-
-void
-ghid_end_drawing (GHidPort *port)
-{
-}
-
void
ghid_screen_update (void)
{
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index d3678b7..d969dd2 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -646,13 +646,8 @@ ghid_port_window_motion_cb (GtkWidget * widget,
gdouble dx, dy;
static gint x_prev = -1, y_prev = -1;
-
gdk_event_request_motions (ev);
- if (!ghid_start_drawing (out))
- return FALSE;
-
-
if (out->panning)
{
dx = gport->zoom * (x_prev - ev->x);
@@ -670,7 +665,6 @@ ghid_port_window_motion_cb (GtkWidget * widget,
queue_tooltip_update (out);
#endif
- ghid_end_drawing (out);
return FALSE;
}
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index cfb9708..8b86396 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -496,8 +496,6 @@ void ghid_show_crosshair (gboolean show);
void ghid_init_renderer (int *, char ***, GHidPort *);
void ghid_init_drawing_widget (GtkWidget *widget, GHidPort *);
void ghid_drawing_area_configure_hook (GHidPort *port);
-gboolean ghid_start_drawing (GHidPort *port);
-void ghid_end_drawing (GHidPort *port);
void ghid_screen_update (void);
gboolean ghid_drawing_area_expose_cb (GtkWidget *, GdkEventExpose *,
GHidPort *);
|
|
From: <gi...@gp...> - 2011-04-27 20:12:45
|
The branch, master has been updated
via f4c2355b6c463fcaabc4b82d335edfa7ca2d8689 (commit)
via a06c8d7e8c61415c3b49bcd210afc4506747191d (commit)
via 427e04ec09da124a225a66884f35bcfb369aeb15 (commit)
from 4d239d983d96a13fcd48b837c5178af145ecca0c (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/Makefile.am | 2 +
src/draw.c | 532 ++++++---------------------------------
src/draw.h | 1 -
src/draw_funcs.c | 404 +++++++++++++++++++++++++++++
src/draw_funcs.h | 17 ++
src/hid/gerber/gerber.c | 3 +-
src/hid/gtk/gui-output-events.c | 12 +-
src/hid/ps/ps.c | 3 +-
8 files changed, 511 insertions(+), 463 deletions(-)
create mode 100644 src/draw_funcs.c
create mode 100644 src/draw_funcs.h
=================
Commit Messages
=================
commit f4c2355b6c463fcaabc4b82d335edfa7ca2d8689
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Avoid extra crosshair and attached object redraws
The crosshair movement is handled by a notify_crosshair_change() call
in ghid_note_event_location().
:100644 100644 a0e8eb3... d3678b7... M src/hid/gtk/gui-output-events.c
commit a06c8d7e8c61415c3b49bcd210afc4506747191d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Continue with crazy idea
:100644 100644 c71e849... b6555a2... M src/draw.c
:100644 100644 adfee36... cf324a5... M src/draw.h
:100644 100644 8a2d557... 679d973... M src/draw_funcs.c
:100644 100644 1f97d82... 25c33a1... M src/draw_funcs.h
:100644 100644 9642579... a56c8b9... M src/hid/gerber/gerber.c
:100644 100644 79459d6... 91ba337... M src/hid/ps/ps.c
commit 427e04ec09da124a225a66884f35bcfb369aeb15
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Crasy test
:100644 100644 5abbfb2... 34cd5b3... M src/Makefile.am
:100644 100644 c041195... c71e849... M src/draw.c
:000000 100644 0000000... 8a2d557... A src/draw_funcs.c
:000000 100644 0000000... 1f97d82... A src/draw_funcs.h
=========
Changes
=========
commit f4c2355b6c463fcaabc4b82d335edfa7ca2d8689
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Avoid extra crosshair and attached object redraws
The crosshair movement is handled by a notify_crosshair_change() call
in ghid_note_event_location().
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index a0e8eb3..d3678b7 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -335,8 +335,6 @@ ghid_port_key_press_cb (GtkWidget * drawing_area,
state = (GdkModifierType) (kev->state);
mk = ghid_modifier_keys_state (&state);
- ghid_show_crosshair (FALSE);
-
handled = TRUE; /* Start off assuming we handle it */
switch (ksym)
{
@@ -440,7 +438,6 @@ ghid_port_button_press_cb (GtkWidget * drawing_area,
ghid_note_event_location (ev);
state = (GdkModifierType) (ev->state);
mk = ghid_modifier_keys_state (&state);
- ghid_show_crosshair (FALSE);
do_mouse_action(ev->button, mk);
@@ -648,7 +645,6 @@ ghid_port_window_motion_cb (GtkWidget * widget,
{
gdouble dx, dy;
static gint x_prev = -1, y_prev = -1;
- gboolean moved;
gdk_event_request_motions (ev);
@@ -668,17 +664,12 @@ ghid_port_window_motion_cb (GtkWidget * widget,
return FALSE;
}
x_prev = y_prev = -1;
- moved = ghid_note_event_location ((GdkEventButton *)ev);
+ ghid_note_event_location ((GdkEventButton *)ev);
#if ENABLE_TOOLTIPS
queue_tooltip_update (out);
#endif
- ghid_show_crosshair (FALSE);
- ghid_show_crosshair (TRUE);
- if (moved && have_crosshair_attachments ())
- ghid_draw_area_update (gport, NULL);
-
ghid_end_drawing (out);
return FALSE;
}
@@ -804,7 +795,6 @@ ghid_port_window_leave_cb (GtkWidget * widget,
}
}
- ghid_show_crosshair (FALSE);
out->has_entered = FALSE;
ghid_screen_update ();
commit a06c8d7e8c61415c3b49bcd210afc4506747191d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Continue with crazy idea
diff --git a/src/draw.c b/src/draw.c
index c71e849..b6555a2 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -141,16 +141,6 @@ set_pv_color (PinType *pv, int type)
: PCB->PinColor);
}
-static void
-set_pv_inlayer_color (PinType *pv, LayerType *layer, int type)
-{
- if (TEST_FLAG (WARNFLAG, pv)) gui->set_color (Output.fgGC, PCB->WarnColor);
- else if (TEST_FLAG (SELECTEDFLAG, pv)) gui->set_color (Output.fgGC, (type == VIA_TYPE) ? PCB->ViaSelectedColor
- : PCB->PinSelectedColor);
- else if (TEST_FLAG (FOUNDFLAG, pv)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
- else gui->set_color (Output.fgGC, layer->Color);
-}
-
static int
pin_callback (const BoxType * b, void *cl)
{
@@ -160,14 +150,6 @@ pin_callback (const BoxType * b, void *cl)
}
static int
-pin_inlayer_callback (const BoxType * b, void *cl)
-{
- set_pv_inlayer_color ((PinType *)b, cl, PIN_TYPE);
- dapi->draw_pin ((PinType *)b, NULL, NULL);
- return 1;
-}
-
-static int
via_callback (const BoxType * b, void *cl)
{
set_pv_color ((PinType *)b, VIA_TYPE);
@@ -176,14 +158,6 @@ via_callback (const BoxType * b, void *cl)
}
static int
-via_inlayer_callback (const BoxType * b, void *cl)
-{
- set_pv_inlayer_color ((PinType *)b, cl, VIA_TYPE);
- dapi->draw_via ((PinType *)b, NULL, NULL);
- return 1;
-}
-
-static int
pad_callback (const BoxType * b, void *cl)
{
PadTypePtr pad = (PadTypePtr) b;
@@ -202,28 +176,6 @@ pad_callback (const BoxType * b, void *cl)
return 1;
}
-static int
-pad_inlayer_callback (const BoxType * b, void *cl)
-{
- PadTypePtr pad = (PadTypePtr) b;
- LayerType *layer = cl;
- int solder_group = GetLayerGroupNumberByNumber (solder_silk_layer);
- int group = GetLayerGroupNumberByPointer (layer);
-
- int side = (group == solder_group) ? SOLDER_LAYER : COMPONENT_LAYER;
-
- if (ON_SIDE (pad, side))
- {
- 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 if (TEST_FLAG (FOUNDFLAG, pad)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
- else gui->set_color (Output.fgGC, layer->Color);
-
- dapi->draw_pad (pad, NULL, NULL);
- }
- return 1;
-}
-
static void
draw_element_name (ElementType *element)
{
@@ -357,20 +309,6 @@ CountHoles (int *plated, int *unplated, BoxType *drawn_area)
}
static int
-line_callback (const BoxType * b, void *cl)
-{
- LayerType *layer = cl;
- LineType *line = (LineType *)b;
-
- if (TEST_FLAG (SELECTEDFLAG, line)) gui->set_color (Output.fgGC, layer->SelectedColor);
- else if (TEST_FLAG (FOUNDFLAG, line)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
- else gui->set_color (Output.fgGC, layer->Color);
-
- dapi->draw_line (line, NULL, NULL);
- return 1;
-}
-
-static int
rat_callback (const BoxType * b, void *cl)
{
RatType *rat = (RatType *)b;
@@ -383,20 +321,6 @@ rat_callback (const BoxType * b, void *cl)
return 1;
}
-static int
-arc_callback (const BoxType * b, void *cl)
-{
- LayerType *layer = cl;
- ArcType *arc = (ArcType *)b;
-
- if (TEST_FLAG (SELECTEDFLAG, arc)) gui->set_color (Output.fgGC, layer->SelectedColor);
- else if (TEST_FLAG (FOUNDFLAG, arc)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
- else gui->set_color (Output.fgGC, layer->Color);
-
- dapi->draw_arc (arc, NULL, NULL);
- return 1;
-}
-
static void
draw_element_package (ElementType *element)
{
@@ -498,7 +422,7 @@ DrawEverything (BoxTypePtr drawn_area)
{
r_search (PCB->Data->element_tree, drawn_area, NULL, element_callback, &side);
r_search (PCB->Data->name_tree[NAME_INDEX (PCB)], drawn_area, NULL, name_callback, &side);
- DrawLayer (&(PCB->Data->Layer[max_copper_layer + side]), drawn_area);
+ dapi->draw_layer (&(PCB->Data->Layer[max_copper_layer + side]), drawn_area, NULL);
}
r_search (PCB->Data->pad_tree, drawn_area, NULL, pad_callback, &side);
}
@@ -662,25 +586,6 @@ via_mask_callback (const BoxType * b, void *cl)
return 1;
}
-struct poly_info {
- const BoxType *drawn_area;
- LayerType *layer;
-};
-
-static int
-poly_callback (const BoxType * b, void *cl)
-{
- struct poly_info *i = cl;
- PolygonType *polygon = (PolygonType *)b;
-
- if (TEST_FLAG (SELECTEDFLAG, polygon)) gui->set_color (Output.fgGC, i->layer->SelectedColor);
- else if (TEST_FLAG (FOUNDFLAG, polygon)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
- else gui->set_color (Output.fgGC, i->layer->Color);
-
- dapi->draw_poly (polygon, i->drawn_area, NULL);
- return 1;
-}
-
static int
pad_mask_callback (const BoxType * b, void *cl)
{
@@ -709,7 +614,7 @@ DrawSilk (int side, const BoxType * drawn_area)
{
gui->use_mask (HID_MASK_BEFORE);
#endif
- DrawLayer (LAYER_PTR (max_copper_layer + side), drawn_area);
+ dapi->draw_layer (LAYER_PTR (max_copper_layer + side), drawn_area, NULL);
/* draw package */
r_search (PCB->Data->element_tree, drawn_area, NULL, element_callback, &side);
r_search (PCB->Data->name_tree[NAME_INDEX (PCB)], drawn_area, NULL, name_callback, &side);
@@ -724,7 +629,7 @@ DrawSilk (int side, const BoxType * drawn_area)
if (gui->poly_after)
{
gui->use_mask (HID_MASK_AFTER);
- DrawLayer (LAYER_PTR (max_copper_layer + layer), drawn_area);
+ dapi->draw_layer (LAYER_PTR (max_copper_layer + layer), drawn_area, NULL);
/* draw package */
r_search (PCB->Data->element_tree, drawn_area, NULL, element_callback, &side);
r_search (PCB->Data->name_tree[NAME_INDEX (PCB)], drawn_area, NULL, name_callback, &side);
@@ -812,116 +717,6 @@ DrawRats (BoxTypePtr drawn_area)
gui->use_mask (HID_MASK_OFF);
}
-static int
-text_callback (const BoxType * b, void *cl)
-{
- 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;
-}
-
-/* ---------------------------------------------------------------------------
- * draws one non-copper layer
- */
-void
-DrawLayerCommon (LayerTypePtr Layer, const BoxType * screen, bool clear_pins)
-{
- int component_group = GetLayerGroupNumberByNumber (component_silk_layer);
- int solder_group = GetLayerGroupNumberByNumber (solder_silk_layer);
- int group = GetLayerGroupNumberByPointer (Layer);
- struct poly_info info = {screen, Layer};
-
- /* print the non-clearing polys */
- r_search (Layer->polygon_tree, screen, NULL, poly_callback, &info);
-
- if (clear_pins && TEST_FLAG (CHECKPLANESFLAG, PCB))
- return;
-
- /* draw all visible lines this layer */
- r_search (Layer->line_tree, screen, NULL, line_callback, Layer);
-
- /* draw the layer arcs on screen */
- r_search (Layer->arc_tree, screen, NULL, arc_callback, Layer);
-
- /* draw the layer text on screen */
- r_search (Layer->text_tree, screen, NULL, text_callback, Layer);
-
- /* We should check for gui->gui here, but it's kinda cool seeing the
- auto-outline magically disappear when you first add something to
- the "outline" layer. */
-
- if (strcmp (Layer->Name, "outline") == 0 ||
- strcmp (Layer->Name, "route") == 0)
- {
- if (IsLayerEmpty (Layer))
- {
- gui->set_color (Output.fgGC, Layer->Color);
- gui->set_line_width (Output.fgGC, PCB->minWid);
- gui->draw_rect (Output.fgGC, 0, 0, PCB->MaxWidth, PCB->MaxHeight);
- }
- return;
- }
-
- /* draw element pins */
- r_search (PCB->Data->pin_tree, screen, NULL, pin_inlayer_callback, Layer);
-
- /* draw element pads */
- if (group == component_group)
- r_search (PCB->Data->pad_tree, screen, NULL, pad_inlayer_callback, Layer);
-
- if (group == solder_group)
- r_search (PCB->Data->pad_tree, screen, NULL, pad_inlayer_callback, Layer);
-
- /* draw vias */
- r_search (PCB->Data->via_tree, screen, NULL, via_inlayer_callback, Layer);
- r_search (PCB->Data->pin_tree, screen, NULL, hole_callback, NULL);
- r_search (PCB->Data->via_tree, screen, NULL, hole_callback, NULL);
-}
-
-void
-DrawLayer (LayerTypePtr Layer, const BoxType * screen)
-{
- struct poly_info info = {screen, Layer};
-
- /* print the non-clearing polys */
- r_search (Layer->polygon_tree, screen, NULL, poly_callback, &info);
-
- /* draw all visible lines this layer */
- r_search (Layer->line_tree, screen, NULL, line_callback, Layer);
-
- /* draw the layer arcs on screen */
- r_search (Layer->arc_tree, screen, NULL, arc_callback, Layer);
-
- /* draw the layer text on screen */
- r_search (Layer->text_tree, screen, NULL, text_callback, Layer);
-
- /* We should check for gui->gui here, but it's kinda cool seeing the
- auto-outline magically disappear when you first add something to
- the "outline" layer. */
- if (IsLayerEmpty (Layer)
- && (strcmp (Layer->Name, "outline") == 0
- || strcmp (Layer->Name, "route") == 0))
- {
- gui->set_color (Output.fgGC, Layer->Color);
- gui->set_line_width (Output.fgGC, PCB->minWid);
- gui->draw_rect (Output.fgGC,
- 0, 0,
- PCB->MaxWidth, PCB->MaxHeight);
- }
-}
-
/* ---------------------------------------------------------------------------
* draws one layer group. Returns non-zero if pins and pads should be
* drawn with this group.
@@ -943,7 +738,7 @@ DrawLayerGroup (int group, const BoxType *drawn_area)
strcmp (Layer->Name, "route") == 0)
rv = 0;
if (layernum < max_copper_layer && Layer->On)
- DrawLayerCommon (Layer, drawn_area, true);
+ dapi->draw_layer (Layer, drawn_area, NULL);
}
if (n_entries > 1)
rv = 1;
diff --git a/src/draw.h b/src/draw.h
index adfee36..cf324a5 100644
--- a/src/draw.h
+++ b/src/draw.h
@@ -54,7 +54,6 @@ void DrawElementName (ElementTypePtr);
void DrawElementPackage (ElementTypePtr);
void DrawElementPinsAndPads (ElementTypePtr);
void DrawObject (int, void *, void *);
-void DrawLayer (LayerTypePtr, const BoxType *);
void EraseVia (PinTypePtr);
void EraseRat (RatTypePtr);
void EraseViaName (PinTypePtr);
diff --git a/src/draw_funcs.c b/src/draw_funcs.c
index 8a2d557..679d973 100644
--- a/src/draw_funcs.c
+++ b/src/draw_funcs.c
@@ -1,7 +1,10 @@
#include "global.h"
#include "data.h"
+#include "misc.h"
+#include "rtree.h"
#include "draw_funcs.h"
+#include "draw.h"
static void
_draw_pv (PinType *pv, bool draw_hole)
@@ -182,6 +185,206 @@ draw_poly (PolygonType *polygon, const BoxType *drawn_area, void *userdata)
}
}
+static int
+line_callback (const BoxType * b, void *cl)
+{
+ LayerType *layer = cl;
+ LineType *line = (LineType *)b;
+
+ if (TEST_FLAG (SELECTEDFLAG, line)) gui->set_color (Output.fgGC, layer->SelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, line)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+
+ dapi->draw_line (line, NULL, NULL);
+ return 1;
+}
+
+static int
+arc_callback (const BoxType * b, void *cl)
+{
+ LayerType *layer = cl;
+ ArcType *arc = (ArcType *)b;
+
+ if (TEST_FLAG (SELECTEDFLAG, arc)) gui->set_color (Output.fgGC, layer->SelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, arc)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+
+ dapi->draw_arc (arc, NULL, NULL);
+ return 1;
+}
+
+struct poly_info {
+ const const BoxType *drawn_area;
+ LayerType *layer;
+};
+
+static int
+poly_callback (const BoxType * b, void *cl)
+{
+ struct poly_info *i = cl;
+ PolygonType *polygon = (PolygonType *)b;
+
+ if (TEST_FLAG (SELECTEDFLAG, polygon)) gui->set_color (Output.fgGC, i->layer->SelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, polygon)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, i->layer->Color);
+
+ dapi->draw_poly (polygon, i->drawn_area, NULL);
+ return 1;
+}
+
+static int
+text_callback (const BoxType * b, void *cl)
+{
+ 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;
+}
+
+static void
+set_pv_inlayer_color (PinType *pv, LayerType *layer, int type)
+{
+ if (TEST_FLAG (WARNFLAG, pv)) gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pv)) gui->set_color (Output.fgGC, (type == VIA_TYPE) ? PCB->ViaSelectedColor
+ : PCB->PinSelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, pv)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+}
+
+static int
+pin_inlayer_callback (const BoxType * b, void *cl)
+{
+ set_pv_inlayer_color ((PinType *)b, cl, PIN_TYPE);
+ dapi->draw_pin ((PinType *)b, NULL, NULL);
+ return 1;
+}
+
+static int
+via_inlayer_callback (const BoxType * b, void *cl)
+{
+ set_pv_inlayer_color ((PinType *)b, cl, VIA_TYPE);
+ dapi->draw_via ((PinType *)b, NULL, NULL);
+ return 1;
+}
+
+static int
+pad_inlayer_callback (const BoxType * b, void *cl)
+{
+ PadTypePtr pad = (PadTypePtr) b;
+ LayerType *layer = cl;
+ int solder_group = GetLayerGroupNumberByNumber (solder_silk_layer);
+ int group = GetLayerGroupNumberByPointer (layer);
+
+ int side = (group == solder_group) ? SOLDER_LAYER : COMPONENT_LAYER;
+
+ if (ON_SIDE (pad, side))
+ {
+ 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 if (TEST_FLAG (FOUNDFLAG, pad)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+
+ dapi->draw_pad (pad, NULL, NULL);
+ }
+ return 1;
+}
+
+static int
+hole_callback (const BoxType * b, void *cl)
+{
+ PinTypePtr pv = (PinTypePtr) b;
+ int plated = cl ? *(int *) cl : -1;
+
+ if ((plated == 0 && !TEST_FLAG (HOLEFLAG, pv)) ||
+ (plated == 1 && TEST_FLAG (HOLEFLAG, pv)))
+ return 1;
+
+ if (TEST_FLAG (WARNFLAG, pv)) gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pv)) gui->set_color (Output.fgGC, PCB->PinSelectedColor);
+ else gui->set_color (Output.fgGC, Settings.BlackColor);
+
+ dapi->draw_hole (pv, NULL, NULL);
+ return 1;
+}
+
+static void
+draw_layer (LayerType *layer, const BoxType *drawn_area, void *userdata)
+{
+ int component_group = GetLayerGroupNumberByNumber (component_silk_layer);
+ int solder_group = GetLayerGroupNumberByNumber (solder_silk_layer);
+ int layer_num = GetLayerNumber (PCB->Data, layer);
+ int group = GetLayerGroupNumberByPointer (layer);
+ struct poly_info info = {drawn_area, layer};
+
+ /* print the non-clearing polys */
+ r_search (layer->polygon_tree, drawn_area, NULL, poly_callback, &info);
+
+ if (TEST_FLAG (CHECKPLANESFLAG, PCB))
+ return;
+
+ /* draw all visible lines this layer */
+ r_search (layer->line_tree, drawn_area, NULL, line_callback, layer);
+
+ /* draw the layer arcs on drawn_area */
+ r_search (layer->arc_tree, drawn_area, NULL, arc_callback, layer);
+
+ /* draw the layer text on drawn_area */
+ r_search (layer->text_tree, drawn_area, NULL, text_callback, layer);
+
+ /* We should check for gui->gui here, but it's kinda cool seeing the
+ auto-outline magically disappear when you first add something to
+ the "outline" layer. */
+
+ if (strcmp (layer->Name, "outline") == 0 ||
+ strcmp (layer->Name, "route") == 0)
+ {
+ if (IsLayerEmpty (layer))
+ {
+ gui->set_color (Output.fgGC, layer->Color);
+ gui->set_line_width (Output.fgGC, PCB->minWid);
+ gui->draw_rect (Output.fgGC, 0, 0, PCB->MaxWidth, PCB->MaxHeight);
+ }
+ return;
+ }
+
+ /* Don't draw vias on silk layers */
+ if (layer_num >= max_copper_layer)
+ return;
+
+#if 0
+ /* Don't draw vias on layers which are out of the layer stack */
+ if ((group >= component_group && group >= solder_group) ||
+ (group <= component_group && group <= solder_group))
+ return;
+#endif
+
+ /* draw element pins */
+ r_search (PCB->Data->pin_tree, drawn_area, NULL, pin_inlayer_callback, layer);
+
+ /* draw element pads */
+ if (group == component_group)
+ r_search (PCB->Data->pad_tree, drawn_area, NULL, pad_inlayer_callback, layer);
+
+ if (group == solder_group)
+ r_search (PCB->Data->pad_tree, drawn_area, NULL, pad_inlayer_callback, layer);
+
+ /* draw vias */
+ r_search (PCB->Data->via_tree, drawn_area, NULL, via_inlayer_callback, layer);
+ r_search (PCB->Data->pin_tree, drawn_area, NULL, hole_callback, NULL);
+ r_search (PCB->Data->via_tree, drawn_area, NULL, hole_callback, NULL);
+}
+
struct draw_funcs d_f = {
.draw_pin = draw_pin,
.draw_pin_mask = draw_pin_mask,
@@ -195,6 +398,7 @@ struct draw_funcs d_f = {
.draw_rat = draw_rat,
.draw_arc = draw_arc,
.draw_poly = draw_poly,
+ .draw_layer = draw_layer,
};
struct draw_funcs *dapi = &d_f;
diff --git a/src/draw_funcs.h b/src/draw_funcs.h
index 1f97d82..25c33a1 100644
--- a/src/draw_funcs.h
+++ b/src/draw_funcs.h
@@ -11,6 +11,7 @@ struct draw_funcs {
void (*draw_rat) (RatType *, const BoxType *, void *);
void (*draw_arc) (ArcType *, const BoxType *, void *);
void (*draw_poly) (PolygonType *, const BoxType *, void *);
+ void (*draw_layer) (LayerType *, const BoxType *, void *);
};
extern struct draw_funcs *dapi;
diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
index 9642579..a56c8b9 100644
--- a/src/hid/gerber/gerber.c
+++ b/src/hid/gerber/gerber.c
@@ -26,6 +26,7 @@
#include "misc.h"
#include "error.h"
#include "draw.h"
+#include "draw_funcs.h"
#include "hid.h"
#include "../hidint.h"
@@ -719,7 +720,7 @@ gerber_set_layer (const char *name, int group, int empty)
{
if (outline_layer
&& outline_layer != PCB->Data->Layer+idx)
- DrawLayer (outline_layer, ®ion);
+ dapi->draw_layer (outline_layer, ®ion, NULL);
else if (!outline_layer)
{
hidGC gc = gui->make_gc ();
diff --git a/src/hid/ps/ps.c b/src/hid/ps/ps.c
index 79459d6..91ba337 100644
--- a/src/hid/ps/ps.c
+++ b/src/hid/ps/ps.c
@@ -16,6 +16,7 @@
#include "misc.h"
#include "error.h"
#include "draw.h"
+#include "draw_funcs.h"
#include "hid.h"
#include "../hidint.h"
@@ -863,7 +864,7 @@ ps_set_layer (const char *name, int group, int empty)
&& strcmp (name, "outline")
&& strcmp (name, "route"))
{
- DrawLayer (outline_layer, ®ion);
+ dapi->draw_layer (outline_layer, ®ion, NULL);
}
return 1;
commit 427e04ec09da124a225a66884f35bcfb369aeb15
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Crasy test
diff --git a/src/Makefile.am b/src/Makefile.am
index 5abbfb2..34cd5b3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -63,6 +63,8 @@ PCB_SRCS = \
dolists.h \
draw.c \
draw.h \
+ draw_funcs.c \
+ draw_funcs.h \
drill.c \
drill.h \
edif.y \
diff --git a/src/draw.c b/src/draw.c
index c041195..c71e849 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -41,6 +41,7 @@
#include "crosshair.h"
#include "data.h"
#include "draw.h"
+#include "draw_funcs.h"
#include "error.h"
#include "mymem.h"
#include "misc.h"
@@ -85,54 +86,12 @@ static void DrawEverything (BoxTypePtr);
static void DrawPPV (int group, const BoxType *);
static int DrawLayerGroup (int, const BoxType *);
static void AddPart (void *);
-static void SetPVColor (PinTypePtr, int);
static void DrawEMark (ElementTypePtr, LocationType, LocationType, bool);
static void DrawMask (int side, BoxType *);
static void DrawPaste (int side, BoxType *);
static void DrawRats (BoxType *);
static void DrawSilk (int side, const BoxType *);
-/*--------------------------------------------------------------------------------------
- * setup color for pin or via
- */
-static void
-SetPVColor (PinTypePtr Pin, int Type)
-{
- char *color;
-
- if (Type == VIA_TYPE)
- {
- if (!doing_pinout
- && TEST_FLAG (WARNFLAG | SELECTEDFLAG | FOUNDFLAG, Pin))
- {
- if (TEST_FLAG (WARNFLAG, Pin))
- color = PCB->WarnColor;
- else if (TEST_FLAG (SELECTEDFLAG, Pin))
- color = PCB->ViaSelectedColor;
- else
- color = PCB->ConnectedColor;
- }
- else
- color = PCB->ViaColor;
- }
- else
- {
- if (!doing_pinout
- && TEST_FLAG (WARNFLAG | SELECTEDFLAG | FOUNDFLAG, Pin))
- {
- if (TEST_FLAG (WARNFLAG, Pin))
- color = PCB->WarnColor;
- else if (TEST_FLAG (SELECTEDFLAG, Pin))
- color = PCB->PinSelectedColor;
- else
- color = PCB->ConnectedColor;
- }
- else
- color = PCB->PinColor;
- }
-
- gui->set_color (Output.fgGC, color);
-}
/*---------------------------------------------------------------------------
* Adds the update rect to the update region
@@ -172,172 +131,96 @@ Redraw (void)
}
static void
-_draw_pv_name (PinType *pv)
+set_pv_color (PinType *pv, int type)
{
- BoxType box;
- bool vert;
- TextType text;
-
- 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--;
+ if (TEST_FLAG (WARNFLAG, pv)) gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pv)) gui->set_color (Output.fgGC, (type == VIA_TYPE) ? PCB->ViaSelectedColor
+ : PCB->PinSelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, pv)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, (type == VIA_TYPE) ? PCB->ViaColor
+ : PCB->PinColor);
}
static void
-_draw_pv (PinTypePtr pv, bool draw_hole)
+set_pv_inlayer_color (PinType *pv, LayerType *layer, int type)
{
- 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);
+ if (TEST_FLAG (WARNFLAG, pv)) gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pv)) gui->set_color (Output.fgGC, (type == VIA_TYPE) ? PCB->ViaSelectedColor
+ : PCB->PinSelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, pv)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
}
static int
pin_callback (const BoxType * b, void *cl)
{
- draw_pin ((PinType *)b, false);
+ set_pv_color ((PinType *)b, PIN_TYPE);
+ dapi->draw_pin ((PinType *)b, NULL, NULL);
return 1;
}
-static void
-draw_via (PinTypePtr via, bool draw_hole)
+static int
+pin_inlayer_callback (const BoxType * b, void *cl)
{
- SetPVColor (via, VIA_TYPE);
- _draw_pv (via, draw_hole);
+ set_pv_inlayer_color ((PinType *)b, cl, PIN_TYPE);
+ dapi->draw_pin ((PinType *)b, NULL, NULL);
+ return 1;
}
static int
via_callback (const BoxType * b, void *cl)
{
- draw_via ((PinType *)b, false);
+ set_pv_color ((PinType *)b, VIA_TYPE);
+ dapi->draw_via ((PinType *)b, NULL, NULL);
return 1;
}
-static void
-draw_pad_name (PadType *pad)
+static int
+via_inlayer_callback (const BoxType * b, void *cl)
{
- 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);
+ set_pv_inlayer_color ((PinType *)b, cl, VIA_TYPE);
+ dapi->draw_via ((PinType *)b, NULL, NULL);
+ return 1;
}
-static void
-_draw_pad (hidGC gc, PadType *pad, bool clear, bool mask)
+static int
+pad_callback (const BoxType * b, void *cl)
{
- 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);
+ PadTypePtr pad = (PadTypePtr) b;
+ int *side = cl;
- _draw_pad (Output.fgGC, pad, false, false);
+ if (ON_SIDE (pad, *side))
+ {
+ 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 if (TEST_FLAG (FOUNDFLAG, pad)) 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);
- if (doing_pinout || TEST_FLAG (DISPLAYNAMEFLAG, pad))
- draw_pad_name (pad);
+ dapi->draw_pad (pad, NULL, NULL);
+ }
+ return 1;
}
static int
-pad_callback (const BoxType * b, void *cl)
+pad_inlayer_callback (const BoxType * b, void *cl)
{
PadTypePtr pad = (PadTypePtr) b;
- int *side = cl;
+ LayerType *layer = cl;
+ int solder_group = GetLayerGroupNumberByNumber (solder_silk_layer);
+ int group = GetLayerGroupNumberByPointer (layer);
- if (ON_SIDE (pad, *side))
- draw_pad (pad);
+ int side = (group == solder_group) ? SOLDER_LAYER : COMPONENT_LAYER;
+
+ if (ON_SIDE (pad, side))
+ {
+ 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 if (TEST_FLAG (FOUNDFLAG, pad)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+
+ dapi->draw_pad (pad, NULL, NULL);
+ }
return 1;
}
@@ -379,12 +262,27 @@ draw_element_pins_and_pads (ElementType *element)
PAD_LOOP (element);
{
if (doing_pinout || doing_assy || FRONT (pad) || PCB->InvisibleObjectsOn)
- draw_pad (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 if (TEST_FLAG (FOUNDFLAG, pad)) 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);
+
+ dapi->draw_pad (pad, NULL, NULL);
+ }
}
END_LOOP;
PIN_LOOP (element);
{
- draw_pin (pin, true);
+ set_pv_color (pin, PIN_TYPE);
+ dapi->draw_pin (pin, NULL, NULL);
+
+ if (TEST_FLAG (WARNFLAG, pin)) gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pin)) gui->set_color (Output.fgGC, PCB->PinSelectedColor);
+ else gui->set_color (Output.fgGC, Settings.BlackColor);
+
+ dapi->draw_hole (pin, NULL, NULL);
}
END_LOOP;
}
@@ -408,35 +306,11 @@ hole_callback (const BoxType * b, void *cl)
(plated == 1 && TEST_FLAG (HOLEFLAG, pv)))
return 1;
- if (TEST_FLAG (THINDRAWFLAG, PCB))
- {
- if (!TEST_FLAG (HOLEFLAG, pv))
- {
- gui->set_line_cap (Output.fgGC, Round_Cap);
- gui->set_line_width (Output.fgGC, 0);
- gui->draw_arc (Output.fgGC,
- pv->X, pv->Y, pv->DrillingHole / 2,
- pv->DrillingHole / 2, 0, 360);
- }
- }
- else
- gui->fill_circle (Output.bgGC, pv->X, pv->Y, pv->DrillingHole / 2);
+ if (TEST_FLAG (WARNFLAG, pv)) gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pv)) gui->set_color (Output.fgGC, PCB->PinSelectedColor);
+ else gui->set_color (Output.fgGC, Settings.BlackColor);
- if (TEST_FLAG (HOLEFLAG, pv))
- {
- if (TEST_FLAG (WARNFLAG, pv))
- gui->set_color (Output.fgGC, PCB->WarnColor);
- else if (TEST_FLAG (SELECTEDFLAG, pv))
- gui->set_color (Output.fgGC, PCB->ViaSelectedColor);
- else
- gui->set_color (Output.fgGC, Settings.BlackColor);
-
- gui->set_line_cap (Output.fgGC, Round_Cap);
- gui->set_line_width (Output.fgGC, 0);
- gui->draw_arc (Output.fgGC,
- pv->X, pv->Y, pv->DrillingHole / 2,
- pv->DrillingHole / 2, 0, 360);
- }
+ dapi->draw_hole (pv, NULL, NULL);
return 1;
}
@@ -482,39 +356,17 @@ CountHoles (int *plated, int *unplated, BoxType *drawn_area)
if (unplated != NULL) *unplated = hcs.nunplated;
}
-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);
+ LayerType *layer = cl;
+ LineType *line = (LineType *)b;
+
+ if (TEST_FLAG (SELECTEDFLAG, line)) gui->set_color (Output.fgGC, layer->SelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, line)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+
+ dapi->draw_line (line, NULL, NULL);
return 1;
}
@@ -523,71 +375,25 @@ rat_callback (const BoxType * b, void *cl)
{
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 (SELECTEDFLAG, rat)) gui->set_color (Output.fgGC, PCB->RatSelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, rat)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, PCB->RatColor);
- 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
- _draw_line ((LineType *) rat);
+ dapi->draw_rat (rat, NULL, NULL);
return 1;
}
-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);
+ LayerType *layer = cl;
+ ArcType *arc = (ArcType *)b;
+
+ if (TEST_FLAG (SELECTEDFLAG, arc)) gui->set_color (Output.fgGC, layer->SelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, arc)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+
+ dapi->draw_arc (arc, NULL, NULL);
return 1;
}
@@ -607,12 +413,14 @@ draw_element_package (ElementType *element)
/* draw lines, arcs, text and pins */
ELEMENTLINE_LOOP (element);
{
- _draw_line (line);
+ //_draw_line (line);
+ dapi->draw_line (line, NULL, NULL);
}
END_LOOP;
ARC_LOOP (element);
{
- _draw_arc (arc);
+ //_draw_arc (arc);
+ dapi->draw_arc (arc, NULL, NULL);
}
END_LOOP;
}
@@ -841,13 +649,16 @@ DrawPPV (int group, const BoxType *drawn_area)
}
static int
-clearPin_callback (const BoxType * b, void *cl)
+pin_mask_callback (const BoxType * b, void *cl)
{
- PinType *pin = (PinTypePtr) b;
- if (TEST_FLAG (THINDRAWFLAG, PCB) || TEST_FLAG (THINDRAWPOLYFLAG, PCB))
- gui->thindraw_pcb_pv (Output.pmGC, Output.pmGC, pin, false, true);
- else
- gui->fill_pcb_pv (Output.pmGC, Output.pmGC, pin, false, true);
+ dapi->draw_pin_mask ((PinType *) b, NULL, NULL);
+ return 1;
+}
+
+static int
+via_mask_callback (const BoxType * b, void *cl)
+{
+ dapi->draw_via_mask ((PinType *) b, NULL, NULL);
return 1;
}
@@ -861,49 +672,22 @@ poly_callback (const BoxType * b, void *cl)
{
struct poly_info *i = cl;
PolygonType *polygon = (PolygonType *)b;
- static char *color;
-
- if (!polygon->Clipped)
- return 0;
- if (TEST_FLAG (SELECTEDFLAG, polygon))
- color = i->layer->SelectedColor;
- else if (TEST_FLAG (FOUNDFLAG, polygon))
- color = PCB->ConnectedColor;
- else
- color = i->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, 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 &&
- 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, i->drawn_area);
- }
+ if (TEST_FLAG (SELECTEDFLAG, polygon)) gui->set_color (Output.fgGC, i->layer->SelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, polygon)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, i->layer->Color);
+ dapi->draw_poly (polygon, i->drawn_area, NULL);
return 1;
}
static int
-clearPad_callback (const BoxType * b, void *cl)
+pad_mask_callback (const BoxType * b, void *cl)
{
PadTypePtr pad = (PadTypePtr) b;
int *side = cl;
- if (ON_SIDE (pad, *side) && pad->Mask)
- _draw_pad (Output.pmGC, pad, true, true);
+ if (ON_SIDE (pad, *side))
+ dapi->draw_pad_mask (pad, NULL, NULL);
return 1;
}
@@ -933,9 +717,9 @@ DrawSilk (int side, const BoxType * drawn_area)
}
gui->use_mask (HID_MASK_CLEAR);
- r_search (PCB->Data->pin_tree, drawn_area, NULL, clearPin_callback, NULL);
- r_search (PCB->Data->via_tree, drawn_area, NULL, clearPin_callback, NULL);
- r_search (PCB->Data->pad_tree, drawn_area, NULL, clearPad_callback, &side);
+ r_search (PCB->Data->pin_tree, drawn_area, NULL, pin_mask_callback, NULL);
+ r_search (PCB->Data->via_tree, drawn_area, NULL, via_mask_callback, NULL);
+ r_search (PCB->Data->pad_tree, drawn_area, NULL, pad_mask_callback, &side);
if (gui->poly_after)
{
@@ -983,9 +767,9 @@ DrawMask (int side, BoxType * screen)
gui->use_mask (HID_MASK_CLEAR);
}
- r_search (PCB->Data->pin_tree, screen, NULL, clearPin_callback, NULL);
- r_search (PCB->Data->via_tree, screen, NULL, clearPin_callback, NULL);
- r_search (PCB->Data->pad_tree, screen, NULL, clearPad_callback, &side);
+ r_search (PCB->Data->pin_tree, screen, NULL, pin_mask_callback, NULL);
+ r_search (PCB->Data->via_tree, screen, NULL, via_mask_callback, NULL);
+ r_search (PCB->Data->pad_tree, screen, NULL, pad_mask_callback, &side);
if (thin)
gui->set_color (Output.pmGC, "erase");
@@ -1005,13 +789,8 @@ DrawPaste (int side, BoxType *drawn_area)
gui->set_color (Output.fgGC, PCB->ElementColor);
ALLPAD_LOOP (PCB->Data);
{
- if (ON_SIDE (pad, side) && !TEST_FLAG (NOPASTEFLAG, pad) && pad->Mask > 0)
- {
- if (pad->Mask < pad->Thickness)
- _draw_pad (Output.fgGC, pad, true, true);
- else
- _draw_pad (Output.fgGC, pad, false, false);
- }
+ if (ON_SIDE (pad, side))
+ dapi->draw_pad_paste (pad, NULL, NULL);
}
ENDALL_LOOP;
}
@@ -1059,6 +838,9 @@ text_callback (const BoxType * b, void *cl)
void
DrawLayerCommon (LayerTypePtr Layer, const BoxType * screen, bool clear_pins)
{
+ int component_group = GetLayerGroupNumberByNumber (component_silk_layer);
+ int solder_group = GetLayerGroupNumberByNumber (solder_silk_layer);
+ int group = GetLayerGroupNumberByPointer (Layer);
struct poly_info info = {screen, Layer};
/* print the non-clearing polys */
@@ -1079,6 +861,55 @@ DrawLayerCommon (LayerTypePtr Layer, const BoxType * screen, bool clear_pins)
/* We should check for gui->gui here, but it's kinda cool seeing the
auto-outline magically disappear when you first add something to
the "outline" layer. */
+
+ if (strcmp (Layer->Name, "outline") == 0 ||
+ strcmp (Layer->Name, "route") == 0)
+ {
+ if (IsLayerEmpty (Layer))
+ {
+ gui->set_color (Output.fgGC, Layer->Color);
+ gui->set_line_width (Output.fgGC, PCB->minWid);
+ gui->draw_rect (Output.fgGC, 0, 0, PCB->MaxWidth, PCB->MaxHeight);
+ }
+ return;
+ }
+
+ /* draw element pins */
+ r_search (PCB->Data->pin_tree, screen, NULL, pin_inlayer_callback, Layer);
+
+ /* draw element pads */
+ if (group == component_group)
+ r_search (PCB->Data->pad_tree, screen, NULL, pad_inlayer_callback, Layer);
+
+ if (group == solder_group)
+ r_search (PCB->Data->pad_tree, screen, NULL, pad_inlayer_callback, Layer);
+
+ /* draw vias */
+ r_search (PCB->Data->via_tree, screen, NULL, via_inlayer_callback, Layer);
+ r_search (PCB->Data->pin_tree, screen, NULL, hole_callback, NULL);
+ r_search (PCB->Data->via_tree, screen, NULL, hole_callback, NULL);
+}
+
+void
+DrawLayer (LayerTypePtr Layer, const BoxType * screen)
+{
+ struct poly_info info = {screen, Layer};
+
+ /* print the non-clearing polys */
+ r_search (Layer->polygon_tree, screen, NULL, poly_callback, &info);
+
+ /* draw all visible lines this layer */
+ r_search (Layer->line_tree, screen, NULL, line_callback, Layer);
+
+ /* draw the layer arcs on screen */
+ r_search (Layer->arc_tree, screen, NULL, arc_callback, Layer);
+
+ /* draw the layer text on screen */
+ r_search (Layer->text_tree, screen, NULL, text_callback, Layer);
+
+ /* We should check for gui->gui here, but it's kinda cool seeing the
+ auto-outline magically disappear when you first add something to
+ the "outline" layer. */
if (IsLayerEmpty (Layer)
&& (strcmp (Layer->Name, "outline") == 0
|| strcmp (Layer->Name, "route") == 0))
@@ -1091,12 +922,6 @@ DrawLayerCommon (LayerTypePtr Layer, const BoxType * screen, bool clear_pins)
}
}
-void
-DrawLayer (LayerTypePtr Layer, const BoxType * screen)
-{
- DrawLayerCommon (Layer, screen, false);
-}
-
/* ---------------------------------------------------------------------------
* draws one layer group. Returns non-zero if pins and pads should be
* drawn with this group.
@@ -1187,6 +1012,20 @@ GatherPadName (PadTypePtr Pad)
return;
}
+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);
+}
+
/* ---------------------------------------------------------------------------
* lowlevel drawing routine for text objects
*/
diff --git a/src/draw_funcs.c b/src/draw_funcs.c
new file mode 100644
index 0000000..8a2d557
--- /dev/null
+++ b/src/draw_funcs.c
@@ -0,0 +1,200 @@
+
+#include "global.h"
+#include "data.h"
+#include "draw_funcs.h"
+
+static void
+_draw_pv (PinType *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);
+}
+
+static void
+draw_pin (PinType *pin, const BoxType *drawn_area, void *userdata)
+{
+ _draw_pv (pin, false);
+}
+
+static void
+draw_pin_mask (PinType *pin, const BoxType *drawn_area, void *userdata)
+{
+ if (TEST_FLAG (THINDRAWFLAG, PCB) || TEST_FLAG (THINDRAWPOLYFLAG, PCB))
+ gui->thindraw_pcb_pv (Output.pmGC, Output.pmGC, pin, false, true);
+ else
+ gui->fill_pcb_pv (Output.pmGC, Output.pmGC, pin, false, true);
+}
+
+static void
+draw_via (PinType *via, const BoxType *drawn_area, void *userdata)
+{
+ _draw_pv (via, false);
+}
+
+static void
+draw_via_mask (PinType *via, const BoxType *drawn_area, void *userdata)
+{
+ if (TEST_FLAG (THINDRAWFLAG, PCB) || TEST_FLAG (THINDRAWPOLYFLAG, PCB))
+ gui->thindraw_pcb_pv (Output.pmGC, Output.pmGC, via, false, true);
+ else
+ gui->fill_pcb_pv (Output.pmGC, Output.pmGC, via, false, true);
+}
+
+static void
+draw_hole (PinType *pv, const BoxType *drawn_area, void *userdata)
+{
+ if (!TEST_FLAG (THINDRAWFLAG, PCB))
+ gui->fill_circle (Output.bgGC, pv->X, pv->Y, pv->DrillingHole / 2);
+
+ if (TEST_FLAG (THINDRAWFLAG, PCB) || TEST_FLAG (HOLEFLAG, pv))
+ {
+ gui->set_line_cap (Output.fgGC, Round_Cap);
+ gui->set_line_width (Output.fgGC, 0);
+
+ gui->draw_arc (Output.fgGC, pv->X, pv->Y,
+ pv->DrillingHole / 2, pv->DrillingHole / 2, 0, 360);
+ }
+}
+
+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, const BoxType *drawn_area, void *userdata)
+{
+ _draw_pad (Output.fgGC, pad, false, false);
+}
+
+static void
+draw_pad_mask (PadType *pad, const BoxType *drawn_area, void *userdata)
+{
+ if (pad->Mask <= 0)
+ return;
+
+ _draw_pad (Output.pmGC, pad, true, true);
+}
+
+static void
+draw_pad_paste (PadType *pad, const BoxType *drawn_area, void *userdata)
+{
+ if (TEST_FLAG (NOPASTEFLAG, pad) || pad->Mask <= 0)
+ return;
+
+ if (pad->Mask < pad->Thickness)
+ _draw_pad (Output.fgGC, pad, true, true);
+ else
+ _draw_pad (Output.fgGC, pad, false, false);
+}
+
+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 (LineType *line, const BoxType *drawn_area, void *userdata)
+{
+ _draw_line (line);
+}
+
+static void
+draw_rat (RatType *rat, const BoxType *drawn_area, void *userdata)
+{
+ 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
+ _draw_line ((LineType *) rat);
+}
+
+static void
+draw_arc (ArcType *arc, const BoxType *drawn_area, void *userdata)
+{
+ 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_poly (PolygonType *polygon, const BoxType *drawn_area, void *userdata)
+{
+ if (!polygon->Clipped)
+ return;
+
+ if (gui->thindraw_pcb_polygon != NULL &&
+ (TEST_FLAG (THINDRAWFLAG, PCB) ||
+ TEST_FLAG (THINDRAWPOLYFLAG, PCB)))
+ gui->thindraw_pcb_polygon (Output.fgGC, polygon, drawn_area);
+ else
+ gui->fill_pcb_polygon (Output.fgGC, polygon, drawn_area);
+
+ /* 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, drawn_area);
+ }
+}
+
+struct draw_funcs d_f = {
+ .draw_pin = draw_pin,
+ .draw_pin_mask = draw_pin_mask,
+ .draw_via = draw_via,
+ .draw_via_mask = draw_via_mask,
+ .draw_hole = draw_hole,
+ .draw_pad = draw_pad,
+ .draw_pad_mask = draw_pad_mask,
+ .draw_pad_paste = draw_pad_paste,
+ .draw_line = draw_line,
+ .draw_rat = draw_rat,
+ .draw_arc = draw_arc,
+ .draw_poly = draw_poly,
+};
+
+struct draw_funcs *dapi = &d_f;
diff --git a/src/draw_funcs.h b/src/draw_funcs.h
new file mode 100644
index 0000000..1f97d82
--- /dev/null
+++ b/src/draw_funcs.h
@@ -0,0 +1,16 @@
+struct draw_funcs {
+ void (*draw_pin) (PinType *, const BoxType *, void *);
+ void (*draw_pin_mask) (PinType *, const BoxType *, void *);
+ void (*draw_via) (PinType *, const BoxType *, void *);
+ void (*draw_via_mask) (PinType *, const BoxType *, void *);
+ void (*draw_hole) (PinType *, const BoxType *, void *);
+ void (*draw_pad) (PadType *, const BoxType *, void *);
+ void (*draw_pad_mask) (PadType *, const BoxType *, void *);
+ void (*draw_pad_paste) (PadType *, const BoxType *, void *);
+ void (*draw_line) (LineType *, const BoxType *, void *);
+ void (*draw_rat) (RatType *, const BoxType *, void *);
+ void (*draw_arc) (ArcType *, const BoxType *, void *);
+ void (*draw_poly) (PolygonType *, const BoxType *, void *);
+};
+
+extern struct draw_funcs *dapi;
|
|
From: <gi...@gp...> - 2011-04-27 19:32:31
|
The branch, master has been updated
via 4d239d983d96a13fcd48b837c5178af145ecca0c (commit)
from e87ceebc5b665597ea27aa5e9d476da07522dcb2 (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
=========
globalconst.h | 32 ++++++++--------
src/action.c | 20 +++++-----
src/autoplace.c | 2 +-
src/buffer.c | 2 +-
src/change.c | 4 +-
src/const.h | 12 ++++--
src/create.c | 4 +-
src/djopt.c | 8 ++--
src/find.c | 2 +-
src/hid/batch/batch.c | 4 +-
src/hid/gcode/gcode.c | 6 +-
src/hid/gerber/gerber.c | 10 ++--
src/hid/gtk/gtkhid-main.c | 4 +-
src/hid/gtk/gui-drc-window.c | 3 -
src/hid/gtk/gui-misc.c | 30 +++++++-------
src/hid/gtk/gui-top-window.c | 46 +++++++++++------------
src/hid/gtk/gui.h | 9 +---
src/hid/lesstif/dialogs.c | 8 ++--
src/hid/lesstif/lesstif.h | 4 --
src/hid/lesstif/main.c | 38 +++++++++---------
src/hid/lesstif/styles.c | 8 ++--
src/hid/nelma/nelma.c | 4 +-
src/hid/png/png.c | 17 +++-----
src/hid/ps/eps.c | 2 +-
src/hid/ps/ps.c | 84 +++++++++++++++++++++---------------------
src/main.c | 46 +++++++++++-----------
src/misc.c | 10 ++--
src/parse_l.l | 8 ++--
src/print.c | 10 ++--
src/report.c | 8 ++--
src/vendor.c | 14 ++----
31 files changed, 222 insertions(+), 237 deletions(-)
=================
Commit Messages
=================
commit 4d239d983d96a13fcd48b837c5178af145ecca0c
Author: Andrew Poelstra <as...@sf...>
Commit: Peter Clifton <pc...@ca...>
PCB / Physical unit macros patch
Specify various constants in physical units, converting to PCB internal
units using macros. When reporting to the user (or exporting), convert
dimensions to physical units using macros so the code does not rely on
details of PCB's internal coordinates in so many places.
:100755 100755 ff8e696... 71bc61a... M globalconst.h
:100644 100644 7744cd1... 53dde28... M src/action.c
:100644 100644 b9db528... 65eef92... M src/autoplace.c
:100644 100644 4f746e9... 907c7e6... M src/buffer.c
:100644 100644 277717a... c65c534... M src/change.c
:100644 100644 3b6cd30... 724b3be... M src/const.h
:100644 100644 f942c40... 6409139... M src/create.c
:100644 100644 4995c08... 09abdc5... M src/djopt.c
:100644 100644 47bd68c... b740890... M src/find.c
:100644 100644 99c2220... f14d75f... M src/hid/batch/batch.c
:100644 100644 6491afd... 50f22cb... M src/hid/gcode/gcode.c
:100644 100644 d5843ef... 9642579... M src/hid/gerber/gerber.c
:100644 100644 a51d167... 0df478d... M src/hid/gtk/gtkhid-main.c
:100644 100644 70a097e... 674e495... M src/hid/gtk/gui-drc-window.c
:100644 100644 75ba763... 21c8161... M src/hid/gtk/gui-misc.c
:100644 100644 1a81c58... ca82b96... M src/hid/gtk/gui-top-window.c
:100644 100644 5616489... cfb9708... M src/hid/gtk/gui.h
:100644 100644 8756d1f... ffe99eb... M src/hid/lesstif/dialogs.c
:100644 100644 66a5c12... 1bd368f... M src/hid/lesstif/lesstif.h
:100644 100644 928a1ae... b22328c... M src/hid/lesstif/main.c
:100644 100644 829caab... 9e9b61c... M src/hid/lesstif/styles.c
:100644 100644 6e911ff... 7d136d6... M src/hid/nelma/nelma.c
:100644 100644 ab64e5a... cb38659... M src/hid/png/png.c
:100644 100644 f94175f... afcfb73... M src/hid/ps/eps.c
:100644 100644 a417753... 79459d6... M src/hid/ps/ps.c
:100644 100644 d14c935... ab9a614... M src/main.c
:100644 100644 5bea138... 0e25089... M src/misc.c
:100644 100644 57cd1c6... 56d3b84... M src/parse_l.l
:100644 100644 cd19d31... 286888d... M src/print.c
:100644 100644 6adf368... 5131ec6... M src/report.c
:100644 100644 754f7d1... aa766bb... M src/vendor.c
=========
Changes
=========
commit 4d239d983d96a13fcd48b837c5178af145ecca0c
Author: Andrew Poelstra <as...@sf...>
Commit: Peter Clifton <pc...@ca...>
PCB / Physical unit macros patch
Specify various constants in physical units, converting to PCB internal
units using macros. When reporting to the user (or exporting), convert
dimensions to physical units using macros so the code does not rely on
details of PCB's internal coordinates in so many places.
diff --git a/globalconst.h b/globalconst.h
index ff8e696..71bc61a 100755
--- a/globalconst.h
+++ b/globalconst.h
@@ -60,36 +60,36 @@
/* ---------------------------------------------------------------------------
* some limit specifications
*/
-#define LARGE_VALUE 10000000 /* maximum extent of board and elements in 1/100 mil */
+#define LARGE_VALUE 10000000 /* maximum extent of board and elements */
#define MAX_LAYER 16 /* max number of layer, check source */
/* code for more changes, a *lot* more changes */
#define DEF_LAYER 8 /* default number of layers for new boards */
#define NUM_STYLES 4
-#define MIN_LINESIZE 1 /* thickness of lines in 1/100000'' */
+#define MIN_LINESIZE MIL_TO_COORD(0.01) /* thickness of lines */
#define MAX_LINESIZE LARGE_VALUE
#define MIN_TEXTSCALE 10 /* scaling of text objects in percent */
#define MAX_TEXTSCALE 10000
-#define MIN_PINORVIASIZE 2000 /* size of a pin or via in 1/100 mils */
-#define MIN_PINORVIAHOLE 400 /* size of a pins or vias drilling hole */
+#define MIN_PINORVIASIZE MIL_TO_COORD(20) /* size of a pin or via */
+#define MIN_PINORVIAHOLE MIL_TO_COORD(4) /* size of a pins or vias drilling hole */
#define MAX_PINORVIASIZE LARGE_VALUE
-#define MIN_PINORVIACOPPER 400 /* min difference outer-inner diameter */
-#define MIN_PADSIZE 100 /* min size of a pad */
+#define MIN_PINORVIACOPPER MIL_TO_COORD(4) /* min difference outer-inner diameter */
+#define MIN_PADSIZE MIL_TO_COORD(1) /* min size of a pad */
#define MAX_PADSIZE LARGE_VALUE /* max size of a pad */
-#define MIN_DRC_VALUE 10
-#define MAX_DRC_VALUE 50000
-#define MIN_DRC_SILK 100
-#define MAX_DRC_SILK 3000
-#define MIN_DRC_DRILL 100
-#define MAX_DRC_DRILL 5000
+#define MIN_DRC_VALUE MIL_TO_COORD(0.1)
+#define MAX_DRC_VALUE MIL_TO_COORD(500)
+#define MIN_DRC_SILK MIL_TO_COORD(1)
+#define MAX_DRC_SILK MIL_TO_COORD(30)
+#define MIN_DRC_DRILL MIL_TO_COORD(1)
+#define MAX_DRC_DRILL MIL_TO_COORD(50)
#define MIN_DRC_RING 0
-#define MAX_DRC_RING 10000
-#define MIN_GRID 1 /* min grid in 1/100 mils */
-#define MAX_GRID 100000 /* max grid in 1/100 mils */
+#define MAX_DRC_RING MIL_TO_COORD(100)
+#define MIN_GRID 1
+#define MAX_GRID MIL_TO_COORD(1000)
#define MAX_FONTPOSITION 255 /* upper limit of characters in my font */
#define MAX_COORD LARGE_VALUE /* coordinate limits */
-#define MIN_SIZE 1000 /* lowest width and height of the board */
+#define MIN_SIZE MIL_TO_COORD(10) /* lowest width and height of the board */
#define MAX_BUFFER 5 /* number of pastebuffers */
/* additional changes in menu.c are */
/* also required to select more buffers */
diff --git a/src/action.c b/src/action.c
index 7744cd1..53dde28 100644
--- a/src/action.c
+++ b/src/action.c
@@ -1857,15 +1857,15 @@ ActionDRCheck (int argc, char **argv, int x, int y)
if (gui->drc_gui == NULL || gui->drc_gui->log_drc_overview)
{
- Message (_("Rules are minspace %d.%02d, minoverlap %d.%d "
- "minwidth %d.%02d, minsilk %d.%02d\n"
- "min drill %d.%02d, min annular ring %d.%02d\n"),
- (PCB->Bloat + 1) / 100, (PCB->Bloat + 1) % 100,
- PCB->Shrink / 100, PCB->Shrink % 100,
- PCB->minWid / 100, PCB->minWid % 100,
- PCB->minSlk / 100, PCB->minSlk % 100,
- PCB->minDrill / 100, PCB->minDrill % 100,
- PCB->minRing / 100, PCB->minRing % 100);
+ Message (_("Rules are minspace %.2f, minoverlap %.2f "
+ "minwidth %.2f, minsilk %.2f\n"
+ "min drill %.2f, min annular ring %.2f\n"),
+ COORD_TO_MIL(PCB->Bloat + 1),
+ COORD_TO_MIL(PCB->Shrink),
+ COORD_TO_MIL(PCB->minWid),
+ COORD_TO_MIL(PCB->minSlk),
+ COORD_TO_MIL(PCB->minDrill),
+ COORD_TO_MIL(PCB->minRing));
}
count = DRCAll ();
if (gui->drc_gui == NULL || gui->drc_gui->log_drc_overview)
@@ -2393,7 +2393,7 @@ from.
%end-doc */
-#define GAP 10000
+#define GAP MIL_TO_COORD(100)
static int
ActionDisperseElements (int argc, char **argv, int x, int y)
diff --git a/src/autoplace.c b/src/autoplace.c
index b9db528..65eef92 100644
--- a/src/autoplace.c
+++ b/src/autoplace.c
@@ -379,7 +379,7 @@ ComputeCost (NetListTypePtr Nets, double T0, double T)
box->Y2 = maxy;
}
/* okay, add half-perimeter to cost! */
- W += (maxx - minx) / 100 + (maxy - miny) / 100 +
+ W += COORD_TO_MIL(maxx - minx) + COORD_TO_MIL(maxy - miny) +
((allpads && !allsameside) ? CostParameter.via_cost : 0);
}
/* now compute penalty function Wc which is proportional to
diff --git a/src/buffer.c b/src/buffer.c
index 4f746e9..907c7e6 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1064,7 +1064,7 @@ ConvertBufferToElement (BufferTypePtr Buffer)
{
char num[8];
if (via->Mask < via->Thickness)
- via->Mask = via->Thickness + 2 * MASKFRAME * 100; /* MASKFRAME is in mils */
+ via->Mask = via->Thickness + 2 * MIL_TO_COORD(MASKFRAME); /* MASKFRAME is in mils */
if (via->Name)
CreateNewPin (Element, via->X, via->Y, via->Thickness,
via->Clearance, via->Mask, via->DrillingHole,
diff --git a/src/change.c b/src/change.c
index 277717a..c65c534 100644
--- a/src/change.c
+++ b/src/change.c
@@ -739,7 +739,7 @@ ChangeLineClearSize (LayerTypePtr Layer, LineTypePtr Line)
if (Line->Clearance == 0)
{
CLEAR_FLAG (CLEARLINEFLAG, Line);
- Line->Clearance = 1000;
+ Line->Clearance = MIL_TO_COORD(10);
}
SetLineBoundingBox (Line);
r_insert_entry (Layer->line_tree, (BoxTypePtr) Line, 0);
@@ -820,7 +820,7 @@ ChangeArcClearSize (LayerTypePtr Layer, ArcTypePtr Arc)
if (Arc->Clearance == 0)
{
CLEAR_FLAG (CLEARLINEFLAG, Arc);
- Arc->Clearance = 1000;
+ Arc->Clearance = MIL_TO_COORD(10);
}
SetArcBoundingBox (Arc);
r_insert_entry (Layer->arc_tree, (BoxTypePtr) Arc, 0);
diff --git a/src/const.h b/src/const.h
index 3b6cd30..724b3be 100644
--- a/src/const.h
+++ b/src/const.h
@@ -65,12 +65,16 @@
#define COS_22_5_DEGREE 0.923879533 /* cos(22.5) */
#define TAN_30_DEGREE 0.577350269 /* tan(30) */
#define TAN_60_DEGREE 1.732050808 /* tan(60) */
-#define MIL_TO_MM 0.025400000
-#define MM_TO_MIL (1./MIL_TO_MM)
-#define COOR_TO_MM 0.000254000
-#define MM_TO_COOR (1./COOR_TO_MM)
#define LN_2_OVER_2 0.346573590
+/* PCB/physical unit conversions */
+#define COORD_TO_MIL(n) ((n) / 100.0)
+#define MIL_TO_COORD(n) ((n) * 100.0)
+#define COORD_TO_MM(n) ((n) * 0.000254)
+#define MM_TO_COORD(n) ((n) / 0.000254)
+#define COORD_TO_INCH(n) (COORD_TO_MIL(n) / 1000.0)
+#define INCH_TO_COORD(n) (MIL_TO_COORD(n) * 1000.0)
+
/* ---------------------------------------------------------------------------
* modes
*/
diff --git a/src/create.c b/src/create.c
index f942c40..6409139 100644
--- a/src/create.c
+++ b/src/create.c
@@ -248,8 +248,8 @@ CreateNewVia (DataTypePtr Data,
if (SQUARE (via->X - X) + SQUARE (via->Y - Y) <=
SQUARE (via->DrillingHole / 2 + DrillingHole / 2))
{
- Message (_("Dropping via at (%d, %d) because it's hole would overlap with the via "
- "at (%d, %d)\n"), X/100, Y/100, via->X/100, via->Y/100);
+ Message (_("Dropping via at (%f, %f) because it's hole would overlap with the via "
+ "at (%f, %f)\n"), COORD_TO_MIL(X), COORD_TO_MIL(Y), COORD_TO_MIL(via->X), COORD_TO_MIL(via->Y));
return (NULL); /* don't allow via stacking */
}
}
diff --git a/src/djopt.c b/src/djopt.c
index 4995c08..09abdc5 100644
--- a/src/djopt.c
+++ b/src/djopt.c
@@ -1719,7 +1719,7 @@ orthopull ()
c = c->next;
}
if (rv)
- printf ("orthopull: %d mils saved\n", rv / 100);
+ printf ("orthopull: %f mils saved\n", COORD_TO_MIL(rv));
return rv;
}
@@ -2099,8 +2099,8 @@ vianudge ()
/* at this point, we know we can move it */
- dprintf ("vianudge: nudging via at %d,%d by %d mils saving %d\n",
- c->x, c->y, len / 100, saved / 100);
+ dprintf ("vianudge: nudging via at %d,%d by %f mils saving %f\n",
+ c->x, c->y, COORD_TO_MIL(len), COORD_TO_MIL(saved));
rv += len * saved;
move_corner (c, c2->x, c2->y);
@@ -2111,7 +2111,7 @@ vianudge ()
}
if (rv)
- printf ("vianudge: %d mils saved\n", rv / 100);
+ printf ("vianudge: %f mils saved\n", COORD_TO_MIL(rv));
return rv;
}
diff --git a/src/find.c b/src/find.c
index 47bd68c..b740890 100644
--- a/src/find.c
+++ b/src/find.c
@@ -157,7 +157,7 @@ RCSID ("$Id$");
#define IS_PV_ON_PAD(PV,Pad) \
( IsPointInPad((PV)->X, (PV)->Y, MAX((PV)->Thickness/2 +Bloat,0), (Pad)))
-#define LENGTH_TO_HUMAN(value) (Settings.grid_units_mm ? ((value) / 100000.0 * 25.4) : ((value) / 100.0))
+#define LENGTH_TO_HUMAN(value) (Settings.grid_units_mm ? COORD_TO_MM(value) : COORD_TO_MIL(value))
#define LENGTH_DIGITS (Settings.grid_units_mm ? 4 : 2)
#define LENGTH_UNITS_STRING (Settings.grid_units_mm ? "mm" : "mils")
diff --git a/src/hid/batch/batch.c b/src/hid/batch/batch.c
index 99c2220..f14d75f 100644
--- a/src/hid/batch/batch.c
+++ b/src/hid/batch/batch.c
@@ -85,8 +85,8 @@ info (int argc, char **argv, int x, int y)
}
printf("Filename: %s\n", PCB->Filename);
printf("Size: %g x %g mils, %g x %g mm\n",
- PCB->MaxWidth / 100.0,
- PCB->MaxHeight / 100.0,
+ COORD_TO_MIL(PCB->MaxWidth),
+ COORD_TO_MIL(PCB->MaxHeight),
PCB->MaxWidth * COOR_TO_MM,
PCB->MaxHeight * COOR_TO_MM);
cg = GetLayerGroupNumberByNumber (component_silk_layer);
diff --git a/src/hid/gcode/gcode.c b/src/hid/gcode/gcode.c
index 6491afd..50f22cb 100644
--- a/src/hid/gcode/gcode.c
+++ b/src/hid/gcode/gcode.c
@@ -68,7 +68,7 @@
#endif
#define CRASH fprintf(stderr, "HID error: pcb called unimplemented GCODE function %s.\n", __FUNCTION__); abort()
-#define pcb_unit 100000.0 /* pcb internal units per inch */
+#define pcb_unit (INCH_TO_COORD(1)) /* pcb internal units per inch */
struct color_struct
{
/* the descriptor used by the gd library */
@@ -182,7 +182,7 @@ REGISTER_ATTRIBUTES (gcode_attribute_list)
/* *** Utility funcions **************************************************** */
-/* convert from default PCB units (1/100 mil) to gcode units */
+/* convert from default PCB units to gcode units */
static int pcb_to_gcode (int pcb)
{
int gcode;
@@ -446,7 +446,7 @@ gcode_do_export (HID_Attr_Val * options)
gcode_cutdepth = options[HA_cutdepth].real_value * scale;
gcode_drilldepth = options[HA_drilldepth].real_value * scale;
gcode_safeZ = options[HA_safeZ].real_value * scale;
- gcode_toolradius = options[HA_toolradius].real_value * scale * pcb_unit; /* in PCB units (1/100 mil) */
+ gcode_toolradius = options[HA_toolradius].real_value * scale * pcb_unit; /* in PCB units */
if (metric)
gcode_toolradius *= 1 / 25.4;
gcode_choose_groups ();
diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
index d5843ef..9642579 100644
--- a/src/hid/gerber/gerber.c
+++ b/src/hid/gerber/gerber.c
@@ -145,7 +145,7 @@ int n_pending_drills = 0, max_pending_drills = 0;
/*----------------------------------------------------------------------------*/
/* Defined Constants */
/*----------------------------------------------------------------------------*/
-#define AUTO_OUTLINE_WIDTH 800 /* Auto-geneated outline width of 8 mils */
+#define AUTO_OUTLINE_WIDTH MIL_TO_COORD(8) /* Auto-geneated outline width of 8 mils */
/*----------------------------------------------------------------------------*/
@@ -203,16 +203,16 @@ printAperture(FILE *f, int i)
{
case ROUND:
fprintf (f, "%%ADD%dC,%.4f*%%\015\012", dCode,
- width / 100000.0);
+ COORD_TO_INCH(width));
break;
case SQUARE:
fprintf (f, "%%ADD%dR,%.4fX%.4f*%%\015\012",
- dCode, width / 100000.0, width / 100000.0);
+ dCode, COORD_TO_INCH(width), COORD_TO_INCH(width));
break;
case OCTAGON:
fprintf (f, "%%AMOCT%d*5,0,8,0,0,%.4f,22.5*%%\015\012"
"%%ADD%dOCT%d*%%\015\012", dCode,
- width / (100000.0 * COS_22_5_DEGREE), dCode,
+ COORD_TO_INCH(width) / COS_22_5_DEGREE, dCode,
dCode);
break;
#if 0
@@ -628,7 +628,7 @@ gerber_set_layer (const char *name, int group, int empty)
if (curapp->aperture_used[i])
fprintf (f, "T%02dC%.3f\015\012",
i + DCODE_BASE,
- global_aperture_sizes[i] / 100000.0);
+ COORD_TO_INCH(global_aperture_sizes[i]));
fprintf (f, "%%\015\012");
/* FIXME */
return 1;
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index a51d167..0df478d 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -1652,9 +1652,9 @@ CursorAction(int argc, char **argv, int x, int y)
* come up with PCB internal units.
*/
if (strncasecmp (argv[3], "mm", 2) == 0)
- xu = yu = MM_TO_COOR;
+ xu = yu = MM_TO_COORD(1);
else if (strncasecmp (argv[3], "mil", 3) == 0)
- xu = yu = 100;
+ xu = yu = MIL_TO_COORD(1);
else if (strncasecmp (argv[3], "grid", 4) == 0)
xu = yu = PCB->Grid;
else if (strncasecmp (argv[3], "view", 4) == 0)
diff --git a/src/hid/gtk/gui-drc-window.c b/src/hid/gtk/gui-drc-window.c
index 70a097e..674e495 100644
--- a/src/hid/gtk/gui-drc-window.c
+++ b/src/hid/gtk/gui-drc-window.c
@@ -962,9 +962,6 @@ ghid_drc_window_show (gboolean raise)
gtk_widget_show_all (drc_window);
}
-#define UNIT1(value) (Settings.grid_units_mm ? ((value) / 100000.0 * 25.4) : ((value) / 100.0))
-#define UNIT(value) UNIT1(value) , (Settings.grid_units_mm ? "mm" : "mils")
-
void ghid_drc_window_append_violation (DrcViolationType *violation)
{
GhidDrcViolation *violation_obj;
diff --git a/src/hid/gtk/gui-misc.c b/src/hid/gtk/gui-misc.c
index 75ba763..21c8161 100644
--- a/src/hid/gtk/gui-misc.c
+++ b/src/hid/gtk/gui-misc.c
@@ -509,17 +509,17 @@ ghid_set_status_line_label (void)
"<b>text</b>=%i%% "
"<b>buffer</b>=#%i"),
Settings.ShowSolderSide ? _("solder") : _("component"),
- PCB->Grid / 100.0,
+ COORD_TO_MIL(PCB->Grid),
(int) Settings.GridFactor,
TEST_FLAG (ALLDIRECTIONFLAG, PCB) ? "all" :
(PCB->Clipping == 0 ? "45" :
(PCB->Clipping == 1 ? "45_/" : "45\\_")),
TEST_FLAG (RUBBERBANDFLAG, PCB) ? ",R " : " ",
- Settings.LineThickness / 100.0,
- Settings.ViaThickness / 100.0,
- Settings.ViaDrillingHole / 100.0,
+ COORD_TO_MIL(Settings.LineThickness),
+ COORD_TO_MIL(Settings.ViaThickness),
+ COORD_TO_MIL(Settings.ViaDrillingHole),
ghidgui->compact_horizontal ? "\n" : "",
- Settings.Keepaway / 100.0,
+ COORD_TO_MIL(Settings.Keepaway),
Settings.TextScale, Settings.BufferNumber + 1);
else
snprintf (text, sizeof (text),
@@ -532,16 +532,16 @@ ghid_set_status_line_label (void)
"<b>text</b>=%i%% "
"<b>buffer</b>=#%i"),
Settings.ShowSolderSide ? _("solder") : _("component"),
- PCB->Grid * COOR_TO_MM, (int) Settings.GridFactor,
+ COORD_TO_MM(PCB->Grid), (int) Settings.GridFactor,
TEST_FLAG (ALLDIRECTIONFLAG, PCB) ? "all" :
(PCB->Clipping == 0 ? "45" :
(PCB->Clipping == 1 ? "45_/" : "45\\_")),
TEST_FLAG (RUBBERBANDFLAG, PCB) ? ",R " : " ",
- Settings.LineThickness * COOR_TO_MM,
- Settings.ViaThickness * COOR_TO_MM,
- Settings.ViaDrillingHole * COOR_TO_MM,
+ COORD_TO_MM(Settings.LineThickness),
+ COORD_TO_MM(Settings.ViaThickness),
+ COORD_TO_MM(Settings.ViaDrillingHole),
ghidgui->compact_horizontal ? "\n" : "",
- Settings.Keepaway * COOR_TO_MM,
+ COORD_TO_MM(Settings.Keepaway),
Settings.TextScale, Settings.BufferNumber + 1);
ghid_status_line_set_text (text);
@@ -569,7 +569,7 @@ ghid_get_grid_factor(void)
if (!Settings.grid_units_mm)
return -1;
- factor = PCB->Grid * COOR_TO_MM * grid_scale;
+ factor = COORD_TO_MM(PCB->Grid) * grid_scale;
rounded_factor = floor (factor + .5);
/* check whether the grid is actually metric
@@ -585,20 +585,20 @@ ghid_get_grid_factor(void)
static double
ghid_grid_pcb_to_units (double x, double grid_factor)
{
- double x_scaled = (Settings.grid_units_mm? COOR_TO_MM: 1./100) * x;
+ double x_scaled = (Settings.grid_units_mm ? COORD_TO_MM(1): COORD_TO_MIL(1)) * x;
double nearest_gridpoint;
if (grid_factor < 0)
return x_scaled;
- x *= COOR_TO_MM;
+ x = COORD_TO_MM(x);
nearest_gridpoint = floor (x / grid_factor + .5);
/* honour snapping to an unaligned object */
- if (fabs (nearest_gridpoint * grid_factor - x) > COOR_TO_MM)
+ if (fabs (nearest_gridpoint * grid_factor - x) > COORD_TO_MM(1))
return x_scaled;
/* without mm-adjusted grid_factor
- (return floor (x / PCB->Grid + .5) * PCB->Grid * COOR_TO_MM),
+ (return floor (x / PCB->Grid + .5) * COORD_TO_MM(PCB->Grid)),
the round-off errors redintroduce the bug for 0.1 or 0.05 mm grid
at coordinates more than 1500 mm.
grid_factor makes the stuff work at least up to 254 m,
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 1a81c58..ca82b96 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -408,34 +408,32 @@ ghid_update_toggle_flags ()
#define N_GRID_SETTINGS 11
-#define MM_TO_PCB(mm) ((mm) * 100000 / 25.4)
-
static gdouble grid_mil_values[N_GRID_SETTINGS] = {
- 10.0,
- 20.0,
- 50.0,
- 100.0,
- 200.0,
- 500.0,
- 1000.0,
- 2000.0,
- 2500.0,
- 5000.0,
- 10000.0
+ MIL_TO_COORD (0.10),
+ MIL_TO_COORD (0.20),
+ MIL_TO_COORD (0.50),
+ MIL_TO_COORD (1.00),
+ MIL_TO_COORD (2.00),
+ MIL_TO_COORD (5.00),
+ MIL_TO_COORD (10.0),
+ MIL_TO_COORD (20.0),
+ MIL_TO_COORD (25.0),
+ MIL_TO_COORD (50.0),
+ MIL_TO_COORD (100)
};
static gdouble grid_mm_values[N_GRID_SETTINGS] = {
- MM_TO_PCB (0.002),
- MM_TO_PCB (0.005),
- MM_TO_PCB (0.01),
- MM_TO_PCB (0.02),
- MM_TO_PCB (0.05),
- MM_TO_PCB (0.1),
- MM_TO_PCB (0.2),
- MM_TO_PCB (0.25),
- MM_TO_PCB (0.5),
- MM_TO_PCB (1.0),
- MM_TO_PCB (2.0)
+ MM_TO_COORD (0.002),
+ MM_TO_COORD (0.005),
+ MM_TO_COORD (0.01),
+ MM_TO_COORD (0.02),
+ MM_TO_COORD (0.05),
+ MM_TO_COORD (0.1),
+ MM_TO_COORD (0.2),
+ MM_TO_COORD (0.25),
+ MM_TO_COORD (0.5),
+ MM_TO_COORD (1.0),
+ MM_TO_COORD (2.0)
};
/* When the user toggles grid units mil<->mm, call this to get an
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 5616489..cfb9708 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -55,14 +55,11 @@
/* Go from from the grid units in use (millimeters or mils) to PCB units
| and back again.
- | PCB keeps values internally to 1/100000 inch (0.01 mils), but gui
+ | PCB keeps values internally higher precision, but gui
| widgets (spin buttons, labels, etc) need mils or millimeters.
*/
-#define FROM_PCB_UNITS(v) (Settings.grid_units_mm ? \
- ((v) * 0.000254) : ((v) * 0.01))
-
-#define TO_PCB_UNITS(v) (Settings.grid_units_mm ? \
- ((v) / 0.000254 + 0.5) : ((v) * 100.0 + 0.5))
+#define FROM_PCB_UNITS(v) (Settings.grid_units_mm ? COORD_TO_MM(v) : COORD_TO_MIL(v))
+#define TO_PCB_UNITS(v) (Settings.grid_units_mm ? MM_TO_COORD(v) : MIL_TO_COORD(v))
extern int ghid_flip_x, ghid_flip_y;
#define SIDE_X(x) ((ghid_flip_x ? PCB->MaxWidth - (x) : (x)))
diff --git a/src/hid/lesstif/dialogs.c b/src/hid/lesstif/dialogs.c
index 8756d1f..ffe99eb 100644
--- a/src/hid/lesstif/dialogs.c
+++ b/src/hid/lesstif/dialogs.c
@@ -1140,9 +1140,9 @@ sz_str2val (Widget w, int pcbu)
return atoi (buf);
sscanf (buf, "%lf", &d);
if (Settings.grid_units_mm)
- return MM_TO_PCB (d);
+ return MM_TO_COORD (d);
else
- return MIL_TO_PCB (d);
+ return MIL_TO_COORD (d);
}
static void
@@ -1153,9 +1153,9 @@ sz_val2str (Widget w, int u, int pcbu)
if (pcbu)
{
if (Settings.grid_units_mm)
- d = PCB_TO_MM (u);
+ d = COORD_TO_MM (u);
else
- d = PCB_TO_MIL (u);
+ d = COORD_TO_MIL (u);
sprintf (buf, "%.2f", d + 0.002);
}
else
diff --git a/src/hid/lesstif/lesstif.h b/src/hid/lesstif/lesstif.h
index 66a5c12..1bd368f 100644
--- a/src/hid/lesstif/lesstif.h
+++ b/src/hid/lesstif/lesstif.h
@@ -60,7 +60,3 @@ extern void lesstif_attributes_dialog (char *, AttributeListType *);
#define need_idle_proc lesstif_need_idle_proc
#define show_crosshair lesstif_show_crosshair
-#define PCB_TO_MIL(n) ((n) / 100.0)
-#define PCB_TO_MM(n) ((n) / 100000.0 * 25.4)
-#define MIL_TO_PCB(n) (int)((n) * 100.0 + 0.2)
-#define MM_TO_PCB(n) (int)((n) / 25.4 * 100000.0 + 0.2)
diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index 928a1ae..b22328c 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -890,9 +890,9 @@ CursorAction(int argc, char **argv, int x, int y)
dy = -dy;
if (strncasecmp (argv[3], "mm", 2) == 0)
- xu = yu = MM_TO_COOR;
+ xu = yu = MM_TO_COORD(1);
else if (strncasecmp (argv[3], "mil", 3) == 0)
- xu = yu = 100;
+ xu = yu = MIL_TO_COORD(1);
else if (strncasecmp (argv[3], "grid", 4) == 0)
xu = yu = PCB->Grid;
else if (strncasecmp (argv[3], "view", 4) == 0)
@@ -906,7 +906,7 @@ CursorAction(int argc, char **argv, int x, int y)
yu = PCB->MaxHeight / 100.0;
}
else
- xu = yu = 100;
+ xu = yu = MIL_TO_COORD(1);
EventMoveCrosshair (Crosshair.X+(int)(dx*xu), Crosshair.Y+(int)(dy*yu));
gui->set_crosshair (Crosshair.X, Crosshair.Y, pan_warp);
@@ -2316,16 +2316,16 @@ coords_to_widget (int x, int y, Widget w, int prev_state)
if (Settings.grid_units_mm)
{
/* MM */
- dx = PCB_TO_MM (x);
- dy = PCB_TO_MM (y);
- g = PCB_TO_MM (PCB->Grid);
+ dx = COORD_TO_MM (x);
+ dy = COORD_TO_MM (y);
+ g = COORD_TO_MM (PCB->Grid);
}
else
{
/* Mils */
- dx = PCB_TO_MIL (x);
- dy = PCB_TO_MIL (y);
- g = PCB_TO_MIL (PCB->Grid);
+ dx = COORD_TO_MIL (x);
+ dy = COORD_TO_MIL (y);
+ g = COORD_TO_MIL (PCB->Grid);
}
if (x < 0 && prev_state >= 0)
buf[0] = 0;
@@ -2376,9 +2376,9 @@ pcb2str (int pcbval)
bufp = (bufp + 1) % 20;
if (Settings.grid_units_mm)
- d = PCB_TO_MM (pcbval);
+ d = COORD_TO_MM (pcbval);
else
- d = PCB_TO_MIL (pcbval);
+ d = COORD_TO_MIL (pcbval);
if ((int) (d * 100 + 0.5) == (int) (d + 0.005) * 100)
sprintf (buf[bufp], "%d", (int) d);
@@ -2638,16 +2638,16 @@ idle_proc (XtPointer dummy)
{
if (Settings.grid_units_mm)
{
- g = PCB_TO_MM (old_grid);
- x = PCB_TO_MM (old_gx);
- y = PCB_TO_MM (old_gy);
+ g = COORD_TO_MM (old_grid);
+ x = COORD_TO_MM (old_gx);
+ y = COORD_TO_MM (old_gy);
u = "mm";
}
else
{
- g = PCB_TO_MIL (old_grid);
- x = PCB_TO_MIL (old_gx);
- y = PCB_TO_MIL (old_gy);
+ g = COORD_TO_MIL (old_grid);
+ x = COORD_TO_MIL (old_gx);
+ y = COORD_TO_MIL (old_gy);
u = "mil";
}
if (x || y)
@@ -2677,12 +2677,12 @@ idle_proc (XtPointer dummy)
if (Settings.grid_units_mm)
{
- g = PCB_TO_MM (view_zoom);
+ g = COORD_TO_MM (view_zoom);
units = "mm";
}
else
{
- g = PCB_TO_MIL (view_zoom);
+ g = COORD_TO_MIL (view_zoom);
units = "mil";
}
if ((int) (g * 100 + 0.5) == (int) (g + 0.005) * 100)
diff --git a/src/hid/lesstif/styles.c b/src/hid/lesstif/styles.c
index 829caab..9e9b61c 100644
--- a/src/hid/lesstif/styles.c
+++ b/src/hid/lesstif/styles.c
@@ -101,9 +101,9 @@ update_one_value (int i, int v)
char buf[100];
double d;
if (use_mm)
- d = PCB_TO_MM (v);
+ d = COORD_TO_MM (v);
else
- d = PCB_TO_MIL (v);
+ d = COORD_TO_MIL (v);
sprintf (buf, "%.2f", d);
XmTextSetString (style_values[i], buf);
@@ -172,9 +172,9 @@ style_value_cb (Widget w, int i, void *cbs)
s = XmTextGetString (w);
sscanf (s, "%lf", &d);
if (use_mm)
- n = MM_TO_PCB (d);
+ n = MM_TO_COORD (d);
else
- n = MIL_TO_PCB (d);
+ n = MIL_TO_COORD (d);
switch (i)
{
case SSthick:
diff --git a/src/hid/nelma/nelma.c b/src/hid/nelma/nelma.c
index 6e911ff..7d136d6 100644
--- a/src/hid/nelma/nelma.c
+++ b/src/hid/nelma/nelma.c
@@ -182,12 +182,12 @@ REGISTER_ATTRIBUTES(nelma_attribute_list)
/* *** Utility funcions **************************************************** */
-/* convert from default PCB units (1/100 mil) to nelma units */
+/* convert from default PCB units to nelma units */
static int pcb_to_nelma(int pcb)
{
int nelma;
- nelma = (pcb * nelma_dpi) / 100000;
+ nelma = COORD_TO_INCH(pcb) * nelma_dpi;
return nelma;
}
diff --git a/src/hid/png/png.c b/src/hid/png/png.c
index ab64e5a..cb38659 100644
--- a/src/hid/png/png.c
+++ b/src/hid/png/png.c
@@ -316,13 +316,13 @@ parse_bloat (char *str)
suf[0] = 0;
sscanf (str, "%lf %s", &val, suf);
if (strcasecmp (suf, "in") == 0)
- bloat = val * 100000.0;
+ bloat = INCH_TO_COORD(val);
else if (strcasecmp (suf, "mil") == 0)
- bloat = val * 100.0;
+ bloat = MIL_TO_COORD(val);
else if (strcasecmp (suf, "mm") == 0)
- bloat = val * MM_TO_COOR;
+ bloat = MM_TO_COORD(val);
else if (strcasecmp (suf, "um") == 0)
- bloat = val * MM_TO_COOR / 1000.0;
+ bloat = MM_TO_COORD(val) / 1000.0;
else if (strcasecmp (suf, "pix") == 0
|| strcasecmp (suf, "px") == 0)
bloat = val * scale;
@@ -628,13 +628,10 @@ png_do_export (HID_Attr_Val * options)
if (dpi > 0)
{
/*
- * a scale of 1 means 1 pixel is 1/100 mil
- * a scale of 100,000 means 1 pixel is 1 inch
- * FIXME -- need to use a macro to go from PCB units
- * so if we ever change pcb's internal units, this
- * will get updated.
+ * a scale of 1 means 1 pixel is 1 inch
+ * a scale of 10 means 1 pixel is 10 inches
*/
- scale = 100000.0 / dpi;
+ scale = INCH_TO_COORD(1) / dpi;
w = w / scale;
h = h / scale;
}
diff --git a/src/hid/ps/eps.c b/src/hid/ps/eps.c
index f94175f..afcfb73 100644
--- a/src/hid/ps/eps.c
+++ b/src/hid/ps/eps.c
@@ -231,7 +231,7 @@ eps_hid_export_to_file (FILE * the_file, HID_Attr_Val * options)
in_mono = options[HA_mono].int_value;
-#define pcb2em(x) (int)((x) / 100000.0 * 72.0 * options[HA_scale].real_value + 1)
+#define pcb2em(x) (int)(COORD_TO_INCH(x) * 72.0 * options[HA_scale].real_value + 1)
fprintf (f, "%%%%BoundingBox: 0 0 %d %d\n",
pcb2em (bounds->X2 - bounds->X1),
pcb2em (bounds->Y2 - bounds->Y1));
diff --git a/src/hid/ps/ps.c b/src/hid/ps/ps.c
index a417753..79459d6 100644
--- a/src/hid/ps/ps.c
+++ b/src/hid/ps/ps.c
@@ -110,44 +110,44 @@ typedef struct
* {A,B,C,D,E}-Size here are the ANSI sizes and not the architectural sizes.
*/
-#define MARGINX 50000
-#define MARGINY 50000
+#define MARGINX MIL_TO_COORD(500)
+#define MARGINY MIL_TO_COORD(500)
static MediaType media_data[] = {
- {"A0", 3311023, 4681102, MARGINX, MARGINY},
- {"A1", 2338582, 3311023, MARGINX, MARGINY},
- {"A2", 1653543, 2338582, MARGINX, MARGINY},
- {"A3", 1169291, 1653543, MARGINX, MARGINY},
- {"A4", 826771, 1169291, MARGINX, MARGINY},
- {"A5", 582677, 826771, MARGINX, MARGINY},
- {"A6", 413385, 582677, MARGINX, MARGINY},
- {"A7", 291338, 413385, MARGINX, MARGINY},
- {"A8", 204724, 291338, MARGINX, MARGINY},
- {"A9", 145669, 204724, MARGINX, MARGINY},
- {"A10", 102362, 145669, MARGINX, MARGINY},
- {"B0", 3937007, 5566929, MARGINX, MARGINY},
- {"B1", 2783464, 3937007, MARGINX, MARGINY},
- {"B2", 1968503, 2783464, MARGINX, MARGINY},
- {"B3", 1389763, 1968503, MARGINX, MARGINY},
- {"B4", 984251, 1389763, MARGINX, MARGINY},
- {"B5", 692913, 984251, MARGINX, MARGINY},
- {"B6", 492125, 692913, MARGINX, MARGINY},
- {"B7", 346456, 492125, MARGINX, MARGINY},
- {"B8", 244094, 346456, MARGINX, MARGINY},
- {"B9", 173228, 244094, MARGINX, MARGINY},
- {"B10", 122047, 173228, MARGINX, MARGINY},
- {"Letter", 850000, 1100000, MARGINX, MARGINY},
- {"11x17", 1100000, 1700000, MARGINX, MARGINY},
- {"Ledger", 1700000, 1100000, MARGINX, MARGINY},
- {"Legal", 850000, 1400000, MARGINX, MARGINY},
- {"Executive", 750000, 1000000, MARGINX, MARGINY},
- {"A-size", 850000, 1100000, MARGINX, MARGINY},
- {"B-size", 1100000, 1700000, MARGINX, MARGINY},
- {"C-size", 1700000, 2200000, MARGINX, MARGINY},
- {"D-size", 2200000, 3400000, MARGINX, MARGINY},
- {"E-size", 3400000, 4400000, MARGINX, MARGINY},
- {"US-Business_Card", 350000, 200000, 0, 0},
- {"Intl-Business_Card", 337500, 212500, 0, 0}
+ {"A0", MM_TO_COORD(841), MM_TO_COORD(1189), MARGINX, MARGINY},
+ {"A1", MM_TO_COORD(594), MM_TO_COORD(841), MARGINX, MARGINY},
+ {"A2", MM_TO_COORD(420), MM_TO_COORD(594), MARGINX, MARGINY},
+ {"A3", MM_TO_COORD(297), MM_TO_COORD(420), MARGINX, MARGINY},
+ {"A4", MM_TO_COORD(210), MM_TO_COORD(297), MARGINX, MARGINY},
+ {"A5", MM_TO_COORD(148), MM_TO_COORD(210), MARGINX, MARGINY},
+ {"A6", MM_TO_COORD(105), MM_TO_COORD(148), MARGINX, MARGINY},
+ {"A7", MM_TO_COORD(74), MM_TO_COORD(105), MARGINX, MARGINY},
+ {"A8", MM_TO_COORD(52), MM_TO_COORD(74), MARGINX, MARGINY},
+ {"A9", MM_TO_COORD(37), MM_TO_COORD(52), MARGINX, MARGINY},
+ {"A10", MM_TO_COORD(26), MM_TO_COORD(37), MARGINX, MARGINY},
+ {"B0", MM_TO_COORD(1000), MM_TO_COORD(1414), MARGINX, MARGINY},
+ {"B1", MM_TO_COORD(707), MM_TO_COORD(1000), MARGINX, MARGINY},
+ {"B2", MM_TO_COORD(500), MM_TO_COORD(707), MARGINX, MARGINY},
+ {"B3", MM_TO_COORD(353), MM_TO_COORD(500), MARGINX, MARGINY},
+ {"B4", MM_TO_COORD(250), MM_TO_COORD(353), MARGINX, MARGINY},
+ {"B5", MM_TO_COORD(176), MM_TO_COORD(250), MARGINX, MARGINY},
+ {"B6", MM_TO_COORD(125), MM_TO_COORD(176), MARGINX, MARGINY},
+ {"B7", MM_TO_COORD(88), MM_TO_COORD(125), MARGINX, MARGINY},
+ {"B8", MM_TO_COORD(62), MM_TO_COORD(88), MARGINX, MARGINY},
+ {"B9", MM_TO_COORD(44), MM_TO_COORD(62), MARGINX, MARGINY},
+ {"B10", MM_TO_COORD(31), MM_TO_COORD(44), MARGINX, MARGINY},
+ {"Letter", INCH_TO_COORD(8.5), INCH_TO_COORD(11), MARGINX, MARGINY},
+ {"11x17", INCH_TO_COORD(11), INCH_TO_COORD(17), MARGINX, MARGINY},
+ {"Ledger", INCH_TO_COORD(17), INCH_TO_COORD(11), MARGINX, MARGINY},
+ {"Legal", INCH_TO_COORD(8.5), INCH_TO_COORD(14), MARGINX, MARGINY},
+ {"Executive", INCH_TO_COORD(7.5), INCH_TO_COORD(10), MARGINX, MARGINY},
+ {"A-size", INCH_TO_COORD(8.5), INCH_TO_COORD(11), MARGINX, MARGINY},
+ {"B-size", INCH_TO_COORD(11), INCH_TO_COORD(17), MARGINX, MARGINY},
+ {"C-size", INCH_TO_COORD(17), INCH_TO_COORD(22), MARGINX, MARGINY},
+ {"D-size", INCH_TO_COORD(22), INCH_TO_COORD(34), MARGINX, MARGINY},
+ {"E-size", INCH_TO_COORD(34), INCH_TO_COORD(44), MARGINX, MARGINY},
+ {"US-Business_Card", INCH_TO_COORD(3.5), INCH_TO_COORD(2.0), 0, 0},
+ {"Intl-Business_Card", INCH_TO_COORD(3.375), INCH_TO_COORD(2.125), 0, 0}
};
#undef MARGINX
@@ -349,8 +349,8 @@ ps_start_file (FILE *f)
*/
fprintf (f, "%%%%DocumentMedia: %s %g %g 0 \"\" \"\"\n",
media_data[media].name,
- media_data[media].Width * 72.0 / 100000.0,
- media_data[media].Height * 72.0 / 100000.0);
+ COORD_TO_INCH(media_data[media].Width) * 72.0,
+ COORD_TO_INCH(media_data[media].Height) * 72.0);
fprintf (f, "%%%%DocumentPaperSizes: %s\n",
media_data[media].name);
@@ -615,8 +615,8 @@ corner (int x, int y, int dx, int dy)
int len = (PCB->MaxWidth + PCB->MaxHeight) / 10;
int len2 = (PCB->MaxWidth + PCB->MaxHeight) / 50;
#else
- int len = 200000;
- int len2 = 20000;
+ int len = MIL_TO_COORD(2000);
+ int len2 = MIL_TO_COORD(200);
#endif
int thick = 0;
/*
@@ -790,7 +790,7 @@ ps_set_layer (const char *name, int group, int empty)
* If users don't want to make smaller boards, or use fewer drill
* sizes, they can always ignore this sheet. */
if (SL_TYPE (idx) == SL_FAB) {
- int natural = (int) ((boffset - 0.5) * 100000) - PCB->MaxHeight / 2;
+ int natural = (int) ((boffset - 0.5) * INCH_TO_COORD(1)) - PCB->MaxHeight / 2;
int needed = PrintFab_overhang();
fprintf (f, "%% PrintFab overhang natural %d, needed %d\n", natural, needed);
if (needed > natural)
@@ -840,7 +840,7 @@ ps_set_layer (const char *name, int group, int empty)
fprintf (f, "/a { gsave setlinewidth translate scale 0 0 1 5 3 roll arc stroke grestore} bind def\n");
if (drill_helper)
fprintf (f,
- "/dh { gsave %d setlinewidth 0 gray %d 0 360 arc stroke grestore} bind def\n",
+ "/dh { gsave %f setlinewidth 0 gray %f 0 360 arc stroke grestore} bind def\n",
MIN_PINORVIAHOLE, MIN_PINORVIAHOLE * 3 / 2);
}
#if 0
diff --git a/src/main.c b/src/main.c
index d14c935..ab9a614 100644
--- a/src/main.c
+++ b/src/main.c
@@ -484,24 +484,24 @@ HID_Attribute main_attribute_list[] = {
COLOR (WarnColor, "#ff8000", "warn-color", "color for warnings"),
COLOR (MaskColor, "#ff0000", "mask-color", "color for solder mask"),
- ISET (ViaThickness, 6000, "via-thickness", 0),
- ISET (ViaDrillingHole, 2800, "via-drilling-hole", 0),
- ISET (LineThickness, 1000, "line-thickness",
+ ISET (ViaThickness, MIL_TO_COORD(60), "via-thickness", 0),
+ ISET (ViaDrillingHole, MIL_TO_COORD(28), "via-drilling-hole", 0),
+ ISET (LineThickness, MIL_TO_COORD(10), "line-thickness",
"Initial thickness of new lines."),
- ISET (RatThickness, 1000, "rat-thickness", 0),
- ISET (Keepaway, 1000, "keepaway", 0),
- ISET (MaxWidth, 600000, "default-PCB-width", 0),
- ISET (MaxHeight, 500000, "default-PCB-height", 0),
+ ISET (RatThickness, MIL_TO_COORD(10), "rat-thickness", 0),
+ ISET (Keepaway, MIL_TO_COORD(10), "keepaway", 0),
+ ISET (MaxWidth, MIL_TO_COORD(MIL_TO_COORD(60)), "default-PCB-width", 0),
+ ISET (MaxHeight, MIL_TO_COORD(MIL_TO_COORD(50)), "default-PCB-height", 0),
ISET (TextScale, 100, "text-scale", 0),
- ISET (AlignmentDistance, 200, "alignment-distance", 0),
- ISET (Bloat, 1000, "bloat", 0),
- ISET (Shrink, 1000, "shrink", 0),
- ISET (minWid, 1000, "min-width", "DRC minimum copper spacing"),
- ISET (minSlk, 1000, "min-silk", "DRC minimum silk width"),
- ISET (minDrill, 1500, "min-drill", "DRC minimum drill diameter"),
- ISET (minRing, 1000, "min-ring", "DRC minimum annular ring"),
-
- RSET (Grid, 1000, "grid", 0),
+ ISET (AlignmentDistance, MIL_TO_COORD(2), "alignment-distance", 0),
+ ISET (Bloat, MIL_TO_COORD(10), "bloat", 0),
+ ISET (Shrink, MIL_TO_COORD(10), "shrink", 0),
+ ISET (minWid, MIL_TO_COORD(10), "min-width", "DRC minimum copper spacing"),
+ ISET (minSlk, MIL_TO_COORD(10), "min-silk", "DRC minimum silk width"),
+ ISET (minDrill, MIL_TO_COORD(15), "min-drill", "DRC minimum drill diameter"),
+ ISET (minRing, MIL_TO_COORD(10), "min-ring", "DRC minimum annular ring"),
+
+ RSET (Grid, MIL_TO_COORD(10), "grid", 0),
RSET (grid_increment_mm, 0.1, "grid-increment-mm", 0),
RSET (grid_increment_mil, 5.0, "grid-increment-mil", 0),
RSET (size_increment_mm, 0.2, "size-increment-mm", 0),
@@ -510,7 +510,7 @@ HID_Attribute main_attribute_list[] = {
RSET (line_increment_mil, 5.0, "line-increment-mil", 0),
RSET (clear_increment_mm, 0.05, "clear-increment-mm", 0),
RSET (clear_increment_mil, 2.0, "clear-increment-mil", 0),
- RSET (IsleArea, 200000000, "minimum polygon area", 0),
+ RSET (IsleArea, MIL_TO_COORD(1400) * MIL_TO_COORD(1400), "minimum polygon area", 0),
ISET (BackupInterval, 60, "backup-interval", 0),
@@ -564,10 +564,10 @@ HID_Attribute main_attribute_list[] = {
SSET (GnetlistProgram, NULL, "gnetlist",
"Sets the name and optionally full path to the gnetlist(3) program"),
- ISET (PinoutOffsetX, 100, "pinout-offset-x", 0),
- ISET (PinoutOffsetY, 100, "pinout-offset-y", 0),
- ISET (PinoutTextOffsetX, 800, "pinout-text-offset-x", 0),
- ISET (PinoutTextOffsetY, -100, "pinout-text-offset-y", 0),
+ ISET (PinoutOffsetX, MIL_TO_COORD(1), "pinout-offset-x", 0),
+ ISET (PinoutOffsetY, MIL_TO_COORD(1), "pinout-offset-y", 0),
+ ISET (PinoutTextOffsetX, MIL_TO_COORD(8), "pinout-text-offset-x", 0),
+ ISET (PinoutTextOffsetY, MIL_TO_COORD(-1), "pinout-text-offset-y", 0),
BSET (DrawGrid, 0, "draw-grid", "default to drawing the grid at startup"),
BSET (ClearLine, 1, "clear-line", 0),
@@ -609,11 +609,11 @@ REGISTER_ATTRIBUTES (main_attribute_list)
if (Settings.LineThickness > MAX_LINESIZE
|| Settings.LineThickness < MIN_LINESIZE)
- Settings.LineThickness = 1000;
+ Settings.LineThickness = MIL_TO_COORD(10);
if (Settings.ViaThickness > MAX_PINORVIASIZE
|| Settings.ViaThickness < MIN_PINORVIASIZE)
- Settings.ViaThickness = 4000;
+ Settings.ViaThickness = MIL_TO_COORD(40);
if (Settings.ViaDrillingHole <= 0)
Settings.ViaDrillingHole =
diff --git a/src/misc.c b/src/misc.c
index 5bea138..0e25089 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -139,13 +139,13 @@ GetValue (const char *val, const char *units, bool * absolute)
if (units && *units)
{
if (strncasecmp (units, "mm", 2) == 0)
- value *= MM_TO_COOR;
+ value = MM_TO_COORD(value);
else if (strncasecmp (units, "cm", 2) == 0)
- value *= MM_TO_COOR * 10;
+ value = 10 * MM_TO_COORD(value);
else if (strncasecmp (units, "mil", 3) == 0)
- value *= 100;
+ value = MIL_TO_COORD(value);
else if (strncasecmp (units, "in", 3) == 0)
- value *= 100000;
+ value = INCH_TO_COORD(value);
}
return value;
}
@@ -841,7 +841,7 @@ ParseRouteString (char *s, RouteStyleTypePtr routeStyle, int scale)
/* for backwards-compatibility, we use a 10-mil default
* for styles which omit the keepaway specification. */
if (*s != ',')
- routeStyle->Keepaway = 1000;
+ routeStyle->Keepaway = MIL_TO_COORD(10);
else
{
s++;
diff --git a/src/parse_l.l b/src/parse_l.l
index 57cd1c6..56d3b84 100644
--- a/src/parse_l.l
+++ b/src/parse_l.l
@@ -143,10 +143,10 @@ Attribute { return(T_ATTRIBUTE); }
yylval.number = (unsigned) *(yytext+1);
return(CHAR_CONST);
}
-{FLOATINGMM} { return parse_number(3937.0079); }
-{FLOATINGUM} { return parse_number(3.9370079); }
-{FLOATINGIN} { return parse_number(100000.0); }
-{FLOATINGMIL} { return parse_number(100.0); }
+{FLOATINGMM} { return parse_number(MM_TO_COORD(1)); }
+{FLOATINGUM} { return parse_number(MM_TO_COORD(1) * 1000); }
+{FLOATINGIN} { return parse_number(INCH_TO_COORD(1)); }
+{FLOATINGMIL} { return parse_number(MIL_TO_COORD(1)); }
{DECIMAL} { return parse_number(1.0); }
{HEX} {
diff --git a/src/print.c b/src/print.c
index cd19d31..286888d 100644
--- a/src/print.c
+++ b/src/print.c
@@ -316,12 +316,12 @@ PrintFab (void)
/*FPrintOutline (); */
gui->set_line_width (Output.fgGC, FAB_LINE_W);
text_at (200000, yoff, 0,
- "Maximum Dimensions: %d mils wide, %d mils high",
- PCB->MaxWidth / 100, PCB->MaxHeight / 100);
+ "Maximum Dimensions: %f mils wide, %f mils high",
+ COORD_TO_MIL(PCB->MaxWidth), COORD_TO_MIL(PCB->MaxHeight));
text_at (PCB->MaxWidth / 2, PCB->MaxHeight + 2000, 1,
- "Board outline is the centerline of this %d mil"
- " rectangle - 0,0 to %d,%d mils",
- FAB_LINE_W / 100, PCB->MaxWidth / 100, PCB->MaxHeight / 100);
+ "Board outline is the centerline of this %f mil"
+ " rectangle - 0,0 to %f,%f mils",
+ COORD_TO_MIL(FAB_LINE_W), COORD_TO_MIL(PCB->MaxWidth), COORD_TO_MIL(PCB->MaxHeight));
}
else
{
diff --git a/src/report.c b/src/report.c
index 6adf368..5131ec6 100644
--- a/src/report.c
+++ b/src/report.c
@@ -54,7 +54,7 @@
static double
units(double value)
-{return (Settings.grid_units_mm ? (value * COOR_TO_MM) : (value / 100.0));}
+{return (Settings.grid_units_mm ? COORD_TO_MM(value) : COORD_TO_MIL(value));}
#define UNIT(value) units(value), (Settings.grid_units_mm ? "mm" : "mils")
@@ -619,17 +619,17 @@ ReportAllNetLengths (int argc, char **argv, int x, int y)
if (strcasecmp (units_name, "mm") == 0)
{
prec = 4;
- scale = COOR_TO_MM;
+ scale = COORD_TO_MM(1);
}
else if (strcasecmp (units_name, "mil") == 0)
{
prec = 2;
- scale = .01;
+ scale = COORD_TO_MIL(1);
}
else if (strcasecmp (units_name, "in") == 0)
{
prec = 5;
- scale = 1./100000;
+ scale = COORD_TO_INCH(1);
}
else
{
diff --git a/src/vendor.c b/src/vendor.c
index 754f7d1..aa766bb 100644
--- a/src/vendor.c
+++ b/src/vendor.c
@@ -327,29 +327,25 @@ ActionLoadVendorFrom (int argc, char **argv, int x, int y)
sval = resource_value (res, "units");
if (sval == NULL)
{
- sf = 100;
+ sf = MIL_TO_COORD(1);
}
else if ((NSTRCMP (sval, "mil") == 0) || (NSTRCMP (sval, "mils") == 0))
{
- sf = 100;
+ sf = MIL_TO_COORD(1);
}
else if ((NSTRCMP (sval, "inch") == 0) || (NSTRCMP (sval, "inches") == 0))
{
- sf = 100000;
+ sf = INCH_TO_COORD(1);
}
else if (NSTRCMP (sval, "mm") == 0)
{
- /*
- * divide by .0254 to convert mm to mils. Then multiply by 100
- * for PCB units
- */
- sf = (100.0 / 0.0254);
+ sf = MM_TO_COORD(1);
}
else
{
Message ("\"%s\" is not a supported units. Defaulting to inch\n",
sval);
- sf = 100000;
+ sf = INCH_TO_COORD(1);
}
|
|
From: <gi...@gp...> - 2011-04-27 00:25:00
|
The branch, master has been updated
via e87ceebc5b665597ea27aa5e9d476da07522dcb2 (commit)
from 3c052533b71678cf92ed1222ceb79dca7f53c935 (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 | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
=================
Commit Messages
=================
commit e87ceebc5b665597ea27aa5e9d476da07522dcb2
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Remove old commented debug printf
:100644 100644 d351889... c041195... M src/draw.c
=========
Changes
=========
commit e87ceebc5b665597ea27aa5e9d476da07522dcb2
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Remove old commented debug printf
diff --git a/src/draw.c b/src/draw.c
index d351889..c041195 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -1736,8 +1736,6 @@ hid_expose_callback (HID * hid, BoxType * region, void *item)
Output.bgGC = gui->make_gc ();
Output.pmGC = gui->make_gc ();
- /*printf("\033[32mhid_expose_callback, s=%p %d\033[0m\n", &(SWAP_IDENT), SWAP_IDENT); */
-
hid->set_color (Output.pmGC, "erase");
hid->set_color (Output.bgGC, "drill");
|
|
From: <gi...@gp...> - 2011-04-27 00:17:15
|
The branch, master has been updated
via 3c052533b71678cf92ed1222ceb79dca7f53c935 (commit)
from a1d652788c846c6ec5b7a143a538f2544a2ce262 (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 | 28 ----------------------------
1 files changed, 0 insertions(+), 28 deletions(-)
=================
Commit Messages
=================
commit 3c052533b71678cf92ed1222ceb79dca7f53c935
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Remove unused function thin_callback()
:100644 100644 6eb0d81... d351889... M src/draw.c
=========
Changes
=========
commit 3c052533b71678cf92ed1222ceb79dca7f53c935
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Remove unused function thin_callback()
diff --git a/src/draw.c b/src/draw.c
index 6eb0d81..d351889 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -1393,34 +1393,6 @@ DrawPolygon (LayerTypePtr Layer, PolygonTypePtr Polygon)
AddPart (Polygon);
}
-int
-thin_callback (PLINE * pl, LayerTypePtr lay, PolygonTypePtr poly)
-{
- int i, *x, *y;
- VNODE *v;
-
- i = 0;
- x = (int *) malloc (pl->Count * sizeof (int));
- y = (int *) malloc (pl->Count * sizeof (int));
- for (v = &pl->head; i < pl->Count; v = v->next)
- {
- x[i] = v->point[0];
- y[i++] = v->point[1];
- }
- gui->set_line_cap (Output.fgGC, Round_Cap);
- gui->set_line_width (Output.fgGC, 0);
- for (i = 0; i < pl->Count - 1; i++)
- {
- gui->draw_line (Output.fgGC, x[i], y[i], x[i + 1], y[i + 1]);
- // gui->fill_circle (Output.fgGC, x[i], y[i], 30);
- }
- gui->draw_line (Output.fgGC, x[pl->Count - 1], y[pl->Count - 1], x[0],
- y[0]);
- free (x);
- free (y);
- return 0;
-}
-
/* ---------------------------------------------------------------------------
* draws an element
*/
|
|
From: <gi...@gp...> - 2011-04-26 22:49:11
|
The branch, master has been updated
via a1d652788c846c6ec5b7a143a538f2544a2ce262 (commit)
from 14d6b636fffdba8ffe271b458d2d177e7c1eb016 (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/crosshair.c | 48 ++----------------------------------------------
src/crosshair.h | 2 --
src/global.h | 1 -
src/hid/lesstif/main.c | 33 +++++++++++++++++++++++++++------
4 files changed, 29 insertions(+), 55 deletions(-)
=================
Commit Messages
=================
commit a1d652788c846c6ec5b7a143a538f2544a2ce262
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Move crosshair on / off functionality into lesstif HID.
Lesstif is the only GUI which turns attached objects on and off, when
the mouse leaves the viewport, so it might as well manage it internally.
:100644 100644 9498879... 2abe960... M src/crosshair.c
:100644 100644 efa6679... 6e9656e... M src/crosshair.h
:100644 100644 904d6fe... f6620c9... M src/global.h
:100644 100644 703da61... 928a1ae... M src/hid/lesstif/main.c
=========
Changes
=========
commit a1d652788c846c6ec5b7a143a538f2544a2ce262
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Move crosshair on / off functionality into lesstif HID.
Lesstif is the only GUI which turns attached objects on and off, when
the mouse leaves the viewport, so it might as well manage it internally.
diff --git a/src/crosshair.c b/src/crosshair.c
index 9498879..2abe960 100644
--- a/src/crosshair.c
+++ b/src/crosshair.c
@@ -547,9 +547,6 @@ XORDrawMoveOrCopyObject (void)
void
DrawAttached (void)
{
- if (!Crosshair.On)
- return;
-
switch (Settings.Mode)
{
case VIA_MODE:
@@ -681,8 +678,8 @@ DrawAttached (void)
void
DrawMark (void)
{
- /* Mark is not drawn when the crosshair is off, or when it is not set */
- if (!Crosshair.On || !Marked.status)
+ /* Mark is not drawn when it is not set */
+ if (!Marked.status)
return;
gui->draw_line (Crosshair.GC,
@@ -740,45 +737,6 @@ notify_mark_change (bool changes_complete)
gui->notify_mark_change (changes_complete);
}
-/* ---------------------------------------------------------------------------
- * switches crosshair on
- */
-void
-CrosshairOn (void)
-{
- if (Crosshair.On)
- return;
-
- notify_crosshair_change (false);
- if (Marked.status)
- notify_mark_change (false);
-
- Crosshair.On = true;
-
- notify_crosshair_change (true);
- if (Marked.status)
- notify_mark_change (true);
-}
-
-/* ---------------------------------------------------------------------------
- * switches crosshair off
- */
-void
-CrosshairOff (void)
-{
- if (!Crosshair.On)
- return;
-
- notify_crosshair_change (false);
- if (Marked.status)
- notify_mark_change (false);
-
- Crosshair.On = false;
-
- notify_crosshair_change (true);
- if (Marked.status)
- notify_mark_change (true);
-}
/* ---------------------------------------------------------------------------
* Convenience for plugins using the old {Hide,Restore}Crosshair API.
@@ -1172,8 +1130,6 @@ InitCrosshair (void)
gui->set_line_cap (Crosshair.GC, Trace_Cap);
gui->set_line_width (Crosshair.GC, 1);
- Crosshair.On = true;
-
/* set initial shape */
Crosshair.shape = Basic_Crosshair_Shape;
diff --git a/src/crosshair.h b/src/crosshair.h
index efa6679..6e9656e 100644
--- a/src/crosshair.h
+++ b/src/crosshair.h
@@ -48,8 +48,6 @@
void notify_crosshair_change (bool changes_complete);
void notify_mark_change (bool changes_complete);
-void CrosshairOn (void);
-void CrosshairOff (void);
void HideCrosshair (void);
void RestoreCrosshair (void);
void DrawAttached (void);
diff --git a/src/global.h b/src/global.h
index 904d6fe..f6620c9 100644
--- a/src/global.h
+++ b/src/global.h
@@ -583,7 +583,6 @@ typedef struct /* holds cursor information */
LocationType X, /* position in PCB coordinates */
Y, MinX, /* lowest and highest coordinates */
MinY, MaxX, MaxY;
- bool On; /* flag for 'is visible' */
AttachedLineType AttachedLine; /* data of new lines... */
AttachedBoxType AttachedBox;
PolygonType AttachedPolygon;
diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index 703da61..928a1ae 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -139,6 +139,24 @@ static int view_left_x = 0, view_top_y = 0;
static double view_zoom = 1000, prev_view_zoom = 1000;
static int flip_x = 0, flip_y = 0;
static int autofade = 0;
+static bool crosshair_on = true;
+
+static void
+ShowCrosshair (bool show)
+{
+ if (crosshair_on == show)
+ return;
+
+ notify_crosshair_change (false);
+ if (Marked.status)
+ notify_mark_change (false);
+
+ crosshair_on = show;
+
+ notify_crosshair_change (true);
+ if (Marked.status)
+ notify_mark_change (true);
+}
static int
flag_flipx (int x)
@@ -1413,7 +1431,7 @@ work_area_input (Widget w, XtPointer v, XEvent * e, Boolean * ctd)
case LeaveNotify:
crosshair_in_window = 0;
- CrosshairOff ();
+ ShowCrosshair (false);
need_idle_proc ();
break;
@@ -1421,7 +1439,7 @@ work_area_input (Widget w, XtPointer v, XEvent * e, Boolean * ctd)
crosshair_in_window = 1;
in_move_event = 1;
EventMoveCrosshair (Px (e->xcrossing.x), Py (e->xcrossing.y));
- CrosshairOn ();
+ ShowCrosshair (true);
in_move_event = 0;
need_idle_proc ();
break;
@@ -2518,8 +2536,11 @@ idle_proc (XtPointer dummy)
XCopyArea (display, main_pixmap, window, my_gc, 0, 0, view_width,
view_height, 0, 0);
pixmap = window;
- DrawAttached ();
- DrawMark ();
+ if (crosshair_on)
+ {
+ DrawAttached ();
+ DrawMark ();
+ }
need_redraw = 0;
}
@@ -2898,7 +2919,7 @@ lesstif_notify_crosshair_change (bool changes_complete)
return;
}
- if (invalidate_depth == 0)
+ if (invalidate_depth == 0 && crosshair_on)
DrawAttached ();
if (!changes_complete)
@@ -2925,7 +2946,7 @@ lesstif_notify_mark_change (bool changes_complete)
return;
}
- if (invalidate_depth == 0)
+ if (invalidate_depth == 0 && crosshair_on)
DrawMark ();
if (!changes_complete)
|
|
From: <gi...@gp...> - 2011-04-26 22:36:38
|
The branch, master has been updated
via 14d6b636fffdba8ffe271b458d2d177e7c1eb016 (commit)
from dca72407d0b3d23e3bd6743c87498b0f48fcd196 (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/crosshair.c | 88 ++++++++----------------
src/hid.h | 2 +
src/hid/common/hidnogui.c | 4 +
src/hid/gtk/gtkhid-gdk.c | 90 ++++++++++++++++++++++++-
src/hid/gtk/gtkhid-main.c | 110 ++++++++++++++++---------------
src/hid/gtk/gui.h | 2 +
src/hid/lesstif/main.c | 162 ++++++++++++++++++++++++++++++---------------
7 files changed, 291 insertions(+), 167 deletions(-)
=================
Commit Messages
=================
commit 14d6b636fffdba8ffe271b458d2d177e7c1eb016
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Give the HIDs control over attached object (crosshair, mark) drawing
This is required if a renderer doesn't want to follow the current
drawing model where it is assumed the core can call the HID's
drawing APIs at any arbitrary point in time.
Expose some API from crosshair.c to perform the actual drawing on
demand, and add hooks to the HID structure to notify the GUI when it
would previously have called the crosshair or mark drawing routines.
This allows renderers with defined setup and tear-down requirements
around drawing to execute them before the objects are drawn.
CrosshairOn() and CrosshairOff() now simply set the Crosshair.On flag
and call the appropriate notification hooks.
This commit replaces all HideCrosshair() and RestoreCrosshair() calls
with the new hooks notify_{crosshair|mark}_changed(), with an argument
specifying whether a change is about to happen (false argument), or has
been completed (true argument).
:100644 100644 06226d2... 9498879... M src/crosshair.c
:100644 100644 0a81ddd... 36aca75... M src/hid.h
:100644 100644 1568cd5... 84ceda3... M src/hid/common/hidnogui.c
:100644 100644 fa6dea0... bd6e035... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 5037ff0... a51d167... M src/hid/gtk/gtkhid-main.c
:100644 100644 180e58c... 5616489... M src/hid/gtk/gui.h
:100644 100644 75c295e... 703da61... M src/hid/lesstif/main.c
=========
Changes
=========
commit 14d6b636fffdba8ffe271b458d2d177e7c1eb016
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Give the HIDs control over attached object (crosshair, mark) drawing
This is required if a renderer doesn't want to follow the current
drawing model where it is assumed the core can call the HID's
drawing APIs at any arbitrary point in time.
Expose some API from crosshair.c to perform the actual drawing on
demand, and add hooks to the HID structure to notify the GUI when it
would previously have called the crosshair or mark drawing routines.
This allows renderers with defined setup and tear-down requirements
around drawing to execute them before the objects are drawn.
CrosshairOn() and CrosshairOff() now simply set the Crosshair.On flag
and call the appropriate notification hooks.
This commit replaces all HideCrosshair() and RestoreCrosshair() calls
with the new hooks notify_{crosshair|mark}_changed(), with an argument
specifying whether a change is about to happen (false argument), or has
been completed (true argument).
diff --git a/src/crosshair.c b/src/crosshair.c
index 06226d2..9498879 100644
--- a/src/crosshair.c
+++ b/src/crosshair.c
@@ -66,15 +66,6 @@ typedef struct
} point;
/* ---------------------------------------------------------------------------
- * some local identifiers
- */
-
-/* This is a stack for HideCrosshair() and RestoreCrosshair() calls. They
- * must always be matched. */
-static bool CrosshairStack[MAX_CROSSHAIRSTACK_DEPTH];
-static int CrosshairStackLocation = 0;
-
-/* ---------------------------------------------------------------------------
* some local prototypes
*/
static void XORPolygon (PolygonTypePtr, LocationType, LocationType);
@@ -723,38 +714,11 @@ DrawMark (void)
void
notify_crosshair_change (bool changes_complete)
{
- if (changes_complete)
- {
- /* fprintf(stderr, "RestoreCrosshair stack %d\n", CrosshairStackLocation); */
- if (CrosshairStackLocation <= 0)
- {
- fprintf(stderr, "Error: CrosshairStackLocation underflow\n");
- return;
- }
-
- CrosshairStackLocation--;
-
- if (CrosshairStack[CrosshairStackLocation])
- CrosshairOn ();
- else
- CrosshairOff ();
- }
- else
- {
- /* fprintf(stderr, "HideCrosshair stack %d\n", CrosshairStackLocation); */
- if (CrosshairStackLocation >= MAX_CROSSHAIRSTACK_DEPTH)
- {
- fprintf(stderr, "Error: CrosshairStackLocation overflow\n");
- return;
- }
-
- CrosshairStack[CrosshairStackLocation] = Crosshair.On;
- CrosshairStackLocation++;
-
- CrosshairOff ();
- }
+ if (gui->notify_crosshair_change)
+ gui->notify_crosshair_change (changes_complete);
}
+
/* ---------------------------------------------------------------------------
* notify the GUI that data relating to the mark is being changed.
*
@@ -772,8 +736,8 @@ notify_crosshair_change (bool changes_complete)
void
notify_mark_change (bool changes_complete)
{
- /* For now, just piggy back on the crosshair changes redrawing the mark */
- notify_crosshair_change (changes_complete);
+ if (gui->notify_mark_change)
+ gui->notify_mark_change (changes_complete);
}
/* ---------------------------------------------------------------------------
@@ -782,12 +746,18 @@ notify_mark_change (bool changes_complete)
void
CrosshairOn (void)
{
- if (!Crosshair.On)
- {
- Crosshair.On = true;
- DrawAttached ();
- DrawMark ();
- }
+ if (Crosshair.On)
+ return;
+
+ notify_crosshair_change (false);
+ if (Marked.status)
+ notify_mark_change (false);
+
+ Crosshair.On = true;
+
+ notify_crosshair_change (true);
+ if (Marked.status)
+ notify_mark_change (true);
}
/* ---------------------------------------------------------------------------
@@ -796,12 +766,18 @@ CrosshairOn (void)
void
CrosshairOff (void)
{
- if (Crosshair.On)
- {
- DrawAttached ();
- DrawMark ();
- Crosshair.On = false;
- }
+ if (!Crosshair.On)
+ return;
+
+ notify_crosshair_change (false);
+ if (Marked.status)
+ notify_mark_change (false);
+
+ Crosshair.On = false;
+
+ notify_crosshair_change (true);
+ if (Marked.status)
+ notify_mark_change (true);
}
/* ---------------------------------------------------------------------------
@@ -1184,8 +1160,7 @@ SetCrosshairRange (LocationType MinX, LocationType MinY, LocationType MaxX,
/* ---------------------------------------------------------------------------
* initializes crosshair stuff
- * clears the struct, allocates to graphical contexts and
- * initializes the stack
+ * clears the struct, allocates to graphical contexts
*/
void
InitCrosshair (void)
@@ -1197,9 +1172,6 @@ InitCrosshair (void)
gui->set_line_cap (Crosshair.GC, Trace_Cap);
gui->set_line_width (Crosshair.GC, 1);
- /* fake a crosshair off entry on stack */
- CrosshairStackLocation = 0;
- CrosshairStack[CrosshairStackLocation++] = true;
Crosshair.On = true;
/* set initial shape */
diff --git a/src/hid.h b/src/hid.h
index 0a81ddd..36aca75 100644
--- a/src/hid.h
+++ b/src/hid.h
@@ -298,6 +298,8 @@ typedef enum
/* This may be called to ask the GUI to force a redraw of a given area */
void (*invalidate_lr) (int left_, int right_, int top_, int bottom_);
void (*invalidate_all) (void);
+ void (*notify_crosshair_change) (bool changes_complete);
+ void (*notify_mark_change) (bool changes_complete);
/* During redraw or print/export cycles, this is called once per
layer (or layer group, for copper layers). If it returns false
diff --git a/src/hid/common/hidnogui.c b/src/hid/common/hidnogui.c
index 1568cd5..84ceda3 100644
--- a/src/hid/common/hidnogui.c
+++ b/src/hid/common/hidnogui.c
@@ -444,6 +444,8 @@ HID hid_nogui = {
nogui_parse_arguments,
nogui_invalidate_lr,
nogui_invalidate_all,
+ 0 /* nogui_notify_crosshair_change */ ,
+ 0 /* nogui_notify_mark_change */ ,
nogui_set_layer,
nogui_make_gc,
nogui_destroy_gc,
@@ -505,6 +507,8 @@ apply_default_hid (HID * d, HID * s)
AD (parse_arguments);
AD (invalidate_lr);
AD (invalidate_all);
+ AD (notify_crosshair_change);
+ AD (notify_mark_change);
AD (set_layer);
AD (make_gc);
AD (destroy_gc);
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index fa6dea0..bd6e035 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -34,6 +34,8 @@ typedef struct render_priv {
GdkGC *mask_gc;
GdkGC *u_gc;
GdkGC *grid_gc;
+ int attached_invalidate_depth;
+ int mark_invalidate_depth;
} render_priv;
@@ -709,6 +711,7 @@ ghid_invalidate_lr (int left, int right, int top, int bottom)
ghid_invalidate_all ();
}
+
void
ghid_invalidate_all ()
{
@@ -771,11 +774,94 @@ ghid_invalidate_all ()
hid_expose_callback (&ghid_hid, ®ion, 0);
ghid_draw_grid ();
- DrawAttached ();
- DrawMark ();
+ /* In some cases we are called with the crosshair still off */
+ if (priv->attached_invalidate_depth == 0)
+ DrawAttached ();
+
+ /* In some cases we are called with the mark still off */
+ if (priv->mark_invalidate_depth == 0)
+ DrawMark ();
+
ghid_screen_update ();
}
+
+void
+ghid_notify_crosshair_change (bool changes_complete)
+{
+ render_priv *priv = gport->render_priv;
+
+ /* We sometimes get called before the GUI is up */
+ if (gport->drawing_area == NULL)
+ return;
+
+ if (changes_complete)
+ priv->attached_invalidate_depth --;
+
+ if (priv->attached_invalidate_depth < 0)
+ {
+ priv->attached_invalidate_depth = 0;
+ /* A mismatch of changes_complete == false and == true notifications
+ * is not expected to occur, but we will try to handle it gracefully.
+ * As we know the crosshair will have been shown already, we must
+ * repaint the entire view to be sure not to leave an artaefact.
+ */
+ ghid_invalidate_all ();
+ return;
+ }
+
+ if (priv->attached_invalidate_depth == 0)
+ DrawAttached ();
+
+ if (!changes_complete)
+ {
+ priv->attached_invalidate_depth ++;
+ }
+ else if (gport->drawing_area != NULL)
+ {
+ /* Queue a GTK expose when changes are complete */
+ ghid_draw_area_update (gport, NULL);
+ }
+}
+
+void
+ghid_notify_mark_change (bool changes_complete)
+{
+ render_priv *priv = gport->render_priv;
+
+ /* We sometimes get called before the GUI is up */
+ if (gport->drawing_area == NULL)
+ return;
+
+ if (changes_complete)
+ priv->mark_invalidate_depth --;
+
+ if (priv->mark_invalidate_depth < 0)
+ {
+ priv->mark_invalidate_depth = 0;
+ /* A mismatch of changes_complete == false and == true notifications
+ * is not expected to occur, but we will try to handle it gracefully.
+ * As we know the mark will have been shown already, we must
+ * repaint the entire view to be sure not to leave an artaefact.
+ */
+ ghid_invalidate_all ();
+ return;
+ }
+
+ if (priv->mark_invalidate_depth == 0)
+ DrawMark ();
+
+ if (!changes_complete)
+ {
+ priv->mark_invalidate_depth ++;
+ }
+ else if (gport->drawing_area != NULL)
+ {
+ /* Queue a GTK expose when changes are complete */
+ ghid_draw_area_update (gport, NULL);
+ }
+}
+
static void
draw_right_cross (GdkGC *xor_gc, gint x, gint y)
{
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 5037ff0..a51d167 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -2102,60 +2102,62 @@ hid_gtk_init ()
common_draw_helpers_init (&ghid_hid);
- ghid_hid.struct_size = sizeof (HID);
- ghid_hid.name = "gtk";
- ghid_hid.description = "Gtk - The Gimp Toolkit";
- ghid_hid.gui = 1;
- ghid_hid.poly_after = 1;
-
- ghid_hid.get_export_options = ghid_get_export_options;
- ghid_hid.do_export = ghid_do_export;
- ghid_hid.parse_arguments = ghid_parse_arguments;
- ghid_hid.invalidate_lr = ghid_invalidate_lr;
- ghid_hid.invalidate_all = ghid_invalidate_all;
- ghid_hid.set_layer = ghid_set_layer;
- ghid_hid.make_gc = ghid_make_gc;
- ghid_hid.destroy_gc = ghid_destroy_gc;
- ghid_hid.use_mask = ghid_use_mask;
- ghid_hid.set_color = ghid_set_color;
- ghid_hid.set_line_cap = ghid_set_line_cap;
- ghid_hid.set_line_width = ghid_set_line_width;
- ghid_hid.set_draw_xor = ghid_set_draw_xor;
- ghid_hid.set_draw_faded = ghid_set_draw_faded;
- ghid_hid.set_line_cap_angle = ghid_set_line_cap_angle;
- ghid_hid.draw_line = ghid_draw_line;
- ghid_hid.draw_arc = ghid_draw_arc;
- ghid_hid.draw_rect = ghid_draw_rect;
- ghid_hid.fill_circle = ghid_fill_circle;
- ghid_hid.fill_polygon = ghid_fill_polygon;
- ghid_hid.fill_rect = ghid_fill_rect;
-
- ghid_hid.calibrate = ghid_calibrate;
- ghid_hid.shift_is_pressed = ghid_shift_is_pressed;
- ghid_hid.control_is_pressed = ghid_control_is_pressed;
- ghid_hid.mod1_is_pressed = ghid_mod1_is_pressed,
- ghid_hid.get_coords = ghid_get_coords;
- ghid_hid.set_crosshair = ghid_set_crosshair;
- ghid_hid.add_timer = ghid_add_timer;
- ghid_hid.stop_timer = ghid_stop_timer;
- ghid_hid.watch_file = ghid_watch_file;
- ghid_hid.unwatch_file = ghid_unwatch_file;
- ghid_hid.add_block_hook = ghid_add_block_hook;
- ghid_hid.stop_block_hook = ghid_stop_block_hook;
-
- ghid_hid.log = ghid_log;
- ghid_hid.logv = ghid_logv;
- ghid_hid.confirm_dialog = ghid_confirm_dialog;
- ghid_hid.close_confirm_dialog = ghid_close_confirm_dialog;
- ghid_hid.report_dialog = ghid_report_dialog;
- ghid_hid.prompt_for = ghid_prompt_for;
- ghid_hid.fileselect = ghid_fileselect;
- ghid_hid.attribute_dialog = ghid_attribute_dialog;
- ghid_hid.show_item = ghid_show_item;
- ghid_hid.beep = ghid_beep;
- ghid_hid.progress = ghid_progress;
- ghid_hid.drc_gui = &ghid_drc_gui,
- ghid_hid.edit_attributes = ghid_attributes;
+ ghid_hid.struct_size = sizeof (HID);
+ ghid_hid.name = "gtk";
+ ghid_hid.description = "Gtk - The Gimp Toolkit";
+ ghid_hid.gui = 1;
+ ghid_hid.poly_after = 1;
+
+ ghid_hid.get_export_options = ghid_get_export_options;
+ ghid_hid.do_export = ghid_do_export;
+ ghid_hid.parse_arguments = ghid_parse_arguments;
+ ghid_hid.invalidate_lr = ghid_invalidate_lr;
+ ghid_hid.invalidate_all = ghid_invalidate_all;
+ ghid_hid.notify_crosshair_change = ghid_notify_crosshair_change;
+ ghid_hid.notify_mark_change = ghid_notify_mark_change;
+ ghid_hid.set_layer = ghid_set_layer;
+ ghid_hid.make_gc = ghid_make_gc;
+ ghid_hid.destroy_gc = ghid_destroy_gc;
+ ghid_hid.use_mask = ghid_use_mask;
+ ghid_hid.set_color = ghid_set_color;
+ ghid_hid.set_line_cap = ghid_set_line_cap;
+ ghid_hid.set_line_width = ghid_set_line_width;
+ ghid_hid.set_draw_xor = ghid_set_draw_xor;
+ ghid_hid.set_draw_faded = ghid_set_draw_faded;
+ ghid_hid.set_line_cap_angle = ghid_set_line_cap_angle;
+ ghid_hid.draw_line = ghid_draw_line;
+ ghid_hid.draw_arc = ghid_draw_arc;
+ ghid_hid.draw_rect = ghid_draw_rect;
+ ghid_hid.fill_circle = ghid_fill_circle;
+ ghid_hid.fill_polygon = ghid_fill_polygon;
+ ghid_hid.fill_rect = ghid_fill_rect;
+
+ ghid_hid.calibrate = ghid_calibrate;
+ ghid_hid.shift_is_pressed = ghid_shift_is_pressed;
+ ghid_hid.control_is_pressed = ghid_control_is_pressed;
+ ghid_hid.mod1_is_pressed = ghid_mod1_is_pressed,
+ ghid_hid.get_coords = ghid_get_coords;
+ ghid_hid.set_crosshair = ghid_set_crosshair;
+ ghid_hid.add_timer = ghid_add_timer;
+ ghid_hid.stop_timer = ghid_stop_timer;
+ ghid_hid.watch_file = ghid_watch_file;
+ ghid_hid.unwatch_file = ghid_unwatch_file;
+ ghid_hid.add_block_hook = ghid_add_block_hook;
+ ghid_hid.stop_block_hook = ghid_stop_block_hook;
+
+ ghid_hid.log = ghid_log;
+ ghid_hid.logv = ghid_logv;
+ ghid_hid.confirm_dialog = ghid_confirm_dialog;
+ ghid_hid.close_confirm_dialog = ghid_close_confirm_dialog;
+ ghid_hid.report_dialog = ghid_report_dialog;
+ ghid_hid.prompt_for = ghid_prompt_for;
+ ghid_hid.fileselect = ghid_fileselect;
+ ghid_hid.attribute_dialog = ghid_attribute_dialog;
+ ghid_hid.show_item = ghid_show_item;
+ ghid_hid.beep = ghid_beep;
+ ghid_hid.progress = ghid_progress;
+ ghid_hid.drc_gui = &ghid_drc_gui,
+ ghid_hid.edit_attributes = ghid_attributes;
hid_register_hid (&ghid_hid);
#include "gtk_lists.h"
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 180e58c..5616489 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -493,6 +493,8 @@ void ghid_fill_polygon (hidGC gc, int n_coords, int *x, int *y);
void ghid_fill_rect (hidGC gc, int x1, int y1, int x2, int y2);
void ghid_invalidate_lr (int left, int right, int top, int bottom);
void ghid_invalidate_all ();
+void ghid_notify_crosshair_change (bool changes_complete);
+void ghid_notify_mark_change (bool changes_complete);
void ghid_show_crosshair (gboolean show);
void ghid_init_renderer (int *, char ***, GHidPort *);
void ghid_init_drawing_widget (GtkWidget *widget, GHidPort *);
diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index 75c295e..703da61 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -2878,6 +2878,60 @@ lesstif_invalidate_all (void)
lesstif_invalidate_lr (0, PCB->MaxWidth, 0, PCB->MaxHeight);
}
+static void
+lesstif_notify_crosshair_change (bool changes_complete)
+{
+ static int invalidate_depth = 0;
+
+ if (changes_complete)
+ invalidate_depth --;
+
+ if (invalidate_depth < 0)
+ {
+ invalidate_depth = 0;
+ /* A mismatch of changes_complete == false and == true notifications
+ * is not expected to occur, but we will try to handle it gracefully.
+ * As we know the crosshair will have been shown already, we must
+ * repaint the entire view to be sure not to leave an artaefact.
+ */
+ need_idle_proc ();
+ return;
+ }
+
+ if (invalidate_depth == 0)
+ DrawAttached ();
+
+ if (!changes_complete)
+ invalidate_depth ++;
+}
+
+static void
+lesstif_notify_mark_change (bool changes_complete)
+{
+ static int invalidate_depth = 0;
+
+ if (changes_complete)
+ invalidate_depth --;
+
+ if (invalidate_depth < 0)
+ {
+ invalidate_depth = 0;
+ /* A mismatch of changes_complete == false and == true notifications
+ * is not expected to occur, but we will try to handle it gracefully.
+ * As we know the mark will have been shown already, we must
+ * repaint the entire view to be sure not to leave an artaefact.
+ */
+ need_idle_proc ();
+ return;
+ }
+
+ if (invalidate_depth == 0)
+ DrawMark ();
+
+ if (!changes_complete)
+ invalidate_depth ++;
+}
+
static int
lesstif_set_layer (const char *name, int group, int empty)
{
@@ -3804,59 +3858,61 @@ hid_lesstif_init ()
common_draw_helpers_init (&lesstif_hid);
- lesstif_hid.struct_size = sizeof (HID);
- lesstif_hid.name = "lesstif";
- lesstif_hid.description = "LessTif - a Motif clone for X/Unix";
- lesstif_hid.gui = 1;
- lesstif_hid.poly_before = 1;
-
- lesstif_hid.get_export_options = lesstif_get_export_options;
- lesstif_hid.do_export = lesstif_do_export;
- lesstif_hid.parse_arguments = lesstif_parse_arguments;
- lesstif_hid.invalidate_lr = lesstif_invalidate_lr;
- lesstif_hid.invalidate_all = lesstif_invalidate_all;
- lesstif_hid.set_layer = lesstif_set_layer;
- lesstif_hid.make_gc = lesstif_make_gc;
- lesstif_hid.destroy_gc = lesstif_destroy_gc;
- lesstif_hid.use_mask = lesstif_use_mask;
- lesstif_hid.set_color = lesstif_set_color;
- lesstif_hid.set_line_cap = lesstif_set_line_cap;
- lesstif_hid.set_line_width = lesstif_set_line_width;
- lesstif_hid.set_draw_xor = lesstif_set_draw_xor;
- lesstif_hid.set_draw_faded = lesstif_set_draw_faded;
- lesstif_hid.set_line_cap_angle = lesstif_set_line_cap_angle;
- lesstif_hid.draw_line = lesstif_draw_line;
- lesstif_hid.draw_arc = lesstif_draw_arc;
- lesstif_hid.draw_rect = lesstif_draw_rect;
- lesstif_hid.fill_circle = lesstif_fill_circle;
- lesstif_hid.fill_polygon = lesstif_fill_polygon;
- lesstif_hid.fill_rect = lesstif_fill_rect;
-
- lesstif_hid.calibrate = lesstif_calibrate;
- lesstif_hid.shift_is_pressed = lesstif_shift_is_pressed;
- lesstif_hid.control_is_pressed = lesstif_control_is_pressed;
- lesstif_hid.mod1_is_pressed = lesstif_mod1_is_pressed;
- lesstif_hid.get_coords = lesstif_get_coords;
- lesstif_hid.set_crosshair = lesstif_set_crosshair;
- lesstif_hid.add_timer = lesstif_add_timer;
- lesstif_hid.stop_timer = lesstif_stop_timer;
- lesstif_hid.watch_file = lesstif_watch_file;
- lesstif_hid.unwatch_file = lesstif_unwatch_file;
- lesstif_hid.add_block_hook = lesstif_add_block_hook;
- lesstif_hid.stop_block_hook = lesstif_stop_block_hook;
-
- lesstif_hid.log = lesstif_log;
- lesstif_hid.logv = lesstif_logv;
- lesstif_hid.confirm_dialog = lesstif_confirm_dialog;
- lesstif_hid.close_confirm_dialog = lesstif_close_confirm_dialog;
- lesstif_hid.report_dialog = lesstif_report_dialog;
- lesstif_hid.prompt_for = lesstif_prompt_for;
- lesstif_hid.fileselect = lesstif_fileselect;
- lesstif_hid.attribute_dialog = lesstif_attribute_dialog;
- lesstif_hid.show_item = lesstif_show_item;
- lesstif_hid.beep = lesstif_beep;
- lesstif_hid.progress = lesstif_progress;
- lesstif_hid.edit_attributes = lesstif_attributes_dialog;
+ lesstif_hid.struct_size = sizeof (HID);
+ lesstif_hid.name = "lesstif";
+ lesstif_hid.description = "LessTif - a Motif clone for X/Unix";
+ lesstif_hid.gui = 1;
+ lesstif_hid.poly_before = 1;
+
+ lesstif_hid.get_export_options = lesstif_get_export_options;
+ lesstif_hid.do_export = lesstif_do_export;
+ lesstif_hid.parse_arguments = lesstif_parse_arguments;
+ lesstif_hid.invalidate_lr = lesstif_invalidate_lr;
+ lesstif_hid.invalidate_all = lesstif_invalidate_all;
+ lesstif_hid.notify_crosshair_change = lesstif_notify_crosshair_change;
+ lesstif_hid.notify_mark_change = lesstif_notify_mark_change;
+ lesstif_hid.set_layer = lesstif_set_layer;
+ lesstif_hid.make_gc = lesstif_make_gc;
+ lesstif_hid.destroy_gc = lesstif_destroy_gc;
+ lesstif_hid.use_mask = lesstif_use_mask;
+ lesstif_hid.set_color = lesstif_set_color;
+ lesstif_hid.set_line_cap = lesstif_set_line_cap;
+ lesstif_hid.set_line_width = lesstif_set_line_width;
+ lesstif_hid.set_draw_xor = lesstif_set_draw_xor;
+ lesstif_hid.set_draw_faded = lesstif_set_draw_faded;
+ lesstif_hid.set_line_cap_angle = lesstif_set_line_cap_angle;
+ lesstif_hid.draw_line = lesstif_draw_line;
+ lesstif_hid.draw_arc = lesstif_draw_arc;
+ lesstif_hid.draw_rect = lesstif_draw_rect;
+ lesstif_hid.fill_circle = lesstif_fill_circle;
+ lesstif_hid.fill_polygon = lesstif_fill_polygon;
+ lesstif_hid.fill_rect = lesstif_fill_rect;
+
+ lesstif_hid.calibrate = lesstif_calibrate;
+ lesstif_hid.shift_is_pressed = lesstif_shift_is_pressed;
+ lesstif_hid.control_is_pressed = lesstif_control_is_pressed;
+ lesstif_hid.mod1_is_pressed = lesstif_mod1_is_pressed;
+ lesstif_hid.get_coords = lesstif_get_coords;
+ lesstif_hid.set_crosshair = lesstif_set_crosshair;
+ lesstif_hid.add_timer = lesstif_add_timer;
+ lesstif_hid.stop_timer = lesstif_stop_timer;
+ lesstif_hid.watch_file = lesstif_watch_file;
+ lesstif_hid.unwatch_file = lesstif_unwatch_file;
+ lesstif_hid.add_block_hook = lesstif_add_block_hook;
+ lesstif_hid.stop_block_hook = lesstif_stop_block_hook;
+
+ lesstif_hid.log = lesstif_log;
+ lesstif_hid.logv = lesstif_logv;
+ lesstif_hid.confirm_dialog = lesstif_confirm_dialog;
+ lesstif_hid.close_confirm_dialog = lesstif_close_confirm_dialog;
+ lesstif_hid.report_dialog = lesstif_report_dialog;
+ lesstif_hid.prompt_for = lesstif_prompt_for;
+ lesstif_hid.fileselect = lesstif_fileselect;
+ lesstif_hid.attribute_dialog = lesstif_attribute_dialog;
+ lesstif_hid.show_item = lesstif_show_item;
+ lesstif_hid.beep = lesstif_beep;
+ lesstif_hid.progress = lesstif_progress;
+ lesstif_hid.edit_attributes = lesstif_attributes_dialog;
hid_register_hid (&lesstif_hid);
#include "lesstif_lists.h"
|
|
From: <gi...@gp...> - 2011-04-26 21:59:55
|
The branch, master has been updated
via dca72407d0b3d23e3bd6743c87498b0f48fcd196 (commit)
via 366b8e0cf21359ed4bcf22a3a9528cdf665b5610 (commit)
via 0213e4791f9aa4008c8d06a48c377b338f6e1a43 (commit)
from 19373161d96d8bc776ab8a123069d3a01dc22cd4 (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/action.c | 116 ++++++++++++++++++-----------------
src/buffer.c | 8 +-
src/crosshair.c | 129 ++++++++++++++++++++++++++++++--------
src/crosshair.h | 2 +
src/hid/gtk/gtkhid-main.c | 4 +-
src/hid/gtk/gui-misc.c | 8 +-
src/hid/gtk/gui-output-events.c | 2 +-
src/hid/lesstif/main.c | 12 ++--
src/misc.c | 8 +--
src/set.c | 12 ++--
10 files changed, 188 insertions(+), 113 deletions(-)
=================
Commit Messages
=================
commit dca72407d0b3d23e3bd6743c87498b0f48fcd196
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
action.c: Convert some explicit mark redrawing to notification
:100644 100644 eddbbbd... 7744cd1... M src/action.c
commit 366b8e0cf21359ed4bcf22a3a9528cdf665b5610
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Separate out mark change notification from crosshair change notification
Hook it up to notify the crosshair (which also redraws the mark) for now.
:100644 100644 9834577... 06226d2... M src/crosshair.c
:100644 100644 671ae3d... efa6679... M src/crosshair.h
:100644 100644 16986e8... c77129e... M src/set.c
commit 0213e4791f9aa4008c8d06a48c377b338f6e1a43
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Rename HideCrosshair() and RestoreCrosshair()
Whist this is a tedious rename which will probably have implications
for some plugins, it helps to clarify what is going on with the
crosshair across forthcoming patches which put it under the control
of the GUIs.
The old APIs are retained for backwards compatibility with plugins,
and will print a one-shot warning for each which is called.
:100644 100644 5dc544e... eddbbbd... M src/action.c
:100644 100644 43d5c2b... 4f746e9... M src/buffer.c
:100644 100644 054610b... 9834577... M src/crosshair.c
:100644 100644 ff16b1e... 671ae3d... M src/crosshair.h
:100644 100644 5af6ed6... 5037ff0... M src/hid/gtk/gtkhid-main.c
:100644 100644 8bda96d... 75ba763... M src/hid/gtk/gui-misc.c
:100644 100644 b62ecf0... a0e8eb3... M src/hid/gtk/gui-output-events.c
:100644 100644 c1b12d3... 75c295e... M src/hid/lesstif/main.c
:100644 100644 d63aef1... 5bea138... M src/misc.c
:100644 100644 90db719... 16986e8... M src/set.c
=========
Changes
=========
commit dca72407d0b3d23e3bd6743c87498b0f48fcd196
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
action.c: Convert some explicit mark redrawing to notification
diff --git a/src/action.c b/src/action.c
index eddbbbd..7744cd1 100644
--- a/src/action.c
+++ b/src/action.c
@@ -4027,24 +4027,27 @@ ActionMarkCrosshair (int argc, char **argv, int x, int y)
{
if (Marked.status)
{
- DrawMark ();
+ notify_mark_change (false);
Marked.status = false;
+ notify_mark_change (true);
}
else
{
+ notify_mark_change (false);
+ Marked.status = false;
Marked.status = true;
Marked.X = Crosshair.X;
Marked.Y = Crosshair.Y;
- DrawMark ();
+ notify_mark_change (true);
}
}
else if (GetFunctionID (function) == F_Center)
{
- DrawMark ();
+ notify_mark_change (false);
Marked.status = true;
Marked.X = Crosshair.X;
Marked.Y = Crosshair.Y;
- DrawMark ();
+ notify_mark_change (true);
}
return 0;
}
commit 366b8e0cf21359ed4bcf22a3a9528cdf665b5610
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Separate out mark change notification from crosshair change notification
Hook it up to notify the crosshair (which also redraws the mark) for now.
diff --git a/src/crosshair.c b/src/crosshair.c
index 9834577..06226d2 100644
--- a/src/crosshair.c
+++ b/src/crosshair.c
@@ -755,6 +755,26 @@ notify_crosshair_change (bool changes_complete)
}
}
+/* ---------------------------------------------------------------------------
+ * notify the GUI that data relating to the mark is being changed.
+ *
+ * The argument passed is false to notify "changes are about to happen",
+ * and true to notify "changes have finished".
+ *
+ * Each call with a 'false' parameter must be matched with a following one
+ * with a 'true' parameter. Unmatched 'true' calls are currently not permitted,
+ * but might be allowed in the future.
+ *
+ * GUIs should not complain if they receive extra calls with 'true' as parameter.
+ * They should initiate a redraw of the mark - which may (if necessary) mean
+ * repainting the whole screen if the GUI hasn't tracked the mark's location.
+ */
+void
+notify_mark_change (bool changes_complete)
+{
+ /* For now, just piggy back on the crosshair changes redrawing the mark */
+ notify_crosshair_change (changes_complete);
+}
/* ---------------------------------------------------------------------------
* switches crosshair on
@@ -806,6 +826,7 @@ HideCrosshair (void)
}
notify_crosshair_change (false);
+ notify_mark_change (false);
}
void
@@ -820,6 +841,7 @@ RestoreCrosshair (void)
}
notify_crosshair_change (true);
+ notify_mark_change (true);
}
/* ---------------------------------------------------------------------------
diff --git a/src/crosshair.h b/src/crosshair.h
index 671ae3d..efa6679 100644
--- a/src/crosshair.h
+++ b/src/crosshair.h
@@ -47,6 +47,7 @@
#define STATE_THIRD 2
void notify_crosshair_change (bool changes_complete);
+void notify_mark_change (bool changes_complete);
void CrosshairOn (void);
void CrosshairOff (void);
void HideCrosshair (void);
diff --git a/src/set.c b/src/set.c
index 16986e8..c77129e 100644
--- a/src/set.c
+++ b/src/set.c
@@ -342,20 +342,20 @@ SetLocalRef (LocationType X, LocationType Y, bool Showing)
if (Showing)
{
- notify_crosshair_change (false);
+ notify_mark_change (false);
if (count == 0)
old = Marked;
Marked.X = X;
Marked.Y = Y;
Marked.status = true;
count++;
- notify_crosshair_change (true);
+ notify_mark_change (true);
}
else if (count > 0)
{
- notify_crosshair_change (false);
+ notify_mark_change (false);
count = 0;
Marked = old;
- notify_crosshair_change (true);
+ notify_mark_change (true);
}
}
commit 0213e4791f9aa4008c8d06a48c377b338f6e1a43
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Rename HideCrosshair() and RestoreCrosshair()
Whist this is a tedious rename which will probably have implications
for some plugins, it helps to clarify what is going on with the
crosshair across forthcoming patches which put it under the control
of the GUIs.
The old APIs are retained for backwards compatibility with plugins,
and will print a one-shot warning for each which is called.
diff --git a/src/action.c b/src/action.c
index 5dc544e..eddbbbd 100644
--- a/src/action.c
+++ b/src/action.c
@@ -607,7 +607,7 @@ click_cb (hidval hv)
{
if (Note.Click)
{
- HideCrosshair ();
+ notify_crosshair_change (false);
Note.Click = false;
if (Note.Moving && !gui->shift_is_pressed ())
{
@@ -650,7 +650,7 @@ click_cb (hidval hv)
Crosshair.AttachedBox.Point1.X = Note.X;
Crosshair.AttachedBox.Point1.Y = Note.Y;
}
- RestoreCrosshair ();
+ notify_crosshair_change (true);
}
}
@@ -945,7 +945,7 @@ NotifyLine (void)
static void
NotifyBlock (void)
{
- HideCrosshair ();
+ notify_crosshair_change (false);
switch (Crosshair.AttachedBox.State)
{
case STATE_FIRST: /* setup first point */
@@ -960,7 +960,7 @@ NotifyBlock (void)
Crosshair.AttachedBox.State = STATE_THIRD;
break;
}
- RestoreCrosshair ();
+ notify_crosshair_change (true);
}
@@ -2122,11 +2122,11 @@ ActionMovePointer (char *deltax, char *deltay)
/* restore crosshair for erasure */
Crosshair.X = x;
Crosshair.Y = y;
- HideCrosshair ();
+ notify_crosshair_change (false);
MoveCrosshairRelative (TO_SCREEN_SIGN_X (dx), TO_SCREEN_SIGN_Y (dy));
/* update object position and cursor location */
AdjustAttachedObjects ();
- RestoreCrosshair ();
+ notify_crosshair_change (true);
}
/* ---------------------------------------------------------------------------
@@ -2152,10 +2152,9 @@ EventMoveCrosshair (int ev_x, int ev_y)
{
if (MoveCrosshairAbsolute (ev_x, ev_y))
{
-
/* update object position and cursor location */
AdjustAttachedObjects ();
- RestoreCrosshair ();
+ notify_crosshair_change (true);
}
}
else
@@ -2720,7 +2719,7 @@ ActionDisplay (int argc, char **argv, int childX, int childY)
break;
case F_CycleClip:
- HideCrosshair ();
+ notify_crosshair_change (false);
if TEST_FLAG
(ALLDIRECTIONFLAG, PCB)
{
@@ -2730,27 +2729,27 @@ ActionDisplay (int argc, char **argv, int childX, int childY)
else
PCB->Clipping = (PCB->Clipping + 1) % 3;
AdjustAttachedObjects ();
- RestoreCrosshair ();
+ notify_crosshair_change (true);
break;
case F_CycleCrosshair:
- HideCrosshair ();
+ notify_crosshair_change (false);
Crosshair.shape = CrosshairShapeIncrement(Crosshair.shape);
if (Crosshair_Shapes_Number == Crosshair.shape)
Crosshair.shape = Basic_Crosshair_Shape;
- RestoreCrosshair ();
+ notify_crosshair_change (true);
break;
case F_ToggleRubberBandMode:
- HideCrosshair ();
+ notify_crosshair_change (false);
TOGGLE_FLAG (RUBBERBANDFLAG, PCB);
- RestoreCrosshair ();
+ notify_crosshair_change (true);
break;
case F_ToggleStartDirection:
- HideCrosshair ();
+ notify_crosshair_change (false);
TOGGLE_FLAG (SWAPSTARTDIRFLAG, PCB);
- RestoreCrosshair ();
+ notify_crosshair_change (true);
break;
case F_ToggleUniqueNames:
@@ -2758,9 +2757,9 @@ ActionDisplay (int argc, char **argv, int childX, int childY)
break;
case F_ToggleSnapPin:
- HideCrosshair ();
+ notify_crosshair_change (false);
TOGGLE_FLAG (SNAPPINFLAG, PCB);
- RestoreCrosshair ();
+ notify_crosshair_change (true);
break;
case F_ToggleLocalRef:
@@ -2801,7 +2800,7 @@ ActionDisplay (int argc, char **argv, int childX, int childY)
break;
case F_ToggleAutoDRC:
- HideCrosshair ();
+ notify_crosshair_change (false);
TOGGLE_FLAG (AUTODRCFLAG, PCB);
if (TEST_FLAG (AUTODRCFLAG, PCB) && Settings.Mode == LINE_MODE)
{
@@ -2815,7 +2814,7 @@ ActionDisplay (int argc, char **argv, int childX, int childY)
Crosshair.AttachedLine.Point1.Y, true, 1,
FOUNDFLAG);
}
- RestoreCrosshair ();
+ notify_crosshair_change (true);
break;
case F_ToggleCheckPlanes:
@@ -2853,7 +2852,7 @@ ActionDisplay (int argc, char **argv, int childX, int childY)
oldGrid = PCB->Grid;
PCB->Grid = 1.0;
if (MoveCrosshairAbsolute (Crosshair.X, Crosshair.Y))
- RestoreCrosshair (); /* was hidden by MoveCrosshairAbs */
+ notify_crosshair_change (true); /* first notify was in MoveCrosshairAbs */
SetGrid (oldGrid, true);
}
break;
@@ -3057,7 +3056,7 @@ ActionMode (int argc, char **argv, int x, int y)
{
Note.X = Crosshair.X;
Note.Y = Crosshair.Y;
- HideCrosshair ();
+ notify_crosshair_change (false);
switch (GetFunctionID (function))
{
case F_Arc:
@@ -3253,7 +3252,7 @@ ActionMode (int argc, char **argv, int x, int y)
SaveMode ();
break;
}
- RestoreCrosshair ();
+ notify_crosshair_change (true);
return 0;
}
@@ -5439,7 +5438,7 @@ ActionSelect (int argc, char **argv, int x, int y)
Crosshair.AttachedBox.Point2.X);
box.Y2 = MAX (Crosshair.AttachedBox.Point1.Y,
Crosshair.AttachedBox.Point2.Y);
- HideCrosshair ();
+ notify_crosshair_change (false);
NotifyBlock ();
if (Crosshair.AttachedBox.State == STATE_THIRD &&
SelectBlock (&box, true))
@@ -5447,7 +5446,7 @@ ActionSelect (int argc, char **argv, int x, int y)
SetChangedFlag (true);
Crosshair.AttachedBox.State = STATE_FIRST;
}
- RestoreCrosshair ();
+ notify_crosshair_change (true);
break;
}
@@ -5618,7 +5617,7 @@ ActionUnselect (int argc, char **argv, int x, int y)
Crosshair.AttachedBox.Point2.X);
box.Y2 = MAX (Crosshair.AttachedBox.Point1.Y,
Crosshair.AttachedBox.Point2.Y);
- HideCrosshair ();
+ notify_crosshair_change (false);
NotifyBlock ();
if (Crosshair.AttachedBox.State == STATE_THIRD &&
SelectBlock (&box, false))
@@ -5626,7 +5625,7 @@ ActionUnselect (int argc, char **argv, int x, int y)
SetChangedFlag (true);
Crosshair.AttachedBox.State = STATE_FIRST;
}
- RestoreCrosshair ();
+ notify_crosshair_change (true);
break;
}
@@ -5857,18 +5856,18 @@ ActionLoadFrom (int argc, char **argv, int x, int y)
if (strcasecmp (function, "ElementToBuffer") == 0)
{
- HideCrosshair ();
+ notify_crosshair_change (false);
if (LoadElementToBuffer (PASTEBUFFER, name, true))
SetMode (PASTEBUFFER_MODE);
- RestoreCrosshair ();
+ notify_crosshair_change (true);
}
else if (strcasecmp (function, "LayoutToBuffer") == 0)
{
- HideCrosshair ();
+ notify_crosshair_change (false);
if (LoadLayoutToBuffer (PASTEBUFFER, name))
SetMode (PASTEBUFFER_MODE);
- RestoreCrosshair ();
+ notify_crosshair_change (true);
}
else if (strcasecmp (function, "Layout") == 0)
@@ -5925,7 +5924,7 @@ ActionNew (int argc, char **argv, int x, int y)
if (!name)
return 1;
- HideCrosshair ();
+ notify_crosshair_change (false);
/* do emergency saving
* clear the old struct and allocate memory for the new one
*/
@@ -5947,7 +5946,7 @@ ActionNew (int argc, char **argv, int x, int y)
Redraw ();
hid_action ("PCBChanged");
- RestoreCrosshair ();
+ notify_crosshair_change (true);
return 0;
}
return 1;
@@ -6034,7 +6033,7 @@ ActionPasteBuffer (int argc, char **argv, int x, int y)
static char *default_file = NULL;
int free_name = 0;
- HideCrosshair ();
+ notify_crosshair_change (true);
if (function)
{
switch (GetFunctionID (function))
@@ -6141,7 +6140,7 @@ ActionPasteBuffer (int argc, char **argv, int x, int y)
}
else
{
- RestoreCrosshair ();
+ notify_crosshair_change (false);
AFAIL (pastebuffer);
}
@@ -6164,7 +6163,7 @@ ActionPasteBuffer (int argc, char **argv, int x, int y)
}
}
- RestoreCrosshair ();
+ notify_crosshair_change (true);
return 0;
}
@@ -6205,13 +6204,13 @@ ActionUndo (int argc, char **argv, int x, int y)
return 1;
/* undo the last operation */
- HideCrosshair ();
+ notify_crosshair_change (false);
if ((Settings.Mode == POLYGON_MODE ||
Settings.Mode == POLYGONHOLE_MODE) &&
Crosshair.AttachedPolygon.PointN)
{
GoToPreviousPoint ();
- RestoreCrosshair ();
+ notify_crosshair_change (true);
return 0;
}
/* move anchor point if undoing during line creation */
@@ -6223,7 +6222,7 @@ ActionUndo (int argc, char **argv, int x, int y)
Undo (true); /* undo the connection find */
Crosshair.AttachedLine.State = STATE_FIRST;
SetLocalRef (0, 0, false);
- RestoreCrosshair ();
+ notify_crosshair_change (true);
return 0;
}
if (Crosshair.AttachedLine.State == STATE_THIRD)
@@ -6251,7 +6250,7 @@ ActionUndo (int argc, char **argv, int x, int y)
Crosshair.AttachedLine.Point1.X;
Crosshair.AttachedLine.Point2.Y =
Crosshair.AttachedLine.Point1.Y;
- RestoreCrosshair ();
+ notify_crosshair_change (true);
return 0;
}
/* move to new anchor */
@@ -6298,7 +6297,7 @@ ActionUndo (int argc, char **argv, int x, int y)
ptr2 = (LineTypePtr) ptrtmp;
lastLayer = (LayerTypePtr) ptr1;
}
- RestoreCrosshair ();
+ notify_crosshair_change (true);
return 0;
}
}
@@ -6307,7 +6306,7 @@ ActionUndo (int argc, char **argv, int x, int y)
if (Crosshair.AttachedBox.State == STATE_SECOND)
{
Crosshair.AttachedBox.State = STATE_FIRST;
- RestoreCrosshair ();
+ notify_crosshair_change (true);
return 0;
}
if (Crosshair.AttachedBox.State == STATE_THIRD)
@@ -6342,7 +6341,7 @@ ActionUndo (int argc, char **argv, int x, int y)
break;
}
}
- RestoreCrosshair ();
+ notify_crosshair_change (true);
return 0;
}
@@ -6375,7 +6374,7 @@ ActionRedo (int argc, char **argv, int x, int y)
Crosshair.AttachedPolygon.PointN) ||
Crosshair.AttachedLine.State == STATE_SECOND)
return 1;
- HideCrosshair ();
+ notify_crosshair_change (false);
if (Redo (true))
{
SetChangedFlag (true);
@@ -6390,7 +6389,7 @@ ActionRedo (int argc, char **argv, int x, int y)
addedLines++;
}
}
- RestoreCrosshair ();
+ notify_crosshair_change (true);
return 0;
}
@@ -6424,7 +6423,7 @@ ActionPolygon (int argc, char **argv, int x, int y)
char *function = ARG (0);
if (function && Settings.Mode == POLYGON_MODE)
{
- HideCrosshair ();
+ notify_crosshair_change (false);
switch (GetFunctionID (function))
{
/* close open polygon if possible */
@@ -6437,7 +6436,7 @@ ActionPolygon (int argc, char **argv, int x, int y)
GoToPreviousPoint ();
break;
}
- RestoreCrosshair ();
+ notify_crosshair_change (true);
}
return 0;
}
@@ -6601,24 +6600,24 @@ ActionSetSame (int argc, char **argv, int x, int y)
switch (type)
{
case LINE_TYPE:
- HideCrosshair ();
+ notify_crosshair_change (false);
Settings.LineThickness = ((LineTypePtr) ptr2)->Thickness;
Settings.Keepaway = ((LineTypePtr) ptr2)->Clearance / 2;
layer = (LayerTypePtr) ptr1;
if (Settings.Mode != LINE_MODE)
SetMode (LINE_MODE);
- RestoreCrosshair ();
+ notify_crosshair_change (true);
hid_action ("RouteStylesChanged");
break;
case ARC_TYPE:
- HideCrosshair ();
+ notify_crosshair_change (false);
Settings.LineThickness = ((ArcTypePtr) ptr2)->Thickness;
Settings.Keepaway = ((ArcTypePtr) ptr2)->Clearance / 2;
layer = (LayerTypePtr) ptr1;
if (Settings.Mode != ARC_MODE)
SetMode (ARC_MODE);
- RestoreCrosshair ();
+ notify_crosshair_change (true);
hid_action ("RouteStylesChanged");
break;
@@ -6627,13 +6626,13 @@ ActionSetSame (int argc, char **argv, int x, int y)
break;
case VIA_TYPE:
- HideCrosshair ();
+ notify_crosshair_change (false);
Settings.ViaThickness = ((PinTypePtr) ptr2)->Thickness;
Settings.ViaDrillingHole = ((PinTypePtr) ptr2)->DrillingHole;
Settings.Keepaway = ((PinTypePtr) ptr2)->Clearance / 2;
if (Settings.Mode != VIA_MODE)
SetMode (VIA_MODE);
- RestoreCrosshair ();
+ notify_crosshair_change (true);
hid_action ("RouteStylesChanged");
break;
diff --git a/src/buffer.c b/src/buffer.c
index 43d5c2b..4f746e9 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -526,7 +526,7 @@ AddSelectedToBuffer (BufferTypePtr Buffer, LocationType X, LocationType Y,
*/
if (!LeaveSelected)
ExtraFlag = SELECTEDFLAG;
- HideCrosshair ();
+ notify_crosshair_change (false);
Source = PCB->Data;
Dest = Buffer->Data;
SelectedOperation (&AddBufferFunctions, false, ALL_TYPES);
@@ -542,7 +542,7 @@ AddSelectedToBuffer (BufferTypePtr Buffer, LocationType X, LocationType Y,
Buffer->X = Crosshair.X;
Buffer->Y = Crosshair.Y;
}
- RestoreCrosshair ();
+ notify_crosshair_change (true);
ExtraFlag = 0;
}
@@ -1457,9 +1457,9 @@ ActionFreeRotateBuffer(int argc, char **argv, int x, int y)
else
angle_s = argv[0];
- HideCrosshair ();
+ notify_crosshair_change (false);
FreeRotateBuffer(PASTEBUFFER, strtod(angle_s, 0));
- RestoreCrosshair ();
+ notify_crosshair_change (true);
return 0;
}
diff --git a/src/crosshair.c b/src/crosshair.c
index 054610b..9834577 100644
--- a/src/crosshair.c
+++ b/src/crosshair.c
@@ -706,6 +706,57 @@ DrawMark (void)
/* ---------------------------------------------------------------------------
+ * notify the GUI that data relating to the crosshair is being changed.
+ *
+ * The argument passed is false to notify "changes are about to happen",
+ * and true to notify "changes have finished".
+ *
+ * Each call with a 'false' parameter must be matched with a following one
+ * with a 'true' parameter. Unmatched 'true' calls are currently not permitted,
+ * but might be allowed in the future.
+ *
+ * GUIs should not complain if they receive extra calls with 'true' as parameter.
+ * They should initiate a redraw of the crosshair attached objects - which may
+ * (if necessary) mean repainting the whole screen if the GUI hasn't tracked the
+ * location of existing attached drawing.
+ */
+void
+notify_crosshair_change (bool changes_complete)
+{
+ if (changes_complete)
+ {
+ /* fprintf(stderr, "RestoreCrosshair stack %d\n", CrosshairStackLocation); */
+ if (CrosshairStackLocation <= 0)
+ {
+ fprintf(stderr, "Error: CrosshairStackLocation underflow\n");
+ return;
+ }
+
+ CrosshairStackLocation--;
+
+ if (CrosshairStack[CrosshairStackLocation])
+ CrosshairOn ();
+ else
+ CrosshairOff ();
+ }
+ else
+ {
+ /* fprintf(stderr, "HideCrosshair stack %d\n", CrosshairStackLocation); */
+ if (CrosshairStackLocation >= MAX_CROSSHAIRSTACK_DEPTH)
+ {
+ fprintf(stderr, "Error: CrosshairStackLocation overflow\n");
+ return;
+ }
+
+ CrosshairStack[CrosshairStackLocation] = Crosshair.On;
+ CrosshairStackLocation++;
+
+ CrosshairOff ();
+ }
+}
+
+
+/* ---------------------------------------------------------------------------
* switches crosshair on
*/
void
@@ -734,45 +785,46 @@ CrosshairOff (void)
}
/* ---------------------------------------------------------------------------
- * saves crosshair state (on/off) and hides him
+ * Convenience for plugins using the old {Hide,Restore}Crosshair API.
+ * This links up to notify the GUI of the expected changes using the new APIs.
+ *
+ * Use of this old API is deprecated, as the names don't necessarily reflect
+ * what all GUIs may do in response to the notifications. Keeping these APIs
+ * is aimed at easing transition to the newer API, they will emit a harmless
+ * warning at the time of their first use.
+ *
*/
void
-HideCrosshair ()
+HideCrosshair (void)
{
- /* fprintf(stderr, "HideCrosshair stack %d\n", CrosshairStackLocation); */
- if (CrosshairStackLocation >= MAX_CROSSHAIRSTACK_DEPTH)
+ static bool warned_old_api = false;
+ if (!warned_old_api)
{
- fprintf(stderr, "Error: CrosshairStackLocation overflow\n");
- return;
+ Message (_("WARNING: A plugin is using the deprecated API HideCrosshair().\n"
+ " This API may be removed in a future release of PCB.\n"));
+ warned_old_api = true;
}
- CrosshairStack[CrosshairStackLocation] = Crosshair.On;
- CrosshairStackLocation++;
-
- CrosshairOff ();
+ notify_crosshair_change (false);
}
-/* ---------------------------------------------------------------------------
- * restores last crosshair state
- */
void
RestoreCrosshair (void)
{
- /* fprintf(stderr, "RestoreCrosshair stack %d\n", CrosshairStackLocation); */
- if (CrosshairStackLocation <= 0)
+ static bool warned_old_api = false;
+ if (!warned_old_api)
{
- fprintf(stderr, "Error: CrosshairStackLocation underflow\n");
- return;
+ Message (_("WARNING: A plugin is using the deprecated API RestoreCrosshair().\n"
+ " This API may be removed in a future release of PCB.\n"));
+ warned_old_api = true;
}
- CrosshairStackLocation--;
-
- if (CrosshairStack[CrosshairStackLocation])
- CrosshairOn ();
- else
- CrosshairOff ();
+ notify_crosshair_change (true);
}
+/* ---------------------------------------------------------------------------
+ * Returns the square of the given number
+ */
static double
square (double x)
{
@@ -1064,8 +1116,8 @@ MoveCrosshairRelative (LocationType DeltaX, LocationType DeltaY)
}
/* ---------------------------------------------------------------------------
- * move crosshair absolute switched off if it moved
- * return true if it switched off
+ * move crosshair absolute
+ * return true if the crosshair was moved from its existing position
*/
bool
MoveCrosshairAbsolute (LocationType X, LocationType Y)
@@ -1076,13 +1128,14 @@ MoveCrosshairAbsolute (LocationType X, LocationType Y)
FitCrosshairIntoGrid (X, Y);
if (Crosshair.X != x || Crosshair.Y != y)
{
- /* back up to old position and erase crosshair */
+ /* back up to old position to notify the GUI
+ * (which might want to erase the old crosshair) */
z = Crosshair.X;
Crosshair.X = x;
x = z;
z = Crosshair.Y;
Crosshair.Y = y;
- HideCrosshair ();
+ notify_crosshair_change (false); /* Our caller notifies when it has done */
/* now move forward again */
Crosshair.X = x;
Crosshair.Y = z;
diff --git a/src/crosshair.h b/src/crosshair.h
index ff16b1e..671ae3d 100644
--- a/src/crosshair.h
+++ b/src/crosshair.h
@@ -46,6 +46,7 @@
#define STATE_SECOND 1
#define STATE_THIRD 2
+void notify_crosshair_change (bool changes_complete);
void CrosshairOn (void);
void CrosshairOff (void);
void HideCrosshair (void);
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 5af6ed6..5037ff0 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -1838,11 +1838,11 @@ ScrollAction (int argc, char **argv, int x, int y)
else
AFAIL (scroll);
- HideCrosshair ();
+ notify_crosshair_change (false);
ghid_port_ranges_pan (dx, dy, TRUE);
MoveCrosshairRelative (dx, dy);
AdjustAttachedObjects ();
- RestoreCrosshair ();
+ notify_crosshair_change (true);
return 0;
}
diff --git a/src/hid/gtk/gui-misc.c b/src/hid/gtk/gui-misc.c
index 8bda96d..75ba763 100644
--- a/src/hid/gtk/gui-misc.c
+++ b/src/hid/gtk/gui-misc.c
@@ -403,12 +403,12 @@ run_get_location_loop (const gchar * message)
oldObjState = Crosshair.AttachedObject.State;
oldLineState = Crosshair.AttachedLine.State;
oldBoxState = Crosshair.AttachedBox.State;
- HideCrosshair ();
+ notify_crosshair_change (false);
Crosshair.AttachedObject.State = STATE_FIRST;
Crosshair.AttachedLine.State = STATE_FIRST;
Crosshair.AttachedBox.State = STATE_FIRST;
ghid_hand_cursor ();
- RestoreCrosshair ();
+ notify_crosshair_change (true);
/* Stop the top level GMainLoop from getting user input from keyboard
| and mouse so we can install our own handlers here. Also set the
@@ -439,11 +439,11 @@ run_get_location_loop (const gchar * message)
ghid_interface_input_signals_connect (); /* return to normal */
ghid_interface_set_sensitive (TRUE);
- HideCrosshair ();
+ notify_crosshair_change (false);
Crosshair.AttachedObject.State = oldObjState;
Crosshair.AttachedLine.State = oldLineState;
Crosshair.AttachedBox.State = oldBoxState;
- RestoreCrosshair ();
+ notify_crosshair_change (true);
ghid_restore_cursor ();
ghid_set_status_line_label ();
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index b62ecf0..a0e8eb3 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -232,7 +232,7 @@ ghid_note_event_location (GdkEventButton * ev)
if (moved)
{
AdjustAttachedObjects ();
- RestoreCrosshair ();
+ notify_crosshair_change (true);
}
ghid_set_cursor_position_labels ();
return moved;
diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index c1b12d3..75c295e 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -1310,12 +1310,12 @@ mod_changed (XKeyEvent * e, int set)
return;
}
in_move_event = 1;
- HideCrosshair ();
+ notify_crosshair_change (false);
if (panning)
Pan (2, e->x, e->y);
EventMoveCrosshair (Px (e->x), Py (e->y));
AdjustAttachedObjects ();
- RestoreCrosshair ();
+ notify_crosshair_change (true);
in_move_event = 0;
}
@@ -1351,7 +1351,7 @@ work_area_input (Widget w, XtPointer v, XEvent * e, Boolean * ctd)
}
ignore_release = 0;
- HideCrosshair ();
+ notify_crosshair_change (false);
pressed_button = e->xbutton.button;
mods = ((e->xbutton.state & ShiftMask) ? M_Shift : 0)
+ ((e->xbutton.state & ControlMask) ? M_Ctrl : 0)
@@ -1361,7 +1361,7 @@ work_area_input (Widget w, XtPointer v, XEvent * e, Boolean * ctd)
+ ((e->xbutton.state & Mod1Mask) ? M_Alt : 0);
#endif
do_mouse_action(e->xbutton.button, mods);
- RestoreCrosshair ();
+ notify_crosshair_change (true);
break;
}
@@ -1371,7 +1371,7 @@ work_area_input (Widget w, XtPointer v, XEvent * e, Boolean * ctd)
if (e->xbutton.button != pressed_button)
return;
lesstif_button_event (w, e);
- HideCrosshair ();
+ notify_crosshair_change (false);
pressed_button = 0;
mods = ((e->xbutton.state & ShiftMask) ? M_Shift : 0)
+ ((e->xbutton.state & ControlMask) ? M_Ctrl : 0)
@@ -1382,7 +1382,7 @@ work_area_input (Widget w, XtPointer v, XEvent * e, Boolean * ctd)
#endif
+ M_Release;
do_mouse_action (e->xbutton.button, mods);
- RestoreCrosshair ();
+ notify_crosshair_change (true);
break;
}
diff --git a/src/misc.c b/src/misc.c
index d63aef1..5bea138 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -705,15 +705,11 @@ CenterDisplay (LocationType X, LocationType Y, bool Delta)
double save_grid = PCB->Grid;
PCB->Grid = 1;
if (Delta)
- {
- MoveCrosshairRelative (X, Y);
- }
+ MoveCrosshairRelative (X, Y);
else
{
if (MoveCrosshairAbsolute (X, Y))
- {
- RestoreCrosshair ();
- }
+ notify_crosshair_change (true);
}
gui->set_crosshair (Crosshair.X, Crosshair.Y, HID_SC_WARP_POINTER);
PCB->Grid = save_grid;
diff --git a/src/set.c b/src/set.c
index 90db719..16986e8 100644
--- a/src/set.c
+++ b/src/set.c
@@ -244,7 +244,7 @@ SetMode (int Mode)
if (recursing)
return;
recursing = true;
- HideCrosshair ();
+ notify_crosshair_change (false);
addedLines = 0;
Crosshair.AttachedObject.Type = NO_TYPE;
Crosshair.AttachedObject.State = STATE_FIRST;
@@ -314,7 +314,7 @@ SetMode (int Mode)
* may have changed
*/
MoveCrosshairRelative (0, 0);
- RestoreCrosshair ();
+ notify_crosshair_change (true);
}
void
@@ -342,20 +342,20 @@ SetLocalRef (LocationType X, LocationType Y, bool Showing)
if (Showing)
{
- HideCrosshair ();
+ notify_crosshair_change (false);
if (count == 0)
old = Marked;
Marked.X = X;
Marked.Y = Y;
Marked.status = true;
count++;
- RestoreCrosshair ();
+ notify_crosshair_change (true);
}
else if (count > 0)
{
- HideCrosshair ();
+ notify_crosshair_change (false);
count = 0;
Marked = old;
- RestoreCrosshair ();
+ notify_crosshair_change (true);
}
}
|
|
From: <gi...@gp...> - 2011-04-26 20:06:35
|
The branch, master has been updated
via 19373161d96d8bc776ab8a123069d3a01dc22cd4 (commit)
from 12982d2e9442df4ff51d8a6a88e23c18e9338fec (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/hid/gtk/gtkhid-gdk.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
=================
Commit Messages
=================
commit 19373161d96d8bc776ab8a123069d3a01dc22cd4
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: DrawMark from ghid_invalidate_all() as well as DrawAttached
:100644 100644 c9947c2... fa6dea0... M src/hid/gtk/gtkhid-gdk.c
=========
Changes
=========
commit 19373161d96d8bc776ab8a123069d3a01dc22cd4
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: DrawMark from ghid_invalidate_all() as well as DrawAttached
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index c9947c2..fa6dea0 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -772,6 +772,7 @@ ghid_invalidate_all ()
ghid_draw_grid ();
DrawAttached ();
+ DrawMark ();
ghid_screen_update ();
}
|
|
From: <gi...@gp...> - 2011-04-26 19:53:47
|
The branch, master has been updated
via 12982d2e9442df4ff51d8a6a88e23c18e9338fec (commit)
from 4d457455798d50d814fd8feb349261a4b64dd5ec (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 | 4 ----
src/hid/gtk/gtkhid-gdk.c | 5 ++---
src/hid/gtk/gui-output-events.c | 15 ---------------
src/hid/gtk/gui-top-window.c | 3 ---
src/hid/gtk/gui.h | 2 +-
5 files changed, 3 insertions(+), 26 deletions(-)
=================
Commit Messages
=================
commit 12982d2e9442df4ff51d8a6a88e23c18e9338fec
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Let the GUIs manage the crosshair across a redraw
Removes several {Hide/Restore}Crosshair() calls from the GTK HID.
These are not requried any more, as they are followed by invalidate_all()
calls which take care of the crosshair as well.
Changes to draw.c were tested not to affect Lesstif HID
:100644 100644 fcd605b... 6eb0d81... M src/draw.c
:100644 100644 ba58d5d... c9947c2... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 268988d... b62ecf0... M src/hid/gtk/gui-output-events.c
:100644 100644 f33678a... 1a81c58... M src/hid/gtk/gui-top-window.c
:100644 100644 d7f0d39... 180e58c... M src/hid/gtk/gui.h
=========
Changes
=========
commit 12982d2e9442df4ff51d8a6a88e23c18e9338fec
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Let the GUIs manage the crosshair across a redraw
Removes several {Hide/Restore}Crosshair() calls from the GTK HID.
These are not requried any more, as they are followed by invalidate_all()
calls which take care of the crosshair as well.
Changes to draw.c were tested not to affect Lesstif HID
diff --git a/src/draw.c b/src/draw.c
index fcd605b..6eb0d81 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -154,13 +154,9 @@ AddPart (void *b)
void
Draw (void)
{
- HideCrosshair ();
-
if (Block.X1 <= Block.X2 && Block.Y1 <= Block.Y2)
gui->invalidate_lr (Block.X1, Block.X2, Block.Y1, Block.Y2);
- RestoreCrosshair ();
-
/* shrink the update block */
Block.X1 = Block.Y1 = MAXINT;
Block.X2 = Block.Y2 = -MAXINT;
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index ba58d5d..c9947c2 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -770,9 +770,8 @@ ghid_invalidate_all ()
hid_expose_callback (&ghid_hid, ®ion, 0);
ghid_draw_grid ();
- if (ghidgui->need_restore_crosshair)
- RestoreCrosshair ();
- ghidgui->need_restore_crosshair = FALSE;
+
+ DrawAttached ();
ghid_screen_update ();
}
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index 268988d..b62ecf0 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -58,9 +58,6 @@ ghid_port_ranges_changed (void)
{
GtkAdjustment *h_adj, *v_adj;
- HideCrosshair ();
- ghidgui->need_restore_crosshair = TRUE;
-
h_adj = gtk_range_get_adjustment (GTK_RANGE (ghidgui->h_range));
v_adj = gtk_range_get_adjustment (GTK_RANGE (ghidgui->v_range));
gport->view_x0 = h_adj->value;
@@ -305,11 +302,8 @@ ghid_port_key_release_cb (GtkWidget * drawing_area, GdkEventKey * kev,
if (ghid_is_modifier_key_sym (ksym))
ghid_note_event_location (NULL);
- HideCrosshair ();
AdjustAttachedObjects ();
ghid_invalidate_all ();
- RestoreCrosshair ();
- ghid_screen_update ();
g_idle_add (ghid_idle_cb, NULL);
return FALSE;
}
@@ -447,15 +441,12 @@ ghid_port_button_press_cb (GtkWidget * drawing_area,
state = (GdkModifierType) (ev->state);
mk = ghid_modifier_keys_state (&state);
ghid_show_crosshair (FALSE);
- HideCrosshair ();
do_mouse_action(ev->button, mk);
ghid_invalidate_all ();
- RestoreCrosshair ();
ghid_window_set_name_label (PCB->Name);
ghid_set_status_line_label ();
- ghid_show_crosshair (TRUE);
if (!gport->panning)
g_idle_add (ghid_idle_cb, NULL);
return TRUE;
@@ -473,14 +464,10 @@ ghid_port_button_release_cb (GtkWidget * drawing_area,
state = (GdkModifierType) (ev->state);
mk = ghid_modifier_keys_state (&state);
- HideCrosshair ();
-
do_mouse_action(ev->button, mk + M_Release);
AdjustAttachedObjects ();
ghid_invalidate_all ();
- RestoreCrosshair ();
- ghid_screen_update ();
ghid_window_set_name_label (PCB->Name);
ghid_set_status_line_label ();
@@ -496,7 +483,6 @@ ghid_port_drawing_area_configure_event_cb (GtkWidget * widget,
{
static gboolean first_time_done;
- HideCrosshair ();
gport->width = ev->width;
gport->height = ev->height;
@@ -530,7 +516,6 @@ ghid_port_drawing_area_configure_event_cb (GtkWidget * widget,
ghid_port_ranges_scale (FALSE);
ghid_invalidate_all ();
- RestoreCrosshair ();
return 0;
}
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index f33678a..1a81c58 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -650,11 +650,8 @@ ghid_menu_cb (GtkAction * action, gpointer data)
*/
if (ghidgui->toggle_holdoff == FALSE)
{
- HideCrosshair ();
AdjustAttachedObjects ();
ghid_invalidate_all ();
- RestoreCrosshair ();
- ghid_screen_update ();
ghid_window_set_name_label (PCB->Name);
ghid_set_status_line_label ();
#ifdef FIXME
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index d7f0d39..180e58c 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -132,7 +132,7 @@ typedef struct
small_label_markup,
compact_horizontal,
compact_vertical,
- ghid_title_window, use_command_window, need_restore_crosshair, creating;
+ ghid_title_window, use_command_window, creating;
gint n_mode_button_columns,
top_window_width,
|
|
From: <gi...@gp...> - 2011-04-26 19:45:09
|
The branch, master has been updated
via 4d457455798d50d814fd8feb349261a4b64dd5ec (commit)
from fba79a4d2a325c1c21c467358fe06fd9a26930f9 (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/hid/gtk/gui.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
=================
Commit Messages
=================
commit 4d457455798d50d814fd8feb349261a4b64dd5ec
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove duplicated prototype
:100644 100644 f419530... d7f0d39... M src/hid/gtk/gui.h
=========
Changes
=========
commit 4d457455798d50d814fd8feb349261a4b64dd5ec
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove duplicated prototype
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index f419530..d7f0d39 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -282,7 +282,6 @@ void ghid_port_ranges_zoom (gdouble zoom);
gboolean ghid_port_ranges_pan (gdouble x, gdouble y, gboolean relative);
void ghid_port_ranges_scale (gboolean emit_changed);
void ghid_port_ranges_update_ranges (void);
-void ghid_screen_update (void);
gboolean ghid_note_event_location (GdkEventButton * ev);
gboolean have_crosshair_attachments (void);
|
|
From: <gi...@gp...> - 2011-04-26 19:44:59
|
The branch, master has been updated
via fba79a4d2a325c1c21c467358fe06fd9a26930f9 (commit)
from 351ebc91665795f98d0e6c6676d0c85c7e464008 (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 | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
=================
Commit Messages
=================
commit fba79a4d2a325c1c21c467358fe06fd9a26930f9
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Remove obsolete comment
:100644 100644 8e8821d... fcd605b... M src/draw.c
=========
Changes
=========
commit fba79a4d2a325c1c21c467358fe06fd9a26930f9
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Remove obsolete comment
diff --git a/src/draw.c b/src/draw.c
index 8e8821d..fcd605b 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -149,17 +149,13 @@ AddPart (void *b)
}
/*
- * initiate the actual drawing to the pixmap/screen
- * make the update block slightly larger to handle round-off
- * caused by the TO_SCREEN operation
+ * initiate the actual redrawing of the updated area
*/
void
Draw (void)
{
HideCrosshair ();
- /* clear and create event if not drawing to a pixmap
- */
if (Block.X1 <= Block.X2 && Block.Y1 <= Block.Y2)
gui->invalidate_lr (Block.X1, Block.X2, Block.Y1, Block.Y2);
|
|
From: <gi...@gp...> - 2011-04-26 19:42:53
|
The branch, master has been updated
discards 42edd0cc692dbc7d8609896b67bcabf4b209fbe8 (commit)
discards 44a8ca4f7d71cd743053a14ace0740b1f6e0b458 (commit)
discards 023dd955353cc355e00a3099f3262e16fa432bf6 (commit)
discards c96e65eeb94c569e81cc940d4a10dd54e3b7ebc1 (commit)
from 42edd0cc692dbc7d8609896b67bcabf4b209fbe8 (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/Makefile.am | 2 -
src/draw.c | 538 +++++++++++++++++++++++++++++++++++++++--------
src/draw.h | 1 +
src/draw_funcs.c | 402 -----------------------------------
src/draw_funcs.h | 17 --
src/hid/gerber/gerber.c | 3 +-
src/hid/gtk/gui.h | 1 +
src/hid/ps/ps.c | 3 +-
8 files changed, 458 insertions(+), 509 deletions(-)
delete mode 100644 src/draw_funcs.c
delete mode 100644 src/draw_funcs.h
=================
Commit Messages
=================
=========
Changes
=========
|
|
From: <gi...@gp...> - 2011-04-26 19:26:43
|
The branch, master has been updated
via 42edd0cc692dbc7d8609896b67bcabf4b209fbe8 (commit)
from 44a8ca4f7d71cd743053a14ace0740b1f6e0b458 (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/hid/gtk/gui.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
=================
Commit Messages
=================
commit 42edd0cc692dbc7d8609896b67bcabf4b209fbe8
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove duplicated prototype
:100644 100644 f419530... d7f0d39... M src/hid/gtk/gui.h
=========
Changes
=========
commit 42edd0cc692dbc7d8609896b67bcabf4b209fbe8
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove duplicated prototype
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index f419530..d7f0d39 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -282,7 +282,6 @@ void ghid_port_ranges_zoom (gdouble zoom);
gboolean ghid_port_ranges_pan (gdouble x, gdouble y, gboolean relative);
void ghid_port_ranges_scale (gboolean emit_changed);
void ghid_port_ranges_update_ranges (void);
-void ghid_screen_update (void);
gboolean ghid_note_event_location (GdkEventButton * ev);
gboolean have_crosshair_attachments (void);
|
|
From: <gi...@gp...> - 2011-04-26 19:16:03
|
The branch, master has been updated
via 44a8ca4f7d71cd743053a14ace0740b1f6e0b458 (commit)
via 023dd955353cc355e00a3099f3262e16fa432bf6 (commit)
via c96e65eeb94c569e81cc940d4a10dd54e3b7ebc1 (commit)
from 351ebc91665795f98d0e6c6676d0c85c7e464008 (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/Makefile.am | 2 +
src/draw.c | 538 ++++++++---------------------------------------
src/draw.h | 1 -
src/draw_funcs.c | 402 +++++++++++++++++++++++++++++++++++
src/draw_funcs.h | 17 ++
src/hid/gerber/gerber.c | 3 +-
src/hid/ps/ps.c | 3 +-
7 files changed, 509 insertions(+), 457 deletions(-)
create mode 100644 src/draw_funcs.c
create mode 100644 src/draw_funcs.h
=================
Commit Messages
=================
commit 44a8ca4f7d71cd743053a14ace0740b1f6e0b458
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Remove obsolete comment
:100644 100644 53757f4... 20a269d... M src/draw.c
commit 023dd955353cc355e00a3099f3262e16fa432bf6
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Continue with crazy idea
:100644 100644 cc04a43... 53757f4... M src/draw.c
:100644 100644 adfee36... cf324a5... M src/draw.h
:100644 100644 49beeba... 363a85e... M src/draw_funcs.c
:100644 100644 1f97d82... 25c33a1... M src/draw_funcs.h
:100644 100644 d5843ef... 4429121... M src/hid/gerber/gerber.c
:100644 100644 a417753... 8024abc... M src/hid/ps/ps.c
commit c96e65eeb94c569e81cc940d4a10dd54e3b7ebc1
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Crasy test
:100644 100644 5abbfb2... 34cd5b3... M src/Makefile.am
:100644 100644 8e8821d... cc04a43... M src/draw.c
:000000 100644 0000000... 49beeba... A src/draw_funcs.c
:000000 100644 0000000... 1f97d82... A src/draw_funcs.h
=========
Changes
=========
commit 44a8ca4f7d71cd743053a14ace0740b1f6e0b458
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Remove obsolete comment
diff --git a/src/draw.c b/src/draw.c
index 53757f4..20a269d 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -108,17 +108,13 @@ AddPart (void *b)
}
/*
- * initiate the actual drawing to the pixmap/screen
- * make the update block slightly larger to handle round-off
- * caused by the TO_SCREEN operation
+ * initiate the actual redrawing of the updated area
*/
void
Draw (void)
{
HideCrosshair ();
- /* clear and create event if not drawing to a pixmap
- */
if (Block.X1 <= Block.X2 && Block.Y1 <= Block.Y2)
gui->invalidate_lr (Block.X1, Block.X2, Block.Y1, Block.Y2);
commit 023dd955353cc355e00a3099f3262e16fa432bf6
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Continue with crazy idea
diff --git a/src/draw.c b/src/draw.c
index cc04a43..53757f4 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -149,16 +149,6 @@ set_pv_color (PinType *pv, int type)
: PCB->PinColor);
}
-static void
-set_pv_inlayer_color (PinType *pv, LayerType *layer, int type)
-{
- if (TEST_FLAG (WARNFLAG, pv)) gui->set_color (Output.fgGC, PCB->WarnColor);
- else if (TEST_FLAG (SELECTEDFLAG, pv)) gui->set_color (Output.fgGC, (type == VIA_TYPE) ? PCB->ViaSelectedColor
- : PCB->PinSelectedColor);
- else if (TEST_FLAG (FOUNDFLAG, pv)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
- else gui->set_color (Output.fgGC, layer->Color);
-}
-
static int
pin_callback (const BoxType * b, void *cl)
{
@@ -168,14 +158,6 @@ pin_callback (const BoxType * b, void *cl)
}
static int
-pin_inlayer_callback (const BoxType * b, void *cl)
-{
- set_pv_inlayer_color ((PinType *)b, cl, PIN_TYPE);
- dapi->draw_pin ((PinType *)b, NULL, NULL);
- return 1;
-}
-
-static int
via_callback (const BoxType * b, void *cl)
{
set_pv_color ((PinType *)b, VIA_TYPE);
@@ -184,14 +166,6 @@ via_callback (const BoxType * b, void *cl)
}
static int
-via_inlayer_callback (const BoxType * b, void *cl)
-{
- set_pv_inlayer_color ((PinType *)b, cl, VIA_TYPE);
- dapi->draw_via ((PinType *)b, NULL, NULL);
- return 1;
-}
-
-static int
pad_callback (const BoxType * b, void *cl)
{
PadTypePtr pad = (PadTypePtr) b;
@@ -210,28 +184,6 @@ pad_callback (const BoxType * b, void *cl)
return 1;
}
-static int
-pad_inlayer_callback (const BoxType * b, void *cl)
-{
- PadTypePtr pad = (PadTypePtr) b;
- LayerType *layer = cl;
- int solder_group = GetLayerGroupNumberByNumber (solder_silk_layer);
- int group = GetLayerGroupNumberByPointer (layer);
-
- int side = (group == solder_group) ? SOLDER_LAYER : COMPONENT_LAYER;
-
- if (ON_SIDE (pad, side))
- {
- 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 if (TEST_FLAG (FOUNDFLAG, pad)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
- else gui->set_color (Output.fgGC, layer->Color);
-
- dapi->draw_pad (pad, NULL, NULL);
- }
- return 1;
-}
-
static void
draw_element_name (ElementType *element)
{
@@ -365,20 +317,6 @@ CountHoles (int *plated, int *unplated, BoxType *drawn_area)
}
static int
-line_callback (const BoxType * b, void *cl)
-{
- LayerType *layer = cl;
- LineType *line = (LineType *)b;
-
- if (TEST_FLAG (SELECTEDFLAG, line)) gui->set_color (Output.fgGC, layer->SelectedColor);
- else if (TEST_FLAG (FOUNDFLAG, line)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
- else gui->set_color (Output.fgGC, layer->Color);
-
- dapi->draw_line (line, NULL, NULL);
- return 1;
-}
-
-static int
rat_callback (const BoxType * b, void *cl)
{
RatType *rat = (RatType *)b;
@@ -391,20 +329,6 @@ rat_callback (const BoxType * b, void *cl)
return 1;
}
-static int
-arc_callback (const BoxType * b, void *cl)
-{
- LayerType *layer = cl;
- ArcType *arc = (ArcType *)b;
-
- if (TEST_FLAG (SELECTEDFLAG, arc)) gui->set_color (Output.fgGC, layer->SelectedColor);
- else if (TEST_FLAG (FOUNDFLAG, arc)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
- else gui->set_color (Output.fgGC, layer->Color);
-
- dapi->draw_arc (arc, NULL, NULL);
- return 1;
-}
-
static void
draw_element_package (ElementType *element)
{
@@ -506,7 +430,7 @@ DrawEverything (BoxTypePtr drawn_area)
{
r_search (PCB->Data->element_tree, drawn_area, NULL, element_callback, &side);
r_search (PCB->Data->name_tree[NAME_INDEX (PCB)], drawn_area, NULL, name_callback, &side);
- DrawLayer (&(PCB->Data->Layer[max_copper_layer + side]), drawn_area);
+ dapi->draw_layer (&(PCB->Data->Layer[max_copper_layer + side]), drawn_area, NULL);
}
r_search (PCB->Data->pad_tree, drawn_area, NULL, pad_callback, &side);
}
@@ -670,25 +594,6 @@ via_mask_callback (const BoxType * b, void *cl)
return 1;
}
-struct poly_info {
- const BoxType *drawn_area;
- LayerType *layer;
-};
-
-static int
-poly_callback (const BoxType * b, void *cl)
-{
- struct poly_info *i = cl;
- PolygonType *polygon = (PolygonType *)b;
-
- if (TEST_FLAG (SELECTEDFLAG, polygon)) gui->set_color (Output.fgGC, i->layer->SelectedColor);
- else if (TEST_FLAG (FOUNDFLAG, polygon)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
- else gui->set_color (Output.fgGC, i->layer->Color);
-
- dapi->draw_poly (polygon, i->drawn_area, NULL);
- return 1;
-}
-
static int
pad_mask_callback (const BoxType * b, void *cl)
{
@@ -717,7 +622,7 @@ DrawSilk (int side, const BoxType * drawn_area)
{
gui->use_mask (HID_MASK_BEFORE);
#endif
- DrawLayer (LAYER_PTR (max_copper_layer + side), drawn_area);
+ dapi->draw_layer (LAYER_PTR (max_copper_layer + side), drawn_area, NULL);
/* draw package */
r_search (PCB->Data->element_tree, drawn_area, NULL, element_callback, &side);
r_search (PCB->Data->name_tree[NAME_INDEX (PCB)], drawn_area, NULL, name_callback, &side);
@@ -732,7 +637,7 @@ DrawSilk (int side, const BoxType * drawn_area)
if (gui->poly_after)
{
gui->use_mask (HID_MASK_AFTER);
- DrawLayer (LAYER_PTR (max_copper_layer + layer), drawn_area);
+ dapi->draw_layer (LAYER_PTR (max_copper_layer + layer), drawn_area, NULL);
/* draw package */
r_search (PCB->Data->element_tree, drawn_area, NULL, element_callback, &side);
r_search (PCB->Data->name_tree[NAME_INDEX (PCB)], drawn_area, NULL, name_callback, &side);
@@ -820,116 +725,6 @@ DrawRats (BoxTypePtr drawn_area)
gui->use_mask (HID_MASK_OFF);
}
-static int
-text_callback (const BoxType * b, void *cl)
-{
- 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;
-}
-
-/* ---------------------------------------------------------------------------
- * draws one non-copper layer
- */
-void
-DrawLayerCommon (LayerTypePtr Layer, const BoxType * screen, bool clear_pins)
-{
- int component_group = GetLayerGroupNumberByNumber (component_silk_layer);
- int solder_group = GetLayerGroupNumberByNumber (solder_silk_layer);
- int group = GetLayerGroupNumberByPointer (Layer);
- struct poly_info info = {screen, Layer};
-
- /* print the non-clearing polys */
- r_search (Layer->polygon_tree, screen, NULL, poly_callback, &info);
-
- if (clear_pins && TEST_FLAG (CHECKPLANESFLAG, PCB))
- return;
-
- /* draw all visible lines this layer */
- r_search (Layer->line_tree, screen, NULL, line_callback, Layer);
-
- /* draw the layer arcs on screen */
- r_search (Layer->arc_tree, screen, NULL, arc_callback, Layer);
-
- /* draw the layer text on screen */
- r_search (Layer->text_tree, screen, NULL, text_callback, Layer);
-
- /* We should check for gui->gui here, but it's kinda cool seeing the
- auto-outline magically disappear when you first add something to
- the "outline" layer. */
-
- if (strcmp (Layer->Name, "outline") == 0 ||
- strcmp (Layer->Name, "route") == 0)
- {
- if (IsLayerEmpty (Layer))
- {
- gui->set_color (Output.fgGC, Layer->Color);
- gui->set_line_width (Output.fgGC, PCB->minWid);
- gui->draw_rect (Output.fgGC, 0, 0, PCB->MaxWidth, PCB->MaxHeight);
- }
- return;
- }
-
- /* draw element pins */
- r_search (PCB->Data->pin_tree, screen, NULL, pin_inlayer_callback, Layer);
-
- /* draw element pads */
- if (group == component_group)
- r_search (PCB->Data->pad_tree, screen, NULL, pad_inlayer_callback, Layer);
-
- if (group == solder_group)
- r_search (PCB->Data->pad_tree, screen, NULL, pad_inlayer_callback, Layer);
-
- /* draw vias */
- r_search (PCB->Data->via_tree, screen, NULL, via_inlayer_callback, Layer);
- r_search (PCB->Data->pin_tree, screen, NULL, hole_callback, NULL);
- r_search (PCB->Data->via_tree, screen, NULL, hole_callback, NULL);
-}
-
-void
-DrawLayer (LayerTypePtr Layer, const BoxType * screen)
-{
- struct poly_info info = {screen, Layer};
-
- /* print the non-clearing polys */
- r_search (Layer->polygon_tree, screen, NULL, poly_callback, &info);
-
- /* draw all visible lines this layer */
- r_search (Layer->line_tree, screen, NULL, line_callback, Layer);
-
- /* draw the layer arcs on screen */
- r_search (Layer->arc_tree, screen, NULL, arc_callback, Layer);
-
- /* draw the layer text on screen */
- r_search (Layer->text_tree, screen, NULL, text_callback, Layer);
-
- /* We should check for gui->gui here, but it's kinda cool seeing the
- auto-outline magically disappear when you first add something to
- the "outline" layer. */
- if (IsLayerEmpty (Layer)
- && (strcmp (Layer->Name, "outline") == 0
- || strcmp (Layer->Name, "route") == 0))
- {
- gui->set_color (Output.fgGC, Layer->Color);
- gui->set_line_width (Output.fgGC, PCB->minWid);
- gui->draw_rect (Output.fgGC,
- 0, 0,
- PCB->MaxWidth, PCB->MaxHeight);
- }
-}
-
/* ---------------------------------------------------------------------------
* draws one layer group. Returns non-zero if pins and pads should be
* drawn with this group.
@@ -951,7 +746,7 @@ DrawLayerGroup (int group, const BoxType *drawn_area)
strcmp (Layer->Name, "route") == 0)
rv = 0;
if (layernum < max_copper_layer && Layer->On)
- DrawLayerCommon (Layer, drawn_area, true);
+ dapi->draw_layer (Layer, drawn_area, NULL);
}
if (n_entries > 1)
rv = 1;
diff --git a/src/draw.h b/src/draw.h
index adfee36..cf324a5 100644
--- a/src/draw.h
+++ b/src/draw.h
@@ -54,7 +54,6 @@ void DrawElementName (ElementTypePtr);
void DrawElementPackage (ElementTypePtr);
void DrawElementPinsAndPads (ElementTypePtr);
void DrawObject (int, void *, void *);
-void DrawLayer (LayerTypePtr, const BoxType *);
void EraseVia (PinTypePtr);
void EraseRat (RatTypePtr);
void EraseViaName (PinTypePtr);
diff --git a/src/draw_funcs.c b/src/draw_funcs.c
index 49beeba..363a85e 100644
--- a/src/draw_funcs.c
+++ b/src/draw_funcs.c
@@ -1,7 +1,10 @@
#include "global.h"
#include "data.h"
+#include "misc.h"
+#include "rtree.h"
#include "draw_funcs.h"
+#include "draw.h"
static void
_draw_pv (PinType *pv, bool draw_hole)
@@ -180,6 +183,206 @@ draw_poly (PolygonType *polygon, const BoxType *drawn_area, void *userdata)
}
}
+static int
+line_callback (const BoxType * b, void *cl)
+{
+ LayerType *layer = cl;
+ LineType *line = (LineType *)b;
+
+ if (TEST_FLAG (SELECTEDFLAG, line)) gui->set_color (Output.fgGC, layer->SelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, line)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+
+ dapi->draw_line (line, NULL, NULL);
+ return 1;
+}
+
+static int
+arc_callback (const BoxType * b, void *cl)
+{
+ LayerType *layer = cl;
+ ArcType *arc = (ArcType *)b;
+
+ if (TEST_FLAG (SELECTEDFLAG, arc)) gui->set_color (Output.fgGC, layer->SelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, arc)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+
+ dapi->draw_arc (arc, NULL, NULL);
+ return 1;
+}
+
+struct poly_info {
+ const const BoxType *drawn_area;
+ LayerType *layer;
+};
+
+static int
+poly_callback (const BoxType * b, void *cl)
+{
+ struct poly_info *i = cl;
+ PolygonType *polygon = (PolygonType *)b;
+
+ if (TEST_FLAG (SELECTEDFLAG, polygon)) gui->set_color (Output.fgGC, i->layer->SelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, polygon)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, i->layer->Color);
+
+ dapi->draw_poly (polygon, i->drawn_area, NULL);
+ return 1;
+}
+
+static int
+text_callback (const BoxType * b, void *cl)
+{
+ 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;
+}
+
+static void
+set_pv_inlayer_color (PinType *pv, LayerType *layer, int type)
+{
+ if (TEST_FLAG (WARNFLAG, pv)) gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pv)) gui->set_color (Output.fgGC, (type == VIA_TYPE) ? PCB->ViaSelectedColor
+ : PCB->PinSelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, pv)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+}
+
+static int
+pin_inlayer_callback (const BoxType * b, void *cl)
+{
+ set_pv_inlayer_color ((PinType *)b, cl, PIN_TYPE);
+ dapi->draw_pin ((PinType *)b, NULL, NULL);
+ return 1;
+}
+
+static int
+via_inlayer_callback (const BoxType * b, void *cl)
+{
+ set_pv_inlayer_color ((PinType *)b, cl, VIA_TYPE);
+ dapi->draw_via ((PinType *)b, NULL, NULL);
+ return 1;
+}
+
+static int
+pad_inlayer_callback (const BoxType * b, void *cl)
+{
+ PadTypePtr pad = (PadTypePtr) b;
+ LayerType *layer = cl;
+ int solder_group = GetLayerGroupNumberByNumber (solder_silk_layer);
+ int group = GetLayerGroupNumberByPointer (layer);
+
+ int side = (group == solder_group) ? SOLDER_LAYER : COMPONENT_LAYER;
+
+ if (ON_SIDE (pad, side))
+ {
+ 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 if (TEST_FLAG (FOUNDFLAG, pad)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+
+ dapi->draw_pad (pad, NULL, NULL);
+ }
+ return 1;
+}
+
+static int
+hole_callback (const BoxType * b, void *cl)
+{
+ PinTypePtr pv = (PinTypePtr) b;
+ int plated = cl ? *(int *) cl : -1;
+
+ if ((plated == 0 && !TEST_FLAG (HOLEFLAG, pv)) ||
+ (plated == 1 && TEST_FLAG (HOLEFLAG, pv)))
+ return 1;
+
+ if (TEST_FLAG (WARNFLAG, pv)) gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pv)) gui->set_color (Output.fgGC, PCB->PinSelectedColor);
+ else gui->set_color (Output.fgGC, Settings.BlackColor);
+
+ dapi->draw_hole (pv, NULL, NULL);
+ return 1;
+}
+
+static void
+draw_layer (LayerType *layer, const BoxType *drawn_area, void *userdata)
+{
+ int component_group = GetLayerGroupNumberByNumber (component_silk_layer);
+ int solder_group = GetLayerGroupNumberByNumber (solder_silk_layer);
+ int layer_num = GetLayerNumber (PCB->Data, layer);
+ int group = GetLayerGroupNumberByPointer (layer);
+ struct poly_info info = {drawn_area, layer};
+
+ /* print the non-clearing polys */
+ r_search (layer->polygon_tree, drawn_area, NULL, poly_callback, &info);
+
+ if (TEST_FLAG (CHECKPLANESFLAG, PCB))
+ return;
+
+ /* draw all visible lines this layer */
+ r_search (layer->line_tree, drawn_area, NULL, line_callback, layer);
+
+ /* draw the layer arcs on drawn_area */
+ r_search (layer->arc_tree, drawn_area, NULL, arc_callback, layer);
+
+ /* draw the layer text on drawn_area */
+ r_search (layer->text_tree, drawn_area, NULL, text_callback, layer);
+
+ /* We should check for gui->gui here, but it's kinda cool seeing the
+ auto-outline magically disappear when you first add something to
+ the "outline" layer. */
+
+ if (strcmp (layer->Name, "outline") == 0 ||
+ strcmp (layer->Name, "route") == 0)
+ {
+ if (IsLayerEmpty (layer))
+ {
+ gui->set_color (Output.fgGC, layer->Color);
+ gui->set_line_width (Output.fgGC, PCB->minWid);
+ gui->draw_rect (Output.fgGC, 0, 0, PCB->MaxWidth, PCB->MaxHeight);
+ }
+ return;
+ }
+
+ /* Don't draw vias on silk layers */
+ if (layer_num >= max_copper_layer)
+ return;
+
+#if 0
+ /* Don't draw vias on layers which are out of the layer stack */
+ if ((group >= component_group && group >= solder_group) ||
+ (group <= component_group && group <= solder_group))
+ return;
+#endif
+
+ /* draw element pins */
+ r_search (PCB->Data->pin_tree, drawn_area, NULL, pin_inlayer_callback, layer);
+
+ /* draw element pads */
+ if (group == component_group)
+ r_search (PCB->Data->pad_tree, drawn_area, NULL, pad_inlayer_callback, layer);
+
+ if (group == solder_group)
+ r_search (PCB->Data->pad_tree, drawn_area, NULL, pad_inlayer_callback, layer);
+
+ /* draw vias */
+ r_search (PCB->Data->via_tree, drawn_area, NULL, via_inlayer_callback, layer);
+ r_search (PCB->Data->pin_tree, drawn_area, NULL, hole_callback, NULL);
+ r_search (PCB->Data->via_tree, drawn_area, NULL, hole_callback, NULL);
+}
+
struct draw_funcs d_f = {
.draw_pin = draw_pin,
.draw_pin_mask = draw_pin_mask,
@@ -193,6 +396,7 @@ struct draw_funcs d_f = {
.draw_rat = draw_rat,
.draw_arc = draw_arc,
.draw_poly = draw_poly,
+ .draw_layer = draw_layer,
};
struct draw_funcs *dapi = &d_f;
diff --git a/src/draw_funcs.h b/src/draw_funcs.h
index 1f97d82..25c33a1 100644
--- a/src/draw_funcs.h
+++ b/src/draw_funcs.h
@@ -11,6 +11,7 @@ struct draw_funcs {
void (*draw_rat) (RatType *, const BoxType *, void *);
void (*draw_arc) (ArcType *, const BoxType *, void *);
void (*draw_poly) (PolygonType *, const BoxType *, void *);
+ void (*draw_layer) (LayerType *, const BoxType *, void *);
};
extern struct draw_funcs *dapi;
diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
index d5843ef..4429121 100644
--- a/src/hid/gerber/gerber.c
+++ b/src/hid/gerber/gerber.c
@@ -26,6 +26,7 @@
#include "misc.h"
#include "error.h"
#include "draw.h"
+#include "draw_funcs.h"
#include "hid.h"
#include "../hidint.h"
@@ -719,7 +720,7 @@ gerber_set_layer (const char *name, int group, int empty)
{
if (outline_layer
&& outline_layer != PCB->Data->Layer+idx)
- DrawLayer (outline_layer, ®ion);
+ dapi->draw_layer (outline_layer, ®ion, NULL);
else if (!outline_layer)
{
hidGC gc = gui->make_gc ();
diff --git a/src/hid/ps/ps.c b/src/hid/ps/ps.c
index a417753..8024abc 100644
--- a/src/hid/ps/ps.c
+++ b/src/hid/ps/ps.c
@@ -16,6 +16,7 @@
#include "misc.h"
#include "error.h"
#include "draw.h"
+#include "draw_funcs.h"
#include "hid.h"
#include "../hidint.h"
@@ -863,7 +864,7 @@ ps_set_layer (const char *name, int group, int empty)
&& strcmp (name, "outline")
&& strcmp (name, "route"))
{
- DrawLayer (outline_layer, ®ion);
+ dapi->draw_layer (outline_layer, ®ion, NULL);
}
return 1;
commit c96e65eeb94c569e81cc940d4a10dd54e3b7ebc1
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Crasy test
diff --git a/src/Makefile.am b/src/Makefile.am
index 5abbfb2..34cd5b3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -63,6 +63,8 @@ PCB_SRCS = \
dolists.h \
draw.c \
draw.h \
+ draw_funcs.c \
+ draw_funcs.h \
drill.c \
drill.h \
edif.y \
diff --git a/src/draw.c b/src/draw.c
index 8e8821d..cc04a43 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -41,6 +41,7 @@
#include "crosshair.h"
#include "data.h"
#include "draw.h"
+#include "draw_funcs.h"
#include "error.h"
#include "mymem.h"
#include "misc.h"
@@ -85,54 +86,12 @@ static void DrawEverything (BoxTypePtr);
static void DrawPPV (int group, const BoxType *);
static int DrawLayerGroup (int, const BoxType *);
static void AddPart (void *);
-static void SetPVColor (PinTypePtr, int);
static void DrawEMark (ElementTypePtr, LocationType, LocationType, bool);
static void DrawMask (int side, BoxType *);
static void DrawPaste (int side, BoxType *);
static void DrawRats (BoxType *);
static void DrawSilk (int side, const BoxType *);
-/*--------------------------------------------------------------------------------------
- * setup color for pin or via
- */
-static void
-SetPVColor (PinTypePtr Pin, int Type)
-{
- char *color;
-
- if (Type == VIA_TYPE)
- {
- if (!doing_pinout
- && TEST_FLAG (WARNFLAG | SELECTEDFLAG | FOUNDFLAG, Pin))
- {
- if (TEST_FLAG (WARNFLAG, Pin))
- color = PCB->WarnColor;
- else if (TEST_FLAG (SELECTEDFLAG, Pin))
- color = PCB->ViaSelectedColor;
- else
- color = PCB->ConnectedColor;
- }
- else
- color = PCB->ViaColor;
- }
- else
- {
- if (!doing_pinout
- && TEST_FLAG (WARNFLAG | SELECTEDFLAG | FOUNDFLAG, Pin))
- {
- if (TEST_FLAG (WARNFLAG, Pin))
- color = PCB->WarnColor;
- else if (TEST_FLAG (SELECTEDFLAG, Pin))
- color = PCB->PinSelectedColor;
- else
- color = PCB->ConnectedColor;
- }
- else
- color = PCB->PinColor;
- }
-
- gui->set_color (Output.fgGC, color);
-}
/*---------------------------------------------------------------------------
* Adds the update rect to the update region
@@ -180,172 +139,96 @@ Redraw (void)
}
static void
-_draw_pv_name (PinType *pv)
+set_pv_color (PinType *pv, int type)
{
- BoxType box;
- bool vert;
- TextType text;
-
- 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--;
+ if (TEST_FLAG (WARNFLAG, pv)) gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pv)) gui->set_color (Output.fgGC, (type == VIA_TYPE) ? PCB->ViaSelectedColor
+ : PCB->PinSelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, pv)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, (type == VIA_TYPE) ? PCB->ViaColor
+ : PCB->PinColor);
}
static void
-_draw_pv (PinTypePtr pv, bool draw_hole)
+set_pv_inlayer_color (PinType *pv, LayerType *layer, int type)
{
- 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);
+ if (TEST_FLAG (WARNFLAG, pv)) gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pv)) gui->set_color (Output.fgGC, (type == VIA_TYPE) ? PCB->ViaSelectedColor
+ : PCB->PinSelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, pv)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
}
static int
pin_callback (const BoxType * b, void *cl)
{
- draw_pin ((PinType *)b, false);
+ set_pv_color ((PinType *)b, PIN_TYPE);
+ dapi->draw_pin ((PinType *)b, NULL, NULL);
return 1;
}
-static void
-draw_via (PinTypePtr via, bool draw_hole)
+static int
+pin_inlayer_callback (const BoxType * b, void *cl)
{
- SetPVColor (via, VIA_TYPE);
- _draw_pv (via, draw_hole);
+ set_pv_inlayer_color ((PinType *)b, cl, PIN_TYPE);
+ dapi->draw_pin ((PinType *)b, NULL, NULL);
+ return 1;
}
static int
via_callback (const BoxType * b, void *cl)
{
- draw_via ((PinType *)b, false);
+ set_pv_color ((PinType *)b, VIA_TYPE);
+ dapi->draw_via ((PinType *)b, NULL, NULL);
return 1;
}
-static void
-draw_pad_name (PadType *pad)
+static int
+via_inlayer_callback (const BoxType * b, void *cl)
{
- 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);
+ set_pv_inlayer_color ((PinType *)b, cl, VIA_TYPE);
+ dapi->draw_via ((PinType *)b, NULL, NULL);
+ return 1;
}
-static void
-_draw_pad (hidGC gc, PadType *pad, bool clear, bool mask)
+static int
+pad_callback (const BoxType * b, void *cl)
{
- 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);
+ PadTypePtr pad = (PadTypePtr) b;
+ int *side = cl;
- _draw_pad (Output.fgGC, pad, false, false);
+ if (ON_SIDE (pad, *side))
+ {
+ 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 if (TEST_FLAG (FOUNDFLAG, pad)) 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);
- if (doing_pinout || TEST_FLAG (DISPLAYNAMEFLAG, pad))
- draw_pad_name (pad);
+ dapi->draw_pad (pad, NULL, NULL);
+ }
+ return 1;
}
static int
-pad_callback (const BoxType * b, void *cl)
+pad_inlayer_callback (const BoxType * b, void *cl)
{
PadTypePtr pad = (PadTypePtr) b;
- int *side = cl;
+ LayerType *layer = cl;
+ int solder_group = GetLayerGroupNumberByNumber (solder_silk_layer);
+ int group = GetLayerGroupNumberByPointer (layer);
- if (ON_SIDE (pad, *side))
- draw_pad (pad);
+ int side = (group == solder_group) ? SOLDER_LAYER : COMPONENT_LAYER;
+
+ if (ON_SIDE (pad, side))
+ {
+ 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 if (TEST_FLAG (FOUNDFLAG, pad)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+
+ dapi->draw_pad (pad, NULL, NULL);
+ }
return 1;
}
@@ -387,12 +270,27 @@ draw_element_pins_and_pads (ElementType *element)
PAD_LOOP (element);
{
if (doing_pinout || doing_assy || FRONT (pad) || PCB->InvisibleObjectsOn)
- draw_pad (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 if (TEST_FLAG (FOUNDFLAG, pad)) 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);
+
+ dapi->draw_pad (pad, NULL, NULL);
+ }
}
END_LOOP;
PIN_LOOP (element);
{
- draw_pin (pin, true);
+ set_pv_color (pin, PIN_TYPE);
+ dapi->draw_pin (pin, NULL, NULL);
+
+ if (TEST_FLAG (WARNFLAG, pin)) gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pin)) gui->set_color (Output.fgGC, PCB->PinSelectedColor);
+ else gui->set_color (Output.fgGC, Settings.BlackColor);
+
+ dapi->draw_hole (pin, NULL, NULL);
}
END_LOOP;
}
@@ -416,35 +314,11 @@ hole_callback (const BoxType * b, void *cl)
(plated == 1 && TEST_FLAG (HOLEFLAG, pv)))
return 1;
- if (TEST_FLAG (THINDRAWFLAG, PCB))
- {
- if (!TEST_FLAG (HOLEFLAG, pv))
- {
- gui->set_line_cap (Output.fgGC, Round_Cap);
- gui->set_line_width (Output.fgGC, 0);
- gui->draw_arc (Output.fgGC,
- pv->X, pv->Y, pv->DrillingHole / 2,
- pv->DrillingHole / 2, 0, 360);
- }
- }
- else
- gui->fill_circle (Output.bgGC, pv->X, pv->Y, pv->DrillingHole / 2);
+ if (TEST_FLAG (WARNFLAG, pv)) gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pv)) gui->set_color (Output.fgGC, PCB->PinSelectedColor);
+ else gui->set_color (Output.fgGC, Settings.BlackColor);
- if (TEST_FLAG (HOLEFLAG, pv))
- {
- if (TEST_FLAG (WARNFLAG, pv))
- gui->set_color (Output.fgGC, PCB->WarnColor);
- else if (TEST_FLAG (SELECTEDFLAG, pv))
- gui->set_color (Output.fgGC, PCB->ViaSelectedColor);
- else
- gui->set_color (Output.fgGC, Settings.BlackColor);
-
- gui->set_line_cap (Output.fgGC, Round_Cap);
- gui->set_line_width (Output.fgGC, 0);
- gui->draw_arc (Output.fgGC,
- pv->X, pv->Y, pv->DrillingHole / 2,
- pv->DrillingHole / 2, 0, 360);
- }
+ dapi->draw_hole (pv, NULL, NULL);
return 1;
}
@@ -490,39 +364,17 @@ CountHoles (int *plated, int *unplated, BoxType *drawn_area)
if (unplated != NULL) *unplated = hcs.nunplated;
}
-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);
+ LayerType *layer = cl;
+ LineType *line = (LineType *)b;
+
+ if (TEST_FLAG (SELECTEDFLAG, line)) gui->set_color (Output.fgGC, layer->SelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, line)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+
+ dapi->draw_line (line, NULL, NULL);
return 1;
}
@@ -531,71 +383,25 @@ rat_callback (const BoxType * b, void *cl)
{
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 (SELECTEDFLAG, rat)) gui->set_color (Output.fgGC, PCB->RatSelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, rat)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, PCB->RatColor);
- 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
- _draw_line ((LineType *) rat);
+ dapi->draw_rat (rat, NULL, NULL);
return 1;
}
-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);
+ LayerType *layer = cl;
+ ArcType *arc = (ArcType *)b;
+
+ if (TEST_FLAG (SELECTEDFLAG, arc)) gui->set_color (Output.fgGC, layer->SelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, arc)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, layer->Color);
+
+ dapi->draw_arc (arc, NULL, NULL);
return 1;
}
@@ -615,12 +421,14 @@ draw_element_package (ElementType *element)
/* draw lines, arcs, text and pins */
ELEMENTLINE_LOOP (element);
{
- _draw_line (line);
+ //_draw_line (line);
+ dapi->draw_line (line, NULL, NULL);
}
END_LOOP;
ARC_LOOP (element);
{
- _draw_arc (arc);
+ //_draw_arc (arc);
+ dapi->draw_arc (arc, NULL, NULL);
}
END_LOOP;
}
@@ -849,13 +657,16 @@ DrawPPV (int group, const BoxType *drawn_area)
}
static int
-clearPin_callback (const BoxType * b, void *cl)
+pin_mask_callback (const BoxType * b, void *cl)
{
- PinType *pin = (PinTypePtr) b;
- if (TEST_FLAG (THINDRAWFLAG, PCB) || TEST_FLAG (THINDRAWPOLYFLAG, PCB))
- gui->thindraw_pcb_pv (Output.pmGC, Output.pmGC, pin, false, true);
- else
- gui->fill_pcb_pv (Output.pmGC, Output.pmGC, pin, false, true);
+ dapi->draw_pin_mask ((PinType *) b, NULL, NULL);
+ return 1;
+}
+
+static int
+via_mask_callback (const BoxType * b, void *cl)
+{
+ dapi->draw_via_mask ((PinType *) b, NULL, NULL);
return 1;
}
@@ -869,49 +680,22 @@ poly_callback (const BoxType * b, void *cl)
{
struct poly_info *i = cl;
PolygonType *polygon = (PolygonType *)b;
- static char *color;
-
- if (!polygon->Clipped)
- return 0;
- if (TEST_FLAG (SELECTEDFLAG, polygon))
- color = i->layer->SelectedColor;
- else if (TEST_FLAG (FOUNDFLAG, polygon))
- color = PCB->ConnectedColor;
- else
- color = i->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, 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 &&
- 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, i->drawn_area);
- }
+ if (TEST_FLAG (SELECTEDFLAG, polygon)) gui->set_color (Output.fgGC, i->layer->SelectedColor);
+ else if (TEST_FLAG (FOUNDFLAG, polygon)) gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ else gui->set_color (Output.fgGC, i->layer->Color);
+ dapi->draw_poly (polygon, i->drawn_area, NULL);
return 1;
}
static int
-clearPad_callback (const BoxType * b, void *cl)
+pad_mask_callback (const BoxType * b, void *cl)
{
PadTypePtr pad = (PadTypePtr) b;
int *side = cl;
- if (ON_SIDE (pad, *side) && pad->Mask)
- _draw_pad (Output.pmGC, pad, true, true);
+ if (ON_SIDE (pad, *side))
+ dapi->draw_pad_mask (pad, NULL, NULL);
return 1;
}
@@ -941,9 +725,9 @@ DrawSilk (int side, const BoxType * drawn_area)
}
gui->use_mask (HID_MASK_CLEAR);
- r_search (PCB->Data->pin_tree, drawn_area, NULL, clearPin_callback, NULL);
- r_search (PCB->Data->via_tree, drawn_area, NULL, clearPin_callback, NULL);
- r_search (PCB->Data->pad_tree, drawn_area, NULL, clearPad_callback, &side);
+ r_search (PCB->Data->pin_tree, drawn_area, NULL, pin_mask_callback, NULL);
+ r_search (PCB->Data->via_tree, drawn_area, NULL, via_mask_callback, NULL);
+ r_search (PCB->Data->pad_tree, drawn_area, NULL, pad_mask_callback, &side);
if (gui->poly_after)
{
@@ -991,9 +775,9 @@ DrawMask (int side, BoxType * screen)
gui->use_mask (HID_MASK_CLEAR);
}
- r_search (PCB->Data->pin_tree, screen, NULL, clearPin_callback, NULL);
- r_search (PCB->Data->via_tree, screen, NULL, clearPin_callback, NULL);
- r_search (PCB->Data->pad_tree, screen, NULL, clearPad_callback, &side);
+ r_search (PCB->Data->pin_tree, screen, NULL, pin_mask_callback, NULL);
+ r_search (PCB->Data->via_tree, screen, NULL, via_mask_callback, NULL);
+ r_search (PCB->Data->pad_tree, screen, NULL, pad_mask_callback, &side);
if (thin)
gui->set_color (Output.pmGC, "erase");
@@ -1013,13 +797,8 @@ DrawPaste (int side, BoxType *drawn_area)
gui->set_color (Output.fgGC, PCB->ElementColor);
ALLPAD_LOOP (PCB->Data);
{
- if (ON_SIDE (pad, side) && !TEST_FLAG (NOPASTEFLAG, pad) && pad->Mask > 0)
- {
- if (pad->Mask < pad->Thickness)
- _draw_pad (Output.fgGC, pad, true, true);
- else
- _draw_pad (Output.fgGC, pad, false, false);
- }
+ if (ON_SIDE (pad, side))
+ dapi->draw_pad_paste (pad, NULL, NULL);
}
ENDALL_LOOP;
}
@@ -1067,6 +846,9 @@ text_callback (const BoxType * b, void *cl)
void
DrawLayerCommon (LayerTypePtr Layer, const BoxType * screen, bool clear_pins)
{
+ int component_group = GetLayerGroupNumberByNumber (component_silk_layer);
+ int solder_group = GetLayerGroupNumberByNumber (solder_silk_layer);
+ int group = GetLayerGroupNumberByPointer (Layer);
struct poly_info info = {screen, Layer};
/* print the non-clearing polys */
@@ -1087,6 +869,55 @@ DrawLayerCommon (LayerTypePtr Layer, const BoxType * screen, bool clear_pins)
/* We should check for gui->gui here, but it's kinda cool seeing the
auto-outline magically disappear when you first add something to
the "outline" layer. */
+
+ if (strcmp (Layer->Name, "outline") == 0 ||
+ strcmp (Layer->Name, "route") == 0)
+ {
+ if (IsLayerEmpty (Layer))
+ {
+ gui->set_color (Output.fgGC, Layer->Color);
+ gui->set_line_width (Output.fgGC, PCB->minWid);
+ gui->draw_rect (Output.fgGC, 0, 0, PCB->MaxWidth, PCB->MaxHeight);
+ }
+ return;
+ }
+
+ /* draw element pins */
+ r_search (PCB->Data->pin_tree, screen, NULL, pin_inlayer_callback, Layer);
+
+ /* draw element pads */
+ if (group == component_group)
+ r_search (PCB->Data->pad_tree, screen, NULL, pad_inlayer_callback, Layer);
+
+ if (group == solder_group)
+ r_search (PCB->Data->pad_tree, screen, NULL, pad_inlayer_callback, Layer);
+
+ /* draw vias */
+ r_search (PCB->Data->via_tree, screen, NULL, via_inlayer_callback, Layer);
+ r_search (PCB->Data->pin_tree, screen, NULL, hole_callback, NULL);
+ r_search (PCB->Data->via_tree, screen, NULL, hole_callback, NULL);
+}
+
+void
+DrawLayer (LayerTypePtr Layer, const BoxType * screen)
+{
+ struct poly_info info = {screen, Layer};
+
+ /* print the non-clearing polys */
+ r_search (Layer->polygon_tree, screen, NULL, poly_callback, &info);
+
+ /* draw all visible lines this layer */
+ r_search (Layer->line_tree, screen, NULL, line_callback, Layer);
+
+ /* draw the layer arcs on screen */
+ r_search (Layer->arc_tree, screen, NULL, arc_callback, Layer);
+
+ /* draw the layer text on screen */
+ r_search (Layer->text_tree, screen, NULL, text_callback, Layer);
+
+ /* We should check for gui->gui here, but it's kinda cool seeing the
+ auto-outline magically disappear when you first add something to
+ the "outline" layer. */
if (IsLayerEmpty (Layer)
&& (strcmp (Layer->Name, "outline") == 0
|| strcmp (Layer->Name, "route") == 0))
@@ -1099,12 +930,6 @@ DrawLayerCommon (LayerTypePtr Layer, const BoxType * screen, bool clear_pins)
}
}
-void
-DrawLayer (LayerTypePtr Layer, const BoxType * screen)
-{
- DrawLayerCommon (Layer, screen, false);
-}
-
/* ---------------------------------------------------------------------------
* draws one layer group. Returns non-zero if pins and pads should be
* drawn with this group.
@@ -1195,6 +1020,20 @@ GatherPadName (PadTypePtr Pad)
return;
}
+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);
+}
+
/* ---------------------------------------------------------------------------
* lowlevel drawing routine for text objects
*/
diff --git a/src/draw_funcs.c b/src/draw_funcs.c
new file mode 100644
index 0000000..49beeba
--- /dev/null
+++ b/src/draw_funcs.c
@@ -0,0 +1,198 @@
+
+#include "global.h"
+#include "data.h"
+#include "draw_funcs.h"
+
+static void
+_draw_pv (PinType *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);
+}
+
+static void
+draw_pin (PinType *pin, const BoxType *drawn_area, void *userdata)
+{
+ _draw_pv (pin, false);
+}
+
+static void
+draw_pin_mask (PinType *pin, const BoxType *drawn_area, void *userdata)
+{
+ if (TEST_FLAG (THINDRAWFLAG, PCB) || TEST_FLAG (THINDRAWPOLYFLAG, PCB))
+ gui->thindraw_pcb_pv (Output.pmGC, Output.pmGC, pin, false, true);
+ else
+ gui->fill_pcb_pv (Output.pmGC, Output.pmGC, pin, false, true);
+}
+
+static void
+draw_via (PinType *via, const BoxType *drawn_area, void *userdata)
+{
+ _draw_pv (via, false);
+}
+
+static void
+draw_via_mask (PinType *via, const BoxType *drawn_area, void *userdata)
+{
+ if (TEST_FLAG (THINDRAWFLAG, PCB) || TEST_FLAG (THINDRAWPOLYFLAG, PCB))
+ gui->thindraw_pcb_pv (Output.pmGC, Output.pmGC, via, false, true);
+ else
+ gui->fill_pcb_pv (Output.pmGC, Output.pmGC, via, false, true);
+}
+
+static void
+draw_hole (PinType *pv, const BoxType *drawn_area, void *userdata)
+{
+ gui->set_line_cap (Output.fgGC, Round_Cap);
+ gui->set_line_width (Output.fgGC, 0);
+
+ if (!TEST_FLAG (THINDRAWFLAG, PCB))
+ gui->fill_circle (Output.bgGC, pv->X, pv->Y, pv->DrillingHole / 2);
+
+ if (TEST_FLAG (THINDRAWFLAG, PCB) || TEST_FLAG (HOLEFLAG, pv))
+ gui->draw_arc (Output.fgGC, pv->X, pv->Y,
+ pv->DrillingHole / 2, pv->DrillingHole / 2, 0, 360);
+}
+
+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, const BoxType *drawn_area, void *userdata)
+{
+ _draw_pad (Output.fgGC, pad, false, false);
+}
+
+static void
+draw_pad_mask (PadType *pad, const BoxType *drawn_area, void *userdata)
+{
+ if (pad->Mask <= 0)
+ return;
+
+ _draw_pad (Output.pmGC, pad, true, true);
+}
+
+static void
+draw_pad_paste (PadType *pad, const BoxType *drawn_area, void *userdata)
+{
+ if (TEST_FLAG (NOPASTEFLAG, pad) || pad->Mask <= 0)
+ return;
+
+ if (pad->Mask < pad->Thickness)
+ _draw_pad (Output.fgGC, pad, true, true);
+ else
+ _draw_pad (Output.fgGC, pad, false, false);
+}
+
+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 (LineType *line, const BoxType *drawn_area, void *userdata)
+{
+ _draw_line (line);
+}
+
+static void
+draw_rat (RatType *rat, const BoxType *drawn_area, void *userdata)
+{
+ 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
+ _draw_line ((LineType *) rat);
+}
+
+static void
+draw_arc (ArcType *arc, const BoxType *drawn_area, void *userdata)
+{
+ 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_poly (PolygonType *polygon, const BoxType *drawn_area, void *userdata)
+{
+ if (!polygon->Clipped)
+ return;
+
+ if (gui->thindraw_pcb_polygon != NULL &&
+ (TEST_FLAG (THINDRAWFLAG, PCB) ||
+ TEST_FLAG (THINDRAWPOLYFLAG, PCB)))
+ gui->thindraw_pcb_polygon (Output.fgGC, polygon, drawn_area);
+ else
+ gui->fill_pcb_polygon (Output.fgGC, polygon, drawn_area);
+
+ /* 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, drawn_area);
+ }
+}
+
+struct draw_funcs d_f = {
+ .draw_pin = draw_pin,
+ .draw_pin_mask = draw_pin_mask,
+ .draw_via = draw_via,
+ .draw_via_mask = draw_via_mask,
+ .draw_hole = draw_hole,
+ .draw_pad = draw_pad,
+ .draw_pad_mask = draw_pad_mask,
+ .draw_pad_paste = draw_pad_paste,
+ .draw_line = draw_line,
+ .draw_rat = draw_rat,
+ .draw_arc = draw_arc,
+ .draw_poly = draw_poly,
+};
+
+struct draw_funcs *dapi = &d_f;
diff --git a/src/draw_funcs.h b/src/draw_funcs.h
new file mode 100644
index 0000000..1f97d82
--- /dev/null
+++ b/src/draw_funcs.h
@@ -0,0 +1,16 @@
+struct draw_funcs {
+ void (*draw_pin) (PinType *, const BoxType *, void *);
+ void (*draw_pin_mask) (PinType *, const BoxType *, void *);
+ void (*draw_via) (PinType *, const BoxType *, void *);
+ void (*draw_via_mask) (PinType *, const BoxType *, void *);
+ void (*draw_hole) (PinType *, const BoxType *, void *);
+ void (*draw_pad) (PadType *, const BoxType *, void *);
+ void (*draw_pad_mask) (PadType *, const BoxType *, void *);
+ void (*draw_pad_paste) (PadType *, const BoxType *, void *);
+ void (*draw_line) (LineType *, const BoxType *, void *);
+ void (*draw_rat) (RatType *, const BoxType *, void *);
+ void (*draw_arc) (ArcType *, const BoxType *, void *);
+ void (*draw_poly) (PolygonType *, const BoxType *, void *);
+};
+
+extern struct draw_funcs *dapi;
|
|
From: <gi...@gp...> - 2011-04-26 15:37:30
|
The branch, master has been updated
via 351ebc91665795f98d0e6c6676d0c85c7e464008 (commit)
from c2e0a8593ff4a04f96fa216282b5542d957203a7 (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 | 26 ++++++++++++++------------
1 files changed, 14 insertions(+), 12 deletions(-)
=================
Commit Messages
=================
commit 351ebc91665795f98d0e6c6676d0c85c7e464008
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Remove clip_box global variable in favour of a more targeted one
Used for polygon clipping during drawing.
:100644 100644 2273d76... 8e8821d... M src/draw.c
=========
Changes
=========
commit 351ebc91665795f98d0e6c6676d0c85c7e464008
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Remove clip_box global variable in favour of a more targeted one
Used for polygon clipping during drawing.
diff --git a/src/draw.c b/src/draw.c
index 2273d76..8e8821d 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -77,7 +77,6 @@ static BoxType Block = {MAXINT, MAXINT, -MAXINT, -MAXINT};
static int doing_pinout = 0;
static bool doing_assy = false;
-static const BoxType *clip_box = NULL;
/* ---------------------------------------------------------------------------
* some local prototypes
@@ -860,10 +859,15 @@ clearPin_callback (const BoxType * b, void *cl)
return 1;
}
+struct poly_info {
+ const BoxType *drawn_area;
+ LayerType *layer;
+};
+
static int
poly_callback (const BoxType * b, void *cl)
{
- LayerType *layer = cl;
+ struct poly_info *i = cl;
PolygonType *polygon = (PolygonType *)b;
static char *color;
@@ -871,19 +875,19 @@ poly_callback (const BoxType * b, void *cl)
return 0;
if (TEST_FLAG (SELECTEDFLAG, polygon))
- color = layer->SelectedColor;
+ color = i->layer->SelectedColor;
else if (TEST_FLAG (FOUNDFLAG, polygon))
color = PCB->ConnectedColor;
else
- color = layer->Color;
+ color = i->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);
+ gui->thindraw_pcb_polygon (Output.fgGC, polygon, i->drawn_area);
else
- gui->fill_pcb_polygon (Output.fgGC, polygon, clip_box);
+ 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 &&
@@ -895,7 +899,7 @@ poly_callback (const BoxType * b, void *cl)
for (poly.Clipped = polygon->Clipped->f;
poly.Clipped != polygon->Clipped;
poly.Clipped = poly.Clipped->f)
- gui->thindraw_pcb_polygon (Output.fgGC, &poly, clip_box);
+ gui->thindraw_pcb_polygon (Output.fgGC, &poly, i->drawn_area);
}
return 1;
@@ -1063,9 +1067,10 @@ text_callback (const BoxType * b, void *cl)
void
DrawLayerCommon (LayerTypePtr Layer, const BoxType * screen, bool clear_pins)
{
+ struct poly_info info = {screen, Layer};
+
/* print the non-clearing polys */
- clip_box = screen;
- r_search (Layer->polygon_tree, screen, NULL, poly_callback, Layer);
+ r_search (Layer->polygon_tree, screen, NULL, poly_callback, &info);
if (clear_pins && TEST_FLAG (CHECKPLANESFLAG, PCB))
return;
@@ -1092,8 +1097,6 @@ DrawLayerCommon (LayerTypePtr Layer, const BoxType * screen, bool clear_pins)
0, 0,
PCB->MaxWidth, PCB->MaxHeight);
}
-
- clip_box = NULL;
}
void
@@ -1115,7 +1118,6 @@ DrawLayerGroup (int group, const BoxType *drawn_area)
int n_entries = PCB->LayerGroups.Number[group];
Cardinal *layers = PCB->LayerGroups.Entries[group];
- clip_box = drawn_area;
for (i = n_entries - 1; i >= 0; i--)
{
layernum = layers[i];
|
|
From: <gi...@gp...> - 2011-04-26 13:16:40
|
The branch, master has been updated
via c2e0a8593ff4a04f96fa216282b5542d957203a7 (commit)
from 5d39ef90df7568517bccefde13156ec794ee661e (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 | 35 ++++++++++++++++++-----------------
1 files changed, 18 insertions(+), 17 deletions(-)
=================
Commit Messages
=================
commit c2e0a8593ff4a04f96fa216282b5542d957203a7
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: EraseRat() should just gather the affected area
These were missed (or incorrectly converted) in the previous patch series
which split gathering routines from drawing routines.
Tidy up DrawRat() to be consistent with the new code in EraseRat()
:100644 100644 4a8de5f... 2273d76... M src/draw.c
=========
Changes
=========
commit c2e0a8593ff4a04f96fa216282b5542d957203a7
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: EraseRat() should just gather the affected area
These were missed (or incorrectly converted) in the previous patch series
which split gathering routines from drawing routines.
Tidy up DrawRat() to be consistent with the new code in EraseRat()
diff --git a/src/draw.c b/src/draw.c
index 4a8de5f..2273d76 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -1350,25 +1350,25 @@ DrawLine (LayerTypePtr Layer, LineTypePtr Line)
* draws a ratline
*/
void
-DrawRat (RatTypePtr Line)
+DrawRat (RatTypePtr Rat)
{
if (Settings.RatThickness < 20)
- Line->Thickness = pixel_slop * Settings.RatThickness;
+ 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, Line))
+ if (TEST_FLAG(VIAFLAG, Rat))
{
- int w = Line->Thickness;
+ int w = Rat->Thickness;
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);
+ b.X1 = Rat->Point1.X - w * 2 - w / 2;
+ b.X2 = Rat->Point1.X + w * 2 + w / 2;
+ b.Y1 = Rat->Point1.Y - w * 2 - w / 2;
+ b.Y2 = Rat->Point1.Y + w * 2 + w / 2;
+ AddPart (&b);
}
else
- DrawLine (NULL, (LineType *) Line);
+ DrawLine (NULL, (LineType *)Rat);
}
/* ---------------------------------------------------------------------------
@@ -1507,15 +1507,16 @@ EraseRat (RatTypePtr 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);
+ BoxType b;
+
+ b.X1 = Rat->Point1.X - w * 2 - w / 2;
+ b.X2 = Rat->Point1.X + w * 2 + w / 2;
+ b.Y1 = Rat->Point1.Y - w * 2 - w / 2;
+ b.Y2 = Rat->Point1.Y + w * 2 + w / 2;
+ AddPart (&b);
}
else
- _draw_line ((LineTypePtr) Rat);
+ EraseLine ((LineType *)Rat);
}
|
|
From: <gi...@gp...> - 2011-04-26 11:45:21
|
The branch, master has been updated
via 5d39ef90df7568517bccefde13156ec794ee661e (commit)
from 9d4af8a46e33e5657abb5e3f70e2f353eda5a2bf (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 | 56 +++++++++++++++++++++++++++++++++-----------------------
1 files changed, 33 insertions(+), 23 deletions(-)
=================
Commit Messages
=================
commit 5d39ef90df7568517bccefde13156ec794ee661e
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Separate out common code for drawing holes
Makes things a bit clearer
:100644 100644 d3bc398... 4a8de5f... M src/draw.c
=========
Changes
=========
commit 5d39ef90df7568517bccefde13156ec794ee661e
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Separate out common code for drawing holes
Makes things a bit clearer
diff --git a/src/draw.c b/src/draw.c
index d3bc398..4a8de5f 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -449,6 +449,18 @@ hole_callback (const BoxType * b, void *cl)
return 1;
}
+static void
+DrawHoles (bool draw_plated, bool draw_unplated, BoxType *drawn_area)
+{
+ int plated = -1;
+
+ if ( draw_plated && !draw_unplated) plated = 1;
+ if (!draw_plated && draw_unplated) plated = 0;
+
+ r_search (PCB->Data->pin_tree, drawn_area, NULL, hole_callback, &plated);
+ r_search (PCB->Data->via_tree, drawn_area, NULL, hole_callback, &plated);
+}
+
typedef struct
{
int nplated;
@@ -468,6 +480,18 @@ hole_counting_callback (const BoxType * b, void *cl)
}
static void
+CountHoles (int *plated, int *unplated, BoxType *drawn_area)
+{
+ HoleCountStruct hcs = {0, 0};
+
+ r_search (PCB->Data->pin_tree, drawn_area, NULL, hole_counting_callback, &hcs);
+ r_search (PCB->Data->via_tree, drawn_area, NULL, hole_counting_callback, &hcs);
+
+ if (plated != NULL) *plated = hcs.nplated;
+ if (unplated != NULL) *unplated = hcs.nunplated;
+}
+
+static void
_draw_line (LineType *line)
{
gui->set_line_cap (Output.fgGC, Trace_Cap);
@@ -638,12 +662,12 @@ static void
DrawEverything (BoxTypePtr drawn_area)
{
int i, ngroups, side;
- int plated;
int component, solder;
/* This is the list of layer groups we will draw. */
int do_group[MAX_LAYER];
/* This is the reverse of the order in which we draw them. */
int drawn_groups[MAX_LAYER];
+ int plated, unplated;
bool paste_empty;
PCB->Data->SILKLAYER.Color = PCB->ElementColor;
@@ -698,29 +722,15 @@ DrawEverything (BoxTypePtr drawn_area)
DrawPPV (SWAP_IDENT ? solder : component, drawn_area);
else
{
- HoleCountStruct hcs;
- hcs.nplated = hcs.nunplated = 0;
- r_search (PCB->Data->pin_tree, drawn_area, NULL, hole_counting_callback,
- &hcs);
- r_search (PCB->Data->via_tree, drawn_area, NULL, hole_counting_callback,
- &hcs);
- if (hcs.nplated && gui->set_layer ("plated-drill", SL (PDRILL, 0), 0))
- {
- plated = 1;
- r_search (PCB->Data->pin_tree, drawn_area, NULL, hole_callback,
- &plated);
- r_search (PCB->Data->via_tree, drawn_area, NULL, hole_callback,
- &plated);
- }
- if (hcs.nunplated && gui->set_layer ("unplated-drill", SL (UDRILL, 0), 0))
- {
- plated = 0;
- r_search (PCB->Data->pin_tree, drawn_area, NULL, hole_callback,
- &plated);
- r_search (PCB->Data->via_tree, drawn_area, NULL, hole_callback,
- &plated);
- }
+ CountHoles (&plated, &unplated, drawn_area);
+
+ if (plated && gui->set_layer ("plated-drill", SL (PDRILL, 0), 0))
+ DrawHoles (true, false, drawn_area);
+
+ if (unplated && gui->set_layer ("unplated-drill", SL (PDRILL, 0), 0))
+ DrawHoles (false, true, drawn_area);
}
+
/* Draw the solder mask if turned on */
if (gui->set_layer ("componentmask", SL (MASK, TOP), 0))
DrawMask (COMPONENT_LAYER, drawn_area);
|
|
From: <gi...@gp...> - 2011-04-26 00:32:53
|
The branch, master has been updated
via 9d4af8a46e33e5657abb5e3f70e2f353eda5a2bf (commit)
from 2faae748e25224686be089375c7ea4fd4e67d86d (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 | 64 ------------------------------------------------------------
1 files changed, 0 insertions(+), 64 deletions(-)
=================
Commit Messages
=================
commit 9d4af8a46e33e5657abb5e3f70e2f353eda5a2bf
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Remove Gathering variable
This variable is no longer needed since the "Gathering" Draw* functions
are separate from the draw_... implementations which are triggered
by the GUI calling for a repaint of the gathered area.
:100644 100644 e3c79e3... d3bc398... M src/draw.c
=========
Changes
=========
commit 9d4af8a46e33e5657abb5e3f70e2f353eda5a2bf
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Remove Gathering variable
This variable is no longer needed since the "Gathering" Draw* functions
are separate from the draw_... implementations which are triggered
by the GUI calling for a repaint of the gathered area.
diff --git a/src/draw.c b/src/draw.c
index e3c79e3..d3bc398 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -34,9 +34,6 @@
#include "config.h"
#endif
-#undef NDEBUG
-#include <assert.h>
-
#include "global.h"
/*#include "clip.h"*/
@@ -77,7 +74,6 @@ RCSID ("$Id$");
* some local identifiers
*/
static BoxType Block = {MAXINT, MAXINT, -MAXINT, -MAXINT};
-static bool Gathering = true;
static int doing_pinout = 0;
static bool doing_assy = false;
@@ -191,8 +187,6 @@ _draw_pv_name (PinType *pv)
bool vert;
TextType text;
- assert (!Gathering);
-
if (!pv->Name || !pv->Name[0])
text.TextString = EMPTY (pv->Number);
else
@@ -1278,8 +1272,6 @@ DrawTextLowLevel (TextTypePtr Text, int min_line_width)
void
DrawVia (PinTypePtr Via)
{
- assert (Gathering);
-
AddPart (Via);
if (!TEST_FLAG (HOLEFLAG, Via) && TEST_FLAG (DISPLAYNAMEFLAG, Via))
DrawViaName (Via);
@@ -1291,8 +1283,6 @@ DrawVia (PinTypePtr Via)
void
DrawViaName (PinTypePtr Via)
{
- assert (Gathering);
-
GatherPVName (Via);
}
@@ -1302,8 +1292,6 @@ DrawViaName (PinTypePtr Via)
void
DrawPin (PinTypePtr Pin)
{
- assert (Gathering);
-
AddPart (Pin);
if ((!TEST_FLAG (HOLEFLAG, Pin) && TEST_FLAG (DISPLAYNAMEFLAG, Pin))
|| doing_pinout)
@@ -1316,8 +1304,6 @@ DrawPin (PinTypePtr Pin)
void
DrawPinName (PinTypePtr Pin)
{
- assert (Gathering);
-
GatherPVName (Pin);
}
@@ -1327,8 +1313,6 @@ DrawPinName (PinTypePtr Pin)
void
DrawPad (PadTypePtr Pad)
{
- assert (Gathering);
-
AddPart (Pad);
if (doing_pinout || TEST_FLAG (DISPLAYNAMEFLAG, Pad))
DrawPadName (Pad);
@@ -1340,8 +1324,6 @@ DrawPad (PadTypePtr Pad)
void
DrawPadName (PadTypePtr Pad)
{
- assert (Gathering);
-
GatherPadName (Pad);
}
@@ -1351,8 +1333,6 @@ DrawPadName (PadTypePtr Pad)
void
DrawLine (LayerTypePtr Layer, LineTypePtr Line)
{
- assert (Gathering);
-
AddPart (Line);
}
@@ -1362,8 +1342,6 @@ DrawLine (LayerTypePtr Layer, LineTypePtr Line)
void
DrawRat (RatTypePtr Line)
{
- 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 */
@@ -1389,8 +1367,6 @@ DrawRat (RatTypePtr Line)
void
DrawArc (LayerTypePtr Layer, ArcTypePtr Arc)
{
- assert (Gathering);
-
AddPart (Arc);
}
@@ -1400,8 +1376,6 @@ DrawArc (LayerTypePtr Layer, ArcTypePtr Arc)
void
DrawText (LayerTypePtr Layer, TextTypePtr Text)
{
- assert (Gathering);
-
AddPart (Text);
}
@@ -1412,8 +1386,6 @@ DrawText (LayerTypePtr Layer, TextTypePtr Text)
void
DrawPolygon (LayerTypePtr Layer, PolygonTypePtr Polygon)
{
- assert (Gathering);
-
AddPart (Polygon);
}
@@ -1451,8 +1423,6 @@ thin_callback (PLINE * pl, LayerTypePtr lay, PolygonTypePtr poly)
void
DrawElement (ElementTypePtr Element)
{
- assert (Gathering);
-
DrawElementPackage (Element);
DrawElementName (Element);
DrawElementPinsAndPads (Element);
@@ -1464,8 +1434,6 @@ DrawElement (ElementTypePtr Element)
void
DrawElementName (ElementTypePtr Element)
{
- assert (Gathering);
-
if (TEST_FLAG (HIDENAMEFLAG, Element))
return;
DrawText (NULL, &ELEMENT_TEXT (PCB, Element));
@@ -1477,8 +1445,6 @@ DrawElementName (ElementTypePtr Element)
void
DrawElementPackage (ElementTypePtr Element)
{
- assert (Gathering);
-
ELEMENTLINE_LOOP (Element);
{
DrawLine (NULL, line);
@@ -1497,8 +1463,6 @@ DrawElementPackage (ElementTypePtr Element)
void
DrawElementPinsAndPads (ElementTypePtr Element)
{
- assert (Gathering);
-
PAD_LOOP (Element);
{
if (doing_pinout || doing_assy || FRONT (pad) || PCB->InvisibleObjectsOn)
@@ -1518,8 +1482,6 @@ DrawElementPinsAndPads (ElementTypePtr Element)
void
EraseVia (PinTypePtr Via)
{
- assert (Gathering);
-
AddPart (Via);
if (TEST_FLAG (DISPLAYNAMEFLAG, Via))
EraseViaName (Via);
@@ -1553,8 +1515,6 @@ EraseRat (RatTypePtr Rat)
void
EraseViaName (PinTypePtr Via)
{
- assert (Gathering);
-
GatherPVName (Via);
}
@@ -1564,8 +1524,6 @@ EraseViaName (PinTypePtr Via)
void
ErasePad (PadTypePtr Pad)
{
- assert (Gathering);
-
AddPart (Pad);
if (TEST_FLAG (DISPLAYNAMEFLAG, Pad))
ErasePadName (Pad);
@@ -1577,8 +1535,6 @@ ErasePad (PadTypePtr Pad)
void
ErasePadName (PadTypePtr Pad)
{
- assert (Gathering);
-
GatherPadName (Pad);
}
@@ -1588,8 +1544,6 @@ ErasePadName (PadTypePtr Pad)
void
ErasePin (PinTypePtr Pin)
{
- assert (Gathering);
-
AddPart (Pin);
if (TEST_FLAG (DISPLAYNAMEFLAG, Pin))
ErasePinName (Pin);
@@ -1601,8 +1555,6 @@ ErasePin (PinTypePtr Pin)
void
ErasePinName (PinTypePtr Pin)
{
- assert (Gathering);
-
GatherPVName (Pin);
}
@@ -1612,8 +1564,6 @@ ErasePinName (PinTypePtr Pin)
void
EraseLine (LineTypePtr Line)
{
- assert (Gathering);
-
AddPart (Line);
}
@@ -1623,8 +1573,6 @@ EraseLine (LineTypePtr Line)
void
EraseArc (ArcTypePtr Arc)
{
- assert (Gathering);
-
if (!Arc->Thickness)
return;
AddPart (Arc);
@@ -1636,8 +1584,6 @@ EraseArc (ArcTypePtr Arc)
void
EraseText (LayerTypePtr Layer, TextTypePtr Text)
{
- assert (Gathering);
-
AddPart (Text);
}
@@ -1647,8 +1593,6 @@ EraseText (LayerTypePtr Layer, TextTypePtr Text)
void
ErasePolygon (PolygonTypePtr Polygon)
{
- assert (Gathering);
-
AddPart (Polygon);
}
@@ -1678,8 +1622,6 @@ EraseElement (ElementTypePtr Element)
void
EraseElementPinsAndPads (ElementTypePtr Element)
{
- assert (Gathering);
-
PIN_LOOP (Element);
{
ErasePin (pin);
@@ -1698,8 +1640,6 @@ EraseElementPinsAndPads (ElementTypePtr Element)
void
EraseElementName (ElementTypePtr Element)
{
- assert (Gathering);
-
if (TEST_FLAG (HIDENAMEFLAG, Element))
return;
DrawText (NULL, &ELEMENT_TEXT (PCB, Element));
@@ -1819,8 +1759,6 @@ hid_expose_callback (HID * hid, BoxType * region, void *item)
Output.bgGC = gui->make_gc ();
Output.pmGC = gui->make_gc ();
- Gathering = false;
-
/*printf("\033[32mhid_expose_callback, s=%p %d\033[0m\n", &(SWAP_IDENT), SWAP_IDENT); */
hid->set_color (Output.pmGC, "erase");
@@ -1842,6 +1780,4 @@ hid_expose_callback (HID * hid, BoxType * region, void *item)
Output.fgGC = savefg;
Output.bgGC = savebg;
Output.pmGC = savepm;
-
- Gathering = true;
}
|
|
From: <gi...@gp...> - 2011-04-26 00:29:06
|
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Split "Gathering" routines from real drawing routines (Arcs)
:100644 100644 279108c... 2183dc9... M src/draw.c
commit 4f2631050d7980f1a9f5f30f8782ccf666a07d5d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Split "Gathering" routines from real drawing routines (Lines)
:100644 100644 b31f6fd... 279108c... M src/draw.c
commit 4d5478cb99e6aa8689722096fb537b5f957aa117
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Split "Gathering" from real drawing routines (Rats)
:100644 100644 9051686... b31f6fd... M src/draw.c
commit a626d525b3f746ed72775b4b154bdb75afaac5e8
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Split "Gathering" routines from real drawing routines (Pads)
:100644 100644 f40f06d... 9051686... M src/draw.c
commit 935ae7d3248dfea3ae962ac48893630f3829a99b
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Split "Gathering" routines from real drawing routines (Pins + Vias)
:100644 100644 b9a812e... f40f06d... M src/draw.c
commit 10bcefc32529deead4e9976b8f722d7a035765aa
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Split "Gathering" from real drawing routines (Element names)
:100644 100644 75a6c8e... d71982f... M src/draw.c
commit ec53d352153e3497a5fe3d890dd36a1d666ba121
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Split "Gathering" from real drawing routines (Element Package)
:100644 100644 2aeefc1... 75a6c8e... M src/draw.c
commit a36d6037a67fb6bd5447aa6e5b569775406268a6
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Split "Gathering" from real drawing routines (Element)
:100644 100644 7e8690f... 2aeefc1... M src/draw.c
=========
Changes
=========
commit 2faae748e25224686be089375c7ea4fd4e67d86d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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 <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
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
|
|
From: <gi...@gp...> - 2011-04-25 17:02:50
|
The branch, master has been updated
via 1a7b45893e69bddff69a7d1238127a91987a51d1 (commit)
from a6414f42162017e5962f25370e584e9164cf2949 (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 | 75 +++++++++++++++++++++++++----------------------------------
1 files changed, 32 insertions(+), 43 deletions(-)
=================
Commit Messages
=================
commit 1a7b45893e69bddff69a7d1238127a91987a51d1
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Fold DrawHole into its only caller, hole_callback
:100644 100644 09e183e... 7e8690f... M src/draw.c
=========
Changes
=========
commit 1a7b45893e69bddff69a7d1238127a91987a51d1
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Fold DrawHole into its only caller, hole_callback
diff --git a/src/draw.c b/src/draw.c
index 09e183e..7e8690f 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -97,7 +97,6 @@ static void AddPart (void *);
static void SetPVColor (PinTypePtr, int);
static void DrawEMark (ElementTypePtr, LocationType, LocationType, bool);
static void ClearPad (PadTypePtr, bool);
-static void DrawHole (PinTypePtr);
static void DrawMask (int side, BoxType *);
static void DrawPaste (int side, BoxType *);
static void DrawRats (BoxType *);
@@ -231,14 +230,42 @@ EMark_callback (const BoxType * b, void *cl)
static int
hole_callback (const BoxType * b, void *cl)
{
- PinTypePtr pin = (PinTypePtr) b;
+ PinTypePtr pv = (PinTypePtr) b;
int plated = cl ? *(int *) cl : -1;
- if ((plated == 0 && !TEST_FLAG (HOLEFLAG, pin)) ||
- (plated == 1 && TEST_FLAG (HOLEFLAG, pin)))
+ if ((plated == 0 && !TEST_FLAG (HOLEFLAG, pv)) ||
+ (plated == 1 && TEST_FLAG (HOLEFLAG, pv)))
return 1;
- DrawHole ((PinTypePtr) b);
+ if (TEST_FLAG (THINDRAWFLAG, PCB))
+ {
+ if (!TEST_FLAG (HOLEFLAG, pv))
+ {
+ gui->set_line_cap (Output.fgGC, Round_Cap);
+ gui->set_line_width (Output.fgGC, 0);
+ gui->draw_arc (Output.fgGC,
+ pv->X, pv->Y, pv->DrillingHole / 2,
+ pv->DrillingHole / 2, 0, 360);
+ }
+ }
+ else
+ gui->fill_circle (Output.bgGC, pv->X, pv->Y, pv->DrillingHole / 2);
+
+ if (TEST_FLAG (HOLEFLAG, pv))
+ {
+ if (TEST_FLAG (WARNFLAG, pv))
+ gui->set_color (Output.fgGC, PCB->WarnColor);
+ else if (TEST_FLAG (SELECTEDFLAG, pv))
+ gui->set_color (Output.fgGC, PCB->ViaSelectedColor);
+ else
+ gui->set_color (Output.fgGC, Settings.BlackColor);
+
+ gui->set_line_cap (Output.fgGC, Round_Cap);
+ gui->set_line_width (Output.fgGC, 0);
+ gui->draw_arc (Output.fgGC,
+ pv->X, pv->Y, pv->DrillingHole / 2,
+ pv->DrillingHole / 2, 0, 360);
+ }
return 1;
}
@@ -796,44 +823,6 @@ DrawPinOrViaLowLevel (PinTypePtr pv, bool drawHole)
gui->fill_pcb_pv (Output.fgGC, Output.bgGC, pv, drawHole, false);
}
-/**************************************************************
- * draw pin/via hole
- */
-static void
-DrawHole (PinTypePtr Ptr)
-{
- if (TEST_FLAG (THINDRAWFLAG, PCB))
- {
- if (!TEST_FLAG (HOLEFLAG, Ptr))
- {
- gui->set_line_cap (Output.fgGC, Round_Cap);
- gui->set_line_width (Output.fgGC, 0);
- gui->draw_arc (Output.fgGC,
- Ptr->X, Ptr->Y, Ptr->DrillingHole / 2,
- Ptr->DrillingHole / 2, 0, 360);
- }
- }
- else
- {
- gui->fill_circle (Output.bgGC, Ptr->X, Ptr->Y, Ptr->DrillingHole / 2);
- }
- if (TEST_FLAG (HOLEFLAG, Ptr))
- {
- if (TEST_FLAG (WARNFLAG, Ptr))
- gui->set_color (Output.fgGC, PCB->WarnColor);
- else if (TEST_FLAG (SELECTEDFLAG, Ptr))
- gui->set_color (Output.fgGC, PCB->ViaSelectedColor);
- else
- gui->set_color (Output.fgGC, Settings.BlackColor);
-
- gui->set_line_cap (Output.fgGC, Round_Cap);
- gui->set_line_width (Output.fgGC, 0);
- gui->draw_arc (Output.fgGC,
- Ptr->X, Ptr->Y, Ptr->DrillingHole / 2,
- Ptr->DrillingHole / 2, 0, 360);
- }
-}
-
/* ---------------------------------------------------------------------------
* lowlevel drawing routine for pin and via names
*/
|
|
From: <gi...@gp...> - 2011-04-25 15:11:28
|
The branch, master has been updated
via a6414f42162017e5962f25370e584e9164cf2949 (commit)
from a3d422a89dd7aa2f6298cc8c284896284a029838 (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 | 39 +++++++++------------------------------
1 files changed, 9 insertions(+), 30 deletions(-)
=================
Commit Messages
=================
commit a6414f42162017e5962f25370e584e9164cf2949
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Move DrawPlainPin and DrawPlainVia into their only callers
Make their code part of pin_callback and via_callback.
Drop the Gathering tests within this code, as their only callers are
within a block where Gathering is definately set.
:100644 100644 8b73644... 09e183e... M src/draw.c
=========
Changes
=========
commit a6414f42162017e5962f25370e584e9164cf2949
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Move DrawPlainPin and DrawPlainVia into their only callers
Make their code part of pin_callback and via_callback.
Drop the Gathering tests within this code, as their only callers are
within a block where Gathering is definately set.
diff --git a/src/draw.c b/src/draw.c
index 8b73644..09e183e 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -84,8 +84,6 @@ static void DrawEverything (BoxTypePtr);
static void DrawPPV (int group, const BoxType *);
static int DrawLayerGroup (int, const BoxType *);
static void DrawPinOrViaLowLevel (PinTypePtr, bool);
-static void DrawPlainPin (PinTypePtr, bool);
-static void DrawPlainVia (PinTypePtr, bool);
static void DrawPinOrViaNameLowLevel (PinTypePtr);
static void DrawPadLowLevel (hidGC, PadTypePtr, bool, bool);
static void DrawPadNameLowLevel (PadTypePtr);
@@ -460,14 +458,21 @@ static int
via_callback (const BoxType * b, void *cl)
{
PinTypePtr via = (PinTypePtr) b;
- DrawPlainVia (via, false);
+ 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)
{
- DrawPlainPin ((PinTypePtr) b, false);
+ PinTypePtr pin = (PinTypePtr) b;
+ SetPVColor (pin, PIN_TYPE);
+ DrawPinOrViaLowLevel (pin, false);
+ if (!TEST_FLAG (HOLEFLAG, pin) && TEST_FLAG (DISPLAYNAMEFLAG, pin))
+ DrawPinOrViaNameLowLevel (pin);
return 1;
}
@@ -1180,19 +1185,6 @@ DrawVia (PinTypePtr Via)
}
/* ---------------------------------------------------------------------------
- * draw a via without dealing with polygon clearance
- */
-static void
-DrawPlainVia (PinTypePtr Via, bool holeToo)
-{
- if (!Gathering)
- SetPVColor (Via, VIA_TYPE);
- DrawPinOrViaLowLevel (Via, holeToo);
- if (!TEST_FLAG (HOLEFLAG, Via) && TEST_FLAG (DISPLAYNAMEFLAG, Via))
- DrawPinOrViaNameLowLevel (Via);
-}
-
-/* ---------------------------------------------------------------------------
* draws the name of a via
*/
void
@@ -1225,19 +1217,6 @@ DrawPin (PinTypePtr Pin)
}
/* ---------------------------------------------------------------------------
- * draw a pin without clearing around polygons
- */
-static void
-DrawPlainPin (PinTypePtr Pin, bool holeToo)
-{
- if (!Gathering)
- SetPVColor (Pin, PIN_TYPE);
- DrawPinOrViaLowLevel (Pin, holeToo);
- if (!TEST_FLAG (HOLEFLAG, Pin) && TEST_FLAG (DISPLAYNAMEFLAG, Pin))
- DrawPinOrViaNameLowLevel (Pin);
-}
-
-/* ---------------------------------------------------------------------------
* draws the name of a pin
*/
void
|