comparison lisp/faces.el @ 5624:c39052c921b5

New "foreback" face property. -------------------- ChangeLog entries follow: -------------------- lisp/ChangeLog addition: 2011-12-27 Didier Verna <didier@xemacs.org> * cl-macs.el (face-foreback): New defsetf. * faces.el (set-face-property): Document the foreback property. * faces.el (face-foreback): * faces.el (face-foreback-instance): * faces.el (face-foreback-name): * faces.el (set-face-foreback): New functions. * faces.el (face-equal): * faces.el (init-other-random-faces): * cus-face.el (custom-face-attributes): * x-faces.el (x-init-face-from-resources): Handle the foreback property. src/ChangeLog addition: 2011-12-27 Didier Verna <didier@xemacs.org> * faces.h (struct Lisp_Face): New 'foreback slot. * faces.h (struct face_cachel): New 'foreback and 'foreback_specified slots. * faces.h (WINDOW_FACE_CACHEL_FOREBACK): * faces.h (FACE_FOREBACK): New macros. * faces.c: Declare Qforeback. * lisp.h: Externalize it. * faces.c (syms_of_faces): Define it. * faces.c (vars_of_faces): Update built-in face specifiers. * faces.c (complex_vars_of_faces): Update specifier fallbacks. * faces.c (mark_face): * faces.c (face_equal): * faces.c (face_getprop): * faces.c (face_putprop): * faces.c (face_remprop): * faces.c (face_plist): * faces.c (reset_face): * faces.c (update_face_inheritance_mapper): * faces.c (Fmake_face): * faces.c (mark_face_cachels): * faces.c (update_face_cachel_data): * faces.c (merge_face_cachel_data): * faces.c (reset_face_cachel): * faces.c (face_property_was_changed): * faces.c (Fcopy_face): * fontcolor.c (face_color_validate): Handle the foreback property. * redisplay-msw.c (mswindows_output_blank): * redisplay-msw.c (mswindows_output_string): * redisplay-output.c (redisplay_clear_region): * redisplay-xlike-inc.c (XLIKE_output_string): * redisplay-xlike-inc.c (XLIKE_output_blank): Use the face's foreback color instead of the foreground one for drawing a background bitmap.
author Didier Verna <didier@xemacs.org>
date Tue, 27 Dec 2011 17:07:23 +0100
parents 4b4b37ddb7fd
children daf5accfe973
comparison
equal deleted inserted replaced
5623:444713e89160 5624:c39052c921b5
320 The following symbols have predefined meanings: 320 The following symbols have predefined meanings:
321 321
322 foreground The foreground color of the face. 322 foreground The foreground color of the face.
323 For valid instantiators, see `make-color-specifier'. 323 For valid instantiators, see `make-color-specifier'.
324 324
325 foreback The foreground color of the face's background pixmap,
326 when the pixmap is a bitmap.
327 Only used by faces on X and MS Windows devices.
328 For valid instantiators, see `make-color-specifier'.
329
325 background The background color of the face. 330 background The background color of the face.
326 For valid instantiators, see `make-color-specifier'. 331 For valid instantiators, see `make-color-specifier'.
327 332
328 font The font used to display text covered by this face. 333 font The font used to display text covered by this face.
329 For valid instantiators, see `make-font-specifier'. 334 For valid instantiators, see `make-font-specifier'.
581 586
582 See `set-face-property' for more information." 587 See `set-face-property' for more information."
583 (interactive (face-interactive "foreground")) 588 (interactive (face-interactive "foreground"))
584 (set-face-property face 'foreground color locale tag-set how-to-add)) 589 (set-face-property face 'foreground color locale tag-set how-to-add))
585 590
591 (defun face-foreback (face &optional locale tag-set exact-p)
592 "Return the foreback spec of FACE in LOCALE, or nil if it is unspecified.
593
594 NOTE: This returns a locale-specific specification, not any sort of value
595 corresponding to the actual foreback being used. If you want to know the
596 actual foreback color used in a particular domain, use
597 `face-foreback-instance', or `face-foreback-name' for its name
598 \(i.e. the instantiator used to create it).
599
600 FACE may be either a face object or a symbol representing a face.
601
602 LOCALE may be a locale (the instantiators for that particular locale
603 will be returned), a locale type (the specifications for all locales
604 of that type will be returned), `all' (all specifications will be
605 returned), or nil (the actual specifier object will be returned).
606
607 See `face-property' for more information."
608 (face-property face 'foreback locale tag-set exact-p))
609
610 (defun face-foreback-instance (face &optional domain default no-fallback)
611 "Return the instance of FACE's foreback in DOMAIN.
612
613 Return value will be a color instance object; query its properties using
614 `color-instance-name' or `color-instance-rgb-properties'.
615
616 FACE may be either a face object or a symbol representing a face.
617
618 Normally DOMAIN will be a window or nil (meaning the selected window),
619 and an instance object describing how the foreback appears in that
620 particular window and buffer will be returned.
621
622 See `face-property-instance' for more information."
623 (face-property-instance face 'foreback domain default no-fallback))
624
625 (defun face-foreback-name (face &optional domain default no-fallback)
626 "Return the name of FACE's foreback color in DOMAIN.
627
628 FACE may be either a face object or a symbol representing a face.
629
630 Normally DOMAIN will be a window or nil (meaning the selected window),
631 and an instance object describing how the foreback appears in that
632 particular window and buffer will be returned.
633
634 See `face-property-instance' for more information."
635 (color-instance-name (face-foreback-instance
636 face domain default no-fallback)))
637
638 (defun set-face-foreback (face color &optional locale tag-set how-to-add)
639 "Change the foreback color of FACE to COLOR in LOCALE.
640
641 FACE may be either a face object or a symbol representing a face.
642
643 COLOR should be an instantiator (see `make-color-specifier'), a list of
644 instantiators, an alist of specifications (each mapping a locale to
645 an instantiator list), or a color specifier object.
646
647 If COLOR is an alist, LOCALE must be omitted. If COLOR is a
648 specifier object, LOCALE can be a locale, a locale type, `all',
649 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE
650 specifies the locale under which the specified instantiator(s)
651 will be added, and defaults to `global'.
652
653 See `set-face-property' for more information."
654 (interactive (face-interactive "foreback"))
655 (set-face-property face 'foreback color locale tag-set how-to-add))
656
586 (defun face-background (face &optional locale tag-set exact-p) 657 (defun face-background (face &optional locale tag-set exact-p)
587 "Return the background color of FACE in LOCALE, or nil if it is unspecified. 658 "Return the background color of FACE in LOCALE, or nil if it is unspecified.
588 659
589 NOTE: This returns a locale-specific specification, not any sort of value 660 NOTE: This returns a locale-specific specification, not any sort of value
590 corresponding to the actual background being used. If you want to know the 661 corresponding to the actual background being used. If you want to know the
933 See `face-property-instance' for the semantics of the DOMAIN argument." 1004 See `face-property-instance' for the semantics of the DOMAIN argument."
934 (if (null domain) (setq domain (selected-window))) 1005 (if (null domain) (setq domain (selected-window)))
935 (if (not (valid-specifier-domain-p domain)) 1006 (if (not (valid-specifier-domain-p domain))
936 (error "Invalid specifier domain")) 1007 (error "Invalid specifier domain"))
937 (let ((device (dfw-device domain)) 1008 (let ((device (dfw-device domain))
938 (common-props '(foreground background font display-table underline 1009 (common-props '(foreground background
939 dim inherit shrink)) 1010 font display-table underline
940 (win-props '(background-pixmap background-placement strikethru)) 1011 dim inherit shrink))
1012 (win-props '(foreback background-pixmap background-placement
1013 strikethru))
941 (tty-props '(highlight blinking reverse))) 1014 (tty-props '(highlight blinking reverse)))
942 1015
943 ;; First check the properties which are used in common between the 1016 ;; First check the properties which are used in common between the
944 ;; x and tty devices. Then, check those properties specific to 1017 ;; x and tty devices. Then, check those properties specific to
945 ;; the particular device type. 1018 ;; the particular device type.
2003 ;; specified, that it not use fallbacks, otherwise *they* use the general 2076 ;; specified, that it not use fallbacks, otherwise *they* use the general
2004 ;; fallback of the default face instead, which clashes with the gui 2077 ;; fallback of the default face instead, which clashes with the gui
2005 ;; element faces. So take the modeline face information from its 2078 ;; element faces. So take the modeline face information from its
2006 ;; fallbacks, themselves ultimately set up in faces.c: 2079 ;; fallbacks, themselves ultimately set up in faces.c:
2007 (loop 2080 (loop
2008 for face-property in '(foreground background 2081 for face-property in '(foreground foreback background
2009 background-pixmap background-placement) 2082 background-pixmap background-placement)
2010 do (when (and (setq face-property (face-property 'modeline face-property)) 2083 do (when (and (setq face-property (face-property 'modeline face-property))
2011 (null (specifier-instance face-property device nil t)) 2084 (null (specifier-instance face-property device nil t))
2012 (specifier-instance face-property device)) 2085 (specifier-instance face-property device))
2013 (set-specifier face-property 2086 (set-specifier face-property