/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

  1. I;21;Foundation/CPObject.jI;21;Foundation/CPString.ji;13;CPResponder.ji;10;CPWindow.ji;12;CPDocument.jc;4651;
  2. var _1=objj_allocateClassPair(CPResponder,"CPWindowController"),_2=_1.isa;
  3. class_addIvars(_1,[new objj_ivar("_owner"),new objj_ivar("_window"),new objj_ivar("_document"),new objj_ivar("_windowCibName")]);
  4. objj_registerClassPair(_1);
  5. objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  6. class_addMethods(_1,[new objj_method(sel_getUid("initWithWindow:"),function(_3,_4,_5){
  7. with(_3){
  8. _3=objj_msgSendSuper({receiver:_3,super_class:objj_getClass("CPResponder")},"init");
  9. if(_3){
  10. objj_msgSend(_3,"setWindow:",_5);
  11. objj_msgSend(_3,"setNextResponder:",CPApp);
  12. }
  13. return _3;
  14. }
  15. }),new objj_method(sel_getUid("initWithWindowCibName:"),function(_6,_7,_8){
  16. with(_6){
  17. return objj_msgSend(_6,"initWithWindowCibName:owner:",_8,_6);
  18. }
  19. }),new objj_method(sel_getUid("initWithWindowCibName:owner:"),function(_9,_a,_b,_c){
  20. with(_9){
  21. _9=objj_msgSendSuper({receiver:_9,super_class:objj_getClass("CPResponder")},"init");
  22. if(_9){
  23. _owner=_c;
  24. _windowCibName=_b;
  25. objj_msgSend(_9,"setNextResponder:",CPApp);
  26. }
  27. return _9;
  28. }
  29. }),new objj_method(sel_getUid("loadWindow"),function(_d,_e){
  30. with(_d){
  31. objj_msgSend(_d,"windowWillLoad");
  32. objj_msgSend(_d,"setWindow:",CPApp._keyWindow=objj_msgSend(objj_msgSend(CPWindow,"alloc"),"initWithContentRect:styleMask:",CPRectMakeZero(),CPBorderlessBridgeWindowMask|CPTitledWindowMask|CPClosableWindowMask|CPResizableWindowMask));
  33. objj_msgSend(_d,"windowDidLoad");
  34. }
  35. }),new objj_method(sel_getUid("showWindow:"),function(_f,_10,_11){
  36. with(_f){
  37. var _12=objj_msgSend(_f,"window");
  38. if(objj_msgSend(_12,"respondsToSelector:",sel_getUid("becomesKeyOnlyIfNeeded"))&&objj_msgSend(_12,"becomesKeyOnlyIfNeeded")){
  39. objj_msgSend(_12,"orderFront:",_11);
  40. }else{
  41. objj_msgSend(_12,"makeKeyAndOrderFront:",_11);
  42. }
  43. }
  44. }),new objj_method(sel_getUid("isWindowLoaded"),function(_13,_14){
  45. with(_13){
  46. return _window;
  47. }
  48. }),new objj_method(sel_getUid("window"),function(_15,_16){
  49. with(_15){
  50. if(!_window){
  51. objj_msgSend(_15,"loadWindow");
  52. }
  53. return _window;
  54. }
  55. }),new objj_method(sel_getUid("setWindow:"),function(_17,_18,_19){
  56. with(_17){
  57. _window=_19;
  58. objj_msgSend(_window,"setWindowController:",_17);
  59. objj_msgSend(_window,"setNextResponder:",_17);
  60. }
  61. }),new objj_method(sel_getUid("windowDidLoad"),function(_1a,_1b){
  62. with(_1a){
  63. objj_msgSend(_document,"windowControllerDidLoadNib:",_1a);
  64. objj_msgSend(_1a,"synchronizeWindowTitleWithDocumentName");
  65. }
  66. }),new objj_method(sel_getUid("windowWillLoad"),function(_1c,_1d){
  67. with(_1c){
  68. objj_msgSend(_document,"windowControllerWillLoadNib:",_1c);
  69. }
  70. }),new objj_method(sel_getUid("setDocument:"),function(_1e,_1f,_20){
  71. with(_1e){
  72. if(_document==_20){
  73. return;
  74. }
  75. var _21=objj_msgSend(CPNotificationCenter,"defaultCenter");
  76. if(_document){
  77. objj_msgSend(_21,"removeObserver:name:object:",_1e,CPDocumentWillSaveNotification,_document);
  78. objj_msgSend(_21,"removeObserver:name:object:",_1e,CPDocumentDidSaveNotification,_document);
  79. objj_msgSend(_21,"removeObserver:name:object:",_1e,CPDocumentDidFailToSaveNotification,_document);
  80. }
  81. _document=_20;
  82. if(_document){
  83. objj_msgSend(_21,"addObserver:selector:name:object:",_1e,sel_getUid("_documentWillSave:"),CPDocumentWillSaveNotification,_document);
  84. objj_msgSend(_21,"addObserver:selector:name:object:",_1e,sel_getUid("_documentDidSave:"),CPDocumentDidSaveNotification,_document);
  85. objj_msgSend(_21,"addObserver:selector:name:object:",_1e,sel_getUid("_documentDidFailToSave:"),CPDocumentDidFailToSaveNotification,_document);
  86. objj_msgSend(_1e,"setDocumentEdited:",objj_msgSend(_document,"isDocumentEdited"));
  87. }
  88. objj_msgSend(_1e,"synchronizeWindowTitleWithDocumentName");
  89. }
  90. }),new objj_method(sel_getUid("_documentWillSave:"),function(_22,_23,_24){
  91. with(_22){
  92. objj_msgSend(objj_msgSend(_22,"window"),"setDocumentSaving:",YES);
  93. }
  94. }),new objj_method(sel_getUid("_documentDidSave:"),function(_25,_26,_27){
  95. with(_25){
  96. objj_msgSend(objj_msgSend(_25,"window"),"setDocumentSaving:",NO);
  97. }
  98. }),new objj_method(sel_getUid("_documentDidFailToSave:"),function(_28,_29,_2a){
  99. with(_28){
  100. objj_msgSend(objj_msgSend(_28,"window"),"setDocumentSaving:",NO);
  101. }
  102. }),new objj_method(sel_getUid("document"),function(_2b,_2c){
  103. with(_2b){
  104. return _document;
  105. }
  106. }),new objj_method(sel_getUid("setDocumentEdited:"),function(_2d,_2e,_2f){
  107. with(_2d){
  108. objj_msgSend(objj_msgSend(_2d,"window"),"setDocumentEdited:",_2f);
  109. }
  110. }),new objj_method(sel_getUid("synchronizeWindowTitleWithDocumentName"),function(_30,_31){
  111. with(_30){
  112. if(!_document||!_window){
  113. return;
  114. }
  115. objj_msgSend(_window,"setTitle:",objj_msgSend(_30,"windowTitleForDocumentDisplayName:",objj_msgSend(_document,"displayName")));
  116. }
  117. }),new objj_method(sel_getUid("windowTitleForDocumentDisplayName:"),function(_32,_33,_34){
  118. with(_32){
  119. return _34;
  120. }
  121. })]);