[net.micro.atari16] ramdisk source -- part III

ACS19@UHUPVM1.BITNET (05/17/86)

/* HERE IS THE THIRD PART OF THE RAMDISK ACCESSORY */
/* This program is copyright 1986 by Michael Vederman.  Distribute it
freely, so long as proper credit is given. */
/**************************************************************************/
/* BEGIN PART III */

open_dialog()
{
int c;

/* This routine does a lot.  It probably could have been done easier
by direct assignment to the structure, but standard system calls never
hurt. (gag) It opens a dialog box into our window, then does a form_do,
indicating one editable field, which makes it wait for something to
happen.  Then it does whatever the return code tells it.  I tried for
the longest time to get the fmd_finish to erase the dialog, but it
doesn't.  It merely pipes a message, you have to do a redraw manually!!
Which means you better know VDI.  I cheated by getting rid of the whole
window, in this way it has to redraw the desktop, automatically. */

	clear_window(wi_handle);
	form_center(rs_object, &fo_cx, &fo_cy, &fo_cw, &fo_ch);
  	form_dial(FMD_START,xdesk,ydesk,wdesk,hdesk,fo_cx, fo_cy, fo_cw, fo_ch);
	objc_draw(rs_object,0,15,fo_cx,fo_cy,fo_cw,fo_ch);
	if (!in_place)
		form_alert(1,&alert8);
	fo_doreturn=form_do(rs_object, SIZEBOX);
	form_dial(FMD_FINISH,xdesk,ydesk,wdesk,hdesk,fo_cx,fo_cy,fo_cw,fo_ch);

	switch (fo_doreturn)
		{
		  case ALOCBOX:
			{

			do_ramdisk();
			if (ok){
			objc_change(rs_object, ALOCBOX, 0,
			            xdesk, ydesk, wdesk,hdesk,
				    SHADOWED+DISABLED, 0);
			objc_change(rs_object, ALOCSTR, 0,
				    xdesk, ydesk, wdesk, hdesk,
				    DISABLED, 0);
			objc_change(rs_object, DALOCSTR, 0,
				    xdesk, ydesk, wdesk, hdesk,
				    NORMAL, 0);
			objc_change(rs_object, RESIZSTR, 0,
				    xdesk, ydesk, wdesk, hdesk,
				    NORMAL, 0);
			objc_change(rs_object, DALOCBOX, 0,
				    xdesk, ydesk, wdesk, hdesk,
				    NORMAL|SHADOWED, 0);
			objc_change(rs_object, RESIZBOX, 0,
				    xdesk, ydesk, wdesk, hdesk,
				    NORMAL|SHADOWED, 0);
				}
			else
			objc_change(rs_object, ALOCBOX, 0,
				    xdesk, ydesk, wdesk, hdesk,
				    NORMAL|SHADOWED, 0);
			}
		break;

		case RESIZBOX:
			{
			objc_change(rs_object, RESIZBOX, 0,
				    xdesk, ydesk, wdesk, hdesk,
				    NORMAL|SHADOWED, 0);
			form_alert(1,&alert6);
			}
		break;
			
		case DALOCBOX:
			{
			remove_rdisk();
              objc_change(rs_object, ALOCBOX, 0,
				    xdesk, ydesk, wdesk,hdesk,
				    NORMAL|SHADOWED, 0);
			objc_change(rs_object, ALOCSTR, 0,
				    xdesk, ydesk, wdesk,hdesk,
				    NORMAL, 0);
			objc_change(rs_object, DALOCBOX, 0,
				    xdesk, ydesk, wdesk,hdesk,
				    DISABLED|SHADOWED, 0);
			objc_change(rs_object, DALOCSTR, 0,
				    xdesk, ydesk, wdesk,hdesk,
				    DISABLED, 0);
			objc_change(rs_object, RESIZBOX, 0,
				    xdesk, ydesk, wdesk,hdesk,
				    DISABLED|SHADOWED, 0);
			objc_change(rs_object, RESIZSTR, 0,
				    xdesk, ydesk, wdesk,hdesk,
				    DISABLED, 0);
			form_alert(1,&alert5);
			}
		break;

		case GOODBYE:
		    {
			form_alert(1, &alert4);
			objc_change(rs_object, GOODBYE, 0,
			            xdesk, ydesk, wdesk,hdesk,
				    NORMAL, 0);
		    }
		break;

	}

	wind_close(wi_handle);
	graf_shrinkbox(15,27,160,8, xdesk, ydesk, wdesk, hdesk );
	wind_delete(wi_handle);

	msgbuff[0]=AC_CLOSE;
	msgbuff[3]=menu_id;
	wi_handle=(-1);

}
/***************************************************************************/

start()
{

	while (TRUE)
	{
	  event=evnt_multi( MU_MESAG,
			1, 1, ret,
			0, 0, 0, 0, 0,
			0, 0, 0, 0, 0,
			msgbuff, 0, 0, &ret, &ret, &ret, &ret, &ret, &ret );

	  if ( event & MU_MESAG )
		switch( msgbuff[0] )
		{

		  case AC_OPEN:
		    if (msgbuff[4]==menu_id)
		    {
			if (wi_handle==(-1))
				 { open_vwork();
				 open_window();
				 open_dialog(); }
		    }
		  break;

		  case AC_CLOSE:
		    if ((msgbuff[3]==menu_id) && (wi_handle != (-1) ))
			{ v_clsvwk(handle); wi_handle=(-1); }
		  break;

		}
	}
}

/* Th.. Th.. That's all Folks...  If you have any problems, please post
them either to the network, or send them to me directly ACS19@UHUPVM1.
I know that there will probably be a tab expansion somewhere along the
line, so I hope it does not get truncated.  If it does, I will repost
it.  I hope no one accuses me of 'abuse of the system', since I merely
wish to exchange and share info.  I have edited this a little, and I
have not recompiled it since, but I do not think there should be any
problems.  Let me know what you find.  Someone please send me the
other articles from BAMMI's posting of Tim Oren's tutorial, I have
10-12, and also need the macro defs, since he has not responded yet. */

/* Mike */
/* END PART III */