mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-28 03:10:24 -04:00
feat(tracker): add pattern marks to tracker
This commit is contained in:
parent
91766e198d
commit
492b2252bf
@ -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})
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user