Index: doc-rnd/gpmi/packages/dialogs.html =================================================================== --- doc-rnd/gpmi/packages/dialogs.html (revision 623) +++ doc-rnd/gpmi/packages/dialogs.html (revision 624) @@ -7,13 +7,38 @@ on stderr. Note: message arguments usually may contain newline (\n) characters to split the message. -

function void dialog_log(const char *msg)

+

Common conventions

+ Dialog boxes are blocking calls to the GUI HID: when the script + calls a dialog box, the script is suspended until the dialog box + is closed by the user. In other words, dialog boxes behave + as regular function calls from the scripts: when they return, + the dialog is over and the result is known. +

+ The only exception is dialog_progress(), which opens or + updates or closes the already open progress dialog box, and + returns immediately (even when the box is left open). + +

Simple dialogs vs. custom dialogs

+ Most of the calls will pop up a static dialog box. Static means + that widgets are predefined by the GUI HID. The script + is free to fill in data, but can not change the basic structure of + the dialog box. For example dialog_confirm(), dialog_prompt(), + dialog_fileselect() are static. +

+ When the script needs a custom, dynamic dialog box, it needs to + create an attribute dialog. The script sets up a HID + structure using the hid package, builds up all the input fields + then calls dialog_attribute() with the hid. + +

API reference

+ +

function void dialog_log(const char *msg)

Append a message to the log (log window and/or stderr). Arguments:
  1. const char *msg: the message
-

function int dialog_confirm(const char *msg, const char *ok, const char *cancel)

+

function int dialog_confirm(const char *msg, const char *ok, const char *cancel)

Ask the user for confirmation. Returns 0 for cancel and 1 for ok. Arguments:
  1. const char *msg: message to the user @@ -24,7 +49,7 @@ case the GUI will use the default (perhaps localized) labels for those buttons. -

    function void dialog_report(const char *title, const char *msg)

    +

    function void dialog_report(const char *title, const char *msg)

    Pop up a report dialog. Arguments:
    1. const char *title: title of the window @@ -32,7 +57,7 @@
    No return value. -

    function char *dialog_prompt(const char *msg, const char *default_)

    +

    function char *dialog_prompt(const char *msg, const char *default_)

    Prompt the user for a single line textual data. Arguments:
    1. const char *msg: message or question to the user @@ -40,10 +65,10 @@
    Returns what the user typed or NULL (empty) if the user choosed to cancel. -

    function void dialog_beep(void)

    +

    function void dialog_beep(void)

    Beeps. No argument, no return value. -

    function int dialog_progress(int so_far, int total, const char *message)

    +

    function int dialog_progress(int so_far, int total, const char *message)

    Request the GUI hid to draw a progress bar. Arguments:
    1. int so_far: achieved state @@ -58,7 +83,7 @@ break the loop on cancel. After the loop a call with so_far=total+1 should be made to make sure the window is closed. -

      function int dialog_attribute(hid_t *hid, const char *title, const char *descr)

      +

      function int dialog_attribute(hid_t *hid, const char *title, const char *descr)

      Presents the user a custom dialog box, similar to those used by the exporters.
        @@ -69,7 +94,7 @@ Return value: !!!TODO!!!. Values selected by the user are accessed using hid_get_attribute. -

        function char *dialog_fileselect(const char *title, const char *descr, char *default_file_, char *default_ext, const char *history_tag, multiple dialog_fileselect_t flags)

        +

        function char *dialog_fileselect(const char *title, const char *descr, char *default_file_, char *default_ext, const char *history_tag, multiple dialog_fileselect_t flags)

        Pops up a file selection dialog.
        1. const char *title: window title Index: doc-rnd/gpmi/packages/event_id.html =================================================================== --- doc-rnd/gpmi/packages/event_id.html (revision 623) +++ doc-rnd/gpmi/packages/event_id.html (revision 624) @@ -11,8 +11,9 @@

          -The above described case (dispatcher event handler) is rare - most users -can safely ignore this argument, but it must present as the first argument +The case described above (dispatcher in the event handler) is rare. +Most users will bind one event to one function and can safely ignore this +argument. Nevertheless it must present as the first argument on the event handler's argument list. Index: doc-rnd/gpmi/packages/hid.html =================================================================== --- doc-rnd/gpmi/packages/hid.html (revision 623) +++ doc-rnd/gpmi/packages/hid.html (revision 624) @@ -4,18 +4,18 @@ The hid package has two purposes:

            -
          • it is glue layer for exporter dialog boxes and attribute dialog boxes; +
          • it is glue layer for exporter dialog boxes and attribute dialog boxes;
          • it can register exporter HIDs in PCB
          -

          hid package - attribute dialog boxes

          -

          function hid_t *hid_create(char *hid_name, char *description);

          +

          API reference - attribute dialog boxes

          +

          function 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. hid_t is an opaq structure for the package that is used to describe attributes of an attribute dialog or an exporter hid. -

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

          +

          function 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:
            @@ -43,7 +43,7 @@
          1. HIDA_Path: path to a file or directory -

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

            +

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

            Query an attribute from the hid after dialog_attributes() returned.
            1. hid: hid_t previously created using hid_create() @@ -51,8 +51,8 @@
            Returns the value set by the user. -

            hid package - register an exporter

            -

            function int hid_register(hid_t *hid)

            +

            API reference - register an exporter

            +

            function int hid_register(hid_t *hid)

            Register the hid as an exporter. Should be called after all attributes have been added using hid_add_atrtibute(). The export is coordinated by pcb core; when the user request an export using the @@ -63,7 +63,7 @@
          2. an envelope event to finish exporting
          -

          Envelope: events generated before or after exporting

          +

          Envelope: events generated before or after exporting

          • HIDE_get_export_options(void *hid): TODO Generated before get_exporter_options returns the option list to the GUI hid
          • HIDE_do_export_start(void *hid): Generated before export redraw starts @@ -70,7 +70,7 @@
          • HIDE_do_export_finish(void *hid): Generated after export redraw finihsed
          -

          Drawing: events generated during exporting

          +

          Drawing: events generated during exporting

          Note: there may be multiple gcs (graphic contexts), each having its own color, line properties, xor drawing and faded state. Graphic contexts are created and destroyed by the following events: Index: doc-rnd/gpmi/packages/layout.html =================================================================== --- doc-rnd/gpmi/packages/layout.html (revision 623) +++ doc-rnd/gpmi/packages/layout.html (revision 624) @@ -3,9 +3,9 @@

          layout package

          Layout package searches and manipulates the current layout. Dimension units -are in 1/100 mil TODO unless otherwise mentioned. +are in nanometer unless otherwise mentioned. -

          layout package - page

          +

          layout package - page

          Functions used to query or set width and height of the drawing:
          • int layout_get_page_width(); @@ -13,7 +13,7 @@
          • void layout_set_page_size(int width, int height);
          -

          layout package - layer manipulation

          +

          layer manipulation

          Most functions perform operations similar to user commands affecting the current layer. The following few calls can change the current layer. Warning: this is the @@ -25,7 +25,7 @@
        2. void layout_switch_to_layer(int layer): switch to layer (further actions will take place there) -

          layout package - search layer(s) for objects

          +

          API reference - search layer(s) for objects

          Search results are collected on lists identified by their name (search_ID). If a new search is done with the same name, old search results for that name are discarded. @@ -39,7 +39,7 @@

          [todo] lists can be merged or copied. [todo] -

          function int layout_search_box(const char *search_ID, multiple layout_object_mask_t obj_types, int x1, int y1, int x2, int y2);

          +

          function int layout_search_box(const char *search_ID, multiple layout_object_mask_t obj_types, int x1, int y1, int x2, int y2);

          Creates a new search and adds all objects that matches obj_types mask within the given rectangle on the current layer. Arguments:
            @@ -58,7 +58,7 @@
          1. OM_PIN -

            function int layout_search_selected(const char *search_ID, multiple layout_object_mask_t obj_types)

            +

            function int layout_search_selected(const char *search_ID, multiple layout_object_mask_t obj_types)

            Creates a new search and adds all selected objects. Arguments:
              @@ -66,7 +66,7 @@
            1. obj_types: on or more object types or'd
            -

            function int layout_search_found(const char *search_ID, multiple layout_object_mask_t obj_types)

            +

            function int layout_search_found(const char *search_ID, multiple layout_object_mask_t obj_types)

            Creates a new search and adds all "found" objects (found objects are highlighted in green on the GUI). Arguments:
              @@ -74,7 +74,7 @@
            1. obj_types: on or more object types or'd
            -

            function layout_object_t *layout_search_get(const char *search_ID, int n);

            +

            function layout_object_t *layout_search_get(const char *search_ID, int n);

            Returns the nth object of a search. Arguments:
              @@ -85,7 +85,7 @@ Fields of the object structure can be accessed using the object accessors (see below). -

              int layout_search_free(const char *search_ID)

              +

              int layout_search_free(const char *search_ID)

              Frees all memory related to a search. Returns 0 on success. Argument:
                @@ -92,12 +92,12 @@
              1. search_ID: unique name of the search (requires an existing search)
              -

              layout package - object accessors

              +

              API reference - object accessors

              The following functions may be used by the script to access fields of an object structure. The object structure is most often obtained by calling layout_search_get(). -

              int layout_obj_coord(layout_object_t *obj, layout_object_coord_t coord)

              +

              int layout_obj_coord(layout_object_t *obj, layout_object_coord_t coord)

              Return the requested coord of an object. Arguments:
                @@ -123,10 +123,10 @@ Point 1 and point 2 are usually endpoints of the object (line, arc), "the whole object" coordinate is a central point (TODO: what's this?). -

                layout_object_mask_t layout_obj_type(layout_object_t *obj)

                +

                layout_object_mask_t layout_obj_type(layout_object_t *obj)

                Return the type of an object (always a single value of layout_object_mask_t). -

                int layout_obj_move(layout_object_t *obj, layout_object_coord_t coord, int dx, int dy)

                +

                int layout_obj_move(layout_object_t *obj, layout_object_coord_t coord, int dx, int dy)

                Change location of an object or parts of the object (like move endpoint of a line); returns 0 on success. Arguments: @@ -137,14 +137,14 @@
              -

              int layout_arc_angles(layout_object_t *obj, int relative, int start, int delta)

              +

              int layout_arc_angles(layout_object_t *obj, int relative, int start, int delta)

              Change angles of an arc; start and delta are relative if relative is non-zero; returns 0 on success. -

              layout package - create new objects

              +

              API reference - create new objects

              These calls are used to create new objects on the current layer. -

              int layout_create_line(int x1, int y1, int x2, int y2, int thickness, int clearance, multiple layout_flag_t flags)

              +

              int layout_create_line(int x1, int y1, int x2, int y2, int thickness, int clearance, multiple layout_flag_t flags)

              Creates a line. Arguments:
                @@ -186,7 +186,7 @@
              1. FL_THERMALSTYLE5 -

                int layout_create_via(int x, int y, int thickness, int clearance, int mask, int hole, const char *name, multiple layout_flag_t flags)

                +

                int layout_create_via(int x, int y, int thickness, int clearance, int mask, int hole, const char *name, multiple layout_flag_t flags)

                Create a named via. Arguments:
                  @@ -199,7 +199,7 @@
                -

                int layout_create_arc(int x, int y, int width, int height, int sa, int dir, int thickness, int clearance, multiple layout_flag_t flags);

                +

                int layout_create_arc(int x, int y, int width, int height, int sa, int dir, int thickness, int clearance, multiple layout_flag_t flags);

                Create a new arc. Arguments:
                  @@ -212,5 +212,11 @@
                1. flags: one or more of layout flags
                +

                API reference - page, untis and coordinates

                +TODO + +

                API reference - debug draw

                +TODO +