From acfb80a2e702a7472ccf547350c2a71568c8cf01 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 4 Feb 2025 10:04:45 -0600 Subject: [PATCH] kinda, sorta, but no. not yet --- eventMouseClick.go | 36 +++++++++++++++++++++++------------- eventMouseMove.go | 12 ++++++++---- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/eventMouseClick.go b/eventMouseClick.go index 1f33ee7..81b8aaf 100644 --- a/eventMouseClick.go +++ b/eventMouseClick.go @@ -9,6 +9,27 @@ import ( "go.wit.com/widget" ) +func (tk *guiWidget) redrawWindow(w int, h int) { + if tk.node.WidgetType != widget.Window { + return + } + // might make the green box the right size + tk.setFullSize() + + // draw the current window + // w = tk.gocuiSize.w0 + 4 + // h = tk.gocuiSize.h0 + 4 + w = w + 4 + h = h + 4 + tk.DrawAt(w, h) + tk.setColor(&colorActiveW) // sets the window to Green BG + tk.showWidgets() + tk.placeWidgets(w, h) // compute the sizes & places for each widget + + tk.setFullSize() + me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0) +} + // this whole things was impossible to make but it got me where I am now // the debugging is way way better now with it being visible in the Stdout window // so now it's possible to redo all this and make it better @@ -27,19 +48,8 @@ func (tk *guiWidget) doWidgetClick(w int, h int) { me.currentWindow.isCurrent = true tk.active = false - // might make the green box the right size - tk.setFullSize() - - // draw the current window - w := tk.gocuiSize.w0 + 4 - h := tk.gocuiSize.h0 + 4 - tk.DrawAt(w, h) - tk.setColor(&colorActiveW) // sets the window to Green BG - tk.showWidgets() - tk.placeWidgets(w, h) // compute the sizes & places for each widget - - tk.setFullSize() - me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0) + tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0) + return case widget.Group: if tk.active { tk.active = false diff --git a/eventMouseMove.go b/eventMouseMove.go index 991bd62..8f68219 100644 --- a/eventMouseMove.go +++ b/eventMouseMove.go @@ -92,10 +92,14 @@ func mouseMove(g *gocui.Gui) { func (tk *guiWidget) moveNew(g *gocui.Gui) { w, h := g.MousePosition() if tk.node.WidgetType == widget.Window { - w1, h1 := tk.Size() - g.SetView(tk.cuiName, w, h, w+w1, h+h1, 0) - tk.verifyRect() - s := fmt.Sprintf("move(%dx%d) %s ###", w, h, tk.cuiName) + /* + w1, h1 := tk.Size() + g.SetView(tk.cuiName, w, h, w+w1, h+h1, 0) + tk.verifyRect() + s := fmt.Sprintf("move(%dx%d) %s WIN", w, h, tk.cuiName) + */ + tk.redrawWindow(w, h) + s := fmt.Sprintf("move(%dx%d) %s WIN", w, h, tk.cuiName) tk.dumpWidget(s) return }