mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-11 09:00:26 -07:00
Themeing of settings
This commit is contained in:
parent
f0de95ad06
commit
2d1e2806ec
4 changed files with 15 additions and 50 deletions
|
|
@ -7,21 +7,20 @@ import KondoKit.plugin.Companion.secondaryColor
|
|||
import plugin.api.API
|
||||
import java.awt.*
|
||||
import java.awt.datatransfer.DataFlavor
|
||||
import java.awt.event.ActionEvent
|
||||
import java.awt.event.ActionListener
|
||||
import java.awt.event.KeyAdapter
|
||||
import java.awt.event.KeyEvent
|
||||
import java.awt.event.MouseAdapter
|
||||
import java.awt.event.MouseEvent
|
||||
import KondoKit.SpriteToBufferedImage.getBufferedImageFromSprite
|
||||
import java.awt.image.BufferedImage
|
||||
import javax.imageio.ImageIO
|
||||
import javax.swing.*
|
||||
|
||||
class CustomSearchField(private val parentPanel: JPanel, private val onSearch: (String) -> Unit) : Canvas() {
|
||||
private var cursorVisible: Boolean = true
|
||||
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 {
|
||||
ImageCanvas(it).apply {
|
||||
preferredSize = Dimension(12, 12) // ICON_DIMENSION_SMALL
|
||||
|
|
@ -31,16 +30,14 @@ class CustomSearchField(private val parentPanel: JPanel, private val onSearch: (
|
|||
fillColor = WIDGET_COLOR
|
||||
}
|
||||
}
|
||||
|
||||
// Method to set the text programmatically
|
||||
|
||||
fun setText(newText: String) {
|
||||
text = newText
|
||||
SwingUtilities.invokeLater {
|
||||
repaint()
|
||||
}
|
||||
}
|
||||
|
||||
// Method to get the current text
|
||||
|
||||
fun getText(): String {
|
||||
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
|
||||
if (plugin.StateManager.focusedView == "REFLECTIVE_EDITOR_VIEW")
|
||||
SwingUtilities.invokeLater {
|
||||
|
|
@ -155,9 +152,7 @@ class CustomSearchField(private val parentPanel: JPanel, private val onSearch: (
|
|||
}
|
||||
}
|
||||
|
||||
private fun getBufferedImageFromSprite(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
|
||||
private fun getBufferedImageFromSpriteWithScale(sprite: Any?): BufferedImage {
|
||||
val image = BufferedImage(12, 12, BufferedImage.TYPE_INT_ARGB)
|
||||
val g2d = image.createGraphics()
|
||||
g2d.color = Color.GRAY
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
|
@ -67,6 +67,7 @@ open class SearchField(
|
|||
if (e.isControlDown) {
|
||||
when (e.keyCode) {
|
||||
KeyEvent.VK_A -> {
|
||||
// They probably want to clear the search box
|
||||
text = ""
|
||||
SwingUtilities.invokeLater {
|
||||
repaint()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
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.event.MouseAdapter
|
||||
import java.awt.event.MouseEvent
|
||||
|
|
@ -8,10 +12,10 @@ import javax.swing.JPanel
|
|||
|
||||
class ToggleSwitch : JPanel() {
|
||||
private var activated = false
|
||||
private var switchColor = Color(200, 200, 200)
|
||||
private var buttonColor = Color(255, 255, 255)
|
||||
private var borderColor = Color(50, 50, 50)
|
||||
private var activeSwitch = Color(0, 125, 255)
|
||||
private var switchColor = primaryColor
|
||||
private var buttonColor = secondaryColor
|
||||
private var borderColor = WIDGET_COLOR
|
||||
private var activeSwitch = PROGRESS_BAR_FILL
|
||||
private var puffer: BufferedImage? = null
|
||||
private var g: Graphics2D? = null
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue