home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / apps.to.go / DTS.Lib / DTS.Lib.headers / DTS.Lib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-02  |  15.1 KB  |  482 lines  |  [TEXT/MPS ]

  1. #ifndef __DTSLib__
  2. #define __DTSLib__
  3.  
  4. #ifndef __TYPES__
  5. #include <Types.h>
  6. #endif
  7.  
  8. #ifndef __APPLEEVENTS__
  9. #include <AppleEvents.h>
  10. #endif
  11.  
  12. #ifndef __FILES__
  13. #include <Files.h>
  14. #endif
  15.  
  16. #ifndef __MOVIES__
  17. #include <Movies.h>
  18. #endif
  19.  
  20. #ifndef __PRINTING__
  21. #include <Printing.h>
  22. #endif
  23.  
  24. #ifndef __TREEOBJ__
  25. #include "TreeObj.h"
  26. #endif
  27.  
  28. #ifndef __UTILITIES__
  29. #include "Utilities.h"
  30. #endif
  31.  
  32. #ifndef __WINDOWS__
  33. #include <Windows.h>
  34. #endif
  35.  
  36. /********/
  37.  
  38. typedef void        (*CalcFrameRgnProcPtr)(FileRecHndl frHndl, WindowPtr window, RgnHandle rgn);
  39. typedef void        (*ContentClickProcPtr)(WindowPtr window, EventRecord *event, Boolean firstClick);
  40. typedef Boolean        (*ContentKeyProcPtr)(WindowPtr window, EventRecord *event, Boolean *passThrough);
  41. typedef void        (*DrawFrameProcPtr)(FileRecHndl frHndl, WindowPtr window, Boolean activate);
  42. typedef OSErr        (*FreeDocumentProcPtr)(FileRecHndl frHndl);
  43. typedef OSErr        (*FreeWindowProcPtr)(FileRecHndl frHndl, WindowPtr window);
  44. typedef OSErr        (*ImageProcPtr)(FileRecHndl frHndl);
  45. typedef OSErr        (*InitContentProcPtr)(FileRecHndl frHndl, WindowPtr window);
  46. typedef OSErr        (*ReadDocumentProcPtr)(FileRecHndl frHndl);
  47. typedef OSErr        (*ReadDocumentHeaderProcPtr)(FileRecHndl frHndl);
  48. typedef void        (*ResizeContentProcPtr)(WindowPtr window, short oldh, short oldv);
  49. typedef void        (*ScrollFrameProcPtr)(FileRecHndl frHndl, WindowPtr window, long dh, long dv);
  50. typedef void        (*UndoFixupProcPtr)(FileRecHndl frHndl, Point contOrg, Boolean afterUndo);
  51. typedef Boolean        (*WindowCursorProcPtr)(FileRecHndl frHndl, WindowPtr window, Point globalPt);
  52. typedef OSErr        (*WriteDocumentProcPtr)(FileRecHndl frHndl);
  53. typedef OSErr        (*WriteDocumentHeaderProcPtr)(FileRecHndl frHndl);
  54. typedef Boolean        (*AdjustMenuItemsProcPtr)(WindowPtr window, short menuID);
  55. typedef Boolean        (*DoMenuItemProcPtr)(WindowPtr window, short menuID, short menuItem);
  56.     /* The above are the procPtrs that are kept in a file reference handle.  These point to
  57.     ** the functions in your application that are automatically called by the framework.
  58.     ** You will find stub functions in the files Window.c, WindowDialog.c, and WindowPalette.c
  59.     ** The framework initializes these procPtrs to point to the correct set of functions, based
  60.     ** on the type of the window (kwIsDocument, kwIsModalDialog, or kwIsPalette). */
  61.  
  62. typedef OSErr        (*HideWindowProcPtr)(FileRecHndl frHndl, WindowPtr window);
  63.     /* There is a global in Window2.c called gHideWindowProc that, if set to non-nil, is called
  64.     ** when a window is hidden by the framework.  If you have windows that are only hidden, and
  65.     ** not disposed of, it may be important to the application to get a message that the window
  66.     ** is being hidden.  Set gHideWindowProc to point to a procedure in your application
  67.     ** conforming to the above prototype, and it will be called when a window is hidden. */
  68.  
  69. typedef long        (*DocScrollBarProc)(FileRecHndl frHndl, ControlHandle ctl, short message, long val);
  70. #define kscrollHAdjust        0
  71. #define kscrollVAdjust        1
  72. #define kscrollGetHOrigin     2
  73. #define kscrollGetVOrigin     3
  74. #define kscrollGetHLongOrigin 4
  75. #define kscrollGetVLongOrigin 5
  76.     /* The document scrollbars can be coerced into handling long values.  If you need long values
  77.     ** from the document scrollbars because your document space is greater than 32k, then
  78.     ** place a DocScrollBarProc in the refCon field of the document scrollbar.  You will then get
  79.     ** called at appropriate times with the various messages.  The proc's job is to convert the
  80.     ** short value from the scrollbar to a logical long (and back again) for the various messages.
  81.     ** The file reference handle is also passed in, so you can combine the state of the document
  82.     ** with the scrollbar's short value to derive the long scroll value. */
  83.  
  84. #ifdef powerc
  85. #pragma options align=mac68k
  86. #endif
  87. typedef struct {
  88.     OSType                        sfType;
  89.     Boolean                        defaultDoc;
  90.     Movie                        movie;
  91.     short                        movieResID;
  92.     short                        movieFlags;
  93.     Boolean                        movieDataRefWasChanged;
  94.     Boolean                        docDirty;
  95.     long                        modNum;
  96.     long                        modTick;
  97.     Boolean                        readOnly;
  98.     short                        refNum;
  99.     short                        resRefNum;
  100.     FSSpec                        fss;
  101.     short                        windowID;
  102.     WindowPtr                    window;
  103.     PositionWndProcPtr            getDocWindow;
  104.     CalcFrameRgnProcPtr            calcFrameRgnProc;
  105.     ContentClickProcPtr            contentClickProc;
  106.     ContentKeyProcPtr            contentKeyProc;
  107.     DrawFrameProcPtr            drawFrameProc;
  108.     FreeDocumentProcPtr            freeDocumentProc;
  109.     FreeWindowProcPtr            freeWindowProc;
  110.     ImageProcPtr                imageProc;
  111.     InitContentProcPtr            initContentProc;
  112.     ReadDocumentProcPtr            readDocumentProc;
  113.     ReadDocumentHeaderProcPtr    readDocumentHeaderProc;
  114.     ResizeContentProcPtr        resizeContentProc;
  115.     ScrollFrameProcPtr            scrollFrameProc;
  116.     UndoFixupProcPtr            undoFixupProc;
  117.     WindowCursorProcPtr            windowCursorProc;
  118.     WriteDocumentProcPtr        writeDocumentProc;
  119.     WriteDocumentHeaderProcPtr    writeDocumentHeaderProc;
  120.     AdjustMenuItemsProcPtr        adjustMenuItemsProc;
  121.     DoMenuItemProcPtr            doMenuItemProc;
  122.     long                        attributes;            /* Here down is window content information. */
  123.     Rect                        windowSizeBounds;
  124.     ControlHandle                hScroll;
  125.     ControlHandle                vScroll;
  126.     short                        hScrollIndent;
  127.     short                        vScrollIndent;
  128.     short                        leftSidebar;
  129.     short                        topSidebar;
  130.     short                        hArrowVal;
  131.     short                        vArrowVal;
  132.     short                        hPageVal;
  133.     short                        vPageVal;
  134. } FileStateRec;
  135. #ifdef powerc
  136. #pragma options align=reset
  137. #endif
  138.  
  139. #ifdef powerc
  140. #pragma options align=mac68k
  141. #endif
  142. typedef struct {
  143.     long            windowTag[2];        /* Used to match up windows.                    */
  144.     short            endSendInfo;        /* Above is send info.                            */
  145.  
  146.     short            connected;            /* Flag showing we are connected.                */
  147.     AEAddressDesc    remoteLoc;            /* AppleEvents address of remote user.            */
  148.     Str32            remoteName;            /* Name of user connected to.                    */
  149.     Str32            remoteZone;            /* Zone of user connected to.                    */
  150.     Str32            remoteMachine;        /* Machine name of user connected to.            */
  151.  
  152.     Str255            remotePath;            /* Full path of user connected to.    */
  153.     Str32            remoteApp;            /* Name of user connected to.        */
  154.  
  155.     short            endLocalInfo;        /* Above info is for one machine only.            */
  156. } ConnectRec;
  157. #ifdef powerc
  158. #pragma options align=reset
  159. #endif
  160.  
  161. #ifdef powerc
  162. #pragma options align=mac68k
  163. #endif
  164. typedef struct {
  165.     short        version;            /* The file format version.                    */
  166.     Boolean        printRecValid;        /* True if prRec has been created.            */
  167.     TPrint        print;                /* Print record for file.                    */
  168.     Rect        structureRect;        /* Remember where window was when saved.    */
  169.     Rect        contentRect;        /* Remember where window was when saved.    */
  170.     Rect        stdState;            /* This and below rect used for saving        */
  171.     Rect        userState;            /* zoom information for window.                */
  172.     long        hDocSize;            /* hDocSize and vDocSize have to be saved    */
  173.     long        vDocSize;            /* with the document, or recalculated        */
  174.                                     /* when the file is opened so that the        */
  175.                                     /* window can be created the correct size.    */
  176.     short        endDocHeaderInfo;    /* End version, print, and window info.        */
  177. } DocHeaderInfo;
  178. #ifdef powerc
  179. #pragma options align=reset
  180. #endif
  181.  
  182. #ifdef powerc
  183. #pragma options align=mac68k
  184. #endif
  185. struct AEHandler{
  186.     AEEventClass            theEventClass;
  187.     AEEventID                theEventID;
  188.     AEEventHandlerProcPtr    theHandler;
  189.     AEEventHandlerUPP        theUPP;
  190. };
  191. typedef struct AEHandler AEHandler;
  192. #ifdef powerc
  193. #pragma options align=reset
  194. #endif
  195.  
  196. #ifdef powerc
  197. #pragma options align=mac68k
  198. #endif
  199. typedef struct {
  200.     OSType    sfType;
  201.     char    sfTypeTerm;            /* 0-byte which terminates sfType, thus making it a c-str. */
  202.     short    windowID;
  203.     long    attributes;
  204.     Boolean    fileBasedDoc;        /* True if document can be opened/saved. */
  205.     Boolean    openAsDefault;        /* True if new document should be created as default document. */
  206.     Boolean    openAtStartup;        /* True if new document should always be created at startup. */
  207.     short    hScrollIndent;
  208.     short    vScrollIndent;
  209.     short    leftSidebar;
  210.     short    topSidebar;
  211.     char    title[2];            /* title[0] = enumerated window title */
  212.                                 /* title[1] = references and offsets to other WFMTObj definitions */
  213.                                 /* A WFMTObj can reference other for inclusion into the window 
  214.                                 ** content.  The format is TYPE,xoffset,yoffset,TYPE,xoffset,yoffset.
  215.                                 ** A WFMTObj can reference as many other WFMTObj's as will fit into
  216.                                 ** a max pascal string.  If this isn't enough (hard to imagine),
  217.                                 ** then a WFMTObj can act as a container for other WFMTObj's.  They
  218.                                 ** can be nested as many deep as you want. */
  219. } WFMTObj;
  220. #define mDerefWFMT(hndl) ((WFMTObj*)((*hndl) + 1))
  221. #ifdef powerc
  222. #pragma options align=reset
  223. #endif
  224.  
  225. #ifdef powerc
  226. #pragma options align=mac68k
  227. #endif
  228. typedef struct {
  229.     short    numRows;
  230.     short    numCols;
  231.     short    cellHeight;
  232.     short    cellWidth;
  233.     short    mode;
  234. } CLNewInfo;
  235. #ifdef powerc
  236. #pragma options align=reset
  237. #endif
  238.  
  239. #ifdef powerc
  240. #pragma options align=mac68k
  241. #endif
  242. typedef struct {
  243.     Rect    destRct;
  244.     Rect    viewRct;
  245.     Rect    brdrRct;
  246.     short    maxTextLen;
  247.     short    mode;
  248. } CTENewInfo;
  249. #ifdef powerc
  250. #pragma options align=reset
  251. #endif
  252.  
  253. #ifdef powerc
  254. #pragma options align=mac68k
  255. #endif
  256. typedef struct {
  257.     Boolean            selected;
  258.     Rect            rect;
  259.     char            visible;
  260.     char            hilite;
  261.     short            value, min, max;
  262.     unsigned short    procID;
  263.     long            refCon;
  264.     unsigned short    ctlID;
  265.     short            cctbID;
  266.     short            fontSize;
  267.     Style            fontStyle;
  268.     union {
  269.         CLNewInfo    clnew;
  270.         CTENewInfo    ctenew;
  271.     } extCtl;
  272.     unsigned char    title[4];        /* 4 pascal strings are stored back-to-back starting here. */
  273.                                     /* title[0] = control title */
  274.                                     /* title[1] = key equivs    */
  275.                                     /* title[2] = control font  */
  276.                                     /* title[3] = balloon help info */
  277.     short            textLen[2];        /* 2 short-prefixed data blocks stored starting here.
  278.                                     ** textLen[0] = textEdit control text block
  279.                                     ** textLen[1] = textEdit control style block */
  280. } CtlObj;
  281. #define mDerefCtl(hndl) ((CtlObj*)((*hndl) + 1))
  282. #ifdef powerc
  283. #pragma options align=reset
  284. #endif
  285.  
  286. #ifdef powerc
  287. #pragma options align=mac68k
  288. #endif
  289. typedef struct {
  290.     TreeObjHndl        ctlObj;
  291.     ControlHandle    ctl;
  292.     char            visible;
  293.     short            procID;
  294. } CObjCtl;
  295. typedef CObjCtl CObjCtlAry[];
  296. typedef CObjCtlAry *CObjCtlPtr, **CObjCtlHndl;
  297. #ifdef powerc
  298. #pragma options align=reset
  299. #endif
  300.  
  301. /* The structs CLNewInfo, CTENewInfo, and CtlObj are primarily for support of the AppsToGo
  302. ** application editor.  However, you may find it useful to know the format of the control
  303. ** objects used by the framework for control creation.  At startup time, your application is
  304. ** free to modify any control definitions.  These changes may be based on user preferences
  305. ** or whatever.  Just look up the control definition object, and change it.  When the control
  306. ** definition is used, the modification will be reflected in the control creation. */ 
  307.  
  308. /********/
  309.  
  310. #define mDerefWStateData(window) (*(WStateDataHandle)(((WindowPeek)window)->dataHandle))
  311.  
  312. #define kwGrowIcon            0x00000001L
  313. #define kwHScroll            0x00000002L
  314. #define kwHScrollLessGrow    0x00000006L
  315. #define kwVScroll            0x00000008L
  316. #define kwVScrollLessGrow    0x00000018L
  317. #define kwVisible            0x00000020L
  318. #define kwOpenAtOldLoc        0x00000040L
  319. #define kwDoFirstClick        0x00000080L
  320. #define kwHideOnClose        0x00000100L
  321. #define kwIsDocument        0
  322. #define kwIsPalette            0x00000200L
  323. #define kwIsModalDialog        0x00000400L
  324. #define kwDefaultDocHeader    0x00000800L
  325. #define kwHeaderIsResource    0x00001000L
  326. #define kwRuntimeOnlyDoc    0x00002000L
  327. #define kwAutoNew            0x00004000L
  328. #define kwDefaultDocType    0x00008000L
  329. #define kwColorMonitor        0x00010000L
  330. #define kwSecondaryMonitor    0x00020000L
  331. #define kwStaggerWindow        0x00040000L
  332. #define kwCenterWindow        0x00080000L
  333. #define kwSameMonitor        0x00100000L
  334.     /* These are the various window and document attributes you can set with AppsToGo. */
  335.  
  336. #define kwNoChange            -32767
  337.     /* This constant is used to inform SetContentOrigin, SetSidebarSize, and SetScrollIndent
  338.     ** to leave either the horizontal or vertical component as it was.  This allows you to change
  339.     ** just one component without having to look up the old value for the other component. */
  340.  
  341. #define kwBotScroll            32767
  342.     /* This constant is used to inform SetContentOrigin to scroll as far as possible for either
  343.     ** the horizontal or vertical component. */
  344.  
  345. #define kwShowAll            0x01
  346. #define kwHideAll            0x03
  347. #define kwStandardVis        0x00
  348. #define kwInvertVis            0x02
  349. #define kwInvalOnHide        0x04
  350.     /* These values are used for modifying the display of a control set.  See the AppsToGo
  351.     ** manual for an explanation of control sets. */
  352.  
  353. #define kMinWindowWidth  200
  354. #define kMinWindowHeight 200
  355. #define kMaxWindowWidth  16384
  356. #define kMaxWindowHeight 16384
  357.     /* These are the default min and max sizes for a window.  They are placed in the
  358.     ** windowSizeBounds rect when a new file reference handle is created.  Simply change the
  359.     ** windowSizeBounds rect for documents that need other values. */
  360.  
  361. #define kwVHAppWindow        (kwVisible)
  362.     /* This simply means that the View Hierarchy window is initially visible.
  363.     ** (Not much good if it isn't.) */
  364.  
  365. #define kCustomEventClass  'CUST'
  366. #define keySFType          'KSFT'
  367. #define keyFSS             'KFSS'
  368. #define keyPascal          'PSTR'
  369. #define keyAppConnect      'KCNT'
  370. #define keyWindowTag       'KWND'
  371. #define keyWFMTMessage     'WFMT'
  372. #define keyRSRCMessage     'RSRC'
  373.  
  374. #define typeAppConnect     'KCNT'
  375. #define typeDoubleLong     'DBLL'
  376. #define typePascal         'PSTR'
  377. #define typePascal2        'PST2'
  378. #define typePascal3        'PST3'
  379. #define typeWFMTMessage    'WFMT'
  380. #define typeRSRCMessage    'RSRC'
  381. #define typeRSRCType       'RSTY'
  382. #define typeRSRCID         'RSID'
  383. #define typeBlockNum       'BLKN'
  384.     /* These are the various AppleEvent keys and types currently used by the framework.
  385.     ** You are free to create your own for your application's use. */
  386.  
  387. #define kGetWFMTMssg           0
  388. #define kSetWFMTMssg           1
  389. #define kMergeAppResourcesMssg 2
  390. #define kGetAppResourceMssg    3
  391. #define kSetAppResourceMssg    4
  392.     /* AppleEvent sub-messages used by the AppsToGo application editor. */
  393.  
  394. #define keyReplyErr        'errn'
  395.  
  396. #define kWrongVersion    1
  397.  
  398. #define kInvalRefNum    0
  399. #define kInvalVRefNum    0
  400.  
  401. #define kSaveYes        1
  402. #define kSaveNo            3
  403. #define kSaveCanceled    4
  404.  
  405. #define kOpenYes        1
  406. #define kOpenNo            3
  407.  
  408. #define kStdAbout        1
  409.  
  410. #define kStdNew            1
  411. #define kStdOpen        2
  412. #define kStdClose        3
  413. #define kStdSave        4
  414. #define kStdSaveAs        5
  415. #define kStdPageSetup    6
  416. #define kStdPrint        7
  417. #define kStdQuit        8
  418.  
  419. #define kStdUndo        1
  420. #define kStdRedo        2
  421. #define kStdCut            3
  422. #define kStdCopy        4
  423. #define kStdPaste        5
  424. #define kStdClear        6
  425. #define kStdViewHier    7
  426.  
  427. #define kOpenMovie ((FSSpecPtr)-1)
  428.  
  429. /********/
  430. /********/
  431. /********/
  432.  
  433. #define kViewHierFileType 'VWHR'
  434.  
  435. #define rTECtl            4000
  436. #define rListCtl        4016
  437. #define rCIconCtl        4032
  438. #define rPICTCtl        4048
  439. #define rStatTextCtl    4064
  440. #define rICONCtl        4080
  441. #define rDataCtl        4096
  442.  
  443. #define    rMenuBar    128                /* application's menu bar */
  444.  
  445. #define    rWindow        128                /* application's primary document window */
  446. #define    rVHWindow    129                /* view hierarchy window */
  447.  
  448. #define    rErrorAlert        129
  449. #define rYesNoCancel    130
  450. #define rOpenReadOnly    131
  451. #define rPrStatusDlg    132
  452.  
  453. #define    mApple    128
  454. #define    iAbout    1
  455.  
  456. #define kSave   0
  457. #define kSaveAs 1
  458. #define kClose  2
  459. #define kQuit   3
  460.  
  461. #define rNewViewCtl        128
  462.  
  463. #define rBadNewsStrings        257            /* Not-good-at-all startup error messages. */
  464. #define sWimpyMachine        1            /* Strings to display in the user item */
  465. #define sHeapTooSmall        2
  466. #define sNoFreeRoomInHeap    3
  467. #define sBadThingHappened    4
  468.  
  469. #define rFileIOStrings    258                /* Strings for StandardFile dialogs. */
  470. #define sSFprompt 1
  471. #define sWClosing 2
  472. #define sQuitting 3
  473.  
  474. #define rDefaultTitles    259
  475.  
  476. #define rPPCText    260
  477. #define sTitleText  1
  478. #define sAppText    2
  479.  
  480.  
  481. #endif
  482.