[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gEDA-dev: [pcb] multiple hids in one .so
<snip>
>> If adding the hid pointer to those calls is really that bad, why not
>> adding a new global variable called "current_exporter" which would
>> be set in the gui hids, before the first call to the exporter? It
>> would be less than 16 new lines in the code, I think :)
>
>I think this is a reasonable solution for now (until we switch to C++ :).
The patch is attached. This is the first time I'm adding anything in PCB
so feel free to correct me if I did something wrong.
Regards
Igor2
Index: hid.h
===================================================================
RCS file: /cvsroot/pcb/pcb/src/hid.h,v
retrieving revision 1.12
diff -u -r1.12 hid.h
--- hid.h 2 Oct 2006 04:51:35 -0000 1.12
+++ hid.h 5 Oct 2006 14:30:02 -0000
@@ -455,6 +455,10 @@
hid_start_gui. */
extern HID *gui;
+/* This is either NULL or points to the current HID that is being called to
+ do the exporting. The gui HIDs set and unset this var.*/
+ extern HID *exporter;
+
/* The GUI may set this to be approximately the PCB size of a pixel,
to allow for near-misses in selection and changes in drawing items
smaller than a screen pixel. */
Index: hid/common/hidinit.c
===================================================================
RCS file: /cvsroot/pcb/pcb/src/hid/common/hidinit.c,v
retrieving revision 1.9
diff -u -r1.9 hidinit.c
--- hid/common/hidinit.c 2 Oct 2006 04:51:36 -0000 1.9
+++ hid/common/hidinit.c 5 Oct 2006 14:30:02 -0000
@@ -35,6 +35,7 @@
extern HID hid_nogui;
HID *gui = &hid_nogui;
+HID *exporter = NULL;
int pixel_slop = 1;
Index: hid/gtk/gui-dialog-print.c
===================================================================
RCS file: /cvsroot/pcb/pcb/src/hid/gtk/gui-dialog-print.c,v
retrieving revision 1.3
diff -u -r1.3 gui-dialog-print.c
--- hid/gtk/gui-dialog-print.c 5 Apr 2006 04:22:15 -0000 1.3
+++ hid/gtk/gui-dialog-print.c 5 Oct 2006 14:30:02 -0000
@@ -326,7 +326,6 @@
GHidPort *out = &ghid_port;
int i;
HID **hids;
- HID *exporter = NULL;
GtkTooltips *tips;
tips = gtk_tooltips_new ();
@@ -376,4 +375,6 @@
if (export_dialog != NULL)
gtk_widget_destroy (export_dialog);
export_dialog = NULL;
+
+ exporter = NULL;
}
Index: hid/lesstif/dialogs.c
===================================================================
RCS file: /cvsroot/pcb/pcb/src/hid/lesstif/dialogs.c,v
retrieving revision 1.18
diff -u -r1.18 dialogs.c
--- hid/lesstif/dialogs.c 25 Sep 2006 23:02:36 -0000 1.18
+++ hid/lesstif/dialogs.c 5 Oct 2006 14:30:03 -0000
@@ -968,6 +968,8 @@
return 1;
printer = hids[i - 1];
+ exporter = printer;
+
opts = printer->get_export_options (&n);
vals = (HID_Attr_Val *) calloc (n, sizeof (HID_Attr_Val));
if (lesstif_attribute_dialog (opts, n, vals))
@@ -977,6 +979,7 @@
}
printer->do_export (vals);
free (vals);
+ exporter = NULL;
return 0;
}
_______________________________________________
geda-dev mailing list
geda-dev@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev