diff --git a/tracker/patterns.go b/tracker/patterns.go index 7ee3c2f..4276d70 100644 --- a/tracker/patterns.go +++ b/tracker/patterns.go @@ -54,3 +54,10 @@ func (t *Tracker) layoutPatterns(tracks []sointu.Track, activeTrack, cursorPatte return layout.Dimensions{Size: gtx.Constraints.Max} } } + +func patternIndexToString(index byte) string { + if index < 10 { + return string([]byte{'0' + index}) + } + return string([]byte{'A' + index - 10}) +} diff --git a/tracker/theme.go b/tracker/theme.go index 6d0f069..a3bc00e 100644 --- a/tracker/theme.go +++ b/tracker/theme.go @@ -15,6 +15,7 @@ var neutral = color.RGBA{R: 73, G: 117, B: 130, A: 255} var light = color.RGBA{R: 138, G: 219, B: 243, A: 255} var dark = color.RGBA{R: 24, G: 40, B: 44, A: 255} var white = color.RGBA{R: 255, G: 255, B: 255, A: 255} +var blue = color.RGBA{R: 127, G: 127, B: 255, A: 255} var gray = color.RGBA{R: 127, G: 127, B: 127, A: 255} var black = color.RGBA{R: 0, G: 0, B: 0, A: 255} var yellow = color.RGBA{R: 255, G: 255, B: 130, A: 255} @@ -36,6 +37,7 @@ var trackerInactiveTextColor = gray var trackerTextColor = white var trackerActiveTextColor = yellow var trackerPlayColor = red +var trackerPatMarker = blue var patternBgColor = black var patternPlayColor = red diff --git a/tracker/track.go b/tracker/track.go index b916d32..028af19 100644 --- a/tracker/track.go +++ b/tracker/track.go @@ -14,7 +14,8 @@ import ( ) const trackRowHeight = 16 -const trackWidth = 100 +const trackWidth = 84 +const patmarkWidth = 16 func (t *Tracker) layoutTrack(patterns [][]byte, sequence []byte, active bool, cursorRow, cursorPattern, cursorCol, playRow, playPattern int) layout.Widget { return func(gtx layout.Context) layout.Dimensions { @@ -55,6 +56,10 @@ func (t *Tracker) layoutTrack(patterns [][]byte, sequence []byte, active bool, c if songRow == playSongRow { paint.FillShape(gtx.Ops, trackerPlayColor, clip.Rect{Max: image.Pt(trackWidth, trackRowHeight)}.Op()) } + if j == 0 { + paint.ColorOp{Color: trackerPatMarker}.Add(gtx.Ops) + widget.Label{}.Layout(gtx, textShaper, trackerFont, trackerFontSize, patternIndexToString(s)) + } if songRow == cursorSongRow { paint.ColorOp{Color: trackerActiveTextColor}.Add(gtx.Ops) } else { @@ -64,10 +69,11 @@ func (t *Tracker) layoutTrack(patterns [][]byte, sequence []byte, active bool, c paint.ColorOp{Color: trackerInactiveTextColor}.Add(gtx.Ops) } } + op.Offset(f32.Pt(patmarkWidth, 0)).Add(gtx.Ops) widget.Label{}.Layout(gtx, textShaper, trackerFont, trackerFontSize, valueAsNote(c)) op.Offset(f32.Pt(trackWidth/2, 0)).Add(gtx.Ops) widget.Label{}.Layout(gtx, textShaper, trackerFont, trackerFontSize, strings.ToUpper(fmt.Sprintf("%02x", c))) - op.Offset(f32.Pt(-trackWidth/2, trackRowHeight)).Add(gtx.Ops) + op.Offset(f32.Pt(-trackWidth/2-patmarkWidth, trackRowHeight)).Add(gtx.Ops) } } return layout.Dimensions{Size: gtx.Constraints.Max}