private Caret createInsertCaret(StyledText styledText) { Caret caret= new Caret(styledText, SWT.NULL); // XXX: Filed request to get a caret with auto-height: https://bugs.eclipse.org/bugs/show_bug.cgi?id=118612 caret.setSize(getCaretWidthPreference(), styledText.getLineHeight()); caret.setFont(styledText.getFont()); return caret; }
private Caret createInsertCaret(StyledText styledText) { Caret caret= new Caret(styledText, SWT.NULL); // XXX: Filed request to get a caret with auto-height: https://bugs.eclipse.org/bugs/show_bug.cgi?id=118612 caret.setSize(getCaretWidthPreference(), styledText.getLineHeight()); caret.setFont(styledText.getFont()); return caret; }
private Caret createInsertCaret(StyledText styledText) { Caret caret= new Caret(styledText, SWT.NULL); // XXX: Filed request to get a caret with auto-height: https://bugs.eclipse.org/bugs/show_bug.cgi?id=118612 caret.setSize(getCaretWidthPreference(), styledText.getLineHeight()); caret.setFont(styledText.getFont()); return caret; }
private Caret createRawInsertModeCaret(StyledText styledText) { // don't draw special raw caret if no smart mode is enabled if (!getLegalInsertModes().contains(SMART_INSERT)) return createInsertCaret(styledText); Caret caret= new Caret(styledText, SWT.NULL); Image image= createRawInsertModeCaretImage(styledText); if (image != null) caret.setImage(image); else { // XXX: Filed request to get a caret with auto-height: https://bugs.eclipse.org/bugs/show_bug.cgi?id=118612 caret.setSize(getCaretWidthPreference(), styledText.getLineHeight()); } caret.setFont(styledText.getFont()); return caret; }
private Caret createRawInsertModeCaret(StyledText styledText) { // don't draw special raw caret if no smart mode is enabled if (!getLegalInsertModes().contains(SMART_INSERT)) return createInsertCaret(styledText); Caret caret= new Caret(styledText, SWT.NULL); Image image= createRawInsertModeCaretImage(styledText); if (image != null) caret.setImage(image); else { // XXX: Filed request to get a caret with auto-height: https://bugs.eclipse.org/bugs/show_bug.cgi?id=118612 caret.setSize(getCaretWidthPreference(), styledText.getLineHeight()); } caret.setFont(styledText.getFont()); return caret; }
private Image createRawInsertModeCaretImage(StyledText styledText) { PaletteData caretPalette= new PaletteData(new RGB[] {new RGB (0,0,0), new RGB (255,255,255)}); int width= getCaretWidthPreference(); int widthOffset= width - 1; // XXX: Filed request to get a caret with auto-height: https://bugs.eclipse.org/bugs/show_bug.cgi?id=118612 ImageData imageData= new ImageData(4 + widthOffset, styledText.getLineHeight(), 1, caretPalette); Display display= styledText.getDisplay(); Image bracketImage= new Image(display, imageData); GC gc= new GC (bracketImage); gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance int height= imageData.height / 3; // gap between two bars of one third of the height // draw boxes using lines as drawing a line of a certain width produces // rounded corners. for (int i= 0; i < width ; i++) { gc.drawLine(i, 0, i, height - 1); gc.drawLine(i, imageData.height - height, i, imageData.height - 1); } gc.dispose(); return bracketImage; }
private Image createRawInsertModeCaretImage(StyledText styledText) { PaletteData caretPalette= new PaletteData(new RGB[] {new RGB (0,0,0), new RGB (255,255,255)}); int width= getCaretWidthPreference(); int widthOffset= width - 1; // XXX: Filed request to get a caret with auto-height: https://bugs.eclipse.org/bugs/show_bug.cgi?id=118612 ImageData imageData= new ImageData(4 + widthOffset, styledText.getLineHeight(), 1, caretPalette); Display display= styledText.getDisplay(); Image bracketImage= new Image(display, imageData); GC gc= new GC (bracketImage); gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance int height= imageData.height / 3; // gap between two bars of one third of the height // draw boxes using lines as drawing a line of a certain width produces // rounded corners. for (int i= 0; i < width ; i++) { gc.drawLine(i, 0, i, height - 1); gc.drawLine(i, imageData.height - height, i, imageData.height - 1); } gc.dispose(); return bracketImage; }
private Image createRawInsertModeCaretImage(StyledText styledText) { PaletteData caretPalette= new PaletteData(new RGB[] {new RGB (0,0,0), new RGB (255,255,255)}); int width= getCaretWidthPreference(); int widthOffset= width - 1; // XXX: Filed request to get a caret with auto-height: https://bugs.eclipse.org/bugs/show_bug.cgi?id=118612 ImageData imageData= new ImageData(4 + widthOffset, styledText.getLineHeight(), 1, caretPalette); Display display= styledText.getDisplay(); Image bracketImage= new Image(display, imageData); GC gc= new GC (bracketImage); gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance int height= imageData.height / 3; // gap between two bars of one third of the height // draw boxes using lines as drawing a line of a certain width produces // rounded corners. for (int i= 0; i < width ; i++) { gc.drawLine(i, 0, i, height - 1); gc.drawLine(i, imageData.height - height, i, imageData.height - 1); } gc.dispose(); return bracketImage; }