rm old stuff
This commit is contained in:
parent
3cf873439d
commit
4e5c6f2515
|
@ -1,73 +0,0 @@
|
||||||
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the GPL 3.0
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"errors"
|
|
||||||
"io"
|
|
||||||
|
|
||||||
"github.com/awesome-gocui/gocui"
|
|
||||||
)
|
|
||||||
|
|
||||||
type FakeFile struct {
|
|
||||||
reader *bytes.Reader
|
|
||||||
buffer *bytes.Buffer
|
|
||||||
offset int64
|
|
||||||
view *gocui.View
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *FakeFile) Read(p []byte) (n int, err error) {
|
|
||||||
n, err = f.reader.ReadAt(p, f.offset)
|
|
||||||
f.offset += int64(n)
|
|
||||||
return n, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var fakecount int = 0
|
|
||||||
|
|
||||||
func (f *FakeFile) Write(p []byte) (n int, err error) {
|
|
||||||
n, err = f.buffer.Write(p)
|
|
||||||
f.offset += int64(n)
|
|
||||||
f.reader.Reset(f.buffer.Bytes())
|
|
||||||
f.view.Write(p)
|
|
||||||
fakecount += 1
|
|
||||||
if fakecount > 20 {
|
|
||||||
fakecount = 0
|
|
||||||
f.view.Clear()
|
|
||||||
}
|
|
||||||
return n, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *FakeFile) Seek(offset int64, whence int) (int64, error) {
|
|
||||||
newOffset := f.offset
|
|
||||||
|
|
||||||
switch whence {
|
|
||||||
case io.SeekStart:
|
|
||||||
newOffset = offset
|
|
||||||
case io.SeekCurrent:
|
|
||||||
newOffset += offset
|
|
||||||
case io.SeekEnd:
|
|
||||||
newOffset = int64(f.buffer.Len()) + offset
|
|
||||||
default:
|
|
||||||
return 0, errors.New("Seek: whence not at start,current or end")
|
|
||||||
}
|
|
||||||
// never can get here right?
|
|
||||||
|
|
||||||
if newOffset < 0 {
|
|
||||||
return 0, errors.New("Seek: offset < 0")
|
|
||||||
}
|
|
||||||
|
|
||||||
f.offset = newOffset
|
|
||||||
return f.offset, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewFakeFile(v *gocui.View) *FakeFile {
|
|
||||||
buf := &bytes.Buffer{}
|
|
||||||
return &FakeFile{
|
|
||||||
reader: bytes.NewReader(buf.Bytes()),
|
|
||||||
buffer: buf,
|
|
||||||
offset: 0,
|
|
||||||
view: v,
|
|
||||||
}
|
|
||||||
}
|
|
62
structs.go
62
structs.go
|
@ -40,37 +40,37 @@ type config struct {
|
||||||
startOutputH int // ?
|
startOutputH int // ?
|
||||||
helpLabel *gocui.View // ?
|
helpLabel *gocui.View // ?
|
||||||
// dropdownV *guiWidget // this is a floating widget that we show whenever the user clicks on a
|
// 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
|
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
|
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
|
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
|
PadW int `default:"1" dense:"0"` // pad spacing
|
||||||
PadH 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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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)
|
RawW int `default:"1"` // the raw beginning of each window (or tab)
|
||||||
RawH int `default:"5"` // 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
|
FakeW int `default:"20"` // offset for the hidden widgets
|
||||||
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?
|
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
|
canvas bool // if set to true, the windows are a raw canvas
|
||||||
menubar bool // for windows
|
menubar bool // for windows
|
||||||
stretchy bool // expand things like buttons to the maximum size
|
stretchy bool // expand things like buttons to the maximum size
|
||||||
margin bool // add space around the frames of windows
|
margin bool // add space around the frames of windows
|
||||||
writeMutex sync.Mutex // writeMutex protects writes to *guiWidget (it's global right now maybe)
|
writeMutex sync.Mutex // writeMutex protects writes to *guiWidget (it's global right now maybe)
|
||||||
fakefile *FakeFile // JUNK? used to attempt to write to the stdout window
|
// fakefile *FakeFile // JUNK? used to attempt to write to the stdout window
|
||||||
dtoggle bool // is a dropdown or combobox currently active?
|
dtoggle bool // is a dropdown or combobox currently active?
|
||||||
showHelp bool // toggle boolean for the help menu (deprecate?)
|
showHelp bool // toggle boolean for the help menu (deprecate?)
|
||||||
ecount int // counts how many mouse and keyboard events have occurred
|
ecount int // counts how many mouse and keyboard events have occurred
|
||||||
supermouse bool // prints out every widget found while you move the mouse around
|
supermouse bool // prints out every widget found while you move the mouse around
|
||||||
depth int // used for listWidgets() debugging
|
depth int // used for listWidgets() debugging
|
||||||
globalMouseDown bool // yep, mouse is pressed
|
globalMouseDown bool // yep, mouse is pressed
|
||||||
}
|
}
|
||||||
|
|
||||||
// deprecate these
|
// deprecate these
|
||||||
|
|
Loading…
Reference in New Issue