Changeset 12782


Ignore:
Timestamp:
Sep 8, 2009, 1:27:21 PM (10 years ago)
Author:
gfoy
Message:

Miscellaneous.

Location:
trunk/source/contrib/foy/list-definitions-cm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/contrib/foy/list-definitions-cm/history-lists.lisp

    r12746 r12782  
    3232(defParameter *file-history-list-length* 25)
    3333
    34 (export '(notify))
    35 
    36 ;;; This includes a work-around for what appears to be a bug in the hemlock-frame
    37 ;;; #/close method.  After a #/close, the window remains on the (#/orderedWindows *NSApp*)
    38 ;;; list, but (hi::buffer-document buffer) in NIL.  Therefore the extra tests:
    39 (defun window-with-path (path)
    40   "If a window with PATH is open, return it."
    41   (gui::first-window-satisfying-predicate
    42    #'(lambda (w)
    43        (when (and (typep w 'gui::hemlock-frame)
    44                   (not (typep w 'gui::hemlock-listener-frame)))
    45          (let* ((pane (slot-value w 'gui::pane))
    46                 (text-view (gui::text-pane-text-view pane))
    47                 (buffer (gui::hemlock-buffer text-view))
    48                 (document (when buffer (hi::buffer-document buffer)))
    49                 (p (hi::buffer-pathname buffer)))
    50            (when (and document p) (string-equal path p)))))))
    51 
    5234(defun maybe-open-file (path)
    5335  "If a window with PATH is open, return it.  Otherwise open a new window."
    54   (let ((w (window-with-path path)))
     36  (let ((w (cmenu:window-with-path path)))
    5537    (if w
    5638      w
     
    6547                     (hemlock::user-homedir-pathname)))
    6648
    67 (defun notify (message)
    68   "FYI"
    69   (gui::alert-window :title "Notification" :message message))
    7049
    7150;;; ----------------------------------------------------------------------------
     
    8665  (let* ((name (hle-name entry))
    8766         (path (hle-path entry))
    88          (window (window-with-path path))
     67         (window (cmenu:window-with-path path))
    8968         mark def-list text-view hemlock-view)
    9069    (unless (probe-file path)
    91       (notify (format nil "~a does not exist.  It will be deleted from the history lists."
     70      (cmenu:notify (format nil "~a does not exist.  It will be deleted from the history lists."
    9271                      path))
    9372      (purge-file-references *position-history-list* path)
     
    11796             (move-entry-to-front *file-history-list* path) t)
    11897            (t
    119              (notify (format nil "Cannot find ~S.  It will be deleted from the position history list."
     98             (cmenu:notify (format nil "Cannot find ~S.  It will be deleted from the position history list."
    12099                             name))
    121100             (remove-entry *position-history-list* name) nil)))))
     
    130109  (let ((path (hle-path entry)))
    131110    (unless (probe-file path)
    132       (notify (format nil "~S does not exist.  It will be deleted from the history lists." path))
     111      (cmenu:notify (format nil "~S does not exist.  It will be deleted from the history lists." path))
    133112      (purge-file-references *position-history-list* path)
    134113      (remove-path *file-history-list* path)
    135114      (return-from show-entry nil))
    136     (let ((window (window-with-path path)))
     115    (let ((window (cmenu:window-with-path path)))
    137116      (unless window
    138117        (let ((hemlock-view (gui::cocoa-edit path)))
     
    426405(defMethod read-history-list ((hl history-list) stream &optional position-p)
    427406  (flet ((oops ()
    428            (notify (format nil "There is a problem with ~S. Setting the history to NIL." (hl-path hl)))
     407           (cmenu:notify (format nil "There is a problem with ~S. Setting the history to NIL." (hl-path hl)))
    429408           (setf (hl-list hl) nil)
    430409           ;;; delete the file?
     
    494473;;;
    495474(objc:defmethod (#/becomeKeyWindow :void) ((w gui::hemlock-frame))
    496   (let* ((path (window-path w))
     475  (let* ((path (cmenu:window-path w))
    497476         (name (when (and path (string-equal (pathname-type path) "lisp"))
    498477                 (concatenate 'string (pathname-name path) ".lisp"))))
  • trunk/source/contrib/foy/list-definitions-cm/list-definitions.lisp

    r12735 r12782  
    33;;; ----------------------------------------------------------------------------
    44;;;
    5 ;;;      list-definitionsisp
     5;;;      list-definitions.lisp
    66;;;
    77;;;      copyright (c) 2009 Glen Foy
     
    3333(require :context-menu-cm)
    3434
    35 (export '(find-and-display-definition))
     35(export '(find-and-display-definition window-path active-hemlock-window))
    3636
    3737(defParameter *objc-defmethod-search-pattern* (hi::new-search-pattern :string-insensitive :forward "(objc:defmethod"))
     
    4545
    4646(defmacro clone (mark) `(hi::copy-mark ,mark :temporary))
    47 
    48 (defun active-hemlock-window ()
    49   "Return the active hemlock-frame."
    50   (gui::first-window-satisfying-predicate
    51    #'(lambda (w)
    52        (and (typep w 'gui::hemlock-frame)
    53             (not (typep w 'gui::hemlock-listener-frame))
    54             (#/isKeyWindow w)))))
    55 
    56 (defun window-path (w)
    57   "Return the window's path."
    58   (let* ((pane (slot-value w 'gui::pane))
    59          (hemlock-view (when pane (gui::text-pane-hemlock-view pane)))
    60          (buffer (when hemlock-view (hi::hemlock-view-buffer hemlock-view))))
    61     (when buffer (hi::buffer-pathname buffer))))
    6247
    6348;;; ----------------------------------------------------------------------------
     
    149134                 :sub-title (if alpha-p "alphabetical" "positional")
    150135                 :menu-text-view text-view
    151                  :menu-path (window-path (#/window text-view))))
    152          (window (active-hemlock-window))
     136                 :menu-path (cmenu:window-path (#/window text-view))))
     137         (window (cmenu:active-hemlock-window))
    153138         (alist (when window (list-definitions window alpha-p)))
    154139         (class-icon (#/iconForFileType: (#/sharedWorkspace ns:ns-workspace) (ccl::%make-nsstring "lisp")))
     
    367352(defun find-and-display-definition (name path)
    368353  "Display the file and scroll to the definition position."
    369   (let ((window (window-with-path path))
     354  (let ((window (cmenu:window-with-path path))
    370355         mark def-list text-view hemlock-view)
    371356    (unless (probe-file path)
    372       (notify (format nil "~a does not exist."
     357      (cmenu:notify (format nil "~a does not exist."
    373358                      path))
    374359      (return-from find-and-display-definition nil))
Note: See TracChangeset for help on using the changeset viewer.