diff options
author | Michael Kifer <kifer@cs.stonybrook.edu> | 1997-05-31 01:10:39 +0000 |
---|---|---|
committer | Michael Kifer <kifer@cs.stonybrook.edu> | 1997-05-31 01:10:39 +0000 |
commit | 390773e06145dad8234a747137b2a3057f74fbfb (patch) | |
tree | ee34301ad66f3b4fcb530fa932437d03f137a9a7 /lisp/ediff-wind.el | |
parent | 33be84e1fc3ec49958b8f96f23ecf42a37ef234f (diff) | |
download | emacs-390773e06145dad8234a747137b2a3057f74fbfb.tar.gz |
new version
Diffstat (limited to 'lisp/ediff-wind.el')
-rw-r--r-- | lisp/ediff-wind.el | 151 |
1 files changed, 104 insertions, 47 deletions
diff --git a/lisp/ediff-wind.el b/lisp/ediff-wind.el index 8edde2995df..6aff0d81278 100644 --- a/lisp/ediff-wind.el +++ b/lisp/ediff-wind.el @@ -1,6 +1,6 @@ ;;; ediff-wind.el --- window manipulation utilities -;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. +;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. ;; Author: Michael Kifer <kifer@cs.sunysb.edu> @@ -22,11 +22,8 @@ ;; Boston, MA 02111-1307, USA. ;;; Code: - -(require 'ediff-init) -(if ediff-xemacs-p - (require 'ediff-tbar) - (defun ediff-compute-toolbar-width () 0)) + +(provide 'ediff-wind) ;; Compiler pacifier (defvar icon-title-format) @@ -38,10 +35,39 @@ (defvar right-toolbar-width) (defvar default-menubar) (defvar frame-icon-title-format) +(defvar ediff-diff-status) + +(eval-when-compile + (let ((load-path (cons (expand-file-name ".") load-path))) + (or (featurep 'ediff-init) + (load "ediff-init.el" nil nil 'nosuffix)) + (or (featurep 'ediff-util) + (load "ediff-util.el" nil nil 'nosuffix)) + (or (featurep 'ediff-help) + (load "ediff-help.el" nil nil 'nosuffix)) + (or (featurep 'ediff-tbar) + (load "ediff-tbar.el" 'noerror nil 'nosuffix)) + )) ;; end pacifier +(require 'ediff-init) + +;; be careful with ediff-tbar +(if ediff-xemacs-p + (condition-case nil + (require 'ediff-tbar) + (error + (defun ediff-compute-toolbar-width () 0))) + (defun ediff-compute-toolbar-width () 0)) + +(defgroup ediff-window nil + "Ediff window manipulation" + :prefix "ediff-" + :group 'ediff + :group 'frames) + -(defvar ediff-window-setup-function (if (ediff-window-display-p) +(defcustom ediff-window-setup-function (if (ediff-window-display-p) 'ediff-setup-windows-multiframe 'ediff-setup-windows-plain) "*Function called to set up windows. @@ -62,7 +88,9 @@ The basic guidelines: buffer-A, buffer-B, buffer-C, control-buffer Buffer C may not be used in jobs that compare only two buffers. If you plan to do something fancy, take a close look at how the two -provided functions are written.") +provided functions are written." + :type 'function + :group 'ediff-window) ;; indicates if we are in a multiframe setup (ediff-defvar-local ediff-multiframe nil "") @@ -83,21 +111,25 @@ provided functions are written.") (ediff-defvar-local ediff-window-config-saved "" "") -(defvar ediff-split-window-function 'split-window-vertically +(defcustom ediff-split-window-function 'split-window-vertically "*The function used to split the main window between buffer-A and buffer-B. You can set it to a horizontal split instead of the default vertical split by setting this variable to `split-window-horizontally'. You can also have your own function to do fancy splits. This variable has no effect when buffer-A/B are shown in different frames. -In this case, Ediff will use those frames to display these buffers.") +In this case, Ediff will use those frames to display these buffers." + :type 'function + :group 'ediff-window) -(defvar ediff-merge-split-window-function 'split-window-horizontally +(defcustom ediff-merge-split-window-function 'split-window-horizontally "*The function used to split the main window between buffer-A and buffer-B. You can set it to a vertical split instead of the default horizontal split by setting this variable to `split-window-vertically'. You can also have your own function to do fancy splits. This variable has no effect when buffer-A/B/C are shown in different frames. -In this case, Ediff will use those frames to display these buffers.") +In this case, Ediff will use those frames to display these buffers." + :type 'function + :group 'ediff-window) (defconst ediff-control-frame-parameters (list @@ -132,40 +164,50 @@ Do not specify width and height here. These are computed automatically.") (defvar ediff-mouse-pixel-threshold 30 "If the user moves mouse more than this many pixels, Ediff won't warp mouse into control window.") -(defvar ediff-grab-mouse t +(defcustom ediff-grab-mouse t "*If t, Ediff will always grab the mouse and put it in the control frame. If 'maybe, Ediff will do it sometimes, but not after operations that require relatively long time. If nil, the mouse will be entirely user's -responsibility.") +responsibility." + :type 'boolean + :group 'ediff-window) -(defvar ediff-control-frame-position-function 'ediff-make-frame-position +(defcustom ediff-control-frame-position-function 'ediff-make-frame-position "Function to call to determine the desired location for the control panel. Expects three parameters: the control buffer, the desired width and height of the control frame. It returns an association list -of the form \(\(top . <position>\) \(left . <position>\)\)") +of the form \(\(top . <position>\) \(left . <position>\)\)" + :type 'boolean + :group 'ediff-window) -(defvar ediff-control-frame-upward-shift (if ediff-xemacs-p 42 14) +(defcustom ediff-control-frame-upward-shift (if ediff-xemacs-p 42 14) "*The upward shift of control frame from the top of buffer A's frame. Measured in pixels. This is used by the default control frame positioning function, `ediff-make-frame-position'. This variable is provided for easy -customization of the default.") +customization of the default." + :type 'integer + :group 'ediff-window) -(defvar ediff-narrow-control-frame-leftward-shift (if ediff-xemacs-p 7 3) +(defcustom ediff-narrow-control-frame-leftward-shift (if ediff-xemacs-p 7 3) "*The leftward shift of control frame from the right edge of buf A's frame. Measured in characters. This is used by the default control frame positioning function, `ediff-make-frame-position' to adjust the position of the control frame when it shows the short menu. This variable is provided for easy -customization of the default.") +customization of the default." + :type 'integer + :group 'ediff-window) -(defvar ediff-wide-control-frame-rightward-shift 7 +(defcustom ediff-wide-control-frame-rightward-shift 7 "*The rightward shift of control frame from the left edge of buf A's frame. Measured in characters. This is used by the default control frame positioning function, `ediff-make-frame-position' to adjust the position of the control frame when it shows the full menu. This variable is provided for easy -customization of the default.") +customization of the default." + :type 'integer + :group 'ediff-window) ;; Wide frame display @@ -189,7 +231,7 @@ the frame used for the wide display.") ;; Frame used for the control panel in a windowing system. (ediff-defvar-local ediff-control-frame nil "") -(defvar ediff-prefer-iconified-control-frame nil +(defcustom ediff-prefer-iconified-control-frame nil "*If t, keep control panel iconified when help message is off. This has effect only on a windowing system. If t, hitting `?' to toggle control panel off iconifies it. @@ -197,7 +239,9 @@ If t, hitting `?' to toggle control panel off iconifies it. This is only useful in Emacs and only for certain kinds of window managers, such as TWM and its derivatives, since the window manager must permit keyboard input to go into icons. XEmacs completely ignores keyboard input -into icons, regardless of the window manager.") +into icons, regardless of the window manager." + :type 'boolean + :group 'ediff-window) ;;; Functions @@ -515,8 +559,12 @@ into icons, regardless of the window manager.") (if use-same-frame (let ((window-min-height 1)) - ;; avoid dedicated and non-splittable windows - (ediff-skip-unsuitable-frames) + (if (and (eq frame-A frame-B) + (eq frame-B frame-C) + (frame-live-p frame-A)) + (select-frame frame-A) + ;; avoid dedicated and non-splittable windows + (ediff-skip-unsuitable-frames)) (delete-other-windows) (setq merge-window-lines (max 2 (round (* (window-height) merge-window-share)))) @@ -678,8 +726,10 @@ into icons, regardless of the window manager.") (if use-same-frame (let (wind-width-or-height) ; this affects 3way setups only - ;; avoid dedicated and non-splittable windows - (ediff-skip-unsuitable-frames) + (if (and (eq frame-A frame-B) (frame-live-p frame-A)) + (select-frame frame-A) + ;; avoid dedicated and non-splittable windows + (ediff-skip-unsuitable-frames)) (delete-other-windows) (switch-to-buffer buf-A) (setq wind-A (selected-window)) @@ -858,16 +908,15 @@ into icons, regardless of the window manager.") fheight lines fwidth (max (+ (ediff-help-message-line-length) 2) (ediff-compute-toolbar-width)) - adjusted-parameters (append (list - ;; possibly change surrogate minibuffer - (cons 'minibuffer - (minibuffer-window - designated-minibuffer-frame)) - (cons 'width fwidth) - (cons 'height fheight)) - (funcall - ediff-control-frame-position-function - ctl-buffer fwidth fheight))) + adjusted-parameters + (list + ;; possibly change surrogate minibuffer + (cons 'minibuffer + (minibuffer-window + designated-minibuffer-frame)) + (cons 'width fwidth) + (cons 'height fheight)) + ) (if ediff-use-long-help-message (setq adjusted-parameters (cons '(auto-raise . nil) adjusted-parameters))) @@ -876,8 +925,10 @@ into icons, regardless of the window manager.") ;; are changed. (if ediff-xemacs-p (progn + (set-specifier top-toolbar-height (list ctl-frame 2)) + (sit-for 0) (set-specifier top-toolbar-height (list ctl-frame 0)) - (set-specifier bottom-toolbar-height (list ctl-frame 0)) + ;;(set-specifier bottom-toolbar-height (list ctl-frame 0)) (set-specifier left-toolbar-width (list ctl-frame 0)) (set-specifier right-toolbar-width (list ctl-frame 0)) )) @@ -890,11 +941,13 @@ into icons, regardless of the window manager.") (if (memq system-type '(emx windows-nt windows-95)) (modify-frame-parameters ctl-frame adjusted-parameters)) - (goto-char (point-min)) + ;; make or zap toolbar (if not requested) + (ediff-make-bottom-toolbar ctl-frame) + (goto-char (point-min)) + (modify-frame-parameters ctl-frame adjusted-parameters) (make-frame-visible ctl-frame) - (ediff-make-bottom-toolbar) ; no effect if the toolbar is not requested ;; This works around a bug in 19.25 and earlier. There, if frame gets ;; iconified, the current buffer changes to that of the frame that @@ -910,6 +963,12 @@ into icons, regardless of the window manager.") (raise-frame ctl-frame))) (set-window-dedicated-p (selected-window) t) + + ;; Now move the frame. We must do it separately due to an obscure bug in + ;; XEmacs + (modify-frame-parameters + ctl-frame + (funcall ediff-control-frame-position-function ctl-buffer fwidth fheight)) ;; synchronize so the cursor will move to control frame ;; per RMS suggestion @@ -935,6 +994,7 @@ into icons, regardless of the window manager.") (ediff-eval-in-buffer ctl-buffer (run-hooks 'ediff-after-setup-control-frame-hook)) )) + (defun ediff-destroy-control-frame (ctl-buffer) (ediff-eval-in-buffer ctl-buffer @@ -1061,9 +1121,9 @@ It assumes that it is called from within the control buffer." ;; control buffer format (setq mode-line-format - (list (if (ediff-narrow-control-frame-p) " " "-- ") - mode-line-buffer-identification - " Quick Help")) + (if (ediff-narrow-control-frame-p) + (list " " mode-line-buffer-identification) + (list "-- " mode-line-buffer-identification " Quick Help"))) ;; control buffer id (setq mode-line-buffer-identification (if (ediff-narrow-control-frame-p) @@ -1204,7 +1264,4 @@ It assumes that it is called from within the control buffer." ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body)) ;;; End: -(provide 'ediff-wind) - - ;;; ediff-wind.el ends here |