Changeset 12735


Ignore:
Timestamp:
Sep 2, 2009, 1:51:35 PM (10 years ago)
Author:
gfoy
Message:

Changed the appearance of the Default Tool submenu and added an alphabetical index to CL-Documentation-CM

Location:
trunk/source/contrib/foy
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/contrib/foy/cl-documentation-cm/cl-documentation-cm.lisp

    r12717 r12735  
    1212                                                     *loading-file-source-file*)))
    1313  (defParameter *cl-documentation-files*
    14     (list (merge-pathnames ";cl-documentation.lisp" *cl-documentation-directory*))))
     14    (list (merge-pathnames ";cl-documentation.lisp" *cl-documentation-directory*)
     15          (merge-pathnames ";cl-documentation-2.lisp" *cl-documentation-directory*))))
    1516 
    1617(dolist (file *cl-documentation-files*)
  • trunk/source/contrib/foy/cl-documentation-cm/cl-documentation.lisp

    r12717 r12735  
    55;;;      cl-documentation.lisp
    66;;;
    7 ;;;      copyright © 2009 Glen Foy
     7;;;      copyright (c) 2009 Glen Foy
    88;;;      (Permission is granted to Clozure Associates to distribute this file.)
    99;;;
     
    1717;;;
    1818;;;      Mod History, most recent first:
     19;;;      9/2/9   Added a second menu, providing an alphabetical index.
    1920;;;      8/31/9  version 0.1b1
    2021;;;              First cut.
     
    2930
    3031(defparameter *cl-documentation-menu* nil "The cl-documentation-menu instance.")
     32(defparameter *cl-alphabetical-menu* nil "The cl-alphabetical-menu instance.")
    3133
    3234
     
    3537(defClass CL-DOCUMENTATION-MENU (ns:ns-menu)
    3638  ((tool-menu :initform nil :accessor tool-menu)
     39   (sub-title :initform "functional groups" :reader sub-title)
    3740   (doc-path :initform (merge-pathnames ";ReadMe.rtf" cl-user::*cl-documentation-directory*) :reader doc-path)
    3841   (text-view :initform nil :accessor text-view))
     
    4447
    4548(objc:defmethod (#/update :void) ((m cl-documentation-menu))
    46   (cmenu:update-tool-menu m (tool-menu m))
     49  (cmenu:update-tool-menu m (tool-menu m) :sub-title (sub-title m))
    4750  (call-next-method))
    4851
     
    460463
    461464(defun get-cl-documentation-menu (view event)
    462   (declare (ignore event))
    463   (setf (text-view *cl-documentation-menu*) view)
    464   *cl-documentation-menu*)
     465  (cond ((logtest #$NSCommandKeyMask (#/modifierFlags event))
     466         (setf (text-view *cl-alphabetical-menu*) view)           
     467         *cl-alphabetical-menu*)
     468        (t
     469         (setf (text-view *cl-documentation-menu*) view)           
     470         *cl-documentation-menu*)))
    465471
    466472(cmenu:register-tool "CL-Documentation-CM" #'get-cl-documentation-menu)
  • trunk/source/contrib/foy/context-menu-cm/context-menu-cm.lisp

    r12717 r12735  
    55;;;      context-menu-cm.lisp
    66;;;
    7 ;;;      copyright © 2009 Glen Foy
     7;;;      copyright (c) 2009 Glen Foy
    88;;;      (Permission is granted to Clozure Associates to distribute this file.)
    99;;;
     
    1717;;;
    1818;;;      Mod History, most recent first:
     19;;;      9/2/9   Changed the appearance of the Default Tool submenu.
    1920;;;      8/31/9  version 0.1b1
    2021;;;              First cut
     
    146147  "Add the default tool submenu and possibly a documentation menu-item to MENU."
    147148  (let ((default-item (make-instance ns:ns-menu-item))
    148         (attributed-string (#/initWithString:attributes:
    149                             (#/alloc ns:ns-attributed-string)
    150                             (ccl::%make-nsstring (format nil "TOOL: ~S" (default-tool *menu-manager*)))
    151                             *tool-label-dictionary*))
    152149        (tool-menu (make-instance 'default-tool-menu)))
    153     (#/setAttributedTitle: default-item attributed-string)
     150    ;; Title is set by update method.
    154151    (#/setSubmenu: default-item tool-menu)
    155152    (#/insertItem:atIndex: menu default-item 0)
     
    158155                 (attributed-string (#/initWithString:attributes:
    159156                                     (#/alloc ns:ns-attributed-string)
    160                                      (ccl::%make-nsstring (format nil "doc..." (default-tool *menu-manager*)))
     157                                     (ccl::%make-nsstring (format nil "     doc..." (default-tool *menu-manager*)))
    161158                                     *tool-doc-dictionary*)))
    162159             (#/setAttributedTitle: doc-item attributed-string)
     
    170167    tool-menu))
    171168
    172 (defun update-tool-menu (menu default-menu)
     169(defun update-tool-menu (menu default-menu &key sub-title)
    173170  "Update MENU's Tool submenu."
    174171  (let ((first-item (#/itemAtIndex: menu 0))
    175172        (attributed-string (#/initWithString:attributes:
    176173                            (#/alloc ns:ns-attributed-string)
    177                             (ccl::%make-nsstring (format nil "TOOL: ~S" (default-tool *menu-manager*)))
     174                            (if sub-title
     175                              (ccl::%make-nsstring (format nil "~S
     176    (~A)" (default-tool *menu-manager*) sub-title))
     177                              (ccl::%make-nsstring (format nil "~S" (default-tool *menu-manager*))))
    178178                            *tool-label-dictionary*)))
    179179    (#/setAttributedTitle: first-item attributed-string)
  • trunk/source/contrib/foy/hemlock-commands-cm/hemlock-commands-1.lisp

    r12717 r12735  
    55;;;      hemlock-commands-1.lisp
    66;;;
    7 ;;;      copyright © 2009 Glen Foy
     7;;;      copyright (c) 2009 Glen Foy
    88;;;      (Permission is granted to Clozure Associates to distribute this file.)
    99;;;
     
    4141(defclass HEMLOCK-COMMANDS-MENU (ns:ns-menu)
    4242  ((tool-menu :initform nil :accessor tool-menu)
     43   (sub-title :initform "basic commands" :reader sub-title)
    4344   (doc-path :initform (merge-pathnames ";ReadMe.rtf" cl-user::*hemlock-commands-directory*) :reader doc-path)
    4445   (text-view :initform nil :accessor text-view))
     
    139140
    140141(objc:defmethod (#/update :void) ((self hemlock-commands-menu))
    141   (cmenu:update-tool-menu self (tool-menu self))
     142  (cmenu:update-tool-menu self (tool-menu self) :sub-title (sub-title self))
    142143  (call-next-method))
    143144
  • trunk/source/contrib/foy/hemlock-commands-cm/hemlock-commands-2.lisp

    r12717 r12735  
    55;;;      hemlock-commands-2.lisp
    66;;;
    7 ;;;      copyright © 2009 Glen Foy
     7;;;      copyright (c) 2009 Glen Foy
    88;;;      (Permission is granted to Clozure Associates to distribute this file.)
    99;;;
     
    105105(defclass HEMLOCK-COMMANDS-KEYWORD-MENU (ns:ns-menu)
    106106  ((tool-menu :initform nil :accessor tool-menu)
     107   (sub-title :initform "keyword filters" :reader sub-title)
    107108   (doc-path :initform (merge-pathnames ";ReadMe.rtf" cl-user::*hemlock-commands-directory*) :reader doc-path))
    108109  (:documentation "A popup menu with keyword submenus for filtering Hemlock commands.")
     
    142143
    143144(objc:defmethod (#/update :void) ((self hemlock-commands-keyword-menu))
    144   (cmenu:update-tool-menu self (tool-menu self))
     145  (cmenu:update-tool-menu self (tool-menu self) :sub-title (sub-title self))
    145146  (call-next-method))
    146147
  • trunk/source/contrib/foy/hemlock-commands-cm/hemlock-commands-new.lisp

    r12724 r12735  
    55;;;      hemlock-commands-new.lisp
    66;;;
    7 ;;;      copyright ï¿œ 2009 Glen Foy
     7;;;      copyright (c) 2009 Glen Foy
    88;;;      (Permission is granted to Clozure Associates to distribute this file.)
    99;;;
     
    129129         (pane (when hemlock-view (hi::hemlock-view-pane hemlock-view)))
    130130         (text-view (when pane (gui::text-pane-text-view pane))))
    131       (cond (sym
     131      (cond ((and sym text-view)
    132132             (cond ((eq (symbol-package sym) (find-package :common-lisp))
    133133                    (or (display-ccl-doc sym text-view)
  • trunk/source/contrib/foy/hemlock-commands-cm/hemlock-documentation-dialog.lisp

    r12717 r12735  
    55;;;      hemlock-documentation-dialog.lisp
    66;;;
    7 ;;;      copyright © 2009 Glen Foy
     7;;;      copyright © 2009 Glen Foy
    88;;;      (Permission is granted to Clozure Associates to distribute this file.)
    99;;;
     
    266266                        (ccl::@selector "closeAction:")))
    267267     (setf (source-button dialog)
    268            (make-button #@"SourceÉ" (if *graphic-p* 420 270) 10 90 32
     268           (make-button #@"SourceÉ" (if *graphic-p* 420 270) 10 90 32
    269269                        (ccl::@selector "commandSourceAction:")))
    270270     (setf (inspect-button dialog)
    271            (make-button #@"InspectÉ" (if *graphic-p* 320 170) 10 90 32
     271           (make-button #@"InspectÉ" (if *graphic-p* 320 170) 10 90 32
    272272                        (ccl::@selector "inspectSymbolAction:")))
    273273     (setf (hyperspec-button dialog)
    274            (make-button #@"HyperSpecÉ" (if *graphic-p* 180 30) 10 130 32
     274           (make-button #@"HyperSpecÉ" (if *graphic-p* 180 30) 10 130 32
    275275                        (ccl::@selector "hyperSpecAction:"))))))
    276276
  • trunk/source/contrib/foy/list-definitions-cm/history-lists.lisp

    r12723 r12735  
    55;;;      history-lists.lisp
    66;;;
    7 ;;;      copyright ï¿œ 2009 Glen Foy
     7;;;      copyright (c) 2009 Glen Foy
    88;;;      (Permission is granted to Clozure Associates to distribute this file.)
    99;;;
     
    270270;;;
    271271(defclass POSITIONS-MENU (ns:ns-menu)
    272   ((tool-menu :initform nil :accessor tool-menu))
     272  ((tool-menu :initform nil :accessor tool-menu)
     273   (sub-title :initform "position history" :reader sub-title))
    273274  (:documentation "A popup menu of most-recently-visited definition positions.")
    274275  (:metaclass ns:+ns-object))
     
    289290
    290291(objc:defmethod (#/update :void) ((self positions-menu))
    291   (cmenu:update-tool-menu self (tool-menu self))
     292  (cmenu:update-tool-menu self (tool-menu self) :sub-title (sub-title self))
    292293  (call-next-method))
    293294
     
    354355;;;
    355356(defclass FILE-MENU (ns:ns-menu)
    356   ((tool-menu :initform nil :accessor tool-menu))
     357  ((tool-menu :initform nil :accessor tool-menu)
     358   (sub-title :initform "file history" :reader sub-title))
    357359  (:documentation "A popup menu of most-recently-visited files.")
    358360  (:metaclass ns:+ns-object))
     
    369371
    370372(objc:defmethod (#/update :void) ((self file-menu))
    371   (cmenu:update-tool-menu self (tool-menu self))
     373  (cmenu:update-tool-menu self (tool-menu self) :sub-title (sub-title self))
    372374  (call-next-method))
    373375
  • trunk/source/contrib/foy/list-definitions-cm/list-definitions.lisp

    r12717 r12735  
    55;;;      list-definitionsisp
    66;;;
    7 ;;;      copyright © 2009 Glen Foy
     7;;;      copyright (c) 2009 Glen Foy
    88;;;      (Permission is granted to Clozure Associates to distribute this file.)
    99;;;
     
    6767   (path :initarg :menu-path :reader menu-path) ; *** history-path
    6868   (doc-path :initform (merge-pathnames ";ReadMe.rtf" cl-user::*list-definitions-directory-string*) :reader doc-path)
    69    (tool-menu :initform nil :accessor tool-menu))
     69   (tool-menu :initform nil :accessor tool-menu)
     70   (sub-title :initform nil :initarg :sub-title :reader sub-title))
    7071  (:documentation "The definitions popup menu.")
    7172  (:metaclass ns:+ns-object))
     
    7576  (maybe-add-history-entry *position-history-list* (item-info sender) (menu-path m)))
    7677
    77 (objc:defmethod (#/update :void) ((self list-definitions-menu))
    78   (cmenu:update-tool-menu self (tool-menu self))
     78 (objc:defmethod (#/update :void) ((self list-definitions-menu))
     79  (cmenu:update-tool-menu self (tool-menu self) :sub-title (sub-title self))
    7980  (call-next-method))
    8081
     
    146147  "Construct the list-definitions popup menu."
    147148  (let* ((menu (make-instance 'list-definitions-menu
     149                 :sub-title (if alpha-p "alphabetical" "positional")
    148150                 :menu-text-view text-view
    149151                 :menu-path (window-path (#/window text-view))))
     
    154156    (ns:with-ns-size (icon-size 16 16)
    155157      (#/setSize: class-icon icon-size))
    156     (setf (tool-menu menu) (cmenu:add-default-tool-menu menu :doc-file (doc-path menu)))
     158    (setf (tool-menu menu)
     159          (if alpha-p
     160            (cmenu:add-default-tool-menu menu :doc-file (doc-path menu))
     161            (cmenu:add-default-tool-menu menu)))
    157162    (dolist (entry alist)
    158163      (let* ((def-info (car entry))
Note: See TracChangeset for help on using the changeset viewer.