org.gjt.sp.jedit.syntax
Class Chunk

java.lang.Object
  |
  +--org.gjt.sp.jedit.syntax.Token
        |
        +--org.gjt.sp.jedit.syntax.Chunk

public class Chunk
extends Token

A syntax token with extra information required for painting it on screen.

Since:
jEdit 4.1pre1

Field Summary
 boolean accessable
           
 float charWidth
           
static boolean DEBUG
           
 java.awt.font.GlyphVector gv
           
 boolean monospaced
           
 SyntaxStyle style
           
 boolean visible
           
 float width
           
 
Fields inherited from class org.gjt.sp.jedit.syntax.Token
COMMENT1, COMMENT2, DIGIT, END, FUNCTION, id, ID_COUNT, INVALID, KEYWORD1, KEYWORD2, KEYWORD3, LABEL, length, LITERAL1, LITERAL2, MARKUP, next, NULL, offset, OPERATOR, rules, TAB, WHITESPACE
 
Constructor Summary
Chunk(byte id, int offset, int length, ParserRuleSet rules)
           
Chunk(float width, int offset, ParserRuleSet rules)
           
 
Method Summary
 float[] getPositions()
           
 void init(javax.swing.text.Segment seg, javax.swing.text.TabExpander expander, float x, SyntaxStyle[] styles, java.awt.font.FontRenderContext fontRenderContext, byte defaultID, float charWidth)
           
static float offsetToX(Chunk chunks, int offset)
          Converts an offset in a chunk list into an x co-ordinate.
 float offsetToX(int offset)
           
static float paintChunkList(javax.swing.text.Segment lineText, Chunk chunks, java.awt.Graphics2D gfx, float x, float y, java.awt.Color background, boolean glyphVector)
          Paints a chunk list.
static int xToOffset(Chunk chunks, float x, boolean round)
          Converts an x co-ordinate in a chunk list into an offset.
 int xToOffset(float x, boolean round)
           
 
Methods inherited from class org.gjt.sp.jedit.syntax.Token
stringToToken, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG

accessable

public boolean accessable

visible

public boolean visible

monospaced

public boolean monospaced

charWidth

public float charWidth

style

public SyntaxStyle style

width

public float width

gv

public java.awt.font.GlyphVector gv
Constructor Detail

Chunk

public Chunk(float width,
             int offset,
             ParserRuleSet rules)

Chunk

public Chunk(byte id,
             int offset,
             int length,
             ParserRuleSet rules)
Method Detail

paintChunkList

public static float paintChunkList(javax.swing.text.Segment lineText,
                                   Chunk chunks,
                                   java.awt.Graphics2D gfx,
                                   float x,
                                   float y,
                                   java.awt.Color background,
                                   boolean glyphVector)
Paints a chunk list.

Parameters:
lineText - The line text
chunks - The chunk list
gfx - The graphics context
x - The x co-ordinate
y - The y co-ordinate
background - The background color of the painting area, used for the background color hack
Returns:
The width of the painted text
Since:
jEdit 4.1pre1

offsetToX

public static float offsetToX(Chunk chunks,
                              int offset)
Converts an offset in a chunk list into an x co-ordinate.

Parameters:
chunks - The chunk list
offset - The offset
Since:
jEdit 4.1pre1

xToOffset

public static int xToOffset(Chunk chunks,
                            float x,
                            boolean round)
Converts an x co-ordinate in a chunk list into an offset.

Parameters:
chunks - The chunk list
x - The x co-ordinate
round - Round up to next letter if past the middle of a letter?
Returns:
The offset within the line, or -1 if the x co-ordinate is too far to the right
Since:
jEdit 4.1pre1

getPositions

public final float[] getPositions()

offsetToX

public final float offsetToX(int offset)

xToOffset

public final int xToOffset(float x,
                           boolean round)

init

public void init(javax.swing.text.Segment seg,
                 javax.swing.text.TabExpander expander,
                 float x,
                 SyntaxStyle[] styles,
                 java.awt.font.FontRenderContext fontRenderContext,
                 byte defaultID,
                 float charWidth)