0
|
1 ;;; x-misc.el --- miscellaneous X functions.
|
|
2
|
|
3 ;;; Copyright (C) 1995 Sun Microsystems.
|
|
4 ;;; Copyright (C) 1995, 1996 Ben Wing.
|
|
5
|
|
6 ;; Author: Ben Wing <wing@666.com>
|
|
7
|
|
8 ;; This file is part of XEmacs.
|
|
9
|
|
10 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
11 ;; under the terms of the GNU General Public License as published by
|
|
12 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
13 ;; any later version.
|
|
14
|
|
15 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
18 ;; General Public License for more details.
|
|
19
|
|
20 ;; You should have received a copy of the GNU General Public License
|
70
|
21 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
22 ;; Free Software Foundation, 59 Temple Place - Suite 330,
|
|
23 ;; Boston, MA 02111-1307, USA.
|
0
|
24
|
|
25 (defun x-bogosity-check-resource (name class type)
|
|
26 "Check for a bogus resource specification."
|
|
27 (let ((bogus (x-get-resource
|
|
28 (concat "__no-such-friggin-locale__." name)
|
|
29 (concat "__No-such-friggin-widget__." class)
|
|
30 type 'global nil t)))
|
|
31 (if bogus
|
|
32 (display-warning
|
|
33 'resource
|
|
34 (format "Bad resource specification encountered: something like
|
|
35 Emacs*%s: %s
|
|
36 You should replace the * with a . in order to get proper behavior when
|
|
37 you use the specifier and/or `set-face-*' functions." name bogus)))))
|
|
38
|
|
39 (defun x-init-specifier-from-resources (specifier type locale
|
|
40 &rest resource-list)
|
|
41 "Initialize a specifier from the resource database.
|
|
42 LOCALE specifies the locale that is to be initialized and should be
|
|
43 a frame, a device, or 'global. TYPE is the type of the resource and
|
|
44 should be one of 'string, 'boolean, 'integer, or 'natnum. The
|
|
45 remaining args should be conses of names and classes of resources
|
|
46 to be examined. The first resource with a value specified becomes
|
|
47 the spec for SPECIFIER in LOCALE. (However, if SPECIFIER already
|
|
48 has a spec in LOCALE, nothing is done.) Finally, if LOCALE is 'global,
|
|
49 a check is done for bogus resource specifications."
|
|
50 (if (eq locale 'global)
|
|
51 (mapcar #'(lambda (x)
|
|
52 (x-bogosity-check-resource (car x) (cdr x) type))
|
|
53 resource-list))
|
|
54 (if (not (specifier-spec-list specifier locale))
|
|
55 (catch 'done
|
|
56 (while resource-list
|
|
57 (let* ((name (caar resource-list))
|
|
58 (class (cdar resource-list))
|
|
59 (resource
|
|
60 (x-get-resource name class type locale nil t)))
|
|
61 (if resource
|
|
62 (progn
|
|
63 (add-spec-to-specifier specifier resource locale)
|
|
64 (throw 'done t))))
|
|
65 (setq resource-list (cdr resource-list))))))
|
|
66
|
|
67 (defun x-get-resource-and-bogosity-check (name class type &optional locale)
|
|
68 (x-bogosity-check-resource name class type)
|
|
69 (x-get-resource name class type locale nil t))
|
|
70
|
|
71 ;; #### this function is not necessary.
|
|
72 (defun x-get-resource-and-maybe-bogosity-check (name class type &optional
|
|
73 locale)
|
|
74 (if (eq locale 'global)
|
|
75 (x-bogosity-check-resource name class type))
|
|
76 (x-get-resource name class type locale nil t))
|
|
77
|
|
78
|
|
79
|