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
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ import com.intellij.ui.ColorUtil
import com.intellij.util.ui.JBInsets
import krasa.editorGroups.tabs2.EditorGroupsTabsPosition
import krasa.editorGroups.tabs2.impl.painter.EditorGroupsTabPainter
import krasa.editorGroups.tabs2.impl.themes.EditorGroupDefaultTabTheme
import krasa.editorGroups.tabs2.impl.themes.EditorGroupCustomTabTheme
import krasa.editorGroups.tabs2.impl.themes.EditorGroupTabTheme
import java.awt.Color
import java.awt.Graphics2D
import java.awt.Point
import java.awt.Rectangle
import java.awt.*
import java.awt.geom.RoundRectangle2D

internal open class RoundedTabPainter : EditorGroupsTabPainter {
private val theme = EditorGroupDefaultTabTheme()
private val theme = EditorGroupCustomTabTheme()

private val regularColors = theme.background to theme.background

Expand Down Expand Up @@ -132,13 +129,14 @@ internal open class RoundedTabPainter : EditorGroupsTabPainter {

if (fill != null) {
// Paint rounded tab
g.color = fill
g.color = ColorUtil.withAlpha(fill, theme.roundTabOpacity.toDouble())
g.fill(shape)
}

if (draw != null) {
// Paint rounded border
g.color = draw
g.stroke = BasicStroke(theme.roundTabBorderWidth)
g.draw(shape)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@ open class EditorGroupCustomTabTheme : EditorGroupTabTheme {

override val roundTabOpacity: Float
get() = EditorGroupsUI.backgroundOpacity()

override val roundTabBorderWidth: Float
get() = EditorGroupsUI.roundTabBorderWidth()
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,7 @@ open class EditorGroupDefaultTabTheme : EditorGroupTabTheme {

override val roundTabOpacity: Float
get() = 0.9f

override val roundTabBorderWidth: Float
get() = 1.0f
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ interface EditorGroupTabTheme {
// Islands
val roundTabArc: Int
val roundTabOpacity: Float?
val roundTabBorderWidth: Float?
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ object EditorGroupsUI {
defaultTheme.roundTabOpacity
)

fun roundTabBorderWidth(): Float = JBUI.getFloat(
"EditorGroupsTabs.roundTabBorderWidth",
defaultTheme.roundTabBorderWidth
)

fun font(): Font {
val isCustomFont = EditorGroupsSettings.instance.isCustomFont
val customFont = EditorGroupsSettings.instance.customFont
Expand Down
Loading