FragmentTool.h

/*
    File:       FragmentTool.h
 
    Contains:   Common header file included by all source files
 
    Written by: Chris White 
 
    Copyright:  Copyright © 1995-1999 by Apple Computer, Inc., All Rights Reserved.
 
                You may incorporate this Apple sample source code into your program(s) without
                restriction. This Apple sample source code has been provided "AS IS" and the
                responsibility for its operation is yours. You are not permitted to redistribute
                this Apple sample source code as "Apple sample source 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 source
                code, but that you've made changes.
 
    Change History (most recent first):
                8/5/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
                
 
*/
 
 
#ifndef __FRAGMENTTOOL__
#define __FRAGMENTTOOL__
 
 
 
#ifndef __WINDOWS__
    #include <Windows.h>
#endif
 
#ifndef __FILES__
    #include <Files.h>
#endif
 
#include <Drag.h>
#include <Lists.h>
#include <Types.h>
#include <Dialogs.h>
 
 
 
 
#define DEBUGGING   1
 
 
#define kFourQuestionMarks      0x3F3F3F3F      
 
 
enum
{
    /* File types & creators */
    
    kCreatorCode = 'frgt'
};
 
 
 
enum
{
    /* Internal error codes */
    
    kGenericError = 1,
    kNeedSystem7,
    kCFMNotPresent,
    kMixedModeNotPresent,
    kDragManagerNotPresent
};
 
 
 
enum
{
    // Error strings
    
    
    kGenericErrorStr = 4,
    kUnresolvedDependenciesStr = 5,
    kFileOpenStr = 6
};
 
 
 
enum
{
    kDAWindowType = 100,
    kDocumentWindowType,
    kListWindowType,
    kGetInfoWindowType,
    kMoveFragmentWindowSubType,
    kCopyFragmentWindowSubType
};
 
 
 
enum
{
    kNotCancelled = false, 
    kCancelled = true
};
 
#define kDisplayWindow  1000
 
 
 
 
#define kAboutDialog            1001
#define kErrorDialog            1002
#define kSaveDontsaveDialog     2003
#define rErrorStrings           1002
 
typedef Byte        int8;   
typedef short       int16;
typedef long        int32;
 
 
 
 
typedef struct WindowInfo
{
    Boolean     bUntitled;
    Boolean     bDirty;
    ListRef     listRef;
    Handle      dataHandle;
    FSSpec      fileSpec;
    
} tWindowInfo, *tWindowInfoPtr;
 
 
typedef struct DialogInfo
{
    int16       windowType;
    int16       windowSubType;
    ListHandle  listRef;
    int32       refCon;
    
} tDialogInfo, *tDialogInfoPtr;
 
 
 
 
typedef struct DrawingWindow DrawingWindow, *DrawingWindowPeek;
 
 
 
typedef OSErr (*tContentsProcPtr) ( ListRef theList, void* refCon );
 
 
 
 
struct AddFragmentsRecOut
{
    int16   theFileRef;
};
 
 
struct AddFragmentsRecIn
{
    Handle  theDataHandle;
};
 
 
typedef struct AddFragmentsRec
{
    union
    {
        struct AddFragmentsRecOut   out;
        struct AddFragmentsRecIn    in;
    } u;
    
} tAddFragmentsRec;
 
 
 
typedef struct DragData
{
    WindowRef   theWindow;
    int16       theIndex;
} tDragData;
 
 
 
 
/* Global Variable Definitions */
 
 
 
/*
   This allows me to include this file in all sources with the 
   extern keyword used in all instances except the main source file.
*/
 
#ifdef __MAIN__
    #define global
#else
    #define global  extern
#endif
 
 
global  Boolean                 gQuit;                  /* quit program flag */
global  int32                   gSleepTime;
global  int16                   gMenuState;             /* In what state did we last leave our menu bar? */
global  WindowRef               gCurrentWindow;         /* Which window are we redrawing? */
global  Handle                  gCommonMenuBar;         /* The menubar for the app itself, with no tool menus */
 
global  Boolean                 gHasDragManager;        /* Is the Drag Manager available? */
global  UserItemUPP             gOutlineUserItemUPP;
global  DragTrackingHandlerUPP  gDragTrackingHandlerUPP;
global  DragReceiveHandlerUPP   gDragReceiveHandlerUPP;
global  DragSendDataUPP         gDragSendDataProcUPP;
global  ListClickLoopUPP        gClickLoopUPP;
 
 
#endif  // __FRAGMENTTOOL__