;; 09-toolbar.el --- Toolbar set up

;; Copyright (C) 2007 - 2020 Steve Youngs

;;     Author: Steve Youngs <steve@sxemacs.org>
;; Maintainer: Steve Youngs <steve@sxemacs.org>
;;    Created: <2007-12-02>
;; Time-stamp: <Thursday Apr  9, 2020 07:43:09 steve>
;;   Download: <https://downloads.sxemacs.org/SYinits>
;;   HTMLised: <https://www.sxemacs.org/SYinits/09-toolbar.html>
;;   Git Repo: git clone https://git.sxemacs.org/syinit
;;   Keywords: init, compile

;; This file is part of SYinit

;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions
;; are met:
;;
;; 1. Redistributions of source code must retain the above copyright
;;    notice, this list of conditions and the following disclaimer.
;;
;; 2. Redistributions in binary form must reproduce the above copyright
;;    notice, this list of conditions and the following disclaimer in the
;;    documentation and/or other materials provided with the distribution.
;;
;; 3. Neither the name of the author nor the names of any contributors
;;    may be used to endorse or promote products derived from this
;;    software without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

;;; Commentary:
;;
;;   Sets up the toolbar the way I like it.

;;; Credits:
;;
;;   The HTML version of this file was created with Hrvoje Niksic's
;;   htmlize.el which is part of the XEmacs "text-modes" package.
;;

;;; Todo:
;;
;;     

;;; Code:
;; Re-organise the default toolbar.
(when (featurep 'toolbar)
  (setq
   toolbar-info-use-separate-frame t
   toolbar-mail-reader 'gnus
   toolbar-news-use-separate-frame t)
  (customize-set-variable 'toolbar-captioned-p nil))

(setq edit-toolbar-added-buttons-alist 'nil)

(mapcar
 (lambda (cons)
   (setf (symbol-value (car cons)) (toolbar-make-button-list (cdr cons))))
 edit-toolbar-added-buttons-alist)

(defun toolbar-redo ()
  (interactive)
  (call-interactively #'redo))

(defvar toolbar-redo-icon
  (toolbar-make-button-list
   (locate-data-file "redo.png")))

(defun toolbar-irc ()
  (interactive)
  (call-interactively #'sy-riece))

(defvar toolbar-irc-icon
  (toolbar-make-button-list
   (locate-data-file "irc@32x32.png")))

(defun toolbar-emoney ()
  (interactive)
  (call-interactively #'emoney))

(defvar toolbar-emoney-icon
  (toolbar-make-button-list
   (locate-data-file "emoney.png")))

(and (device-on-window-system-p)
     (set-specifier
      default-toolbar 
      '([toolbar-file-icon toolbar-open t "Open a file"] 
        [toolbar-folder-icon toolbar-dired t "Edit a directory"] 
        [toolbar-disk-icon toolbar-save t "Save buffer"] 
        [toolbar-printer-icon toolbar-print t "Print buffer"] 
        [toolbar-cut-icon toolbar-cut t "Kill region"] 
        [toolbar-copy-icon toolbar-copy t "Copy region"] 
        [toolbar-paste-icon toolbar-paste t "Paste from clipboard"] 
        [toolbar-undo-icon toolbar-undo t "Undo"]
        [toolbar-redo-icon toolbar-redo t "Redo"]
        [toolbar-spell-icon toolbar-ispell t "Check spelling"] 
        [toolbar-replace-icon toolbar-replace t "Search & Replace"] 
        [toolbar-compile-icon toolbar-compile t "Start a compilation"] 
        [toolbar-debug-icon toolbar-debug t "Start a debugger"]
        [toolbar-emoney-icon toolbar-emoney t "Manage your millions with eMoney"]
        [toolbar-irc-icon toolbar-irc t "Be productive with Riece"]
        [toolbar-news-icon gnus-other-frame t "Gnus"]
        nil 
        [toolbar-info-icon toolbar-info t "Don't Panic!!"])))
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
(message "Toolbar set successfully")
Created with SXEmacs Valid XHTML 1.0 Transitional!
Copyright © 2020 Steve Youngs
Verbatim copying and distribution is permitted in any medium, providing this notice is preserved.
Last modified: Wed Apr 15 18:13:40 AEST 2020