summaryrefslogtreecommitdiff
path: root/gocui/structs.go
diff options
context:
space:
mode:
Diffstat (limited to 'gocui/structs.go')
-rw-r--r--gocui/structs.go68
1 files changed, 34 insertions, 34 deletions
diff --git a/gocui/structs.go b/gocui/structs.go
index a3ca566..e899f78 100644
--- a/gocui/structs.go
+++ b/gocui/structs.go
@@ -10,11 +10,11 @@ package main
import (
"fmt"
+ "github.com/awesome-gocui/gocui"
"reflect"
"strconv"
- "sync"
"strings"
- "github.com/awesome-gocui/gocui"
+ "sync"
"go.wit.com/log"
)
@@ -30,24 +30,24 @@ var redoWidgets bool = true
var currentWindow *node
type config struct {
- baseGui *gocui.Gui // the main gocui handle
- rootNode *node // the base of the binary tree. it should have id == 0
+ baseGui *gocui.Gui // the main gocui handle
+ rootNode *node // the base of the binary tree. it should have id == 0
- ctrlDown *node // shown if you click the mouse when the ctrl key is pressed
+ ctrlDown *node // shown if you click the mouse when the ctrl key is pressed
currentWindow *node // this is the current tab or window to show
- logStdout *node // where to show STDOUT
- helpLabel *gocui.View
- ddview *node // the gocui view to select dropdrown lists
- ddClicked bool // the dropdown menu view was clicked
- ddNode *node // the dropdown menu is for this widget
+ logStdout *node // where to show STDOUT
+ helpLabel *gocui.View
+ ddview *node // the gocui view to select dropdrown lists
+ ddClicked bool // the dropdown menu view was clicked
+ ddNode *node // the dropdown menu is for this widget
/*
- // this is the channel we send user events like
- // mouse clicks or keyboard events back to the program
- callback chan toolkit.Action
+ // this is the channel we send user events like
+ // mouse clicks or keyboard events back to the program
+ callback chan toolkit.Action
- // this is the channel we get requests to make widgets
- pluginChan chan toolkit.Action
+ // this is the channel we get requests to make widgets
+ pluginChan chan toolkit.Action
*/
// When the widget has a frame, like a button, it adds 2 lines runes on each side
@@ -62,12 +62,12 @@ type config struct {
// how far down to start Window or Tab headings
WindowW int `default:"8" dense:"0"`
WindowH int `default:"-1"`
- TabW int `default:"5" dense:"0"`
- TabH int `default:"1" dense:"0"`
+ TabW int `default:"5" dense:"0"`
+ TabH int `default:"1" dense:"0"`
// additional amount of space to put between window & tab widgets
WindowPadW int `default:"8" dense:"0"`
- TabPadW int `default:"4" dense:"0"`
+ TabPadW int `default:"4" dense:"0"`
// additional amount of space to indent on a group
GroupPadW int `default:"6" dense:"2"`
@@ -79,12 +79,12 @@ type config struct {
// offset for the hidden widgets
FakeW int `default:"20"`
- padded bool // add space between things like buttons
+ padded bool // add space between things like buttons
bookshelf bool // do you want things arranged in the box like a bookshelf or a stack?
- canvas bool // if set to true, the windows are a raw canvas
- menubar bool // for windows
- stretchy bool // expand things like buttons to the maximum size
- margin bool // add space around the frames of windows
+ canvas bool // if set to true, the windows are a raw canvas
+ menubar bool // for windows
+ stretchy bool // expand things like buttons to the maximum size
+ margin bool // add space around the frames of windows
// writeMutex protects locks the write process
writeMutex sync.Mutex
@@ -96,13 +96,13 @@ type config struct {
// deprecate these
var (
initialMouseX, initialMouseY, xOffset, yOffset int
- globalMouseDown, msgMouseDown, movingMsg bool
+ globalMouseDown, msgMouseDown, movingMsg bool
)
// this is the gocui way
// corner starts at in the upper left corner
type rectType struct {
- w0, h0, w1, h1 int // left top right bottom
+ w0, h0, w1, h1 int // left top right bottom
}
func (r *rectType) Width() int {
@@ -115,11 +115,11 @@ func (r *rectType) Height() int {
type guiWidget struct {
// the gocui package variables
- v *gocui.View // this is nil if the widget is not displayed
- cuiName string // what gocui uses to reference the widget
+ v *gocui.View // this is nil if the widget is not displayed
+ cuiName string // what gocui uses to reference the widget
// the actual text to display in the console
- label string
+ label string
// the logical size of the widget
// For example, 40x12 would be the center of a normal terminal
@@ -130,14 +130,14 @@ type guiWidget struct {
gocuiSize rectType
isCurrent bool // is this the currently displayed Window or Tab?
- isFake bool // widget types like 'box' are 'false'
+ isFake bool // widget types like 'box' are 'false'
// used to track the size of grids
- widths map[int]int // how tall each row in the grid is
+ widths map[int]int // how tall each row in the grid is
heights map[int]int // how wide each column in the grid is
tainted bool
- frame bool
+ frame bool
// for a window, this is currently selected tab
selectedTab *node
@@ -156,13 +156,13 @@ func (w *guiWidget) Write(p []byte) (n int, err error) {
w.tainted = true
me.writeMutex.Lock()
defer me.writeMutex.Unlock()
- if (me.logStdout.tk.v == nil) {
+ if me.logStdout.tk.v == nil {
// optionally write the output to /tmp
s := fmt.Sprint(string(p))
s = strings.TrimSuffix(s, "\n")
fmt.Fprintln(outf, s)
v, _ := me.baseGui.View("msg")
- if (v != nil) {
+ if v != nil {
// fmt.Fprintln(outf, "found msg")
me.logStdout.tk.v = v
}
@@ -174,7 +174,7 @@ func (w *guiWidget) Write(p []byte) (n int, err error) {
s = strings.TrimSuffix(s, "\n")
tmp := strings.Split(s, "\n")
outputS = append(outputS, tmp...)
- if (len(outputS) > outputH) {
+ if len(outputS) > outputH {
l := len(outputS) - outputH
outputS = outputS[l:]
}