comparison lisp/hm--html-menus/hm--html-menu.el @ 102:a145efe76779 r20-1b3

Import from CVS: tag r20-1b3
author cvs
date Mon, 13 Aug 2007 09:15:49 +0200
parents 4be1180a9e89
children 9f59509498e1
comparison
equal deleted inserted replaced
101:a0ec055d74dd 102:a145efe76779
1 ;;; hm--html-menu --- A menu for the hm--html-mode. 1 ;;; hm--html-menu --- A menu for the hm--html-mode.
2 ;;; 2 ;;;
3 ;;; $Id: hm--html-menu.el,v 1.3 1997/02/24 01:13:27 steve Exp $ 3 ;;; $Id: hm--html-menu.el,v 1.4 1997/02/27 06:08:09 steve Exp $
4 ;;; 4 ;;;
5 ;;; Copyright (C) 1993 - 1997 Heiko Muenkel 5 ;;; Copyright (C) 1993 - 1997 Heiko Muenkel
6 ;;; email: muenkel@tnt.uni-hannover.de 6 ;;; email: muenkel@tnt.uni-hannover.de
7 ;;; 7 ;;;
8 ;;; This program is free software; you can redistribute it and/or modify 8 ;;; This program is free software; you can redistribute it and/or modify
131 ["Document division" hm--html-add-document-division t] 131 ["Document division" hm--html-add-document-division t]
132 ["New line" hm--html-add-line-break t] 132 ["New line" hm--html-add-line-break t]
133 ["Horizontal rule" hm--html-add-horizontal-rule t] 133 ["Horizontal rule" hm--html-add-horizontal-rule t]
134 ) 134 )
135 ("Formating Paragraphs" 135 ("Formating Paragraphs"
136 ["Without links" hm--html-add-plaintext t] 136 ; ["Without links" hm--html-add-plaintext t]
137 ["With links" hm--html-add-preformated t] 137 ["Preformated" hm--html-add-preformated t]
138 ["Blockquote" hm--html-add-blockquote t]
138 "----" 139 "----"
139 ["Basefont..." hm--html-add-basefont t] 140 ["Basefont..." hm--html-add-basefont t]
140 ["Font..." hm--html-add-font t] 141 ["Font..." hm--html-add-font t]
141 ["Blockquote" hm--html-add-blockquote t]
142 ["Listing" hm--html-add-listing t]
143 ["Abstract" hm--html-add-abstract t]
144 "----"
145 ["Center" hm--html-add-center t] 142 ["Center" hm--html-add-center t]
143 ["Style" hm--html-add-style t]
144 "----"
145 ["HTML Comment" hm--html-add-comment t]
146 ; ["Listing" hm--html-add-listing t]
147 ; ["Abstract" hm--html-add-abstract t]
146 ) 148 )
147 ("Formatting Words" 149 ("Formatting Words"
148 ["Bold" hm--html-add-bold t] 150 ["Bold" hm--html-add-bold t]
149 ["Italic" hm--html-add-italic t] 151 ["Italic" hm--html-add-italic t]
150 ["Typewriter" hm--html-add-fixed t] 152 ["Typewriter" hm--html-add-fixed t]
153 ["Superscript" hm--html-add-superscript t] 155 ["Superscript" hm--html-add-superscript t]
154 ["Subscript" hm--html-add-subscript t] 156 ["Subscript" hm--html-add-subscript t]
155 "----" 157 "----"
156 ["Underline" hm--html-add-underline t] 158 ["Underline" hm--html-add-underline t]
157 ["Strikethru" hm--html-add-strikethru t] 159 ["Strikethru" hm--html-add-strikethru t]
158 ;; ["Render" hm--html-add-render t]
159 "----" 160 "----"
160 ; ["Emphasized" hm--html-add-emphasized t] 161 ; ["Emphasized" hm--html-add-emphasized t]
161 ; ["Strong" hm--html-add-strong t] 162 ; ["Strong" hm--html-add-strong t]
162 ; "----" 163 ; "----"
163 ("Phrase" 164 ("Phrase"
171 ["Sample" hm--html-add-sample t] 172 ["Sample" hm--html-add-sample t]
172 ["Citation" hm--html-add-citation t] 173 ["Citation" hm--html-add-citation t]
173 ) 174 )
174 ;; All the following commands are still implemented, but most 175 ;; All the following commands are still implemented, but most
175 ;; of them are not defined in HTM 3.2 176 ;; of them are not defined in HTM 3.2
177 ;; You've to load hm--html-not-standard.el to use them
176 ; ("Computing" 178 ; ("Computing"
177 ; ["Definition" hm--html-add-definition t] 179 ; ["Definition" hm--html-add-definition t]
178 ; ["Keyboard" hm--html-add-keyboard t] 180 ; ["Keyboard" hm--html-add-keyboard t]
179 ; ["Command" hm--html-add-command t] 181 ; ["Command" hm--html-add-command t]
180 ; ["Argument" hm--html-add-argument t] 182 ; ["Argument" hm--html-add-argument t]
201 ; ["Copyright" hm--html-add-copyright t] 203 ; ["Copyright" hm--html-add-copyright t]
202 ; ) 204 ; )
203 ; "----" 205 ; "----"
204 ; ["Footnote" hm--html-add-footnote t] 206 ; ["Footnote" hm--html-add-footnote t]
205 ; ["Margin" hm--html-add-margin t] 207 ; ["Margin" hm--html-add-margin t]
206 "----" 208 ; "----"
207 ["HTML Comment" hm--html-add-comment t] 209 ; ["HTML Comment" hm--html-add-comment t]
208 ) 210 )
209 ("Include" 211 ("Include"
210 ["Top aligned image..." hm--html-add-image-top t] 212 ["Top aligned image..." hm--html-add-image-top t]
211 ["Middle aligned image..." hm--html-add-image-middle t] 213 ["Middle aligned image..." hm--html-add-image-middle t]
212 ["Bottom aligned image..." hm--html-add-image-bottom t] 214 ["Bottom aligned image..." hm--html-add-image-bottom t]
220 ["Map..." hm--html-add-map t] 222 ["Map..." hm--html-add-map t]
221 ["Area..." hm--html-add-area t] 223 ["Area..." hm--html-add-area t]
222 "----" 224 "----"
223 ["Applet..." hm--html-add-applet t] 225 ["Applet..." hm--html-add-applet t]
224 ["Parameter..." hm--html-add-applet-parameter t] 226 ["Parameter..." hm--html-add-applet-parameter t]
227 ["Script" hm--html-add-script t]
225 ; "----" 228 ; "----"
226 ; ["File..." hm--html-add-server-side-include-file t] 229 ; ["File..." hm--html-add-server-side-include-file t]
227 ; ["Command..." hm--html-add-server-side-include-command t] 230 ; ["Command..." hm--html-add-server-side-include-command t]
228 ; ["Command with isindex parameter..." 231 ; ["Command with isindex parameter..."
229 ; hm--html-add-server-side-include-command-with-isindex-parameter 232 ; hm--html-add-server-side-include-command-with-isindex-parameter
280 ["Menu" hm--html-add-menu t] 283 ["Menu" hm--html-add-menu t]
281 "----" 284 "----"
282 ["Paragraph Container" hm--html-add-paragraph t] 285 ["Paragraph Container" hm--html-add-paragraph t]
283 ) 286 )
284 ("Formating Paragraphs" 287 ("Formating Paragraphs"
285 ["Without links" hm--html-add-plaintext t] 288 ; ["Without links" hm--html-add-plaintext t]
286 ["With links" hm--html-add-preformated t] 289 ["Preformated" hm--html-add-preformated t]
287 ) 290 )
288 ("Formatting Words" 291 ("Formatting Words"
289 ["Bold" hm--html-add-bold t] 292 ["Bold" hm--html-add-bold t]
290 ["Italic" hm--html-add-italic t] 293 ["Italic" hm--html-add-italic t]
291 ["Underline" hm--html-add-underline t] 294 ["Underline" hm--html-add-underline t]
351 "----" 354 "----"
352 ["Paragraph container" hm--html-add-paragraph-to-region t] 355 ["Paragraph container" hm--html-add-paragraph-to-region t]
353 ["Document division" hm--html-add-document-division-to-region t] 356 ["Document division" hm--html-add-document-division-to-region t]
354 ) 357 )
355 ("Formatting Paragraphs" 358 ("Formatting Paragraphs"
356 ["Without links" hm--html-add-plaintext-to-region t] 359 ; ["Without links" hm--html-add-plaintext-to-region t]
357 ["With links" hm--html-add-preformated-to-region t] 360 ["Preformated" hm--html-add-preformated-to-region t]
361 ["Blockquote" hm--html-add-blockquote-to-region t]
358 "----" 362 "----"
359 ["Font..." hm--html-add-font-to-region t] 363 ["Font..." hm--html-add-font-to-region t]
360 ["Blockquote" hm--html-add-blockquote-to-region t]
361 ["Listing" hm--html-add-listing-to-region t]
362 ["Abstract" hm--html-add-abstract-to-region t]
363 "----"
364 ["Center" hm--html-add-center-to-region t] 364 ["Center" hm--html-add-center-to-region t]
365 ["Style" hm--html-add-style-to-region t]
366 "----"
367 ["HTML Comment" hm--html-add-comment-to-region t]
368 ; ["Listing" hm--html-add-listing-to-region t]
369 ; ["Abstract" hm--html-add-abstract-to-region t]
365 ) 370 )
366 ("Formatting Words" 371 ("Formatting Words"
367 ["Bold" hm--html-add-bold-to-region t] 372 ["Bold" hm--html-add-bold-to-region t]
368 ["Italic" hm--html-add-italic-to-region t] 373 ["Italic" hm--html-add-italic-to-region t]
369 ["Typewriter" hm--html-add-fixed-to-region t] 374 ["Typewriter" hm--html-add-fixed-to-region t]
420 ; ["Copyright" hm--html-add-copyright-to-region t] 425 ; ["Copyright" hm--html-add-copyright-to-region t]
421 ; ) 426 ; )
422 ; "----" 427 ; "----"
423 ; ["Footnote" hm--html-add-footnote-to-region t] 428 ; ["Footnote" hm--html-add-footnote-to-region t]
424 ; ["Margin" hm--html-add-margin-to-region t] 429 ; ["Margin" hm--html-add-margin-to-region t]
425 "----" 430 ; "----"
426 ["HTML Comment" hm--html-add-comment-to-region t] 431 ; ["HTML Comment" hm--html-add-comment-to-region t]
427 ) 432 )
428 ("Include" 433 ("Include"
429 ["Map..." hm--html-add-map-to-region t] 434 ["Map..." hm--html-add-map-to-region t]
430 "----" 435 "----"
431 ["Applet..." hm--html-add-applet-to-region t] 436 ["Applet..." hm--html-add-applet-to-region t]
437 ["Script" hm--html-add-script-to-region t]
432 ) 438 )
433 ("Forms" 439 ("Forms"
434 ["Form..." hm--html-add-form-to-region t]) 440 ["Form..." hm--html-add-form-to-region t])
435 )) 441 ))
436 442
455 ("Structure" 461 ("Structure"
456 ["Menu item" hm--html-add-list-or-menu-item-to-region t] 462 ["Menu item" hm--html-add-list-or-menu-item-to-region t]
457 ["Menu" hm--html-add-menu-to-region t] 463 ["Menu" hm--html-add-menu-to-region t]
458 ) 464 )
459 ("Formatting Paragraphs" 465 ("Formatting Paragraphs"
460 ["Without links" hm--html-add-plaintext-to-region t] 466 ; ["Without links" hm--html-add-plaintext-to-region t]
461 ["With links" hm--html-add-preformated-to-region t] 467 ["Preformated" hm--html-add-preformated-to-region t]
462 ) 468 )
463 ("Formatting Words" 469 ("Formatting Words"
464 ["Bold" hm--html-add-bold-to-region t] 470 ["Bold" hm--html-add-bold-to-region t]
465 ["Italic" hm--html-add-italic-to-region t] 471 ["Italic" hm--html-add-italic-to-region t]
466 ["Underline" hm--html-add-underline-to-region t] 472 ["Underline" hm--html-add-underline-to-region t]
481 ["Expert menu" 487 ["Expert menu"
482 hm--html-use-expert-menu 488 hm--html-use-expert-menu
483 :active t 489 :active t
484 :style radio 490 :style radio
485 :selected hm--html-expert] 491 :selected hm--html-expert]
486 ; ["Marcs menu" hm--html-use-marcs-menu t]
487 ) 492 )
488 ["Reload config files" hm--html-load-config-files t] 493 ["Reload config files" hm--html-load-config-files t]
489 ["Templates (fixed dirs) ..." 494 ["Templates (fixed dirs) ..."
490 hm--html-insert-template-from-fixed-dirs 495 hm--html-insert-template-from-fixed-dirs
491 t] 496 t]
527 (if (adapt-xemacsp) 532 (if (adapt-xemacsp)
528 (defun hm--install-html-menu (menu-name) 533 (defun hm--install-html-menu (menu-name)
529 (if (and current-menubar (not (assoc menu-name current-menubar))) 534 (if (and current-menubar (not (assoc menu-name current-menubar)))
530 (progn 535 (progn
531 (set-buffer-menubar (copy-sequence current-menubar)) 536 (set-buffer-menubar (copy-sequence current-menubar))
532 (add-menu nil menu-name (cdr hm--html-pulldown-menu))))) 537 (add-submenu nil (cons menu-name (cdr hm--html-pulldown-menu)) "HTML"))))
533 538
534 (defun hm--install-html-menu (menu-name) 539 (defun hm--install-html-menu (menu-name)
535 (if (eq major-mode 'hm--html-mode) 540 (if (eq major-mode 'hm--html-mode)
536 (easy-menu-define hm--html-menu-map 541 (easy-menu-define hm--html-menu-map
537 hm--html-mode-map 542 hm--html-mode-map
541 (easy-menu-define hm--html-minor-menu-map 546 (easy-menu-define hm--html-minor-menu-map
542 hm--html-minor-mode-map 547 hm--html-minor-mode-map
543 "The hm--html-minor-mode pulldown menu." 548 "The hm--html-minor-mode pulldown menu."
544 (cons menu-name 549 (cons menu-name
545 (cdr hm--html-pulldown-menu)))) 550 (cdr hm--html-pulldown-menu))))
546 ; (easy-menu-define hm--html-region-menu-map
547 ; hm--html-region-mode-map
548 ; "The hm--html-mode pulldown menu, if a region is active."
549 ; (cons menu-name
550 ; (cdr hm--html-pulldown-menu)))
551 ; (if (and current-menubar (not (assoc "HTML" current-menubar)))
552 ; (progn
553 ; (set-buffer-menubar current-menubar)
554 ; ))
555 ; (add-menu nil "HTML" (cdr hm--html-pulldown-menu))
556 )) 551 ))
557 552
558 (if (adapt-emacs19p) 553 (if (adapt-emacs19p)
559 (progn 554 (progn
560 555
582 ) 577 )
583 (x-popup-menu nil hm--html-menu-noregion-novice-map) 578 (x-popup-menu nil hm--html-menu-noregion-novice-map)
584 (x-popup-menu nil hm--html-menu-region-novice-map)) 579 (x-popup-menu nil hm--html-menu-region-novice-map))
585 580
586 581
587 ; (defun hm--html-emacs19-popup-menu (menu event)
588 ; (let ((pos (posn-x-y (event-end event)))
589 ; (window (posn-window (event-start event)))
590 ; (answer))
591 ; (while menu
592 ; (setq answer (x-popup-menu (list (list (car pos) (cdr pos))
593 ; window)
594 ; menu))
595 ; (setq cmd (lookup-key menu (apply 'vector answer)))
596 ; (setq menu nil)
597 ; (and cmd
598 ; (if (keymapp cmd)
599 ; (setq menu cmd)
600 ; (call-interactively cmd))))))
601
602 ; (defun hm--html-popup-menu (event)
603 ; "Pops the HTML- menu up, if no region is active."
604 ; (interactive "@e")
605 ; (if hm--html-expert
606 ; (hm--html-emacs19-popup-menu hm--html-menu-noregion-expert-map
607 ; event)
608 ; (hm--html-emacs19-popup-menu hm--html-menu-noregion-novice-map
609 ; event)))
610
611 ; (defun hm--html-popup-menu-region (event)
612 ; "Pops the HTML- menu up, if a region is active."
613 ; (interactive "@e")
614 ; (if hm--html-expert
615 ; (hm--html-emacs19-popup-menu hm--html-menu-region-expert-map
616 ; event)
617 ; (hm--html-emacs19-popup-menu hm--html-menu-region-novice-map
618 ; event)))
619 ) 582 )
620 583
621 (defun hm--html-popup-menu (event) 584 (defun hm--html-popup-menu (event)
622 "Pops the HTML- menu up, if no region is active." 585 "Pops the HTML- menu up, if no region is active."
623 (interactive "@e") 586 (interactive "@e")
624 ; (if hm--html-marc
625 ; (popup-menu html-menu)
626 (if hm--html-expert 587 (if hm--html-expert
627 (popup-menu hm--html-menu-noregion-expert) 588 (popup-menu hm--html-menu-noregion-expert)
628 (popup-menu hm--html-menu-noregion-novice))) 589 (popup-menu hm--html-menu-noregion-novice)))
629 ;)
630 590
631 591
632 (defun hm--html-popup-menu-region (event) 592 (defun hm--html-popup-menu-region (event)
633 "Pops the HTML- menu up, if a region is active." 593 "Pops the HTML- menu up, if a region is active."
634 (interactive "@e") 594 (interactive "@e")
635 ; (if hm--html-marc
636 ; (popup-menu html-menu)
637 (if hm--html-expert 595 (if hm--html-expert
638 (popup-menu hm--html-menu-region-expert) 596 (popup-menu hm--html-menu-region-expert)
639 (popup-menu hm--html-menu-region-novice))) 597 (popup-menu hm--html-menu-region-novice)))
640 ;)
641 ) 598 )
642 599
643 600
644 (if (adapt-xemacsp) 601 (if (adapt-xemacsp)
645 (progn 602 (progn
646 603
647 (defun hm--html-use-novice-menu () 604 (defun hm--html-use-novice-menu ()
648 "Changes the HTML popup menu to the novice menu." 605 "Changes the HTML popup menu to the novice menu."
649 (interactive) 606 (interactive)
650 (setq hm--html-expert nil) 607 (setq hm--html-expert nil)
651 ; (setq hm--html-marc nil)
652 ; (define-key html-mode-map '(button3) 'hm--popup-html-menu)
653 ; (define-key html-region-mode-map '(button3) 'hm--popup-html-menu)
654 ) 608 )
655 609
656 610
657 (defun hm--html-use-expert-menu () 611 (defun hm--html-use-expert-menu ()
658 "Changes the HTML popup menu to the expert menu." 612 "Changes the HTML popup menu to the expert menu."
659 (interactive) 613 (interactive)
660 (setq hm--html-expert t) 614 (setq hm--html-expert t)
661 ; (setq hm--html-marc nil)
662 ; (define-key html-mode-map '(button3) 'hm--popup-html-menu)
663 ; (define-key html-region-mode-map '(button3) 'hm--popup-html-menu)
664 ) 615 )
665 ) 616 )
666 617
667 ;; For the Emacs 19 618 ;; For the Emacs 19
668 (defun hm--html-use-novice-menu () 619 (defun hm--html-use-novice-menu ()
704 hm--html-emacs19-popup-noregion-menu-button 655 hm--html-emacs19-popup-noregion-menu-button
705 hm--html-menu-noregion-expert-map)) 656 hm--html-menu-noregion-expert-map))
706 ) 657 )
707 ) 658 )
708 659
709 ;(defun hm--html-use-marcs-menu ()
710 ; "Changes the HTML popup menu to Marc Andreessens menu."
711 ; (interactive)
712 ; (setq hm--html-marc t)
713 ; )
714
715
716 ;(define-key html-mode-map '(button3) 'hm--popup-html-menu)
717 ;(define-key html-region-mode-map '(button3) 'hm--popup-html-menu)
718
719 ;(add-hook 'html-mode-hook 'hm--install-html-menu)
720
721
722 ;(defun sgml-popup-menu (event title entries)
723 ; "Display a popup menu."
724 ; (setq entries
725 ; (loop for ent in entries collect
726 ; (vector (car ent)
727 ; (list 'setq 'value (list 'quote (cdr ent)))
728 ; t)))
729 ; (cond ((> (length entries) sgml-max-menu-size)
730 ; (setq entries
731 ; (loop for i from 1 while entries collect
732 ; (let ((submenu
733 ; (subseq entries 0 (min (length entries)
734 ; sgml-max-menu-size))))
735 ; (setq entries (nthcdr sgml-max-menu-size
736 ; entries))
737 ; (cons
738 ; (format "%s '%s'-'%s'"
739 ; title
740 ; (sgml-range-indicator (aref (car submenu) 0))
741 ; (sgml-range-indicator
742 ; (aref (car (last submenu)) 0)))
743 ; submenu))))))
744 ;; (sgml-xemacs-get-popup-value (cons title entries)))
745 ; (sgml-xemacs-get-popup-value (append hm--html-popup-menu
746 ; (list "--" "--" title "==")
747 ; entries)))
748 660
749 (defvar hm--html-use-psgml t 661 (defvar hm--html-use-psgml t
750 "Set this to t, if functions from the psgml-mode should be used.") 662 "Set this to t, if functions from the psgml-mode should be used.")
751 663
752 ;;; Popup the menus in the minor mode 664 ;;; Popup the menus in the minor mode
833 )) 745 ))
834 746
835 )) 747 ))
836 748
837 749
838 ;(defvar hm--html-menu-load-hook nil
839 ; "*Hook variable to execute functions after loading the file hm--html-menu.")
840
841
842 (run-hooks 'hm--html-menu-load-hook) 750 (run-hooks 'hm--html-menu-load-hook)
843 751
844 752
845 ;;; Announce the feature hm--html-menu 753 ;;; Announce the feature hm--html-menu
846 (provide 'hm--html-menu) 754 (provide 'hm--html-menu)