~ubuntu-branches/ubuntu/hardy/texmacs/hardy

« back to all changes in this revision

Viewing changes to TeXmacs/progs/menus/menu-text.scm

  • Committer: Bazaar Package Importer
  • Author(s): Ralf Treinen
  • Date: 2004-04-19 20:34:00 UTC
  • Revision ID: james.westby@ubuntu.com-20040419203400-g4e34ih0315wcn8v
Tags: upstream-1.0.3-R2
ImportĀ upstreamĀ versionĀ 1.0.3-R2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
3
;;
 
4
;; MODULE      : menu-text.scm
 
5
;; DESCRIPTION : menus for inserting structure in text mode
 
6
;; COPYRIGHT   : (C) 1999  Joris van der Hoeven
 
7
;;
 
8
;; This software falls under the GNU general public license and comes WITHOUT
 
9
;; ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for details.
 
10
;; If you don't have this file, write to the Free Software Foundation, Inc.,
 
11
;; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
12
;;
 
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
14
 
 
15
(texmacs-module (menus menu-text)
 
16
  (:use (texmacs edit edit-text) (texmacs edit edit-format)))
 
17
 
 
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
19
;; Document headers
 
20
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
21
 
 
22
(menu-bind letter-header-menu
 
23
  (when (not (inside? "letter-header"))
 
24
        ("Header" (make 'letter-header)))
 
25
  (when (inside? "letter-header")
 
26
        ("Address" (make-header 'address))
 
27
        ("Date" (make-header 'letter-date))
 
28
        ("Today" (begin (make-header 'letter-date) (make-arity 'date 0)))
 
29
        ("Destination" (make-header 'destination)))
 
30
  ---
 
31
  (when (not (inside? "letter-header"))
 
32
        ("Opening" (make 'opening))
 
33
        ("Closing" (make 'closing))
 
34
        ("Signature" (make 'signature)))
 
35
  ---
 
36
  ("C.C." (make 'cc))
 
37
  ("Encl." (make 'encl)))
 
38
 
 
39
(menu-bind exam-header-menu
 
40
  ("Class" (make-header 'class))
 
41
  ("Date" (begin (go-end-of-header-element) (make 'title-date)))
 
42
  ("Title" (make-header 'title)))
 
43
 
 
44
(menu-bind title-menu
 
45
  (when (and (not (inside? "make-title")) (not (inside? "abstract")))
 
46
        ("Make title" (begin (make 'make-title) (make 'title))))
 
47
  (when (inside? "make-title")
 
48
        ("Title" (make-header 'title))
 
49
        ("Author" (make-header 'author))
 
50
        ("Address" (make-header 'address))
 
51
        ("Email" (make-header 'title-email))
 
52
        ("Date" (make-header 'title-date))
 
53
        ---
 
54
        ("TeXmacs notice" (make 'made-by-TeXmacs))
 
55
        ("Running title" (make-header 'header-title))
 
56
        ("Running author" (make-header 'header-author))
 
57
        ("Address block" (make 'address-block))
 
58
        ("Today" (begin (make-header 'title-date)
 
59
                        (make-arity 'date 0))))
 
60
  ---
 
61
  (when (and (not (inside? "make-title")) (not (inside? "abstract")))
 
62
        ("Abstract" (make 'abstract)))
 
63
  (when (and (not (inside? "make-title")) (inside? "abstract"))
 
64
        ("Keywords" (make-section 'keywords))
 
65
        ("A.M.S. subject classification" (make-section 'AMS-class))))
 
66
 
 
67
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
68
;; Sections
 
69
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
70
 
 
71
(menu-bind chapter-menu
 
72
  ("Chapter" (make-section 'chapter))
 
73
  ("Appendix" (make-section 'appendix))
 
74
  ("Prologue" (make-unnamed-section 'prologue))
 
75
  ("Epilogue" (make-unnamed-section 'epilogue)))
 
76
 
 
77
(menu-bind section-menu
 
78
  ("Section" (make-section 'section))
 
79
  ("Subsection" (make-section 'subsection))
 
80
  ("Subsubsection" (make-section 'subsubsection))
 
81
  ---
 
82
  ("Paragraph" (make-section 'paragraph))
 
83
  ("Subparagraph" (make-section 'subparagraph)))
 
84
 
 
85
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
86
;; Theorem like environments
 
87
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
88
 
 
89
(menu-bind environment-menu
 
90
  (if (style-has? "header-exam-dtd")
 
91
      ("Exercise" (make 'exercise))
 
92
      ("Problem" (make 'problem)))
 
93
  (if (not (style-has? "header-exam-dtd"))
 
94
      (if (style-has? "env-default-dtd")
 
95
          ("Theorem" (make 'theorem))
 
96
          ("Proposition" (make 'proposition))
 
97
          ("Lemma" (make 'lemma))
 
98
          ("Corollary" (make 'corollary))
 
99
          ("Proof" (make 'proof))
 
100
          ("Axiom" (make 'axiom))
 
101
          ("Definition" (make 'definition))
 
102
          ---
 
103
          ("Remark" (make 'remark))
 
104
          ("Note" (make 'note))
 
105
          ("Example" (make 'example))
 
106
          ("Warning" (make 'warning))
 
107
          ("Exercise" (make 'exercise))
 
108
          ("Problem" (make 'problem))
 
109
          ---)
 
110
      ("Verbatim" (make 'verbatim))
 
111
      ("Code" (make 'code))
 
112
      ("Quote" (make 'quote-env))
 
113
      ("Quotation" (make 'quotation))
 
114
      ("Verse" (make 'verse))))
 
115
 
 
116
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
117
;; Tags
 
118
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
119
 
 
120
(menu-bind content-tag-menu
 
121
  ("Strong" (make 'strong))
 
122
  ("Emphasize" (make 'em))
 
123
  ("Definition" (make 'dfn))
 
124
  ("Sample" (make 'samp))
 
125
  ---
 
126
  ("Name" (make 'name))
 
127
  ("Person" (make 'person))
 
128
  ("Cite" (make 'cite*))
 
129
  ("Abbreviation" (make 'abbr))
 
130
  ("Acronym" (make 'acronym))
 
131
  ---
 
132
  ("Verbatim" (make 'verbatim))
 
133
  ("Keyboard" (make 'kbd))
 
134
  ("Code" (make 'code*))
 
135
  ("Variable" (make 'var)))
 
136
 
 
137
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
138
;; Enumerations
 
139
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
140
 
 
141
(menu-bind itemize-menu
 
142
  ("Default" (make-tmlist 'itemize))
 
143
  ---
 
144
  ("Bullets" (make-tmlist 'itemize-dot))
 
145
  ("Dashes" (make-tmlist 'itemize-minus))
 
146
  ("Arrows" (make-tmlist 'itemize-arrow)))
 
147
 
 
148
(menu-bind enumerate-menu
 
149
  ("Default" (make-tmlist 'enumerate))
 
150
  ---
 
151
  ("1, 2, 3, ..." (make-tmlist 'enumerate-numeric))
 
152
  ("i, ii, iii, ..." (make-tmlist 'enumerate-roman))
 
153
  ("I, II, III, ..." (make-tmlist 'enumerate-Roman))
 
154
  ("a, b, c, ..." (make-tmlist 'enumerate-alpha))
 
155
  ("A, B, C, ..." (make-tmlist 'enumerate-Alpha)))
 
156
 
 
157
(menu-bind description-menu
 
158
  ("Default" (make-tmlist 'description))
 
159
  ---
 
160
  ("Compact" (make-tmlist 'description-compact))
 
161
  ("Aligned" (make-tmlist 'description-aligned))
 
162
  ("Dashes" (make-tmlist 'description-dash))
 
163
  ("Long" (make-tmlist 'description-long)))
 
164
 
 
165
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
166
;; Automatically generated content
 
167
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
168
 
 
169
(menu-bind automatic-menu
 
170
  ("Table of contents" (make-aux "table-of-contents" "toc"))
 
171
  ("Bibliography" ...
 
172
   (interactive
 
173
    '("Bibliography style:" "Bibliography file:") 'make-bib))
 
174
  ("Index" (make-aux "the-index" "idx"))
 
175
  ("Glossary" (make-aux "the-glossary" "gly"))
 
176
  ("List of figures" (make-aux* "the-glossary*" "figure" "List of figures"))
 
177
  ("List of tables" (make-aux* "the-glossary*" "table" "List of tables")))
 
178
 
 
179
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
180
;; Inserting mathematical markup into the text
 
181
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
182
 
 
183
(menu-bind insert-mathematics-menu
 
184
  ("Formula" "$" (make-with "mode" "math"))
 
185
  (if (style-has? "env-math-dtd")
 
186
      ---
 
187
      ("Equation" (begin (make 'equation*) (temp-proof-fix)))
 
188
      ("Equations" (begin (make 'eqnarray*) (temp-proof-fix)))))
 
189
 
 
190
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
191
;; Style dependent menus
 
192
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
193
 
 
194
(menu-bind text-menu
 
195
  (if (and (style-has? "header-title-dtd")
 
196
           (not (style-has? "header-letter-dtd"))
 
197
           (not (style-has? "header-exam-dtd")))
 
198
      (-> "Title" (link title-menu)))
 
199
  (if (style-has? "header-letter-dtd")
 
200
      (-> "Header" (link letter-header-menu)))
 
201
  (if (style-has? "header-exam-dtd")
 
202
      (-> "Header" (link exam-header-menu)))
 
203
  (if (style-has? "book-style")
 
204
      (-> "Chapter" (link chapter-menu)))
 
205
  (if (and (style-has? "section-latex-dtd")
 
206
           (not (style-has? "header-exam-dtd")))
 
207
      (-> "Section" (link section-menu)))
 
208
  (if (style-has? "std-markup-dtd")
 
209
      (-> "Environment" (link environment-menu))
 
210
      (-> "Content tag" (link content-tag-menu)))
 
211
  (if (style-has? "common-base-dtd")
 
212
      ---)
 
213
  (if (style-has? "std-list-dtd")
 
214
      (-> "Itemize" (link itemize-menu))
 
215
      (-> "Enumerate" (link enumerate-menu))
 
216
        (-> "Description" (link description-menu))
 
217
        (when (or (inside-list?) (inside-description?))
 
218
              ("New item" (make-item)))
 
219
        ---)
 
220
  (-> "Mathematics" (link insert-mathematics-menu))
 
221
  (if (style-has? "program-dtd")
 
222
      (-> "Session"
 
223
          (link session-menu)
 
224
          ---
 
225
          ("Other" ... (interactive
 
226
                        '("Session type:" "Session name:") 'make-session))))
 
227
  (if (style-has? "section-automatic-dtd")
 
228
      (-> "Automatic" (link automatic-menu))))
 
229
 
 
230
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
231
;; Icons for text mode
 
232
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
233
 
 
234
(menu-bind texmacs-text-icons
 
235
  (if (and (style-has? "header-title-dtd")
 
236
           (not (style-has? "header-letter-dtd"))
 
237
           (not (style-has? "header-exam-dtd")))
 
238
      (=> (balloon (icon "tm_title.xpm") "Enter a title")
 
239
          (link title-menu)))
 
240
  (if (style-has? "header-letter-dtd")
 
241
      (=> (balloon (icon "tm_title.xpm") "Make a letter environment")
 
242
          (link letter-header-menu)))
 
243
  (if (style-has? "header-exam-dtd")
 
244
      (=> (balloon (icon "tm_title.xpm") "Enter title information")
 
245
          (link exam-header-menu)))
 
246
  (if (style-has? "book-style")
 
247
      (=> (balloon (icon "tm_chapter.xpm") "Start a new chapter")
 
248
          (link chapter-menu)))
 
249
  (if (and (style-has? "section-latex-dtd")
 
250
           (not (style-has? "header-exam-dtd")))
 
251
      (=> (balloon (icon "tm_section.xpm") "Start a new section")
 
252
          (link section-menu)))
 
253
  (if (style-has? "std-markup-dtd")
 
254
      (=> (balloon (icon "tm_theorem.xpm") "Insert an environment")
 
255
          (link environment-menu)))
 
256
  (=> (balloon (icon "tm_parstyle.xpm") "Set paragraph mode")
 
257
      ((balloon (icon "tm_left.xpm") "Align text to the left")
 
258
       (make-line-with "par-mode" "left"))
 
259
      ((balloon (icon "tm_center.xpm") "Center text")
 
260
       (make-line-with "par-mode" "center"))
 
261
      ((balloon (icon "tm_right.xpm") "Align text to the right")
 
262
       (make-line-with "par-mode" "right"))
 
263
      ((balloon (icon "tm_justify.xpm") "Justify text")
 
264
       (make-line-with "par-mode" "justify")))
 
265
  (=> (balloon (icon "tm_parindent.xpm") "Set paragraph margins")
 
266
      ("Left margin" (interactive '("Left margin:") 'set-left-margin))
 
267
      ("Right margin" (interactive '("Right margin:") 'set-right-margin))
 
268
      ("First indentation"
 
269
       (interactive '("First indentation:") 'set-first-indent)))
 
270
  (if (style-has? "env-float-dtd")
 
271
      (if (not (inside? "float"))
 
272
          (=> (balloon (icon "tm_pageins.xpm") "Make a page insertion")
 
273
              (link insert-page-insertion-menu)))
 
274
      (if (inside? "float")
 
275
          (=> (balloon (icon "tm_floatpos.xpm") "Position floating object")
 
276
              (link position-float-menu))))
 
277
;;((balloon (icon "tm_footnote.xpm") "Insert a footnote") ())
 
278
;;((balloon (icon "tm_margin.xpm") "Insert a marginal note") ())
 
279
;;((balloon (icon "tm_floating.xpm") "Insert a floating object") ())
 
280
;;((balloon (icon "tm_multicol.xpm") "Start multicolumn context") ())
 
281
  (if (style-has? "section-automatic-dtd")
 
282
      (=> (balloon (icon "tm_index.xpm")
 
283
                   "Insert automatically generated content")
 
284
          (link automatic-menu)))
 
285
  (if (style-has? "std-list-dtd")
 
286
      |
 
287
      (=> (balloon (icon "tm_itemize.xpm") "Itemize")
 
288
          (link itemize-menu))
 
289
      (=> (balloon (icon "tm_enumerate.xpm") "Enumerate")
 
290
          (link enumerate-menu))
 
291
      (=> (balloon (icon "tm_description.xpm") "Description")
 
292
          (link description-menu))
 
293
      (if (or (inside-list?) (inside-description?))
 
294
          ((balloon (icon "tm_item.xpm") "Insert a new item#(A-;)")
 
295
           (make-item))))
 
296
  |
 
297
  (=> (balloon (icon "tm_math.xpm") "Insert mathematics")
 
298
      (link insert-mathematics-menu))
 
299
  ;((balloon (icon "tm_insert_graphics.xpm") "Insert graphics")
 
300
  ;(make-graphics))
 
301
  (if (style-has? "program-dtd")
 
302
      (=> (balloon (icon "tm_shell.xpm")
 
303
                   "Start an interactive session")
 
304
          (link session-menu)
 
305
          ---
 
306
          ("Other" ...
 
307
           (interactive
 
308
            '("Session type:" "Session name:") 'make-session)))))
 
309
 
 
310
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
311
;; Icons for modifying text properties
 
312
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
313
 
 
314
(menu-bind text-modifier-icons
 
315
  (if (style-has? "std-markup-dtd")
 
316
      ;;((balloon
 
317
      ;;(text (roman rm bold right 12 600) "S")
 
318
      ;;"Write bold text#(A-C-b)")
 
319
      ;;(make-with "font-series" "bold"))
 
320
      ((balloon (icon "tm_emphasize.xpm") "Emphasize text#(F5)")
 
321
       (make 'em))
 
322
      ((balloon (icon "tm_strong.xpm") "Write strong text#(F6)")
 
323
       (make 'strong))
 
324
      ((balloon (icon "tm_verbatim.xpm") "Write verbatim text#(F7)")
 
325
       (make 'verbatim))
 
326
      ((balloon (icon "tm_sansserif.xpm") "Write sample text#(F8)")
 
327
       (make 'samp))
 
328
      ((balloon (icon "tm_name.xpm") "Write a name#(S-F6)")
 
329
       (make 'name)))
 
330
  (if (not (style-has? "std-markup-dtd"))
 
331
      ((balloon (icon "tm_italic.xpm") "Write italic text#(A-C-i)")
 
332
       (make-with "font-shape" "italic"))
 
333
      ((balloon (icon "tm_bold.xpm") "Write bold text#(A-C-b)")
 
334
       (make-with "font-series" "bold"))
 
335
      ((balloon (icon "tm_typewriter.xpm") "Use a typewriter font#(A-C-t)")
 
336
       (make-with "font-family" "tt"))
 
337
      ((balloon (icon "tm_sansserif.xpm") "Use a sans serif font#(A-C-s)")
 
338
       (make-with "font-family" "ss"))
 
339
      ((balloon (icon "tm_smallcaps.xpm") "Use small capitals#(A-C-p)")
 
340
       (make-with "font-shape" "small-caps"))))