* riece-display.el (riece-configure-windows-top): New function.
authorkaoru <kaoru>
Wed, 20 Aug 2003 15:18:25 +0000 (15:18 +0000)
committerkaoru <kaoru>
Wed, 20 Aug 2003 15:18:25 +0000 (15:18 +0000)
* riece-layout.el: New add-on.

lisp/ChangeLog
lisp/riece-display.el
lisp/riece-layout.el

index 2782d38..f515e88 100644 (file)
@@ -1,3 +1,8 @@
+2003-08-20  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * riece-display.el (riece-configure-windows-top): New function.
+       * riece-layout.el: New add-on.
+
 2003-08-19  Daiki Ueno  <ueno@unixuser.org>
 
        * riece-layout.el: New add-on.
index 64ac02b..7b7c5bd 100644 (file)
@@ -101,6 +101,67 @@ Local to the buffers.")
     (select-window (or (get-buffer-window buffer)
                       (get-buffer-window riece-command-buffer)))))
 
+(defun riece-configure-windows-top (&optional plist)
+  "Candidate of `riece-configure-windows-function'.
+PLIST accept :command-height, :nick-width, and :channel-list-width."
+  (let ((command-height (or (plist-get plist :command-height) 5))
+       (nick-width (or (plist-get plist :nick-width) 13))
+       (channel-list-width (or (plist-get plist :channel-list-width) 25))
+       (buffer (window-buffer))
+       (show-user-list
+        (and riece-user-list-buffer-mode
+             riece-current-channel
+             ;; User list buffer is nuisance for private conversation.
+             (riece-channel-p (riece-identity-prefix
+                               riece-current-channel)))))
+    ;; Can't expand minibuffer to full frame.
+    (when (eq (selected-window) (minibuffer-window))
+      (other-window 1))
+    (delete-other-windows)
+    ;; top of frame
+    (let ((rest-window (split-window (selected-window) command-height)))
+      (set-window-buffer (selected-window)
+                        riece-command-buffer)
+      (select-window rest-window))
+    ;; middle of frame (vertical-spilit when need)
+    (when (or (and riece-current-channel riece-channel-buffer-mode)
+             show-user-list)
+      (let ((rest-window
+            (split-window (selected-window)
+                          (/ (* 5 (+ (window-height) command-height)) 8))))
+       (cond
+        ;; channel-buffer + user-list
+        ((and show-user-list
+              (and riece-current-channel riece-channel-buffer-mode))
+         (set-window-buffer
+          (split-window (selected-window) (- (window-width) nick-width) t)
+          riece-user-list-buffer)
+         (set-window-buffer (selected-window) riece-channel-buffer))
+        ;; only user-list
+        (show-user-list
+         (set-window-buffer (selected-window) riece-user-list-buffer))
+        ;; only channel-buffer
+        (riece-channel-buffer-mode
+         (set-window-buffer (selected-window) riece-channel-buffer)))
+       (select-window rest-window)))
+    ;; bottom of frame
+    (if (and riece-current-channel
+            riece-channel-list-buffer-mode)
+       (progn
+         (set-window-buffer
+          (split-window (selected-window)
+                        (- (window-width) channel-list-width) t)
+          riece-channel-list-buffer)
+         (set-window-buffer (selected-window) riece-others-buffer)
+         (with-current-buffer riece-channel-buffer
+           (setq truncate-partial-width-windows nil))
+         (with-current-buffer riece-others-buffer
+           (setq truncate-partial-width-windows nil)))
+      (set-window-buffer (selected-window) riece-dialogue-buffer))
+    (riece-set-window-points)
+    (select-window (or (get-buffer-window buffer)
+                      (get-buffer-window riece-command-buffer)))))
+
 (defun riece-set-window-points ()
   (if (get-buffer-window riece-user-list-buffer)
       (with-current-buffer riece-user-list-buffer
index 39c2d7c..f36960b 100644 (file)
@@ -46,7 +46,8 @@
   :group 'riece-layout)
 
 (defcustom riece-layout-alist
-  '(("default" riece-configure-windows riece-configure-windows-predicate))
+  '(("default" riece-configure-windows riece-configure-windows-predicate)
+    ("top" riece-configure-windows-top riece-configure-windows-predicate))
   "An alist mapping the names to configure/predicate functions."
   :type 'list
   :group 'riece-layout)
@@ -79,4 +80,4 @@ the layout to the selected layout-name."
 
 (provide 'riece-layout)
 
-;;; riece-layout.el ends here
\ No newline at end of file
+;;; riece-layout.el ends here