home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / Editions.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  13.2 KB  |  412 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Editions.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Editions;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __EDITIONS__}
  27. {$SETC __EDITIONS__ := 1}
  28.  
  29. {$I+}
  30. {$SETC EditionsIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __MEMORY__}
  35. {$I Memory.p}
  36. {$ENDC}
  37. {    Types.p                                                        }
  38. {        ConditionalMacros.p                                        }
  39. {    MixedMode.p                                                    }
  40.  
  41. {$IFC UNDEFINED __FILES__}
  42. {$I Files.p}
  43. {$ENDC}
  44. {    OSUtils.p                                                    }
  45.  
  46. {$IFC UNDEFINED __ALIASES__}
  47. {$I Aliases.p}
  48. {$ENDC}
  49. {    AppleTalk.p                                                    }
  50.  
  51. {$IFC UNDEFINED __DIALOGS__}
  52. {$I Dialogs.p}
  53. {$ENDC}
  54. {    Errors.p                                                    }
  55. {    Windows.p                                                    }
  56. {        Quickdraw.p                                                }
  57. {            QuickdrawText.p                                        }
  58. {        Events.p                                                }
  59. {        Controls.p                                                }
  60. {            Menus.p                                                }
  61. {    TextEdit.p                                                    }
  62.  
  63. {$PUSH}
  64. {$ALIGN MAC68K}
  65. {$LibExport+}
  66.  
  67. CONST
  68. { resource types  }
  69.     rSectionType                = 'sect';                        { ResType of saved SectionRecords }
  70. { Finder types for edition files }
  71.     kPICTEditionFileType        = 'edtp';
  72.     kTEXTEditionFileType        = 'edtt';
  73.     ksndEditionFileType            = 'edts';
  74.     kUnknownEditionFileType        = 'edtu';
  75.     kPublisherDocAliasFormat    = 'alis';
  76.     kPreviewFormat                = 'prvw';
  77.     kFormatListFormat            = 'fmts';
  78.  
  79. { section types }
  80.     stSubscriber                = $01;
  81.     stPublisher                    = $0A;
  82.     sumAutomatic                = 0;                            { subscriber update mode - Automatically     }
  83.     sumManual                    = 1;                            { subscriber update mode - Manually }
  84.     pumOnSave                    = 0;                            { publisher update mode - OnSave            }
  85.     pumManual                    = 1;                            { publisher update mode - Manually }
  86.     kPartsNotUsed                = 0;
  87.     kPartNumberUnknown            = -1;                            { misc }
  88.     kPreviewWidth                = 120;
  89.     kPreviewHeight                = 120;
  90. { bits for formatsMask }
  91.     kPICTformatMask                = 1;
  92.     kTEXTformatMask                = 2;
  93.     ksndFormatMask                = 4;
  94. { pseudo-item hits for dialogHooks 
  95.  the first if for NewPublisher or NewSubscriber Dialogs }
  96.     emHookRedrawPreview            = 150;
  97. { the following are for SectionOptions Dialog }
  98.     emHookCancelSection            = 160;
  99.     emHookGoToPublisher            = 161;
  100.     emHookGetEditionNow            = 162;
  101.     emHookSendEditionNow        = 162;
  102.     emHookManualUpdateMode        = 163;
  103.     emHookAutoUpdateMode        = 164;
  104.  
  105. { the refcon field of the dialog record during a modalfilter 
  106.  or dialoghook contains one the following }
  107.     emOptionsDialogRefCon        = 'optn';
  108.     emCancelSectionDialogRefCon    = 'cncl';
  109.     emGoToPubErrDialogRefCon    = 'gerr';
  110.     kFormatLengthUnknown        = -1;
  111.  
  112. { one byte, stSubscriber or stPublisher }
  113.     
  114. TYPE
  115.     SectionType = SignedByte;
  116.  
  117. { seconds since 1904 }
  118.     TimeStamp = LONGINT;
  119.  
  120. { similar to ResType }
  121.     FormatType = FourCharCode;
  122.  
  123. { used in Edition I/O }
  124.     EditionRefNum = Handle;
  125.  
  126. { update modes }
  127. { sumAutomatic, pumSuspend, etc }
  128.     UpdateMode = INTEGER;
  129.  
  130.     SectionPtr = ^SectionRecord;
  131.     SectionHandle = ^SectionPtr;
  132.  
  133.     SectionRecord = RECORD
  134.         version:                SignedByte;                                { always 0x01 in system 7.0 }
  135.         kind:                    SectionType;                            { stSubscriber or stPublisher }
  136.         mode:                    UpdateMode;                                { auto or manual }
  137.         mdDate:                    TimeStamp;                                { last change in document }
  138.         sectionID:                LONGINT;                                { app. specific, unique per document }
  139.         refCon:                    LONGINT;                                { application specific }
  140.         alias:                    AliasHandle;                            { handle to Alias Record }
  141.         subPart:                LONGINT;                                { which part of container file }
  142.         nextSection:            SectionHandle;                            { for linked list of app's Sections }
  143.         controlBlock:            Handle;                                    { used internally }
  144.         refNum:                    EditionRefNum;                            { used internally }
  145.     END;
  146.     EditionContainerSpec = RECORD
  147.         theFile:                FSSpec;
  148.         theFileScript:            ScriptCode;
  149.         thePart:                LONGINT;
  150.         thePartName:            Str31;
  151.         thePartScript:            ScriptCode;
  152.     END;
  153.     EditionContainerSpecPtr = ^EditionContainerSpec;
  154.  
  155.     EditionInfoRecord = RECORD
  156.         crDate:                    TimeStamp;                                { date EditionContainer was created }
  157.         mdDate:                    TimeStamp;                                { date of last change }
  158.         fdCreator:                OSType;                                    { file creator }
  159.         fdType:                    OSType;                                    { file type }
  160.         container:                EditionContainerSpec;                    { the Edition }
  161.     END;
  162.     NewPublisherReply = RECORD
  163.         canceled:                BOOLEAN;                                { O }
  164.         replacing:                BOOLEAN;
  165.         usePart:                BOOLEAN;                                { I }
  166.         filler:                    SInt8;
  167.         preview:                Handle;                                    { I }
  168.         previewFormat:            FormatType;                                { I }
  169.         container:                EditionContainerSpec;                    { I/O }
  170.     END;
  171.     NewSubscriberReply = RECORD
  172.         canceled:                BOOLEAN;                                { O }
  173.         formatsMask:            SignedByte;
  174.         container:                EditionContainerSpec;                    {I/O}
  175.     END;
  176.     SectionOptionsReply = RECORD
  177.         canceled:                BOOLEAN;                                { O }
  178.         changed:                BOOLEAN;                                { O }
  179.         sectionH:                SectionHandle;                            { I }
  180.         action:                    ResType;                                { O }
  181.     END;
  182.     ExpModalFilterProcPtr = ProcPtr;  { FUNCTION ExpModalFilter(theDialog: DialogPtr; VAR theEvent: EventRecord; itemOffset: INTEGER; VAR itemHit: INTEGER; yourDataPtr: Ptr): BOOLEAN; }
  183.     ExpDlgHookProcPtr = ProcPtr;  { FUNCTION ExpDlgHook(itemOffset: INTEGER; itemHit: INTEGER; theDialog: DialogPtr; yourDataPtr: Ptr): INTEGER; }
  184.     ExpModalFilterUPP = UniversalProcPtr;
  185.     ExpDlgHookUPP = UniversalProcPtr;
  186.  
  187. CONST
  188.     uppExpModalFilterProcInfo = $0000FBD0; { FUNCTION (4 byte param, 4 byte param, 2 byte param, 4 byte param, 4 byte param): 1 byte result; }
  189.     uppExpDlgHookProcInfo = $00003EA0; { FUNCTION (2 byte param, 2 byte param, 4 byte param, 4 byte param): 2 byte result; }
  190.  
  191. FUNCTION NewExpModalFilterProc(userRoutine: ExpModalFilterProcPtr): ExpModalFilterUPP;
  192.     {$IFC NOT GENERATINGCFM }
  193.     INLINE $2E9F;
  194.     {$ENDC}
  195.  
  196. FUNCTION NewExpDlgHookProc(userRoutine: ExpDlgHookProcPtr): ExpDlgHookUPP;
  197.     {$IFC NOT GENERATINGCFM }
  198.     INLINE $2E9F;
  199.     {$ENDC}
  200.  
  201. FUNCTION CallExpModalFilterProc(theDialog: DialogPtr; VAR theEvent: EventRecord; itemOffset: INTEGER; VAR itemHit: INTEGER; yourDataPtr: Ptr; userRoutine: ExpModalFilterUPP): BOOLEAN;
  202.     {$IFC NOT GENERATINGCFM}
  203.     INLINE $205F, $4E90;
  204.     {$ENDC}
  205.  
  206. FUNCTION CallExpDlgHookProc(itemOffset: INTEGER; itemHit: INTEGER; theDialog: DialogPtr; yourDataPtr: Ptr; userRoutine: ExpDlgHookUPP): INTEGER;
  207.     {$IFC NOT GENERATINGCFM}
  208.     INLINE $205F, $4E90;
  209.     {$ENDC}
  210.  
  211. CONST
  212.     ioHasFormat                    = 0;
  213.     ioReadFormat                = 1;
  214.     ioNewFormat                    = 2;
  215.     ioWriteFormat                = 3;
  216.  
  217.     
  218. TYPE
  219.     FormatIOVerb = SignedByte;
  220.  
  221.  
  222. CONST
  223.     eoOpen                        = 0;
  224.     eoClose                        = 1;
  225.     eoOpenNew                    = 2;
  226.     eoCloseNew                    = 3;
  227.     eoCanSubscribe                = 4;
  228.  
  229.     
  230. TYPE
  231.     EditionOpenerVerb = SignedByte;
  232.  
  233.     FormatIOParamBlock = RECORD
  234.         ioRefNum:                LONGINT;
  235.         format:                    FormatType;
  236.         formatIndex:            LONGINT;
  237.         offset:                    LONGINT;
  238.         buffPtr:                Ptr;
  239.         buffLen:                LONGINT;
  240.     END;
  241.     FormatIOProcPtr = ProcPtr;  { FUNCTION FormatIO(selector: ByteParameter; VAR PB: FormatIOParamBlock): INTEGER; }
  242.     EditionOpenerProcPtr = ProcPtr;  { FUNCTION EditionOpener(selector: ByteParameter; VAR PB: EditionOpenerParamBlock): INTEGER; }
  243.     FormatIOUPP = UniversalProcPtr;
  244.     EditionOpenerUPP = UniversalProcPtr;
  245.  
  246.     EditionOpenerParamBlock = RECORD
  247.         info:                    EditionInfoRecord;
  248.         sectionH:                SectionHandle;
  249.         document:                ^FSSpec;
  250.         fdCreator:                OSType;
  251.         ioRefNum:                LONGINT;
  252.         ioProc:                    FormatIOUPP;
  253.         success:                BOOLEAN;
  254.         formatsMask:            SignedByte;
  255.     END;
  256. CONST
  257.     uppFormatIOProcInfo = $00000360; { FUNCTION (1 byte param, 4 byte param): 2 byte result; }
  258.     uppEditionOpenerProcInfo = $00000360; { FUNCTION (1 byte param, 4 byte param): 2 byte result; }
  259.  
  260. FUNCTION NewFormatIOProc(userRoutine: FormatIOProcPtr): FormatIOUPP;
  261.     {$IFC NOT GENERATINGCFM }
  262.     INLINE $2E9F;
  263.     {$ENDC}
  264.  
  265. FUNCTION NewEditionOpenerProc(userRoutine: EditionOpenerProcPtr): EditionOpenerUPP;
  266.     {$IFC NOT GENERATINGCFM }
  267.     INLINE $2E9F;
  268.     {$ENDC}
  269.  
  270. CONST
  271.     sectionEventMsgClass        = 'sect';
  272.     sectionReadMsgID            = 'read';
  273.     sectionWriteMsgID            = 'writ';
  274.     sectionScrollMsgID            = 'scrl';
  275.     sectionCancelMsgID            = 'cncl';
  276.  
  277.     currentEditionMgrVers        = $0011;
  278.  
  279. { Use InitEditionPackVersion(currentEditionMgrVers) instead of InitEditionPack }
  280.  
  281. FUNCTION InitEditionPackVersion(curEditionMgrVers: INTEGER): OSErr;
  282.     {$IFC NOT GENERATINGCFM}
  283.     INLINE $303C, $0100, $A82D;
  284.     {$ENDC}
  285. FUNCTION NewSection({CONST}VAR container: EditionContainerSpec; sectionDocument: ConstFSSpecPtr; kind: ByteParameter; sectionID: LONGINT; initalMode: UpdateMode; VAR sectionH: SectionHandle): OSErr;
  286.     {$IFC NOT GENERATINGCFM}
  287.     INLINE $303C, $0A02, $A82D;
  288.     {$ENDC}
  289. FUNCTION RegisterSection({CONST}VAR sectionDocument: FSSpec; sectionH: SectionHandle; VAR aliasWasUpdated: BOOLEAN): OSErr;
  290.     {$IFC NOT GENERATINGCFM}
  291.     INLINE $303C, $0604, $A82D;
  292.     {$ENDC}
  293. FUNCTION UnRegisterSection(sectionH: SectionHandle): OSErr;
  294.     {$IFC NOT GENERATINGCFM}
  295.     INLINE $303C, $0206, $A82D;
  296.     {$ENDC}
  297. FUNCTION IsRegisteredSection(sectionH: SectionHandle): OSErr;
  298.     {$IFC NOT GENERATINGCFM}
  299.     INLINE $303C, $0208, $A82D;
  300.     {$ENDC}
  301. FUNCTION AssociateSection(sectionH: SectionHandle; {CONST}VAR newSectionDocument: FSSpec): OSErr;
  302.     {$IFC NOT GENERATINGCFM}
  303.     INLINE $303C, $040C, $A82D;
  304.     {$ENDC}
  305. FUNCTION CreateEditionContainerFile({CONST}VAR editionFile: FSSpec; fdCreator: OSType; editionFileNameScript: ScriptCode): OSErr;
  306.     {$IFC NOT GENERATINGCFM}
  307.     INLINE $303C, $050E, $A82D;
  308.     {$ENDC}
  309. FUNCTION DeleteEditionContainerFile({CONST}VAR editionFile: FSSpec): OSErr;
  310.     {$IFC NOT GENERATINGCFM}
  311.     INLINE $303C, $0210, $A82D;
  312.     {$ENDC}
  313. FUNCTION OpenEdition(subscriberSectionH: SectionHandle; VAR refNum: EditionRefNum): OSErr;
  314.     {$IFC NOT GENERATINGCFM}
  315.     INLINE $303C, $0412, $A82D;
  316.     {$ENDC}
  317. FUNCTION OpenNewEdition(publisherSectionH: SectionHandle; fdCreator: OSType; publisherSectionDocument: ConstFSSpecPtr; VAR refNum: EditionRefNum): OSErr;
  318.     {$IFC NOT GENERATINGCFM}
  319.     INLINE $303C, $0814, $A82D;
  320.     {$ENDC}
  321. FUNCTION CloseEdition(whichEdition: EditionRefNum; successful: BOOLEAN): OSErr;
  322.     {$IFC NOT GENERATINGCFM}
  323.     INLINE $303C, $0316, $A82D;
  324.     {$ENDC}
  325. FUNCTION EditionHasFormat(whichEdition: EditionRefNum; whichFormat: FormatType; VAR formatSize: Size): OSErr;
  326.     {$IFC NOT GENERATINGCFM}
  327.     INLINE $303C, $0618, $A82D;
  328.     {$ENDC}
  329. FUNCTION ReadEdition(whichEdition: EditionRefNum; whichFormat: FormatType; buffPtr: UNIV Ptr; VAR buffLen: Size): OSErr;
  330.     {$IFC NOT GENERATINGCFM}
  331.     INLINE $303C, $081A, $A82D;
  332.     {$ENDC}
  333. FUNCTION WriteEdition(whichEdition: EditionRefNum; whichFormat: FormatType; buffPtr: UNIV Ptr; buffLen: Size): OSErr;
  334.     {$IFC NOT GENERATINGCFM}
  335.     INLINE $303C, $081C, $A82D;
  336.     {$ENDC}
  337. FUNCTION GetEditionFormatMark(whichEdition: EditionRefNum; whichFormat: FormatType; VAR currentMark: LONGINT): OSErr;
  338.     {$IFC NOT GENERATINGCFM}
  339.     INLINE $303C, $061E, $A82D;
  340.     {$ENDC}
  341. FUNCTION SetEditionFormatMark(whichEdition: EditionRefNum; whichFormat: FormatType; setMarkTo: LONGINT): OSErr;
  342.     {$IFC NOT GENERATINGCFM}
  343.     INLINE $303C, $0620, $A82D;
  344.     {$ENDC}
  345. FUNCTION GetEditionInfo(sectionH: SectionHandle; VAR editionInfo: EditionInfoRecord): OSErr;
  346.     {$IFC NOT GENERATINGCFM}
  347.     INLINE $303C, $0422, $A82D;
  348.     {$ENDC}
  349. FUNCTION GoToPublisherSection({CONST}VAR container: EditionContainerSpec): OSErr;
  350.     {$IFC NOT GENERATINGCFM}
  351.     INLINE $303C, $0224, $A82D;
  352.     {$ENDC}
  353. FUNCTION GetLastEditionContainerUsed(VAR container: EditionContainerSpec): OSErr;
  354.     {$IFC NOT GENERATINGCFM}
  355.     INLINE $303C, $0226, $A82D;
  356.     {$ENDC}
  357. FUNCTION GetStandardFormats({CONST}VAR container: EditionContainerSpec; VAR previewFormat: FormatType; preview: Handle; publisherAlias: Handle; formats: Handle): OSErr;
  358.     {$IFC NOT GENERATINGCFM}
  359.     INLINE $303C, $0A28, $A82D;
  360.     {$ENDC}
  361. FUNCTION GetEditionOpenerProc(VAR opener: EditionOpenerUPP): OSErr;
  362.     {$IFC NOT GENERATINGCFM}
  363.     INLINE $303C, $022A, $A82D;
  364.     {$ENDC}
  365. FUNCTION SetEditionOpenerProc(opener: EditionOpenerUPP): OSErr;
  366.     {$IFC NOT GENERATINGCFM}
  367.     INLINE $303C, $022C, $A82D;
  368.     {$ENDC}
  369. FUNCTION CallEditionOpenerProc(selector: ByteParameter; VAR PB: EditionOpenerParamBlock; routine: EditionOpenerUPP): OSErr;
  370.     {$IFC NOT GENERATINGCFM}
  371.     INLINE $303C, $052E, $A82D;
  372.     {$ENDC}
  373. FUNCTION CallFormatIOProc(selector: ByteParameter; VAR PB: FormatIOParamBlock; routine: FormatIOUPP): OSErr;
  374.     {$IFC NOT GENERATINGCFM}
  375.     INLINE $303C, $0530, $A82D;
  376.     {$ENDC}
  377. FUNCTION NewSubscriberDialog(VAR reply: NewSubscriberReply): OSErr;
  378.     {$IFC NOT GENERATINGCFM}
  379.     INLINE $303C, $0232, $A82D;
  380.     {$ENDC}
  381. FUNCTION NewSubscriberExpDialog(VAR reply: NewSubscriberReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookUPP; filter: ExpModalFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  382.     {$IFC NOT GENERATINGCFM}
  383.     INLINE $303C, $0B34, $A82D;
  384.     {$ENDC}
  385. FUNCTION NewPublisherDialog(VAR reply: NewPublisherReply): OSErr;
  386.     {$IFC NOT GENERATINGCFM}
  387.     INLINE $303C, $0236, $A82D;
  388.     {$ENDC}
  389. FUNCTION NewPublisherExpDialog(VAR reply: NewPublisherReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookUPP; filter: ExpModalFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  390.     {$IFC NOT GENERATINGCFM}
  391.     INLINE $303C, $0B38, $A82D;
  392.     {$ENDC}
  393. FUNCTION SectionOptionsDialog(VAR reply: SectionOptionsReply): OSErr;
  394.     {$IFC NOT GENERATINGCFM}
  395.     INLINE $303C, $023A, $A82D;
  396.     {$ENDC}
  397. FUNCTION SectionOptionsExpDialog(VAR reply: SectionOptionsReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookUPP; filter: ExpModalFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  398.     {$IFC NOT GENERATINGCFM}
  399.     INLINE $303C, $0B3C, $A82D;
  400.     {$ENDC}
  401.  
  402. {$ALIGN RESET}
  403. {$POP}
  404.  
  405. {$SETC UsingIncludes := EditionsIncludes}
  406.  
  407. {$ENDC} {__EDITIONS__}
  408.  
  409. {$IFC NOT UsingIncludes}
  410.  END.
  411. {$ENDC}
  412.