git-svn make executable
[texmacs.git] / src / TeXmacs / progs / texmacs / menus / main-menu.scm
blob361f9733e5f0acd6a7eef3b8247d8c7617d01f57
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 ;;
4 ;; MODULE      : main-menu.scm
5 ;; DESCRIPTION : the default main menu of TeXmacs
6 ;; COPYRIGHT   : (C) 1999  Joris van der Hoeven
7 ;;
8 ;; This software falls under the GNU general public license version 3 or later.
9 ;; It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
10 ;; in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
12 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14 (texmacs-module (texmacs menus main-menu)
15   (:use (utils library cursor)))
17 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18 ;; Main dynamic, extensible or user defined submenus
19 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21 (menu-bind texmacs-extra-menu)
22 (menu-bind texmacs-extra-icons)
23 (tm-define (buffer-menu) (get-buffer-menu))
24 (tm-define (project-buffer-menu) (get-project-buffer-menu))
25 (tm-define (style-menu) (get-style-menu))
26 (tm-define (add-package-menu) (get-add-package-menu))
27 (tm-define (remove-package-menu) (get-remove-package-menu))
28 (menu-bind bookmarks-menu)
29 (menu-bind test-menu)
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
32 ;; The TeXmacs main menu
33 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
35 (menu-bind texmacs-menu
36   (=> "File" (link file-menu))
37   (=> "Edit" (link edit-menu))
38   (if (not (in-graphics?)) (=> "Insert" (link insert-menu)))
39   (if (in-source?) (=> "Source" (link source-menu)))
40   (if (in-text?) (=> "Text" (link text-menu)))
41   (if (in-math?) (=> "Mathematics" (link math-menu)))
42   (if (in-session?) (=> "Session" (link session-menu)))
43   (if (in-graphics?) (=> "Graphics" (link graphics-menu)))
44   (if (in-table?) (link vertical-table-cell-menu))
45   (if (with-linking-tool?)
46       (=> "Link" (link link-menu)))
47   (link texmacs-extra-menu)
48   (if (not (in-graphics?)) (=> "Format" (link format-menu)))
49   (=> "Document" (link document-menu))
50   (if (and (not (project-attached?))
51            (== (get-init-tree "sectional-short-style") (tree 'macro "false")))
52       (=> "Part" (link document-part-menu)))
53   (if (project-attached?) (=> "Project" (link project-menu)))
54   (if (with-versioning-tool?)
55       (=> "Version" (link version-menu)))
56   (=> "View" (link view-menu))
57   (=> "Go" (link go-menu))
58   (if (detailed-menus?) (=> "Tools" (link tools-menu)))
59   (if (with-remote-connections?)
60       (=> "Remote" (link remote-menu)))
61   (if (with-debugging-tool?)
62       (=> "Debug" (link debug-menu)))
63   (if (nnull? (test-menu))
64       (=> "Test" (link test-menu)))
65   (=> "Help" (link help-menu)))
68 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
69 ;; The TeXmacs popup menu
70 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
72 (menu-bind texmacs-popup-menu
73   (-> "File" (link file-menu))
74   (-> "Edit" (link edit-menu))
75   (if (not (in-graphics?)) (-> "Insert" (link insert-menu)))
76   (if (in-source?) (-> "Source" (link source-menu)))
77   (if (in-text?) (-> "Text" (link text-menu)))
78   (if (in-math?) (-> "Mathematics" (link math-menu)))
79   (if (in-graphics?) (-> "Graphics" (link graphics-menu)))
80   (if (in-session?) (-> "Session" (link session-menu)))
81   (if (in-table?) (link horizontal-table-cell-menu))
82   (if (with-linking-tool?) (-> "Link" (link link-menu)))
83   (if (not (in-graphics?)) (-> "Format" (link format-menu)))
84   (-> "Document" (link document-menu))
85   (if (== (get-init-tree "sectional-short-style") (tree 'macro "false"))
86       (-> "Part" (link document-part-menu)))
87   (if (project-attached?) (=> "Project" (link project-menu)))
88   (if (with-versioning-tool?) (-> "Version" (link version-menu)))
89   (-> "View" (link view-menu))
90   (-> "Go" (link go-menu))
91   (if (detailed-menus?) (-> "Tools" (link tools-menu)))
92   (if (with-remote-connections?) (-> "Remote" (link remote-menu)))
93   (if (with-debugging-tool?) (=> "Debug" (link debug-menu)))
94   (if (nnull? (test-menu)) (=> "Test" (link test-menu)))
95   ---
96   (-> "Help" (link help-menu)))
98 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
99 ;; The main icon bar
100 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
102 (menu-bind texmacs-main-icons
103   (=> (balloon (icon "tm_new.xpm") "Create a new document")
104       (link new-file-menu))
105   (=> (balloon (icon "tm_open.xpm") "Load a file") (link load-menu))
106   (=> (balloon (icon "tm_save.xpm") "Save this buffer") (link save-menu))
107   (=> (balloon (icon "tm_print.xpm") "Print") (link print-menu))
108   (if (detailed-menus?)
109       (=> (balloon (icon "tm_style.xpm") "Select a document style")
110           (link document-style-menu))
111       (=> (balloon (icon "tm_language.xpm") "Select a language")
112           (link global-language-menu)))
113   (=> (balloon (icon "tm_cancel.xpm") "Close") (link close-menu))
114   |
115   ((balloon (icon "tm_cut.xpm") "Cut text#(C-w)")
116    (clipboard-cut "primary"))
117   ((balloon (icon "tm_copy.xpm") "Copy text#(M-w)")
118    (clipboard-copy "primary"))
119   ((balloon (icon "tm_paste.xpm") "Paste text#(C-y)")
120    (clipboard-paste "primary"))
121   (if (not (in-search-mode?))
122       ((balloon (icon "tm_find.xpm") "Find text#(C-s)") (search-start #t)))
123   (if (in-search-mode?)
124       ((balloon (icon "tm_find_next.xpm") "Find next match#(C-s)")
125        (search-button-next)))
126   ((balloon (icon "tm_replace.xpm") "Query replace#(C-=)")
127    (interactive replace-start-forward))
128   ((balloon (icon "tm_spell.xpm") "Check text for spelling errors#(M-$)")
129    (spell-start))
130   ((balloon (icon "tm_undo.xpm") "Undo last changes#(M-[)") (undo 0))
131   ((balloon (icon "tm_redo.xpm") "Redo undone changes#(M-])") (redo 0))
132   (if (not (in-graphics?))
133       |
134       (=> (balloon (icon "tm_table.xpm") "Insert a table")
135           (link insert-table-menu))
136       (=> (balloon (icon "tm_image.xpm") "Insert a picture")
137           (link insert-image-menu))
138       (=> (balloon (icon "tm_link.xpm") "Insert a link")
139           (link insert-link-menu))
140       (if (detailed-menus?)
141           (if (style-has? "std-fold-dtd")
142               (=> (balloon (icon "tm_switch.xpm") "Switching and folding")
143                   (link insert-fold-menu)))
144           (=> (balloon (icon "tm_animate.xpm") "Animation")
145               (link insert-animation-menu)))
146       (=> (balloon (icon "tm_math.xpm") "Insert mathematics")
147           (link insert-math-menu))
148       (if (and (style-has? "program-dtd") (detailed-menus?))
149           (=> (balloon (icon "tm_shell.xpm")
150                        "Start an interactive session")
151               (link insert-session-menu))))
152   |
153   ((balloon (icon "tm_back.xpm") "Browse back (C-<)")
154    (cursor-history-backward))
155   ((balloon (icon "tm_reload.xpm") "Reload (C-F2)")
156    (revert-buffer))
157   ((balloon (icon "tm_forward.xpm") "Browse forward (C->)")
158    (cursor-history-forward)))
160 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
161 ;; The context dependent icon bar
162 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
164 (menu-bind texmacs-context-icons
165   (if (in-source?) (link source-icons))
166   (if (in-text?) (link text-icons))
167   (if (in-session?) (link session-icons))
168   (if (in-math?) (link math-icons))
169   (if (in-graphics?) (link graphics-icons))
170   (if (not (in-graphics?)) |)
171   (if (or (in-source?) (in-text?)) (link text-format-icons))
172   (if (in-math?) (link math-format-icons))
173   (if (in-prog?) (link prog-format-icons))
174   (if (in-table?) (link table-icons))
175   (link help-icons))