* riece-toolbar.el: New add-on.
authorDaiki Ueno <ueno@unixuser.org>
Sat, 11 Dec 2004 06:47:43 +0000 (06:47 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Sat, 11 Dec 2004 06:47:43 +0000 (06:47 +0000)
* COMPILE (riece-modules): Add riece-toolbar.
* Makefile.am (EXTRA_DIST): Add riece-toolbar.el.

lisp/COMPILE
lisp/ChangeLog
lisp/Makefile.am
lisp/riece-toolbar.el [new file with mode: 0644]

index d73f66c..b759cbe 100644 (file)
@@ -71,7 +71,8 @@
                riece-hangman
                riece-biff
                riece-kakasi
-               riece-yank))))
+               riece-yank
+               riece-toolbar))))
 
 (defun riece-compile-modules (modules)
   (let ((load-path (cons nil load-path)))
index 542f919..1962ecc 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-11  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-toolbar.el: New add-on.
+       * COMPILE (riece-modules): Add riece-toolbar.
+       * Makefile.am (EXTRA_DIST): Add riece-toolbar.el.
+
 2004-12-10  Daiki Ueno  <ueno@unixuser.org>
 
        * test/test-riece-log.el
index 2e791c9..9da7b61 100644 (file)
@@ -15,7 +15,7 @@ EXTRA_DIST = COMPILE ChangeLog ChangeLog.Liece \
        riece-menu.el riece-icon.el riece-async.el riece-lsdb.el \
        riece-xface.el riece-ctlseq.el riece-ignore.el riece-hangman.el \
        riece-biff.el riece-kakasi.el riece-foolproof.el riece-yank.el \
-       url-riece.el
+       riece-toolbar.el url-riece.el
 
 CLEANFILES = auto-autoloads.el custom-load.el *.elc
 FLAGS ?= -batch -q -no-site-file
diff --git a/lisp/riece-toolbar.el b/lisp/riece-toolbar.el
new file mode 100644 (file)
index 0000000..1bdba0c
--- /dev/null
@@ -0,0 +1,82 @@
+;;; riece-toolbar.el --- show icons on toolbar
+;; Copyright (C) 1998-2004 Daiki Ueno
+
+;; Author: Daiki Ueno <ueno@unixuser.org>
+;; Created: 1998-09-28
+;; Keywords: IRC, riece
+
+;; This file is part of Riece.
+
+;; 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:
+
+;; NOTE: This add-on doesn't support XEmacs yet.
+
+;; To use, add the following line to your ~/.riece/init.el:
+;; (add-to-list 'riece-addons 'riece-toolbar)
+
+;;; Code:
+
+(require 'riece-menu)
+
+(defvar riece-toolbar-item-list
+  '((riece-command-quit "riece-command-quit")
+    (riece-command-join "riece-command-join")
+    (riece-command-part "riece-command-part")
+    (riece-command-next-channel "riece-command-next-channel")
+    (riece-command-previous-channel "riece-command-previous-channel")
+    (riece-command-change-window-layout "riece-command-change-window-layout")))
+
+(if (fboundp 'tool-bar-local-item-from-menu)
+    (defalias 'riece-tool-bar-local-item-from-menu
+      'tool-bar-local-item-from-menu)
+  (if (fboundp 'tool-bar-add-item-from-menu)
+      (defun riece-tool-bar-local-item-from-menu (command icon in-map
+                                                         &optional from-map
+                                                         &rest props)
+       "Define tool bar binding for COMMAND using the given ICON in \
+keymap IN-MAP."
+       (let ((tool-bar-map in-map))
+         (apply #'tool-bar-add-item-from-menu command icon from-map props)))
+    (defalias 'riece-tool-bar-local-item-from-menu 'ignore)))
+
+(defvar riece-command-mode-map)
+(defun riece-toolbar-insinuate-in-command-buffer ()
+  (when (boundp 'tool-bar-map)
+    (make-local-variable 'tool-bar-map)
+    (setq tool-bar-map
+         (let ((map (make-sparse-keymap))
+               (pointer riece-toolbar-item-list))
+           (while pointer
+             (riece-tool-bar-local-item-from-menu (car (car pointer))
+                                                  (nth 1 (car pointer))
+                                                  map riece-command-mode-map)
+             (setq pointer (cdr pointer)))
+           map))))
+
+(defun riece-toolbar-requires ()
+  '(riece-menu))
+
+(defun riece-toolbar-insinuate ()
+  (add-hook 'riece-command-mode-hook
+           (lambda ()
+             (riece-toolbar-insinuate-in-command-buffer))
+           t))
+
+(provide 'riece-toolbar)
+
+;;; riece-toolbar.el ends here
\ No newline at end of file