# PCB GPMI

## Reference manual for package hid

Automatically generated from hid.h

### Enums

Enum values should be passed on as strings.

#### hid_attr_type_e

     Type of an HID attribute (usually a widget on an attribute dialog box)

value | meaning
--- | ---
HIDA_Label | non-editable label displayed on the GUI
HIDA_Integer | a signed 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

#### EndCapStyle_e

     Line or arc ending style

value | meaning
--- | ---
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

### Events

Events do not have return value. The first argument is always the even id. Event handlers defined in scripts get all event arguments converted to string (types below are informational).

#### HIDE_get_export_options(int event_id, void* hid)

     Called before get_exporter_options returns the option list to the GUI hid

#### HIDE_do_export_start(int event_id, void* hid)

     Called before export redraw starts

#### HIDE_do_export_finish(int event_id, void* hid)

     Called after export redraw finished

#### HIDE_set_layer(int event_id, void* hid, const char* name, int group, int empty)

     PCB callback events for drawing: change layer

#### HIDE_set_color(int event_id, void* hid, void* gc, const char* name)

     PCB callback events for drawing: change drawing color

#### HIDE_set_line_cap(int event_id, void* hid, void* gc, EndCapStyle style)

     PCB callback events for drawing: change drawing line cap style

#### HIDE_set_line_width(int event_id, void* hid, void* gc, int width)

     PCB callback events for drawing: change drawing line width

#### HIDE_set_draw_xor(int event_id, void* hid, void* gc, int xor)

     PCB callback events for drawing: toggle xor drawing method

#### HIDE_set_draw_faded(int event_id, void* hid, void* gc, int faded)

     PCB callback events for drawing: toggle faded drawing method

#### HIDE_draw_line(int event_id, void* hid, void* gc, int x1, int y1, int x2, int y2)

     PCB callback events for drawing: draw a line

#### HIDE_draw_arc(int event_id, void* hid, void* gc, int cx, int cy, int xradius, int yradius, double start_angle, double delta_angle)

     PCB callback events for drawing: draw an arc from center cx;cy

#### HIDE_draw_rect(int event_id, void* hid, void* gc, int x1, int y1, int x2, int y2)

     PCB callback events for drawing: draw a rectangle

#### HIDE_fill_circle(int event_id, void* hid, void* gc, int cx, int cy, int radius)

     PCB callback events for drawing: draw a filled circle

#### HIDE_fill_polygon(int event_id, void* hid, void* gc, int n_coords, int* x, int* y)

     PCB callback events for drawing: draw a filled polygon

#### HIDE_fill_rect(int event_id, void* hid, void* gc, int x1, int y1, int x2, int y2)

     PCB callback events for drawing: draw a filled rectangle

#### HIDE_use_mask(int event_id, void* hid, int use_it)

     PCB callback events for drawing: TODO

#### HIDE_make_gc(int event_id, void* hid, void* gc)

     PCB callback events for drawing: create a new graphical context

#### HIDE_destroy_gc(int event_id, void* hid, void* gc)

     PCB callback events for drawing: destroy a graphical context

#### HIDE_fill_pcb_pv(int event_id, void* hid, void* fg_gc, void* bg_gc, void* pad, int drawHole, int mask)

     PCB callback events for drawing: TODO

#### HIDE_fill_pcb_pad(int event_id, void* hid, void* pad, int clear, int mask)

     PCB callback events for drawing: TODO

### Functions

The following functions are registered in script context.

#### hid_t* hid_create(char* hid_name, char* description)

     Creates a new hid context. Name and description matters only if the hid is
    registered as an exporter later.

#### int hid_add_attribute(hid_t* hid, char* attr_name, char* help, hid_attr_type_t type, int min, int max, char* default_val)

     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.

#### char* hid_get_attribute(hid_t* hid, int attr_id)

     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.

#### int hid_register(hid_t* hid)

     Register the hid; call it after a hid is created and its attributes
       are all set up

#### void hid_gpmi_data_set(hid_t* h, void* data)

     For internal use

#### hid_t* hid_gpmi_data_get(HID* h)

     For internal use

#### HID_Attr_Val hid_string2val(const hid_attr_type_t type, const char* str)

     For internal use