first previous next last contents

REG_GET_OPS

reg_get_ops         get_ops;

typedef struct {
    int    job;      /* REG_GET_OPS */
    char  *ops;      /* Somewhere to place ops in, unalloced to start with */
} reg_get_ops;

Within the Results Manager a popup menu is available for choosing from a list of tasks to be performed on this data. These can include anything, but typically include deleting the data and listing textual information. The ops field will intitially point to NULL when the callback function is called. The callback function should then assign ops to a static string listing NULL separated items to appear on the popup menu, ending in a double NULL. If an item in this string is "SEPARATOR", a separator line on the menu will appear. If an item is "PLACEHOLDER", then nothing for this item will appear in the menu, but the numbering used for REG_INVOKE_OP will count "PLACEHOLDER" as an option. An example of the acknowledging code follows:

case REG_GET_OPS:
    if (r->all_hidden)
        jdata->get_ops.ops = "Information\0PLACEHOLDER\0"
            "Hide all\0Reveal all\0SEPARATOR\0Remove\0";
    else
        jdata->get_ops.ops = "Information\0Configure\0"
            "Hide all\0Reveal all\0SEPARATOR\0Remove\0";
    break;

Here we have a menu containing, "Information", "Configure", "Hide all", "Reveal all" and "Remove". In this example, if r->all_hidden is set then the "Configure" option does not appear, but the later options (eg Remove) will always be given the same number (4 in this case).

REG_INVOKE_OP

reg_invoke_op       invoke_op;

typedef struct {
    int    job;        /* REG_INVOKE_OP */
    int    op;         /* Operation to perform */
} reg_invoke_op;

When the user has chosen an option from the Results Manager popup window (from the list returned by REG_GET_OPS), REG_INVOKE_OP is called with an integer value (held in the op field) detailing which operation was chosen. op starts counting from zero for the first item returned from REG_GET_OPS, and counts up one each time for each operation or PLACEHOLDER listed. An example of an acknowledge for REG_INVOKE_OP to complement the example given in REG_GET_OPS follows:

case REG_INVOKE_OP:
    switch (jdata->invoke_op.op) {
    case 0: /* Information */
        csmatch_info((mobj_repeat *)r, "Find Repeats");
        break;
    case 1: /* Configure */
        csmatch_configure(io, cs->window, (mobj_repeat *)r);
        break;
    case 2: /* Hide all */
        csmatch_hide(our_interp, cs->window, (mobj_repeat *)r, csplot_hash);
        break;
    case 3: /* Reveal all */
        csmatch_reveal(our_interp, cs->window, (mobj_repeat *)r, csplot_hash);
        break;
    case 4: /* Remove */
        csmatch_remove(io, cs->window, (mobj_repeat *)r, csplot_hash);
        break;
    }
    break;

first previous next last contents
This page is maintained by staden-package. Last generated on 1 March 2001.
URL: http://www.mrc-lmb.cam.ac.uk/pubseq/manual/scripting_182.html