diff options
| author | Jeff Carr <[email protected]> | 2025-02-01 15:15:05 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-01 15:15:05 -0600 |
| commit | 96fdfd13386472039dd75b0c622bb97b9987173a (patch) | |
| tree | b0d0d08c8d826efc315970bd7a32a7f2354dbddd /structs.go | |
| parent | 8d007ec10d8ea58d3bb1f85ec2ce2e99c3604231 (diff) | |
remove dumb old stuff and clean up struct.go
Diffstat (limited to 'structs.go')
| -rw-r--r-- | structs.go | 200 |
1 files changed, 66 insertions, 134 deletions
@@ -22,7 +22,6 @@ import ( "go.wit.com/log" "go.wit.com/toolkits/tree" - "go.wit.com/widget" ) // It's probably a terrible idea to call this 'me' @@ -34,77 +33,48 @@ var redoWidgets bool = true // This is the window that is currently active // var currentWindow *tree.Node +// todo: move all this to a protobuf. then, redo all this mess. it got me here, but now it's time to clean it up for good type config struct { - baseGui *gocui.Gui // the main gocui handle - // rootNode *node // the base of the binary tree. it should have id == 0 - - treeRoot *tree.Node // the base of the binary tree. it should have id == 0 - myTree *tree.TreeInfo - - ctrlDown *tree.Node // shown if you click the mouse when the ctrl key is pressed - currentWindow *guiWidget // this is the current tab or window to show - logStdout *tree.Node // where to show STDOUT - startOutputW int - startOutputH int - helpLabel *gocui.View - - // this is a floating widget that we show whenever the user clicks on a - // dropdown menu or combobox - // the dropdown widget to select dropdrown lists - dropdownV *guiWidget - dropdownW *guiWidget // grab the dropdown choices from this widget - - // When the widget has a frame, like a button, it adds 2 lines runes on each side - // so you need 3 char spacing in each direction to not have them overlap - // the amount of padding when there is a frame - FramePadW int `default:"1" dense:"0"` - FramePadH int `default:"1" dense:"0"` - - PadW int `default:"1" dense:"0"` - PadH int `default:"1" dense:"0"` - - // 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"` - - // additional amount of space to put between window & tab widgets - WindowPadW int `default:"8" dense:"0"` - TabPadW int `default:"4" dense:"0"` - - // additional amount of space to indent on a group - GroupPadW int `default:"2" dense:"1"` - - // additional amount of space to indent on a group - BoxPadW int `default:"2" dense:"1"` - - // additional amount of space to indent on a group - GridPadW int `default:"2" dense:"1"` - - // the raw beginning of each window (or tab) - RawW int `default:"1"` - RawH int `default:"5"` - - // offset for the hidden widgets - FakeW int `default:"20"` - - 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 - - writeMutex sync.Mutex // TODO: writeMutex protects locks the write process - fakefile *FakeFile // JUNK? used to attempt to write to the stdout window - dtoggle bool // is a dropdown or combobox currently active? - showHelp bool // toggle boolean for the help menu (deprecate?) - - // debugging things - ecount int // counts how many mouse and keyboard events have occurred - supermouse bool // prints out every widget found while you move the mouse around - depth int // used for listWidgets() debugging + baseGui *gocui.Gui // the main gocui handle + treeRoot *tree.Node // the base of the binary tree. it should have id == 0 + myTree *tree.TreeInfo // ? + ctrlDown *tree.Node // shown if you click the mouse when the ctrl key is pressed + currentWindow *guiWidget // this is the current tab or window to show + logStdout *tree.Node // where to show STDOUT + startOutputW int // ? + startOutputH int // ? + helpLabel *gocui.View // ? + dropdownV *guiWidget // this is a floating widget that we show whenever the user clicks on a + dropdownW *guiWidget // grab the dropdown choices from this widget + FramePadW int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side + FramePadH int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side + PadW int `default:"1" dense:"0"` // pad spacing + PadH int `default:"1" dense:"0"` // pad spacing + WindowW int `default:"8" dense:"0"` // how far down to start Window or Tab headings + WindowH int `default:"-1"` // how far down to start Window or Tab headings + TabW int `default:"5" dense:"0"` // how far down to start Window or Tab headings + TabH int `default:"1" dense:"0"` // how far down to start Window or Tab headings + WindowPadW int `default:"8" dense:"0"` // additional amount of space to put between window & tab widgets + TabPadW int `default:"4" dense:"0"` // additional amount of space to put between window & tab widgets + GroupPadW int `default:"2" dense:"1"` // additional amount of space to indent on a group + BoxPadW int `default:"2" dense:"1"` // additional amount of space to indent on a box + GridPadW int `default:"2" dense:"1"` // additional amount of space to indent on a grid + RawW int `default:"1"` // the raw beginning of each window (or tab) + RawH int `default:"5"` // the raw beginning of each window (or tab) + FakeW int `default:"20"` // offset for the hidden widgets + 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 + writeMutex sync.Mutex // TODO: writeMutex protects locks the write process + fakefile *FakeFile // JUNK? used to attempt to write to the stdout window + dtoggle bool // is a dropdown or combobox currently active? + showHelp bool // toggle boolean for the help menu (deprecate?) + ecount int // counts how many mouse and keyboard events have occurred + supermouse bool // prints out every widget found while you move the mouse around + depth int // used for listWidgets() debugging } // deprecate these @@ -128,69 +98,31 @@ 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 - - WidgetType widget.WidgetType - - // tw *toolkit.Widget - parent *guiWidget - children []*guiWidget - - node *tree.Node - - hasTabs bool // does the window have tabs? - currentTab bool // the visible tab - - value string - checked bool - - // the actual text to display in the console - labelN string - - vals []string // dropdown menu items - - active bool - - enable bool - defaultColor *colorT // store the color to go back to - - // hidden bool - - // AtW int - // AtH int - - // direction widget.Orientation - - // progname string - - // the logical size of the widget - // For example, 40x12 would be the center of a normal terminal - // size rectType - - // the actual gocui display view of this widget - // sometimes this isn't visible like with a Box or Grid - gocuiSize rectType - - startW int - startH int - - isCurrent bool // is this the currently displayed Window or Tab? - 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 - heights map[int]int // how wide each column in the grid is - - tainted bool - frame bool - - // for a window, this is currently selected tab - selectedTab *tree.Node - - // what color to use - color *colorT + v *gocui.View // this is nil if the widget is not displayed + cuiName string // what gocui uses to reference the widget (usually "TK <widgetId>" + parent *guiWidget // mirrors the binary node tree + children []*guiWidget // mirrors the binary node tree + node *tree.Node // the pointer back to the tree + hasTabs bool // does the window have tabs? + currentTab bool // the visible tab + value string // ? + checked bool // ? + labelN string // the actual text to display in the console + vals []string // dropdown menu items + active bool // ? + enable bool // ? + defaultColor *colorT // store the color to go back to + gocuiSize rectType // should mirror the real display size. todo: verify these are accurate. they are not yet + startW int // ? + startH int // ? + isCurrent bool // is this the currently displayed Window or Tab? + isFake bool // widget types like 'box' are 'false' + 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 // ? + selectedTab *tree.Node // for a window, this is currently selected tab + color *colorT // what color to use } // from the gocui devs: |
