gEDA-dev: [pcb] multiple hids in one .so
Igor2
igor2 at inno.bme.hu
Mon Oct 2 01:18:11 EDT 2006
On Mon, 2 Oct 2006, DJ Delorie wrote:
>
>> Great, so could you add a cookie field in the HID structure and
>> change the get_exporter_options() to carry a pointer to the HID
>> structure or carry the cookie or anything that helps the code to
>> identify the HID? :)
>
>Once we start down this road, how many of the HID functions will we
>need to change?
All callbacks that don't have gc param. If make_gc() also has the info
needed, one can pack it in the gc if it wants. It seems there are 24 with
the make_gc(), list is attached.
Other ways around would be:
1. let's say PCB will never be multithreaded so using global variables in
the API is ok (like it uses gui now). In this case the GUI hids should set
a global var pointing to the selected HID. I'm not sure this would be a
smaller patch but it would look worse :)
2. let's pass HID to _all_ calls and the drawing ones would extract gc
from the HID structure. It's more work but would make the interface more
orthogonal.
3. Add a set_hid() callback that would inform the .so which hid is
selected. Called only once, before any other hid function. Probably this
is the less painful to add, but it seems like some workaround.
-------------- next part --------------
hidGC (*make_gc) (void);
HID_Attribute *(*get_export_options) (int *n_ret);
void (*do_export) (HID_Attr_Val * options);
void (*parse_arguments) (int *argc, char ***argv);
void (*invalidate_wh) (int x, int y, int width, int height, int last);
void (*invalidate_lr) (int left, int right, int top, int bottom, int last);
void (*invalidate_all) (void);
int (*set_layer) (const char *name, int group);
void (*use_mask) (int use_it);
void (*calibrate) (double xval, double yval);
int (*shift_is_pressed) (void);
int (*control_is_pressed) (void);
void (*get_coords) (const char *msg, int *x, int *y);
void (*set_crosshair) (int x, int y);
hidval (*add_timer) (void (*func) (hidval user_data),
void (*stop_timer) (hidval timer);
void (*log) (const char *fmt, ...);
void (*logv) (const char *fmt, va_list args);
int (*confirm_dialog) (char *msg, ...);
void (*report_dialog) (char *title, char *msg);
char *(*prompt_for) (char *msg, char *default_string);
int (*attribute_dialog) (HID_Attribute * attrs, int n_attrs, HID_Attr_Val * results);
void (*show_item) (void *item);
void (*beep) (void);
More information about the geda-dev
mailing list