mirror of
https://github.com/vsariola/sointu.git
synced 2026-02-23 16:43:25 -05:00
drafting
This commit is contained in:
parent
fd5e2c3bb8
commit
b328cc3a07
@ -38,6 +38,9 @@ type SongPanel struct {
|
||||
Step *NumericUpDownState
|
||||
SongLength *NumericUpDownState
|
||||
|
||||
List *layout.List
|
||||
ScrollBar *ScrollBar
|
||||
|
||||
Scope *OscilloscopeState
|
||||
|
||||
SpectrumState *SpectrumState
|
||||
@ -68,6 +71,9 @@ func NewSongPanel(tr *Tracker) *SongPanel {
|
||||
CPUExpander: &Expander{},
|
||||
SpectrumExpander: &Expander{},
|
||||
|
||||
List: &layout.List{Axis: layout.Vertical},
|
||||
ScrollBar: &ScrollBar{Axis: layout.Vertical},
|
||||
|
||||
SpectrumState: NewSpectrumState(),
|
||||
}
|
||||
return ret
|
||||
@ -158,8 +164,9 @@ func (t *SongPanel) layoutSongOptions(gtx C) D {
|
||||
|
||||
synthBtn := Btn(tr.Theme, &tr.Theme.Button.Text, t.SynthBtn, tr.Model.SyntherName(), "")
|
||||
|
||||
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
|
||||
layout.Rigid(func(gtx C) D {
|
||||
listItem := func(gtx C, index int) D {
|
||||
switch index {
|
||||
case 0:
|
||||
return t.SongSettingsExpander.Layout(gtx, tr.Theme, "Song",
|
||||
func(gtx C) D {
|
||||
return Label(tr.Theme, &tr.Theme.SongPanel.RowHeader, strconv.Itoa(tr.BPM().Value())+" BPM").Layout(gtx)
|
||||
@ -188,8 +195,7 @@ func (t *SongPanel) layoutSongOptions(gtx C) D {
|
||||
}),
|
||||
)
|
||||
})
|
||||
}),
|
||||
layout.Rigid(func(gtx C) D {
|
||||
case 1:
|
||||
return t.CPUExpander.Layout(gtx, tr.Theme, "CPU", cpuSmallLabel,
|
||||
func(gtx C) D {
|
||||
return layout.Flex{Axis: layout.Vertical, Alignment: layout.End}.Layout(gtx,
|
||||
@ -198,8 +204,7 @@ func (t *SongPanel) layoutSongOptions(gtx C) D {
|
||||
)
|
||||
},
|
||||
)
|
||||
}),
|
||||
layout.Rigid(func(gtx C) D {
|
||||
case 2:
|
||||
return t.LoudnessExpander.Layout(gtx, tr.Theme, "Loudness",
|
||||
func(gtx C) D {
|
||||
loudness := tr.Model.DetectorResult().Loudness[tracker.LoudnessShortTerm]
|
||||
@ -229,8 +234,7 @@ func (t *SongPanel) layoutSongOptions(gtx C) D {
|
||||
)
|
||||
},
|
||||
)
|
||||
}),
|
||||
layout.Rigid(func(gtx C) D {
|
||||
case 3:
|
||||
return t.PeakExpander.Layout(gtx, tr.Theme, "Peaks",
|
||||
func(gtx C) D {
|
||||
maxPeak := max(tr.Model.DetectorResult().Peaks[tracker.PeakShortTerm][0], tr.Model.DetectorResult().Peaks[tracker.PeakShortTerm][1])
|
||||
@ -258,16 +262,24 @@ func (t *SongPanel) layoutSongOptions(gtx C) D {
|
||||
)
|
||||
},
|
||||
)
|
||||
}),
|
||||
layout.Flexed(1, func(gtx C) D {
|
||||
case 4:
|
||||
gtx.Constraints.Max.Y = gtx.Dp(300)
|
||||
scope := Scope(tr.Theme, tr.Model.SignalAnalyzer(), t.Scope)
|
||||
return t.ScopeExpander.Layout(gtx, tr.Theme, "Oscilloscope", func(gtx C) D { return D{} }, scope.Layout)
|
||||
}),
|
||||
layout.Flexed(1, func(gtx C) D {
|
||||
case 5:
|
||||
gtx.Constraints.Max.Y = gtx.Dp(300)
|
||||
return t.SpectrumExpander.Layout(gtx, tr.Theme, "Spectrum", func(gtx C) D { return D{} }, t.SpectrumState.Layout)
|
||||
}),
|
||||
layout.Rigid(Label(tr.Theme, &tr.Theme.SongPanel.Version, version.VersionOrHash).Layout),
|
||||
)
|
||||
case 6:
|
||||
return Label(tr.Theme, &tr.Theme.SongPanel.Version, version.VersionOrHash).Layout(gtx)
|
||||
default:
|
||||
return D{}
|
||||
}
|
||||
}
|
||||
gtx.Constraints.Min = gtx.Constraints.Max
|
||||
dims := t.List.Layout(gtx, 7, listItem)
|
||||
t.ScrollBar.Layout(gtx, &tr.Theme.ScrollBar, 7, &t.List.Position)
|
||||
tr.SpecAnEnabled().SetValue(t.SpectrumExpander.Expanded)
|
||||
return dims
|
||||
}
|
||||
|
||||
func dbLabel(th *Theme, value tracker.Decibel) LabelWidget {
|
||||
|
||||
Reference in New Issue
Block a user