Changeset 6671


Ignore:
Timestamp:
Jun 3, 2007, 3:06:51 AM (17 years ago)
Author:
Gary Byers
Message:

Let user resize columns.
Defend against some bugs that Hamilton had defended agains with
HANDLER-CASE-FOR-COCOA.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ide-1.0/ccl/examples/cocoa-inspector.lisp

    r6234 r6671  
    8181(defparameter *cocoa-inspector-nswindows-table* (make-hash-table :test 'eql))
    8282
    83 ; this is what a window should map to - an object that manages all the data a window might be displaying
     83;;; this is what a window should map to - an object that manages all
     84;;; the data a window might be displaying
    8485(defclass cocoa-inspector ()
    8586  ((object-vector :initform (make-array 0 :adjustable t :fill-pointer 0) :accessor object-vector)
     
    8788   (focal-point :initform 0 :accessor focal-point)))
    8889
    89 ;; note that ELT pays attention to the fill pointer, while AREF doesn't!
     90;;; note that ELT pays attention to the fill pointer, while AREF doesn't!
    9091(defmethod object ((cinspector cocoa-inspector))
    9192  (elt (object-vector cinspector) (focal-point cinspector)))
     
    9394  (elt (object-vector cinspector) n))
    9495(defmethod inspector ((cinspector cocoa-inspector))
    95   (elt (inspector-vector cinspector) (focal-point cinspector)))
     96  ;; This can return nil.
     97  (let* ((i (focal-point cinspector))
     98         (v (inspector-vector cinspector))
     99         (n (length v)))
     100    (if (< i n)
     101      (aref v i))))
    96102(defmethod nth-inspector ((cinspector cocoa-inspector) n)
    97103  (elt (inspector-vector cinspector) n))
     
    342348  (let* ((cinspector (gethash (inspector-window self) *cocoa-inspector-nswindows-table*))
    343349         (column (#/selectedColumn sender)))
    344     (when (<= 0 column)
     350    (when (< -1 column (length (object-vector cinspector)))
    345351      ;; this seems to work, but I'm not really paying attention to
    346352      ;; thread stuff...
     
    355361        (if cinspector
    356362          (let ((inspector (inspector cinspector)))
    357             (inspector::inspector-line-count inspector))
    358           0))
     363            (if inspector
     364              (inspector::inspector-line-count inspector)
     365              0))))
    359366      0))
    360367
     
    452459        ;; being handled as two single actions
    453460        (let* ((browser (inspector-browser windowcontroller)))
     461          (#/setColumnResizingType: browser #$NSBrowserUserColumnResizing)
     462          (#/setPrefersAllColumnUserResizing: browser nil)
    454463          (#/setDoubleAction: browser (@selector #/browserDoubleAction:))
    455464          (#/setIgnoresMultiClick: browser t))
Note: See TracChangeset for help on using the changeset viewer.