mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 13:04:25 -04:00
refactor(tracker/gioui): use gioui/x/explorer instead of home made file explorer
This commit is contained in:
parent
8c4f7ee61f
commit
3da62179e4
@ -1,7 +1,6 @@
|
||||
package gioui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"image"
|
||||
|
||||
"gioui.org/app"
|
||||
@ -63,55 +62,16 @@ func (t *Tracker) Layout(gtx layout.Context, w *app.Window) {
|
||||
dstyle.AltStyle.Text = "Float32"
|
||||
dstyle.Layout(gtx)
|
||||
for t.WaveTypeDialog.BtnOk.Clicked() {
|
||||
t.exportWav(t.wavFilePath, true)
|
||||
t.ExportWav(true)
|
||||
t.WaveTypeDialog.Visible = false
|
||||
}
|
||||
for t.WaveTypeDialog.BtnAlt.Clicked() {
|
||||
t.exportWav(t.wavFilePath, false)
|
||||
t.ExportWav(false)
|
||||
t.WaveTypeDialog.Visible = false
|
||||
}
|
||||
for t.WaveTypeDialog.BtnCancel.Clicked() {
|
||||
t.WaveTypeDialog.Visible = false
|
||||
}
|
||||
fstyle := OpenFileDialog(t.Theme, t.OpenSongDialog)
|
||||
fstyle.Title = "Open Song File"
|
||||
fstyle.ExtAlt = ".4kp"
|
||||
fstyle.Layout(gtx)
|
||||
for ok, file := t.OpenSongDialog.FileSelected(); ok; ok, file = t.OpenSongDialog.FileSelected() {
|
||||
t.loadSong(file)
|
||||
}
|
||||
fstyle = SaveFileDialog(t.Theme, t.SaveSongDialog)
|
||||
fstyle.Title = "Save Song As"
|
||||
for ok, file := t.SaveSongDialog.FileSelected(); ok; ok, file = t.SaveSongDialog.FileSelected() {
|
||||
t.saveSong(file)
|
||||
}
|
||||
fstyle.Layout(gtx)
|
||||
exportWavDialogStyle := SaveFileDialog(t.Theme, t.ExportWavDialog)
|
||||
exportWavDialogStyle.Title = "Export Song As Wav"
|
||||
for ok, file := t.ExportWavDialog.FileSelected(); ok; ok, file = t.ExportWavDialog.FileSelected() {
|
||||
t.wavFilePath = file
|
||||
t.WaveTypeDialog.Visible = true
|
||||
}
|
||||
exportWavDialogStyle.ExtMain = ".wav"
|
||||
exportWavDialogStyle.ExtAlt = ""
|
||||
exportWavDialogStyle.Layout(gtx)
|
||||
fstyle = SaveFileDialog(t.Theme, t.SaveInstrumentDialog)
|
||||
fstyle.Title = "Save Instrument As"
|
||||
if t.SaveInstrumentDialog.Visible && t.Instrument().Name != "" {
|
||||
fstyle.Title = fmt.Sprintf("Save Instrument \"%v\" As", t.Instrument().Name)
|
||||
}
|
||||
for ok, file := t.SaveInstrumentDialog.FileSelected(); ok; ok, file = t.SaveInstrumentDialog.FileSelected() {
|
||||
t.saveInstrument(file)
|
||||
t.OpenInstrumentDialog.Directory.SetText(t.SaveInstrumentDialog.Directory.Text())
|
||||
}
|
||||
fstyle.Layout(gtx)
|
||||
fstyle = OpenFileDialog(t.Theme, t.OpenInstrumentDialog)
|
||||
fstyle.Title = "Open Instrument File"
|
||||
fstyle.ExtAlt = ".4ki"
|
||||
for ok, file := t.OpenInstrumentDialog.FileSelected(); ok; ok, file = t.OpenInstrumentDialog.FileSelected() {
|
||||
t.loadInstrument(file)
|
||||
}
|
||||
fstyle.Layout(gtx)
|
||||
if t.ModalDialog != nil {
|
||||
t.ModalDialog(gtx)
|
||||
}
|
||||
|
Reference in New Issue
Block a user