Fix byte-compile error
[riece] / lisp / riece-layout.el
index f83319e..ed5897b 100644 (file)
@@ -1,8 +1,8 @@
-;;; riece-layout.el --- layout management
+;;; riece-layout.el --- layout management -*- lexical-binding: t -*-
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
-;;     TAKAHASHI "beatmaria" Kaoru <kaoru@kaisei.org>
+;;     TAKAHASHI Kaoru <kaoru@kaisei.org>
 ;; Keywords: IRC, riece
 
 ;; This file is part of Riece.
@@ -19,8 +19,8 @@
 
 ;; 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.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Code:
 
@@ -28,7 +28,7 @@
 (require 'riece-misc)
 
 (defgroup riece-layout nil
-  "Manage window layouts"
+  "Window layouts."
   :prefix "riece-"
   :group 'riece)
 
@@ -45,6 +45,8 @@
     ("bottom-right" riece-configure-windows right bottom)
     ("bottom-left" riece-configure-windows left bottom)
     ("top" riece-configure-windows-top)
+    ("spiral" riece-configure-windows-spiral)
+    ("one-window" riece-configure-windows-one-window)
     ("default" . "middle-right"))
   "An alist mapping the names to layout functions.
 An element of this alist is either in the following forms:
@@ -56,7 +58,11 @@ In the first form, NAME is a string which specifies the layout
 setting, and CONFIGURE-FUNCTION is a function which does window
 splitting, etc.  PARAMETERS are collected and passed to CONFIGURE-FUNCTION.
 In the second form, NAME1 is an alias for NAME2."
-  :type 'list
+  :type '(repeat (choice (list :tag "Layout"
+                               (string :tag "Name")
+                               (function :tag "Configure function")
+                               (repeat :tag "Parameters" :inline t symbol))
+                         (cons :tag "Alias" string string)))
   :group 'riece-layout)
 
 (defun riece-redraw-layout (&optional force)
@@ -250,6 +256,59 @@ PLIST accept :command-height, :user-list-width, and :channel-list-width."
     (select-window (or (get-buffer-window buffer)
                       (get-buffer-window riece-command-buffer)))))
 
+;; +---+-------------------+---+
+;; | c | channel           | u |
+;; | h |                   | s |
+;; | a |                   | e |
+;; | n |-------------------+ r |   | +---+
+;; | n | command           | s |   | |   |
+;; | e +-------------------+---+   | +-> |
+;; | l | others                |   +-----+
+;; | s |                       |
+;; +---+-----------------------+
+(defun riece-configure-windows-spiral ()
+  "spiral placement of windows"
+;;  (interactive)
+  (let ((command-height 4)
+        (users-width    15)
+        (channels-width 30)
+        (buffer         (window-buffer)))
+    (when (eq (selected-window) (minibuffer-window)) (other-window 1))
+    (delete-other-windows)
+
+    ;; (1) create channels window
+    (let ((rest (split-window (selected-window) channels-width t)))
+      (set-window-buffer (selected-window) riece-channel-list-buffer)
+      (select-window rest))
+
+    ;; (2) create others window
+    (set-window-buffer (split-window (selected-window)
+                                     (+ (/ (window-height) 2)
+                                        command-height))
+                       riece-others-buffer)
+
+    ;; (3) create users window
+    (set-window-buffer (split-window (selected-window)
+                                     (- (window-width) users-width) t)
+                       riece-user-list-buffer)
+  
+    ;; (4) create current channel window
+    (let ((rest (split-window (selected-window)
+                              (- (window-height) command-height))))
+      (set-window-buffer rest riece-command-buffer)
+      (set-window-buffer (selected-window) riece-channel-buffer))
+
+    (riece-set-window-points)
+    (select-window (or (get-buffer-window buffer)
+                       (get-buffer-window riece-command-buffer)))))
+
+(defun riece-configure-windows-one-window ()
+  ;; Can't expand minibuffer to full frame.
+  (if (eq (selected-window) (minibuffer-window))
+      (other-window 1))
+  (delete-other-windows)
+  (set-window-buffer (selected-window) riece-dialogue-buffer))
+
 (provide 'riece-layout)
 
 ;;; riece-layout.el ends here