From b4a63ce3629c7b7d3ddaef23ac16339edd0dee8a Mon Sep 17 00:00:00 2001 From: "5684185+vsariola@users.noreply.github.com" <5684185+vsariola@users.noreply.github.com> Date: Fri, 11 Oct 2024 12:16:40 +0300 Subject: [PATCH] feat(tracker/gioui): label identifying instrument MIDI channel Closes #154. --- CHANGELOG.md | 3 +++ tracker/gioui/instrument_editor.go | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dd1300..fb99e13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### Added +- A small number above the instrument name identifies the MIDI channel / + instrument number, with numbering starting from 1 ([#154][i154]) - The filter unit frequency parameter is displayed in Hz, corresponding roughly to the resonant frequency of the filter ([#158][i158]) - Include version info in the binaries, as given be `git describe`. This version @@ -235,5 +237,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). [i148]: https://github.com/vsariola/sointu/issues/148 [i149]: https://github.com/vsariola/sointu/issues/149 [i150]: https://github.com/vsariola/sointu/issues/150 +[i154]: https://github.com/vsariola/sointu/issues/154 [i158]: https://github.com/vsariola/sointu/issues/158 [i162]: https://github.com/vsariola/sointu/issues/162 diff --git a/tracker/gioui/instrument_editor.go b/tracker/gioui/instrument_editor.go index 0fffdf0..2172c8d 100644 --- a/tracker/gioui/instrument_editor.go +++ b/tracker/gioui/instrument_editor.go @@ -258,10 +258,7 @@ func (ie *InstrumentEditor) layoutInstrumentList(gtx C, t *Tracker) D { element := func(gtx C, i int) D { gtx.Constraints.Min.Y = gtx.Dp(unit.Dp(36)) gtx.Constraints.Min.X = gtx.Dp(unit.Dp(30)) - grabhandle := LabelStyle{Text: "", ShadeColor: black, Color: white, FontSize: unit.Sp(10), Alignment: layout.Center, Shaper: t.Theme.Shaper} - if i == ie.instrumentDragList.TrackerList.Selected() { - grabhandle.Text = ":::" - } + grabhandle := LabelStyle{Text: strconv.Itoa(i + 1), ShadeColor: black, Color: mediumEmphasisTextColor, FontSize: unit.Sp(10), Alignment: layout.Center, Shaper: t.Theme.Shaper} label := func(gtx C) D { name, level, ok := (*tracker.Instruments)(t.Model).Item(i) if !ok { @@ -312,7 +309,7 @@ func (ie *InstrumentEditor) layoutInstrumentList(gtx C, t *Tracker) D { labelStyle := LabelStyle{Text: name, ShadeColor: black, Color: color, Font: labelDefaultFont, FontSize: unit.Sp(12), Shaper: t.Theme.Shaper} return layout.Center.Layout(gtx, labelStyle.Layout) } - return layout.Inset{Left: unit.Dp(6), Right: unit.Dp(6)}.Layout(gtx, func(gtx C) D { + return layout.Inset{Left: unit.Dp(6), Right: unit.Dp(6), Top: unit.Dp(4)}.Layout(gtx, func(gtx C) D { return layout.Flex{Axis: layout.Vertical, Alignment: layout.Middle}.Layout(gtx, layout.Rigid(grabhandle.Layout), layout.Rigid(label),