PageRenderTime 15ms CodeModel.GetById 11ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Frameworks/AppKit/rhino.platform/CPPasteboard.j

http://github.com/jfahrenkrug/MapKit-HelloWorld
Unknown | 142 lines | 142 code | 0 blank | 0 comment | 0 complexity | 8be340e50f37cbadc23de0bbfcaadd7c MD5 | raw file
  1I;21;Foundation/CPObject.jI;20;Foundation/CPArray.jI;25;Foundation/CPDictionary.jI;40;Foundation/CPPropertyListSerialization.jc;4493;
  2CPGeneralPboard="CPGeneralPboard";
  3CPFontPboard="CPFontPboard";
  4CPRulerPboard="CPRulerPboard";
  5CPFindPboard="CPFindPboard";
  6CPDragPboard="CPDragPboard";
  7CPColorPboardType="CPColorPboardType";
  8CPFilenamesPboardType="CPFilenamesPboardType";
  9CPFontPboardType="CPFontPboardType";
 10CPHTMLPboardType="CPHTMLPboardType";
 11CPStringPboardType="CPStringPboardType";
 12CPURLPboardType="CPURLPboardType";
 13CPImagePboardType="CPImagePboardType";
 14var _1=nil;
 15var _2=objj_allocateClassPair(CPObject,"CPPasteboard"),_3=_2.isa;
 16class_addIvars(_2,[new objj_ivar("_types"),new objj_ivar("_owners"),new objj_ivar("_provided"),new objj_ivar("_changeCount"),new objj_ivar("_stateUID")]);
 17objj_registerClassPair(_2);
 18objj_addClassForBundle(_2,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
 19class_addMethods(_2,[new objj_method(sel_getUid("_initWithName:"),function(_4,_5,_6){
 20with(_4){
 21_4=objj_msgSendSuper({receiver:_4,super_class:objj_getClass("CPObject")},"init");
 22if(_4){
 23_name=_6;
 24_types=[];
 25_owners=objj_msgSend(CPDictionary,"dictionary");
 26_provided=objj_msgSend(CPDictionary,"dictionary");
 27_changeCount=0;
 28}
 29return _4;
 30}
 31}),new objj_method(sel_getUid("addTypes:owner:"),function(_7,_8,_9,_a){
 32with(_7){
 33var i=0,_c=_9.length;
 34for(;i<_c;++i){
 35var _d=_9[i];
 36if(!objj_msgSend(_owners,"objectForKey:",_d)){
 37objj_msgSend(_types,"addObject:",_d);
 38objj_msgSend(_provided,"removeObjectForKey:",_d);
 39}
 40objj_msgSend(_owners,"setObject:forKey:",_a,_d);
 41}
 42return ++_changeCount;
 43}
 44}),new objj_method(sel_getUid("declareTypes:owner:"),function(_e,_f,_10,_11){
 45with(_e){
 46objj_msgSend(_types,"setArray:",_10);
 47_owners=objj_msgSend(CPDictionary,"dictionary");
 48_provided=objj_msgSend(CPDictionary,"dictionary");
 49var _12=_types.length;
 50while(_12--){
 51objj_msgSend(_owners,"setObject:forKey:",_11,_types[_12]);
 52}
 53return ++_changeCount;
 54}
 55}),new objj_method(sel_getUid("setData:forType:"),function(_13,_14,_15,_16){
 56with(_13){
 57objj_msgSend(_provided,"setObject:forKey:",_15,_16);
 58return YES;
 59}
 60}),new objj_method(sel_getUid("setPropertyList:forType:"),function(_17,_18,_19,_1a){
 61with(_17){
 62return objj_msgSend(_17,"setData:forType:",objj_msgSend(CPPropertyListSerialization,"dataFromPropertyList:format:errorDescription:",_19,CPPropertyListXMLFormat_v1_0,nil),_1a);
 63}
 64}),new objj_method(sel_getUid("setString:forType:"),function(_1b,_1c,_1d,_1e){
 65with(_1b){
 66return objj_msgSend(_1b,"setPropertyList:forType:",_1d,_1e);
 67}
 68}),new objj_method(sel_getUid("availableTypeFromArray:"),function(_1f,_20,_21){
 69with(_1f){
 70return objj_msgSend(_types,"firstObjectCommonWithArray:",_21);
 71}
 72}),new objj_method(sel_getUid("types"),function(_22,_23){
 73with(_22){
 74return _types;
 75}
 76}),new objj_method(sel_getUid("changeCount"),function(_24,_25){
 77with(_24){
 78return _changeCount;
 79}
 80}),new objj_method(sel_getUid("dataForType:"),function(_26,_27,_28){
 81with(_26){
 82var _29=objj_msgSend(_provided,"objectForKey:",_28);
 83if(_29){
 84return _29;
 85}
 86var _2a=objj_msgSend(_owners,"objectForKey:",_28);
 87if(_2a){
 88objj_msgSend(_2a,"pasteboard:provideDataForType:",_26,_28);
 89++_changeCount;
 90return objj_msgSend(_provided,"objectForKey:",_28);
 91}
 92return nil;
 93}
 94}),new objj_method(sel_getUid("propertyListForType:"),function(_2b,_2c,_2d){
 95with(_2b){
 96var _2e=objj_msgSend(_2b,"dataForType:",_2d);
 97if(_2e){
 98return objj_msgSend(CPPropertyListSerialization,"propertyListFromData:format:errorDescription:",_2e,CPPropertyListXMLFormat_v1_0,nil);
 99}
100return nil;
101}
102}),new objj_method(sel_getUid("stringForType:"),function(_2f,_30,_31){
103with(_2f){
104return objj_msgSend(_2f,"propertyListForType:",_31);
105}
106}),new objj_method(sel_getUid("_generateStateUID"),function(_32,_33){
107with(_32){
108var _34=32;
109_stateUID="";
110while(_34--){
111_stateUID+=FLOOR(RAND()*16).toString(16).toUpperCase();
112}
113return _stateUID;
114}
115}),new objj_method(sel_getUid("_stateUID"),function(_35,_36){
116with(_35){
117return _stateUID;
118}
119})]);
120class_addMethods(_3,[new objj_method(sel_getUid("initialize"),function(_37,_38){
121with(_37){
122if(_37!=objj_msgSend(CPPasteboard,"class")){
123return;
124}
125objj_msgSend(_37,"setVersion:",1);
126_1=objj_msgSend(CPDictionary,"dictionary");
127}
128}),new objj_method(sel_getUid("generalPasteboard"),function(_39,_3a){
129with(_39){
130return objj_msgSend(CPPasteboard,"pasteboardWithName:",CPGeneralPboard);
131}
132}),new objj_method(sel_getUid("pasteboardWithName:"),function(_3b,_3c,_3d){
133with(_3b){
134var _3e=objj_msgSend(_1,"objectForKey:",_3d);
135if(_3e){
136return _3e;
137}
138_3e=objj_msgSend(objj_msgSend(CPPasteboard,"alloc"),"_initWithName:",_3d);
139objj_msgSend(_1,"setObject:forKey:",_3e,_3d);
140return _3e;
141}
142})]);