Skip to content

Commit

Permalink
Added synthesis option for selection color.
Browse files Browse the repository at this point in the history
  • Loading branch information
soerendomroes authored and EhsanKhodadad committed Aug 21, 2024
1 parent d62028e commit 9d48a70
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ public List<SynthesisOption> 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand All @@ -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);
}
Expand All @@ -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);
}

Expand Down

0 comments on commit 9d48a70

Please sign in to comment.