mirror of
https://github.com/vsariola/sointu.git
synced 2025-06-04 01:28:45 -04:00
refactor(tracker): move instrument related stuff from layout.go to instruments.go
the code related to handling instrument button actions definitely should be in instruments.go, not layout.go
This commit is contained in:
parent
7c810ac052
commit
24ebc99b92
@ -14,15 +14,15 @@ import (
|
|||||||
"golang.org/x/exp/shiny/materialdesign/icons"
|
"golang.org/x/exp/shiny/materialdesign/icons"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (t *Tracker) updateInstrumentScroll() {
|
func (t *Tracker) layoutInstruments(gtx C) D {
|
||||||
if t.CurrentInstrument > 7 {
|
if t.CurrentInstrument > 7 {
|
||||||
t.InstrumentDragList.List.Position.First = t.CurrentInstrument - 7
|
t.InstrumentDragList.List.Position.First = t.CurrentInstrument - 7
|
||||||
} else {
|
} else {
|
||||||
t.InstrumentDragList.List.Position.First = 0
|
t.InstrumentDragList.List.Position.First = 0
|
||||||
}
|
}
|
||||||
}
|
for t.NewInstrumentBtn.Clicked() {
|
||||||
|
t.AddInstrument()
|
||||||
func (t *Tracker) layoutInstruments(gtx C) D {
|
}
|
||||||
btnStyle := material.IconButton(t.Theme, t.NewInstrumentBtn, widgetForIcon(icons.ContentAdd))
|
btnStyle := material.IconButton(t.Theme, t.NewInstrumentBtn, widgetForIcon(icons.ContentAdd))
|
||||||
btnStyle.Background = transparent
|
btnStyle.Background = transparent
|
||||||
btnStyle.Inset = layout.UniformInset(unit.Dp(6))
|
btnStyle.Inset = layout.UniformInset(unit.Dp(6))
|
||||||
|
@ -16,7 +16,6 @@ func (t *Tracker) Layout(gtx layout.Context) {
|
|||||||
t.VerticalSplit.Layout(gtx,
|
t.VerticalSplit.Layout(gtx,
|
||||||
t.layoutTop,
|
t.layoutTop,
|
||||||
t.layoutBottom)
|
t.layoutBottom)
|
||||||
t.updateInstrumentScroll()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Tracker) layoutBottom(gtx layout.Context) layout.Dimensions {
|
func (t *Tracker) layoutBottom(gtx layout.Context) layout.Dimensions {
|
||||||
@ -31,13 +30,8 @@ func (t *Tracker) layoutBottom(gtx layout.Context) layout.Dimensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Tracker) layoutTop(gtx layout.Context) layout.Dimensions {
|
func (t *Tracker) layoutTop(gtx layout.Context) layout.Dimensions {
|
||||||
for t.NewInstrumentBtn.Clicked() {
|
|
||||||
t.AddInstrument()
|
|
||||||
}
|
|
||||||
|
|
||||||
return t.TopHorizontalSplit.Layout(gtx,
|
return t.TopHorizontalSplit.Layout(gtx,
|
||||||
t.layoutSongPanel,
|
t.layoutSongPanel,
|
||||||
t.layoutInstruments,
|
t.layoutInstruments,
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user