Changeset 12070


Ignore:
Timestamp:
May 16, 2009, 12:04:20 AM (10 years ago)
Author:
gb
Message:

Remember window sizes/positions for named documents.

File:
1 edited

Legend:

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

    r12059 r12070  
    26522652                                        url)
    26532653  (call-next-method url)
     2654  (let* ((path nil)
     2655         (controllers (#/windowControllers self)))
     2656    (dotimes (i (#/count controllers))
     2657      (let* ((controller (#/objectAtIndex: controllers i))
     2658             (window (#/window controller)))
     2659        (#/setFrameAutosaveName: window (or path (setq path (#/path url)))))))
    26542660  (let* ((buffer (hemlock-buffer self)))
    26552661    (when buffer
     
    27012707           (controller (make-instance
    27022708                           'hemlock-editor-window-controller
    2703                          :with-window window)))
     2709                         :with-window window))
     2710           (url (#/fileURL self))
     2711           (path (unless (%null-ptr-p url) (#/path url))))
    27042712      ;;(#/setDelegate: window self)
    27052713      (#/setDelegate: window controller)
     
    27072715      (#/addWindowController: self controller)
    27082716      (#/release controller)
    2709       ;; Cascade windows from the top left corner of the topmost editor window.
    2710       ;; If there's no editor window, use the default position.
    2711       (flet ((editor-window-p (w)
    2712                (and (not (eql w window))
    2713                     (eql (#/class (#/windowController w))
    2714                          (find-class 'hemlock-editor-window-controller)))))
    2715         (let* ((editors (remove-if-not #'editor-window-p (windows)))
    2716                (top-editor (car editors)))
    2717           (if top-editor
    2718             (ns:with-ns-point (zp 0 0)
    2719               (setq *editor-cascade-point* (#/cascadeTopLeftFromPoint:
    2720                                             top-editor zp)))
    2721             (let* ((screen-frame (#/visibleFrame (#/screen window)))
    2722                    (pt (ns:make-ns-point *initial-editor-x-pos*
    2723                                          (- (ns:ns-rect-height screen-frame)
    2724                                             *initial-editor-y-pos*))))
    2725               (setq *editor-cascade-point* pt)))))
    2726       (#/cascadeTopLeftFromPoint: window *editor-cascade-point*)
     2717      (#/setShouldCascadeWindows: controller nil)
     2718      (when path
     2719        (unless (#/setFrameAutosaveName: window path)
     2720          (setq path nil)))
     2721      (unless (and path
     2722                   (#/setFrameUsingName: window path))
     2723        ;; Cascade windows from the top left corner of the topmost editor window.
     2724        ;; If there's no editor window, use the default position.
     2725        (flet ((editor-window-p (w)
     2726                 (and (not (eql w window))
     2727                      (eql (#/class (#/windowController w))
     2728                           (find-class 'hemlock-editor-window-controller)))))
     2729          (let* ((editors (remove-if-not #'editor-window-p (windows)))
     2730                 (top-editor (car editors)))
     2731            (if top-editor
     2732              (ns:with-ns-point (zp 0 0)
     2733                (setq *editor-cascade-point* (#/cascadeTopLeftFromPoint:
     2734                                              top-editor zp)))
     2735              (let* ((screen-frame (#/visibleFrame (#/screen window)))
     2736                     (pt (ns:make-ns-point *initial-editor-x-pos*
     2737                                           (- (ns:ns-rect-height screen-frame)
     2738                                              *initial-editor-y-pos*))))
     2739                (setq *editor-cascade-point* pt)))))
     2740        (#/cascadeTopLeftFromPoint: window *editor-cascade-point*))
    27272741      (let ((view (hemlock-view window)))
    27282742        (hi::handle-hemlock-event view #'(lambda ()
Note: See TracChangeset for help on using the changeset viewer.