Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colored highlighting of selected diagram edges #2324

Merged
merged 6 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
soerendomroes marked this conversation as resolved.
Show resolved Hide resolved
// 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 Down Expand Up @@ -57,6 +58,7 @@
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 +78,12 @@ 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";
soerendomroes marked this conversation as resolved.
Show resolved Hide resolved

public static final SynthesisOption SELECTION_HIGHLIGHTING_COLOR =
SynthesisOption.createCheckOption(SELECTION_HIGHLIGHTING_COLOR_LABEL, false)
.setCategory(LinguaFrancaSynthesis.APPEARANCE);

soerendomroes marked this conversation as resolved.
Show resolved Hide resolved
public KRendering noSelectionStyle(KRendering r) {
return _kRenderingExtensions.setSelectionTextStrikeout(r, false);
}
Expand All @@ -86,6 +94,11 @@ 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
boolean selectionColor = getBooleanValue(SELECTION_HIGHLIGHTING_COLOR);
if (selectionColor) {
_kRenderingExtensions.setSelectionForeground(r, Colors.ORANGE_1);
}
soerendomroes marked this conversation as resolved.
Show resolved Hide resolved
return _kRenderingExtensions.setSelectionLineWidth(r, lineWidthValue * 2);
}

Expand Down
Loading