home *** CD-ROM | disk | FTP | other *** search
- #include "all.h"
- #include "regtabext.h"
-
- DoCommand(mResult)
- unsigned long mResult;
- {
- int moveToScrap;
- Handle TEScrH;
- char name[30];
- short theMenu, theItem;
- Point p;
- SFReply reply;
- WindowPtr oldWindow;
- GrafPtr oldPort;
-
- theMenu = mResult >> 16;
- theItem = mResult;
-
- p.h = 100;
- p.v = 100;
-
- moveToScrap = FALSE;
-
- switch (theMenu) {
-
- case apMenuRes :
- GetItem(myMenu[0],theItem,name);
- OpenDeskAcc(name);
- break;
-
- case fiMenuRes :
- switch(theItem) {
- case 1: /*read table*/
- strcpy(name,"RGTB");
- SFGetFile( pass(p), "\P ", 0L, 1, name, 0L, &reply );
- ReadTable(&reply);
- break;
- case 2: /*write table*/
- SFPutFile( pass(p), "\PSave Table as . . .", "\PUntitled Table",
- 0L, &reply );
- WriteTable(&reply);
- break;
- case 4: /*read ascii table*/
- strcpy( name, "TEXT" );
- SFGetFile( pass(p), "\P ", 0L, 1, name, 0L, &reply );
- ReadAsciiTable(&reply);
- break;
- case 5: /*write ascii table table*/
- SFPutFile( pass(p), "\PSave Table as . . . ", "\PUntitled Ascii Table",
- NULL, &reply );
- WriteAsciiTable(&reply);
- break;
- case 7: /*load procedure*/
- strcpy( name, "TEXT" );
- SFGetFile( pass(p), "\P ", 0L, 1, name, 0L, &reply );
- ReadProcedure(&reply);
- break;
- case 8: /*save procedure as*/
- SFPutFile( pass(p), "\PSave Procedure as . . . ", "\PUntitled Procedure",
- NULL, &reply );
- WriteProcedure(&reply);
- break;
- case 10: /*MacWrite Graph*/
- SFPutFile( pass(p), "\PSave graph as . . . ", "\PUntitled Graph",
- NULL, &reply );
- WriteGraph(&reply);
- break;
- case 12: /* quit */
- doneFlag = TRUE;
- break;
- } /*end switch theItem*/
- break;
-
- case edMenuRes :
- if( SystemEdit(theItem-1) ) break;
- oldWindow = whichWindow;
- whichWindow = FrontWindow();
- GetPort( &oldPort );
- GetWndNumber(whichWindow);
- SetPort( whichWindow );
- switch(theItem) {
-
- case 1: /*undo*/
- /*undo does nothing*/
- break;
-
- case 3: /*cut*/
- if( whichWindow == theWindow[coWindow] ) {
- TECut( coText );
- moveToScrap=TRUE;
- }
- else if (whichWindow == theWindow[prWindow]) {
- TECut( prText );
- moveToScrap=TRUE;
- }
- else if (whichWindow == theWindow[edWindow]) {
- TECut( edText );
- moveToScrap=TRUE;
- }
- break;
-
- case 4: /*copy*/
- if( whichWindow == theWindow[coWindow] ) {
- TECopy( coText );
- moveToScrap=TRUE;
- }
- else if ( whichWindow == theWindow[prWindow]) {
- TECopy( prText );
- moveToScrap=TRUE;
- }
- else if ( whichWindow == theWindow[edWindow]) {
- TECopy( edText );
- moveToScrap=TRUE;
- }
- break;
-
- case 5: /*paste*/
- if( whichWindow == theWindow[coWindow] ) {
- TEPaste( coText );
- IfOutScroll(coText);
- }
- else if (whichWindow == theWindow[prWindow]) {
- TEPaste( prText );
- IfOutScroll(prText);
- }
- else if (whichWindow == theWindow[edWindow]) {
- TEPaste( edText );
- }
- break;
-
- case 6: /*clear*/
- /*clear does nothing*/
- break;
-
- } /*end switch theItem*/
-
- whichWindow = oldWindow;
- SetPort( oldPort );
- GetWndNumber(whichWindow);
- break;
-
- case wiMenuRes :
- switch(theItem) {
- case 1:
- SelectWindow(theWindow[coWindow]);
- break;
- case 2:
- SelectWindow(theWindow[grWindow]);
- break;
- case 3:
- SelectWindow(theWindow[prWindow]);
- break;
- case 4:
- SelectWindow(theWindow[edWindow]);
- break;
- } /*end switch theItem*/
- break;
-
- case abMenuRes :
- switch(theItem) {
- case 1:
- ErrMsg("Abort!");
- break;
- } /*end switch theItem*/
- break;
- } /*end switch theMenu*/
-
- if (moveToScrap) {
- TEScrH=TEScrapHndl();
- HLock(TEScrH);
- ZeroScrap();
- PutScrap( TEGetScrpLen(), 'TEXT', *TEScrH );
- HUnlock(TEScrH);
- scrapIndex = (InfoScrap())->scrapCount;
- }
-
- HiliteMenu(0);
- }
-