/*
 *---------------------------------------------------------------------
 *            Copyright 1990 University of New Mexico
 * 
 * Permission to copy and modify this software and its documen- 
 * tation only for internal use in your organization is hereby 
 * granted, provided that this notice is retained thereon and 
 * on all copies.  UNM makes no representations as too the sui- 
 * tability and operability of this software for any purpose. 
 * It is provided 'as is' without express or implied warranty. 
 *  
 * UNM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- 
 * NESS.  IN NO EVENT SHALL UNM BE LIABLE FOR ANY SPECIAL, 
 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY OTHER DAMAGES WHAT- 
 * SOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 
 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 
 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PER- 
 * FORMANCE OF THIS SOFTWARE. 
 *  
 * No other rights, including for example, the right to redis- 
 * tribute this software and its documentation or the right to 
 * prepare derivative works, are granted unless specifically 
 * provided in a separate license agreement. 
 * 
 *---------------------------------------------------------------------
 */
#include "unmcopyright.h"
#include "example1.h"



/********************************************************
*
*  Routine Name:  run_sub
*
*       Purpose:  drives the subform 'sub'
*
*         Input:  form - pointer to the form tree 
*		  sub_info  - information structure for subform 'sub'
*        Output:  action of the application program
*
*     Called By:  run_example1()
*
*   Automatically Generated By:  conductor -i example1.pane -l 1 -b
*
********************************************************/


run_sub(form, sub_info)

xvf_form *form;
example1_sub *sub_info;
{

	/*
	 * action came from the 'one' pane
	 */
	if (sub_info->one_selected)
	    run_one(form, sub_info->one);


}   /* end run_sub */





/********************************************************
*
*  Routine Name:  run_one
*
*       Purpose:  drives the pane 'one'
*
*         Input:  form - pointer to the form tree 
*		  one_info  - information structure for pane 'one'
*        Output:  action of the application program
*
*     Called By:  run_sub()
*
*   Automatically Generated By:  conductor -i example1.pane -l 1 -b
*
********************************************************/

static int coordx1 = 5, coordx2 = 5;
static int coordy1 = 5, coordy2 = 135;

run_one(form, one_info)

xvf_form *form;
sub_one *one_info;
{
	Coord coord1, coord2;

	/*
	 * user clicked on pane action button 'add'
	 */
	if (one_info->add)
	{
                colornum++;
                if (colornum == COLORNUM)
                    colornum = 0;

                coordx1 += 5;
                coordx2 += 5;
                coord1.x = coordx1;
                coord1.y = coordy1;
                coord2.x = coordx2;
                coord2.y = coordy2;
                X2D_draw_line (1, coord1, coord2, &Colors[colornum]);
		linecount++;
	}
}
