Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
Headers/Proto.h
/************************************************************************************* |
# |
# Proto.h |
# |
# This file contains the prototypes for the apps procs and funcs |
# |
# Author(s): Michael Marinkovich & Guillermo Ortiz |
# marink@apple.com |
# |
# Modification History: |
# |
# 4/3/96 MWM Initial coding |
# |
# Copyright © 1992-96 Apple Computer, Inc., All Rights Reserved |
# |
# |
# You may incorporate this sample code into your applications without |
# restriction, though the sample code has been provided "AS IS" and the |
# responsibility for its operation is 100% yours. However, what you are |
# not permitted to do is to redistribute the source as "DSC Sample Code" |
# after having made changes. If you're going to re-distribute the source, |
# we require that you make it clear in the source that the code was |
# descended from Apple Sample Code, but that you've made changes. |
# |
*************************************************************************************/ |
#include <Displays.h> |
#include <ImageCompression.h> |
//---------------------------------------------------------------------- |
// |
// JPEG |
// |
//---------------------------------------------------------------------- |
OSErr ReadJPEG(FSSpec spec, CGrafPtr *newWorld); |
OSErr ConvertJPEG(Handle image, CGrafPtr *newWorld); |
OSErr ReadJPEGHeader(short refNum, ImageDescriptionHandle desc, Rect *bounds); |
UInt8 FindNextMarker(long refNum); |
OSErr HandleAPPOMarker(UInt8 marker, long refNum, ImageDescriptionHandle desc, Boolean *readingExtension); |
OSErr HandleSOFMarker(long refNum, ImageDescriptionHandle desc, Boolean readingExtension); |
void HandleSOSMarker(long refNum); |
UInt8 ReadByte(short refNum); |
UInt16 ReadWord(short refNum); |
void SkipLength(long refNum); |
OSErr NewJPEGWorld(GWorldPtr *theWorld, short depth, Rect theRect); |
OSErr SaveJPEG(WindowRef window); |
pascal OSErr DataUnloadProc(Ptr data, long bytesNeeded, long refCon); |
pascal OSErr DataLoadingProc(Ptr *data, long bytesNeeded, long refCon); |
//---------------------------------------------------------------------- |
// |
// Aevt |
// |
//---------------------------------------------------------------------- |
OSErr AEInit(void); |
void AEDispose(void); |
pascal OSErr DoAEOpenApp(AppleEvent *event, AppleEvent reply, long refCon); |
pascal OSErr DoAEQuitApp(AppleEvent *event, AppleEvent reply, long refCon); |
pascal OSErr DoAEOpenDoc(AppleEvent *event, AppleEvent reply, long refCon); |
pascal OSErr DoAEPrintDoc(AppleEvent *event, AppleEvent reply, long refCon); |
OSErr GotAEParams(AppleEvent *appleEvent); |
//---------------------------------------------------------------------- |
// |
// Initialize |
// |
//---------------------------------------------------------------------- |
OSErr Initialize(void); |
void ToolBoxInit(void); |
void CheckEnvironment(void); |
OSErr InitApp(void); |
void MenuSetup(void); |
//---------------------------------------------------------------------- |
// |
// Main |
// |
//---------------------------------------------------------------------- |
void HandleError(short errNo,Boolean fatal); |
void HandleAlert(short alertID); |
//---------------------------------------------------------------------- |
// |
// Events |
// |
//---------------------------------------------------------------------- |
void EventLoop(void); |
short MyGetSleep(void); |
void CustomWindowEvent(short eventType,WindowRef window,void *refCon); |
void DoEvent(EventRecord *event); |
void DoIdle(WindowRef window, void *refCon); |
void HandleMouseDown( EventRecord *event ); |
void HandleMenuChoice( WindowRef window, void *refCon ); |
void HandleContentClick( WindowRef window, void *refCon ); |
void HandleZoomClick( WindowRef window, void *refCon ); |
void HandleGrow(WindowRef window, void *refCon); |
void UpdateWindow(WindowRef window); |
void DoActivate(WindowRef window, void *refCon); |
//---------------------------------------------------------------------- |
// |
// Windows |
// |
//---------------------------------------------------------------------- |
WindowPtr CreateWindow(short resID, void *wStorage, Rect *bounds, Str255 title, |
Boolean visible, short procID,short kind, WindowRef behind, |
Boolean goAwayFlag,long refCon); |
OSErr RemoveWindow(WindowRef window); |
void NewWindowTitle(WindowRef window, Str255 str); |
OSErr InitWindowProcs(WindowRef window, short windKind); |
GWorldPtr PictToWorld(PicHandle pict, OSErr *rtnErr); |
void DrawWindow( WindowRef window, void *refCon ); |
void DrawAboutWindow( WindowRef window, void *refCon ); |
void DoResizeWindow (WindowRef window); |
short GetWindKind(WindowRef window); |
Boolean GetIsAppWindow(WindowRef window); |
Boolean GetIsAboutWindow( WindowRef window ); |
//---------------------------------------------------------------------- |
// |
// Displays |
// |
//---------------------------------------------------------------------- |
OSErr InstallAEDMNotification(void); |
pascal OSErr WorldChangedProc(AppleEvent event,AppleEvent reply,long refCon); |
OSErr HandleNotification(AppleEvent *event); |
OSErr HandleDeviceChange(DisplayIDType displayID, Rect *newRect); |
Boolean OutOfBoundsRect(Rect windRect, Rect screenRect); |
void MoveInbounds(WindowRef window, GDHandle gd, Rect screenRect); |
void ResizeInbounds(WindowRef window, GDHandle gd, Rect screenRect); |
GDHandle GetGreatestDevice(WindowRef window); |
void ResetStdState(WindowRef window); |
short GetWTitleHeight(WindowRef window); |
//---------------------------------------------------------------------- |
// |
// Scrolls |
// |
//---------------------------------------------------------------------- |
void InstallScrollBars(WindowRef window, DocHnd doc); |
void AdjustScrollValues(WindowRef window); |
void AdjustScrollbars(WindowRef window, Boolean resize); |
pascal void ScrollActionProc(ControlRef control, short part); |
void ScrollPict(short hAmount,short vAmount,WindowRef window); |
void MyScrollPicture(WindowRef window, short hs, short vs); |
void GetContRect(WindowRef window,Rect *contRect); |
//---------------------------------------------------------------------- |
// |
// Utils |
// |
//---------------------------------------------------------------------- |
void DoOpenNew(void); |
PicHandle ReadFile(FSSpec spec); |
void ZeroRect(Rect *r); |
void pstrcpy(StringPtr dst, StringPtr src); |
void pstrcat(StringPtr dst, StringPtr src); |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14