forge is finally an app again. this time in the console
This commit is contained in:
parent
13a194dca5
commit
b6b5df6a18
|
@ -5,7 +5,6 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/awesome-gocui/gocui"
|
||||
|
@ -64,34 +63,6 @@ func theSuperMouse(g *gocui.Gui, v *gocui.View) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (tk *guiWidget) makeTK(ddItems []string) {
|
||||
items := strings.Join(ddItems, "\n")
|
||||
var err error
|
||||
tk.labelN = items
|
||||
tk.SetText(items)
|
||||
tk.gocuiSize.w0 = 100
|
||||
tk.gocuiSize.w1 = 120
|
||||
tk.gocuiSize.h0 = 15
|
||||
tk.gocuiSize.h1 = 18
|
||||
tk.v, err = me.baseGui.SetView(tk.cuiName,
|
||||
tk.gocuiSize.w0,
|
||||
tk.gocuiSize.h0,
|
||||
tk.gocuiSize.w1,
|
||||
tk.gocuiSize.h1, 0)
|
||||
if err != nil {
|
||||
log.Info("makeTK() err", err)
|
||||
return
|
||||
}
|
||||
if tk.v == nil {
|
||||
return
|
||||
}
|
||||
tk.v.Wrap = true
|
||||
tk.v.Frame = true
|
||||
tk.v.Clear()
|
||||
fmt.Fprint(tk.v, items)
|
||||
tk.Show()
|
||||
}
|
||||
|
||||
/*
|
||||
func addDropdown() *tree.Node {
|
||||
return addDropdownNew(-222)
|
||||
|
@ -172,12 +143,12 @@ func theStdout(g *gocui.Gui, v *gocui.View) error {
|
|||
if me.stdout.outputOnTop {
|
||||
if me.stdout.outputOffscreen {
|
||||
me.stdout.outputOffscreen = false
|
||||
log.Info(fmt.Sprintf("set stdout off screen pager=%d len(%d)", me.stdout.pager, len(me.stdout.outputS)))
|
||||
log.Info(fmt.Sprintf("stdout moved off screen pager=%d len(%d)", me.stdout.pager, len(me.stdout.outputS)))
|
||||
relocateStdoutOffscreen()
|
||||
return nil
|
||||
} else {
|
||||
me.stdout.outputOffscreen = true
|
||||
log.Info("set stdout on screen here")
|
||||
log.Info(fmt.Sprintf("stdout moved on screen pager=%d len(%d)", me.stdout.pager, len(me.stdout.outputS)))
|
||||
}
|
||||
// move the stdout window back onscreen
|
||||
me.stdout.tk.relocateStdout(me.stdout.lastW, me.stdout.lastH)
|
||||
|
|
|
@ -43,7 +43,7 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
|
|||
log.Info("mouseDown() stopping here. dropdwon menu is in effect")
|
||||
for _, tk := range findByXY(w, h) {
|
||||
if (tk.node.WidgetType == widget.Flag) && (tk == me.dropdown.tk) {
|
||||
log.Info("SENDING CLICK TO Flag (dropdown)")
|
||||
// log.Info("SENDING CLICK TO Flag (dropdown)")
|
||||
tk.doWidgetClick(w, h)
|
||||
me.dropdown.active = false
|
||||
return nil
|
||||
|
@ -80,45 +80,39 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
|
|||
for _, tk := range tk.findByXYreal(w, h) {
|
||||
// tk.dumpWidget("mouseDown()")
|
||||
if tk.node.WidgetType == widget.Button {
|
||||
log.Info("SENDING CLICK TO Button")
|
||||
// log.Info("SENDING CLICK TO Button")
|
||||
tk.doWidgetClick(w, h)
|
||||
return nil
|
||||
}
|
||||
if tk.node.WidgetType == widget.Checkbox {
|
||||
log.Info("SENDING CLICK TO Checkbox")
|
||||
// log.Info("SENDING CLICK TO Checkbox")
|
||||
tk.doWidgetClick(w, h)
|
||||
return nil
|
||||
}
|
||||
if tk.node.WidgetType == widget.Dropdown {
|
||||
log.Info("SENDING CLICK TO Dropdown")
|
||||
// log.Info("SENDING CLICK TO Dropdown")
|
||||
tk.doWidgetClick(w, h)
|
||||
return nil
|
||||
}
|
||||
if tk.node.WidgetType == widget.Textbox {
|
||||
log.Info("SENDING CLICK TO Textbox")
|
||||
// log.Info("SENDING CLICK TO Textbox")
|
||||
tk.doWidgetClick(w, h)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
if tk.node.WidgetType == widget.Stdout {
|
||||
tk.dumpWidget("stdout fixme drag()" + tk.labelN)
|
||||
// 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)
|
||||
// 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)
|
||||
return nil
|
||||
|
||||
// move the msg I guess
|
||||
// return msgDown(g, v)
|
||||
// return nil
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
6
init.go
6
init.go
|
@ -202,10 +202,10 @@ func gocuiMain() {
|
|||
func newWindowTrigger() {
|
||||
log.Log(NOW, "newWindowTriggerl() START")
|
||||
for {
|
||||
log.Log(NOW, "newWindowTrigger() for loop")
|
||||
// log.Log(NOW, "GO plugin toolkit made a new window")
|
||||
select {
|
||||
case tk := <-me.newWindowTrigger:
|
||||
log.Log(NOW, "newWindowTrigger() got new window", tk.cuiName)
|
||||
// log.Log(NOW, "newWindowTrigger() got new window", tk.cuiName)
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
redoWindows(1, -1)
|
||||
if !me.stdout.init {
|
||||
|
@ -215,7 +215,7 @@ func newWindowTrigger() {
|
|||
tk.makeWindowActive()
|
||||
tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0)
|
||||
setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn
|
||||
log.Log(NOW, "newWindowTrigger() after sleep")
|
||||
// log.Log(NOW, "newWindowTrigger() after sleep")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ func relocateStdoutOffscreen() {
|
|||
return
|
||||
}
|
||||
log.CaptureMode(me.stdout.tk)
|
||||
log.Log(ERROR, "setting log.CaptureMode(tk.v) in relocateStdoutOffscreen()")
|
||||
// log.Log(ERROR, "setting log.CaptureMode(tk.v) in relocateStdoutOffscreen()")
|
||||
newW := 10
|
||||
newH := 0 - me.stdout.h - 4
|
||||
me.stdout.tk.relocateStdout(newW, newH)
|
||||
|
|
52
window.go
52
window.go
|
@ -5,8 +5,8 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
log "go.wit.com/log"
|
||||
"go.wit.com/toolkits/tree"
|
||||
"go.wit.com/widget"
|
||||
)
|
||||
|
@ -48,13 +48,15 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
|
|||
tk.full.h0 = tk.force.h0
|
||||
|
||||
tk.setFullSize()
|
||||
v, err := me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
|
||||
if err != nil {
|
||||
log.Info("crap. got an err", err)
|
||||
}
|
||||
if tk.v != v {
|
||||
log.Info("crap. got another problem v != tk.v")
|
||||
}
|
||||
/*
|
||||
v, err := me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
|
||||
if err != nil {
|
||||
log.Info("crap. got an err", err)
|
||||
}
|
||||
if tk.v != v {
|
||||
log.Info("crap. got another problem v != tk.v")
|
||||
}
|
||||
*/
|
||||
tk.Show()
|
||||
tk.v.Clear()
|
||||
fmt.Fprint(tk.v, "ZZZ"+tk.GetText())
|
||||
|
@ -95,7 +97,7 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
|
|||
// re-draws the buttons for each of the windows
|
||||
func redoWindows(nextW int, nextH int) {
|
||||
for _, tk := range findWindows() {
|
||||
tk.dumpWidget(fmt.Sprintf("redoWindowsS (%d,%d)", nextW, nextH))
|
||||
// tk.dumpWidget(fmt.Sprintf("redoWindowsS (%d,%d)", nextW, nextH))
|
||||
if tk.window.wasDragged {
|
||||
// don't move windows around the user has dragged to a certain location
|
||||
tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0)
|
||||
|
@ -109,7 +111,7 @@ func redoWindows(nextW int, nextH int) {
|
|||
// probably a new window?
|
||||
tk.redrawWindow(nextW, nextH)
|
||||
}
|
||||
tk.dumpWidget(fmt.Sprintf("redoWindowsE (%d,%d)", nextW, nextH))
|
||||
// tk.dumpWidget(fmt.Sprintf("redoWindowsE (%d,%d)", nextW, nextH))
|
||||
|
||||
// increment the width for the next window
|
||||
nextW += tk.gocuiSize.Width() + 10
|
||||
|
@ -182,3 +184,33 @@ func (tk *guiWidget) makeWindowActive() {
|
|||
}
|
||||
*/
|
||||
}
|
||||
|
||||
func (tk *guiWidget) makeTK(ddItems []string) {
|
||||
items := strings.Join(ddItems, "\n")
|
||||
tk.labelN = items
|
||||
tk.SetText(items)
|
||||
tk.gocuiSize.w0 = 100
|
||||
tk.gocuiSize.w1 = 120
|
||||
tk.gocuiSize.h0 = 15
|
||||
tk.gocuiSize.h1 = 18
|
||||
/*
|
||||
var err error
|
||||
tk.v, err = me.baseGui.SetView(tk.cuiName,
|
||||
tk.gocuiSize.w0,
|
||||
tk.gocuiSize.h0,
|
||||
tk.gocuiSize.w1,
|
||||
tk.gocuiSize.h1, 0)
|
||||
if err != nil {
|
||||
log.Info("makeTK() err", err)
|
||||
return
|
||||
}
|
||||
if tk.v == nil {
|
||||
return
|
||||
}
|
||||
tk.v.Wrap = true
|
||||
tk.v.Frame = true
|
||||
tk.v.Clear()
|
||||
fmt.Fprint(tk.v, items)
|
||||
*/
|
||||
tk.Show()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue