-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make control flow line rendering configurable
- Loading branch information
Showing
4 changed files
with
201 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
.../src/main/java/software/coley/recaf/ui/pane/editing/assembler/ControlFlowLinesConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package software.coley.recaf.ui.pane.editing.assembler; | ||
|
||
import jakarta.annotation.Nonnull; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Inject; | ||
import software.coley.observables.ObservableObject; | ||
import software.coley.recaf.config.BasicConfigContainer; | ||
import software.coley.recaf.config.BasicConfigValue; | ||
import software.coley.recaf.config.ConfigGroups; | ||
|
||
/** | ||
* Config for {@link ControlFlowLines}. | ||
* | ||
* @author Matt Coley | ||
*/ | ||
@ApplicationScoped | ||
public class ControlFlowLinesConfig extends BasicConfigContainer { | ||
private final ObservableObject<ConnectionMode> connectionMode = new ObservableObject<>(ConnectionMode.ALL_CONNECTIONS); | ||
private final ObservableObject<LineRenderMode> renderMode = new ObservableObject<>(LineRenderMode.FLAT); | ||
|
||
@Inject | ||
public ControlFlowLinesConfig() { | ||
super(ConfigGroups.SERVICE_ASSEMBLER, "flow-lines" + CONFIG_SUFFIX); | ||
addValue(new BasicConfigValue<>("connection-mode", ConnectionMode.class, connectionMode)); | ||
addValue(new BasicConfigValue<>("render-mode", LineRenderMode.class, renderMode)); | ||
} | ||
|
||
/** | ||
* @return Current line connection mode. | ||
*/ | ||
@Nonnull | ||
public ObservableObject<ConnectionMode> getConnectionMode() { | ||
return connectionMode; | ||
} | ||
|
||
/** | ||
* @return Current line render mode. | ||
*/ | ||
@Nonnull | ||
public ObservableObject<LineRenderMode> getRenderMode() { | ||
return renderMode; | ||
} | ||
|
||
/** | ||
* Modes for how to render lines. | ||
*/ | ||
public enum LineRenderMode { | ||
/** | ||
* Simple flat lines. | ||
*/ | ||
FLAT, | ||
/** | ||
* Simple flat lines with some glowing. | ||
*/ | ||
FLAT_GLOWING, | ||
/** | ||
* Party time! | ||
*/ | ||
RAINBOW_GLOWING | ||
} | ||
|
||
/** | ||
* Modes for where to draw lines. | ||
*/ | ||
public enum ConnectionMode { | ||
/** | ||
* Show control flow connections for all flow edges. | ||
*/ | ||
ALL_CONNECTIONS, | ||
/** | ||
* Show control flow connections for only the current item. | ||
*/ | ||
CURRENT_CONNECTION | ||
} | ||
} |
Oops, something went wrong.