🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sources.mac
1 messages
1 total messages Started by Erik Kilk Sat, 14 Nov 1987 05:40
Waiting -- A Processor Monitor under MultiFinder
#26
Author: Erik Kilk
Date: Sat, 14 Nov 1987 05:40
125 lines
3635 bytes
[Waiting  --  A Processor Monitor under MultiFinder]

Here is a little application you can run under MultiFinder and let
sit in the background.  It puts up a tiny title-less window with an
indicator representing how much time it is waiting for processing
time.  This is one calculation of how busy your computer is.  The
indicator draws a filled in arc where a full circle represents one
full second (or more).  Try running an editor and watch it while
you are typing.  When activated, you can drag the window around by
just grabbing anywhere in its contents.  Its position will be saved
for the next time the program is run.  Partial sources are included.
The rest is SimpleTools 3 which is a general purpose event loop
manager and will be posted here in the near future (SimpleTools 2 was
posted here months ago).

[Moderator's note:  The binary has been posted to comp.binaries.mac.]

Erik Kilk

---
#!/bin/sh
# shar:	Shell Archiver
#	Run the following text with /bin/sh to create:
#	Waiting.c
sed 's/^X//' << 'SHAR_EOF' > Waiting.c
X#include <Quickdraw.h>
X#include <EventMgr.h>
X#include <ResourceMgr.h>
X#include "simple.h"
X
Xextern long Ticks 		: 0x16A;
Xextern long yieldTime;
Xextern Rect	dragrect;
X
Xtypedef struct wait_data {
X			Point windtop;
X			int yield;
X			int res1, res2, res3;
X} wait_data;
X
Xlong		leaving_time;
XRect		whole;
XWindowPtr 	thewindow;
XPoint		top;
Xwait_data	**data;
X
Xidle ()
X{
X	long		time_away, angle;
X	time_away 	= Ticks - leaving_time;
X	angle 		= time_away * 6L;
X	if (angle > 360L) angle = 360L;
X	SetPort (thewindow);
X	EraseArc (&whole, 0, (int) angle - 350);
X	PaintArc (&whole, 0, (int) angle);
X	leaving_time = Ticks;
X}
X
Xmovewindow(x,y,windp,event)	
Xint x,y;			
XWindowPtr windp;		
XEventRecord *event;
X{
X  	DragWindow (windp, event->where, &dragrect);
X}
X
Xgot_about ()
X{
X	Alert (1000, 0L);
X}
X
Xgot_quit ()
X{
X	if (data != 0L) {
X		top.h = thewindow -> portRect.left;
X		top.v = thewindow -> portRect.top;
X		SetPort (thewindow);
X		LocalToGlobal (&top);
X		HLock (data);
X		(**data).windtop 	= top;
X		(**data).yield 		= (int) yieldTime;
X		HUnlock (data);
X		ChangedResource (data);
X		WriteResource (data);
X	} 
X  	ExitToShell();
X}
X
Xget_data ()
X{
X	data = (wait_data **) GetResource ('WAIT', 0);
X	top.h = -1; top.v = -1; yieldTime = -1;
X	if (data) {
X		HLock (data);
X		top 		= (**data).windtop;
X		yieldTime 	= (long) (**data).yield;
X		HUnlock (data);
X	}
X	if (!PtInRect (top, &dragrect)) {
X		top.h = 2;
X		top.v = 22;
X	}
X	if (yieldTime <= 0 || yieldTime > 1000)
X		yieldTime = 1;
X}
X
Xmain ()
X{
X	simpletools ("About Waiting...");
X	menu (applestring, "About Waiting...", got_about);
X	menu (applestring, "About Waiting...", itemenable);
X	menu ("File", "Quit/Q", got_quit);
X	SetRect (&whole, 1, 1, 11, 11);
X	wprocid 	= 3;
X	windmenu	= 0;
X	get_data ();
X	thewindow 	= window ("Waiting",top.h,top.v,top.h+12,top.v+12,0L,0L, 
X						idle, movewindow);
X	run (idle);
X	leaving_time = Ticks;
X	runsimpletools ();
X}
SHAR_EOF
exit
---
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads