mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-12-26 20:29:50 +00:00
Adding UI elements into the Fyne UI.
This commit is contained in:
parent
541d8be170
commit
f31773b51c
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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{
|
||||
|
1
frontend/a2fyne/resources/caps-lock.svg
Normal file
1
frontend/a2fyne/resources/caps-lock.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M9.96,13.71L12,8.29L14.03,13.72M11.14,6L6.43,18H8.36L9.32,15.43H14.68L15.64,18H17.57L12.86,6H11.14M20,2H4C2.89,2 2,2.89 2,4V20C2,21.11 2.9,22 4,22H20C21.11,22 22,21.11 22,20V4C22,2.89 21.1,2 20,2M20,20H4V4H20V20Z" /></svg>
|
After Width: | Height: | Size: 507 B |
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user