1 ;; pc-win.el -- setup support for `PC windows' (whatever that is).
3 ;; Copyright (C) 1994 Free Software Foundation, Inc.
5 ;; Author: Morten Welinder <terra@diku.dk>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 ;; ---------------------------------------------------------------------------
24 (load "term/internal" nil t)
26 ;; Color translation -- doesn't really need to be fast
28 (defvar msdos-color-aliases
29 '(("purple" . "magenta")
30 ("firebrick" . "red") ; ?
32 ("royalblue" . "blue")
33 ("cadetblue" . "blue")
34 ("forestgreen" . "green")
35 ("darkolivegreen" . "green")
36 ("darkgoldenrod" . "brown")
37 ("goldenrod" . "yellow")
38 ("grey40" . "darkgray")
39 ("rosybrown" . "brown")
40 ("blue" . "lightblue") ;; from here: for Enriched Text
41 ("darkslategray" . "darkgray")
43 ("light blue" . "lightblue") ;; from here: for cpp-highlight
44 ("light cyan" . "lightcyan")
45 ("light yellow" . "yellow")
46 ("light pink" . "lightred")
47 ("pale green" . "lightgreen")
49 ("medium purple" . "magenta")
50 ("turquoise" . "lightgreen")
51 ("violet" . "magenta"))
52 "List of alternate names for colors.")
54 (defun msdos-color-translate (name)
55 (setq name (downcase name))
56 (let* ((len (length name))
65 ("lightgray" . 7) ("light gray" . 7)
66 ("darkgray" . 8) ("dark gray" . 8)
76 (and (setq try (cdr (assoc name msdos-color-aliases)))
77 (msdos-color-translate try))
79 (string= "light" (substring name 0 4))
80 (setq try (msdos-color-translate (substring name 5)))
83 (string= "light " (substring name 0 5))
84 (setq try (msdos-color-translate (substring name 6)))
87 (string= "dark" (substring name 0 3))
88 (msdos-color-translate (substring name 4)))
90 (string= "dark " (substring name 0 4))
91 (msdos-color-translate (substring name 5))))))
92 ;; ---------------------------------------------------------------------------
93 ;; We want to delay setting frame parameters until the faces are setup
94 (defvar default-frame-alist nil)
96 (defun msdos-face-setup ()
97 (modify-frame-parameters (selected-frame) default-frame-alist)
99 (set-face-foreground 'bold "yellow")
100 (set-face-foreground 'italic "red")
101 (set-face-foreground 'bold-italic "lightred")
102 (set-face-foreground 'underline "white")
103 (set-face-background 'region "green")
105 (make-face 'msdos-menu-active-face)
106 (make-face 'msdos-menu-passive-face)
107 (make-face 'msdos-menu-select-face)
108 (set-face-foreground 'msdos-menu-active-face "white")
109 (set-face-foreground 'msdos-menu-passive-face "lightgray")
110 (set-face-background 'msdos-menu-active-face "blue")
111 (set-face-background 'msdos-menu-passive-face "blue")
112 (set-face-background 'msdos-menu-select-face "red"))
114 ;; We have only one font, so...
115 (add-hook 'before-init-hook 'msdos-face-setup)
116 ;; ---------------------------------------------------------------------------
117 ;; More or less useful imitations of certain X-functions. A lot of the
118 ;; values returned are questionable, but usually only the form of the
119 ;; returned value matters. Also, by the way, recall that `ignore' is
120 ;; a useful function for returning 'nil regardless of argument.
123 (defun x-display-color-p (&optional display) 't)
124 (fset 'focus-frame 'ignore)
125 (fset 'unfocus-frame 'ignore)
126 (defun x-list-fonts (pattern &optional face frame) (list "default"))
127 (defun x-color-defined-p (color) (numberp (msdos-color-translate color)))
128 (defun x-display-pixel-width (&optional frame) (* 8 (frame-width frame)))
129 (defun x-display-pixel-height (&optional frame) (* 8 (frame-height frame)))
130 (defun x-display-planes (&optional frame) 4) ; 3 for background, actually
131 (defun x-display-color-cells (&optional frame) 16) ; ???
132 (defun x-server-max-request-size (&optional frame) 1000000) ; ???
133 (defun x-server-vendor (&optional frame) t "GNU")
134 (defun x-server-version (&optional frame) '(1 0 0))
135 (defun x-display-screens (&optional frame) 1)
136 (defun x-display-mm-height (&optional frame) 200) ; Guess the size of my
137 (defun x-display-mm-width (&optional frame) 253) ; monitor, MW...
138 (defun x-display-backing-store (&optional frame) 'not-useful)
139 (defun x-display-visual-class (&optional frame) 'static-color)
140 (fset 'x-display-save-under 'ignore)
141 (fset 'x-get-resource 'ignore)
143 ;; From lisp/term/x-win.el
144 (setq x-display-name "pc")
145 (setq split-window-keep-point t)
147 ;; From lisp/select.el
148 (defun x-get-selection (&rest rest) "")
149 (fset 'x-set-selection 'ignore)
151 ;; From lisp/faces.el: we only have one font, so always return
152 ;; it, no matter which variety they've asked for.
153 (defun x-frob-font-slant (font which)
156 ;; From lisp/frame.el
157 (fset 'set-default-font 'ignore)
158 (fset 'set-mouse-color 'ignore) ; We cannot, I think.
159 (fset 'set-cursor-color 'ignore) ; Hardware determined by char under.
160 (fset 'set-border-color 'ignore) ; Not useful.
161 (fset 'auto-raise-mode 'ignore)
162 (fset 'auto-lower-mode 'ignore)
163 (defun set-background-color (color-name)
164 "Set the background color of the selected frame to COLOR.
165 When called interactively, prompt for the name of the color to use."
166 (interactive "sColor: ")
167 (modify-frame-parameters (selected-frame)
168 (list (cons 'background-color color-name))))
169 (defun set-foreground-color (color-name)
170 "Set the foreground color of the selected frame to COLOR.
171 When called interactively, prompt for the name of the color to use."
172 (interactive "sColor: ")
173 (modify-frame-parameters (selected-frame)
174 (list (cons 'foreground-color color-name))))
175 ;; ---------------------------------------------------------------------------
176 ;; Handle the X-like command line parameters "-fg" and "-bg"
177 (defun msdos-handle-args (args)
180 (let ((this (car args)))
181 (setq args (cdr args))
182 (cond ((or (string= this "-fg") (string= this "-foreground"))
184 (setq default-frame-alist
185 (cons (cons 'foreground-color (car args))
188 ((or (string= this "-bg") (string= this "-background"))
190 (setq default-frame-alist
191 (cons (cons 'background-color (car args))
194 (t (setq rest (cons this rest))))))
197 (setq command-line-args (msdos-handle-args command-line-args))
198 ;; ---------------------------------------------------------------------------
199 ;; XEmacs always has faces