home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
source
/
clintsrc.sit
/
DA.h
next >
Wrap
Text File
|
1990-05-05
|
6KB
|
177 lines
/*========================================================================
=== DA.h
===
=== Greg Anderson
=== 29 Kerr Hall
=== Social Sciences Computing
=== University of California at Santa Cruz
=== Santa Cruz CA 95062
===
=== (408) 459-2658
=== sirkm@ssyx.ucsc.edu
===
=== This .h file is included by all .c segments.
===
========================================================================*/
extern pascal void AsmClikLoop();
#define maxInCache 14
/*
* Size of TCP buffer:
*/
#define TCPBUFSIZE 16000L
#define TCPCTLSIZE 200L
#define NOERRORMAGIC 132
/*
* Macros:
*/
#define OWNEDRSRCID(id) (0xC000 | (((-(id)) - 1) << 5))
#define DA_global ((Globals *)(*dCtl->dCtlStorage))
#define DA_window (dCtl->dCtlWindow)
#define DA_te ( ((DocumentPeek)DA_window)->docTE )
#define DA_iList ( DA_global->itemList )
#define DA_tcp ( DA_global->tcpCtrl )
#define DA_tcpL (long *)( DA_tcp )
#define DA_tcpW (int *)( DA_tcp )
#define DA_tcpB (char *)( DA_tcp )
#define DA_active (DA_window != nil)
#define DA_inactive (DA_window == nil)
#define max(a,b) ( a > b ? a : b )
#define min(a,b) ( a < b ? a : b )
#define pstrlen(a) ((short)(unsigned char)(a)[0])
/*
#define APPHEAP 1
#define SYSHEAP 2
#define DISK 3
#define FREEON 4
*/
/*
* Accessory messages:
*/
#define accEvent 64
#define accRun 65
#define accUndo 68
#define accCut 70
#define accCopy 71
#define accPaste 72
#define accClear 73
/*----------------------------------------------------------------------
| A DocumentRecord contains the WindowRecord for one of our document
| windows, as well as the TEHandle for the text we are editing.
----------------------------------------------------------------------*/
typedef struct {
WindowRecord docWindow;
TEHandle docTE;
ControlHandle docVScroll;
ControlHandle docHScroll;
ProcPtr docClik;
} DocumentRecord, *DocumentPeek;
/*----------------------------------------------------------------------
| This structure type holds the global variables used by this desk
| accessory.
----------------------------------------------------------------------*/
typedef struct {
int rsrcID; /* Computed rsrc id of owned resources */
Str255 strBuf; /* Buffer to read strings into */
int windMsg, /* Which message in window info? */
windButton, /* Which button in window info? */
flag; /* Flag */
CntrlParam *tcpCtrl; /* TCP control record */
ListHandle itemList; /* Scrolling item list handle */
int lastService; /* The last service number requested */
int ignoreUntil; /* Ignore all input until this char recvd */
/*
* Undo stuff
*/
int undoType; /* What are we going to UNDO? */
int undoFrom; /* Where did the cut / paste happen? */
int undoTo; /* How many characters were pasted in? */
TEHandle undoText; /* The deleted text to replace when UNDO-ing */
/*
* Mac TCP buffers:
*/
char tcpBuf[TCPBUFSIZE];
} Globals;
/*----------------------------------------------------------------------
| Prototypes:
----------------------------------------------------------------------*/
pascal short DRVROpen(CntrlParam *ctlPB, DCtlPtr dCtl);
void startDA( DCtlPtr dCtl );
static void doCtlEvent(EventRecord *event, DCtlPtr dCtl);
void doCutCopy( DCtlPtr dCtl, int CutOrCopy );
void doCut( DCtlPtr dCtl );
void doCopy( DCtlPtr dCtl );
void doPaste( DCtlPtr dCtl );
void doClear( DCtlPtr dCtl );
void doAbort( DCtlPtr dCtl );
void drawWindow( DCtlPtr dCtl );
void drawWInfo( DCtlPtr dCtl );
void changeMsg( DCtlPtr dCtl, int newMsg );
void getLocalUpdateRgn( WindowPtr window, RgnHandle localRgn );
void doKeyDown( EventRecord *event, DCtlPtr dCtl );
void doCommandKey( EventRecord *event, DCtlPtr dCtl );
void pageTE( DCtlPtr dCtl, int direction);
void addTEstring( DCtlPtr dCtl, char *string );
Boolean doNew( DCtlPtr dCtl );
Boolean doCloseWindow( DCtlPtr dCtl );
void doContentClick( DCtlPtr dCtl, EventRecord *event );
void doInfoClick( DCtlPtr dCtl,EventRecord *event );
void doGrowWindow(WindowPtr window,EventRecord *event);
void doZoomWindow(WindowPtr window,short part);
void resizeWindow( WindowPtr window );
void doUpdate( DCtlPtr dCtl );
void doDeactivate( WindowPtr window );
void doActivate( DCtlPtr dCtl, Boolean becomingActive );
void getTERect( WindowPtr window, Rect *teRect );
void getInfoRect( WindowPtr window, Rect *infoRect);
void getGrowRect( WindowPtr window, Rect *growRect );
void getZoomRect( WindowPtr window, Rect *zoomRect );
void adjustViewRect( TEHandle docTE );
TEHandle makeTE( Rect destRect, Rect viewRect );
void adjustTE( WindowPtr window );
void adjustHV( Boolean isVert, ControlHandle control, TEHandle docTE,
Boolean canRedraw );
void adjustScrollValues( WindowPtr window, Boolean canRedraw );
void adjustScrollSizes( WindowPtr window );
void adjustScrollbars( WindowPtr window, Boolean needsResize );
pascal void PascalClikLoop();
pascal ProcPtr getOldClikLoop();
void commonAction( ControlHandle control, short *amount );
pascal void vActionProc( ControlHandle control, short part );
pascal void hActionProc( ControlHandle control, short part );
void doIdle( DCtlPtr dCtl );
void alertUser( DCtlPtr dCtl, short error );
void alertUser2( DCtlPtr dCtl, short error1, short error2 );
short selectService( DCtlPtr dCtl, long *inet_addr, char *result );
void setupList(DCtlPtr dCtl, DialogPtr dlog, long *inet_addr);
char *checkHostCache( char *walk, char *hostName, long *inet_addr );
void addHostToCache( DCtlPtr dCtl, char *hostName, char *dotAddr, DialogPtr dlog);
void findNextLine(char **str);
int doPopup( DCtlPtr dCtl, DialogPtr dlog, int popItem, Str255 Pstr);
StringPtr text(int index, Globals *globals);
void getCstr(int index, char *str, Globals *globals);
int fix_cr(char *str);
void strcpy(char *a, char *b);
void straddc(char *a,char c);
int strlen(char *str);
long lstrlen(char *str);
char *P2Cstr(char *cstr,char *pstr);
char *C2Pstr(char *pstr,char *cstr);
OSErr initTCP();
void connectToServer( DCtlPtr dCtl, long inet_addr, char *command );
char connectionState( DCtlPtr dCtl );
short NameToAddr(char *name,long *addr, long timeout);