aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJan Djärv2010-04-20 20:52:07 +0200
committerJan Djärv2010-04-20 20:52:07 +0200
commitf904c0f93825fb434f802ced019c378a20ec491d (patch)
tree8c3423c4680c054cd4ede1c2d01438d64f328a67 /lisp
parentc632dfda11b0ad6a144704dc473e4ff6bbac0990 (diff)
downloademacs-f904c0f93825fb434f802ced019c378a20ec491d.tar.gz
emacs-f904c0f93825fb434f802ced019c378a20ec491d.zip
Gtk tool bars can be text, icons with text or just icons.
* xsettings.c: Qmonospace_font_name, Qtool_bar_style and current_tool_bar_style are new. (store_config_changed_event): Rename from store_font_changed_event. (XSETTINGS_TOOL_BAR_STYLE): New define. (SEEN_FONT, SEEN_TB_STYLE): New enum values. (struct xsettings): Add font and tb_style, set xft stuff inside #ifdef HAVE_XFT. (something_changedCB): store_font_changed_event is now store_config_changed_event (parse_settings): Rename from parse_xft_settings. Read non-xft xsettings outside #ifdef HAVE_XFT. (read_settings): Renamed from read_xft_settings. (apply_xft_settings): Take current settings as parameter. Do not call read_(xft)_settings. (read_and_apply_settings): New function. (xft_settings_event): Do non-xft stuff out of HAVE_XFT. Call read_and_apply_settings if there are settings to be read. (init_xsettings): Renamed from init_xfd_settings. Call read_and_apply_settings unconditionally. (xsettings_initialize): Call init_xsettings. (Ftool_bar_get_system_style): New function. (syms_of_xsettings): Define Qmonospace_font_name and Qtool_bar_style. Initialize current_tool_bar_style to nil. defsubr Stool_bar_get_system_style. Fprovide on dynamic-setting. * xsettings.h (Ftool_bar_get_system_style): Declare. * xdisp.c: Vtool_bar_style, tool_bar_max_label_size, Qtext, Qboth, Qboth_horiz are new. (syms_of_xdisp): Intern Qtext, Qboth, Qboth_horiz, DEFVAR Vtool_bar_style, tool_bar_max_label_size. * lisp.h: Extern declare Qtext, Qboth, Qboth_horiz. * keyboard.c: QClabel is new. (parse_tool_bar_item): Take out QClabel from tool bar items. Try to construct a label if ther is no QClabel. (syms_of_keyboard): Intern :label as QClabel. * dispextern.h (tool_bar_item_idx): TOOL_BAR_ITEM_LABEL is new. (Vtool_bar_style, tool_bar_max_label_size, DEFAULT_TOOL_BAR_LABEL_SIZE): New. * Makefile.in (SOME_MACHINE_LISP): font-setting.el renamed to dynamic-setting.el. * gtkutil.c (xg_tool_bar_menu_proxy): Handle label in tool bar item. (xg_make_tool_item, xg_show_toolbar_item): New function. (update_frame_tool_bar): Take label from TOOL_BAR_ITEM_LABEL. Call xg_make_tool_item to make a tool bar item. Call xg_show_toolbar_item. Use wtoolbar instead of x->toolbar_widget. * xterm.c (x_draw_image_relief): Take Vtool_bar_button_margin into account for toolbars. * vc-dir.el (vc-dir-tool-bar-map): Add :label on some tool bar items. * tool-bar.el (tool-bar-setup): Add :label on some tool bar items. * loadup.el: Load dynamic-setting.el if feature dynamic-setting is present. * info.el (info-tool-bar-map): Add labels. * cus-start.el (all): Add tool-bar-style and tool-bar-max-label-size. * cus-edit.el (custom-commands): Add labels for tool bar. (custom-buffer-create-internal, Custom-mode): Adjust for labels in custom-commands. * dynamic-setting.el: Renamed from font-setting.el.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog19
-rw-r--r--lisp/cus-edit.el25
-rw-r--r--lisp/cus-start.el9
-rw-r--r--lisp/dynamic-setting.el (renamed from lisp/font-setting.el)32
-rw-r--r--lisp/info.el9
-rw-r--r--lisp/loadup.el4
-rw-r--r--lisp/tool-bar.el7
-rw-r--r--lisp/vc-dir.el12
8 files changed, 82 insertions, 35 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1162638f8a9..5ac61d146cd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,22 @@
12010-04-21 Jan Djärv <jan.h.d@swipnet.se>
2
3 * vc-dir.el (vc-dir-tool-bar-map): Add :label on some tool bar items.
4
5 * tool-bar.el (tool-bar-setup): Add :label on some tool bar items.
6
7 * loadup.el: Load dynamic-setting.el if feature dynamic-setting
8 is present.
9
10 * info.el (info-tool-bar-map): Add labels.
11
12 * cus-start.el (all): Add tool-bar-style and tool-bar-max-label-size.
13
14 * cus-edit.el (custom-commands): Add labels for tool bar.
15 (custom-buffer-create-internal, Custom-mode): Adjust for
16 labels in custom-commands.
17
18 * dynamic-setting.el: Renamed from font-setting.el.
19
12010-04-21 John Wiegley <jwiegley@gmail.com> 202010-04-21 John Wiegley <jwiegley@gmail.com>
2 21
3 * ido.el (ido-init-completion-maps): For ido-switch-buffer, C-o 22 * ido.el (ido-init-completion-maps): For ido-switch-buffer, C-o
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index cb6e746f3b2..bb2f67422e3 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -739,25 +739,31 @@ groups after non-groups, if nil do not order groups at all."
739(defvar custom-commands 739(defvar custom-commands
740 '(("Set for current session" Custom-set t 740 '(("Set for current session" Custom-set t
741 "Apply all settings in this buffer to the current session" 741 "Apply all settings in this buffer to the current session"
742 "index") 742 "index"
743 "Apply")
743 ("Save for future sessions" Custom-save 744 ("Save for future sessions" Custom-save
744 (or custom-file user-init-file) 745 (or custom-file user-init-file)
745 "Apply all settings in this buffer and save them for future Emacs sessions." 746 "Apply all settings in this buffer and save them for future Emacs sessions."
746 "save") 747 "save"
748 "Save")
747 ("Undo edits" Custom-reset-current t 749 ("Undo edits" Custom-reset-current t
748 "Restore all settings in this buffer to reflect their current values." 750 "Restore all settings in this buffer to reflect their current values."
749 "refresh") 751 "refresh"
752 "Undo")
750 ("Reset to saved" Custom-reset-saved t 753 ("Reset to saved" Custom-reset-saved t
751 "Restore all settings in this buffer to their saved values (if any)." 754 "Restore all settings in this buffer to their saved values (if any)."
752 "undo") 755 "undo"
756 "Reset")
753 ("Erase customizations" Custom-reset-standard 757 ("Erase customizations" Custom-reset-standard
754 (or custom-file user-init-file) 758 (or custom-file user-init-file)
755 "Un-customize all settings in this buffer and save them with standard values." 759 "Un-customize all settings in this buffer and save them with standard values."
756 "delete") 760 "delete"
761 "Uncustomize")
757 ("Help for Customize" Custom-help t 762 ("Help for Customize" Custom-help t
758 "Get help for using Customize." 763 "Get help for using Customize."
759 "help") 764 "help"
760 ("Exit" Custom-buffer-done t "Exit Customize." "exit"))) 765 "Help")
766 ("Exit" Custom-buffer-done t "Exit Customize." "exit" "Exit")))
761 767
762(defun Custom-help () 768(defun Custom-help ()
763 "Read the node on Easy Customization in the Emacs manual." 769 "Read the node on Easy Customization in the Emacs manual."
@@ -1616,7 +1622,7 @@ Otherwise use brackets."
1616 (if custom-buffer-verbose-help 1622 (if custom-buffer-verbose-help
1617 (widget-insert " 1623 (widget-insert "
1618 Operate on all settings in this buffer:\n")) 1624 Operate on all settings in this buffer:\n"))
1619 (let ((button (lambda (tag action active help icon) 1625 (let ((button (lambda (tag action active help icon label)
1620 (widget-insert " ") 1626 (widget-insert " ")
1621 (if (eval active) 1627 (if (eval active)
1622 (widget-create 'push-button :tag tag 1628 (widget-create 'push-button :tag tag
@@ -4680,7 +4686,8 @@ if that value is non-nil."
4680 (mapc 4686 (mapc
4681 (lambda (arg) 4687 (lambda (arg)
4682 (tool-bar-local-item-from-menu 4688 (tool-bar-local-item-from-menu
4683 (nth 1 arg) (nth 4 arg) map custom-mode-map)) 4689 (nth 1 arg) (nth 4 arg) map custom-mode-map
4690 :label (nth 5 arg)))
4684 custom-commands) 4691 custom-commands)
4685 (setq custom-tool-bar-map map)))) 4692 (setq custom-tool-bar-map map))))
4686 (make-local-variable 'custom-options) 4693 (make-local-variable 'custom-options)
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 30678a09bb8..07f7702e9d6 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -339,6 +339,15 @@ since it could result in memory overflow and make Emacs crash."
339 (const :tag "Off (nil)" :value nil) 339 (const :tag "Off (nil)" :value nil)
340 (const :tag "Immediate" :value t) 340 (const :tag "Immediate" :value t)
341 (number :tag "Delay by secs" :value 0.5)) "22.1") 341 (number :tag "Delay by secs" :value 0.5)) "22.1")
342 (tool-bar-style
343 frames (choice
344 (const :tag "Images" :value image)
345 (const :tag "Text" :value text)
346 (const :tag "Both" :value both)
347 (const :tag "Both-horiz" :value both-horiz)
348 (const :tag "System default" :value nil)) "23.3")
349 (tool-bar-max-label-size frames integer "23.3")
350
342 ;; xfaces.c 351 ;; xfaces.c
343 (scalable-fonts-allowed display boolean "22.1") 352 (scalable-fonts-allowed display boolean "22.1")
344 ;; xfns.c 353 ;; xfns.c
diff --git a/lisp/font-setting.el b/lisp/dynamic-setting.el
index 3a6f1dc0e31..37a95999562 100644
--- a/lisp/font-setting.el
+++ b/lisp/dynamic-setting.el
@@ -1,10 +1,10 @@
1;;; font-setting.el --- Support dynamic font changes 1;;; dynamic-setting.el --- Support dynamic changes
2 2
3;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. 3;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
4 4
5;; Author: Jan Djärv <jan.h.d@swipnet.se> 5;; Author: Jan Djärv <jan.h.d@swipnet.se>
6;; Maintainer: FSF 6;; Maintainer: FSF
7;; Keywords: font, system-font 7;; Keywords: font, system-font, tool-bar-style
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
10 10
@@ -81,21 +81,25 @@ current form for the frame (i.e. hinting or somesuch changed)."
81 (custom-push-theme 'theme-face 'default 'user 'set spec) 81 (custom-push-theme 'theme-face 'default 'user 'set spec)
82 (put 'default 'face-modified nil)))))) 82 (put 'default 'face-modified nil))))))
83 83
84(defun font-setting-handle-config-changed-event (event) 84(defun dynamic-setting-handle-config-changed-event (event)
85 "Handle config-changed-event to change fonts on the display in EVENT. 85 "Handle config-changed-event on the display in EVENT.
86If `font-use-system-font' is nil, the font is not changed." 86Changes can be
87 The monospace font. If `font-use-system-font' is nil, the font
88 is not changed.
89 Xft parameters, like DPI and hinting.
90 The tool bar style."
87 (interactive "e") 91 (interactive "e")
88 (let ((type (nth 1 event)) ;; font-name or font-render 92 (let ((type (nth 1 event))
89 (display-name (nth 2 event))) 93 (display-name (nth 2 event)))
90 (if (or (not (eq type 'font-name)) 94 (cond ((and (eq type 'monospace-font-name) font-use-system-font)
91 font-use-system-font) 95 (font-setting-change-default-font display-name t))
92 (font-setting-change-default-font display-name
93 (eq type 'font-name)))))
94 96
95(if (or (featurep 'system-font-setting) (featurep 'font-render-setting)) 97 ((eq type 'font-render)
96 (define-key special-event-map [config-changed-event] 98 (font-setting-change-default-font display-name nil))
97 'font-setting-handle-config-changed-event))
98 99
99(provide 'font-setting) 100 ((eq type 'tool-bar-style) (force-mode-line-update t)))))
101
102(define-key special-event-map [config-changed-event]
103 'dynamic-setting-handle-config-changed-event)
100 104
101;; arch-tag: 3a57e78f-1cd6-48b6-ab75-98f160dcc017 105;; arch-tag: 3a57e78f-1cd6-48b6-ab75-98f160dcc017
diff --git a/lisp/info.el b/lisp/info.el
index aea283403ec..b8eb1339d17 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -3736,9 +3736,11 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
3736(defvar info-tool-bar-map 3736(defvar info-tool-bar-map
3737 (let ((map (make-sparse-keymap))) 3737 (let ((map (make-sparse-keymap)))
3738 (tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map 3738 (tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map
3739 :rtl "right-arrow") 3739 :rtl "right-arrow"
3740 :label "Back")
3740 (tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map 3741 (tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map
3741 :rtl "left-arrow") 3742 :rtl "left-arrow"
3743 :label "Forward")
3742 (tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map 3744 (tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map
3743 :rtl "next-node") 3745 :rtl "next-node")
3744 (tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map 3746 (tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map
@@ -3746,7 +3748,8 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
3746 (tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map) 3748 (tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map)
3747 (tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map) 3749 (tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map)
3748 (tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map) 3750 (tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map)
3749 (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map) 3751 (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map
3752 :label "Index Search")
3750 (tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map) 3753 (tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map)
3751 (tool-bar-local-item-from-menu 'Info-exit "exit" map Info-mode-map) 3754 (tool-bar-local-item-from-menu 'Info-exit "exit" map Info-mode-map)
3752 map)) 3755 map))
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 95af8cdb47e..36bf8dea082 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -203,8 +203,8 @@
203 (load "dnd") 203 (load "dnd")
204 (load "tool-bar"))) 204 (load "tool-bar")))
205 205
206(if (or (featurep 'system-font-setting) (featurep 'font-render-setting)) 206(if (featurep 'dynamic-setting)
207 (load "font-setting")) 207 (load "dynamic-setting"))
208 208
209(if (featurep 'x) 209(if (featurep 'x)
210 (progn 210 (progn
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index 875eb240433..18a75437f97 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -267,7 +267,7 @@ holds a keymap."
267 ;; People say it's bad to have EXIT on the tool bar, since users 267 ;; People say it's bad to have EXIT on the tool bar, since users
268 ;; might inadvertently click that button. 268 ;; might inadvertently click that button.
269 ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit") 269 ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
270 (tool-bar-add-item-from-menu 'find-file "new") 270 (tool-bar-add-item-from-menu 'find-file "new" nil :label "New File")
271 (tool-bar-add-item-from-menu 'menu-find-file-existing "open") 271 (tool-bar-add-item-from-menu 'menu-find-file-existing "open")
272 (tool-bar-add-item-from-menu 'dired "diropen") 272 (tool-bar-add-item-from-menu 'dired "diropen")
273 (tool-bar-add-item-from-menu 'kill-this-buffer "close") 273 (tool-bar-add-item-from-menu 'kill-this-buffer "close")
@@ -294,14 +294,15 @@ holds a keymap."
294 "paste" nil 294 "paste" nil
295 :visible '(not (eq 'special (get major-mode 295 :visible '(not (eq 'special (get major-mode
296 'mode-class)))) 296 'mode-class))))
297 (tool-bar-add-item-from-menu 'nonincremental-search-forward "search") 297 (tool-bar-add-item-from-menu 'nonincremental-search-forward "search"
298 nil :label "Search")
298 ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell") 299 ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell")
299 300
300 ;; There's no icon appropriate for News and we need a command rather 301 ;; There's no icon appropriate for News and we need a command rather
301 ;; than a lambda for Read Mail. 302 ;; than a lambda for Read Mail.
302 ;;(tool-bar-add-item-from-menu 'compose-mail "mail/compose") 303 ;;(tool-bar-add-item-from-menu 'compose-mail "mail/compose")
303 304
304 (tool-bar-add-item-from-menu 'print-buffer "print") 305 (tool-bar-add-item-from-menu 'print-buffer "print" nil :label "Print")
305 306
306 ;; tool-bar-add-item-from-menu itself operates on 307 ;; tool-bar-add-item-from-menu itself operates on
307 ;; (default-value 'tool-bar-map), but when we don't use that function, 308 ;; (default-value 'tool-bar-map), but when we don't use that function,
diff --git a/lisp/vc-dir.el b/lisp/vc-dir.el
index 4b95321d366..f24e627de64 100644
--- a/lisp/vc-dir.el
+++ b/lisp/vc-dir.el
@@ -301,7 +301,8 @@ If BODY uses EVENT, it should be a variable,
301 map vc-dir-mode-map) 301 map vc-dir-mode-map)
302 (tool-bar-local-item "bookmark_add" 302 (tool-bar-local-item "bookmark_add"
303 'vc-dir-toggle-mark 'vc-dir-toggle-mark map 303 'vc-dir-toggle-mark 'vc-dir-toggle-mark map
304 :help "Toggle mark on current item") 304 :help "Toggle mark on current item"
305 :label "Toggle Mark")
305 (tool-bar-local-item-from-menu 'vc-dir-previous-line "left-arrow" 306 (tool-bar-local-item-from-menu 'vc-dir-previous-line "left-arrow"
306 map vc-dir-mode-map 307 map vc-dir-mode-map
307 :rtl "right-arrow") 308 :rtl "right-arrow")
@@ -313,11 +314,14 @@ If BODY uses EVENT, it should be a variable,
313 (tool-bar-local-item-from-menu 'revert-buffer "refresh" 314 (tool-bar-local-item-from-menu 'revert-buffer "refresh"
314 map vc-dir-mode-map) 315 map vc-dir-mode-map)
315 (tool-bar-local-item-from-menu 'nonincremental-search-forward 316 (tool-bar-local-item-from-menu 'nonincremental-search-forward
316 "search" map) 317 "search" map nil
318 :label "Search")
317 (tool-bar-local-item-from-menu 'vc-dir-query-replace-regexp 319 (tool-bar-local-item-from-menu 'vc-dir-query-replace-regexp
318 "search-replace" map vc-dir-mode-map) 320 "search-replace" map vc-dir-mode-map
321 :label "Replace")
319 (tool-bar-local-item-from-menu 'vc-dir-kill-dir-status-process "cancel" 322 (tool-bar-local-item-from-menu 'vc-dir-kill-dir-status-process "cancel"
320 map vc-dir-mode-map) 323 map vc-dir-mode-map
324 :label "Cancel")
321 (tool-bar-local-item-from-menu 'quit-window "exit" 325 (tool-bar-local-item-from-menu 'quit-window "exit"
322 map vc-dir-mode-map) 326 map vc-dir-mode-map)
323 map)) 327 map))