This commit is contained in:
5684185+vsariola@users.noreply.github.com
2025-06-25 12:54:01 +03:00
parent 6b92ec10cc
commit 1d9f1171bc
6 changed files with 10 additions and 18 deletions

View File

@ -56,10 +56,6 @@ func (d *DragList) Focus() {
d.requestFocus = true
}
func (d *DragList) Focused(gtx C) bool {
return gtx.Focused(d)
}
func (s FilledDragListStyle) LayoutScrollBar(gtx C) D {
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())
}
case key.Event:
if !s.dragList.Focused(gtx) || ke.State != key.Press {
if ke.State != key.Press {
break
}
s.dragList.command(gtx, ke)

View File

@ -17,7 +17,7 @@ func (t *Tracker) FocusNext(gtx C, maxLevel int) {
next = tag
return false // we're done
}
if gtx.Source.Focused(tag) {
if gtx.Focused(tag) {
focused = tag
}
return true
@ -39,7 +39,7 @@ func (t *Tracker) FocusPrev(gtx C, maxLevel int) {
if first == nil {
first = tag // remember the first tag
}
if gtx.Source.Focused(tag) {
if gtx.Focused(tag) {
if prev != nil {
return false // we're done
}

View File

@ -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.IsTrack = true
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}
if drawSelection && selection.Contains(point) {
color := t.Theme.Selection.Inactive
if te.scrollTable.Focused(gtx) {
if gtx.Focused(te.scrollTable) {
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())
@ -294,7 +294,7 @@ func (te *NoteEditor) layoutTracks(gtx C, t *Tracker) D {
// draw the cursor
if point == cursor {
c := t.Theme.Cursor.Inactive
if te.scrollTable.Focused(gtx) {
if gtx.Focused(te.scrollTable) {
c = t.Theme.Cursor.Active
}
if hasTrackMidiIn {

View File

@ -100,12 +100,12 @@ func (oe *OrderEditor) Layout(gtx C, t *Tracker) D {
point := tracker.Point{X: x, Y: y}
if selection.Contains(point) {
color = t.Theme.Selection.Inactive
if oe.scrollTable.Focused(gtx) {
if gtx.Focused(oe.scrollTable) {
color = t.Theme.Selection.Active
}
if point == oe.scrollTable.Table.Cursor() {
color = t.Theme.Cursor.Inactive
if oe.scrollTable.Focused(gtx) {
if gtx.Focused(oe.scrollTable) {
color = t.Theme.Cursor.Active
}
}

View File

@ -109,7 +109,7 @@ func (ie *PatchPanel) Tags(curLevel int, yield TagYieldFunc) bool {
func (ie *PatchPanel) TreeFocused(gtx C) bool {
return !ie.Tags(0, func(level int, tag event.Tag) bool {
return !gtx.Source.Focused(tag)
return !gtx.Focused(tag)
})
}

View File

@ -98,13 +98,9 @@ func (st *ScrollTable) Tags(level int, yield TagYieldFunc) bool {
yield(level, st)
}
func (st *ScrollTable) Focused(gtx C) bool {
return gtx.Source.Focused(st)
}
func (st *ScrollTable) TreeFocused(gtx C) bool {
return !st.Tags(0, func(level int, tag event.Tag) bool {
return !gtx.Source.Focused(tag)
return !gtx.Focused(tag)
})
}