mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-19 05:24:48 -04:00
feat: focus search editor after "add unit"
This commit is contained in:
@ -72,7 +72,6 @@ func NewInstrumentEditor(model *tracker.Model) *InstrumentEditor {
|
||||
copyInstrumentBtn: new(TipClickable),
|
||||
saveInstrumentBtn: new(TipClickable),
|
||||
loadInstrumentBtn: new(TipClickable),
|
||||
addUnitBtn: NewActionClickable(model.AddUnit(false)),
|
||||
commentExpandBtn: NewBoolClickable(model.CommentExpanded().Bool()),
|
||||
presetMenuBtn: new(TipClickable),
|
||||
soloBtn: NewBoolClickable(model.Solo().Bool()),
|
||||
@ -91,6 +90,7 @@ func NewInstrumentEditor(model *tracker.Model) *InstrumentEditor {
|
||||
ret.presetMenuItems = append(ret.presetMenuItems, MenuItem{Text: name, IconBytes: icons.ImageAudiotrack, Doer: model.LoadPreset(index)})
|
||||
return true
|
||||
})
|
||||
ret.addUnitBtn = NewActionClickable(model.AddUnitAndThen(func() { ret.searchEditor.Focus() }))
|
||||
ret.enlargeHint = makeHint("Enlarge", " (%s)", "InstrEnlargedToggle")
|
||||
ret.shrinkHint = makeHint("Shrink", " (%s)", "InstrEnlargedToggle")
|
||||
ret.addInstrumentHint = makeHint("Add\ninstrument", "\n(%s)", "AddInstrument")
|
||||
@ -383,6 +383,12 @@ func (ie *InstrumentEditor) layoutUnitList(gtx C, t *Tracker) D {
|
||||
}
|
||||
count := min(ie.unitDragList.TrackerList.Count(), 256)
|
||||
|
||||
if ie.searchEditor.requestFocus {
|
||||
// for now, only the searchEditor has its requestFocus flag
|
||||
ie.searchEditor.requestFocus = false
|
||||
gtx.Execute(key.FocusCmd{Tag: &ie.searchEditor.Editor})
|
||||
}
|
||||
|
||||
element := func(gtx C, i int) D {
|
||||
gtx.Constraints.Max.Y = gtx.Dp(20)
|
||||
gtx.Constraints.Min.Y = gtx.Constraints.Max.Y
|
||||
|
Reference in New Issue
Block a user