feat(sointu): add instrument name field and use it to name more sensible defaults

This commit is contained in:
vsariola
2021-02-06 19:10:37 +02:00
parent b34161b173
commit ef59c4a61a
4 changed files with 31 additions and 23 deletions

View File

@ -93,7 +93,11 @@ func (t *Tracker) layoutInstrumentNames(gtx C) D {
element := func(gtx C, i int) D {
gtx.Constraints.Min.Y = gtx.Px(unit.Dp(36))
labelStyle := LabelStyle{Text: fmt.Sprintf("%v", i), ShadeColor: black, Color: white, Font: labelDefaultFont, FontSize: unit.Sp(12)}
text := t.song.Patch.Instruments[i].Name
if text == "" {
text = fmt.Sprintf("%v", i)
}
labelStyle := LabelStyle{Text: text, ShadeColor: black, Color: white, Font: labelDefaultFont, FontSize: unit.Sp(12)}
return layout.Inset{Left: unit.Dp(10), Right: unit.Dp(10)}.Layout(gtx, func(gtx C) D {
return layout.Center.Layout(gtx, labelStyle.Layout)
})