StyleRange getStyleRange(StyleRange style) { if (style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) hasLinks = true; if (style.start == 0 && style.length == 0 && style.fontStyle == SWT.NORMAL) return style; StyleRange clone = (StyleRange)style.clone(); clone.start = clone.length = 0; clone.fontStyle = SWT.NORMAL; if (clone.font == null) clone.font = getFont(style.fontStyle); return clone; } TextLayout getTextLayout(int lineIndex) {
StyleRange getStyleRange(StyleRange style) { if (style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) hasLinks = true; if (style.start == 0 && style.length == 0 && style.fontStyle == SWT.NORMAL) return style; StyleRange clone = (StyleRange)style.clone(); clone.start = clone.length = 0; clone.fontStyle = SWT.NORMAL; if (clone.font == null) clone.font = getFont(style.fontStyle); return clone; } TextLayout getTextLayout(int lineIndex) {
StyleRange getStyleRange(StyleRange style) { if (style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) hasLinks = true; if (style.start == 0 && style.length == 0 && style.fontStyle == SWT.NORMAL) return style; StyleRange clone = (StyleRange)style.clone(); clone.start = clone.length = 0; clone.fontStyle = SWT.NORMAL; if (clone.font == null) clone.font = getFont(style.fontStyle); return clone; } TextLayout getTextLayout(int lineIndex) {
StyleRange getStyleRange(StyleRange style) { if (style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) hasLinks = true; if (style.start == 0 && style.length == 0 && style.fontStyle == SWT.NORMAL) return style; StyleRange clone = (StyleRange)style.clone(); clone.start = clone.length = 0; clone.fontStyle = SWT.NORMAL; if (clone.font == null) clone.font = getFont(style.fontStyle); return clone; } TextLayout getTextLayout(int lineIndex) {
StyleRange getStyleRange(StyleRange style) { if (style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) hasLinks = true; if (style.start == 0 && style.length == 0 && style.fontStyle == SWT.NORMAL) return style; StyleRange clone = (StyleRange)style.clone(); clone.start = clone.length = 0; clone.fontStyle = SWT.NORMAL; if (clone.font == null) clone.font = getFont(style.fontStyle); return clone; } TextLayout getTextLayout(int lineIndex) {
void drawBullet(Bullet bullet, GC gc, int paintX, int paintY, int index, int lineAscent, int lineDescent) { StyleRange style = bullet.style; GlyphMetrics metrics = style.metrics; Color color = style.foreground; if (color != null) gc.setForeground(color); Font font = style.font; if (font != null) gc.setFont(font); String string = ""; int type = bullet.type & (ST.BULLET_DOT|ST.BULLET_NUMBER|ST.BULLET_LETTER_LOWER|ST.BULLET_LETTER_UPPER); switch (type) { case ST.BULLET_DOT: string = "\u2022"; break; case ST.BULLET_NUMBER: string = String.valueOf(index + 1); break; case ST.BULLET_LETTER_LOWER: string = String.valueOf((char) (index % 26 + 97)); break; case ST.BULLET_LETTER_UPPER: string = String.valueOf((char) (index % 26 + 65)); break; } if ((bullet.type & ST.BULLET_TEXT) != 0) string += bullet.text; Display display = styledText.getDisplay(); TextLayout layout = new TextLayout(display); layout.setText(string); layout.setAscent(lineAscent); layout.setDescent(lineDescent); style = (StyleRange)style.clone(); style.metrics = null; if (style.font == null) style.font = getFont(style.fontStyle); layout.setStyle(style, 0, string.length()); int x = paintX + Math.max(0, metrics.width - layout.getBounds().width - BULLET_MARGIN); layout.draw(gc, x, paintY); layout.dispose(); } int drawLine(int lineIndex, int paintX, int paintY, GC gc, Color widgetBackground, Color widgetForeground) {
void drawBullet(Bullet bullet, GC gc, int paintX, int paintY, int index, int lineAscent, int lineDescent) { StyleRange style = bullet.style; GlyphMetrics metrics = style.metrics; Color color = style.foreground; if (color != null) gc.setForeground(color); Font font = style.font; if (font != null) gc.setFont(font); String string = ""; int type = bullet.type & (ST.BULLET_DOT|ST.BULLET_NUMBER|ST.BULLET_LETTER_LOWER|ST.BULLET_LETTER_UPPER); switch (type) { case ST.BULLET_DOT: string = "\u2022"; break; case ST.BULLET_NUMBER: string = String.valueOf(index + 1); break; case ST.BULLET_LETTER_LOWER: string = String.valueOf((char) (index % 26 + 97)); break; case ST.BULLET_LETTER_UPPER: string = String.valueOf((char) (index % 26 + 65)); break; } if ((bullet.type & ST.BULLET_TEXT) != 0) string += bullet.text; Display display = styledText.getDisplay(); TextLayout layout = new TextLayout(display); layout.setText(string); layout.setAscent(lineAscent); layout.setDescent(lineDescent); style = (StyleRange)style.clone(); style.metrics = null; if (style.font == null) style.font = getFont(style.fontStyle); layout.setStyle(style, 0, string.length()); int x = paintX + Math.max(0, metrics.width - layout.getBounds().width - BULLET_MARGIN); layout.draw(gc, x, paintY); layout.dispose(); } int drawLine(int lineIndex, int paintX, int paintY, GC gc, Color widgetBackground, Color widgetForeground) {
void drawBullet(Bullet bullet, GC gc, int paintX, int paintY, int index, int lineAscent, int lineDescent) { StyleRange style = bullet.style; GlyphMetrics metrics = style.metrics; Color color = style.foreground; if (color != null) gc.setForeground(color); Font font = style.font; if (font != null) gc.setFont(font); String string = ""; int type = bullet.type & (ST.BULLET_DOT|ST.BULLET_NUMBER|ST.BULLET_LETTER_LOWER|ST.BULLET_LETTER_UPPER); switch (type) { case ST.BULLET_DOT: string = "\u2022"; break; case ST.BULLET_NUMBER: string = String.valueOf(index + 1); break; case ST.BULLET_LETTER_LOWER: string = String.valueOf((char) (index % 26 + 97)); break; case ST.BULLET_LETTER_UPPER: string = String.valueOf((char) (index % 26 + 65)); break; } if ((bullet.type & ST.BULLET_TEXT) != 0) string += bullet.text; Display display = styledText.getDisplay(); TextLayout layout = new TextLayout(display); layout.setText(string); layout.setAscent(lineAscent); layout.setDescent(lineDescent); style = (StyleRange)style.clone(); style.metrics = null; if (style.font == null) style.font = getFont(style.fontStyle); layout.setStyle(style, 0, string.length()); int x = paintX + Math.max(0, metrics.width - layout.getBounds().width - BULLET_MARGIN); layout.draw(gc, x, paintY); layout.dispose(); } int drawLine(int lineIndex, int paintX, int paintY, GC gc, Color widgetBackground, Color widgetForeground) {
void drawBullet(Bullet bullet, GC gc, int paintX, int paintY, int index, int lineAscent, int lineDescent) { StyleRange style = bullet.style; GlyphMetrics metrics = style.metrics; Color color = style.foreground; if (color != null) gc.setForeground(color); Font font = style.font; if (font != null) gc.setFont(font); String string = ""; int type = bullet.type & (ST.BULLET_DOT|ST.BULLET_NUMBER|ST.BULLET_LETTER_LOWER|ST.BULLET_LETTER_UPPER); switch (type) { case ST.BULLET_DOT: string = "\u2022"; break; case ST.BULLET_NUMBER: string = String.valueOf(index + 1); break; case ST.BULLET_LETTER_LOWER: string = String.valueOf((char) (index % 26 + 97)); break; case ST.BULLET_LETTER_UPPER: string = String.valueOf((char) (index % 26 + 65)); break; } if ((bullet.type & ST.BULLET_TEXT) != 0) string += bullet.text; Display display = styledText.getDisplay(); TextLayout layout = new TextLayout(display); layout.setText(string); layout.setAscent(lineAscent); layout.setDescent(lineDescent); style = (StyleRange)style.clone(); style.metrics = null; if (style.font == null) style.font = getFont(style.fontStyle); layout.setStyle(style, 0, string.length()); int x = paintX + Math.max(0, metrics.width - layout.getBounds().width - BULLET_MARGIN); layout.draw(gc, x, paintY); layout.dispose(); } int drawLine(int lineIndex, int paintX, int paintY, GC gc, Color widgetBackground, Color widgetForeground) {
style = (StyleRange)style.clone(); style.metrics = null; if (style.font == null) style.font = getFont(style.fontStyle); layout.setStyle(style, 0, string.length()); int x = paintX + Math.max(0, metrics.width - layout.getBounds().width - BULLET_MARGIN);
layout.setText(" "); layout.setFont(font); layout.setStyle(new TextStyle(getFont(SWT.NORMAL), null, null), 0, 0); layout.setStyle(new TextStyle(getFont(SWT.BOLD), null, null), 1, 1); layout.setStyle(new TextStyle(getFont(SWT.ITALIC), null, null), 2, 2); layout.setStyle(new TextStyle(getFont(SWT.BOLD | SWT.ITALIC), null, null), 3, 3); FontMetrics metrics = layout.getLineMetrics(0); ascent = metrics.getAscent() + metrics.getLeading();
layout.setText(" "); layout.setFont(font); layout.setStyle(new TextStyle(getFont(SWT.NORMAL), null, null), 0, 0); layout.setStyle(new TextStyle(getFont(SWT.BOLD), null, null), 1, 1); layout.setStyle(new TextStyle(getFont(SWT.ITALIC), null, null), 2, 2); layout.setStyle(new TextStyle(getFont(SWT.BOLD | SWT.ITALIC), null, null), 3, 3); FontMetrics metrics = layout.getLineMetrics(0); ascent = metrics.getAscent() + metrics.getLeading();
layout.setText(" "); layout.setFont(font); layout.setStyle(new TextStyle(getFont(SWT.NORMAL), null, null), 0, 0); layout.setStyle(new TextStyle(getFont(SWT.BOLD), null, null), 1, 1); layout.setStyle(new TextStyle(getFont(SWT.ITALIC), null, null), 2, 2); layout.setStyle(new TextStyle(getFont(SWT.BOLD | SWT.ITALIC), null, null), 3, 3); FontMetrics metrics = layout.getLineMetrics(0); ascent = metrics.getAscent() + metrics.getLeading();
layout.setText(" "); layout.setFont(font); layout.setStyle(new TextStyle(getFont(SWT.NORMAL), null, null), 0, 0); layout.setStyle(new TextStyle(getFont(SWT.BOLD), null, null), 1, 1); layout.setStyle(new TextStyle(getFont(SWT.ITALIC), null, null), 2, 2); layout.setStyle(new TextStyle(getFont(SWT.BOLD | SWT.ITALIC), null, null), 3, 3); FontMetrics metrics = layout.getLineMetrics(0); ascent = metrics.getAscent() + metrics.getLeading();
layout.setText(" "); layout.setFont(font); layout.setStyle(new TextStyle(getFont(SWT.NORMAL), null, null), 0, 0); layout.setStyle(new TextStyle(getFont(SWT.BOLD), null, null), 1, 1); layout.setStyle(new TextStyle(getFont(SWT.ITALIC), null, null), 2, 2); layout.setStyle(new TextStyle(getFont(SWT.BOLD | SWT.ITALIC), null, null), 3, 3); FontMetrics metrics = layout.getLineMetrics(0); ascent = metrics.getAscent() + metrics.getLeading();