diff --git a/tool/console.go b/tool/console.go index d6801f24..cc2874a7 100644 --- a/tool/console.go +++ b/tool/console.go @@ -4,13 +4,13 @@ import ( "fmt" "image" - "github.com/vizicist/palette/engine" + "github.com/vizicist/palette/kit" w "github.com/vizicist/palette/twinsys" ) func init() { w.RegisterWindow("Console", NewConsole) - // engine.RegisterBlock("Console", NewConsole) + // kit.RegisterBlock("Console", NewConsole) } // Console is a window that has a couple of buttons @@ -48,15 +48,15 @@ func (console *Console) Context() *w.WinContext { } // Do xxx -func (console *Console) Do(cmd engine.Cmd) string { +func (console *Console) Do(cmd kit.Cmd) string { switch cmd.Subj { case "mouse": - pos := cmd.ValuesPos(engine.PointZero) + pos := cmd.ValuesPos(kit.PointZero) child, relpos := w.WinFindWindowUnder(console, pos) if child != nil { // Note that we update the value in cmd.Values cmd.ValuesSetPos(relpos) - engine.LogOfType("mouse", "Console Do mouse", "cmd", cmd) + kit.LogOfType("mouse", "Console Do mouse", "cmd", cmd) child.Do(cmd) } @@ -84,7 +84,7 @@ func (console *Console) Do(cmd engine.Cmd) string { case "Three": console.addLine("Three!\n") case "Clear": - console.TextArea.Do(engine.NewSimpleCmd("clear")) + console.TextArea.Do(kit.NewSimpleCmd("clear")) default: lbl := cmd.ValuesString("label", "") console.addLine(fmt.Sprintf("Unknown button: %s\n", lbl)) @@ -93,7 +93,7 @@ func (console *Console) Do(cmd engine.Cmd) string { default: w.WinDoUpstream(console, cmd) } - return engine.OkResult() + return kit.OkResult() } func (console *Console) addLine(s string) { diff --git a/tool/riff.go b/tool/riff.go index 399c69f7..a9b387c5 100644 --- a/tool/riff.go +++ b/tool/riff.go @@ -4,7 +4,7 @@ import ( "fmt" "image" - "github.com/vizicist/palette/engine" + "github.com/vizicist/palette/kit" w "github.com/vizicist/palette/twinsys" ) @@ -41,7 +41,7 @@ func (riff *Riff) Context() *w.WinContext { } // Do xxx -func (riff *Riff) Do(cmd engine.Cmd) string { +func (riff *Riff) Do(cmd kit.Cmd) string { // Things that should be handled the same for all tools? // "mouse" forwarding downstream @@ -60,7 +60,7 @@ func (riff *Riff) Do(cmd engine.Cmd) string { case "close": // do anything? case "getstate": - ret := riff.TextArea.Do(engine.NewSimpleCmd("getstate")) + ret := riff.TextArea.Do(kit.NewSimpleCmd("getstate")) return ret case "buttondown": @@ -68,7 +68,7 @@ func (riff *Riff) Do(cmd engine.Cmd) string { lbl := cmd.ValuesString("label", "") switch lbl { case "Clear": - riff.TextArea.Do(engine.NewSimpleCmd("clear")) + riff.TextArea.Do(kit.NewSimpleCmd("clear")) default: riff.addLine(fmt.Sprintf("Unknown button: %s\n", lbl)) } @@ -79,7 +79,7 @@ func (riff *Riff) Do(cmd engine.Cmd) string { default: w.WinDoUpstream(riff, cmd) } - return engine.OkResult() + return kit.OkResult() } func (riff *Riff) addLine(line string) { diff --git a/twinsys/button.go b/twinsys/button.go index 911aacde..0c687edb 100644 --- a/twinsys/button.go +++ b/twinsys/button.go @@ -3,7 +3,7 @@ package twinsys import ( "image" - "github.com/vizicist/palette/engine" + "github.com/vizicist/palette/kit" ) // Button xxx @@ -36,11 +36,11 @@ func (button *Button) Context() *WinContext { } // Do xxx -func (button *Button) Do(cmd engine.Cmd) string { +func (button *Button) Do(cmd kit.Cmd) string { switch cmd.Subj { case "resize": - sz := cmd.ValuesXY("size", engine.PointZero) + sz := cmd.ValuesXY("size", kit.PointZero) toPoint := image.Point{X: sz.X, Y: sz.Y} minSize := WinMinSize(button) if toPoint.X < minSize.X || toPoint.Y < minSize.Y { @@ -68,9 +68,9 @@ func (button *Button) Do(cmd engine.Cmd) string { case "mouse": currSize := WinGetSize(button) currRect := image.Rect(0, 0, currSize.X, currSize.Y) - pos := cmd.ValuesPos(engine.PointZero) + pos := cmd.ValuesPos(kit.PointZero) if !pos.In(currRect) { - engine.LogWarn("button: pos not in Rect?") + kit.LogWarn("button: pos not in Rect?") break } ddu := cmd.ValuesString("ddu", "") diff --git a/twinsys/menu.go b/twinsys/menu.go index 9ad494f6..61f2c973 100644 --- a/twinsys/menu.go +++ b/twinsys/menu.go @@ -5,7 +5,7 @@ import ( "image/color" "strings" - "github.com/vizicist/palette/engine" + "github.com/vizicist/palette/kit" ) // Menu xxx @@ -33,7 +33,7 @@ type MenuItem struct { Label string posX int posY int - Cmd engine.Cmd + Cmd kit.Cmd } var lastMenuX int @@ -155,12 +155,12 @@ func (menu *Menu) redraw() { } // If mouseHandler return value is true, the menu should be removed -func (menu *Menu) mouseHandler(cmd engine.Cmd) (removeMenu bool) { +func (menu *Menu) mouseHandler(cmd kit.Cmd) (removeMenu bool) { parent := WinParent(menu) menu.itemSelected = -1 - pos := cmd.ValuesPos(engine.PointZero) + pos := cmd.ValuesPos(kit.PointZero) ddu := cmd.ValuesString("ddu", "") // If it's in the handle area... if pos.Y <= menu.handleHeight { @@ -210,15 +210,15 @@ func (menu *Menu) mouseHandler(cmd engine.Cmd) (removeMenu bool) { } // Do xxx -func (menu *Menu) Do(cmd engine.Cmd) string { +func (menu *Menu) Do(cmd kit.Cmd) string { switch cmd.Subj { case "close": - engine.LogWarn("menu.Do: close needs work? Maybe not") + kit.LogWarn("menu.Do: close needs work? Maybe not") case "resize": - size := cmd.ValuesXY("size", engine.PointZero) + size := cmd.ValuesXY("size", kit.PointZero) menu.resize(size) case "redraw": @@ -246,5 +246,5 @@ func (menu *Menu) Do(cmd engine.Cmd) string { // } } } - return engine.OkResult() + return kit.OkResult() } diff --git a/twinsys/menus.go b/twinsys/menus.go index 5de5fd2c..e987ca6a 100644 --- a/twinsys/menus.go +++ b/twinsys/menus.go @@ -1,12 +1,12 @@ package twinsys -import "github.com/vizicist/palette/engine" +import "github.com/vizicist/palette/kit" // NewPageMenu xxx func NewPageMenu(parent Window) WindowData { items := []MenuItem{ - {Label: "About", Cmd: engine.NewSimpleCmd("about")}, + {Label: "About", Cmd: kit.NewSimpleCmd("about")}, {Label: "Dump", Cmd: NewDumpFileCmd("homepage.json")}, {Label: "Restore", Cmd: NewRestoreFileCmd("homepage.json")}, {Label: "Tools ->", Cmd: NewSubMenuCmd("ToolsMenu")}, @@ -28,7 +28,7 @@ func NewToolsMenu(parent Window) WindowData { func NewWindowMenu(parent Window) WindowData { items := []MenuItem{ {Label: "Resize", Cmd: NewPickToolCmd("resize")}, - {Label: "Move", Cmd: engine.NewSimpleCmd("movetool")}, + {Label: "Move", Cmd: kit.NewSimpleCmd("movetool")}, {Label: "Delete", Cmd: NewPickToolCmd("delete")}, {Label: "More ->", Cmd: NewSubMenuCmd("ToolsMenu")}, } diff --git a/twinsys/msgs.go b/twinsys/msgs.go index ee287caf..3f7988ed 100644 --- a/twinsys/msgs.go +++ b/twinsys/msgs.go @@ -6,7 +6,7 @@ import ( "image/color" "strings" - "github.com/vizicist/palette/engine" + "github.com/vizicist/palette/kit" "golang.org/x/image/font" ) @@ -18,17 +18,17 @@ type DrawTextMsg struct { } // NewDrawTextMsg xxx -func NewDrawTextCmd(text string, styleName string, pos image.Point) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"text":"%s","style":"%s","pos":"%d,%d"}`, text, styleName, pos.X, pos.Y)) - return engine.Cmd{Subj: "drawtext", Values: arr} +func NewDrawTextCmd(text string, styleName string, pos image.Point) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"text":"%s","style":"%s","pos":"%d,%d"}`, text, styleName, pos.X, pos.Y)) + return kit.Cmd{Subj: "drawtext", Values: arr} } //////////////////////////////////////////////////////////////////// // NewDrawLineMsg xxx -func NewDrawLineCmd(xy0 image.Point, xy1 image.Point) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"xy0":"%d,%d","xy1":"%d,%d"}`, xy0.X, xy0.Y, xy1.X, xy1.Y)) - return engine.Cmd{Subj: "drawline", Values: arr} +func NewDrawLineCmd(xy0 image.Point, xy1 image.Point) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"xy0":"%d,%d","xy1":"%d,%d"}`, xy0.X, xy0.Y, xy1.X, xy1.Y)) + return kit.Cmd{Subj: "drawline", Values: arr} } ////////////////////////////////////////////////////////////////// @@ -43,87 +43,87 @@ func NewDrawLineCmd(xy0 image.Point, xy1 image.Point) engine.Cmd { ////////////////////////////////////////////////////////////////// // NewCloseTransientsCmd xxx -func NewCloseTransientsCmd(exceptMenuName string) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"exceptmenu":"%s"}`, exceptMenuName)) - return engine.Cmd{Subj: "closetransients", Values: arr} +func NewCloseTransientsCmd(exceptMenuName string) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"exceptmenu":"%s"}`, exceptMenuName)) + return kit.Cmd{Subj: "closetransients", Values: arr} } // NewCloseMe xxx -func NewCloseMeCmd(menu string) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"menu":"%s"}`, menu)) - return engine.Cmd{Subj: "closeme", Values: arr} +func NewCloseMeCmd(menu string) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"menu":"%s"}`, menu)) + return kit.Cmd{Subj: "closeme", Values: arr} } // NewMouseMsg xxx -func NewShowMouseCursorCmd(b bool) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"show":"%v"}`, b)) - return engine.Cmd{Subj: "showmousecursor", Values: arr} +func NewShowMouseCursorCmd(b bool) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"show":"%v"}`, b)) + return kit.Cmd{Subj: "showmousecursor", Values: arr} } // NewMouseMsg xxx -func NewMouseCmd(ddu string, pos image.Point, bnum int) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"ddu":"%s","pos":"%d,%d","button":"%d"}`, ddu, pos.X, pos.Y, bnum)) - return engine.Cmd{Subj: "mouse", Values: arr} +func NewMouseCmd(ddu string, pos image.Point, bnum int) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"ddu":"%s","pos":"%d,%d","button":"%d"}`, ddu, pos.X, pos.Y, bnum)) + return kit.Cmd{Subj: "mouse", Values: arr} } // NewDrawRectMsg xxx -func NewDrawRectCmd(rect image.Rectangle) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"xy0":"%d,%d","xy1":"%d,%d"}`, +func NewDrawRectCmd(rect image.Rectangle) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"xy0":"%d,%d","xy1":"%d,%d"}`, rect.Min.X, rect.Min.Y, rect.Max.X, rect.Max.Y)) - return engine.Cmd{Subj: "drawrect", Values: arr} + return kit.Cmd{Subj: "drawrect", Values: arr} } // NewDrawFilledRectMsg xxx -func NewDrawFilledRectCmd(rect image.Rectangle) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"xy0":"%d,%d","xy1":"%d,%d"}`, rect.Min.X, rect.Min.Y, rect.Max.X, rect.Max.Y)) - return engine.Cmd{Subj: "drawfilledrect", Values: arr} +func NewDrawFilledRectCmd(rect image.Rectangle) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"xy0":"%d,%d","xy1":"%d,%d"}`, rect.Min.X, rect.Min.Y, rect.Max.X, rect.Max.Y)) + return kit.Cmd{Subj: "drawfilledrect", Values: arr} } // NewButtonDownMsg xxx -func NewButtonDownCmd(label string) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"label":"%s"}`, label)) - return engine.Cmd{Subj: "buttondown", Values: arr} +func NewButtonDownCmd(label string) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"label":"%s"}`, label)) + return kit.Cmd{Subj: "buttondown", Values: arr} } // NewButtonUpMsg xxx -func NewButtonUpCmd(label string) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"label":"%s"}`, label)) - return engine.Cmd{Subj: "buttonup", Values: arr} +func NewButtonUpCmd(label string) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"label":"%s"}`, label)) + return kit.Cmd{Subj: "buttonup", Values: arr} } // NewSetColorMsg xxx -func NewSetColorCmd(c color.RGBA) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"r":"%d","g":"%d","b":"%d","a":"%d"}`, c.R, c.G, c.B, c.A)) - return engine.Cmd{Subj: "setcolor", Values: arr} +func NewSetColorCmd(c color.RGBA) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"r":"%d","g":"%d","b":"%d","a":"%d"}`, c.R, c.G, c.B, c.A)) + return kit.Cmd{Subj: "setcolor", Values: arr} } // NewResizeMsg xxx -func NewResizeCmd(size image.Point) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"size":"%d,%d"}`, size.X, size.Y)) - return engine.Cmd{Subj: "resize", Values: arr} +func NewResizeCmd(size image.Point) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"size":"%d,%d"}`, size.X, size.Y)) + return kit.Cmd{Subj: "resize", Values: arr} } // NewResizeMeMsg xxx -func NewResizeMeCmd(size image.Point) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"size":"%d,%d"}`, size.X, size.Y)) - return engine.Cmd{Subj: "resizeme", Values: arr} +func NewResizeMeCmd(size image.Point) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"size":"%d,%d"}`, size.X, size.Y)) + return kit.Cmd{Subj: "resizeme", Values: arr} } // NewAddLineMsg xxx -func NewAddLineCmd(line string) engine.Cmd { +func NewAddLineCmd(line string) kit.Cmd { n := strings.Index(line, "\n") if n >= 0 { line = line[0:n] } - arr, _ := engine.StringMap(fmt.Sprintf(`{"line":"%s"}`, line)) - return engine.Cmd{Subj: "addline", Values: arr} + arr, _ := kit.StringMap(fmt.Sprintf(`{"line":"%s"}`, line)) + return kit.Cmd{Subj: "addline", Values: arr} } // ShowMouseCursorMsg xxx -// func NewShowMouseCursor(show bool) engine.Cmd { -// arr, _ := engine.StringMap(fmt.Sprintf(`{"show":"%v"}`, show)) -// return engine.Cmd{Subj: "showmousecursor", Values: arr} +// func NewShowMouseCursor(show bool) kit.Cmd { +// arr, _ := kit.StringMap(fmt.Sprintf(`{"show":"%v"}`, show)) +// return kit.Cmd{Subj: "showmousecursor", Values: arr} // } // MenuCallbackMsg xxx @@ -133,62 +133,62 @@ type MenuCallbackMsg struct { } // NewPickToolCmd xxx -func NewPickToolCmd(action string) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"action":"%s"}`, action)) - return engine.Cmd{Subj: "picktool", Values: arr} +func NewPickToolCmd(action string) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"action":"%s"}`, action)) + return kit.Cmd{Subj: "picktool", Values: arr} } // NewSweepToolCmd xxx -func NewSweepToolCmd(toolname string) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"toolname":"%s"}`, toolname)) - return engine.Cmd{Subj: "sweeptool", Values: arr} +func NewSweepToolCmd(toolname string) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"toolname":"%s"}`, toolname)) + return kit.Cmd{Subj: "sweeptool", Values: arr} } // NewMoveMenuCmd xxx -func NewMoveMenuCmd(menu string) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"menu":"%s"}`, menu)) - return engine.Cmd{Subj: "movemenu", Values: arr} +func NewMoveMenuCmd(menu string) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"menu":"%s"}`, menu)) + return kit.Cmd{Subj: "movemenu", Values: arr} } // NewMakePermanentCmd xxx -func NewMakePermanentCmd(menuName string) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"menu":"%s"}`, menuName)) - return engine.Cmd{Subj: "movemenu", Values: arr} +func NewMakePermanentCmd(menuName string) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"menu":"%s"}`, menuName)) + return kit.Cmd{Subj: "movemenu", Values: arr} } // NewSubMenuCmd xxx -func NewSubMenuCmd(submenu string) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"submenu":"%s"}`, submenu)) - return engine.Cmd{Subj: "submenu", Values: arr} +func NewSubMenuCmd(submenu string) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"submenu":"%s"}`, submenu)) + return kit.Cmd{Subj: "submenu", Values: arr} } // NewLogMsg xxx -func NewLogCmd(text string) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"text":"%s"}`, text)) - return engine.Cmd{Subj: "log", Values: arr} +func NewLogCmd(text string) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"text":"%s"}`, text)) + return kit.Cmd{Subj: "log", Values: arr} } // NewAboutMsg xxx -func NewAboutCmd() engine.Cmd { - return engine.Cmd{Subj: "about", Values: nil} +func NewAboutCmd() kit.Cmd { + return kit.Cmd{Subj: "about", Values: nil} } // NewDumpfileMsg xxx -func NewDumpFileCmd(filename string) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"filename":"%s"}`, filename)) - return engine.Cmd{Subj: "dumpfile", Values: arr} +func NewDumpFileCmd(filename string) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"filename":"%s"}`, filename)) + return kit.Cmd{Subj: "dumpfile", Values: arr} } // NewRestorefileMsg xxx -func NewRestoreFileCmd(filename string) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"filename":"%s"}`, filename)) - return engine.Cmd{Subj: "restorefile", Values: arr} +func NewRestoreFileCmd(filename string) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"filename":"%s"}`, filename)) + return kit.Cmd{Subj: "restorefile", Values: arr} } // NewRestorefileMsg xxx -func NewRestoreCmd(state string) engine.Cmd { - arr, _ := engine.StringMap(fmt.Sprintf(`{"state":"%s"}`, state)) - return engine.Cmd{Subj: "restore", Values: arr} +func NewRestoreCmd(state string) kit.Cmd { + arr, _ := kit.StringMap(fmt.Sprintf(`{"state":"%s"}`, state)) + return kit.Cmd{Subj: "restore", Values: arr} } // StateDataMsg xxx @@ -220,11 +220,11 @@ func PointString(p image.Point) string { func StringToRect(s string) (r image.Rectangle) { n, err := fmt.Sscanf(s, "%d,%d,%d,%d", &r.Min.X, &r.Min.Y, &r.Max.X, &r.Max.Y) if err != nil { - engine.LogIfError(err) + kit.LogIfError(err) return image.Rectangle{} } if n != 4 { - engine.LogWarn("StringRect: Bad format", "s", s) + kit.LogWarn("StringRect: Bad format", "s", s) return image.Rectangle{} } return r @@ -234,11 +234,11 @@ func StringToRect(s string) (r image.Rectangle) { func StringToPoint(s string) (p image.Point) { n, err := fmt.Sscanf(s, "%d,%d", &p.X, &p.Y) if err != nil { - engine.LogIfError(err) + kit.LogIfError(err) return image.Point{} } if n != 2 { - engine.LogWarn("StringPoint: Bad format", "s", s) + kit.LogWarn("StringPoint: Bad format", "s", s) return image.Point{} } return p diff --git a/twinsys/page.go b/twinsys/page.go index 34524236..c1449f18 100644 --- a/twinsys/page.go +++ b/twinsys/page.go @@ -9,11 +9,11 @@ import ( "runtime" "strings" - "github.com/vizicist/palette/engine" + "github.com/vizicist/palette/kit" ) // MouseHandler xxx -type MouseHandler func(engine.Cmd) +type MouseHandler func(kit.Cmd) // MouseDrawer xxx type MouseDrawer func() @@ -61,13 +61,13 @@ func NewPage(parent Window, name string) WindowData { // Putting things in page.log is a last-resort, // since sometimes there's no Console up - path := engine.LogFilePath("page.log") + path := kit.LogFilePath("page.log") f, err := os.OpenFile(path, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644) if err != nil { fmt.Printf("NewPage: Unable to open %s err=%s", path, err) } page.logFile = f // could be nil - engine.LogInfo("Page logs are being saved in", "path", path) + kit.LogInfo("Page logs are being saved in", "path", path) return NewToolData(page, "Page", image.Point{640, 480}) } @@ -95,7 +95,7 @@ func (w PageLogWriter) Write(p []byte) (n int, err error) { func (page *Page) logToFile(s string) { if page.logFile != nil { _, err := page.logFile.WriteString(s) - engine.LogIfError(err) + kit.LogIfError(err) } } @@ -105,7 +105,7 @@ func (page *Page) Context() *WinContext { } // Do xxx -func (page *Page) Do(cmd engine.Cmd) string { +func (page *Page) Do(cmd kit.Cmd) string { // XXX - should be checking to verify that the from Window // is allowed to do the particular commands invoked. @@ -124,30 +124,30 @@ func (page *Page) Do(cmd engine.Cmd) string { fname := cmd.ValuesString("filename", "") bytes, err := os.ReadFile(fname) if err != nil { - return engine.ErrorResult(err.Error()) + return kit.ErrorResult(err.Error()) } err = page.restoreState(string(bytes)) if err != nil { - return engine.ErrorResult(err.Error()) + return kit.ErrorResult(err.Error()) } case "dumpfile": fname := cmd.ValuesString("filename", "") - retmsg := page.Do(engine.NewSimpleCmd("getstate")) - engine.LogInfo("dumpfile message", "retmsg", retmsg) - m, _ := engine.StringMap(retmsg) + retmsg := page.Do(kit.NewSimpleCmd("getstate")) + kit.LogInfo("dumpfile message", "retmsg", retmsg) + m, _ := kit.StringMap(retmsg) state, ok := m["state"] if !ok { - engine.LogWarn("DumpFileMsg didn't receive valid StateDatamsg") + kit.LogWarn("DumpFileMsg didn't receive valid StateDatamsg") } else { ps := toPrettyJSON(state) - fpath := engine.ConfigFilePath(fname) - engine.LogIfError(os.WriteFile(fpath, []byte(ps), 0644)) + fpath := kit.ConfigFilePath(fname) + kit.LogIfError(os.WriteFile(fpath, []byte(ps), 0644)) } case "getstate": state, err := page.dumpState() - engine.LogIfError(err) + kit.LogIfError(err) if err == nil { return state } @@ -162,7 +162,7 @@ func (page *Page) Do(cmd engine.Cmd) string { } case "mouse": - page.lastPos = cmd.ValuesPos(engine.PointZero) + page.lastPos = cmd.ValuesPos(kit.PointZero) page.mouseHandler(cmd) case "closeme": @@ -186,7 +186,7 @@ func (page *Page) Do(cmd engine.Cmd) string { pos := image.Point{lastMenuX + 4, page.lastPos.Y} _, err := page.AddTool(submenutype, pos, image.Point{}) if err != nil { - engine.LogIfError(err) + kit.LogIfError(err) } case "sweeptool": @@ -222,7 +222,7 @@ func (page *Page) Do(cmd engine.Cmd) string { default: WinDoUpstream(page, cmd) } - return engine.OkResult() + return kit.OkResult() } func (page *Page) restoreState(s string) error { @@ -243,11 +243,11 @@ func (page *Page) restoreState(s string) error { sz := dat["size"].(string) size := StringToPoint(sz) - engine.LogInfo("restore", "name", name, "size", size) + kit.LogInfo("restore", "name", name, "size", size) WinDoUpstream(page, NewResizeMeCmd(size)) - engine.LogWarn("HEY!! restoreState needs work!") + kit.LogWarn("HEY!! restoreState needs work!") children := dat["children"].([]any) for _, ch := range children { @@ -261,7 +261,7 @@ func (page *Page) restoreState(s string) error { // Create the window childW, err := page.AddTool(toolType, pos, size) if err != nil { - engine.LogIfError(err) + kit.LogIfError(err) continue } // restore state @@ -285,7 +285,7 @@ func (page *Page) dumpState() (string, error) { if child == doingMenu { // don't dump the menu used to do a dump continue } - state := child.Do(engine.NewSimpleCmd("getstate")) + state := child.Do(kit.NewSimpleCmd("getstate")) s += fmt.Sprintf("%s{\n", sep) s += fmt.Sprintf("\"wid\": \"%s\",\n", wid) @@ -331,7 +331,7 @@ func (page *Page) AddTool(name string, pos image.Point, size image.Point) (Windo size = td.minSize } WinSetChildSize(child, size) - engine.LogInfo("Page.AddTool", "name", name, "pos", pos, "size", size) + kit.LogInfo("Page.AddTool", "name", name, "pos", pos, "size", size) return child, nil } @@ -375,12 +375,12 @@ func (page *Page) drawPickMouse() { func (page *Page) resize() { size := WinGetSize(page) WinSetSize(page, size) - engine.LogWarn("Page.Resize: should be doing menus (and other things)?") + kit.LogWarn("Page.Resize: should be doing menus (and other things)?") } -func (page *Page) defaultHandler(cmd engine.Cmd) { +func (page *Page) defaultHandler(cmd kit.Cmd) { - pos := cmd.ValuesPos(engine.PointZero) + pos := cmd.ValuesPos(kit.PointZero) ddu := cmd.ValuesString("ddu", "") child, relPos := WinFindWindowUnder(page, pos) @@ -409,7 +409,7 @@ func (page *Page) defaultHandler(cmd engine.Cmd) { } else { w, err := page.AddTool("PageMenu", pos, image.Point{}) if err != nil { - engine.LogIfError(err) + kit.LogIfError(err) } else { page.pageMenu = w } @@ -424,13 +424,13 @@ func (page *Page) sweepRect() image.Rectangle { return r } -func (page *Page) sweepHandler(cmd engine.Cmd) { +func (page *Page) sweepHandler(cmd kit.Cmd) { ddu := cmd.ValuesString("ddu", "") switch ddu { case "down": - pos := cmd.ValuesPos(engine.PointZero) + pos := cmd.ValuesPos(kit.PointZero) page.dragStart = pos page.mouseDrawer = page.drawSweepRect @@ -449,12 +449,12 @@ func (page *Page) sweepHandler(cmd engine.Cmd) { case "resize": wname := page.targetWindowName if wname == "" { - engine.LogWarn("Page.sweepHandler: no targetWindow?") + kit.LogWarn("Page.sweepHandler: no targetWindow?") return } w := WinChildNamed(page, wname) if w == nil { - engine.LogWarn("Page.sweepHandler: no window with", "name", wname) + kit.LogWarn("Page.sweepHandler: no window with", "name", wname) return } // If you don't sweep out anything, look for @@ -464,7 +464,7 @@ func (page *Page) sweepHandler(cmd engine.Cmd) { // If there's a window (other than the one we're resizing) // underneath the point, then don't do anything if under != nil && under != w { - engine.LogWarn("Page.sweepHandler: can't resize above a Window") + kit.LogWarn("Page.sweepHandler: can't resize above a Window") return } foundRect := page.findSpace(r.Min, w) @@ -488,7 +488,7 @@ func (page *Page) sweepHandler(cmd engine.Cmd) { } child, err := page.AddTool(page.sweepToolName, toolPos, toolSize) if err != nil { - engine.LogIfError(err) + kit.LogIfError(err) } else { WinSetChildSize(child, toolSize) } @@ -582,7 +582,7 @@ func (page *Page) startSweep(action string) { } // This Handler waits until MouseUp -func (page *Page) pickHandler(cmd engine.Cmd) { +func (page *Page) pickHandler(cmd kit.Cmd) { ddu := cmd.ValuesString("ddu", "") switch ddu { @@ -604,13 +604,13 @@ func (page *Page) pickHandler(cmd engine.Cmd) { WinRemoveChild(page, child) page.resetHandlers() default: - engine.LogWarn("Unrecognized action", "currentAction", page.currentAction) + kit.LogWarn("Unrecognized action", "currentAction", page.currentAction) } } } // This Handler starts doing things on MouseDown -func (page *Page) moveHandler(cmd engine.Cmd) { +func (page *Page) moveHandler(cmd kit.Cmd) { ddu := cmd.ValuesString("ddu", "") switch ddu { diff --git a/twinsys/screen.go b/twinsys/screen.go index ceb94cae..2763e379 100644 --- a/twinsys/screen.go +++ b/twinsys/screen.go @@ -15,7 +15,7 @@ import ( "github.com/hajimehoshi/ebiten/v2/ebitenutil" "github.com/hajimehoshi/ebiten/v2/inpututil" "github.com/hajimehoshi/ebiten/v2/text" - "github.com/vizicist/palette/engine" + "github.com/vizicist/palette/kit" "golang.org/x/image/font" ) @@ -52,14 +52,14 @@ func Run() { minSize := image.Point{X: 640, Y: 480} // default // change it with config value - winsize, err := engine.GetParam("global.winsize") - engine.LogIfError(err) + winsize, err := kit.GetParam("global.winsize") + kit.LogIfError(err) if winsize != "" { var xsize int var ysize int n, err := fmt.Sscanf(winsize, "%d,%d", &xsize, &ysize) if err != nil || n != 2 { - engine.LogWarn("Run: bad format of winsize", "winsize", winsize) + kit.LogWarn("Run: bad format of winsize", "winsize", winsize) } else { minSize.X = xsize minSize.Y = ysize @@ -92,21 +92,21 @@ func Run() { screen.currentPage = WinAddChild(screen, td) // START DEBUG - do RESTORE - fname := engine.ConfigFilePath("homepage.json") + fname := kit.ConfigFilePath("homepage.json") bytes, err := os.ReadFile(fname) if err != nil { - engine.LogIfError(err) + kit.LogIfError(err) } else { page := td.w.(*Page) err = page.restoreState(string(bytes)) if err != nil { - engine.LogIfError(err) + kit.LogIfError(err) } } // This is it! RunGame runs forever if err := ebiten.RunGame(screen); err != nil { - engine.LogIfError(err) + kit.LogIfError(err) // Should be fatal? } } @@ -117,12 +117,12 @@ func (screen *Screen) Context() *WinContext { } // Do xxx -func (screen *Screen) Do(cmd engine.Cmd) string { +func (screen *Screen) Do(cmd kit.Cmd) string { switch cmd.Subj { case "drawline": - xy0 := cmd.ValuesXY0(engine.PointZero) - xy1 := cmd.ValuesXY1(engine.PointZero) + xy0 := cmd.ValuesXY0(kit.PointZero) + xy1 := cmd.ValuesXY1(kit.PointZero) screen.drawLine(xy0, xy1) case "drawrect": rect := cmd.ValuesRect(image.Rectangle{}) @@ -133,7 +133,7 @@ func (screen *Screen) Do(cmd engine.Cmd) string { case "drawtext": text := cmd.ValuesString("text", "") styleName := cmd.ValuesString("style", "") - pos := cmd.ValuesXY("pos", engine.PointZero) + pos := cmd.ValuesXY("pos", kit.PointZero) screen.drawText(text, styleName, pos) case "setcolor": c := cmd.ValuesColor(RedColor) @@ -146,13 +146,13 @@ func (screen *Screen) Do(cmd engine.Cmd) string { ebiten.SetCursorMode(ebiten.CursorModeHidden) } case "closeme": - engine.LogWarn("screen.runMsgs: should not be getting CloseMeMsg!?") + kit.LogWarn("screen.runMsgs: should not be getting CloseMeMsg!?") case "resizeme": - size := cmd.ValuesSize(engine.PointZero) + size := cmd.ValuesSize(kit.PointZero) ebiten.SetWindowSize(size.X, size.Y) default: - engine.LogWarn("screen.runMsgs: unrecognized", "msg", cmd.Subj) + kit.LogWarn("screen.runMsgs: unrecognized", "msg", cmd.Subj) } return "" } @@ -160,7 +160,7 @@ func (screen *Screen) Do(cmd engine.Cmd) string { // Layout satisfies the ebiten.Game interface func (screen *Screen) Layout(width, height int) (int, int) { if screen == nil { - engine.LogWarn("Screen.Layout: Hey, screen shouldn't be nil!") + kit.LogWarn("Screen.Layout: Hey, screen shouldn't be nil!") return width, height } currSize := WinGetSize(screen) @@ -216,7 +216,7 @@ func (screen *Screen) Update() (err error) { // Draw satisfies the ebiten.Game interface func (screen *Screen) Draw(eimage *ebiten.Image) { screen.eimage = eimage - screen.currentPage.Do(engine.NewSimpleCmd("redraw")) + screen.currentPage.Do(kit.NewSimpleCmd("redraw")) } // drawRect xxx @@ -225,7 +225,7 @@ func (screen *Screen) drawRect(rect image.Rectangle) { y0 := rect.Min.Y x1 := rect.Max.X y1 := rect.Max.Y - engine.LogOfType("drawing", "drawRect", "x0", x0, "y0", y0, "x1", x1, "y1", y1) + kit.LogOfType("drawing", "drawRect", "x0", x0, "y0", y0, "x1", x1, "y1", y1) screen.drawLine(image.Point{x0, y0}, image.Point{x1, y0}) screen.drawLine(image.Point{x1, y0}, image.Point{x1, y1}) screen.drawLine(image.Point{x1, y1}, image.Point{x0, y1}) @@ -234,21 +234,21 @@ func (screen *Screen) drawRect(rect image.Rectangle) { // drawLine xxx func (screen *Screen) drawLine(xy0, xy1 image.Point) { - engine.LogOfType("drawing", "drawLine", "x0", xy0.X, "y0", xy0.Y, "x1", xy1.X, "y1", xy1.Y, "color", screen.foreColor) + kit.LogOfType("drawing", "drawLine", "x0", xy0.X, "y0", xy0.Y, "x1", xy1.X, "y1", xy1.Y, "color", screen.foreColor) ebitenutil.DrawLine(screen.eimage, float64(xy0.X), float64(xy0.Y), float64(xy1.X), float64(xy1.Y), screen.foreColor) } func (screen *Screen) drawText(s string, styleName string, pos image.Point) { styleInfo := Styles[styleName] - engine.LogOfType("drawing", "drawText", "s", s, "x", pos.X, "y", pos.Y) + kit.LogOfType("drawing", "drawText", "s", s, "x", pos.X, "y", pos.Y) text.Draw(screen.eimage, s, styleInfo.fontFace, pos.X, pos.Y, screen.foreColor) } func (screen *Screen) drawFilledRect(rect image.Rectangle) { w := rect.Max.X - rect.Min.X h := rect.Max.Y - rect.Min.Y - engine.LogOfType("drawing", "drawFilledRect", "x0", rect.Min.X) + kit.LogOfType("drawing", "drawFilledRect", "x0", rect.Min.X) ebitenutil.DrawRect(screen.eimage, float64(rect.Min.X), float64(rect.Min.Y), float64(w), float64(h), screen.foreColor) } diff --git a/twinsys/style.go b/twinsys/style.go index 1db2a20f..e1614fe5 100644 --- a/twinsys/style.go +++ b/twinsys/style.go @@ -6,7 +6,7 @@ import ( "os" "github.com/golang/freetype/truetype" - "github.com/vizicist/palette/engine" + "github.com/vizicist/palette/kit" "golang.org/x/image/font" "golang.org/x/image/font/gofont/gomono" @@ -43,7 +43,7 @@ func DefaultStyleName() string { func NewStyle(styleName string, fontHeight int) *StyleInfo { if fontHeight <= 0 { - engine.LogWarn("NewStyle: invalid fontHeight, using 12") + kit.LogWarn("NewStyle: invalid fontHeight, using 12") fontHeight = 12 } @@ -53,7 +53,7 @@ func NewStyle(styleName string, fontHeight int) *StyleInfo { switch styleName { case "fixed": - fontfile := engine.ConfigFilePath("consola.ttf") + fontfile := kit.ConfigFilePath("consola.ttf") b, err := os.ReadFile(fontfile) if err == nil { f, _ = truetype.Parse(b) @@ -62,21 +62,21 @@ func NewStyle(styleName string, fontHeight int) *StyleInfo { case "regular": // This font sucks // f, err = truetype.Parse(goregular.TTF) - fontfile := engine.ConfigFilePath("times.ttf") + fontfile := kit.ConfigFilePath("times.ttf") b, err := os.ReadFile(fontfile) if err == nil { f, _ = truetype.Parse(b) } default: - engine.LogWarn("NewStyle: unrecognized fontname", "fontname", styleName) + kit.LogWarn("NewStyle: unrecognized fontname", "fontname", styleName) } if err != nil { - engine.LogIfError(err) + kit.LogIfError(err) f, _ = truetype.Parse(gomono.TTF) // last resort } else if f == nil { - engine.LogWarn("NewStyle: unable to get font", "font", styleName) + kit.LogWarn("NewStyle: unable to get font", "font", styleName) f, _ = truetype.Parse(gomono.TTF) // last resort } face := truetype.NewFace(f, &truetype.Options{Size: float64(fontHeight)}) @@ -97,7 +97,7 @@ func NewStyle(styleName string, fontHeight int) *StyleInfo { func (style *StyleInfo) TextFitRect(s string) image.Rectangle { width := len(s) * style.CharWidth() height := style.TextHeight() - pos := engine.PointZero + pos := kit.PointZero return image.Rectangle{Min: pos, Max: pos.Add(image.Point{width, height})} } diff --git a/twinsys/text.go b/twinsys/text.go index 9ef4619f..8ed81fe9 100644 --- a/twinsys/text.go +++ b/twinsys/text.go @@ -6,7 +6,7 @@ import ( "image" "strings" - "github.com/vizicist/palette/engine" + "github.com/vizicist/palette/kit" ) // TextCallback xxx @@ -121,12 +121,12 @@ func jsonEscape(i string) string { } // Do xxx -func (st *ScrollingText) Do(cmd engine.Cmd) string { +func (st *ScrollingText) Do(cmd kit.Cmd) string { switch cmd.Subj { case "resize": - size := cmd.ValuesXY("size", engine.PointZero) + size := cmd.ValuesXY("size", kit.PointZero) st.resize(size) case "redraw": @@ -157,9 +157,9 @@ func (st *ScrollingText) Do(cmd engine.Cmd) string { st.AddLine(line) default: - engine.LogWarn("ScrollingText: didn't handle", "subj", cmd.Subj) + kit.LogWarn("ScrollingText: didn't handle", "subj", cmd.Subj) } - return engine.OkResult() + return kit.OkResult() } // AddLine xxx diff --git a/twinsys/window.go b/twinsys/window.go index 53f38caf..4b50d56e 100644 --- a/twinsys/window.go +++ b/twinsys/window.go @@ -4,7 +4,7 @@ import ( "fmt" "image" - "github.com/vizicist/palette/engine" + "github.com/vizicist/palette/kit" ) // Window is the external (and networkable) interface @@ -15,7 +15,7 @@ import ( type Window interface { Context() *WinContext - Do(cmd engine.Cmd) string + Do(cmd kit.Cmd) string } // WinContext doesn't export any of its fields @@ -46,7 +46,7 @@ func newWindowContextNoParent() WinContext { func NewWindowContext(parent Window) WinContext { var style string if parent == nil { - engine.LogWarn("NewWindowContext: unexpected parent == nil?") + kit.LogWarn("NewWindowContext: unexpected parent == nil?") style = parent.Context().styleName } return realNewWindowContext(parent, style) @@ -96,7 +96,7 @@ func WinAddChild(parent Window, td WindowData) Window { child := td.w cc := child.Context() if !cc.initialized { - engine.LogWarn("AddChild: child.Context not initialized!") + kit.LogWarn("AddChild: child.Context not initialized!") return nil } cc.minSize = td.minSize @@ -105,7 +105,7 @@ func WinAddChild(parent Window, td WindowData) Window { pc := parent.Context() if !pc.initialized { - engine.LogWarn("AddChild: parent.Data not initialized!?") + kit.LogWarn("AddChild: parent.Data not initialized!?") return nil } @@ -113,7 +113,7 @@ func WinAddChild(parent Window, td WindowData) Window { wname := fmt.Sprintf("%s.%d", td.toolType, pc.lastChildID) _, ok := pc.childWindow[wname] if ok { - engine.LogWarn("AddChild: there's already a child with", "name", wname) + kit.LogWarn("AddChild: there's already a child with", "name", wname) return nil } @@ -131,7 +131,7 @@ func WinAddChild(parent Window, td WindowData) Window { func WinRemoveChild(parent Window, child Window) { if child == nil { - engine.LogWarn("RemoveChild: child=nil?") + kit.LogWarn("RemoveChild: child=nil?") } pc := parent.Context() childName, ok := pc.childName[child] @@ -160,7 +160,7 @@ func winMoveWindow(parent Window, child Window, delta image.Point) { pc := parent.Context() childPos, ok := pc.childPos[child] if !ok { - engine.LogWarn("WinMoveWindow: w not in parent childPos?") + kit.LogWarn("WinMoveWindow: w not in parent childPos?") return } pc.childPos[child] = childPos.Add(delta) @@ -169,12 +169,12 @@ func winMoveWindow(parent Window, child Window, delta image.Point) { // WinRedrawChildren xxx func WinRedrawChildren(parent Window) { if parent == nil { - engine.LogWarn("RedrawChildren: parent==nil?") + kit.LogWarn("RedrawChildren: parent==nil?") return } pc := parent.Context() for _, w := range pc.order { - w.Do(engine.NewSimpleCmd("redraw")) + w.Do(kit.NewSimpleCmd("redraw")) } } @@ -190,7 +190,7 @@ func WinSetAttValue(w Window, name string, val string) { wc.att[name] = val } -func getAndAdjustXY01(cmd engine.Cmd, adjust image.Point) engine.Cmd { +func getAndAdjustXY01(cmd kit.Cmd, adjust image.Point) kit.Cmd { xy0 := cmd.ValuesXY0(image.Point{}) xy1 := cmd.ValuesXY1(image.Point{}) newxy0 := xy0.Add(adjust) @@ -201,19 +201,19 @@ func getAndAdjustXY01(cmd engine.Cmd, adjust image.Point) engine.Cmd { } // WinDoUpstream xxx -func WinDoUpstream(w Window, cmd engine.Cmd) { +func WinDoUpstream(w Window, cmd kit.Cmd) { subj := cmd.Subj - // engine.Info("DoUpstream","cmd",cmd,"arg",arg) + // kit.Info("DoUpstream","cmd",cmd,"arg",arg) parent := WinParent(w) if parent == nil { - engine.LogWarn("DoUpstream: no parent", "w", w) + kit.LogWarn("DoUpstream: no parent", "w", w) return } // Adjust coordinates to reflect child's position in the parent adjust := WinChildPos(parent, w) - var forwarded engine.Cmd + var forwarded kit.Cmd switch subj { @@ -230,7 +230,7 @@ func WinDoUpstream(w Window, cmd engine.Cmd) { forwarded = cmd case "drawtext": - pos := cmd.ValuesXY("pos", engine.PointZero) + pos := cmd.ValuesXY("pos", kit.PointZero) newpos := pos.Add(adjust) cmd.ValuesSetPos(newpos) forwarded = cmd @@ -310,7 +310,7 @@ func WinSetSize(w Window, size image.Point) { // WinSetChildSize xxx func WinSetChildSize(w Window, size image.Point) { if size.X == 0 || size.Y == 0 { - engine.LogWarn("WinSetChildSize: too small, setting to 100,100") + kit.LogWarn("WinSetChildSize: too small, setting to 100,100") size = image.Point{100, 100} } w.Context().currSz = size @@ -320,7 +320,7 @@ func WinSetChildSize(w Window, size image.Point) { // WinSetChildPos xxx func WinSetChildPos(parent Window, child Window, pos image.Point) { if parent == nil { - engine.LogWarn("WinSeetChildPos: parent is nil?") + kit.LogWarn("WinSeetChildPos: parent is nil?") return } parent.Context().childPos[child] = pos @@ -329,12 +329,12 @@ func WinSetChildPos(parent Window, child Window, pos image.Point) { // WinChildPos xxx func WinChildPos(parent Window, child Window) (p image.Point) { if parent == nil { - engine.LogWarn("WinChildPos: parent is nil?") + kit.LogWarn("WinChildPos: parent is nil?") return } childPos, ok := parent.Context().childPos[child] if !ok { - engine.LogWarn("WinChildPos: w not in parent childPos?") + kit.LogWarn("WinChildPos: w not in parent childPos?") return } return childPos @@ -353,12 +353,12 @@ func WinChildRect(parent, child Window) (r image.Rectangle) { // WinChildName xxx func WinChildName(parent Window, child Window) string { if parent == nil { - engine.LogWarn("WinChildID: parent is nil?") + kit.LogWarn("WinChildID: parent is nil?") return "" } id, ok := parent.Context().childName[child] if !ok { - // engine.Warn("WinChildID: w not in parent childName?") + // kit.Warn("WinChildID: w not in parent childName?") return "" } return id @@ -367,7 +367,7 @@ func WinChildName(parent Window, child Window) string { // WinChildNamed xxx func WinChildNamed(parent Window, name string) Window { if parent == nil { - engine.LogWarn("WinChildNamed: parent is nil?") + kit.LogWarn("WinChildNamed: parent is nil?") return nil } for w, nm := range parent.Context().childName { @@ -375,7 +375,7 @@ func WinChildNamed(parent Window, name string) Window { return w } } - engine.LogWarn("WinChildNamed: no child with name", "name", name) + kit.LogWarn("WinChildNamed: no child with name", "name", name) return nil } @@ -388,7 +388,7 @@ func WinMinSize(w Window) (r image.Point) { func WinParent(w Window) Window { parent := w.Context().parent if parent == nil { - engine.LogWarn("Hey, why is WinParent being called for WorldWindow") + kit.LogWarn("Hey, why is WinParent being called for WorldWindow") } return parent } @@ -406,7 +406,7 @@ func WinStyleName(w Window) string { return ctx.styleName // Window has its own style } if ctx.parent == nil { - engine.LogWarn("WinStye: using DefaultStyle because no parent", "w", w) + kit.LogWarn("WinStye: using DefaultStyle because no parent", "w", w) return DefaultStyleName() } return WinStyleName(ctx.parent) // use the parent's style @@ -421,10 +421,10 @@ func WinRelativePos(parent Window, w Window, pos image.Point) image.Point { // WinForwardMouse is a utility function for Tools that just want // to forward all their mouse events to whatever sub-windows they have. -func WinForwardMouse(w Window, cmd engine.Cmd) { +func WinForwardMouse(w Window, cmd kit.Cmd) { ddu := cmd.ValuesString("ddu", "") bnum := cmd.ValuesInt("buttonnum", 0) - pos := cmd.ValuesPos(engine.PointZero) + pos := cmd.ValuesPos(kit.PointZero) child, relPos := WinFindWindowUnder(w, pos) if child != nil { relcmd := NewMouseCmd(ddu, relPos, bnum)