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 (
|
var (
|
||||||
Transparent tcell.Color = tcell.ColorDefault
|
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{
|
Themes = map[string]map[string]tcell.Color{
|
||||||
"Gruvbox": {
|
"Gruvbox": {
|
||||||
"bg": tcell.NewHexColor(0x282828),
|
"bg": tcell.NewHexColor(0x282828),
|
||||||
|
4
main.go
4
main.go
@ -17,7 +17,9 @@ var (
|
|||||||
langCycle = NewUICycle(srcLangDropDown, dstLangDropDown)
|
langCycle = NewUICycle(srcLangDropDown, dstLangDropDown)
|
||||||
themeDropDown = tview.NewDropDown()
|
themeDropDown = tview.NewDropDown()
|
||||||
transparentDropDown = 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")
|
langButton = tview.NewButton("(1)Language")
|
||||||
styleButton = tview.NewButton("(2)Style")
|
styleButton = tview.NewButton("(2)Style")
|
||||||
menuButton = tview.NewButton("(3)KeyMap")
|
menuButton = tview.NewButton("(3)KeyMap")
|
||||||
|
46
ui.go
46
ui.go
@ -71,6 +71,20 @@ func updateBackgroundColor() {
|
|||||||
tcell.StyleDefault.
|
tcell.StyleDefault.
|
||||||
Background(window.src.selectedColor).
|
Background(window.src.selectedColor).
|
||||||
Foreground(window.src.prefixColor))
|
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() {
|
func updateBorderColor() {
|
||||||
@ -85,6 +99,10 @@ func updateBorderColor() {
|
|||||||
SetTitleColor(window.src.borderColor)
|
SetTitleColor(window.src.borderColor)
|
||||||
dstLangDropDown.SetBorderColor(window.dst.borderColor).
|
dstLangDropDown.SetBorderColor(window.dst.borderColor).
|
||||||
SetTitleColor(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() {
|
func updateNonConfigColor() {
|
||||||
@ -109,6 +127,14 @@ func updateNonConfigColor() {
|
|||||||
transparentDropDown.SetFieldBackgroundColor(window.src.selectedColor).
|
transparentDropDown.SetFieldBackgroundColor(window.src.selectedColor).
|
||||||
SetFieldTextColor(window.src.foregroundColor).
|
SetFieldTextColor(window.src.foregroundColor).
|
||||||
SetPrefixTextColor(window.src.prefixColor)
|
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
|
// button
|
||||||
langButton.SetLabelColor(window.src.foregroundColor).
|
langButton.SetLabelColor(window.src.foregroundColor).
|
||||||
@ -163,13 +189,19 @@ func uiInit() {
|
|||||||
dstLangDropDown.SetBorder(true)
|
dstLangDropDown.SetBorder(true)
|
||||||
dstLangDropDown.SetOptions(Lang, nil)
|
dstLangDropDown.SetOptions(Lang, nil)
|
||||||
themeDropDown.SetLabel("Theme: ").
|
themeDropDown.SetLabel("Theme: ").
|
||||||
SetOptions(themesName, nil).
|
SetOptions(ThemesName, nil).
|
||||||
SetCurrentOption(IndexOf(theme, themesName))
|
SetCurrentOption(IndexOf(theme, ThemesName))
|
||||||
transparentDropDown.SetLabel("Transparent: ").
|
transparentDropDown.SetLabel("Transparent: ").
|
||||||
SetOptions([]string{"true", "false"}, nil).
|
SetOptions([]string{"true", "false"}, nil).
|
||||||
SetCurrentOption(
|
SetCurrentOption(
|
||||||
IndexOf(strconv.FormatBool(transparent),
|
IndexOf(strconv.FormatBool(transparent),
|
||||||
[]string{"true", "false"}))
|
[]string{"true", "false"}))
|
||||||
|
srcBorderDropDown.SetOptions(Palette, nil)
|
||||||
|
srcBorderDropDown.SetBorder(true).
|
||||||
|
SetTitle("Source")
|
||||||
|
dstBorderDropDown.SetOptions(Palette, nil)
|
||||||
|
dstBorderDropDown.SetBorder(true).
|
||||||
|
SetTitle("Destination")
|
||||||
|
|
||||||
// window
|
// window
|
||||||
translateWindow.SetDirection(tview.FlexColumn).
|
translateWindow.SetDirection(tview.FlexColumn).
|
||||||
@ -190,7 +222,13 @@ func uiInit() {
|
|||||||
AddItem(nil, 0, 1, false).
|
AddItem(nil, 0, 1, false).
|
||||||
AddItem(tview.NewFlex().SetDirection(tview.FlexRow).
|
AddItem(tview.NewFlex().SetDirection(tview.FlexRow).
|
||||||
AddItem(themeDropDown, 1, 1, true).
|
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(nil, 0, 1, false), 20, 1, true).
|
||||||
AddItem(attachButton(), 1, 1, false).
|
AddItem(attachButton(), 1, 1, false).
|
||||||
AddItem(nil, 0, 1, false)
|
AddItem(nil, 0, 1, false)
|
||||||
@ -211,6 +249,8 @@ func uiInit() {
|
|||||||
SetSelectedFunc(themeSelected)
|
SetSelectedFunc(themeSelected)
|
||||||
transparentDropDown.SetDoneFunc(styleDropDownHandler).
|
transparentDropDown.SetDoneFunc(styleDropDownHandler).
|
||||||
SetSelectedFunc(transparentSelected)
|
SetSelectedFunc(transparentSelected)
|
||||||
|
srcBorderDropDown.SetDoneFunc(styleDropDownHandler)
|
||||||
|
dstBorderDropDown.SetDoneFunc(styleDropDownHandler)
|
||||||
langButton.SetSelectedFunc(func() {
|
langButton.SetSelectedFunc(func() {
|
||||||
mainPage.HidePage("stylePage")
|
mainPage.HidePage("stylePage")
|
||||||
mainPage.ShowPage("langPage")
|
mainPage.ShowPage("langPage")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user