Article View: comp.sys.atari.st
Article #18129Re: GEM source code
From: Steve Yelvington
Date: Fri, 22 Mar 1991 06:31
Date: Fri, 22 Mar 1991 06:31
111 lines
4099 bytes
4099 bytes
[In article <1991Mar21.101741.14347@convex.com>,
rosenkra@convex.com (William Rosencranz) writes ... ]
> something just dawned on my, so please indulge me for a moment...
>
> of all the source code ever posted here (c.b.a.st), almost all, if not
> all is unix-like utilities. i don't recall ever seeing source for gem
> programs, even things like gem front ends to archivers. why is this?
There has been some, but darned little. The only complete GEM apps
with source I can remember are from Jim Charlton, who wrote a nifty
binary file editor and a resource construction kit.
> in this regard, i promise to post a real gem application sometime in
> the next few months. source included! how 'bout that for trend setting :-)
Great! I don't suppose you're interested in writing a simple text-editing
window module, are you? I really don't want to reinvent the wheel. (Which
is a euphemism for ``I'm too lazy to write one myself.'')
The only GEM text editor for which I have located sources is DIARY.ACC,
which unfortunately is written in Modula-2. Since you're a fellow who
regards the shift key in the same way most people regard bedbugs, you
probably know why I find that disappointing. :-)
In the spirit of Sharing More GEM Code, here's a couple of functions.
Corrections/suggestions are welcome. The third function apparently
has a bug that shows up when I add |M_BUTTON to the arguments to
evnt_multi(); if anybody sees what I did wrong please let me know.
/*
* Function: edit_form(form) OBJECT *form;
* Returns: int value of object used to exit the form
* Description: This is a wrapper for form_do that handles all
* necessary drawing of the form, user interaction, etc.
*/
int edit_form(form)
OBJECT *form;
{
int exit_obj;
int x,y,w,h;
graf_mouse(M_OFF,NULL);
form_center(form, &x, &y, &w, &h);
form_dial(FMD_START,1,1,1,1,x,y,w,h);
form_dial(FMD_GROW,1,1,1,1,x,y,w,h);
objc_draw(form, 0, 10, x, y, w, h);
graf_mouse(M_ON,NULL);
exit_obj = form_do(form, 0);
form_dial(FMD_SHRINK,1,1,1,1,x,y,w,h);
form_dial(FMD_FINISH,1,1,1,1,x,y,w,h);
form[exit_obj].ob_state = NORMAL;
return(exit_obj);
}
/*
* Function: g_clrscr()
* Returns: void
* Description: Instructs GEM to redraw the workspace
*/
void g_clrscr()
{
int x,y,w,h;
wind_get(0,WF_FULLXYWH,&x,&y,&w,&h);
form_dial(FMD_START,1,1,1,1,x,y,w,h);
form_dial(FMD_FINISH,1,1,1,1,x,y,w,h);
}
/*
* Function: show_about()
* Returns: void
* Description: Shows the ABOUTBOX until timeout or mouse click
*/
void show_about()
{
OBJECT *aboutbox;
int x,y,w,h,junk;
static long delay;
delay = 4*1000L;
rsrc_gaddr(0,ABOUTBOX, &aboutbox); /* assumes there is such a thing */
graf_mouse(M_OFF,NULL);
form_center(aboutbox, &x, &y, &w, &h);
form_dial(FMD_START,1,1,1,1,x,y,w,h);
form_dial(FMD_GROW,1,1,1,1,x,y,w,h);
objc_draw(aboutbox, 0, 10, x, y, w, h);
graf_mouse(M_ON,NULL);
/* This is where I wait for a timeout or a keystroke.
I'd like to wait for a mouse click, but adding
MU_BUTTON to the first argument causes evnt_multi
to return immediately. ??? */
evnt_multi(MU_TIMER|MU_KEYBD,
1, 1, 0,
0,0,0,0,0,
0,0,0,0,0,
&junk,
loword(delay),hiword(delay),
&junk,&junk,
&junk,&junk,
&junk,
&junk);
form_dial(FMD_SHRINK,1,1,1,1,x,y,w,h);
form_dial(FMD_FINISH,1,1,1,1,x,y,w,h);
}
----
Steve Yelvington / P. O. Box 38 / Marine on St. Croix, MN 55047 USA
INTERNET: steve@thelake.mn.org UUCP: plains!umn-cs!thelake!steve
GEnie: S.YELVINGTO2 Delphi: YELVINGTON
Technical Details
Message-ID:
<A66918006@thelake.mn.org>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!news.cs.indiana.edu!msi.umn.edu!cs.umn.edu!thelake!steveReferences:
<1991Mar21.101741.14347@convex.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!news.cs.indiana.edu!msi.umn.edu!cs.umn.edu!thelake!steve From: steve@thelake.mn.org (Steve Yelvington) Newsgroups: comp.sys.atari.st Subject: Re: GEM source code Message-ID: <A66918006@thelake.mn.org> References: <1991Mar21.101741.14347@convex.com> Date: Fri, 22 Mar 1991 00:31:58 CST Organization: St. Croix Valley C and Ski Lines: 111