summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--click.go2
-rw-r--r--color.go16
-rw-r--r--main.go19
-rw-r--r--size.go24
-rw-r--r--structs.go2
-rw-r--r--tab.go2
6 files changed, 44 insertions, 21 deletions
diff --git a/click.go b/click.go
index f95f122..9d8a6f4 100644
--- a/click.go
+++ b/click.go
@@ -103,7 +103,7 @@ func (w *guiWidget) doWidgetClick() {
case widget.Window:
log.Log(NOW, "doWidgetClick() START on window", w.String())
if me.currentWindow == w.node {
- if ! w.active {
+ if !w.active {
return
}
}
diff --git a/color.go b/color.go
index f855d0e..51ad9d3 100644
--- a/color.go
+++ b/color.go
@@ -41,13 +41,13 @@ var superLightGrey gocui.Attribute = gocui.GetColor("#55AAFF") // super light gr
// Normal Text On mouseover
//
// Widget Frame Text background Text background
-var colorWindow colorT = colorT {
+var colorWindow colorT = colorT{
frame: none,
- fg: gocui.ColorBlue,
- bg: none,
+ fg: gocui.ColorBlue,
+ bg: none,
selFg: none,
selBg: powdererBlue,
- name: "normal window",
+ name: "normal window",
}
var colorActiveW colorT = colorT{none, none, powdererBlue, none, powdererBlue, "active window"}
@@ -58,13 +58,13 @@ var colorButton colorT = colorT{gocui.ColorGreen, none, gocui.ColorWhite, gocui.
var colorLabel colorT = colorT{none, none, superLightGrey, none, superLightGrey, "normal label"}
var colorGroup colorT = colorT{none, none, superLightGrey, none, superLightGrey, "normal group"}
-var colorDisabled colorT = colorT {
+var colorDisabled colorT = colorT{
frame: superLightGrey,
- fg: superLightGrey,
- bg: superLightGrey,
+ fg: superLightGrey,
+ bg: superLightGrey,
selFg: gocui.ColorBlack,
selBg: gocui.ColorBlack,
- name: "disabled widget",
+ name: "disabled widget",
}
// widget debugging colors. these widgets aren't displayed unless you are debugging
diff --git a/main.go b/main.go
index 6de0402..b2c0fd7 100644
--- a/main.go
+++ b/main.go
@@ -6,6 +6,7 @@ package main
import (
"os"
+ "runtime/debug"
"go.wit.com/log"
"go.wit.com/toolkits/tree"
@@ -30,7 +31,7 @@ func init() {
log.Log(NOW, "Init() start pluginChan")
// go catchActionChannel()
log.Sleep(.1) // probably not needed, but in here for now under development
- go main()
+ go mainGogui()
log.Sleep(.1) // probably not needed, but in here for now under development
}
@@ -58,6 +59,19 @@ func standardExit() {
var outf *os.File
func main() {
+}
+
+func mainGogui() {
+ defer func() {
+ if r := recover(); r != nil {
+ log.Warn("YAHOOOO Recovered in guiMain application:", r)
+ log.Warn("Recovered from panic:", r)
+ log.Warn("Stack trace:")
+ debug.PrintStack()
+ me.myTree.SendToolkitPanic()
+ return
+ }
+ }()
var err error
log.Log(INFO, "main() start Init()")
@@ -75,7 +89,4 @@ func main() {
ferr, _ := os.OpenFile("/tmp/witgui.err", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0664)
os.Stderr = ferr
gocuiMain()
-
- log.Log(NOW, "MouseMain() closed")
- standardExit()
}
diff --git a/size.go b/size.go
index ef69fa7..651e773 100644
--- a/size.go
+++ b/size.go
@@ -22,7 +22,9 @@ func (tk *guiWidget) Size() (int, int) {
var maxH int = 0
var maxW int = 0
for _, child := range tk.children {
- if tk.hidden { continue }
+ if tk.hidden {
+ continue
+ }
sizeW, sizeH := child.Size()
maxW += sizeW
if sizeH > maxH {
@@ -41,7 +43,9 @@ func (tk *guiWidget) Size() (int, int) {
maxH := tk.gocuiSize.Height()
for _, child := range tk.children {
- if tk.hidden { continue }
+ if tk.hidden {
+ continue
+ }
sizeW, sizeH := child.Size()
// increment straight down
@@ -59,11 +63,15 @@ func (tk *guiWidget) Size() (int, int) {
}
func (w *guiWidget) sizeGrid() (int, int) {
- if w.hidden { return 0, 0 }
+ if w.hidden {
+ return 0, 0
+ }
// first compute the max sizes of the rows and columns
for _, child := range w.children {
- if w.hidden { continue }
+ if w.hidden {
+ continue
+ }
sizeW, sizeH := child.Size()
// set the child's realWidth, and grid offset
@@ -91,12 +99,16 @@ func (w *guiWidget) sizeBox() (int, int) {
if w.WidgetType != widget.Box {
return 0, 0
}
- if w.hidden { return 0, 0 }
+ if w.hidden {
+ return 0, 0
+ }
var maxW int = 0
var maxH int = 0
for _, child := range w.children {
- if w.hidden {continue}
+ if w.hidden {
+ continue
+ }
sizeW, sizeH := child.Size()
if child.direction == widget.Horizontal {
maxW += sizeW
diff --git a/structs.go b/structs.go
index ddc22c0..fba741c 100644
--- a/structs.go
+++ b/structs.go
@@ -151,7 +151,7 @@ type guiWidget struct {
active bool
- enable bool
+ enable bool
defaultColor *colorT // store the color to go back to
hidden bool
diff --git a/tab.go b/tab.go
index 3ab1ba4..e318035 100644
--- a/tab.go
+++ b/tab.go
@@ -66,7 +66,7 @@ func (w *guiWidget) redoWindows(nextW int, nextH int) {
child.showView()
sizeW := child.gocuiSize.Width()
nextW += sizeW + 4
- child.redoWindows(startW + 3, startH + 2)
+ child.redoWindows(startW+3, startH+2)
}
}