Commits

berndl  committed 3a958cb

Additional source for ECB 1.10

  • Participants
  • Parent commits 407a9c5

Comments (0)

Files changed (5)

File ecb-create-layout.el

+;;; ecb-create-layout.el --- creating new layouts
+
+;; Copyright (C) 2001 Jesper Nordenberg
+;; Copyright (C) 2001 Free Software Foundation, Inc.
+;; Copyright (C) 2001 Klaus Berndl <klaus.berndl@sdm.de>
+
+;; Author: Klaus Berndl <klaus.berndl@sdm.de>
+;; Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
+;; Keywords: java, class, browser
+
+;; This program is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by the Free
+;; Software Foundation; either version 2, or (at your option) any later
+;; version.
+
+;; This program is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+;; more details.
+
+;; You should have received a copy of the GNU General Public License along
+;; with GNU Emacs; see the file COPYING. If not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+;; $Id$
+
+;;; Commentary:
+;;
+;; Contains code for easy creating new layouts
+
+;;; Code
+
+(eval-when-compile
+  (require 'silentcomp))
+
+(require 'ecb-mode-line)
+(require 'ecb-util)
+
+(require 'cl) ;; for set-difference
+
+;; XEmacs stuff
+(silentcomp-defvar vertical-divider-map)
+(silentcomp-defvar modeline-map)
+;; Emacs 21.X stuff
+(silentcomp-defvar automatic-hscrolling)
+(silentcomp-defvar before-make-frame-hook)
+(silentcomp-defvar after-make-frame-functions)
+;; First loaded during activated ECB
+(silentcomp-defvar ecb-buildin-layouts)
+
+(defgroup ecb-create-layout nil
+  "Settings for creating new ECB-layouts."
+  :group 'ecb-layout
+  :prefix "ecb-create-layout-")
+
+(defcustom ecb-create-layout-file "~/.ecb-user-layouts.el"
+  "*File where all layouts created by `ecb-create-new-layout' are stored."
+  :group 'ecb-create-layout
+  :type 'file)
+
+(defcustom ecb-create-layout-frame-width 110
+  "*Frame width of the layout creation frame."
+  :group 'ecb-create-layout
+  :type 'integer)
+
+(defcustom ecb-create-layout-frame-height 42
+  "*Frame height of the layout creation frame."
+  :group 'ecb-create-layout
+  :type 'integer)
+
+
+;; internal vars and consts
+
+
+(defconst ecb-create-layout-buf-prefix " *ECB-LC-")
+(defconst ecb-create-layout-frame-name "Creation of a new ECB-layout")
+(defconst ecb-create-layout-all-buf-types
+  '("directories" "history" "methods" "sources"))
+
+(defconst ecb-create-layout-help-text-left-right
+  "
+ ECB layout creation mode
+ ========================
+
+ This is the help-screen of this mode. The window
+ displaying this help text is called the edit-window
+ which is neither selectable nor deletable nor
+ splittable in this mode.
+
+ <left/right/up/down-arrow>: Moving around in current
+ window C-n, C-p: Go to next/previous window (beside
+ the edit-window)
+
+ C-s: Split current window. You will be asked:
+      - If \"vertical\" or \"horizontal\" split
+      - How to split: \"at-point\", \"half\" or
+        \"other\" (i.e. you can specify any fraction
+        between 0.1 and 0.9)
+      - Which type (\"directories\", \"sources\",
+        \"methods\" or \"history\") the current window
+        should be.
+ C-u: Unsplit, ie. delete current window
+ C-t: Give the current window a type (\"directories\",
+      \"sources\", \"methods\" or \"history\")
+
+ C-c: Cancel layout creation. This does not save the
+      layout. Deletes this frame.
+ C-q: Save current defined layout and quit the layout
+      creation. You will be asked for a layout-name.
+      With TAB-completion you can get the names already
+      in use. You have to choose a new name!
+      Deletes this frame.
+
+ There are NO other commands or keys avaliable. ALL
+ other keys are disabled in this mode!
+")
+
+(defconst ecb-create-layout-help-text-top
+  " ECB layout creation mode
+ ========================
+
+ This is the help-screen of this mode. The window displaying this help text is called
+ the edit-window which is neither selectable nor deletable nor splittable in this mode.
+
+ <left/right/up/down-arrow>: Moving around in current window
+ C-n, C-p: Go to next/previous window (beside the edit-window)
+
+ C-s: Split current window. You will be asked:
+      - If \"vertical\" or \"horizontal\" split
+      - How to split: \"at-point\", \"half\" or \"other\" (i.e. you can specify any
+        fraction between 0.1 and 0.9)
+      - Which type (\"directories\", \"sources\", \"methods\" or \"history\") the current
+        window should be.
+ C-u: Unsplit, ie. delete current window
+ C-t: Give the current window a type (\"directories\", \"sources\", \"methods\" or \"history\")
+
+ C-c: Cancel layout creation. This does not save the layout. Deletes this frame.
+ C-q: Save current defined layout and quit the layout creation. You will be asked for a
+      layout-name. With TAB-completion you can get the names already in use.
+      You have to choose a new name! Deletes this frame.
+
+ There are NO other commands or keys avaliable. ALL other keys are disabled in this mode!
+")
+
+(defconst ecb-create-layout-file-header
+     "
+
+;; Copyright (C) 2001 Jesper Nordenberg
+;; Copyright (C) 2001 Free Software Foundation, Inc.
+;; Copyright (C) 2001 Klaus Berndl <klaus.berndl@sdm.de>
+
+;; Author: Klaus Berndl <klaus.berndl@sdm.de>
+;; Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
+;; Keywords: java, class, browser
+
+;; This program is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by the Free
+;; Software Foundation; either version 2, or (at your option) any later
+;; version.
+
+;; This program is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+;; more details.
+
+;; You should have received a copy of the GNU General Public License along
+;; with GNU Emacs; see the file COPYING. If not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; This file contains all user-defined ECB-layouts created by the command
+;; `ecb-create-new-layout'.
+
+;; !!! DO NOT EDIT THIS FILE MANUALLY - IT IS GENERATED BY ECB !!!
+
+")
+
+
+(defvar ecb-create-layout-frame nil)
+(defvar ecb-create-layout-edit-window nil)
+
+(defvar ecb-create-layout-old-global-map nil)
+(defvar ecb-create-layout-old-minor-mode-map-alist nil)
+(defvar ecb-create-layout-old-hscroll nil)
+(defvar ecb-create-layout-old-debug-on-error nil)
+(defvar ecb-create-layout-old-frame nil)
+(defvar ecb-create-layout-old-vertical-div-map nil)
+(defvar ecb-create-layout-old-modeline-map nil)
+(defvar ecb-create-layout-old-after-frame-h nil)
+(defvar ecb-create-layout-old-before-frame-h nil)
+
+(defvar ecb-create-layout-generated-lisp nil)
+(defvar ecb-create-layout-gen-counter 0)
+
+(defvar ecb-create-layout-buf-types nil)
+
+;; can be 'left, 'right, 'top or 'left-right
+(defvar ecb-create-layout-type 'left)
+
+(defun ecb-create-layout-initilize ()
+  (setq ecb-create-layout-buf-types
+        (copy-list ecb-create-layout-all-buf-types))
+  (setq ecb-create-layout-frame nil)
+  (setq ecb-create-layout-edit-window nil)
+  (setq ecb-create-layout-old-global-map nil)
+  (setq ecb-create-layout-old-minor-mode-map-alist nil)
+  (setq ecb-create-layout-old-hscroll nil)
+  (setq ecb-create-layout-old-frame nil)
+
+  (if ecb-running-xemacs
+      (progn
+        (setq ecb-create-layout-old-vertical-div-map nil)
+        (setq ecb-create-layout-old-modeline-map nil))
+    (setq ecb-create-layout-old-after-frame-h nil)
+    (setq ecb-create-layout-old-before-frame-h nil))
+  
+  (setq ecb-create-layout-generated-lisp nil)
+  (setq ecb-create-layout-gen-counter 0))
+
+(defadvice delete-frame (before ecb-create-layout)
+  "Ensure calling `ecb-create-layout-cancel' during deleting the
+layout-creation frame."
+  (let ((frame (or (ad-get-arg 0) (selected-frame))))
+    (when (string= (ecb-frame-parameter frame 'name)
+                   ecb-create-layout-frame-name)
+      (ecb-create-layout-cancel))))
+
+(defun ecb-create-layout-frame-ok ()
+  "Return not nil if current frame is the `ecb-create-layout-frame'"
+  (and ecb-create-layout-frame
+       (frame-live-p ecb-create-layout-frame)
+       (equal (selected-frame) ecb-create-layout-frame)))
+
+
+(defun ecb-create-layout-cancel (&rest ignore)
+  (interactive)
+  (when (ecb-create-layout-frame-ok)
+    (ecb-create-layout-clear-all (interactive-p))
+    (message "ECB Layout Creation canceled - the layout is not saved!")))
+
+(defun ecb-create-layout-clear-all (&optional delete-frame)
+  "Resets all stuff to state before `ecb-create-new-layout' was called. If
+DELETE-FRAME is not nil then the new created frame will be deleted and the
+`ecb-create-layout-old-frame' will be selected."
+  ;; disabling the advice
+  (ad-disable-advice 'delete-frame 'before 'ecb-create-layout)
+  (ad-activate 'delete-frame)
+  ;; killing all white-space-filled layout-buffers
+  (dolist (b (buffer-list ecb-create-layout-frame))
+    (if (string-match "^ \\*ECB-LC-" (buffer-name b))
+        (kill-buffer b)))
+  ;; restore the global-map
+  (if (keymapp ecb-create-layout-old-global-map)
+      (use-global-map ecb-create-layout-old-global-map))
+  ;; restore the minor-mode-maps
+  (if ecb-create-layout-old-minor-mode-map-alist
+      (setq minor-mode-map-alist
+            ecb-create-layout-old-minor-mode-map-alist))
+  ;; restore horiz. scrolling
+  (if ecb-running-emacs-21
+      (setq automatic-hscrolling ecb-create-layout-old-hscroll))
+  ;; for XEmacs restore these maps
+  (if ecb-running-xemacs
+      (progn
+        (setq vertical-divider-map ecb-create-layout-old-vertical-div-map)
+        (setq modeline-map ecb-create-layout-old-modeline-map))
+    ;; before and after makeing frame stuff
+    (setq before-make-frame-hook ecb-create-layout-old-before-frame-h)
+    (setq after-make-frame-functions ecb-create-layout-old-after-frame-h))
+  ;; restore old debug-on-error
+  (setq debug-on-error ecb-create-layout-old-debug-on-error)
+  ;; delete the layout-frame and select the ecb-create-layout-old-frame
+  (when delete-frame
+    (when (and ecb-create-layout-old-frame
+               (frame-live-p ecb-create-layout-old-frame))
+      (raise-frame ecb-create-layout-old-frame)
+      (select-frame ecb-create-layout-old-frame))
+    (when (and ecb-create-layout-frame
+               (frame-live-p ecb-create-layout-frame))
+      (ad-with-originals 'delete-frame
+        (delete-frame ecb-create-layout-frame))))
+  (setq ecb-create-layout-frame nil))
+
+(defun ecb-create-layout-save-and-quit (&rest ignore)
+  "Quit the ECB Layout creation and save the defined layout."
+  (interactive)
+  (when (ecb-create-layout-frame-ok)
+    (if (ecb-create-layout-ready-for-save-p)
+        (let ((delete-frame (interactive-p)))
+          ;; if an error occurs during `ecb-create-layout-save-layout' or the
+          ;; user hits C-q we must clean the layout creation stuff!
+          (unwind-protect
+              (ecb-create-layout-save-layout)
+            ;; clean the layout creation stuff
+            (ecb-create-layout-clear-all delete-frame)
+            (message "ECB Layout Creation finished.")))
+      (ecb-error "You must give every ECB-tree-window a type (use C-t)!"))))
+
+
+(defun ecb-create-layout-ready-for-save-p ()
+  "Returns only not nil if all windows in current layout have a type."
+  (let ((save-p t))
+    (save-excursion
+      (dolist (win (ecb-window-list (selected-frame) 0))
+        (unless (equal win ecb-create-layout-edit-window)
+          (set-buffer (window-buffer win))
+          (setq save-p (ecb-create-layout-buffer-type)))))
+    save-p))
+
+
+(defmacro ecb-create-layout-insert-line (line)
+  "Insert LINE in current-buffer and adds a newline."
+  `(progn
+     (insert ,line)
+     (insert "\n")))
+
+(defun ecb-create-layout-insert-file-header ()
+  (insert (format ";;; %s --- user defined ECB-layouts" ;;
+                  (file-name-nondirectory ecb-create-layout-file)))
+  (insert ecb-create-layout-file-header))
+
+(defun ecb-create-layout-save-layout ()
+  "Saves current layout in `ecb-create-layout-file'."
+  ;; make edit-window the current selected window
+  (ecb-create-layout-select-edit-window)
+  ;; we need the reversed sequence of the generated code
+  (setq ecb-create-layout-generated-lisp
+        (nreverse ecb-create-layout-generated-lisp))
+  ;; ensure we have load all layouts defined until now
+  (ecb-load-layouts)
+  ;; now we have the create-code in the right sequence so we can save the new
+  ;; layout in the user-layout file
+  (let ((layout-name ""))
+    ;; a repeat...until-loop
+    (while (progn
+             ;;the while body
+             (setq layout-name
+                   (ecb-choose-layout-name (ecb-available-layouts-of-type nil)
+                                           nil))
+             ;; the while condition
+             (ecb-available-layouts-member-p layout-name)))
+    (with-temp-file (expand-file-name ecb-create-layout-file)
+      (erase-buffer)
+      (if (file-readable-p (expand-file-name ecb-create-layout-file))
+          (insert-file-contents (expand-file-name ecb-create-layout-file))
+        (ecb-create-layout-insert-file-header))
+      (goto-char (point-max))
+      ;; insert header of the layout-define macro
+      (ecb-create-layout-insert-line
+       (format "(ecb-layout-define \"%s\" %s nil"
+               layout-name
+               (symbol-name ecb-create-layout-type)))
+      ;; insert all the generated layout-code of the new layout
+      (dolist (line ecb-create-layout-generated-lisp)
+        (ecb-create-layout-insert-line
+         (format "  %s" line)))
+      ;; close the new layout-function
+      (ecb-create-layout-insert-line "  )"))
+    ;; now we load the new layout
+    (load-file (expand-file-name ecb-create-layout-file))
+    (message "The new layout is saved in %s, loaded and available!"
+             ecb-create-layout-file)))
+
+(defun ecb-create-layout-gen-lisp (lisp-statement)
+  (setq ecb-create-layout-generated-lisp
+        (cons lisp-statement ecb-create-layout-generated-lisp)))
+
+(defun ecb-create-layout-split-ver (&optional fraction)
+  (let ((factor (or fraction
+                    (/ (float (count-lines (window-start) (point)))
+                       (float (- (window-height) 2))))))
+    (ecb-split-ver factor t)
+    (ecb-create-layout-gen-lisp `(ecb-split-ver ,factor t))
+    factor))
+
+(defun ecb-create-layout-split-hor (&optional fraction)
+  (let ((factor (or fraction
+                    (/ (float (- (point) (ecb-line-beginning-pos)))
+                       (float (- (window-width) 3))))))
+    (ecb-split-hor factor t)
+    (ecb-create-layout-gen-lisp `(ecb-split-hor ,factor t))
+    (beginning-of-line)
+    factor))
+
+(defun ecb-create-layout-add-to-buf-types (type)
+  (when (stringp type)
+    (add-to-list 'ecb-create-layout-buf-types type)
+    (setq ecb-create-layout-buf-types
+          (sort ecb-create-layout-buf-types 'string-lessp))))
+
+(defun ecb-create-layout-remove-from-buf-type (type)
+  (when (stringp type)
+    (setq ecb-create-layout-buf-types
+          (sort (delete type ecb-create-layout-buf-types) 'string-lessp))))
+
+(defun ecb-create-layout-buffer-type ()
+  (get-text-property (point-min) 'ecb-create-layout-type))
+
+(defun ecb-create-layout-buffer-factor ()
+  (get-text-property (point-min) 'ecb-create-layout-factor))
+
+(defun ecb-create-layout-set-buffer-type (type)
+  (let ((buffer-read-only nil))
+    (put-text-property (point-min) (1+ (point-min)) 'ecb-create-layout-type
+                       type)))
+
+(defun ecb-create-layout-set-buffer-factor (factor)
+  (let ((buffer-read-only nil))
+    (put-text-property (point-min) (1+ (point-min)) 'ecb-create-layout-factor
+                       factor)))
+
+(defun ecb-create-layout-set-buffer-to-type (&optional type)
+  (interactive)
+  (when (ecb-create-layout-frame-ok)
+    ;; adding the old buffer type to the available-list
+    (ecb-create-layout-add-to-buf-types (or type
+                                            (ecb-create-layout-buffer-type)))
+    (let ((new-type (or (and (stringp type) type)
+                        (ecb-query-string "Type of current ECB-tree-buffer:"
+                                          ecb-create-layout-buf-types))))
+      ;; removing the new buffer type from the available-list
+      (ecb-create-layout-remove-from-buf-type new-type)
+      (ecb-mode-line-set (buffer-name (current-buffer))
+                         (concat "ECB " new-type))
+      ;; setting the new buffer type in the buffer itself
+      (ecb-create-layout-set-buffer-type new-type)
+      (when (interactive-p)
+        (ecb-create-layout-gen-lisp
+         `(,(intern (format "ecb-set-%s-buffer" new-type))))
+        (ecb-create-layout-next-window))
+      new-type)))
+
+(defun ecb-create-layout-select-edit-window ()
+  (let ((counter 0))
+    (while (not (equal (selected-window) ecb-create-layout-edit-window))
+      (other-window 1)
+      (setq counter (1+ counter)))
+    (ecb-create-layout-gen-lisp `(dotimes (i ,counter)
+                                   (other-window 1)
+                                   (if (equal (selected-window)
+                                              ecb-compile-window)
+                                       (other-window 1))))))
+
+(defun ecb-create-layout-split ()
+  (interactive)
+  (when (ecb-create-layout-frame-ok)
+    ;; splitting
+    (let* ((old-buf-type (ecb-create-layout-buffer-type))
+           (split-choices (if (equal ecb-create-layout-type 'top)
+                              '("horizontal" "vertical")
+                            '("vertical" "horizontal")))
+           (split-type (ecb-query-string "Split type:" split-choices))
+           (split-method
+            (ecb-query-string "Split method:"
+                              '("at-point" "half")
+                              "Insert a fraction between 0.1 and 0.9"))
+           (fraction (cond ((string= split-method "at-point")
+                            nil)
+                           ((string= split-method "half")
+                            0.5)
+                           ((floatp (string-to-number split-method))
+                            (string-to-number split-method))
+                           (t 0.5)))
+           (real-split-factor
+            (if (string= split-type "horizontal")
+                (ecb-create-layout-split-hor fraction)
+              (ecb-create-layout-split-ver fraction))))
+      ;; creating new fitting buffers
+      (save-selected-window
+        (ecb-create-layout-new-buffer)
+        (select-window (next-window))
+        (ecb-create-layout-new-buffer))
+      ;; asking for the buffer type
+      (ecb-create-layout-set-buffer-factor real-split-factor)
+      (ecb-create-layout-gen-lisp
+       `(,(intern (format "ecb-set-%s-buffer"
+                          (ecb-create-layout-set-buffer-to-type old-buf-type)))))
+      (ecb-create-layout-next-window))))
+
+(defun ecb-create-layout-forward-char ()
+  (interactive)
+  (when (ecb-create-layout-frame-ok)
+    (unless (> (- (point) (ecb-line-beginning-pos)) (- (window-width)
+                                                       (if ecb-running-xemacs
+                                                           3
+                                                         2)))
+      (call-interactively 'forward-char))))
+
+(defun ecb-create-layout-next-window ()
+  (interactive)
+  (when (ecb-create-layout-frame-ok)
+    (let ((steps (if (equal (next-window) ecb-create-layout-edit-window) 2 1)))
+      (other-window steps)
+      (ecb-create-layout-gen-lisp `(dotimes (i ,steps)
+                                     (other-window 1)
+                                     (if (equal (selected-window)
+                                                ecb-compile-window)
+                                         (other-window 1)))))))
+
+(defun ecb-create-layout-previous-window ()
+  (interactive)
+  (when (ecb-create-layout-frame-ok)
+    (let ((steps (if (equal (previous-window (selected-window) 0)
+                            ecb-create-layout-edit-window)
+                     -2 -1)))
+      (other-window steps)
+      (ecb-create-layout-gen-lisp `(dotimes (i ,(abs steps))
+                                     (other-window -1)
+                                     (if (equal (selected-window)
+                                                ecb-compile-window)
+                                         (other-window -1)))))))
+
+(defun ecb-create-layout-delete-window ()
+  (interactive)
+  (when (ecb-create-layout-frame-ok)
+    (unless (or (equal (selected-window) ecb-create-layout-edit-window)
+                (= (length (ecb-window-list nil 0))
+                   (if (equal ecb-create-layout-type 'left-right) 3 2)))
+      (if (and (member ecb-create-layout-type '(right left-right))
+               (equal (previous-window (selected-window) 0)
+                      ecb-create-layout-edit-window)
+               (> (nth 0 (ecb-window-edges (next-window))) (nth 0 (ecb-window-edges)))
+               (= (nth 3 (ecb-window-edges ecb-create-layout-edit-window))
+                  (nth 3 (ecb-window-edges))))
+          ;; In exactly this window context we can not delete the current
+          ;; window because otherwise the edit-window would enlarge and the
+          ;; wrong window would be deleted!
+          (ecb-error "This window can not be deleted! Delete another one.")
+        ;; add the buffer type of the deleted window to the available-list
+        (ecb-create-layout-add-to-buf-types (ecb-create-layout-buffer-type))
+        (kill-buffer (current-buffer))
+        (delete-window)
+        (ecb-create-layout-gen-lisp '(delete-window))
+        (if (equal (selected-window) ecb-create-layout-edit-window)
+            (ecb-create-layout-previous-window))
+        ;; add the buffer type of the new bigger window to the available-list
+        (ecb-create-layout-add-to-buf-types (ecb-create-layout-buffer-type))
+        (kill-buffer (current-buffer))
+        (ecb-create-layout-new-buffer)))))
+
+(defvar ecb-create-layout-mode-map nil
+  "`ecb-create-layout-mode' keymap.")
+
+(if ecb-create-layout-mode-map
+    ()
+  (setq ecb-create-layout-mode-map (make-sparse-keymap))
+;;  (suppress-keymap ecb-create-layout-mode-map t)
+
+  ;; for minibuffer insertion we need the following
+  (dotimes (i 26)
+    (define-key ecb-create-layout-mode-map
+      (string (+ i 97)) 'self-insert-command))
+
+  (dotimes (i 26)
+    (define-key ecb-create-layout-mode-map
+      (string (+ i 65)) 'self-insert-command))
+
+  (dotimes (i 10)
+    (define-key ecb-create-layout-mode-map
+      (string (+ i 48)) 'self-insert-command))
+
+  (define-key ecb-create-layout-mode-map "." 'self-insert-command)
+  (define-key ecb-create-layout-mode-map "-" 'self-insert-command)
+  
+  (if ecb-running-xemacs
+      (define-key ecb-create-layout-mode-map (kbd "<BS>")
+        'delete-backward-char)
+    (define-key ecb-create-layout-mode-map (kbd "<DEL>")
+      'backward-delete-char-untabify))
+
+  (define-key ecb-create-layout-mode-map (kbd "C-q")
+    'ecb-create-layout-save-and-quit)
+  (define-key ecb-create-layout-mode-map (kbd "C-c")
+    'ecb-create-layout-cancel)
+  (define-key ecb-create-layout-mode-map (kbd "C-u")
+    'ecb-create-layout-delete-window)
+  (define-key ecb-create-layout-mode-map (kbd "C-s") 'ecb-create-layout-split)
+  (define-key ecb-create-layout-mode-map (kbd "C-t")
+    'ecb-create-layout-set-buffer-to-type)
+  (define-key ecb-create-layout-mode-map (kbd "<left>") 'backward-char)
+  (define-key ecb-create-layout-mode-map (kbd "<right>")
+    'ecb-create-layout-forward-char)
+  (define-key ecb-create-layout-mode-map (kbd "<up>") 'previous-line)
+  (define-key ecb-create-layout-mode-map (kbd "<down>") 'next-line)
+  (define-key ecb-create-layout-mode-map (kbd "C-n")
+    'ecb-create-layout-next-window)
+  (define-key ecb-create-layout-mode-map (kbd "C-p")
+    'ecb-create-layout-previous-window)
+;;   (define-key ecb-create-layout-mode-map (kbd "C-h v")
+;;     'describe-variable)
+;;   (define-key ecb-create-layout-mode-map (kbd "C-h k")
+;;     'describe-key)
+;;   (define-key ecb-create-layout-mode-map (kbd "C-h d")
+;;     'ecb-create-layout-debug)
+;;   (define-key ecb-create-layout-mode-map (kbd "M-<down>")
+;;     'scroll-other-window)
+  (set-keymap-parent ecb-create-layout-mode-map nil))
+
+
+(defun ecb-create-layout-new-buffer (&optional do-not-fill)
+  (set-window-dedicated-p (selected-window) nil)
+  (switch-to-buffer (generate-new-buffer ecb-create-layout-buf-prefix))
+  (erase-buffer)
+  (unless do-not-fill
+    (dotimes (i (window-height))
+      (insert-string
+       (format "%s\n"
+               (make-string (- (window-width)
+                               (if ecb-running-xemacs 3 1))
+                            ?\ )))))
+  (goto-char (point-min))
+  (ecb-create-layout-mode)
+  (set-window-dedicated-p (selected-window) t))
+
+
+
+(defun ecb-create-layout-mode ()
+  "Major mode for creating new ECB-layouts."
+  (setq major-mode 'ecb-create-layout-mode)
+  (setq mode-name "ECB Create-Layout")
+  (use-local-map ecb-create-layout-mode-map)
+  (make-variable-buffer-local 'buffer-read-only)
+  (ecb-mode-line-set (buffer-name (current-buffer)) "")
+  (setq buffer-read-only t))
+
+(defun ecb-create-layout-init-layout (&optional new)
+  (delete-other-windows)
+  (ecb-create-layout-new-buffer)
+  (when new
+    (setq ecb-create-layout-type (intern (ecb-query-string
+                                          "Location of the the ECB-tree-windows:"
+                                          '("left" "right" "top" "left-right")))))
+  (cond ((equal ecb-create-layout-type 'left)
+         (ecb-split-hor ecb-windows-width))
+        ((equal ecb-create-layout-type 'right)
+         (ecb-split-hor (- ecb-windows-width) t))
+        ((equal ecb-create-layout-type 'top)
+         (ecb-split-ver ecb-windows-height))
+        (t
+         (ecb-split-hor (- (* 0.667 ecb-windows-width)) t)
+         (ecb-split-hor (* 0.667 ecb-windows-width) nil t)))
+  ;; we set the buffer in the big edit-window
+  (ecb-create-layout-new-buffer t)
+  ;; now we insert the help in the edit-window
+  (let ((buffer-read-only nil))
+    (insert (if (equal ecb-create-layout-type 'top)
+                ecb-create-layout-help-text-top
+              ecb-create-layout-help-text-left-right)))
+  (setq ecb-create-layout-edit-window (selected-window))
+  (ecb-mode-line-set (buffer-name (current-buffer)) "   ECB edit-window")
+  ;; The edit window must not be dedicated
+  (set-window-dedicated-p (selected-window) nil)
+  ;; we set the buffer for the (currently unsplitted) ECB-window
+  (other-window 1)
+  (ecb-create-layout-new-buffer)
+  ;; for the left-right type we have to set the other column too
+  (when (equal ecb-create-layout-type 'left-right)
+    (other-window 1)
+    (ecb-create-layout-new-buffer)))
+
+
+(defun ecb-create-layout-make-frame ()
+  "Create a new frame for the layout creation process and return it."
+  (cond (ecb-running-xemacs
+         (make-frame `((name . ,ecb-create-layout-frame-name)
+                       (minibuffer . t)
+                       (user-position . t)
+                       (width . ,ecb-create-layout-frame-width)
+                       (height . ,ecb-create-layout-frame-height)
+                       (default-toolbar-visible-p . nil)
+                       (left-toolbar-visible-p . nil)
+                       (right-toolbar-visible-p . nil)
+                       (top-toolbar-visible-p . nil)
+                       (bottom-toolbar-visible-p . nil)
+                       (default-gutter-visible-p . nil)
+                       (left-gutter-visible-p . nil)
+                       (right-gutter-visible-p . nil)
+                       (top-gutter-visible-p . nil)
+                       (bottom-gutter-visible-p . nil)
+                       (has-modeline-p . t)
+                       (use-left-overflow . nil)
+                       (vertical-scrollbar-visible-p . nil)
+                       (horizontal-scrollbar-visible-p . nil)
+                       (use-right-overflow . nil)
+                       (menubar-visible-p . nil))))
+        (ecb-running-emacs-21
+         (make-frame `((name . ,ecb-create-layout-frame-name)
+                       (minibuffer . t)
+                       (user-position . t)
+                       (width . ,ecb-create-layout-frame-width)
+                       (height . ,ecb-create-layout-frame-height)
+                       (vertical-scroll-bars . nil)
+                       (horizontal-scroll-bars . nil)
+                       (tool-bar-lines . 0)
+                       (menu-bar-lines . 0))))
+        (t ;; Emacs 20
+         (make-frame `((name . ,ecb-create-layout-frame-name)
+                       (minibuffer . t)
+                       (user-position . t)
+                       (width . ,ecb-create-layout-frame-width)
+                       (height . ,ecb-create-layout-frame-height)
+                       (vertical-scroll-bars . nil)
+                       (menu-bar-lines . 0))))))
+         
+
+
+(defun ecb-create-new-layout ()
+  "Start interactively layout creating."
+  (interactive)
+
+  (ecb-create-layout-initilize)
+
+  ;; before- and after make frame stuff
+  (when (not ecb-running-xemacs)
+    (setq ecb-create-layout-old-after-frame-h after-make-frame-functions)
+    (setq after-make-frame-functions nil)
+    (setq ecb-create-layout-old-before-frame-h before-make-frame-hook)
+    (setq before-make-frame-hook nil))
+    
+  ;; saving old frame
+  (setq ecb-create-layout-old-frame (selected-frame))
+
+  ;; creating new frame
+  (setq ecb-create-layout-frame (ecb-create-layout-make-frame))
+  (raise-frame ecb-create-layout-frame)
+  (select-frame ecb-create-layout-frame)
+  (ad-enable-advice 'delete-frame 'before 'ecb-create-layout)
+  (ad-activate 'delete-frame)
+
+  ;; global map
+  (setq ecb-create-layout-old-global-map (current-global-map))
+  (use-global-map ecb-create-layout-mode-map)
+
+  ;; minor-modes map
+  (setq ecb-create-layout-old-minor-mode-map-alist minor-mode-map-alist)
+  (setq minor-mode-map-alist nil)
+
+  ;; horiz. scrolling
+  (when ecb-running-emacs-21
+    (setq ecb-create-layout-old-hscroll automatic-hscrolling)
+    (setq automatic-hscrolling nil))
+
+  ;; for XEmacs modeline- and vertical-divider maps
+  (when ecb-running-xemacs
+    (setq ecb-create-layout-old-vertical-div-map vertical-divider-map)
+    (setq vertical-divider-map nil)
+    (setq ecb-create-layout-old-modeline-map modeline-map)
+    (setq modeline-map nil))
+
+  ;; debug on error
+  (setq ecb-create-layout-old-debug-on-error debug-on-error)
+  (setq debug-on-error nil)
+
+  (ecb-create-layout-init-layout t))
+
+
+(defun ecb-delete-new-layout ()
+  "Select a layout-name for a layout created by `ecb-create-new-layout' and
+delete this layout. This means the layout-definiton is removed from the file
+`ecb-create-layout-file' and the layout-function and associated aliases are
+unbound."
+  (interactive)
+  ;; ensure we have load all layouts defined until now
+  (ecb-load-layouts)
+  (let ((new-layout-list
+         (sort (set-difference (ecb-available-layouts-of-type nil)
+                               (mapcar (function (lambda (elem)
+                                                   (car elem)))
+                                       ecb-buildin-layouts)
+                               :test 'string=)
+               'string<))
+        (layout-name nil))
+    (if (= (length new-layout-list) 0)
+        (ecb-error "There are no layouts to delete!")
+      (setq layout-name (ecb-choose-layout-name new-layout-list t)))
+    (with-temp-file (expand-file-name ecb-create-layout-file)
+      (erase-buffer)
+      (if (file-readable-p (expand-file-name ecb-create-layout-file))
+          (insert-file-contents (expand-file-name ecb-create-layout-file))
+        (ecb-error "This layout is not defined in %s!" ecb-create-layout-file))
+      (goto-char (point-min))
+      (if (re-search-forward (concat "^(ecb-layout-define +"
+                                     "\"" layout-name "\".+$")
+                             nil t)
+          (progn
+            ;; Deleting the layout definition in the file
+            ;; `ecb-create-layout-file'.
+            (beginning-of-line)
+            (delete-region (match-beginning 0)
+                           (progn
+                             (forward-sexp)
+                             (point)))
+            (kill-line)
+            ;; undefining the function and aliases.
+            (ecb-layout-undefine layout-name))
+        (ecb-error "This layout is not defined in %s!" ecb-create-layout-file)))))
+
+(defun ecb-create-layout-debug ()
+  (interactive)
+  (message "Layout-Debug: Type: %s, Factor: %s"
+           (ecb-create-layout-buffer-type)
+           (ecb-create-layout-buffer-factor)))
+
+(silentcomp-provide 'ecb-create-layout)
+
+;; ecb-help.el ends here

File ecb-examples.el

+;;; ecb-examples.el --- examples for using ECB with elisp
+
+;; Copyright (C) 2002 Jesper Nordenberg
+;; Copyright (C) 2002 Free Software Foundation, Inc.
+;; Copyright (C) 2002 Klaus Berndl <klaus.berndl@sdm.de>
+
+;; Author: Klaus Berndl <klaus.berndl@sdm.de>
+;; Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
+;; Keywords: java, class, browser
+
+;; This program is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by the Free
+;; Software Foundation; either version 2, or (at your option) any later
+;; version.
+
+;; This program is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+;; more details.
+
+;; You should have received a copy of the GNU General Public License along
+;; with GNU Emacs; see the file COPYING. If not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+;;
+;; Contains the code for some examples mentioned in the online-help.
+;; This is a full working layout-example to demonstrate how to program
+;; complete new special windows/buffers, add them to a layout and syncronize
+;; it with the edit-window of ECB.
+;;
+;; To test this example just do:
+;; 1. Start ECB 
+;; 2. Load ecb-examples.el into (X)Emacs: (require 'ecb-examples)
+;; 3. Call `ecb-show-layout-help' and insert "example-layout1" as layout name
+;;    to see the outline of the test layout and get information about the
+;;    special windows of this layout.
+;; 4. Call `ecb-examples-activate'.
+;; 5. Play around with the new layout and test it.
+;; 6. Call `ecb-examples-deactivate'.
+;;
+;; The intention of this example is to be a skeleton and pattern for other
+;; packages which want to use the layout-engine of ECB do display their own
+;; information. For example graphical debuggers (like JDEbug of JDEE) could be
+;; made this way.
+
+;; $Id$
+
+;;; Code
+
+;; ---------------------------------------------------------------------------
+;; --- Some requirements we always need if using the ECB layout-engine -------
+;; ---------------------------------------------------------------------------
+
+(require 'ecb-util)
+(require 'ecb-layout)
+
+
+;; ---------------------------------------------------------------------------
+;; --- Code for the bufferinfo buffer ----------------------------------------
+;; ---------------------------------------------------------------------------
+
+
+(defconst ecb-examples-bufferinfo-buffer-name " *ECB buffer info*")
+(defvar ecb-examples-bufferinfo-last-file nil)
+
+
+
+;; Two helper functions for displaying infos in a special buffer
+
+(defun ecb-examples-print-file-attributes (buffer filename)
+  "Insert in buffer BUFFER some file-information about FILENAME."
+  (ecb-with-readonly-buffer buffer
+    (erase-buffer)
+    (insert (format "Bufferinfo for %s:\n\n" filename))
+    (let* ((attributes (file-attributes filename))
+           (type (format "Type: %s\n" (cond ((null (nth 0 attributes))
+                                             "File")
+                                            ((equal (nth 0 attributes) t)
+                                             "Directory")
+                                            ((stringp (nth 0 attributes))
+                                             (concat "Link to "
+                                                     (nth 0 attributes))))))
+           (size (format "Size: %d\n" (nth 7 attributes)))
+           (modes (format "Modes: %s\n" (nth 8 attributes))))
+      (insert type size modes))))
+
+
+(defun ecb-examples-print-non-filebuffer (buffer buffer-name)
+  "Insert in buffer BUFFER a small message for buffer with name BUFFER-NAME."
+  (ecb-with-readonly-buffer buffer
+    (erase-buffer)
+    (insert (format "Bufferinfo for buffer %s\n\n" buffer-name))
+    (insert "This is a not a filebuffer, so there are no\n")
+    (insert "informations available.")))
+
+
+
+;; The main synchronizing function which is added to
+;; `ecb-current-buffer-sync-hook' for autom. evaluation by
+;; `ecb-current-buffer-sync' which runs dependend on the values of
+;; `ecb-window-sync' and `ecb-window-sync-delay'.
+
+(defun ecb-examples-bufferinfo-sync ()
+  "Synchronizes the buffer `ecb-examples-bufferinfo-buffer-name' with current
+buffer of the edit-window if that buffer has changed.
+Can be called interactively but normally this should not be necessary because
+it will be called autom. with `ecb-current-buffer-sync-hook'."
+  (interactive)
+
+  (ecb-do-if-buffer-visible-in-ecb-frame 'ecb-examples-bufferinfo-buffer-name
+
+    ;; here we can be sure that the buffer with name
+    ;; `ecb-examples-bufferinfo-buffer-name' is displayed in a window of
+    ;; `ecb-frame'.
+    
+    ;; The macro `ecb-do-if-buffer-visible-in-ecb-frame' binds locally the
+    ;; variables visible-buffer and visible-window:
+    ;; visible-window:= (get-buffer-window ecb-examples-bufferinfo-buffer-name)
+    ;; visible-buffer:= (get-buffer ecb-examples-bufferinfo-buffer-name)
+
+    (let ((filename (buffer-file-name (current-buffer))))
+     
+      (if (and filename (file-readable-p filename))
+
+          ;; synchronizing for real filesource-buffers
+            
+          ;; Let us be smart: We synchronize only if sourcebuffer has changed
+          (when (not (string= (ecb-fix-filename filename)
+                              (ecb-fix-filename
+                               ecb-examples-bufferinfo-last-file)))
+            ;; set new last-file-name so we can check next time if changed
+            (setq ecb-examples-bufferinfo-last-file filename)
+            ;; we display the file-infos for current source-file
+            (ecb-examples-print-file-attributes visible-buffer filename))
+        
+        ;; what should we do for non file buffers like help-buffers etc...
+        (setq ecb-examples-bufferinfo-last-file nil)
+        (ecb-examples-print-non-filebuffer visible-buffer
+                                           (buffer-name (current-buffer)))))))
+
+
+
+;; ---------------------------------------------------------------------------
+;; --- Code for the action buffer --------------------------------------------
+;; ---------------------------------------------------------------------------
+
+
+(defconst ecb-examples-action-buffer-name " *ECB action buffer*")
+(defvar ecb-examples-action-buffer-keymap nil)
+
+
+
+;; Two helper functions for creating a readonly buffer with a special local
+;; keymap.
+
+(defun ecb-examples-insert-text-in-action-buffer (text)
+  "Insert TEXT at point and make it highlight-able for mouse-movement over the
+text."
+  (let ((p (point)))
+    (insert text)
+    (put-text-property p (+ p (length text)) 'mouse-face 'highlight)))
+
+(defun ecb-examples-action-buffer-create ()
+  "Return the action-buffer with name `ecb-examples-action-buffer-name' If
+the buffer does not exist it will be created. The buffer is read only,
+contains two buttons \[prior] and \[next] and mouse-2 calls
+`ecb-examples-action-buffer-clicked'."
+  (save-excursion
+    (if (get-buffer ecb-examples-action-buffer-name)
+        (get-buffer ecb-examples-action-buffer-name)
+      (let ((nop (function (lambda() (interactive)))))
+        (set-buffer (get-buffer-create ecb-examples-action-buffer-name))
+
+        ;; we setup a local keymap
+        
+        (make-local-variable 'ecb-examples-action-buffer-keymap)
+        (setq ecb-examples-action-buffer-keymap (make-sparse-keymap))
+        
+        ;; define mouse-2 with `ecb-examples-action-buffer-clicked'
+        (define-key ecb-examples-action-buffer-keymap
+          (if ecb-running-xemacs '(button2) [down-mouse-2])
+          'ecb-examples-action-buffer-clicked)
+
+        ;; nop operations for the other mouse-2 operations with Emacs
+        (define-key ecb-examples-action-buffer-keymap [mouse-2] nop)
+        (define-key ecb-examples-action-buffer-keymap [double-mouse-2] nop)
+        (define-key ecb-examples-action-buffer-keymap [triple-mouse-2] nop)
+        
+        (use-local-map ecb-examples-action-buffer-keymap)
+
+        ;; insert the action buttons [prior] und [next] and make it read-only
+
+        (ecb-with-readonly-buffer (current-buffer)
+         (erase-buffer)
+         (ecb-examples-insert-text-in-action-buffer "[prior]")
+         (insert "\n")
+         (ecb-examples-insert-text-in-action-buffer "[next]")
+         (insert "\n"))
+        
+        (current-buffer)))))
+
+
+
+;; The function which performs the actions in the action-buffer
+
+(defun ecb-examples-action-buffer-clicked (e)
+  "Perform the right action for the mouse-click. If the user clicks onto
+\[prior] the buffer in the edit-window is scrolled up, if clickes onto \[next]
+the buffer in the edit-window is scrolled down. Otherwise nothing will be
+done."
+  (interactive "e")
+  (mouse-set-point e)
+  (let ((line (buffer-substring (ecb-line-beginning-pos) (ecb-line-end-pos))))
+    (cond ((string-match "prior" line)
+           (ecb-select-edit-window)
+           (call-interactively 'scroll-down))
+          ((string-match "next" line)
+           (ecb-select-edit-window)
+           (call-interactively 'scroll-up))
+          (t nil))))
+
+
+;; ---------------------------------------------------------------------------
+;; --- The layout definiton with a bufferinfo- and a action-buffer -----------
+;; ---------------------------------------------------------------------------
+
+
+(ecb-layout-define "example-layout1" top
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |Bufferinfo for <filename>:            |[prior]       |
+   |Type: file                            |[next]        |
+   |Size: 23456                           |              |
+   |Modes: rw-rw-rw-                      |              |
+   |-----------------------------------------------------|
+   |                                                     |
+   |                                                     |
+   |                                                     |
+   |                                                     |
+   |                    Edit                             |
+   |                                                     |
+   |                                                     |
+   |                                                     |
+   |                                                     |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place.
+
+The top-left window always displays informations about the current buffer in
+the selected edit-window. This window demonstrates how autom. synchronizing
+a special window/buffer of a layout with current edit-window.
+
+The top-right window offers two buttons which can be used with the middle
+mouse-button to scroll the edit-window. This is not very senseful but it
+demonstrates how to drive the edit-window with actions performed in a special
+window/buffer of a layout."
+
+  ;; dedicating the bufferinfo window to the bufferinfo-buffer
+  (ecb-with-dedicated-window
+   (switch-to-buffer (get-buffer-create ecb-examples-bufferinfo-buffer-name))
+   (setq buffer-read-only t))
+  
+  ;; creating the action-window
+  (ecb-split-hor 0.75)
+  
+  ;; dedicate the action window to the action-buffer
+  (ecb-with-dedicated-window
+   (switch-to-buffer (buffer-name (ecb-examples-action-buffer-create))))
+
+  ;; select the edit-window
+  (select-window (next-window)))
+
+
+;; ---------------------------------------------------------------------------
+;; --- (De)activating the new layout and the synchronization -----------------
+;; ---------------------------------------------------------------------------
+
+
+
+;; Code for saving and restoring the state before activation
+
+(defvar ecb-examples-preact-layout nil)
+(defvar ecb-examples-preact-windows-height nil)
+(defvar ecb-examples-preact-compile-window-height nil)
+(defun ecb-examples-preactivation-state(action)
+  (cond ((equal action 'save)
+         (setq ecb-examples-preact-layout
+               ecb-layout-name
+               ecb-examples-preact-windows-height
+               ecb-windows-height
+               ecb-examples-preact-compile-window-height
+               ecb-compile-window-height))
+        ((equal action 'restore)
+         (setq ecb-layout-name
+               ecb-examples-preact-layout
+               ecb-windows-height
+               ecb-examples-preact-windows-height
+               ecb-compile-window-height
+               ecb-examples-preact-compile-window-height))))
+
+
+
+;; Activation of the example. Because a set of new special windows integrated
+;; in a new layout is often just the GUI of a complete tool (like a graphical
+;; debugger) we demonstrate here the complete activation and deactivation of
+;; such a tool or at least of the tool-GUI. We decide that the GUI of our
+;; example tool needs a compile-window with height 5 lines and the height of
+;; the special windows "row" on top should be exactly 6 lines (normally width
+;; and height of the special windows should be a fraction of the frame, but
+;; here we use 6 lines; You can change the code below to use a frame-fraction
+;; of 0.2 instead of 6 hard lines, just try it!
+
+(defun ecb-examples-activate ()
+  "Activate the new layout \"example-layout1\". Add
+`ecb-examples-bufferinfo-sync' to `ecb-current-buffer-sync-hook', set
+`ecb-compile-window-height' to 5 and `ecb-windows-height' to 6. The
+preactivation-state is saved and will be restored by `ecb-examples-deactivate'."
+  (interactive)
+
+  (assert (featurep 'ecb) nil
+          "ECB must be loaded!")
+  (assert ecb-minor-mode nil
+          "ECB must be activated!")
+  (assert (equal (selected-frame) ecb-frame) nil
+          "The ECB-frame must be selected!")
+  (assert (not (string= ecb-layout-name "example-layout1")) nil
+          "The examples-layout1 is already active!")
+  
+  ;; activating the synchronization of the bufferinfo-window
+  (add-hook 'ecb-current-buffer-sync-hook
+            'ecb-examples-bufferinfo-sync)
+  
+  ;; saving the state
+  (ecb-examples-preactivation-state 'save)
+
+  ;; switch to our prefered layout
+  (setq ecb-windows-height 6)
+  (setq ecb-compile-window-height 5)
+  (ecb-layout-switch "example-layout1"))
+
+
+
+;; Deactivation of the example
+
+(defun ecb-examples-deactivate ()
+  "Deactivate the new layout \"example-layout1\". Remove
+`ecb-examples-bufferinfo-sync' from `ecb-current-buffer-sync-hook' and restore
+the state as before activation."
+  (interactive)
+
+  (assert (featurep 'ecb) nil
+          "ECB must be loaded!")
+  (assert ecb-minor-mode nil
+          "ECB must be activated!")
+  (assert (equal (selected-frame) ecb-frame) nil
+          "The ECB-frame must be selected!")
+  (assert (string= ecb-layout-name "example-layout1") nil
+          "The example-layout1 is not active!")
+  
+  (remove-hook 'ecb-current-buffer-sync-hook
+               'ecb-examples-bufferinfo-sync)
+  (ecb-examples-preactivation-state 'restore)
+  (ecb-layout-switch ecb-layout-name))
+  
+
+;; ---------------------------------------------------------------------------
+;; --- Providing the examples ------------------------------------------------
+;; ---------------------------------------------------------------------------
+
+(provide 'ecb-examples)
+
+;; ecb-examples.el ends here

File ecb-layout-defs.el

+;;; ecb-layout.el --- layout for ECB
+
+;; Copyright (C) 2000, 2001 Jesper Nordenberg, Klaus Berndl
+
+;; Author: Klaus Berndl <klaus.berndl@sdm.de>
+;; Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
+;; Keywords: java, class, browser
+
+;; This program is free software; you can redistribute it and/or modify it under
+;; the terms of the GNU General Public License as published by the Free Software
+;; Foundation; either version 2, or (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+;; FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+;; details.
+
+;; You should have received a copy of the GNU General Public License along with
+;; GNU Emacs; see the file COPYING.  If not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+;; $Id$
+
+;;; Commentary:
+;;
+;; Contains all layout definitions for ECB
+;;
+;; This file is part of the ECB package which can be found at:
+;; http://ecb.sourceforge.net
+
+(eval-when-compile
+  (require 'silentcomp))
+
+(require 'ecb-util)
+(require 'ecb-layout)
+
+;; ========= Current available layouts ===============================
+
+;; Here come all the index layout-functions:
+
+;; Layout left1 -----------------------------------------------------
+
+(ecb-layout-define "left1" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |  Directories |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |--------------|                                      |
+   |      |       |                                      |
+   | Sour | Hist  |                 Edit                 |
+   |      |       |                                      |
+   |      |       |                                      |
+   |--------------|                                      |
+   |              |                                      |
+   |  Methods     |                                      |
+   |              |                                      |
+   |              |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (ecb-set-directories-buffer)
+  (ecb-split-ver 0.3)
+  (ecb-set-sources-buffer)
+  (ecb-split-ver 0.5)
+  (ecb-set-methods-buffer)
+  (select-window (previous-window))
+  (ecb-split-hor 0.5)
+  (ecb-set-history-buffer)
+  (select-window (next-window (next-window))))
+
+;; Layout left2 -----------------------------------------------------
+
+(ecb-layout-define "left2" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |  Directories |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |--------------|                 Edit                 |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |  Sources     |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (ecb-set-directories-buffer)
+  (ecb-split-ver 0.5)
+  (ecb-set-sources-buffer)
+  (select-window (next-window)))
+
+;; Layout left3 -----------------------------------------------------
+
+(ecb-layout-define "left3" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |  Directories |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |--------------|                                      |
+   |              |                                      |
+   |  Sources     |                 Edit                 |
+   |              |                                      |
+   |              |                                      |
+   |--------------|                                      |
+   |              |                                      |
+   |  Methods     |                                      |
+   |              |                                      |
+   |              |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (ecb-set-directories-buffer)
+  (ecb-split-ver 0.3)
+  (ecb-set-sources-buffer)
+  (ecb-split-ver 0.5)
+  (ecb-set-methods-buffer)
+  (select-window (next-window)))
+
+;; Layout left4 -----------------------------------------------------
+
+(ecb-layout-define "left4" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |  Directories |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |--------------|                 Edit                 |
+   |      |       |                                      |
+   |      |       |                                      |
+   |      |       |                                      |
+   | Sour | Hist  |                                      |
+   |      |       |                                      |
+   |      |       |                                      |
+   |      |       |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (ecb-set-directories-buffer)
+  (ecb-split-ver 0.5)
+  (ecb-set-sources-buffer)
+  (ecb-split-hor 0.5)
+  (ecb-set-history-buffer)
+  (select-window (next-window)))
+
+;; Layout left5 -----------------------------------------------------
+
+(ecb-layout-define "left5" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |  Directories |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |--------------|                                      |
+   |              |                                      |
+   |  Sources     |                 Edit                 |
+   |              |                                      |
+   |              |                                      |
+   |--------------|                                      |
+   |              |                                      |
+   |  History     |                                      |
+   |              |                                      |
+   |              |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (ecb-set-directories-buffer)
+  (ecb-split-ver 0.3)
+  (ecb-set-sources-buffer)
+  (ecb-split-ver 0.5)
+  (ecb-set-history-buffer)
+  (select-window (next-window)))
+
+;; Layout right1 -----------------------------------------------------
+
+(ecb-layout-define "right1" right
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |                                      |              |
+   |                                      |  Directories |
+   |                                      |              |
+   |                                      |              |
+   |                                      |--------------|
+   |                                      |              |
+   |                                      |              |
+   |             Edit                     |  Sources     |
+   |                                      |              |
+   |                                      |              |
+   |                                      |--------------|
+   |                                      |              |
+   |                                      |  Methods     |
+   |                                      |              |
+   |                                      |              |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (let ((edit-win (previous-window (selected-window) 0)))
+    (ecb-set-directories-buffer)
+    (ecb-split-ver 0.3)
+    (ecb-set-sources-buffer)
+    (ecb-split-ver 0.5)
+    (ecb-set-methods-buffer)
+    (select-window edit-win)))
+
+;; Layout right2 -----------------------------------------------------
+
+(ecb-layout-define "right2" right
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |                                      |              |
+   |                                      |              |
+   |                                      |              |
+   |                                      |  Directories |
+   |                                      |              |
+   |                                      |              |
+   |                                      |              |
+   |             Edit                     |--------------|
+   |                                      |              |
+   |                                      |              |
+   |                                      |              |
+   |                                      |  Methods     |
+   |                                      |              |
+   |                                      |              |
+   |                                      |              |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (let ((edit-win (previous-window (selected-window) 0)))
+    (ecb-set-directories-buffer)
+    (ecb-split-ver 0.5)
+    (ecb-set-methods-buffer)
+    (select-window edit-win)))
+
+;; Layout left6 -----------------------------------------------------
+
+(ecb-layout-define "left6" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |  Sources     |                                      | 
+   |--------------|                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |  Methods     |                 Edit                 |
+   |              |                                      | 
+   |              |                                      |
+   |              |                                      |
+   |--------------|                                      |
+   |  History     |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (ecb-set-sources-buffer)
+  (ecb-split-ver 0.2)
+  (ecb-set-methods-buffer)
+  (ecb-split-ver 0.75)
+  (ecb-set-history-buffer)
+  (select-window (next-window)))
+
+;; Layout top1 -----------------------------------------------------
+
+(ecb-layout-define "top1" top
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |                        |             |              |
+   |                        |             |              |
+   |      Directories       |  Sources    |  Methods     |
+   |                        |             |              |
+   |                        |             |              |
+   |-----------------------------------------------------|
+   |                                                     |
+   |                                                     |
+   |                                                     |
+   |                                                     |
+   |                    Edit                             |
+   |                                                     |
+   |                                                     |
+   |                                                     |
+   |                                                     |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (ecb-set-directories-buffer)
+  (ecb-split-hor 0.5)
+  (ecb-set-sources-buffer)
+  (ecb-split-hor 0.5)
+  (ecb-set-methods-buffer)
+  (select-window (next-window)))
+
+;; Layout left7 -----------------------------------------------------
+
+(ecb-layout-define "left7" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |  Directories |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |--------------|                 Edit                 |
+   |              |                                      |
+   |  History     |                                      |
+   |              |                                      |
+   |--------------|                                      |
+   |              |                                      |
+   |  Methods     |                                      |
+   |              |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place. This layout works best if it is contained in
+`ecb-show-sources-in-directories-buffer'!"
+  (ecb-set-directories-buffer)
+  (ecb-split-ver 0.6)
+  (ecb-set-history-buffer)
+  (ecb-split-ver 0.4)
+  (ecb-set-methods-buffer)
+  (select-window (next-window)))
+
+;; Layout left8 -----------------------------------------------------
+
+(ecb-layout-define "left8" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |  Directories |                                      |
+   |              |                                      |
+   |--------------|                                      |
+   |              |                                      |
+   |  Sources     |                                      |
+   |              |                                      |
+   |--------------|                 Edit                 |
+   |              |                                      |
+   |  Methods     |                                      |
+   |              |                                      |
+   |              |                                      |
+   |--------------|                                      |
+   |  History     |                                      |
+   |              |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (ecb-set-directories-buffer)
+  (ecb-split-ver 0.3)
+  (ecb-set-sources-buffer)
+  (ecb-split-ver 0.35)
+  (ecb-set-methods-buffer)
+  (ecb-split-ver 0.65)
+  (ecb-set-history-buffer)
+  (select-window (next-window)))
+
+;; Layout top2 -----------------------------------------------------
+
+(ecb-layout-define "top2" top
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |                                                     |
+   |                                                     |
+   |                    Methods                          |
+   |                                                     |
+   |                                                     |
+   |-----------------------------------------------------|
+   |                                                     |
+   |                                                     |
+   |                                                     |
+   |                                                     |
+   |                    Edit                             |
+   |                                                     |
+   |                                                     |
+   |                                                     |
+   |                                                     |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (ecb-set-methods-buffer)
+  (select-window (next-window)))
+
+;; Layout left9 -----------------------------------------------------
+
+(ecb-layout-define "left9" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |   Methods    |                 Edit                 |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (ecb-set-methods-buffer)
+  (select-window (next-window)))
+
+;; Layout left10 -----------------------------------------------------
+
+(ecb-layout-define "left10" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |  Methods     |                 Edit                 |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |--------------|                                      |
+   |  Sou | Hist  |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then the
+layout contains no durable compilation window and the other windows get a little
+more place."
+  (ecb-set-methods-buffer)
+  (ecb-split-ver 0.75)
+  (ecb-set-sources-buffer)
+  (ecb-split-hor 0.5)
+  (ecb-set-history-buffer)
+  (select-window (next-window)))
+
+;; Layout left11 -----------------------------------------------------
+
+(ecb-layout-define "left11" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |  Methods     |                 Edit                 |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |--------------|                                      |
+   |    Hist      |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then the
+layout contains no durable compilation window and the other windows get a little
+more place."
+  (ecb-set-methods-buffer)
+  (ecb-split-ver 0.75)
+  (ecb-set-history-buffer)
+  (select-window (next-window)))
+
+;; Layout left12 -----------------------------------------------------
+
+(ecb-layout-define "left12" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |   History    |                 Edit                 |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (ecb-set-history-buffer)
+  (select-window (next-window)))
+
+;; Layout left13 -----------------------------------------------------
+
+(ecb-layout-define "left13" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   | Directories  |                 Edit                 |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place. This layout works best if it is contained in
+`ecb-show-sources-in-directories-buffer'!"
+  (ecb-set-directories-buffer)
+  (select-window (next-window)))
+
+;; Layout left14 -----------------------------------------------------
+
+(ecb-layout-define "left14" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   | Directories  |                 Edit                 |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |--------------|                                      |
+   |    Hist      |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place. This layout works best if it is contained in
+`ecb-show-sources-in-directories-buffer'!"
+  (ecb-set-directories-buffer)
+  (ecb-split-ver 0.75)
+  (ecb-set-history-buffer)
+  (select-window (next-window)))
+
+;; Layout left15 -----------------------------------------------------
+
+(ecb-layout-define "left15" left
+  "This function creates the following layout:
+
+   -------------------------------------------------------
+   |              |                                      |
+   |  Directories |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |--------------|                 Edit                 |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   |  Methods     |                                      |
+   |              |                                      |
+   |              |                                      |
+   |              |                                      |
+   -------------------------------------------------------
+   |                                                     |
+   |                    Compilation                      |
+   |                                                     |
+   -------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place. This layout works best if it is contained in
+`ecb-show-sources-in-directories-buffer'!"
+  (ecb-set-directories-buffer)
+  (ecb-split-ver 0.5)
+  (ecb-set-methods-buffer)
+  (select-window (next-window)))
+
+;; Layout leftright1 -----------------------------------------------------
+
+(ecb-layout-define "leftright1" left-right
+ "This function creates the following layout:
+
+   --------------------------------------------------------------
+   |              |                               |             |
+   |  Directories |                               |  Methods    |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |--------------|             Edit              |             |
+   |              |                               |             |
+   |  Sources     |                               |             |
+   |              |                               |             |
+   |--------------|                               |             |
+   |              |                               |             |
+   |  History     |                               |             |
+   |              |                               |             |
+   --------------------------------------------------------------
+   |                                                            |
+   |                    Compilation                             |
+   |                                                            |
+   --------------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+ (ecb-set-directories-buffer)
+ (ecb-split-ver 0.4)
+ (ecb-set-sources-buffer)
+ (ecb-split-ver 0.5)
+ (ecb-set-history-buffer)
+ (select-window (next-window (next-window)))
+ (ecb-set-methods-buffer)
+ (select-window (previous-window (selected-window) 0)))
+
+;; Layout leftright2 -----------------------------------------------------
+
+(ecb-layout-define "leftright2" left-right
+ "This function creates the following layout:
+
+   --------------------------------------------------------------
+   |              |                               |             |
+   |  Directories |                               |  Methods    |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |--------------|             Edit              |-------------|
+   |              |                               |             |
+   |  Sources     |                               |  History    |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   --------------------------------------------------------------
+   |                                                            |
+   |                    Compilation                             |
+   |                                                            |
+   --------------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+ (ecb-set-directories-buffer)
+ (ecb-split-ver 0.66)
+ (ecb-set-sources-buffer)
+ (select-window (next-window (next-window)))
+ (ecb-set-methods-buffer)
+ (ecb-split-ver 0.66)
+ (ecb-set-history-buffer)
+ (select-window (previous-window (previous-window (selected-window) 0) 0)))
+
+;; Layout leftright3 -----------------------------------------------------
+
+(ecb-layout-define "leftright3" left-right
+  "This function creates the following layout:
+
+   --------------------------------------------------------------
+   |              |                               |             |
+   |  Directories |                               |  Methods    |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |             Edit              |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   |              |                               |             |
+   --------------------------------------------------------------
+   |                                                            |
+   |                    Compilation                             |
+   |                                                            |
+   --------------------------------------------------------------
+
+If you have not set a compilation-window in `ecb-compile-window-height' then
+the layout contains no durable compilation window and the other windows get a
+little more place."
+  (ecb-set-directories-buffer)
+  (select-window (next-window (next-window)))
+  (ecb-set-methods-buffer)
+  (select-window (previous-window (selected-window) 0)))
+
+
+(defconst ecb-buildin-layouts (copy-list ecb-available-layouts)
+  "All layouts defined until now.")
+
+(silentcomp-provide 'ecb-layout-defs)
+
+;;; ecb-layout-defs.el ends here
+;;; ecb-tod.el: ECB tip od the day
+
+;; Copyright (C) 2003 Jesper Nordenberg
+;; Copyright (C) 2003 Free Software Foundation, Inc.
+;; Copyright (C) 2003 Klaus Berndl <klaus.berndl@sdm.de>
+
+;; Author: Klaus Berndl <klaus.berndl@sdm.de>
+;; Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
+;; Keywords: java, class, browser
+
+;; This program is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by the Free
+;; Software Foundation; either version 2, or (at your option) any later
+;; version.
+
+;; This program is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+;; more details.
+
+;; You should have received a copy of the GNU General Public License along
+;; with GNU Emacs; see the file COPYING. If not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+;; $Id$
+
+;;; Commentary:
+;;
+;; Contains code for tips of the day
+
+;;; Code
+
+(eval-when-compile
+  (require 'silentcomp))
+
+(require 'ecb-util)
+
+(silentcomp-defvar ecb-tod-cursor)
+
+(defcustom ecb-tip-of-the-day t
+  "*Show tip of the day at start time of ECB."
+  :group 'ecb-general
+  :type 'boolean)
+
+(defcustom ecb-tip-of-the-day-file "~/.ecb-tip-of-day.el"
+  "*File where tip-of-the-day cursor is stored."
+  :group 'ecb-general
+  :type 'file)
+
+(defconst ecb-tod-tip-list
+  '("You can expand the ECB-methods-buffer with `ecb-expand-methods-nodes' [C-c . x]."
+    "You can toggle between different layouts with `ecb-toggle-layout' [C-c . t]."
+    "You can toggle displaying the ECB-windows with `ecb-toggle-ecb-windows' [C-c . w]."
+    "You can use speedbar as directory browser with option `ecb-use-speedbar-for-directories'."
+    "You can speedup access for big directories with option `ecb-cache-directory-contents'."
+    "You can display the online help also in HTML-format with option `ecb-show-help-format'."
+    "You can interactively create your own layouts with the command `ecb-create-new-layout'."
+    "You can start the eshell in the compile-window with `ecb-eshell-goto-eshell' [C-c . e]."
+    "You can \(de)activate ECB on a major-mode basis with `ecb-major-modes-activate' and `ecb-major-modes-deactivate'."
+    "Use the incremental search in the methods-buffer for fast node-selecting; see `ecb-tree-incremental-search'."
+    "You can cycle through all currently opened \"compile-buffers\" with `ecb-cycle-through-compilation-buffers'."
+    "You can change the window-sizes by dragging the mouse and storing the new sizes with `ecb-store-window-sizes'."
+    "You can get a quick overlook of all builtin layouts with `ecb-show-layout-help'."
+    "Browse your sources as with a web-browser with `ecb-nav-goto-next' \[C-c . n], `ecb-nav-goto-previous' \[C-c . p]."
+    "Download latest ECB direct from the website with `ecb-download-ecb'."
+    "Download latest semantic direct from the website with `ecb-download-semantic''."
+    "Customize the look\&feel of the tree-buffers with `ecb-tree-expand-symbol-before' and `ecb-tree-indent'."
+    "Customize the contents of the methods-buffer with `ecb-token-display-function', `ecb-type-token-display', `ecb-show-tokens'."
+    "Customize the main mouse-buttons of the tree-buffers with `ecb-primary-secondary-mouse-buttons'."
+    "Customize with `ecb-tree-RET-selects-edit-window' in which tree-buffer a RETURN selects the edit-window."
+    "Grep a directory \(recurive) by using the popup-menu \(the right mouse-button) in the directories buffer."
+    "Customize the sorting of the sources with the option `ecb-sources-sort-method'."
+    "Narrow the source-buffer to the selected token in the methods-buffer with `ecb-token-jump-narrow'."
+    "Enable autom. enlarging of the compile-window by select with the option `ecb-compile-window-enlarge-by-select'."
+    "Customize with `ecb-compile-window-temporally-enlarge' the situations the compile-window is allowed to enlarge."
+    "Customize the jump-behavior of `other-window' [C-x o] with the option `ecb-other-window-jump-behavior'."
+    "Customize height and width of the ECB-windows with `ecb-windows-height' and `ecb-windows-width'."
+    "Define with `ecb-compilation-buffer-names' and `ecb-compilation-major-modes' which buffers are \"compile-buffers\"."
+    "Customize all faces used by ECB with the customize-groups `ecb-face-options' and `ecb-faces'."
+    "Auto-activate eshell with the option `ecb-eshell-auto-activate'."
+    "Get best use of big screen-displays with leftright-layouts like \"leftright1\" or \"leftright2\"."
+    "Use the POWER-click in the methods-buffer to narrow the clicked node in the edit-window."
+    "Use the POWER-click in the sources- and history-buffer to get only an overlook of the source-contents."
+    "Exclude not important sources from being displayed in the sources-buffer with `ecb-source-file-regexps'."
+    "Use left- and right-arrow for smart expanding/collapsing tree-buffer-nodes; see `ecb-tree-navigation-by-arrow'."
+    "Add personal keybindings to the tree-buffers with `ecb-common-tree-buffer-after-create-hook'."
+    "Add personal keybindings to the directories-buffer with `ecb-directories-buffer-after-create-hook'."
+    "Add personal keybindings to the sources-buffer with `ecb-sources-buffer-after-create-hook'."
+    "Add personal keybindings to the methods-buffer with `ecb-methods-buffer-after-create-hook'."
+    "Add personal keybindings to the history-buffer with `ecb-history-buffer-after-create-hook'."
+    "Pop up a menu with the right mouse-button and do senseful things in the tree-buffers."
+    "Call `ecb-show-help' [C-c . o] with a prefix-argument [C-u] and choose the help-format."
+    "You can change the prefix [C-c .] of all ECB-keybindings quick and easy with `ecb-key-map'."
+    "Send a problem-report to the ECB-mailing-list quick and easy with `ecb-submit-problem-report'."
+    "Switch on/off auto. expanding of the ECB-methods-buffer with `ecb-auto-expand-directory-tree'."
+    "You can quickly toggle auto. expanding of the ECB-methods-buffer with `ecb-toggle-auto-expand-token-tree'."
+    "Highlight current semantic-token of the edit-buffer in the ECB-methods-buffer with `ecb-highlight-token-with-point'."
+    "Use `scroll-all-mode' to scroll both edit-windows of ECB simultaneously - and no other windows are scrolled!"
+    "You can toggle having a compile window with `ecb-toggle-compile-window' if `ecb-compile-window-height' is not nil."
+    "Start ECB automatically after Emacs is started. Use option `ecb-auto-activate'"
+    )
+  "List of all available tips of the day.")
+
+
+
+;; Klaus Berndl <klaus.berndl@sdm.de>: just a first try to get current