mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
feat(gioui): implement own file save / load dialogs
Removes the dependency on sqweek/dialogs, which was always very buggy. Closes #12
This commit is contained in:
@ -73,12 +73,18 @@ type Tracker struct {
|
||||
ConfirmInstrDelete *Dialog
|
||||
ConfirmSongDialog *Dialog
|
||||
WaveTypeDialog *Dialog
|
||||
OpenSongDialog *FileDialog
|
||||
SaveSongDialog *FileDialog
|
||||
OpenInstrumentDialog *FileDialog
|
||||
SaveInstrumentDialog *FileDialog
|
||||
ExportWavDialog *FileDialog
|
||||
ConfirmSongActionType int
|
||||
window *app.Window
|
||||
|
||||
lastVolume tracker.Volume
|
||||
volumeChan chan tracker.Volume
|
||||
|
||||
wavFilePath string
|
||||
player *tracker.Player
|
||||
refresh chan struct{}
|
||||
playerCloser chan struct{}
|
||||
@ -172,9 +178,15 @@ func New(audioContext sointu.AudioContext, synthService sointu.SynthService, syn
|
||||
ConfirmInstrDelete: new(Dialog),
|
||||
ConfirmSongDialog: new(Dialog),
|
||||
WaveTypeDialog: new(Dialog),
|
||||
errorChannel: make(chan error, 32),
|
||||
window: window,
|
||||
synthService: synthService,
|
||||
OpenSongDialog: NewFileDialog(),
|
||||
SaveSongDialog: NewFileDialog(),
|
||||
OpenInstrumentDialog: NewFileDialog(),
|
||||
SaveInstrumentDialog: NewFileDialog(),
|
||||
|
||||
ExportWavDialog: NewFileDialog(),
|
||||
errorChannel: make(chan error, 32),
|
||||
window: window,
|
||||
synthService: synthService,
|
||||
}
|
||||
t.Model = tracker.NewModel()
|
||||
vuBufferObserver := make(chan []float32)
|
||||
@ -203,3 +215,13 @@ func New(audioContext sointu.AudioContext, synthService sointu.SynthService, syn
|
||||
t.ResetSong()
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *Tracker) Quit(forced bool) bool {
|
||||
if !forced && t.ChangedSinceSave() {
|
||||
t.ConfirmSongActionType = ConfirmQuit
|
||||
t.ConfirmSongDialog.Visible = true
|
||||
return false
|
||||
}
|
||||
t.quitted = true
|
||||
return true
|
||||
}
|
||||
|
Reference in New Issue
Block a user