Skip to content
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
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ changelog-plugin = { module = "org.jetbrains.changelog:org.jetbrains.changelog.g
coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "coroutines" }

mappingIo = "net.fabricmc:mapping-io:0.2.1"
mixinExtras-expressions = "io.github.llamalad7:mixinextras-expressions:0.0.5"
mixinExtras-expressions = "io.github.llamalad7:mixinextras-expressions:0.0.6"
jgraphx = "com.github.vlsi.mxgraph:jgraphx:4.2.2"

# GrammarKit
Expand Down
10 changes: 10 additions & 0 deletions src/main/kotlin/platform/mixin/expression/MEExpressionMatchUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ object MEExpressionMatchUtil {
insns: Iterable<VirtualInsn>,
contextType: ExpressionContext.Type,
forCompletion: Boolean,
crossinline reportMatchStatus: (FlowValue, Expression, Boolean) -> Unit = { _, _, _ -> },
crossinline reportPartialMatch: (FlowValue, Expression) -> Unit = { _, _ -> },
callback: (ExpressionMatch) -> Unit
) {
for (insn in insns) {
Expand All @@ -283,6 +285,14 @@ object MEExpressionMatchUtil {
// Our maps are per-injector anyway, so this is just a normal decoration.
decorations.getOrPut(VirtualInsn(insn), ::mutableMapOf)[key] = value
}

override fun reportMatchStatus(node: FlowValue, expr: Expression, matched: Boolean) {
reportMatchStatus.invoke(node, expr, matched)
}

override fun reportPartialMatch(node: FlowValue, expr: Expression) {
reportPartialMatch.invoke(node, expr)
}
}

val flow = flows[insn] ?: continue
Expand Down
84 changes: 84 additions & 0 deletions src/main/kotlin/platform/mixin/expression/gui/DiagramStyles.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Minecraft Development for IntelliJ
*
* https://mcdev.io/
*
* Copyright (C) 2025 minecraft-dev
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3.0 only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package com.demonwav.mcdev.platform.mixin.expression.gui

import com.intellij.openapi.editor.colors.EditorColorsManager
import com.intellij.openapi.editor.colors.EditorFontType
import com.intellij.ui.JBColor
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.UIUtil
import com.mxgraph.util.mxConstants
import java.awt.Color

object DiagramStyles {
val DEFAULT_NODE
get() = mapOf(
mxConstants.STYLE_FONTFAMILY to CURRENT_EDITOR_FONT.family,
mxConstants.STYLE_ROUNDED to true,
mxConstants.STYLE_FILLCOLOR to JBUI.CurrentTheme.Button.buttonColorStart().hexString,
mxConstants.STYLE_FONTCOLOR to UIUtil.getLabelForeground().hexString,
mxConstants.STYLE_STROKECOLOR to JBUI.CurrentTheme.Button.buttonOutlineColorStart(false).hexString,
mxConstants.STYLE_ALIGN to mxConstants.ALIGN_CENTER,
mxConstants.STYLE_VERTICAL_ALIGN to mxConstants.ALIGN_TOP,
mxConstants.STYLE_SHAPE to mxConstants.SHAPE_LABEL,
mxConstants.STYLE_SPACING to 5,
mxConstants.STYLE_SPACING_TOP to 3,
)
val DEFAULT_EDGE
get() = mapOf(
mxConstants.STYLE_STROKECOLOR to UIUtil.getFocusedBorderColor().hexString,
)
val LINE_NUMBER = mapOf(
mxConstants.STYLE_FONTSIZE to "16",
mxConstants.STYLE_STROKECOLOR to "none",
mxConstants.STYLE_FILLCOLOR to "none",
)
val SEARCH_HIGHLIGHT
get() = mapOf(
mxConstants.STYLE_STROKECOLOR to UIUtil.getFocusedBorderColor().hexString,
mxConstants.STYLE_STROKEWIDTH to "2",
)
val IGNORED = mapOf(
mxConstants.STYLE_OPACITY to 20,
mxConstants.STYLE_TEXT_OPACITY to 20,
mxConstants.STYLE_STROKE_OPACITY to 20,
mxConstants.STYLE_FILL_OPACITY to 20,
)
val FAILED
get() = mapOf(
mxConstants.STYLE_STROKECOLOR to JBColor.red.hexString,
mxConstants.STYLE_STROKEWIDTH to "3.5",
)
val PARTIAL_MATCH
get() = mapOf(
mxConstants.STYLE_STROKECOLOR to JBColor.orange.hexString,
mxConstants.STYLE_STROKEWIDTH to "2.5",
)
val SUCCESS
get() = mapOf(
mxConstants.STYLE_STROKECOLOR to JBColor.green.hexString,
mxConstants.STYLE_STROKEWIDTH to "1.5",
)
val CURRENT_EDITOR_FONT
get() = EditorColorsManager.getInstance().globalScheme.getFont(EditorFontType.PLAIN)
}

private val Color.hexString get() = "#%06X".format(rgb)
Loading
Loading