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-01-14 17:25:16
|
The branch, master has been updated
via 60bb0194d14f804b1c752b98c681b461683d6b3a (commit)
from 1c2237d88352e85ef1577580d519c5e3ee9dd715 (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
=========
configure.ac | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
=================
Commit Messages
=================
commit 60bb0194d14f804b1c752b98c681b461683d6b3a
Author: Jared Casper <jar...@gm...>
Commit: Peter Clifton <pc...@ca...>
Heed and remove warning issued by autoconf 2.68.
Starting in autoconf 2.68, "the macros AC_PREPROC_IFELSE,
AC_COMPILE_IFELSE, AC_LINK_IFELSE, and AC_RUN_IFELSE now warn if the
first argument failed to use AC_LANG_SOURCE or AC_LANG_PROGRAM to
generate the conftest file contents."
Closes-bug: lp-700180
Reviewed-by: Peter Clifton <pc...@ca...>
:100644 100644 13e0e07... ca2dbe4... M configure.ac
=========
Changes
=========
commit 60bb0194d14f804b1c752b98c681b461683d6b3a
Author: Jared Casper <jar...@gm...>
Commit: Peter Clifton <pc...@ca...>
Heed and remove warning issued by autoconf 2.68.
Starting in autoconf 2.68, "the macros AC_PREPROC_IFELSE,
AC_COMPILE_IFELSE, AC_LINK_IFELSE, and AC_RUN_IFELSE now warn if the
first argument failed to use AC_LANG_SOURCE or AC_LANG_PROGRAM to
generate the conftest file contents."
Closes-bug: lp-700180
Reviewed-by: Peter Clifton <pc...@ca...>
diff --git a/configure.ac b/configure.ac
index 13e0e07..ca2dbe4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -264,7 +264,7 @@ if test "x$GCC" = "xyes"; then
AC_MSG_CHECKING([If the compiler accepts -rdynamic])
old_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -rdynamic"
-AC_LINK_IFELSE([int main(){}],
+AC_LINK_IFELSE([AC_LANG_PROGRAM()],
[AC_MSG_RESULT([yes])],
[LDFLAGS="$old_LDFLAGS"
AC_MSG_RESULT([no])
|
|
From: <gi...@gp...> - 2011-01-12 19:20:14
|
The branch, master has been updated
via 1c2237d88352e85ef1577580d519c5e3ee9dd715 (commit)
from a04f34e9532979b00a141e7adebdc6ae073e4831 (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-output-events.c | 42 ++++++--------------------------------
1 files changed, 7 insertions(+), 35 deletions(-)
=================
Commit Messages
=================
commit 1c2237d88352e85ef1577580d519c5e3ee9dd715
Author: Ineiev <in...@us...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Fix disappearing reference mark
Fixes the following symptoms (Bug sf-1882970 reported
by Steven Michalske):
(0) when the cursor leaves the window,
the mark disappears (with attached objects);
when the cursor enters again, the mark
is redrawn only if there are any attached objects;
(1) When there are no attached objects,
the mark disappears on button press, but is not
redrawn again when button press and release form
a click.
(Commit message edited by Peter Clifton <pc...@ca...>)
Reviewed-by: Peter Clifton <pc...@ca...>
Closes-bug: lp-699244
Closes-bug: lp-699453
:100644 100644 f55cabc... 2e820a3... M src/hid/gtk/gui-output-events.c
=========
Changes
=========
commit 1c2237d88352e85ef1577580d519c5e3ee9dd715
Author: Ineiev <in...@us...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Fix disappearing reference mark
Fixes the following symptoms (Bug sf-1882970 reported
by Steven Michalske):
(0) when the cursor leaves the window,
the mark disappears (with attached objects);
when the cursor enters again, the mark
is redrawn only if there are any attached objects;
(1) When there are no attached objects,
the mark disappears on button press, but is not
redrawn again when button press and release form
a click.
(Commit message edited by Peter Clifton <pc...@ca...>)
Reviewed-by: Peter Clifton <pc...@ca...>
Closes-bug: lp-699244
Closes-bug: lp-699453
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index f55cabc..2e820a3 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/*
* COPYRIGHT
*
@@ -54,14 +52,7 @@
#define TOOLTIP_UPDATE_DELAY 200
-RCSID ("$Id$");
-
static gint x_pan_speed, y_pan_speed;
-
-/* Set to true if cursor is currently in viewport. This is a hack to prevent
- * Crosshair stack corruption due to unmatching window enter / leave events */
-gboolean cursor_in_viewport = false;
-
void
ghid_port_ranges_changed (void)
{
@@ -453,7 +444,6 @@ ghid_port_button_press_cb (GtkWidget * drawing_area,
GdkEventButton * ev, GtkUIManager * ui)
{
ModifierKeysState mk;
- gboolean drag;
GdkModifierType state;
/* Reject double and triple click events */
@@ -464,7 +454,6 @@ ghid_port_button_press_cb (GtkWidget * drawing_area,
mk = ghid_modifier_keys_state (&state);
ghid_show_crosshair (FALSE);
HideCrosshair (TRUE);
- drag = have_crosshair_attachments ();
do_mouse_action(ev->button, mk);
@@ -484,26 +473,21 @@ ghid_port_button_release_cb (GtkWidget * drawing_area,
GdkEventButton * ev, GtkUIManager * ui)
{
ModifierKeysState mk;
- gboolean drag;
GdkModifierType state;
ghid_note_event_location (ev);
state = (GdkModifierType) (ev->state);
mk = ghid_modifier_keys_state (&state);
- drag = have_crosshair_attachments ();
- if (drag)
- HideCrosshair (TRUE);
+ HideCrosshair (TRUE);
do_mouse_action(ev->button, mk + M_Release);
- if (drag)
- {
- AdjustAttachedObjects ();
- ghid_invalidate_all ();
- RestoreCrosshair (TRUE);
- ghid_screen_update ();
- }
+ AdjustAttachedObjects ();
+ ghid_invalidate_all ();
+ RestoreCrosshair (TRUE);
+ ghid_screen_update ();
+
ghid_window_set_name_label (PCB->Name);
ghid_set_status_line_label ();
g_idle_add (ghid_idle_cb, NULL);
@@ -767,13 +751,7 @@ ghid_port_window_enter_cb (GtkWidget * widget,
{
ghid_screen_update ();
}
-
- if(! cursor_in_viewport)
- {
- RestoreCrosshair (TRUE);
- cursor_in_viewport = TRUE;
- }
-
+ CrosshairOn (TRUE);
return FALSE;
}
@@ -865,12 +843,6 @@ ghid_port_window_leave_cb (GtkWidget * widget,
}
}
- if(cursor_in_viewport)
- {
- HideCrosshair (TRUE);
- cursor_in_viewport = FALSE;
- }
-
ghid_show_crosshair (FALSE);
out->has_entered = FALSE;
|
|
From: <gi...@gp...> - 2011-01-11 21:19:45
|
The branch, master has been updated
via a04f34e9532979b00a141e7adebdc6ae073e4831 (commit)
from b1626728f9d65f16208cde500fd76046169869df (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/lpr/lpr.c | 1 -
src/hid/ps/ps.c | 21 ++++++++++++++++++---
2 files changed, 18 insertions(+), 4 deletions(-)
=================
Commit Messages
=================
commit a04f34e9532979b00a141e7adebdc6ae073e4831
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Fix postscript page scaling
Calculate page sizes *after* selecting the page, not before.
:100644 100644 ac3e2db... a79af0a... M src/hid/lpr/lpr.c
:100644 100644 814e23e... eacf826... M src/hid/ps/ps.c
=========
Changes
=========
commit a04f34e9532979b00a141e7adebdc6ae073e4831
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Fix postscript page scaling
Calculate page sizes *after* selecting the page, not before.
diff --git a/src/hid/lpr/lpr.c b/src/hid/lpr/lpr.c
index ac3e2db..a79af0a 100644
--- a/src/hid/lpr/lpr.c
+++ b/src/hid/lpr/lpr.c
@@ -92,7 +92,6 @@ lpr_do_export (HID_Attr_Val * options)
return;
}
- ps_start_file (f);
ps_hid_export_to_file (f, options);
fclose (f);
diff --git a/src/hid/ps/ps.c b/src/hid/ps/ps.c
index 814e23e..eacf826 100644
--- a/src/hid/ps/ps.c
+++ b/src/hid/ps/ps.c
@@ -339,6 +339,21 @@ ps_start_file (FILE *f)
*/
fprintf (f, "%%%%Pages: (atend)\n" );
+ /*
+ * %%DocumentMedia: <name> <width> <height> <weight> <color> <type>
+ *
+ * Substitute 0 or "" for N/A. Width and height are in points
+ * (1/72").
+ *
+ * Media sizes are in PCB units
+ */
+ 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);
+ fprintf (f, "%%%%DocumentPaperSizes: %s\n",
+ media_data[media].name);
+
/* End General Header Comments. */
/* General Body Comments go here. Currently there are none. */
@@ -446,6 +461,9 @@ ps_hid_export_to_file (FILE * the_file, HID_Attr_Val * options)
drillcopper = options[HA_drillcopper].int_value;
legend = options[HA_legend].int_value;
+ if (f)
+ ps_start_file (f);
+
if (fade_ratio < 0)
fade_ratio = 0;
if (fade_ratio > 1)
@@ -488,7 +506,6 @@ ps_hid_export_to_file (FILE * the_file, HID_Attr_Val * options)
if (strcmp (layer->Name, "outline") == 0 ||
strcmp (layer->Name, "route") == 0)
{
- printf("see outline layer\n");
outline_layer = layer;
}
}
@@ -568,7 +585,6 @@ ps_do_export (HID_Attr_Val * options)
perror (filename);
return;
}
- ps_start_file (f);
}
hid_save_and_show_layer_ons (save_ons);
@@ -850,7 +866,6 @@ ps_set_layer (const char *name, int group, int empty)
&& strcmp (name, "outline")
&& strcmp (name, "route"))
{
- printf("attempting to draw outlines on %s\n", name);
DrawLayer (outline_layer, ®ion);
}
|
|
From: <gi...@gp...> - 2011-01-10 07:12:51
|
The branch, master has been updated
via b1626728f9d65f16208cde500fd76046169869df (commit)
via 565c250349a949d9cd42ec99e11be653321c6342 (commit)
from 8f3fcd5ba0c4f26aae49fca59fa128141388b265 (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/file.c | 10 ++++--
src/misc.c | 108 +++++++++++++++++++++++++++++++++++++++++-------------------
2 files changed, 81 insertions(+), 37 deletions(-)
=================
Commit Messages
=================
commit b1626728f9d65f16208cde500fd76046169869df
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Calculate text bounding boxes based on that actual drawn glyphs.
Previously, a text's bounding box was calculated based on overall
font metrics, not the actual glyphs. This meant that text clearing
a polygon would have far more space around it than called for.
:100644 100644 2e471d0... e1e14c8... M src/misc.c
commit 565c250349a949d9cd42ec99e11be653321c6342
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Make new PCB active during parsing
Set the global PCB pointer to the "new" pcb while it's being loaded.
Some of the creation functions use the DRC values in PCB to compute,
for example, bounding boxes. Before, it used whatever was hanging
around in the previous PCB (or the default values).
:100644 100644 4e4d55d... 9e38217... M src/file.c
=========
Changes
=========
commit b1626728f9d65f16208cde500fd76046169869df
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Calculate text bounding boxes based on that actual drawn glyphs.
Previously, a text's bounding box was calculated based on overall
font metrics, not the actual glyphs. This meant that text clearing
a polygon would have far more space around it than called for.
diff --git a/src/misc.c b/src/misc.c
index 2e471d0..e1e14c8 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -427,58 +427,98 @@ SetTextBoundingBox (FontTypePtr FontPtr, TextTypePtr Text)
{
SymbolTypePtr symbol = FontPtr->Symbol;
unsigned char *s = (unsigned char *) Text->TextString;
- LocationType width = 0, height = 0;
- BDimension maxThick = 0;
+ BDimension minThick = 0;
int i;
+ int space = 0;
+
+ LocationType minx=0, miny=0, maxx=0, maxy=0;
+ LocationType tx;
+ int first_time = 1;
+
+ if (PCB->minSlk < PCB->minWid)
+ minThick = PCB->minWid;
+ else
+ minThick = PCB->minSlk;
+
+ minThick /= Text->Scale / 50.0;
+
+ tx = 0;
/* calculate size of the bounding box */
for (; s && *s; s++)
- if (*s <= MAX_FONTPOSITION && symbol[*s].Valid)
- {
- LineTypePtr line = symbol[*s].Line;
- for (i = 0; i < symbol[*s].LineN; line++, i++)
- if (line->Thickness > maxThick)
- maxThick = line->Thickness;
- width += symbol[*s].Width + symbol[*s].Delta;
- height = MAX (height, (LocationType) symbol[*s].Height);
- }
- else
- {
- width +=
- ((FontPtr->DefaultSymbol.X2 - FontPtr->DefaultSymbol.X1) * 6 / 5);
- height = (FontPtr->DefaultSymbol.Y2 - FontPtr->DefaultSymbol.Y1);
- }
+ {
+ if (*s <= MAX_FONTPOSITION && symbol[*s].Valid)
+ {
+ LineTypePtr line = symbol[*s].Line;
+ for (i = 0; i < symbol[*s].LineN; line++, i++)
+ {
+ int t = line->Thickness / 4;
+ if (t < minThick)
+ t = minThick;
+
+ if (first_time)
+ {
+ minx = maxx = line->Point1.X;
+ miny = maxy = line->Point1.Y;
+ first_time = 0;
+ }
+
+ minx = MIN (minx, line->Point1.X - t + tx);
+ miny = MIN (miny, line->Point1.Y - t);
+ minx = MIN (minx, line->Point2.X - t + tx);
+ miny = MIN (miny, line->Point2.Y - t);
+ maxx = MAX (maxx, line->Point1.X + t + tx);
+ maxy = MAX (maxy, line->Point1.Y + t);
+ maxx = MAX (maxx, line->Point2.X + t + tx);
+ maxy = MAX (maxy, line->Point2.Y + t);
+ }
+ space = symbol[*s].Delta;
+ }
+ else
+ {
+ BoxType *ds = &FontPtr->DefaultSymbol;
+ int w = ds->X2 - ds->X1;
+
+ minx = MIN (minx, ds->X1 + tx);
+ miny = MIN (miny, ds->Y1);
+ minx = MIN (minx, ds->X2 + tx);
+ miny = MIN (miny, ds->Y2);
+ maxx = MAX (maxx, ds->X1 + tx);
+ maxy = MAX (maxy, ds->Y1);
+ maxx = MAX (maxx, ds->X2 + tx);
+ maxy = MAX (maxy, ds->Y2);
+
+ space = w / 5;
+ }
+ tx += symbol[*s].Width + space;
+ }
/* scale values */
- width *= Text->Scale / 100.;
- height *= Text->Scale / 100.;
- maxThick *= Text->Scale / 200.;
- if (maxThick < 400)
- maxThick = 400;
+ minx *= Text->Scale / 100.;
+ miny *= Text->Scale / 100.;
+ maxx *= Text->Scale / 100.;
+ maxy *= Text->Scale / 100.;
/* set upper-left and lower-right corner;
* swap coordinates if necessary (origin is already in 'swapped')
* and rotate box
*/
- Text->BoundingBox.X1 = Text->X;
- Text->BoundingBox.Y1 = Text->Y;
+
if (TEST_FLAG (ONSOLDERFLAG, Text))
{
- Text->BoundingBox.X1 -= maxThick;
- Text->BoundingBox.Y1 -= SWAP_SIGN_Y (maxThick);
- Text->BoundingBox.X2 =
- Text->BoundingBox.X1 + SWAP_SIGN_X (width + maxThick);
- Text->BoundingBox.Y2 =
- Text->BoundingBox.Y1 + SWAP_SIGN_Y (height + 2 * maxThick);
+ Text->BoundingBox.X1 = Text->X + minx;
+ Text->BoundingBox.Y1 = Text->Y - miny;
+ Text->BoundingBox.X2 = Text->X + maxx;
+ Text->BoundingBox.Y2 = Text->Y - maxy;
RotateBoxLowLevel (&Text->BoundingBox, Text->X, Text->Y,
(4 - Text->Direction) & 0x03);
}
else
{
- Text->BoundingBox.X1 -= maxThick;
- Text->BoundingBox.Y1 -= maxThick;
- Text->BoundingBox.X2 = Text->BoundingBox.X1 + width + maxThick;
- Text->BoundingBox.Y2 = Text->BoundingBox.Y1 + height + 2 * maxThick;
+ Text->BoundingBox.X1 = Text->X + minx;
+ Text->BoundingBox.Y1 = Text->Y + miny;
+ Text->BoundingBox.X2 = Text->X + maxx;
+ Text->BoundingBox.Y2 = Text->Y + maxy;
RotateBoxLowLevel (&Text->BoundingBox,
Text->X, Text->Y, Text->Direction);
}
commit 565c250349a949d9cd42ec99e11be653321c6342
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Make new PCB active during parsing
Set the global PCB pointer to the "new" pcb while it's being loaded.
Some of the creation functions use the DRC values in PCB to compute,
for example, bounding boxes. Before, it used whatever was hanging
around in the previous PCB (or the default values).
diff --git a/src/file.c b/src/file.c
index 4e4d55d..9e38217 100644
--- a/src/file.c
+++ b/src/file.c
@@ -351,6 +351,7 @@ int
LoadPCB (char *Filename)
{
PCBTypePtr newPCB = CreateNewPCB (false);
+ PCBTypePtr oldPCB;
bool units_mm;
#ifdef DEBUG
double elapsed;
@@ -359,11 +360,13 @@ LoadPCB (char *Filename)
start = clock ();
#endif
+ oldPCB = PCB;
+ PCB = newPCB;
+
/* new data isn't added to the undo list */
- if (!ParsePCB (newPCB, Filename))
+ if (!ParsePCB (PCB, Filename))
{
- RemovePCB (PCB);
- PCB = newPCB;
+ RemovePCB (oldPCB);
CreateNewPCBPost (PCB, 0);
ResetStackAndVisibility ();
@@ -412,6 +415,7 @@ LoadPCB (char *Filename)
return (0);
}
+ PCB = oldPCB;
hid_action ("PCBChanged");
/* release unused memory */
|
|
From: <gi...@gp...> - 2011-01-08 03:40:14
|
The branch, master has been updated
via c9e069b19455c6e20b7988b86a4736f6ea0b1bc0 (commit)
from e97a3932e65e936d87f2eb59e3453a9ff4976501 (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/buffer.c | 152 +++++++++++++++++++++++++++++----------------------------
1 files changed, 77 insertions(+), 75 deletions(-)
=================
Commit Messages
=================
commit c9e069b19455c6e20b7988b86a4736f6ea0b1bc0
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Support far-side polygons when converting buffer to element.
:100644 100644 4447c30... 4442bbb... M src/buffer.c
=========
Changes
=========
commit c9e069b19455c6e20b7988b86a4736f6ea0b1bc0
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Support far-side polygons when converting buffer to element.
diff --git a/src/buffer.c b/src/buffer.c
index 4447c30..4442bbb 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1047,6 +1047,8 @@ ConvertBufferToElement (BufferTypePtr Buffer)
Cardinal group;
Cardinal pin_n = 1;
bool hasParts = false, crooked = false;
+ int onsolder;
+ bool warned = false;
if (Buffer->Data->pcb == 0)
Buffer->Data->pcb = PCB;
@@ -1081,85 +1083,85 @@ ConvertBufferToElement (BufferTypePtr Buffer)
hasParts = true;
}
END_LOOP;
- /* get the component-side SM pads */
- group = GetLayerGroupNumberByNumber (SWAP_IDENT ? solder_silk_layer :
- component_silk_layer);
- GROUP_LOOP (Buffer->Data, group);
- {
- char num[8];
- LINE_LOOP (layer);
- {
- sprintf (num, "%d", pin_n++);
- CreateNewPad (Element, line->Point1.X,
- line->Point1.Y, line->Point2.X,
- line->Point2.Y, line->Thickness,
- line->Clearance,
- line->Thickness + line->Clearance, NULL,
- line->Number ? line->Number : num,
- MakeFlags (SWAP_IDENT ? ONSOLDERFLAG : NOFLAG));
- hasParts = true;
- }
- END_LOOP;
- POLYGON_LOOP (layer);
- {
- int x1, y1, x2, y2, w, h, t;
-
- if (! polygon_is_rectangle (polygon))
- {
- crooked = true;
- continue;
- }
-
- w = polygon->Points[2].X - polygon->Points[0].X;
- h = polygon->Points[1].Y - polygon->Points[0].Y;
- t = (w < h) ? w : h;
- x1 = polygon->Points[0].X + t/2;
- y1 = polygon->Points[0].Y + t/2;
- x2 = x1 + (w-t);
- y2 = y1 + (h-t);
-
- sprintf (num, "%d", pin_n++);
- CreateNewPad (Element,
- x1, y1, x2, y2, t,
- 2 * Settings.Keepaway,
- t + Settings.Keepaway,
- NULL, num,
- MakeFlags (SQUAREFLAG | (SWAP_IDENT ? ONSOLDERFLAG : NOFLAG)));
- hasParts = true;
- }
- END_LOOP;
- }
- END_LOOP;
- /* now get the opposite side pads */
- group = GetLayerGroupNumberByNumber (SWAP_IDENT ? component_silk_layer :
- solder_silk_layer);
- GROUP_LOOP (Buffer->Data, group);
- {
- bool warned = false;
- char num[8];
- LINE_LOOP (layer);
+
+ for (onsolder = 0; onsolder < 2; onsolder ++)
{
- sprintf (num, "%d", pin_n++);
- CreateNewPad (Element, line->Point1.X,
- line->Point1.Y, line->Point2.X,
- line->Point2.Y, line->Thickness,
- line->Clearance,
- line->Thickness + line->Clearance, NULL,
- line->Number ? line->Number : num,
- MakeFlags (SWAP_IDENT ? NOFLAG : ONSOLDERFLAG));
- if (!hasParts && !warned)
+ int silk_layer;
+ int onsolderflag;
+
+ if ((!onsolder) == (!SWAP_IDENT))
+ {
+ silk_layer = component_silk_layer;
+ onsolderflag = NOFLAG;
+ }
+ else
{
- warned = true;
- Message
- (_("Warning: All of the pads are on the opposite\n"
- "side from the component - that's probably not what\n"
- "you wanted\n"));
+ silk_layer = solder_silk_layer;
+ onsolderflag = ONSOLDERFLAG;
}
- hasParts = true;
+
+#define MAYBE_WARN() \
+ if (onsolder && !hasParts && !warned) \
+ { \
+ warned = true; \
+ Message \
+ (_("Warning: All of the pads are on the opposite\n" \
+ "side from the component - that's probably not what\n" \
+ "you wanted\n")); \
+ } \
+
+ /* get the component-side SM pads */
+ group = GetLayerGroupNumberByNumber (silk_layer);
+ GROUP_LOOP (Buffer->Data, group);
+ {
+ char num[8];
+ LINE_LOOP (layer);
+ {
+ sprintf (num, "%d", pin_n++);
+ CreateNewPad (Element, line->Point1.X,
+ line->Point1.Y, line->Point2.X,
+ line->Point2.Y, line->Thickness,
+ line->Clearance,
+ line->Thickness + line->Clearance, NULL,
+ line->Number ? line->Number : num,
+ MakeFlags (onsolderflag));
+ MAYBE_WARN();
+ hasParts = true;
+ }
+ END_LOOP;
+ POLYGON_LOOP (layer);
+ {
+ int x1, y1, x2, y2, w, h, t;
+
+ if (! polygon_is_rectangle (polygon))
+ {
+ crooked = true;
+ continue;
+ }
+
+ w = polygon->Points[2].X - polygon->Points[0].X;
+ h = polygon->Points[1].Y - polygon->Points[0].Y;
+ t = (w < h) ? w : h;
+ x1 = polygon->Points[0].X + t/2;
+ y1 = polygon->Points[0].Y + t/2;
+ x2 = x1 + (w-t);
+ y2 = y1 + (h-t);
+
+ sprintf (num, "%d", pin_n++);
+ CreateNewPad (Element,
+ x1, y1, x2, y2, t,
+ 2 * Settings.Keepaway,
+ t + Settings.Keepaway,
+ NULL, num,
+ MakeFlags (SQUAREFLAG | onsolderflag));
+ MAYBE_WARN();
+ hasParts = true;
+ }
+ END_LOOP;
+ }
+ END_LOOP;
}
- END_LOOP;
- }
- END_LOOP;
+
/* now add the silkscreen. NOTE: elements must have pads or pins too */
LINE_LOOP (&Buffer->Data->SILKLAYER);
{
|
|
From: <gi...@gp...> - 2011-01-08 00:51:27
|
The branch, master has been updated
via e97a3932e65e936d87f2eb59e3453a9ff4976501 (commit)
from c0ec7462facd046414734ebd0a65917f67ddcf74 (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 | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
=================
Commit Messages
=================
commit e97a3932e65e936d87f2eb59e3453a9ff4976501
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Fix command-injection bug in Import()
Use "--" before the list of schematics, to prevent the src list
from containing other gnetlist options (or arbitrary guile code)
:100644 100644 d8e631f... 5acd3fd... M src/action.c
=========
Changes
=========
commit e97a3932e65e936d87f2eb59e3453a9ff4976501
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Fix command-injection bug in Import()
Use "--" before the list of schematics, to prevent the src list
from containing other gnetlist options (or arbitrary guile code)
diff --git a/src/action.c b/src/action.c
index d8e631f..5acd3fd 100644
--- a/src/action.c
+++ b/src/action.c
@@ -7782,20 +7782,21 @@ ActionImport (int argc, char **argv, int x, int y)
return 1;
}
- cmd = (char **) malloc ((6 + nsources) * sizeof (char *));
+ cmd = (char **) malloc ((7 + nsources) * sizeof (char *));
cmd[0] = Settings.GnetlistProgram;
cmd[1] = "-g";
cmd[2] = "pcbfwd";
cmd[3] = "-o";
cmd[4] = tmpfile;
+ cmd[5] = "--";
for (i=0; i<nsources; i++)
- cmd[5+i] = sources[i];
- cmd[5+nsources] = NULL;
+ cmd[6+i] = sources[i];
+ cmd[6+nsources] = NULL;
#ifdef DEBUG
printf("ActionImport: =========== About to run gnetlist ============\n");
- printf("%s %s %s %s %s %s ...\n",
- cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5]);
+ printf("%s %s %s %s %s %s %s ...\n",
+ cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6]);
#endif
if (pcb_spawnvp (cmd))
|
|
From: <gi...@gp...> - 2011-01-08 00:10:09
|
The branch, master has been updated
via c0ec7462facd046414734ebd0a65917f67ddcf74 (commit)
from ab1c8c4d4ec61d85083d61668042526a878fcddc (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-top-window.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
=================
Commit Messages
=================
commit c0ec7462facd046414734ebd0a65917f67ddcf74
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Fix prelight state for layer button to show current status
One of the ways we identify whether a layer is switched on or off is
by changing the background colour of the GtkToggleButton representing
that layer.
Fix the prelight (mouse-over) background style to match the current
button state, so as to give immediate feed-back when the user presses
the button, and make the interface less confusing.
Closes-bug: lp-699150
:100644 100644 b4c8c42... f2cdb99... M src/hid/gtk/gui-top-window.c
=========
Changes
=========
commit c0ec7462facd046414734ebd0a65917f67ddcf74
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Fix prelight state for layer button to show current status
One of the ways we identify whether a layer is switched on or off is
by changing the background colour of the GtkToggleButton representing
that layer.
Fix the prelight (mouse-over) background style to match the current
button state, so as to give immediate feed-back when the user presses
the button, and make the interface less confusing.
Closes-bug: lp-699150
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index b4c8c42..f2cdb99 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -1465,17 +1465,19 @@ layer_enable_button_cb (GtkWidget * widget, gpointer data)
}
static void
-layer_button_set_color (LayerButtonSet * lb, gchar * color_string)
+layer_button_set_color (LayerButtonSet * lb, gchar * color_string,
+ bool set_prelight)
{
GdkColor color;
if (!lb->layer_enable_ebox)
return;
-
+
color.red = color.green = color.blue = 0;
ghid_map_color_string (color_string, &color);
gtk_widget_modify_bg (lb->layer_enable_ebox, GTK_STATE_ACTIVE, &color);
- gtk_widget_modify_bg (lb->layer_enable_ebox, GTK_STATE_PRELIGHT, &color);
+ gtk_widget_modify_bg (lb->layer_enable_ebox, GTK_STATE_PRELIGHT,
+ set_prelight ? &color : NULL);
gtk_widget_modify_fg (lb->label, GTK_STATE_ACTIVE, &WhitePixel);
}
@@ -1573,7 +1575,7 @@ make_layer_buttons (GtkWidget * vbox, GHidPort * port)
lb->text = g_strdup (text);
lb->label = label;
- layer_button_set_color (lb, color_string);
+ layer_button_set_color (lb, color_string, active);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), active);
g_signal_connect (G_OBJECT (button), "toggled",
@@ -1605,11 +1607,13 @@ ghid_layer_buttons_color_update (void)
for (i = 0; i < N_LAYER_BUTTONS; ++i)
{
+ bool active;
+
lb = &layer_buttons[i];
layer_process (&color_string, NULL, NULL, i);
-
- layer_button_set_color (lb, color_string);
+ active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (lb));
+ layer_button_set_color (lb, color_string, active);
}
}
@@ -1621,6 +1625,7 @@ ghid_layer_enable_buttons_update (void)
{
LayerButtonSet *lb;
gchar *s;
+ gchar *color_string;
gint i;
#ifdef DEBUG_MENUS
@@ -1651,6 +1656,8 @@ ghid_layer_enable_buttons_update (void)
printf ("ghid_layer_enable_buttons_update: active=%d new=%d\n",
active, new);
}
+ layer_process (&color_string, NULL, NULL, i);
+ layer_button_set_color (lb, color_string, PCB->Data->Layer[i].On);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
(lb->layer_enable_button),
PCB->Data->Layer[i].On);
|
|
From: <gi...@gp...> - 2011-01-07 23:16:13
|
The branch, master has been updated
via ab1c8c4d4ec61d85083d61668042526a878fcddc (commit)
from 3d983853cbc61c64993492799eef911339f4f5cc (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-command-window.c | 1 +
src/hid/gtk/gui-dialog-size.c | 1 +
src/hid/gtk/gui-misc.c | 6 ++----
src/hid/gtk/gui-output-events.c | 2 ++
src/hid/gtk/gui-top-window.c | 24 ++++++++++++++++++------
5 files changed, 24 insertions(+), 10 deletions(-)
=================
Commit Messages
=================
commit ab1c8c4d4ec61d85083d61668042526a878fcddc
Author: Felix Ruoff <Fe...@po...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Modify window title to match the GNOME Human Interface Guidelines
Modifies the title of the main window as suggested in the GNOME HIG:
(http://library.gnome.org/devel/hig-book/nightly/windows-primary.html)
The following will be shown there:
- A star (*) if the layout has unsaved changes (this patch also
removes this sign from the statusbar, where it currently is)
- The name of the layout, if set in the config-dialog
('Put layout name on the window title bar')
- The filename (in braces, if layout name is shown)
- The string " - PCB"
Closes-bug: lp-699509
Acked-by: Peter Clifton <pc...@ca...>
(Also modified commit message)
:100644 100644 ef2f637... b97ec0b... M src/hid/gtk/gui-command-window.c
:100644 100644 16caff3... 8409ba5... M src/hid/gtk/gui-dialog-size.c
:100644 100644 a607a69... e3316aa... M src/hid/gtk/gui-misc.c
:100644 100644 e0120b6... f55cabc... M src/hid/gtk/gui-output-events.c
:100644 100644 828c524... b4c8c42... M src/hid/gtk/gui-top-window.c
=========
Changes
=========
commit ab1c8c4d4ec61d85083d61668042526a878fcddc
Author: Felix Ruoff <Fe...@po...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Modify window title to match the GNOME Human Interface Guidelines
Modifies the title of the main window as suggested in the GNOME HIG:
(http://library.gnome.org/devel/hig-book/nightly/windows-primary.html)
The following will be shown there:
- A star (*) if the layout has unsaved changes (this patch also
removes this sign from the statusbar, where it currently is)
- The name of the layout, if set in the config-dialog
('Put layout name on the window title bar')
- The filename (in braces, if layout name is shown)
- The string " - PCB"
Closes-bug: lp-699509
Acked-by: Peter Clifton <pc...@ca...>
(Also modified commit message)
diff --git a/src/hid/gtk/gui-command-window.c b/src/hid/gtk/gui-command-window.c
index ef2f637..b97ec0b 100644
--- a/src/hid/gtk/gui-command-window.c
+++ b/src/hid/gtk/gui-command-window.c
@@ -481,5 +481,6 @@ ghid_handle_user_command (gboolean raise)
}
RestoreCrosshair (true);
}
+ ghid_window_set_name_label (PCB->Name);
ghid_set_status_line_label ();
}
diff --git a/src/hid/gtk/gui-dialog-size.c b/src/hid/gtk/gui-dialog-size.c
index 16caff3..8409ba5 100644
--- a/src/hid/gtk/gui-dialog-size.c
+++ b/src/hid/gtk/gui-dialog-size.c
@@ -334,5 +334,6 @@ ghid_route_style_dialog (gint index, RouteStyleType * temp_rst)
}
gtk_widget_destroy (dialog);
+ ghid_window_set_name_label (PCB->Name);
ghid_set_status_line_label ();
}
diff --git a/src/hid/gtk/gui-misc.c b/src/hid/gtk/gui-misc.c
index a607a69..e3316aa 100644
--- a/src/hid/gtk/gui-misc.c
+++ b/src/hid/gtk/gui-misc.c
@@ -500,7 +500,7 @@ ghid_set_status_line_label (void)
if (!Settings.grid_units_mm)
snprintf (text, sizeof (text),
- _("<b>%c view</b>=%s "
+ _("<b>view</b>=%s "
"<b>grid</b>=%.1f:%i "
"%s%s "
"<b>line</b>=%.1f "
@@ -508,7 +508,6 @@ ghid_set_status_line_label (void)
"<b>clearance</b>=%.1f "
"<b>text</b>=%i%% "
"<b>buffer</b>=#%i"),
- PCB->Changed ? '*' : ' ',
Settings.ShowSolderSide ? _("solder") : _("component"),
PCB->Grid / 100.0,
(int) Settings.GridFactor,
@@ -524,7 +523,7 @@ ghid_set_status_line_label (void)
Settings.TextScale, Settings.BufferNumber + 1);
else
snprintf (text, sizeof (text),
- _("<b>%c view</b>=%s "
+ _("<b>view</b>=%s "
"<b>grid</b>=%5.3f:%i "
"%s%s "
"<b>line</b>=%5.3f "
@@ -532,7 +531,6 @@ ghid_set_status_line_label (void)
"<b>clearance</b>=%5.3f "
"<b>text</b>=%i%% "
"<b>buffer</b>=#%i"),
- PCB->Changed ? '*' : ' ',
Settings.ShowSolderSide ? _("solder") : _("component"),
PCB->Grid * COOR_TO_MM, (int) Settings.GridFactor,
TEST_FLAG (ALLDIRECTIONFLAG, PCB) ? "all" :
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index e0120b6..f55cabc 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -470,6 +470,7 @@ ghid_port_button_press_cb (GtkWidget * drawing_area,
ghid_invalidate_all ();
RestoreCrosshair (TRUE);
+ ghid_window_set_name_label (PCB->Name);
ghid_set_status_line_label ();
ghid_show_crosshair (TRUE);
if (!gport->panning)
@@ -503,6 +504,7 @@ ghid_port_button_release_cb (GtkWidget * drawing_area,
RestoreCrosshair (TRUE);
ghid_screen_update ();
}
+ ghid_window_set_name_label (PCB->Name);
ghid_set_status_line_label ();
g_idle_add (ghid_idle_cb, NULL);
return TRUE;
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 828c524..b4c8c42 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -661,6 +661,7 @@ ghid_menu_cb (GtkAction * action, gpointer data)
ghid_invalidate_all ();
RestoreCrosshair (TRUE);
ghid_screen_update ();
+ ghid_window_set_name_label (PCB->Name);
ghid_set_status_line_label ();
#ifdef FIXME
g_idle_add (ghid_idle_cb, NULL);
@@ -876,6 +877,7 @@ ghid_sync_with_new_layout (void)
ghid_route_style_button_set_active (0);
ghid_config_handle_units_changed ();
+ ghid_window_set_name_label (PCB->Name);
ghid_set_status_line_label ();
}
@@ -1199,12 +1201,14 @@ make_top_menubar (GtkWidget * hbox, GHidPort * port)
}
-/* Set the PCB name on a label or on the window title bar.
+/* Refreshes the window title bar and sets the PCB name to the
+ * window title bar or to a seperate label
*/
void
ghid_window_set_name_label (gchar * name)
{
gchar *str;
+ gchar *filename;
/* FIXME -- should this happen? It does... */
/* This happens if we're calling an exporter from the command line */
@@ -1218,21 +1222,29 @@ ghid_window_set_name_label (gchar * name)
if (!ghidgui->name_label)
return;
+ if (!PCB->Filename || !*PCB->Filename)
+ filename = g_strdup(_("Unsaved.pcb"));
+ else
+ filename = g_strdup(PCB->Filename);
+
if (ghidgui->ghid_title_window)
{
gtk_widget_hide (ghidgui->label_hbox);
- str = g_strdup_printf ("PCB: %s", ghidgui->name_label_string);
- gtk_window_set_title (GTK_WINDOW (gport->top_window), str);
+ str = g_strdup_printf ("%s%s (%s) - PCB", PCB->Changed ? "*": "",
+ ghidgui->name_label_string, filename);
}
else
{
- gtk_widget_show (ghidgui->label_hbox);
+ gtk_widget_show (ghidgui->label_hbox);
str = g_strdup_printf (" <b><big>%s</big></b> ",
- ghidgui->name_label_string);
+ ghidgui->name_label_string);
gtk_label_set_markup (GTK_LABEL (ghidgui->name_label), str);
- gtk_window_set_title (GTK_WINDOW (gport->top_window), "PCB");
+ str = g_strdup_printf ("%s%s - PCB", PCB->Changed ? "*": "",
+ filename);
}
+ gtk_window_set_title (GTK_WINDOW (gport->top_window), str);
g_free (str);
+ g_free (filename);
}
static void
|
|
From: <gi...@gp...> - 2011-01-05 20:57:50
|
The branch, master has been updated
via 3d983853cbc61c64993492799eef911339f4f5cc (commit)
from 70d3bfa6da2b72f52a071b2183d21a60d6db44d4 (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/select.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
=================
Commit Messages
=================
commit 3d983853cbc61c64993492799eef911339f4f5cc
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Fix "select pads on hidden far side"
If an SMT pad is on the far side of the board, and the far side
layer is not visible, do not select that pad. Exception: if that
pad is part of an element which *is* on the visible side, the pad
is selected as part of selecting the whole element. But, elements
on the far side (the common case) won't have their pads selected
when those pads aren't visible.
:100644 100644 5d44b4f... 3e978bb... M src/select.c
=========
Changes
=========
commit 3d983853cbc61c64993492799eef911339f4f5cc
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Fix "select pads on hidden far side"
If an SMT pad is on the far side of the board, and the far side
layer is not visible, do not select that pad. Exception: if that
pad is part of an element which *is* on the visible side, the pad
is selected as part of selecting the whole element. But, elements
on the far side (the common case) won't have their pads selected
when those pads aren't visible.
diff --git a/src/select.c b/src/select.c
index 5d44b4f..3e978bb 100644
--- a/src/select.c
+++ b/src/select.c
@@ -451,7 +451,10 @@ SelectBlock (BoxTypePtr Box, bool Flag)
PAD_LOOP (element);
{
if (PAD_IN_BOX (pad, Box)
- && TEST_FLAG (SELECTEDFLAG, pad) != Flag)
+ && TEST_FLAG (SELECTEDFLAG, pad) != Flag
+ && (TEST_FLAG (ONSOLDERFLAG, pad) == SWAP_IDENT
+ || PCB->InvisibleObjectsOn
+ || !Flag))
{
AddObjectToFlagUndoList (PAD_TYPE, element, pad, pad);
ASSIGN_FLAG (SELECTEDFLAG, Flag, pad);
|
|
From: <gi...@gp...> - 2011-01-04 06:54:42
|
The branch, master has been updated
via 70d3bfa6da2b72f52a071b2183d21a60d6db44d4 (commit)
via 1e6c76cc65aeb54513e45a6162376afbb14dc55e (commit)
via c7c2a77d032a061f098cceef2085d482198cf1de (commit)
via f48e9b3ee6ffc86f99e44220e575c3a0a04875ed (commit)
from be0620e20b85d2d8122383a11fef8646153f7f5d (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
=========
lib/geda.inc | 2 +
src/hid/lesstif/main.c | 93 +++++++++++++++++++++++++++++++++++----------
src/hid/lesstif/menu.c | 10 +++-
src/hid/lesstif/netlist.c | 2 +-
4 files changed, 83 insertions(+), 24 deletions(-)
=================
Commit Messages
=================
commit 70d3bfa6da2b72f52a071b2183d21a60d6db44d4
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Allow zoom-out-past-board for Lesstif
The lesstif GUI has been modified two ways:
1. You may zoom out "past" the board, making the board smaller
than the window. Note that the crosshair is still limited to
the board's extents.
2. You may pan the board so that edges need not be on the edge
of the window, such as centering an edge for inspection.
Note that the smallest the board can be is 1/10th the window
size. While this is arbitrary, it's easily changed if needed,
and avoids problems with miniscule boards (and thus maxiscule
coordinate systems).
The 'v' key still zooms the board to fit, but now centers the
board in the window rather than placing it at the upper left.
:100644 100644 5f497a8... 70a00dc... M src/hid/lesstif/main.c
commit 1e6c76cc65aeb54513e45a6162376afbb14dc55e
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
ResetConncetions -> ResetConnections
Typo.
:100644 100644 4ddc240... 3645547... M src/hid/lesstif/netlist.c
commit c7c2a77d032a061f098cceef2085d482198cf1de
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Fix lesstif segfault in key handling.
When a key handler calls an action, the key table might change
before the action returns (via nested key handlers), so save a
pointer to the table we're parsing to ensure it will be around
when we return.
:100644 100644 6baa016... 6442fcd... M src/hid/lesstif/menu.c
commit f48e9b3ee6ffc86f99e44220e575c3a0a04875ed
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Add 80-pin headers.
Add 80 pin DIP and Ribbon 0.1" header macros to the usual list.
:100644 100644 347adcf... b2a2310... M lib/geda.inc
=========
Changes
=========
commit 70d3bfa6da2b72f52a071b2183d21a60d6db44d4
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Allow zoom-out-past-board for Lesstif
The lesstif GUI has been modified two ways:
1. You may zoom out "past" the board, making the board smaller
than the window. Note that the crosshair is still limited to
the board's extents.
2. You may pan the board so that edges need not be on the edge
of the window, such as centering an edge for inspection.
Note that the smallest the board can be is 1/10th the window
size. While this is arbitrary, it's easily changed if needed,
and avoids problems with miniscule boards (and thus maxiscule
coordinate systems).
The 'v' key still zooms the board to fit, but now centers the
board in the window rather than placing it at the upper left.
diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index 5f497a8..70a00dc 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -44,6 +44,9 @@ RCSID ("$Id$");
#define XtRDouble "Double"
#endif
+/* How big the viewport can be relative to the pcb size. */
+#define MAX_ZOOM_SCALE 10
+
typedef struct hid_gc_struct
{
HID *me_pointer;
@@ -190,6 +193,7 @@ HID_Attribute lesstif_attribute_list[] = {
REGISTER_ATTRIBUTES (lesstif_attribute_list)
static void lesstif_use_mask (int use_it);
+static void zoom_max ();
static void zoom_to (double factor, int x, int y);
static void zoom_by (double factor, int x, int y);
static void zoom_toggle (int x, int y);
@@ -337,7 +341,7 @@ PCBChanged (int argc, char **argv, int x, int y)
stdarg (XmNsliderSize, PCB->MaxHeight ? PCB->MaxHeight : 1);
stdarg (XmNmaximum, PCB->MaxHeight ? PCB->MaxHeight : 1);
XtSetValues (vscroll, args, n);
- zoom_by (1000000, 0, 0);
+ zoom_max ();
hid_action ("NetlistChanged");
hid_action ("LayersChanged");
@@ -452,7 +456,7 @@ ZoomAction (int argc, char **argv, int x, int y)
}
if (argc < 1)
{
- zoom_to (1000000, 0, 0);
+ zoom_max ();
return 0;
}
vp = argv[0];
@@ -1131,6 +1135,7 @@ set_scroll (Widget s, int pos, int view, int pcb)
void
lesstif_pan_fixup ()
{
+#if 0
if (view_left_x > PCB->MaxWidth - (view_width * view_zoom))
view_left_x = PCB->MaxWidth - (view_width * view_zoom);
if (view_top_y > PCB->MaxHeight - (view_height * view_zoom))
@@ -1145,6 +1150,7 @@ lesstif_pan_fixup ()
zoom_by (1, 0, 0);
return;
}
+#endif
set_scroll (hscroll, view_left_x, view_width, PCB->MaxWidth);
set_scroll (vscroll, view_top_y, view_height, PCB->MaxHeight);
@@ -1153,6 +1159,20 @@ lesstif_pan_fixup ()
}
static void
+zoom_max ()
+{
+ double new_zoom = PCB->MaxWidth / view_width;
+ if (new_zoom < PCB->MaxHeight / view_height)
+ new_zoom = PCB->MaxHeight / view_height;
+
+ view_left_x = -(view_width * new_zoom - PCB->MaxWidth) / 2;
+ view_top_y = -(view_height * new_zoom - PCB->MaxHeight) / 2;
+ view_zoom = new_zoom;
+ pixel_slop = view_zoom;
+ lesstif_pan_fixup ();
+}
+
+static void
zoom_to (double new_zoom, int x, int y)
{
double max_zoom, xfrac, yfrac;
@@ -1170,6 +1190,8 @@ zoom_to (double new_zoom, int x, int y)
if (max_zoom < PCB->MaxHeight / view_height)
max_zoom = PCB->MaxHeight / view_height;
+ max_zoom *= MAX_ZOOM_SCALE;
+
if (new_zoom < 1)
new_zoom = 1;
if (new_zoom > max_zoom)
@@ -2429,29 +2451,60 @@ idle_proc (XtPointer dummy)
}
XSetForeground (display, bg_gc, bgcolor);
XFillRectangle (display, main_pixmap, bg_gc, 0, 0, mx, my);
- if (region.X2 > PCB->MaxWidth || region.Y2 > PCB->MaxHeight)
+
+ if (region.X1 < 0 || region.Y1 < 0
+ || region.X2 > PCB->MaxWidth || region.Y2 > PCB->MaxHeight)
{
+ int leftmost, rightmost, topmost, bottommost;
+
+ leftmost = Vx (0);
+ rightmost = Vx (PCB->MaxWidth);
+ topmost = Vy (0);
+ bottommost = Vy (PCB->MaxHeight);
+ if (leftmost > rightmost) {
+ int t = leftmost;
+ leftmost = rightmost;
+ rightmost = t;
+ }
+ if (topmost > bottommost) {
+ int t = topmost;
+ topmost = bottommost;
+ bottommost = t;
+ }
+ if (leftmost < 0)
+ leftmost = 0;
+ if (topmost < 0)
+ topmost = 0;
+ if (rightmost > view_width)
+ rightmost = view_width;
+ if (bottommost > view_height)
+ bottommost = view_height;
+
XSetForeground (display, bg_gc, offlimit_color);
- if (region.X2 > PCB->MaxWidth)
- {
- mx = Vx (PCB->MaxWidth);
- if (flip_x)
- XFillRectangle (display, main_pixmap, bg_gc, 0, 0,
- mx-1, my);
- else
- XFillRectangle (display, main_pixmap, bg_gc, mx+1, 0,
- view_width - mx + 1, my);
+ /* L T R
+ L x R
+ L B R */
+
+ if (leftmost > 0)
+ {
+ XFillRectangle (display, main_pixmap, bg_gc, 0, 0,
+ leftmost, view_height);
+ }
+ if (rightmost < view_width)
+ {
+ XFillRectangle (display, main_pixmap, bg_gc, rightmost+1, 0,
+ view_width-rightmost+1, view_height);
+ }
+ if (topmost > 0)
+ {
+ XFillRectangle (display, main_pixmap, bg_gc, leftmost, 0,
+ rightmost-leftmost+1, topmost);
}
- if (region.Y2 > PCB->MaxHeight)
+ if (bottommost < view_height)
{
- my = Vy (PCB->MaxHeight) + 1;
- if (flip_y)
- XFillRectangle (display, main_pixmap, bg_gc, 0, 0, mx,
- my-1);
- else
- XFillRectangle (display, main_pixmap, bg_gc, 0, my, mx,
- view_height - my + 1);
+ XFillRectangle (display, main_pixmap, bg_gc, leftmost, bottommost+1,
+ rightmost-leftmost+1, view_height-bottommost+1);
}
}
DrawBackgroundImage();
commit 1e6c76cc65aeb54513e45a6162376afbb14dc55e
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
ResetConncetions -> ResetConnections
Typo.
diff --git a/src/hid/lesstif/netlist.c b/src/hid/lesstif/netlist.c
index 4ddc240..3645547 100644
--- a/src/hid/lesstif/netlist.c
+++ b/src/hid/lesstif/netlist.c
@@ -143,7 +143,7 @@ nbcb_select_common (LibraryMenuTypePtr net, int pos, int select_flag)
RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true, true);
SelectConnection (select_flag);
- ResetConncetions (false);
+ ResetConnections (false);
FreeConnectionLookupMemory ();
IncrementUndoSerialNumber ();
Draw ();
commit c7c2a77d032a061f098cceef2085d482198cf1de
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Fix lesstif segfault in key handling.
When a key handler calls an action, the key table might change
before the action returns (via nested key handlers), so save a
pointer to the table we're parsing to ensure it will be around
when we return.
diff --git a/src/hid/lesstif/menu.c b/src/hid/lesstif/menu.c
index 6baa016..6442fcd 100644
--- a/src/hid/lesstif/menu.c
+++ b/src/hid/lesstif/menu.c
@@ -1098,6 +1098,7 @@ lesstif_key_event (XKeyEvent * e)
int mods = 0;
int i, vi;
static int sorted = 0;
+ acc_table_t *my_table = 0;
if (!sorted)
{
@@ -1202,10 +1203,13 @@ lesstif_key_event (XKeyEvent * e)
else
have_xy = 0;
- for (vi = 1; vi < cur_table[i].u.a.node->c; vi++)
- if (resource_type (cur_table[i].u.a.node->v[vi]) == 10)
+ /* Parsing actions may not return until more user interaction
+ happens, so remember which table we're scanning. */
+ my_table = cur_table;
+ for (vi = 1; vi < my_table[i].u.a.node->c; vi++)
+ if (resource_type (my_table[i].u.a.node->v[vi]) == 10)
if (hid_parse_actions
- (cur_table[i].u.a.node->v[vi].value))
+ (my_table[i].u.a.node->v[vi].value))
break;
cur_table = 0;
return 1;
commit f48e9b3ee6ffc86f99e44220e575c3a0a04875ed
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Add 80-pin headers.
Add 80 pin DIP and Ribbon 0.1" header macros to the usual list.
diff --git a/lib/geda.inc b/lib/geda.inc
index 347adcf..b2a2310 100644
--- a/lib/geda.inc
+++ b/lib/geda.inc
@@ -793,6 +793,7 @@ define(`PKG_HEADER58_1', `PKG_CONNECTOR_DIL(`$1', `$2', `$3', 29)');
define(`PKG_HEADER60_1', `PKG_CONNECTOR_DIL(`$1', `$2', `$3', 30)');
define(`PKG_HEADER62_1', `PKG_CONNECTOR_DIL(`$1', `$2', `$3', 31)');
define(`PKG_HEADER64_1', `PKG_CONNECTOR_DIL(`$1', `$2', `$3', 32)');
+define(`PKG_HEADER80_1', `PKG_CONNECTOR_DIL(`$1', `$2', `$3', 40)');
#
## Header connector, ribbon cable numbering
@@ -830,6 +831,7 @@ define(`PKG_HEADER58_2', `PKG_CONNECTOR(`$1', `$2', `$3', 29, 2)');
define(`PKG_HEADER60_2', `PKG_CONNECTOR(`$1', `$2', `$3', 30, 2)');
define(`PKG_HEADER62_2', `PKG_CONNECTOR(`$1', `$2', `$3', 31, 2)');
define(`PKG_HEADER64_2', `PKG_CONNECTOR(`$1', `$2', `$3', 32, 2)');
+define(`PKG_HEADER80_2', `PKG_CONNECTOR(`$1', `$2', `$3', 40, 2)');
#
## Header connector with latches
|
|
From: <gi...@gp...> - 2010-12-28 01:40:57
|
The branch, master has been updated
via be0620e20b85d2d8122383a11fef8646153f7f5d (commit)
from 60b0ea93b440c505628429637688e8a9ed6eda43 (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-main.c | 2 +-
src/hid/gtk/gui-netlist-window.c | 14 +++++++++-----
src/hid/gtk/gui.h | 1 +
3 files changed, 11 insertions(+), 6 deletions(-)
=================
Commit Messages
=================
commit be0620e20b85d2d8122383a11fef8646153f7f5d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Fix warping pointer to correct location from netlist window
We weren't updating the pointer location after having panned the
connection into the center of the screen.
Also fixes the open-coded panning code to work for flipped views.
The patch is pretty horrible at best, but appears to fix the issue.
Unfortunately the locical call to use (the "Center" action) cannot be
made through the generic action code as we need to specify the location
explicitly. We could perhaps export the Centre action function, or
refactor it as a wrapper around a helper function which we would then
export and call.
I aim to eventually rework the GTK HID's coordinate transforms
(including flipped views), event handling, view panning and pointer
warping in order to give greater sepeatation between the renderer
agnostic parts of the HID and the renderer. This will be needed for the
3D portions of the PCB+GL branch.
It seems most sensible to start refactoring from a state where the
existing code at least functions correctly (even if it isn't pretty),
rather than work in fixes as I refactor.
:100644 100644 9fd781c... 8bbf3eb... M src/hid/gtk/gtkhid-main.c
:100644 100644 ce3e2ff... a5e38d1... M src/hid/gtk/gui-netlist-window.c
:100644 100644 ba8b601... d2a76ce... M src/hid/gtk/gui.h
=========
Changes
=========
commit be0620e20b85d2d8122383a11fef8646153f7f5d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Fix warping pointer to correct location from netlist window
We weren't updating the pointer location after having panned the
connection into the center of the screen.
Also fixes the open-coded panning code to work for flipped views.
The patch is pretty horrible at best, but appears to fix the issue.
Unfortunately the locical call to use (the "Center" action) cannot be
made through the generic action code as we need to specify the location
explicitly. We could perhaps export the Centre action function, or
refactor it as a wrapper around a helper function which we would then
export and call.
I aim to eventually rework the GTK HID's coordinate transforms
(including flipped views), event handling, view panning and pointer
warping in order to give greater sepeatation between the renderer
agnostic parts of the HID and the renderer. This will be needed for the
3D portions of the PCB+GL branch.
It seems most sensible to start refactoring from a state where the
existing code at least functions correctly (even if it isn't pretty),
rather than work in fixes as I refactor.
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 9fd781c..8bbf3eb 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -34,7 +34,7 @@ static void zoom_by (double factor, int x, int y);
int ghid_flip_x = 0, ghid_flip_y = 0;
-static void
+void
ghid_pan_fixup ()
{
diff --git a/src/hid/gtk/gui-netlist-window.c b/src/hid/gtk/gui-netlist-window.c
index ce3e2ff..a5e38d1 100644
--- a/src/hid/gtk/gui-netlist-window.c
+++ b/src/hid/gtk/gui-netlist-window.c
@@ -270,11 +270,15 @@ node_selection_changed_cb (GtkTreeSelection * selection, gpointer data)
|| Crosshair.Y < gport->view_y0 + margin
|| Crosshair.Y > gport->view_y0 + gport->view_height - margin
)
- {
- x0 = Crosshair.X - gport->view_width / 2;
- y0 = Crosshair.Y - gport->view_height / 2;
- ghid_port_ranges_pan(x0, y0, FALSE);
- }
+ {
+
+ x0 = SIDE_X (Crosshair.X) - gport->view_width / 2;
+ y0 = SIDE_Y (Crosshair.Y) - gport->view_height / 2;
+ gport->view_x0 = x0;
+ gport->view_y0 = y0;
+ ghid_pan_fixup ();
+ gui->set_crosshair (Crosshair.X, Crosshair.Y, HID_SC_WARP_POINTER);
+ }
ghid_screen_update();
}
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index ba8b601..d2a76ce 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -507,6 +507,7 @@ void ghid_invalidate_all ();
void ghid_show_crosshair (gboolean show);
/* gtkhid-main.c */
+void ghid_pan_fixup (void);
void ghid_get_coords (const char *msg, int *x, int *y);
gint PCBChanged (int argc, char **argv, int x, int y);
|
|
From: <gi...@gp...> - 2010-12-27 17:23:11
|
The branch, master has been updated
via 60b0ea93b440c505628429637688e8a9ed6eda43 (commit)
via 34a21a5b21bb80dea76164972d7ae7b9756eb6a2 (commit)
via c3038ad2b4325ddd0ec3769d31c355d7e8f0b211 (commit)
via d6dd08b4e0c1257994de834f07f194f1855c1606 (commit)
via e08826eec68b844e7b260a6176916a6f04d2f50b (commit)
via cda6dec709ca096e8ac3df4d087e445527831a14 (commit)
via 3a02a899c62e2fcbddea0fadea1de2a52bab97c0 (commit)
from b99fde814d5c3e1ba6ba02512a5d582376ed9aea (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
=========
configure.ac | 13 +---
src/hid/gtk/gtkhid-gdk.c | 15 ----
src/hid/gtk/gtkhid-main.c | 163 ++++++++++-----------------------------
src/hid/gtk/gui-dialog.c | 2 -
src/hid/gtk/gui-output-events.c | 9 +--
5 files changed, 47 insertions(+), 155 deletions(-)
=================
Commit Messages
=================
commit 60b0ea93b440c505628429637688e8a9ed6eda43
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove unused Vx2 and Vy2 functions from gtkhid-{main,gdk}.c
:100644 100644 b1dc11d... 0a2cc59... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 6b2dd87... 9fd781c... M src/hid/gtk/gtkhid-main.c
commit 34a21a5b21bb80dea76164972d7ae7b9756eb6a2
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove unused file scope variables event_x and event_y
:100644 100644 569a09b... e0120b6... M src/hid/gtk/gui-output-events.c
commit c3038ad2b4325ddd0ec3769d31c355d7e8f0b211
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Compute warp pointer offset without reading current position
This is closer to the way the old code which used the an XWarpPointer
call worked, and makes the two code-paths where we warp the pointer
consistent. Also, remove some unnecessary comments which were more
relevant to explain why we previously had too implementations.
:100644 100644 d3df2f9... 6b2dd87... M src/hid/gtk/gtkhid-main.c
commit d6dd08b4e0c1257994de834f07f194f1855c1606
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Fix "Center" action in a couple of ways
We need to update the adjustments together otherwise the center
action will only work on one axis at a time.
Fix typo for out-of bounds check which mixed width and height.
:100644 100644 991c97d... d3df2f9... M src/hid/gtk/gtkhid-main.c
commit e08826eec68b844e7b260a6176916a6f04d2f50b
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Clean up mouse warping code now we require a later GTK version
Remove the X11 specific implementation and remove some comments in the
GDK one which were more relevant to explain why we previously had two
implementations.
:100644 100644 f606faa... cf685a7... M configure.ac
:100644 100644 e91b68c... 991c97d... M src/hid/gtk/gtkhid-main.c
commit cda6dec709ca096e8ac3df4d087e445527831a14
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Cleanup conditional code now we require a later GTK version
:100644 100644 1f6b11a... 80c1157... M src/hid/gtk/gui-dialog.c
commit 3a02a899c62e2fcbddea0fadea1de2a52bab97c0
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Bump required GTK version in configure.ac test to 2.12
This is required, as we utilise some of the newer APIs.
NB: GTK+ 2.12.0 was released in September 2007
:100644 100644 abdd8a1... f606faa... M configure.ac
=========
Changes
=========
commit 60b0ea93b440c505628429637688e8a9ed6eda43
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove unused Vx2 and Vy2 functions from gtkhid-{main,gdk}.c
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index b1dc11d..0a2cc59 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -28,21 +28,6 @@ extern HID ghid_hid;
static int cur_mask = -1;
static int mask_seq = 0;
-/* ------------------------------------------------------------ */
-
-static inline int
-Vx2 (int x)
-{
- return (x - gport->view_x0) / gport->zoom + 0.5;
-}
-
-static inline int
-Vy2 (int y)
-{
- return (y - gport->view_y0) / gport->zoom + 0.5;
-}
-
-/* ------------------------------------------------------------ */
typedef struct hid_gc_struct
{
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 6b2dd87..9fd781c 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -33,21 +33,6 @@ static void zoom_by (double factor, int x, int y);
int ghid_flip_x = 0, ghid_flip_y = 0;
-/* ------------------------------------------------------------ */
-
-static inline int
-Vx2 (int x)
-{
- return (x - gport->view_x0) / gport->zoom + 0.5;
-}
-
-static inline int
-Vy2 (int y)
-{
- return (y - gport->view_y0) / gport->zoom + 0.5;
-}
-
-/* ------------------------------------------------------------ */
static void
ghid_pan_fixup ()
commit 34a21a5b21bb80dea76164972d7ae7b9756eb6a2
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove unused file scope variables event_x and event_y
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index 569a09b..e0120b6 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -214,8 +214,6 @@ ghid_port_ranges_zoom (gdouble zoom)
* handles all events from PCB drawing area
*/
-static gint event_x, event_y;
-
void
ghid_get_coords (const char *msg, int *x, int *y)
{
@@ -231,14 +229,13 @@ ghid_get_coords (const char *msg, int *x, int *y)
gboolean
ghid_note_event_location (GdkEventButton * ev)
{
- gint x, y;
+ gint event_x, event_y;
gboolean moved;
if (!ev)
{
- gdk_window_get_pointer (ghid_port.drawing_area->window, &x, &y, NULL);
- event_x = x;
- event_y = y;
+ gdk_window_get_pointer (ghid_port.drawing_area->window,
+ &event_x, &event_y, NULL);
}
else
{
commit c3038ad2b4325ddd0ec3769d31c355d7e8f0b211
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Compute warp pointer offset without reading current position
This is closer to the way the old code which used the an XWarpPointer
call worked, and makes the two code-paths where we warp the pointer
consistent. Also, remove some unnecessary comments which were more
relevant to explain why we previously had too implementations.
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index d3df2f9..6b2dd87 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -1652,10 +1652,10 @@ currently within the window already.
static int
Center(int argc, char **argv, int x, int y)
{
- int x0, y0, w2, h2, dx, dy;
+ int x0, y0, w2, h2;
GdkDisplay *display;
GdkScreen *screen;
- gint cx, cy;
+ int xofs, yofs;
if (argc != 0)
AFAIL (center);
@@ -1680,8 +1680,6 @@ Center(int argc, char **argv, int x, int y)
y = y0 + h2;
}
- dx = (x0 - gport->view_x0) / gport->zoom ;
- dy = (y0 - gport->view_y0) / gport->zoom;
gport->view_x0 = x0;
gport->view_y0 = y0;
@@ -1694,9 +1692,13 @@ Center(int argc, char **argv, int x, int y)
display = gdk_display_get_default ();
screen = gdk_display_get_default_screen (display);
- /* figure out where the pointer is and then move it from there by the specified delta */
- gdk_display_get_pointer (display, NULL, &cx, &cy, NULL);
- gdk_display_warp_pointer (display, screen, cx - dx, cy - dy);
+ /*
+ * Figure out where the drawing area is on the screen because
+ * gdk_display_warp_pointer will warp relative to the whole display
+ * but the value we've been given is relative to your drawing area
+ */
+ gdk_window_get_origin (gport->drawing_area->window, &xofs, &yofs);
+ gdk_display_warp_pointer (display, screen, xofs + Vx (x), yofs + Vy (y));
return 0;
}
commit d6dd08b4e0c1257994de834f07f194f1855c1606
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Fix "Center" action in a couple of ways
We need to update the adjustments together otherwise the center
action will only work on one axis at a time.
Fix typo for out-of bounds check which mixed width and height.
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 991c97d..d3df2f9 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -53,14 +53,14 @@ static void
ghid_pan_fixup ()
{
- /*
+ /*
* don't pan so far to the right that we see way past the right
* edge of the board.
*/
if (gport->view_x0 > PCB->MaxWidth - gport->view_width)
gport->view_x0 = PCB->MaxWidth - gport->view_width;
- /*
+ /*
* don't pan so far down that we see way past the bottom edge of
* the board.
*/
@@ -74,20 +74,20 @@ ghid_pan_fixup ()
if (gport->view_y0 < 0)
gport->view_y0 = 0;
+ /* if we can see the entire board and some, then zoom to fit */
+ if (gport->view_width > PCB->MaxWidth &&
+ gport->view_height > PCB->MaxHeight)
+ {
+ zoom_by (1, 0, 0);
+ return;
+ }
- /* if we can see the entire board and some, then zoom to fit */
- if (gport->view_width > PCB->MaxWidth &&
- gport->view_height > PCB->MaxHeight)
- {
- zoom_by (1, 0, 0);
- return;
- }
-
- gtk_range_set_value (GTK_RANGE (ghidgui->h_range), gport->view_x0);
- gtk_range_set_value (GTK_RANGE (ghidgui->v_range), gport->view_y0);
-
- ghid_invalidate_all ();
+ ghidgui->adjustment_changed_holdoff = TRUE;
+ gtk_range_set_value (GTK_RANGE (ghidgui->h_range), gport->view_x0);
+ gtk_range_set_value (GTK_RANGE (ghidgui->v_range), gport->view_y0);
+ ghidgui->adjustment_changed_holdoff = FALSE;
+ ghid_port_ranges_changed();
}
/* ------------------------------------------------------------ */
@@ -1668,7 +1668,7 @@ Center(int argc, char **argv, int x, int y)
x0 = x - w2;
y0 = y - h2;
- if (x0 < 0)
+ if (x0 < 0)
{
x0 = 0;
x = x0 + w2;
@@ -1677,7 +1677,7 @@ Center(int argc, char **argv, int x, int y)
if (y0 < 0)
{
y0 = 0;
- y = y0 + w2;
+ y = y0 + h2;
}
dx = (x0 - gport->view_x0) / gport->zoom ;
commit e08826eec68b844e7b260a6176916a6f04d2f50b
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Clean up mouse warping code now we require a later GTK version
Remove the X11 specific implementation and remove some comments in the
GDK one which were more relevant to explain why we previously had two
implementations.
diff --git a/configure.ac b/configure.ac
index f606faa..cf685a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -721,15 +721,6 @@ Please review the following errors:
$GTK_PKG_ERRORS])]
)
GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
-
- # if we are building for gtk >= 2.8.0, we can use gdk_display_warp_pointer()
- # otherwise we need XWarpPointer and we'll pull in the required headers with
- # gdk/gdkx.h and we'll need to link with X11
- if ! $PKG_CONFIG gtk+-2.0 --atleast-version=2.8.0 ; then
- CPPFLAGS="$CFLAGS $GTK_CFLAGS"
- AC_CHECK_HEADERS([gdk/gdkx.h])
- fi
-
GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
;;
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index e91b68c..991c97d 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -20,11 +20,6 @@
#include "gui.h"
#include "hid/common/draw_helpers.h"
-
-#if !GTK_CHECK_VERSION(2,8,0) && defined(HAVE_GDK_GDKX_H)
-#include <gdk/gdkx.h>
-#endif
-
#ifdef HAVE_LIBDMALLOC
#include <dmalloc.h>
#endif
@@ -489,41 +484,20 @@ ghid_set_crosshair (int x, int y, int action)
if (action == HID_SC_WARP_POINTER)
{
-#if GTK_CHECK_VERSION(2,8,0)
- gint xofs, yofs;
- GdkDisplay *display;
- GdkScreen *screen;
-
- display = gdk_display_get_default ();
- screen = gdk_display_get_default_screen (display);
-
- /*
- * Figure out where the drawing area is on the screen because
- * gdk_display_warp_pointer will warp relative to the whole display
- * but the value we've been given is relative to your drawing area
- */
- gdk_window_get_origin (gport->drawing_area->window, &xofs, &yofs);
-
- /*
- * Note that under X11, gdk_display_warp_pointer is just a wrapper around XWarpPointer, but
- * hopefully by avoiding the direct call to an X function we might still work under windows
- * and other non-X11 based gdk's
- */
- gdk_display_warp_pointer (display, screen, xofs + Vx (x), yofs + Vy (y));
+ gint xofs, yofs;
+ GdkDisplay *display;
+ GdkScreen *screen;
+ display = gdk_display_get_default ();
+ screen = gdk_display_get_default_screen (display);
-#else
-# ifdef HAVE_GDK_GDKX_H
- gint xofs, yofs;
- gdk_window_get_origin (gport->drawing_area->window, &xofs, &yofs);
- XWarpPointer (GDK_DRAWABLE_XDISPLAY (gport->drawing_area->window),
- None, GDK_WINDOW_XID (gport->drawing_area->window),
- 0, 0, 0, 0,
- xofs + Vx (x), yofs + Vy (y));
-# else
-# error "sorry. You need gtk+>=2.8.0 unless you are on X windows"
-# endif
-#endif
+ /*
+ * Figure out where the drawing area is on the screen because
+ * gdk_display_warp_pointer will warp relative to the whole display
+ * but the value we've been given is relative to your drawing area
+ */
+ gdk_window_get_origin (gport->drawing_area->window, &xofs, &yofs);
+ gdk_display_warp_pointer (display, screen, xofs + Vx (x), yofs + Vy (y));
}
}
@@ -1679,7 +1653,10 @@ static int
Center(int argc, char **argv, int x, int y)
{
int x0, y0, w2, h2, dx, dy;
-
+ GdkDisplay *display;
+ GdkScreen *screen;
+ gint cx, cy;
+
if (argc != 0)
AFAIL (center);
@@ -1708,61 +1685,18 @@ Center(int argc, char **argv, int x, int y)
gport->view_x0 = x0;
gport->view_y0 = y0;
-
ghid_pan_fixup ();
/* Move the pointer to the center of the window, but only if it's
currently within the window already. Watch out for edges,
though. */
-#if GTK_CHECK_VERSION(2,8,0)
- {
- GdkDisplay *display;
- GdkScreen *screen;
- gint cx, cy;
-
- display = gdk_display_get_default ();
- screen = gdk_display_get_default_screen (display);
-
- /* figure out where the pointer is and then move it from there by the specified delta */
- gdk_display_get_pointer (display, NULL, &cx, &cy, NULL);
- gdk_display_warp_pointer (display, screen, cx - dx, cy - dy);
-
- /*
- * Note that under X11, gdk_display_warp_pointer is just a wrapper around XWarpPointer, but
- * hopefully by avoiding the direct call to an X function we might still work under windows
- * and other non-X11 based gdk's
- */
- }
-#else
-# ifdef HAVE_GDK_GDKX_H
- {
-
- Window w_src, w_dst;
- w_src = GDK_WINDOW_XID (gport->drawing_area->window);
- w_dst = w_src;
+ display = gdk_display_get_default ();
+ screen = gdk_display_get_default_screen (display);
- /* don't warp with the auto drc - that creates auto-scroll chaos */
- if (TEST_FLAG (AUTODRCFLAG, PCB) && Settings.Mode == LINE_MODE
- && Crosshair.AttachedLine.State != STATE_FIRST)
- return 0;
-
- XWarpPointer (GDK_DRAWABLE_XDISPLAY (gport->drawing_area->window),
- w_src, w_dst,
- 0, 0, 0, 0,
- Vx2 (x), Vy2 (y));
-
- /* XWarpPointer creates Motion events normally bound to
- * EventMoveCrosshair.
- * We don't do any updates when EventMoveCrosshair
- * is called the next time to prevent from rounding errors
- */
- /* FIXME?
- * IgnoreMotionEvents = ignore;
- */
- }
-# endif
-#endif
+ /* figure out where the pointer is and then move it from there by the specified delta */
+ gdk_display_get_pointer (display, NULL, &cx, &cy, NULL);
+ gdk_display_warp_pointer (display, screen, cx - dx, cy - dy);
return 0;
}
commit cda6dec709ca096e8ac3df4d087e445527831a14
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Cleanup conditional code now we require a later GTK version
diff --git a/src/hid/gtk/gui-dialog.c b/src/hid/gtk/gui-dialog.c
index 1f6b11a..80c1157 100644
--- a/src/hid/gtk/gui-dialog.c
+++ b/src/hid/gtk/gui-dialog.c
@@ -229,14 +229,12 @@ ghid_dialog_close_confirm ()
GTK_STOCK_SAVE, GTK_RESPONSE_YES,
NULL);
-#if GTK_CHECK_VERSION (2,6,0)
/* Set the alternative button order (ok, cancel, help) for other systems */
gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog),
GTK_RESPONSE_YES,
GTK_RESPONSE_NO,
GTK_RESPONSE_CANCEL,
-1);
-#endif
switch (gtk_dialog_run (GTK_DIALOG (dialog)))
{
commit 3a02a899c62e2fcbddea0fadea1de2a52bab97c0
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Bump required GTK version in configure.ac test to 2.12
This is required, as we utilise some of the newer APIs.
NB: GTK+ 2.12.0 was released in September 2007
diff --git a/configure.ac b/configure.ac
index abdd8a1..f606faa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -715,8 +715,8 @@ for e in $HIDLIST; do
AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
fi
- PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0, ,
- [AC_MSG_ERROR([Cannot find gtk+ >= 2.4.0, install it and rerun ./configure
+ PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.12.0, ,
+ [AC_MSG_ERROR([Cannot find gtk+ >= 2.12.0, install it and rerun ./configure
Please review the following errors:
$GTK_PKG_ERRORS])]
)
|
|
From: <gi...@gp...> - 2010-12-26 22:22:23
|
The branch, master has been updated
via b99fde814d5c3e1ba6ba02512a5d582376ed9aea (commit)
from 183ff5b416ea26fc99d72a54a7d093310e940cd5 (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 | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
=================
Commit Messages
=================
commit b99fde814d5c3e1ba6ba02512a5d582376ed9aea
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove unused DRAW_Z, VIEW_Z macros
:100644 100644 b814366... ba8b601... M src/hid/gtk/gui.h
=========
Changes
=========
commit b99fde814d5c3e1ba6ba02512a5d582376ed9aea
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove unused DRAW_Z, VIEW_Z macros
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index b814366..ba8b601 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -70,11 +70,9 @@ extern int ghid_flip_x, ghid_flip_y;
#define DRAW_X(x) (gint)((SIDE_X(x) - gport->view_x0) / gport->zoom)
#define DRAW_Y(y) (gint)((SIDE_Y(y) - gport->view_y0) / gport->zoom)
-#define DRAW_Z(z) (gint)((z) / gport->zoom)
#define VIEW_X(x) SIDE_X((gint)((x) * gport->zoom + gport->view_x0))
#define VIEW_Y(y) SIDE_Y((gint)((y) * gport->zoom + gport->view_y0))
-#define VIEW_Z(z) (gint)((z) * gport->zoom)
/*
* Used to intercept "special" hotkeys that gtk doesn't usually pass
|
|
From: <gi...@gp...> - 2010-12-26 22:21:18
|
The branch, master has been updated
via 183ff5b416ea26fc99d72a54a7d093310e940cd5 (commit)
via f2ede77431b363f2ef8f5f9e05e47ffa4858537d (commit)
from 45f77a303f38841f4f50b8b3519a76b33e3e80b8 (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-output-events.c | 8 ++++----
src/hid/gtk/gui-top-window.c | 3 ++-
src/hid/gtk/gui.h | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
=================
Commit Messages
=================
commit 183ff5b416ea26fc99d72a54a7d093310e940cd5
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Don't avoid panning when further X11 events are pending
Since we are using motion hints, we should not get bogged down with
motion events, so we should probably just act upon them.
:100644 100644 a216dd7... 569a09b... M src/hid/gtk/gui-output-events.c
commit f2ede77431b363f2ef8f5f9e05e47ffa4858537d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use motion notify events to avoid too rapid pointer events
Not fixing a specific problem - just a backport from the GL branch.
:100644 100644 4ca6040... a216dd7... M src/hid/gtk/gui-output-events.c
:100644 100644 817c453... 828c524... M src/hid/gtk/gui-top-window.c
:100644 100644 d67db1a... b814366... M src/hid/gtk/gui.h
=========
Changes
=========
commit 183ff5b416ea26fc99d72a54a7d093310e940cd5
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Don't avoid panning when further X11 events are pending
Since we are using motion hints, we should not get bogged down with
motion events, so we should probably just act upon them.
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index a216dd7..569a09b 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -717,8 +717,6 @@ ghid_port_window_motion_cb (GtkWidget * widget,
if (out->panning)
{
- if (gtk_events_pending ())
- return FALSE;
dx = gport->zoom * (x_prev - ev->x);
dy = gport->zoom * (y_prev - ev->y);
if (x_prev > 0)
commit f2ede77431b363f2ef8f5f9e05e47ffa4858537d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use motion notify events to avoid too rapid pointer events
Not fixing a specific problem - just a backport from the GL branch.
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index 4ca6040..a216dd7 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -707,12 +707,14 @@ queue_tooltip_update (GHidPort *out)
gint
ghid_port_window_motion_cb (GtkWidget * widget,
- GdkEventButton * ev, GHidPort * out)
+ GdkEventMotion * ev, GHidPort * out)
{
gdouble dx, dy;
static gint x_prev = -1, y_prev = -1;
gboolean moved;
+ gdk_event_request_motions (ev);
+
if (out->panning)
{
if (gtk_events_pending ())
@@ -726,7 +728,7 @@ ghid_port_window_motion_cb (GtkWidget * widget,
return FALSE;
}
x_prev = y_prev = -1;
- moved = ghid_note_event_location (ev);
+ moved = ghid_note_event_location ((GdkEventButton *)ev);
#if ENABLE_TOOLTIPS
queue_tooltip_update (out);
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 817c453..828c524 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -2299,7 +2299,8 @@ ghid_build_pcb_top_window (void)
| GDK_LEAVE_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK
| GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK
| GDK_KEY_RELEASE_MASK | GDK_KEY_PRESS_MASK
- | GDK_FOCUS_CHANGE_MASK | GDK_POINTER_MOTION_MASK);
+ | GDK_FOCUS_CHANGE_MASK | GDK_POINTER_MOTION_MASK
+ | GDK_POINTER_MOTION_HINT_MASK);
/*
* This is required to get the drawing_area key-press-event. Also the
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index d67db1a..b814366 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -303,7 +303,7 @@ gint ghid_port_window_enter_cb (GtkWidget * widget,
gint ghid_port_window_leave_cb (GtkWidget * widget,
GdkEventCrossing * ev, GHidPort * out);
gint ghid_port_window_motion_cb (GtkWidget * widget,
- GdkEventButton * ev, GHidPort * out);
+ GdkEventMotion * ev, GHidPort * out);
gint ghid_port_window_mouse_scroll_cb (GtkWidget * widget,
GdkEventScroll * ev, GHidPort * out);
|
|
From: <gi...@gp...> - 2010-12-25 02:13:58
|
The branch, master has been updated
via 45f77a303f38841f4f50b8b3519a76b33e3e80b8 (commit)
from cec4118b192773fccba226e1caf15ba401a1123d (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/find.c | 5 ++++-
src/find.h | 2 +-
src/hid/gtk/gui-netlist-window.c | 2 +-
src/hid/lesstif/netlist.c | 2 +-
src/rats.c | 3 ++-
src/select.c | 3 ++-
6 files changed, 11 insertions(+), 6 deletions(-)
=================
Commit Messages
=================
commit 45f77a303f38841f4f50b8b3519a76b33e3e80b8
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Revert undo changes relating to RatFindHook calls
This reverts commit 1aac06b665330507ca42f380e38f32875a979cd9
and commit d3b508ca272b7d89aa27f552ab78943f9bed27f9.
I made a mistake by assuming the undo data saved by the RatFindHook
(when looking up nets to select) was redundant. I had presumed this
since the flags being set are reset again before we finish processing.
What actually happens, is that further processing sets the SELECTED flag
on the FOUND objects. Undo data is saved for the SELECTED flag addition,
which stores the previous flags of the object. When an undo is performed,
it also restores the FOUND flag we wanted to keep unset.
In order to get back to our original state, we need the RatFindHook to
store undo information for when the FOUND flag was initially set.
The ResetConnections() call after the RatFindHook should still be ok
not saving undo information, as it only touches object flags which
will be restored anyway by the undo data now saved by the RatFindHook.
NB: Revert was manually modified to retain an indenting change in find.c
and to add the required changes to select.c, which had additions using
the RatFindHook API since the above reverted commits were made.
:100644 100644 f2f9a92... 613629a... M src/find.c
:100644 100644 11f23e3... 892c7ef... M src/find.h
:100644 100644 3d88554... ce3e2ff... M src/hid/gtk/gui-netlist-window.c
:100644 100644 906eda7... 4ddc240... M src/hid/lesstif/netlist.c
:100644 100644 061f9aa... 3e9d6ee... M src/rats.c
:100644 100644 27a590b... 5d44b4f... M src/select.c
=========
Changes
=========
commit 45f77a303f38841f4f50b8b3519a76b33e3e80b8
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Revert undo changes relating to RatFindHook calls
This reverts commit 1aac06b665330507ca42f380e38f32875a979cd9
and commit d3b508ca272b7d89aa27f552ab78943f9bed27f9.
I made a mistake by assuming the undo data saved by the RatFindHook
(when looking up nets to select) was redundant. I had presumed this
since the flags being set are reset again before we finish processing.
What actually happens, is that further processing sets the SELECTED flag
on the FOUND objects. Undo data is saved for the SELECTED flag addition,
which stores the previous flags of the object. When an undo is performed,
it also restores the FOUND flag we wanted to keep unset.
In order to get back to our original state, we need the RatFindHook to
store undo information for when the FOUND flag was initially set.
The ResetConnections() call after the RatFindHook should still be ok
not saving undo information, as it only touches object flags which
will be restored anyway by the undo data now saved by the RatFindHook.
NB: Revert was manually modified to retain an indenting change in find.c
and to add the required changes to select.c, which had additions using
the RatFindHook API since the above reverted commits were made.
diff --git a/src/find.c b/src/find.c
index f2f9a92..613629a 100644
--- a/src/find.c
+++ b/src/find.c
@@ -3398,11 +3398,14 @@ LookupConnection (LocationType X, LocationType Y, bool AndDraw,
* assumes InitConnectionLookup() has already been done
*/
void
-RatFindHook (int type, void *ptr1, void *ptr2, void *ptr3, bool AndRats)
+RatFindHook (int type, void *ptr1, void *ptr2, void *ptr3,
+ bool undo, bool AndRats)
{
+ User = undo;
DumpList ();
ListStart (type, ptr1, ptr2, ptr3);
DoIt (AndRats, false);
+ User = false;
}
/* ---------------------------------------------------------------------------
diff --git a/src/find.h b/src/find.h
index 11f23e3..892c7ef 100644
--- a/src/find.h
+++ b/src/find.h
@@ -63,7 +63,7 @@ void InitLayoutLookup (void);
void FreeConnectionLookupMemory (void);
void FreeComponentLookupMemory (void);
void FreeLayoutLookupMemory (void);
-void RatFindHook (int, void *, void *, void *, bool);
+void RatFindHook (int, void *, void *, void *, bool, bool);
void SaveFindFlag (int);
void RestoreFindFlag (void);
int DRCAll (void);
diff --git a/src/hid/gtk/gui-netlist-window.c b/src/hid/gtk/gui-netlist-window.c
index 3d88554..ce3e2ff 100644
--- a/src/hid/gtk/gui-netlist-window.c
+++ b/src/hid/gtk/gui-netlist-window.c
@@ -520,7 +520,7 @@ netlist_select_cb (GtkWidget * widget, gpointer data)
for (i = selected_net->EntryN, entry = selected_net->Entry; i; i--, entry++)
if (SeekPad (entry, &conn, false))
- RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true);
+ RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true, true);
SelectConnection (select_flag);
ResetConnections (false);
diff --git a/src/hid/lesstif/netlist.c b/src/hid/lesstif/netlist.c
index 906eda7..4ddc240 100644
--- a/src/hid/lesstif/netlist.c
+++ b/src/hid/lesstif/netlist.c
@@ -140,7 +140,7 @@ nbcb_select_common (LibraryMenuTypePtr net, int pos, int select_flag)
for (i = net->EntryN, entry = net->Entry; i; i--, entry++)
if (SeekPad (entry, &conn, false))
- RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true);
+ RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true, true);
SelectConnection (select_flag);
ResetConncetions (false);
diff --git a/src/rats.c b/src/rats.c
index 061f9aa..3e9d6ee 100644
--- a/src/rats.c
+++ b/src/rats.c
@@ -465,7 +465,8 @@ GatherSubnets (NetListTypePtr Netl, bool NoWarn, bool AndRats)
a = &Netl->Net[m];
ResetConnections (false);
RatFindHook (a->Connection[0].type, a->Connection[0].ptr1,
- a->Connection[0].ptr2, a->Connection[0].ptr2, AndRats);
+ a->Connection[0].ptr2, a->Connection[0].ptr2, false,
+ AndRats);
/* now anybody connected to the first point has DRCFLAG set */
/* so move those to this subnet */
CLEAR_FLAG (DRCFLAG, (PinTypePtr) a->Connection[0].ptr2);
diff --git a/src/select.c b/src/select.c
index 27a590b..5d44b4f 100644
--- a/src/select.c
+++ b/src/select.c
@@ -1029,7 +1029,8 @@ SelectObjectByName (int Type, char *Pattern, bool Flag)
{
for (i = menu->EntryN, entry = menu->Entry; i; i--, entry++)
if (SeekPad (entry, &conn, false))
- RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true);
+ RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2,
+ true, true);
}
}
END_LOOP;
|
|
From: <gi...@gp...> - 2010-12-24 11:57:44
|
The branch, master has been updated
via cec4118b192773fccba226e1caf15ba401a1123d (commit)
via f0cc7b26a2c297fe2c79ac02450087861a6d63a1 (commit)
via 1aac06b665330507ca42f380e38f32875a979cd9 (commit)
via d3b508ca272b7d89aa27f552ab78943f9bed27f9 (commit)
via b8c880c955859d2bc53079b4cafdf8914dafdec2 (commit)
via c80c2af6f06372e35d3fcf4115cd14220b3d16f6 (commit)
via efd212c1deb264e9a7f2be17e9338fbb60e22cc0 (commit)
from e8c699a6f7a954b31d400a5adb429105b0c24b15 (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 | 46 ++++++++++++++++++++++---------
src/autoroute.c | 3 +-
src/const.h | 1 +
src/find.c | 55 +++++++++++++------------------------
src/find.h | 7 +++--
src/hid/gtk/gui-netlist-window.c | 11 +++-----
src/hid/lesstif/netlist.c | 11 +++-----
src/rats.c | 9 ++----
src/report.c | 21 +++++++-------
src/select.c | 27 ++++++++++++++++++
src/set.c | 10 +++---
src/toporouter.c | 3 +-
12 files changed, 112 insertions(+), 92 deletions(-)
=================
Commit Messages
=================
commit cec4118b192773fccba226e1caf15ba401a1123d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Remove Draw() call from ResetFound*() Let the caller do it
This allows multiple changes to be grouped into one repaint operation.
Use this where appropriate, such as the Netlist lookup functions.
:100644 100644 c4c28c0... d8e631f... M src/action.c
:100644 100644 345e670... f2f9a92... M src/find.c
:100644 100644 07ff6b8... f0668d9... M src/report.c
:100644 100644 c5d34eb... 25267d8... M src/set.c
commit f0cc7b26a2c297fe2c79ac02450087861a6d63a1
Author: Martin Kupec <mar...@ku...>
Commit: Peter Clifton <pc...@ca...>
Add NetByName to the select action options
v2: Check Net name appropriately
v3: Ensure we set the changed flag
Reviewed-by: Peter Clifton <pc...@ca...>
:100644 100644 8e01180... c4c28c0... M src/action.c
:100644 100644 676a6f0... e4a1d31... M src/const.h
:100644 100644 87dc661... 27a590b... M src/select.c
commit 1aac06b665330507ca42f380e38f32875a979cd9
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
find.c: Remove "undo" parameter to RatFindHook
Since all callers pass false for the "undo" parameter since the
last commit, remove it from the function prototype.
NB: The file-global variable "User", which it previously set can be
assumed to be false, as it defaults to false - and is restored after
any code which temporarily sets it to true.
:100644 100644 519d0ba... 345e670... M src/find.c
:100644 100644 892c7ef... 11f23e3... M src/find.h
:100644 100644 e780aa4... 3d88554... M src/hid/gtk/gui-netlist-window.c
:100644 100644 0bc4389... 906eda7... M src/hid/lesstif/netlist.c
:100644 100644 3e9d6ee... 061f9aa... M src/rats.c
commit d3b508ca272b7d89aa27f552ab78943f9bed27f9
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
We don't need the RatFindHook to save undo state when doing netlist lookup
We already save undo information to get to a known state when
resetting the FOUND flags. Since we later reset back to this state,
we don't need to save undo data.
:100644 100644 ce3e2ff... e780aa4... M src/hid/gtk/gui-netlist-window.c
:100644 100644 4ddc240... 0bc4389... M src/hid/lesstif/netlist.c
commit b8c880c955859d2bc53079b4cafdf8914dafdec2
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Fix netlist selection to save undo information for wiped "FOUND" flags
When we wipe the found flags on objects, we should also queue them
for redraw - this fixes that too, as the ResetConnections() argument
controls both redraw AND saving undo data.
:100644 100644 addb0d0... ce3e2ff... M src/hid/gtk/gui-netlist-window.c
:100644 100644 a2d3507... 4ddc240... M src/hid/lesstif/netlist.c
commit c80c2af6f06372e35d3fcf4115cd14220b3d16f6
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Remove unneeded Undo serial number save / restore in netlist lookup
The RatFindHook function does not call anything which will increment
the Undo serial number, so the save / restore calls are not required.
:100644 100644 96315b4... addb0d0... M src/hid/gtk/gui-netlist-window.c
:100644 100644 bf48b09... a2d3507... M src/hid/lesstif/netlist.c
commit efd212c1deb264e9a7f2be17e9338fbb60e22cc0
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Fix broken undo handling for ResetFound*() and ResetConnections()
Many callers have this idiom:
SaveUndoSerialNumber ();
ResetFoundPinsViasAndPads (AndDraw);
RestoreUndoSerialNumber ();
ResetFoundLinesAndPolygons (AndDraw);
The intent is to squash the two operations into one undo operation. The
ResetFound* functions DO increment the Undo serial number but ONLY if
that particular function makes a change.
Assume for the example that the first ResetFound* call makes some change
and increments the serial number. This is then reset by the caller. If
the second ResetFound* call doesn't find anything, there is no overall
increment to the serial number.
Move the undo serial number handling out of the ResetFound* calls, and
let the callers increment the serial number if desired. To facilitate
this, return a boolean value from these functions to indicate whether
any changes were made which could be undone.
For convenience, expose previously static find.c function
ResetConnections() in order to avoid repeating Undo handling in each
caller to the two ResetFound* functions which are often called together.
:100644 100644 7a9c3f0... 8e01180... M src/action.c
:100644 100644 9ccab97... 976ef09... M src/autoroute.c
:100644 100644 3176357... 519d0ba... M src/find.c
:100644 100644 5b04980... 892c7ef... M src/find.h
:100644 100644 cee63da... 96315b4... M src/hid/gtk/gui-netlist-window.c
:100644 100644 3438b33... bf48b09... M src/hid/lesstif/netlist.c
:100644 100644 5fe86cd... 3e9d6ee... M src/rats.c
:100644 100644 a9c429d... 07ff6b8... M src/report.c
:100644 100644 7a41f73... c5d34eb... M src/set.c
:100644 100644 88c1325... bfd494a... M src/toporouter.c
=========
Changes
=========
commit cec4118b192773fccba226e1caf15ba401a1123d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Remove Draw() call from ResetFound*() Let the caller do it
This allows multiple changes to be grouped into one repaint operation.
Use this where appropriate, such as the Netlist lookup functions.
diff --git a/src/action.c b/src/action.c
index c4c28c0..d8e631f 100644
--- a/src/action.c
+++ b/src/action.c
@@ -2365,17 +2365,26 @@ ActionConnection (int argc, char **argv, int x, int y)
case F_ResetLinesAndPolygons:
if (ResetFoundLinesAndPolygons (true))
- IncrementUndoSerialNumber ();
+ {
+ IncrementUndoSerialNumber ();
+ Draw ();
+ }
break;
case F_ResetPinsViasAndPads:
if (ResetFoundPinsViasAndPads (true))
- IncrementUndoSerialNumber ();
+ {
+ IncrementUndoSerialNumber ();
+ Draw ();
+ }
break;
case F_Reset:
if (ResetConnections (true))
- IncrementUndoSerialNumber ();
+ {
+ IncrementUndoSerialNumber ();
+ Draw ();
+ }
break;
}
RestoreCrosshair (true);
@@ -2789,7 +2798,10 @@ ActionDisplay (int argc, char **argv, int childX, int childY)
if (TEST_FLAG (AUTODRCFLAG, PCB) && Settings.Mode == LINE_MODE)
{
if (ResetConnections (true))
- IncrementUndoSerialNumber ();
+ {
+ IncrementUndoSerialNumber ();
+ Draw ();
+ }
if (Crosshair.AttachedLine.State != STATE_FIRST)
LookupConnection (Crosshair.AttachedLine.Point1.X,
Crosshair.AttachedLine.Point1.Y, true, 1,
diff --git a/src/find.c b/src/find.c
index 345e670..f2f9a92 100644
--- a/src/find.c
+++ b/src/find.c
@@ -3486,11 +3486,7 @@ ResetFoundPinsViasAndPads (bool AndDraw)
}
END_LOOP;
if (change)
- {
- SetChangedFlag (true);
- if (AndDraw)
- Draw ();
- }
+ SetChangedFlag (true);
return change;
}
@@ -3555,11 +3551,7 @@ ResetFoundLinesAndPolygons (bool AndDraw)
}
ENDALL_LOOP;
if (change)
- {
- SetChangedFlag (true);
- if (AndDraw)
- Draw ();
- }
+ SetChangedFlag (true);
return change;
}
@@ -3922,7 +3914,10 @@ DRCAll (void)
TheFlag = FOUNDFLAG | DRCFLAG | SELECTEDFLAG;
if (ResetConnections (true))
- IncrementUndoSerialNumber ();
+ {
+ IncrementUndoSerialNumber ();
+ Draw ();
+ }
User = false;
diff --git a/src/report.c b/src/report.c
index 07ff6b8..f0668d9 100644
--- a/src/report.c
+++ b/src/report.c
@@ -46,6 +46,7 @@
#include "macro.h"
#include "undo.h"
#include "find.h"
+#include "draw.h"
#ifdef HAVE_LIBDMALLOC
#include <dmalloc.h>
@@ -688,7 +689,8 @@ ReportAllNetLengths (int argc, char **argv, int x, int y)
continue;
got_one:
- ResetConnections (true);
+ if (ResetConnections (true))
+ Draw ();
/* NB: XYtoNetLength calls LookupConnection, which performs an undo
* serial number update, so we don't need to add one here.
*/
@@ -706,7 +708,8 @@ ReportNetLength (int argc, char **argv, int x, int y)
char *netname = 0;
int found = 0;
- ResetConnections (true);
+ if (ResetConnections (true))
+ Draw ();
/* NB: XYtoNetLength calls LookupConnection, which performs an undo
* serial number update, so we don't need to add one here.
*/
diff --git a/src/set.c b/src/set.c
index c5d34eb..25267d8 100644
--- a/src/set.c
+++ b/src/set.c
@@ -293,7 +293,10 @@ SetMode (int Mode)
if (Mode == LINE_MODE && TEST_FLAG (AUTODRCFLAG, PCB))
{
if (ResetConnections (true))
- IncrementUndoSerialNumber ();
+ {
+ IncrementUndoSerialNumber ();
+ Draw ();
+ }
}
}
commit f0cc7b26a2c297fe2c79ac02450087861a6d63a1
Author: Martin Kupec <mar...@ku...>
Commit: Peter Clifton <pc...@ca...>
Add NetByName to the select action options
v2: Check Net name appropriately
v3: Ensure we set the changed flag
Reviewed-by: Peter Clifton <pc...@ca...>
diff --git a/src/action.c b/src/action.c
index 8e01180..c4c28c0 100644
--- a/src/action.c
+++ b/src/action.c
@@ -135,6 +135,7 @@ typedef enum
F_Move,
F_NameOnPCB,
F_Netlist,
+ F_NetByName,
F_None,
F_Notify,
F_Object,
@@ -371,6 +372,7 @@ static FunctionType Functions[] = {
{"Move", F_Move},
{"NameOnPCB", F_NameOnPCB},
{"Netlist", F_Netlist},
+ {"NetByName", F_NetByName},
{"None", F_None},
{"Notify", F_Notify},
{"Object", F_Object},
@@ -5343,8 +5345,9 @@ static const char select_syntax[] =
"Select(All|Block|Connection)\n"
"Select(ElementByName|ObjectByName|PadByName|PinByName)\n"
"Select(ElementByName|ObjectByName|PadByName|PinByName, Name)\n"
- "Select(TextByName|ViaByName)\n"
- "Select(TextByName|ViaByName, Name)\n" "Select(Convert)";
+ "Select(TextByName|ViaByName|NetByName)\n"
+ "Select(TextByName|ViaByName|NetByName, Name)\n"
+ "Select(Convert)";
static const char select_help[] = "Toggles or sets the selection";
@@ -5358,6 +5361,7 @@ static const char select_help[] = "Toggles or sets the selection";
@item PinByName
@item TextByName
@item ViaByName
+@item NetByName
These all rely on having a regular expression parser built into
@code{pcb}. If the name is not specified then the user is prompted
@@ -5391,7 +5395,6 @@ ActionSelect (int argc, char **argv, int x, int y)
char *function = ARG (0);
if (function)
{
-
HideCrosshair (true);
switch (GetFunctionID (function))
{
@@ -5416,6 +5419,9 @@ ActionSelect (int argc, char **argv, int x, int y)
case F_ViaByName:
type = VIA_TYPE;
goto commonByName;
+ case F_NetByName:
+ type = NET_TYPE;
+ goto commonByName;
commonByName:
{
@@ -5573,7 +5579,6 @@ static int
ActionUnselect (int argc, char **argv, int x, int y)
{
char *function = ARG (0);
-
if (function)
{
HideCrosshair (true);
@@ -5600,6 +5605,9 @@ ActionUnselect (int argc, char **argv, int x, int y)
case F_ViaByName:
type = VIA_TYPE;
goto commonByName;
+ case F_NetByName:
+ type = NET_TYPE;
+ goto commonByName;
commonByName:
{
diff --git a/src/const.h b/src/const.h
index 676a6f0..e4a1d31 100644
--- a/src/const.h
+++ b/src/const.h
@@ -310,6 +310,7 @@ When set, element names are not drawn.
#define ELEMENTARC_TYPE 0x08000
#define LOCKED_TYPE 0x10000 /* used to tell search to include locked items. */
+#define NET_TYPE 0x20000 /* used to select whole net. */
#define PIN_TYPES (VIA_TYPE | PIN_TYPE)
#define LOCK_TYPES (VIA_TYPE | LINE_TYPE | ARC_TYPE | POLYGON_TYPE | ELEMENT_TYPE \
diff --git a/src/select.c b/src/select.c
index 87dc661..27a590b 100644
--- a/src/select.c
+++ b/src/select.c
@@ -44,6 +44,7 @@
#include "undo.h"
#include "rats.h"
#include "misc.h"
+#include "find.h"
#include <sys/types.h>
#ifdef HAVE_REGEX_H
@@ -1011,6 +1012,32 @@ SelectObjectByName (int Type, char *Pattern, bool Flag)
}
}
END_LOOP;
+ if (Type & NET_TYPE)
+ {
+ InitConnectionLookup ();
+ changed = ResetConnections (true) || changed;
+
+ MENU_LOOP (&PCB->NetlistLib);
+ {
+ Cardinal i;
+ LibraryEntryType *entry;
+ ConnectionType conn;
+
+ /* Name[0] and Name[1] are special purpose, not the actual name*/
+ if (menu->Name && menu->Name[0] != '\0' && menu->Name[1] != '\0' &&
+ REGEXEC (menu->Name + 2))
+ {
+ for (i = menu->EntryN, entry = menu->Entry; i; i--, entry++)
+ if (SeekPad (entry, &conn, false))
+ RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true);
+ }
+ }
+ END_LOOP;
+
+ changed = SelectConnection (Flag) || changed;
+ changed = ResetConnections (false) || changed;
+ FreeConnectionLookupMemory ();
+ }
#if defined(HAVE_REGCOMP)
#if !defined(sgi)
commit 1aac06b665330507ca42f380e38f32875a979cd9
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
find.c: Remove "undo" parameter to RatFindHook
Since all callers pass false for the "undo" parameter since the
last commit, remove it from the function prototype.
NB: The file-global variable "User", which it previously set can be
assumed to be false, as it defaults to false - and is restored after
any code which temporarily sets it to true.
diff --git a/src/find.c b/src/find.c
index 519d0ba..345e670 100644
--- a/src/find.c
+++ b/src/find.c
@@ -3398,15 +3398,11 @@ LookupConnection (LocationType X, LocationType Y, bool AndDraw,
* assumes InitConnectionLookup() has already been done
*/
void
- RatFindHook
- (int type, void *ptr1, void *ptr2, void *ptr3, bool undo,
- bool AndRats)
+RatFindHook (int type, void *ptr1, void *ptr2, void *ptr3, bool AndRats)
{
- User = undo;
DumpList ();
ListStart (type, ptr1, ptr2, ptr3);
DoIt (AndRats, false);
- User = false;
}
/* ---------------------------------------------------------------------------
diff --git a/src/find.h b/src/find.h
index 892c7ef..11f23e3 100644
--- a/src/find.h
+++ b/src/find.h
@@ -63,7 +63,7 @@ void InitLayoutLookup (void);
void FreeConnectionLookupMemory (void);
void FreeComponentLookupMemory (void);
void FreeLayoutLookupMemory (void);
-void RatFindHook (int, void *, void *, void *, bool, bool);
+void RatFindHook (int, void *, void *, void *, bool);
void SaveFindFlag (int);
void RestoreFindFlag (void);
int DRCAll (void);
diff --git a/src/hid/gtk/gui-netlist-window.c b/src/hid/gtk/gui-netlist-window.c
index e780aa4..3d88554 100644
--- a/src/hid/gtk/gui-netlist-window.c
+++ b/src/hid/gtk/gui-netlist-window.c
@@ -520,7 +520,7 @@ netlist_select_cb (GtkWidget * widget, gpointer data)
for (i = selected_net->EntryN, entry = selected_net->Entry; i; i--, entry++)
if (SeekPad (entry, &conn, false))
- RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, false, true);
+ RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true);
SelectConnection (select_flag);
ResetConnections (false);
diff --git a/src/hid/lesstif/netlist.c b/src/hid/lesstif/netlist.c
index 0bc4389..906eda7 100644
--- a/src/hid/lesstif/netlist.c
+++ b/src/hid/lesstif/netlist.c
@@ -140,7 +140,7 @@ nbcb_select_common (LibraryMenuTypePtr net, int pos, int select_flag)
for (i = net->EntryN, entry = net->Entry; i; i--, entry++)
if (SeekPad (entry, &conn, false))
- RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, false, true);
+ RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true);
SelectConnection (select_flag);
ResetConncetions (false);
diff --git a/src/rats.c b/src/rats.c
index 3e9d6ee..061f9aa 100644
--- a/src/rats.c
+++ b/src/rats.c
@@ -465,8 +465,7 @@ GatherSubnets (NetListTypePtr Netl, bool NoWarn, bool AndRats)
a = &Netl->Net[m];
ResetConnections (false);
RatFindHook (a->Connection[0].type, a->Connection[0].ptr1,
- a->Connection[0].ptr2, a->Connection[0].ptr2, false,
- AndRats);
+ a->Connection[0].ptr2, a->Connection[0].ptr2, AndRats);
/* now anybody connected to the first point has DRCFLAG set */
/* so move those to this subnet */
CLEAR_FLAG (DRCFLAG, (PinTypePtr) a->Connection[0].ptr2);
commit d3b508ca272b7d89aa27f552ab78943f9bed27f9
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
We don't need the RatFindHook to save undo state when doing netlist lookup
We already save undo information to get to a known state when
resetting the FOUND flags. Since we later reset back to this state,
we don't need to save undo data.
diff --git a/src/hid/gtk/gui-netlist-window.c b/src/hid/gtk/gui-netlist-window.c
index ce3e2ff..e780aa4 100644
--- a/src/hid/gtk/gui-netlist-window.c
+++ b/src/hid/gtk/gui-netlist-window.c
@@ -520,7 +520,7 @@ netlist_select_cb (GtkWidget * widget, gpointer data)
for (i = selected_net->EntryN, entry = selected_net->Entry; i; i--, entry++)
if (SeekPad (entry, &conn, false))
- RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true, true);
+ RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, false, true);
SelectConnection (select_flag);
ResetConnections (false);
diff --git a/src/hid/lesstif/netlist.c b/src/hid/lesstif/netlist.c
index 4ddc240..0bc4389 100644
--- a/src/hid/lesstif/netlist.c
+++ b/src/hid/lesstif/netlist.c
@@ -140,7 +140,7 @@ nbcb_select_common (LibraryMenuTypePtr net, int pos, int select_flag)
for (i = net->EntryN, entry = net->Entry; i; i--, entry++)
if (SeekPad (entry, &conn, false))
- RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true, true);
+ RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, false, true);
SelectConnection (select_flag);
ResetConncetions (false);
commit b8c880c955859d2bc53079b4cafdf8914dafdec2
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Fix netlist selection to save undo information for wiped "FOUND" flags
When we wipe the found flags on objects, we should also queue them
for redraw - this fixes that too, as the ResetConnections() argument
controls both redraw AND saving undo data.
diff --git a/src/hid/gtk/gui-netlist-window.c b/src/hid/gtk/gui-netlist-window.c
index addb0d0..ce3e2ff 100644
--- a/src/hid/gtk/gui-netlist-window.c
+++ b/src/hid/gtk/gui-netlist-window.c
@@ -516,7 +516,7 @@ netlist_select_cb (GtkWidget * widget, gpointer data)
node_selected_net = NULL;
InitConnectionLookup ();
- ResetConnections (false);
+ ResetConnections (true);
for (i = selected_net->EntryN, entry = selected_net->Entry; i; i--, entry++)
if (SeekPad (entry, &conn, false))
diff --git a/src/hid/lesstif/netlist.c b/src/hid/lesstif/netlist.c
index a2d3507..4ddc240 100644
--- a/src/hid/lesstif/netlist.c
+++ b/src/hid/lesstif/netlist.c
@@ -136,7 +136,7 @@ nbcb_select_common (LibraryMenuTypePtr net, int pos, int select_flag)
int i;
InitConnectionLookup ();
- ResetConnections (false);
+ ResetConnections (true);
for (i = net->EntryN, entry = net->Entry; i; i--, entry++)
if (SeekPad (entry, &conn, false))
commit c80c2af6f06372e35d3fcf4115cd14220b3d16f6
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Remove unneeded Undo serial number save / restore in netlist lookup
The RatFindHook function does not call anything which will increment
the Undo serial number, so the save / restore calls are not required.
diff --git a/src/hid/gtk/gui-netlist-window.c b/src/hid/gtk/gui-netlist-window.c
index 96315b4..addb0d0 100644
--- a/src/hid/gtk/gui-netlist-window.c
+++ b/src/hid/gtk/gui-netlist-window.c
@@ -518,11 +518,9 @@ netlist_select_cb (GtkWidget * widget, gpointer data)
InitConnectionLookup ();
ResetConnections (false);
- SaveUndoSerialNumber ();
for (i = selected_net->EntryN, entry = selected_net->Entry; i; i--, entry++)
if (SeekPad (entry, &conn, false))
RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true, true);
- RestoreUndoSerialNumber ();
SelectConnection (select_flag);
ResetConnections (false);
diff --git a/src/hid/lesstif/netlist.c b/src/hid/lesstif/netlist.c
index bf48b09..a2d3507 100644
--- a/src/hid/lesstif/netlist.c
+++ b/src/hid/lesstif/netlist.c
@@ -138,11 +138,9 @@ nbcb_select_common (LibraryMenuTypePtr net, int pos, int select_flag)
InitConnectionLookup ();
ResetConnections (false);
- SaveUndoSerialNumber ();
for (i = net->EntryN, entry = net->Entry; i; i--, entry++)
if (SeekPad (entry, &conn, false))
RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true, true);
- RestoreUndoSerialNumber ();
SelectConnection (select_flag);
ResetConncetions (false);
commit efd212c1deb264e9a7f2be17e9338fbb60e22cc0
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Fix broken undo handling for ResetFound*() and ResetConnections()
Many callers have this idiom:
SaveUndoSerialNumber ();
ResetFoundPinsViasAndPads (AndDraw);
RestoreUndoSerialNumber ();
ResetFoundLinesAndPolygons (AndDraw);
The intent is to squash the two operations into one undo operation. The
ResetFound* functions DO increment the Undo serial number but ONLY if
that particular function makes a change.
Assume for the example that the first ResetFound* call makes some change
and increments the serial number. This is then reset by the caller. If
the second ResetFound* call doesn't find anything, there is no overall
increment to the serial number.
Move the undo serial number handling out of the ResetFound* calls, and
let the callers increment the serial number if desired. To facilitate
this, return a boolean value from these functions to indicate whether
any changes were made which could be undone.
For convenience, expose previously static find.c function
ResetConnections() in order to avoid repeating Undo handling in each
caller to the two ResetFound* functions which are often called together.
diff --git a/src/action.c b/src/action.c
index 7a9c3f0..8e01180 100644
--- a/src/action.c
+++ b/src/action.c
@@ -2362,18 +2362,18 @@ ActionConnection (int argc, char **argv, int x, int y)
}
case F_ResetLinesAndPolygons:
- ResetFoundLinesAndPolygons (true);
+ if (ResetFoundLinesAndPolygons (true))
+ IncrementUndoSerialNumber ();
break;
case F_ResetPinsViasAndPads:
- ResetFoundPinsViasAndPads (true);
+ if (ResetFoundPinsViasAndPads (true))
+ IncrementUndoSerialNumber ();
break;
case F_Reset:
- SaveUndoSerialNumber ();
- ResetFoundPinsViasAndPads (true);
- RestoreUndoSerialNumber ();
- ResetFoundLinesAndPolygons (true);
+ if (ResetConnections (true))
+ IncrementUndoSerialNumber ();
break;
}
RestoreCrosshair (true);
@@ -2786,10 +2786,8 @@ ActionDisplay (int argc, char **argv, int childX, int childY)
TOGGLE_FLAG (AUTODRCFLAG, PCB);
if (TEST_FLAG (AUTODRCFLAG, PCB) && Settings.Mode == LINE_MODE)
{
- SaveUndoSerialNumber ();
- ResetFoundPinsViasAndPads (true);
- RestoreUndoSerialNumber ();
- ResetFoundLinesAndPolygons (true);
+ if (ResetConnections (true))
+ IncrementUndoSerialNumber ();
if (Crosshair.AttachedLine.State != STATE_FIRST)
LookupConnection (Crosshair.AttachedLine.Point1.X,
Crosshair.AttachedLine.Point1.Y, true, 1,
diff --git a/src/autoroute.c b/src/autoroute.c
index 9ccab97..976ef09 100644
--- a/src/autoroute.c
+++ b/src/autoroute.c
@@ -985,8 +985,7 @@ CreateRouteData ()
* this saves on searching the trees to find the nets
*/
/* use the DRCFLAG to mark objects as they are entered */
- ResetFoundPinsViasAndPads (false);
- ResetFoundLinesAndPolygons (false);
+ ResetConnections (false);
Nets = CollectSubnets (false);
{
routebox_t *last_net = NULL;
diff --git a/src/find.c b/src/find.c
index 3176357..519d0ba 100644
--- a/src/find.c
+++ b/src/find.c
@@ -345,7 +345,6 @@ static void PrintPinConnections (FILE *, bool);
static bool PrintAndSelectUnusedPinsAndPadsOfElement (ElementTypePtr,
FILE *);
static void DrawNewConnections (void);
-static void ResetConnections (bool);
static void DumpList (void);
static void LocateError (LocationType *, LocationType *);
static void BuildObjectList (int *, long int **, int **);
@@ -3418,9 +3417,7 @@ LookupUnusedPins (FILE * FP)
{
/* reset all currently marked connections */
User = true;
- SaveUndoSerialNumber ();
ResetConnections (true);
- RestoreUndoSerialNumber ();
InitConnectionLookup ();
ELEMENT_LOOP (PCB->Data);
@@ -3444,12 +3441,11 @@ LookupUnusedPins (FILE * FP)
/* ---------------------------------------------------------------------------
* resets all used flags of pins and vias
*/
-void
+bool
ResetFoundPinsViasAndPads (bool AndDraw)
{
bool change = false;
-
VIA_LOOP (PCB->Data);
{
if (TEST_FLAG (TheFlag, via))
@@ -3497,22 +3493,19 @@ ResetFoundPinsViasAndPads (bool AndDraw)
{
SetChangedFlag (true);
if (AndDraw)
- {
- IncrementUndoSerialNumber ();
- Draw ();
- }
+ Draw ();
}
+ return change;
}
/* ---------------------------------------------------------------------------
* resets all used flags of LOs
*/
-void
+bool
ResetFoundLinesAndPolygons (bool AndDraw)
{
bool change = false;
-
RAT_LOOP (PCB->Data);
{
if (TEST_FLAG (TheFlag, line))
@@ -3569,25 +3562,23 @@ ResetFoundLinesAndPolygons (bool AndDraw)
{
SetChangedFlag (true);
if (AndDraw)
- {
- IncrementUndoSerialNumber ();
- Draw ();
- }
+ Draw ();
}
+ return change;
}
/* ---------------------------------------------------------------------------
* resets all found connections
*/
-static void
+bool
ResetConnections (bool AndDraw)
{
- if (AndDraw)
- SaveUndoSerialNumber ();
- ResetFoundPinsViasAndPads (AndDraw);
- if (AndDraw)
- RestoreUndoSerialNumber ();
- ResetFoundLinesAndPolygons (AndDraw);
+ bool change = false;
+
+ change = ResetFoundPinsViasAndPads (AndDraw) || change;
+ change = ResetFoundLinesAndPolygons (AndDraw) || change;
+
+ return change;
}
/*----------------------------------------------------------------------------
@@ -3934,7 +3925,8 @@ DRCAll (void)
TheFlag = FOUNDFLAG | DRCFLAG | SELECTEDFLAG;
- ResetConnections (true);
+ if (ResetConnections (true))
+ IncrementUndoSerialNumber ();
User = false;
diff --git a/src/find.h b/src/find.h
index 5b04980..892c7ef 100644
--- a/src/find.h
+++ b/src/find.h
@@ -54,8 +54,9 @@ void LookupElementConnections (ElementTypePtr, FILE *);
void LookupConnectionsToAllElements (FILE *);
void LookupConnection (LocationType, LocationType, bool, BDimension, int);
void LookupUnusedPins (FILE *);
-void ResetFoundLinesAndPolygons (bool);
-void ResetFoundPinsViasAndPads (bool);
+bool ResetFoundLinesAndPolygons (bool);
+bool ResetFoundPinsViasAndPads (bool);
+bool ResetConnections (bool);
void InitConnectionLookup (void);
void InitComponentLookup (void);
void InitLayoutLookup (void);
diff --git a/src/hid/gtk/gui-netlist-window.c b/src/hid/gtk/gui-netlist-window.c
index cee63da..96315b4 100644
--- a/src/hid/gtk/gui-netlist-window.c
+++ b/src/hid/gtk/gui-netlist-window.c
@@ -516,17 +516,16 @@ netlist_select_cb (GtkWidget * widget, gpointer data)
node_selected_net = NULL;
InitConnectionLookup ();
- ResetFoundPinsViasAndPads (false);
- ResetFoundLinesAndPolygons (false);
- SaveUndoSerialNumber ();
+ ResetConnections (false);
+ SaveUndoSerialNumber ();
for (i = selected_net->EntryN, entry = selected_net->Entry; i; i--, entry++)
if (SeekPad (entry, &conn, false))
RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true, true);
RestoreUndoSerialNumber ();
+
SelectConnection (select_flag);
- ResetFoundPinsViasAndPads (false);
- ResetFoundLinesAndPolygons (false);
+ ResetConnections (false);
FreeConnectionLookupMemory ();
IncrementUndoSerialNumber ();
Draw ();
diff --git a/src/hid/lesstif/netlist.c b/src/hid/lesstif/netlist.c
index 3438b33..bf48b09 100644
--- a/src/hid/lesstif/netlist.c
+++ b/src/hid/lesstif/netlist.c
@@ -136,17 +136,16 @@ nbcb_select_common (LibraryMenuTypePtr net, int pos, int select_flag)
int i;
InitConnectionLookup ();
- ResetFoundPinsViasAndPads (false);
- ResetFoundLinesAndPolygons (false);
- SaveUndoSerialNumber ();
+ ResetConnections (false);
+ SaveUndoSerialNumber ();
for (i = net->EntryN, entry = net->Entry; i; i--, entry++)
if (SeekPad (entry, &conn, false))
RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true, true);
RestoreUndoSerialNumber ();
+
SelectConnection (select_flag);
- ResetFoundPinsViasAndPads (false);
- ResetFoundLinesAndPolygons (false);
+ ResetConncetions (false);
FreeConnectionLookupMemory ();
IncrementUndoSerialNumber ();
Draw ();
diff --git a/src/rats.c b/src/rats.c
index 5fe86cd..3e9d6ee 100644
--- a/src/rats.c
+++ b/src/rats.c
@@ -463,8 +463,7 @@ GatherSubnets (NetListTypePtr Netl, bool NoWarn, bool AndRats)
for (m = 0; Netl->NetN > 0 && m < Netl->NetN; m++)
{
a = &Netl->Net[m];
- ResetFoundPinsViasAndPads (false);
- ResetFoundLinesAndPolygons (false);
+ ResetConnections (false);
RatFindHook (a->Connection[0].type, a->Connection[0].ptr1,
a->Connection[0].ptr2, a->Connection[0].ptr2, false,
AndRats);
@@ -545,8 +544,7 @@ GatherSubnets (NetListTypePtr Netl, bool NoWarn, bool AndRats)
if (!NoWarn)
Warned |= CheckShorts (a->Connection[0].menu);
}
- ResetFoundPinsViasAndPads (false);
- ResetFoundLinesAndPolygons (false);
+ ResetConnections (false);
return (Warned);
}
diff --git a/src/report.c b/src/report.c
index a9c429d..07ff6b8 100644
--- a/src/report.c
+++ b/src/report.c
@@ -688,11 +688,10 @@ ReportAllNetLengths (int argc, char **argv, int x, int y)
continue;
got_one:
- SaveUndoSerialNumber ();
- ResetFoundPinsViasAndPads (true);
- RestoreUndoSerialNumber ();
- ResetFoundLinesAndPolygons (true);
- RestoreUndoSerialNumber ();
+ ResetConnections (true);
+ /* NB: XYtoNetLength calls LookupConnection, which performs an undo
+ * serial number update, so we don't need to add one here.
+ */
length = XYtoNetLength (x, y, &found);
gui->log("Net %s length %.*f %s\n", netname, prec, length*scale, units_name);
@@ -707,11 +706,10 @@ ReportNetLength (int argc, char **argv, int x, int y)
char *netname = 0;
int found = 0;
- SaveUndoSerialNumber ();
- ResetFoundPinsViasAndPads (true);
- RestoreUndoSerialNumber ();
- ResetFoundLinesAndPolygons (true);
- RestoreUndoSerialNumber ();
+ ResetConnections (true);
+ /* NB: XYtoNetLength calls LookupConnection, which performs an undo
+ * serial number update, so we don't need to add one here.
+ */
gui->get_coords ("Click on a connection", &x, &y);
length = XYtoNetLength (x, y, &found);
diff --git a/src/set.c b/src/set.c
index 7a41f73..c5d34eb 100644
--- a/src/set.c
+++ b/src/set.c
@@ -292,11 +292,8 @@ SetMode (int Mode)
Crosshair.AttachedLine.State = STATE_FIRST;
if (Mode == LINE_MODE && TEST_FLAG (AUTODRCFLAG, PCB))
{
- SaveUndoSerialNumber ();
- ResetFoundPinsViasAndPads (true);
- RestoreUndoSerialNumber ();
- ResetFoundLinesAndPolygons (true);
- IncrementUndoSerialNumber ();
+ if (ResetConnections (true))
+ IncrementUndoSerialNumber ();
}
}
diff --git a/src/toporouter.c b/src/toporouter.c
index 88c1325..bfd494a 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -2799,8 +2799,7 @@ void
import_clusters(toporouter_t *r)
{
NetListListType nets;
- ResetFoundPinsViasAndPads (false);
- ResetFoundLinesAndPolygons (false);
+ ResetConnections (false);
nets = CollectSubnets(false);
NETLIST_LOOP(&nets);
{
|
|
From: <gi...@gp...> - 2010-12-23 11:48:42
|
The branch, master has been updated
via e8c699a6f7a954b31d400a5adb429105b0c24b15 (commit)
from a5515fcf70379ee8115f32e83cf115552e68df73 (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 | 2 ++
src/hid/gtk/gui-netlist-window.c | 2 +-
src/hid/lesstif/netlist.c | 1 +
src/select.c | 1 -
4 files changed, 4 insertions(+), 2 deletions(-)
=================
Commit Messages
=================
commit e8c699a6f7a954b31d400a5adb429105b0c24b15
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
select.c: Remove Draw() call from SelectConnection
Make callers responsible for calling the final Draw(), to avoid
multiple redraws if other operations are to occur, such as changing
"FOUND" flags on objects after making the selection.
:100644 100644 ba1fbed... 7a9c3f0... M src/action.c
:100644 100644 1d8e939... cee63da... M src/hid/gtk/gui-netlist-window.c
:100644 100644 ee6d723... 3438b33... M src/hid/lesstif/netlist.c
:100644 100644 c4b5e17... 87dc661... M src/select.c
=========
Changes
=========
commit e8c699a6f7a954b31d400a5adb429105b0c24b15
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
select.c: Remove Draw() call from SelectConnection
Make callers responsible for calling the final Draw(), to avoid
multiple redraws if other operations are to occur, such as changing
"FOUND" flags on objects after making the selection.
diff --git a/src/action.c b/src/action.c
index ba1fbed..7a9c3f0 100644
--- a/src/action.c
+++ b/src/action.c
@@ -5484,6 +5484,7 @@ ActionSelect (int argc, char **argv, int x, int y)
case F_Connection:
if (SelectConnection (true))
{
+ Draw ();
IncrementUndoSerialNumber ();
SetChangedFlag (true);
}
@@ -5660,6 +5661,7 @@ ActionUnselect (int argc, char **argv, int x, int y)
case F_Connection:
if (SelectConnection (false))
{
+ Draw ();
IncrementUndoSerialNumber ();
SetChangedFlag (true);
}
diff --git a/src/hid/gtk/gui-netlist-window.c b/src/hid/gtk/gui-netlist-window.c
index 1d8e939..cee63da 100644
--- a/src/hid/gtk/gui-netlist-window.c
+++ b/src/hid/gtk/gui-netlist-window.c
@@ -529,7 +529,7 @@ netlist_select_cb (GtkWidget * widget, gpointer data)
ResetFoundLinesAndPolygons (false);
FreeConnectionLookupMemory ();
IncrementUndoSerialNumber ();
- ghid_invalidate_all ();
+ Draw ();
}
static void
diff --git a/src/hid/lesstif/netlist.c b/src/hid/lesstif/netlist.c
index ee6d723..3438b33 100644
--- a/src/hid/lesstif/netlist.c
+++ b/src/hid/lesstif/netlist.c
@@ -149,6 +149,7 @@ nbcb_select_common (LibraryMenuTypePtr net, int pos, int select_flag)
ResetFoundLinesAndPolygons (false);
FreeConnectionLookupMemory ();
IncrementUndoSerialNumber ();
+ Draw ();
}
static void
diff --git a/src/select.c b/src/select.c
index c4b5e17..87dc661 100644
--- a/src/select.c
+++ b/src/select.c
@@ -850,7 +850,6 @@ SelectConnection (bool Flag)
}
}
END_LOOP;
- Draw ();
return (changed);
}
|
|
From: <gi...@gp...> - 2010-12-23 09:48:57
|
The branch, master has been updated
via a5515fcf70379ee8115f32e83cf115552e68df73 (commit)
from 7f9432d189a8824a418da803a43cf02d1d0916b8 (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/free_atexit.h | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
=================
Commit Messages
=================
commit a5515fcf70379ee8115f32e83cf115552e68df73
Author: Patrick Bernaud <pat...@ch...>
Commit: Peter Clifton <pc...@ca...>
Fix substitutions for leaky_*alloc functions
:100644 100644 558b597... fb53b51... M src/free_atexit.h
=========
Changes
=========
commit a5515fcf70379ee8115f32e83cf115552e68df73
Author: Patrick Bernaud <pat...@ch...>
Commit: Peter Clifton <pc...@ca...>
Fix substitutions for leaky_*alloc functions
diff --git a/src/free_atexit.h b/src/free_atexit.h
index 558b597..fb53b51 100644
--- a/src/free_atexit.h
+++ b/src/free_atexit.h
@@ -11,7 +11,8 @@
#define leaky_init()
#define leaky_uninit()
#define leaky_malloc(size) malloc(size)
-#define leaky_realloc(ptr, size) malloc(ptr, size)
+#define leaky_calloc(nmemb, size) calloc(nmemb, size)
+#define leaky_realloc(old_memory, size) realloc(old_memory, size)
#else
/* set up atexit() hook - can be avoided if leaky_uninit() is called by hand */
|
|
From: <gi...@gp...> - 2010-12-22 22:32:16
|
The branch, master has been updated
discards 884ad7ecaf59bf946d75ef8dd5bc3d73c9e8c7b2 (commit)
from 884ad7ecaf59bf946d75ef8dd5bc3d73c9e8c7b2 (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 | 16 ++++------------
src/const.h | 1 -
src/select.c | 30 ------------------------------
3 files changed, 4 insertions(+), 43 deletions(-)
=================
Commit Messages
=================
=========
Changes
=========
|
|
From: <gi...@gp...> - 2010-12-22 21:57:21
|
The branch, master has been updated
via 884ad7ecaf59bf946d75ef8dd5bc3d73c9e8c7b2 (commit)
from 7f9432d189a8824a418da803a43cf02d1d0916b8 (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 | 16 ++++++++++++----
src/const.h | 1 +
src/select.c | 30 ++++++++++++++++++++++++++++++
3 files changed, 43 insertions(+), 4 deletions(-)
=================
Commit Messages
=================
commit 884ad7ecaf59bf946d75ef8dd5bc3d73c9e8c7b2
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Add NetByName to the select action options
v2: Check Net name appropriately
:100644 100644 ba1fbed... 77b105d... M src/action.c
:100644 100644 676a6f0... e4a1d31... M src/const.h
:100644 100644 c4b5e17... bd4f373... M src/select.c
=========
Changes
=========
commit 884ad7ecaf59bf946d75ef8dd5bc3d73c9e8c7b2
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Add NetByName to the select action options
v2: Check Net name appropriately
diff --git a/src/action.c b/src/action.c
index ba1fbed..77b105d 100644
--- a/src/action.c
+++ b/src/action.c
@@ -135,6 +135,7 @@ typedef enum
F_Move,
F_NameOnPCB,
F_Netlist,
+ F_NetByName,
F_None,
F_Notify,
F_Object,
@@ -371,6 +372,7 @@ static FunctionType Functions[] = {
{"Move", F_Move},
{"NameOnPCB", F_NameOnPCB},
{"Netlist", F_Netlist},
+ {"NetByName", F_NetByName},
{"None", F_None},
{"Notify", F_Notify},
{"Object", F_Object},
@@ -5345,8 +5347,9 @@ static const char select_syntax[] =
"Select(All|Block|Connection)\n"
"Select(ElementByName|ObjectByName|PadByName|PinByName)\n"
"Select(ElementByName|ObjectByName|PadByName|PinByName, Name)\n"
- "Select(TextByName|ViaByName)\n"
- "Select(TextByName|ViaByName, Name)\n" "Select(Convert)";
+ "Select(TextByName|ViaByName|NetByName)\n"
+ "Select(TextByName|ViaByName|NetByName, Name)\n"
+ "Select(Convert)";
static const char select_help[] = "Toggles or sets the selection";
@@ -5360,6 +5363,7 @@ static const char select_help[] = "Toggles or sets the selection";
@item PinByName
@item TextByName
@item ViaByName
+@item NetByName
These all rely on having a regular expression parser built into
@code{pcb}. If the name is not specified then the user is prompted
@@ -5393,7 +5397,6 @@ ActionSelect (int argc, char **argv, int x, int y)
char *function = ARG (0);
if (function)
{
-
HideCrosshair (true);
switch (GetFunctionID (function))
{
@@ -5418,6 +5421,9 @@ ActionSelect (int argc, char **argv, int x, int y)
case F_ViaByName:
type = VIA_TYPE;
goto commonByName;
+ case F_NetByName:
+ type = NET_TYPE;
+ goto commonByName;
commonByName:
{
@@ -5574,7 +5580,6 @@ static int
ActionUnselect (int argc, char **argv, int x, int y)
{
char *function = ARG (0);
-
if (function)
{
HideCrosshair (true);
@@ -5601,6 +5606,9 @@ ActionUnselect (int argc, char **argv, int x, int y)
case F_ViaByName:
type = VIA_TYPE;
goto commonByName;
+ case F_NetByName:
+ type = NET_TYPE;
+ goto commonByName;
commonByName:
{
diff --git a/src/const.h b/src/const.h
index 676a6f0..e4a1d31 100644
--- a/src/const.h
+++ b/src/const.h
@@ -310,6 +310,7 @@ When set, element names are not drawn.
#define ELEMENTARC_TYPE 0x08000
#define LOCKED_TYPE 0x10000 /* used to tell search to include locked items. */
+#define NET_TYPE 0x20000 /* used to select whole net. */
#define PIN_TYPES (VIA_TYPE | PIN_TYPE)
#define LOCK_TYPES (VIA_TYPE | LINE_TYPE | ARC_TYPE | POLYGON_TYPE | ELEMENT_TYPE \
diff --git a/src/select.c b/src/select.c
index c4b5e17..bd4f373 100644
--- a/src/select.c
+++ b/src/select.c
@@ -44,6 +44,7 @@
#include "undo.h"
#include "rats.h"
#include "misc.h"
+#include "find.h"
#include <sys/types.h>
#ifdef HAVE_REGEX_H
@@ -1012,6 +1013,35 @@ SelectObjectByName (int Type, char *Pattern, bool Flag)
}
}
END_LOOP;
+ if (Type & NET_TYPE)
+ {
+ InitConnectionLookup ();
+ ResetFoundPinsViasAndPads (false);
+ ResetFoundLinesAndPolygons (false);
+ SaveUndoSerialNumber ();
+
+ MENU_LOOP (&PCB->NetlistLib);
+ {
+ Cardinal i;
+ LibraryEntryType *entry;
+ ConnectionType conn;
+
+ /* Name[0] and Name[1] are special purpose, not the actual name*/
+ if (menu->Name && menu->Name[0] != '\0' && menu->Name[1] != '\0' &&
+ REGEXEC (menu->Name + 2))
+ {
+ for (i = menu->EntryN, entry = menu->Entry; i; i--, entry++)
+ if (SeekPad (entry, &conn, false))
+ RatFindHook (conn.type, conn.ptr1, conn.ptr2, conn.ptr2, true, true);
+ }
+ }
+ END_LOOP;
+ RestoreUndoSerialNumber ();
+ SelectConnection (Flag);
+ ResetFoundPinsViasAndPads (false);
+ ResetFoundLinesAndPolygons (false);
+ FreeConnectionLookupMemory ();
+ }
#if defined(HAVE_REGCOMP)
#if !defined(sgi)
|
|
From: <gi...@gp...> - 2010-12-22 21:54:40
|
The branch, master has been updated
via 7f9432d189a8824a418da803a43cf02d1d0916b8 (commit)
via d24a35e1771ad753fa7430479ab01b847222b67e (commit)
from 300031d67ff186c4a4e74fb046d97a74c7d40732 (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/free_atexit.c | 11 ++++++++++-
src/free_atexit.h | 3 +++
src/hid/gtk/gui-top-window.c | 5 +++--
3 files changed, 16 insertions(+), 3 deletions(-)
=================
Commit Messages
=================
commit 7f9432d189a8824a418da803a43cf02d1d0916b8
Author: Tibor Palinkas <ge...@ig...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use leaky_* functions for deliberate leaks in ghid_ui_info_append
Allocate cached temporary memory with the leak_* memory allocation wrapers
which allow these to be freed at exit.
:100644 100644 90977e2... 817c453... M src/hid/gtk/gui-top-window.c
commit d24a35e1771ad753fa7430479ab01b847222b67e
Author: Tibor Palinkas <ge...@ig...>
Commit: Peter Clifton <pc...@ca...>
free_atexit.c: Add leaky_calloc() function for deliberately leaked calloc's
Stores a pointer to the calloc'd memory to be free'd at exit of the
program. Returned memory must not be free'd manually.
:100644 100644 dc11f12... 501775c... M src/free_atexit.c
:100644 100644 3b142b6... 558b597... M src/free_atexit.h
=========
Changes
=========
commit 7f9432d189a8824a418da803a43cf02d1d0916b8
Author: Tibor Palinkas <ge...@ig...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use leaky_* functions for deliberate leaks in ghid_ui_info_append
Allocate cached temporary memory with the leak_* memory allocation wrapers
which allow these to be freed at exit.
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 90977e2..817c453 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -119,6 +119,7 @@ a zoom in/out.
#include "set.h"
#include "undo.h"
#include "vendor.h"
+#include "free_atexit.h"
#include "gui-icons-mode-buttons.data"
#include "gui-icons-misc.data"
@@ -3679,7 +3680,7 @@ ghid_ui_info_append (const gchar * new)
if (new_ui_info_sz == 0)
{
new_ui_info_sz = 1024;
- new_ui_info = (gchar *) calloc ( new_ui_info_sz, sizeof (gchar));
+ new_ui_info = leaky_calloc (new_ui_info_sz, sizeof (gchar));
}
while (strlen (new_ui_info) + strlen (new) + 1 > new_ui_info_sz)
@@ -3688,7 +3689,7 @@ ghid_ui_info_append (const gchar * new)
gchar * np;
n = new_ui_info_sz + 1024;
- if ( (np = realloc (new_ui_info, n)) == NULL)
+ if ((np = leaky_realloc (new_ui_info, n)) == NULL)
{
fprintf (stderr, "ghid_ui_info_append(): realloc of size %ld failed\n",
(long int) n);
commit d24a35e1771ad753fa7430479ab01b847222b67e
Author: Tibor Palinkas <ge...@ig...>
Commit: Peter Clifton <pc...@ca...>
free_atexit.c: Add leaky_calloc() function for deliberately leaked calloc's
Stores a pointer to the calloc'd memory to be free'd at exit of the
program. Returned memory must not be free'd manually.
diff --git a/src/free_atexit.c b/src/free_atexit.c
index dc11f12..501775c 100644
--- a/src/free_atexit.c
+++ b/src/free_atexit.c
@@ -22,8 +22,8 @@
*
*/
-
#include <stdlib.h>
+#include <string.h>
/* we need one ID per context - short int with 64k IDs should be enough */
typedef unsigned int leaky_idx_t;
@@ -56,6 +56,15 @@ void *leaky_malloc (size_t size)
return new_memory + sizeof(leaky_admin_t);
}
+void *leaky_calloc (size_t nmemb, size_t size)
+{
+ size_t size_ = size * nmemb;
+ void *new_memory = leaky_malloc (size_);
+
+ memset (new_memory, 0, size_);
+ return new_memory;
+}
+
void *leaky_realloc (void* old_memory, size_t size)
{
void *new_memory;
diff --git a/src/free_atexit.h b/src/free_atexit.h
index 3b142b6..558b597 100644
--- a/src/free_atexit.h
+++ b/src/free_atexit.h
@@ -23,6 +23,9 @@ void leaky_uninit (void);
/* allocate memory, remember the pointer and free it after exit from the application */
void *leaky_malloc (size_t size);
+/* same as leaky_malloc but this one wraps calloc() */
+void *leaky_calloc (size_t nmemb, size_t size);
+
/* reallocate memory, remember the new pointer and free it after exit from the application */
void *leaky_realloc (void* old_memory, size_t size);
|
|
From: <gi...@gp...> - 2010-12-22 18:57:48
|
The branch, master has been updated
via 300031d67ff186c4a4e74fb046d97a74c7d40732 (commit)
from 1d6dc09da71e407ece2f042370c2ed350ae8448b (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/report.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
=================
Commit Messages
=================
commit 300031d67ff186c4a4e74fb046d97a74c7d40732
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
report.c: Fix missing return value
:100644 100644 be6d1e6... a9c429d... M src/report.c
=========
Changes
=========
commit 300031d67ff186c4a4e74fb046d97a74c7d40732
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
report.c: Fix missing return value
diff --git a/src/report.c b/src/report.c
index be6d1e6..a9c429d 100644
--- a/src/report.c
+++ b/src/report.c
@@ -327,7 +327,7 @@ ReportDialog (int argc, char **argv, int x, int y)
{
LayerTypePtr layer = (LayerTypePtr) ptr1;
__r_dump_tree (layer->polygon_tree->root, 0);
- return;
+ return 0;
}
#endif
Polygon = (PolygonTypePtr) ptr2;
|
|
From: <gi...@gp...> - 2010-12-22 14:53:51
|
The branch, master has been updated
via 1d6dc09da71e407ece2f042370c2ed350ae8448b (commit)
from b11b037f3b20721ab4a2b68d25e6681419a1e3a6 (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/toporouter.c | 56 +++++++++++++++++++++++++++---------------------------
1 files changed, 28 insertions(+), 28 deletions(-)
=================
Commit Messages
=================
commit 1d6dc09da71e407ece2f042370c2ed350ae8448b
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
toporouter.c: Make inline functions "static inline"
gcc builds break for CFLAGS="-g" only builds (no -O2). Inlineing is only
performed when optimisation is enabled, and unless we make all local
inlined functions "static inline", it does not emit the non-inlined
assembly for them, resulting in undefined symbols at link time.
:100644 100644 41fd4b1... 88c1325... M src/toporouter.c
=========
Changes
=========
commit 1d6dc09da71e407ece2f042370c2ed350ae8448b
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
toporouter.c: Make inline functions "static inline"
gcc builds break for CFLAGS="-g" only builds (no -O2). Inlineing is only
performed when optimisation is enabled, and unless we make all local
inlined functions "static inline", it does not emit the non-inlined
assembly for them, resulting in undefined symbols at link time.
diff --git a/src/toporouter.c b/src/toporouter.c
index 41fd4b1..88c1325 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -303,14 +303,14 @@ lookup_thickness(char *name)
return Settings.LineThickness;
}
-inline gdouble
+static inline gdouble
cluster_keepaway(toporouter_cluster_t *cluster)
{
if(cluster) return lookup_keepaway(cluster->netlist->style);
return lookup_keepaway(NULL);
}
-inline gdouble
+static inline gdouble
cluster_thickness(toporouter_cluster_t *cluster)
{
if(cluster) return lookup_thickness(cluster->netlist->style);
@@ -555,7 +555,7 @@ constraint_netlist(toporouter_constraint_t *c)
return NULL;
}
-inline guint
+static inline guint
epsilon_equals(gdouble a, gdouble b)
{
if(a > b - EPSILON && a < b + EPSILON) return 1;
@@ -763,7 +763,7 @@ point_from_point_to_point(toporouter_vertex_t *a, toporouter_vertex_t *b, gdoubl
}
-inline gint
+static inline gint
coord_wind(gdouble ax, gdouble ay, gdouble bx, gdouble by, gdouble cx, gdouble cy)
{
gdouble rval, dx1, dx2, dy1, dy2;
@@ -786,13 +786,13 @@ point_wind(GtsPoint *a, GtsPoint *b, GtsPoint *c)
return (rval > EPSILON) ? 1 : ((rval < -EPSILON) ? -1 : 0);
}
-inline int
+static inline int
vertex_wind(GtsVertex *a, GtsVertex *b, GtsVertex *c)
{
return point_wind(GTS_POINT(a), GTS_POINT(b), GTS_POINT(c));
}
-inline int
+static inline int
tvertex_wind(toporouter_vertex_t *a, toporouter_vertex_t *b, toporouter_vertex_t *c)
{
return point_wind(GTS_POINT(a), GTS_POINT(b), GTS_POINT(c));
@@ -808,7 +808,7 @@ sloppy_point_wind(GtsPoint *a, GtsPoint *b, GtsPoint *c)
return (rval > 10.) ? 1 : ((rval < -10.) ? -1 : 0);
}
-inline int
+static inline int
sloppy_vertex_wind(GtsVertex *a, GtsVertex *b, GtsVertex *c)
{
return point_wind(GTS_POINT(a), GTS_POINT(b), GTS_POINT(c));
@@ -925,7 +925,7 @@ vertex_move_towards_vertex_values(GtsVertex *v, GtsVertex *p, gdouble d, gdouble
#define tv_on_layer(v,l) (l == TOPOROUTER_BBOX(TOPOROUTER_VERTEX(v)->boxes->data)->layer)
-inline gdouble
+static inline gdouble
min_spacing(toporouter_vertex_t *v1, toporouter_vertex_t *v2)
{
@@ -949,7 +949,7 @@ min_spacing(toporouter_vertex_t *v1, toporouter_vertex_t *v2)
}
// v1 is a vertex in the CDT, and v2 is a net... other way around?
-inline gdouble
+static inline gdouble
min_vertex_net_spacing(toporouter_vertex_t *v1, toporouter_vertex_t *v2)
{
@@ -966,7 +966,7 @@ min_vertex_net_spacing(toporouter_vertex_t *v1, toporouter_vertex_t *v2)
return ms;
}
-inline gdouble
+static inline gdouble
min_oproute_vertex_spacing(toporouter_oproute_t *oproute, toporouter_vertex_t *v2)
{
@@ -1301,7 +1301,7 @@ wind_double(gdouble p1_x, gdouble p1_y, gdouble p2_x, gdouble p2_y, gdouble p3_x
return (rval > 0.0001) ? 1 : ((rval < -0.0001) ? -1 : 0);
}
-inline void
+static inline void
print_toporouter_constraint(toporouter_constraint_t *tc)
{
printf("%f,%f -> %f,%f ",
@@ -1311,7 +1311,7 @@ print_toporouter_constraint(toporouter_constraint_t *tc)
tc->c.edge.segment.v2->p.y);
}
-inline void
+static inline void
print_toporouter_vertex(toporouter_vertex_t *tv)
{
printf("%f,%f ", tv->v.p.x, tv->v.p.y);
@@ -1434,7 +1434,7 @@ vertex_gradient(toporouter_spoint_t *a, toporouter_spoint_t *b)
/*
* Returns gradient of segment given by (x0,y0) & (x1,y1)
*/
-inline gdouble
+static inline gdouble
cartesian_gradient(gdouble x0, gdouble y0, gdouble x1, gdouble y1)
{
if(epsilon_equals(x0,x1)) return INFINITY;
@@ -1445,7 +1445,7 @@ cartesian_gradient(gdouble x0, gdouble y0, gdouble x1, gdouble y1)
/*
* Returns gradient of segment given by (x0,y0) & (x1,y1)
*/
-inline gdouble
+static inline gdouble
point_gradient(GtsPoint *a, GtsPoint *b)
{
return cartesian_gradient(a->x, a->y, b->x, b->y);
@@ -1483,7 +1483,7 @@ vertices_plane_distance(toporouter_spoint_t *a, toporouter_spoint_t *b) {
/*
* Finds the point p distance r away from a on the line segment of a & b
*/
-inline void
+static inline void
vertex_outside_segment(toporouter_spoint_t *a, toporouter_spoint_t *b, gdouble r, toporouter_spoint_t *p)
{
gdouble m;
@@ -1537,19 +1537,19 @@ point_intersect_prop(GtsPoint *a, GtsPoint *b, GtsPoint *c, GtsPoint *d)
( point_wind(c, d, a) ^ point_wind(c, d, b) );
}
-inline int
+static inline int
vertex_intersect_prop(GtsVertex *a, GtsVertex *b, GtsVertex *c, GtsVertex *d)
{
return point_intersect_prop(GTS_POINT(a), GTS_POINT(b), GTS_POINT(c), GTS_POINT(d));
}
-inline int
+static inline int
tvertex_intersect_prop(toporouter_vertex_t *a, toporouter_vertex_t *b, toporouter_vertex_t *c, toporouter_vertex_t *d)
{
return point_intersect_prop(GTS_POINT(a), GTS_POINT(b), GTS_POINT(c), GTS_POINT(d));
}
/*
-inline int
+static inline int
tvertex_intersect(toporouter_vertex_t *a, toporouter_vertex_t *b, toporouter_vertex_t *c, toporouter_vertex_t *d)
{
if( !point_wind(GTS_POINT(a), GTS_POINT(d), GTS_POINT(b)) || !point_wind(GTS_POINT(a), GTS_POINT(c), GTS_POINT(b)) ) return 1;
@@ -1625,7 +1625,7 @@ point_between(GtsPoint *a, GtsPoint *b, GtsPoint *c)
(c->y >= b->y));
}
-inline int
+static inline int
vertex_between(GtsVertex *a, GtsVertex *b, GtsVertex *c)
{
return point_between(GTS_POINT(a), GTS_POINT(b), GTS_POINT(c));
@@ -1846,13 +1846,13 @@ midpoint(GtsPoint *a, GtsPoint *b)
return gts_point_new(gts_point_class(), (a->x + b->x) / 2., (a->y + b->y) / 2., 0.);
}
-inline gdouble
+static inline gdouble
pad_rad(PadType *pad)
{
return (lookup_thickness(pad->Name) / 2.) + lookup_keepaway(pad->Name);
}
-inline gdouble
+static inline gdouble
pin_rad(PinType *pin)
{
return (lookup_thickness(pin->Name) / 2.) + lookup_keepaway(pin->Name);
@@ -3087,7 +3087,7 @@ toporouter_heap_color(gpointer data, gpointer user_data)
v->flags |= (guint) user_data;
}
*/
-inline gdouble
+static inline gdouble
angle_span(gdouble a1, gdouble a2)
{
if(a1 > a2)
@@ -3445,7 +3445,7 @@ triangle_interior_capacity(GtsTriangle *t, toporouter_vertex_t *v)
return INFINITY;
}
-inline toporouter_vertex_t *
+static inline toporouter_vertex_t *
segment_common_vertex(GtsSegment *s1, GtsSegment *s2)
{
if(!s1 || !s2) return NULL;
@@ -3456,14 +3456,14 @@ segment_common_vertex(GtsSegment *s1, GtsSegment *s2)
return NULL;
}
-inline toporouter_vertex_t *
+static inline toporouter_vertex_t *
route_vertices_common_vertex(toporouter_vertex_t *v1, toporouter_vertex_t *v2)
{
return segment_common_vertex(GTS_SEGMENT(v1->routingedge), GTS_SEGMENT(v2->routingedge));
}
-inline guint
+static inline guint
edges_third_edge(GtsSegment *s1, GtsSegment *s2, toporouter_vertex_t **v1, toporouter_vertex_t **v2)
{
if(!s1 || !s2) return 0;
@@ -3976,7 +3976,7 @@ routedata_insert_temppoints(toporouter_route_t *data, GList *temppoints) {
}
-inline gint
+static inline gint
constraint_route_test(toporouter_constraint_t *c, toporouter_route_t *routedata)
{
if(c->box->cluster && c->box->cluster->netlist == routedata->src->netlist) {
@@ -7038,7 +7038,7 @@ print_costmatrix(gdouble *m, guint n)
}
-inline void
+static inline void
init_cost_matrix(gdouble *m, guint n)
{
for(guint i=0;i<n;i++) {
@@ -7086,7 +7086,7 @@ netscore_create(toporouter_t *r, toporouter_route_t *routedata, guint n, guint i
return netscore;
}
-inline void
+static inline void
netscore_destroy(toporouter_netscore_t *netscore)
{
free(netscore->pairwise_nodetour);
|
|
From: <gi...@gp...> - 2010-12-22 13:48:46
|
The branch, master has been updated
via b11b037f3b20721ab4a2b68d25e6681419a1e3a6 (commit)
from b996bb2e352d390a45db60580b0816b233950fe7 (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 | 240 ++++++++++++++++++++++++++++++++++++++-
src/hid/gtk/gtkhid-main.c | 76 ------------
src/hid/gtk/gui-output-events.c | 173 +----------------------------
src/hid/gtk/gui.h | 9 +-
4 files changed, 242 insertions(+), 256 deletions(-)
=================
Commit Messages
=================
commit b11b037f3b20721ab4a2b68d25e6681419a1e3a6
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Move more gdk specific drawing routines to gtkhid-gdk.c
:100644 100644 5cd969c... b1dc11d... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 a3947d0... e91b68c... M src/hid/gtk/gtkhid-main.c
:100644 100644 6164415... 4ca6040... M src/hid/gtk/gui-output-events.c
:100644 100644 4ad6cdc... d67db1a... M src/hid/gtk/gui.h
=========
Changes
=========
commit b11b037f3b20721ab4a2b68d25e6681419a1e3a6
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Move more gdk specific drawing routines to gtkhid-gdk.c
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index 5cd969c..b1dc11d 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -21,7 +21,6 @@ RCSID ("$Id$");
extern HID ghid_hid;
-
/* Sets gport->u_gc to the "right" GC to use (wrt mask or window)
*/
#define USE_GC(gc) if (!use_gc(gc)) return
@@ -79,7 +78,7 @@ ghid_make_gc (void)
return rv;
}
-void
+static void
ghid_draw_grid (void)
{
static GdkPoint *points = 0;
@@ -153,7 +152,7 @@ ghid_draw_grid (void)
}
/* ------------------------------------------------------------ */
-void
+static void
ghid_draw_bg_image (void)
{
static GdkPixbuf *pixbuf;
@@ -649,3 +648,238 @@ ghid_fill_rect (hidGC gc, int x1, int y1, int x2, int y2)
gdk_draw_rectangle (gport->drawable, gport->u_gc, TRUE,
x1, y1, x2 - x1 + 1, y2 - y1 + 1);
}
+
+void
+ghid_invalidate_lr (int left, int right, int top, int bottom)
+{
+ ghid_invalidate_all ();
+}
+
+void
+ghid_invalidate_all ()
+{
+ int eleft, eright, etop, ebottom;
+ BoxType region;
+
+ if (!gport->pixmap)
+ return;
+
+ region.X1 = MIN(Px(0), Px(gport->width + 1));
+ region.Y1 = MIN(Py(0), Py(gport->height + 1));
+ region.X2 = MAX(Px(0), Px(gport->width + 1));
+ region.Y2 = MAX(Py(0), Py(gport->height + 1));
+
+ eleft = Vx (0);
+ eright = Vx (PCB->MaxWidth);
+ etop = Vy (0);
+ ebottom = Vy (PCB->MaxHeight);
+ if (eleft > eright)
+ {
+ int tmp = eleft;
+ eleft = eright;
+ eright = tmp;
+ }
+ if (etop > ebottom)
+ {
+ int tmp = etop;
+ etop = ebottom;
+ ebottom = tmp;
+ }
+
+ if (eleft > 0)
+ gdk_draw_rectangle (gport->drawable, gport->offlimits_gc,
+ 1, 0, 0, eleft, gport->height);
+ else
+ eleft = 0;
+ if (eright < gport->width)
+ gdk_draw_rectangle (gport->drawable, gport->offlimits_gc,
+ 1, eright, 0, gport->width - eright, gport->height);
+ else
+ eright = gport->width;
+ if (etop > 0)
+ gdk_draw_rectangle (gport->drawable, gport->offlimits_gc,
+ 1, eleft, 0, eright - eleft + 1, etop);
+ else
+ etop = 0;
+ if (ebottom < gport->height)
+ gdk_draw_rectangle (gport->drawable, gport->offlimits_gc,
+ 1, eleft, ebottom, eright - eleft + 1,
+ gport->height - ebottom);
+ else
+ ebottom = gport->height;
+
+ gdk_draw_rectangle (gport->drawable, gport->bg_gc, 1,
+ eleft, etop, eright - eleft + 1, ebottom - etop + 1);
+
+ ghid_draw_bg_image();
+
+ hid_expose_callback (&ghid_hid, ®ion, 0);
+ ghid_draw_grid ();
+ if (ghidgui->need_restore_crosshair)
+ RestoreCrosshair (FALSE);
+ ghidgui->need_restore_crosshair = FALSE;
+ ghid_screen_update ();
+}
+
+static void
+draw_right_cross (GdkGC *xor_gc, gint x, gint y)
+{
+ gdk_draw_line (gport->drawing_area->window, xor_gc, x, 0, x, gport->height);
+ gdk_draw_line (gport->drawing_area->window, xor_gc, 0, y, gport->width, y);
+}
+
+static void
+draw_slanted_cross (GdkGC *xor_gc, gint x, gint y)
+{
+ gint x0, y0, x1, y1;
+
+ x0 = x + (gport->height - y);
+ x0 = MAX(0, MIN (x0, gport->width));
+ x1 = x - y;
+ x1 = MAX(0, MIN (x1, gport->width));
+ y0 = y + (gport->width - x);
+ y0 = MAX(0, MIN (y0, gport->height));
+ y1 = y - x;
+ y1 = MAX(0, MIN (y1, gport->height));
+ gdk_draw_line (gport->drawing_area->window, xor_gc, x0, y0, x1, y1);
+
+ x0 = x - (gport->height - y);
+ x0 = MAX(0, MIN (x0, gport->width));
+ x1 = x + y;
+ x1 = MAX(0, MIN (x1, gport->width));
+ y0 = y + x;
+ y0 = MAX(0, MIN (y0, gport->height));
+ y1 = y - (gport->width - x);
+ y1 = MAX(0, MIN (y1, gport->height));
+ gdk_draw_line (gport->drawing_area->window, xor_gc, x0, y0, x1, y1);
+}
+
+static void
+draw_dozen_cross (GdkGC *xor_gc, gint x, gint y)
+{
+ gint x0, y0, x1, y1;
+ gdouble tan60 = sqrt (3);
+
+ x0 = x + (gport->height - y) / tan60;
+ x0 = MAX(0, MIN (x0, gport->width));
+ x1 = x - y / tan60;
+ x1 = MAX(0, MIN (x1, gport->width));
+ y0 = y + (gport->width - x) * tan60;
+ y0 = MAX(0, MIN (y0, gport->height));
+ y1 = y - x * tan60;
+ y1 = MAX(0, MIN (y1, gport->height));
+ gdk_draw_line (gport->drawing_area->window, xor_gc, x0, y0, x1, y1);
+
+ x0 = x + (gport->height - y) * tan60;
+ x0 = MAX(0, MIN (x0, gport->width));
+ x1 = x - y * tan60;
+ x1 = MAX(0, MIN (x1, gport->width));
+ y0 = y + (gport->width - x) / tan60;
+ y0 = MAX(0, MIN (y0, gport->height));
+ y1 = y - x / tan60;
+ y1 = MAX(0, MIN (y1, gport->height));
+ gdk_draw_line (gport->drawing_area->window, xor_gc, x0, y0, x1, y1);
+
+ x0 = x - (gport->height - y) / tan60;
+ x0 = MAX(0, MIN (x0, gport->width));
+ x1 = x + y / tan60;
+ x1 = MAX(0, MIN (x1, gport->width));
+ y0 = y + x * tan60;
+ y0 = MAX(0, MIN (y0, gport->height));
+ y1 = y - (gport->width - x) * tan60;
+ y1 = MAX(0, MIN (y1, gport->height));
+ gdk_draw_line (gport->drawing_area->window, xor_gc, x0, y0, x1, y1);
+
+ x0 = x - (gport->height - y) * tan60;
+ x0 = MAX(0, MIN (x0, gport->width));
+ x1 = x + y * tan60;
+ x1 = MAX(0, MIN (x1, gport->width));
+ y0 = y + x / tan60;
+ y0 = MAX(0, MIN (y0, gport->height));
+ y1 = y - (gport->width - x) / tan60;
+ y1 = MAX(0, MIN (y1, gport->height));
+ gdk_draw_line (gport->drawing_area->window, xor_gc, x0, y0, x1, y1);
+}
+
+static void
+draw_crosshair (GdkGC *xor_gc, gint x, gint y)
+{
+ static enum crosshair_shape prev = Basic_Crosshair_Shape;
+
+ draw_right_cross (xor_gc, x, y);
+ if (prev == Union_Jack_Crosshair_Shape)
+ draw_slanted_cross (xor_gc, x, y);
+ if (prev == Dozen_Crosshair_Shape)
+ draw_dozen_cross (xor_gc, x, y);
+ prev = Crosshair.shape;
+}
+
+#define VCW 16
+#define VCD 8
+
+void
+ghid_show_crosshair (gboolean show)
+{
+ gint x, y;
+ static gint x_prev = -1, y_prev = -1;
+ static gboolean draw_markers, draw_markers_prev = FALSE;
+ static GdkGC *xor_gc;
+ static GdkColor cross_color;
+
+ if (gport->x_crosshair < 0 || ghidgui->creating || !gport->has_entered)
+ return;
+
+ if (!xor_gc)
+ {
+ xor_gc = gdk_gc_new (ghid_port.drawing_area->window);
+ gdk_gc_copy (xor_gc, ghid_port.drawing_area->style->white_gc);
+ gdk_gc_set_function (xor_gc, GDK_XOR);
+ /* FIXME: when CrossColor changed from config */
+ ghid_map_color_string (Settings.CrossColor, &cross_color);
+ }
+ x = DRAW_X (gport->x_crosshair);
+ y = DRAW_Y (gport->y_crosshair);
+
+ gdk_gc_set_foreground (xor_gc, &cross_color);
+
+ if (x_prev >= 0)
+ {
+ draw_crosshair (xor_gc, x_prev, y_prev);
+ if (draw_markers_prev)
+ {
+ gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
+ 0, y_prev - VCD, VCD, VCW);
+ gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
+ gport->width - VCD, y_prev - VCD, VCD, VCW);
+ gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
+ x_prev - VCD, 0, VCW, VCD);
+ gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
+ x_prev - VCD, gport->height - VCD, VCW, VCD);
+ }
+ }
+
+ if (x >= 0 && show)
+ {
+ draw_crosshair (xor_gc, x, y);
+ draw_markers = ghidgui->auto_pan_on && have_crosshair_attachments ();
+ if (draw_markers)
+ {
+ gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
+ 0, y - VCD, VCD, VCW);
+ gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
+ gport->width - VCD, y - VCD, VCD, VCW);
+ gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
+ x - VCD, 0, VCW, VCD);
+ gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
+ x - VCD, gport->height - VCD, VCW, VCD);
+ }
+ x_prev = x;
+ y_prev = y;
+ draw_markers_prev = draw_markers;
+ }
+ else
+ {
+ x_prev = y_prev = -1;
+ draw_markers_prev = FALSE;
+ }
+}
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index a3947d0..e91b68c 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -33,9 +33,6 @@
RCSID ("$Id$");
-extern HID ghid_hid;
-
-
static void zoom_to (double factor, int x, int y);
static void zoom_by (double factor, int x, int y);
@@ -311,79 +308,6 @@ zoom_by (double factor, int x, int y)
/* ------------------------------------------------------------ */
-void
-ghid_invalidate_lr (int left, int right, int top, int bottom)
-{
- ghid_invalidate_all ();
-}
-
-void
-ghid_invalidate_all ()
-{
- int eleft, eright, etop, ebottom;
- BoxType region;
-
- if (!gport->pixmap)
- return;
-
- region.X1 = MIN(Px(0), Px(gport->width + 1));
- region.Y1 = MIN(Py(0), Py(gport->height + 1));
- region.X2 = MAX(Px(0), Px(gport->width + 1));
- region.Y2 = MAX(Py(0), Py(gport->height + 1));
-
- eleft = Vx (0);
- eright = Vx (PCB->MaxWidth);
- etop = Vy (0);
- ebottom = Vy (PCB->MaxHeight);
- if (eleft > eright)
- {
- int tmp = eleft;
- eleft = eright;
- eright = tmp;
- }
- if (etop > ebottom)
- {
- int tmp = etop;
- etop = ebottom;
- ebottom = tmp;
- }
-
- if (eleft > 0)
- gdk_draw_rectangle (gport->drawable, gport->offlimits_gc,
- 1, 0, 0, eleft, gport->height);
- else
- eleft = 0;
- if (eright < gport->width)
- gdk_draw_rectangle (gport->drawable, gport->offlimits_gc,
- 1, eright, 0, gport->width - eright, gport->height);
- else
- eright = gport->width;
- if (etop > 0)
- gdk_draw_rectangle (gport->drawable, gport->offlimits_gc,
- 1, eleft, 0, eright - eleft + 1, etop);
- else
- etop = 0;
- if (ebottom < gport->height)
- gdk_draw_rectangle (gport->drawable, gport->offlimits_gc,
- 1, eleft, ebottom, eright - eleft + 1,
- gport->height - ebottom);
- else
- ebottom = gport->height;
-
- gdk_draw_rectangle (gport->drawable, gport->bg_gc, 1,
- eleft, etop, eright - eleft + 1, ebottom - etop + 1);
-
- ghid_draw_bg_image();
-
- hid_expose_callback (&ghid_hid, ®ion, 0);
- ghid_draw_grid ();
- if (ghidgui->need_restore_crosshair)
- RestoreCrosshair (FALSE);
- ghidgui->need_restore_crosshair = FALSE;
- ghid_screen_update ();
-}
-
-
int
ghid_set_layer (const char *name, int group, int empty)
{
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index 6164415..4ca6040 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -259,7 +259,7 @@ ghid_note_event_location (GdkEventButton * ev)
return moved;
}
-static gboolean
+gboolean
have_crosshair_attachments (void)
{
gboolean result = FALSE;
@@ -298,177 +298,6 @@ have_crosshair_attachments (void)
return result;
}
-
-#define VCW 16
-#define VCD 8
-
-static void
-draw_right_cross (GdkGC *xor_gc, gint x, gint y)
-{
- gdk_draw_line (gport->drawing_area->window, xor_gc,
- x, 0, x, gport->height);
- gdk_draw_line (gport->drawing_area->window, xor_gc,
- 0, y, gport->width, y);
-}
-
-static void
-draw_slanted_cross (GdkGC *xor_gc, gint x, gint y)
-{
- gint x0, y0, x1, y1;
-
- x0 = x + (gport->height - y);
- x0 = MAX(0, MIN (x0, gport->width));
- x1 = x - y;
- x1 = MAX(0, MIN (x1, gport->width));
- y0 = y + (gport->width - x);
- y0 = MAX(0, MIN (y0, gport->height));
- y1 = y - x;
- y1 = MAX(0, MIN (y1, gport->height));
- gdk_draw_line (gport->drawing_area->window, xor_gc,
- x0, y0, x1, y1);
- x0 = x - (gport->height - y);
- x0 = MAX(0, MIN (x0, gport->width));
- x1 = x + y;
- x1 = MAX(0, MIN (x1, gport->width));
- y0 = y + x;
- y0 = MAX(0, MIN (y0, gport->height));
- y1 = y - (gport->width - x);
- y1 = MAX(0, MIN (y1, gport->height));
- gdk_draw_line (gport->drawing_area->window, xor_gc,
- x0, y0, x1, y1);
-}
-
-static void
-draw_dozen_cross (GdkGC *xor_gc, gint x, gint y)
-{
- gint x0, y0, x1, y1;
- gdouble tan60 = sqrt (3);
-
- x0 = x + (gport->height - y) / tan60;
- x0 = MAX(0, MIN (x0, gport->width));
- x1 = x - y / tan60;
- x1 = MAX(0, MIN (x1, gport->width));
- y0 = y + (gport->width - x) * tan60;
- y0 = MAX(0, MIN (y0, gport->height));
- y1 = y - x * tan60;
- y1 = MAX(0, MIN (y1, gport->height));
- gdk_draw_line (gport->drawing_area->window, xor_gc,
- x0, y0, x1, y1);
-
- x0 = x + (gport->height - y) * tan60;
- x0 = MAX(0, MIN (x0, gport->width));
- x1 = x - y * tan60;
- x1 = MAX(0, MIN (x1, gport->width));
- y0 = y + (gport->width - x) / tan60;
- y0 = MAX(0, MIN (y0, gport->height));
- y1 = y - x / tan60;
- y1 = MAX(0, MIN (y1, gport->height));
- gdk_draw_line (gport->drawing_area->window, xor_gc,
- x0, y0, x1, y1);
-
- x0 = x - (gport->height - y) / tan60;
- x0 = MAX(0, MIN (x0, gport->width));
- x1 = x + y / tan60;
- x1 = MAX(0, MIN (x1, gport->width));
- y0 = y + x * tan60;
- y0 = MAX(0, MIN (y0, gport->height));
- y1 = y - (gport->width - x) * tan60;
- y1 = MAX(0, MIN (y1, gport->height));
- gdk_draw_line (gport->drawing_area->window, xor_gc,
- x0, y0, x1, y1);
-
- x0 = x - (gport->height - y) * tan60;
- x0 = MAX(0, MIN (x0, gport->width));
- x1 = x + y * tan60;
- x1 = MAX(0, MIN (x1, gport->width));
- y0 = y + x / tan60;
- y0 = MAX(0, MIN (y0, gport->height));
- y1 = y - (gport->width - x) / tan60;
- y1 = MAX(0, MIN (y1, gport->height));
- gdk_draw_line (gport->drawing_area->window, xor_gc,
- x0, y0, x1, y1);
-}
-
-static void
-draw_crosshair (GdkGC *xor_gc, gint x, gint y)
-{
- static enum crosshair_shape prev = Basic_Crosshair_Shape;
-
- draw_right_cross (xor_gc, x, y);
- if (prev == Union_Jack_Crosshair_Shape)
- draw_slanted_cross (xor_gc, x, y);
- if (prev == Dozen_Crosshair_Shape)
- draw_dozen_cross (xor_gc, x, y);
- prev = Crosshair.shape;
-}
-
-void
-ghid_show_crosshair (gboolean show)
-{
- gint x, y;
- static gint x_prev = -1, y_prev = -1;
- static gboolean draw_markers, draw_markers_prev = FALSE;
- static GdkGC *xor_gc;
- static GdkColor cross_color;
-
- if (gport->x_crosshair < 0 || ghidgui->creating || !gport->has_entered)
- return;
-
- if (!xor_gc)
- {
- xor_gc = gdk_gc_new (ghid_port.drawing_area->window);
- gdk_gc_copy (xor_gc, ghid_port.drawing_area->style->white_gc);
- gdk_gc_set_function (xor_gc, GDK_XOR);
- /* FIXME: when CrossColor changed from config */
- ghid_map_color_string (Settings.CrossColor, &cross_color);
- }
- x = DRAW_X (gport->x_crosshair);
- y = DRAW_Y (gport->y_crosshair);
-
- gdk_gc_set_foreground (xor_gc, &cross_color);
-
- if (x_prev >= 0)
- {
- draw_crosshair (xor_gc, x_prev, y_prev);
- if (draw_markers_prev)
- {
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- 0, y_prev - VCD, VCD, VCW);
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- gport->width - VCD, y_prev - VCD, VCD, VCW);
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- x_prev - VCD, 0, VCW, VCD);
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- x_prev - VCD, gport->height - VCD, VCW, VCD);
- }
- }
-
- if (x >= 0 && show)
- {
- draw_crosshair (xor_gc, x, y);
- draw_markers = ghidgui->auto_pan_on && have_crosshair_attachments ();
- if (draw_markers)
- {
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- 0, y - VCD, VCD, VCW);
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- gport->width - VCD, y - VCD, VCD, VCW);
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- x - VCD, 0, VCW, VCD);
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- x - VCD, gport->height - VCD, VCW, VCD);
- }
- x_prev = x;
- y_prev = y;
- draw_markers_prev = draw_markers;
- }
- else
- {
- x_prev = y_prev = -1;
- draw_markers_prev = FALSE;
- }
-}
-
static gboolean
ghid_idle_cb (gpointer data)
{
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 4ad6cdc..d67db1a 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -284,11 +284,10 @@ 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_show_crosshair (gboolean show);
void ghid_screen_update (void);
gboolean ghid_note_event_location (GdkEventButton * ev);
-
+gboolean have_crosshair_attachments (void);
gboolean ghid_port_key_press_cb (GtkWidget * drawing_area,
GdkEventKey * kev, GtkUIManager * ui);
gboolean ghid_port_key_release_cb (GtkWidget * drawing_area,
@@ -491,8 +490,6 @@ GdkPixmap *ghid_render_pixmap (int cx,
/* gtkhid-gdk.c */
hidGC ghid_make_gc (void);
void ghid_destroy_gc (hidGC);
-void ghid_draw_grid (void);
-void ghid_draw_bg_image (void);
void ghid_use_mask (int use_it);
void ghid_set_color (hidGC gc, const char *name);
void ghid_set_line_cap (hidGC gc, EndCapStyle style);
@@ -507,9 +504,11 @@ void ghid_draw_rect (hidGC gc, int x1, int y1, int x2, int y2);
void ghid_fill_circle (hidGC gc, int cx, int cy, int radius);
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 ();
+void ghid_invalidate_all ();
+void ghid_show_crosshair (gboolean show);
/* gtkhid-main.c */
-void ghid_invalidate_all ();
void ghid_get_coords (const char *msg, int *x, int *y);
gint PCBChanged (int argc, char **argv, int x, int y);
|
|
From: <gi...@gp...> - 2010-12-22 11:56:03
|
The branch, master has been updated
via b996bb2e352d390a45db60580b0816b233950fe7 (commit)
from 5c0e88f2d44c4a22b6afa770750f2a599b048e2b (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/free_atexit.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++
src/free_atexit.h | 30 +++++++++++++++++
src/main.c | 8 +++++
4 files changed, 131 insertions(+), 0 deletions(-)
create mode 100644 src/free_atexit.c
create mode 100644 src/free_atexit.h
=================
Commit Messages
=================
commit b996bb2e352d390a45db60580b0816b233950fe7
Author: Tibor Palinkas <ge...@ig...>
Commit: Peter Clifton <pc...@ca...>
Add leaky_{malloc,realloc} functions for deliberate non-free'd allocations
These are to be used for local allocations made and cached for
the lifetime of the program (never free'd). Typically, these are stored
in a static char * variable (or similar) within a function.
The leaky_*() functions store the addresses of all memory they allocate,
and for debugging builds, free it upon exit of the program, thus allowing
leak detectors such as valgrind to ignore our deliberate "leaks".
The memory returned by leaky_*() must not be free'd.
Build system and PCB integration, and leaky_atexit.c reindenting by
Peter Clifton <pc...@ca...>
:100644 100644 a0f1c50... e287ae7... M src/Makefile.am
:000000 100644 0000000... dc11f12... A src/free_atexit.c
:000000 100644 0000000... 3b142b6... A src/free_atexit.h
:100644 100644 462285d... 735fde7... M src/main.c
=========
Changes
=========
commit b996bb2e352d390a45db60580b0816b233950fe7
Author: Tibor Palinkas <ge...@ig...>
Commit: Peter Clifton <pc...@ca...>
Add leaky_{malloc,realloc} functions for deliberate non-free'd allocations
These are to be used for local allocations made and cached for
the lifetime of the program (never free'd). Typically, these are stored
in a static char * variable (or similar) within a function.
The leaky_*() functions store the addresses of all memory they allocate,
and for debugging builds, free it upon exit of the program, thus allowing
leak detectors such as valgrind to ignore our deliberate "leaks".
The memory returned by leaky_*() must not be free'd.
Build system and PCB integration, and leaky_atexit.c reindenting by
Peter Clifton <pc...@ca...>
diff --git a/src/Makefile.am b/src/Makefile.am
index a0f1c50..e287ae7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,6 +72,8 @@ PCB_SRCS = \
find.h \
flags.c \
fontmode.c \
+ free_atexit.c \
+ free_atexit.h \
global.h \
heap.c \
heap.h \
diff --git a/src/free_atexit.c b/src/free_atexit.c
new file mode 100644
index 0000000..dc11f12
--- /dev/null
+++ b/src/free_atexit.c
@@ -0,0 +1,91 @@
+/* COPYRIGHT
+ *
+ * Copyright (C) 2010 PCB Contributors (see ChangeLog for details)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Contact addresses for paper mail and Email:
+ * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA
+ * hac...@ap...
+ *
+ */
+
+
+#include <stdlib.h>
+
+/* we need one ID per context - short int with 64k IDs should be enough */
+typedef unsigned int leaky_idx_t;
+
+
+/* This structure should be as big as void *, which should be the natural
+bit-width of the architecture. We allocate extra admin space to be as big
+as this union, to preserve alignment of pointers returned by malloc().
+NOTE: in the special corner case when leaky_idx_t is wider than void * but
+not multiple of it, the alignment will be messed up, potentially causing slower
+memory access. */
+typedef union {
+ leaky_idx_t idx;
+ void *ptr;
+} leaky_admin_t;
+
+static void **free_list = NULL;
+static leaky_idx_t free_size = 0;
+
+
+void *leaky_malloc (size_t size)
+{
+ void *new_memory = malloc(size + sizeof(leaky_admin_t));
+
+ free_list = realloc (free_list, (free_size + 1) * sizeof(void *));
+ free_list[free_size] = new_memory;
+ *(leaky_idx_t *)new_memory = free_size;
+
+ free_size++;
+ return new_memory + sizeof(leaky_admin_t);
+}
+
+void *leaky_realloc (void* old_memory, size_t size)
+{
+ void *new_memory;
+ leaky_idx_t i;
+
+ if (old_memory == NULL)
+ return leaky_malloc (size);
+
+ old_memory -= sizeof(leaky_admin_t);
+
+ i = *(leaky_idx_t *)old_memory;
+
+ new_memory = realloc (old_memory, size + sizeof(leaky_admin_t));
+ free_list[i] = new_memory;
+
+ return new_memory + sizeof(leaky_admin_t);
+}
+
+void leaky_uninit (void)
+{
+ int i;
+
+ for (i = 0; i < free_size; i++)
+ free (free_list[i]);
+
+ free (free_list);
+ free_size = 0;
+}
+
+void leaky_init (void)
+{
+ atexit(leaky_uninit);
+}
diff --git a/src/free_atexit.h b/src/free_atexit.h
new file mode 100644
index 0000000..3b142b6
--- /dev/null
+++ b/src/free_atexit.h
@@ -0,0 +1,30 @@
+/* This tiny library is to assist cleaning up harmless memory leaks caused
+ by (growing) buffers allocated in static variables in functions. The
+ library provides leaky_ prefixed variants of the common allocation
+ routines. These wrappers will remember all pointers they return and
+ can free all memory used, at the end of the applocation.
+*/
+
+#include <stdlib.h>
+
+#ifdef NDEBUG
+#define leaky_init()
+#define leaky_uninit()
+#define leaky_malloc(size) malloc(size)
+#define leaky_realloc(ptr, size) malloc(ptr, size)
+#else
+
+/* set up atexit() hook - can be avoided if leaky_uninit() is called by hand */
+void leaky_init (void);
+
+/* free all allocations */
+void leaky_uninit (void);
+
+/* allocate memory, remember the pointer and free it after exit from the application */
+void *leaky_malloc (size_t size);
+
+/* reallocate memory, remember the new pointer and free it after exit from the application */
+void *leaky_realloc (void* old_memory, size_t size);
+
+
+#endif
diff --git a/src/main.c b/src/main.c
index 462285d..735fde7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -53,6 +53,7 @@
#include "action.h"
#include "misc.h"
#include "lrealpath.h"
+#include "free_atexit.h"
#include "hid/common/actions.h"
@@ -1028,6 +1029,13 @@ main (int argc, char *argv[])
/* FIX_ME
LoadBackgroundImage (Settings.BackgroundImage); */
+ /* This must be called before any other atexit functions
+ * are registered, as it configures an atexit function to
+ * clean up and free various items of allocated memory,
+ * and must be the last last atexit function to run.
+ */
+ leaky_init ();
+
/* Register a function to be called when the program terminates.
* This makes sure that data is saved even if LEX/YACC routines
* abort the program.
|