pcb 4.1.1
An interactive printed circuit board layout editor.

hid_st Struct Reference

This is the main HID structure. More...

#include <hid.h>

Collaboration diagram for hid_st:

Data Fields

int struct_size
const char * name
const char * description
char gui:1
char printer:1
char exporter:1
char poly_before:1
char poly_after:1
HID_Attribute *(* get_export_options )(int *n_ret_)
void(* do_export )(HID_Attr_Val *options_)
void(* uninit )(HID *hid)
void(* do_exit )(HID *hid)
void(* parse_arguments )(int *argc_, char ***argv_)
void(* invalidate_lr )(Coord left_, Coord right_, Coord top_, Coord bottom_)
void(* invalidate_all )(void)
void(* notify_crosshair_change )(bool changes_complete)
void(* notify_mark_change )(bool changes_complete)
int(* set_layer )(const char *name_, int group_, int _empty)
void(* end_layer )(void)
HID_DRAWgraphics
void(* calibrate )(double xval_, double yval_)
int(* shift_is_pressed )(void)
int(* control_is_pressed )(void)
int(* mod1_is_pressed )(void)
void(* get_coords )(const char *msg_, Coord *x_, Coord *y_)
void(* set_crosshair )(int x_, int y_, int cursor_action_)
hidval(* add_timer )(void(*func)(hidval user_data_), unsigned long milliseconds_, hidval user_data_)
void(* stop_timer )(hidval timer_)
hidval(* watch_file )(int fd_, unsigned int condition_, void(*func_)(hidval watch_, int fd_, unsigned int condition_, hidval user_data_), hidval user_data)
void(* unwatch_file )(hidval watch_)
hidval(* add_block_hook )(void(*func_)(hidval data_), hidval data_)
void(* stop_block_hook )(hidval block_hook_)
void(* log )(const char *fmt_,...)
void(* logv )(const char *fmt_, va_list args_)
int(* confirm_dialog )(char *msg_,...)
int(* close_confirm_dialog )()
void(* report_dialog )(char *title_, char *msg_)
char *(* prompt_for )(const char *msg_, const char *default_string_)
char *(* fileselect )(const char *title_, const char *descr_, char *default_file_, char *default_ext_, const char *history_tag_, int flags_)
int(* attribute_dialog )(HID_Attribute *attrs_, int n_attrs_, HID_Attr_Val *results_, const char *title_, const char *descr_)
void(* show_item )(void *item_)
void(* beep )(void)
int(* progress )(int so_far_, int total_, const char *message_)
HID_DRC_GUIdrc_gui
void(* edit_attributes )(char *owner, AttributeListType *attrlist_)
HID_DRAW *(* request_debug_draw )(void)
void(* flush_debug_draw )(void)
void(* finish_debug_draw )(void)
void(* notify_save_pcb )(const char *filename, bool done)
void(* notify_filename_changed )(void)

Detailed Description

This is the main HID structure.

Definition at line 354 of file hid.h.


Field Documentation

hidval(* hid_st::add_block_hook)(void(*func_)(hidval data_), hidval data_)

Causes func to be called in the main loop prior to blocking.

Definition at line 570 of file hid.h.

Referenced by common_nogui_init(), hid_batch_init(), hid_lesstif_init(), and pcb_dbus_connection_setup_with_mainloop().

hidval(* hid_st::add_timer)(void(*func)(hidval user_data_), unsigned long milliseconds_, hidval user_data_)

Causes func to be called at some point in the future.

Timers are only good for *one* call; if you want it to repeat, add another timer during the callback for the first.

user_data can be anything, it's just passed to func.

Warning:
Times are not guaranteed to be accurate.

Definition at line 541 of file hid.h.

Referenced by backup_cb(), common_nogui_init(), EnableAutosave(), hid_batch_init(), hid_lesstif_init(), NotifyMode(), timeout_add(), and timeout_handler_cb().

int(* hid_st::attribute_dialog)(HID_Attribute *attrs_, int n_attrs_, HID_Attr_Val *results_, const char *title_, const char *descr_)

A generic dialog to ask for a set of attributes.

If n_attrs_ is zero, attrs(.name) must be NULL terminated.

Returns non-zero if an error occurred (usually, this means the user cancelled the dialog or something).

title_ is the title of the dialog box.

descr_ (if not NULL) can be a longer description of what the attributes are used for.

The HID may choose to ignore it or it may use it for a tooltip or text in a dialog box, or a help string.

Definition at line 670 of file hid.h.

Referenced by common_nogui_init(), hid_batch_init(), hid_lesstif_init(), PrintCalibrate(), and ps_calibrate_1().

void(* hid_st::calibrate)(double xval_, double yval_)

This is for the printer.

If you call this for the GUI, xval_ and yval_ are ignored, and a dialog pops up to lead you through the calibration procedure.

For the printer, if xval_ and yval_ are zero, a calibration page is printed with instructions for calibrating your printer.

After calibrating, nonzero xval_ and yval_ are passed according to the instructions.

Metric is nonzero if the user prefers metric units, else inches are used.

Definition at line 487 of file hid.h.

Referenced by ActionPSCalib(), common_nogui_init(), hid_batch_init(), hid_eps_init(), hid_gcode_init(), hid_gerber_init(), hid_gsvit_init(), hid_lesstif_init(), hid_lpr_init(), hid_nelma_init(), hid_png_init(), PrintCalibrate(), and ps_ps_init().

A close confirmation dialog for unsaved pages, for example, with options "Close without saving", "Cancel" and "Save".

Returns zero if the close is cancelled, or one if it should proceed.

The HID is responsible for any "Save" action the user may wish before confirming the close.

Definition at line 599 of file hid.h.

Referenced by ActionQuit(), common_nogui_init(), and hid_lesstif_init().

int(* hid_st::confirm_dialog)(char *msg_,...)

A generic yes/no dialog.

Returns zero if the cancel button is pressed, one for the ok button.

If you specify alternate labels for ..., they are used instead of the default OK/Cancel ones, and the return value is the index of the label chosen.

Warning:
You MUST pass NULL as the last parameter to this.

Definition at line 586 of file hid.h.

Referenced by ActionAutoPlaceSelected(), ActionElementList(), ActionLoadFrom(), ActionNew(), ActionRenumber(), ChangePolygonClearSize(), CheckAndOpenFile(), ClearUndoList(), common_nogui_init(), GlobalPuller(), hid_lesstif_init(), maybe_pull_1(), MoveLayer(), and throw_drc_dialog().

void(* hid_st::do_exit)(HID *hid)

uninit a GUI hid.

Definition at line 436 of file hid.h.

Referenced by hid_lesstif_init(), and QuitApplication().

void(* hid_st::do_export)(HID_Attr_Val *options_)

Export (or print) the current PCB.

The options given represent the choices made from the options returned from get_export_options.

Call with options == NULL to start the primary GUI (create a main window, print, export, etc).

Definition at line 423 of file hid.h.

Referenced by common_nogui_init(), Export(), ghid_dialog_print(), hid_batch_init(), hid_bom_init(), hid_eps_init(), hid_gcode_init(), hid_gerber_init(), hid_gsvit_init(), hid_ipcd356_init(), hid_lesstif_init(), hid_lpr_init(), hid_nelma_init(), hid_png_init(), main(), Print(), and ps_ps_init().

void(* hid_st::edit_attributes)(char *owner, AttributeListType *attrlist_)

Definition at line 714 of file hid.h.

Referenced by ActionAttributes(), and hid_lesstif_init().

void(* hid_st::end_layer)(void)

Tell the GUI the layer last selected has been finished with.

Definition at line 482 of file hid.h.

Referenced by common_nogui_init(), DrawEverything(), and ghid_init_renderer().

If set, this HID provides an export option, and should be used as part of the File->Export menu option.

Examples are PNG, Gerber, and EPS exporters.

Definition at line 390 of file hid.h.

Referenced by hid_bom_init(), hid_eps_init(), hid_gcode_init(), hid_gerber_init(), hid_gsvit_init(), hid_ipcd356_init(), hid_nelma_init(), hid_png_init(), hid_ps_init(), and main().

char*(* hid_st::fileselect)(const char *title_, const char *descr_, char *default_file_, char *default_ext_, const char *history_tag_, int flags_)

title_ may be used as a dialog box title. Ignored if NULL.

descr_ is a longer help string. Ignored if NULL.

default_file_ is the default file name. Ignored if NULL.

default_ext_ is the default file extension, like ".pdf". Ignored if NULL.

history_tag_ may be used by the GUI to keep track of file history. Examples would be "board", "vendor", "renumber", etc. If NULL, no specific history is kept.

flags_ are the bitwise or of the HID_FILESELECT defines above.

Definition at line 650 of file hid.h.

Referenced by ActionLoadVendorFrom(), ActionPasteBuffer(), ActionRenumber(), common_nogui_init(), hid_lesstif_init(), and OpenConnectionDataFile().

When finished, the user must inform the GUI to clean up resources.

Any remaining rendering will be flushed to the screen.

Definition at line 744 of file hid.h.

Referenced by AutoRoute(), common_nogui_init(), and hid_lesstif_init().

void(* hid_st::flush_debug_draw)(void)

Flush pending drawing to the screen.

May be implemented as a NOOP if the GUI has chosen to send the debug drawing directly to the screen.

Definition at line 737 of file hid.h.

Referenced by common_nogui_init(), hid_lesstif_init(), and TracePath().

Returns a set of resources describing options the export or print HID supports.

In GUI mode, the print/export dialogs use this to set up the selectable options.

In command line mode, these are used to interpret command line options.

If n_ret_ is non-NULL, the number of attributes is stored there.

Definition at line 409 of file hid.h.

Referenced by common_nogui_init(), Export(), ghid_dialog_print(), hid_batch_init(), hid_bom_init(), hid_eps_init(), hid_gcode_init(), hid_gerber_init(), hid_gsvit_init(), hid_ipcd356_init(), hid_lesstif_init(), hid_lpr_init(), hid_nelma_init(), hid_png_init(), lpr_get_export_options(), Print(), print_defaults(), ps_ps_init(), and usage_hid().

If set, this is the GUI HID.

Exactly one of these three flags must be set; setting "gui" lets the expose callback optimize and coordinate itself.

Definition at line 375 of file hid.h.

Referenced by _draw_pv(), _draw_pv_name(), draw_element_name(), DrawEverything(), DrawLayerGroup(), DrawPPV(), hid_batch_init(), hid_lesstif_init(), print_defaults(), and usage_hid().

void(* hid_st::invalidate_lr)(Coord left_, Coord right_, Coord top_, Coord bottom_)

This may be called to ask the GUI to force a redraw of a given area.

Definition at line 449 of file hid.h.

Referenced by common_nogui_init(), Draw(), hid_batch_init(), and hid_lesstif_init().

void(* hid_st::log)(const char *fmt_,...)
void(* hid_st::logv)(const char *fmt_, va_list args_)

Log a message to the log window.

Definition at line 583 of file hid.h.

Referenced by common_nogui_init(), hid_lesstif_init(), and Message().

Definition at line 512 of file hid.h.

Referenced by common_nogui_init(), EnforceLineDRC(), hid_batch_init(), and hid_lesstif_init().

const char* hid_st::name

The name of this HID.

This should be suitable for command line options, multi-selection menus, file names, etc.

Definition at line 365 of file hid.h.

Referenced by DrawRats(), hid_batch_init(), hid_bom_init(), hid_eps_init(), hid_extents_init(), hid_gcode_init(), hid_gerber_init(), hid_gsvit_init(), hid_ipcd356_init(), hid_lesstif_init(), hid_lpr_init(), hid_nelma_init(), hid_nogui_get_hid(), hid_png_init(), hid_ps_init(), hid_register_hid(), print_defaults(), and usage_hid().

void(* hid_st::notify_crosshair_change)(bool changes_complete)

Definition at line 457 of file hid.h.

Referenced by hid_lesstif_init(), and notify_crosshair_change().

Notification to the GUI that the PCB file has been renamed.

Definition at line 761 of file hid.h.

Referenced by ActionSaveTo().

void(* hid_st::notify_mark_change)(bool changes_complete)

Definition at line 459 of file hid.h.

Referenced by hid_lesstif_init(), and notify_mark_change().

void(* hid_st::notify_save_pcb)(const char *filename, bool done)

Notification to the GUI around saving the PCB file.

Called with a false parameter before the save, called again with true after the save.

Allows GUIs which watch for file-changes on disk to ignore our deliberate changes.

Definition at line 751 of file hid.h.

Referenced by SavePCB().

void(* hid_st::parse_arguments)(int *argc_, char ***argv_)

Parse the command line.

Call this early for whatever HID will be the primary HID, as it will set all the registered attributes.

The HID should remove all arguments, leaving any possible file names behind.

Definition at line 439 of file hid.h.

Referenced by common_nogui_init(), hid_batch_init(), hid_bom_init(), hid_eps_init(), hid_gcode_init(), hid_gerber_init(), hid_gsvit_init(), hid_ipcd356_init(), hid_lesstif_init(), hid_lpr_init(), hid_nelma_init(), hid_png_init(), main(), and ps_ps_init().

If set, the redraw code will draw polygons after erasing the clearances.

Note:
Note that HIDs may set both of these, in which case polygons will be drawn twice.

Definition at line 402 of file hid.h.

Referenced by DrawMaskBoardArea(), DrawSilk(), eps_hid_export_to_file(), and hid_eps_init().

If set, the redraw code will draw polygons before erasing the clearances.

Definition at line 397 of file hid.h.

Referenced by DrawMaskBoardArea(), DrawSilk(), eps_hid_export_to_file(), hid_extents_init(), hid_gcode_init(), hid_gsvit_init(), hid_lesstif_init(), hid_lpr_init(), hid_nelma_init(), hid_png_init(), and hid_ps_init().

If set, this is the printer-class HID.

The common part of PCB may use this to do command-line printing, without having instantiated any GUI HIDs. Only one printer HID is normally defined at a time.

Definition at line 382 of file hid.h.

Referenced by hid_lpr_init(), and main().

int(* hid_st::progress)(int so_far_, int total_, const char *message_)

Used by optimizers and autorouter to show progress to the user.

Pass all zeros to flush display and remove any dialogs.

Returns nonzero if the user wishes to cancel the operation.

Definition at line 703 of file hid.h.

Referenced by AutoRoute(), common_nogui_init(), hid_lesstif_init(), move_corner(), and RouteAll().

char*(* hid_st::prompt_for)(const char *msg_, const char *default_string_)

Prompts the user to enter a string, returns the string.

If default_string isn't NULL, the form is pre-filled with this value.

"msg" is like "Enter value:".

Definition at line 616 of file hid.h.

Referenced by ActionChangeName(), ActionFreeRotateBuffer(), ActionImport(), ActionNew(), ActionSelect(), ActionUnselect(), common_nogui_init(), hid_lesstif_init(), NotifyMode(), and QueryInputAndChangeObjectName().

void(* hid_st::report_dialog)(char *title_, char *msg_)

Just prints text.

Definition at line 613 of file hid.h.

Referenced by common_nogui_init(), hid_lesstif_init(), ReportDialog(), ReportDrills(), and ReportFoundPins().

Request permission for debug drawing.

Returns a HID_DRAW pointer which should be used rather than the global gui->graphics-> for making drawing calls.

If the return value is NULL, then permission has been denied, and the drawing must not continue.

Warning:
Debug drawing is not guaranteed to be re-entrant. The caller must not nest requests for debug drawing.

Definition at line 724 of file hid.h.

Referenced by AutoRoute(), common_nogui_init(), and hid_lesstif_init().

void(* hid_st::set_crosshair)(int x_, int y_, int cursor_action_)

Sets the crosshair, which may differ from the pointer depending on grid and pad snap.

Note:
Note that the HID is responsible for hiding, showing, redrawing, etc. The core just tells it what coordinates it's actually using.
Note that this routine may need to know what "pcb units" are so it can display them in mm or mils accordingly.

If cursor_action_ is set, the cursor or screen may be adjusted so that the cursor and the crosshair are at the same point on the screen.

Definition at line 516 of file hid.h.

Referenced by CenterDisplay(), common_nogui_init(), CursorAction(), FitCrosshairIntoGrid(), hid_batch_init(), hid_eps_init(), hid_gcode_init(), hid_gerber_init(), hid_gsvit_init(), hid_lesstif_init(), hid_nelma_init(), hid_png_init(), netnode_browse(), node_selection_changed_cb(), and ps_ps_init().

int(* hid_st::set_layer)(const char *name_, int group_, int _empty)

During redraw or print/export cycles, this is called once per layer (or layer group, for copper layers).

If it returns false (zero), the HID does not want that layer, and none of the drawing functions should be called.

If it returns true (nonzero), the items in that layer [group] should be drawn using the various drawing functions.

In addition to the MAX_GROUP copper layer groups, you may select layers indicated by the macros SL_* defined above, or any others with an index of -1.

For copper layer groups, you may pass NULL for name to have a name fetched from the PCB struct.

The EMPTY argument is a hint - if set, the layer is empty, if zero it may be non-empty.

Definition at line 461 of file hid.h.

Referenced by common_nogui_init(), DrawEverything(), hid_batch_init(), hid_eps_init(), hid_extents_init(), hid_gcode_init(), hid_gerber_init(), hid_gsvit_init(), hid_lesstif_init(), hid_nelma_init(), hid_png_init(), and ps_ps_init().

void(* hid_st::show_item)(void *item_)

This causes a second window to display, which only shows the selected item.

The expose callback is called twice; once to size the extents of the item, and once to draw it.

To pass magic values, pass the address of a variable created for this purpose.

Definition at line 689 of file hid.h.

Referenced by ActionDisplay(), common_nogui_init(), hid_batch_init(), and hid_lesstif_init().

void(* hid_st::stop_block_hook)(hidval block_hook_)

Use this to stop a main loop block hook.

Definition at line 575 of file hid.h.

Referenced by common_nogui_init(), hid_batch_init(), and hid_lesstif_init().

void(* hid_st::stop_timer)(hidval timer_)

Use this to stop a timer that hasn't triggered yet.

Definition at line 553 of file hid.h.

Referenced by common_nogui_init(), EnableAutosave(), hid_batch_init(), hid_lesstif_init(), and timeout_handler_dbus_freed().

The size of this structure.

We use this as a compatibility check; a HID built with a different hid.h than we're expecting should have a different size here.

Definition at line 357 of file hid.h.

Referenced by hid_batch_init(), hid_bom_init(), hid_eps_init(), hid_extents_init(), hid_gcode_init(), hid_gerber_init(), hid_gsvit_init(), hid_ipcd356_init(), hid_lesstif_init(), hid_lpr_init(), hid_nelma_init(), hid_nogui_get_hid(), hid_png_init(), hid_ps_init(), and hid_register_hid().

void(* hid_st::uninit)(HID *hid)

uninit a GUI hid.

Definition at line 433 of file hid.h.

Referenced by hid_lesstif_init(), and pcb_main_uninit().

void(* hid_st::unwatch_file)(hidval watch_)

Use this to stop a file watch.

Definition at line 567 of file hid.h.

Referenced by common_nogui_init(), hid_batch_init(), hid_lesstif_init(), and io_watch_handler_dbus_freed().

hidval(* hid_st::watch_file)(int fd_, unsigned int condition_, void(*func_)(hidval watch_, int fd_, unsigned int condition_, hidval user_data_), hidval user_data)

Causes func_ to be called when some condition occurs on the file descriptor passed.

Conditions include data for reading, writing, hangup, and errors.

user_data can be anything, it's just passed to func_.

Definition at line 556 of file hid.h.

Referenced by common_nogui_init(), hid_batch_init(), hid_lesstif_init(), and watch_add().


The documentation for this struct was generated from the following file: