value__ntId__ntName __ntTemplate viewFlagsViewGetDropTypesScriptViewDragFeedbackScriptViewDropScriptviewClickScript beforeScriptViewDropRemoveScriptViewDropMoveScriptviewNameViewDropDoneScriptViewGetDropDataScript addNewSymbol AddNewPictcounter rightsideviewSetupChildrenScript  __ntDatatype __ntFlagsÿ( CLAS@    NUMBÿ8„   ÿ8func(dropPoint) // let the Drag and Drop API know which types we accept // NOTE: the list is sorted by what we prefer to have dropped kDropTypesArray ;  SCPT   ÿXfunc(dragInfo, dragPoint, show) begin local ourBox := :LocalBox(); // For our feedback, we draw a thick gray rectangle using the Xor transfer mode. // By using Xor, calling this with show=true and then show=nil will erase the // feedback rectangle. Note that we use DoDrawing to ensure correct clipping. :DoDrawing('DrawShape, [MakeRect(ourBox.left + 1, ourBox.top + 1, ourBox.right - 1, ourBox.bottom - 1), {transferMode: modeXor, penSize:3, penPattern:vfGray}]); true; // let the Drag and Drop system know that you did draw something. end    ÿ*func(dropType, dropData, dropPt) begin // if this is the palette view, then we won't allow anything to be added if copy then return true; if (dropType = 'picture) and (dropdata.context) then begin addarrayslot(datain, dropdata.context); :AddNewPict(dropData); return true; end; if dropType = 'text then begin local ourGlobals := :GlobalBox(); addarrayslot(datain, dropdata.text); :AddNewSymbol(dropPt.x - ourGlobals.left, dropPt.y - ourGlobals.top, dropdata.text); return true; end; return nil; end    ÿ ~func(unit) begin // figure out if we hit a dragon, if so drag it // otherwise pass the click on InkOff(unit) ; local hitDragon ; local clickX := GetPoint(firstX, unit) ; local clickY := GetPoint(firstY, unit) ; // find the dragon child that was tapped (if any) hitDragon := foreach child in :ChildViewFrames() do if ClassOf(child) = kSymbolClass AND IsPtInRect(clickX, clickY, child:GlobalOuterBox()) then break child; if hitDragon then begin hitDragon:Hilite(true); r:=hitdragon.context; // Create a frame which can be used by destination views to decide "can I accept this item" local ourDragReferenceFrame := { name: r, text: r, symbol: hitdragon.symbol, context: hitdragon.context, version: kVersion, bounds: hitDragon.viewBounds, // Only use this slot when dragon is converted to text view: hitDragon, }; // Create the drag-and-drop frame. The types parameter is very important to this. The // array contains a list of symbols representing potential formats for our data. local theFrame := { types: ['picture,'text], label: r, icon: hitdragon.icon, dragRef: ourDragReferenceFrame, view: hitDragon, }; :DragAndDrop(unit, hitDragon:GlobalBox(), nil /* pinbounds */, copy /* copy := nil */, [theFrame]); hitDragon:Hilite(nil) ; true; end ; end    ÿ–/* ** Sine of the Times source code ** descended from: ** Newton Developer Technical Support Sample Code ** ** DragonDrop, a drag and drop example ** ** by J. Christopher Bell and James Speir, Newton Developer Technical Support ** ** Copyright © 1994-5 by Apple Computer, Inc. All rights reserved. ** ** You may incorporate this sample code into your applications without ** restriction. This sample code has been provided "AS IS" and the ** responsibility for its operation is 100% yours. You are not ** permitted to modify and redistribute the source as "DTS Sample Code." ** If you are going to re-distribute the source, we require that you ** make it clear in the source that the code was descended from ** Apple-provided sample code, but that you've made changes. */  EVAL   ÿ®func(dragRef) begin rightside:=rightside-dragref.view.viewbounds.right; RemoveStepView(self, dragRef.view); // build the new datain array while length(datain)>0 do arrayremovecount(datain,0,1); foreach element in self:childviewframes() do addarrayslot(datain,element.context); true; // do not let the default behavior happen end    Òfunc(dragRef, offset, lastDragPt, copy) begin dragRef.view:OffsetView(offset.x, offset.y); true; end    nil '   >func() begin return true; end    ÿúfunc(dragType, dragRef) begin if (dragType='picture) and (dragref.symbol exists) then begin return {context: deepclone(dragref.context), symbol: deepclone(dragref.symbol), icon: deepclone(dragref.icon), viewbounds: deepclone(dragref.bounds)}; end; else if dragType = 'text then begin // return the actual data that will be passed to the destination view. return {text: clone(dragref.text), viewFont: userconfiguration.viewFont, viewBounds: deepclone(dragRef.bounds)}; end; else return nil; end    ÿ H// This function will only be used in the beginning to create the initial dragon // or, if the user writes some text in the edit view which contains the word 'dragon' func(x, y, insymbol) begin fn := StrTokenize(insymbol, $ ); while ts := call fn with () do begin local sym:=nil; local protoDragon := GetLayout("Dragon") ; protodragon:=clone(protodragon); foreach index, element in drawframe do if strpos(ts,sprintobject(index),0)<>nil then begin sym:=index; break; end; if sym=nil then sym:='text; // find out from the proto how large a dragon is... local width := protoDragon.viewbounds.right - protoDragon.viewbounds.left; local height := protoDragon.viewbounds.bottom - protoDragon.viewbounds.top; // position our new child accordingly local m:={_proto:protoDragon, viewBounds: RelBounds(x, y, width, height)}; m._proto.context:=ts; m._proto.symbol:=sym; if drawframe.(sym) exists then newview:=AddStepView(self, m); if newview then rightside:=rightside+newview.viewbounds.right; end; // AddStepView() does not automatically update the view. // this is a problem for things like borders (ms) :Dirty(); end    ÿfunc(pictData) begin pictdata:=clone(pictdata); pictData._proto := GetLayout("Dragon"); newview:=AddStepView(self, pictData); if newview then rightside:=rightside+newview.viewbounds.right; :Dirty();// AddStepView() does not automatically update the view. end    0 EVAL   0 EVAL   pfunc() begin self.stepchildren:=[]; rightside:=0; end SCPTclViewdragondropview