Changeset 12849


Ignore:
Timestamp:
Sep 17, 2009, 7:51:18 AM (10 years ago)
Author:
gfoy
Message:

Bogus move on #/saveDocument

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/contrib/foy/window-parking-cm/window-parking.lisp

    r12840 r12849  
    1414;;;
    1515;;;      Mod History (most recent edit first)
     16;;;      9/17/9 Fix bogus move after #/saveDocument.
     17;;;      9/16/9 Park new window.
    1618;;;      9/9/9  first cut
    1719;;;
    1820;;; ----------------------------------------------------------------------------
     21
    1922
    2023(defpackage "WINDOW-PARKING" (:nicknames "WP") (:use :cl :ccl))
     
    105108  (:metaclass ns:+ns-object))
    106109
     110(defmethod init-parking ((w parkable-hemlock-frame))
     111  (setf (parked-p w) nil)
     112  (setf (front-p w) nil))
     113
    107114(defmethod h-position ((w parkable-hemlock-frame))
    108115  (let ((rect (#/frame w)))
     
    136143  (format stream "<parkable-hemlock-frame: ~S>" (namestring (cmenu:window-path w))))
    137144
     145;;; This is a work-around for some odd #/saveDocument behavior:
     146;;; Why is the frame being set on a save operation?
     147(objc:defmethod (#/saveDocument: :void) ((self gui::hemlock-editor-document) (sender :id))
     148  (let* ((url (#/fileURL self))
     149         (path (ccl::lisp-string-from-nsstring (#/path url)))
     150         (window (cmenu:window-with-path path)))
     151    (when window (init-parking window))
     152    (call-next-method sender)
     153    (when window (setf (parked-p window) t))))
    138154
    139155;;; ----------------------------------------------------------------------------
     
    155171
    156172(objc:defmethod (#/setFrame:display: :void) ((w parkable-hemlock-frame) (rect :<NSR>ect) (display-p :<BOOL>))
    157   (cond ((parked-p w)
     173 (cond ((parked-p w)
    158174         (call-next-method rect display-p))
    159175        (t
     
    227243            (neq (ps-v-position ps) (v-position window)))
    228244    ;; park it
    229     (setf (parked-p window) nil)
     245    (init-parking window)
    230246    (ns:with-ns-rect (r (ps-h-position ps) (ps-v-position ps) (ps-h-dimension ps) (ps-v-dimension ps))
    231247      (#/setFrame:display: window r t))
     
    264280;;; (1- position).  Return POSITION or NIL
    265281(defMethod bump-position ((wp window-parker) position)
    266   ;; has the recursive call run out of positions?
     282  ;; Has the recursive call run out of positions?
    267283  (when (< position 0)
    268284    (cmenu:notify "There are no on-screen parking spots with unmodified buffers.")
     
    366382                                (cmenu:notify (format nil "First save: ~S. Then try again."
    367383                                                      (cmenu:window-path tenant)))
    368                                 (setf (parked-p tenant) nil)) ; *** ?
     384                                (init-parking tenant))
    369385                               (t
    370386                                (vacate-current-location wp window)
Note: See TracChangeset for help on using the changeset viewer.