/*
** Listing 1.
**
** Function to draw a dialogue box centred on
** the screen, allow the user to interact with it,
** then remove it.  The two input parameters are a
** pointer to the root of the tree, and the index of
** the object to start text editing at (0 if none).
** The function returns the index of the object used to
** exit the interaction. This object is deselected. The
** global variable 'zoomflag' determines whether the
** expanding and shrinking outline boxes are displayed.
**
** Usage:   exit = dialogue(tree,start_edit);
**
**          int exit, dialogue(OBJECT *, short,);
*/

int dialogue(tree,edit_obj)

OBJECT *tree;
short edit_obj;

{
    short x, y, w, h, exit_obj;

    form_center(tree,&x,&y,&w,&h);
    form_dial(FMD_START,0,0,0,0,x,y,w,h);
    if (zoomflag)
        form_dial(FMD_GROW,x,y,20,20,x,y,w,h);
    graf_mouse(M_OFF,0);
    objc_draw(tree,ROOT,MAX_DEPTH,x,y,w,h);
    graf_mouse(ARROW,0);
    graf_mouse(M_ON,0);
    exit_obj = form_do(tree,edit_object);
    (tree+exit_obj)->ob_state &= ~SELECTED;
    if (zoomflag)
        form_dial(FMD_SHRINK,x,y,20,20,x,y,w,h);
    form_dial(FMD_FINISH,0,0,0,0,x,y,w,h);
    return((int)exit_obj);
}
