2001-07-15 16:15:35 +00:00
|
|
|
;;; pc-win.el --- setup support for `PC windows' (whatever that is)
|
1994-10-17 08:04:13 +00:00
|
|
|
|
2005-08-01 15:47:19 +00:00
|
|
|
;; Copyright (C) 1994, 1996, 1997, 1999, 2001, 2002, 2003, 2004,
|
2006-02-06 12:31:40 +00:00
|
|
|
;; 2005, 2006 Free Software Foundation, Inc.
|
1994-10-17 08:04:13 +00:00
|
|
|
|
|
|
|
;; Author: Morten Welinder <terra@diku.dk>
|
1996-03-02 06:37:35 +00:00
|
|
|
;; Maintainer: FSF
|
1994-10-17 08:04:13 +00:00
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
;; GNU Emacs 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.
|
|
|
|
|
|
|
|
;; GNU Emacs 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
|
1996-01-14 09:58:28 +00:00
|
|
|
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
2005-07-04 16:49:24 +00:00
|
|
|
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
;; Boston, MA 02110-1301, USA.
|
1996-01-14 09:58:28 +00:00
|
|
|
|
2001-07-15 16:15:35 +00:00
|
|
|
;;; Commentary:
|
|
|
|
|
1996-01-14 09:58:28 +00:00
|
|
|
;;; Code:
|
|
|
|
|
1994-10-17 08:04:13 +00:00
|
|
|
(load "term/internal" nil t)
|
|
|
|
|
1999-07-30 08:51:19 +00:00
|
|
|
;;; This is copied from etc/rgb.txt, except that some values were changed
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
;;; a bit to make them consistent with DOS console colors, and the RGB
|
|
|
|
;;; values were scaled up to 16 bits, as `tty-define-color' requires.
|
|
|
|
;;;
|
|
|
|
;;; The mapping between the 16 standard EGA/VGA colors and X color names
|
|
|
|
;;; was done by running a Unix version of Emacs inside an X client and a
|
|
|
|
;;; DJGPP-compiled Emacs on the same PC. The names of X colors used to
|
|
|
|
;;; define the pixel values are shown as comments to each color below.
|
1999-07-30 08:51:19 +00:00
|
|
|
;;;
|
|
|
|
;;; If you want to change the RGB values, keep in mind that various pieces
|
|
|
|
;;; of Emacs think that a color whose RGB values add up to less than 0.6 of
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
;;; the values for WHITE (i.e. less than 117963) are ``dark'', otherwise the
|
1999-07-30 08:51:19 +00:00
|
|
|
;;; color is ``light''; see `frame-set-background-mode' in lisp/faces.el for
|
|
|
|
;;; an example.
|
|
|
|
(defvar msdos-color-values
|
2002-01-25 13:13:02 +00:00
|
|
|
'(("black" 0 0 0 0)
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
("blue" 1 0 0 52480) ; MediumBlue
|
2002-01-25 13:13:02 +00:00
|
|
|
("green" 2 8704 35584 8704) ; ForestGreen
|
|
|
|
("cyan" 3 0 52736 53504) ; DarkTurquoise
|
|
|
|
("red" 4 45568 8704 8704) ; FireBrick
|
|
|
|
("magenta" 5 35584 0 35584) ; DarkMagenta
|
|
|
|
("brown" 6 40960 20992 11520) ; Sienna
|
|
|
|
("lightgray" 7 48640 48640 48640) ; Gray
|
|
|
|
("darkgray" 8 26112 26112 26112) ; Gray40
|
|
|
|
("lightblue" 9 0 0 65535) ; Blue
|
|
|
|
("lightgreen" 10 0 65535 0) ; Green
|
|
|
|
("lightcyan" 11 0 65535 65535) ; Cyan
|
|
|
|
("lightred" 12 65535 0 0) ; Red
|
|
|
|
("lightmagenta" 13 65535 0 65535) ; Magenta
|
|
|
|
("yellow" 14 65535 65535 0) ; Yellow
|
|
|
|
("white" 15 65535 65535 65535))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
"A list of MS-DOS console colors, their indices and 16-bit RGB values.")
|
1999-02-01 13:25:12 +00:00
|
|
|
|
1994-10-17 08:04:13 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
;; We want to delay setting frame parameters until the faces are setup
|
|
|
|
(defvar default-frame-alist nil)
|
1996-06-10 21:19:59 +00:00
|
|
|
(modify-frame-parameters terminal-frame default-frame-alist)
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(tty-color-clear)
|
1994-10-17 08:04:13 +00:00
|
|
|
|
|
|
|
(defun msdos-face-setup ()
|
1996-06-10 21:19:59 +00:00
|
|
|
(set-face-foreground 'bold "yellow" terminal-frame)
|
|
|
|
(set-face-foreground 'italic "red" terminal-frame)
|
|
|
|
(set-face-foreground 'bold-italic "lightred" terminal-frame)
|
|
|
|
(set-face-foreground 'underline "white" terminal-frame)
|
1994-10-17 08:04:13 +00:00
|
|
|
|
|
|
|
(make-face 'msdos-menu-active-face)
|
|
|
|
(make-face 'msdos-menu-passive-face)
|
|
|
|
(make-face 'msdos-menu-select-face)
|
1996-06-10 21:19:59 +00:00
|
|
|
(set-face-foreground 'msdos-menu-active-face "white" terminal-frame)
|
|
|
|
(set-face-foreground 'msdos-menu-passive-face "lightgray" terminal-frame)
|
|
|
|
(set-face-background 'msdos-menu-active-face "blue" terminal-frame)
|
|
|
|
(set-face-background 'msdos-menu-passive-face "blue" terminal-frame)
|
1997-08-11 01:18:29 +00:00
|
|
|
(set-face-background 'msdos-menu-select-face "red" terminal-frame))
|
1994-10-17 08:04:13 +00:00
|
|
|
|
|
|
|
(add-hook 'before-init-hook 'msdos-face-setup)
|
1996-06-10 21:19:59 +00:00
|
|
|
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(defun msdos-handle-reverse-video (frame parameters)
|
|
|
|
"Handle the reverse-video frame parameter on MS-DOS frames."
|
2001-03-02 13:34:48 +00:00
|
|
|
(when (cdr (or (assq 'reverse parameters)
|
|
|
|
(assq 'reverse default-frame-alist)))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(let* ((params (frame-parameters frame))
|
2000-10-16 19:17:35 +00:00
|
|
|
(fg (cdr (assq 'foreground-color params)))
|
|
|
|
(bg (cdr (assq 'background-color params))))
|
|
|
|
(if (equal fg (cdr (assq 'mouse-color params)))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(modify-frame-parameters frame
|
2000-10-16 19:17:35 +00:00
|
|
|
(list (cons 'mouse-color bg))))
|
|
|
|
(if (equal fg (cdr (assq 'cursor-color params)))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(modify-frame-parameters frame
|
2000-10-16 19:17:35 +00:00
|
|
|
(list (cons 'cursor-color bg)))))))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
|
|
|
|
;; This must run after all the default colors are inserted into
|
|
|
|
;; tty-color-alist, since msdos-handle-reverse-video needs to know the
|
|
|
|
;; actual frame colors. tty-color-alist is set up by startup.el, but
|
|
|
|
;; only after it runs before-init-hook and after-init-hook.
|
|
|
|
(defun msdos-setup-initial-frame ()
|
|
|
|
(modify-frame-parameters terminal-frame default-frame-alist)
|
|
|
|
;; This remembers the screen colors after applying default-frame-alist,
|
|
|
|
;; so that all subsequent frames could begin with those colors.
|
|
|
|
(msdos-remember-default-colors terminal-frame)
|
|
|
|
(modify-frame-parameters terminal-frame initial-frame-alist)
|
|
|
|
(msdos-handle-reverse-video terminal-frame
|
|
|
|
(frame-parameters terminal-frame))
|
|
|
|
|
|
|
|
(frame-set-background-mode terminal-frame)
|
|
|
|
(face-set-after-frame-default terminal-frame))
|
|
|
|
|
|
|
|
(add-hook 'term-setup-hook 'msdos-setup-initial-frame)
|
|
|
|
|
1996-06-10 21:19:59 +00:00
|
|
|
;; We create frames as if we were a terminal, but with a twist.
|
|
|
|
(defun make-msdos-frame (&optional parameters)
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(let ((frame (make-terminal-frame parameters))
|
|
|
|
success)
|
1999-08-10 10:21:18 +00:00
|
|
|
(unwind-protect
|
|
|
|
(progn
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(msdos-handle-reverse-video frame (frame-parameters frame))
|
1999-08-10 10:21:18 +00:00
|
|
|
(frame-set-background-mode frame)
|
|
|
|
(face-set-after-frame-default frame)
|
|
|
|
(setq success t))
|
|
|
|
(unless success (delete-frame frame)))
|
1997-07-13 20:52:08 +00:00
|
|
|
frame))
|
1996-06-10 21:19:59 +00:00
|
|
|
|
|
|
|
(setq frame-creation-function 'make-msdos-frame)
|
|
|
|
|
1994-10-17 08:04:13 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
1996-01-05 22:21:28 +00:00
|
|
|
;; More or less useful imitations of certain X-functions. A lot of the
|
1994-10-17 08:04:13 +00:00
|
|
|
;; values returned are questionable, but usually only the form of the
|
|
|
|
;; returned value matters. Also, by the way, recall that `ignore' is
|
|
|
|
;; a useful function for returning 'nil regardless of argument.
|
|
|
|
|
|
|
|
;; From src/xfns.c
|
1997-08-07 17:33:49 +00:00
|
|
|
(defun x-list-fonts (pattern &optional face frame maximum width)
|
1999-08-15 11:42:08 +00:00
|
|
|
(if (or (null width) (and (numberp width) (= width 1)))
|
|
|
|
(list "ms-dos")
|
1997-08-07 17:33:49 +00:00
|
|
|
(list "no-such-font")))
|
1996-02-08 17:49:24 +00:00
|
|
|
(defun x-display-pixel-width (&optional frame) (frame-width frame))
|
|
|
|
(defun x-display-pixel-height (&optional frame) (frame-height frame))
|
1999-08-15 11:42:08 +00:00
|
|
|
(defun x-display-planes (&optional frame) 4) ;bg switched to 16 colors as well
|
|
|
|
(defun x-display-color-cells (&optional frame) 16)
|
1994-10-17 08:04:13 +00:00
|
|
|
(defun x-server-max-request-size (&optional frame) 1000000) ; ???
|
|
|
|
(defun x-server-vendor (&optional frame) t "GNU")
|
|
|
|
(defun x-server-version (&optional frame) '(1 0 0))
|
|
|
|
(defun x-display-screens (&optional frame) 1)
|
1999-08-15 11:42:08 +00:00
|
|
|
(defun x-display-mm-height (&optional frame) 245) ; Guess the size of my
|
|
|
|
(defun x-display-mm-width (&optional frame) 322) ; monitor, EZ...
|
1994-10-17 08:04:13 +00:00
|
|
|
(defun x-display-backing-store (&optional frame) 'not-useful)
|
|
|
|
(defun x-display-visual-class (&optional frame) 'static-color)
|
|
|
|
(fset 'x-display-save-under 'ignore)
|
|
|
|
(fset 'x-get-resource 'ignore)
|
1998-10-14 15:11:12 +00:00
|
|
|
|
1994-10-17 08:04:13 +00:00
|
|
|
;; From lisp/term/x-win.el
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(defvar x-display-name "pc"
|
|
|
|
"The display name specifying the MS-DOS display and frame type.")
|
1994-10-17 08:04:13 +00:00
|
|
|
(setq split-window-keep-point t)
|
1999-08-15 11:42:08 +00:00
|
|
|
(defvar x-colors (mapcar 'car msdos-color-values)
|
1996-01-02 23:04:42 +00:00
|
|
|
"The list of colors available on a PC display under MS-DOS.")
|
1999-07-30 08:51:19 +00:00
|
|
|
|
1998-04-22 13:45:00 +00:00
|
|
|
;; From lisp/term/w32-win.el
|
1997-04-15 15:00:38 +00:00
|
|
|
;
|
|
|
|
;;;; Selections and cut buffers
|
1996-01-02 23:04:42 +00:00
|
|
|
;
|
1997-04-15 15:00:38 +00:00
|
|
|
;;; We keep track of the last text selected here, so we can check the
|
|
|
|
;;; current selection against it, and avoid passing back our own text
|
|
|
|
;;; from x-cut-buffer-or-selection-value.
|
|
|
|
(defvar x-last-selected-text nil)
|
|
|
|
|
2000-12-02 11:21:44 +00:00
|
|
|
(defcustom x-select-enable-clipboard t
|
|
|
|
"Non-nil means cutting and pasting uses the clipboard.
|
|
|
|
This is the default on this system, since MS-Windows does not
|
|
|
|
support other types of selections."
|
|
|
|
:type 'boolean
|
|
|
|
:group 'killing)
|
1997-04-15 15:00:38 +00:00
|
|
|
|
|
|
|
(defun x-select-text (text &optional push)
|
2003-02-04 13:30:45 +00:00
|
|
|
(if x-select-enable-clipboard
|
1998-04-22 13:45:00 +00:00
|
|
|
(w16-set-clipboard-data text))
|
1997-04-15 15:00:38 +00:00
|
|
|
(setq x-last-selected-text text))
|
2003-02-04 13:30:45 +00:00
|
|
|
|
1997-04-15 15:00:38 +00:00
|
|
|
;;; Return the value of the current selection.
|
|
|
|
;;; Consult the selection, then the cut buffer. Treat empty strings
|
|
|
|
;;; as if they were unset.
|
|
|
|
(defun x-get-selection-value ()
|
2003-02-04 13:30:45 +00:00
|
|
|
(if x-select-enable-clipboard
|
1997-04-15 15:00:38 +00:00
|
|
|
(let (text)
|
|
|
|
;; Don't die if x-get-selection signals an error.
|
|
|
|
(condition-case c
|
1998-04-22 13:45:00 +00:00
|
|
|
(setq text (w16-get-clipboard-data))
|
|
|
|
(error (message "w16-get-clipboard-data:%s" c)))
|
1997-04-15 15:00:38 +00:00
|
|
|
(if (string= text "") (setq text nil))
|
|
|
|
(cond
|
|
|
|
((not text) nil)
|
|
|
|
((eq text x-last-selected-text) nil)
|
|
|
|
((string= text x-last-selected-text)
|
|
|
|
;; Record the newer string, so subsequent calls can use the 'eq' test.
|
|
|
|
(setq x-last-selected-text text)
|
|
|
|
nil)
|
|
|
|
(t
|
|
|
|
(setq x-last-selected-text text))))))
|
|
|
|
|
|
|
|
;;; Arrange for the kill and yank functions to set and check the clipboard.
|
|
|
|
(setq interprogram-cut-function 'x-select-text)
|
|
|
|
(setq interprogram-paste-function 'x-get-selection-value)
|
1994-10-17 08:04:13 +00:00
|
|
|
|
1995-11-22 13:44:42 +00:00
|
|
|
;; From lisp/faces.el: we only have one font, so always return
|
|
|
|
;; it, no matter which variety they've asked for.
|
|
|
|
(defun x-frob-font-slant (font which)
|
|
|
|
font)
|
2001-10-26 21:27:19 +00:00
|
|
|
(make-obsolete 'x-frob-font-slant 'make-face-... "21.1")
|
1999-08-15 11:42:08 +00:00
|
|
|
(defun x-frob-font-weight (font which)
|
|
|
|
font)
|
2001-10-26 21:27:19 +00:00
|
|
|
(make-obsolete 'x-frob-font-weight 'make-face-... "21.1")
|
1999-08-15 11:42:08 +00:00
|
|
|
(defun x-font-family-list ()
|
|
|
|
"Return a list of available font families on FRAME.\n\
|
|
|
|
If FRAME is omitted or nil, use the selected frame.\n\
|
|
|
|
Value is a list of conses (FAMILY . FIXED-P) where FAMILY\n\
|
|
|
|
is a font family, and FIXED-P is non-nil if fonts of that family\n\
|
|
|
|
are fixed-pitch."
|
|
|
|
'(("default" . t)))
|
1995-11-22 13:44:42 +00:00
|
|
|
|
1997-08-07 17:33:49 +00:00
|
|
|
;; From src/fontset.c:
|
|
|
|
(fset 'query-fontset 'ignore)
|
|
|
|
|
1996-12-08 08:24:03 +00:00
|
|
|
;; From lisp/term/x-win.el: make iconify-or-deiconify-frame a no-op.
|
|
|
|
(fset 'iconify-or-deiconify-frame 'ignore)
|
|
|
|
|
1994-10-17 08:04:13 +00:00
|
|
|
;; From lisp/frame.el
|
|
|
|
(fset 'set-default-font 'ignore)
|
|
|
|
(fset 'set-mouse-color 'ignore) ; We cannot, I think.
|
|
|
|
(fset 'set-cursor-color 'ignore) ; Hardware determined by char under.
|
|
|
|
(fset 'set-border-color 'ignore) ; Not useful.
|
1997-10-13 16:05:32 +00:00
|
|
|
|
1994-10-17 08:04:13 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
1997-04-20 07:33:52 +00:00
|
|
|
|
2003-09-01 15:45:59 +00:00
|
|
|
;;; arch-tag: 5cbdb455-b495-427b-95d0-e417d77d00b4
|
1997-04-20 07:33:52 +00:00
|
|
|
;;; pc-win.el ends here
|