Changeset 12106


Ignore:
Timestamp:
May 22, 2009, 6:34:16 AM (10 years ago)
Author:
rme
Message:

Add a scope bar to the experimental apropos window. The bar currently
contains All Symbols/External? Symbols buttons.

Location:
trunk/source/cocoa-ide
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/ide-contents/Resources/English.lproj/xapropos.nib/classes.nib

    r12022 r12106  
    1616                                <key>source</key>
    1717                                <string>id</string>
     18                                <key>toggleExternalOnly</key>
     19                                <string>id</string>
    1820                        </dict>
    1921                        <key>CLASS</key>
     
    2729                                <key>actionPopupButton</key>
    2830                                <string>id</string>
     31                                <key>allSymbolsButton</key>
     32                                <string>id</string>
    2933                                <key>contextualMenu</key>
     34                                <string>id</string>
     35                                <key>externalSymbolsButton</key>
    3036                                <string>id</string>
    3137                                <key>searchField</key>
  • trunk/source/cocoa-ide/ide-contents/Resources/English.lproj/xapropos.nib/info.nib

    r12023 r12106  
    99        <key>IBOpenObjects</key>
    1010        <array>
    11                 <integer>1</integer>
    1211                <integer>113</integer>
     12                <integer>139</integer>
    1313        </array>
    1414        <key>IBSystem Version</key>
    15         <string>9G55</string>
     15        <string>9J61</string>
    1616        <key>targetFramework</key>
    1717        <string>IBCocoaFramework</string>
  • trunk/source/cocoa-ide/xapropos.lisp

    r12022 r12106  
    66   (matched-symbols :initform (make-array 100 :fill-pointer 0 :adjustable t)
    77                    :accessor matched-symbols)
     8   (external-only-p :initform nil :accessor external-only-p)
    89   ;; outlets
    910   (action-menu :foreign-type :id :accessor action-menu)
     
    1112   (search-field :foreign-type :id :accessor search-field)
    1213   (search-field-toolbar-item :foreign-type :id :accessor search-field-toolbar-item)
     14   (all-symbols-button :foreign-type :id :accessor all-symbols-button)
     15   (external-symbols-button :foreign-type :id :accessor external-symbols-button)
    1316   (table-view :foreign-type :id :accessor table-view)
    1417   (contextual-menu :foreign-type :id :accessor contextual-menu))
    1518  (:metaclass ns:+ns-object))
     19
     20(defclass scope-bar-view (ns:ns-view)
     21  ()
     22  (:metaclass ns:+ns-object))
     23
     24(defconstant $scope-bar-border-width 1)
     25
     26;;; This should use a gradient, but we don't have NSGradient on Tiger.
     27
     28(objc:defmethod (#/drawRect: :void) ((self scope-bar-view) (rect #>NSRect))
     29  (let* (;;(start-color (#/colorWithCalibratedWhite:alpha: ns:ns-color 0.75 1.0))
     30         (end-color (#/colorWithCalibratedWhite:alpha: ns:ns-color 0.90 1.0))
     31         (border-color (#/colorWithCalibratedWhite:alpha: ns:ns-color 0.69 1.0))
     32         (bounds (#/bounds self)))
     33    (#/set end-color)
     34    (#_NSRectFill bounds)
     35    (ns:with-ns-rect (r 0 0 (ns:ns-rect-width bounds) $scope-bar-border-width)
     36      (#/set border-color)
     37      (#_NSRectFill r))))
    1638
    1739(defconstant $all-symbols-item-tag 0)
     
    5678    (#/setToolbar: (#/window wc) toolbar)
    5779    (#/release toolbar)
     80    (#/search: wc (search-field wc))
    5881    (#/makeFirstResponder: (#/window wc) (search-field wc))))
    5982
     
    100123                   (array row-objects)) wc
    101124    (setf (fill-pointer v) 0)
    102     (do-all-symbols (sym)
    103       (when (case category
    104               (:function (fboundp sym))
    105               (:variable (boundp sym))
    106               (:macro (macro-function sym))
    107               (:class (find-class sym nil))
    108               (t t))
    109         (when (ccl::%apropos-substring-p substring (symbol-name sym))
    110           (vector-push-extend sym v))))
     125    (flet ((maybe-include-symbol (sym)
     126             (when (case category
     127                     (:function (fboundp sym))
     128                     (:variable (boundp sym))
     129                     (:macro (macro-function sym))
     130                     (:class (find-class sym nil))
     131                     (t t))
     132               (when (ccl::%apropos-substring-p substring (symbol-name sym))
     133                 (vector-push-extend sym v)))))
     134      (if (external-only-p wc)
     135        (dolist (p (list-all-packages))
     136          (do-external-symbols (sym p)
     137            (maybe-include-symbol sym)))
     138        (do-all-symbols (sym)
     139          (maybe-include-symbol sym))))
    111140    (setf v (sort v #'string-lessp))
    112141    (#/removeAllObjects array)
     
    131160      (#/search: wc (search-field wc)))))
    132161
     162(objc:defmethod (#/toggleExternalOnly: :void) ((wc xapropos-window-controller) sender)
     163  (cond ((eql sender (all-symbols-button wc))
     164         (#/setState: (external-symbols-button wc) #$NSOffState)
     165         (setf (external-only-p wc) nil))
     166        ((eql sender (external-symbols-button wc))
     167         (#/setState: (all-symbols-button wc) #$NSOffState)
     168         (setf (external-only-p wc) t)))
     169  (#/search: wc (search-field wc)))
     170 
    133171(objc:defmethod (#/inspect: :void) ((wc xapropos-window-controller) sender)
    134172  (declare (ignore sender))
Note: See TracChangeset for help on using the changeset viewer.