1
2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3;;
4;; MODULE      : insert-menu.scm
5;; DESCRIPTION : menus for inserting new structure
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>.
11;;
12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13
14(texmacs-module (generic insert-menu)
15  (:use (generic generic-edit)
16	(generic format-edit)
17	(generic format-geometry-edit)))
18
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
20;; Insert links
21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22
23(menu-bind insert-link-menu
24  ("Label" (make-label))
25  ("Reference" (make 'reference))
26  ("Page reference" (make 'pageref))
27  ---
28  (if (detailed-menus?)
29      ("Include" (choose-file make-include "Include file" "")))
30  ("Hyperlink" (make 'hlink))
31  (if (detailed-menus?)
32      ("Action" (make 'action)))
33  (if (simple-menus?)
34      ("Footnote" (make 'footnote)))
35  (if (and (style-has? "std-dtd") (in-text?))
36      ---
37      (-> "Citation"
38	  (if (not (style-has? "cite-author-year-dtd"))
39	      ("Visible" (make 'cite))
40	      ("Invisible" (make 'nocite))
41	      ("Detailed" (make 'cite-detail)))
42	  (if (style-has? "cite-author-year-dtd")
43	      (group "Abbreviated authors")
44	      ("Raw" (make 'cite-raw))
45	      ("Textual" (make 'cite-textual))
46	      ("Parenthesized" (make 'cite-parenthesized))
47	      ---
48	      (group "Full author list")
49	      ("Raw" (make 'cite-raw*))
50	      ("Textual" (make 'cite-textual*))
51	      ("Parenthesized" (make 'cite-parenthesized*))
52	      ---
53	      (group "Decomposed")
54	      ("Parenthesis" (make 'render-cite))
55	      ("Abreviated authors" (make 'cite-author-link))
56	      ("Full author list" (make 'cite-author*-link))
57	      ("Year" (make 'cite-year-link))
58	      ("Invisible" (make 'nocite))))
59      (-> "Index entry"
60	  ("Main" (make 'index))
61	  ("Sub" (make 'subindex))
62	  ("Subsub" (make 'subsubindex))
63	  ("Complex" (make 'index-complex))
64	  ---
65	  ("Interjection" (make 'index-line)))
66      (-> "Glossary entry"
67	  ("Regular" (make 'glossary))
68	  ("Explained" (make 'glossary-explain))
69	  ("Duplicate" (make 'glossary-dup))
70	  ---
71	  ("Interjection" (make 'glossary-line)))
72      (-> "Alternate"
73          ("Bibliography"
74           (make-alternate "Name of bibliography" "bib" 'with-bib))
75          ("Table of contents"
76           (make-alternate "Name of table of contents" "toc" 'with-toc))
77          ("Index"
78           (make-alternate "Name of index" "idx" 'with-index))
79          ("Glossary"
80           (make-alternate "Name of glossary" "gly" 'with-glossary))
81          ("List of figures"
82           (make-alternate "Name of list of figures" "figure" 'with-figure-list))
83          ("List of tables"
84           (make-alternate "Name of list of tables" "table" 'with-table-list))))
85  (if (and (style-has? "calc-dtd") (calc-ready?))
86      ---
87      (link calc-insert-menu)))
88
89;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
90;; Insert images
91;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
92
93(menu-bind insert-image-menu
94  (if (and (style-has? "env-float-dtd") (in-text?))
95      ("Small figure" (make 'small-figure))
96      ("Big figure" (make 'big-figure))
97      ---)
98  ("Draw image" (make-graphics))
99  (when (selection-active-small?)
100    ("Draw over selection" (make-graphics-over-selection)))
101  (if (in-math?)
102      ("Commutative diagram" (make-cd)))
103  ("Link image" (choose-file make-link-image "Load image" "image"))
104  ("Insert image" (choose-file make-inline-image "Load image" "image"))
105  (if (detailed-menus?)
106      ("Thumbnails" (make-thumbnails)))
107  (if (or (lazy-plugin-force)
108	  (and (style-has? "scripts-dtd") (scripts-defined? "gnuplot")))
109      ---
110      (-> "Plot" (link scripts-plot-menu))))
111
112;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
113;; Insert animations
114;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
115
116(menu-bind insert-animation-menu
117  ("Fixed" (interactive make-anim-constant))
118  ("Compose" (make 'anim-compose))
119  ("Repeat" (make 'anim-repeat))
120  ---
121  (-> "Translate"
122      ("Rightwards" (interactive make-anim-translate-right))
123      ("Leftwards" (interactive make-anim-translate-left))
124      ("Upwards" (interactive make-anim-translate-up))
125      ("Downwards" (interactive make-anim-translate-down)))
126  (-> "Progressive"
127      ("Rightwards" (interactive make-anim-progressive-right))
128      ("Leftwards" (interactive make-anim-progressive-left))
129      ("Upwards" (interactive make-anim-progressive-up))
130      ("Downwards" (interactive make-anim-progressive-down))
131      ("From center" (interactive make-anim-progressive-center)))
132  ---
133  ("Animation" (choose-file make-animation "Load file" "animation"))
134  ("Sound" (choose-file make-sound "Load file" "sound")))
135
136;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
137;; The main Insert menu
138;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
139
140(menu-bind texmacs-insert-menu
141  (if (not (in-text?))
142      ("Text" (make 'text)))
143  (if (not (in-math?))
144      (-> "Mathematics" (link insert-math-menu)))
145  (-> "Table" (link insert-table-menu))
146  (-> "Image" (link insert-image-menu))
147  (-> "Link" (link insert-link-menu))
148  (if (detailed-menus?)
149      (if (style-has? "std-fold-dtd")
150          (-> "Fold" (link insert-fold-menu)))
151      (-> "Animation" (link insert-animation-menu)))
152  (if (and (style-has? "session-dtd") (detailed-menus?) (not (in-math?)))
153      (-> "Session" (link insert-session-menu))))
154
155(menu-bind insert-menu
156  (if (in-text?) (link text-menu))
157  (if (in-math?) (link math-menu))
158  (if (not (or (in-text?) (in-math?))) (link texmacs-insert-menu)))
159
160;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
161;; The main Insert icons
162;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
163
164(menu-bind texmacs-insert-icons
165  /
166  (if (not (in-text?))
167      ((balloon (icon "tm_textual.xpm") "Insert plain text")
168       (make 'text)))
169  (if (not (in-math?))
170      (=> (balloon (icon "tm_math.xpm") "Insert mathematics")
171	  (link insert-math-menu)))
172  (=> (balloon (icon "tm_table.xpm") "Insert a table")
173      (link insert-table-menu))
174  (=> (balloon (icon "tm_image.xpm") "Insert a picture")
175      (link insert-image-menu))
176  (=> (balloon (icon "tm_link.xpm") "Insert a link")
177      (link insert-link-menu))
178  (if (detailed-menus?)
179      (if (style-has? "std-fold-dtd")
180	  (=> (balloon (icon "tm_switch.xpm") "Switching and folding")
181	      (link insert-fold-menu)))
182      (=> (balloon (icon "tm_animate.xpm") "Animation")
183	  (link insert-animation-menu)))
184  (if (and (style-has? "session-dtd") (detailed-menus?) (in-text?))
185      (=> (balloon (icon "tm_shell.xpm")
186		   "Start an interactive session")
187	  (link insert-session-menu))))
188