From 750d88f728b98a128fb62af234fb2296eb66b2d3 Mon Sep 17 00:00:00 2001 From: "5684185+vsariola@users.noreply.github.com" <5684185+vsariola@users.noreply.github.com> Date: Sun, 4 May 2025 09:33:24 +0300 Subject: [PATCH] drafting --- tracker/gioui/buttons.go | 1 + tracker/gioui/instrument_editor.go | 24 ++++++++++++------------ tracker/gioui/theme.go | 14 ++++++++------ tracker/gioui/theme.yml | 14 +++++++------- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/tracker/gioui/buttons.go b/tracker/gioui/buttons.go index 870ed82..62fbd62 100644 --- a/tracker/gioui/buttons.go +++ b/tracker/gioui/buttons.go @@ -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 } diff --git a/tracker/gioui/instrument_editor.go b/tracker/gioui/instrument_editor.go index 9caa8c0..745c455 100644 --- a/tracker/gioui/instrument_editor.go +++ b/tracker/gioui/instrument_editor.go @@ -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) }), diff --git a/tracker/gioui/theme.go b/tracker/gioui/theme.go index 83f3ada..41825d9 100644 --- a/tracker/gioui/theme.go +++ b/tracker/gioui/theme.go @@ -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 diff --git a/tracker/gioui/theme.yml b/tracker/gioui/theme.yml index 310fde9..e45b5dc 100644 --- a/tracker/gioui/theme.yml +++ b/tracker/gioui/theme.yml @@ -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 }