Search in sources :

Example 1 with EffectType

use of com.intellij.openapi.editor.markup.EffectType in project intellij-community by JetBrains.

the class EclipseThemeReader method readTextAttributes.

private static TextAttributes readTextAttributes(@NotNull String tag, Attributes attributes, boolean isBackground) throws SAXException {
    TextAttributes textAttributes = new TextAttributes();
    Color color = getColor(attributes);
    if (isBackground) {
        textAttributes.setBackgroundColor(color);
    } else {
        textAttributes.setForegroundColor(color);
    }
    textAttributes.setFontType(getFontStyle(tag, attributes));
    EffectType effectType = getEffectType(attributes);
    if (effectType != null) {
        textAttributes.setEffectType(effectType);
        textAttributes.setEffectColor(textAttributes.getForegroundColor());
    }
    return textAttributes;
}
Also used : TextAttributes(com.intellij.openapi.editor.markup.TextAttributes) EffectType(com.intellij.openapi.editor.markup.EffectType)

Example 2 with EffectType

use of com.intellij.openapi.editor.markup.EffectType in project intellij-community by JetBrains.

the class ColorAndFontDescriptionPanel method reset.

public void reset(@NotNull EditorSchemeAttributeDescriptor attrDescription) {
    if (!(attrDescription instanceof ColorAndFontDescription))
        return;
    ColorAndFontDescription description = (ColorAndFontDescription) attrDescription;
    if (description.isFontEnabled()) {
        myLabelFont.setEnabled(description.isEditable());
        myCbBold.setEnabled(description.isEditable());
        myCbItalic.setEnabled(description.isEditable());
        int fontType = description.getFontType();
        myCbBold.setSelected(BitUtil.isSet(fontType, Font.BOLD));
        myCbItalic.setSelected(BitUtil.isSet(fontType, Font.ITALIC));
    } else {
        myLabelFont.setEnabled(false);
        myCbBold.setSelected(false);
        myCbBold.setEnabled(false);
        myCbItalic.setSelected(false);
        myCbItalic.setEnabled(false);
    }
    updateColorChooser(myCbForeground, myForegroundChooser, description.isForegroundEnabled(), description.isForegroundChecked(), description.getForegroundColor());
    updateColorChooser(myCbBackground, myBackgroundChooser, description.isBackgroundEnabled(), description.isBackgroundChecked(), description.getBackgroundColor());
    updateColorChooser(myCbErrorStripe, myErrorStripeColorChooser, description.isErrorStripeEnabled(), description.isErrorStripeChecked(), description.getErrorStripeColor());
    EffectType effectType = description.getEffectType();
    updateColorChooser(myCbEffects, myEffectsColorChooser, description.isEffectsColorEnabled(), description.isEffectsColorChecked(), description.getEffectColor());
    if (description.isEffectsColorEnabled() && description.isEffectsColorChecked()) {
        myEffectsCombo.setEnabled(description.isEditable());
        myEffectsModel.setEffectName(ContainerUtil.reverseMap(myEffectsMap).get(effectType));
    } else {
        myEffectsCombo.setEnabled(false);
    }
    setInheritanceInfo(description);
    myLabelFont.setEnabled(myCbBold.isEnabled() || myCbItalic.isEnabled());
}
Also used : EffectType(com.intellij.openapi.editor.markup.EffectType)

Example 3 with EffectType

use of com.intellij.openapi.editor.markup.EffectType in project intellij-community by JetBrains.

the class SimpleTextAttributes method toTextAttributes.

public TextAttributes toTextAttributes() {
    Color effectColor;
    EffectType effectType;
    if (isWaved()) {
        effectColor = myWaveColor;
        effectType = EffectType.WAVE_UNDERSCORE;
    } else if (isStrikeout()) {
        effectColor = myWaveColor;
        effectType = EffectType.STRIKEOUT;
    } else if (isUnderline()) {
        effectColor = myWaveColor;
        effectType = EffectType.LINE_UNDERSCORE;
    } else if (isBoldDottedLine()) {
        effectColor = myWaveColor;
        effectType = EffectType.BOLD_DOTTED_LINE;
    } else if (isSearchMatch()) {
        effectColor = myWaveColor;
        effectType = EffectType.SEARCH_MATCH;
    } else {
        effectColor = null;
        effectType = null;
    }
    return new TextAttributes(myFgColor, null, effectColor, effectType, myStyle & FONT_MASK);
}
Also used : TextAttributes(com.intellij.openapi.editor.markup.TextAttributes) EffectType(com.intellij.openapi.editor.markup.EffectType)

Example 4 with EffectType

use of com.intellij.openapi.editor.markup.EffectType in project intellij-community by JetBrains.

the class SimpleTextAttributes method fromTextAttributes.

@NotNull
public static SimpleTextAttributes fromTextAttributes(TextAttributes attributes) {
    if (attributes == null)
        return REGULAR_ATTRIBUTES;
    Color foregroundColor = attributes.getForegroundColor();
    if (foregroundColor == null)
        foregroundColor = REGULAR_ATTRIBUTES.getFgColor();
    int style = attributes.getFontType();
    if (attributes.getEffectColor() != null) {
        EffectType effectType = attributes.getEffectType();
        if (effectType == EffectType.STRIKEOUT) {
            style |= STYLE_STRIKEOUT;
        } else if (effectType == EffectType.WAVE_UNDERSCORE) {
            style |= STYLE_WAVED;
        } else if (effectType == EffectType.LINE_UNDERSCORE || effectType == EffectType.BOLD_LINE_UNDERSCORE || effectType == EffectType.BOLD_DOTTED_LINE) {
            style |= STYLE_UNDERLINE;
        } else if (effectType == EffectType.SEARCH_MATCH) {
            style |= STYLE_SEARCH_MATCH;
        } else {
        // not supported
        }
    }
    return new SimpleTextAttributes(attributes.getBackgroundColor(), foregroundColor, attributes.getEffectColor(), style);
}
Also used : EffectType(com.intellij.openapi.editor.markup.EffectType) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with EffectType

use of com.intellij.openapi.editor.markup.EffectType in project intellij-community by JetBrains.

the class ColoredOutputTypeRegistry method createAnsiConsoleViewContentType.

@SuppressWarnings("ConstantConditions")
@NotNull
private static AnsiConsoleViewContentType createAnsiConsoleViewContentType(@NotNull String attribute) {
    int foregroundColor = -1;
    int backgroundColor = -1;
    boolean inverse = false;
    EffectType effectType = null;
    int fontType = -1;
    final String[] strings = attribute.split(";");
    for (String string : strings) {
        int value;
        try {
            value = Integer.parseInt(string);
        } catch (NumberFormatException e) {
            continue;
        }
        if (value == 1) {
            fontType = Font.BOLD;
        } else if (value == 4) {
            effectType = EffectType.LINE_UNDERSCORE;
        } else if (value == 7) {
            inverse = true;
        } else if (value == 22) {
            fontType = Font.PLAIN;
        } else if (value == 24) {
            //not underlined
            effectType = null;
        } else if (value >= 30 && value <= 37) {
            foregroundColor = value - 30;
        } else if (value == 38) {
        //TODO: 256 colors foreground
        } else if (value == 39) {
            foregroundColor = -1;
        } else if (value >= 40 && value <= 47) {
            backgroundColor = value - 40;
        } else if (value == 48) {
        //TODO: 256 colors background
        } else if (value == 49) {
            backgroundColor = -1;
        } else if (value >= 90 && value <= 97) {
            foregroundColor = value - 82;
        } else if (value >= 100 && value <= 107) {
            backgroundColor = value - 92;
        }
    }
    return new AnsiConsoleViewContentType(attribute, backgroundColor, foregroundColor, inverse, effectType, fontType);
}
Also used : EffectType(com.intellij.openapi.editor.markup.EffectType) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

EffectType (com.intellij.openapi.editor.markup.EffectType)7 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)4 NotNull (org.jetbrains.annotations.NotNull)2 RangeHighlighterEx (com.intellij.openapi.editor.ex.RangeHighlighterEx)1 JBColor (com.intellij.ui.JBColor)1 ArrayList (java.util.ArrayList)1