Commit 603bb798 authored by David Byers's avatar David Byers
Browse files

Fixed bug 983 (show supervised conferences with different font)

Detailed changes:
> 	Fix bug 983:
> 	* vars.el.in (kom-highlight-conferences): Added highlighting of no
> 	presentation and supervised conferences to the default.
>
> 	* faces.el (kom-active-strikethrough-face): New face.
> 	(kom-active-highlight-face): New face.
> 	(kom-face--default--active-strikethrough-face): New face.
> 	(kom-face--default--active-highlight-face): New face.
> 	(kom-face--user-defined--active-strikethrough-face): New face.
> 	(kom-face--user-defined--active-highlight-face): New face.
>
> 	* lyskom-buttons.el (lyskom-highlight-has-no-presentation): New
> 	function.
> 	(lyskom-highlight-i-am-supervisor): New function.
> 	(lyskom-highlight-function-get-conf-stat): New function.
>
> 	* option-edit.el (lyskom-face-widget): Handle explicit list of
> 	faces.
>
> 	* lyskom-buttons.el (lyskom-default-button): Pass
> 	conf-stat/uconf-stat/whatever to lyskom-default-button. Use
> 	uconf-stat instead of conf-stat when looking in the cache.
> 	(lyskom-generate-button): Support functions in
> 	kom-highlight-conferences.
>
parent ca205c38
2003-03-16 David Byers <david.byers@swipnet.se>
Fix bug 983:
* vars.el.in (kom-highlight-conferences): Added highlighting of no
presentation and supervised conferences to the default.
* faces.el (kom-active-strikethrough-face): New face.
(kom-active-highlight-face): New face.
(kom-face--default--active-strikethrough-face): New face.
(kom-face--default--active-highlight-face): New face.
(kom-face--user-defined--active-strikethrough-face): New face.
(kom-face--user-defined--active-highlight-face): New face.
* lyskom-buttons.el (lyskom-highlight-has-no-presentation): New
function.
(lyskom-highlight-i-am-supervisor): New function.
(lyskom-highlight-function-get-conf-stat): New function.
* option-edit.el (lyskom-face-widget): Handle explicit list of
faces.
* lyskom-buttons.el (lyskom-default-button): Pass
conf-stat/uconf-stat/whatever to lyskom-default-button. Use
uconf-stat instead of conf-stat when looking in the cache.
(lyskom-generate-button): Support functions in
kom-highlight-conferences.
Fixed bug 984:
* commands1.el (lyskom-get-marked-texts): New function.
(lyskom-review-marked-texts): Use it.
......
......@@ -2857,7 +2857,8 @@ Select whether to execute command or keyboard macro.")
(link-fold-case . "Case insensitive")
(generated-face . "Automatic")
(fonts . "Fonts\n")
(predefined-fonts . "Fonts intended for specific uses\n")
(other-fonts . "Fonts with no specific uses\n")
(other-face . "Other")
(ext-simple-command . "Simple command")
......@@ -2870,6 +2871,8 @@ Select whether to execute command or keyboard macro.")
(morons . "Morons and other \"special\" people")
(friends . "Friends and other special people")
(me . "Mig, myself and I")
(i-am-supervisor . "Conferences i supervise")
(has-no-presentation . "Conferences without presentations")
(highlight-conferences . "Conferences:")
(highlight-face . "Face:")
(highlight-conflist . "Conference list")
......@@ -3828,7 +3831,12 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
(kom-active-face-doc . "\
Face used for clickable areas other than URLs, conference and person
names, friends, morons and text numbers..")
names, friends, morons and text numbers.")
(kom-active-highlight-face-doc . "\
Face intended for clickable areas that are to be highlighted.")
(kom-active-strikethrough-face-doc . "\
Face intended for clickable areas that are to be indicated with
strikethrough.")
(kom-url-face-doc . "\
Face used for clickable URLs.")
(kom-me-face-doc . "\
......@@ -4081,6 +4089,8 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
(kom-text-links-tag . "Text links:")
(kom-active-face-tag . "Other clickable areas:")
(kom-active-highlight-face-tag . "Highlighted clickable areas:")
(kom-active-strikethrough-face-tag . "Struck-through clickable areas:")
(kom-url-face-tag . "Clickable URLs:")
(kom-me-face-tag . "My own name:")
(kom-highlight-face-tag . "Mouseover highlight:")
......
......@@ -94,6 +94,24 @@
The value should be either a symbol naming a face or nil.
The default value is kom-face--default--active-face.
This is a LysKOM face variable."
server
inherited)
(def-kom-var kom-active-strikethrough-face 'kom-face--default--active-strikethrough-face
"*Face used for some \"clickable\" areas.
The value should be either a symbol naming a face or nil.
The default value is kom-face--default--active-strikethrough-face.
This is a LysKOM face variable."
server
inherited)
(def-kom-var kom-active-highlight-face 'kom-face--default--active-highlight-face
"*Face used for some \"clickable\" areas.
The value should be either a symbol naming a face or nil.
The default value is kom-face--default--active-highlight-face.
This is a LysKOM face variable."
server
inherited)
......@@ -429,6 +447,36 @@ Do not alter this face unless you know what you're doing."
:group 'lyskom-faces
)
(defface kom-face--default--active-strikethrough-face
'((((background light))
(:foreground "blue4"
:strike-through t)
)
(((background dark))
(:foreground "lightblue"
:strike-through t)
)
)
"Face suitable for some \"clickable\" areas.
Do not alter this face unless you know what you're doing."
:group 'lyskom-faces
)
(defface kom-face--default--active-highlight-face
'((((background light))
(:foreground "blue4"
:weight bold)
)
(((background dark))
(:foreground "lightblue"
:weight bold)
)
)
"Face suitable for some \"clickable\" areas.
Do not alter this face unless you know what you're doing."
:group 'lyskom-faces
)
(defface kom-face--default--url-face
'((((background light))
......@@ -594,6 +642,35 @@ Do not change this face unless you know what you're doing."
)
(defface kom-face--user-defined--active-strikethrough-face
'((((background light))
(:foreground "blue4"
:strike-through t)
)
(((background dark))
(:foreground "lightblue"
:strike-through t)
)
)
"Face suitable for some \"clickable\" areas."
:group 'lyskom-faces
)
(defface kom-face--user-defined--active-highlight-face
'((((background light))
(:foreground "blue4"
:weight bold)
)
(((background dark))
(:foreground "lightblue"
:weight bold)
)
)
"Face suitable for some \"clickable\" areas."
:group 'lyskom-faces
)
(defface kom-face--user-defined--url-face
'((((background light))
(:foreground "blueviolet")
......@@ -769,6 +846,11 @@ Do not change this face unless you know what you're doing."
kom-face--user-defined--async-text-body-face))
(kom-async-dashed-lines-face . (kom-face--default--async-dashed-lines-face
kom-face--user-defined--async-dashed-lines-face))
(kom-active-highlight-face . (kom-face--default--active-highlight-face
kom-face--user-defined--active-highlight-face))
(kom-active-strikethrough-face . (kom-face--default--active-strikethrough-face
kom-face--user-defined--active-strikethrough-face))
)
"Alist of predefined faces suitable for each face variable.
Used for customization and nothing else."
......
......@@ -466,13 +466,15 @@ kom-next- and -previous-link won't notice the button"
(t -1)))
(numarg (cond ((numberp arg) arg)
((stringp arg) (string-to-number arg))
((lyskom-conf-stat-p arg) (conf-stat->conf-no arg))
((lyskom-uconf-stat-p arg) (uconf-stat->conf-no arg))
((lyskom-pers-stat-p arg) (pers-stat->pers-no arg))
(t nil)))
(data (assq type lyskom-button-actions))
(hints (and data (elt data 4)))
(the-hint (lyskom-get-button-hint hints))
(props
(cond ((and (memq type '(conf pers))
numarg)
(cond ((and (memq type '(conf pers)) numarg)
(list 'face
(or face
(or
......@@ -494,6 +496,13 @@ kom-next- and -previous-link won't notice the button"
((and (symbolp (cdr el))
(boundp (cdr el)))
(symbol-value (cdr el))))))
((and (functionp (car el))
(funcall (car el) arg))
(lyskom-traverse-break
(cond ((facep (cdr el)) (cdr el))
((and (symbolp (cdr el))
(boundp (cdr el)))
(symbol-value (cdr el))))))
((and (listp (car el))
(memq numarg (car el)))
(lyskom-traverse-break
......@@ -540,9 +549,9 @@ kom-next- and -previous-link won't notice the button"
(cons 'lyskom-button-hint
(cons the-hint props))
props))))
(defun lyskom-default-button (type arg &optional menu-title)
"Generate a button of type TYPE from data in ARG. ARG can be almost any
......@@ -557,45 +566,49 @@ up."
(cond ((lyskom-conf-stat-p arg)
(if (conf-type->letterbox (conf-stat->conf-type arg))
(setq type 'pers))
(setq xarg (conf-stat->conf-no arg)
(setq xarg arg
text (conf-stat->name arg)))
((lyskom-uconf-stat-p arg)
(if (conf-type->letterbox (uconf-stat->conf-type arg))
(setq type 'pers))
(setq xarg (uconf-stat->conf-no arg)
(setq xarg arg
text (uconf-stat->name arg)))
((numberp arg)
(if (setq xarg (cache-get-conf-stat arg))
(if (setq xarg (cache-get-uconf-stat arg))
(progn
(if (conf-type->letterbox
(conf-stat->conf-type xarg))
(uconf-stat->conf-type xarg))
(setq type 'pers))
(setq text (conf-stat->name xarg))
(setq xarg (conf-stat->conf-no xarg)))
(setq text ""
xarg arg)))
(setq text (uconf-stat->name xarg))
(setq xarg arg))
(setq text "" xarg arg)))
(t (setq text "" xarg 0))))
((eq type 'pers)
(cond ((lyskom-conf-stat-p arg)
(setq xarg (conf-stat->conf-no arg)
(setq xarg arg
text (conf-stat->name arg)))
((lyskom-uconf-stat-p arg)
(setq xarg (uconf-stat->conf-no arg)
(setq xarg arg
text (uconf-stat->name arg)))
((lyskom-pers-stat-p arg)
(setq xarg (pers-stat->pers-no arg)
text
(or (conf-stat->name
(cache-get-conf-stat
(pers-stat->pers-no arg)))
"")))
(setq xarg arg
text (or (conf-stat->name
(cache-get-conf-stat
(pers-stat->pers-no arg)))
"")))
((numberp arg)
(setq text
(or (conf-stat->name
(cache-get-conf-stat arg))
"")
xarg arg))
(if (setq xarg (cache-get-uconf-stat arg))
(progn
(if (conf-type->letterbox
(uconf-stat->conf-type xarg))
(setq type 'pers))
(setq text (uconf-stat->name xarg))
(setq xarg arg))
(setq text "" xarg arg)))
(t (setq text "" xarg 0))))
((eq type 'text)
(cond ((stringp arg) (setq xarg (string-to-number arg)
text arg))
......@@ -605,6 +618,7 @@ up."
(setq xarg (text-stat->text-no arg)
text (number-to-string (text-stat->text-no arg))))
(t (setq xarg 0 text ""))))
((eq type 'url)
(setq face kom-url-face)
(cond ((stringp arg) (setq xarg nil text arg))
......@@ -1316,3 +1330,54 @@ depending on the value of `kom-lynx-terminal'."
(defun lyskom-button-apply (buf arg text)
(apply (car arg) (cdr arg)))
;;; ================================================================
;;; Functions to put in kom-highlight-conferences
(defun lyskom-highlight-function-get-conf-stat (arg)
"Try to translate ARG to a conf-stat without making server calls.
ARG may be a conf-stat, pers-stat, uconf-stat, integer or string."
(cond ((lyskom-pers-stat-p arg)
(cache-get-conf-stat (pers-stat->pers-no arg)))
((lyskom-uconf-stat-p arg)
(cache-get-conf-stat (uconf-stat->conf-no arg)))
((numberp arg)
(cache-get-conf-stat arg))
((stringp arg)
(cache-get-conf-stat (string-to-int arg)))
((lyskom-conf-stat-p arg) arg)
(t nil)))
(defun lyskom-highlight-i-am-supervisor (arg)
"Returns non-nil if lyskom-pers-no is the supervisor of ARG.
ARG interpreted by `lyskom-highlight-function-get-conf-stat'.
This function never makes server calls, so if the information required
to answer accurately is not cached, this function will return an incorrect
result (nil instead of t)."
(let ((marshal nil)
(conf-stat (lyskom-highlight-function-get-conf-stat arg)))
(when conf-stat
(let ((conf (conf-stat->supervisor conf-stat))
(result nil))
(while (and (not (memq conf marshal)) conf (not result))
(setq marshal (cons conf marshal))
(if (lyskom-try-get-membership conf t)
(setq result t)
(setq conf (conf-stat->supervisor (cache-get-conf-stat conf)))))
result))))
(defun lyskom-highlight-has-no-presentation (arg)
"Returns non-nil if lyskom-pers-no is the supervisor of CONF-STAT.
ARG is interpreted by `lyskom-highlight-function-get-conf-stat'.
This function never makes server calls, so if the information required
to answer accurately is not cached, this function will return an incorrect
result (nil instead of t)."
(eq 0 (conf-stat->presentation
(lyskom-highlight-function-get-conf-stat arg))))
......@@ -121,7 +121,7 @@
"\n\n"
section
(fonts bold centered)
(predefined-fonts bold centered)
section
"\n"
[kom-active-face]
......@@ -143,6 +143,13 @@
[kom-async-dashed-lines-face]
"\n\n"
section
(other-fonts bold centered)
section
"\n"
[kom-active-highlight-face]
[kom-active-strikethrough-face]
"\n\n"
section
(audio-cues bold centered)
section
"\n"
......@@ -667,6 +674,8 @@ customize buffer but do not save them to the server."
(repeat (cons ((choice ((const (morons kom-morons))
(const (friends kom-friends))
(const (me lyskom-pers-no))
(const (i-am-supervisor lyskom-highlight-i-am-supervisor))
(const (has-no-presentation lyskom-highlight-has-no-presentation))
(repeat (person nil :tag name)
:indent 12
:tag highlight-conflist
......@@ -676,7 +685,12 @@ customize buffer but do not save them to the server."
:tag highlight-conferences
:format "%[%t%] %v\n"
)
(face nil :tag highlight-face))
(face (kom-active-face
kom-active-highlight-face
kom-active-strikethrough-face
kom-friends-face
kom-morons-face
kom-me-face) :tag highlight-face))
:format "%v"
)
))
......@@ -809,6 +823,8 @@ customize buffer but do not save them to the server."
(kom-url-face (face))
(kom-text-no-face (face))
(kom-active-face (face))
(kom-active-highlight-face (face))
(kom-active-strikethrough-face (face))
(kom-highlight-face (face))
(kom-me-face (face))
(kom-friends-face (face))
......@@ -1083,21 +1099,24 @@ customize buffer but do not save them to the server."
:tag (symbol-name f)
:value f
:format "%t"))
(cdr (assq var lyskom-predefined-faces)))
(or
(and (listp args) args)
(cdr (assq var lyskom-predefined-faces))))
(list (list 'symbol
':size 30
':tag (lyskom-custom-string
'other-face))))))
(when args
(when (eq args t)
(setq wargs
(append (list (list 'item
:tag (lyskom-custom-string 'generated-face)
:value nil
:format "%t"))
wargs)))
(if args
(if wargs
(lyskom-build-simple-widget-spec 'menu-choice
(list ':format "%[%t%] %v\n")
(list ':format "%[%t%] %v\n"
':args wargs)
propl)
(lyskom-build-simple-widget-spec 'symbol
(list ':format "%[%t%] %v\n"
......
......@@ -2973,7 +2973,8 @@ teckenkodning.
(link-fold-case . "Versaler och gemener lika")
(generated-face . "Automatgenererat teckensnitt")
(fonts . "Teckensnitt\n")
(predefined-fonts . "Teckensnitt avsedda fr specifika tillmpningar\n")
(other-fonts . "Teckensnitt utan specifika tillmpningar\n")
(other-face . "Annat")
(ext-simple-command . "Enkelt kommando")
......@@ -2986,6 +2987,8 @@ teckenkodning.
(morons . "Idioter och knppskallar")
(friends . "Vnner och bekanta")
(me . "Mig sjlv och ingen annan")
(i-am-supervisor . "Mten jag organiserar")
(has-no-presentation . "Mten utan presentationer")
(highlight-conferences . "Mten:")
(highlight-face . "Utseende:")
(highlight-conflist . "Mteslista")
......@@ -3951,6 +3954,12 @@ i servern. Annars sparas det i din .emacs.")
Teckensnitt fr klickbara texter frutom URLer, mten, vnner och
bekanta, idioter och knppskallar, och inlggsnummer. Vrdet skall
vara namnet p en s kallad `face'.")
(kom-active-highlight-face-doc . "\
Teckensnitt avsett fr klickbara texter som skall markeras extra
tydligt. Vrdet skall vara namnet p en s kallad `face'.")
(kom-active-strikethrough-face-doc . "\
Teckensnitt avsett fr klickbara texter som skall markeras extra
tydligt. Vrdet skall vara namnet p en s kallad `face'.")
(kom-url-face-doc . "\
Teckensnitt fr klickbara URLer.")
(kom-me-face-doc . "\
......@@ -4203,6 +4212,8 @@ i servern. Annars sparas det i din .emacs.")
(kom-url-transformation-rules-tag . "Transformation av URLer:")
(kom-text-links-tag . "Textlnkar:")
(kom-active-face-tag . "vriga klickbara texter:")
(kom-active-highlight-face-tag . "Tydligare markerade klickbara texter:")
(kom-active-strikethrough-face-tag . "verstrukna klickbara texter:")
(kom-url-face-tag . "Klickbara URLer:")
(kom-me-face-tag . "Mitt eget namn:")
(kom-highlight-face-tag . "Markering av klickbara ytor:")
......
......@@ -1316,6 +1316,7 @@ Cannot be called from a callback."
((lyskom-is-member (conf-stat->supervisor conf-stat) viewer-no) t)
(t nil))))
(defun lyskom-is-member (conf-no pers-no &optional queue)
"Return the membership in CONF-NO of PERS-NO
Optional argument QUEUE is the queue to send the queries on.
......
......@@ -1650,6 +1650,8 @@ Values other than `t' and `nil' are reserved for future use."
(def-kom-var kom-highlight-conferences
'((kom-friends . kom-friends-face)
(kom-morons . kom-morons-face)
(lyskom-highlight-has-no-presentation . kom-active-strikethrough-face)
(lyskom-highlight-i-am-supervisor . kom-active-highlight-face)
(lyskom-pers-no . kom-me-face))
"**How to highlight conference an person names.
......@@ -1664,6 +1666,12 @@ The following values are legal for keys:
number is in the list. If the value is an integer,
matches if the conference number matches the integer.
List Matches if the conference number is in the list.
Function Matches if the function returns non-nil (see below).
When using a function as the key, the function will be called with a
single argument, the object to be printed. The type of the argument
will vary depending on how it is printed. Functions should be written
so they work regardless of what is passed to them.
All other values are reserved for future use."
server)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment