/[climacs]/climacs/gui.lisp
ViewVC logotype

Diff of /climacs/gui.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.242 by thenriksen, Tue Dec 11 23:19:45 2007 UTC revision 1.243 by thenriksen, Tue Dec 11 23:42:15 2007 UTC
# Line 96  window")) Line 96  window"))
96    (let ((window-displaying-view    (let ((window-displaying-view
97           (find-if #'(lambda (other-pane)           (find-if #'(lambda (other-pane)
98                        (and (not (eq other-pane pane))                        (and (not (eq other-pane pane))
99                               (typep other-pane 'climacs-pane)
100                             (eq (view other-pane) view)))                             (eq (view other-pane) view)))
101                    (windows (pane-frame pane))))                    (windows (pane-frame pane))))
102          (old-view-active (active (view pane))))          (old-view-active (active (view pane))))
# Line 235  window")) Line 236  window"))
236    ())    ())
237    
238  (defmethod command-table-inherit-from ((table climacs-command-table))  (defmethod command-table-inherit-from ((table climacs-command-table))
239    (append (view-command-tables (current-view))    (append (when (typep (current-window) 'climacs-pane)
240                (view-command-tables (current-view)))
241            '(global-climacs-table)            '(global-climacs-table)
242            (when (use-editor-commands-p (current-view))            (when (and (typep (current-window) 'climacs-pane)
243                         (use-editor-commands-p (current-view)))
244              '(editor-table))              '(editor-table))
245            (call-next-method)))            (call-next-method)))
246    
# Line 312  window")) Line 315  window"))
315  instance."  instance."
316    (eq window (esa-current-window (pane-frame window))))    (eq window (esa-current-window (pane-frame window))))
317    
318  (defun ensure-only-view-active (climacs view)  (defun ensure-only-view-active (climacs &optional view)
319    "Ensure that `view' is the only view of `climacs' that is    "Ensure that `view' is the only view of `climacs' that is
320    active. `View' may be NIL, in which case no view is set as
321  active."  active."
322    (dolist (other-view (views climacs))    (dolist (other-view (views climacs))
323      (unless (eq other-view view)      (unless (eq other-view view)
324        (setf (active other-view) nil)))        (setf (active other-view) nil)))
325    (setf (active view) t))    (unless (null view)
326        (setf (active view) t)))
327    
328  (defmethod (setf views) :around (new-value (frame climacs))  (defmethod (setf views) :around (new-value (frame climacs))
329    ;; If any windows show a view that no longer exists in the    ;; If any windows show a view that no longer exists in the
# Line 379  active." Line 384  active."
384    "Return some view on display."    "Return some view on display."
385    (view (esa-current-window *application-frame*)))    (view (esa-current-window *application-frame*)))
386    
387    (defun view-on-display (climacs view)
388      "Return true if `view' is on display in a window of `climacs',
389    false otherwise."
390      (member view (remove-if-not #'(lambda (window)
391                                      (typep window 'climacs-pane))
392                                  (windows climacs))
393       :key #'view))
394    
395  (defun any-preferably-undisplayed-view ()  (defun any-preferably-undisplayed-view ()
396    "Return some view, any view, preferable one that is not    "Return some view, any view, preferable one that is not
397  currently displayed in any window."  currently displayed in any window."
398    (or (find-if #'(lambda (view)    (or (find-if-not #'(lambda (view)
399                     (not (member view (windows *esa-instance*) :key #'view)))                         (not (view-on-display *esa-instance* view)))
400                 (views *esa-instance*))                     (views *esa-instance*))
401        (any-view)))        (any-view)))
402    
403  (defun any-undisplayed-view ()  (defun any-undisplayed-view ()
404    "Return some view, any view, as long as it is not currently    "Return some view, any view, as long as it is not currently
405  displayed in any window. If necessary, clone a view on display."  displayed in any window. If necessary, clone a view on display."
406    (or (find-if #'(lambda (view)    (or (find-if-not #'(lambda (view)
407                     (not (member view (windows *esa-instance*) :key #'view)))                         (view-on-display *esa-instance* view))
408                 (views *esa-instance*))                     (views *esa-instance*))
409        (clone-view-for-climacs *esa-instance* (any-view))))        (clone-view-for-climacs *esa-instance* (any-view))))
410    
411  (define-presentation-type read-only ())  (define-presentation-type read-only ())
# Line 509  instance." Line 522  instance."
522          (error "Cannot set unknown window to be active window"))          (error "Cannot set unknown window to be active window"))
523        (setf (windows climacs)        (setf (windows climacs)
524              (cons window (remove window (windows climacs)))))              (cons window (remove window (windows climacs)))))
525      (when (typep window 'climacs-pane)      (ensure-only-view-active
526        (ensure-only-view-active climacs (view window)))))       climacs (when (typep window 'climacs-pane)
527                   (view window)))))
528    
529  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
530  ;;;  ;;;

Legend:
Removed from v.1.242  
changed lines
  Added in v.1.243

  ViewVC Help
Powered by ViewVC 1.1.5