maybe fixed wierd clicks on window drag
This commit is contained in:
parent
fb3c16707d
commit
7813fc126d
23
color.go
23
color.go
|
@ -282,26 +282,3 @@ func (tk *guiWidget) setColorButtonDenseOLD() {
|
|||
tk.color.selBg = gocui.NewRGBColor(r, g, b)
|
||||
*/
|
||||
}
|
||||
|
||||
// weird. lots of color problems for me on debian sid using the traditional Andy Herzfield 'gnome'
|
||||
func (tk *guiWidget) setColorWindow() {
|
||||
if tk.color == nil {
|
||||
tk.color = new(colorT)
|
||||
}
|
||||
tk.color.frame = gocui.AttrNone
|
||||
tk.color.fg = gocui.ColorBlue
|
||||
tk.color.bg = gocui.AttrNone
|
||||
tk.color.selFg = gocui.ColorWhite
|
||||
tk.color.selBg = gocui.ColorBlue
|
||||
}
|
||||
|
||||
func (tk *guiWidget) setColorButtonDense() {
|
||||
if tk.color == nil {
|
||||
tk.color = new(colorT)
|
||||
}
|
||||
tk.color.frame = gocui.AttrNone
|
||||
tk.color.fg = gocui.ColorBlue
|
||||
tk.color.bg = gocui.AttrNone
|
||||
tk.color.selFg = gocui.ColorWhite
|
||||
tk.color.selBg = gocui.ColorBlue
|
||||
}
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
||||
// Use of this source code is governed by the GPL 3.0
|
||||
|
||||
package main
|
||||
|
||||
// simple colors for light and dark
|
||||
|
||||
import (
|
||||
"github.com/awesome-gocui/gocui"
|
||||
)
|
||||
|
||||
// weird. lots of color problems for me on debian sid using the traditional Andy Herzfield 'gnome'
|
||||
func (tk *guiWidget) setColorWindowTitle() {
|
||||
if tk.color == nil {
|
||||
tk.color = new(colorT)
|
||||
}
|
||||
if me.dark { // use a dark color palette
|
||||
tk.color.frame = gocui.AttrNone
|
||||
tk.color.fg = gocui.ColorBlue
|
||||
tk.color.bg = gocui.AttrNone
|
||||
tk.color.selFg = gocui.ColorWhite
|
||||
tk.color.selBg = gocui.ColorBlue
|
||||
return
|
||||
}
|
||||
tk.color.frame = gocui.ColorWhite
|
||||
tk.color.fg = gocui.AttrNone
|
||||
tk.color.bg = gocui.ColorBlue
|
||||
tk.color.selFg = gocui.ColorBlue
|
||||
tk.color.selBg = gocui.AttrNone
|
||||
}
|
||||
|
||||
func (tk *guiWidget) setColorBG() {
|
||||
if tk.color == nil {
|
||||
tk.color = new(colorT)
|
||||
}
|
||||
if me.dark {
|
||||
tk.color.frame = gocui.AttrNone
|
||||
tk.color.fg = gocui.ColorBlack
|
||||
tk.color.bg = gocui.ColorBlack
|
||||
tk.color.selFg = gocui.AttrNone
|
||||
tk.color.selBg = gocui.AttrNone
|
||||
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
|
||||
}
|
||||
|
||||
func (tk *guiWidget) setColorButtonDense() {
|
||||
if tk.color == nil {
|
||||
tk.color = new(colorT)
|
||||
}
|
||||
if me.dark {
|
||||
tk.color.frame = gocui.AttrNone
|
||||
tk.color.fg = gocui.ColorBlue
|
||||
tk.color.bg = gocui.AttrNone
|
||||
tk.color.selFg = gocui.ColorWhite
|
||||
tk.color.selBg = gocui.ColorBlue
|
||||
return
|
||||
}
|
||||
tk.color.frame = gocui.AttrNone
|
||||
tk.color.fg = gocui.ColorBlue
|
||||
tk.color.bg = gocui.AttrNone
|
||||
tk.color.selFg = gocui.ColorWhite
|
||||
tk.color.selBg = gocui.ColorBlue
|
||||
}
|
||||
|
||||
func (tk *guiWidget) setColorButton() {
|
||||
if tk.color == nil {
|
||||
tk.color = new(colorT)
|
||||
}
|
||||
if me.dark {
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
func (tk *guiWidget) setColorInput() {
|
||||
if tk.color == nil {
|
||||
tk.color = new(colorT)
|
||||
}
|
||||
if me.dark {
|
||||
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
|
||||
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
|
||||
}
|
|
@ -33,7 +33,7 @@ func makeNewFlagWidget(wId int) *guiWidget {
|
|||
// set the name used by gocui to the id
|
||||
tk.cuiName = fmt.Sprintf("%d DR", wId)
|
||||
|
||||
tk.color = &colorFlag
|
||||
tk.setColorInput()
|
||||
|
||||
// add this new widget on the binary tree
|
||||
tk.parent = me.treeRoot.TK.(*guiWidget)
|
||||
|
@ -127,7 +127,7 @@ func (tk *guiWidget) showTextbox() {
|
|||
if me.textbox.tk == nil {
|
||||
// should only happen once
|
||||
me.textbox.tk = makeNewFlagWidget(me.textbox.wId)
|
||||
me.dropdown.tk.dumpWidget("init() textbox")
|
||||
me.textbox.tk.dumpWidget("init() textbox")
|
||||
}
|
||||
if me.textbox.tk == nil {
|
||||
log.Log(GOCUI, "showTextbox() Is Broken")
|
||||
|
@ -137,7 +137,7 @@ func (tk *guiWidget) showTextbox() {
|
|||
// log.Log(GOCUI, "showTextbox() SHOWING AT W,H=", startW, startH)
|
||||
me.textbox.tk.MoveToOffset(startW+3, startH+2)
|
||||
me.textbox.tk.labelN = "holy cow"
|
||||
me.textbox.tk.SetColorRed()
|
||||
me.textbox.tk.setColorInput()
|
||||
me.textbox.tk.Show()
|
||||
me.textbox.active = true
|
||||
me.textbox.callerTK = tk
|
||||
|
|
|
@ -99,7 +99,12 @@ func addDropdown() *tree.Node {
|
|||
|
||||
// use this to test code ideas // put whatever you want here and hit '2' to activate it
|
||||
func theNotsure(g *gocui.Gui, v *gocui.View) error {
|
||||
log.Info("got keypress 2. now what?")
|
||||
if me.dark {
|
||||
me.dark = false
|
||||
} else {
|
||||
me.dark = true
|
||||
}
|
||||
log.Info("got keypress 2. now what? dark =", me.dark)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -101,11 +101,19 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
|
|||
}
|
||||
}
|
||||
}
|
||||
if tk.node.WidgetType == widget.Stdout {
|
||||
tk.dumpWidget("stdout fixme drag()" + tk.labelN)
|
||||
me.currentDrag = tk
|
||||
tk.dragW = w - tk.gocuiSize.w0
|
||||
tk.dragH = h - tk.gocuiSize.h0
|
||||
// tk.doWidgetClick(w-tk.dragW, w-tk.dragH)
|
||||
return nil
|
||||
}
|
||||
tk.dumpWidget("mouse drag()" + tk.labelN)
|
||||
me.currentDrag = tk
|
||||
tk.dragW = w - tk.gocuiSize.w0
|
||||
tk.dragH = h - tk.gocuiSize.h0
|
||||
tk.doWidgetClick(w-tk.dragW, w-tk.dragH)
|
||||
// tk.doWidgetClick(w-tk.dragW, w-tk.dragH)
|
||||
return nil
|
||||
|
||||
// move the msg I guess
|
||||
|
|
|
@ -100,6 +100,8 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
|
|||
tk.showTextbox()
|
||||
case widget.Flag:
|
||||
tk.dropdownClicked(w, h)
|
||||
case widget.Stdout:
|
||||
tk.dumpWidget("stdout click()")
|
||||
default:
|
||||
tk.dumpWidget("undef click()")
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ type config struct {
|
|||
downW int // where the mouse was pressed down
|
||||
downH int // where the mouse was pressed down
|
||||
currentDrag *guiWidget // what widget is currently being moved around
|
||||
|
||||
dark bool // use a 'dark' color palette
|
||||
}
|
||||
|
||||
// settings for the stdout window
|
||||
|
|
10
treeAdd.go
10
treeAdd.go
|
@ -63,14 +63,16 @@ func addWidget(n *tree.Node) {
|
|||
tk.color = &colorTab
|
||||
return
|
||||
case widget.Button:
|
||||
tk.color = &colorButton
|
||||
tk.setColorButton()
|
||||
return
|
||||
case widget.Checkbox:
|
||||
tk.color = &colorCheckbox
|
||||
// tk.color = &colorCheckbox
|
||||
tk.setColorInput()
|
||||
tk.labelN = "X " + n.State.Label
|
||||
return
|
||||
case widget.Dropdown:
|
||||
tk.color = &colorDropdown
|
||||
// tk.color = &colorDropdown
|
||||
tk.setColorInput()
|
||||
return
|
||||
case widget.Textbox:
|
||||
n.State.Label = "TEXTBOX"
|
||||
|
@ -91,7 +93,7 @@ func addWidget(n *tree.Node) {
|
|||
setFake(n)
|
||||
return
|
||||
case widget.Group:
|
||||
tk.color = &colorGroup
|
||||
// tk.color = &colorLabel
|
||||
tk.frame = false
|
||||
return
|
||||
case widget.Label:
|
||||
|
|
Loading…
Reference in New Issue