Index: doc-rnd/gpmi/packages/Makefile =================================================================== --- doc-rnd/gpmi/packages/Makefile (nonexistent) +++ doc-rnd/gpmi/packages/Makefile (revision 778) @@ -0,0 +1,9 @@ +ROOT=../../.. +all: actions_ref.html dialogs_ref.html hid_ref.html layout_ref.html + +include $(ROOT)/src/pcb-gpmi/Makefile.config + +%_ref.html: $(ROOT)/src/pcb-gpmi/gpmi_plugin/gpmi_pkg/%.h + $(ROOT)/util/genref.sh $^ $(ROOT) $(PCB_CFLAGS) >$@ + + Index: doc-rnd/gpmi/packages/actions.html =================================================================== --- doc-rnd/gpmi/packages/actions.html (revision 777) +++ doc-rnd/gpmi/packages/actions.html (revision 778) @@ -102,78 +102,5 @@ of create_menu() is executed. Thus the script usually registers a new action first then registers one or more menu items executing those actions. -

API reference

-

event ACTE_action(int event_id, const char *name, int argc, int x, int y)

- Arguments: -
    -
  1. event_id -
  2. const char *name: name of the action (as registed using function action_register()) -
  3. int argc: number of arguments. Arguments can be accessed using function action_arg -
  4. int x, int y: optional coords, if need_xy was not empty at action_register -
- -

function action_register(const char *name, const char *need_xy, const char *description, const char *syntax)

- Arguments: -
    -
  1. const char *name: name of the action -
  2. const char *need_xy: the question the user is asked when he needs to choose a coordinate; if empty, no coordinate is asked -
  3. const char *description: description of the action (for the help) -
  4. const char *syntax: syntax of the action (for the help) -
- Returns 0 on success. -

- Multiple actions can be registered. Any action registered by the script - will trigger an ACTE_event sent to the script. - -

function const char *action_arg(int argn)

- Extracts action argument argn for the current action - (makes sense only in an ACTE_action event handler). - Arguments: -
    -
  1. int N: return the Nth argument -
- Returns an argument or empty string if N is out of range [0..argc-1]. -

- PCB action optionally have arguments. - The interface is "int argc, char *argv[]" based in PCB. - Due to syntax limitations the event handler does not receive argv directly,. - The script can access te argv[] array using action_arg(). - -

event ACTE_gui_init(int event_id, int argc, char **argv);

- Called right after gui initialization, before the gui main loop. - Arguments: -
    -
  1. event_id -
  2. int argc: number of arguments the gui was initialized with. -
  3. char **argv[]: arguments the gui was initialized with - unaccessible for the scripts. -
- -

event ACTE_unload(int event_id, const char *conffile);

- Called right before unloading a script to give the script a chance - to clean up. - Arguments: -
    -
  1. event_id -
  2. const char *conffile: the name of the config file that originally triggered laoding the script, or empty if the script was loaded from the gui. -
- -

function int action(const char *cmdline)

- Execute a pcb-rnd action. Returns non-zero on error; generally - returns value of the action (which is also non-zero on error). -
    -
  1. const char *cmdline: pcb-rnd command line in action_name(arg1, arg2, ..., argN) format -
- -

function void create_menu(const char *path, const char *action, const char *mnemonic, const char *hotkey, const char *tooltip)

- Create a new menu or submenu at path. Missing parents are created automatically - with empty action, mnemonic, hotkey and tooltop. -
    -
  1. const char *path: the full path of the new menu -
  2. const char *action: this action is executed when the user clicks on the menu -
  3. const char *mnemonic: which letter to underline in the menu text (will be the fast-jump-there key once the menu is open) -
  4. const char *hotkey: when this key is pressed in the main gui, the action is also triggered; the format is modifiers<Key>letter, where modifiers is Alt, Shift or Ctrl. This is the same syntax that is used in the .res files. -
  5. const char *tooltip: short help text -
- Index: doc-rnd/gpmi/packages/actions_ref.html =================================================================== --- doc-rnd/gpmi/packages/actions_ref.html (nonexistent) +++ doc-rnd/gpmi/packages/actions_ref.html (revision 778) @@ -0,0 +1,77 @@ + + +

PCB GPMI

+

Reference manual for package actions

+Automatically generated from actions.h + +

Events

+
+

Events do not have return value. The first argument is always the even id + +

ACTE_action(int event_id, char* name, int argc, int x, int y)

+
+ Generated when an action registered by the script is executed.
+   Arguments:
+    name: name of the action (as registed using function action_register())
+    argc: number of arguments. Arguments can be accessed using function action_arg
+    x, y: optional coords, if need_xy was not empty at action_register 
+
+
+

ACTE_gui_init(int event_id, int argc, char** argv)

+
+ Generated right after gui initialization, before the gui main loop.
+   Arguments:
+    argc: number of arguments the gui was initialized with.
+    argv[]: arguments the gui was initialized with - unaccessible for the scripts. 
+
+
+

ACTE_unload(int event_id, char* conffile)

+
+ Generated right before unloading a script to give the script a chance
+   to clean up.
+   Arguments:
+    conffile: the name of the config file that originally triggered laoding the script, or empty if the script was loaded from the gui. 
+
+
+

Functions

+
+

The following functions are registered in script context. + +

int action_register(char* name, char* need_xy, char* description, char* syntax)

+
+ Register an action in PCB - when the action is executed, event
+   ACTE_action is generated with the action name.
+   Multiple actions can be registered. Any action registered by the script
+   will trigger an ACTE_event sent to the script.
+   Arguments:
+    name: name of the action
+    need_xy: the question the user is asked when he needs to choose a coordinate; if empty, no coordinate is asked
+    description: description of the action (for the help)
+    syntax: syntax of the action (for the help)
+   Returns 0 on success.
+ 
+
+
+

int action(char* cmdline)

+
+ call an existing action using PCB syntax (e.g. foo(1, 2, 3))
+   Returns non-zero on error; generally returns value of the action
+   (which is also non-zero on error). 
+
+
+

void create_menu(char* path, char* action, char* mnemonic, char* hotkey, char* tooltip)

+
+ Create a new menu or submenu at path. Missing parents are created
+   automatically with empty action, mnemonic, hotkey and tooltip.
+   Arguments:
+    path: the full path of the new menu
+    action: this action is executed when the user clicks on the menu
+    mnemonic: which letter to underline in the menu text (will be the fast-jump-there key once the menu is open)
+    hotkey: when this key is pressed in the main gui, the action is also triggered; the format is modifiers<Key>letter, where modifiers is Alt, Shift or Ctrl. This is the same syntax that is used in the .res files.
+    tooltip: short help text 
+
+
+ + + +