eudora-mac/filegraphic.c

1 line
102 KiB
C
Raw Normal View History

2018-05-23 09:59:15 +00:00
/* Copyright (c) 2017, Computer History Museum All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Computer History Museum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "filegraphic.h" #include "pete.h" #include <QuickTimeComponents.h> #ifdef URLACCESS #include <urlaccess.h> #else typedef void* URLReference; #endif #if NETSCAPE #include "netscapeplugins.h" #endif #define FILE_NUM 81 /* Copyright (c) 1996 by Qualcomm, Inc. */ #pragma segment FILEGRAPHIC #ifdef DEBUG // Display missing graphic asserts? // Don't normally need this. Usually missing graphics are ones that have // been deleted by transferring a message to the trash. //#define MISSING_GRAPHIC_ASSERTS #endif #ifdef ATT_ICONS enum { kBorderSize = 2 }; #define kMaxDownloads 4 #define kAttStubIconWd 20 #define kQTYesList 'QTys' #define kQTNoList 'QTno' typedef struct GetURLDataStruct **GetURLDataHandle; typedef struct GetURLDataStruct { GetURLDataHandle next; GetURLDataHandle duplicate; FGIHandle graphic; PETEHandle pte; URLReference urlRef; FSSpec spec; OSStatus urlError; Boolean finished; Boolean reschedule; } GetURLData; // Globals static short gPicRefN; static Handle ghSpoolBuf; static long gSpoolBufSize,gSpoolBufIdx; static Handle gMissingGraphicIconSuite; static Handle gBadGraphicIconSuite; static short gDownloadCount; static GetURLDataHandle gURLDataList; static QTImageHandle gQTImageList; static Boolean gMovieClick; static MyWindowPtr gGetGraphicsWin; pascal OSErr FileGraphicSend(FlavorType flavor, void *dragSendRefCon, ItemReference theItemRef, DragReference drag); void PeteMakeFileGraphic(PETEHandle pte,FGIHandle newGHndl,FSSpecPtr spec,short maxWidth,short ht,Boolean displayInline); OSErr PeteFileGraphicHit(PETEHandle pte,FGIHandle graphic,long offset,EventRecord *event); Rect *FileGraphicIconRect(Rect *iconR, Rect *r); void FileGraphicDisplay(PETEHandle pte, FGIHandle graphic, long offset); static PicHandle SpecPicture(FSSpecPtr spec,long maxBytes); void SpoolPictDisplay(PicHandle picture,FSSpecPtr spec,Rect *r); Rect *FileGraphicTextRect(Rect *textR, Rect *r); void FileGraphicAdjustSize(FGIHandle graphic, short width); HFSFlavor *BuildHFSFlavor(HFSFlavor *hfs, FSSpecPtr spec); void FileGraphicFancyRgn(PETEHandle pte,FGIHandle graphic,long offset,Point pt,RgnHandle rgn); Boolean FileGraphicDrag(PETEHandle pte,FGIHandle graphic,long offset,EventRecord *event); OSErr GetDropSpec(DragReference drag,FSSpecPtr spec); OSErr FinderTricks(DragReference drag,OSErr dragErr,FSSpecPtr orig); static void DrawBorder(Boolean doGrey,Rect *r,short thickness,Boolean