Changeset 12168


Ignore:
Timestamp:
Jun 1, 2009, 2:20:47 AM (10 years ago)
Author:
rme
Message:

Remove modeline-scroll-view class. Add #/evalAll: method on
hemlock-text-view. Set "Execute All" menu item action to #/evalAll:.
Add code to hemlock-text-view's #/validateMenuItem: method to try to
enable/disable the "Execute All" menu item approrpriately (we don't
want "Execute All" to work on listener windows).

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

Legend:

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

    r12151 r12168  
    12621262        (setq s (lisp-string-from-nsstring s))
    12631263        (ui-object-eval-selection *NSApp* (list package-name pathname s))))))
     1264
     1265(objc:defmethod (#/evalAll: :void) ((self hemlock-text-view) sender)
     1266  (declare (ignore sender))
     1267  (let* ((buffer (hemlock-buffer self))
     1268         (package-name (hi::variable-value 'hemlock::current-package :buffer buffer))
     1269         (pathname (hi::buffer-pathname buffer))
     1270         (s (lisp-string-from-nsstring (#/string self))))
     1271    (ui-object-eval-selection *NSApp* (list package-name pathname s))))
    12641272
    12651273(objc:defmethod (#/loadBuffer: :void) ((self hemlock-text-view) sender)
     
    15531561                            (funcall (hi::modeline-field-function field) buffer))
    15541562                        (hi::buffer-modeline-fields buffer)))))
    1555           (#/drawAtPoint:withAttributes: (%make-nsstring string)
     1563          (#/drawAtPoint:withAttributes: (#/autorelease (%make-nsstring string))
    15561564                                         (ns:make-ns-point 5 1)
    15571565                                         text-attributes))))))
    15581566
    1559 ;;; Draw the underlying buffer's modeline string on a white background
    1560 ;;; with a bezeled border around it.
    15611567(objc:defmethod (#/drawRect: :void) ((self modeline-view) (rect :<NSR>ect))
    15621568  (declare (ignorable rect))
     
    15671573    (#_NSRectFill bounds)
    15681574    (#/set (#/colorWithCalibratedWhite:alpha: ns:ns-color 0.3333 1.0))
     1575    ;; Draw borders on top and bottom.
    15691576    (ns:with-ns-rect (r 0 0.5 (ns:ns-rect-width bounds) 0.5)
    15701577      (#_NSRectFill r))
     
    15801587
    15811588
    1582 
    1583 ;;; Modeline-scroll-view
    1584 
    1585 ;;; This is just an NSScrollView that draws a "placard" view (the modeline)
    1586 ;;; in the horizontal scrollbar.  The modeline's arbitrarily given the
    1587 ;;; leftmost 75% of the available real estate.
    1588 (defclass modeline-scroll-view (ns:ns-scroll-view)
    1589     ((modeline :foreign-type :id :accessor scroll-view-modeline)
    1590      (pane :foreign-type :id :accessor scroll-view-pane))
    1591   (:metaclass ns:+ns-object))
    1592 
    1593 ;;; Making an instance of a modeline scroll view instantiates the
    1594 ;;; modeline view, as well.
    1595 
    1596 (objc:defmethod #/initWithFrame: ((self modeline-scroll-view) (frame :<NSR>ect))
    1597     (let* ((v (call-next-method frame)))
    1598       (when v
    1599         (let* ((modeline (make-instance 'modeline-view)))
    1600           (#/addSubview: v modeline)
    1601           (setf (scroll-view-modeline v) modeline)))
    1602       v))
    1603 
    1604 ;;; Scroll views use the "tile" method to lay out their subviews.
    1605 ;;; After the next-method has done so, steal some room in the horizontal
    1606 ;;; scroll bar and place the modeline view there.
    1607 
    1608 (objc:defmethod (#/tile :void) ((self modeline-scroll-view))
    1609   (call-next-method)
    1610   (let* ((modeline (scroll-view-modeline self)))
    1611     (when (and (#/hasHorizontalScroller self)
    1612                (not (%null-ptr-p modeline)))
    1613       (let* ((hscroll (#/horizontalScroller self))
    1614              (scrollbar-frame (#/frame hscroll))
    1615              (modeline-frame (#/frame hscroll)) ; sic
    1616              (modeline-width (* (pref modeline-frame
    1617                                       :<NSR>ect.size.width)
    1618                                 0.75f0)))
    1619         (declare (type ns:cgfloat modeline-width))
    1620         (setf (pref modeline-frame :<NSR>ect.size.width)
    1621               modeline-width
    1622               (the ns:cgfloat
    1623                 (pref scrollbar-frame :<NSR>ect.size.width))
    1624               (- (the ns:cgfloat
    1625                    (pref scrollbar-frame :<NSR>ect.size.width))
    1626                  modeline-width)
    1627               (the ns:cgfloat
    1628                 (pref scrollbar-frame :<NSR>ect.origin.x))
    1629               (+ (the ns:cgfloat
    1630                    (pref scrollbar-frame :<NSR>ect.origin.x))
    1631                  modeline-width))
    1632         (#/setFrame: hscroll scrollbar-frame)
    1633         (#/setFrame: modeline modeline-frame)))))
    1634 
    1635 
    1636  
    16371589
    16381590;;; A clip view subclass, which exists mostly so that we can track origin changes.
     
    23862338          ((eql action (@selector #/evalSelection:))
    23872339           (not (eql 0 (ns:ns-range-length (#/selectedRange self)))))
     2340          ((eql action (@selector #/evalAll:))
     2341           (let* ((doc (#/document (#/windowController (#/window self)))))
     2342             (and (not (%null-ptr-p doc))
     2343                  (eq (type-of doc) 'hemlock-editor-document))))
    23882344          ;; if this hemlock-text-view is in an editor windowm and its buffer has
    23892345          ;; an associated pathname, then activate the Load Buffer item
  • trunk/source/cocoa-ide/ide-contents/Resources/English.lproj/MainMenu.nib/classes.nib

    r12014 r12168  
    3232                                <string>id</string>
    3333                                <key>continue</key>
     34                                <string>id</string>
     35                                <key>evalAll</key>
    3436                                <string>id</string>
    3537                                <key>evalSelection</key>
  • trunk/source/cocoa-ide/ide-contents/Resources/English.lproj/MainMenu.nib/info.nib

    r12014 r12168  
    1212        </array>
    1313        <key>IBSystem Version</key>
    14         <string>9G55</string>
     14        <string>9J61</string>
    1515        <key>targetFramework</key>
    1616        <string>IBCocoaFramework</string>
Note: See TracChangeset for help on using the changeset viewer.