Themeing of settings

This commit is contained in:
downthecrop 2025-10-11 20:29:56 -07:00
parent f0de95ad06
commit 2d1e2806ec
4 changed files with 15 additions and 50 deletions

View file

@ -7,21 +7,20 @@ import KondoKit.plugin.Companion.secondaryColor
import plugin.api.API import plugin.api.API
import java.awt.* import java.awt.*
import java.awt.datatransfer.DataFlavor import java.awt.datatransfer.DataFlavor
import java.awt.event.ActionEvent
import java.awt.event.ActionListener import java.awt.event.ActionListener
import java.awt.event.KeyAdapter import java.awt.event.KeyAdapter
import java.awt.event.KeyEvent import java.awt.event.KeyEvent
import java.awt.event.MouseAdapter import java.awt.event.MouseAdapter
import java.awt.event.MouseEvent import java.awt.event.MouseEvent
import KondoKit.SpriteToBufferedImage.getBufferedImageFromSprite
import java.awt.image.BufferedImage import java.awt.image.BufferedImage
import javax.imageio.ImageIO
import javax.swing.* import javax.swing.*
class CustomSearchField(private val parentPanel: JPanel, private val onSearch: (String) -> Unit) : Canvas() { class CustomSearchField(private val parentPanel: JPanel, private val onSearch: (String) -> Unit) : Canvas() {
private var cursorVisible: Boolean = true private var cursorVisible: Boolean = true
private var text: String = "" private var text: String = ""
private val bufferedImageSprite = getBufferedImageFromSprite(API.GetSprite(1423)) // MAG_SPRITE private val bufferedImageSprite = getBufferedImageFromSpriteWithScale(API.GetSprite(1423)) // MAG_SPRITE
private val imageCanvas = bufferedImageSprite.let { private val imageCanvas = bufferedImageSprite.let {
ImageCanvas(it).apply { ImageCanvas(it).apply {
preferredSize = Dimension(12, 12) // ICON_DIMENSION_SMALL preferredSize = Dimension(12, 12) // ICON_DIMENSION_SMALL
@ -32,7 +31,6 @@ class CustomSearchField(private val parentPanel: JPanel, private val onSearch: (
} }
} }
// Method to set the text programmatically
fun setText(newText: String) { fun setText(newText: String) {
text = newText text = newText
SwingUtilities.invokeLater { SwingUtilities.invokeLater {
@ -40,7 +38,6 @@ class CustomSearchField(private val parentPanel: JPanel, private val onSearch: (
} }
} }
// Method to get the current text
fun getText(): String { fun getText(): String {
return text return text
} }
@ -107,7 +104,7 @@ class CustomSearchField(private val parentPanel: JPanel, private val onSearch: (
} }
}) })
javax.swing.Timer(500, ActionListener { _ -> Timer(500, ActionListener { _ ->
cursorVisible = !cursorVisible cursorVisible = !cursorVisible
if (plugin.StateManager.focusedView == "REFLECTIVE_EDITOR_VIEW") if (plugin.StateManager.focusedView == "REFLECTIVE_EDITOR_VIEW")
SwingUtilities.invokeLater { SwingUtilities.invokeLater {
@ -155,9 +152,7 @@ class CustomSearchField(private val parentPanel: JPanel, private val onSearch: (
} }
} }
private fun getBufferedImageFromSprite(sprite: Any?): BufferedImage { private fun getBufferedImageFromSpriteWithScale(sprite: Any?): BufferedImage {
// This is a simplified version - you might need to adjust based on your actual implementation
// For now, let's just return a placeholder image
val image = BufferedImage(12, 12, BufferedImage.TYPE_INT_ARGB) val image = BufferedImage(12, 12, BufferedImage.TYPE_INT_ARGB)
val g2d = image.createGraphics() val g2d = image.createGraphics()
g2d.color = Color.GRAY g2d.color = Color.GRAY

View file

@ -1,35 +0,0 @@
package KondoKit.components.ReflectiveEditorComponents
import java.util.concurrent.ExecutorService
import java.util.concurrent.TimeUnit
/**
* Simple test to verify GitLabPluginFetcher debug logging works
*/
fun main() {
println("Testing GitLabPluginFetcher with debug logging...")
GitLabPluginFetcher.fetchGitLabPlugins { plugins ->
println("Fetched ${plugins.size} plugins")
plugins.forEach { plugin ->
println("- ${plugin.path}: ${plugin.pluginProperties?.description ?: plugin.pluginError}")
}
// Shutdown the executor service
try {
val field = GitLabPluginFetcher::class.java.getDeclaredField("executorService")
field.isAccessible = true
val executorService = field.get(GitLabPluginFetcher) as ExecutorService
executorService.shutdown()
if (!executorService.awaitTermination(5, TimeUnit.SECONDS)) {
executorService.shutdownNow()
}
} catch (e: Exception) {
e.printStackTrace()
}
}
// Give the async fetch some time to complete
Thread.sleep(10000)
println("Test completed")
}

View file

@ -67,6 +67,7 @@ open class SearchField(
if (e.isControlDown) { if (e.isControlDown) {
when (e.keyCode) { when (e.keyCode) {
KeyEvent.VK_A -> { KeyEvent.VK_A -> {
// They probably want to clear the search box
text = "" text = ""
SwingUtilities.invokeLater { SwingUtilities.invokeLater {
repaint() repaint()

View file

@ -1,5 +1,9 @@
package KondoKit.components package KondoKit.components
import KondoKit.plugin.Companion.PROGRESS_BAR_FILL
import KondoKit.plugin.Companion.WIDGET_COLOR
import KondoKit.plugin.Companion.primaryColor
import KondoKit.plugin.Companion.secondaryColor
import java.awt.* import java.awt.*
import java.awt.event.MouseAdapter import java.awt.event.MouseAdapter
import java.awt.event.MouseEvent import java.awt.event.MouseEvent
@ -8,10 +12,10 @@ import javax.swing.JPanel
class ToggleSwitch : JPanel() { class ToggleSwitch : JPanel() {
private var activated = false private var activated = false
private var switchColor = Color(200, 200, 200) private var switchColor = primaryColor
private var buttonColor = Color(255, 255, 255) private var buttonColor = secondaryColor
private var borderColor = Color(50, 50, 50) private var borderColor = WIDGET_COLOR
private var activeSwitch = Color(0, 125, 255) private var activeSwitch = PROGRESS_BAR_FILL
private var puffer: BufferedImage? = null private var puffer: BufferedImage? = null
private var g: Graphics2D? = null private var g: Graphics2D? = null