Package com.biglybt.ui.swt.shells
Class GCStringPrinter
java.lang.Object
com.biglybt.ui.swt.shells.GCStringPrinter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private static final boolean
private org.eclipse.swt.graphics.Rectangle
private static final char
static final int
static final int
static final int
static final int
private org.eclipse.swt.graphics.GC
private static final String
private int
private org.eclipse.swt.graphics.Image[]
private float[]
private boolean
private List
<GCStringPrinter.URLInfo> private static final int
private static final int
private static final Pattern
private static final Pattern
private static final Pattern
private org.eclipse.swt.graphics.Point
private org.eclipse.swt.graphics.Rectangle
private int
private org.eclipse.swt.graphics.Point
private String
private int
private boolean
private org.eclipse.swt.graphics.Color
private boolean
-
Constructor Summary
ConstructorsConstructorDescriptionGCStringPrinter
(org.eclipse.swt.graphics.GC gc, String string, org.eclipse.swt.graphics.Rectangle printArea, boolean skipClip, boolean fullLinesOnly, int swtFlags) GCStringPrinter
(org.eclipse.swt.graphics.GC gc, String string, org.eclipse.swt.graphics.Rectangle printArea, int printFlags, int swtFlags) -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
private boolean
void
private void
drawLine
(org.eclipse.swt.graphics.GC gc, GCStringPrinter.LineInfo lineInfo, int swtFlags, org.eclipse.swt.graphics.Rectangle printArea, boolean noDraw) printArea is updated to the position of the next rowprivate static void
private org.eclipse.swt.graphics.Point
drawText
(org.eclipse.swt.graphics.GC gc, String s, int x, int y, int height, List<org.eclipse.swt.graphics.Rectangle> hitAreas, boolean nodraw, boolean calcExtent) org.eclipse.swt.graphics.Rectangle
Get the area that was drawn to.org.eclipse.swt.graphics.Point
org.eclipse.swt.graphics.Point
getHitUrl
(int x, int y) float[]
org.eclipse.swt.graphics.Rectangle
getText()
org.eclipse.swt.graphics.Color
boolean
boolean
isCutoff()
boolean
boolean
static void
boolean
boolean
printString
(int _printFlags) static boolean
printString
(org.eclipse.swt.graphics.GC gc, String string, org.eclipse.swt.graphics.Rectangle printArea) static boolean
printString
(org.eclipse.swt.graphics.GC gc, String string, org.eclipse.swt.graphics.Rectangle printArea, boolean skipClip, boolean fullLinesOnly) static boolean
printString
(org.eclipse.swt.graphics.GC gc, String string, org.eclipse.swt.graphics.Rectangle printArea, boolean skipClip, boolean fullLinesOnly, int swtFlags) void
printString
(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle, int swtFlags) DO NOT REMOVE OR CHANGE RETURN TYPE -- USED BY PLUGINSboolean
printString2
(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle, int swtFlags) private GCStringPrinter.LineInfo
processLine
(org.eclipse.swt.graphics.GC gc, GCStringPrinter.LineInfo lineInfo, org.eclipse.swt.graphics.Rectangle printArea, boolean fullLinesOnly, boolean hasMoreElements, boolean isLastLine) private int
processWord
(org.eclipse.swt.graphics.GC gc, String sLine, String word, org.eclipse.swt.graphics.Rectangle printArea, GCStringPrinter.LineInfo lineInfo, StringBuffer outputLine, StringBuffer space, boolean isLastLine) void
setImages
(org.eclipse.swt.graphics.Image[] images) void
setImageScales
(float[] imageScales) void
setUrlColor
(org.eclipse.swt.graphics.Color urlColor) static org.eclipse.swt.graphics.Point
stringExtent
(org.eclipse.swt.graphics.GC gc, String text) private boolean
private boolean
private static org.eclipse.swt.graphics.Point
textExtent
(org.eclipse.swt.graphics.GC gc, String text) private String
private void
truncate
(StringBuffer buffer, int len)
-
Field Details
-
ELLIPSIS
private static final char ELLIPSIS- See Also:
-
DEBUG
private static final boolean DEBUG- See Also:
-
GOOD_STRING
- See Also:
-
FLAG_SKIPCLIP
public static final int FLAG_SKIPCLIP- See Also:
-
FLAG_FULLLINESONLY
public static final int FLAG_FULLLINESONLY- See Also:
-
FLAG_NODRAW
public static final int FLAG_NODRAW- See Also:
-
FLAG_KEEP_URL_INFO
public static final int FLAG_KEEP_URL_INFO- See Also:
-
patHREF
-
patAHREF_TITLE
-
patAHREF_TARGET
-
MAX_LINE_LEN
private static final int MAX_LINE_LEN- See Also:
-
MAX_WORD_LEN
private static final int MAX_WORD_LEN- See Also:
-
cutoff
private boolean cutoff -
truncated
private boolean truncated -
isWordCut
private boolean isWordCut -
gc
private org.eclipse.swt.graphics.GC gc -
string
-
printArea
private org.eclipse.swt.graphics.Rectangle printArea -
swtFlags
private int swtFlags -
printFlags
private int printFlags -
size
private org.eclipse.swt.graphics.Point size -
preferredSize
private org.eclipse.swt.graphics.Point preferredSize -
urlColor
private org.eclipse.swt.graphics.Color urlColor -
listUrlInfo
-
images
private org.eclipse.swt.graphics.Image[] images -
imageScales
private float[] imageScales -
iCurrentHeight
private int iCurrentHeight -
wrap
private boolean wrap -
drawRect
private org.eclipse.swt.graphics.Rectangle drawRect
-
-
Constructor Details
-
GCStringPrinter
public GCStringPrinter(org.eclipse.swt.graphics.GC gc, String string, org.eclipse.swt.graphics.Rectangle printArea, boolean skipClip, boolean fullLinesOnly, int swtFlags) -
GCStringPrinter
public GCStringPrinter(org.eclipse.swt.graphics.GC gc, String string, org.eclipse.swt.graphics.Rectangle printArea, int printFlags, int swtFlags)
-
-
Method Details
-
printString
public static boolean printString(org.eclipse.swt.graphics.GC gc, String string, org.eclipse.swt.graphics.Rectangle printArea) -
printString
public static boolean printString(org.eclipse.swt.graphics.GC gc, String string, org.eclipse.swt.graphics.Rectangle printArea, boolean skipClip, boolean fullLinesOnly) -
printString
public static boolean printString(org.eclipse.swt.graphics.GC gc, String string, org.eclipse.swt.graphics.Rectangle printArea, boolean skipClip, boolean fullLinesOnly, int swtFlags) - Parameters:
gc
- GC to print onstring
- Text to printprintArea
- Area of GC to print text toskipClip
- Don't set any clipping on the GC. Text may overhang printArea when this is truefullLinesOnly
- If bottom of a line will be chopped off, do not display itswtFlags
- SWT flags. SWT.CENTER, SWT.BOTTOM, SWT.TOP, SWT.WRAP- Returns:
- whether it fit
-
_printString
private boolean _printString() -
swt_printString_NoAdvanced
private boolean swt_printString_NoAdvanced() -
swt_printString
private boolean swt_printString() -
__printString
private boolean __printString()- Parameters:
gc
-string
-printArea
-printFlags
-swtFlags
-- Returns:
- Since:
- 3.0.4.3
-
processLine
private GCStringPrinter.LineInfo processLine(org.eclipse.swt.graphics.GC gc, GCStringPrinter.LineInfo lineInfo, org.eclipse.swt.graphics.Rectangle printArea, boolean fullLinesOnly, boolean hasMoreElements, boolean isLastLine) - Parameters:
hasMoreElements
-line
-- Since:
- 3.0.0.7
-
truncate
-
truncate
-
processWord
private int processWord(org.eclipse.swt.graphics.GC gc, String sLine, String word, org.eclipse.swt.graphics.Rectangle printArea, GCStringPrinter.LineInfo lineInfo, StringBuffer outputLine, StringBuffer space, boolean isLastLine) - Parameters:
int
- Position of part of word that didn't fit- Since:
- 3.0.0.7
-
drawLine
private void drawLine(org.eclipse.swt.graphics.GC gc, GCStringPrinter.LineInfo lineInfo, int swtFlags, org.eclipse.swt.graphics.Rectangle printArea, boolean noDraw) printArea is updated to the position of the next row- Parameters:
gc
-swtFlags
-printArea
-noDraw
-outputLine
-
-
drawText
-
stringExtent
public static org.eclipse.swt.graphics.Point stringExtent(org.eclipse.swt.graphics.GC gc, String text) -
textExtent
private static org.eclipse.swt.graphics.Point textExtent(org.eclipse.swt.graphics.GC gc, String text) -
drawText
private static void drawText(org.eclipse.swt.graphics.GC gc, String text, int x, int y, boolean transparent) -
main
-
printString
public boolean printString() -
printString
public boolean printString(int _printFlags) -
calculateMetrics
public void calculateMetrics() -
printString
public void printString(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle, int swtFlags) DO NOT REMOVE OR CHANGE RETURN TYPE -- USED BY PLUGINS -
printString2
public boolean printString2(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle, int swtFlags) -
getCalculatedSize
public org.eclipse.swt.graphics.Point getCalculatedSize() -
getCalculatedPreferredSize
public org.eclipse.swt.graphics.Point getCalculatedPreferredSize() -
getUrlColor
public org.eclipse.swt.graphics.Color getUrlColor() -
setUrlColor
public void setUrlColor(org.eclipse.swt.graphics.Color urlColor) -
getHitUrl
-
getHitUrlInfo
-
hasHitUrl
public boolean hasHitUrl() -
isCutoff
public boolean isCutoff() -
isTruncated
public boolean isTruncated() -
setImages
public void setImages(org.eclipse.swt.graphics.Image[] images) -
getImageScales
public float[] getImageScales() -
setImageScales
public void setImageScales(float[] imageScales) -
getText
- Returns:
- Since:
- 4.0.0.1
-
isWordCut
public boolean isWordCut() -
getCalculatedDrawRect
public org.eclipse.swt.graphics.Rectangle getCalculatedDrawRect()Get the area that was drawn to. Draw Rectangle is a subset of the original printArea that was painted on. In cases where text was centered vertically, or bottom aligned, y may be larger than printArea.y.x
may be difference if text is centered or right aligned. Note:x
is only adjusted if text is drawn. Returned width and height are the same asgetCalculatedSize()
-
getPrintArea
public org.eclipse.swt.graphics.Rectangle getPrintArea()
-