/[libvob]/libvob/org/nongnu/libvob/vobs/TextVob.java
ViewVC logotype

Diff of /libvob/org/nongnu/libvob/vobs/TextVob.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by tjl, Fri Mar 21 09:42:51 2003 UTC revision 1.4 by mudyc, Tue May 13 22:33:07 2003 UTC
# Line 31  import org.nongnu.libvob.impl.awt.*; Line 31  import org.nongnu.libvob.impl.awt.*;
31  import org.nongnu.libvob.impl.gl.*;  import org.nongnu.libvob.impl.gl.*;
32  import org.nongnu.libvob.linebreaking.*;  import org.nongnu.libvob.linebreaking.*;
33  import org.nongnu.libvob.gl.*;  import org.nongnu.libvob.gl.*;
34    import org.nongnu.libvob.util.*;
35  import java.awt.Rectangle;  import java.awt.Rectangle;
36  import java.awt.Shape;  import java.awt.Shape;
37    import java.awt.Color;
38    
39  /** A single contiguous text string as a Vob.  /** A single contiguous text string as a Vob.
40   * This vob implements the HBox interface so it is   * This vob implements the HBox interface so it is
# Line 59  String rcsid = "$Id$"; Line 61  String rcsid = "$Id$";
61      protected final TextStyle style;      protected final TextStyle style;
62      protected final String text;      protected final String text;
63      protected final boolean baselined;      protected final boolean baselined;
64      protected String textColor = null;      protected Color color = null;
65        protected String colorString = null;
66    
67      protected Object key;      protected Object key;
68    
# Line 72  String rcsid = "$Id$"; Line 75  String rcsid = "$Id$";
75       *                  If false, the text will be comfortably within the box.       *                  If false, the text will be comfortably within the box.
76       */       */
77      public TextVob(TextStyle style, String text, boolean baselined) {      public TextVob(TextStyle style, String text, boolean baselined) {
78          this(style, text, baselined, null);          this(style, text, baselined, (String)null);
79      }      }
80    
81      /** Same as another constructor but in GL side you can give the color      /** Same as another constructor but in GL side you can give the color
82       * with string like "Color 1 0.5 0.5"       * with string like "Color 1 0.5 0.5"
83       * @param color OpenGL Color used to draw the text.       * @param color OpenGL Color used to draw the text.
84       */       */
85        public TextVob(TextStyle style, String text, boolean baselined, Color color) {
86            super();
87            this.style = style;
88            this.baselined = baselined;
89            this.text = text;
90    
91            this.color = color;
92            if (color != null)
93                this.colorString ="Color "+ ColorUtil.colorGLString(color);
94        }
95    
96      public TextVob(TextStyle style, String text, boolean baselined, String color) {      public TextVob(TextStyle style, String text, boolean baselined, String color) {
97          super();          super();
98          this.style = style;          this.style = style;
99          this.baselined = baselined;          this.baselined = baselined;
100          this.text = text;          this.text = text;
101    
102          this.textColor = color;          this.colorString = color;
103      }      }
104    
105    
# Line 96  String rcsid = "$Id$"; Line 110  String rcsid = "$Id$";
110      }      }
111    
112      public TextVob(TextStyle style, String text, boolean baselined, Object key) {      public TextVob(TextStyle style, String text, boolean baselined, Object key) {
113          this(style, text, baselined, null);          this(style, text, baselined, (String)null);
114        }
115        public TextVob(TextStyle style, String text, boolean baselined, Object key, Color color) {
116            this(style, text, baselined, color);
117            this.color = color;
118      }      }
119      public TextVob(TextStyle style, String text, boolean baselined, Object key, String color) {      public TextVob(TextStyle style, String text, boolean baselined, Object key, String color) {
120          this(style, text, baselined, color);          this(style, text, baselined, color);
# Line 205  String rcsid = "$Id$"; Line 223  String rcsid = "$Id$";
223    
224      private Vob setColor() {      private Vob setColor() {
225          if(setColor == null) {          if(setColor == null) {
226              setColor = GLCache.getCallList(this.textColor == null ? "" : this.textColor);              setColor = GLCache.getCallList(this.colorString == null ? "" : this.colorString);
227          }          }
228          return setColor;          return setColor;
229      }      }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26