diff --git a/apple2.go b/apple2.go index 1293af5..309be83 100644 --- a/apple2.go +++ b/apple2.go @@ -138,7 +138,8 @@ func (a *Apple2) IsProfiling() bool { return a.profile } -func (a *Apple2) setForceCaps(value bool) { +// SetForceCaps allows the caps state to be toggled at runtime +func (a *Apple2) SetForceCaps(value bool) { a.forceCaps = value } diff --git a/apple2main.go b/apple2main.go index fad8891..ba1d488 100644 --- a/apple2main.go +++ b/apple2main.go @@ -148,7 +148,7 @@ func MainApple() *Apple2 { a.io.setTraceRegistrations(*traceSSReg) a.io.setPanicNotImplemented(*panicSS) a.setProfiling(*profile) - a.setForceCaps(*forceCaps) + a.SetForceCaps(*forceCaps) var charGenMap charColumnMap initialCharGenPage := 0 diff --git a/frontend/a2fyne/main.go b/frontend/a2fyne/main.go index 507d1b0..cab30eb 100644 --- a/frontend/a2fyne/main.go +++ b/frontend/a2fyne/main.go @@ -3,6 +3,7 @@ package main import ( "fmt" "image" + "strings" "time" "github.com/ivanizag/izapple2" @@ -28,6 +29,14 @@ type state struct { screenMode int } +func (s *state) DefaultTitle() string { + title := "iz-" + s.a.Name + if s.a.IsForceCaps() { + title = strings.ToUpper(title) + } + return title +} + func main() { var s state s.a = izapple2.MainApple() @@ -47,7 +56,7 @@ func fyneRun(s *state) { s.app = app.New() s.app.SetIcon(resourceApple2Png) - s.win = s.app.NewWindow("iz-" + s.a.Name) + s.win = s.app.NewWindow(s.DefaultTitle()) s.win.SetIcon(resourceApple2Png) s.devices = newPanelDevices(s) diff --git a/frontend/a2fyne/resources.go b/frontend/a2fyne/resources.go index b17f58d..3beda25 100644 --- a/frontend/a2fyne/resources.go +++ b/frontend/a2fyne/resources.go @@ -1,3 +1,5 @@ +// auto-generated + package main import "fyne.io/fyne" @@ -12,6 +14,11 @@ var resourceCameraSvg = &fyne.StaticResource{ StaticContent: []byte{ 60, 63, 120, 109, 108, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 48, 34, 32, 101, 110, 99, 111, 100, 105, 110, 103, 61, 34, 85, 84, 70, 45, 56, 34, 63, 62, 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 115, 118, 103, 32, 80, 85, 66, 76, 73, 67, 32, 34, 45, 47, 47, 87, 51, 67, 47, 47, 68, 84, 68, 32, 83, 86, 71, 32, 49, 46, 49, 47, 47, 69, 78, 34, 32, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 71, 114, 97, 112, 104, 105, 99, 115, 47, 83, 86, 71, 47, 49, 46, 49, 47, 68, 84, 68, 47, 115, 118, 103, 49, 49, 46, 100, 116, 100, 34, 62, 60, 115, 118, 103, 32, 120, 109, 108, 110, 115, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 50, 48, 48, 48, 47, 115, 118, 103, 34, 32, 120, 109, 108, 110, 115, 58, 120, 108, 105, 110, 107, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 49, 57, 57, 57, 47, 120, 108, 105, 110, 107, 34, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 49, 34, 32, 119, 105, 100, 116, 104, 61, 34, 50, 52, 34, 32, 104, 101, 105, 103, 104, 116, 61, 34, 50, 52, 34, 32, 118, 105, 101, 119, 66, 111, 120, 61, 34, 48, 32, 48, 32, 50, 52, 32, 50, 52, 34, 62, 60, 112, 97, 116, 104, 32, 100, 61, 34, 77, 52, 44, 52, 72, 55, 76, 57, 44, 50, 72, 49, 53, 76, 49, 55, 44, 52, 72, 50, 48, 65, 50, 44, 50, 32, 48, 32, 48, 44, 49, 32, 50, 50, 44, 54, 86, 49, 56, 65, 50, 44, 50, 32, 48, 32, 48, 44, 49, 32, 50, 48, 44, 50, 48, 72, 52, 65, 50, 44, 50, 32, 48, 32, 48, 44, 49, 32, 50, 44, 49, 56, 86, 54, 65, 50, 44, 50, 32, 48, 32, 48, 44, 49, 32, 52, 44, 52, 77, 49, 50, 44, 55, 65, 53, 44, 53, 32, 48, 32, 48, 44, 48, 32, 55, 44, 49, 50, 65, 53, 44, 53, 32, 48, 32, 48, 44, 48, 32, 49, 50, 44, 49, 55, 65, 53, 44, 53, 32, 48, 32, 48, 44, 48, 32, 49, 55, 44, 49, 50, 65, 53, 44, 53, 32, 48, 32, 48, 44, 48, 32, 49, 50, 44, 55, 77, 49, 50, 44, 57, 65, 51, 44, 51, 32, 48, 32, 48, 44, 49, 32, 49, 53, 44, 49, 50, 65, 51, 44, 51, 32, 48, 32, 48, 44, 49, 32, 49, 50, 44, 49, 53, 65, 51, 44, 51, 32, 48, 32, 48, 44, 49, 32, 57, 44, 49, 50, 65, 51, 44, 51, 32, 48, 32, 48, 44, 49, 32, 49, 50, 44, 57, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}} +var resourceCapsLockSvg = &fyne.StaticResource{ + StaticName: "caps-lock.svg", + StaticContent: []byte{ + 60, 63, 120, 109, 108, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 48, 34, 32, 101, 110, 99, 111, 100, 105, 110, 103, 61, 34, 85, 84, 70, 45, 56, 34, 63, 62, 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 115, 118, 103, 32, 80, 85, 66, 76, 73, 67, 32, 34, 45, 47, 47, 87, 51, 67, 47, 47, 68, 84, 68, 32, 83, 86, 71, 32, 49, 46, 49, 47, 47, 69, 78, 34, 32, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 71, 114, 97, 112, 104, 105, 99, 115, 47, 83, 86, 71, 47, 49, 46, 49, 47, 68, 84, 68, 47, 115, 118, 103, 49, 49, 46, 100, 116, 100, 34, 62, 60, 115, 118, 103, 32, 120, 109, 108, 110, 115, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 50, 48, 48, 48, 47, 115, 118, 103, 34, 32, 120, 109, 108, 110, 115, 58, 120, 108, 105, 110, 107, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 49, 57, 57, 57, 47, 120, 108, 105, 110, 107, 34, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 49, 34, 32, 119, 105, 100, 116, 104, 61, 34, 50, 52, 34, 32, 104, 101, 105, 103, 104, 116, 61, 34, 50, 52, 34, 32, 118, 105, 101, 119, 66, 111, 120, 61, 34, 48, 32, 48, 32, 50, 52, 32, 50, 52, 34, 62, 60, 112, 97, 116, 104, 32, 100, 61, 34, 77, 57, 46, 57, 54, 44, 49, 51, 46, 55, 49, 76, 49, 50, 44, 56, 46, 50, 57, 76, 49, 52, 46, 48, 51, 44, 49, 51, 46, 55, 50, 77, 49, 49, 46, 49, 52, 44, 54, 76, 54, 46, 52, 51, 44, 49, 56, 72, 56, 46, 51, 54, 76, 57, 46, 51, 50, 44, 49, 53, 46, 52, 51, 72, 49, 52, 46, 54, 56, 76, 49, 53, 46, 54, 52, 44, 49, 56, 72, 49, 55, 46, 53, 55, 76, 49, 50, 46, 56, 54, 44, 54, 72, 49, 49, 46, 49, 52, 77, 50, 48, 44, 50, 72, 52, 67, 50, 46, 56, 57, 44, 50, 32, 50, 44, 50, 46, 56, 57, 32, 50, 44, 52, 86, 50, 48, 67, 50, 44, 50, 49, 46, 49, 49, 32, 50, 46, 57, 44, 50, 50, 32, 52, 44, 50, 50, 72, 50, 48, 67, 50, 49, 46, 49, 49, 44, 50, 50, 32, 50, 50, 44, 50, 49, 46, 49, 49, 32, 50, 50, 44, 50, 48, 86, 52, 67, 50, 50, 44, 50, 46, 56, 57, 32, 50, 49, 46, 49, 44, 50, 32, 50, 48, 44, 50, 77, 50, 48, 44, 50, 48, 72, 52, 86, 52, 72, 50, 48, 86, 50, 48, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}} + var resourceFastForwardSvg = &fyne.StaticResource{ StaticName: "fast-forward.svg", StaticContent: []byte{ diff --git a/frontend/a2fyne/resources/caps-lock.svg b/frontend/a2fyne/resources/caps-lock.svg new file mode 100644 index 0000000..a0bf29d --- /dev/null +++ b/frontend/a2fyne/resources/caps-lock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/a2fyne/toolbar.go b/frontend/a2fyne/toolbar.go index 6566db1..8cf54b9 100644 --- a/frontend/a2fyne/toolbar.go +++ b/frontend/a2fyne/toolbar.go @@ -30,7 +30,7 @@ func buildToolbar(s *state) *widget.Toolbar { theme.NewThemedResource(resourceLayersTripleSvg, nil), func() { s.showPages = !s.showPages if !s.showPages { - s.win.SetTitle("iz-" + s.a.Name) + s.win.SetTitle(s.DefaultTitle()) } })) tb.Append(widget.NewToolbarAction( @@ -46,6 +46,12 @@ func buildToolbar(s *state) *widget.Toolbar { "Snapshot saved on 'snapshot.png'")) } })) + tb.Append(widget.NewToolbarSeparator()) + tb.Append(widget.NewToolbarAction( + theme.NewThemedResource(resourceCapsLockSvg, nil), func() { + s.a.SetForceCaps(!s.a.IsForceCaps()) + s.win.SetTitle(s.DefaultTitle()) + })) //tb.Append(widget.NewToolbarSeparator()) //tb.Append(newToolbarDisk("S6D1") tb.Append(widget.NewToolbarSpacer())