menus.el 8.17 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
(defvar lyskom-menus
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
  '((menu read
	  ((item kom-view-next-text)
	   (item kom-list-news)
	   (hline review-separator)
	   (item kom-view-commented-text)
	   (item kom-view-previous-commented-text)
	   (item kom-review-comments)
	   (item kom-review-tree)
	   (item kom-find-root)
	   (hline jump-separator)
	   (item kom-jump)
	   (item kom-super-jump)
	   (item kom-set-unread)))
    (menu write
	  ((item kom-write-text)
	   (item kom-send-letter)
	   (item kom-write-comment)
	   (item kom-private-answer)
	   (item kom-comment-previous)
	   (hline send-separator)
	   (item kom-send-message)))
    (menu conference
	  ((item kom-go-to-conf)
	   (item kom-go-to-next-conf)
	   (hline info-separator)
	   (item kom-membership)
	   (item kom-list-conferences)
	   (item kom-status-conf)
	   (item kom-review-presentation)
	   (hline member-separator)
	   (item kom-add-self)
	   (item kom-sub-self)
	   (item kom-prioritize)))
    (menu person
	  ((item kom-who-is-on)
	   (item kom-status-session)
	   (hline info-separator)
	   (item kom-list-persons)
	   (item kom-status-person)
	   (item kom-review-presentation)
	   (hline change-separator)
	   (item kom-change-name)
	   (item kom-change-password))))
78
  "The menus used in LysKOM.")
Niels Möller's avatar
Niels Möller committed
79

80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
(defvar lyskom-popup-menus
  (` ((menu lyskom (, lyskom-menus))))
  "Popup-menu in the backgrouond of the LysKOM window")

;;; Gamla utseendet
;;(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.")

115 116
(defvar lyskom-edit-menus
  '((menu lyskom
117 118 119 120 121 122 123 124 125 126
	  ((item kom-edit-send)
;	   (item kom-edit-send-anonymous)
	   (hline reciever-separator)
	   (item kom-edit-add-recipient)
	   (item kom-edit-add-copy)
	   (hline comment-separator)
	   (item kom-edit-show-commented)
;	   (item kom-edit-insert-commented)
	   (hline send-separator)
	   (item kom-edit-quit))))
127
  "The menus for editing LysKOM messages.")
128 129

(defvar lyskom-menu-map nil
130
  "A keymap describing the LysKOM top menu.")
131 132 133

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

135 136 137 138 139
(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
140

141 142 143 144 145 146
(defvar lyskom-popup-menu-map nil
  "A keymap the LysKOM menu in the edit buffer.")

(when (not lyskom-popup-menu-map)
  (setq lyskom-popup-menu-map (make-sparse-keymap)))

Niels Möller's avatar
Niels Möller committed
147
(defun lyskom-build-menus ()
148 149
  "Create menus from according to LYSKOM-MENUS"
  (interactive)
150

151
  ;; Menu in lyskom-mode
Niels Möller's avatar
Niels Möller committed
152 153
  (define-key lyskom-mode-map [menu-bar]
    lyskom-menu-map)
154 155
  (define-key lyskom-mode-map [menu-bar edit]
    'undefined)
156

157
  ;; Menu in lyskom-edit-mode
158
  (lyskom-define-menu lyskom-menu-map lyskom-menus)
159 160
  (define-key lyskom-edit-mode-map [menu-bar]
    lyskom-edit-menu-map)
161 162 163 164
  (lyskom-define-menu lyskom-edit-menu-map lyskom-edit-menus)

  ;; Popup-menu
  (lyskom-define-menu lyskom-popup-menu-map lyskom-popup-menus))
Niels Möller's avatar
Niels Möller committed
165 166 167 168

(defun lyskom-define-menu (map menus)
  (when menus
    (lyskom-define-menu map (cdr menus))
169 170 171 172 173 174 175 176 177 178 179 180
    (let ((type (car (car menus)))
	  (symbol (car (cdr (car menus)))))
      (cond ((eq 'hline type)
	     (define-key map (vector symbol) '("--")))
	    ((eq 'menu type)
	     (let* ((name (lyskom-get-menu-string symbol))
		    (submap (make-sparse-keymap name)))
	       (define-key map (vector symbol)
		 (cons name submap))
	       (lyskom-define-menu submap
				   (car (cdr (cdr (car menus)))))))
	    ((eq 'item type)
Niels Möller's avatar
Niels Möller committed
181
	     (define-key map (vector symbol)
182 183
	       (cons (lyskom-get-menu-string symbol) symbol)))
	    (t (error "Menu description invalid in lyskom-define-menu"))))))
Niels Möller's avatar
Niels Möller committed
184 185

		   
186 187
(defun lyskom-background-menu (pos event)
  "Pop up a menu with LysKOM commands and execute the selected command."
188
  (let* ((menu (lookup-key lyskom-popup-menu-map [lyskom]))
189 190 191 192 193 194 195
	 (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
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253



;;;;(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