From 0e680b7608cf6a2e1be70569b4da2cf5a7204c2d Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Thu, 18 Dec 1997 17:50:29 +0000 Subject: Moved toolbox to lib-toolbox, Sjoerd-style. --- Mac/Lib/lib-toolbox/AEObjects.py | 61 +++++ Mac/Lib/lib-toolbox/AERegistry.py | 438 ++++++++++++++++++++++++++++++ Mac/Lib/lib-toolbox/AppleEvents.py | 104 +++++++ Mac/Lib/lib-toolbox/Components.py | 35 +++ Mac/Lib/lib-toolbox/Controls.py | 89 ++++++ Mac/Lib/lib-toolbox/Dialogs.py | 21 ++ Mac/Lib/lib-toolbox/Events.py | 64 +++++ Mac/Lib/lib-toolbox/Fonts.py | 32 +++ Mac/Lib/lib-toolbox/Lists.py | 24 ++ Mac/Lib/lib-toolbox/Menus.py | 14 + Mac/Lib/lib-toolbox/MiniAEFrame.py | 176 ++++++++++++ Mac/Lib/lib-toolbox/QuickDraw.py | 113 ++++++++ Mac/Lib/lib-toolbox/QuickTime.py | 386 ++++++++++++++++++++++++++ Mac/Lib/lib-toolbox/Resources.py | 23 ++ Mac/Lib/lib-toolbox/Sound.py | 102 +++++++ Mac/Lib/lib-toolbox/TextEdit.py | 56 ++++ Mac/Lib/lib-toolbox/WASTEconst.py | 87 ++++++ Mac/Lib/lib-toolbox/Windows.py | 59 ++++ Mac/Lib/lib-toolbox/aepack.py | 357 ++++++++++++++++++++++++ Mac/Lib/lib-toolbox/aetools.py | 224 +++++++++++++++ Mac/Lib/lib-toolbox/aetypes.py | 541 +++++++++++++++++++++++++++++++++++++ Mac/Lib/toolbox/AEObjects.py | 61 ----- Mac/Lib/toolbox/AERegistry.py | 438 ------------------------------ Mac/Lib/toolbox/AppleEvents.py | 104 ------- Mac/Lib/toolbox/Components.py | 35 --- Mac/Lib/toolbox/Controls.py | 89 ------ Mac/Lib/toolbox/Dialogs.py | 21 -- Mac/Lib/toolbox/Events.py | 64 ----- Mac/Lib/toolbox/Fonts.py | 32 --- Mac/Lib/toolbox/Lists.py | 24 -- Mac/Lib/toolbox/Menus.py | 14 - Mac/Lib/toolbox/MiniAEFrame.py | 176 ------------ Mac/Lib/toolbox/QuickDraw.py | 113 -------- Mac/Lib/toolbox/QuickTime.py | 386 -------------------------- Mac/Lib/toolbox/Resources.py | 23 -- Mac/Lib/toolbox/Sound.py | 102 ------- Mac/Lib/toolbox/TextEdit.py | 56 ---- Mac/Lib/toolbox/WASTEconst.py | 87 ------ Mac/Lib/toolbox/Windows.py | 59 ---- Mac/Lib/toolbox/aepack.py | 357 ------------------------ Mac/Lib/toolbox/aetools.py | 224 --------------- Mac/Lib/toolbox/aetypes.py | 541 ------------------------------------- 42 files changed, 3006 insertions(+), 3006 deletions(-) create mode 100644 Mac/Lib/lib-toolbox/AEObjects.py create mode 100644 Mac/Lib/lib-toolbox/AERegistry.py create mode 100644 Mac/Lib/lib-toolbox/AppleEvents.py create mode 100644 Mac/Lib/lib-toolbox/Components.py create mode 100644 Mac/Lib/lib-toolbox/Controls.py create mode 100644 Mac/Lib/lib-toolbox/Dialogs.py create mode 100644 Mac/Lib/lib-toolbox/Events.py create mode 100644 Mac/Lib/lib-toolbox/Fonts.py create mode 100644 Mac/Lib/lib-toolbox/Lists.py create mode 100644 Mac/Lib/lib-toolbox/Menus.py create mode 100644 Mac/Lib/lib-toolbox/MiniAEFrame.py create mode 100644 Mac/Lib/lib-toolbox/QuickDraw.py create mode 100644 Mac/Lib/lib-toolbox/QuickTime.py create mode 100644 Mac/Lib/lib-toolbox/Resources.py create mode 100644 Mac/Lib/lib-toolbox/Sound.py create mode 100644 Mac/Lib/lib-toolbox/TextEdit.py create mode 100644 Mac/Lib/lib-toolbox/WASTEconst.py create mode 100644 Mac/Lib/lib-toolbox/Windows.py create mode 100644 Mac/Lib/lib-toolbox/aepack.py create mode 100644 Mac/Lib/lib-toolbox/aetools.py create mode 100644 Mac/Lib/lib-toolbox/aetypes.py delete mode 100644 Mac/Lib/toolbox/AEObjects.py delete mode 100644 Mac/Lib/toolbox/AERegistry.py delete mode 100644 Mac/Lib/toolbox/AppleEvents.py delete mode 100644 Mac/Lib/toolbox/Components.py delete mode 100644 Mac/Lib/toolbox/Controls.py delete mode 100644 Mac/Lib/toolbox/Dialogs.py delete mode 100644 Mac/Lib/toolbox/Events.py delete mode 100644 Mac/Lib/toolbox/Fonts.py delete mode 100644 Mac/Lib/toolbox/Lists.py delete mode 100644 Mac/Lib/toolbox/Menus.py delete mode 100644 Mac/Lib/toolbox/MiniAEFrame.py delete mode 100644 Mac/Lib/toolbox/QuickDraw.py delete mode 100644 Mac/Lib/toolbox/QuickTime.py delete mode 100644 Mac/Lib/toolbox/Resources.py delete mode 100644 Mac/Lib/toolbox/Sound.py delete mode 100644 Mac/Lib/toolbox/TextEdit.py delete mode 100644 Mac/Lib/toolbox/WASTEconst.py delete mode 100644 Mac/Lib/toolbox/Windows.py delete mode 100644 Mac/Lib/toolbox/aepack.py delete mode 100644 Mac/Lib/toolbox/aetools.py delete mode 100644 Mac/Lib/toolbox/aetypes.py diff --git a/Mac/Lib/lib-toolbox/AEObjects.py b/Mac/Lib/lib-toolbox/AEObjects.py new file mode 100644 index 0000000..38a8e1b --- /dev/null +++ b/Mac/Lib/lib-toolbox/AEObjects.py @@ -0,0 +1,61 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:AEObjects.h' + +kAEAND = 'AND ' +kAEOR = 'OR ' +kAENOT = 'NOT ' +kAEFirst = 'firs' +kAELast = 'last' +kAEMiddle = 'midd' +kAEAny = 'any ' +kAEAll = 'all ' +kAENext = 'next' +kAEPrevious = 'prev' +keyAECompOperator = 'relo' +keyAELogicalTerms = 'term' +keyAELogicalOperator = 'logc' +keyAEObject1 = 'obj1' +keyAEObject2 = 'obj2' +keyAEDesiredClass = 'want' +keyAEContainer = 'from' +keyAEKeyForm = 'form' +keyAEKeyData = 'seld' +keyAERangeStart = 'star' +keyAERangeStop = 'stop' +keyDisposeTokenProc = 'xtok' +keyAECompareProc = 'cmpr' +keyAECountProc = 'cont' +keyAEMarkTokenProc = 'mkid' +keyAEMarkProc = 'mark' +keyAEAdjustMarksProc = 'adjm' +keyAEGetErrDescProc = 'indc' +formAbsolutePosition = 'indx' +formRelativePosition = 'rele' +formTest = 'test' +formRange = 'rang' +formPropertyID = 'prop' +formName = 'name' +typeObjectSpecifier = 'obj ' +typeObjectBeingExamined = 'exmn' +typeCurrentContainer = 'ccnt' +typeToken = 'toke' +typeRelativeDescriptor = 'rel ' +typeAbsoluteOrdinal = 'abso' +typeIndexDescriptor = 'inde' +typeRangeDescriptor = 'rang' +typeLogicalDescriptor = 'logi' +typeCompDescriptor = 'cmpd' +typeOSLTokenList = 'ostl' +kAEIDoMinimum = 0x0000 +kAEIDoWhose = 0x0001 +kAEIDoMarking = 0x0004 +kAEPassSubDescs = 0x0008 +kAEResolveNestedLists = 0x0010 +kAEHandleSimpleRanges = 0x0020 +kAEUseRelativeIterators = 0x0040 +typeWhoseDescriptor = 'whos' +formWhose = 'whos' +typeWhoseRange = 'wrng' +keyAEWhoseRangeStart = 'wstr' +keyAEWhoseRangeStop = 'wstp' +keyAEIndex = 'kidx' +keyAETest = 'ktst' diff --git a/Mac/Lib/lib-toolbox/AERegistry.py b/Mac/Lib/lib-toolbox/AERegistry.py new file mode 100644 index 0000000..c4c918b --- /dev/null +++ b/Mac/Lib/lib-toolbox/AERegistry.py @@ -0,0 +1,438 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:AERegistry.h' + +cAEList = 'list' +cApplication = 'capp' +cArc = 'carc' +cBoolean = 'bool' +cCell = 'ccel' +cChar = 'cha ' +cColorTable = 'clrt' +cColumn = 'ccol' +cDocument = 'docu' +cDrawingArea = 'cdrw' +cEnumeration = 'enum' +cFile = 'file' +cFixed = 'fixd' +cFixedPoint = 'fpnt' +cFixedRectangle = 'frct' +cGraphicLine = 'glin' +cGraphicObject = 'cgob' +cGraphicShape = 'cgsh' +cGraphicText = 'cgtx' +cGroupedGraphic = 'cpic' +cInsertionLoc = 'insl' +cInsertionPoint = 'cins' +cIntlText = 'itxt' +cIntlWritingCode = 'intl' +cItem = 'citm' +cLine = 'clin' +cLongDateTime = 'ldt ' +cLongFixed = 'lfxd' +cLongFixedPoint = 'lfpt' +cLongFixedRectangle = 'lfrc' +cLongInteger = 'long' +cLongPoint = 'lpnt' +cLongRectangle = 'lrct' +cMachineLoc = 'mLoc' +cMenu = 'cmnu' +cMenuItem = 'cmen' +cObject = 'cobj' +cObjectSpecifier = 'obj ' +cOpenableObject = 'coob' +cOval = 'covl' +cParagraph = 'cpar' +cPICT = 'PICT' +cPixel = 'cpxl' +cPixelMap = 'cpix' +cPolygon = 'cpgn' +cProperty = 'prop' +cQDPoint = 'QDpt' +cQDRectangle = 'qdrt' +cRectangle = 'crec' +cRGBColor = 'cRGB' +cRotation = 'trot' +cRoundedRectangle = 'crrc' +cRow = 'crow' +cSelection = 'csel' +cShortInteger = 'shor' +cTable = 'ctbl' +cText = 'ctxt' +cTextFlow = 'cflo' +cTextStyles = 'tsty' +cType = 'type' +cVersion = 'vers' +cWindow = 'cwin' +cWord = 'cwor' +enumArrows = 'arro' +enumJustification = 'just' +enumKeyForm = 'kfrm' +enumPosition = 'posi' +enumProtection = 'prtn' +enumQuality = 'qual' +enumSaveOptions = 'savo' +enumStyle = 'styl' +enumTransferMode = 'tran' +formUniqueID = 'ID ' +kAEAbout = 'abou' +kAEAfter = 'afte' +kAEAliasSelection = 'sali' +kAEAllCaps = 'alcp' +kAEArrowAtEnd = 'aren' +kAEArrowAtStart = 'arst' +kAEArrowBothEnds = 'arbo' +kAEAsk = 'ask ' +kAEBefore = 'befo' +kAEBeginning = 'bgng' +kAEBeginsWith = 'bgwt' +kAEBeginTransaction = 'begi' +kAEBold = 'bold' +kAECaseSensEquals = 'cseq' +kAECentered = 'cent' +kAEChangeView = 'view' +kAEClone = 'clon' +kAEClose = 'clos' +kAECondensed = 'cond' +kAEContains = 'cont' +kAECopy = 'copy' +kAECoreSuite = 'core' +kAECountElements = 'cnte' +kAECreateElement = 'crel' +kAECreatePublisher = 'cpub' +kAECut = 'cut ' +kAEDelete = 'delo' +kAEDoObjectsExist = 'doex' +kAEDoScript = 'dosc' +kAEDrag = 'drag' +kAEDuplicateSelection = 'sdup' +kAEEditGraphic = 'edit' +kAEEmptyTrash = 'empt' +kAEEnd = 'end ' +kAEEndsWith = 'ends' +kAEEndTransaction = 'endt' +kAEEquals = '= ' +kAEExpanded = 'pexp' +kAEFast = 'fast' +kAEFinderEvents = 'FNDR' +kAEFormulaProtect = 'fpro' +kAEFullyJustified = 'full' +kAEGetClassInfo = 'qobj' +kAEGetData = 'getd' +kAEGetDataSize = 'dsiz' +kAEGetEventInfo = 'gtei' +kAEGetInfoSelection = 'sinf' +kAEGetPrivilegeSelection = 'sprv' +kAEGetSuiteInfo = 'gtsi' +kAEGreaterThan = '> ' +kAEGreaterThanEquals = '>= ' +kAEGrow = 'grow' +kAEHidden = 'hidn' +kAEHiQuality = 'hiqu' +kAEImageGraphic = 'imgr' +kAEIsUniform = 'isun' +kAEItalic = 'ital' +kAELeftJustified = 'left' +kAELessThan = '< ' +kAELessThanEquals = '<= ' +kAELowercase = 'lowc' +kAEMakeObjectsVisible = 'mvis' +kAEMiscStandards = 'misc' +kAEModifiable = 'modf' +kAEMove = 'move' +kAENo = 'no ' +kAENoArrow = 'arno' +kAENonmodifiable = 'nmod' +kAEOpen = 'odoc' +kAEOpenSelection = 'sope' +kAEOutline = 'outl' +kAEPageSetup = 'pgsu' +kAEPaste = 'past' +kAEPlain = 'plan' +kAEPrint = 'pdoc' +kAEPrintSelection = 'spri' +kAEPrintWindow = 'pwin' +kAEPutAwaySelection = 'sput' +kAEQDAddOver = 'addo' +kAEQDAddPin = 'addp' +kAEQDAdMax = 'admx' +kAEQDAdMin = 'admn' +kAEQDBic = 'bic ' +kAEQDBlend = 'blnd' +kAEQDCopy = 'cpy ' +kAEQDNotBic = 'nbic' +kAEQDNotCopy = 'ncpy' +kAEQDNotOr = 'ntor' +kAEQDNotXor = 'nxor' +kAEQDOr = 'or ' +kAEQDSubOver = 'subo' +kAEQDSubPin = 'subp' +kAEQDSupplementalSuite = 'qdsp' +kAEQDXor = 'xor ' +kAEQuickdrawSuite = 'qdrw' +kAEQuitAll = 'quia' +kAERedo = 'redo' +kAERegular = 'regl' +kAEReplace = 'rplc' +kAERequiredSuite = 'reqd' +kAERestart = 'rest' +kAERevealSelection = 'srev' +kAERevert = 'rvrt' +kAERightJustified = 'rght' +kAESave = 'save' +kAESelect = 'slct' +kAESetData = 'setd' +kAESetPosition = 'posn' +kAEShadow = 'shad' +kAEShowClipboard = 'shcl' +kAEShutDown = 'shut' +kAESleep = 'slep' +kAESmallCaps = 'smcp' +kAESpecialClassProperties = 'c@#!' +kAEStrikethrough = 'strk' +kAESubscript = 'sbsc' +kAESuperscript = 'spsc' +kAETableSuite = 'tbls' +kAETextSuite = 'TEXT' +kAETransactionTerminated = 'ttrm' +kAEUnderline = 'undl' +kAEUndo = 'undo' +kAEWholeWordEquals = 'wweq' +kAEYes = 'yes ' +kAEZoom = 'zoom' +keyAEAngle = 'kang' +keyAEArcAngle = 'parc' +keyAEBaseAddr = 'badd' +keyAEBestType = 'pbst' +keyAEBgndColor = 'kbcl' +keyAEBgndPattern = 'kbpt' +keyAEBounds = 'pbnd' +keyAECellList = 'kclt' +keyAEClassID = 'clID' +keyAEColor = 'colr' +keyAEColorTable = 'cltb' +keyAECurveHeight = 'kchd' +keyAECurveWidth = 'kcwd' +keyAEDashStyle = 'pdst' +keyAEData = 'data' +keyAEDefaultType = 'deft' +keyAEDefinitionRect = 'pdrt' +keyAEDescType = 'dstp' +keyAEDestination = 'dest' +keyAEDoAntiAlias = 'anta' +keyAEDoDithered = 'gdit' +keyAEDoRotate = 'kdrt' +keyAEDoScale = 'ksca' +keyAEDoTranslate = 'ktra' +keyAEEditionFileLoc = 'eloc' +keyAEElements = 'elms' +keyAEEndPoint = 'pend' +keyAEEventClass = 'evcl' +keyAEEventID = 'evti' +keyAEFile = 'kfil' +keyAEFileType = 'fltp' +keyAEFillColor = 'flcl' +keyAEFillPattern = 'flpt' +keyAEFlipHorizontal = 'kfho' +keyAEFlipVertical = 'kfvt' +keyAEFont = 'font' +keyAEFormula = 'pfor' +keyAEGraphicObjects = 'gobs' +keyAEID = 'ID ' +keyAEImageQuality = 'gqua' +keyAEInsertHere = 'insh' +keyAEKeyForms = 'keyf' +keyAEKeyword = 'kywd' +keyAELevel = 'levl' +keyAELineArrow = 'arro' +keyAEName = 'pnam' +keyAENewElementLoc = 'pnel' +keyAEObject = 'kobj' +keyAEObjectClass = 'kocl' +keyAEOffStyles = 'ofst' +keyAEOnStyles = 'onst' +keyAEParameters = 'prms' +keyAEParamFlags = 'pmfg' +keyAEPenColor = 'ppcl' +keyAEPenPattern = 'pppa' +keyAEPenWidth = 'ppwd' +keyAEPixelDepth = 'pdpt' +keyAEPixMapMinus = 'kpmm' +keyAEPMTable = 'kpmt' +keyAEPointList = 'ptlt' +keyAEPointSize = 'ptsz' +keyAEPosition = 'kpos' +keyAEPropData = 'prdt' +keyAEProperties = 'qpro' +keyAEProperty = 'kprp' +keyAEPropFlags = 'prfg' +keyAEPropID = 'prop' +keyAEProtection = 'ppro' +keyAERenderAs = 'kren' +keyAERequestedType = 'rtyp' +keyAEResult = '----' +keyAEResultInfo = 'rsin' +keyAERotation = 'prot' +keyAERotPoint = 'krtp' +keyAERowList = 'krls' +keyAESaveOptions = 'savo' +keyAEScale = 'pscl' +keyAEScriptTag = 'psct' +keyAEShowWhere = 'show' +keyAEStartAngle = 'pang' +keyAEStartPoint = 'pstp' +keyAEStyles = 'ksty' +keyAESuiteID = 'suit' +keyAEText = 'ktxt' +keyAETextColor = 'ptxc' +keyAETextFont = 'ptxf' +keyAETextPointSize = 'ptps' +keyAETextStyles = 'txst' +keyAETheText = 'thtx' +keyAETransferMode = 'pptm' +keyAETranslation = 'ptrs' +keyAETryAsStructGraf = 'toog' +keyAEUniformStyles = 'ustl' +keyAEUpdateOn = 'pupd' +keyAEUserTerm = 'utrm' +keyAEWindow = 'wndw' +keyAEWritingCode = 'wrcd' +keyAETSMScriptTag = 'sclg' +keyAETSMTextFont = 'ktxf' +keyAETSMTextPointSize = 'ktps' +keyMiscellaneous = 'fmsc' +keySelection = 'fsel' +keyWindow = 'kwnd' +pArcAngle = 'parc' +pBackgroundColor = 'pbcl' +pBackgroundPattern = 'pbpt' +pBestType = 'pbst' +pBounds = 'pbnd' +pClass = 'pcls' +pClipboard = 'pcli' +pColor = 'colr' +pColorTable = 'cltb' +pContents = 'pcnt' +pCornerCurveHeight = 'pchd' +pCornerCurveWidth = 'pcwd' +pDashStyle = 'pdst' +pDefaultType = 'deft' +pDefinitionRect = 'pdrt' +pEnabled = 'enbl' +pEndPoint = 'pend' +pFillColor = 'flcl' +pFillPattern = 'flpt' +pFont = 'font' +pFormula = 'pfor' +pGraphicObjects = 'gobs' +pHasCloseBox = 'hclb' +pHasTitleBar = 'ptit' +pID = 'ID ' +pIndex = 'pidx' +pInsertionLoc = 'pins' +pIsFloating = 'isfl' +pIsFrontProcess = 'pisf' +pIsModal = 'pmod' +pIsModified = 'imod' +pIsResizable = 'prsz' +pIsStationeryPad = 'pspd' +pIsZoomable = 'iszm' +pIsZoomed = 'pzum' +pItemNumber = 'itmn' +pJustification = 'pjst' +pLineArrow = 'arro' +pMenuID = 'mnid' +pName = 'pnam' +pNewElementLoc = 'pnel' +pPenColor = 'ppcl' +pPenPattern = 'pppa' +pPenWidth = 'ppwd' +pPixelDepth = 'pdpt' +pPointList = 'ptlt' +pPointSize = 'ptsz' +pProtection = 'ppro' +pRotation = 'prot' +pScale = 'pscl' +pScript = 'scpt' +pScriptTag = 'psct' +pSelected = 'selc' +pSelection = 'sele' +pStartAngle = 'pang' +pStartPoint = 'pstp' +pTextColor = 'ptxc' +pTextFont = 'ptxf' +pTextItemDelimiters = 'txdl' +pTextPointSize = 'ptps' +pTextStyles = 'txst' +pTransferMode = 'pptm' +pTranslation = 'ptrs' +pUniformStyles = 'ustl' +pUpdateOn = 'pupd' +pUserSelection = 'pusl' +pVersion = 'vers' +pVisible = 'pvis' +typeAEText = 'tTXT' +typeArc = 'carc' +typeBest = 'best' +typeCell = 'ccel' +typeClassInfo = 'gcli' +typeColorTable = 'clrt' +typeColumn = 'ccol' +typeDashStyle = 'tdas' +typeData = 'tdta' +typeDrawingArea = 'cdrw' +typeElemInfo = 'elin' +typeEnumeration = 'enum' +typeEPS = 'EPS ' +typeEventInfo = 'evin' +typeFinderWindow = 'fwin' +typeFixedPoint = 'fpnt' +typeFixedRectangle = 'frct' +typeGraphicLine = 'glin' +typeGraphicText = 'cgtx' +typeGroupedGraphic = 'cpic' +typeInsertionLoc = 'insl' +typeIntlText = 'itxt' +typeIntlWritingCode = 'intl' +typeLongDateTime = 'ldt ' +typeLongFixed = 'lfxd' +typeLongFixedPoint = 'lfpt' +typeLongFixedRectangle = 'lfrc' +typeLongPoint = 'lpnt' +typeLongRectangle = 'lrct' +typeMachineLoc = 'mLoc' +typeOval = 'covl' +typeParamInfo = 'pmin' +typePict = 'PICT' +typePixelMap = 'cpix' +typePixMapMinus = 'tpmm' +typePolygon = 'cpgn' +typePropInfo = 'pinf' +typeQDPoint = 'QDpt' +typeRectangle = 'crec' +typeRGB16 = 'tr16' +typeRGB96 = 'tr96' +typeRGBColor = 'cRGB' +typeRotation = 'trot' +typeRoundedRectangle = 'crrc' +typeRow = 'crow' +typeScrapStyles = 'styl' +typeScript = 'scpt' +typeStyledText = 'STXT' +typeSuiteInfo = 'suin' +typeTable = 'ctbl' +typeTextStyles = 'tsty' +typeTIFF = 'TIFF' +typeVersion = 'vers' +kBySmallIcon = 0 +kByIconView = 1 +kByNameView = 2 +kByDateView = 3 +kBySizeView = 4 +kByKindView = 5 +kByCommentView = 6 +kByLabelView = 7 +kByVersionView = 8 +kAEInfo = 11 +kAEMain = 0 +kAESharing = 13 +kAEZoomIn = 7 +kAEZoomOut = 8 diff --git a/Mac/Lib/lib-toolbox/AppleEvents.py b/Mac/Lib/lib-toolbox/AppleEvents.py new file mode 100644 index 0000000..c491b80 --- /dev/null +++ b/Mac/Lib/lib-toolbox/AppleEvents.py @@ -0,0 +1,104 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:AppleEvents.h' + +typeBoolean = 'bool' +typeChar = 'TEXT' +typeSMInt = 'shor' +typeInteger = 'long' +typeSMFloat = 'sing' +typeFloat = 'doub' +typeLongInteger = 'long' +typeShortInteger = 'shor' +typeLongFloat = 'doub' +typeShortFloat = 'sing' +typeExtended = 'exte' +typeComp = 'comp' +typeMagnitude = 'magn' +typeAEList = 'list' +typeAERecord = 'reco' +typeAppleEvent = 'aevt' +typeTrue = 'true' +typeFalse = 'fals' +typeAlias = 'alis' +typeEnumerated = 'enum' +typeType = 'type' +typeAppParameters = 'appa' +typeProperty = 'prop' +typeFSS = 'fss ' +typeKeyword = 'keyw' +typeSectionH = 'sect' +typeWildCard = '****' +typeApplSignature = 'sign' +typeQDRectangle = 'qdrt' +typeFixed = 'fixd' +typeSessionID = 'ssid' +typeTargetID = 'targ' +typeProcessSerialNumber = 'psn ' +typeNull = 'null' +keyDirectObject = '----' +keyErrorNumber = 'errn' +keyErrorString = 'errs' +keyProcessSerialNumber = 'psn ' +keyTransactionIDAttr = 'tran' +keyReturnIDAttr = 'rtid' +keyEventClassAttr = 'evcl' +keyEventIDAttr = 'evid' +keyAddressAttr = 'addr' +keyOptionalKeywordAttr = 'optk' +keyTimeoutAttr = 'timo' +keyInteractLevelAttr = 'inte' +keyEventSourceAttr = 'esrc' +keyMissedKeywordAttr = 'miss' +keyOriginalAddressAttr = 'from' +keyPreDispatch = 'phac' +keySelectProc = 'selh' +keyAERecorderCount = 'recr' +keyAEVersion = 'vers' +kCoreEventClass = 'aevt' +kAEOpenApplication = 'oapp' +kAEOpenDocuments = 'odoc' +kAEPrintDocuments = 'pdoc' +kAEQuitApplication = 'quit' +kAEAnswer = 'ansr' +kAEApplicationDied = 'obit' +kAENoReply = 0x00000001 +kAEQueueReply = 0x00000002 +kAEWaitReply = 0x00000003 +kAENeverInteract = 0x00000010 +kAECanInteract = 0x00000020 +kAEAlwaysInteract = 0x00000030 +kAECanSwitchLayer = 0x00000040 +kAEDontReconnect = 0x00000080 +kAEDontRecord = 0x00001000 +kAEDontExecute = 0x00002000 +kAENormalPriority = 0x00000000 +kAEStartRecording = 'reca' +kAEStopRecording = 'recc' +kAENotifyStartRecording = 'rec1' +kAENotifyStopRecording = 'rec0' +kAENotifyRecording = 'recr' +kAutoGenerateReturnID = -1 +kAnyTransactionID = 0 +kAEDefaultTimeout = -1 +kNoTimeOut = -2 +kAENoDispatch = 0 +kAEUseStandardDispatch = 0xFFFFFFFF +kAEDoNotIgnoreHandler = 0x00000000 +kAEIgnoreAppPhacHandler = 0x00000001 +kAEIgnoreAppEventHandler = 0x00000002 +kAEIgnoreSysPhacHandler = 0x00000004 +kAEIgnoreSysEventHandler = 0x00000008 +kAEIngoreBuiltInEventHandler = 0x00000010 +kAEDontDisposeOnResume = 0x80000000 +kAEInteractWithSelf = 0 +kAEInteractWithLocal = 1 +kAEInteractWithAll = 2 +kAEUnknownSource = 0 +kAEDirectCall = 1 +kAESameProcess = 2 +kAELocalProcess = 3 +kAERemoteProcess = 4 +kAEDataArray = 0 +kAEPackedArray = 1 +kAEHandleArray = 2 +kAEDescArray = 3 +kAEKeyDescArray = 4 diff --git a/Mac/Lib/lib-toolbox/Components.py b/Mac/Lib/lib-toolbox/Components.py new file mode 100644 index 0000000..338feeb --- /dev/null +++ b/Mac/Lib/lib-toolbox/Components.py @@ -0,0 +1,35 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Components.h' + +kAppleManufacturer = 'appl' +kComponentResourceType = 'thng' +kAnyComponentType = 0 +kAnyComponentSubType = 0 +kAnyComponentManufacturer = 0 +kAnyComponentFlagsMask = 0 +cmpWantsRegisterMessage = 1L << 31 +kComponentOpenSelect = -1 +kComponentCloseSelect = -2 +kComponentCanDoSelect = -3 +kComponentVersionSelect = -4 +kComponentRegisterSelect = -5 +kComponentTargetSelect = -6 +kComponentUnregisterSelect = -7 +kComponentGetMPWorkFunctionSelect = -8 +defaultComponentIdentical = 0 +defaultComponentAnyFlags = 1 +defaultComponentAnyManufacturer = 2 +defaultComponentAnySubType = 4 +registerComponentGlobal = 1 +registerComponentNoDuplicates = 2 +registerComponentAfterExisting = 4 +uppComponentFunctionImplementedProcInfo = 0x000002F0 +uppGetComponentVersionProcInfo = 0x000000F0 +uppComponentSetTargetProcInfo = 0x000003F0 +uppCallComponentOpenProcInfo = 0x000003F0 +uppCallComponentCloseProcInfo = 0x000003F0 +uppCallComponentCanDoProcInfo = 0x000002F0 +uppCallComponentVersionProcInfo = 0x000000F0 +uppCallComponentRegisterProcInfo = 0x000000F0 +uppCallComponentTargetProcInfo = 0x000003F0 +uppCallComponentUnregisterProcInfo = 0x000000F0 +uppCallComponentGetMPWorkFunctionProcInfo = 0x00000FF0 diff --git a/Mac/Lib/lib-toolbox/Controls.py b/Mac/Lib/lib-toolbox/Controls.py new file mode 100644 index 0000000..aa150f5 --- /dev/null +++ b/Mac/Lib/lib-toolbox/Controls.py @@ -0,0 +1,89 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Controls.h' + +pushButProc = 0 +checkBoxProc = 1 +radioButProc = 2 +scrollBarProc = 16 +popupMenuProc = 1008 +kControlUsesOwningWindowsFontVariant = 1 << 3 +kControlNoPart = 0 +kControlLabelPart = 1 +kControlMenuPart = 2 +kControlTrianglePart = 4 +kControlButtonPart = 10 +kControlCheckBoxPart = 11 +kControlRadioButtonPart = 11 +kControlUpButtonPart = 20 +kControlDownButtonPart = 21 +kControlPageUpPart = 22 +kControlPageDownPart = 23 +kControlIndicatorPart = 129 +kControlDisabledPart = 254 +kControlInactivePart = 255 +kControlCheckboxUncheckedValue = 0 +kControlCheckboxCheckedValue = 1 +kControlCheckboxMixedValue = 2 +kControlRadioButtonUncheckedValue = 0 +kControlRadioButtonCheckedValue = 1 +kControlRadioButtonMixedValue = 2 +popupFixedWidth = 1 << 0 +popupVariableWidth = 1 << 1 +popupUseAddResMenu = 1 << 2 +popupUseWFont = 1 << 3 +popupTitleBold = 1 << 8 +popupTitleItalic = 1 << 9 +popupTitleUnderline = 1 << 10 +popupTitleOutline = 1 << 11 +popupTitleShadow = 1 << 12 +popupTitleCondense = 1 << 13 +popupTitleExtend = 1 << 14 +popupTitleNoStyle = 1 << 15 +popupTitleLeftJust = 0x00000000 +popupTitleCenterJust = 0x00000001 +popupTitleRightJust = 0x000000FF +hAxisOnly = 1 +vAxisOnly = 2 +cFrameColor = 0 +cBodyColor = 1 +cTextColor = 2 +cThumbColor = 3 +drawCntl = 0 +testCntl = 1 +calcCRgns = 2 +initCntl = 3 +dispCntl = 4 +posCntl = 5 +thumbCntl = 6 +dragCntl = 7 +autoTrack = 8 +calcCntlRgn = 10 +calcThumbRgn = 11 +drawThumbOutline = 12 +kDrawControlEntireControl = 0 +kDrawControlIndicatorOnly = 129 +kDragControlEntireControl = 0 +kDragControlIndicator = 1 +useWFont = 8 +inLabel = 1 +inMenu = 2 +inTriangle = 4 +inButton = 10 +inCheckBox = 11 +inUpButton = 20 +inDownButton = 21 +inPageUp = 22 +inPageDown = 23 +inThumb = 129 +kNoHiliteControlPart = 0 +kInLabelControlPart = 1 +kInMenuControlPart = 2 +kInTriangleControlPart = 4 +kInButtonControlPart = 10 +kInCheckBoxControlPart = 11 +kInUpButtonControlPart = 20 +kInDownButtonControlPart = 21 +kInPageUpControlPart = 22 +kInPageDownControlPart = 23 +kInIndicatorControlPart = 129 +kReservedControlPart = 254 +kControlInactiveControlPart = 255 diff --git a/Mac/Lib/lib-toolbox/Dialogs.py b/Mac/Lib/lib-toolbox/Dialogs.py new file mode 100644 index 0000000..893feda --- /dev/null +++ b/Mac/Lib/lib-toolbox/Dialogs.py @@ -0,0 +1,21 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Dialogs.h' + +ctrlItem = 4 +btnCtrl = 0 +chkCtrl = 1 +radCtrl = 2 +resCtrl = 3 +statText = 8 +editText = 16 +iconItem = 32 +picItem = 64 +userItem = 0 +itemDisable = 128 +ok = 1 +cancel = 2 +stopIcon = 0 +noteIcon = 1 +cautionIcon = 2 +overlayDITL = 0 +appendDITLRight = 1 +appendDITLBottom = 2 diff --git a/Mac/Lib/lib-toolbox/Events.py b/Mac/Lib/lib-toolbox/Events.py new file mode 100644 index 0000000..7f66525 --- /dev/null +++ b/Mac/Lib/lib-toolbox/Events.py @@ -0,0 +1,64 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Events.h' + +nullEvent = 0 +mouseDown = 1 +mouseUp = 2 +keyDown = 3 +keyUp = 4 +autoKey = 5 +updateEvt = 6 +diskEvt = 7 +activateEvt = 8 +osEvt = 15 +kHighLevelEvent = 23 +mDownMask = 0x0002 +mUpMask = 0x0004 +keyDownMask = 0x0008 +keyUpMask = 0x0010 +autoKeyMask = 0x0020 +updateMask = 0x0040 +diskMask = 0x0080 +activMask = 0x0100 +highLevelEventMask = 0x0400 +osMask = 0x8000 +everyEvent = 0xFFFF +charCodeMask = 0x000000FF +keyCodeMask = 0x0000FF00 +adbAddrMask = 0x00FF0000 +osEvtMessageMask = 0xFF000000L +mouseMovedMessage = 0x00FA +suspendResumeMessage = 0x0001 +resumeFlag = 1 +convertClipboardFlag = 2 +activeFlag = 0x0001 +btnState = 0x0080 +cmdKey = 0x0100 +shiftKey = 0x0200 +alphaLock = 0x0400 +optionKey = 0x0800 +controlKey = 0x1000 +rightShiftKey = 0x2000 +rightOptionKey = 0x4000 +rightControlKey = 0x8000 +activeFlagBit = 0 +btnStateBit = 7 +cmdKeyBit = 8 +shiftKeyBit = 9 +alphaLockBit = 10 +optionKeyBit = 11 +controlKeyBit = 12 +rightShiftKeyBit = 13 +rightOptionKeyBit = 14 +rightControlKeyBit = 15 +networkEvt = 10 +driverEvt = 11 +app1Evt = 12 +app2Evt = 13 +app3Evt = 14 +app4Evt = 15 +networkMask = 0x0400 +driverMask = 0x0800 +app1Mask = 0x1000 +app2Mask = 0x2000 +app3Mask = 0x4000 +app4Mask = 0x8000 diff --git a/Mac/Lib/lib-toolbox/Fonts.py b/Mac/Lib/lib-toolbox/Fonts.py new file mode 100644 index 0000000..9823046 --- /dev/null +++ b/Mac/Lib/lib-toolbox/Fonts.py @@ -0,0 +1,32 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Fonts.h' + +systemFont = 0 +applFont = 1 +newYork = 2 +geneva = 3 +monaco = 4 +venice = 5 +london = 6 +athens = 7 +sanFran = 8 +toronto = 9 +cairo = 11 +losAngeles = 12 +times = 20 +helvetica = 21 +courier = 22 +symbol = 23 +mobile = 24 +commandMark = 17 +checkMark = 18 +diamondMark = 19 +appleMark = 20 +propFont = 36864 +prpFntH = 36865 +prpFntW = 36866 +prpFntHW = 36867 +fixedFont = 45056 +fxdFntH = 45057 +fxdFntW = 45058 +fxdFntHW = 45059 +fontWid = 44208 diff --git a/Mac/Lib/lib-toolbox/Lists.py b/Mac/Lib/lib-toolbox/Lists.py new file mode 100644 index 0000000..4469b5b --- /dev/null +++ b/Mac/Lib/lib-toolbox/Lists.py @@ -0,0 +1,24 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Lists.h' + +lDoVAutoscroll = 2 +lDoHAutoscroll = 1 +lOnlyOne = -128 +lExtendDrag = 64 +lNoDisjoint = 32 +lNoExtend = 16 +lNoRect = 8 +lUseSense = 4 +lNoNilHilite = 2 +lDoVAutoscrollBit = 1 +lDoHAutoscrollBit = 0 +lOnlyOneBit = 7 +lExtendDragBit = 6 +lNoDisjointBit = 5 +lNoExtendBit = 4 +lNoRectBit = 3 +lUseSenseBit = 2 +lNoNilHiliteBit = 1 +lInitMsg = 0 +lDrawMsg = 1 +lHiliteMsg = 2 +lCloseMsg = 3 diff --git a/Mac/Lib/lib-toolbox/Menus.py b/Mac/Lib/lib-toolbox/Menus.py new file mode 100644 index 0000000..e33f81b --- /dev/null +++ b/Mac/Lib/lib-toolbox/Menus.py @@ -0,0 +1,14 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Menus.h' + +noMark = 0 +mDrawMsg = 0 +mChooseMsg = 1 +mSizeMsg = 2 +mDrawItemMsg = 4 +mCalcItemMsg = 5 +textMenuProc = 0 +hMenuCmd = 27 +hierMenu = -1 +mPopUpMsg = 3 +mctAllItems = -98 +mctLastIDIndic = -99 diff --git a/Mac/Lib/lib-toolbox/MiniAEFrame.py b/Mac/Lib/lib-toolbox/MiniAEFrame.py new file mode 100644 index 0000000..549b3ee --- /dev/null +++ b/Mac/Lib/lib-toolbox/MiniAEFrame.py @@ -0,0 +1,176 @@ +"""MiniAEFrame - A first stab at an AE Application framework. +This framework is still work-in-progress, so do not rely on it remaining +unchanged. +""" + +import sys +import traceback +import MacOS +import AE +from AppleEvents import * +import Evt +from Events import * +import Menu +import Win +from Windows import * +import Qd + +import aetools +import EasyDialogs + +kHighLevelEvent = 23 # Not defined anywhere for Python yet? + +class MiniApplication: + """A minimal FrameWork.Application-like class""" + + def __init__(self): + self.quitting = 0 + # Initialize menu + self.appleid = 1 + self.quitid = 2 + Menu.ClearMenuBar() + self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") + applemenu.AppendMenu("All about cgitest...;(-") + applemenu.AppendResMenu('DRVR') + applemenu.InsertMenu(0) + self.quitmenu = Menu.NewMenu(self.quitid, "File") + self.quitmenu.AppendMenu("Quit") + self.quitmenu.InsertMenu(0) + Menu.DrawMenuBar() + + def __del__(self): + self.close() + + def close(self): + pass + + def mainloop(self, mask = everyEvent, timeout = 60*60): + while not self.quitting: + self.dooneevent(mask, timeout) + + def _quit(self): + self.quitting = 1 + + def dooneevent(self, mask = everyEvent, timeout = 60*60): + got, event = Evt.WaitNextEvent(mask, timeout) + if got: + self.lowlevelhandler(event) + + def lowlevelhandler(self, event): + what, message, when, where, modifiers = event + h, v = where + if what == kHighLevelEvent: + msg = "High Level Event: %s %s" % \ + (`code(message)`, `code(h | (v<<16))`) + try: + AE.AEProcessAppleEvent(event) + except AE.Error, err: + print 'AE error: ', err + print 'in', msg + traceback.print_exc() + return + elif what == keyDown: + c = chr(message & charCodeMask) + if c == '.' and modifiers & cmdKey: + raise KeyboardInterrupt, "Command-period" + elif what == mouseDown: + partcode, window = Win.FindWindow(where) + if partcode == inMenuBar: + result = Menu.MenuSelect(where) + id = (result>>16) & 0xffff # Hi word + item = result & 0xffff # Lo word + if id == self.appleid: + if item == 1: + EasyDialogs.Message("cgitest - First cgi test") + return + elif item > 1: + name = self.applemenu.GetItem(item) + Qd.OpenDeskAcc(name) + return + if id == self.quitid and item == 1: + print "Menu-requested QUIT" + self.quitting = 1 + # Anything not handled is passed to Python/SIOUX + MacOS.HandleEvent(event) + +class AEServer: + + def __init__(self): + self.ae_handlers = {} + + def installaehandler(self, classe, type, callback): + AE.AEInstallEventHandler(classe, type, self.callback_wrapper) + self.ae_handlers[(classe, type)] = callback + + def close(self): + for classe, type in self.ae_handlers.keys(): + AE.AERemoveEventHandler(classe, type) + + def callback_wrapper(self, _request, _reply): + _parameters, _attributes = aetools.unpackevent(_request) + _class = _attributes['evcl'].type + _type = _attributes['evid'].type + + if self.ae_handlers.has_key((_class, _type)): + _function = self.ae_handlers[(_class, _type)] + elif self.ae_handlers.has_key((_class, '****')): + _function = self.ae_handlers[(_class, '****')] + elif self.ae_handlers.has_key(('****', '****')): + _function = self.ae_handlers[('****', '****')] + else: + raise 'Cannot happen: AE callback without handler', (_class, _type) + + # XXXX Do key-to-name mapping here + + _parameters['_attributes'] = _attributes + _parameters['_class'] = _class + _parameters['_type'] = _type + if _parameters.has_key('----'): + _object = _parameters['----'] + del _parameters['----'] + print 'XXX', (_function, (_object,), _parameters) + try: + rv = apply(_function, (_object,), _parameters) + except TypeError, name: + raise TypeError, ('AppleEvent handler misses formal keyword argument', _function, name) + else: + try: + rv = apply(_function, (), _parameters) + except TypeError, name: + raise TypeError, ('AppleEvent handler misses formal keyword argument', _function, name) + + if rv == None: + aetools.packevent(_reply, {}) + else: + aetools.packevent(_reply, {'----':rv}) + +def code(x): + "Convert a long int to the 4-character code it really is" + s = '' + for i in range(4): + x, c = divmod(x, 256) + s = chr(c) + s + return s + +class _Test(AEServer, MiniApplication): + """Mini test application, handles required events""" + + def __init__(self): + MiniApplication.__init__(self) + AEServer.__init__(self) + self.installaehandler('aevt', 'oapp', self.open_app) + self.installaehandler('aevt', 'quit', self.quit) + self.installaehandler('aevt', '****', self.other) + self.mainloop() + + def quit(self, **args): + self._quit() + + def open_app(self, **args): + pass + + def other(self, _object=None, _class=None, _type=None, **args): + print 'AppleEvent', (_class, _type), 'for', _object, 'Other args:', args + +if __name__ == '__main__': + _Test() diff --git a/Mac/Lib/lib-toolbox/QuickDraw.py b/Mac/Lib/lib-toolbox/QuickDraw.py new file mode 100644 index 0000000..dc8b002 --- /dev/null +++ b/Mac/Lib/lib-toolbox/QuickDraw.py @@ -0,0 +1,113 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDraw.h' + +invalColReq = -1 +srcCopy = 0 +srcOr = 1 +srcXor = 2 +srcBic = 3 +notSrcCopy = 4 +notSrcOr = 5 +notSrcXor = 6 +notSrcBic = 7 +patCopy = 8 +patOr = 9 +patXor = 10 +patBic = 11 +notPatCopy = 12 +notPatOr = 13 +notPatXor = 14 +notPatBic = 15 +grayishTextOr = 49 +hilitetransfermode = 50 +blend = 32 +addPin = 33 +addOver = 34 +subPin = 35 +addMax = 37 +adMax = 37 +subOver = 38 +adMin = 39 +ditherCopy = 64 +transparent = 36 +italicBit = 1 +ulineBit = 2 +outlineBit = 3 +shadowBit = 4 +condenseBit = 5 +extendBit = 6 +normalBit = 0 +inverseBit = 1 +redBit = 4 +greenBit = 3 +blueBit = 2 +cyanBit = 8 +magentaBit = 7 +yellowBit = 6 +blackBit = 5 +blackColor = 33 +whiteColor = 30 +redColor = 205 +greenColor = 341 +blueColor = 409 +cyanColor = 273 +magentaColor = 137 +yellowColor = 69 +picLParen = 0 +picRParen = 1 +clutType = 0 +fixedType = 1 +directType = 2 +gdDevType = 0 +interlacedDevice = 2 +roundedDevice = 5 +hasAuxMenuBar = 6 +burstDevice = 7 +ext32Device = 8 +ramInit = 10 +mainScreen = 11 +allInit = 12 +screenDevice = 13 +noDriver = 14 +screenActive = 15 +hiliteBit = 7 +pHiliteBit = 0 +defQDColors = 127 +RGBDirect = 16 +baseAddr32 = 4 +sysPatListID = 0 +iBeamCursor = 1 +crossCursor = 2 +plusCursor = 3 +watchCursor = 4 +kQDGrafVerbFrame = 0 +kQDGrafVerbPaint = 1 +kQDGrafVerbErase = 2 +kQDGrafVerbInvert = 3 +kQDGrafVerbFill = 4 +singleDevicesBit = 0 +dontMatchSeedsBit = 1 +allDevicesBit = 2 +singleDevices = 1 << singleDevicesBit +dontMatchSeeds = 1 << dontMatchSeedsBit +allDevices = 1 << allDevicesBit +kNoConstraint = 0 +kVerticalConstraint = 1 +kHorizontalConstraint = 2 +kCursorImageMajorVersion = 0x0001 +kCursorImageMinorVersion = 0x0000 +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDrawText.h' + +leftCaret = 0 +rightCaret = -1 +hilite = 1 +smLeftCaret = 0 +smRightCaret = -1 +smHilite = 1 +onlyStyleRun = 0 +leftStyleRun = 1 +rightStyleRun = 2 +middleStyleRun = 3 +smOnlyStyleRun = 0 +smLeftStyleRun = 1 +smRightStyleRun = 2 +smMiddleStyleRun = 3 diff --git a/Mac/Lib/lib-toolbox/QuickTime.py b/Mac/Lib/lib-toolbox/QuickTime.py new file mode 100644 index 0000000..078ae1d --- /dev/null +++ b/Mac/Lib/lib-toolbox/QuickTime.py @@ -0,0 +1,386 @@ +# Generated from 'sap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Movies.h' + +MovieFileType = 'MooV' +MediaHandlerType = 'mhlr' +DataHandlerType = 'dhlr' +VideoMediaType = 'vide' +SoundMediaType = 'soun' +TextMediaType = 'text' +BaseMediaType = 'gnrc' +MPEGMediaType = 'MPEG' +MusicMediaType = 'musi' +TimeCodeMediaType = 'tmcd' +SpriteMediaType = 'sprt' +TweenMediaType = 'twen' +ThreeDeeMediaType = 'qd3d' +HandleDataHandlerSubType = 'hndl' +ResourceDataHandlerSubType = 'rsrc' +VisualMediaCharacteristic = 'eyes' +AudioMediaCharacteristic = 'ears' +kCharacteristicCanSendVideo = 'vsnd' +DoTheRightThing = 0 +kMusicFlagDontPlay2Soft = 1L << 0 +dfDontDisplay = 1 << 0 +dfDontAutoScale = 1 << 1 +dfClipToTextBox = 1 << 2 +dfUseMovieBGColor = 1 << 3 +dfShrinkTextBoxToFit = 1 << 4 +dfScrollIn = 1 << 5 +dfScrollOut = 1 << 6 +dfHorizScroll = 1 << 7 +dfReverseScroll = 1 << 8 +dfContinuousScroll = 1 << 9 +dfFlowHoriz = 1 << 10 +dfContinuousKaraoke = 1 << 11 +dfDropShadow = 1 << 12 +dfAntiAlias = 1 << 13 +dfKeyedText = 1 << 14 +dfInverseHilite = 1 << 15 +dfTextColorHilite = 1 << 16 +searchTextDontGoToFoundTime = 1L << 16 +searchTextDontHiliteFoundText = 1L << 17 +searchTextOneTrackOnly = 1L << 18 +searchTextEnabledTracksOnly = 1L << 19 +k3DMediaRendererEntry = 'rend' +k3DMediaRendererName = 'name' +k3DMediaRendererCode = 'rcod' +movieProgressOpen = 0 +movieProgressUpdatePercent = 1 +movieProgressClose = 2 +progressOpFlatten = 1 +progressOpInsertTrackSegment = 2 +progressOpInsertMovieSegment = 3 +progressOpPaste = 4 +progressOpAddMovieSelection = 5 +progressOpCopy = 6 +progressOpCut = 7 +progressOpLoadMovieIntoRam = 8 +progressOpLoadTrackIntoRam = 9 +progressOpLoadMediaIntoRam = 10 +progressOpImportMovie = 11 +progressOpExportMovie = 12 +mediaQualityDraft = 0x0000 +mediaQualityNormal = 0x0040 +mediaQualityBetter = 0x0080 +mediaQualityBest = 0x00C0 +loopTimeBase = 1 +palindromeLoopTimeBase = 2 +maintainTimeBaseZero = 4 +triggerTimeFwd = 0x0001 +triggerTimeBwd = 0x0002 +triggerTimeEither = 0x0003 +triggerRateLT = 0x0004 +triggerRateGT = 0x0008 +triggerRateEqual = 0x0010 +triggerRateChange = 0 +triggerAtStart = 0x0001 +triggerAtStop = 0x0002 +timeBaseBeforeStartTime = 1 +timeBaseAfterStopTime = 2 +callBackAtTime = 1 +callBackAtRate = 2 +callBackAtTimeJump = 3 +callBackAtExtremes = 4 +callBackAtInterrupt = 0x8000 +callBackAtDeferredTask = 0x4000 +qtcbNeedsRateChanges = 1 +qtcbNeedsTimeChanges = 2 +qtcbNeedsStartStopChanges = 4 +keepInRam = 1 << 0 +unkeepInRam = 1 << 1 +flushFromRam = 1 << 2 +loadForwardTrackEdits = 1 << 3 +loadBackwardTrackEdits = 1 << 4 +newMovieActive = 1 << 0 +newMovieDontResolveDataRefs = 1 << 1 +newMovieDontAskUnresolvedDataRefs = 1 << 2 +newMovieDontAutoAlternates = 1 << 3 +newMovieDontUpdateForeBackPointers = 1 << 4 +trackUsageInMovie = 1 << 1 +trackUsageInPreview = 1 << 2 +trackUsageInPoster = 1 << 3 +mediaSampleNotSync = 1 << 0 +mediaSampleShadowSync = 1 << 1 +pasteInParallel = 1 << 0 +showUserSettingsDialog = 1 << 1 +movieToFileOnlyExport = 1 << 2 +movieFileSpecValid = 1 << 3 +nextTimeMediaSample = 1 << 0 +nextTimeMediaEdit = 1 << 1 +nextTimeTrackEdit = 1 << 2 +nextTimeSyncSample = 1 << 3 +nextTimeStep = 1 << 4 +nextTimeEdgeOK = 1 << 14 +nextTimeIgnoreActiveSegment = 1 << 15 +createMovieFileDeleteCurFile = 1L << 31 +createMovieFileDontCreateMovie = 1L << 30 +createMovieFileDontOpenFile = 1L << 29 +flattenAddMovieToDataFork = 1L << 0 +flattenActiveTracksOnly = 1L << 2 +flattenDontInterleaveFlatten = 1L << 3 +flattenFSSpecPtrIsDataRefRecordPtr = 1L << 4 +movieInDataForkResID = -1 +mcTopLeftMovie = 1 << 0 +mcScaleMovieToFit = 1 << 1 +mcWithBadge = 1 << 2 +mcNotVisible = 1 << 3 +mcWithFrame = 1 << 4 +movieScrapDontZeroScrap = 1 << 0 +movieScrapOnlyPutMovie = 1 << 1 +dataRefSelfReference = 1 << 0 +dataRefWasNotResolved = 1 << 1 +hintsScrubMode = 1 << 0 +hintsLoop = 1 << 1 +hintsDontPurge = 1 << 2 +hintsUseScreenBuffer = 1 << 5 +hintsAllowInterlace = 1 << 6 +hintsUseSoundInterp = 1 << 7 +hintsHighQuality = 1 << 8 +hintsPalindrome = 1 << 9 +hintsInactive = 1 << 11 +mediaHandlerFlagBaseClient = 1 +movieTrackMediaType = 1 << 0 +movieTrackCharacteristic = 1 << 1 +movieTrackEnabledOnly = 1 << 2 +movieDrawingCallWhenChanged = 0 +movieDrawingCallAlways = 1 +preloadAlways = 1L << 0 +preloadOnlyIfEnabled = 1L << 1 +fullScreenHideCursor = 1L << 0 +fullScreenAllowEvents = 1L << 1 +fullScreenDontChangeMenuBar = 1L << 2 +fullScreenPreflightSize = 1L << 3 +kBackgroundSpriteLayerNum = 32767 +kSpritePropertyMatrix = 1 +kSpritePropertyImageDescription = 2 +kSpritePropertyImageDataPtr = 3 +kSpritePropertyVisible = 4 +kSpritePropertyLayer = 5 +kSpritePropertyGraphicsMode = 6 +kSpritePropertyImageIndex = 100 +kSpriteTrackPropertyBackgroundColor = 101 +kSpriteTrackPropertyOffscreenBitDepth = 102 +kSpriteTrackPropertySampleFormat = 103 +kOnlyDrawToSpriteWorld = 1L << 0 +kSpriteWorldPreflight = 1L << 1 +kSpriteWorldDidDraw = 1L << 0 +kSpriteWorldNeedsToDraw = 1L << 1 +kKeyFrameAndSingleOverride = 1L << 1 +kKeyFrameAndAllOverrides = 1L << 2 +kParentAtomIsContainer = 0 +kITextRemoveEverythingBut = 0 << 1 +kITextRemoveLeaveSuggestedAlternate = 1 << 1 +kITextAtomType = 'itxt' +kITextStringAtomType = 'text' +kTrackModifierInput = 0x696E +kTrackModifierType = 0x7479 +kTrackModifierReference = 'ssrc' +kTrackModifierObjectID = 'obid' +kTrackModifierInputName = 'name' +kInputMapSubInputID = 'subi' +kTrackModifierTypeMatrix = 1 +kTrackModifierTypeClip = 2 +kTrackModifierTypeGraphicsMode = 5 +kTrackModifierTypeVolume = 3 +kTrackModifierTypeBalance = 4 +kTrackModifierTypeSpriteImage = 'vide' +kTrackModifierObjectMatrix = 6 +kTrackModifierObjectGraphicsMode = 7 +kTrackModifierType3d4x4Matrix = 8 +kTrackModifierCameraData = 9 +kTrackModifierSoundLocalizationData = 10 +kTweenTypeShort = 1 +kTweenTypeLong = 2 +kTweenTypeFixed = 3 +kTweenTypePoint = 4 +kTweenTypeQDRect = 5 +kTweenTypeQDRegion = 6 +kTweenTypeMatrix = 7 +kTweenTypeRGBColor = 8 +kTweenTypeGraphicsModeWithRGBColor = 9 +kTweenType3dScale = '3sca' +kTweenType3dTranslate = '3tra' +kTweenType3dRotate = '3rot' +kTweenType3dRotateAboutPoint = '3rap' +kTweenType3dRotateAboutAxis = '3rax' +kTweenType3dQuaternion = '3qua' +kTweenType3dMatrix = '3mat' +kTweenType3dCameraData = '3cam' +kTweenType3dSoundLocalizationData = '3slc' +kTweenEntry = 'twen' +kTweenData = 'data' +kTweenType = 'twnt' +kTweenStartOffset = 'twst' +kTweenDuration = 'twdu' +kTween3dInitialCondition = 'icnd' +kTweenInterpolationStyle = 'isty' +kTweenRegionData = 'qdrg' +kTweenPictureData = 'PICT' +internalComponentErr = -2070 +notImplementedMusicOSErr = -2071 +cantSendToSynthesizerOSErr = -2072 +cantReceiveFromSynthesizerOSErr = -2073 +illegalVoiceAllocationOSErr = -2074 +illegalPartOSErr = -2075 +illegalChannelOSErr = -2076 +illegalKnobOSErr = -2077 +illegalKnobValueOSErr = -2078 +illegalInstrumentOSErr = -2079 +illegalControllerOSErr = -2080 +midiManagerAbsentOSErr = -2081 +synthesizerNotRespondingOSErr = -2082 +synthesizerOSErr = -2083 +illegalNoteChannelOSErr = -2084 +noteChannelNotAllocatedOSErr = -2085 +tunePlayerFullOSErr = -2086 +tuneParseOSErr = -2087 +videoFlagDontLeanAhead = 1L << 0 +txtProcDefaultDisplay = 0 +txtProcDontDisplay = 1 +txtProcDoDisplay = 2 +findTextEdgeOK = 1 << 0 +findTextCaseSensitive = 1 << 1 +findTextReverseSearch = 1 << 2 +findTextWrapAround = 1 << 3 +findTextUseOffset = 1 << 4 +dropShadowOffsetType = 'drpo' +dropShadowTranslucencyType = 'drpt' +spriteHitTestBounds = 1L << 0 +spriteHitTestImage = 1L << 1 +kSpriteAtomType = 'sprt' +kSpriteImagesContainerAtomType = 'imct' +kSpriteImageAtomType = 'imag' +kSpriteImageDataAtomType = 'imda' +kSpriteSharedDataAtomType = 'dflt' +kSpriteNameAtomType = 'name' +MovieControllerComponentType = 'play' +mcActionIdle = 1 +mcActionDraw = 2 +mcActionActivate = 3 +mcActionDeactivate = 4 +mcActionMouseDown = 5 +mcActionKey = 6 +mcActionPlay = 8 +mcActionGoToTime = 12 +mcActionSetVolume = 14 +mcActionGetVolume = 15 +mcActionStep = 18 +mcActionSetLooping = 21 +mcActionGetLooping = 22 +mcActionSetLoopIsPalindrome = 23 +mcActionGetLoopIsPalindrome = 24 +mcActionSetGrowBoxBounds = 25 +mcActionControllerSizeChanged = 26 +mcActionSetSelectionBegin = 29 +mcActionSetSelectionDuration = 30 +mcActionSetKeysEnabled = 32 +mcActionGetKeysEnabled = 33 +mcActionSetPlaySelection = 34 +mcActionGetPlaySelection = 35 +mcActionSetUseBadge = 36 +mcActionGetUseBadge = 37 +mcActionSetFlags = 38 +mcActionGetFlags = 39 +mcActionSetPlayEveryFrame = 40 +mcActionGetPlayEveryFrame = 41 +mcActionGetPlayRate = 42 +mcActionShowBalloon = 43 +mcActionBadgeClick = 44 +mcActionMovieClick = 45 +mcActionSuspend = 46 +mcActionResume = 47 +mcActionSetControllerKeysEnabled = 48 +mcActionGetTimeSliderRect = 49 +mcActionMovieEdited = 50 +mcActionGetDragEnabled = 51 +mcActionSetDragEnabled = 52 +mcActionGetSelectionBegin = 53 +mcActionGetSelectionDuration = 54 +mcActionPrerollAndPlay = 55 +mcActionGetCursorSettingEnabled = 56 +mcActionSetCursorSettingEnabled = 57 +mcActionSetColorTable = 58 +mcFlagSuppressMovieFrame = 1 << 0 +mcFlagSuppressStepButtons = 1 << 1 +mcFlagSuppressSpeakerButton = 1 << 2 +mcFlagsUseWindowPalette = 1 << 3 +mcFlagsDontInvalidate = 1 << 4 +mcPositionDontInvalidate = 1 << 5 +mcInfoUndoAvailable = 1 << 0 +mcInfoCutAvailable = 1 << 1 +mcInfoCopyAvailable = 1 << 2 +mcInfoPasteAvailable = 1 << 3 +mcInfoClearAvailable = 1 << 4 +mcInfoHasSound = 1 << 5 +mcInfoIsPlaying = 1 << 6 +mcInfoIsLooping = 1 << 7 +mcInfoIsInPalindrome = 1 << 8 +mcInfoEditingEnabled = 1 << 9 +mcInfoMovieIsInteractive = 1 << 10 +mcMenuUndo = 1 +mcMenuCut = 3 +mcMenuCopy = 4 +mcMenuPaste = 5 +mcMenuClear = 6 +kVideoMediaResetStatisticsSelect = 0x0105 +kVideoMediaGetStatisticsSelect = 0x0106 +kTextMediaSetTextProcSelect = 0x0101 +kTextMediaAddTextSampleSelect = 0x0102 +kTextMediaAddTESampleSelect = 0x0103 +kTextMediaAddHiliteSampleSelect = 0x0104 +kTextMediaFindNextTextSelect = 0x0105 +kTextMediaHiliteTextSampleSelect = 0x0106 +kTextMediaSetTextSampleDataSelect = 0x0107 +kSpriteMediaSetPropertySelect = 0x0101 +kSpriteMediaGetPropertySelect = 0x0102 +kSpriteMediaHitTestSpritesSelect = 0x0103 +kSpriteMediaCountSpritesSelect = 0x0104 +kSpriteMediaCountImagesSelect = 0x0105 +kSpriteMediaGetIndImageDescriptionSelect = 0x0106 +kSpriteMediaGetDisplayedSampleNumberSelect = 0x0107 +kMedia3DGetNamedObjectListSelect = 0x0101 +kMedia3DGetRendererListSelect = 0x0102 +kMCSetMovieSelect = 0x0002 +kMCGetIndMovieSelect = 0x0005 +kMCRemoveAllMoviesSelect = 0x0006 +kMCRemoveAMovieSelect = 0x0003 +kMCRemoveMovieSelect = 0x0006 +kMCIsPlayerEventSelect = 0x0007 +kMCSetActionFilterSelect = 0x0008 +kMCDoActionSelect = 0x0009 +kMCSetControllerAttachedSelect = 0x000A +kMCIsControllerAttachedSelect = 0x000B +kMCSetControllerPortSelect = 0x000C +kMCGetControllerPortSelect = 0x000D +kMCSetVisibleSelect = 0x000E +kMCGetVisibleSelect = 0x000F +kMCGetControllerBoundsRectSelect = 0x0010 +kMCSetControllerBoundsRectSelect = 0x0011 +kMCGetControllerBoundsRgnSelect = 0x0012 +kMCGetWindowRgnSelect = 0x0013 +kMCMovieChangedSelect = 0x0014 +kMCSetDurationSelect = 0x0015 +kMCGetCurrentTimeSelect = 0x0016 +kMCNewAttachedControllerSelect = 0x0017 +kMCDrawSelect = 0x0018 +kMCActivateSelect = 0x0019 +kMCIdleSelect = 0x001A +kMCKeySelect = 0x001B +kMCClickSelect = 0x001C +kMCEnableEditingSelect = 0x001D +kMCIsEditingEnabledSelect = 0x001E +kMCCopySelect = 0x001F +kMCCutSelect = 0x0020 +kMCPasteSelect = 0x0021 +kMCClearSelect = 0x0022 +kMCUndoSelect = 0x0023 +kMCPositionControllerSelect = 0x0024 +kMCGetControllerInfoSelect = 0x0025 +kMCSetClipSelect = 0x0028 +kMCGetClipSelect = 0x0029 +kMCDrawBadgeSelect = 0x002A +kMCSetUpEditMenuSelect = 0x002B +kMCGetMenuStringSelect = 0x002C +kMCSetActionFilterWithRefConSelect = 0x002D +kMCPtInControllerSelect = 0x002E +kMCInvalidateSelect = 0x002F diff --git a/Mac/Lib/lib-toolbox/Resources.py b/Mac/Lib/lib-toolbox/Resources.py new file mode 100644 index 0000000..989e700 --- /dev/null +++ b/Mac/Lib/lib-toolbox/Resources.py @@ -0,0 +1,23 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Resources.h' + +resSysHeap = 64 +resPurgeable = 32 +resLocked = 16 +resProtected = 8 +resPreload = 4 +resChanged = 2 +mapReadOnly = 128 +mapCompact = 64 +mapChanged = 32 +resSysRefBit = 7 +resSysHeapBit = 6 +resPurgeableBit = 5 +resLockedBit = 4 +resProtectedBit = 3 +resPreloadBit = 2 +resChangedBit = 1 +mapReadOnlyBit = 7 +mapCompactBit = 6 +mapChangedBit = 5 +kResFileNotOpened = -1 +kSystemResFile = 0 diff --git a/Mac/Lib/lib-toolbox/Sound.py b/Mac/Lib/lib-toolbox/Sound.py new file mode 100644 index 0000000..f782dd5 --- /dev/null +++ b/Mac/Lib/lib-toolbox/Sound.py @@ -0,0 +1,102 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Sound.h' + +soundListRsrc = 'snd ' +rate44khz = 0xAC440000L +rate22050hz = 0x56220000L +rate22khz = 0x56EE8BA3L +rate11khz = 0x2B7745D1L +rate11025hz = 0x2B110000 +squareWaveSynth = 1 +waveTableSynth = 3 +sampledSynth = 5 +MACE3snthID = 11 +MACE6snthID = 13 +kMiddleC = 60 +kSimpleBeepID = 1 +kFullVolume = 0x0100 +kNoVolume = 0 +nullCmd = 0 +initCmd = 1 +freeCmd = 2 +quietCmd = 3 +flushCmd = 4 +reInitCmd = 5 +waitCmd = 10 +pauseCmd = 11 +resumeCmd = 12 +callBackCmd = 13 +syncCmd = 14 +availableCmd = 24 +versionCmd = 25 +totalLoadCmd = 26 +loadCmd = 27 +freqDurationCmd = 40 +restCmd = 41 +freqCmd = 42 +ampCmd = 43 +timbreCmd = 44 +getAmpCmd = 45 +volumeCmd = 46 +getVolumeCmd = 47 +waveTableCmd = 60 +phaseCmd = 61 +soundCmd = 80 +bufferCmd = 81 +rateCmd = 82 +continueCmd = 83 +doubleBufferCmd = 84 +getRateCmd = 85 +rateMultiplierCmd = 86 +getRateMultiplierCmd = 87 +sizeCmd = 90 +convertCmd = 91 +stdQLength = 128 +dataOffsetFlag = 0x8000 +waveInitChannelMask = 0x07 +waveInitChannel0 = 0x04 +waveInitChannel1 = 0x05 +waveInitChannel2 = 0x06 +waveInitChannel3 = 0x07 +initChanLeft = 0x0002 +initChanRight = 0x0003 +initNoInterp = 0x0004 +initNoDrop = 0x0008 +initMono = 0x0080 +initStereo = 0x00C0 +initMACE3 = 0x0300 +initMACE6 = 0x0400 +initPanMask = 0x0003 +initSRateMask = 0x0030 +initStereoMask = 0x00C0 +initCompMask = 0xFF00 +kUseOptionalOutputDevice = -1 +notCompressed = 0 +fixedCompression = -1 +variableCompression = -2 +twoToOne = 1 +eightToThree = 2 +threeToOne = 3 +sixToOne = 4 +stdSH = 0x00 +extSH = 0xFF +cmpSH = 0xFE +outsideCmpSH = 0 +insideCmpSH = 1 +aceSuccess = 0 +aceMemFull = 1 +aceNilBlock = 2 +aceBadComp = 3 +aceBadEncode = 4 +aceBadDest = 5 +aceBadCmd = 6 +sixToOnePacketSize = 8 +threeToOnePacketSize = 16 +stateBlockSize = 64 +leftOverBlockSize = 32 +firstSoundFormat = 0x0001 +secondSoundFormat = 0x0002 +dbBufferReady = 0x00000001 +dbLastBuffer = 0x00000004 +sysBeepDisable = 0x0000 +unitTypeNoSelection = 0xFFFF +unitTypeSeconds = 0x0000 diff --git a/Mac/Lib/lib-toolbox/TextEdit.py b/Mac/Lib/lib-toolbox/TextEdit.py new file mode 100644 index 0000000..6bfb163 --- /dev/null +++ b/Mac/Lib/lib-toolbox/TextEdit.py @@ -0,0 +1,56 @@ +# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:TextEdit.h' + +teJustLeft = 0 +teJustCenter = 1 +teJustRight = -1 +teForceLeft = -2 +teFlushDefault = 0 +teCenter = 1 +teFlushRight = -1 +teFlushLeft = -2 +fontBit = 0 +faceBit = 1 +sizeBit = 2 +clrBit = 3 +addSizeBit = 4 +toggleBit = 5 +toglBit = 5 +doFont = 1 +doFace = 2 +doSize = 4 +doColor = 8 +doAll = 15 +addSize = 16 +doToggle = 32 +EOLHook = 0 +DRAWHook = 4 +WIDTHHook = 8 +HITTESTHook = 12 +nWIDTHHook = 24 +TextWidthHook = 28 +intEOLHook = 0 +intDrawHook = 1 +intWidthHook = 2 +intHitTestHook = 3 +intNWidthHook = 6 +intTextWidthHook = 7 +teFAutoScroll = 0 +teFAutoScr = 0 +teFTextBuffering = 1 +teFOutlineHilite = 2 +teFInlineInput = 3 +teFUseTextServices = 4 +teBitClear = 0 +teBitSet = 1 +teBitTest = -1 +teWordSelect = 4 +teWordDrag = 8 +teFromFind = 12 +teFromRecal = 16 +teFind = 0 +teHighlight = 1 +teDraw = -1 +teCaret = -2 +TEBitClear = 0 +TEBitSet = 1 +TEBitTest = -1 diff --git a/Mac/Lib/lib-toolbox/WASTEconst.py b/Mac/Lib/lib-toolbox/WASTEconst.py new file mode 100644 index 0000000..93c6c60 --- /dev/null +++ b/Mac/Lib/lib-toolbox/WASTEconst.py @@ -0,0 +1,87 @@ +# Generated from ':::::Waste 1.2 Distribution:WASTE C/C++ Headers:WASTE.h' + +weCantUndoErr = -10015 +weEmptySelectionErr = -10013 +weNotHandledErr = -1708 +weUnknownObjectTypeErr = -9478 +weObjectNotFoundErr = -9477 +weReadOnlyErr = -9476 +weUndefinedSelectorErr = -50 +weFlushLeft = -2 +weFlushRight = -1 +weFlushDefault = 0 +weCenter = 1 +weJustify = 2 +weDoFont = 0x0001 +weDoFace = 0x0002 +weDoSize = 0x0004 +weDoColor = 0x0008 +weDoAddSize = 0x0010 +weDoToggleFace = 0x0020 +weDoReplaceFace = 0x0040 +weDoPreserveScript = 0x0080 +weDoExtractSubscript = 0x0100 +weDoFaceMask = 0x0200 +kLeadingEdge = -1 +kTrailingEdge = 0 +kObjectEdge = 2 +weFAutoScroll = 0 +weFOutlineHilite = 2 +weFReadOnly = 5 +weFUndo = 6 +weFIntCutAndPaste = 7 +weFDragAndDrop = 8 +weFInhibitRecal = 9 +weFUseTempMem = 10 +weFDrawOffscreen = 11 +weFInhibitRedraw = 12 +weFMonoStyled = 13 +weFInhibitColor = 31 +weDoAutoScroll = 1L << weFAutoScroll +weDoOutlineHilite = 1L << weFOutlineHilite +weDoReadOnly = 1L << weFReadOnly +weDoUndo = 1L << weFUndo +weDoIntCutAndPaste = 1L << weFIntCutAndPaste +weDoDragAndDrop = 1L << weFDragAndDrop +weDoInhibitRecal = 1L << weFInhibitRecal +weDoUseTempMem = 1L << weFUseTempMem +weDoDrawOffscreen = 1L << weFDrawOffscreen +weDoInhibitRedraw = 1L << weFInhibitRedraw +weDoMonoStyled = 1L << weFMonoStyled +weDoInhibitColor = 1L << weFInhibitColor +weBitToggle = -2 +weCharByteHook = 'cbyt' +weCharToPixelHook = 'c2p ' +weCharTypeHook = 'ctyp' +weClickLoop = 'clik' +weCurrentDrag = 'drag' +weDrawTextHook = 'draw' +weHiliteDropAreaHook = 'hidr' +weLineBreakHook = 'lbrk' +wePixelToCharHook = 'p2c ' +wePort = 'port' +weRefCon = 'refc' +weScrollProc = 'scrl' +weText = 'text' +weTranslateDragHook = 'xdrg' +weTSMDocumentID = 'tsmd' +weTSMPreUpdate = 'pre ' +weTSMPostUpdate = 'post' +weURLHint = 'urlh' +weWordBreakHook = 'wbrk' +weNewHandler = 'new ' +weDisposeHandler = 'free' +weDrawHandler = 'draw' +weClickHandler = 'clik' +weStreamHandler = 'strm' +weAKNone = 0 +weAKUnspecified = 1 +weAKTyping = 2 +weAKCut = 3 +weAKPaste = 4 +weAKClear = 5 +weAKDrag = 6 +weAKSetStyle = 7 +weToScrap = 0 +weToDrag = 1 +weToSoup = 2 diff --git a/Mac/Lib/lib-toolbox/Windows.py b/Mac/Lib/lib-toolbox/Windows.py new file mode 100644 index 0000000..7f54a24 --- /dev/null +++ b/Mac/Lib/lib-toolbox/Windows.py @@ -0,0 +1,59 @@ +# Generated from 'Moes:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Windows.h' + +kWindowDefProcType = 'WDEF' +kStandardWindowDefinition = 0 +kRoundWindowDefinition = 1 +kFloatingWindowDefinition = 124 +kModalDialogVariantCode = 1 +kMovableModalDialogVariantCode = 5 +kSideFloaterVariantCode = 8 +documentProc = 0 +dBoxProc = 1 +plainDBox = 2 +altDBoxProc = 3 +noGrowDocProc = 4 +movableDBoxProc = 5 +zoomDocProc = 8 +zoomNoGrow = 12 +rDocProc = 16 +floatProc = 1985 +floatGrowProc = 1987 +floatZoomProc = 1989 +floatZoomGrowProc = 1991 +floatSideProc = 1993 +floatSideGrowProc = 1995 +floatSideZoomProc = 1997 +floatSideZoomGrowProc = 1999 +dialogKind = 2 +userKind = 8 +kDialogWindowKind = 2 +kApplicationWindowKind = 8 +inDesk = 0 +inMenuBar = 1 +inSysWindow = 2 +inContent = 3 +inDrag = 4 +inGrow = 5 +inGoAway = 6 +inZoomIn = 7 +inZoomOut = 8 +wDraw = 0 +wHit = 1 +wCalcRgns = 2 +wNew = 3 +wDispose = 4 +wGrow = 5 +wDrawGIcon = 6 +deskPatID = 16 +wNoHit = 0 +wInContent = 1 +wInDrag = 2 +wInGrow = 3 +wInGoAway = 4 +wInZoomIn = 5 +wInZoomOut = 6 +wContentColor = 0 +wFrameColor = 1 +wTextColor = 2 +wHiliteColor = 3 +wTitleBarColor = 4 diff --git a/Mac/Lib/lib-toolbox/aepack.py b/Mac/Lib/lib-toolbox/aepack.py new file mode 100644 index 0000000..9302a54 --- /dev/null +++ b/Mac/Lib/lib-toolbox/aepack.py @@ -0,0 +1,357 @@ +"""Tools for use in AppleEvent clients and servers: +conversion between AE types and python types + +pack(x) converts a Python object to an AEDesc object +unpack(desc) does the reverse +coerce(x, wanted_sample) coerces a python object to another python object +""" + +# +# This code was originally written by Guido, and modified/extended by Jack +# to include the various types that were missing. The reference used is +# Apple Event Registry, chapter 9. +# + +import struct +import string +import types +from string import strip +from types import * +import AE +from AppleEvents import * +from AERegistry import * +from AEObjects import * +import MacOS +import macfs +import StringIO +import aetypes +from aetypes import mkenum, mktype + +# These ones seem to be missing from AppleEvents +# (they're in AERegistry.h) + +#typeColorTable = 'clrt' +#typeDrawingArea = 'cdrw' +#typePixelMap = 'cpix' +#typePixelMapMinus = 'tpmm' +#typeRotation = 'trot' +#typeTextStyles = 'tsty' +#typeStyledText = 'STXT' +#typeAEText = 'tTXT' +#typeEnumeration = 'enum' + +# +# Some AE types are immedeately coerced into something +# we like better (and which is equivalent) +# +unpacker_coercions = { + typeComp : typeExtended, + typeColorTable : typeAEList, + typeDrawingArea : typeAERecord, + typeFixed : typeExtended, + typeFloat : typeExtended, + typePixelMap : typeAERecord, + typeRotation : typeAERecord, + typeStyledText : typeAERecord, + typeTextStyles : typeAERecord, +}; + +# +# Some python types we need in the packer: +# +AEDescType = type(AE.AECreateDesc('TEXT', '')) +_sample_fss = macfs.FSSpec(':') +_sample_alias = _sample_fss.NewAliasMinimal() +FSSType = type(_sample_fss) +AliasType = type(_sample_alias) + +def pack(x, forcetype = None): + """Pack a python object into an AE descriptor""" + + if forcetype: + if type(x) is StringType: + return AE.AECreateDesc(forcetype, x) + else: + return pack(x).AECoerceDesc(forcetype) + + if x == None: + return AE.AECreateDesc('null', '') + + t = type(x) + if t == AEDescType: + return x + if t == FSSType: + return AE.AECreateDesc('fss ', x.data) + if t == AliasType: + return AE.AECreateDesc('alis', x.data) + if t == IntType: + return AE.AECreateDesc('long', struct.pack('l', x)) + if t == FloatType: + # + # XXXX (note by Guido) Weird thing -- Think C's "double" is 10 bytes, but + # struct.pack('d') return 12 bytes (and struct.unpack requires + # them, too). The first 2 bytes seem to be repeated... + # Probably an alignment problem + # XXXX (note by Jack) haven't checked this under MW + # + return AE.AECreateDesc('exte', struct.pack('d', x)[2:]) + if t == StringType: + return AE.AECreateDesc('TEXT', x) + if t == ListType: + list = AE.AECreateList('', 0) + for item in x: + list.AEPutDesc(0, pack(item)) + return list + if t == DictionaryType: + record = AE.AECreateList('', 1) + for key, value in x.items(): + record.AEPutParamDesc(key, pack(value)) + return record + if t == InstanceType and hasattr(x, '__aepack__'): + return x.__aepack__() + return AE.AECreateDesc('TEXT', repr(x)) # Copout + +def unpack(desc): + """Unpack an AE descriptor to a python object""" + t = desc.type + + if unpacker_coercions.has_key(t): + desc = desc.AECoerceDesc(unpacker_coercions[t]) + t = desc.type # This is a guess by Jack.... + + if t == typeAEList: + l = [] + for i in range(desc.AECountItems()): + keyword, item = desc.AEGetNthDesc(i+1, '****') + l.append(unpack(item)) + return l + if t == typeAERecord: + d = {} + for i in range(desc.AECountItems()): + keyword, item = desc.AEGetNthDesc(i+1, '****') + d[keyword] = unpack(item) + return d + if t == typeAEText: + record = desc.AECoerceDesc('reco') + return mkaetext(unpack(record)) + if t == typeAlias: + return macfs.RawAlias(desc.data) + # typeAppleEvent returned as unknown + if t == typeBoolean: + return struct.unpack('b', desc.data)[0] + if t == typeChar: + return desc.data + # typeColorTable coerced to typeAEList + # typeComp coerced to extended + # typeData returned as unknown + # typeDrawingArea coerced to typeAERecord + if t == typeEnumeration: + return mkenum(desc.data) + # typeEPS returned as unknown + if t == typeExtended: + data = desc.data + # XXX See corresponding note for pack() + return struct.unpack('d', data[:2] + data)[0] + if t == typeFalse: + return 0 + # typeFixed coerced to extended + # typeFloat coerced to extended + if t == typeFSS: + return macfs.RawFSSpec(desc.data) + if t == typeInsertionLoc: + record = desc.AECoerceDesc('reco') + return mkinsertionloc(unpack(record)) + # typeInteger equal to typeLongInteger + if t == typeIntlText: + script, language = struct.unpack('hh', desc.data[:4]) + return aetypes.IntlText(script, language, desc.data[4:]) + if t == typeIntlWritingCode: + script, language = struct.unpack('hh', desc.data) + return aetypes.IntlWritingCode(script, language) + if t == typeKeyword: + return mkkeyword(desc.data) + # typeLongFloat is equal to typeFloat + if t == typeLongInteger: + return struct.unpack('l', desc.data)[0] + if t == typeNull: + return None + if t == typeMagnitude: + v = struct.unpack('l', desc.data) + if v < 0: + v = 0x100000000L + v + return v + if t == typeObjectSpecifier: + record = desc.AECoerceDesc('reco') + return mkobject(unpack(record)) + # typePict returned as unknown + # typePixelMap coerced to typeAERecord + # typePixelMapMinus returned as unknown + # typeProcessSerialNumber returned as unknown + if t == typeQDPoint: + v, h = struct.unpack('hh', desc.data) + return aetypes.QDPoint(v, h) + if t == typeQDRectangle: + v0, h0, v1, h1 = struct.unpack('hhhh', desc.data) + return aetypes.QDRectangle(v0, h0, v1, h1) + if t == typeRGBColor: + r, g, b = struct.unpack('hhh', desc.data) + return aetypes.RGBColor(r, g, b) + # typeRotation coerced to typeAERecord + # typeScrapStyles returned as unknown + # typeSessionID returned as unknown + if t == typeShortFloat: + return struct.unpack('f', desc.data)[0] + if t == typeShortInteger: + return struct.unpack('h', desc.data)[0] + # typeSMFloat identical to typeShortFloat + # typeSMInt indetical to typeShortInt + # typeStyledText coerced to typeAERecord + if t == typeTargetID: + return mktargetid(desc.data) + # typeTextStyles coerced to typeAERecord + # typeTIFF returned as unknown + if t == typeTrue: + return 1 + if t == typeType: + return mktype(desc.data) + # + # The following are special + # + if t == 'rang': + record = desc.AECoerceDesc('reco') + return mkrange(unpack(record)) + if t == 'cmpd': + record = desc.AECoerceDesc('reco') + return mkcomparison(unpack(record)) + if t == 'logi': + record = desc.AECoerceDesc('reco') + return mklogical(unpack(record)) + return mkunknown(desc.type, desc.data) + +def coerce(data, egdata): + """Coerce a python object to another type using the AE coercers""" + pdata = pack(data) + pegdata = pack(egdata) + pdata = pdata.AECoerceDesc(pegdata.type) + return unpack(pdata) + +# +# Helper routines for unpack +# +def mktargetid(data): + sessionID = getlong(data[:4]) + name = mkppcportrec(data[4:4+72]) + location = mklocationnamerec(data[76:76+36]) + rcvrName = mkppcportrec(data[112:112+72]) + return sessionID, name, location, rcvrName + +def mkppcportrec(rec): + namescript = getword(rec[:2]) + name = getpstr(rec[2:2+33]) + portkind = getword(rec[36:38]) + if portkind == 1: + ctor = rec[38:42] + type = rec[42:46] + identity = (ctor, type) + else: + identity = getpstr(rec[38:38+33]) + return namescript, name, portkind, identity + +def mklocationnamerec(rec): + kind = getword(rec[:2]) + stuff = rec[2:] + if kind == 0: stuff = None + if kind == 2: stuff = getpstr(stuff) + return kind, stuff + +def mkunknown(type, data): + return aetypes.Unknown(type, data) + +def getpstr(s): + return s[1:1+ord(s[0])] + +def getlong(s): + return (ord(s[0])<<24) | (ord(s[1])<<16) | (ord(s[2])<<8) | ord(s[3]) + +def getword(s): + return (ord(s[0])<<8) | (ord(s[1])<<0) + +def mkkeyword(keyword): + return aetypes.Keyword(keyword) + +def mkrange(dict): + return aetypes.Range(dict['star'], dict['stop']) + +def mkcomparison(dict): + return aetypes.Comparison(dict['obj1'], dict['relo'].enum, dict['obj2']) + +def mklogical(dict): + return aetypes.Logical(dict['logc'], dict['term']) + +def mkstyledtext(dict): + return aetypes.StyledText(dict['ksty'], dict['ktxt']) + +def mkaetext(dict): + return aetypes.AEText(dict[keyAEScriptTag], dict[keyAEStyles], dict[keyAEText]) + +def mkinsertionloc(dict): + return aetypes.InsertionLoc(dict[keyAEObject], dict[keyAEPosition]) + +def mkobject(dict): + want = dict['want'].type + form = dict['form'].enum + seld = dict['seld'] + fr = dict['from'] + if form in ('name', 'indx', 'rang', 'test'): + if want == 'text': return aetypes.Text(seld, fr) + if want == 'cha ': return aetypes.Character(seld, fr) + if want == 'cwor': return aetypes.Word(seld, fr) + if want == 'clin': return aetypes.Line(seld, fr) + if want == 'cpar': return aetypes.Paragraph(seld, fr) + if want == 'cwin': return aetypes.Window(seld, fr) + if want == 'docu': return aetypes.Document(seld, fr) + if want == 'file': return aetypes.File(seld, fr) + if want == 'cins': return aetypes.InsertionPoint(seld, fr) + if want == 'prop' and form == 'prop' and aetypes.IsType(seld): + return aetypes.Property(seld.type, fr) + return aetypes.ObjectSpecifier(want, form, seld, fr) + +def _test(): + """Test program. Pack and unpack various things""" + objs = [ + 'a string', + 12, + 12.0, + None, + ['a', 'list', 'of', 'strings'], + {'key1': 'value1', 'key2':'value2'}, + macfs.FSSpec(':'), + macfs.FSSpec(':').NewAliasMinimal(), + aetypes.Enum('enum'), + aetypes.Type('type'), + aetypes.Keyword('kwrd'), + aetypes.Range(1, 10), + aetypes.Comparison(1, '< ', 10), + aetypes.Logical('not ', 1), + # Cannot do StyledText + # Cannot do AEText + aetypes.IntlText(0, 0, 'international text'), + aetypes.IntlWritingCode(0,0), + aetypes.QDPoint(50,100), + aetypes.QDRectangle(50,100,150,200), + aetypes.RGBColor(0x7000, 0x6000, 0x5000), + aetypes.Unknown('xxxx', 'unknown type data'), + aetypes.Character(1), + aetypes.Character(2, aetypes.Line(2)), + ] + for o in objs: + print 'BEFORE', o, `o` + packed = pack(o) + unpacked = unpack(packed) + print 'AFTER ', unpacked, `unpacked` + import sys + sys.exit(1) + +if __name__ == '__main__': + _test() + diff --git a/Mac/Lib/lib-toolbox/aetools.py b/Mac/Lib/lib-toolbox/aetools.py new file mode 100644 index 0000000..21a4237 --- /dev/null +++ b/Mac/Lib/lib-toolbox/aetools.py @@ -0,0 +1,224 @@ +"""Tools for use in AppleEvent clients and servers. + +pack(x) converts a Python object to an AEDesc object +unpack(desc) does the reverse + +packevent(event, parameters, attributes) sets params and attrs in an AEAppleEvent record +unpackevent(event) returns the parameters and attributes from an AEAppleEvent record + +Plus... Lots of classes and routines that help representing AE objects, +ranges, conditionals, logicals, etc., so you can write, e.g.: + + x = Character(1, Document("foobar")) + +and pack(x) will create an AE object reference equivalent to AppleScript's + + character 1 of document "foobar" + +Some of the stuff that appears to be exported from this module comes from other +files: the pack stuff from aepack, the objects from aetypes. + +""" + + +from types import * +import AE +import AppleEvents +import MacOS + +from aetypes import * +from aepack import pack, unpack, coerce, AEDescType + +Error = 'aetools.Error' + +# Special code to unpack an AppleEvent (which is *not* a disguised record!) +# Note by Jack: No??!? If I read the docs correctly it *is*.... + +aekeywords = [ + 'tran', + 'rtid', + 'evcl', + 'evid', + 'addr', + 'optk', + 'timo', + 'inte', # this attribute is read only - will be set in AESend + 'esrc', # this attribute is read only + 'miss', # this attribute is read only + 'from' # new in 1.0.1 +] + +def missed(ae): + try: + desc = ae.AEGetAttributeDesc('miss', 'keyw') + except AE.Error, msg: + return None + return desc.data + +def unpackevent(ae): + parameters = {} + while 1: + key = missed(ae) + if not key: break + parameters[key] = unpack(ae.AEGetParamDesc(key, '****')) + attributes = {} + for key in aekeywords: + try: + desc = ae.AEGetAttributeDesc(key, '****') + except (AE.Error, MacOS.Error), msg: + if msg[0] != -1701: + raise sys.exc_type, sys.exc_value + continue + attributes[key] = unpack(desc) + return parameters, attributes + +def packevent(ae, parameters = {}, attributes = {}): + for key, value in parameters.items(): + ae.AEPutParamDesc(key, pack(value)) + for key, value in attributes.items(): + ae.AEPutAttributeDesc(key, pack(value)) + +# +# Support routine for automatically generated Suite interfaces +# These routines are also useable for the reverse function. +# +def keysubst(arguments, keydict): + """Replace long name keys by their 4-char counterparts, and check""" + ok = keydict.values() + for k in arguments.keys(): + if keydict.has_key(k): + v = arguments[k] + del arguments[k] + arguments[keydict[k]] = v + elif k != '----' and k not in ok: + raise TypeError, 'Unknown keyword argument: %s'%k + +def enumsubst(arguments, key, edict): + """Substitute a single enum keyword argument, if it occurs""" + if not arguments.has_key(key): + return + v = arguments[key] + ok = edict.values() + if edict.has_key(v): + arguments[key] = edict[v] + elif not v in ok: + raise TypeError, 'Unknown enumerator: %s'%v + +def decodeerror(arguments): + """Create the 'best' argument for a raise MacOS.Error""" + errn = arguments['errn'] + err_a1 = errn + if arguments.has_key('errs'): + err_a2 = arguments['errs'] + else: + err_a2 = MacOS.GetErrorString(errn) + if arguments.has_key('erob'): + err_a3 = arguments['erob'] + else: + err_a3 = None + + return (err_a1, err_a2, err_a3) + +class TalkTo: + """An AE connection to an application""" + + def __init__(self, signature, start=0): + """Create a communication channel with a particular application. + + Addressing the application is done by specifying either a + 4-byte signature, an AEDesc or an object that will __aepack__ + to an AEDesc. + """ + self.target_signature = None + if type(signature) == AEDescType: + self.target = signature + elif type(signature) == InstanceType and hasattr(signature, '__aepack__'): + self.target = signature.__aepack__() + elif type(signature) == StringType and len(signature) == 4: + self.target = AE.AECreateDesc(AppleEvents.typeApplSignature, signature) + self.target_signature = signature + else: + raise TypeError, "signature should be 4-char string or AEDesc" + self.send_flags = AppleEvents.kAEWaitReply + self.send_priority = AppleEvents.kAENormalPriority + self.send_timeout = AppleEvents.kAEDefaultTimeout + if start: + self.start() + + def start(self): + """Start the application, if it is not running yet""" + import findertools + import macfs + + fss = macfs.FindApplication(self.target_signature) + findertools.launch(fss) + + def newevent(self, code, subcode, parameters = {}, attributes = {}): + """Create a complete structure for an apple event""" + + event = AE.AECreateAppleEvent(code, subcode, self.target, + AppleEvents.kAutoGenerateReturnID, AppleEvents.kAnyTransactionID) + packevent(event, parameters, attributes) + return event + + def sendevent(self, event): + """Send a pre-created appleevent, await the reply and unpack it""" + + reply = event.AESend(self.send_flags, self.send_priority, + self.send_timeout) + parameters, attributes = unpackevent(reply) + return reply, parameters, attributes + + def send(self, code, subcode, parameters = {}, attributes = {}): + """Send an appleevent given code/subcode/pars/attrs and unpack the reply""" + return self.sendevent(self.newevent(code, subcode, parameters, attributes)) + + # + # The following events are somehow "standard" and don't seem to appear in any + # suite... + # + def activate(self): + """Send 'activate' command""" + self.send('misc', 'actv') + + def _get(self, _object, as=None, _attributes={}): + """_get: get data from an object + Required argument: the object + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: the data + """ + _code = 'core' + _subcode = 'getd' + + _arguments = {'----':_object} + if as: + _arguments['rtyp'] = mktype(as) + + _reply, _arguments, _attributes = self.send(_code, _subcode, + _arguments, _attributes) + if _arguments.has_key('errn'): + raise Error, decodeerror(_arguments) + + if _arguments.has_key('----'): + return _arguments['----'] + + +# Test program +# XXXX Should test more, really... + +def test(): + target = AE.AECreateDesc('sign', 'KAHL') + ae = AE.AECreateAppleEvent('aevt', 'oapp', target, -1, 0) + print unpackevent(ae) + raw_input(":") + ae = AE.AECreateAppleEvent('core', 'getd', target, -1, 0) + obj = Character(2, Word(1, Document(1))) + print obj + print repr(obj) + packevent(ae, {'----': obj}) + params, attrs = unpackevent(ae) + print params['----'] + raw_input(":") + +if __name__ == '__main__': + test() diff --git a/Mac/Lib/lib-toolbox/aetypes.py b/Mac/Lib/lib-toolbox/aetypes.py new file mode 100644 index 0000000..3dc0d0e --- /dev/null +++ b/Mac/Lib/lib-toolbox/aetypes.py @@ -0,0 +1,541 @@ +"""aetypes - Python objects representing various AE types.""" + +from AppleEvents import * +from AERegistry import * +from AEObjects import * +import struct +from types import * +import string + +# +# convoluted, since there are cyclic dependencies between this file and +# aetools_convert. +# +def pack(*args): + from aepack import pack + return apply(pack, args) + +def IsSubclass(cls, base): + """Test whether CLASS1 is the same as or a subclass of CLASS2""" + # Loop to optimize for single inheritance + while 1: + if cls is base: return 1 + if len(cls.__bases__) <> 1: break + cls = cls.__bases__[0] + # Recurse to cope with multiple inheritance + for c in cls.__bases__: + if IsSubclass(c, base): return 1 + return 0 + +def IsInstance(x, cls): + """Test whether OBJECT is an instance of (a subclass of) CLASS""" + return type(x) is InstanceType and IsSubclass(x.__class__, cls) + +def nice(s): + """'nice' representation of an object""" + if type(s) is StringType: return repr(s) + else: return str(s) + +class Unknown: + """An uninterpreted AE object""" + + def __init__(self, type, data): + self.type = type + self.data = data + + def __repr__(self): + return "Unknown(%s, %s)" % (`self.type`, `self.data`) + + def __aepack__(self): + return pack(self.data, self.type) + +class Enum: + """An AE enumeration value""" + + def __init__(self, enum): + self.enum = "%-4.4s" % str(enum) + + def __repr__(self): + return "Enum(%s)" % `self.enum` + + def __str__(self): + return string.strip(self.enum) + + def __aepack__(self): + return pack(self.enum, typeEnumeration) + +def IsEnum(x): + return IsInstance(x, Enum) + +def mkenum(enum): + if IsEnum(enum): return enum + return Enum(enum) + +class Boolean: + """An AE boolean value""" + + def __init__(self, bool): + self.bool = (not not bool) + + def __repr__(self): + return "Boolean(%s)" % `self.bool` + + def __str__(self): + if self.bool: + return "True" + else: + return "False" + + def __aepack__(self): + return pack(struct.pack('b', self.bool), 'bool') + +def IsBoolean(x): + return IsInstance(x, Boolean) + +def mkboolean(bool): + if IsBoolean(bool): return bool + return Boolean(bool) + +class Type: + """An AE 4-char typename object""" + + def __init__(self, type): + self.type = "%-4.4s" % str(type) + + def __repr__(self): + return "Type(%s)" % `self.type` + + def __str__(self): + return string.strip(self.type) + + def __aepack__(self): + return pack(self.type, typeType) + +def IsType(x): + return IsInstance(x, Type) + +def mktype(type): + if IsType(type): return type + return Type(type) + + +class Keyword: + """An AE 4-char keyword object""" + + def __init__(self, keyword): + self.keyword = "%-4.4s" % str(keyword) + + def __repr__(self): + return "Keyword(%s)" % `self.keyword` + + def __str__(self): + return string.strip(self.keyword) + + def __aepack__(self): + return pack(self.keyword, typeKeyword) + +def IsKeyword(x): + return IsInstance(x, Keyword) + +class Range: + """An AE range object""" + + def __init__(self, start, stop): + self.start = start + self.stop = stop + + def __repr__(self): + return "Range(%s, %s)" % (`self.start`, `self.stop`) + + def __str__(self): + return "%s thru %s" % (nice(self.start), nice(self.stop)) + + def __aepack__(self): + return pack({'star': self.start, 'stop': self.stop}, 'rang') + +def IsRange(x): + return IsInstance(x, Range) + +class Comparison: + """An AE Comparison""" + + def __init__(self, obj1, relo, obj2): + self.obj1 = obj1 + self.relo = "%-4.4s" % str(relo) + self.obj2 = obj2 + + def __repr__(self): + return "Comparison(%s, %s, %s)" % (`self.obj1`, `self.relo`, `self.obj2`) + + def __str__(self): + return "%s %s %s" % (nice(self.obj1), string.strip(self.relo), nice(self.obj2)) + + def __aepack__(self): + return pack({'obj1': self.obj1, + 'relo': mkenum(self.relo), + 'obj2': self.obj2}, + 'cmpd') + +def IsComparison(x): + return IsInstance(x, Comparison) + +class NComparison(Comparison): + # The class attribute 'relo' must be set in a subclass + + def __init__(self, obj1, obj2): + Comparison.__init__(obj1, self.relo, obj2) + +class Logical: + """An AE logical expression object""" + + def __init__(self, logc, term): + self.logc = "%-4.4s" % str(logc) + self.term = term + + def __repr__(self): + return "Logical(%s, %s)" % (`self.logc`, `self.term`) + + def __str__(self): + if type(self.term) == ListType and len(self.term) == 2: + return "%s %s %s" % (nice(self.term[0]), + string.strip(self.logc), + nice(self.term[1])) + else: + return "%s(%s)" % (string.strip(self.logc), nice(self.term)) + + def __aepack__(self): + return pack({'logc': mkenum(self.logc), 'term': self.term}, 'logi') + +def IsLogical(x): + return IsInstance(x, Logical) + +class StyledText: + """An AE object respresenting text in a certain style""" + + def __init__(self, style, text): + self.style = style + self.text = text + + def __repr__(self): + return "StyledText(%s, %s)" % (`self.style`, `self.text`) + + def __str__(self): + return self.text + + def __aepack__(self): + return pack({'ksty': self.style, 'ktxt': self.text}, 'STXT') + +def IsStyledText(x): + return IsInstance(x, StyledText) + +class AEText: + """An AE text object with style, script and language specified""" + + def __init__(self, script, style, text): + self.script = script + self.style = style + self.text = text + + def __repr__(self): + return "AEText(%s, %s, %s)" % (`self.script`, `self.style`, `self.text`) + + def __str__(self): + return self.text + + def __aepack__(self): + return pack({keyAEScriptTag: self.script, keyAEStyles: self.style, + keyAEText: self.text}, typeAEText) + +def IsAEText(x): + return IsInstance(x, AEText) + +class IntlText: + """A text object with script and language specified""" + + def __init__(self, script, language, text): + self.script = script + self.language = language + self.text = text + + def __repr__(self): + return "IntlText(%s, %s, %s)" % (`self.script`, `self.language`, `self.text`) + + def __str__(self): + return self.text + + def __aepack__(self): + return pack(struct.pack('hh', self.script, self.language)+self.text, + typeIntlText) + +def IsIntlText(x): + return IsInstance(x, IntlText) + +class IntlWritingCode: + """An object representing script and language""" + + def __init__(self, script, language): + self.script = script + self.language = language + + def __repr__(self): + return "IntlWritingCode(%s, %s)" % (`self.script`, `self.language`) + + def __str__(self): + return "script system %d, language %d"%(self.script, self.language) + + def __aepack__(self): + return pack(struct.pack('hh', self.script, self.language), + typeIntlWritingCode) + +def IsIntlWritingCode(x): + return IsInstance(x, IntlWritingCode) + +class QDPoint: + """A point""" + + def __init__(self, v, h): + self.v = v + self.h = h + + def __repr__(self): + return "QDPoint(%s, %s)" % (`self.v`, `self.h`) + + def __str__(self): + return "(%d, %d)"%(self.v, self.h) + + def __aepack__(self): + return pack(struct.pack('hh', self.v, self.h), + typeQDPoint) + +def IsQDPoint(x): + return IsInstance(x, QDPoint) + +class QDRectangle: + """A rectangle""" + + def __init__(self, v0, h0, v1, h1): + self.v0 = v0 + self.h0 = h0 + self.v1 = v1 + self.h1 = h1 + + def __repr__(self): + return "QDRectangle(%s, %s, %s, %s)" % (`self.v0`, `self.h0`, + `self.v1`, `self.h1`) + + def __str__(self): + return "(%d, %d)-(%d, %d)"%(self.v0, self.h0, self.v1, self.h1) + + def __aepack__(self): + return pack(struct.pack('hhhh', self.v0, self.h0, self.v1, self.h1), + typeQDRectangle) + +def IsQDRectangle(x): + return IsInstance(x, QDRectangle) + +class RGBColor: + """An RGB color""" + + def __init__(self, r, g, b): + self.r = r + self.g = g + self.b = b + + def __repr__(self): + return "RGBColor(%s, %s, %s)" % (`self.r`, `self.g`, `self.b`) + + def __str__(self): + return "0x%x red, 0x%x green, 0x%x blue"% (self.r, self.g, self.b) + + def __aepack__(self): + return pack(struct.pack('hhh', self.r, self.g, self.b), + typeRGBColor) + +def IsRGBColor(x): + return IsInstance(x, RGBColor) + +class ObjectSpecifier: + + """A class for constructing and manipulation AE object specifiers in python. + + An object specifier is actually a record with four fields: + + key type description + --- ---- ----------- + + 'want' type 4-char class code of thing we want, + e.g. word, paragraph or property + + 'form' enum how we specify which 'want' thing(s) we want, + e.g. by index, by range, by name, or by property specifier + + 'seld' any which thing(s) we want, + e.g. its index, its name, or its property specifier + + 'from' object the object in which it is contained, + or null, meaning look for it in the application + + Note that we don't call this class plain "Object", since that name + is likely to be used by the application. + """ + + def __init__(self, want, form, seld, fr = None): + self.want = want + self.form = form + self.seld = seld + self.fr = fr + + def __repr__(self): + s = "ObjectSpecifier(%s, %s, %s" % (`self.want`, `self.form`, `self.seld`) + if self.fr: + s = s + ", %s)" % `self.fr` + else: + s = s + ")" + return s + + def __aepack__(self): + return pack({'want': mktype(self.want), + 'form': mkenum(self.form), + 'seld': self.seld, + 'from': self.fr}, + 'obj ') + +def IsObjectSpecifier(x): + return IsInstance(x, ObjectSpecifier) + + +# Backwards compatability, sigh... +class Property(ObjectSpecifier): + + def __init__(self, which, fr = None, want='prop'): + ObjectSpecifier.__init__(self, want, 'prop', mktype(which), fr) + + def __repr__(self): + if self.fr: + return "Property(%s, %s)" % (`self.seld.type`, `self.fr`) + else: + return "Property(%s)" % `self.seld.type` + + def __str__(self): + if self.fr: + return "Property %s of %s" % (str(self.seld), str(self.fr)) + else: + return "Property %s" % str(self.seld) + + +class NProperty(ObjectSpecifier): + # Subclasses *must* self baseclass attributes: + # want is the type of this property + # which is the property name of this property + + def __init__(self, fr = None): + #try: + # dummy = self.want + #except: + # self.want = 'prop' + self.want = 'prop' + ObjectSpecifier.__init__(self, self.want, 'prop', + mktype(self.which), fr) + + def __repr__(self): + rv = "Property(%s"%`self.seld.type` + if self.fr: + rv = rv + ", fr=%s" % `self.fr` + if self.want != 'prop': + rv = rv + ", want=%s" % `self.want` + return rv + ")" + + def __str__(self): + if self.fr: + return "Property %s of %s" % (str(self.seld), str(self.fr)) + else: + return "Property %s" % str(self.seld) + + +class SelectableItem(ObjectSpecifier): + + def __init__(self, want, seld, fr = None): + t = type(seld) + if t == StringType: + form = 'name' + elif IsRange(seld): + form = 'rang' + elif IsComparison(seld) or IsLogical(seld): + form = 'test' + elif t == TupleType: + # Breakout: specify both form and seld in a tuple + # (if you want ID or rele or somesuch) + form, seld = seld + else: + form = 'indx' + ObjectSpecifier.__init__(self, want, form, seld, fr) + + +class ComponentItem(SelectableItem): + # Derived classes *must* set the *class attribute* 'want' to some constant + # Also, dictionaries _propdict and _elemdict must be set to map property + # and element names to the correct classes + + def __init__(self, which, fr = None): + SelectableItem.__init__(self, self.want, which, fr) + + def __repr__(self): + if not self.fr: + return "%s(%s)" % (self.__class__.__name__, `self.seld`) + return "%s(%s, %s)" % (self.__class__.__name__, `self.seld`, `self.fr`) + + def __str__(self): + seld = self.seld + if type(seld) == StringType: + ss = repr(seld) + elif IsRange(seld): + start, stop = seld.start, seld.stop + if type(start) == InstanceType == type(stop) and \ + start.__class__ == self.__class__ == stop.__class__: + ss = str(start.seld) + " thru " + str(stop.seld) + else: + ss = str(seld) + else: + ss = str(seld) + s = "%s %s" % (self.__class__.__name__, ss) + if self.fr: s = s + " of %s" % str(self.fr) + return s + + def __getattr__(self, name): + if self._elemdict.has_key(name): + cls = self._elemdict[name] + return DelayedComponentItem(cls, self) + if self._propdict.has_key(name): + cls = self._propdict[name] + return cls(self) + raise AttributeError, name + + +class DelayedComponentItem: + def __init__(self, compclass, fr): + self.compclass = compclass + self.fr = fr + + def __call__(self, which): + return self.compclass(which, self.fr) + + def __repr__(self): + return "%s(???, %s)" % (self.__class__.__name__, `self.fr`) + + def __str__(self): + return "selector for element %s of %s"%(self.__class__.__name__, str(self.fr)) + +template = """ +class %s(ComponentItem): want = '%s' +""" + +exec template % ("Text", 'text') +exec template % ("Character", 'cha ') +exec template % ("Word", 'cwor') +exec template % ("Line", 'clin') +exec template % ("Paragraph", 'cpar') +exec template % ("Window", 'cwin') +exec template % ("Document", 'docu') +exec template % ("File", 'file') +exec template % ("InsertionPoint", 'cins') + diff --git a/Mac/Lib/toolbox/AEObjects.py b/Mac/Lib/toolbox/AEObjects.py deleted file mode 100644 index 38a8e1b..0000000 --- a/Mac/Lib/toolbox/AEObjects.py +++ /dev/null @@ -1,61 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:AEObjects.h' - -kAEAND = 'AND ' -kAEOR = 'OR ' -kAENOT = 'NOT ' -kAEFirst = 'firs' -kAELast = 'last' -kAEMiddle = 'midd' -kAEAny = 'any ' -kAEAll = 'all ' -kAENext = 'next' -kAEPrevious = 'prev' -keyAECompOperator = 'relo' -keyAELogicalTerms = 'term' -keyAELogicalOperator = 'logc' -keyAEObject1 = 'obj1' -keyAEObject2 = 'obj2' -keyAEDesiredClass = 'want' -keyAEContainer = 'from' -keyAEKeyForm = 'form' -keyAEKeyData = 'seld' -keyAERangeStart = 'star' -keyAERangeStop = 'stop' -keyDisposeTokenProc = 'xtok' -keyAECompareProc = 'cmpr' -keyAECountProc = 'cont' -keyAEMarkTokenProc = 'mkid' -keyAEMarkProc = 'mark' -keyAEAdjustMarksProc = 'adjm' -keyAEGetErrDescProc = 'indc' -formAbsolutePosition = 'indx' -formRelativePosition = 'rele' -formTest = 'test' -formRange = 'rang' -formPropertyID = 'prop' -formName = 'name' -typeObjectSpecifier = 'obj ' -typeObjectBeingExamined = 'exmn' -typeCurrentContainer = 'ccnt' -typeToken = 'toke' -typeRelativeDescriptor = 'rel ' -typeAbsoluteOrdinal = 'abso' -typeIndexDescriptor = 'inde' -typeRangeDescriptor = 'rang' -typeLogicalDescriptor = 'logi' -typeCompDescriptor = 'cmpd' -typeOSLTokenList = 'ostl' -kAEIDoMinimum = 0x0000 -kAEIDoWhose = 0x0001 -kAEIDoMarking = 0x0004 -kAEPassSubDescs = 0x0008 -kAEResolveNestedLists = 0x0010 -kAEHandleSimpleRanges = 0x0020 -kAEUseRelativeIterators = 0x0040 -typeWhoseDescriptor = 'whos' -formWhose = 'whos' -typeWhoseRange = 'wrng' -keyAEWhoseRangeStart = 'wstr' -keyAEWhoseRangeStop = 'wstp' -keyAEIndex = 'kidx' -keyAETest = 'ktst' diff --git a/Mac/Lib/toolbox/AERegistry.py b/Mac/Lib/toolbox/AERegistry.py deleted file mode 100644 index c4c918b..0000000 --- a/Mac/Lib/toolbox/AERegistry.py +++ /dev/null @@ -1,438 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:AERegistry.h' - -cAEList = 'list' -cApplication = 'capp' -cArc = 'carc' -cBoolean = 'bool' -cCell = 'ccel' -cChar = 'cha ' -cColorTable = 'clrt' -cColumn = 'ccol' -cDocument = 'docu' -cDrawingArea = 'cdrw' -cEnumeration = 'enum' -cFile = 'file' -cFixed = 'fixd' -cFixedPoint = 'fpnt' -cFixedRectangle = 'frct' -cGraphicLine = 'glin' -cGraphicObject = 'cgob' -cGraphicShape = 'cgsh' -cGraphicText = 'cgtx' -cGroupedGraphic = 'cpic' -cInsertionLoc = 'insl' -cInsertionPoint = 'cins' -cIntlText = 'itxt' -cIntlWritingCode = 'intl' -cItem = 'citm' -cLine = 'clin' -cLongDateTime = 'ldt ' -cLongFixed = 'lfxd' -cLongFixedPoint = 'lfpt' -cLongFixedRectangle = 'lfrc' -cLongInteger = 'long' -cLongPoint = 'lpnt' -cLongRectangle = 'lrct' -cMachineLoc = 'mLoc' -cMenu = 'cmnu' -cMenuItem = 'cmen' -cObject = 'cobj' -cObjectSpecifier = 'obj ' -cOpenableObject = 'coob' -cOval = 'covl' -cParagraph = 'cpar' -cPICT = 'PICT' -cPixel = 'cpxl' -cPixelMap = 'cpix' -cPolygon = 'cpgn' -cProperty = 'prop' -cQDPoint = 'QDpt' -cQDRectangle = 'qdrt' -cRectangle = 'crec' -cRGBColor = 'cRGB' -cRotation = 'trot' -cRoundedRectangle = 'crrc' -cRow = 'crow' -cSelection = 'csel' -cShortInteger = 'shor' -cTable = 'ctbl' -cText = 'ctxt' -cTextFlow = 'cflo' -cTextStyles = 'tsty' -cType = 'type' -cVersion = 'vers' -cWindow = 'cwin' -cWord = 'cwor' -enumArrows = 'arro' -enumJustification = 'just' -enumKeyForm = 'kfrm' -enumPosition = 'posi' -enumProtection = 'prtn' -enumQuality = 'qual' -enumSaveOptions = 'savo' -enumStyle = 'styl' -enumTransferMode = 'tran' -formUniqueID = 'ID ' -kAEAbout = 'abou' -kAEAfter = 'afte' -kAEAliasSelection = 'sali' -kAEAllCaps = 'alcp' -kAEArrowAtEnd = 'aren' -kAEArrowAtStart = 'arst' -kAEArrowBothEnds = 'arbo' -kAEAsk = 'ask ' -kAEBefore = 'befo' -kAEBeginning = 'bgng' -kAEBeginsWith = 'bgwt' -kAEBeginTransaction = 'begi' -kAEBold = 'bold' -kAECaseSensEquals = 'cseq' -kAECentered = 'cent' -kAEChangeView = 'view' -kAEClone = 'clon' -kAEClose = 'clos' -kAECondensed = 'cond' -kAEContains = 'cont' -kAECopy = 'copy' -kAECoreSuite = 'core' -kAECountElements = 'cnte' -kAECreateElement = 'crel' -kAECreatePublisher = 'cpub' -kAECut = 'cut ' -kAEDelete = 'delo' -kAEDoObjectsExist = 'doex' -kAEDoScript = 'dosc' -kAEDrag = 'drag' -kAEDuplicateSelection = 'sdup' -kAEEditGraphic = 'edit' -kAEEmptyTrash = 'empt' -kAEEnd = 'end ' -kAEEndsWith = 'ends' -kAEEndTransaction = 'endt' -kAEEquals = '= ' -kAEExpanded = 'pexp' -kAEFast = 'fast' -kAEFinderEvents = 'FNDR' -kAEFormulaProtect = 'fpro' -kAEFullyJustified = 'full' -kAEGetClassInfo = 'qobj' -kAEGetData = 'getd' -kAEGetDataSize = 'dsiz' -kAEGetEventInfo = 'gtei' -kAEGetInfoSelection = 'sinf' -kAEGetPrivilegeSelection = 'sprv' -kAEGetSuiteInfo = 'gtsi' -kAEGreaterThan = '> ' -kAEGreaterThanEquals = '>= ' -kAEGrow = 'grow' -kAEHidden = 'hidn' -kAEHiQuality = 'hiqu' -kAEImageGraphic = 'imgr' -kAEIsUniform = 'isun' -kAEItalic = 'ital' -kAELeftJustified = 'left' -kAELessThan = '< ' -kAELessThanEquals = '<= ' -kAELowercase = 'lowc' -kAEMakeObjectsVisible = 'mvis' -kAEMiscStandards = 'misc' -kAEModifiable = 'modf' -kAEMove = 'move' -kAENo = 'no ' -kAENoArrow = 'arno' -kAENonmodifiable = 'nmod' -kAEOpen = 'odoc' -kAEOpenSelection = 'sope' -kAEOutline = 'outl' -kAEPageSetup = 'pgsu' -kAEPaste = 'past' -kAEPlain = 'plan' -kAEPrint = 'pdoc' -kAEPrintSelection = 'spri' -kAEPrintWindow = 'pwin' -kAEPutAwaySelection = 'sput' -kAEQDAddOver = 'addo' -kAEQDAddPin = 'addp' -kAEQDAdMax = 'admx' -kAEQDAdMin = 'admn' -kAEQDBic = 'bic ' -kAEQDBlend = 'blnd' -kAEQDCopy = 'cpy ' -kAEQDNotBic = 'nbic' -kAEQDNotCopy = 'ncpy' -kAEQDNotOr = 'ntor' -kAEQDNotXor = 'nxor' -kAEQDOr = 'or ' -kAEQDSubOver = 'subo' -kAEQDSubPin = 'subp' -kAEQDSupplementalSuite = 'qdsp' -kAEQDXor = 'xor ' -kAEQuickdrawSuite = 'qdrw' -kAEQuitAll = 'quia' -kAERedo = 'redo' -kAERegular = 'regl' -kAEReplace = 'rplc' -kAERequiredSuite = 'reqd' -kAERestart = 'rest' -kAERevealSelection = 'srev' -kAERevert = 'rvrt' -kAERightJustified = 'rght' -kAESave = 'save' -kAESelect = 'slct' -kAESetData = 'setd' -kAESetPosition = 'posn' -kAEShadow = 'shad' -kAEShowClipboard = 'shcl' -kAEShutDown = 'shut' -kAESleep = 'slep' -kAESmallCaps = 'smcp' -kAESpecialClassProperties = 'c@#!' -kAEStrikethrough = 'strk' -kAESubscript = 'sbsc' -kAESuperscript = 'spsc' -kAETableSuite = 'tbls' -kAETextSuite = 'TEXT' -kAETransactionTerminated = 'ttrm' -kAEUnderline = 'undl' -kAEUndo = 'undo' -kAEWholeWordEquals = 'wweq' -kAEYes = 'yes ' -kAEZoom = 'zoom' -keyAEAngle = 'kang' -keyAEArcAngle = 'parc' -keyAEBaseAddr = 'badd' -keyAEBestType = 'pbst' -keyAEBgndColor = 'kbcl' -keyAEBgndPattern = 'kbpt' -keyAEBounds = 'pbnd' -keyAECellList = 'kclt' -keyAEClassID = 'clID' -keyAEColor = 'colr' -keyAEColorTable = 'cltb' -keyAECurveHeight = 'kchd' -keyAECurveWidth = 'kcwd' -keyAEDashStyle = 'pdst' -keyAEData = 'data' -keyAEDefaultType = 'deft' -keyAEDefinitionRect = 'pdrt' -keyAEDescType = 'dstp' -keyAEDestination = 'dest' -keyAEDoAntiAlias = 'anta' -keyAEDoDithered = 'gdit' -keyAEDoRotate = 'kdrt' -keyAEDoScale = 'ksca' -keyAEDoTranslate = 'ktra' -keyAEEditionFileLoc = 'eloc' -keyAEElements = 'elms' -keyAEEndPoint = 'pend' -keyAEEventClass = 'evcl' -keyAEEventID = 'evti' -keyAEFile = 'kfil' -keyAEFileType = 'fltp' -keyAEFillColor = 'flcl' -keyAEFillPattern = 'flpt' -keyAEFlipHorizontal = 'kfho' -keyAEFlipVertical = 'kfvt' -keyAEFont = 'font' -keyAEFormula = 'pfor' -keyAEGraphicObjects = 'gobs' -keyAEID = 'ID ' -keyAEImageQuality = 'gqua' -keyAEInsertHere = 'insh' -keyAEKeyForms = 'keyf' -keyAEKeyword = 'kywd' -keyAELevel = 'levl' -keyAELineArrow = 'arro' -keyAEName = 'pnam' -keyAENewElementLoc = 'pnel' -keyAEObject = 'kobj' -keyAEObjectClass = 'kocl' -keyAEOffStyles = 'ofst' -keyAEOnStyles = 'onst' -keyAEParameters = 'prms' -keyAEParamFlags = 'pmfg' -keyAEPenColor = 'ppcl' -keyAEPenPattern = 'pppa' -keyAEPenWidth = 'ppwd' -keyAEPixelDepth = 'pdpt' -keyAEPixMapMinus = 'kpmm' -keyAEPMTable = 'kpmt' -keyAEPointList = 'ptlt' -keyAEPointSize = 'ptsz' -keyAEPosition = 'kpos' -keyAEPropData = 'prdt' -keyAEProperties = 'qpro' -keyAEProperty = 'kprp' -keyAEPropFlags = 'prfg' -keyAEPropID = 'prop' -keyAEProtection = 'ppro' -keyAERenderAs = 'kren' -keyAERequestedType = 'rtyp' -keyAEResult = '----' -keyAEResultInfo = 'rsin' -keyAERotation = 'prot' -keyAERotPoint = 'krtp' -keyAERowList = 'krls' -keyAESaveOptions = 'savo' -keyAEScale = 'pscl' -keyAEScriptTag = 'psct' -keyAEShowWhere = 'show' -keyAEStartAngle = 'pang' -keyAEStartPoint = 'pstp' -keyAEStyles = 'ksty' -keyAESuiteID = 'suit' -keyAEText = 'ktxt' -keyAETextColor = 'ptxc' -keyAETextFont = 'ptxf' -keyAETextPointSize = 'ptps' -keyAETextStyles = 'txst' -keyAETheText = 'thtx' -keyAETransferMode = 'pptm' -keyAETranslation = 'ptrs' -keyAETryAsStructGraf = 'toog' -keyAEUniformStyles = 'ustl' -keyAEUpdateOn = 'pupd' -keyAEUserTerm = 'utrm' -keyAEWindow = 'wndw' -keyAEWritingCode = 'wrcd' -keyAETSMScriptTag = 'sclg' -keyAETSMTextFont = 'ktxf' -keyAETSMTextPointSize = 'ktps' -keyMiscellaneous = 'fmsc' -keySelection = 'fsel' -keyWindow = 'kwnd' -pArcAngle = 'parc' -pBackgroundColor = 'pbcl' -pBackgroundPattern = 'pbpt' -pBestType = 'pbst' -pBounds = 'pbnd' -pClass = 'pcls' -pClipboard = 'pcli' -pColor = 'colr' -pColorTable = 'cltb' -pContents = 'pcnt' -pCornerCurveHeight = 'pchd' -pCornerCurveWidth = 'pcwd' -pDashStyle = 'pdst' -pDefaultType = 'deft' -pDefinitionRect = 'pdrt' -pEnabled = 'enbl' -pEndPoint = 'pend' -pFillColor = 'flcl' -pFillPattern = 'flpt' -pFont = 'font' -pFormula = 'pfor' -pGraphicObjects = 'gobs' -pHasCloseBox = 'hclb' -pHasTitleBar = 'ptit' -pID = 'ID ' -pIndex = 'pidx' -pInsertionLoc = 'pins' -pIsFloating = 'isfl' -pIsFrontProcess = 'pisf' -pIsModal = 'pmod' -pIsModified = 'imod' -pIsResizable = 'prsz' -pIsStationeryPad = 'pspd' -pIsZoomable = 'iszm' -pIsZoomed = 'pzum' -pItemNumber = 'itmn' -pJustification = 'pjst' -pLineArrow = 'arro' -pMenuID = 'mnid' -pName = 'pnam' -pNewElementLoc = 'pnel' -pPenColor = 'ppcl' -pPenPattern = 'pppa' -pPenWidth = 'ppwd' -pPixelDepth = 'pdpt' -pPointList = 'ptlt' -pPointSize = 'ptsz' -pProtection = 'ppro' -pRotation = 'prot' -pScale = 'pscl' -pScript = 'scpt' -pScriptTag = 'psct' -pSelected = 'selc' -pSelection = 'sele' -pStartAngle = 'pang' -pStartPoint = 'pstp' -pTextColor = 'ptxc' -pTextFont = 'ptxf' -pTextItemDelimiters = 'txdl' -pTextPointSize = 'ptps' -pTextStyles = 'txst' -pTransferMode = 'pptm' -pTranslation = 'ptrs' -pUniformStyles = 'ustl' -pUpdateOn = 'pupd' -pUserSelection = 'pusl' -pVersion = 'vers' -pVisible = 'pvis' -typeAEText = 'tTXT' -typeArc = 'carc' -typeBest = 'best' -typeCell = 'ccel' -typeClassInfo = 'gcli' -typeColorTable = 'clrt' -typeColumn = 'ccol' -typeDashStyle = 'tdas' -typeData = 'tdta' -typeDrawingArea = 'cdrw' -typeElemInfo = 'elin' -typeEnumeration = 'enum' -typeEPS = 'EPS ' -typeEventInfo = 'evin' -typeFinderWindow = 'fwin' -typeFixedPoint = 'fpnt' -typeFixedRectangle = 'frct' -typeGraphicLine = 'glin' -typeGraphicText = 'cgtx' -typeGroupedGraphic = 'cpic' -typeInsertionLoc = 'insl' -typeIntlText = 'itxt' -typeIntlWritingCode = 'intl' -typeLongDateTime = 'ldt ' -typeLongFixed = 'lfxd' -typeLongFixedPoint = 'lfpt' -typeLongFixedRectangle = 'lfrc' -typeLongPoint = 'lpnt' -typeLongRectangle = 'lrct' -typeMachineLoc = 'mLoc' -typeOval = 'covl' -typeParamInfo = 'pmin' -typePict = 'PICT' -typePixelMap = 'cpix' -typePixMapMinus = 'tpmm' -typePolygon = 'cpgn' -typePropInfo = 'pinf' -typeQDPoint = 'QDpt' -typeRectangle = 'crec' -typeRGB16 = 'tr16' -typeRGB96 = 'tr96' -typeRGBColor = 'cRGB' -typeRotation = 'trot' -typeRoundedRectangle = 'crrc' -typeRow = 'crow' -typeScrapStyles = 'styl' -typeScript = 'scpt' -typeStyledText = 'STXT' -typeSuiteInfo = 'suin' -typeTable = 'ctbl' -typeTextStyles = 'tsty' -typeTIFF = 'TIFF' -typeVersion = 'vers' -kBySmallIcon = 0 -kByIconView = 1 -kByNameView = 2 -kByDateView = 3 -kBySizeView = 4 -kByKindView = 5 -kByCommentView = 6 -kByLabelView = 7 -kByVersionView = 8 -kAEInfo = 11 -kAEMain = 0 -kAESharing = 13 -kAEZoomIn = 7 -kAEZoomOut = 8 diff --git a/Mac/Lib/toolbox/AppleEvents.py b/Mac/Lib/toolbox/AppleEvents.py deleted file mode 100644 index c491b80..0000000 --- a/Mac/Lib/toolbox/AppleEvents.py +++ /dev/null @@ -1,104 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:AppleEvents.h' - -typeBoolean = 'bool' -typeChar = 'TEXT' -typeSMInt = 'shor' -typeInteger = 'long' -typeSMFloat = 'sing' -typeFloat = 'doub' -typeLongInteger = 'long' -typeShortInteger = 'shor' -typeLongFloat = 'doub' -typeShortFloat = 'sing' -typeExtended = 'exte' -typeComp = 'comp' -typeMagnitude = 'magn' -typeAEList = 'list' -typeAERecord = 'reco' -typeAppleEvent = 'aevt' -typeTrue = 'true' -typeFalse = 'fals' -typeAlias = 'alis' -typeEnumerated = 'enum' -typeType = 'type' -typeAppParameters = 'appa' -typeProperty = 'prop' -typeFSS = 'fss ' -typeKeyword = 'keyw' -typeSectionH = 'sect' -typeWildCard = '****' -typeApplSignature = 'sign' -typeQDRectangle = 'qdrt' -typeFixed = 'fixd' -typeSessionID = 'ssid' -typeTargetID = 'targ' -typeProcessSerialNumber = 'psn ' -typeNull = 'null' -keyDirectObject = '----' -keyErrorNumber = 'errn' -keyErrorString = 'errs' -keyProcessSerialNumber = 'psn ' -keyTransactionIDAttr = 'tran' -keyReturnIDAttr = 'rtid' -keyEventClassAttr = 'evcl' -keyEventIDAttr = 'evid' -keyAddressAttr = 'addr' -keyOptionalKeywordAttr = 'optk' -keyTimeoutAttr = 'timo' -keyInteractLevelAttr = 'inte' -keyEventSourceAttr = 'esrc' -keyMissedKeywordAttr = 'miss' -keyOriginalAddressAttr = 'from' -keyPreDispatch = 'phac' -keySelectProc = 'selh' -keyAERecorderCount = 'recr' -keyAEVersion = 'vers' -kCoreEventClass = 'aevt' -kAEOpenApplication = 'oapp' -kAEOpenDocuments = 'odoc' -kAEPrintDocuments = 'pdoc' -kAEQuitApplication = 'quit' -kAEAnswer = 'ansr' -kAEApplicationDied = 'obit' -kAENoReply = 0x00000001 -kAEQueueReply = 0x00000002 -kAEWaitReply = 0x00000003 -kAENeverInteract = 0x00000010 -kAECanInteract = 0x00000020 -kAEAlwaysInteract = 0x00000030 -kAECanSwitchLayer = 0x00000040 -kAEDontReconnect = 0x00000080 -kAEDontRecord = 0x00001000 -kAEDontExecute = 0x00002000 -kAENormalPriority = 0x00000000 -kAEStartRecording = 'reca' -kAEStopRecording = 'recc' -kAENotifyStartRecording = 'rec1' -kAENotifyStopRecording = 'rec0' -kAENotifyRecording = 'recr' -kAutoGenerateReturnID = -1 -kAnyTransactionID = 0 -kAEDefaultTimeout = -1 -kNoTimeOut = -2 -kAENoDispatch = 0 -kAEUseStandardDispatch = 0xFFFFFFFF -kAEDoNotIgnoreHandler = 0x00000000 -kAEIgnoreAppPhacHandler = 0x00000001 -kAEIgnoreAppEventHandler = 0x00000002 -kAEIgnoreSysPhacHandler = 0x00000004 -kAEIgnoreSysEventHandler = 0x00000008 -kAEIngoreBuiltInEventHandler = 0x00000010 -kAEDontDisposeOnResume = 0x80000000 -kAEInteractWithSelf = 0 -kAEInteractWithLocal = 1 -kAEInteractWithAll = 2 -kAEUnknownSource = 0 -kAEDirectCall = 1 -kAESameProcess = 2 -kAELocalProcess = 3 -kAERemoteProcess = 4 -kAEDataArray = 0 -kAEPackedArray = 1 -kAEHandleArray = 2 -kAEDescArray = 3 -kAEKeyDescArray = 4 diff --git a/Mac/Lib/toolbox/Components.py b/Mac/Lib/toolbox/Components.py deleted file mode 100644 index 338feeb..0000000 --- a/Mac/Lib/toolbox/Components.py +++ /dev/null @@ -1,35 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Components.h' - -kAppleManufacturer = 'appl' -kComponentResourceType = 'thng' -kAnyComponentType = 0 -kAnyComponentSubType = 0 -kAnyComponentManufacturer = 0 -kAnyComponentFlagsMask = 0 -cmpWantsRegisterMessage = 1L << 31 -kComponentOpenSelect = -1 -kComponentCloseSelect = -2 -kComponentCanDoSelect = -3 -kComponentVersionSelect = -4 -kComponentRegisterSelect = -5 -kComponentTargetSelect = -6 -kComponentUnregisterSelect = -7 -kComponentGetMPWorkFunctionSelect = -8 -defaultComponentIdentical = 0 -defaultComponentAnyFlags = 1 -defaultComponentAnyManufacturer = 2 -defaultComponentAnySubType = 4 -registerComponentGlobal = 1 -registerComponentNoDuplicates = 2 -registerComponentAfterExisting = 4 -uppComponentFunctionImplementedProcInfo = 0x000002F0 -uppGetComponentVersionProcInfo = 0x000000F0 -uppComponentSetTargetProcInfo = 0x000003F0 -uppCallComponentOpenProcInfo = 0x000003F0 -uppCallComponentCloseProcInfo = 0x000003F0 -uppCallComponentCanDoProcInfo = 0x000002F0 -uppCallComponentVersionProcInfo = 0x000000F0 -uppCallComponentRegisterProcInfo = 0x000000F0 -uppCallComponentTargetProcInfo = 0x000003F0 -uppCallComponentUnregisterProcInfo = 0x000000F0 -uppCallComponentGetMPWorkFunctionProcInfo = 0x00000FF0 diff --git a/Mac/Lib/toolbox/Controls.py b/Mac/Lib/toolbox/Controls.py deleted file mode 100644 index aa150f5..0000000 --- a/Mac/Lib/toolbox/Controls.py +++ /dev/null @@ -1,89 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Controls.h' - -pushButProc = 0 -checkBoxProc = 1 -radioButProc = 2 -scrollBarProc = 16 -popupMenuProc = 1008 -kControlUsesOwningWindowsFontVariant = 1 << 3 -kControlNoPart = 0 -kControlLabelPart = 1 -kControlMenuPart = 2 -kControlTrianglePart = 4 -kControlButtonPart = 10 -kControlCheckBoxPart = 11 -kControlRadioButtonPart = 11 -kControlUpButtonPart = 20 -kControlDownButtonPart = 21 -kControlPageUpPart = 22 -kControlPageDownPart = 23 -kControlIndicatorPart = 129 -kControlDisabledPart = 254 -kControlInactivePart = 255 -kControlCheckboxUncheckedValue = 0 -kControlCheckboxCheckedValue = 1 -kControlCheckboxMixedValue = 2 -kControlRadioButtonUncheckedValue = 0 -kControlRadioButtonCheckedValue = 1 -kControlRadioButtonMixedValue = 2 -popupFixedWidth = 1 << 0 -popupVariableWidth = 1 << 1 -popupUseAddResMenu = 1 << 2 -popupUseWFont = 1 << 3 -popupTitleBold = 1 << 8 -popupTitleItalic = 1 << 9 -popupTitleUnderline = 1 << 10 -popupTitleOutline = 1 << 11 -popupTitleShadow = 1 << 12 -popupTitleCondense = 1 << 13 -popupTitleExtend = 1 << 14 -popupTitleNoStyle = 1 << 15 -popupTitleLeftJust = 0x00000000 -popupTitleCenterJust = 0x00000001 -popupTitleRightJust = 0x000000FF -hAxisOnly = 1 -vAxisOnly = 2 -cFrameColor = 0 -cBodyColor = 1 -cTextColor = 2 -cThumbColor = 3 -drawCntl = 0 -testCntl = 1 -calcCRgns = 2 -initCntl = 3 -dispCntl = 4 -posCntl = 5 -thumbCntl = 6 -dragCntl = 7 -autoTrack = 8 -calcCntlRgn = 10 -calcThumbRgn = 11 -drawThumbOutline = 12 -kDrawControlEntireControl = 0 -kDrawControlIndicatorOnly = 129 -kDragControlEntireControl = 0 -kDragControlIndicator = 1 -useWFont = 8 -inLabel = 1 -inMenu = 2 -inTriangle = 4 -inButton = 10 -inCheckBox = 11 -inUpButton = 20 -inDownButton = 21 -inPageUp = 22 -inPageDown = 23 -inThumb = 129 -kNoHiliteControlPart = 0 -kInLabelControlPart = 1 -kInMenuControlPart = 2 -kInTriangleControlPart = 4 -kInButtonControlPart = 10 -kInCheckBoxControlPart = 11 -kInUpButtonControlPart = 20 -kInDownButtonControlPart = 21 -kInPageUpControlPart = 22 -kInPageDownControlPart = 23 -kInIndicatorControlPart = 129 -kReservedControlPart = 254 -kControlInactiveControlPart = 255 diff --git a/Mac/Lib/toolbox/Dialogs.py b/Mac/Lib/toolbox/Dialogs.py deleted file mode 100644 index 893feda..0000000 --- a/Mac/Lib/toolbox/Dialogs.py +++ /dev/null @@ -1,21 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Dialogs.h' - -ctrlItem = 4 -btnCtrl = 0 -chkCtrl = 1 -radCtrl = 2 -resCtrl = 3 -statText = 8 -editText = 16 -iconItem = 32 -picItem = 64 -userItem = 0 -itemDisable = 128 -ok = 1 -cancel = 2 -stopIcon = 0 -noteIcon = 1 -cautionIcon = 2 -overlayDITL = 0 -appendDITLRight = 1 -appendDITLBottom = 2 diff --git a/Mac/Lib/toolbox/Events.py b/Mac/Lib/toolbox/Events.py deleted file mode 100644 index 7f66525..0000000 --- a/Mac/Lib/toolbox/Events.py +++ /dev/null @@ -1,64 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Events.h' - -nullEvent = 0 -mouseDown = 1 -mouseUp = 2 -keyDown = 3 -keyUp = 4 -autoKey = 5 -updateEvt = 6 -diskEvt = 7 -activateEvt = 8 -osEvt = 15 -kHighLevelEvent = 23 -mDownMask = 0x0002 -mUpMask = 0x0004 -keyDownMask = 0x0008 -keyUpMask = 0x0010 -autoKeyMask = 0x0020 -updateMask = 0x0040 -diskMask = 0x0080 -activMask = 0x0100 -highLevelEventMask = 0x0400 -osMask = 0x8000 -everyEvent = 0xFFFF -charCodeMask = 0x000000FF -keyCodeMask = 0x0000FF00 -adbAddrMask = 0x00FF0000 -osEvtMessageMask = 0xFF000000L -mouseMovedMessage = 0x00FA -suspendResumeMessage = 0x0001 -resumeFlag = 1 -convertClipboardFlag = 2 -activeFlag = 0x0001 -btnState = 0x0080 -cmdKey = 0x0100 -shiftKey = 0x0200 -alphaLock = 0x0400 -optionKey = 0x0800 -controlKey = 0x1000 -rightShiftKey = 0x2000 -rightOptionKey = 0x4000 -rightControlKey = 0x8000 -activeFlagBit = 0 -btnStateBit = 7 -cmdKeyBit = 8 -shiftKeyBit = 9 -alphaLockBit = 10 -optionKeyBit = 11 -controlKeyBit = 12 -rightShiftKeyBit = 13 -rightOptionKeyBit = 14 -rightControlKeyBit = 15 -networkEvt = 10 -driverEvt = 11 -app1Evt = 12 -app2Evt = 13 -app3Evt = 14 -app4Evt = 15 -networkMask = 0x0400 -driverMask = 0x0800 -app1Mask = 0x1000 -app2Mask = 0x2000 -app3Mask = 0x4000 -app4Mask = 0x8000 diff --git a/Mac/Lib/toolbox/Fonts.py b/Mac/Lib/toolbox/Fonts.py deleted file mode 100644 index 9823046..0000000 --- a/Mac/Lib/toolbox/Fonts.py +++ /dev/null @@ -1,32 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Fonts.h' - -systemFont = 0 -applFont = 1 -newYork = 2 -geneva = 3 -monaco = 4 -venice = 5 -london = 6 -athens = 7 -sanFran = 8 -toronto = 9 -cairo = 11 -losAngeles = 12 -times = 20 -helvetica = 21 -courier = 22 -symbol = 23 -mobile = 24 -commandMark = 17 -checkMark = 18 -diamondMark = 19 -appleMark = 20 -propFont = 36864 -prpFntH = 36865 -prpFntW = 36866 -prpFntHW = 36867 -fixedFont = 45056 -fxdFntH = 45057 -fxdFntW = 45058 -fxdFntHW = 45059 -fontWid = 44208 diff --git a/Mac/Lib/toolbox/Lists.py b/Mac/Lib/toolbox/Lists.py deleted file mode 100644 index 4469b5b..0000000 --- a/Mac/Lib/toolbox/Lists.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Lists.h' - -lDoVAutoscroll = 2 -lDoHAutoscroll = 1 -lOnlyOne = -128 -lExtendDrag = 64 -lNoDisjoint = 32 -lNoExtend = 16 -lNoRect = 8 -lUseSense = 4 -lNoNilHilite = 2 -lDoVAutoscrollBit = 1 -lDoHAutoscrollBit = 0 -lOnlyOneBit = 7 -lExtendDragBit = 6 -lNoDisjointBit = 5 -lNoExtendBit = 4 -lNoRectBit = 3 -lUseSenseBit = 2 -lNoNilHiliteBit = 1 -lInitMsg = 0 -lDrawMsg = 1 -lHiliteMsg = 2 -lCloseMsg = 3 diff --git a/Mac/Lib/toolbox/Menus.py b/Mac/Lib/toolbox/Menus.py deleted file mode 100644 index e33f81b..0000000 --- a/Mac/Lib/toolbox/Menus.py +++ /dev/null @@ -1,14 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Menus.h' - -noMark = 0 -mDrawMsg = 0 -mChooseMsg = 1 -mSizeMsg = 2 -mDrawItemMsg = 4 -mCalcItemMsg = 5 -textMenuProc = 0 -hMenuCmd = 27 -hierMenu = -1 -mPopUpMsg = 3 -mctAllItems = -98 -mctLastIDIndic = -99 diff --git a/Mac/Lib/toolbox/MiniAEFrame.py b/Mac/Lib/toolbox/MiniAEFrame.py deleted file mode 100644 index 549b3ee..0000000 --- a/Mac/Lib/toolbox/MiniAEFrame.py +++ /dev/null @@ -1,176 +0,0 @@ -"""MiniAEFrame - A first stab at an AE Application framework. -This framework is still work-in-progress, so do not rely on it remaining -unchanged. -""" - -import sys -import traceback -import MacOS -import AE -from AppleEvents import * -import Evt -from Events import * -import Menu -import Win -from Windows import * -import Qd - -import aetools -import EasyDialogs - -kHighLevelEvent = 23 # Not defined anywhere for Python yet? - -class MiniApplication: - """A minimal FrameWork.Application-like class""" - - def __init__(self): - self.quitting = 0 - # Initialize menu - self.appleid = 1 - self.quitid = 2 - Menu.ClearMenuBar() - self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") - applemenu.AppendMenu("All about cgitest...;(-") - applemenu.AppendResMenu('DRVR') - applemenu.InsertMenu(0) - self.quitmenu = Menu.NewMenu(self.quitid, "File") - self.quitmenu.AppendMenu("Quit") - self.quitmenu.InsertMenu(0) - Menu.DrawMenuBar() - - def __del__(self): - self.close() - - def close(self): - pass - - def mainloop(self, mask = everyEvent, timeout = 60*60): - while not self.quitting: - self.dooneevent(mask, timeout) - - def _quit(self): - self.quitting = 1 - - def dooneevent(self, mask = everyEvent, timeout = 60*60): - got, event = Evt.WaitNextEvent(mask, timeout) - if got: - self.lowlevelhandler(event) - - def lowlevelhandler(self, event): - what, message, when, where, modifiers = event - h, v = where - if what == kHighLevelEvent: - msg = "High Level Event: %s %s" % \ - (`code(message)`, `code(h | (v<<16))`) - try: - AE.AEProcessAppleEvent(event) - except AE.Error, err: - print 'AE error: ', err - print 'in', msg - traceback.print_exc() - return - elif what == keyDown: - c = chr(message & charCodeMask) - if c == '.' and modifiers & cmdKey: - raise KeyboardInterrupt, "Command-period" - elif what == mouseDown: - partcode, window = Win.FindWindow(where) - if partcode == inMenuBar: - result = Menu.MenuSelect(where) - id = (result>>16) & 0xffff # Hi word - item = result & 0xffff # Lo word - if id == self.appleid: - if item == 1: - EasyDialogs.Message("cgitest - First cgi test") - return - elif item > 1: - name = self.applemenu.GetItem(item) - Qd.OpenDeskAcc(name) - return - if id == self.quitid and item == 1: - print "Menu-requested QUIT" - self.quitting = 1 - # Anything not handled is passed to Python/SIOUX - MacOS.HandleEvent(event) - -class AEServer: - - def __init__(self): - self.ae_handlers = {} - - def installaehandler(self, classe, type, callback): - AE.AEInstallEventHandler(classe, type, self.callback_wrapper) - self.ae_handlers[(classe, type)] = callback - - def close(self): - for classe, type in self.ae_handlers.keys(): - AE.AERemoveEventHandler(classe, type) - - def callback_wrapper(self, _request, _reply): - _parameters, _attributes = aetools.unpackevent(_request) - _class = _attributes['evcl'].type - _type = _attributes['evid'].type - - if self.ae_handlers.has_key((_class, _type)): - _function = self.ae_handlers[(_class, _type)] - elif self.ae_handlers.has_key((_class, '****')): - _function = self.ae_handlers[(_class, '****')] - elif self.ae_handlers.has_key(('****', '****')): - _function = self.ae_handlers[('****', '****')] - else: - raise 'Cannot happen: AE callback without handler', (_class, _type) - - # XXXX Do key-to-name mapping here - - _parameters['_attributes'] = _attributes - _parameters['_class'] = _class - _parameters['_type'] = _type - if _parameters.has_key('----'): - _object = _parameters['----'] - del _parameters['----'] - print 'XXX', (_function, (_object,), _parameters) - try: - rv = apply(_function, (_object,), _parameters) - except TypeError, name: - raise TypeError, ('AppleEvent handler misses formal keyword argument', _function, name) - else: - try: - rv = apply(_function, (), _parameters) - except TypeError, name: - raise TypeError, ('AppleEvent handler misses formal keyword argument', _function, name) - - if rv == None: - aetools.packevent(_reply, {}) - else: - aetools.packevent(_reply, {'----':rv}) - -def code(x): - "Convert a long int to the 4-character code it really is" - s = '' - for i in range(4): - x, c = divmod(x, 256) - s = chr(c) + s - return s - -class _Test(AEServer, MiniApplication): - """Mini test application, handles required events""" - - def __init__(self): - MiniApplication.__init__(self) - AEServer.__init__(self) - self.installaehandler('aevt', 'oapp', self.open_app) - self.installaehandler('aevt', 'quit', self.quit) - self.installaehandler('aevt', '****', self.other) - self.mainloop() - - def quit(self, **args): - self._quit() - - def open_app(self, **args): - pass - - def other(self, _object=None, _class=None, _type=None, **args): - print 'AppleEvent', (_class, _type), 'for', _object, 'Other args:', args - -if __name__ == '__main__': - _Test() diff --git a/Mac/Lib/toolbox/QuickDraw.py b/Mac/Lib/toolbox/QuickDraw.py deleted file mode 100644 index dc8b002..0000000 --- a/Mac/Lib/toolbox/QuickDraw.py +++ /dev/null @@ -1,113 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDraw.h' - -invalColReq = -1 -srcCopy = 0 -srcOr = 1 -srcXor = 2 -srcBic = 3 -notSrcCopy = 4 -notSrcOr = 5 -notSrcXor = 6 -notSrcBic = 7 -patCopy = 8 -patOr = 9 -patXor = 10 -patBic = 11 -notPatCopy = 12 -notPatOr = 13 -notPatXor = 14 -notPatBic = 15 -grayishTextOr = 49 -hilitetransfermode = 50 -blend = 32 -addPin = 33 -addOver = 34 -subPin = 35 -addMax = 37 -adMax = 37 -subOver = 38 -adMin = 39 -ditherCopy = 64 -transparent = 36 -italicBit = 1 -ulineBit = 2 -outlineBit = 3 -shadowBit = 4 -condenseBit = 5 -extendBit = 6 -normalBit = 0 -inverseBit = 1 -redBit = 4 -greenBit = 3 -blueBit = 2 -cyanBit = 8 -magentaBit = 7 -yellowBit = 6 -blackBit = 5 -blackColor = 33 -whiteColor = 30 -redColor = 205 -greenColor = 341 -blueColor = 409 -cyanColor = 273 -magentaColor = 137 -yellowColor = 69 -picLParen = 0 -picRParen = 1 -clutType = 0 -fixedType = 1 -directType = 2 -gdDevType = 0 -interlacedDevice = 2 -roundedDevice = 5 -hasAuxMenuBar = 6 -burstDevice = 7 -ext32Device = 8 -ramInit = 10 -mainScreen = 11 -allInit = 12 -screenDevice = 13 -noDriver = 14 -screenActive = 15 -hiliteBit = 7 -pHiliteBit = 0 -defQDColors = 127 -RGBDirect = 16 -baseAddr32 = 4 -sysPatListID = 0 -iBeamCursor = 1 -crossCursor = 2 -plusCursor = 3 -watchCursor = 4 -kQDGrafVerbFrame = 0 -kQDGrafVerbPaint = 1 -kQDGrafVerbErase = 2 -kQDGrafVerbInvert = 3 -kQDGrafVerbFill = 4 -singleDevicesBit = 0 -dontMatchSeedsBit = 1 -allDevicesBit = 2 -singleDevices = 1 << singleDevicesBit -dontMatchSeeds = 1 << dontMatchSeedsBit -allDevices = 1 << allDevicesBit -kNoConstraint = 0 -kVerticalConstraint = 1 -kHorizontalConstraint = 2 -kCursorImageMajorVersion = 0x0001 -kCursorImageMinorVersion = 0x0000 -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDrawText.h' - -leftCaret = 0 -rightCaret = -1 -hilite = 1 -smLeftCaret = 0 -smRightCaret = -1 -smHilite = 1 -onlyStyleRun = 0 -leftStyleRun = 1 -rightStyleRun = 2 -middleStyleRun = 3 -smOnlyStyleRun = 0 -smLeftStyleRun = 1 -smRightStyleRun = 2 -smMiddleStyleRun = 3 diff --git a/Mac/Lib/toolbox/QuickTime.py b/Mac/Lib/toolbox/QuickTime.py deleted file mode 100644 index 078ae1d..0000000 --- a/Mac/Lib/toolbox/QuickTime.py +++ /dev/null @@ -1,386 +0,0 @@ -# Generated from 'sap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Movies.h' - -MovieFileType = 'MooV' -MediaHandlerType = 'mhlr' -DataHandlerType = 'dhlr' -VideoMediaType = 'vide' -SoundMediaType = 'soun' -TextMediaType = 'text' -BaseMediaType = 'gnrc' -MPEGMediaType = 'MPEG' -MusicMediaType = 'musi' -TimeCodeMediaType = 'tmcd' -SpriteMediaType = 'sprt' -TweenMediaType = 'twen' -ThreeDeeMediaType = 'qd3d' -HandleDataHandlerSubType = 'hndl' -ResourceDataHandlerSubType = 'rsrc' -VisualMediaCharacteristic = 'eyes' -AudioMediaCharacteristic = 'ears' -kCharacteristicCanSendVideo = 'vsnd' -DoTheRightThing = 0 -kMusicFlagDontPlay2Soft = 1L << 0 -dfDontDisplay = 1 << 0 -dfDontAutoScale = 1 << 1 -dfClipToTextBox = 1 << 2 -dfUseMovieBGColor = 1 << 3 -dfShrinkTextBoxToFit = 1 << 4 -dfScrollIn = 1 << 5 -dfScrollOut = 1 << 6 -dfHorizScroll = 1 << 7 -dfReverseScroll = 1 << 8 -dfContinuousScroll = 1 << 9 -dfFlowHoriz = 1 << 10 -dfContinuousKaraoke = 1 << 11 -dfDropShadow = 1 << 12 -dfAntiAlias = 1 << 13 -dfKeyedText = 1 << 14 -dfInverseHilite = 1 << 15 -dfTextColorHilite = 1 << 16 -searchTextDontGoToFoundTime = 1L << 16 -searchTextDontHiliteFoundText = 1L << 17 -searchTextOneTrackOnly = 1L << 18 -searchTextEnabledTracksOnly = 1L << 19 -k3DMediaRendererEntry = 'rend' -k3DMediaRendererName = 'name' -k3DMediaRendererCode = 'rcod' -movieProgressOpen = 0 -movieProgressUpdatePercent = 1 -movieProgressClose = 2 -progressOpFlatten = 1 -progressOpInsertTrackSegment = 2 -progressOpInsertMovieSegment = 3 -progressOpPaste = 4 -progressOpAddMovieSelection = 5 -progressOpCopy = 6 -progressOpCut = 7 -progressOpLoadMovieIntoRam = 8 -progressOpLoadTrackIntoRam = 9 -progressOpLoadMediaIntoRam = 10 -progressOpImportMovie = 11 -progressOpExportMovie = 12 -mediaQualityDraft = 0x0000 -mediaQualityNormal = 0x0040 -mediaQualityBetter = 0x0080 -mediaQualityBest = 0x00C0 -loopTimeBase = 1 -palindromeLoopTimeBase = 2 -maintainTimeBaseZero = 4 -triggerTimeFwd = 0x0001 -triggerTimeBwd = 0x0002 -triggerTimeEither = 0x0003 -triggerRateLT = 0x0004 -triggerRateGT = 0x0008 -triggerRateEqual = 0x0010 -triggerRateChange = 0 -triggerAtStart = 0x0001 -triggerAtStop = 0x0002 -timeBaseBeforeStartTime = 1 -timeBaseAfterStopTime = 2 -callBackAtTime = 1 -callBackAtRate = 2 -callBackAtTimeJump = 3 -callBackAtExtremes = 4 -callBackAtInterrupt = 0x8000 -callBackAtDeferredTask = 0x4000 -qtcbNeedsRateChanges = 1 -qtcbNeedsTimeChanges = 2 -qtcbNeedsStartStopChanges = 4 -keepInRam = 1 << 0 -unkeepInRam = 1 << 1 -flushFromRam = 1 << 2 -loadForwardTrackEdits = 1 << 3 -loadBackwardTrackEdits = 1 << 4 -newMovieActive = 1 << 0 -newMovieDontResolveDataRefs = 1 << 1 -newMovieDontAskUnresolvedDataRefs = 1 << 2 -newMovieDontAutoAlternates = 1 << 3 -newMovieDontUpdateForeBackPointers = 1 << 4 -trackUsageInMovie = 1 << 1 -trackUsageInPreview = 1 << 2 -trackUsageInPoster = 1 << 3 -mediaSampleNotSync = 1 << 0 -mediaSampleShadowSync = 1 << 1 -pasteInParallel = 1 << 0 -showUserSettingsDialog = 1 << 1 -movieToFileOnlyExport = 1 << 2 -movieFileSpecValid = 1 << 3 -nextTimeMediaSample = 1 << 0 -nextTimeMediaEdit = 1 << 1 -nextTimeTrackEdit = 1 << 2 -nextTimeSyncSample = 1 << 3 -nextTimeStep = 1 << 4 -nextTimeEdgeOK = 1 << 14 -nextTimeIgnoreActiveSegment = 1 << 15 -createMovieFileDeleteCurFile = 1L << 31 -createMovieFileDontCreateMovie = 1L << 30 -createMovieFileDontOpenFile = 1L << 29 -flattenAddMovieToDataFork = 1L << 0 -flattenActiveTracksOnly = 1L << 2 -flattenDontInterleaveFlatten = 1L << 3 -flattenFSSpecPtrIsDataRefRecordPtr = 1L << 4 -movieInDataForkResID = -1 -mcTopLeftMovie = 1 << 0 -mcScaleMovieToFit = 1 << 1 -mcWithBadge = 1 << 2 -mcNotVisible = 1 << 3 -mcWithFrame = 1 << 4 -movieScrapDontZeroScrap = 1 << 0 -movieScrapOnlyPutMovie = 1 << 1 -dataRefSelfReference = 1 << 0 -dataRefWasNotResolved = 1 << 1 -hintsScrubMode = 1 << 0 -hintsLoop = 1 << 1 -hintsDontPurge = 1 << 2 -hintsUseScreenBuffer = 1 << 5 -hintsAllowInterlace = 1 << 6 -hintsUseSoundInterp = 1 << 7 -hintsHighQuality = 1 << 8 -hintsPalindrome = 1 << 9 -hintsInactive = 1 << 11 -mediaHandlerFlagBaseClient = 1 -movieTrackMediaType = 1 << 0 -movieTrackCharacteristic = 1 << 1 -movieTrackEnabledOnly = 1 << 2 -movieDrawingCallWhenChanged = 0 -movieDrawingCallAlways = 1 -preloadAlways = 1L << 0 -preloadOnlyIfEnabled = 1L << 1 -fullScreenHideCursor = 1L << 0 -fullScreenAllowEvents = 1L << 1 -fullScreenDontChangeMenuBar = 1L << 2 -fullScreenPreflightSize = 1L << 3 -kBackgroundSpriteLayerNum = 32767 -kSpritePropertyMatrix = 1 -kSpritePropertyImageDescription = 2 -kSpritePropertyImageDataPtr = 3 -kSpritePropertyVisible = 4 -kSpritePropertyLayer = 5 -kSpritePropertyGraphicsMode = 6 -kSpritePropertyImageIndex = 100 -kSpriteTrackPropertyBackgroundColor = 101 -kSpriteTrackPropertyOffscreenBitDepth = 102 -kSpriteTrackPropertySampleFormat = 103 -kOnlyDrawToSpriteWorld = 1L << 0 -kSpriteWorldPreflight = 1L << 1 -kSpriteWorldDidDraw = 1L << 0 -kSpriteWorldNeedsToDraw = 1L << 1 -kKeyFrameAndSingleOverride = 1L << 1 -kKeyFrameAndAllOverrides = 1L << 2 -kParentAtomIsContainer = 0 -kITextRemoveEverythingBut = 0 << 1 -kITextRemoveLeaveSuggestedAlternate = 1 << 1 -kITextAtomType = 'itxt' -kITextStringAtomType = 'text' -kTrackModifierInput = 0x696E -kTrackModifierType = 0x7479 -kTrackModifierReference = 'ssrc' -kTrackModifierObjectID = 'obid' -kTrackModifierInputName = 'name' -kInputMapSubInputID = 'subi' -kTrackModifierTypeMatrix = 1 -kTrackModifierTypeClip = 2 -kTrackModifierTypeGraphicsMode = 5 -kTrackModifierTypeVolume = 3 -kTrackModifierTypeBalance = 4 -kTrackModifierTypeSpriteImage = 'vide' -kTrackModifierObjectMatrix = 6 -kTrackModifierObjectGraphicsMode = 7 -kTrackModifierType3d4x4Matrix = 8 -kTrackModifierCameraData = 9 -kTrackModifierSoundLocalizationData = 10 -kTweenTypeShort = 1 -kTweenTypeLong = 2 -kTweenTypeFixed = 3 -kTweenTypePoint = 4 -kTweenTypeQDRect = 5 -kTweenTypeQDRegion = 6 -kTweenTypeMatrix = 7 -kTweenTypeRGBColor = 8 -kTweenTypeGraphicsModeWithRGBColor = 9 -kTweenType3dScale = '3sca' -kTweenType3dTranslate = '3tra' -kTweenType3dRotate = '3rot' -kTweenType3dRotateAboutPoint = '3rap' -kTweenType3dRotateAboutAxis = '3rax' -kTweenType3dQuaternion = '3qua' -kTweenType3dMatrix = '3mat' -kTweenType3dCameraData = '3cam' -kTweenType3dSoundLocalizationData = '3slc' -kTweenEntry = 'twen' -kTweenData = 'data' -kTweenType = 'twnt' -kTweenStartOffset = 'twst' -kTweenDuration = 'twdu' -kTween3dInitialCondition = 'icnd' -kTweenInterpolationStyle = 'isty' -kTweenRegionData = 'qdrg' -kTweenPictureData = 'PICT' -internalComponentErr = -2070 -notImplementedMusicOSErr = -2071 -cantSendToSynthesizerOSErr = -2072 -cantReceiveFromSynthesizerOSErr = -2073 -illegalVoiceAllocationOSErr = -2074 -illegalPartOSErr = -2075 -illegalChannelOSErr = -2076 -illegalKnobOSErr = -2077 -illegalKnobValueOSErr = -2078 -illegalInstrumentOSErr = -2079 -illegalControllerOSErr = -2080 -midiManagerAbsentOSErr = -2081 -synthesizerNotRespondingOSErr = -2082 -synthesizerOSErr = -2083 -illegalNoteChannelOSErr = -2084 -noteChannelNotAllocatedOSErr = -2085 -tunePlayerFullOSErr = -2086 -tuneParseOSErr = -2087 -videoFlagDontLeanAhead = 1L << 0 -txtProcDefaultDisplay = 0 -txtProcDontDisplay = 1 -txtProcDoDisplay = 2 -findTextEdgeOK = 1 << 0 -findTextCaseSensitive = 1 << 1 -findTextReverseSearch = 1 << 2 -findTextWrapAround = 1 << 3 -findTextUseOffset = 1 << 4 -dropShadowOffsetType = 'drpo' -dropShadowTranslucencyType = 'drpt' -spriteHitTestBounds = 1L << 0 -spriteHitTestImage = 1L << 1 -kSpriteAtomType = 'sprt' -kSpriteImagesContainerAtomType = 'imct' -kSpriteImageAtomType = 'imag' -kSpriteImageDataAtomType = 'imda' -kSpriteSharedDataAtomType = 'dflt' -kSpriteNameAtomType = 'name' -MovieControllerComponentType = 'play' -mcActionIdle = 1 -mcActionDraw = 2 -mcActionActivate = 3 -mcActionDeactivate = 4 -mcActionMouseDown = 5 -mcActionKey = 6 -mcActionPlay = 8 -mcActionGoToTime = 12 -mcActionSetVolume = 14 -mcActionGetVolume = 15 -mcActionStep = 18 -mcActionSetLooping = 21 -mcActionGetLooping = 22 -mcActionSetLoopIsPalindrome = 23 -mcActionGetLoopIsPalindrome = 24 -mcActionSetGrowBoxBounds = 25 -mcActionControllerSizeChanged = 26 -mcActionSetSelectionBegin = 29 -mcActionSetSelectionDuration = 30 -mcActionSetKeysEnabled = 32 -mcActionGetKeysEnabled = 33 -mcActionSetPlaySelection = 34 -mcActionGetPlaySelection = 35 -mcActionSetUseBadge = 36 -mcActionGetUseBadge = 37 -mcActionSetFlags = 38 -mcActionGetFlags = 39 -mcActionSetPlayEveryFrame = 40 -mcActionGetPlayEveryFrame = 41 -mcActionGetPlayRate = 42 -mcActionShowBalloon = 43 -mcActionBadgeClick = 44 -mcActionMovieClick = 45 -mcActionSuspend = 46 -mcActionResume = 47 -mcActionSetControllerKeysEnabled = 48 -mcActionGetTimeSliderRect = 49 -mcActionMovieEdited = 50 -mcActionGetDragEnabled = 51 -mcActionSetDragEnabled = 52 -mcActionGetSelectionBegin = 53 -mcActionGetSelectionDuration = 54 -mcActionPrerollAndPlay = 55 -mcActionGetCursorSettingEnabled = 56 -mcActionSetCursorSettingEnabled = 57 -mcActionSetColorTable = 58 -mcFlagSuppressMovieFrame = 1 << 0 -mcFlagSuppressStepButtons = 1 << 1 -mcFlagSuppressSpeakerButton = 1 << 2 -mcFlagsUseWindowPalette = 1 << 3 -mcFlagsDontInvalidate = 1 << 4 -mcPositionDontInvalidate = 1 << 5 -mcInfoUndoAvailable = 1 << 0 -mcInfoCutAvailable = 1 << 1 -mcInfoCopyAvailable = 1 << 2 -mcInfoPasteAvailable = 1 << 3 -mcInfoClearAvailable = 1 << 4 -mcInfoHasSound = 1 << 5 -mcInfoIsPlaying = 1 << 6 -mcInfoIsLooping = 1 << 7 -mcInfoIsInPalindrome = 1 << 8 -mcInfoEditingEnabled = 1 << 9 -mcInfoMovieIsInteractive = 1 << 10 -mcMenuUndo = 1 -mcMenuCut = 3 -mcMenuCopy = 4 -mcMenuPaste = 5 -mcMenuClear = 6 -kVideoMediaResetStatisticsSelect = 0x0105 -kVideoMediaGetStatisticsSelect = 0x0106 -kTextMediaSetTextProcSelect = 0x0101 -kTextMediaAddTextSampleSelect = 0x0102 -kTextMediaAddTESampleSelect = 0x0103 -kTextMediaAddHiliteSampleSelect = 0x0104 -kTextMediaFindNextTextSelect = 0x0105 -kTextMediaHiliteTextSampleSelect = 0x0106 -kTextMediaSetTextSampleDataSelect = 0x0107 -kSpriteMediaSetPropertySelect = 0x0101 -kSpriteMediaGetPropertySelect = 0x0102 -kSpriteMediaHitTestSpritesSelect = 0x0103 -kSpriteMediaCountSpritesSelect = 0x0104 -kSpriteMediaCountImagesSelect = 0x0105 -kSpriteMediaGetIndImageDescriptionSelect = 0x0106 -kSpriteMediaGetDisplayedSampleNumberSelect = 0x0107 -kMedia3DGetNamedObjectListSelect = 0x0101 -kMedia3DGetRendererListSelect = 0x0102 -kMCSetMovieSelect = 0x0002 -kMCGetIndMovieSelect = 0x0005 -kMCRemoveAllMoviesSelect = 0x0006 -kMCRemoveAMovieSelect = 0x0003 -kMCRemoveMovieSelect = 0x0006 -kMCIsPlayerEventSelect = 0x0007 -kMCSetActionFilterSelect = 0x0008 -kMCDoActionSelect = 0x0009 -kMCSetControllerAttachedSelect = 0x000A -kMCIsControllerAttachedSelect = 0x000B -kMCSetControllerPortSelect = 0x000C -kMCGetControllerPortSelect = 0x000D -kMCSetVisibleSelect = 0x000E -kMCGetVisibleSelect = 0x000F -kMCGetControllerBoundsRectSelect = 0x0010 -kMCSetControllerBoundsRectSelect = 0x0011 -kMCGetControllerBoundsRgnSelect = 0x0012 -kMCGetWindowRgnSelect = 0x0013 -kMCMovieChangedSelect = 0x0014 -kMCSetDurationSelect = 0x0015 -kMCGetCurrentTimeSelect = 0x0016 -kMCNewAttachedControllerSelect = 0x0017 -kMCDrawSelect = 0x0018 -kMCActivateSelect = 0x0019 -kMCIdleSelect = 0x001A -kMCKeySelect = 0x001B -kMCClickSelect = 0x001C -kMCEnableEditingSelect = 0x001D -kMCIsEditingEnabledSelect = 0x001E -kMCCopySelect = 0x001F -kMCCutSelect = 0x0020 -kMCPasteSelect = 0x0021 -kMCClearSelect = 0x0022 -kMCUndoSelect = 0x0023 -kMCPositionControllerSelect = 0x0024 -kMCGetControllerInfoSelect = 0x0025 -kMCSetClipSelect = 0x0028 -kMCGetClipSelect = 0x0029 -kMCDrawBadgeSelect = 0x002A -kMCSetUpEditMenuSelect = 0x002B -kMCGetMenuStringSelect = 0x002C -kMCSetActionFilterWithRefConSelect = 0x002D -kMCPtInControllerSelect = 0x002E -kMCInvalidateSelect = 0x002F diff --git a/Mac/Lib/toolbox/Resources.py b/Mac/Lib/toolbox/Resources.py deleted file mode 100644 index 989e700..0000000 --- a/Mac/Lib/toolbox/Resources.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Resources.h' - -resSysHeap = 64 -resPurgeable = 32 -resLocked = 16 -resProtected = 8 -resPreload = 4 -resChanged = 2 -mapReadOnly = 128 -mapCompact = 64 -mapChanged = 32 -resSysRefBit = 7 -resSysHeapBit = 6 -resPurgeableBit = 5 -resLockedBit = 4 -resProtectedBit = 3 -resPreloadBit = 2 -resChangedBit = 1 -mapReadOnlyBit = 7 -mapCompactBit = 6 -mapChangedBit = 5 -kResFileNotOpened = -1 -kSystemResFile = 0 diff --git a/Mac/Lib/toolbox/Sound.py b/Mac/Lib/toolbox/Sound.py deleted file mode 100644 index f782dd5..0000000 --- a/Mac/Lib/toolbox/Sound.py +++ /dev/null @@ -1,102 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Sound.h' - -soundListRsrc = 'snd ' -rate44khz = 0xAC440000L -rate22050hz = 0x56220000L -rate22khz = 0x56EE8BA3L -rate11khz = 0x2B7745D1L -rate11025hz = 0x2B110000 -squareWaveSynth = 1 -waveTableSynth = 3 -sampledSynth = 5 -MACE3snthID = 11 -MACE6snthID = 13 -kMiddleC = 60 -kSimpleBeepID = 1 -kFullVolume = 0x0100 -kNoVolume = 0 -nullCmd = 0 -initCmd = 1 -freeCmd = 2 -quietCmd = 3 -flushCmd = 4 -reInitCmd = 5 -waitCmd = 10 -pauseCmd = 11 -resumeCmd = 12 -callBackCmd = 13 -syncCmd = 14 -availableCmd = 24 -versionCmd = 25 -totalLoadCmd = 26 -loadCmd = 27 -freqDurationCmd = 40 -restCmd = 41 -freqCmd = 42 -ampCmd = 43 -timbreCmd = 44 -getAmpCmd = 45 -volumeCmd = 46 -getVolumeCmd = 47 -waveTableCmd = 60 -phaseCmd = 61 -soundCmd = 80 -bufferCmd = 81 -rateCmd = 82 -continueCmd = 83 -doubleBufferCmd = 84 -getRateCmd = 85 -rateMultiplierCmd = 86 -getRateMultiplierCmd = 87 -sizeCmd = 90 -convertCmd = 91 -stdQLength = 128 -dataOffsetFlag = 0x8000 -waveInitChannelMask = 0x07 -waveInitChannel0 = 0x04 -waveInitChannel1 = 0x05 -waveInitChannel2 = 0x06 -waveInitChannel3 = 0x07 -initChanLeft = 0x0002 -initChanRight = 0x0003 -initNoInterp = 0x0004 -initNoDrop = 0x0008 -initMono = 0x0080 -initStereo = 0x00C0 -initMACE3 = 0x0300 -initMACE6 = 0x0400 -initPanMask = 0x0003 -initSRateMask = 0x0030 -initStereoMask = 0x00C0 -initCompMask = 0xFF00 -kUseOptionalOutputDevice = -1 -notCompressed = 0 -fixedCompression = -1 -variableCompression = -2 -twoToOne = 1 -eightToThree = 2 -threeToOne = 3 -sixToOne = 4 -stdSH = 0x00 -extSH = 0xFF -cmpSH = 0xFE -outsideCmpSH = 0 -insideCmpSH = 1 -aceSuccess = 0 -aceMemFull = 1 -aceNilBlock = 2 -aceBadComp = 3 -aceBadEncode = 4 -aceBadDest = 5 -aceBadCmd = 6 -sixToOnePacketSize = 8 -threeToOnePacketSize = 16 -stateBlockSize = 64 -leftOverBlockSize = 32 -firstSoundFormat = 0x0001 -secondSoundFormat = 0x0002 -dbBufferReady = 0x00000001 -dbLastBuffer = 0x00000004 -sysBeepDisable = 0x0000 -unitTypeNoSelection = 0xFFFF -unitTypeSeconds = 0x0000 diff --git a/Mac/Lib/toolbox/TextEdit.py b/Mac/Lib/toolbox/TextEdit.py deleted file mode 100644 index 6bfb163..0000000 --- a/Mac/Lib/toolbox/TextEdit.py +++ /dev/null @@ -1,56 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:TextEdit.h' - -teJustLeft = 0 -teJustCenter = 1 -teJustRight = -1 -teForceLeft = -2 -teFlushDefault = 0 -teCenter = 1 -teFlushRight = -1 -teFlushLeft = -2 -fontBit = 0 -faceBit = 1 -sizeBit = 2 -clrBit = 3 -addSizeBit = 4 -toggleBit = 5 -toglBit = 5 -doFont = 1 -doFace = 2 -doSize = 4 -doColor = 8 -doAll = 15 -addSize = 16 -doToggle = 32 -EOLHook = 0 -DRAWHook = 4 -WIDTHHook = 8 -HITTESTHook = 12 -nWIDTHHook = 24 -TextWidthHook = 28 -intEOLHook = 0 -intDrawHook = 1 -intWidthHook = 2 -intHitTestHook = 3 -intNWidthHook = 6 -intTextWidthHook = 7 -teFAutoScroll = 0 -teFAutoScr = 0 -teFTextBuffering = 1 -teFOutlineHilite = 2 -teFInlineInput = 3 -teFUseTextServices = 4 -teBitClear = 0 -teBitSet = 1 -teBitTest = -1 -teWordSelect = 4 -teWordDrag = 8 -teFromFind = 12 -teFromRecal = 16 -teFind = 0 -teHighlight = 1 -teDraw = -1 -teCaret = -2 -TEBitClear = 0 -TEBitSet = 1 -TEBitTest = -1 diff --git a/Mac/Lib/toolbox/WASTEconst.py b/Mac/Lib/toolbox/WASTEconst.py deleted file mode 100644 index 93c6c60..0000000 --- a/Mac/Lib/toolbox/WASTEconst.py +++ /dev/null @@ -1,87 +0,0 @@ -# Generated from ':::::Waste 1.2 Distribution:WASTE C/C++ Headers:WASTE.h' - -weCantUndoErr = -10015 -weEmptySelectionErr = -10013 -weNotHandledErr = -1708 -weUnknownObjectTypeErr = -9478 -weObjectNotFoundErr = -9477 -weReadOnlyErr = -9476 -weUndefinedSelectorErr = -50 -weFlushLeft = -2 -weFlushRight = -1 -weFlushDefault = 0 -weCenter = 1 -weJustify = 2 -weDoFont = 0x0001 -weDoFace = 0x0002 -weDoSize = 0x0004 -weDoColor = 0x0008 -weDoAddSize = 0x0010 -weDoToggleFace = 0x0020 -weDoReplaceFace = 0x0040 -weDoPreserveScript = 0x0080 -weDoExtractSubscript = 0x0100 -weDoFaceMask = 0x0200 -kLeadingEdge = -1 -kTrailingEdge = 0 -kObjectEdge = 2 -weFAutoScroll = 0 -weFOutlineHilite = 2 -weFReadOnly = 5 -weFUndo = 6 -weFIntCutAndPaste = 7 -weFDragAndDrop = 8 -weFInhibitRecal = 9 -weFUseTempMem = 10 -weFDrawOffscreen = 11 -weFInhibitRedraw = 12 -weFMonoStyled = 13 -weFInhibitColor = 31 -weDoAutoScroll = 1L << weFAutoScroll -weDoOutlineHilite = 1L << weFOutlineHilite -weDoReadOnly = 1L << weFReadOnly -weDoUndo = 1L << weFUndo -weDoIntCutAndPaste = 1L << weFIntCutAndPaste -weDoDragAndDrop = 1L << weFDragAndDrop -weDoInhibitRecal = 1L << weFInhibitRecal -weDoUseTempMem = 1L << weFUseTempMem -weDoDrawOffscreen = 1L << weFDrawOffscreen -weDoInhibitRedraw = 1L << weFInhibitRedraw -weDoMonoStyled = 1L << weFMonoStyled -weDoInhibitColor = 1L << weFInhibitColor -weBitToggle = -2 -weCharByteHook = 'cbyt' -weCharToPixelHook = 'c2p ' -weCharTypeHook = 'ctyp' -weClickLoop = 'clik' -weCurrentDrag = 'drag' -weDrawTextHook = 'draw' -weHiliteDropAreaHook = 'hidr' -weLineBreakHook = 'lbrk' -wePixelToCharHook = 'p2c ' -wePort = 'port' -weRefCon = 'refc' -weScrollProc = 'scrl' -weText = 'text' -weTranslateDragHook = 'xdrg' -weTSMDocumentID = 'tsmd' -weTSMPreUpdate = 'pre ' -weTSMPostUpdate = 'post' -weURLHint = 'urlh' -weWordBreakHook = 'wbrk' -weNewHandler = 'new ' -weDisposeHandler = 'free' -weDrawHandler = 'draw' -weClickHandler = 'clik' -weStreamHandler = 'strm' -weAKNone = 0 -weAKUnspecified = 1 -weAKTyping = 2 -weAKCut = 3 -weAKPaste = 4 -weAKClear = 5 -weAKDrag = 6 -weAKSetStyle = 7 -weToScrap = 0 -weToDrag = 1 -weToSoup = 2 diff --git a/Mac/Lib/toolbox/Windows.py b/Mac/Lib/toolbox/Windows.py deleted file mode 100644 index 157040f..0000000 --- a/Mac/Lib/toolbox/Windows.py +++ /dev/null @@ -1,59 +0,0 @@ -# Generated from 'flap:Metrowerks:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Windows.h' - -kWindowDefProcType = 'WDEF' -kStandardWindowDefinition = 0 -kRoundWindowDefinition = 1 -kFloatingWindowDefinition = 124 -kModalDialogVariantCode = 1 -kMovableModalDialogVariantCode = 5 -kSideFloaterVariantCode = 8 -documentProc = 0 -dBoxProc = 1 -plainDBox = 2 -altDBoxProc = 3 -noGrowDocProc = 4 -movableDBoxProc = 5 -zoomDocProc = 8 -zoomNoGrow = 12 -rDocProc = 16 -floatProc = 1985 -floatGrowProc = 1987 -floatZoomProc = 1989 -floatZoomGrowProc = 1991 -floatSideProc = 1993 -floatSideGrowProc = 1995 -floatSideZoomProc = 1997 -floatSideZoomGrowProc = 1999 -dialogKind = 2 -userKind = 8 -kDialogWindowKind = 2 -kApplicationWindowKind = 8 -inDesk = 0 -inMenuBar = 1 -inSysWindow = 2 -inContent = 3 -inDrag = 4 -inGrow = 5 -inGoAway = 6 -inZoomIn = 7 -inZoomOut = 8 -wDraw = 0 -wHit = 1 -wCalcRgns = 2 -wNew = 3 -wDispose = 4 -wGrow = 5 -wDrawGIcon = 6 -deskPatID = 16 -wNoHit = 0 -wInContent = 1 -wInDrag = 2 -wInGrow = 3 -wInGoAway = 4 -wInZoomIn = 5 -wInZoomOut = 6 -wContentColor = 0 -wFrameColor = 1 -wTextColor = 2 -wHiliteColor = 3 -wTitleBarColor = 4 diff --git a/Mac/Lib/toolbox/aepack.py b/Mac/Lib/toolbox/aepack.py deleted file mode 100644 index 9302a54..0000000 --- a/Mac/Lib/toolbox/aepack.py +++ /dev/null @@ -1,357 +0,0 @@ -"""Tools for use in AppleEvent clients and servers: -conversion between AE types and python types - -pack(x) converts a Python object to an AEDesc object -unpack(desc) does the reverse -coerce(x, wanted_sample) coerces a python object to another python object -""" - -# -# This code was originally written by Guido, and modified/extended by Jack -# to include the various types that were missing. The reference used is -# Apple Event Registry, chapter 9. -# - -import struct -import string -import types -from string import strip -from types import * -import AE -from AppleEvents import * -from AERegistry import * -from AEObjects import * -import MacOS -import macfs -import StringIO -import aetypes -from aetypes import mkenum, mktype - -# These ones seem to be missing from AppleEvents -# (they're in AERegistry.h) - -#typeColorTable = 'clrt' -#typeDrawingArea = 'cdrw' -#typePixelMap = 'cpix' -#typePixelMapMinus = 'tpmm' -#typeRotation = 'trot' -#typeTextStyles = 'tsty' -#typeStyledText = 'STXT' -#typeAEText = 'tTXT' -#typeEnumeration = 'enum' - -# -# Some AE types are immedeately coerced into something -# we like better (and which is equivalent) -# -unpacker_coercions = { - typeComp : typeExtended, - typeColorTable : typeAEList, - typeDrawingArea : typeAERecord, - typeFixed : typeExtended, - typeFloat : typeExtended, - typePixelMap : typeAERecord, - typeRotation : typeAERecord, - typeStyledText : typeAERecord, - typeTextStyles : typeAERecord, -}; - -# -# Some python types we need in the packer: -# -AEDescType = type(AE.AECreateDesc('TEXT', '')) -_sample_fss = macfs.FSSpec(':') -_sample_alias = _sample_fss.NewAliasMinimal() -FSSType = type(_sample_fss) -AliasType = type(_sample_alias) - -def pack(x, forcetype = None): - """Pack a python object into an AE descriptor""" - - if forcetype: - if type(x) is StringType: - return AE.AECreateDesc(forcetype, x) - else: - return pack(x).AECoerceDesc(forcetype) - - if x == None: - return AE.AECreateDesc('null', '') - - t = type(x) - if t == AEDescType: - return x - if t == FSSType: - return AE.AECreateDesc('fss ', x.data) - if t == AliasType: - return AE.AECreateDesc('alis', x.data) - if t == IntType: - return AE.AECreateDesc('long', struct.pack('l', x)) - if t == FloatType: - # - # XXXX (note by Guido) Weird thing -- Think C's "double" is 10 bytes, but - # struct.pack('d') return 12 bytes (and struct.unpack requires - # them, too). The first 2 bytes seem to be repeated... - # Probably an alignment problem - # XXXX (note by Jack) haven't checked this under MW - # - return AE.AECreateDesc('exte', struct.pack('d', x)[2:]) - if t == StringType: - return AE.AECreateDesc('TEXT', x) - if t == ListType: - list = AE.AECreateList('', 0) - for item in x: - list.AEPutDesc(0, pack(item)) - return list - if t == DictionaryType: - record = AE.AECreateList('', 1) - for key, value in x.items(): - record.AEPutParamDesc(key, pack(value)) - return record - if t == InstanceType and hasattr(x, '__aepack__'): - return x.__aepack__() - return AE.AECreateDesc('TEXT', repr(x)) # Copout - -def unpack(desc): - """Unpack an AE descriptor to a python object""" - t = desc.type - - if unpacker_coercions.has_key(t): - desc = desc.AECoerceDesc(unpacker_coercions[t]) - t = desc.type # This is a guess by Jack.... - - if t == typeAEList: - l = [] - for i in range(desc.AECountItems()): - keyword, item = desc.AEGetNthDesc(i+1, '****') - l.append(unpack(item)) - return l - if t == typeAERecord: - d = {} - for i in range(desc.AECountItems()): - keyword, item = desc.AEGetNthDesc(i+1, '****') - d[keyword] = unpack(item) - return d - if t == typeAEText: - record = desc.AECoerceDesc('reco') - return mkaetext(unpack(record)) - if t == typeAlias: - return macfs.RawAlias(desc.data) - # typeAppleEvent returned as unknown - if t == typeBoolean: - return struct.unpack('b', desc.data)[0] - if t == typeChar: - return desc.data - # typeColorTable coerced to typeAEList - # typeComp coerced to extended - # typeData returned as unknown - # typeDrawingArea coerced to typeAERecord - if t == typeEnumeration: - return mkenum(desc.data) - # typeEPS returned as unknown - if t == typeExtended: - data = desc.data - # XXX See corresponding note for pack() - return struct.unpack('d', data[:2] + data)[0] - if t == typeFalse: - return 0 - # typeFixed coerced to extended - # typeFloat coerced to extended - if t == typeFSS: - return macfs.RawFSSpec(desc.data) - if t == typeInsertionLoc: - record = desc.AECoerceDesc('reco') - return mkinsertionloc(unpack(record)) - # typeInteger equal to typeLongInteger - if t == typeIntlText: - script, language = struct.unpack('hh', desc.data[:4]) - return aetypes.IntlText(script, language, desc.data[4:]) - if t == typeIntlWritingCode: - script, language = struct.unpack('hh', desc.data) - return aetypes.IntlWritingCode(script, language) - if t == typeKeyword: - return mkkeyword(desc.data) - # typeLongFloat is equal to typeFloat - if t == typeLongInteger: - return struct.unpack('l', desc.data)[0] - if t == typeNull: - return None - if t == typeMagnitude: - v = struct.unpack('l', desc.data) - if v < 0: - v = 0x100000000L + v - return v - if t == typeObjectSpecifier: - record = desc.AECoerceDesc('reco') - return mkobject(unpack(record)) - # typePict returned as unknown - # typePixelMap coerced to typeAERecord - # typePixelMapMinus returned as unknown - # typeProcessSerialNumber returned as unknown - if t == typeQDPoint: - v, h = struct.unpack('hh', desc.data) - return aetypes.QDPoint(v, h) - if t == typeQDRectangle: - v0, h0, v1, h1 = struct.unpack('hhhh', desc.data) - return aetypes.QDRectangle(v0, h0, v1, h1) - if t == typeRGBColor: - r, g, b = struct.unpack('hhh', desc.data) - return aetypes.RGBColor(r, g, b) - # typeRotation coerced to typeAERecord - # typeScrapStyles returned as unknown - # typeSessionID returned as unknown - if t == typeShortFloat: - return struct.unpack('f', desc.data)[0] - if t == typeShortInteger: - return struct.unpack('h', desc.data)[0] - # typeSMFloat identical to typeShortFloat - # typeSMInt indetical to typeShortInt - # typeStyledText coerced to typeAERecord - if t == typeTargetID: - return mktargetid(desc.data) - # typeTextStyles coerced to typeAERecord - # typeTIFF returned as unknown - if t == typeTrue: - return 1 - if t == typeType: - return mktype(desc.data) - # - # The following are special - # - if t == 'rang': - record = desc.AECoerceDesc('reco') - return mkrange(unpack(record)) - if t == 'cmpd': - record = desc.AECoerceDesc('reco') - return mkcomparison(unpack(record)) - if t == 'logi': - record = desc.AECoerceDesc('reco') - return mklogical(unpack(record)) - return mkunknown(desc.type, desc.data) - -def coerce(data, egdata): - """Coerce a python object to another type using the AE coercers""" - pdata = pack(data) - pegdata = pack(egdata) - pdata = pdata.AECoerceDesc(pegdata.type) - return unpack(pdata) - -# -# Helper routines for unpack -# -def mktargetid(data): - sessionID = getlong(data[:4]) - name = mkppcportrec(data[4:4+72]) - location = mklocationnamerec(data[76:76+36]) - rcvrName = mkppcportrec(data[112:112+72]) - return sessionID, name, location, rcvrName - -def mkppcportrec(rec): - namescript = getword(rec[:2]) - name = getpstr(rec[2:2+33]) - portkind = getword(rec[36:38]) - if portkind == 1: - ctor = rec[38:42] - type = rec[42:46] - identity = (ctor, type) - else: - identity = getpstr(rec[38:38+33]) - return namescript, name, portkind, identity - -def mklocationnamerec(rec): - kind = getword(rec[:2]) - stuff = rec[2:] - if kind == 0: stuff = None - if kind == 2: stuff = getpstr(stuff) - return kind, stuff - -def mkunknown(type, data): - return aetypes.Unknown(type, data) - -def getpstr(s): - return s[1:1+ord(s[0])] - -def getlong(s): - return (ord(s[0])<<24) | (ord(s[1])<<16) | (ord(s[2])<<8) | ord(s[3]) - -def getword(s): - return (ord(s[0])<<8) | (ord(s[1])<<0) - -def mkkeyword(keyword): - return aetypes.Keyword(keyword) - -def mkrange(dict): - return aetypes.Range(dict['star'], dict['stop']) - -def mkcomparison(dict): - return aetypes.Comparison(dict['obj1'], dict['relo'].enum, dict['obj2']) - -def mklogical(dict): - return aetypes.Logical(dict['logc'], dict['term']) - -def mkstyledtext(dict): - return aetypes.StyledText(dict['ksty'], dict['ktxt']) - -def mkaetext(dict): - return aetypes.AEText(dict[keyAEScriptTag], dict[keyAEStyles], dict[keyAEText]) - -def mkinsertionloc(dict): - return aetypes.InsertionLoc(dict[keyAEObject], dict[keyAEPosition]) - -def mkobject(dict): - want = dict['want'].type - form = dict['form'].enum - seld = dict['seld'] - fr = dict['from'] - if form in ('name', 'indx', 'rang', 'test'): - if want == 'text': return aetypes.Text(seld, fr) - if want == 'cha ': return aetypes.Character(seld, fr) - if want == 'cwor': return aetypes.Word(seld, fr) - if want == 'clin': return aetypes.Line(seld, fr) - if want == 'cpar': return aetypes.Paragraph(seld, fr) - if want == 'cwin': return aetypes.Window(seld, fr) - if want == 'docu': return aetypes.Document(seld, fr) - if want == 'file': return aetypes.File(seld, fr) - if want == 'cins': return aetypes.InsertionPoint(seld, fr) - if want == 'prop' and form == 'prop' and aetypes.IsType(seld): - return aetypes.Property(seld.type, fr) - return aetypes.ObjectSpecifier(want, form, seld, fr) - -def _test(): - """Test program. Pack and unpack various things""" - objs = [ - 'a string', - 12, - 12.0, - None, - ['a', 'list', 'of', 'strings'], - {'key1': 'value1', 'key2':'value2'}, - macfs.FSSpec(':'), - macfs.FSSpec(':').NewAliasMinimal(), - aetypes.Enum('enum'), - aetypes.Type('type'), - aetypes.Keyword('kwrd'), - aetypes.Range(1, 10), - aetypes.Comparison(1, '< ', 10), - aetypes.Logical('not ', 1), - # Cannot do StyledText - # Cannot do AEText - aetypes.IntlText(0, 0, 'international text'), - aetypes.IntlWritingCode(0,0), - aetypes.QDPoint(50,100), - aetypes.QDRectangle(50,100,150,200), - aetypes.RGBColor(0x7000, 0x6000, 0x5000), - aetypes.Unknown('xxxx', 'unknown type data'), - aetypes.Character(1), - aetypes.Character(2, aetypes.Line(2)), - ] - for o in objs: - print 'BEFORE', o, `o` - packed = pack(o) - unpacked = unpack(packed) - print 'AFTER ', unpacked, `unpacked` - import sys - sys.exit(1) - -if __name__ == '__main__': - _test() - diff --git a/Mac/Lib/toolbox/aetools.py b/Mac/Lib/toolbox/aetools.py deleted file mode 100644 index 21a4237..0000000 --- a/Mac/Lib/toolbox/aetools.py +++ /dev/null @@ -1,224 +0,0 @@ -"""Tools for use in AppleEvent clients and servers. - -pack(x) converts a Python object to an AEDesc object -unpack(desc) does the reverse - -packevent(event, parameters, attributes) sets params and attrs in an AEAppleEvent record -unpackevent(event) returns the parameters and attributes from an AEAppleEvent record - -Plus... Lots of classes and routines that help representing AE objects, -ranges, conditionals, logicals, etc., so you can write, e.g.: - - x = Character(1, Document("foobar")) - -and pack(x) will create an AE object reference equivalent to AppleScript's - - character 1 of document "foobar" - -Some of the stuff that appears to be exported from this module comes from other -files: the pack stuff from aepack, the objects from aetypes. - -""" - - -from types import * -import AE -import AppleEvents -import MacOS - -from aetypes import * -from aepack import pack, unpack, coerce, AEDescType - -Error = 'aetools.Error' - -# Special code to unpack an AppleEvent (which is *not* a disguised record!) -# Note by Jack: No??!? If I read the docs correctly it *is*.... - -aekeywords = [ - 'tran', - 'rtid', - 'evcl', - 'evid', - 'addr', - 'optk', - 'timo', - 'inte', # this attribute is read only - will be set in AESend - 'esrc', # this attribute is read only - 'miss', # this attribute is read only - 'from' # new in 1.0.1 -] - -def missed(ae): - try: - desc = ae.AEGetAttributeDesc('miss', 'keyw') - except AE.Error, msg: - return None - return desc.data - -def unpackevent(ae): - parameters = {} - while 1: - key = missed(ae) - if not key: break - parameters[key] = unpack(ae.AEGetParamDesc(key, '****')) - attributes = {} - for key in aekeywords: - try: - desc = ae.AEGetAttributeDesc(key, '****') - except (AE.Error, MacOS.Error), msg: - if msg[0] != -1701: - raise sys.exc_type, sys.exc_value - continue - attributes[key] = unpack(desc) - return parameters, attributes - -def packevent(ae, parameters = {}, attributes = {}): - for key, value in parameters.items(): - ae.AEPutParamDesc(key, pack(value)) - for key, value in attributes.items(): - ae.AEPutAttributeDesc(key, pack(value)) - -# -# Support routine for automatically generated Suite interfaces -# These routines are also useable for the reverse function. -# -def keysubst(arguments, keydict): - """Replace long name keys by their 4-char counterparts, and check""" - ok = keydict.values() - for k in arguments.keys(): - if keydict.has_key(k): - v = arguments[k] - del arguments[k] - arguments[keydict[k]] = v - elif k != '----' and k not in ok: - raise TypeError, 'Unknown keyword argument: %s'%k - -def enumsubst(arguments, key, edict): - """Substitute a single enum keyword argument, if it occurs""" - if not arguments.has_key(key): - return - v = arguments[key] - ok = edict.values() - if edict.has_key(v): - arguments[key] = edict[v] - elif not v in ok: - raise TypeError, 'Unknown enumerator: %s'%v - -def decodeerror(arguments): - """Create the 'best' argument for a raise MacOS.Error""" - errn = arguments['errn'] - err_a1 = errn - if arguments.has_key('errs'): - err_a2 = arguments['errs'] - else: - err_a2 = MacOS.GetErrorString(errn) - if arguments.has_key('erob'): - err_a3 = arguments['erob'] - else: - err_a3 = None - - return (err_a1, err_a2, err_a3) - -class TalkTo: - """An AE connection to an application""" - - def __init__(self, signature, start=0): - """Create a communication channel with a particular application. - - Addressing the application is done by specifying either a - 4-byte signature, an AEDesc or an object that will __aepack__ - to an AEDesc. - """ - self.target_signature = None - if type(signature) == AEDescType: - self.target = signature - elif type(signature) == InstanceType and hasattr(signature, '__aepack__'): - self.target = signature.__aepack__() - elif type(signature) == StringType and len(signature) == 4: - self.target = AE.AECreateDesc(AppleEvents.typeApplSignature, signature) - self.target_signature = signature - else: - raise TypeError, "signature should be 4-char string or AEDesc" - self.send_flags = AppleEvents.kAEWaitReply - self.send_priority = AppleEvents.kAENormalPriority - self.send_timeout = AppleEvents.kAEDefaultTimeout - if start: - self.start() - - def start(self): - """Start the application, if it is not running yet""" - import findertools - import macfs - - fss = macfs.FindApplication(self.target_signature) - findertools.launch(fss) - - def newevent(self, code, subcode, parameters = {}, attributes = {}): - """Create a complete structure for an apple event""" - - event = AE.AECreateAppleEvent(code, subcode, self.target, - AppleEvents.kAutoGenerateReturnID, AppleEvents.kAnyTransactionID) - packevent(event, parameters, attributes) - return event - - def sendevent(self, event): - """Send a pre-created appleevent, await the reply and unpack it""" - - reply = event.AESend(self.send_flags, self.send_priority, - self.send_timeout) - parameters, attributes = unpackevent(reply) - return reply, parameters, attributes - - def send(self, code, subcode, parameters = {}, attributes = {}): - """Send an appleevent given code/subcode/pars/attrs and unpack the reply""" - return self.sendevent(self.newevent(code, subcode, parameters, attributes)) - - # - # The following events are somehow "standard" and don't seem to appear in any - # suite... - # - def activate(self): - """Send 'activate' command""" - self.send('misc', 'actv') - - def _get(self, _object, as=None, _attributes={}): - """_get: get data from an object - Required argument: the object - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the data - """ - _code = 'core' - _subcode = 'getd' - - _arguments = {'----':_object} - if as: - _arguments['rtyp'] = mktype(as) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.has_key('errn'): - raise Error, decodeerror(_arguments) - - if _arguments.has_key('----'): - return _arguments['----'] - - -# Test program -# XXXX Should test more, really... - -def test(): - target = AE.AECreateDesc('sign', 'KAHL') - ae = AE.AECreateAppleEvent('aevt', 'oapp', target, -1, 0) - print unpackevent(ae) - raw_input(":") - ae = AE.AECreateAppleEvent('core', 'getd', target, -1, 0) - obj = Character(2, Word(1, Document(1))) - print obj - print repr(obj) - packevent(ae, {'----': obj}) - params, attrs = unpackevent(ae) - print params['----'] - raw_input(":") - -if __name__ == '__main__': - test() diff --git a/Mac/Lib/toolbox/aetypes.py b/Mac/Lib/toolbox/aetypes.py deleted file mode 100644 index 3dc0d0e..0000000 --- a/Mac/Lib/toolbox/aetypes.py +++ /dev/null @@ -1,541 +0,0 @@ -"""aetypes - Python objects representing various AE types.""" - -from AppleEvents import * -from AERegistry import * -from AEObjects import * -import struct -from types import * -import string - -# -# convoluted, since there are cyclic dependencies between this file and -# aetools_convert. -# -def pack(*args): - from aepack import pack - return apply(pack, args) - -def IsSubclass(cls, base): - """Test whether CLASS1 is the same as or a subclass of CLASS2""" - # Loop to optimize for single inheritance - while 1: - if cls is base: return 1 - if len(cls.__bases__) <> 1: break - cls = cls.__bases__[0] - # Recurse to cope with multiple inheritance - for c in cls.__bases__: - if IsSubclass(c, base): return 1 - return 0 - -def IsInstance(x, cls): - """Test whether OBJECT is an instance of (a subclass of) CLASS""" - return type(x) is InstanceType and IsSubclass(x.__class__, cls) - -def nice(s): - """'nice' representation of an object""" - if type(s) is StringType: return repr(s) - else: return str(s) - -class Unknown: - """An uninterpreted AE object""" - - def __init__(self, type, data): - self.type = type - self.data = data - - def __repr__(self): - return "Unknown(%s, %s)" % (`self.type`, `self.data`) - - def __aepack__(self): - return pack(self.data, self.type) - -class Enum: - """An AE enumeration value""" - - def __init__(self, enum): - self.enum = "%-4.4s" % str(enum) - - def __repr__(self): - return "Enum(%s)" % `self.enum` - - def __str__(self): - return string.strip(self.enum) - - def __aepack__(self): - return pack(self.enum, typeEnumeration) - -def IsEnum(x): - return IsInstance(x, Enum) - -def mkenum(enum): - if IsEnum(enum): return enum - return Enum(enum) - -class Boolean: - """An AE boolean value""" - - def __init__(self, bool): - self.bool = (not not bool) - - def __repr__(self): - return "Boolean(%s)" % `self.bool` - - def __str__(self): - if self.bool: - return "True" - else: - return "False" - - def __aepack__(self): - return pack(struct.pack('b', self.bool), 'bool') - -def IsBoolean(x): - return IsInstance(x, Boolean) - -def mkboolean(bool): - if IsBoolean(bool): return bool - return Boolean(bool) - -class Type: - """An AE 4-char typename object""" - - def __init__(self, type): - self.type = "%-4.4s" % str(type) - - def __repr__(self): - return "Type(%s)" % `self.type` - - def __str__(self): - return string.strip(self.type) - - def __aepack__(self): - return pack(self.type, typeType) - -def IsType(x): - return IsInstance(x, Type) - -def mktype(type): - if IsType(type): return type - return Type(type) - - -class Keyword: - """An AE 4-char keyword object""" - - def __init__(self, keyword): - self.keyword = "%-4.4s" % str(keyword) - - def __repr__(self): - return "Keyword(%s)" % `self.keyword` - - def __str__(self): - return string.strip(self.keyword) - - def __aepack__(self): - return pack(self.keyword, typeKeyword) - -def IsKeyword(x): - return IsInstance(x, Keyword) - -class Range: - """An AE range object""" - - def __init__(self, start, stop): - self.start = start - self.stop = stop - - def __repr__(self): - return "Range(%s, %s)" % (`self.start`, `self.stop`) - - def __str__(self): - return "%s thru %s" % (nice(self.start), nice(self.stop)) - - def __aepack__(self): - return pack({'star': self.start, 'stop': self.stop}, 'rang') - -def IsRange(x): - return IsInstance(x, Range) - -class Comparison: - """An AE Comparison""" - - def __init__(self, obj1, relo, obj2): - self.obj1 = obj1 - self.relo = "%-4.4s" % str(relo) - self.obj2 = obj2 - - def __repr__(self): - return "Comparison(%s, %s, %s)" % (`self.obj1`, `self.relo`, `self.obj2`) - - def __str__(self): - return "%s %s %s" % (nice(self.obj1), string.strip(self.relo), nice(self.obj2)) - - def __aepack__(self): - return pack({'obj1': self.obj1, - 'relo': mkenum(self.relo), - 'obj2': self.obj2}, - 'cmpd') - -def IsComparison(x): - return IsInstance(x, Comparison) - -class NComparison(Comparison): - # The class attribute 'relo' must be set in a subclass - - def __init__(self, obj1, obj2): - Comparison.__init__(obj1, self.relo, obj2) - -class Logical: - """An AE logical expression object""" - - def __init__(self, logc, term): - self.logc = "%-4.4s" % str(logc) - self.term = term - - def __repr__(self): - return "Logical(%s, %s)" % (`self.logc`, `self.term`) - - def __str__(self): - if type(self.term) == ListType and len(self.term) == 2: - return "%s %s %s" % (nice(self.term[0]), - string.strip(self.logc), - nice(self.term[1])) - else: - return "%s(%s)" % (string.strip(self.logc), nice(self.term)) - - def __aepack__(self): - return pack({'logc': mkenum(self.logc), 'term': self.term}, 'logi') - -def IsLogical(x): - return IsInstance(x, Logical) - -class StyledText: - """An AE object respresenting text in a certain style""" - - def __init__(self, style, text): - self.style = style - self.text = text - - def __repr__(self): - return "StyledText(%s, %s)" % (`self.style`, `self.text`) - - def __str__(self): - return self.text - - def __aepack__(self): - return pack({'ksty': self.style, 'ktxt': self.text}, 'STXT') - -def IsStyledText(x): - return IsInstance(x, StyledText) - -class AEText: - """An AE text object with style, script and language specified""" - - def __init__(self, script, style, text): - self.script = script - self.style = style - self.text = text - - def __repr__(self): - return "AEText(%s, %s, %s)" % (`self.script`, `self.style`, `self.text`) - - def __str__(self): - return self.text - - def __aepack__(self): - return pack({keyAEScriptTag: self.script, keyAEStyles: self.style, - keyAEText: self.text}, typeAEText) - -def IsAEText(x): - return IsInstance(x, AEText) - -class IntlText: - """A text object with script and language specified""" - - def __init__(self, script, language, text): - self.script = script - self.language = language - self.text = text - - def __repr__(self): - return "IntlText(%s, %s, %s)" % (`self.script`, `self.language`, `self.text`) - - def __str__(self): - return self.text - - def __aepack__(self): - return pack(struct.pack('hh', self.script, self.language)+self.text, - typeIntlText) - -def IsIntlText(x): - return IsInstance(x, IntlText) - -class IntlWritingCode: - """An object representing script and language""" - - def __init__(self, script, language): - self.script = script - self.language = language - - def __repr__(self): - return "IntlWritingCode(%s, %s)" % (`self.script`, `self.language`) - - def __str__(self): - return "script system %d, language %d"%(self.script, self.language) - - def __aepack__(self): - return pack(struct.pack('hh', self.script, self.language), - typeIntlWritingCode) - -def IsIntlWritingCode(x): - return IsInstance(x, IntlWritingCode) - -class QDPoint: - """A point""" - - def __init__(self, v, h): - self.v = v - self.h = h - - def __repr__(self): - return "QDPoint(%s, %s)" % (`self.v`, `self.h`) - - def __str__(self): - return "(%d, %d)"%(self.v, self.h) - - def __aepack__(self): - return pack(struct.pack('hh', self.v, self.h), - typeQDPoint) - -def IsQDPoint(x): - return IsInstance(x, QDPoint) - -class QDRectangle: - """A rectangle""" - - def __init__(self, v0, h0, v1, h1): - self.v0 = v0 - self.h0 = h0 - self.v1 = v1 - self.h1 = h1 - - def __repr__(self): - return "QDRectangle(%s, %s, %s, %s)" % (`self.v0`, `self.h0`, - `self.v1`, `self.h1`) - - def __str__(self): - return "(%d, %d)-(%d, %d)"%(self.v0, self.h0, self.v1, self.h1) - - def __aepack__(self): - return pack(struct.pack('hhhh', self.v0, self.h0, self.v1, self.h1), - typeQDRectangle) - -def IsQDRectangle(x): - return IsInstance(x, QDRectangle) - -class RGBColor: - """An RGB color""" - - def __init__(self, r, g, b): - self.r = r - self.g = g - self.b = b - - def __repr__(self): - return "RGBColor(%s, %s, %s)" % (`self.r`, `self.g`, `self.b`) - - def __str__(self): - return "0x%x red, 0x%x green, 0x%x blue"% (self.r, self.g, self.b) - - def __aepack__(self): - return pack(struct.pack('hhh', self.r, self.g, self.b), - typeRGBColor) - -def IsRGBColor(x): - return IsInstance(x, RGBColor) - -class ObjectSpecifier: - - """A class for constructing and manipulation AE object specifiers in python. - - An object specifier is actually a record with four fields: - - key type description - --- ---- ----------- - - 'want' type 4-char class code of thing we want, - e.g. word, paragraph or property - - 'form' enum how we specify which 'want' thing(s) we want, - e.g. by index, by range, by name, or by property specifier - - 'seld' any which thing(s) we want, - e.g. its index, its name, or its property specifier - - 'from' object the object in which it is contained, - or null, meaning look for it in the application - - Note that we don't call this class plain "Object", since that name - is likely to be used by the application. - """ - - def __init__(self, want, form, seld, fr = None): - self.want = want - self.form = form - self.seld = seld - self.fr = fr - - def __repr__(self): - s = "ObjectSpecifier(%s, %s, %s" % (`self.want`, `self.form`, `self.seld`) - if self.fr: - s = s + ", %s)" % `self.fr` - else: - s = s + ")" - return s - - def __aepack__(self): - return pack({'want': mktype(self.want), - 'form': mkenum(self.form), - 'seld': self.seld, - 'from': self.fr}, - 'obj ') - -def IsObjectSpecifier(x): - return IsInstance(x, ObjectSpecifier) - - -# Backwards compatability, sigh... -class Property(ObjectSpecifier): - - def __init__(self, which, fr = None, want='prop'): - ObjectSpecifier.__init__(self, want, 'prop', mktype(which), fr) - - def __repr__(self): - if self.fr: - return "Property(%s, %s)" % (`self.seld.type`, `self.fr`) - else: - return "Property(%s)" % `self.seld.type` - - def __str__(self): - if self.fr: - return "Property %s of %s" % (str(self.seld), str(self.fr)) - else: - return "Property %s" % str(self.seld) - - -class NProperty(ObjectSpecifier): - # Subclasses *must* self baseclass attributes: - # want is the type of this property - # which is the property name of this property - - def __init__(self, fr = None): - #try: - # dummy = self.want - #except: - # self.want = 'prop' - self.want = 'prop' - ObjectSpecifier.__init__(self, self.want, 'prop', - mktype(self.which), fr) - - def __repr__(self): - rv = "Property(%s"%`self.seld.type` - if self.fr: - rv = rv + ", fr=%s" % `self.fr` - if self.want != 'prop': - rv = rv + ", want=%s" % `self.want` - return rv + ")" - - def __str__(self): - if self.fr: - return "Property %s of %s" % (str(self.seld), str(self.fr)) - else: - return "Property %s" % str(self.seld) - - -class SelectableItem(ObjectSpecifier): - - def __init__(self, want, seld, fr = None): - t = type(seld) - if t == StringType: - form = 'name' - elif IsRange(seld): - form = 'rang' - elif IsComparison(seld) or IsLogical(seld): - form = 'test' - elif t == TupleType: - # Breakout: specify both form and seld in a tuple - # (if you want ID or rele or somesuch) - form, seld = seld - else: - form = 'indx' - ObjectSpecifier.__init__(self, want, form, seld, fr) - - -class ComponentItem(SelectableItem): - # Derived classes *must* set the *class attribute* 'want' to some constant - # Also, dictionaries _propdict and _elemdict must be set to map property - # and element names to the correct classes - - def __init__(self, which, fr = None): - SelectableItem.__init__(self, self.want, which, fr) - - def __repr__(self): - if not self.fr: - return "%s(%s)" % (self.__class__.__name__, `self.seld`) - return "%s(%s, %s)" % (self.__class__.__name__, `self.seld`, `self.fr`) - - def __str__(self): - seld = self.seld - if type(seld) == StringType: - ss = repr(seld) - elif IsRange(seld): - start, stop = seld.start, seld.stop - if type(start) == InstanceType == type(stop) and \ - start.__class__ == self.__class__ == stop.__class__: - ss = str(start.seld) + " thru " + str(stop.seld) - else: - ss = str(seld) - else: - ss = str(seld) - s = "%s %s" % (self.__class__.__name__, ss) - if self.fr: s = s + " of %s" % str(self.fr) - return s - - def __getattr__(self, name): - if self._elemdict.has_key(name): - cls = self._elemdict[name] - return DelayedComponentItem(cls, self) - if self._propdict.has_key(name): - cls = self._propdict[name] - return cls(self) - raise AttributeError, name - - -class DelayedComponentItem: - def __init__(self, compclass, fr): - self.compclass = compclass - self.fr = fr - - def __call__(self, which): - return self.compclass(which, self.fr) - - def __repr__(self): - return "%s(???, %s)" % (self.__class__.__name__, `self.fr`) - - def __str__(self): - return "selector for element %s of %s"%(self.__class__.__name__, str(self.fr)) - -template = """ -class %s(ComponentItem): want = '%s' -""" - -exec template % ("Text", 'text') -exec template % ("Character", 'cha ') -exec template % ("Word", 'cwor') -exec template % ("Line", 'clin') -exec template % ("Paragraph", 'cpar') -exec template % ("Window", 'cwin') -exec template % ("Document", 'docu') -exec template % ("File", 'file') -exec template % ("InsertionPoint", 'cins') - -- cgit v0.12