source: trunk/ccl/cocoa-ide/cocoa.lisp @ 7116

Last change on this file since 7116 was 7116, checked in by gz, 13 years ago

umm, load cocoa-grep where it will work...

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1(in-package "CCL")
2
3;;; We need to be able to point the CoreFoundation and Cocoa libraries
4;;; at some bundle very early in the process.  If you want to use some
5;;; other bundle path, you may need to change the call to FAKE-CFBUNDLE-PATH
6;;; below.
7
8#+darwin-target
9(progn
10  (require "FAKE-CFBUNDLE-PATH")
11  (fake-cfbundle-path "ccl:cocoa-ide;OpenMCL.app;" "ccl:cocoa-ide;Info.plist-proto"))
12
13
14(require "OBJC-SUPPORT")
15
16(if (< #&NSAppKitVersionNumber 824)
17  (error "This application requires features introduced in OSX 10.4."))
18
19(defparameter *standalone-cocoa-ide* nil)
20
21 
22(require "COCOA-UTILS")
23(require "COCOA-WINDOW")
24(require "COCOA-DOC")
25(require "COCOA-LISTENER")
26(require "COCOA-GREP")
27(require "COCOA-BACKTRACE")
28(require "COCOA-INSPECTOR")
29
30(def-cocoa-default *ccl-directory* :string (ensure-directory-namestring (namestring (ccl-directory))) nil #'(lambda (old new) (unless (equal old new) (replace-base-translation "ccl:" new))))
31
32
33;;; The application delegate gets notified of state changes in the
34;;; application object.
35(defclass lisp-application-delegate (ns:ns-object)
36    ()
37  (:metaclass ns:+ns-object))
38
39
40(objc:defmethod (#/applicationWillFinishLaunching: :void)
41    ((self lisp-application-delegate) notification)
42  (declare (ignore notification))
43  (initialize-user-interface))
44
45(objc:defmethod (#/applicationWillTerminate: :void)
46    ((self lisp-application-delegate) notification)
47  (declare (ignore notification))
48  ;; UI has decided to quit; terminate other lisp threads.
49  (prepare-to-quit))
50
51(objc:defmethod (#/newListener: :void) ((self lisp-application-delegate)
52                                        sender)
53  (declare (ignore sender))
54  (#/openUntitledDocumentOfType:display:
55   (#/sharedDocumentController ns:ns-document-controller)
56   #@"Listener"
57   t))
58
59(defvar *cocoa-application-finished-launching* (make-semaphore)
60  "Semaphore that's signaled when the application's finished launching ...")
61
62(objc:defmethod (#/applicationDidFinishLaunching: :void)
63    ((self lisp-application-delegate) notification)
64  (declare (ignore notification))
65  (signal-semaphore *cocoa-application-finished-launching*))
66
67(objc:defmethod (#/applicationOpenUntitledFile: :<BOOL>)
68    ((self lisp-application-delegate) app)
69  (when (zerop *cocoa-listener-count*)
70    (#/newListener: self app)
71    t))
72
73
74(defmethod ui-object-do-operation ((o ns:ns-application)
75                                   operation
76                                   &rest args)
77  (declare (ignore operation args))
78  ;; Do nothing.  Would it be better to warn and/or log this ?
79  )
80
81(defmethod ui-object-do-operation ((o ns:ns-application)
82                                   (operation (eql :note-current-package))
83                                   &rest args)
84  (ui-object-note-package o (car args)))
85
86(defmethod ui-object-do-operation ((o ns:ns-application)
87                                   (operation (eql :eval-selection))
88                                   &rest args)
89  (ui-object-eval-selection o (car args)))
90
91(defmethod ui-object-do-operation ((o ns:ns-application)
92                                   (operation (eql :enter-backtrace-context))
93                                   &rest args)
94  (ui-object-enter-backtrace-context o (car args)))
95
96(defmethod ui-object-do-operation ((o ns:ns-application)
97                                   (operation (eql :exit-backtrace-context))
98                                   &rest args)
99  (ui-object-exit-backtrace-context o (car args)))
100
101
102
103
104(start-cocoa-application)
105
Note: See TracBrowser for help on using the repository browser.