From 1d9f1171bcd7aa6f67eebff76440b38dd24faaf5 Mon Sep 17 00:00:00 2001 From: "5684185+vsariola@users.noreply.github.com" <5684185+vsariola@users.noreply.github.com> Date: Wed, 25 Jun 2025 12:54:01 +0300 Subject: [PATCH] drafting --- tracker/gioui/draglist.go | 6 +----- tracker/gioui/focus.go | 4 ++-- tracker/gioui/note_editor.go | 6 +++--- tracker/gioui/order_editor.go | 4 ++-- tracker/gioui/patch_panel.go | 2 +- tracker/gioui/scroll_table.go | 6 +----- 6 files changed, 10 insertions(+), 18 deletions(-) diff --git a/tracker/gioui/draglist.go b/tracker/gioui/draglist.go index 3d33e0a..3725021 100644 --- a/tracker/gioui/draglist.go +++ b/tracker/gioui/draglist.go @@ -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) diff --git a/tracker/gioui/focus.go b/tracker/gioui/focus.go index b5b7643..f7a18c2 100644 --- a/tracker/gioui/focus.go +++ b/tracker/gioui/focus.go @@ -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 } diff --git a/tracker/gioui/note_editor.go b/tracker/gioui/note_editor.go index c9f7a46..73c02a7 100644 --- a/tracker/gioui/note_editor.go +++ b/tracker/gioui/note_editor.go @@ -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 { diff --git a/tracker/gioui/order_editor.go b/tracker/gioui/order_editor.go index e6b0cf7..6b03161 100644 --- a/tracker/gioui/order_editor.go +++ b/tracker/gioui/order_editor.go @@ -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 } } diff --git a/tracker/gioui/patch_panel.go b/tracker/gioui/patch_panel.go index 4c43b8e..d35d8e1 100644 --- a/tracker/gioui/patch_panel.go +++ b/tracker/gioui/patch_panel.go @@ -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) }) } diff --git a/tracker/gioui/scroll_table.go b/tracker/gioui/scroll_table.go index c9dd216..58c48e3 100644 --- a/tracker/gioui/scroll_table.go +++ b/tracker/gioui/scroll_table.go @@ -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) }) }