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 {
tooltip := component.PlatformTooltip(th, tip)
tooltip.Bg = black
tooltip.Text.Color = white
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 {
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 {
gtx.Constraints.Min.Y = gtx.Dp(unit.Dp(36))
gtx.Constraints.Min.X = gtx.Dp(unit.Dp(30))
grabhandle := Label(t.Theme, &t.Theme.InstrumentEditor.InstrumentNumber, strconv.Itoa(i+1))
grabhandle := Label(t.Theme, &t.Theme.InstrumentEditor.InstrumentList.Number, strconv.Itoa(i+1))
label := func(gtx C) D {
name, level, mute, ok := (*tracker.Instruments)(t.Model).Item(i)
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)
}
k := byte(255 - level*127)
color := color.NRGBA{R: 255, G: k, B: 255, A: 255}
s := t.Theme.InstrumentEditor.InstrumentName
s := t.Theme.InstrumentEditor.InstrumentList.Name
if mute {
s = t.Theme.InstrumentEditor.InstrumentNameMuted
s = t.Theme.InstrumentEditor.InstrumentList.NameMuted
}
s.Color = color
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()
addUnitBtnStyle := ActionIcon(gtx, &t.Theme.Material, ie.addUnitBtn, icons.ContentAdd, "Add unit (Enter)")
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))
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}
}
u := units[i]
var color color.NRGBA = white
var color color.NRGBA = t.Theme.InstrumentEditor.UnitList.Name.Color
f := labelDefaultFont
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.Color = color
style.HintColor = instrumentNameHintColor
style.TextSize = unit.Sp(12)
style.Font = f
style.HintColor = t.Theme.InstrumentEditor.UnitList.Comment.Color
style.TextSize = t.Theme.InstrumentEditor.UnitList.Name.TextSize
style.Font = t.Theme.InstrumentEditor.UnitList.Name.Font
ret := style.Layout(gtx)
str.Set(ie.searchEditor.Text())
return ret
@ -450,6 +449,7 @@ func (ie *InstrumentEditor) layoutUnitList(gtx C, t *Tracker) D {
}),
layout.Flexed(1, func(gtx C) D {
unitNameLabel := Label(t.Theme, &t.Theme.InstrumentEditor.UnitList.Comment, u.Comment)
unitNameLabel.Color = color
inset := layout.Inset{Left: unit.Dp(5)}
return inset.Layout(gtx, unitNameLabel.Layout)
}),

View File

@ -52,12 +52,14 @@ type Theme struct {
ShortCut LabelStyle
}
InstrumentEditor struct {
Octave LabelStyle
Voices LabelStyle
InstrumentNumber LabelStyle
InstrumentName LabelStyle
InstrumentNameMuted LabelStyle
UnitList struct {
Octave LabelStyle
Voices LabelStyle
InstrumentList struct {
Number LabelStyle
Name LabelStyle
NameMuted LabelStyle
}
UnitList struct {
Name LabelStyle
Comment LabelStyle
Stack LabelStyle

View File

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