mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-12-21 18:29:45 +00:00
UI to select screen modes
This commit is contained in:
parent
1539102ad9
commit
a9b8fe76df
@ -103,7 +103,11 @@ func (k *keyboard) putKey(keyEvent *fyne.KeyEvent) {
|
||||
k.s.a.SendCommand(izapple2.CommandToggleSpeed)
|
||||
}
|
||||
case fyne.KeyF6:
|
||||
k.s.a.SendCommand(izapple2.CommandToggleColor)
|
||||
if k.s.screenMode != izapple2.ScreenModeGreen {
|
||||
k.s.screenMode = izapple2.ScreenModeGreen
|
||||
} else {
|
||||
k.s.screenMode = izapple2.ScreenModeNTSC
|
||||
}
|
||||
case fyne.KeyF7:
|
||||
k.s.showPages = !k.s.showPages
|
||||
case fyne.KeyF9:
|
||||
@ -114,7 +118,7 @@ func (k *keyboard) putKey(keyEvent *fyne.KeyEvent) {
|
||||
k.s.a.SendCommand(izapple2.CommandToggleCPUTrace)
|
||||
case fyne.KeyF12:
|
||||
//case fyne.KeyPrintScreen:
|
||||
err := izapple2.SaveSnapshot(k.s.a, "snapshot.png")
|
||||
err := izapple2.SaveSnapshot(k.s.a, k.s.screenMode, "snapshot.png")
|
||||
if err != nil {
|
||||
fmt.Printf("Error saving snapshoot: %v.\n.", err)
|
||||
} else {
|
||||
|
@ -14,8 +14,6 @@ import (
|
||||
"fyne.io/fyne/canvas"
|
||||
"fyne.io/fyne/driver/desktop"
|
||||
"fyne.io/fyne/layout"
|
||||
"fyne.io/fyne/theme"
|
||||
"fyne.io/fyne/widget"
|
||||
)
|
||||
|
||||
type state struct {
|
||||
@ -25,7 +23,8 @@ type state struct {
|
||||
|
||||
devices *panelDevices
|
||||
|
||||
showPages bool
|
||||
showPages bool
|
||||
screenMode int
|
||||
}
|
||||
|
||||
func main() {
|
||||
@ -43,12 +42,15 @@ func main() {
|
||||
}
|
||||
|
||||
func fyneRun(s *state) {
|
||||
s.screenMode = izapple2.ScreenModeNTSC
|
||||
|
||||
s.app = app.New()
|
||||
s.app.SetIcon(resourceApple2Png)
|
||||
s.win = s.app.NewWindow("iz-" + s.a.Name)
|
||||
s.win.SetIcon(resourceApple2Png)
|
||||
|
||||
s.devices = newPanelDevices(s)
|
||||
s.devices.w.Hide()
|
||||
toolbar := buildToolbar(s)
|
||||
screen := canvas.NewImageFromImage(nil)
|
||||
screen.ScaleMode = canvas.ImageScalePixels // Looks worst but loads less.
|
||||
@ -82,7 +84,7 @@ func fyneRun(s *state) {
|
||||
img = s.a.SnapshotParts()
|
||||
s.win.SetTitle(fmt.Sprintf("%v %v %vx%v", s.a.Name, s.a.VideoModeName(), img.Rect.Dx()/2, img.Rect.Dy()/2))
|
||||
} else {
|
||||
img = s.a.Snapshot()
|
||||
img = s.a.Snapshot(s.screenMode)
|
||||
}
|
||||
screen.Image = img
|
||||
canvas.Refresh(screen)
|
||||
@ -102,63 +104,6 @@ func fyneRun(s *state) {
|
||||
s.app.Run()
|
||||
}
|
||||
|
||||
func buildToolbar(s *state) *widget.Toolbar {
|
||||
return widget.NewToolbar(
|
||||
widget.NewToolbarAction(
|
||||
theme.NewThemedResource(resourceRestartSvg, nil), func() {
|
||||
s.a.SendCommand(izapple2.CommandReset)
|
||||
}),
|
||||
widget.NewToolbarAction(
|
||||
theme.NewThemedResource(resourcePauseSvg, nil), func() {
|
||||
s.a.SendCommand(izapple2.CommandPauseUnpauseEmulator)
|
||||
}),
|
||||
widget.NewToolbarAction(
|
||||
theme.NewThemedResource(resourceFastForwardSvg, nil), func() {
|
||||
s.a.SendCommand(izapple2.CommandToggleSpeed)
|
||||
}),
|
||||
widget.NewToolbarSeparator(),
|
||||
widget.NewToolbarAction(
|
||||
theme.NewThemedResource(resourcePaletteSvg, nil), func() {
|
||||
s.a.SendCommand(izapple2.CommandToggleColor)
|
||||
}),
|
||||
widget.NewToolbarAction(
|
||||
theme.NewThemedResource(resourceLayersTripleSvg, nil), func() {
|
||||
s.showPages = !s.showPages
|
||||
if !s.showPages {
|
||||
s.win.SetTitle("iz-" + s.a.Name)
|
||||
}
|
||||
}),
|
||||
widget.NewToolbarAction(
|
||||
theme.NewThemedResource(resourceCameraSvg, nil), func() {
|
||||
err := izapple2.SaveSnapshot(s.a, "snapshot.png")
|
||||
if err != nil {
|
||||
s.app.SendNotification(fyne.NewNotification(
|
||||
s.win.Title(),
|
||||
fmt.Sprintf("Error saving snapshoot: %v.\n.", err)))
|
||||
} else {
|
||||
s.app.SendNotification(fyne.NewNotification(
|
||||
s.win.Title(),
|
||||
"Snapshot saved on 'snapshot.png'"))
|
||||
}
|
||||
}),
|
||||
//widget.NewToolbarSeparator(),
|
||||
//newToolbarDisk("S6D1"),
|
||||
widget.NewToolbarSpacer(),
|
||||
widget.NewToolbarAction(theme.ViewFullScreenIcon(), func() {
|
||||
s.win.SetFullScreen(!s.win.FullScreen())
|
||||
}),
|
||||
widget.NewToolbarAction(
|
||||
theme.NewThemedResource(resourcePageLayoutSidebarRightSvg, nil), func() {
|
||||
w := s.devices.w
|
||||
if w.Visible() {
|
||||
w.Hide()
|
||||
} else {
|
||||
w.Show()
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
func registerKeyboardEvents(s *state) {
|
||||
kp := newKeyboard(s)
|
||||
canvas := s.win.Canvas()
|
||||
|
@ -27,6 +27,11 @@ var resourceLayersTripleSvg = &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, 49, 50, 32, 48, 76, 51, 32, 55, 76, 52, 46, 54, 51, 32, 56, 46, 50, 55, 76, 49, 50, 32, 49, 52, 76, 49, 57, 46, 51, 54, 32, 56, 46, 50, 55, 76, 50, 49, 32, 55, 76, 49, 50, 32, 48, 77, 49, 57, 46, 51, 55, 32, 49, 48, 46, 55, 51, 76, 49, 50, 32, 49, 54, 46, 52, 55, 76, 52, 46, 54, 50, 32, 49, 48, 46, 55, 52, 76, 51, 32, 49, 50, 76, 49, 50, 32, 49, 57, 76, 50, 49, 32, 49, 50, 76, 49, 57, 46, 51, 55, 32, 49, 48, 46, 55, 51, 77, 49, 57, 46, 51, 55, 32, 49, 53, 46, 55, 51, 76, 49, 50, 32, 50, 49, 46, 52, 55, 76, 52, 46, 54, 50, 32, 49, 53, 46, 55, 52, 76, 51, 32, 49, 55, 76, 49, 50, 32, 50, 52, 76, 50, 49, 32, 49, 55, 76, 49, 57, 46, 51, 55, 32, 49, 53, 46, 55, 51, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}}
|
||||
|
||||
var resourceMonitorSvg = &fyne.StaticResource{
|
||||
StaticName: "monitor.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, 50, 49, 44, 49, 54, 72, 51, 86, 52, 72, 50, 49, 77, 50, 49, 44, 50, 72, 51, 67, 49, 46, 56, 57, 44, 50, 32, 49, 44, 50, 46, 56, 57, 32, 49, 44, 52, 86, 49, 54, 65, 50, 44, 50, 32, 48, 32, 48, 44, 48, 32, 51, 44, 49, 56, 72, 49, 48, 86, 50, 48, 72, 56, 86, 50, 50, 72, 49, 54, 86, 50, 48, 72, 49, 52, 86, 49, 56, 72, 50, 49, 65, 50, 44, 50, 32, 48, 32, 48, 44, 48, 32, 50, 51, 44, 49, 54, 86, 52, 67, 50, 51, 44, 50, 46, 56, 57, 32, 50, 50, 46, 49, 44, 50, 32, 50, 49, 44, 50, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}}
|
||||
|
||||
var resourcePageLayoutSidebarRightSvg = &fyne.StaticResource{
|
||||
StaticName: "page-layout-sidebar-right.svg",
|
||||
StaticContent: []byte{
|
||||
@ -51,3 +56,13 @@ var resourceRestartSvg = &fyne.StaticResource{
|
||||
StaticName: "restart.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, 49, 50, 44, 52, 67, 49, 52, 46, 49, 44, 52, 32, 49, 54, 46, 49, 44, 52, 46, 56, 32, 49, 55, 46, 54, 44, 54, 46, 51, 67, 50, 48, 46, 55, 44, 57, 46, 52, 32, 50, 48, 46, 55, 44, 49, 52, 46, 53, 32, 49, 55, 46, 54, 44, 49, 55, 46, 54, 67, 49, 53, 46, 56, 44, 49, 57, 46, 53, 32, 49, 51, 46, 51, 44, 50, 48, 46, 50, 32, 49, 48, 46, 57, 44, 49, 57, 46, 57, 76, 49, 49, 46, 52, 44, 49, 55, 46, 57, 67, 49, 51, 46, 49, 44, 49, 56, 46, 49, 32, 49, 52, 46, 57, 44, 49, 55, 46, 53, 32, 49, 54, 46, 50, 44, 49, 54, 46, 50, 67, 49, 56, 46, 53, 44, 49, 51, 46, 57, 32, 49, 56, 46, 53, 44, 49, 48, 46, 49, 32, 49, 54, 46, 50, 44, 55, 46, 55, 67, 49, 53, 46, 49, 44, 54, 46, 54, 32, 49, 51, 46, 53, 44, 54, 32, 49, 50, 44, 54, 86, 49, 48, 46, 54, 76, 55, 44, 53, 46, 54, 76, 49, 50, 44, 48, 46, 54, 86, 52, 77, 54, 46, 51, 44, 49, 55, 46, 54, 67, 51, 46, 55, 44, 49, 53, 32, 51, 46, 51, 44, 49, 49, 32, 53, 46, 49, 44, 55, 46, 57, 76, 54, 46, 54, 44, 57, 46, 52, 67, 53, 46, 53, 44, 49, 49, 46, 54, 32, 53, 46, 57, 44, 49, 52, 46, 52, 32, 55, 46, 56, 44, 49, 54, 46, 50, 67, 56, 46, 51, 44, 49, 54, 46, 55, 32, 56, 46, 57, 44, 49, 55, 46, 49, 32, 57, 46, 54, 44, 49, 55, 46, 52, 76, 57, 44, 49, 57, 46, 52, 67, 56, 44, 49, 57, 32, 55, 46, 49, 44, 49, 56, 46, 52, 32, 54, 46, 51, 44, 49, 55, 46, 54, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}}
|
||||
|
||||
var resourceTelevisionClassicSvg = &fyne.StaticResource{
|
||||
StaticName: "television-classic.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, 56, 46, 49, 54, 44, 51, 76, 54, 46, 55, 53, 44, 52, 46, 52, 49, 76, 57, 46, 51, 52, 44, 55, 72, 52, 67, 50, 46, 56, 57, 44, 55, 32, 50, 44, 55, 46, 56, 57, 32, 50, 44, 57, 86, 49, 57, 67, 50, 44, 50, 48, 46, 49, 49, 32, 50, 46, 56, 57, 44, 50, 49, 32, 52, 44, 50, 49, 72, 50, 48, 67, 50, 49, 46, 49, 49, 44, 50, 49, 32, 50, 50, 44, 50, 48, 46, 49, 49, 32, 50, 50, 44, 49, 57, 86, 57, 67, 50, 50, 44, 55, 46, 56, 57, 32, 50, 49, 46, 49, 49, 44, 55, 32, 50, 48, 44, 55, 72, 49, 52, 46, 54, 54, 76, 49, 55, 46, 50, 53, 44, 52, 46, 52, 49, 76, 49, 53, 46, 56, 52, 44, 51, 76, 49, 50, 44, 54, 46, 56, 52, 76, 56, 46, 49, 54, 44, 51, 77, 52, 44, 57, 72, 49, 55, 86, 49, 57, 72, 52, 86, 57, 77, 49, 57, 46, 53, 44, 57, 65, 49, 44, 49, 32, 48, 32, 48, 44, 49, 32, 50, 48, 46, 53, 44, 49, 48, 65, 49, 44, 49, 32, 48, 32, 48, 44, 49, 32, 49, 57, 46, 53, 44, 49, 49, 65, 49, 44, 49, 32, 48, 32, 48, 44, 49, 32, 49, 56, 46, 53, 44, 49, 48, 65, 49, 44, 49, 32, 48, 32, 48, 44, 49, 32, 49, 57, 46, 53, 44, 57, 77, 49, 57, 46, 53, 44, 49, 50, 65, 49, 44, 49, 32, 48, 32, 48, 44, 49, 32, 50, 48, 46, 53, 44, 49, 51, 65, 49, 44, 49, 32, 48, 32, 48, 44, 49, 32, 49, 57, 46, 53, 44, 49, 52, 65, 49, 44, 49, 32, 48, 32, 48, 44, 49, 32, 49, 56, 46, 53, 44, 49, 51, 65, 49, 44, 49, 32, 48, 32, 48, 44, 49, 32, 49, 57, 46, 53, 44, 49, 50, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}}
|
||||
|
||||
var resourceTelevisionSvg = &fyne.StaticResource{
|
||||
StaticName: "television.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, 50, 49, 44, 49, 55, 72, 51, 86, 53, 72, 50, 49, 77, 50, 49, 44, 51, 72, 51, 65, 50, 44, 50, 32, 48, 32, 48, 44, 48, 32, 49, 44, 53, 86, 49, 55, 65, 50, 44, 50, 32, 48, 32, 48, 44, 48, 32, 51, 44, 49, 57, 72, 56, 86, 50, 49, 72, 49, 54, 86, 49, 57, 72, 50, 49, 65, 50, 44, 50, 32, 48, 32, 48, 44, 48, 32, 50, 51, 44, 49, 55, 86, 53, 65, 50, 44, 50, 32, 48, 32, 48, 44, 48, 32, 50, 49, 44, 51, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}}
|
||||
|
1
izapple2fyne/resources/monitor.svg
Normal file
1
izapple2fyne/resources/monitor.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="M21,16H3V4H21M21,2H3C1.89,2 1,2.89 1,4V16A2,2 0 0,0 3,18H10V20H8V22H16V20H14V18H21A2,2 0 0,0 23,16V4C23,2.89 22.1,2 21,2Z" /></svg>
|
After Width: | Height: | Size: 416 B |
1
izapple2fyne/resources/television-classic.svg
Normal file
1
izapple2fyne/resources/television-classic.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="M8.16,3L6.75,4.41L9.34,7H4C2.89,7 2,7.89 2,9V19C2,20.11 2.89,21 4,21H20C21.11,21 22,20.11 22,19V9C22,7.89 21.11,7 20,7H14.66L17.25,4.41L15.84,3L12,6.84L8.16,3M4,9H17V19H4V9M19.5,9A1,1 0 0,1 20.5,10A1,1 0 0,1 19.5,11A1,1 0 0,1 18.5,10A1,1 0 0,1 19.5,9M19.5,12A1,1 0 0,1 20.5,13A1,1 0 0,1 19.5,14A1,1 0 0,1 18.5,13A1,1 0 0,1 19.5,12Z" /></svg>
|
After Width: | Height: | Size: 626 B |
1
izapple2fyne/resources/television.svg
Normal file
1
izapple2fyne/resources/television.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="M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z" /></svg>
|
After Width: | Height: | Size: 395 B |
68
izapple2fyne/toolbar.go
Normal file
68
izapple2fyne/toolbar.go
Normal file
@ -0,0 +1,68 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ivanizag/izapple2"
|
||||
|
||||
"fyne.io/fyne"
|
||||
"fyne.io/fyne/theme"
|
||||
"fyne.io/fyne/widget"
|
||||
)
|
||||
|
||||
func buildCommandToolbar(s *state, icon fyne.Resource, command int) widget.ToolbarItem {
|
||||
return widget.NewToolbarAction(
|
||||
theme.NewThemedResource(icon, nil), func() {
|
||||
s.a.SendCommand(command)
|
||||
})
|
||||
}
|
||||
|
||||
func buildToolbar(s *state) *widget.Toolbar {
|
||||
tb := widget.NewToolbar()
|
||||
tb.Append(buildCommandToolbar(s, resourceRestartSvg, izapple2.CommandReset))
|
||||
tb.Append(buildCommandToolbar(s, resourcePauseSvg, izapple2.CommandPauseUnpauseEmulator))
|
||||
tb.Append(buildCommandToolbar(s, resourceFastForwardSvg, izapple2.CommandToggleSpeed))
|
||||
tb.Append(widget.NewToolbarSeparator())
|
||||
tb.Append(newToolbarScreen(s))
|
||||
tb.Append(widget.NewToolbarSeparator())
|
||||
tb.Append(widget.NewToolbarAction(
|
||||
theme.NewThemedResource(resourceLayersTripleSvg, nil), func() {
|
||||
s.showPages = !s.showPages
|
||||
if !s.showPages {
|
||||
s.win.SetTitle("iz-" + s.a.Name)
|
||||
}
|
||||
}))
|
||||
tb.Append(widget.NewToolbarAction(
|
||||
theme.NewThemedResource(resourceCameraSvg, nil), func() {
|
||||
err := izapple2.SaveSnapshot(s.a, s.screenMode, "snapshot.png")
|
||||
if err != nil {
|
||||
s.app.SendNotification(fyne.NewNotification(
|
||||
s.win.Title(),
|
||||
fmt.Sprintf("Error saving snapshoot: %v.\n.", err)))
|
||||
} else {
|
||||
s.app.SendNotification(fyne.NewNotification(
|
||||
s.win.Title(),
|
||||
"Snapshot saved on 'snapshot.png'"))
|
||||
}
|
||||
}))
|
||||
//tb.Append(widget.NewToolbarSeparator())
|
||||
//tb.Append(newToolbarDisk("S6D1")
|
||||
tb.Append(widget.NewToolbarSpacer())
|
||||
tb.Append(widget.NewToolbarAction(
|
||||
theme.ViewFullScreenIcon(),
|
||||
func() {
|
||||
s.win.SetFullScreen(!s.win.FullScreen())
|
||||
}))
|
||||
tb.Append(widget.NewToolbarAction(
|
||||
theme.NewThemedResource(resourcePageLayoutSidebarRightSvg, nil),
|
||||
func() {
|
||||
w := s.devices.w
|
||||
if w.Visible() {
|
||||
w.Hide()
|
||||
} else {
|
||||
w.Show()
|
||||
}
|
||||
}))
|
||||
|
||||
return tb
|
||||
}
|
92
izapple2fyne/toolbarScreen.go
Normal file
92
izapple2fyne/toolbarScreen.go
Normal file
@ -0,0 +1,92 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fyne.io/fyne"
|
||||
"fyne.io/fyne/theme"
|
||||
"fyne.io/fyne/widget"
|
||||
"github.com/ivanizag/izapple2"
|
||||
)
|
||||
|
||||
type toolbarScreen struct {
|
||||
s *state
|
||||
w fyne.CanvasObject
|
||||
ntsc *widget.Button
|
||||
ntscDisabled *widget.Icon
|
||||
plain *widget.Button
|
||||
plainDisabled *widget.Icon
|
||||
green *widget.Button
|
||||
greenDisabled *widget.Icon
|
||||
}
|
||||
|
||||
func newToolbarScreen(s *state) *toolbarScreen {
|
||||
var tbs toolbarScreen
|
||||
tbs.s = s
|
||||
|
||||
tbs.ntsc = widget.NewButtonWithIcon("",
|
||||
theme.NewThemedResource(resourceTelevisionClassicSvg, nil),
|
||||
func() {
|
||||
tbs.setScreenMode(izapple2.ScreenModeNTSC)
|
||||
})
|
||||
tbs.ntscDisabled = widget.NewIcon(
|
||||
theme.NewDisabledResource(resourceTelevisionClassicSvg))
|
||||
|
||||
tbs.plain = widget.NewButtonWithIcon("",
|
||||
theme.NewThemedResource(resourceTelevisionSvg, nil),
|
||||
func() {
|
||||
tbs.setScreenMode(izapple2.ScreenModePlain)
|
||||
})
|
||||
tbs.plainDisabled = widget.NewIcon(
|
||||
theme.NewDisabledResource(resourceTelevisionSvg))
|
||||
|
||||
tbs.green = widget.NewButtonWithIcon("",
|
||||
theme.NewThemedResource(resourceMonitorSvg, nil),
|
||||
func() {
|
||||
tbs.setScreenMode(izapple2.ScreenModeGreen)
|
||||
})
|
||||
tbs.greenDisabled = widget.NewIcon(
|
||||
theme.NewDisabledResource(resourceMonitorSvg))
|
||||
|
||||
tbs.w = widget.NewHBox(
|
||||
tbs.ntsc, tbs.ntscDisabled,
|
||||
tbs.plain, tbs.plainDisabled,
|
||||
tbs.green, tbs.greenDisabled)
|
||||
|
||||
tbs.ntscDisabled.Hide()
|
||||
tbs.plainDisabled.Hide()
|
||||
tbs.greenDisabled.Hide()
|
||||
tbs.setScreenMode(s.screenMode)
|
||||
|
||||
return &tbs
|
||||
}
|
||||
|
||||
func (tbs *toolbarScreen) setScreenMode(screenMode int) {
|
||||
switch tbs.s.screenMode {
|
||||
case izapple2.ScreenModeNTSC:
|
||||
tbs.ntsc.Show()
|
||||
tbs.ntscDisabled.Hide()
|
||||
case izapple2.ScreenModePlain:
|
||||
tbs.plain.Show()
|
||||
tbs.plainDisabled.Hide()
|
||||
case izapple2.ScreenModeGreen:
|
||||
tbs.green.Show()
|
||||
tbs.greenDisabled.Hide()
|
||||
}
|
||||
|
||||
tbs.s.screenMode = screenMode
|
||||
|
||||
switch screenMode {
|
||||
case izapple2.ScreenModeNTSC:
|
||||
tbs.ntsc.Hide()
|
||||
tbs.ntscDisabled.Show()
|
||||
case izapple2.ScreenModePlain:
|
||||
tbs.plain.Hide()
|
||||
tbs.plainDisabled.Show()
|
||||
case izapple2.ScreenModeGreen:
|
||||
tbs.green.Hide()
|
||||
tbs.greenDisabled.Show()
|
||||
}
|
||||
}
|
||||
|
||||
func (tbs *toolbarScreen) ToolbarObject() fyne.CanvasObject {
|
||||
return tbs.w
|
||||
}
|
Loading…
Reference in New Issue
Block a user