PageRenderTime 27ms CodeModel.GetById 16ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/Frameworks/AppKit/browser.platform/CPDragServer.j

http://github.com/jfahrenkrug/MapKit-HelloWorld
Unknown | 192 lines | 192 code | 0 blank | 0 comment | 0 complexity | 3db78567579af927ceb54dc3ad5ebd7e MD5 | raw file
  1I;15;AppKit/CPView.jI;16;AppKit/CPEvent.jI;21;AppKit/CPPasteboard.jI;20;AppKit/CPImageView.jc;7236;
  2var _1=nil;
  3var _2=nil,_3=nil,_4=nil,_5=nil,_6=nil,_7=nil,_8=nil,_9=nil,_a=nil,_b=nil;
  4var _c=NO,_d=NO,_e=NO,_f=NO,_10=NO;
  5var _11=function(){
  6objj_msgSend(_3,"autoscroll:",_a);
  7};
  8var _12=function(_13){
  9_14(_13);
 10};
 11var _14=function(_15){
 12if(objj_msgSend(_15,"type")==CPLeftMouseUp){
 13if(_b!==nil){
 14clearInterval(_b);
 15}
 16_b=nil;
 17_6=objj_msgSend((objj_msgSend(_8,"isKindOfClass:",objj_msgSend(CPWindow,"class"))?_8:objj_msgSend(_8,"window")),"convertBridgeToBase:",objj_msgSend(objj_msgSend(_15,"window"),"convertBaseToBridge:",objj_msgSend(_15,"locationInWindow")));
 18objj_msgSend(_2,"removeFromSuperview");
 19objj_msgSend(_1._dragWindow,"orderOut:",nil);
 20if(_8&&(!objj_msgSend(_8,"respondsToSelector:",sel_getUid("prepareForDragOperation:"))||objj_msgSend(_8,"prepareForDragOperation:",_9))&&(!objj_msgSend(_8,"respondsToSelector:",sel_getUid("performDragOperation:"))||objj_msgSend(_8,"performDragOperation:",_9))&&objj_msgSend(_8,"respondsToSelector:",sel_getUid("concludeDragOperation:"))){
 21objj_msgSend(_8,"concludeDragOperation:",_9);
 22}
 23if(_10){
 24objj_msgSend(_3,"draggedImage:endedAt:operation:",objj_msgSend(_2,"image"),_6,NO);
 25}else{
 26if(_f){
 27objj_msgSend(_3,"draggedView:endedAt:operation:",_2,_6,NO);
 28}
 29}
 30_c=NO;
 31_8=nil;
 32return;
 33}
 34if(_b===nil){
 35if(objj_msgSend(_3,"respondsToSelector:",sel_getUid("autoscroll:"))){
 36_b=setInterval(_11,100);
 37}
 38}
 39_a=_15;
 40objj_msgSend(CPApp,"setCallback:forNextEventMatchingMask:untilDate:inMode:dequeue:",_14,CPMouseMovedMask|CPLeftMouseDraggedMask|CPLeftMouseUpMask,nil,0,NO);
 41var _16=objj_msgSend(_15,"locationInWindow"),_17=bridgeLocation=objj_msgSend(objj_msgSend(_15,"window"),"convertBaseToBridge:",_16);
 42var _18=objj_msgSend(objj_msgSend(CPDOMWindowBridge,"sharedDOMWindowBridge"),"_dragHitTest:pasteboard:",bridgeLocation,_7);
 43_6=objj_msgSend((objj_msgSend(_18,"isKindOfClass:",objj_msgSend(CPWindow,"class"))?_18:objj_msgSend(_18,"window")),"convertBridgeToBase:",bridgeLocation);
 44if(_18!=_8){
 45if(_8&&objj_msgSend(_8,"respondsToSelector:",sel_getUid("draggingExited:"))){
 46objj_msgSend(_8,"draggingExited:",_9);
 47}
 48_8=_18;
 49if(_8&&objj_msgSend(_8,"respondsToSelector:",sel_getUid("draggingEntered:"))){
 50objj_msgSend(_8,"draggingEntered:",_9);
 51}
 52}else{
 53if(_8&&objj_msgSend(_8,"respondsToSelector:",sel_getUid("draggingUpdated:"))){
 54objj_msgSend(_8,"draggingUpdated:",_9);
 55}
 56}
 57_16.x-=_5.x;
 58_16.y-=_5.y;
 59objj_msgSend(_2,"setFrameOrigin:",_16);
 60if(_e){
 61objj_msgSend(_3,"draggedImage:movedTo:",objj_msgSend(_2,"image"),_16);
 62}else{
 63if(_d){
 64objj_msgSend(_3,"draggedView:movedTo:",_2,_16);
 65}
 66}
 67};
 68var _19=objj_allocateClassPair(CPObject,"CPDraggingInfo"),_1a=_19.isa;
 69objj_registerClassPair(_19);
 70objj_addClassForBundle(_19,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
 71class_addMethods(_19,[new objj_method(sel_getUid("draggingSource"),function(_1b,_1c){
 72with(_1b){
 73return _3;
 74}
 75}),new objj_method(sel_getUid("draggingLocation"),function(_1d,_1e){
 76with(_1d){
 77return _6;
 78}
 79}),new objj_method(sel_getUid("draggingPasteboard"),function(_1f,_20){
 80with(_1f){
 81return _7;
 82}
 83}),new objj_method(sel_getUid("draggedImage"),function(_21,_22){
 84with(_21){
 85return objj_msgSend(_2,"image");
 86}
 87}),new objj_method(sel_getUid("draggedImageLocation"),function(_23,_24){
 88with(_23){
 89return objj_msgSend(_23,"draggedViewLocation");
 90}
 91}),new objj_method(sel_getUid("draggedViewLocation"),function(_25,_26){
 92with(_25){
 93return objj_msgSend((objj_msgSend(_8,"isKindOfClass:",objj_msgSend(CPWindow,"class"))?_8:objj_msgSend(_8,"window")),"convertBridgeToBase:",objj_msgSend(_2,"frame").origin);
 94}
 95}),new objj_method(sel_getUid("draggedView"),function(_27,_28){
 96with(_27){
 97return _2;
 98}
 99})]);
100var _19=objj_allocateClassPair(CPObject,"CPDragServer"),_1a=_19.isa;
101class_addIvars(_19,[new objj_ivar("_dragWindow"),new objj_ivar("_imageView")]);
102objj_registerClassPair(_19);
103objj_addClassForBundle(_19,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
104class_addMethods(_19,[new objj_method(sel_getUid("init"),function(_29,_2a){
105with(_29){
106_29=objj_msgSendSuper({receiver:_29,super_class:objj_getClass("CPObject")},"init");
107if(_29){
108_dragWindow=objj_msgSend(objj_msgSend(CPWindow,"alloc"),"initWithContentRect:styleMask:",CPRectMakeZero(),CPBorderlessWindowMask);
109objj_msgSend(_dragWindow,"setLevel:",CPDraggingWindowLevel);
110}
111return _29;
112}
113}),new objj_method(sel_getUid("dragView:fromWindow:at:offset:event:pasteboard:source:slideBack:"),function(_2b,_2c,_2d,_2e,_2f,_30,_31,_32,_33,_34){
114with(_2b){
115var _35=objj_msgSend(_31,"locationInWindow");
116_2=_2d;
117_3=_33;
118_4=_2e;
119_5=CPPointMake(_35.x-_2f.x,_35.y-_2f.y);
120_7=objj_msgSend(CPPasteboard,"pasteboardWithName:",CPDragPboard);
121objj_msgSend(_dragWindow,"setFrameSize:",CGSizeMakeCopy(objj_msgSend(objj_msgSend(CPDOMWindowBridge,"sharedDOMWindowBridge"),"frame").size));
122objj_msgSend(_dragWindow,"orderFront:",_2b);
123objj_msgSend(_2d,"setFrameOrigin:",_2f);
124objj_msgSend(objj_msgSend(_dragWindow,"contentView"),"addSubview:",_2d);
125if(_c){
126if(objj_msgSend(_3,"respondsToSelector:",sel_getUid("draggedImage:beganAt:"))){
127objj_msgSend(_3,"draggedImage:beganAt:",objj_msgSend(_2d,"image"),_2f);
128}
129_e=objj_msgSend(_3,"respondsToSelector:",sel_getUid("draggedImage:movedTo:"));
130_10=objj_msgSend(_3,"respondsToSelector:",sel_getUid("draggedImage:endAt:operation:"));
131_d=NO;
132_f=NO;
133}else{
134if(objj_msgSend(_3,"respondsToSelector:",sel_getUid("draggedView:beganAt:"))){
135objj_msgSend(_3,"draggedView:beganAt:",_2d,_2f);
136}
137_d=objj_msgSend(_3,"respondsToSelector:",sel_getUid("draggedView:movedTo:"));
138_f=objj_msgSend(_3,"respondsToSelector:",sel_getUid("draggedView:endedAt:operation:"));
139_e=NO;
140_10=NO;
141}
142_12(_31);
143}
144}),new objj_method(sel_getUid("dragImage:fromWindow:at:offset:event:pasteboard:source:slideBack:"),function(_36,_37,_38,_39,_3a,_3b,_3c,_3d,_3e,_3f){
145with(_36){
146_c=YES;
147if(!_imageView){
148_imageView=objj_msgSend(objj_msgSend(CPImageView,"alloc"),"initWithFrame:",CPRectMakeZero());
149}
150objj_msgSend(_imageView,"setImage:",_38);
151objj_msgSend(_imageView,"setFrameSize:",CGSizeMakeCopy(objj_msgSend(_38,"size")));
152objj_msgSend(_36,"dragView:fromWindow:at:offset:event:pasteboard:source:slideBack:",_imageView,_39,_3a,_3b,_3c,_3d,_3e,_3f);
153}
154})]);
155class_addMethods(_1a,[new objj_method(sel_getUid("initialize"),function(_40,_41){
156with(_40){
157if(_40!=objj_msgSend(CPDragServer,"class")){
158return;
159}
160_9=objj_msgSend(objj_msgSend(CPDraggingInfo,"alloc"),"init");
161}
162}),new objj_method(sel_getUid("sharedDragServer"),function(_42,_43){
163with(_42){
164if(!_1){
165_1=objj_msgSend(objj_msgSend(CPDragServer,"alloc"),"init");
166}
167return _1;
168}
169})]);
170var _19=objj_getClass("CPWindow");
171if(!_19){
172objj_exception_throw(new objj_exception(OBJJClassNotFoundException,"*** Could not find definition for class \"CPWindow\""));
173}
174var _1a=_19.isa;
175class_addMethods(_19,[new objj_method(sel_getUid("_dragHitTest:pasteboard:"),function(_44,_45,_46,_47){
176with(_44){
177if(!_inclusiveRegisteredDraggedTypes){
178return nil;
179}
180var _48={x:_46.x-(_frame.origin.x),y:_46.y-(_frame.origin.y)},_49=objj_msgSend(_windowView,"hitTest:",_48);
181while(_49&&!objj_msgSend(_47,"availableTypeFromArray:",objj_msgSend(_49,"registeredDraggedTypes"))){
182_49=objj_msgSend(_49,"superview");
183}
184if(_49){
185return _49;
186}
187if(objj_msgSend(_47,"availableTypeFromArray:",objj_msgSend(_44,"registeredDraggedTypes"))){
188return _44;
189}
190return nil;
191}
192})]);