mirror of
https://github.com/eeeXun/GTT.git
synced 2025-05-19 09:10:42 -07:00
add BorderDropDown
This commit is contained in:
parent
58762c6f8b
commit
8ec1968381
3
color.go
3
color.go
@ -6,7 +6,8 @@ import (
|
||||
|
||||
var (
|
||||
Transparent tcell.Color = tcell.ColorDefault
|
||||
themesName = []string{"Gruvbox", "Nord"}
|
||||
ThemesName = []string{"Gruvbox", "Nord"}
|
||||
Palette = []string{"red", "green", "yellow", "blue", "purple", "cyan"}
|
||||
Themes = map[string]map[string]tcell.Color{
|
||||
"Gruvbox": {
|
||||
"bg": tcell.NewHexColor(0x282828),
|
||||
|
4
main.go
4
main.go
@ -17,7 +17,9 @@ var (
|
||||
langCycle = NewUICycle(srcLangDropDown, dstLangDropDown)
|
||||
themeDropDown = tview.NewDropDown()
|
||||
transparentDropDown = tview.NewDropDown()
|
||||
styleCycle = NewUICycle(themeDropDown, transparentDropDown)
|
||||
srcBorderDropDown = tview.NewDropDown()
|
||||
dstBorderDropDown = tview.NewDropDown()
|
||||
styleCycle = NewUICycle(themeDropDown, transparentDropDown, srcBorderDropDown, dstBorderDropDown)
|
||||
langButton = tview.NewButton("(1)Language")
|
||||
styleButton = tview.NewButton("(2)Style")
|
||||
menuButton = tview.NewButton("(3)KeyMap")
|
||||
|
46
ui.go
46
ui.go
@ -71,6 +71,20 @@ func updateBackgroundColor() {
|
||||
tcell.StyleDefault.
|
||||
Background(window.src.selectedColor).
|
||||
Foreground(window.src.prefixColor))
|
||||
srcBorderDropDown.SetBackgroundColor(window.src.backgroundColor)
|
||||
srcBorderDropDown.SetListStyles(tcell.StyleDefault.
|
||||
Background(window.src.backgroundColor).
|
||||
Foreground(window.src.foregroundColor),
|
||||
tcell.StyleDefault.
|
||||
Background(window.src.selectedColor).
|
||||
Foreground(window.src.prefixColor))
|
||||
dstBorderDropDown.SetBackgroundColor(window.dst.backgroundColor)
|
||||
dstBorderDropDown.SetListStyles(tcell.StyleDefault.
|
||||
Background(window.src.backgroundColor).
|
||||
Foreground(window.src.foregroundColor),
|
||||
tcell.StyleDefault.
|
||||
Background(window.src.selectedColor).
|
||||
Foreground(window.src.prefixColor))
|
||||
}
|
||||
|
||||
func updateBorderColor() {
|
||||
@ -85,6 +99,10 @@ func updateBorderColor() {
|
||||
SetTitleColor(window.src.borderColor)
|
||||
dstLangDropDown.SetBorderColor(window.dst.borderColor).
|
||||
SetTitleColor(window.dst.borderColor)
|
||||
srcBorderDropDown.SetBorderColor(window.src.borderColor).
|
||||
SetTitleColor(window.src.borderColor)
|
||||
dstBorderDropDown.SetBorderColor(window.dst.borderColor).
|
||||
SetTitleColor(window.dst.borderColor)
|
||||
}
|
||||
|
||||
func updateNonConfigColor() {
|
||||
@ -109,6 +127,14 @@ func updateNonConfigColor() {
|
||||
transparentDropDown.SetFieldBackgroundColor(window.src.selectedColor).
|
||||
SetFieldTextColor(window.src.foregroundColor).
|
||||
SetPrefixTextColor(window.src.prefixColor)
|
||||
srcBorderDropDown.SetLabelColor(window.src.labelColor)
|
||||
srcBorderDropDown.SetFieldBackgroundColor(window.src.selectedColor).
|
||||
SetFieldTextColor(window.src.foregroundColor).
|
||||
SetPrefixTextColor(window.src.prefixColor)
|
||||
dstBorderDropDown.SetLabelColor(window.src.labelColor)
|
||||
dstBorderDropDown.SetFieldBackgroundColor(window.src.selectedColor).
|
||||
SetFieldTextColor(window.src.foregroundColor).
|
||||
SetPrefixTextColor(window.src.prefixColor)
|
||||
|
||||
// button
|
||||
langButton.SetLabelColor(window.src.foregroundColor).
|
||||
@ -163,13 +189,19 @@ func uiInit() {
|
||||
dstLangDropDown.SetBorder(true)
|
||||
dstLangDropDown.SetOptions(Lang, nil)
|
||||
themeDropDown.SetLabel("Theme: ").
|
||||
SetOptions(themesName, nil).
|
||||
SetCurrentOption(IndexOf(theme, themesName))
|
||||
SetOptions(ThemesName, nil).
|
||||
SetCurrentOption(IndexOf(theme, ThemesName))
|
||||
transparentDropDown.SetLabel("Transparent: ").
|
||||
SetOptions([]string{"true", "false"}, nil).
|
||||
SetCurrentOption(
|
||||
IndexOf(strconv.FormatBool(transparent),
|
||||
[]string{"true", "false"}))
|
||||
srcBorderDropDown.SetOptions(Palette, nil)
|
||||
srcBorderDropDown.SetBorder(true).
|
||||
SetTitle("Source")
|
||||
dstBorderDropDown.SetOptions(Palette, nil)
|
||||
dstBorderDropDown.SetBorder(true).
|
||||
SetTitle("Destination")
|
||||
|
||||
// window
|
||||
translateWindow.SetDirection(tview.FlexColumn).
|
||||
@ -190,7 +222,13 @@ func uiInit() {
|
||||
AddItem(nil, 0, 1, false).
|
||||
AddItem(tview.NewFlex().SetDirection(tview.FlexRow).
|
||||
AddItem(themeDropDown, 1, 1, true).
|
||||
AddItem(transparentDropDown, 1, 1, false), 20, 1, true).
|
||||
AddItem(transparentDropDown, 1, 1, false).
|
||||
AddItem(tview.NewFlex().SetDirection(tview.FlexColumn).
|
||||
AddItem(nil, 0, 1, false).
|
||||
AddItem(srcBorderDropDown, 32, 1, false).
|
||||
AddItem(dstBorderDropDown, 32, 1, false).
|
||||
AddItem(nil, 0, 1, false), 0, 1, false),
|
||||
20, 1, true).
|
||||
AddItem(nil, 0, 1, false), 20, 1, true).
|
||||
AddItem(attachButton(), 1, 1, false).
|
||||
AddItem(nil, 0, 1, false)
|
||||
@ -211,6 +249,8 @@ func uiInit() {
|
||||
SetSelectedFunc(themeSelected)
|
||||
transparentDropDown.SetDoneFunc(styleDropDownHandler).
|
||||
SetSelectedFunc(transparentSelected)
|
||||
srcBorderDropDown.SetDoneFunc(styleDropDownHandler)
|
||||
dstBorderDropDown.SetDoneFunc(styleDropDownHandler)
|
||||
langButton.SetSelectedFunc(func() {
|
||||
mainPage.HidePage("stylePage")
|
||||
mainPage.ShowPage("langPage")
|
||||
|
Loading…
x
Reference in New Issue
Block a user