This commit is contained in:
5684185+vsariola@users.noreply.github.com 2025-05-04 09:33:24 +03:00
parent dd564815d4
commit 750d88f728
4 changed files with 28 additions and 25 deletions

View File

@ -61,6 +61,7 @@ func NewBoolClickable(b tracker.Bool) *BoolClickable {
func Tooltip(th *material.Theme, tip string) component.Tooltip { func Tooltip(th *material.Theme, tip string) component.Tooltip {
tooltip := component.PlatformTooltip(th, tip) tooltip := component.PlatformTooltip(th, tip)
tooltip.Bg = black tooltip.Bg = black
tooltip.Text.Color = white
return tooltip return tooltip
} }

View File

@ -270,22 +270,21 @@ func (ie *InstrumentEditor) layoutInstrumentHeader(gtx C, t *Tracker) D {
} }
func (ie *InstrumentEditor) layoutInstrumentList(gtx C, t *Tracker) D { func (ie *InstrumentEditor) layoutInstrumentList(gtx C, t *Tracker) D {
gtx.Constraints.Max.Y = gtx.Dp(unit.Dp(36)) gtx.Constraints.Max.Y = gtx.Dp(36)
gtx.Constraints.Min.Y = gtx.Dp(36)
element := func(gtx C, i int) D { element := func(gtx C, i int) D {
gtx.Constraints.Min.Y = gtx.Dp(unit.Dp(36)) grabhandle := Label(t.Theme, &t.Theme.InstrumentEditor.InstrumentList.Number, strconv.Itoa(i+1))
gtx.Constraints.Min.X = gtx.Dp(unit.Dp(30))
grabhandle := Label(t.Theme, &t.Theme.InstrumentEditor.InstrumentNumber, strconv.Itoa(i+1))
label := func(gtx C) D { label := func(gtx C) D {
name, level, mute, ok := (*tracker.Instruments)(t.Model).Item(i) name, level, mute, ok := (*tracker.Instruments)(t.Model).Item(i)
if !ok { if !ok {
labelStyle := Label(t.Theme, &t.Theme.InstrumentEditor.InstrumentName, "") labelStyle := Label(t.Theme, &t.Theme.InstrumentEditor.InstrumentList.Number, "")
return layout.Center.Layout(gtx, labelStyle.Layout) return layout.Center.Layout(gtx, labelStyle.Layout)
} }
k := byte(255 - level*127) k := byte(255 - level*127)
color := color.NRGBA{R: 255, G: k, B: 255, A: 255} color := color.NRGBA{R: 255, G: k, B: 255, A: 255}
s := t.Theme.InstrumentEditor.InstrumentName s := t.Theme.InstrumentEditor.InstrumentList.Name
if mute { if mute {
s = t.Theme.InstrumentEditor.InstrumentNameMuted s = t.Theme.InstrumentEditor.InstrumentList.NameMuted
} }
s.Color = color s.Color = color
if i == ie.instrumentDragList.TrackerList.Selected() { if i == ie.instrumentDragList.TrackerList.Selected() {
@ -364,7 +363,7 @@ func (ie *InstrumentEditor) layoutUnitList(gtx C, t *Tracker) D {
// TODO: how to ie.unitDragList.Focus() // TODO: how to ie.unitDragList.Focus()
addUnitBtnStyle := ActionIcon(gtx, &t.Theme.Material, ie.addUnitBtn, icons.ContentAdd, "Add unit (Enter)") addUnitBtnStyle := ActionIcon(gtx, &t.Theme.Material, ie.addUnitBtn, icons.ContentAdd, "Add unit (Enter)")
addUnitBtnStyle.IconButtonStyle.Color = t.Theme.Material.ContrastFg addUnitBtnStyle.IconButtonStyle.Color = t.Theme.Material.ContrastFg
addUnitBtnStyle.IconButtonStyle.Background = t.Theme.Material.Fg addUnitBtnStyle.IconButtonStyle.Background = t.Theme.Material.ContrastBg
addUnitBtnStyle.IconButtonStyle.Inset = layout.UniformInset(unit.Dp(4)) addUnitBtnStyle.IconButtonStyle.Inset = layout.UniformInset(unit.Dp(4))
var units [256]tracker.UnitListItem var units [256]tracker.UnitListItem
@ -389,7 +388,7 @@ func (ie *InstrumentEditor) layoutUnitList(gtx C, t *Tracker) D {
return layout.Dimensions{Size: gtx.Constraints.Min} return layout.Dimensions{Size: gtx.Constraints.Min}
} }
u := units[i] u := units[i]
var color color.NRGBA = white var color color.NRGBA = t.Theme.InstrumentEditor.UnitList.Name.Color
f := labelDefaultFont f := labelDefaultFont
stackText := strconv.FormatInt(int64(u.StackAfter), 10) stackText := strconv.FormatInt(int64(u.StackAfter), 10)
@ -434,9 +433,9 @@ func (ie *InstrumentEditor) layoutUnitList(gtx C, t *Tracker) D {
} }
style := MaterialEditor(&t.Theme.Material, ie.searchEditor, "---") style := MaterialEditor(&t.Theme.Material, ie.searchEditor, "---")
style.Color = color style.Color = color
style.HintColor = instrumentNameHintColor style.HintColor = t.Theme.InstrumentEditor.UnitList.Comment.Color
style.TextSize = unit.Sp(12) style.TextSize = t.Theme.InstrumentEditor.UnitList.Name.TextSize
style.Font = f style.Font = t.Theme.InstrumentEditor.UnitList.Name.Font
ret := style.Layout(gtx) ret := style.Layout(gtx)
str.Set(ie.searchEditor.Text()) str.Set(ie.searchEditor.Text())
return ret return ret
@ -450,6 +449,7 @@ func (ie *InstrumentEditor) layoutUnitList(gtx C, t *Tracker) D {
}), }),
layout.Flexed(1, func(gtx C) D { layout.Flexed(1, func(gtx C) D {
unitNameLabel := Label(t.Theme, &t.Theme.InstrumentEditor.UnitList.Comment, u.Comment) unitNameLabel := Label(t.Theme, &t.Theme.InstrumentEditor.UnitList.Comment, u.Comment)
unitNameLabel.Color = color
inset := layout.Inset{Left: unit.Dp(5)} inset := layout.Inset{Left: unit.Dp(5)}
return inset.Layout(gtx, unitNameLabel.Layout) return inset.Layout(gtx, unitNameLabel.Layout)
}), }),

View File

@ -54,9 +54,11 @@ type Theme struct {
InstrumentEditor struct { InstrumentEditor struct {
Octave LabelStyle Octave LabelStyle
Voices LabelStyle Voices LabelStyle
InstrumentNumber LabelStyle InstrumentList struct {
InstrumentName LabelStyle Number LabelStyle
InstrumentNameMuted LabelStyle Name LabelStyle
NameMuted LabelStyle
}
UnitList struct { UnitList struct {
Name LabelStyle Name LabelStyle
Comment LabelStyle Comment LabelStyle

View File

@ -102,16 +102,16 @@ menu:
instrumenteditor: instrumenteditor:
octave: { textsize: 14, color: *disabled } octave: { textsize: 14, color: *disabled }
voices: { textsize: 14, color: *disabled } voices: { textsize: 14, color: *disabled }
instrumentnumber: instrumentlist:
{ textsize: 10, color: *mediumemphasis, shadowcolor: *black, alignment: 1 } number: { textsize: 10, color: *mediumemphasis, shadowcolor: *black }
instrumentname: name: { textsize: 12, color: *white, shadowcolor: *black }
{ textsize: 10, color: *white, shadowcolor: *black, alignment: 1 } namemuted: { textsize: 12, color: *disabled }
unitlist: unitlist:
name: { textsize: 12, color: *mediumemphasis, shadowcolor: *black } name: { textsize: 12, color: *white, shadowcolor: *black }
comment: { textsize: 12, color: *disabled } comment: { textsize: 12, color: *disabled }
stack: { textsize: 12, color: *mediumemphasis, shadowcolor: *black } stack: { textsize: 12, color: *mediumemphasis, shadowcolor: *black }
disabled: { textsize: 12, color: *disabled } disabled: { textsize: 12, color: *disabled }
uniteditor: uniteditor:
hint: { textsize: 12, color: *highemphasis, shadowcolor: *black } hint: { textsize: 14, color: *highemphasis, shadowcolor: *black }
chooser: { textsize: 12, color: *white, shadowcolor: *black } chooser: { textsize: 12, color: *white, shadowcolor: *black }
parametername: { textsize: 12, color: *white, shadowcolor: *black } parametername: { textsize: 14, color: *white, shadowcolor: *black }