;;; pov-mode.el --- major mode for Povray scene files
;;
;; Author: Peter Boettcher <pwb@andrew.cmu.edu>
;; Maintainer: Peter Toneby <woormie@acc.umu.se>
;; Created: 04 March 1994
;; Modified: 05 Feb 2008
;; Version: 2.10-pl1
;; Keywords: pov, povray
;;
;; Modified by: Marco Pessotto <marco.erika@gmail.com>
;; 1/5/2008
;; Workaround for Emacs 22
;; Peter Toneby no more maintains pov-mode :-(
;;
;; LCD Archive Entry:
;; povray|Peter Toneby|woormie@acc.umu.se|
;; Major mode for Povray scene files|
;; 08-Sep-2003|2.10|~/lib/emacs/pov-mode.el|
;;
;; Copyright (C) 1997 Peter W. Boettcher
;;
;; This program 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.
;; This program 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
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;;
;;; Commentary:
;;
;; This major mode for GNU Emacs provides support for editing Povray
;; scene files, rendering and viewing them. It automatically indents
;; blocks, both {} and #if #end. It also provides context-sensitive
;; keyword completion and font-lock highlighting, as well as the
;; ability to look up those keywords in the povray docu.
;;
;; It should work for either Xemacs or FSF Emacs, versions >= 20;
;; however, only Xemacs can display pictures.
;;
;; To automatically load pov-mode every time Emacs starts up, put the
;; following line into your .emacs file:
;;
;; (require 'pov-mode)
;;
;; Of course pov-mode has to be somewhere in your load-path for emacs
;; to find it (Use C-h v load-path to see which directories are in the
;; load-path).
;;
;; NOTE: To achieve any sort of reasonable performance, YOU MUST
;; byte-compile this package. In emacs, type M-x byte-compile
;; and then enter the name of this file.
;;
;; You can customize the behaviour of pov-mode and via the
;; customization menu or by simply entering M-x customize-group pov.
;; In many or even most cases, however, it should be completely
;; sufficient to to rely on the default settings.
;;
;; To learn about the basics, just load a pov-file and press C-h m.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;Modified by: Peter Boettcher <pwb@andrew.cmu.edu>
;; 5/8/97:
;; Added font-lock support for Emacs/XEmacs 19
;; Indent under `#declare Object=' lines
;; Corrected comment syntax
;; Got rid of more remnants from postscript mode
;; General cleanup
;; Arbitrarily chose version 1.2
;; 5/8/97: Version 1.21
;; fontify-insanely was ignored. fixed.
;;
;; 9/24/97: Version 1.3
;; Added indentation for Pov 3 syntax (#if #else, etc)
;; Preliminary context-sensitive keyword completion
;;
;; 1/13/98 by Peter Boettcher <pwb@andrew.cmu.edu>
;; Explicitly placed package under GPL
;; Reorganized comment sections and change log to follow GNU standards
;; Added simple code for jumping to pov documentation (Thanks to
;; Benjamin Strautin <bis@acpub.duke.edu> for this code)
;;
;; Modified by: Peter Toneby <woormie@acc.umu.se>
;; 22/3/99: Version 1.99beata1
;; Added support for Pov3.1s new keywords. (not all, I think...)
;; Removed atmosphere (and atmosphere_*) (stupid me...)
;;
;; Modified by: Peter Toneby <woormie@acc.umu.se>
;; 23/4/99: Version 1.99beata2
;; Added support for all new keyword, BUT
;; Added atmosphere (and atmosphere_*) again
;; Got Pete Boettchers blessing to continue (but with a note
;; that said that I should have talked to him first, I'm sorry
;; for not doing that). Pete also said he was willing to let
;; me continue the maintainance of this file.
;; I can't get the pov-keyword-help to work, anyone with knowledge
;; about elisp can send me a fix for it.
;; The keyword expansion doesn't work for all keywords,
;; I need to add lots of stuff and read through the docs
;; to get everything correct.
;;
;; Modified by: Alexander Schmolck <aschmolck@gmx.de>
;; 2000-01-31: Version 2beataXXX
;; Added working keyword lookup in povuser.txt
;; Added rendering and viewing from within Emacs and with an external viewer
;; Added customization and made installation simpler
;; Added a few other minor details
;;
;; Modified by: Peter Toneby <woormie@acc.umu.se>
;; 2000-05-24: Version 2
;; Changed the keyword lookup a little, povuser.txt didn't open as
;; expected when having set the pov-home-dir and pov-help-file
;; manually.
;;
;; Modified by: Peter Toneby <woormie@acc.umu.se>
;; 2000-08-10: Version 2.5b1
;; Added povray-font-lock-faces.
;; Made sure font-lock works properly on:
;; XEmacs 19.15p7
;; XEmacs 20.0
;; XEmacs 21.1p10
;; Emacs 19.29.1
;; Emacs 20.7.2
;; Added all 3.1 keywords except track, since I don't know what it
;; is, I have also dropped the 3.0 specific keywords that
;; shouldn't be used anymore.
;; Fixed some completion stuff, I think I have added all keywords to
;; the completions.
;; Added configureation for all faces. To bad I can't get the defaults
;; to work properly on dark backgrounds, I don't know why that is.
;; Added a toolbar, it replaces to standard XEmacs toolbar, I think
;; that is the best thing to do, but I retain the standard useful
;; functionality.
;; Fixed an error in the external viewer, it used variables that were
;; not available in the same scope as the sentinel.
;; Added basic imenu support, currently only #local and #declare,
;; but I will try to add objects, cameras and lightsources later.
;; 2000-09-12 Version 2.5.b2
;; Added basic support for megapov
;; Bob Pepin fixed a bug in test to select external/internal viewer.
;; fortsätt på kapitel 5.6
;; 2001-04-05 Version 2.6
;; Added the capability to open standard include files by pressing
;; C-c i. It opens the file entered ro.
;; Fixed leeking color in emacs (Robert Kleemann)
;; Changed the rendertoolbarbutton to show a popup dialog with buttons
;; for the different qualities.
;; 2001-12-07 Version 2.7
;; Fixed font-locks for Emacs 21
;; 2002-06-19 Version 2.8
;; Fixed loading for Emacs 21-2, missed a test for customizations
;; Added most parts of a patch from Christoph Hormann that cleaned
;; up the Regexp mess, and added all (or at least most) of the
;; keywords for 3.5 Parts of that patch are still missing, I'll
;; get around to those sometime...
;; 2002-08-07 Version 2.9
;; Added Insert menu, it uses the directory structure of the winpov
;; insert menu.
;; Moved the toolbar icons out to separate xpm-files.
;; Added some missing keyword expansions
;; Fixed so that box, cylinder... has their own face, object-face,
;; removed unused faces
;; Cleaned up the code, removed unused stuff.
;; It works in versions 21, can't test in 20, font-lock is borked for me.
;; 2002-08-10 Version 2.9.1
;; Fixed so that tollbar icons are searched for, not hard coded.
;; 2003-08-29 Version 2.10
;; Fixed references to povray.el.
;; Fixed cut-n-pasted comment for font-pov-operator-face.
;; Fixed the insert menus, they missed the last items, thanks to Hartwig
;; Bosse for the heads up, and a fix.
;; 2003-08-29 Version 2.11 (This is a future version)
;; Fix a bug with rendering so that the active buffer is changed to the
;; correct buffer, found by Hartwig Bosse.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Original Author: Kevin O. Grover <grover@isri.unlv.edu>
;; Cre Date: 04 March 1994
;; This file derived from postscript mode by Chris Maio
;;
;; Please send bug reports/comments/suggestions to Peter Toneby
;; woormie@acc.umu.se
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; TODO list:
;; * Vector operations (add <0, .5, 1> to every vector in region)
;; * Clean up completion code
;; * TAGS, to jump to #declared objects elsewhere in the code
;; * c-mode like electric parens (?)
;; * clean up viewing and rendering code
;; * should render or view be decided on filedates? If so, what
;; image file-name extensions should be checked?
;; I think PNG is default for UNIX, not sure.
;; I could make this a customizeation option.
;; * imenu support
;; started, but needs to be fixed so it handles nested menus.
;; * Make sure the scopes are correct
;; * Make hooks for menus, so they are userselectable
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Better safe than sorry, lets fail if you are using a (very?) old
;; version of (X)Emacs.
(if (if (save-match-data (string-match "Lucid\\|XEmacs" (emacs-version)))
(and (= emacs-major-version 19) (< emacs-minor-version 14))
(and (= emacs-major-version 19) (< emacs-minor-version 29)))
(error "`font-pov' was written for Emacs 19.29/XEmacs 19.14 or later"))
(defvar font-pov-is-XEmacs19
(and (not (null (save-match-data
(string-match "XEmacs\\|Lucid" emacs-version))))
(= 19 emacs-major-version)))
(defvar font-pov-is-XEmacs20
(and (not (null (save-match-data
(string-match "XEmacs\\|Lucid" emacs-version))))
(<= 20 emacs-major-version)))
(defvar font-pov-is-XEmacs21
(and (not (null (save-match-data
(string-match "XEmacs\\|Lucid" emacs-version))))
(<= 21 emacs-major-version)))
(defvar font-pov-is-XEmacs20-2
(or (and font-pov-is-XEmacs20 (<= 2 emacs-minor-version))
font-pov-is-XEmacs21))
(defvar font-pov-is-Emacs19
(and (not font-pov-is-XEmacs19)
(not font-pov-is-XEmacs20)
(= 19 emacs-major-version)))
(defvar font-pov-is-Emacs20
(and (not font-pov-is-XEmacs19)
(not font-pov-is-XEmacs20)
(= 20 emacs-major-version)))
(defvar font-pov-is-Emacs21
(and (not font-pov-is-XEmacs19)
(not font-pov-is-XEmacs20)
(not font-pov-is-XEmacs21)
(= 21 emacs-major-version)))
(defvar font-pov-is-Emacs22
(and (not font-pov-is-XEmacs19)
(not font-pov-is-XEmacs20)
(not font-pov-is-XEmacs21)
(= 22 emacs-major-version)))
(defvar font-pov-is-Emacs
(or font-pov-is-Emacs19
font-pov-is-Emacs20
font-pov-is-Emacs21
font-pov-is-Emacs22))
(require 'cl)
(require 'font-lock) ;;[TODO] Not nice to reqire it, the user should
;; have a choise...
(defconst pov-mode-version '2.10
"The povray mode version.")
(defvar pov-tab-width 8)
(defvar pov-autoindent-endblocks t)
;;Create fontfaces
(defvar font-pov-number-face 'font-pov-number-face
"Face to use for PoV numbers.")
(defvar font-pov-variable-face 'font-pov-variable-face
"Face to use for PoV variables.")
(defvar font-pov-directive-face 'font-pov-directive-face
"Face to use for PoV directives.")
(defvar font-pov-object-face 'font-pov-object-face
"Face to use for PoV objects.")
;(defvar font-pov-object-modifier-face 'font-pov-object-modifier-face
; "Face to use for PoV objects.")
;(defvar font-pov-texture-face 'font-pov-texture-face
; "Face to use for PoV objects.")
(defvar font-pov-operator-face 'font-pov-operator-face
"Face to use for PoV operators.")
(defvar font-pov-csg-face 'font-pov-csg-face
"Face to use for PoV csg keywords.")
;(defvar font-pov-string-face nil
; "Face to use for strings. This is set by font-PoV.")
(defvar font-pov-macro-name-face nil
"Face to use for strings. This is set by font-PoV.")
(defvar font-pov-keyword-face nil
"Face to use for misc keywords. This is set by font-PoV.")
(defvar pov-insertmenu-location nil
"Location of the InsertMenu directory structure.")
(defvar pov-icons-location nil
"Location of the menubaricons.")
; Seems like Emacs lacks these functions (locate-data-[directory|file])...
(unless (fboundp 'locate-data-directory)
(defun locate-data-directory (name &optional dirs)
(if dirs
(if (file-directory-p (expand-file-name name (car dirs)))
(expand-file-name name (car dirs))
(locate-data-directory name (cdr dirs)))
(expand-file-name name data-directory))))
(unless (fboundp 'locate-data-file)
(defun locate-data-file (name &optional dirs)
(print dirs)
(if dirs
(if (file-regular-p (expand-file-name name (car dirs)))
(expand-file-name name (car dirs))
(locate-data-file name (cdr dirs)))
(expand-file-name name data-directory))))
;; This is because FSFEmacs has a ridiculusly low max-lisp-eval-depth
(when (> 1000 max-lisp-eval-depth)
(customize-set-value 'max-lisp-eval-depth 1000))
;; Yup XEmacs didn't get cutomizations until 20.2.
(cond ((or font-pov-is-XEmacs20-2 (or font-pov-is-Emacs20 font-pov-is-Emacs21 font-pov-is-Emacs22))
(defgroup pov nil
"*Major mode for editing povray 3.X scence files <http://www.povray.org>."
:group 'languages)
(defcustom povray-command "povray"
"*Command used to invoke the povray."
:type 'string
:group 'pov)
(defcustom pov-external-viewer-command "xv"
"*The external viewer to call."
:type 'string
:group 'pov)
(defcustom pov-external-view-options "%s"
"*The options for the viewer; %s is replaced with the name of the rendered image."
:type 'string
:group 'pov)
;;allow user to customize external or internal viewer as defaults if she
;;is using Xemacs; for FSF Emacs assume external, since it can't
;;handle pictures anyway
;(if (and (boundp 'running-xemacs) running-xemacs)
(defcustom pov-default-view-internal t
"*Should the pictures be displayed internally by default?"
:type 'boolean
:group 'pov)
;(defvar pov-default-view-internal nil))
(defcustom pov-run-default "+i%s"
"*The default options for the Render command (%s is replaced by the filename)."
:type 'string
:group 'pov
)
(defcustom pov-run-test "res120 -Q3 +i%s"
"*The default options for the Test Render command (%s is replaced by the filename)."
:type 'string
:group 'pov
)
(defcustom pov-run-low "res320 +i%s"
"*The default options for the Test Render command (%s is replaced by the filename)."
:type 'string
:group 'pov
)
(defcustom pov-run-mid "res640 +i%s"
"*The default options for the Medium Res Render command (%s is replaced by the filename)."
:type 'string
:group 'pov
)
(defcustom pov-run-high "res800 +i%s"
"*The default options for the High Res Render command (%s is replaced by the filename)."
:type 'string
:group 'pov
)
(defcustom pov-run-highest "res1k +i%s"
"*The default options for the Higest Res Render command (%s is replaced by the filename)."
:type 'string
:group 'pov
)
(defvar pov-external-view
"External view")
(defvar pov-internal-view
"Internal view")
(defvar pov-command-alist (list (list "Render"
povray-command pov-run-default
'()) ;history for the command
(list "Test quality render"
povray-command pov-run-test
'())
(list "Low quality render"
povray-command pov-run-low
'())
(list "Medium quality render"
povray-command pov-run-highest
'())
(list "High quality render"
povray-command pov-run-high
'())
(list pov-external-view
pov-external-viewer-command
pov-external-view-options
'())
(list pov-internal-view
(list pov-internal-view)
'()))
"the commands to run")
(defcustom pov-home-dir "SHARELIBSPOVRAY"
"*The directory in which the povray files reside."
:type 'directory
:group 'pov)
(defcustom pov-include-dir "SHARELIBSPOVRAY/include"
"*The directory in which the povray includefiles reside."
:type 'directory
:group 'pov)
(defcustom pov-help-file "povuser.txt"
"*The name of the helpfile."
:type 'file
:group 'pov)
(defcustom pov-associate-pov-and-inc-with-pov-mode-flag t
"*If t then files ending with .pov and .inc will automatically start
pov-mode when loaded, unless those file-endings are already in use."
:type 'boolean
:group 'pov)
(defcustom pov-fontify-insanely t
"*Non-nil means colorize every povray keyword. This may take a while on large files. Maybe disable this on slow systems."
:type 'boolean
:group 'pov)
(defcustom pov-imenu-in-menu t
"*Non-nil means have #locals and #declares in a menu called PoV in the menubar. This may take a while on large files. Maybe disable this on slow systems."
:type 'boolean
:group 'pov)
;; CH
(defcustom pov-imenu-only-macros t
"*Non-nil means to restrict imenu to macro declarations."
:type 'boolean
:group 'pov)
;; /end CH
(defcustom pov-indent-level 2
"*Indentation to be used inside of PoVray blocks or arrays."
:type 'integer
:group 'pov)
(defcustom pov-autoindent-endblocks t
"*When non-nil, automatically reindents when you type break, end, or else."
:type 'boolean
:group 'pov
)
(defcustom pov-indent-under-declare 2
"*Indentation under a `#declare Object=' line."
:type 'integer
:group 'pov)
(defcustom pov-tab-width 8
"*Tab stop width for PoV mode."
:type 'integer
:group 'pov)
(defcustom pov-turn-on-font-lock t
"*Turn on syntax highlighting automatically"
:type 'boolean
:group 'pov)
(defcustom font-pov-csg-face t
"*What color does CSG-object have"
:type 'face
:group 'pov)
(defcustom font-pov-object-face t
"*What color does objects have"
:type 'face
:group 'pov)
(defcustom font-pov-variable-face t
"*What color does variables (in declarations) have"
:type 'face
:group 'pov)
; (defcustom font-pov-string-face t
; "*What color does strings have"
; :type 'face
; :group 'pov)
; (defcustom font-pov-texture-face t
; "*What color does textures have"
; :type 'face
; :group 'pov)
; (defcustom font-pov-object-modifier-face t
; "*What color does object modifiers have"
; :type 'face
; :group 'pov)
(defcustom font-pov-directive-face t
"*What color does (#)-directives have"
:type 'face
:group 'pov)
(defcustom font-pov-number-face t
"*What color does numbers have"
:type 'face
:group 'pov)
(defcustom font-pov-keyword-face t
"*What color does keywords have"
:type 'face
:group 'pov)
)
)
; Find where the menubar icons are placed, should be where pov-mode is...
;; (setq pov-icons-location
;; (file-name-directory (locate-data-file "povrender.xpm"
;; (cons (file-name-directory (locate-library "pov-mode"))
;; (if font-pov-is-Emacs data-directory data-directory-list)))))
;;FIX ME
(setq pov-icons-location "EMACSLISPLIBRARY/povrender.xpm")
;; Lets play with the Toolbar, we want to add buttons for
;; rendering and showing images, lets place them on the rightmost
;; position of the toolbar.
(cond ((or font-pov-is-XEmacs20 font-pov-is-XEmacs21)
(defvar toolbar-render-icon
(if (featurep 'xpm)
(let ((rendericon (concat pov-icons-location "povrender.xpm")))
(toolbar-make-button-list (make-image-instance (vector 'xpm :file rendericon))))
))
(defvar toolbar-look-icon
(if (featurep 'xpm)
(let ((viewicon (concat pov-icons-location "povview.xpm")))
(toolbar-make-button-list (make-image-instance (vector 'xpm :file viewicon))))
))
(defvar pov-toolbar
'(
[toolbar-file-icon toolbar-open t "Open a file"]
[toolbar-folder-icon toolbar-dired t "Edit a directory"]
[toolbar-disk-icon toolbar-save t "Save buffer"]
[toolbar-printer-icon toolbar-print t "Print buffer"]
[toolbar-cut-icon toolbar-cut t "Kill region"]
[toolbar-copy-icon toolbar-copy t "Copy region"]
[toolbar-paste-icon toolbar-paste t "Paste from clipboard"]
[toolbar-undo-icon toolbar-undo t "Undo edit"]
[toolbar-spell-icon toolbar-ispell t "Check spelling"]
[toolbar-replace-icon toolbar-replace t "Search & Replace"]
nil
[toolbar-render-icon (pov-render-dialog) t "Configured Render the file"]
; [toolbar-render-icon
; (pov-render-file "Render" (buffer-file-name) nil)
; t "Quick Render the file"]
[toolbar-look-icon
(if pov-default-view-internal
(pov-display-image-xemacs pov-image-file)
(pov-display-image-externally pov-image-file nil))
t "Show the rendered file"]
))
(defvar pov-render-dialog-desc
'("Render Image"
["Test render" (pov-render-file "Test quality render" (buffer-file-name) nil) t]
["Low render" (pov-render-file "Low quality render" (buffer-file-name) nil) t]
["Medium render" (pov-render-file "Medium quality render" (buffer-file-name) nil) t]
["High render" (pov-render-file "High quality render" (buffer-file-name) nil) t]
["Render" (pov-render-file "Render" (buffer-file-name) nil) t]
["Cancel" (pov-render-file "Render" (buffer-file-name) nil) t]
))
))
(defun pov-toolbar ()
(interactive)
(set-specifier default-toolbar (cons (current-buffer) pov-toolbar)))
;; Menubar stuff, buttonmenu will be nice to have too.
;; Abbrev support
(defvar pov-mode-abbrev-table nil
"Abbrev table in use in pov-mode buffers.")
(define-abbrev-table 'pov-mode-abbrev-table ())
(cond ((or font-pov-is-XEmacs20-2 font-pov-is-Emacs20)
(when pov-turn-on-font-lock
(turn-on-font-lock))
;; associate *.pov and *.inc with pov if flag is set and no other
;; modes already have
(cond (pov-associate-pov-and-inc-with-pov-mode-flag
(when (not (assoc "\\.pov\\'" auto-mode-alist))
(setq auto-mode-alist
(append '(("\\.pov\\'" . pov-mode)) auto-mode-alist)))
(when (not (assoc "\\.inc\\'" auto-mode-alist))
(setq auto-mode-alist
(append '(("\\.inc\\'" . pov-mode)) auto-mode-alist)))))
))
;;END AS
(defvar font-pov-do-multi-line t
"*Set this to nil to disable the multi-line fontification prone to infinite loop bugs.")
(defun font-pov-setup ()
"Setup this buffer for PoV font-lock."
(cond
((or font-pov-is-Emacs20 font-pov-is-Emacs21 font-pov-is-Emacs22)
;; Tell Font Lock about the support.
(make-local-variable 'font-lock-defaults))
((or font-pov-is-XEmacs19 font-pov-is-XEmacs20)
;; Cool patch from Christoph Wedler...
(let (instance)
(mapcar (function
(lambda (property)
(setq instance
(face-property-instance 'font-pov-number-face property nil 0 t))
(if (numberp instance)
(setq instance
(face-property-instance 'default property nil 0)))
;(or (numberp instance)
; (set-face-property 'font-lock-string-face property
; instance (current-buffer)))))
))
(built-in-face-specifiers))))
(font-pov-is-Emacs19
(make-local-variable 'font-lock-defaults))))
(cond
((or font-pov-is-Emacs20 font-pov-is-XEmacs20-2 font-pov-is-Emacs21 font-pov-is-Emacs22)
(defface font-pov-object-face
'((((class grayscale) (background light)) (:foreground "DimGray" :bold t))
(((class grayscale) (background dark)) (:foreground "LightGray" :bold t))
(((class color) (background light)) (:foreground "DarkOliveGreen" :bold t))
(((class color) (background dark)) (:foreground "White" :bold t ))
(t (:bold t)))
"Font Lock mode face used for objects."
:group 'font-pov-faces)
(defface font-pov-directive-face
'((((class grayscale) (background light)) (:foreground "DimGray"))
(((class grayscale) (background dark)) (:foreground "LightGray"))
(((class color) (background light)) (:foreground "DarkRed"))
(((class color) (background dark)) (:foreground "lightgreen"))
(t (:italic t)))
"Font Lock mode face used to highlight PoV directives."
:group 'font-pov-faces)
(defface font-pov-number-face
'((((class grayscale) (background light))(:foreground "DimGray" :underline t))
(((class grayscale) (background dark)) (:foreground "LightGray" :underline t))
(((class color) (background light)) (:foreground "SaddleBrown"))
(((class color) (background dark)) (:foreground "wheat"))
(t (:underline t)))
"Font Lock mode face used to highlight numbers in PoV."
:group 'font-pov-faces)
(defface font-pov-variable-face
'((((class grayscale) (background light)) (:foreground "DimGray"))
(((class grayscale) (background dark)) (:foreground "LightGray"))
(((class color) (background light)) (:foreground "ForestGreen"))
(((class color) (background dark)) (:foreground "gray80"))
)
"Font Lock mode face used to highlight variabledeclarations in PoV."
:group 'font-pov-faces)
(defface font-pov-csg-face
'((((class grayscale) (background light)) (:foreground "DimGray"))
(((class grayscale) (background dark)) (:foreground "LightGray"))
(((class color) (background light)) (:foreground "Blue"))
(((class color) (background dark)) (:foreground "red"))
)
"Font Lock mode face used to highlight CSGs in PoV."
:group 'font-pov-faces)
;; -- C.H. --
(defface font-pov-macro-name-face
'((((class grayscale) (background light)) (:foreground "DimGray" :bold t))
(((class grayscale) (background dark)) (:foreground "LightGray" :bold t))
(((class color) (background light)) (:foreground "Blue2" :bold t))
(((class color) (background dark)) (:foreground "gray80" :bold t))
)
"Font Lock mode face used to highlight macro declarations in PoV."
:group 'font-pov-faces)
(defface font-pov-keyword-face
'((((class grayscale) (background light)) (:foreground "DimGray"))
(((class grayscale) (background dark)) (:foreground "LightGray"))
(((class color) (background light)) (:foreground "Blue4"))
(((class color) (background dark)) (:foreground "Blue"))
)
"Font Lock mode face used to highlight general keywords in PoV."
:group 'font-pov-faces)
;; -- end C.H. --
(defface font-pov-operator-face
'((((class grayscale)(background light)) (:foreground "DimGray" :bold t))
(((class grayscale)(background dark)) (:foreground "LightGray" :bold t))
(((class color)(background light)) (:foreground "Limegreen" :bold t ))
(((class color)(background dark)) (:foreground "Limegreen" :bold t ))
(t (:bold t)))
"Font Lock mode face used to highlight operators in PoV."
:group 'font-pov-faces))
(font-pov-is-Emacs19
(unless (assq 'font-pov-variable-face font-lock-face-attributes)
(cond
;; FIXME: Add better conditions for grayscale.
((memq font-lock-display-type '(mono monochrome grayscale greyscale
grayshade greyshade))
(setq font-lock-face-attributes
(append
font-lock-face-attributes
(list '(font-pov-variable-face nil nil t nil nil)
'(font-pov-macro-name-face nil nil t nil nil) ;; C.H.
'(font-pov-keyword-face nil nil nil t nil) ;; C.H.
'(font-pov-object-face nil nil nil t nil)
'(font-pov-number-face nil nil nil nil t)
(list
'font-pov-operator-face
(cdr (assq 'background-color (frame-parameters)))
(cdr (assq 'foreground-color (frame-parameters)))
nil nil nil)))))
((eq font-lock-background-mode 'light) ; light color background
(setq font-lock-face-attributes
(append
font-lock-face-attributes
;;;FIXME: These won't follow font-lock-type-face's changes.
;;; Should I change to a (copy-face) scheme?
'((font-pov-variable-face "DarkOliveGreen" nil t nil nil)
(font-pov-macro-name-face "DarkOliveGreen" nil t nil nil) ;; C.H.
(font-pov-keyword-face "grey50") ;; C.H.
(font-pov-number-face "DarkOliveGreen" nil nil t nil)
(font-pov-object-face