Mercurial > emacs
annotate lisp/vt-control.el @ 109581:06384b3caebf
Add ability to put Gtk+ tool bar on the left/right/bottom or top. Default top.
* lisp/menu-bar.el (menu-bar-showhide-tool-bar-menu-customize-enable-left)
(menu-bar-showhide-tool-bar-menu-customize-disable)
(menu-bar-showhide-tool-bar-menu-customize-enable-right)
(menu-bar-showhide-tool-bar-menu-customize-enable-top)
(menu-bar-showhide-tool-bar-menu-customize-enable-bottom): New functions
(menu-bar-showhide-tool-bar-menu): If tool bar is moveable,
make a menu for Options => toolbar that can move it.
* src/frame.c (Qtool_bar_position): New variable.
(make_frame): Set tool_bar_position to Qtop.
(frame_parms): Add tool-bar-position.
(x_report_frame_params): Store tool_bar_position.
(x_set_fringe_width): Reset wm size hint after fringe changes.
* src/frame.h (struct frame): Add tool_bar_position.
(Qbottom): Declare.
* src/gtkutil.c (FRAME_TOTAL_PIXEL_WIDTH): New macro.
(xg_frame_set_char_size): Add FRAME_TOOLBAR_WIDTH to pixelwidth.
(xg_height_or_width_changed): Use FRAME_TOTAL_PIXEL_WIDTH.
(xg_create_frame_widgets): Create a hobox for placing widgets
vertically. Use gtk_box_pack_start.
(xg_height_or_width_changed): Renamed from xg_height_changed.
(x_wm_set_size_hint): Add FRAME_TOOLBAR_WIDTH to base_width.
(xg_update_frame_menubar, free_frame_menubar): Change to
xg_height_or_width_changed.
(xg_tool_bar_detach_callback): Update left/right/top/bottom tool bar
size correctly. Remove hardcoded 4, instead use handlebox size -
toolbar size.
(xg_tool_bar_attach_callback): Update left/right/top/bottom tool bar
size correctly. Use handlebox size + toolbar size as additional
size.
(xg_pack_tool_bar): POS is a new parameter.
Set orientation of tool bar based on pos.
Only make handlebox_widget if NULL.
Check if tool bar goes to vbox or hbox depending on pos.
(xg_update_tool_bar_sizes): New function.
(update_frame_tool_bar): Remove old_req, new_req. Do not get tool bar
height, call xg_update_tool_bar_sizes instead.
(free_frame_tool_bar): Remove from hbox or vbox depending on
toolbar_in_hbox, Set all FRAME_TOOLBAR_*_(WIDTH|HEIGHT) to zero.
(xg_change_toolbar_position): New function.
* src/gtkutil.h (xg_change_toolbar_position): Declare.
* src/window.c (calc_absolute_offset): Check for FRAME_TOOLBAR_TOP_HEIGHT
and FRAME_TOOLBAR_LEFT_WIDTH.
* src/xfns.c (x_set_tool_bar_position): New function.
(xic_set_statusarea): Use FRAME_TOOLBAR_TOP_HEIGHT.
(x_frame_parm_handlers): Add x_set_tool_bar_position.
(syms_of_xfns): if USE_GTK, provide move-toolbar.
* src/xterm.c (x_set_window_size_1): Add FRAME_TOOLBAR_WIDTH to pixelwidth.
* src/xterm.h (struct x_output): Add toolbar_top_height,
toolbar_bottom_height, toolbar_left_width, toolbar_right_width. Remove
toolbar_height.
if USE_GTK: Add hbox_widget and toolbar_in_hbox.
(FRAME_TOOLBAR_TOP_HEIGHT, FRAME_TOOLBAR_BOTTOM_HEIGHT)
(FRAME_TOOLBAR_LEFT_WIDTH, FRAME_TOOLBAR_RIGHT_WIDTH): New macros.
(FRAME_TOOLBAR_HEIGHT): Is now TOP_HEIGHT + BOTTOM_HEIGHT.
author | Jan D. <jan.h.d@swipnet.se> |
---|---|
date | Thu, 29 Jul 2010 18:49:59 +0200 |
parents | 1d1d5d9bd884 |
children | 376148b31b5e |
rev | line source |
---|---|
4421 | 1 ;;; vt-control.el --- Common VTxxx control functions |
2 | |
74442 | 3 ;; Copyright (C) 1993, 1994, 2001, 2002, 2003, |
106815 | 4 ;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
4421 | 5 |
6 ;; Author: Rob Riepel <riepel@networking.stanford.edu> | |
7 ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu> | |
5140 | 8 ;; Keywords: terminals |
4421 | 9 |
4450 | 10 ;; This file is part of GNU Emacs. |
11 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
4450 | 13 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
15 ;; (at your option) any later version. |
4421 | 16 |
4450 | 17 ;; GNU Emacs is distributed in the hope that it will be useful, |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
4421 | 24 |
25 ;;; Commentary: | |
26 | |
27 ;; The functions contained in this file send various VT control codes | |
28 ;; to the terminal where emacs is running. The following functions are | |
29 ;; available. | |
30 | |
31 ;; Function Action | |
32 | |
33 ;; vt-wide set wide screen (132 characters) | |
34 ;; vt-narrow set narrow screen (80 characters) | |
35 ;; vt-toggle-screen toggle wide/narrow screen | |
36 ;; vt-keypad-on set applications keypad on | |
37 ;; vt-keypad-off set applications keypad off | |
38 ;; vt-numlock toggle applications keypad on/off | |
39 | |
40 ;;; Usage: | |
41 | |
42 ;; To use enable these functions, simply load this file. | |
43 | |
44 ;; Note: vt-control makes no effort to determine how the terminal is | |
45 ;; initially set. It assumes the terminal starts with a width | |
46 ;; of 80 characters and the applications keypad enabled. Nor | |
47 ;; does vt-control try to restore the terminal when emacs is | |
48 ;; killed or suspended. | |
49 | |
50 ;;; Code: | |
51 | |
52 | |
53 ;;; Global variables | |
54 | |
55 (defvar vt-applications-keypad-p t | |
56 "If non-nil, keypad is in applications mode.") | |
57 | |
58 (defvar vt-wide-p nil | |
59 "If non-nil, the screen is 132 characters wide.") | |
60 | |
61 | |
62 ;;; Screen width functions. | |
63 | |
64 (defun vt-wide nil | |
65 "Set the screen 132 characters wide." | |
66 (interactive) | |
67 (send-string-to-terminal "\e[?3h") | |
42321
dc54396f2b69
(vt-wide, vt-narrow): Use set-frame-width instead of obsolete
Pavel Janík <Pavel@Janik.cz>
parents:
18383
diff
changeset
|
68 (set-frame-width (selected-frame) 132) |
4421 | 69 (setq vt-wide-p t)) |
70 | |
71 (defun vt-narrow nil | |
72 "Set the screen 80 characters wide." | |
73 (interactive) | |
74 (send-string-to-terminal "\e[?3l") | |
42321
dc54396f2b69
(vt-wide, vt-narrow): Use set-frame-width instead of obsolete
Pavel Janík <Pavel@Janik.cz>
parents:
18383
diff
changeset
|
75 (set-frame-width (selected-frame) 80) |
4421 | 76 (setq vt-wide-p nil)) |
77 | |
78 (defun vt-toggle-screen nil | |
79 "Toggle between 80 and 132 character screen width." | |
80 (interactive) | |
81 (if vt-wide-p (vt-narrow) (vt-wide))) | |
82 | |
83 | |
84 ;;; Applications keypad functions. | |
85 | |
86 (defun vt-keypad-on (&optional tell) | |
87 "Turn on the VT applications keypad." | |
88 (interactive) | |
12362
03e8afdeabb3
(vt-keypad-on, vt-keypad-off): Updated codes sent
Richard M. Stallman <rms@gnu.org>
parents:
7979
diff
changeset
|
89 (send-string-to-terminal "\e=") |
4421 | 90 (setq vt-applications-keypad-p t) |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
91 (if (or tell (called-interactively-p 'interactive)) |
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
92 (message "Applications keypad enabled."))) |
4421 | 93 |
94 (defun vt-keypad-off (&optional tell) | |
95 "Turn off the VT applications keypad." | |
96 (interactive "p") | |
12362
03e8afdeabb3
(vt-keypad-on, vt-keypad-off): Updated codes sent
Richard M. Stallman <rms@gnu.org>
parents:
7979
diff
changeset
|
97 (send-string-to-terminal "\e>") |
4421 | 98 (setq vt-applications-keypad-p nil) |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
99 (if (or tell (called-interactively-p 'interactive)) |
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
100 (message "Applications keypad disabled."))) |
4421 | 101 |
102 (defun vt-numlock nil | |
103 "Toggle VT application keypad on and off." | |
104 (interactive) | |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
105 (if vt-applications-keypad-p |
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
106 (vt-keypad-off (called-interactively-p 'interactive)) |
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
107 (vt-keypad-on (called-interactively-p 'interactive)))) |
4421 | 108 |
18383 | 109 (provide 'vt-control) |
110 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
79721
diff
changeset
|
111 ;; arch-tag: d4fed1bf-2524-4ba1-a4fe-86bca3d928a2 |
4421 | 112 ;;; vt-control.el ends here |