Changeset 14247
- Timestamp:
- Sep 10, 2010, 1:41:33 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/source/cocoa-ide/cocoa-editor.lisp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/cocoa-ide/cocoa-editor.lisp
r14215 r14247 1799 1799 (text-view-context-menu)) 1800 1800 1801 (defun pathname-for-namestring-fragment (string) 1802 "Return a pathname that STRING might designate." 1803 ;; We could get fancy here, but for now just be stupid. 1804 (let ((pathname (ignore-errors (probe-file string)))) 1805 (if (and (pathnamep pathname) 1806 (not (directory-pathname-p pathname))) 1807 pathname))) 1808 1809 ;;; If we get here, we've already checked that the selection represents 1810 ;;; a valid pathname. 1811 (objc:defmethod (#/openSelection: :void) ((self hemlock-text-view) sender) 1812 (declare (ignore sender)) 1813 (let* ((text (#/string self)) 1814 (selection (#/substringWithRange: text (#/selectedRange self))) 1815 (pathname (pathname-for-namestring-fragment 1816 (lisp-string-from-nsstring selection)))) 1817 (ed pathname))) 1818 1819 ;;; If we get here, we've already checked that the selection represents 1820 ;;; a valid symbol name. 1821 (objc:defmethod (#/inspectSelection: :void) ((self hemlock-text-view) sender) 1822 (declare (ignore sender)) 1823 (let* ((text (#/string self)) 1824 (selection (#/substringWithRange: text (#/selectedRange self))) 1825 (symbol-name (string-upcase (lisp-string-from-nsstring selection)))) 1826 (inspect (find-symbol symbol-name)))) 1827 1801 1828 ;;; If we don't override this, NSTextView will start adding Google/ 1802 1829 ;;; Spotlight search options and dictionary lookup when a selection … … 1804 1831 (objc:defmethod #/menuForEvent: ((self hemlock-text-view) event) 1805 1832 (declare (ignore event)) 1806 (#/menu self)) 1833 (let* ((text (#/string self)) 1834 (selection (#/substringWithRange: text (#/selectedRange self))) 1835 (s (lisp-string-from-nsstring selection)) 1836 (menu (if (> (length s) 0) 1837 (#/copy (#/menu self)) 1838 (#/retain (#/menu self))))) 1839 (when (find-symbol (string-upcase s)) 1840 (let* ((title (#/stringByAppendingString: #@"Inspect " selection)) 1841 (item (make-instance 'ns:ns-menu-item :with-title title 1842 :action (@selector #/inspectSelection:) 1843 :key-equivalent #@""))) 1844 (#/setTarget: item self) 1845 (#/insertItem:atIndex: menu item 0) 1846 (#/release item))) 1847 (when (pathname-for-namestring-fragment s) 1848 (let* ((title (#/stringByAppendingString: #@"Open " selection)) 1849 (item (make-instance 'ns:ns-menu-item :with-title title 1850 :action (@selector #/openSelection:) 1851 :key-equivalent #@""))) 1852 (#/setTarget: item self) 1853 (#/insertItem:atIndex: menu item 0) 1854 (#/release item))) 1855 1856 (#/autorelease menu))) 1807 1857 1808 1858 (defun make-scrolling-text-view-for-textstorage (textstorage x y width height tracks-width color style)
Note:
See TracChangeset
for help on using the changeset viewer.
