Changeset 12022


Ignore:
Timestamp:
May 9, 2009, 5:55:29 AM (10 years ago)
Author:
rme
Message:

Try to make the experimental apropos dialog work on Tiger.

Location:
trunk/source/cocoa-ide
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/cocoa-utils.lisp

    r11805 r12022  
    379379       (#/release nsmessage))))
    380380
     381(defun post-tiger-p ()
     382  (rlet ((p :int))
     383    (#_Gestalt #$gestaltSystemVersion p)
     384    (>= (%get-long p) #x1050)))
     385
     386
  • trunk/source/cocoa-ide/xapropos.lisp

    r12006 r12022  
    88   ;; outlets
    99   (action-menu :foreign-type :id :accessor action-menu)
     10   (action-popup-button :foreign-type :id :accessor action-popup-button)
    1011   (search-field :foreign-type :id :accessor search-field)
    1112   (search-field-toolbar-item :foreign-type :id :accessor search-field-toolbar-item)
     
    3435    self))
    3536
     37(defun make-action-popup (menu)
     38  (ns:with-ns-rect (r 0 0 44 23)
     39    (let* ((button (make-instance 'ns:ns-pop-up-button :with-frame r :pulls-down t))
     40           (item (#/itemAtIndex: menu 0))
     41           (image-name (if (post-tiger-p) #@"NSActionTemplate" #@"gear")))
     42      (#/setBezelStyle: button #$NSTexturedRoundedBezelStyle)
     43      ;; This looks bad on Tiger: the arrow is in the bottom corner of the button.
     44      (#/setArrowPosition: (#/cell button) #$NSPopUpArrowAtBottom)
     45      (#/setImage: item (#/imageNamed: ns:ns-image image-name))
     46      (#/setMenu: button menu)
     47      (#/synchronizeTitleAndSelectedItem button)
     48      button)))
     49
    3650(objc:defmethod (#/windowDidLoad :void) ((wc xapropos-window-controller))
    37   (#/setDoubleAction: (table-view wc) (@selector #/inspect:)))
     51  (#/setDoubleAction: (table-view wc) (@selector #/inspect:))
     52  (setf (action-popup-button wc) (make-action-popup (action-menu wc)))
     53  (let* ((toolbar (make-instance 'ns:ns-toolbar :with-identifier #@"apropos toolbar")))
     54    (#/setDisplayMode: toolbar #$NSToolbarDisplayModeIconOnly)
     55    (#/setDelegate: toolbar wc)
     56    (#/setToolbar: (#/window wc) toolbar)
     57    (#/release toolbar)
     58    (#/makeFirstResponder: (#/window wc) (search-field wc))))
     59
     60(objc:defmethod #/toolbarAllowedItemIdentifiers: ((wc xapropos-window-controller) toolbar)
     61  (declare (ignore toolbar))
     62  (#/arrayWithObjects: ns:ns-array #@"action-popup-button"
     63                       #&NSToolbarFlexibleSpaceItemIdentifier #@"search-field" +null-ptr+))
     64
     65(objc:defmethod #/toolbarDefaultItemIdentifiers: ((wc xapropos-window-controller) toolbar)
     66  (declare (ignore toolbar))
     67  (#/arrayWithObjects: ns:ns-array #@"action-popup-button"
     68                       #&NSToolbarFlexibleSpaceItemIdentifier #@"search-field" +null-ptr+))
     69
     70(objc:defmethod #/toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:
     71                ((wc xapropos-window-controller) toolbar identifier (flag #>BOOL))
     72  (declare (ignore toolbar))
     73  (let* ((toolbar-item (make-instance 'ns:ns-toolbar-item :with-item-identifier identifier)))
     74    (#/autorelease toolbar-item)
     75    (with-slots (action-popup-button search-field) wc
     76      (cond ((#/isEqualToString: identifier #@"action-popup-button")
     77             (#/setMinSize: toolbar-item (pref (#/frame action-popup-button) #>NSRect.size))
     78             (#/setMaxSize: toolbar-item (pref (#/frame action-popup-button) #>NSRect.size))
     79             (#/setView: toolbar-item action-popup-button))
     80            ((#/isEqualToString: identifier #@"search-field")
     81             (#/setMinSize: toolbar-item (pref (#/frame search-field) #>NSRect.size))
     82             (#/setMaxSize: toolbar-item (pref (#/frame search-field) #>NSRect.size))
     83             (#/setView: toolbar-item search-field))
     84          (t
     85           (setq toolbar-item +null-ptr+))))
     86    toolbar-item))
    3887
    3988(objc:defmethod (#/dealloc :void) ((wc xapropos-window-controller))
     
    127176    (when (eql (#/objectAtIndex: array row) (#/null ns:ns-null))
    128177      (let ((name (%make-nsstring (prin1-to-string (aref syms row)))))
    129             (#/replaceObjectAtIndex:withObject: array row name)
     178        (#/replaceObjectAtIndex:withObject: array row name)
    130179        (#/release name)))
    131180    (#/objectAtIndex: array row)))
Note: See TracChangeset for help on using the changeset viewer.