|
@@ -115,6 +115,7 @@ func about_test_door(d *door.Door) {
|
|
|
door.NoMoreSecrets(about.Output(), d, &better)
|
|
|
}
|
|
|
|
|
|
+// Build door.Menu (Main menu)
|
|
|
func MainMenu() door.Menu {
|
|
|
// Make the main menu
|
|
|
// Width was 45
|
|
@@ -138,7 +139,7 @@ func MainMenu() door.Menu {
|
|
|
// m.AddSelection("C", "Crash")
|
|
|
menu.AddSelection("D", "Display Information")
|
|
|
menu.AddSelection("F", "Font Demo")
|
|
|
- menu.AddSelection("I", "Input Prompt Demo")
|
|
|
+ menu.AddSelection("I", "Input Demo")
|
|
|
menu.AddSelection("M", "Menu Demo")
|
|
|
menu.AddSelection("P", "Progress Bars Demo")
|
|
|
menu.AddSelection("S", "Show Panel")
|
|
@@ -630,6 +631,7 @@ type TrackPanels struct {
|
|
|
BColor string
|
|
|
}
|
|
|
|
|
|
+// Find the Panel that was mouse clicked.
|
|
|
func FindPanel(m door.Mouse, panels []TrackPanels) int {
|
|
|
for idx, p := range panels {
|
|
|
hit, _, _ := p.Panel.Within(int(m.X), int(m.Y))
|
|
@@ -837,17 +839,18 @@ func main() {
|
|
|
door.ColorText("RED ON GREEN"),
|
|
|
[]string{"RED", "GREEN", "SOFTWARE"})
|
|
|
|
|
|
- var spin2 door.SpinRite = door.SpinRiteInit(13, 5,
|
|
|
- door.ColorText("BRI CYA ON BLUE"))
|
|
|
-
|
|
|
+ /*
|
|
|
+ var spin2 door.SpinRite = door.SpinRiteInit(13, 5,
|
|
|
+ door.ColorText("BRI CYA ON BLUE"))
|
|
|
+ */
|
|
|
// Add in the GoRoutine Status panel
|
|
|
|
|
|
- var goPanel door.Panel = door.Panel{X: 0,
|
|
|
- Y: 1,
|
|
|
- Width: 18,
|
|
|
+ var goPanel door.Panel = door.Panel{X: door.Width - 19,
|
|
|
+ Y: 3,
|
|
|
+ Width: 16,
|
|
|
Style: door.DOUBLE,
|
|
|
- Title: "] GoRoutines [",
|
|
|
- BorderColor: door.ColorText("BOLD YEL ON BLU"),
|
|
|
+ Title: "] GoRuntime [",
|
|
|
+ BorderColor: door.ColorText("BOLD YELL"),
|
|
|
}
|
|
|
goLineUpdater := func() string {
|
|
|
status := GoRoutinesStatus()
|
|
@@ -856,12 +859,47 @@ func main() {
|
|
|
}
|
|
|
|
|
|
var goLine door.Line = door.Line{
|
|
|
- UpdateF: goLineUpdater,
|
|
|
- Width: goPanel.Width,
|
|
|
+ UpdateF: goLineUpdater,
|
|
|
+ Width: goPanel.Width,
|
|
|
+ DefaultColor: door.ColorText("CYAN"),
|
|
|
}
|
|
|
// goLine.Update() // Force Update
|
|
|
goPanel.Lines = append(goPanel.Lines, goLine)
|
|
|
- goPanel.Lines = append(goPanel.Lines, door.Line{Width: goPanel.Width})
|
|
|
+
|
|
|
+ // Display Legend on GoRuntime panel
|
|
|
+ const DisplayGoRoutineLegend bool = false
|
|
|
+ // Display Memory
|
|
|
+ const DisplayMemory bool = true
|
|
|
+ var MemoryStats map[string]string
|
|
|
+
|
|
|
+ if DisplayGoRoutineLegend {
|
|
|
+ // Line for legend.
|
|
|
+ goPanel.Lines = append(goPanel.Lines, door.Line{Width: goPanel.Width})
|
|
|
+ }
|
|
|
+
|
|
|
+ if DisplayMemory {
|
|
|
+ memoryUpdater := func() string {
|
|
|
+ MemoryStats = Memory()
|
|
|
+ return fmt.Sprintf("%-8s%8s", "Sys", MemoryStats["Sys"])
|
|
|
+ }
|
|
|
+ goPanel.Lines = append(goPanel.Lines, door.Line{UpdateF: memoryUpdater,
|
|
|
+ Width: goPanel.Width,
|
|
|
+ DefaultColor: door.ColorText("BLU")})
|
|
|
+ heapUpdater := func() string {
|
|
|
+ return fmt.Sprintf("%-8s%8s", "HeapSys", MemoryStats["Heap"])
|
|
|
+ }
|
|
|
+ goPanel.Lines = append(goPanel.Lines, door.Line{UpdateF: heapUpdater,
|
|
|
+ Width: goPanel.Width,
|
|
|
+ DefaultColor: door.ColorText("BLU")})
|
|
|
+
|
|
|
+ stackUpdater := func() string {
|
|
|
+ return fmt.Sprintf("%-8s%8s", "StackSys", MemoryStats["StackSys"])
|
|
|
+ }
|
|
|
+ goPanel.Lines = append(goPanel.Lines, door.Line{UpdateF: stackUpdater,
|
|
|
+ Width: goPanel.Width,
|
|
|
+ DefaultColor: door.ColorText("BLU")})
|
|
|
+ }
|
|
|
+
|
|
|
var lIndex int = 0
|
|
|
var legendCount int = 0
|
|
|
const legendUpdate = 20
|
|
@@ -876,20 +914,23 @@ func main() {
|
|
|
"I=Idle D=Dead",
|
|
|
"W=Wait C=Copystk",
|
|
|
}
|
|
|
- goPanel.Lines[1].Text = legend[0]
|
|
|
-
|
|
|
+ if DisplayGoRoutineLegend {
|
|
|
+ goPanel.Lines[1].Text = legend[0]
|
|
|
+ }
|
|
|
for range ticker.C {
|
|
|
// output = door.SavePos + door.Goto(door.Width-16, 1) + spin.Output() +
|
|
|
// door.Goto(door.Width-15, 3) + spin2.Output() + door.RestorePos
|
|
|
|
|
|
- legendCount++
|
|
|
- if legendCount >= legendUpdate {
|
|
|
- legendCount = 0
|
|
|
- lIndex++
|
|
|
- if lIndex == len(legend) {
|
|
|
- lIndex = 0
|
|
|
+ if DisplayGoRoutineLegend {
|
|
|
+ legendCount++
|
|
|
+ if legendCount >= legendUpdate {
|
|
|
+ legendCount = 0
|
|
|
+ lIndex++
|
|
|
+ if lIndex == len(legend) {
|
|
|
+ lIndex = 0
|
|
|
+ }
|
|
|
+ goPanel.Lines[1].Text = legend[lIndex]
|
|
|
}
|
|
|
- goPanel.Lines[1].Text = legend[lIndex]
|
|
|
}
|
|
|
|
|
|
if goPanel.X == 0 {
|
|
@@ -897,8 +938,12 @@ func main() {
|
|
|
}
|
|
|
|
|
|
goPanel.Update()
|
|
|
- output = door.Goto(door.Width-16, 1) + spin.Output() +
|
|
|
- door.Goto(door.Width-15, 3) + spin2.Output() + goPanel.Output()
|
|
|
+ output = door.Goto(door.Width-16, 1) + spin.Output() + goPanel.Output()
|
|
|
+ /*
|
|
|
+ +
|
|
|
+ door.Goto(door.Width-15, 3) + spin2.Output()
|
|
|
+ */
|
|
|
+
|
|
|
if !d.Disconnect() {
|
|
|
d.Update(output)
|
|
|
} else {
|
|
@@ -909,7 +954,7 @@ func main() {
|
|
|
}()
|
|
|
|
|
|
var wopr door.WOPR
|
|
|
- wopr.Init(d.StartTime, d.TimeOut, "") // TimeUsed(), d.TimeLeft(), "")
|
|
|
+ wopr.Init(d.StartTime, d.TimeOut, "")
|
|
|
wopr.ElapsedPanel.X = door.Width - 19
|
|
|
wopr.ElapsedPanel.Y = door.Height - 15
|
|
|
wopr.RemainingPanel.X = door.Width - 19
|