Update of /project/mcclim/cvsroot/mcclim/Drei In directory clnet:/tmp/cvs-serv18573/Drei
Modified Files: lisp-syntax.lisp packages.lisp Added Files: drawing-options.lisp Log Message: Added some standard drawing options, including syntactical drawing options.
This is meant to make it easier to switch colour schemes.
--- /project/mcclim/cvsroot/mcclim/Drei/lisp-syntax.lisp 2008/01/07 22:05:22 1.55 +++ /project/mcclim/cvsroot/mcclim/Drei/lisp-syntax.lisp 2008/01/07 22:37:17 1.56 @@ -1831,43 +1831,37 @@ (progn (cache-symbol-info syntax symbol-form) (global-boundp symbol-form))))
-(let ((keyword-drawing-options (make-drawing-options :face (make-face :ink +orchid+))) - (macro-drawing-options (make-drawing-options :face (make-face :ink +purple+))) - (bound-drawing-options (make-drawing-options :face (make-face :ink +darkgoldenrod+))) - (highlighted-parenthesis-options (make-drawing-options :face (make-face :style (make-text-style nil :bold nil))))) - (define-syntax-highlighting-rules emacs-style-highlighting - (error-lexeme (:face :ink +red+)) - (string-form (:face :ink +rosy-brown+ - :style (make-text-style nil :italic nil))) - (comment (:face :ink +maroon+ :style (make-text-style :serif :bold :large))) - (literal-object-form (:options :function (object-drawer))) - (complete-token-form (:function #'(lambda (view form) - (cond ((symbol-form-is-keyword-p (syntax view) form) - keyword-drawing-options) - ((symbol-form-is-macrobound-p (syntax view) form) - macro-drawing-options) - ((symbol-form-is-boundp (syntax view) form) - bound-drawing-options) - (t +default-drawing-options+))))) - (parenthesis-lexeme (:function #'(lambda (view form) - (if (and (typep view 'point-mark-view) - (or (mark= (point view) (start-offset (parent form))) - (mark= (point view) (end-offset (parent form)))) - (form-complete-p (parent form))) - highlighted-parenthesis-options - +default-drawing-options+)))))) - -(let ((macro-drawing-options (make-drawing-options :face (make-face :style (make-text-style nil :bold nil))))) - (define-syntax-highlighting-rules retro-highlighting - (error-symbol (:face :ink +red+)) - (string-form (:face :style (make-text-style nil :italic nil))) - (comment (:face :style (make-text-style nil nil nil) - :ink +dimgray+)) - (literal-object-form (:options :function (object-drawer))) - (complete-token-form (:function #'(lambda (syntax form) - (cond ((symbol-form-is-macrobound-p syntax form) - macro-drawing-options) - (t +default-drawing-options+))))))) +(define-syntax-highlighting-rules emacs-style-highlighting + (error-lexeme (:face :ink +red+)) + (string-form (:face :ink +rosy-brown+ + :style +italic-face-style+)) + (comment (:face :ink +maroon+ :style (make-text-style :serif :bold :large))) + (literal-object-form (:options :function (object-drawer))) + (complete-token-form (:function #'(lambda (view form) + (cond ((symbol-form-is-keyword-p (syntax view) form) + *keyword-drawing-options*) + ((symbol-form-is-macrobound-p (syntax view) form) + *special-operator-drawing-options*) + ((symbol-form-is-boundp (syntax view) form) + *special-variable-drawing-options*) + (t +default-drawing-options+))))) + (parenthesis-lexeme (:function #'(lambda (view form) + (if (and (typep view 'point-mark-view) + (or (mark= (point view) (start-offset (parent form))) + (mark= (point view) (end-offset (parent form)))) + (form-complete-p (parent form))) + +bold-face-drawing-options+ + +default-drawing-options+))))) + +(define-syntax-highlighting-rules retro-highlighting + (error-symbol (:face :ink +red+)) + (string-form (:face :style +italic-face-style+)) + (comment (:face :ink +dimgray+)) + (literal-object-form (:options :function (object-drawer))) + (complete-token-form (:function #'(lambda (syntax form) + (cond ((symbol-form-is-macrobound-p syntax form) + +bold-face-drawing-options+) + (t +default-drawing-options+))))))
(defparameter *syntax-highlighting-rules* 'emacs-style-highlighting "The syntax highlighting rules used for highlighting Lisp --- /project/mcclim/cvsroot/mcclim/Drei/packages.lisp 2008/01/07 22:05:22 1.35 +++ /project/mcclim/cvsroot/mcclim/Drei/packages.lisp 2008/01/07 22:37:17 1.36 @@ -246,12 +246,12 @@
#:minibuffer
- ;; DREI interface stuff. #:drei #:drei-pane #:drei-gadget-pane #:drei-area #:handling-drei-conditions #:handle-drei-condition #:execute-drei-command - #:display-drei-view-contents #:display-drei-view-cursor
+ ;; Redisplay engine. + #:display-drei-view-contents #:display-drei-view-cursor #:face #:make-face #:face-ink #:face-style #:drawing-options #:make-drawing-options #:drawing-options-face #:drawing-options-function @@ -261,6 +261,17 @@
#:pump-state-for-offset #:stroke-pump #:object-drawer #:*maximum-chunk-size* + + #:+roman-face+ #:+roman-face-drawing-options+ + #:+italic-face+ #:+italic-face-drawing-options+ + #:+bold-face+ #:+bold-face-drawing-options+ + #:+bold-italic-face+ #:+bold-italic-drawing-options+ + + #:*keyword-drawing-options* + #:*special-operator-drawing-options* + #:*special-variable-drawing-options* + + ;; DREI program interface stuff. #:with-drei-options #:performing-drei-operations #:invoke-performing-drei-operations #:with-bound-drei-special-variables
--- /project/mcclim/cvsroot/mcclim/Drei/drawing-options.lisp 2008/01/07 22:37:17 NONE +++ /project/mcclim/cvsroot/mcclim/Drei/drawing-options.lisp 2008/01/07 22:37:17 1.1 ;;; -*- Mode: Lisp; Package: DREI -*-
;;; (c) copyright 2008 by ;;; Troels Henriksen (athas@sigkill.dk)
;;; This library is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU Library General Public ;;; License as published by the Free Software Foundation; either ;;; version 2 of the License, or (at your option) any later version. ;;; ;;; This library 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 ;;; Library General Public License for more details. ;;; ;;; You should have received a copy of the GNU Library General Public ;;; License along with this library; if not, write to the ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;;; Boston, MA 02111-1307 USA.
;;; A bunch of predefined drawing options, styles and faces to make ;;; syntax highlighting rules more elegant.
(in-package :drei)
;;; Some general styles.
(defconstant +roman-face+ (make-face :style (make-text-style nil :roman nil)) "A face specifying a roman style, but with unspecified family and size.")
(defconstant +italic-face+ (make-face :style (make-text-style nil :italic nil)) "A face specifying an italic style, but with unspecified family and size.")
(defconstant +bold-face+ (make-face :style (make-text-style nil :bold nil)) "A face specifying a boldface style, but with unspecified family and size.")
(defconstant +bold-italic-face+ (make-face :style (make-text-style nil :bold nil)) "A face specifying an italic boldface style, but with unspecified family and size.")
;;; ...and their drawing options.
(defconstant +roman-face-drawing-options+ (make-drawing-options :face +roman-face+) "Options used for drawing with a roman face.")
(defconstant +italic-face-drawing-options+ (make-drawing-options :face +italic-face+) "Options used for drawing with an italic face.")
(defconstant +bold-face-drawing-options+ (make-drawing-options :face +bold-face+) "Options used for drawing with boldface.")
(defconstant +bold-italic-face-drawing-options+ (make-drawing-options :face +bold-italic-face+) "Options used for drawing with italic boldface.")
;;; Some drawing options for specific syntactical elements, ;;; approximately like GNU Emacs. These are not constants, as users ;;; may want to change them to fit their colour scheme.
(defvar *keyword-drawing-options* (make-drawing-options :face (make-face :ink +orchid+)) "The drawing options used for drawing the syntactical equivalent of keyword symbols. In Lisp, this is used for keyword symbols.")
(defvar *special-operator-drawing-options* (make-drawing-options :face (make-face :ink +purple+)) "The drawing options used for drawing the syntactical equivalent of special operators. In Lisp, this is used for macros and special operators, in most other languages, it should probably be used for language keywords.")
(defvar *special-variable-drawing-options* (make-drawing-options :face (make-face :ink +darkgoldenrod+)) "The drawing options used for drawing variables that are somehow special. In Lisp, this is used for globally bound non-constant variables with dynamic scope. In other language, it should probably be used for global variables or similar.")