Changeset 7532


Ignore:
Timestamp:
Oct 27, 2007, 7:59:43 PM (13 years ago)
Author:
mikel
Message:

added implementations for the Compile Buffer and Compile And Load Buffer menu items

Location:
trunk/ccl/cocoa-ide
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/cocoa-ide/cocoa-editor.lisp

    r7531 r7532  
    924924         (pathname (hi::buffer-pathname buffer)))
    925925    (ui-object-load-buffer *NSApp* (list package-name pathname))))
     926
     927(objc:defmethod (#/compileBuffer: :void) ((self hemlock-text-view) sender)
     928  (declare (ignore sender))
     929  (let* ((dc (#/sharedDocumentController ns:ns-document-controller))
     930         (doc (#/documentForWindow: dc (#/window self)))
     931         (buffer (hemlock-document-buffer doc))
     932         (package-name (hi::variable-value 'hemlock::current-package :buffer buffer))
     933         (pathname (hi::buffer-pathname buffer)))
     934    (ui-object-compile-buffer *NSApp* (list package-name pathname))))
     935
     936(objc:defmethod (#/compileAndLoadBuffer: :void) ((self hemlock-text-view) sender)
     937  (declare (ignore sender))
     938  (let* ((dc (#/sharedDocumentController ns:ns-document-controller))
     939         (doc (#/documentForWindow: dc (#/window self)))
     940         (buffer (hemlock-document-buffer doc))
     941         (package-name (hi::variable-value 'hemlock::current-package :buffer buffer))
     942         (pathname (hi::buffer-pathname buffer)))
     943    (ui-object-compile-and-load-buffer *NSApp* (list package-name pathname))))
    926944
    927945(defloadvar *text-view-context-menu* ())
     
    21442162          ;; if this hemlock-text-view is in an editor windowm and its buffer has
    21452163          ;; an associated pathname, then activate the Load Buffer item
    2146           ((eql action (@selector #/loadBuffer:))
     2164          ((or (eql action (@selector #/loadBuffer:))
     2165               (eql action (@selector #/compileBuffer:))
     2166               (eql action (@selector #/compileAndLoadBuffer:)))
    21472167           (let* ((d (hemlock-buffer-string-cache (#/hemlockString (#/textStorage self))))
    21482168                  (buffer (buffer-cache-buffer d))
  • trunk/ccl/cocoa-ide/cocoa-listener.lisp

    r7531 r7532  
    554554            (hi::send-string-to-listener-process target-listener string :package package :path path))))))
    555555
     556(defmethod ui-object-compile-buffer ((app ns:ns-application) selection)
     557  (let* ((target-listener (ui-object-choose-listener-for-selection app nil)))
     558    (if (typep target-listener 'cocoa-listener-process)
     559        (destructuring-bind (package path) selection
     560          (let ((string (format nil "(compile-file ~S)" path)))
     561            (hi::send-string-to-listener-process target-listener string :package package :path path))))))
     562
     563(defmethod ui-object-compile-and-load-buffer ((app ns:ns-application) selection)
     564  (let* ((target-listener (ui-object-choose-listener-for-selection app nil)))
     565    (if (typep target-listener 'cocoa-listener-process)
     566        (destructuring-bind (package path) selection
     567          (let ((string (format nil "(progn (compile-file ~S)(load ~S))"
     568                                path
     569                                (make-pathname :directory (pathname-directory path)
     570                                               :name (pathname-name path)
     571                                               :type (pathname-type path)))))
     572            (hi::send-string-to-listener-process target-listener string :package package :path path))))))
    556573
    557574       
Note: See TracChangeset for help on using the changeset viewer.