summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-07 02:34:40 -0600
committerJeff Carr <[email protected]>2025-02-07 02:34:40 -0600
commit7813fc126dee96c1fe901b4ba5fe7fd252804806 (patch)
treecc49e620ddd597cc5f38398592518f5dff324e45
parentfb3c16707d72d41cbb92c2392f36dee76fa36936 (diff)
maybe fixed wierd clicks on window drag
-rw-r--r--color.go23
-rw-r--r--colorNew.go106
-rw-r--r--dropdown.go6
-rw-r--r--eventBindings.go7
-rw-r--r--eventMouse.go10
-rw-r--r--eventMouseClick.go2
-rw-r--r--structs.go2
-rw-r--r--treeAdd.go10
8 files changed, 133 insertions, 33 deletions
diff --git a/color.go b/color.go
index 5e5029f..5b57035 100644
--- a/color.go
+++ b/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
-}
diff --git a/colorNew.go b/colorNew.go
new file mode 100644
index 0000000..9fdc484
--- /dev/null
+++ b/colorNew.go
@@ -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
+}
diff --git a/dropdown.go b/dropdown.go
index e08b11c..407d626 100644
--- a/dropdown.go
+++ b/dropdown.go
@@ -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
diff --git a/eventBindings.go b/eventBindings.go
index 16ef0cf..5b39457 100644
--- a/eventBindings.go
+++ b/eventBindings.go
@@ -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
}
diff --git a/eventMouse.go b/eventMouse.go
index adfbfc1..fb1a4a9 100644
--- a/eventMouse.go
+++ b/eventMouse.go
@@ -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
diff --git a/eventMouseClick.go b/eventMouseClick.go
index ca361b7..d2562c0 100644
--- a/eventMouseClick.go
+++ b/eventMouseClick.go
@@ -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()")
}
diff --git a/structs.go b/structs.go
index f8cc81e..6c6ca45 100644
--- a/structs.go
+++ b/structs.go
@@ -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
diff --git a/treeAdd.go b/treeAdd.go
index a670010..e8e9834 100644
--- a/treeAdd.go
+++ b/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: