menus.el 6.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
;;;;;
;;;;; $Id$
;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
;;;;;
;;;;; This file is part of the LysKOM server.
;;;;; 
;;;;; LysKOM is free software; you can redistribute it and/or modify it
;;;;; under the terms of the GNU General Public License as published by 
;;;;; the Free Software Foundation; either version 2, or (at your option) 
;;;;; any later version.
;;;;; 
;;;;; LysKOM is distributed in the hope that it will be useful, but WITHOUT
;;;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
;;;;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
;;;;; for more details.
;;;;; 
;;;;; You should have received a copy of the GNU General Public License
;;;;; along with LysKOM; see the file COPYING.  If not, write to
;;;;; Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
;;;;; or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 
;;;;; MA 02139, USA.
;;;;;
;;;;; Please mail bug reports to bug-lyskom@lysator.liu.se. 
;;;;;
;;;; ================================================================
;;;; ================================================================
;;;;
;;;; File: menus.el
;;;; Author: Niels Mller
;;;;
;;;;


34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
(defvar lyskom-menus
  '((menu lyskom
	  ((menu read ((item kom-view-next-text)
		       hline
		       (item kom-view-commented-text)
		       (item kom-view-previous-commented-text)
		       (item kom-review-comments)
		       (item kom-review-tree)
		       (item kom-find-root)))
	   (menu dont-read((item kom-jump)
			   (item kom-set-unread)))
	   (menu write ((item kom-write-text)
			(item kom-send-letter)
			(item kom-write-comment)
			(item kom-comment-previous)
			hline
			(item kom-send-message)))
	   (menu move ((item kom-go-to-conf)
		       (item kom-go-to-next-conf)))
	   (menu info ((item kom-who-is-on)
		       (item kom-list-news)
		       hline
		       (item kom-status-person)
		       (item kom-status-conf)
		       (item kom-review-presentation)
		       hline
		       (item kom-list-conferences)
		       (item kom-list-persons))))))
  "The menus used in LysKOM.")
Niels Möller's avatar
Niels Möller committed
63

64 65 66 67 68 69 70 71 72 73 74
(defvar lyskom-edit-menus
  '((menu lyskom
	  ((menu send ((item kom-edit-send)
		       (item kom-edit-send-anonymous)))
	   (item kom-edit-quit)
	   hline
	   (menu recievers ((item kom-edit-add-recipient)
			    (item kom-edit-add-copy)))
	   (menu commented ((item kom-edit-show-commented)
			    (item kom-edit-insert-commented))))))
  "The menus for editing LysKOM messages.")
75 76

(defvar lyskom-menu-map nil
77
  "A keymap describing the LysKOM top menu.")
78 79 80

(when (not lyskom-menu-map) 
  (setq lyskom-menu-map (make-sparse-keymap)))
Niels Möller's avatar
Niels Möller committed
81

82 83 84 85 86
(defvar lyskom-edit-menu-map nil
  "A keymap the LysKOM menu in the edit buffer.")

(when (not lyskom-edit-menu-map)
  (setq lyskom-edit-menu-map (make-sparse-keymap)))
Niels Möller's avatar
Niels Möller committed
87 88

(defun lyskom-build-menus ()
89 90 91
  "Create menus from according to LYSKOM-MENUS"
  (interactive)
  ;; Menu in lyskom-mode
Niels Möller's avatar
Niels Möller committed
92 93
  (define-key lyskom-mode-map [menu-bar]
    lyskom-menu-map)
94 95
  (define-key lyskom-mode-map [menu-bar edit]
    'undefined)
96 97 98 99 100 101
  (lyskom-define-menu lyskom-menu-map lyskom-menus)
  ;; Menu in lyskom-edit-mode
  (define-key lyskom-edit-mode-map [menu-bar]
    lyskom-edit-menu-map)
  (lyskom-define-menu lyskom-edit-menu-map lyskom-edit-menus))
  
Niels Möller's avatar
Niels Möller committed
102 103 104 105 106

(defun lyskom-define-menu (map menus)
  (when menus
    (lyskom-define-menu map (cdr menus))
    (cond ((eq 'hline (car menus))
107
	   (define-key map [separator] '("--")))
Niels Möller's avatar
Niels Möller committed
108 109
	  ((eq 'menu (car (car menus)))
	   (let* ((symbol (car (cdr (car menus))))
110
		  (name (lyskom-get-string symbol 'menu))
Niels Möller's avatar
Niels Möller committed
111 112 113 114 115 116 117
		  (submenu (car (cdr (cdr (car menus)))))
		  (submap (make-sparse-keymap name)))
	     (define-key map (vector symbol)
	       (cons name submap))
	     (lyskom-define-menu submap submenu)))
	  ((eq 'item (car (car menus)))
	   (let* ((symbol (car (cdr (car menus))))
118
		  (name (lyskom-get-string symbol 'menu)))
Niels Möller's avatar
Niels Möller committed
119 120 121 122 123
	     (define-key map (vector symbol)
	       (cons name symbol))))
	  (t (error "Menu description invalid in lyskom-define-menu")))))

		   
124 125 126 127 128 129 130 131 132 133
(defun lyskom-background-menu (pos event)
  "Pop up a menu with LysKOM commands and execute the selected command."
  (let* ((menu (lookup-key lyskom-menu-map [lyskom]))
	 (result (x-popup-menu event (list menu)))
	 (command (and result
		       (lookup-key menu
				   (apply 'vector result)))))
    (if command
	(call-interactively command))))

Niels Möller's avatar
Niels Möller committed
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191



;;;;(terse) Baklnges		   Addera extra kopiemottagare
;;;;Addera kommentar		   Addera medlem
;;;;Addera mottagare		   Automatsvar
;;;;Avmarkera (inlgg)		   Bli medlem i mte
;;;;Brja med nytt namn		   Endast lsa senaste
;;;;Filtrera frfattare		   Filtrera innehll
;;;;Filtrera rende			   Fjrrkontrollera automatsvar
;;;;Fjrrkontrollera avsluta	   Fjrrkontrollera lista meddelanden
;;;;Fjrrkontrollera radera meddelanden
;;;;Fjrrkontrollera ndra svarsmeddelande
;;;;Flytta inlgg			   Fotnot till inlgg
;;;;F skll			   F uppmuntran
;;;;G till mte			   G till nsta mte
;;;;Hjlp				   Hoppa ver alla kommentarer
;;;;Kasta ut en session		   Kommentera fregende inlgg
;;;;Kommentera inlgget		   Ladda ner fil
;;;;Ladda upp fil			   Lista (med) regexpar
;;;;Lista filarean			   Lista filter
;;;;Lista klienter			   Lista meddelanden
;;;;Lista medlemsskap		   Lista mten
;;;;Lista nyheter			   Lista personer
;;;;Lista renden			   Lsa nsta inlgg
;;;;Lngsamma kommandon		   Markera (inlgg)
;;;;Personligt svar			   Personligt svar p fregende inlgg
;;;;Prioritera mten		   Radera inlgg
;;;;Radera meddelanden		   Se tiden
;;;;Skapa mte			   Skicka brev
;;;;Skriva ett inlgg		   Sluta
;;;;Snabba kommandon		   Spara text (p fil)
;;;;Spara variabler			   Status (fr) mte
;;;;Status (fr) person		   Status (fr) session
;;;;Subtrahera kommentar		   Subtrahera mottagare
;;;;Superhoppa			   Snda meddelande
;;;;Stt lapp p drren		   Stt lsniv
;;;;Ta bort lapp p drren		   Uppskjuta lsning
;;;;Uteslut medlem			   Utplna
;;;;Uttrda ur mte			   Var (r) jag
;;;;Vilka r inloggade		   Visa user-arean
;;;;Vnta p ett inlgg		   ndra filter
;;;;ndra livslngd			   ndra lsenord
;;;;ndra mtestyp			   ndra namn
;;;;ndra organisatr		   ndra presentation
;;;;ndra supermte			   ndra svarsmeddelande
;;;;ndra tilltna frfattare	   ndra variabler
;;;;terse alla			   terse alla kommentarer
;;;;terse alla kommentarer rekursivt  terse alla markerade
;;;;terse det fregende kommenterade
;;;;terse det kommenterade		   terse frsta
;;;;terse hoppa			   terse igen
;;;;terse inlgg			   terse lista
;;;;terse markerade		   terse nsta
;;;;terse omodifierat		   terse presentation
;;;;terse senaste			   terse trd
;;;;terse urinlgget		   terstarta kom
;;;;verg till administratrsmod