Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: jpicedt/format/latex/parser/PicColorExpression.java


1   /*
2    PicColorExpression.java - July 23, 2002 - jPicEdt 1.3.2, a picture editor for LaTeX.
3    Copyright (C) 1999-2002 Sylvain Reynal
4   
5    Département de Physique
6    Ecole Nationale Supérieure de l'Electronique et de ses Applications (ENSEA)
7    6, avenue du Ponceau
8    F-95014 CERGY CEDEX
9   
10   Tel : +33 130 736 245
11   Fax : +33 130 736 667
12   e-mail : reynal@ensea.fr
13   jPicEdt web page : http://www.jpicedt.org/
14    
15   This program is free software; you can redistribute it and/or
16   modify it under the terms of the GNU General Public License
17   as published by the Free Software Foundation; either version 2
18   of the License, or any later version.
19    
20   This program is distributed in the hope that it will be useful,
21   but WITHOUT ANY WARRANTY; without even the implied warranty of
22   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23   GNU General Public License for more details.
24    
25   You should have received a copy of the GNU General Public License
26   along with this program; if not, write to the Free Software
27   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28   */
29  
30  package jpicedt.format.latex.parser;
31  
32  import jpicedt.graphic.io.parser.*;
33  import jpicedt.graphic.model.*;
34  
35  import java.awt.Color;
36  
37  /**
38   * jPicEdt syntax (i.e. lines starting with a %)
39   * color : filled/blacken/whiten/shade
40   *
41   */
42  public class PicColorExpression extends AlternateExpression  implements ExpressionConstants, PicObjectConstants {
43  
44      private Pool pool;
45  
46      public PicColorExpression(Pool pl){ 
47      pool = pl;
48      add(new LiteralExpression("filled"){ // old jPicEdt 1.1 format
49        public void action(ParserEvent e){
50          if (DEBUG) System.out.println(e);
51          pool.currentObj.setAttribute(FILL_COLOR,Color.black); 
52          pool.currentObj.setAttribute(FILL_STYLE,SOLID); 
53      }});
54  
55      add(new LiteralExpression("blacken"){
56        public void action(ParserEvent e){
57          if (DEBUG) System.out.println(e);
58          pool.currentObj.setAttribute(FILL_COLOR,Color.black); 
59          pool.currentObj.setAttribute(FILL_STYLE,SOLID); 
60      }});
61  
62      add(new LiteralExpression("whiten"){
63        public void action(ParserEvent e){
64          if (DEBUG) System.out.println(e);
65          pool.currentObj.setAttribute(FILL_COLOR,Color.white); 
66          pool.currentObj.setAttribute(FILL_STYLE,SOLID); 
67      }});
68  
69      add(new LiteralExpression("shade"){
70        public void action(ParserEvent e){
71          if (DEBUG) System.out.println(e);
72          pool.currentObj.setAttribute(FILL_COLOR,Color.gray); 
73          pool.currentObj.setAttribute(FILL_STYLE,SOLID); 
74      }});
75      }
76  }
77