12
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14
14
(texmacs-module (text text-menu)
15
(:use (text format-text-edit) (text std-text-edit)))
15
(:use (text format-text-edit)
17
19
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18
20
;; Document headers
19
21
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21
(menu-bind author-menu
22
("Insert author" (make-doc-data-element 'doc-author-data))
24
(when (inside? 'doc-author-data)
25
("Address" (make-author-data-element 'author-address))
26
("Email" (make-author-data-element 'author-email))
27
("Homepage" (make-author-data-element 'author-homepage))
28
("Note" (make-author-data-element 'author-note))))
30
23
(menu-bind title-menu
31
24
(when (not (inside? 'doc-data))
32
25
("Insert title" (make-doc-data)))
34
(when (inside? 'doc-data)
35
("Subtitle" (make-doc-data-element 'doc-subtitle))
36
(-> "Author" (link author-menu))
38
("Default" (make-doc-data-element 'doc-date))
40
(begin (make-doc-data-element 'doc-date) (make-arity 'date 0))))
42
("General note" (make-doc-data-element 'doc-note))
43
("Written with TeXmacs" (begin (make-doc-data-element 'doc-note)
44
(make 'with-TeXmacs-text))))
46
(if (doc-data-disactivated?)
47
("Activate hidden" (doc-data-activate-all)))
48
(if (not (doc-data-disactivated?))
49
("Show hidden" (doc-data-disactivate-all)))
51
("Running title" (make-doc-data-element 'doc-running-title))
52
("Running author" (make-doc-data-element 'doc-running-author))
53
("Keywords" (make-doc-data-element 'doc-keywords))
54
("A.M.S. subject classification"
55
(make-doc-data-element 'doc-AMS-class))))
57
26
(when (and (not (inside? 'doc-data)) (not (inside? 'abstract)))
58
27
("Abstract" (make 'abstract))))
99
68
("Subparagraph" (make-section 'subparagraph)))
101
70
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
102
;; Theorem like environments
71
;; Enunciations, quotations and programs
103
72
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
105
(menu-bind environment-menu
106
(if (style-has? "header-exam-dtd")
107
("Exercise" (make 'exercise))
108
("Problem" (make 'problem)))
109
(if (not (style-has? "header-exam-dtd"))
110
(if (style-has? "env-theorem-dtd")
111
("Theorem" (make 'theorem))
112
("Proposition" (make 'proposition))
113
("Lemma" (make 'lemma))
114
("Corollary" (make 'corollary))
115
("Proof" (make 'proof))
116
("Axiom" (make 'axiom))
117
("Definition" (make 'definition))
118
("Notation" (make 'notation))
120
("Remark" (make 'remark))
121
("Note" (make 'note))
122
("Example" (make 'example))
123
("Warning" (make 'warning))
124
("Exercise" (make 'exercise))
125
("Problem" (make 'problem))
127
("Verbatim" (make 'verbatim))
128
("Code" (make 'code))
129
("Quote" (make 'quote-env))
130
("Quotation" (make 'quotation))
131
("Verse" (make 'verse))))
74
(menu-bind enunciation-menu
75
(if (style-has? "env-theorem-dtd")
76
("Theorem" (make 'theorem))
77
("Proposition" (make 'proposition))
78
("Lemma" (make 'lemma))
79
("Corollary" (make 'corollary))
80
("Proof" (make 'proof))
82
("Axiom" (make 'axiom))
83
("Definition" (make 'definition))
84
("Notation" (make 'notation))
86
("Remark" (make 'remark))
88
("Example" (make 'example))
89
("Warning" (make 'warning))
91
("Exercise" (make 'exercise))
92
("Problem" (make 'problem))
93
("Solution" (make 'solution))
94
("Question" (make 'question))
95
("Answer" (make 'answer)))
97
(menu-bind prominent-menu
98
("Quote" (make 'quote-env))
99
("Quotation" (make 'quotation))
100
("Verse" (make 'verse))
102
("Padded" (make 'padded))
103
("Underlined" (make 'underlined))
104
("Lines around" (make 'bothlined))
105
("Framed" (make 'framed))
106
(if (style-has? "ornaments-dtd")
108
("Manila paper" (make 'manila-paper))
109
("Rough paper" (make 'rough-paper))
110
("Ridged paper" (make 'ridged-paper))
111
("Pine" (make 'pine))
112
("Granite" (make 'granite))
113
("Metal" (make 'metal))))
116
("Algorithm" (make 'algorithm))
117
("Pseudo code" (make 'pseudo-code))
119
("Indent" (make 'indent))
120
("Tabbed" (make 'tabbed))
124
("Mathemagix" (make 'mmx))
125
("Scheme" (make 'scm))
126
("Shell" (make 'shell))
127
("Verbatim" (make 'verbatim)))
129
("C++" (make 'cpp-code))
130
("Mathemagix" (make 'mmx-code))
131
("Scheme" (make 'scm-code))
132
("Shell" (make 'shell-code))
133
("Verbatim" (make 'verbatim-code))))
133
135
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
229
253
(if (and (style-has? "section-base-dtd")
230
254
(not (style-has? "header-exam-dtd")))
231
255
(-> "Section" (link section-menu)))
232
(if (style-has? "std-markup-dtd")
233
(-> "Environment" (link environment-menu))
256
(if (or (style-has? "env-theorem-dtd")
257
(style-has? "header-exam-dtd"))
258
(-> "Enunciation" (link enunciation-menu)))
259
(if (style-has? "std-markup-dtd")
260
(-> "Prominent" (link prominent-menu)))
261
(if (style-has? "std-markup-dtd")
262
(-> "Program" (link code-menu)))
263
(if (style-has? "section-base-dtd")
264
(-> "Automatic" (link automatic-menu)))
265
(if (style-has? "std-list-dtd")
267
(-> "Itemize" (link itemize-menu))
268
(-> "Enumerate" (link enumerate-menu))
269
(-> "Description" (link description-menu)))
271
(if (style-has? "std-markup-dtd")
234
272
(-> "Content tag" (link content-tag-menu))
235
273
(-> "Size tag" (link size-tag-menu)))
236
274
(-> "Presentation tag" (link presentation-tag-menu))
237
(if (style-has? "std-dtd")
239
(if (style-has? "std-list-dtd")
240
(-> "Itemize" (link itemize-menu))
241
(-> "Enumerate" (link enumerate-menu))
242
(-> "Description" (link description-menu))
243
(when (inside-list-tag?) ("New item" (make-item)))
245
(if (style-has? "section-base-dtd")
246
(-> "Automatic" (link automatic-menu))))
276
(-> "Mathematics" (link insert-math-menu))
277
(-> "Table" (link insert-table-menu))
278
(-> "Image" (link insert-image-menu))
279
(-> "Link" (link insert-link-menu))
280
(if (detailed-menus?)
281
(if (style-has? "std-fold-dtd")
282
(-> "Fold" (link insert-fold-menu)))
283
(-> "Animation" (link insert-animation-menu)))
284
(if (and (style-has? "session-dtd") (detailed-menus?))
285
(-> "Session" (link insert-session-menu))))
248
287
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
249
288
;; Icons for text mode
250
289
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
252
291
(menu-bind text-icons
253
(if (and (style-has? "header-title-dtd")
254
(not (style-has? "header-letter-dtd"))
255
(not (style-has? "header-exam-dtd")))
256
(=> (balloon (icon "tm_title.xpm") "Enter a title")
292
;;("Goedenmiddag" (display* "Hi there\n"))
293
;;(input (display* answer "\n") "string" '("Hello" "Bonjour") "0.5w")
258
294
(if (style-has? "header-letter-dtd")
259
295
(=> (balloon (icon "tm_title.xpm") "Make a letter environment")
260
296
(link letter-header-menu)))
268
304
(not (style-has? "header-exam-dtd")))
269
305
(=> (balloon (icon "tm_section.xpm") "Start a new section")
270
306
(link section-menu)))
271
(if (style-has? "std-markup-dtd")
272
(=> (balloon (icon "tm_theorem.xpm") "Insert an environment")
273
(link environment-menu)))
274
(=> (balloon (icon "tm_parstyle.xpm") "Set paragraph mode")
275
((balloon (icon "tm_left.xpm") "Align text to the left")
276
(make-line-with "par-mode" "left"))
277
((balloon (icon "tm_center.xpm") "Center text")
278
(make-line-with "par-mode" "center"))
279
((balloon (icon "tm_right.xpm") "Align text to the right")
280
(make-line-with "par-mode" "right"))
281
((balloon (icon "tm_justify.xpm") "Justify text")
282
(make-line-with "par-mode" "justify")))
283
(=> (balloon (icon "tm_parindent.xpm") "Set paragraph margins")
284
("Left margin" (make-interactive-line-with "par-left"))
285
("Right margin" (make-interactive-line-with "par-right"))
286
("First indentation" (make-interactive-line-with "par-first")))
287
(if (and (style-has? "env-float-dtd") (detailed-menus?))
288
(if (not (inside? 'float))
289
(=> (balloon (icon "tm_pageins.xpm") "Make a page insertion")
290
(link insert-page-insertion-menu)))
292
(=> (balloon (icon "tm_floatpos.xpm") "Position floating object")
293
(link position-float-menu))))
294
;;((balloon (icon "tm_footnote.xpm") "Insert a footnote") ())
295
;;((balloon (icon "tm_margin.xpm") "Insert a marginal note") ())
296
;;((balloon (icon "tm_floating.xpm") "Insert a floating object") ())
297
;;((balloon (icon "tm_multicol.xpm") "Start multicolumn context") ())
307
(if (or (style-has? "env-theorem-dtd")
308
(style-has? "header-exam-dtd"))
309
(=> (balloon (icon "tm_theorem.xpm") "Insert an enunciation")
310
(link enunciation-menu)))
311
(if (style-has? "std-markup-dtd")
312
(=> (balloon (icon "tm_prominent.xpm") "Insert a prominent piece of text")
313
(link prominent-menu)))
314
(if (style-has? "std-markup-dtd")
315
(=> (balloon (icon "tm_program.xpm") "Insert a computer program")
317
(if (style-has? "std-list-dtd")
318
(=> (balloon (icon "tm_list.xpm") "Insert a list")
298
320
(if (style-has? "section-base-dtd")
299
321
(=> (balloon (icon "tm_index.xpm")
300
322
"Insert automatically generated content")
301
323
(link automatic-menu)))
302
(if (style-has? "std-list-dtd")
304
(=> (balloon (icon "tm_itemize.xpm") "Itemize")
306
(=> (balloon (icon "tm_enumerate.xpm") "Enumerate")
307
(link enumerate-menu))
308
(=> (balloon (icon "tm_description.xpm") "Description")
309
(link description-menu))
310
(if (inside-list-tag?)
311
((balloon (icon "tm_item.xpm") "Insert a new item")
324
(link text-format-icons)
325
(link texmacs-insert-icons))
327
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
328
;; Focus menus for entering title information
329
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
331
(tm-menu (focus-document-extra-menu t)
332
(:require (document-propose-title?))
333
("Title" (make-doc-data)))
335
(tm-menu (focus-document-extra-icons t)
336
(:require (document-propose-title?))
338
((balloon "Title" "Insert title") (make-doc-data))))
340
(tm-menu (focus-document-extra-menu t)
341
(:require (document-propose-abstract?))
342
("Abstract" (make 'abstract)))
344
(tm-menu (focus-document-extra-icons t)
345
(:require (document-propose-abstract?))
347
((balloon "Abstract" "Insert abstract") (make 'abstract))))
349
(tm-define (focus-can-move? t)
350
(:require (doc-title-context? t))
353
(tm-menu (focus-title-menu)
354
("Subtitle" (make-doc-data-element 'doc-subtitle))
355
("Author" (make-doc-data-element 'doc-author-data))
356
("Date" (make-doc-data-element 'doc-date))
358
(begin (make-doc-data-element 'doc-date) (make-arity 'date 0)))
359
("Note" (make-doc-data-element 'doc-note))
360
("TeXmacs notice" (begin (make-doc-data-element 'doc-note)
361
(make 'with-TeXmacs-text))))
363
(tm-menu (focus-title-hidden-menu)
364
("Running title" (make-doc-data-element 'doc-running-title))
365
("Running author" (make-doc-data-element 'doc-running-author))
366
("Keywords" (make-doc-data-element 'doc-keywords))
368
(make-doc-data-element 'doc-AMS-class)))
370
(tm-menu (focus-title-icons)
371
(assuming (doc-data-has-hidden?)
372
((check (balloon (icon "tm_show_hidden.xpm") "Show hidden") "v"
373
(doc-data-disactivated?))
374
(doc-data-activate-toggle)))
376
(inert ("Title" (noop))))
377
(=> (balloon (icon "tm_add.xpm") "Add title information")
378
(link focus-title-menu)
379
(-> "Hidden" (link focus-title-hidden-menu))))
381
(tm-menu (focus-ancestor-menu t)
382
(:require (doc-title-context? t))
384
(link focus-title-menu)
387
(link focus-title-hidden-menu)
390
(tm-menu (focus-ancestor-icons t)
391
(:require (doc-title-context? t))
392
(minibar (dynamic (focus-title-icons)))
395
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
396
;; Focus menus for entering authors
397
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
399
(tm-define (focus-can-move? t)
400
(:require (doc-author-context? t))
403
(tm-menu (focus-author-menu)
404
("Address" (make-author-data-element 'author-address))
405
("Email" (make-author-data-element 'author-email))
406
("Homepage" (make-author-data-element 'author-homepage))
407
("Note" (make-author-data-element 'author-note)))
409
(tm-menu (focus-author-icons)
411
(inert ("Author" (noop))))
412
(=> (balloon (icon "tm_add.xpm") "Add author information")
413
(link focus-author-menu)))
415
(tm-menu (focus-ancestor-menu t)
416
(:require (doc-author-context? t))
418
(link focus-title-menu)
421
(link focus-title-hidden-menu)
424
(link focus-author-menu)
427
(tm-menu (focus-ancestor-icons t)
428
(:require (doc-author-context? t))
429
(minibar (dynamic (focus-title-icons)))
431
(minibar (dynamic (focus-author-icons)))
434
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
435
;; Focus menus for sections
436
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
438
(tm-menu (focus-section-menu)
439
(for (s (tree-search-sections (buffer-tree)))
440
((eval (tm/section-get-title-string s))
441
(when (and (tree->path s) (section-context? s))
442
(tree-go-to s 0 :end)))))
444
(tm-menu (focus-document-extra-menu t)
445
(:require (previous-section))
446
(-> "Sections" (link focus-section-menu)))
448
(tm-menu (focus-document-extra-icons t)
449
(:require (previous-section))
451
(=> (eval (tm/section-get-title-string (previous-section)))
452
(link focus-section-menu))))
454
(tm-menu (focus-extra-menu t)
455
(:require (section-context? t))
458
(link focus-section-menu)))
460
(tm-menu (focus-extra-icons t)
461
(:require (section-context? t))
464
(=> (eval (tm/section-get-title-string t))
465
(link focus-section-menu))))
467
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
468
;; Focus menus for algorithms
469
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
471
(tm-define (focus-tag-name l)
472
(:require (in? l (algorithm-tag-list)))
473
(with r (algorithm-root l)
474
(with s (upcase-first (tree-name (tree r)))
475
(string-replace s "-" " "))))
477
(tm-menu (focus-toggle-menu t)
478
(:require (algorithm-context? t))
479
(when (not (algorithm-named? (focus-tree)))
480
((check "Numbered" "v" (algorithm-numbered? (focus-tree)))
481
(algorithm-toggle-number (focus-tree))))
482
((check "Named" "v" (algorithm-named? (focus-tree)))
483
(algorithm-toggle-name t))
484
((check "Specified" "v" (algorithm-specified? (focus-tree)))
485
(algorithm-toggle-specification t)))
487
(tm-menu (focus-toggle-icons t)
488
(:require (algorithm-context? t))
489
(when (not (algorithm-named? (focus-tree)))
490
((check (balloon (icon "tm_numbered.xpm") "Toggle numbering") "v"
491
(algorithm-numbered? (focus-tree)))
492
(algorithm-toggle-number (focus-tree))))
493
((check (balloon (icon "tm_small_textual.xpm") "Toggle name") "v"
494
(algorithm-named? (focus-tree)))
495
(algorithm-toggle-name t))
496
((check (balloon (icon "tm_specified.xpm") "Toggle specification") "v"
497
(algorithm-specified? (focus-tree)))
498
(algorithm-toggle-specification t)))