mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-21 06:24:32 -04:00
drafting
This commit is contained in:
parent
6b92ec10cc
commit
1d9f1171bc
@ -56,10 +56,6 @@ func (d *DragList) Focus() {
|
|||||||
d.requestFocus = true
|
d.requestFocus = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DragList) Focused(gtx C) bool {
|
|
||||||
return gtx.Focused(d)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s FilledDragListStyle) LayoutScrollBar(gtx C) D {
|
func (s FilledDragListStyle) LayoutScrollBar(gtx C) D {
|
||||||
return s.dragList.ScrollBar.Layout(gtx, &s.ScrollBar, s.dragList.TrackerList.Count(), &s.dragList.List.Position)
|
return s.dragList.ScrollBar.Layout(gtx, &s.ScrollBar, s.dragList.TrackerList.Count(), &s.dragList.List.Position)
|
||||||
}
|
}
|
||||||
@ -117,7 +113,7 @@ func (s FilledDragListStyle) Layout(gtx C, element, bg func(gtx C, i int) D) D {
|
|||||||
s.dragList.TrackerList.SetSelected2(s.dragList.TrackerList.Selected())
|
s.dragList.TrackerList.SetSelected2(s.dragList.TrackerList.Selected())
|
||||||
}
|
}
|
||||||
case key.Event:
|
case key.Event:
|
||||||
if !s.dragList.Focused(gtx) || ke.State != key.Press {
|
if ke.State != key.Press {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
s.dragList.command(gtx, ke)
|
s.dragList.command(gtx, ke)
|
||||||
|
@ -17,7 +17,7 @@ func (t *Tracker) FocusNext(gtx C, maxLevel int) {
|
|||||||
next = tag
|
next = tag
|
||||||
return false // we're done
|
return false // we're done
|
||||||
}
|
}
|
||||||
if gtx.Source.Focused(tag) {
|
if gtx.Focused(tag) {
|
||||||
focused = tag
|
focused = tag
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
@ -39,7 +39,7 @@ func (t *Tracker) FocusPrev(gtx C, maxLevel int) {
|
|||||||
if first == nil {
|
if first == nil {
|
||||||
first = tag // remember the first tag
|
first = tag // remember the first tag
|
||||||
}
|
}
|
||||||
if gtx.Source.Focused(tag) {
|
if gtx.Focused(tag) {
|
||||||
if prev != nil {
|
if prev != nil {
|
||||||
return false // we're done
|
return false // we're done
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ func (te *NoteEditor) Layout(gtx layout.Context, t *Tracker) layout.Dimensions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for te.scrollTable.Focused(gtx) && len(t.noteEvents) > 0 {
|
for gtx.Focused(te.scrollTable) && len(t.noteEvents) > 0 {
|
||||||
ev := t.noteEvents[0]
|
ev := t.noteEvents[0]
|
||||||
ev.IsTrack = true
|
ev.IsTrack = true
|
||||||
ev.Channel = t.Model.Notes().Cursor().X
|
ev.Channel = t.Model.Notes().Cursor().X
|
||||||
@ -286,7 +286,7 @@ func (te *NoteEditor) layoutTracks(gtx C, t *Tracker) D {
|
|||||||
point := tracker.Point{X: x, Y: y}
|
point := tracker.Point{X: x, Y: y}
|
||||||
if drawSelection && selection.Contains(point) {
|
if drawSelection && selection.Contains(point) {
|
||||||
color := t.Theme.Selection.Inactive
|
color := t.Theme.Selection.Inactive
|
||||||
if te.scrollTable.Focused(gtx) {
|
if gtx.Focused(te.scrollTable) {
|
||||||
color = t.Theme.Selection.Active
|
color = t.Theme.Selection.Active
|
||||||
}
|
}
|
||||||
paint.FillShape(gtx.Ops, color, clip.Rect{Min: image.Pt(0, 0), Max: image.Pt(gtx.Constraints.Min.X, gtx.Constraints.Min.Y)}.Op())
|
paint.FillShape(gtx.Ops, color, clip.Rect{Min: image.Pt(0, 0), Max: image.Pt(gtx.Constraints.Min.X, gtx.Constraints.Min.Y)}.Op())
|
||||||
@ -294,7 +294,7 @@ func (te *NoteEditor) layoutTracks(gtx C, t *Tracker) D {
|
|||||||
// draw the cursor
|
// draw the cursor
|
||||||
if point == cursor {
|
if point == cursor {
|
||||||
c := t.Theme.Cursor.Inactive
|
c := t.Theme.Cursor.Inactive
|
||||||
if te.scrollTable.Focused(gtx) {
|
if gtx.Focused(te.scrollTable) {
|
||||||
c = t.Theme.Cursor.Active
|
c = t.Theme.Cursor.Active
|
||||||
}
|
}
|
||||||
if hasTrackMidiIn {
|
if hasTrackMidiIn {
|
||||||
|
@ -100,12 +100,12 @@ func (oe *OrderEditor) Layout(gtx C, t *Tracker) D {
|
|||||||
point := tracker.Point{X: x, Y: y}
|
point := tracker.Point{X: x, Y: y}
|
||||||
if selection.Contains(point) {
|
if selection.Contains(point) {
|
||||||
color = t.Theme.Selection.Inactive
|
color = t.Theme.Selection.Inactive
|
||||||
if oe.scrollTable.Focused(gtx) {
|
if gtx.Focused(oe.scrollTable) {
|
||||||
color = t.Theme.Selection.Active
|
color = t.Theme.Selection.Active
|
||||||
}
|
}
|
||||||
if point == oe.scrollTable.Table.Cursor() {
|
if point == oe.scrollTable.Table.Cursor() {
|
||||||
color = t.Theme.Cursor.Inactive
|
color = t.Theme.Cursor.Inactive
|
||||||
if oe.scrollTable.Focused(gtx) {
|
if gtx.Focused(oe.scrollTable) {
|
||||||
color = t.Theme.Cursor.Active
|
color = t.Theme.Cursor.Active
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ func (ie *PatchPanel) Tags(curLevel int, yield TagYieldFunc) bool {
|
|||||||
|
|
||||||
func (ie *PatchPanel) TreeFocused(gtx C) bool {
|
func (ie *PatchPanel) TreeFocused(gtx C) bool {
|
||||||
return !ie.Tags(0, func(level int, tag event.Tag) bool {
|
return !ie.Tags(0, func(level int, tag event.Tag) bool {
|
||||||
return !gtx.Source.Focused(tag)
|
return !gtx.Focused(tag)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,13 +98,9 @@ func (st *ScrollTable) Tags(level int, yield TagYieldFunc) bool {
|
|||||||
yield(level, st)
|
yield(level, st)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (st *ScrollTable) Focused(gtx C) bool {
|
|
||||||
return gtx.Source.Focused(st)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (st *ScrollTable) TreeFocused(gtx C) bool {
|
func (st *ScrollTable) TreeFocused(gtx C) bool {
|
||||||
return !st.Tags(0, func(level int, tag event.Tag) bool {
|
return !st.Tags(0, func(level int, tag event.Tag) bool {
|
||||||
return !gtx.Source.Focused(tag)
|
return !gtx.Focused(tag)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user