source: branches/ide-1.0/ccl/cocoa-ide/cocoa.lisp @ 6886

Last change on this file since 6886 was 6886, checked in by gb, 14 years ago

Change args/pathnames in fake-cfbundle-path call.

  • 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-BACKTRACE")
27(require "COCOA-INSPECTOR")
28
29(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))))
30
31
32;;; The application delegate gets notified of state changes in the
33;;; application object.
34(defclass lisp-application-delegate (ns:ns-object)
35    ()
36  (:metaclass ns:+ns-object))
37
38
39(objc:defmethod (#/applicationWillFinishLaunching: :void)
40    ((self lisp-application-delegate) notification)
41  (declare (ignore notification))
42  (initialize-user-interface))
43
44(objc:defmethod (#/applicationWillTerminate: :void)
45    ((self lisp-application-delegate) notification)
46  (declare (ignore notification))
47  ;; UI has decided to quit; terminate other lisp threads.
48  (prepare-to-quit))
49
50(objc:defmethod (#/newListener: :void) ((self lisp-application-delegate)
51                                        sender)
52  (declare (ignore sender))
53  (#/openUntitledDocumentOfType:display:
54   (#/sharedDocumentController ns:ns-document-controller)
55   #@"Listener"
56   t))
57
58(defvar *cocoa-application-finished-launching* (make-semaphore)
59  "Semaphore that's signaled when the application's finished launching ...")
60
61(objc:defmethod (#/applicationDidFinishLaunching: :void)
62    ((self lisp-application-delegate) notification)
63  (declare (ignore notification))
64  (signal-semaphore *cocoa-application-finished-launching*))
65
66(objc:defmethod (#/applicationOpenUntitledFile: :<BOOL>)
67    ((self lisp-application-delegate) app)
68  (when (zerop *cocoa-listener-count*)
69    (#/newListener: self app)
70    t))
71
72
73(defmethod ui-object-do-operation ((o ns:ns-application)
74                                   operation
75                                   &rest args)
76  (declare (ignore operation args))
77  ;; Do nothing.  Would it be better to warn and/or log this ?
78  )
79
80(defmethod ui-object-do-operation ((o ns:ns-application)
81                                   (operation (eql :note-current-package))
82                                   &rest args)
83  (ui-object-note-package o (car args)))
84
85(defmethod ui-object-do-operation ((o ns:ns-application)
86                                   (operation (eql :eval-selection))
87                                   &rest args)
88  (ui-object-eval-selection o (car args)))
89
90(defmethod ui-object-do-operation ((o ns:ns-application)
91                                   (operation (eql :enter-backtrace-context))
92                                   &rest args)
93  (ui-object-enter-backtrace-context o (car args)))
94
95(defmethod ui-object-do-operation ((o ns:ns-application)
96                                   (operation (eql :exit-backtrace-context))
97                                   &rest args)
98  (ui-object-exit-backtrace-context o (car args)))
99
100
101
102
103(start-cocoa-application)
104
Note: See TracBrowser for help on using the repository browser.