Index: src/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid.h =================================================================== --- src/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid.h (revision 787) +++ src/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid.h (revision 788) @@ -1,21 +1,21 @@ #include +/* Type of an HID attribute (usually a widget on an attribute dialog box) */ typedef enum hid_attr_type_e { - HIDA_Label, - HIDA_Integer, - HIDA_Real, - HIDA_String, - HIDA_Boolean, - HIDA_Enum, - HIDA_Mixed, - HIDA_Path, - HIDA_Unit, - HIDA_Coord + HIDA_Label, /* non-editable label displayed on the GUI */ + HIDA_Integer, /* a sugned integer value */ + HIDA_Real, /* a floating point value */ + HIDA_String, /* one line textual input */ + HIDA_Boolean, /* true/false boolean value */ + HIDA_Enum, /* select an item of a predefined list */ + HIDA_Mixed, /* TODO */ + HIDA_Path, /* path to a file or directory */ + HIDA_Unit, /* select a dimension unit */ + HIDA_Coord /* enter a coordinate */ } hid_attr_type_t; gpmi_keyword *kw_hid_attr_type_e; /* of hid_attr_type_t */ - /* TODO: these should not be here; GPMI needs to switch over to c99tree! */ #ifndef FROM_PKG typedef void HID; @@ -23,11 +23,12 @@ typedef void* hidGC; typedef char* HID_Attr_Val; +/* Line or arc ending style */ typedef enum EndCapStyle_e { - Trace_Cap, - Square_Cap, - Round_Cap, - Beveled_Cap + Trace_Cap, /* filled circle (trace drawing) */ + Square_Cap, /* rectangular lines (square pad) */ + Round_Cap, /* round pins or round-ended pads, thermals */ + Beveled_Cap /* octagon pins or bevel-cornered pads */ } EndCapStyle; typedef void *PolygonType; @@ -34,7 +35,6 @@ typedef void *BoxType; #endif - typedef struct hid_s { gpmi_module *module; int attr_num; @@ -45,20 +45,42 @@ hidGC new_gc; } hid_t; -/* Create a new hid context */ +/* Creates a new hid context. Name and description matters only if the hid is +registered as an exporter later. */ hid_t *hid_create(char *hid_name, char *description); -/* Add an attribute in the hid - returns unique ID of the attribute */ +/* Append an attribute in a hid previously created using hid_create(). + Arguments: + hid: hid_t previously created using hid_create() + attr_name: name of the attribute + help: help text for the attribute + type: type of the attribute (input widget type) + min: minimum value of the attribute, if type is integer or real) + max: maximum value of the attribute, if type is integer or real) + default_val: default value of the attribute + Returns an unique ID of the attribute the caller should store for + later reference. For example this ID is used when retrieving the + value of the attribute after the user finished entering data in + the dialog. */ int hid_add_attribute(hid_t *hid, char *attr_name, char *help, hid_attr_type_t type, int min, int max, char *default_val); -/* query an attribute from the hid after dialog_attriutes ran */ +/* Query an attribute from the hid after dialog_attributes() returned. + Arguments: + hid: hid_t previously created using hid_create() + attr_id: the unique ID of the attribute (returned by hid_add_attribute()) + Returns the value (converted to string) set by the user. */ dynamic char *hid_get_attribute(hid_t *hid, int attr_id); -/* Register the hid; call it after attributes and... are all set up */ +/* Register the hid; call it after a hid is created and its attributes + are all set up */ int hid_register(hid_t *hid); -/* Mainly for internal use: */ +/* For internal use */ void hid_gpmi_data_set(hid_t *h, void *data); + +/* For internal use */ hid_t *hid_gpmi_data_get(HID *h); + +/* For internal use */ nowrap HID_Attr_Val hid_string2val(const hid_attr_type_t type, const char *str); Index: src/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_events.h =================================================================== --- src/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_events.h (revision 787) +++ src/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_events.h (revision 788) @@ -2,26 +2,59 @@ /* Called before get_exporter_options returns the option list to the GUI hid */ gpmi_define_event(HIDE_get_export_options)(void *hid); + /* Called before export redraw starts */ gpmi_define_event(HIDE_do_export_start)(void *hid); + /* Called after export redraw finihsed */ gpmi_define_event(HIDE_do_export_finish)(void *hid); +/* DRAWING */ -/* PCB callback events for drawing */ +/* PCB callback events for drawing: change layer */ gpmi_define_event(HIDE_set_layer)(void *hid, const char *name, int group, int empty); + +/* PCB callback events for drawing: change drawing color */ gpmi_define_event(HIDE_set_color)(void *hid, void *gc, const char *name); + +/* PCB callback events for drawing: change drawing line cap style*/ gpmi_define_event(HIDE_set_line_cap)(void *hid, void *gc, EndCapStyle style); + +/* PCB callback events for drawing: change drawing line width */ gpmi_define_event(HIDE_set_line_width)(void *hid, void *gc, int width); + +/* PCB callback events for drawing: toggle xor drawing method */ gpmi_define_event(HIDE_set_draw_xor)(void *hid, void *gc, int xor); + +/* PCB callback events for drawing: toggle faded drawing method */ gpmi_define_event(HIDE_set_draw_faded)(void *hid, void *gc, int faded); + +/* PCB callback events for drawing: draw a line */ gpmi_define_event(HIDE_draw_line)(void *hid, void *gc, int x1, int y1, int x2, int y2); + +/* PCB callback events for drawing: draw an arc from center cx;cy */ gpmi_define_event(HIDE_draw_arc)(void *hid, void *gc, int cx, int cy, int xradius, int yradius, double start_angle, double delta_angle); + +/* PCB callback events for drawing: draw a rectangle */ gpmi_define_event(HIDE_draw_rect)(void *hid, void *gc, int x1, int y1, int x2, int y2); + +/* PCB callback events for drawing: draw a filled circle */ gpmi_define_event(HIDE_fill_circle)(void *hid, void *gc, int cx, int cy, int radius); + +/* PCB callback events for drawing: draw a filled ploygon */ gpmi_define_event(HIDE_fill_polygon)(void *hid, void *gc, int n_coords, int *x, int *y); + +/* PCB callback events for drawing: draw a filled rectangle */ gpmi_define_event(HIDE_fill_rect)(void *hid, void *gc, int x1, int y1, int x2, int y2); + +/* PCB callback events for drawing: TODO */ gpmi_define_event(HIDE_use_mask)(void *hid, int use_it); + +/* PCB callback events for drawing: create a new graphical context */ gpmi_define_event(HIDE_make_gc)(void *hid, void *gc); + +/* PCB callback events for drawing: destroy a graphical context */ gpmi_define_event(HIDE_destroy_gc)(void *hid, void *gc); + +/* PCB callback events for drawing: TODO */ gpmi_define_event(HIDE_fill_pcb_pv)(void *hid, void *fg_gc, void *bg_gc, void *pad, int drawHole, int mask);