/** * Called on editor settings change. Current model is expected to drop all cached information * about the settings if any. */ public void reinitSettings() { boolean softWrapsUsedBefore = myUseSoftWraps; myUseSoftWraps = areSoftWrapsEnabledInEditor(); int tabWidthBefore = myTabWidth; myTabWidth = EditorUtil.getTabSize(myEditor); boolean fontsChanged = false; if (!myFontPreferences.equals(myEditor.getColorsScheme().getFontPreferences()) && myEditorTextRepresentationHelper instanceof DefaultEditorTextRepresentationHelper) { fontsChanged = true; myEditor.getColorsScheme().getFontPreferences().copyTo(myFontPreferences); ((DefaultEditorTextRepresentationHelper) myEditorTextRepresentationHelper) .clearSymbolWidthCache(); myPainter.reinit(); } if ((myUseSoftWraps ^ softWrapsUsedBefore) || (tabWidthBefore >= 0 && myTabWidth != tabWidthBefore) || fontsChanged) { myApplianceManager.reset(); myDeferredFoldRegions.clear(); myStorage.removeAll(); myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER); } }
@Override public int paint( @NotNull Graphics g, @NotNull SoftWrapDrawingType drawingType, int x, int y, int lineHeight) { if (!isSoftWrappingEnabled()) { return 0; } return myPainter.paint(g, drawingType, x, y, lineHeight); }
@Override public int paint( @NotNull Graphics g, @NotNull SoftWrapDrawingType drawingType, int x, int y, int lineHeight) { if (!isSoftWrappingEnabled()) { return 0; } if (!myEditor.getSettings().isAllSoftWrapsShown()) { int visualLine = y / lineHeight; LogicalPosition position = myEditor.visualToLogicalPosition(new VisualPosition(visualLine, 0)); if (position.line != myEditor.getCaretModel().getLogicalPosition().line) { return myPainter.getDrawingHorizontalOffset(g, drawingType, x, y, lineHeight); } } return doPaint(g, drawingType, x, y, lineHeight); }
@Override public int getMinDrawingWidthInPixels(@NotNull SoftWrapDrawingType drawingType) { return myPainter.getMinDrawingWidth(drawingType); }
public int doPaint( @NotNull Graphics g, @NotNull SoftWrapDrawingType drawingType, int x, int y, int lineHeight) { return myPainter.paint(g, drawingType, x, y, lineHeight); }