Final uuUndo for Macintosh release

This commit is contained in:
Aaron Giles 2015-02-06 00:56:41 -08:00
parent d3584f97c3
commit 3a0506073b
25 changed files with 21 additions and 0 deletions

1
DSAppleEvents.c Normal file

File diff suppressed because one or more lines are too long

1
DSAppleEvents.h Normal file
View File

@ -0,0 +1 @@
/****************************************************************************** ** ** Project Name: DropShell ** File Name: DSAppleEvents.h ** ** Description: Header w/prototypes for the generic AppleEvent handling routines ** ******************************************************************************* ** A U T H O R I D E N T I T Y ******************************************************************************* ** ** Initials Name ** -------- ----------------------------------------------- ** LDR Leonard Rosenthol ** MTC Marshall Clow ** SCS Stephan Somogyi ** ******************************************************************************* ** R E V I S I O N H I S T O R Y ******************************************************************************* ** ** Date Time Author Description ** -------- ----- ------ --------------------------------------------- ** 11/24/91 LDR Added new routines to this header ** 10/29/91 SCS Changes for THINK C 5 ** 10/28/91 LDR Officially renamed DropShell (from QuickShell) ** 10/06/91 00:02 MTC Converted to MPW C ** 04/09/91 00:02 LDR Added to Projector ** ******************************************************************************/ #pragma once #ifndef __DSAPPLEEVENTS_H__ #define __DSAPPLEEVENTS_H__ #include <AppleEvents.h> #include <DSGlobals.h> #include <DSUtils.h> #include <DSUserProcs.h> pascal void InitAEVTStuff(void); OSErr GotRequiredParams(AppleEvent *theAppleEvent); void FailErr(OSErr err); pascal OSErr _HandleDocs ( AppleEvent *theAppleEvent, AppleEvent *reply, Boolean opening ); pascal OSErr HandleOAPP(AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon); pascal OSErr HandleQuit(AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon); pascal OSErr HandleODOC(AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon); pascal OSErr HandlePDOC(AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon); pascal void DoHighLevelEvent(EventRecord *event); #endif __DSAPPLEEVENTS_H__

1
DSDialogs.c Normal file

File diff suppressed because one or more lines are too long

1
DSDialogs.h Normal file
View File

@ -0,0 +1 @@
#pragma once #ifndef __DSDIALOGS__ #define __DSDIALOGS__ void OpenUserDialog(short menuID, short menuItem); void DoUserDialog(DialogPtr theDialog, short itemHit); void CloseUserDialog(DialogPtr theDialog); void UserDialogActivate(DialogPtr theDialog, Boolean nowActive); #endif

1
DSGlobals.h Normal file
View File

@ -0,0 +1 @@
/****************************************************************************** ** ** Project Name: DropShell ** File Name: DSGlobals.h ** ** Description: Globals used by DropShell ** ******************************************************************************* ** A U T H O R I D E N T I T Y ******************************************************************************* ** ** Initials Name ** -------- ----------------------------------------------- ** LDR Leonard Rosenthol ** MTC Marshall Clow ** SCS Stephan Somogyi ** ******************************************************************************* ** R E V I S I O N H I S T O R Y ******************************************************************************* ** ** Date Time Author Description ** -------- ----- ------ --------------------------------------------- ** 12/09/91 LDR Added gSplashScreen ** 11/24/91 LDR Added some new #defs & a #inc for DSUtils ** 10/29/91 SCS Changes for THINK C 5 ** 10/28/91 LDR Officially renamed DropShell (from QuickShell) ** 10/06/91 00:02 MTC Converted to MPW C ** 04/09/91 00:03 LDR Added to Projector ** ******************************************************************************/ #pragma once #ifndef __DSGLOBALS_H__ #define __DSGLOBALS_H__ #ifndef THINK_C #include <Types.h> #include <Memory.h> #include <QuickDraw.h> #include <OSUtils.h> #include <ToolUtils.h> #include <Menus.h> #include <Packages.h> #include <Traps.h> #include <Files.h> #endif #include <Aliases.h> #include <AppleEvents.h> #include <GestaltEqu.h> #include <Processes.h> #define kAppleNum 128 #define kFileNum 129 #define kErrStringID 100 #define kCantRunErr 1 #define kAEVTErr 2 extern Boolean gDone, gOApped, gHasAppleEvents, gWasEvent; extern EventRecord gEvent; extern MenuHandle gAppleMenu, gFileMenu; extern WindowPtr gSplashScreen; #endif __DSGLOBALS_H__

1
DSUserProcs.c Normal file

File diff suppressed because one or more lines are too long

1
DSUserProcs.h Normal file
View File

@ -0,0 +1 @@
/****************************************************************************** ** ** Project Name: DropShell ** File Name: DSUserProcs.h ** ** Description: Header w/prototypes for specific AppleEvent handlers ** used by the DropShell ** ******************************************************************************* ** A U T H O R I D E N T I T Y ******************************************************************************* ** ** Initials Name ** -------- ----------------------------------------------- ** LDR Leonard Rosenthol ** MTC Marshall Clow ** SCS Stephan Somogyi ** ******************************************************************************* ** R E V I S I O N H I S T O R Y ******************************************************************************* ** ** Date Time Author Description ** -------- ----- ------ --------------------------------------------- ** 01/25/92 LDR Removed the use of const on the userDataHandle ** 12/09/91 LDR Added SelectFile & UserGlobals prototypes ** 11/24/91 LDR Added new routines & changed ones ** 10/29/91 SCS Changes for THINK C 5 ** 10/28/91 LDR Officially renamed DropShell (from QuickShell) ** Added a bunch of comments for clarification ** 10/06/91 00:02 MTC Converted to MPW C ** 04/09/91 00:02 LDR Original Version ** ******************************************************************************/ #pragma once #ifndef __DSUSERPROCS_H__ #define __DSUSERPROCS_H__ #include "DSGlobals.h" #include "DSUtils.h" extern Boolean gProcessing, gHasCQD; pascal void InstallOtherEvents (void); pascal void OpenApp (void); pascal void QuitApp (void); pascal Boolean PreFlightDocs ( Boolean opening, Handle *userDataHandle ); pascal void OpenDoc ( FSSpecPtr myFSSPtr, Boolean opening, Handle userDataHandle ); pascal void PostFlightDocs ( Boolean opening, Handle userDataHandle ); pascal void SelectFile ( void ); pascal Boolean InitUserGlobals(void); pascal void DisposeUserGlobals(void); pascal void HandleFileMenu(short id); #endif __DSUSERPROCS_H__

1
DSUtils.c Normal file

File diff suppressed because one or more lines are too long

1
DSUtils.h Normal file
View File

@ -0,0 +1 @@
/****************************************************************************** ** ** Project Name: DropShell ** File Name: DSUtils.h ** ** Description: header w/protos for DSUtils ** ******************************************************************************* ** A U T H O R I D E N T I T Y ******************************************************************************* ** ** Initials Name ** -------- ----------------------------------------------- ** LDR Leonard Rosenthol ** ******************************************************************************* ** R E V I S I O N H I S T O R Y ******************************************************************************* ** ** Date Time Author Description ** -------- ----- ------ --------------------------------------------- ** 12/09/91 LDR Added protos for new routines ** 11/24/91 LDR original version ** ******************************************************************************/ #pragma once #ifndef __DSUTILS_H__ #define __DSUTILS_H__ #ifndef THINK_C #include <Types.h> #include <Memory.h> #include <QuickDraw.h> #include <OSUtils.h> #include <ToolUtils.h> #include <Menus.h> #include <Packages.h> #include <Traps.h> #include <Files.h> #include <Resources.h> #endif #include <Aliases.h> #include <Processes.h> #include <PPCToolbox.h> #include "DSGlobals.h" void CenterAlert ( short theID ); void ErrorAlert ( short stringListID, short stringIndexID, short errorID ); void GetAppName(Str255 appName); void GetAppFSSpec(FSSpec *appSpec); OSErr GetTargetFromSelf (AEAddressDesc *targetDesc); OSErr GetTargetFromSignature (OSType processSig, AEAddressDesc *targetDesc); OSErr GetTargetFromBrowser (Str255 promptStr, AEAddressDesc *targetDesc); void _SendDocsToSelf (AEDescList *aliasList); void SendODOCToSelf (FSSpec *theFileSpec); void SendQuitToSelf (void); #endif __DSUTILS_H__

1
DSUtilsASG.c Normal file

File diff suppressed because one or more lines are too long

1
DSUtilsASG.h Normal file
View File

@ -0,0 +1 @@
#pragma once #ifndef __DSUTILSASG__ #define __DSUTILSASG__ #if defined(powerc) || defined (__powerc) #pragma options align=mac68k #endif typedef struct Prefs { short version; char trashSource; Boolean makeComments; Point progressLoc; Point prefsLoc; } Prefs, *PrefsPtr, **PrefsHandle; #if defined(powerc) || defined(__powerc) #pragma options align=reset #endif extern PrefsHandle gPrefs; extern Handle gMapResource; enum { kCreator = 'uuUN', kVersion = 0x0100 }; enum { kDontTrashSource, kTrashSource, kDeleteSource }; enum { rProgressDialog = 137, kProgressDialogID = 'Jpgd', progressText1 = 1, progressUser, progressCancel, progressText2, codecProgressForceUpdatePercent = -125 }; extern pascal OSErr GenericProgress(short theMessage, Fixed thePercent, long refCon); extern Boolean CheckAbort(); extern Boolean GiveTime(); extern Boolean HandleAbortMouseDown(EventRecord *theEvent); extern Boolean HandleAbortKeyDown(EventRecord *theEvent); extern pascal void UpdateBar(DialogPtr theDialog, short theItem); extern void SetItemHandle(DialogPtr theDialog, short theItem, Handle newHandle); extern Handle GetItemHandle(DialogPtr theDialog, short theItem); extern void UpdateDialogItem(DialogPtr theDialog, short theItem); extern void HiliteDControl(DialogPtr theDialog, short theItem, short theVal); extern FSSpec *GetPrefsSpec(void); extern OSErr SaveHandleAsResource(short theFile, OSType type, short index, Handle theHandle, short *id); extern OSErr SaveHandleAsResource(FSSpec *file, OSType fileType, OSType type, short index, Handle theHandle, short *id); extern OSErr LoadHandleFromResource(short theFile, OSType type, short index, Handle *theHandle); extern OSErr LoadHandleFromResource(FSSpec *file, OSType type, short index, Handle *theHandle); extern OSErr SavePrefsHandle(OSType type, short index, Handle theHandle, short *id = nil); extern OSErr LoadPrefsHandle(OSType type, short index, Handle *theHandle); extern void LoadPrefs(void); extern void SavePrefs(void); extern void SetWindowPosition(WindowPtr theWindow, Point thePosition); extern void GetWindowPosition(WindowPtr theWindow, Point *thePosition); extern void ForceFolderUpdate(long dirID, short vRefNum); #endif

1
DropShell.c Normal file

File diff suppressed because one or more lines are too long

1
DropShell.h Normal file
View File

@ -0,0 +1 @@
#pragma once void Panic(void); void InitToolbox(void); Boolean InitGlobals(void); void SetUpMenus(void); void InstallSplashScreen(void); void ShowAbout(void); void DoMenu(long retVal); void DoMouseDown(EventRecord *curEvent); void DoKeyDown(EventRecord *curEvent);

1
DropShell.make Normal file
View File

@ -0,0 +1 @@
##***************************************************************************** ## ## Project Name: DropShell ## File Name: DropShell.make ## ## Description: Makefile for DropShell ## This makefile was created with & must be built by ## MPW's Build Menu. Simply use the BuildÉ option, ## specifying DropShell as the thing to build. ## You can also use the BuildProgram command. ## ##***************************************************************************** ## A U T H O R I D E N T I T Y ##***************************************************************************** ## ## Initials Name ## -------- ----------------------------------------------- ## LDR Leonard Rosenthol ## ##***************************************************************************** ## R E V I S I O N H I S T O R Y ##***************************************************************************** ## ## Date Time Author Description ## -------- ----- ------ --------------------------------------------- ## 11/24/91 LDR Cleaned it up a bit using some more vars ## Added the DSUtils stuff ## 10/28/91 LDR Modified for the C version of DropShell ## 10/28/91 LDR Officially renamed DropShell (from QuickShell) ## And added some comments ## 04/08/91 23:57 LDR Original Version ## ##***************************************************************************** # File: DropShell.make # Target: DropShell # Sources: DSGlobals.h # DSAppleEvents.h # DropShell.h # DSAppleEvents.c # DropShell.c # DropShell.r # DSUserProcs.c # DSUtils.c ObjectDir = ":Objects:" LIBS = ¶ "{Libraries}"Runtime.o ¶ "{Libraries}"Interface.o ¶ "{CLibraries}"CSANELib.o ¶ "{CLibraries}"CInterface.o OBJECTS = ¶ {ObjectDir}DSUtils.c.o ¶ {ObjectDir}DSUserProcs.c.o ¶ {ObjectDir}DSAppleEvents.c.o ¶ {ObjectDir}DropShell.c.o "{ObjectDir}"DSUtils.c.o Ä DropShell.make DSUtils.c DSUtils.h DSGlobals.h C -o {ObjectDir} DSUtils.c "{ObjectDir}"DSUserProcs.c.o Ä DropShell.make DSUserProcs.c DSUserProcs.h DSGlobals.h C -o {ObjectDir} DSUserProcs.c "{ObjectDir}"DSAppleEvents.c.o Ä DropShell.make DSAppleEvents.c DSAppleEvents.h DSGlobals.h C -o {ObjectDir} DSAppleEvents.c "{ObjectDir}"DropShell.c.o Ä DropShell.make DropShell.c DSAppleEvents.c DSAppleEvents.h DSGlobals.h C -o {ObjectDir} DropShell.c DropShell ÄÄ DropShell.make {OBJECTS} Link -w -t APPL -c '????' ¶ {OBJECTS} {LIBS} ¶ -o DropShell DropShell ÄÄ DropShell.make DropShell.r Rez DropShell.r -append -o DropShell

1
DropShell.r Normal file

File diff suppressed because one or more lines are too long

BIN
IC2Resource.sit Normal file

Binary file not shown.

1
QuickProfiler.c Normal file

File diff suppressed because one or more lines are too long

1
uuUndo & NewsWatcher.TXT Normal file
View File

@ -0,0 +1 @@
>A uudecode utility must have the following attributes to be usable with >NewsWatcher: Sounds like I already got most of them last night! I'll mail you an alpha version later today for your preliminary evaluation. >No splash screen or registration dialog or other display that the user must >dismiss, at least not when launched with an ODOC event. Check. >No standard file prompt for destination file name and location. Use the >file name from the uuencode header line, and put the decoded result file in >the same folder as the input file. Check. >Append digits or something if necessary to guarantee unique destination >file name. Check. >Launchable in background. Do not assume you start out in the foreground. Check. >Use Notification Manager properly if you are in the background before >presenting error alerts or other dialogs. Check -- right now there *are* no error alerts or dialogs. (This may change, of course :-) >Must be drag-and-drop, of course: Drop a text file on the utility, and it >decodes. Check. >Must be able to accept additional ODOC events while busy, and queue them. >In NewsWatcher, if the helper app is already running, I just send it an >ODOC event. I don't queue them up at my end. This is important, for >example, if a user extracts binaries from several articles at once in a >subject window. In this case, I will likely be creating temp.n.uu files and >firing ODOC events at you faster than you can process them. I think this works, but will check it. All WaitNextEvent() calls during the processing have an event filter of (everyEvent - highLevelEventMask), so things should queue up in the OSEvent queue until I get back to the main event loop. >Must delete input file after successful decode, or at least offer this as a >configurable option. If any kind of error occurs during decoding, however, >the input file must not be deleted. Not done yet, but planned as an option. >Must be able to handle multiple-part uuencoded text with intermixed headers >and other junk, with or without the special "flag lines" indicating where >the parts begin and end. You can, however, assume that parts are in the >correct order. Check. (This was one of the really cool features of my unix version :-) >The following attributes are highly desirable: >Should quit when finished if launched with ODOC event. Check. >Should have configurable preferences for file name suffix -> file type and >creator mapping. (I did manage to convince Leonard to make JPEGView the >default for gif and jpeg files in Expander, by the way. With Expander, you >have to attack StuffIt Engine with ResEdit to change this mapping.) Not yet, but planned. At first, I'll probably just do something similar to the Stuffit Engine until I have time for going all out. >Should run like a bat out of Hell in native mode, of course. :-) Check -- faster than Leonard's, even :-) >Should call WaitNextEvent every 4-6 ticks while busy, no more and no less, >to cooperate well with other apps. I'm using a sleep time of 3 ticks while busy, and making sure I don't call WaitNextEvent any more often than every 2 ticks. It *still* runs like a bat out of hell, though. >Should *not* slow down when run in the background. Check. >A progress dialog is fine, but handle update events properly and reasonably >quickly. Movable modal progress dialogs are best. Check. >Should move the decoded result file to the same location in the Finder >window as the input file after deleting the input file. This makes dragging >and dropping from NewsWatcher to a Finder window nicer, because the final >decoded file ends up where you dropped it. Hadn't thought of that, but it's a good idea. I'll put it in. Thanks for the checklist -- it makes my job a lot easier. Maybe you can even distribute my app with NewsWatcher if you like it enough. I don't really care what you do with it; I'm writing it for my own reasons, anyway :-) Aaron

File diff suppressed because one or more lines are too long

1
uuUndo To Do!.TXT Normal file
View File

@ -0,0 +1 @@
To do yet ========= Preferences: More features?: Debinhexing Test test test!

BIN
uuUndo.68k.µ Normal file

Binary file not shown.

BIN
uuUndo.ppc.µ Normal file

Binary file not shown.

BIN
uuUndoLDEF.68k.µ Normal file

Binary file not shown.

1
uuUndoLDEF.c Normal file
View File

@ -0,0 +1 @@
#include <A4Stuff.h> #include <QDOffscreen.h> static OSErr FindIcon(OSType creator, OSType type); static char gIconBuffer[1024]; static GWorldPtr gTheGWorld = nil; static OSType gIconType = kLargeIcon; static Rect gIconBounds = { 0, 0, 32, 32 }; pascal void main(short message, Boolean selected, Rect *cellRect, Cell theCell, short dataOffset, short dataLen, ListHandle theList) { long oldA4 = SetCurrentA4(); char cellData[16]; RgnHandle oldClip; PenState oldState; FontInfo theInfo; GrafPtr oldPort; Point thePoint; OSErr theErr; short depth; switch (message) { case lInitMsg: if (((CGrafPtr)(*theList)->port)->portVersion & 0xc000) { GDHandle mostDevice; GrafPtr oldPort; Rect globalRect; GetPort(&oldPort); SetPort((*theList)->port); globalRect = (*theList)->port->portRect; LocalToGlobal((Point *)&globalRect.top); LocalToGlobal((Point *)&globalRect.bottom); mostDevice = GetMaxDevice(&globalRect); depth = (*(*mostDevice)->gdPMap)->pixelSize; if (depth == 4) gIconType = kLarge4BitIcon, depth = 4; else if (depth > 4) gIconType = kLarge8BitIcon, depth = 8; else gIconType = kLargeIcon, depth = 1; SetPort(oldPort); } else gIconType = kLargeIcon, depth = 1; theErr = NewGWorld(&gTheGWorld, depth, &gIconBounds, nil, nil, 0); if (theErr != noErr || !gTheGWorld) theErr = NewGWorld(&gTheGWorld, depth, &gIconBounds, nil, nil, useTempMem); break; case lDrawMsg: GetPort(&oldPort); SetPort((*theList)->port); oldClip = NewRgn(); GetClip(oldClip); ClipRect(cellRect); GetPenState(&oldState); PenNormal(); EraseRect(cellRect); if (dataLen == 16) { LGetCell(cellData, &dataLen, theCell, theList); GetFontInfo(&theInfo); thePoint.h = cellRect->left + 5; thePoint.v = cellRect->top + ((34 - (theInfo.ascent + theInfo.leading + theInfo.descent)) / 2) + theInfo.ascent; MoveTo(thePoint.h, thePoint.v); DrawString((StringPtr)cellData); thePoint.h += 87; MoveTo(thePoint.h, thePoint.v); DrawText((StringPtr)cellData, 10, 4); DrawChar('/'); DrawText((StringPtr)cellData, 6, 4); } theErr = FindIcon(*(long *)&cellData[10], *(long *)&cellData[6]); if (theErr == noErr) { PixMapHandle thePixMap = GetGWorldPixMap(gTheGWorld); Rect dstRect = *cellRect; LockPixels(thePixMap); dstRect.right -= 5; dstRect.left = dstRect.right - 32; dstRect.top++; dstRect.bottom = dstRect.top + 32; CopyBits((BitMap *)*thePixMap, &(*theList)->port->portBits, &gIconBounds, &dstRect, srcCopy, nil); UnlockPixels(thePixMap); } if (selected) { LMSetHiliteMode(LMGetHiliteMode() & ~(1 << hiliteBit)); InvertRect(cellRect); } SetPenState(&oldState); SetClip(oldClip); DisposeRgn(oldClip); SetPort(oldPort); break; case lHiliteMsg: LMSetHiliteMode(LMGetHiliteMode() & ~(1 << hiliteBit)); InvertRect(cellRect); break; case lCloseMsg: if (gTheGWorld) DisposeGWorld(gTheGWorld), gTheGWorld = nil; break; } SetA4(oldA4); } OSErr FindIcon(OSType creator, OSType type) { ParamBlockRec vol; DTPBRec dt; Str255 path; OSErr theErr; if (!gTheGWorld) return memFullErr; vol.volumeParam.ioCompletion = nil; vol.volumeParam.ioVolIndex = 1; vol.volumeParam.ioNamePtr = path; while (true) { vol.volumeParam.ioVRefNum = 0; theErr = PBGetVInfoSync(&vol); if (theErr != noErr) break; dt.ioVRefNum = vol.volumeParam.ioVRefNum; dt.ioNamePtr = path; theErr = PBDTGetPath(&dt); if (theErr != noErr) continue; dt.ioCompletion = nil; dt.ioDTBuffer = gIconBuffer; dt.ioDTReqCount = 1024; dt.ioIconType = gIconType; dt.ioFileCreator = creator; dt.ioFileType = type; theErr = PBDTGetIconSync(&dt); if (theErr == noErr && gTheGWorld) { PixMapHandle thePixMap = GetGWorldPixMap(gTheGWorld); char *src, *dst; short row, size; LockPixels(thePixMap); src = gIconBuffer; dst = GetPixBaseAddr(thePixMap); size = 32 * (*thePixMap)->pixelSize / 8; for (row = 0; row < 32; row++) { BlockMove(src, dst, size); src += size; dst += (*thePixMap)->rowBytes & 0x3fff; } UnlockPixels(thePixMap); return noErr; } vol.volumeParam.ioVolIndex++; } }

1
uundo13.c Normal file

File diff suppressed because one or more lines are too long