diff --git a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java index 9e4facbfc7..0764bee94c 100644 --- a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java +++ b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java @@ -293,6 +293,7 @@ public List getDisplayedSynthesisOptions() { ModeDiagrams.INITIALLY_COLLAPSE_MODES, SHOW_USER_LABELS, SHOW_HYPERLINKS, + LinguaFrancaStyleExtensions.SELECTION_HIGHLIGHTING_COLOR, // LinguaFrancaSynthesisInterfaceDependencies.SHOW_INTERFACE_DEPENDENCIES, REACTIONS_USE_HYPEREDGES, USE_ALTERNATIVE_DASH_PATTERN, diff --git a/core/src/main/java/org/lflang/diagram/synthesis/styles/LinguaFrancaStyleExtensions.java b/core/src/main/java/org/lflang/diagram/synthesis/styles/LinguaFrancaStyleExtensions.java index cdc2109fc5..2fb497a8d6 100644 --- a/core/src/main/java/org/lflang/diagram/synthesis/styles/LinguaFrancaStyleExtensions.java +++ b/core/src/main/java/org/lflang/diagram/synthesis/styles/LinguaFrancaStyleExtensions.java @@ -28,6 +28,7 @@ import static de.cau.cs.kieler.klighd.krendering.extensions.PositionReferenceY.*; import com.google.inject.Inject; +import de.cau.cs.kieler.klighd.SynthesisOption; import de.cau.cs.kieler.klighd.internal.util.KlighdInternalProperties; import de.cau.cs.kieler.klighd.kgraph.KEdge; import de.cau.cs.kieler.klighd.kgraph.KLabel; @@ -51,12 +52,15 @@ import de.cau.cs.kieler.klighd.krendering.extensions.KRenderingExtensions; import de.cau.cs.kieler.klighd.labels.decoration.IDecoratorRenderingProvider; import de.cau.cs.kieler.klighd.labels.decoration.LabelDecorationConfigurator; + +import java.util.Arrays; import java.util.List; import org.eclipse.elk.core.math.ElkPadding; import org.eclipse.elk.graph.properties.Property; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.xtext.xbase.lib.Extension; import org.lflang.diagram.synthesis.AbstractSynthesisExtensions; +import org.lflang.diagram.synthesis.LinguaFrancaSynthesis; /** * Extension class that provides styles and coloring for the Lingua Franca diagram synthesis. @@ -76,6 +80,14 @@ public class LinguaFrancaStyleExtensions extends AbstractSynthesisExtensions { @Inject @Extension private KPolylineExtensions _kPolylineExtensions; @Extension private KRenderingFactory _kRenderingFactory = KRenderingFactory.eINSTANCE; + public static final String SELECTION_HIGHLIGHTING_COLOR_LABEL = "Selection Coloring"; + + public static final SynthesisOption SELECTION_HIGHLIGHTING_COLOR = + SynthesisOption.createCheckOption( + SELECTION_HIGHLIGHTING_COLOR_LABEL, + false) + .setCategory(LinguaFrancaSynthesis.APPEARANCE); + public KRendering noSelectionStyle(KRendering r) { return _kRenderingExtensions.setSelectionTextStrikeout(r, false); } @@ -87,7 +99,10 @@ public KRendering underlineSelectionStyle(KRendering r) { public KRendering boldLineSelectionStyle(KRendering r) { float lineWidthValue = _kRenderingExtensions.getLineWidthValue(r); // Improve this with content from https://github.com/lf-lang/rfcs/pull/3 - _kRenderingExtensions.setSelectionForeground(r, Colors.ORANGE_1); + boolean selectionColor = getBooleanValue(SELECTION_HIGHLIGHTING_COLOR); + if (selectionColor) { + _kRenderingExtensions.setSelectionForeground(r, Colors.ORANGE_1); + } return _kRenderingExtensions.setSelectionLineWidth(r, lineWidthValue * 2); }