mirror of
https://github.com/vsariola/sointu.git
synced 2025-11-12 12:52:53 -05:00
refactor(tracker/gioui): remove addUnitAction from InstrumentEditor
This commit is contained in:
parent
628365c486
commit
3495d91a4a
@ -28,10 +28,9 @@ import (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
InstrumentEditor struct {
|
InstrumentEditor struct {
|
||||||
dragList *DragList
|
dragList *DragList
|
||||||
searchEditor *Editor
|
searchEditor *Editor
|
||||||
addUnitBtn *Clickable
|
addUnitBtn *Clickable
|
||||||
addUnitAction tracker.Action
|
|
||||||
|
|
||||||
paramTable *ScrollTable
|
paramTable *ScrollTable
|
||||||
searchList *DragList
|
searchList *DragList
|
||||||
@ -67,10 +66,6 @@ func NewInstrumentEditor(m *tracker.Model) *InstrumentEditor {
|
|||||||
searchList: NewDragList(m.SearchResults().List(), layout.Vertical),
|
searchList: NewDragList(m.SearchResults().List(), layout.Vertical),
|
||||||
searching: m.UnitSearching(),
|
searching: m.UnitSearching(),
|
||||||
}
|
}
|
||||||
ret.addUnitAction = tracker.MakeEnabledAction(tracker.DoFunc(func() {
|
|
||||||
m.AddUnit(false).Do()
|
|
||||||
ret.searchEditor.Focus()
|
|
||||||
}))
|
|
||||||
ret.caser = cases.Title(language.English)
|
ret.caser = cases.Title(language.English)
|
||||||
ret.copyHint = makeHint("Copy unit", " (%s)", "Copy")
|
ret.copyHint = makeHint("Copy unit", " (%s)", "Copy")
|
||||||
ret.disableUnitHint = makeHint("Disable unit", " (%s)", "UnitDisabledToggle")
|
ret.disableUnitHint = makeHint("Disable unit", " (%s)", "UnitDisabledToggle")
|
||||||
@ -202,7 +197,7 @@ func (ul *InstrumentEditor) update(gtx C) {
|
|||||||
t.UnitSearching().SetValue(false)
|
t.UnitSearching().SetValue(false)
|
||||||
}
|
}
|
||||||
for ul.addUnitBtn.Clicked(gtx) {
|
for ul.addUnitBtn.Clicked(gtx) {
|
||||||
ul.addUnitAction.Do()
|
t.AddUnit(false).Do()
|
||||||
t.UnitSearching().SetValue(true)
|
t.UnitSearching().SetValue(true)
|
||||||
ul.searchEditor.Focus()
|
ul.searchEditor.Focus()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user