mirror of
https://github.com/vsariola/sointu.git
synced 2025-06-04 01:28:45 -04:00
feat(tracker): add F1-F8 shortcut keys for changing editmode / playing
Related to #14
This commit is contained in:
parent
25a4bfd5ac
commit
c781c24ae6
@ -121,6 +121,47 @@ func (t *Tracker) KeyEvent(w *app.Window, e key.Event) bool {
|
|||||||
t.LoadSongFile()
|
t.LoadSongFile()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
case "F1":
|
||||||
|
t.EditMode = EditPatterns
|
||||||
|
return true
|
||||||
|
case "F2":
|
||||||
|
t.EditMode = EditTracks
|
||||||
|
return true
|
||||||
|
case "F3":
|
||||||
|
t.EditMode = EditUnits
|
||||||
|
return true
|
||||||
|
case "F4":
|
||||||
|
t.EditMode = EditParameters
|
||||||
|
return true
|
||||||
|
case "F5":
|
||||||
|
t.NoteTracking = true
|
||||||
|
t.PlayPosition.Pattern = t.Cursor.Pattern
|
||||||
|
if t.EditMode == EditPatterns {
|
||||||
|
t.PlayPosition.Row = 0
|
||||||
|
} else {
|
||||||
|
t.PlayPosition.Row = t.Cursor.Row
|
||||||
|
}
|
||||||
|
t.PlayPosition.Row-- // TODO: we advance soon to make up for this -1, but this is not very elegant way to do it
|
||||||
|
t.SetPlaying(true)
|
||||||
|
return true
|
||||||
|
case "F6":
|
||||||
|
t.NoteTracking = false
|
||||||
|
t.PlayPosition.Pattern = t.Cursor.Pattern
|
||||||
|
if t.EditMode == EditPatterns {
|
||||||
|
t.PlayPosition.Row = 0
|
||||||
|
} else {
|
||||||
|
t.PlayPosition.Row = t.Cursor.Row
|
||||||
|
}
|
||||||
|
t.PlayPosition.Row-- // TODO: we advance soon to make up for this -1, but this is not very elegant way to do it
|
||||||
|
t.SetPlaying(true)
|
||||||
|
return true
|
||||||
|
case "F7":
|
||||||
|
t.NoteTracking = false
|
||||||
|
t.SetPlaying(true)
|
||||||
|
return true
|
||||||
|
case "F8":
|
||||||
|
t.SetPlaying(false)
|
||||||
|
return true
|
||||||
case key.NameDeleteForward:
|
case key.NameDeleteForward:
|
||||||
switch t.EditMode {
|
switch t.EditMode {
|
||||||
case EditTracks:
|
case EditTracks:
|
||||||
@ -131,7 +172,19 @@ func (t *Tracker) KeyEvent(w *app.Window, e key.Event) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
case "Space":
|
case "Space":
|
||||||
t.TogglePlay()
|
t.SetPlaying(!t.Playing)
|
||||||
|
if t.Playing {
|
||||||
|
if !e.Modifiers.Contain(key.ModShortcut) {
|
||||||
|
t.NoteTracking = true
|
||||||
|
}
|
||||||
|
t.PlayPosition.Pattern = t.Cursor.Pattern
|
||||||
|
if t.EditMode == EditPatterns {
|
||||||
|
t.PlayPosition.Row = 0
|
||||||
|
} else {
|
||||||
|
t.PlayPosition.Row = t.Cursor.Row
|
||||||
|
}
|
||||||
|
t.PlayPosition.Row--
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
case `\`:
|
case `\`:
|
||||||
if e.Modifiers.Contain(key.ModShift) {
|
if e.Modifiers.Contain(key.ModShift) {
|
||||||
|
@ -144,15 +144,10 @@ func (t *Tracker) Close() {
|
|||||||
t.closer <- struct{}{}
|
t.closer <- struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Tracker) TogglePlay() {
|
func (t *Tracker) SetPlaying(value bool) {
|
||||||
t.songPlayMutex.Lock()
|
t.songPlayMutex.Lock()
|
||||||
defer t.songPlayMutex.Unlock()
|
defer t.songPlayMutex.Unlock()
|
||||||
t.Playing = !t.Playing
|
t.Playing = value
|
||||||
if t.Playing {
|
|
||||||
t.NoteTracking = true
|
|
||||||
t.PlayPosition = t.Cursor.SongRow
|
|
||||||
t.PlayPosition.Row-- // TODO: we advance soon to make up for this -1, but this is not very elegant way to do it
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Tracker) ChangeOctave(delta int) bool {
|
func (t *Tracker) ChangeOctave(delta int) bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user