mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-20 14:04:34 -04:00
drafting
This commit is contained in:
parent
1d9f1171bc
commit
8e9626e48f
@ -79,6 +79,8 @@ type (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// PatchPanel methods
|
||||||
|
|
||||||
func NewPatchPanel(model *tracker.Model) *PatchPanel {
|
func NewPatchPanel(model *tracker.Model) *PatchPanel {
|
||||||
return &PatchPanel{
|
return &PatchPanel{
|
||||||
instrList: MakeInstrList(model),
|
instrList: MakeInstrList(model),
|
||||||
@ -88,31 +90,33 @@ func NewPatchPanel(model *tracker.Model) *PatchPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ie *PatchPanel) Layout(gtx C, t *Tracker) D {
|
func (pp *PatchPanel) Layout(gtx C, t *Tracker) D {
|
||||||
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
|
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
|
||||||
layout.Rigid(func(gtx C) D { return ie.instrList.Layout(gtx, t) }),
|
layout.Rigid(func(gtx C) D { return pp.instrList.Layout(gtx, t) }),
|
||||||
layout.Rigid(func(gtx C) D { return ie.tools.Layout(gtx, t) }),
|
layout.Rigid(func(gtx C) D { return pp.tools.Layout(gtx, t) }),
|
||||||
layout.Flexed(1, func(gtx C) D {
|
layout.Flexed(1, func(gtx C) D {
|
||||||
return layout.Flex{Axis: layout.Horizontal}.Layout(gtx,
|
return layout.Flex{Axis: layout.Horizontal}.Layout(gtx,
|
||||||
layout.Rigid(func(gtx C) D { return ie.unitList.Layout(gtx, t) }),
|
layout.Rigid(func(gtx C) D { return pp.unitList.Layout(gtx, t) }),
|
||||||
layout.Flexed(1, func(gtx C) D { return ie.unitEditor.Layout(gtx, t) }),
|
layout.Flexed(1, func(gtx C) D { return pp.unitEditor.Layout(gtx, t) }),
|
||||||
)
|
)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ie *PatchPanel) Tags(curLevel int, yield TagYieldFunc) bool {
|
func (pp *PatchPanel) Tags(level int, yield TagYieldFunc) bool {
|
||||||
return ie.instrList.Tags(curLevel, yield) &&
|
return pp.instrList.Tags(level, yield) &&
|
||||||
ie.tools.Tags(curLevel, yield) &&
|
pp.tools.Tags(level, yield) &&
|
||||||
ie.unitList.Tags(curLevel, yield) &&
|
pp.unitList.Tags(level, yield) &&
|
||||||
ie.unitEditor.Tags(curLevel, yield)
|
pp.unitEditor.Tags(level, yield)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ie *PatchPanel) TreeFocused(gtx C) bool {
|
func (pp *PatchPanel) TreeFocused(gtx C) bool {
|
||||||
return !ie.Tags(0, func(level int, tag event.Tag) bool {
|
return !pp.Tags(0, func(level int, tag event.Tag) bool {
|
||||||
return !gtx.Focused(tag)
|
return !gtx.Focused(tag)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InstrumentTools methods
|
||||||
|
|
||||||
func MakeInstrumentTools(m *tracker.Model) InstrumentTools {
|
func MakeInstrumentTools(m *tracker.Model) InstrumentTools {
|
||||||
ret := InstrumentTools{
|
ret := InstrumentTools{
|
||||||
Voices: NewNumericUpDownState(),
|
Voices: NewNumericUpDownState(),
|
||||||
@ -232,6 +236,8 @@ func (it *InstrumentTools) Tags(curLevel int, yield TagYieldFunc) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InstrumentList methods
|
||||||
|
|
||||||
func MakeInstrList(model *tracker.Model) InstrumentList {
|
func MakeInstrList(model *tracker.Model) InstrumentList {
|
||||||
return InstrumentList{
|
return InstrumentList{
|
||||||
instrumentDragList: NewDragList(model.Instruments().List(), layout.Horizontal),
|
instrumentDragList: NewDragList(model.Instruments().List(), layout.Horizontal),
|
||||||
@ -257,9 +263,7 @@ func (il *InstrumentList) Layout(gtx C, t *Tracker) D {
|
|||||||
addInstrumentBtn := ActionIconBtn(t.Model.AddInstrument(), t.Theme, il.newInstrumentBtn, icons.ContentAdd, il.addInstrumentHint)
|
addInstrumentBtn := ActionIconBtn(t.Model.AddInstrument(), t.Theme, il.newInstrumentBtn, icons.ContentAdd, il.addInstrumentHint)
|
||||||
return layout.Flex{Axis: layout.Horizontal, Alignment: layout.Middle}.Layout(
|
return layout.Flex{Axis: layout.Horizontal, Alignment: layout.Middle}.Layout(
|
||||||
gtx,
|
gtx,
|
||||||
layout.Flexed(1, func(gtx C) D {
|
layout.Flexed(1, func(gtx C) D { return il.actualLayout(gtx, t) }),
|
||||||
return il.actualLayout(gtx, t)
|
|
||||||
}),
|
|
||||||
layout.Rigid(layout.Spacer{Width: 10}.Layout),
|
layout.Rigid(layout.Spacer{Width: 10}.Layout),
|
||||||
layout.Rigid(Label(t.Theme, &t.Theme.InstrumentEditor.Octave, "Octave").Layout),
|
layout.Rigid(Label(t.Theme, &t.Theme.InstrumentEditor.Octave, "Octave").Layout),
|
||||||
layout.Rigid(layout.Spacer{Width: 4}.Layout),
|
layout.Rigid(layout.Spacer{Width: 4}.Layout),
|
||||||
@ -341,10 +345,12 @@ func (il *InstrumentList) update(gtx C, t *Tracker) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (il *InstrumentList) Tags(curLevel int, yield TagYieldFunc) bool {
|
func (il *InstrumentList) Tags(level int, yield TagYieldFunc) bool {
|
||||||
return yield(curLevel, il.instrumentDragList)
|
return yield(level, il.instrumentDragList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnitList methods
|
||||||
|
|
||||||
func MakeUnitList(m *tracker.Model) UnitList {
|
func MakeUnitList(m *tracker.Model) UnitList {
|
||||||
ret := UnitList{
|
ret := UnitList{
|
||||||
dragList: NewDragList(m.Units().List(), layout.Vertical),
|
dragList: NewDragList(m.Units().List(), layout.Vertical),
|
||||||
|
@ -220,8 +220,8 @@ func (pe *UnitEditor) command(gtx C, e key.Event, t *Tracker) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *UnitEditor) Tags(curLevel int, yield TagYieldFunc) bool {
|
func (t *UnitEditor) Tags(level int, yield TagYieldFunc) bool {
|
||||||
return yield(curLevel, t.sliderList) && yield(curLevel+1, &t.commentEditor.widgetEditor)
|
return yield(level, t.sliderList) && yield(level+1, &t.commentEditor.widgetEditor)
|
||||||
}
|
}
|
||||||
|
|
||||||
type ParameterWidget struct {
|
type ParameterWidget struct {
|
||||||
|
Reference in New Issue
Block a user