mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-20 17:52:23 +00:00
fix: prompt text field theme issues (fixes #701)
This commit is contained in:
parent
45daca9b44
commit
e3da91dc8e
3 changed files with 24 additions and 6 deletions
|
|
@ -38,6 +38,7 @@ import ee.carlrobert.codegpt.settings.service.ollama.OllamaSettings;
|
|||
import ee.carlrobert.codegpt.settings.service.openai.OpenAISettings;
|
||||
import ee.carlrobert.llm.client.google.models.GoogleModel;
|
||||
import ee.carlrobert.llm.client.openai.completion.OpenAIChatCompletionModel;
|
||||
import java.awt.Color;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
|
@ -87,6 +88,7 @@ public class ModelComboBoxAction extends ComboBoxAction {
|
|||
@NotNull String place) {
|
||||
ComboBoxButton button = createComboBoxButton(presentation);
|
||||
button.setBorder(null);
|
||||
button.putClientProperty("JButton.backgroundColor", new Color(0, 0, 0, 0));
|
||||
return button;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ class PromptTextField(
|
|||
|
||||
init {
|
||||
isOneLineMode = false
|
||||
background = JBColor.background()
|
||||
minimumSize = Dimension(100, 40)
|
||||
document.addDocumentListener(getDocumentListener(onTextChanged))
|
||||
IS_PROMPT_TEXT_FIELD_DOCUMENT.set(document, true)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import com.intellij.ui.dsl.builder.AlignX
|
|||
import com.intellij.ui.dsl.builder.RightGap
|
||||
import com.intellij.ui.dsl.builder.panel
|
||||
import com.intellij.util.ui.JBUI
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import ee.carlrobert.codegpt.CodeGPTBundle
|
||||
import ee.carlrobert.codegpt.Icons
|
||||
import ee.carlrobert.codegpt.actions.AttachImageAction
|
||||
|
|
@ -29,6 +30,9 @@ import ee.carlrobert.codegpt.toolwindow.chat.ui.textarea.TotalTokensPanel
|
|||
import ee.carlrobert.codegpt.ui.IconActionButton
|
||||
import ee.carlrobert.llm.client.openai.completion.OpenAIChatCompletionModel
|
||||
import java.awt.*
|
||||
import java.awt.geom.Area
|
||||
import java.awt.geom.Rectangle2D
|
||||
import java.awt.geom.RoundRectangle2D
|
||||
import javax.swing.JPanel
|
||||
|
||||
class UserInputPanel(
|
||||
|
|
@ -38,6 +42,10 @@ class UserInputPanel(
|
|||
private val onStop: () -> Unit
|
||||
) : JPanel(BorderLayout()) {
|
||||
|
||||
companion object {
|
||||
private const val CORNER_RADIUS = 16
|
||||
}
|
||||
|
||||
val text: String
|
||||
get() = promptTextField.text
|
||||
|
||||
|
|
@ -71,7 +79,7 @@ class UserInputPanel(
|
|||
}
|
||||
|
||||
init {
|
||||
isOpaque = false
|
||||
background = UIUtil.getTextFieldBackground()
|
||||
add(promptTextField, BorderLayout.CENTER)
|
||||
add(getFooter(), BorderLayout.SOUTH)
|
||||
}
|
||||
|
|
@ -90,12 +98,21 @@ class UserInputPanel(
|
|||
override fun paintComponent(g: Graphics) {
|
||||
val g2 = g.create() as Graphics2D
|
||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
|
||||
|
||||
val area = Area(Rectangle2D.Float(0f, 0f, width.toFloat(), height.toFloat()))
|
||||
val roundedRect = RoundRectangle2D.Float(0f, 0f, width.toFloat(), height.toFloat(), CORNER_RADIUS.toFloat(), CORNER_RADIUS.toFloat())
|
||||
area.intersect(Area(roundedRect))
|
||||
|
||||
g2.clip = area
|
||||
|
||||
g2.color = background
|
||||
g2.fillRoundRect(0, 0, width - 1, height - 1, 16, 16)
|
||||
super.paintComponent(g)
|
||||
g2.fill(area)
|
||||
|
||||
super.paintComponent(g2)
|
||||
g2.dispose()
|
||||
}
|
||||
|
||||
|
||||
override fun paintBorder(g: Graphics) {
|
||||
val g2 = g.create() as Graphics2D
|
||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
|
||||
|
|
@ -103,7 +120,7 @@ class UserInputPanel(
|
|||
if (promptTextField.isFocusOwner) {
|
||||
g2.stroke = BasicStroke(1.5F)
|
||||
}
|
||||
g2.drawRoundRect(0, 0, width - 1, height - 1, 16, 16)
|
||||
g2.drawRoundRect(0, 0, width - 1, height - 1, CORNER_RADIUS, CORNER_RADIUS)
|
||||
g2.dispose()
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +162,7 @@ class UserInputPanel(
|
|||
}
|
||||
}.align(AlignX.RIGHT)
|
||||
})
|
||||
}
|
||||
}.andTransparent()
|
||||
}
|
||||
|
||||
private fun isImageActionSupported(): Boolean {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue