[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference 7.286::atarist

Title:Atari ST, TT, & Falcon
Notice:Please read note 1.0 and its replies before posting!
Moderator:FUNYET::ANDERSON
Created:Mon Apr 04 1988
Last Modified:Tue May 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1433
Total number of notes:10312

63.0. "Minimal Desk Accessory" by BOLT::MINOW (Je suis marxiste, tendance Groucho) Tue Apr 26 1988 16:58

Here's source for a minimum desk accessory.  The guy who wrote it has
posted a number of useful things to the Usenet Atari newsgroups.

(by the way, a while back he mentioned he's looking for a job after
graduation.  Anyone interested might consider getting in touch with
him directly.)

Martin.

Newsgroups: comp.sys.atari.st
Path: decwrl!labrea!rutgers!rochester!cornell!batcomputer!braner
Subject: converting a TOS prg into a DA
Posted: 24 Apr 88 14:24:35 GMT
Organization: Cornell Theory Center, Cornell University, Ithaca NY
 
/*
Thought this might be useful for some people.  This seems to be about
the minimum code needed to convert a TOS program to a desk accessory.
Note the "manual" saving and restoring of the menu bar bitmap.
Note that a DA should not use dynamic memory allocation.
(The DA version of GNOME uses a large static array to do its own
internal malloc()ing from.)
Also beware: the "current directory", as the DA sees it, can change
between openings since the current application can change it and GEMDOS
only keeps one "current directory".  Surprisingly, although the desktop
normally makes the top window the current directory, that is not always
the case!
 
	- Moshe Braner
*/
 
/*
   This code manually extracted from a program
   that was actually tested with Laser C.
*/
 
#include <osbind.h>
#include <obdefs.h>
#include <gemdefs.h>
extern int gl_apid;
int	menu_id, event, ret;
int	xdesk, ydesk, hdesk, wdesk;
int	msgbuff[8];
char	menusave[1520];
main()
{
	int	i;
	char	*cp;
	/* your TOS application's initializations here */
	Cconws ("\033f");	/* disable vt52 cursor	*/
	appl_init();
	menu_id = menu_register (gl_apid,"  your DA's name");
	wind_get (0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk);
daloop:
	event = evnt_multi (MU_MESAG,
			0,0,0,0,0,0,0,0,0,0,0,0,0,
			msgbuff,
			0,0, &ret,&ret,&ret,&ret,&ret,&ret);
	/* could have simply used evnt_mesag instead:
		evnt_mesag (msgbuf);		*/
	if ((event & MU_MESAG) == 0
		|| msgbuff[0] != AC_OPEN
		|| msgbuff[4] != menu_id )
			goto daloop;
	graf_mouse(M_OFF,0x0L);
	cp = (char *) Physbase();
	for (i=0; i<1520; i++)
		menusave[i] = *cp++;
	wind_update(TRUE);
	form_dial (FMD_START,
			xdesk, ydesk, wdesk, hdesk,
			xdesk, ydesk, wdesk, hdesk);
	/* enable vt52 cursor if needed */
	/* your TOS application does its thing here */
	/* disable vt52 cursor if on */
	form_dial (FMD_FINISH,
			xdesk, ydesk, wdesk, hdesk,
			xdesk, ydesk, wdesk, hdesk);
	wind_update (FALSE);
	cp = (char *) Physbase();
	for (i=0; i<1520; i++)
		*cp++ = menusave[i];
	graf_mouse(M_ON,0x0L);
	goto daloop;
}
T.RTitleUserPersonal
Name
DateLines