cleaning up color handling for enable/disable

This commit is contained in:
Jeff Carr 2025-02-09 05:17:01 -06:00
parent 58eff2a9e2
commit 9540c01d83
2 changed files with 63 additions and 69 deletions

View File

@ -43,14 +43,13 @@ func (tk *guiWidget) setColorWindowFrame() {
tk.color.bg = gocui.ColorBlack tk.color.bg = gocui.ColorBlack
tk.color.selFg = gocui.AttrNone tk.color.selFg = gocui.AttrNone
tk.color.selBg = gocui.AttrNone tk.color.selBg = gocui.AttrNone
tk.updateColor() } else {
return tk.color.frame = gocui.AttrNone
tk.color.fg = gocui.AttrNone
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.AttrNone
tk.color.selBg = gocui.AttrNone
} }
tk.color.frame = gocui.AttrNone
tk.color.fg = gocui.AttrNone
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.AttrNone
tk.color.selBg = gocui.AttrNone
tk.updateColor() tk.updateColor()
} }
@ -66,14 +65,13 @@ func (tk *guiWidget) setColorWindowTitleActive() {
tk.color.bg = gocui.AttrNone tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.ColorWhite tk.color.selFg = gocui.ColorWhite
tk.color.selBg = gocui.ColorBlue tk.color.selBg = gocui.ColorBlue
tk.updateColor() } else {
return tk.color.frame = gocui.ColorWhite
tk.color.fg = gocui.ColorWhite
tk.color.bg = gocui.ColorBlue
tk.color.selFg = gocui.ColorWhite
tk.color.selBg = gocui.ColorBlue
} }
tk.color.frame = gocui.ColorWhite
tk.color.fg = gocui.ColorWhite
tk.color.bg = gocui.ColorBlue
tk.color.selFg = gocui.ColorWhite
tk.color.selBg = gocui.ColorBlue
tk.updateColor() tk.updateColor()
} }
@ -88,14 +86,13 @@ func (tk *guiWidget) setColorWindowTitle() {
tk.color.bg = gocui.AttrNone tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.ColorWhite tk.color.selFg = gocui.ColorWhite
tk.color.selBg = gocui.ColorBlue tk.color.selBg = gocui.ColorBlue
tk.updateColor() } else {
return tk.color.frame = gocui.ColorWhite
tk.color.fg = gocui.ColorBlue
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.ColorWhite
tk.color.selBg = gocui.ColorBlue
} }
tk.color.frame = gocui.ColorWhite
tk.color.fg = gocui.ColorBlue
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.ColorWhite
tk.color.selBg = gocui.ColorBlue
tk.updateColor() tk.updateColor()
} }
@ -110,14 +107,13 @@ func (tk *guiWidget) setColorBG() {
tk.color.bg = gocui.ColorBlack tk.color.bg = gocui.ColorBlack
tk.color.selFg = gocui.AttrNone tk.color.selFg = gocui.AttrNone
tk.color.selBg = gocui.AttrNone tk.color.selBg = gocui.AttrNone
tk.updateColor() } else {
return tk.color.frame = gocui.ColorWhite
tk.color.fg = gocui.ColorWhite
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.AttrNone
tk.color.selBg = gocui.AttrNone
} }
tk.color.frame = gocui.ColorWhite
tk.color.fg = gocui.ColorWhite
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.AttrNone
tk.color.selBg = gocui.AttrNone
tk.updateColor() tk.updateColor()
} }
@ -132,14 +128,13 @@ func (tk *guiWidget) setColorLabel() {
tk.color.bg = gocui.ColorBlack tk.color.bg = gocui.ColorBlack
tk.color.selFg = gocui.ColorWhite tk.color.selFg = gocui.ColorWhite
tk.color.selBg = gocui.AttrNone tk.color.selBg = gocui.AttrNone
tk.updateColor() } else {
return tk.color.frame = gocui.AttrNone
tk.color.fg = gocui.ColorBlack
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.AttrNone
tk.color.selBg = gocui.ColorWhite
} }
tk.color.frame = gocui.AttrNone
tk.color.fg = gocui.ColorBlack
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.AttrNone
tk.color.selBg = gocui.ColorWhite
tk.updateColor() tk.updateColor()
} }
@ -154,14 +149,13 @@ func (tk *guiWidget) setColorButtonDense() {
tk.color.bg = gocui.ColorBlack tk.color.bg = gocui.ColorBlack
tk.color.selFg = gocui.ColorWhite tk.color.selFg = gocui.ColorWhite
tk.color.selBg = gocui.ColorBlue tk.color.selBg = gocui.ColorBlue
tk.updateColor() } else {
return tk.color.frame = gocui.AttrNone
tk.color.fg = gocui.ColorWhite
tk.color.bg = gocui.ColorBlue
tk.color.selFg = gocui.ColorBlue
tk.color.selBg = gocui.AttrNone
} }
tk.color.frame = gocui.AttrNone
tk.color.fg = gocui.ColorWhite
tk.color.bg = gocui.ColorBlue
tk.color.selFg = gocui.ColorBlue
tk.color.selBg = gocui.AttrNone
tk.updateColor() tk.updateColor()
} }
@ -176,14 +170,13 @@ func (tk *guiWidget) setColorButton() {
tk.color.bg = gocui.ColorBlack tk.color.bg = gocui.ColorBlack
tk.color.selFg = gocui.ColorWhite tk.color.selFg = gocui.ColorWhite
tk.color.selBg = gocui.ColorBlue tk.color.selBg = gocui.ColorBlue
tk.updateColor() } else {
return tk.color.frame = gocui.ColorBlue
tk.color.fg = gocui.AttrNone
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.ColorWhite
tk.color.selBg = gocui.ColorBlue
} }
tk.color.frame = gocui.ColorBlue
tk.color.fg = gocui.AttrNone
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.ColorWhite
tk.color.selBg = gocui.ColorBlue
tk.updateColor() tk.updateColor()
} }
@ -198,14 +191,13 @@ func (tk *guiWidget) setColorInput() {
tk.color.bg = gocui.AttrNone tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.ColorYellow tk.color.selFg = gocui.ColorYellow
tk.color.selBg = gocui.ColorBlack tk.color.selBg = gocui.ColorBlack
tk.updateColor() } else {
return tk.color.frame = gocui.ColorYellow
tk.color.fg = gocui.AttrNone
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.ColorYellow
tk.color.selBg = gocui.ColorBlack
} }
tk.color.frame = gocui.ColorYellow
tk.color.fg = gocui.AttrNone
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.ColorYellow
tk.color.selBg = gocui.ColorBlack
tk.updateColor() tk.updateColor()
} }
@ -219,14 +211,13 @@ func (tk *guiWidget) setColorModal() {
tk.color.bg = gocui.ColorBlack tk.color.bg = gocui.ColorBlack
tk.color.selFg = gocui.ColorBlack tk.color.selFg = gocui.ColorBlack
tk.color.selBg = gocui.AttrNone tk.color.selBg = gocui.AttrNone
tk.updateColor() } else {
return tk.color.frame = gocui.ColorRed
tk.color.fg = gocui.AttrNone
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.AttrNone
tk.color.selBg = gocui.ColorWhite
} }
tk.color.frame = gocui.ColorRed
tk.color.fg = gocui.AttrNone
tk.color.bg = gocui.AttrNone
tk.color.selFg = gocui.AttrNone
tk.color.selBg = gocui.ColorWhite
tk.updateColor() tk.updateColor()
} }
@ -239,12 +230,13 @@ func (tk *guiWidget) setColorDisable() {
tk.colorLast.bg = tk.color.bg tk.colorLast.bg = tk.color.bg
tk.colorLast.selFg = tk.color.selFg tk.colorLast.selFg = tk.color.selFg
tk.colorLast.selBg = tk.color.selBg tk.colorLast.selBg = tk.color.selBg
} } else {
tk.color.frame = superLightGrey tk.color.frame = superLightGrey
tk.color.fg = gocui.ColorBlack tk.color.fg = gocui.ColorBlack
tk.color.bg = superLightGrey tk.color.bg = superLightGrey
tk.color.selFg = superLightGrey tk.color.selFg = superLightGrey
tk.color.selBg = superLightGrey tk.color.selBg = superLightGrey
}
tk.updateColor() tk.updateColor()
} }

View File

@ -28,7 +28,9 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
} }
me.myTree.SendUserEvent(tk.node) me.myTree.SendUserEvent(tk.node)
case widget.Button: case widget.Button:
// if tk.node.Enabled() {
me.myTree.SendFromUser(tk.node) me.myTree.SendFromUser(tk.node)
// }
case widget.Combobox: case widget.Combobox:
tk.showDropdown() tk.showDropdown()
case widget.Dropdown: case widget.Dropdown: