/Frameworks/AppKit/rhino.platform/CPWindowController.j
http://github.com/polymar/polish · Unknown · 121 lines · 121 code · 0 blank · 0 comment · 0 complexity · bfc683d4dc44eb243b000b4bc9da4003 MD5 · raw file
- I;21;Foundation/CPObject.jI;21;Foundation/CPString.ji;13;CPResponder.ji;10;CPWindow.ji;12;CPDocument.jc;4651;
- var _1=objj_allocateClassPair(CPResponder,"CPWindowController"),_2=_1.isa;
- class_addIvars(_1,[new objj_ivar("_owner"),new objj_ivar("_window"),new objj_ivar("_document"),new objj_ivar("_windowCibName")]);
- objj_registerClassPair(_1);
- objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
- class_addMethods(_1,[new objj_method(sel_getUid("initWithWindow:"),function(_3,_4,_5){
- with(_3){
- _3=objj_msgSendSuper({receiver:_3,super_class:objj_getClass("CPResponder")},"init");
- if(_3){
- objj_msgSend(_3,"setWindow:",_5);
- objj_msgSend(_3,"setNextResponder:",CPApp);
- }
- return _3;
- }
- }),new objj_method(sel_getUid("initWithWindowCibName:"),function(_6,_7,_8){
- with(_6){
- return objj_msgSend(_6,"initWithWindowCibName:owner:",_8,_6);
- }
- }),new objj_method(sel_getUid("initWithWindowCibName:owner:"),function(_9,_a,_b,_c){
- with(_9){
- _9=objj_msgSendSuper({receiver:_9,super_class:objj_getClass("CPResponder")},"init");
- if(_9){
- _owner=_c;
- _windowCibName=_b;
- objj_msgSend(_9,"setNextResponder:",CPApp);
- }
- return _9;
- }
- }),new objj_method(sel_getUid("loadWindow"),function(_d,_e){
- with(_d){
- objj_msgSend(_d,"windowWillLoad");
- objj_msgSend(_d,"setWindow:",CPApp._keyWindow=objj_msgSend(objj_msgSend(CPWindow,"alloc"),"initWithContentRect:styleMask:",CPRectMakeZero(),CPBorderlessBridgeWindowMask|CPTitledWindowMask|CPClosableWindowMask|CPResizableWindowMask));
- objj_msgSend(_d,"windowDidLoad");
- }
- }),new objj_method(sel_getUid("showWindow:"),function(_f,_10,_11){
- with(_f){
- var _12=objj_msgSend(_f,"window");
- if(objj_msgSend(_12,"respondsToSelector:",sel_getUid("becomesKeyOnlyIfNeeded"))&&objj_msgSend(_12,"becomesKeyOnlyIfNeeded")){
- objj_msgSend(_12,"orderFront:",_11);
- }else{
- objj_msgSend(_12,"makeKeyAndOrderFront:",_11);
- }
- }
- }),new objj_method(sel_getUid("isWindowLoaded"),function(_13,_14){
- with(_13){
- return _window;
- }
- }),new objj_method(sel_getUid("window"),function(_15,_16){
- with(_15){
- if(!_window){
- objj_msgSend(_15,"loadWindow");
- }
- return _window;
- }
- }),new objj_method(sel_getUid("setWindow:"),function(_17,_18,_19){
- with(_17){
- _window=_19;
- objj_msgSend(_window,"setWindowController:",_17);
- objj_msgSend(_window,"setNextResponder:",_17);
- }
- }),new objj_method(sel_getUid("windowDidLoad"),function(_1a,_1b){
- with(_1a){
- objj_msgSend(_document,"windowControllerDidLoadNib:",_1a);
- objj_msgSend(_1a,"synchronizeWindowTitleWithDocumentName");
- }
- }),new objj_method(sel_getUid("windowWillLoad"),function(_1c,_1d){
- with(_1c){
- objj_msgSend(_document,"windowControllerWillLoadNib:",_1c);
- }
- }),new objj_method(sel_getUid("setDocument:"),function(_1e,_1f,_20){
- with(_1e){
- if(_document==_20){
- return;
- }
- var _21=objj_msgSend(CPNotificationCenter,"defaultCenter");
- if(_document){
- objj_msgSend(_21,"removeObserver:name:object:",_1e,CPDocumentWillSaveNotification,_document);
- objj_msgSend(_21,"removeObserver:name:object:",_1e,CPDocumentDidSaveNotification,_document);
- objj_msgSend(_21,"removeObserver:name:object:",_1e,CPDocumentDidFailToSaveNotification,_document);
- }
- _document=_20;
- if(_document){
- objj_msgSend(_21,"addObserver:selector:name:object:",_1e,sel_getUid("_documentWillSave:"),CPDocumentWillSaveNotification,_document);
- objj_msgSend(_21,"addObserver:selector:name:object:",_1e,sel_getUid("_documentDidSave:"),CPDocumentDidSaveNotification,_document);
- objj_msgSend(_21,"addObserver:selector:name:object:",_1e,sel_getUid("_documentDidFailToSave:"),CPDocumentDidFailToSaveNotification,_document);
- objj_msgSend(_1e,"setDocumentEdited:",objj_msgSend(_document,"isDocumentEdited"));
- }
- objj_msgSend(_1e,"synchronizeWindowTitleWithDocumentName");
- }
- }),new objj_method(sel_getUid("_documentWillSave:"),function(_22,_23,_24){
- with(_22){
- objj_msgSend(objj_msgSend(_22,"window"),"setDocumentSaving:",YES);
- }
- }),new objj_method(sel_getUid("_documentDidSave:"),function(_25,_26,_27){
- with(_25){
- objj_msgSend(objj_msgSend(_25,"window"),"setDocumentSaving:",NO);
- }
- }),new objj_method(sel_getUid("_documentDidFailToSave:"),function(_28,_29,_2a){
- with(_28){
- objj_msgSend(objj_msgSend(_28,"window"),"setDocumentSaving:",NO);
- }
- }),new objj_method(sel_getUid("document"),function(_2b,_2c){
- with(_2b){
- return _document;
- }
- }),new objj_method(sel_getUid("setDocumentEdited:"),function(_2d,_2e,_2f){
- with(_2d){
- objj_msgSend(objj_msgSend(_2d,"window"),"setDocumentEdited:",_2f);
- }
- }),new objj_method(sel_getUid("synchronizeWindowTitleWithDocumentName"),function(_30,_31){
- with(_30){
- if(!_document||!_window){
- return;
- }
- objj_msgSend(_window,"setTitle:",objj_msgSend(_30,"windowTitleForDocumentDisplayName:",objj_msgSend(_document,"displayName")));
- }
- }),new objj_method(sel_getUid("windowTitleForDocumentDisplayName:"),function(_32,_33,_34){
- with(_32){
- return _34;
- }
- })]);