Skip to content

View: Add sortable timeline tracks (topology/default/custom) - #982

Open
dhingora-amd wants to merge 4 commits into
mainfrom
dhingora/sortable-tracks
Open

View: Add sortable timeline tracks (topology/default/custom)#982
dhingora-amd wants to merge 4 commits into
mainfrom
dhingora/sortable-tracks

Conversation

@dhingora-amd

Copy link
Copy Markdown
Contributor

Motivation

Give users a quick way to organize timeline tracks instead of only manual
drag-reorder. Also decouples reordering from the controller — its graph order
is presentation-only (fetch is keyed by track id), so the round-trip was
unnecessary.

Technical Details

  • Right-click the track-list header → Sort tracks by: Topology (sidebar
    order), Default (load order), Custom (remembered manual order; drag
    auto-switches to it).
  • Reordering is now view-only: updates TrackInfo::index + fires
    kTrackMetadataChanged; removed the controller SetGraphIndex sync.
  • Topology order cached/deduped in TrackTopology (computed once per tree build).
  • Persists sort_mode + custom_order per project (validated before applying).
  • Menu matches the other context menus (IconMenuItem + base-style padding).

Right-click the track-list header to sort tracks by Topology, Default
(track type), or a remembered Custom order. Dragging a track to reorder
becomes the Custom order, and the choice persists per project.

Reordering is now view-only: it updates each track's display index
(TrackInfo::index) instead of syncing the controller's graph order. Data
fetch is keyed by track id and bookmarks jump by time range, so the
controller order is pure presentation state - this drops the per-reorder
controller round-trip (SetGraphIndex removed).

- Cache the deduped sidebar-tree order in TrackTopology for the Topology
  sort (topology is stable, so it is computed once per tree build).
- Persist sort_mode + custom_order in project settings; validate the
  stored custom order is a full permutation before applying.
- Match the other right-click menus (IconMenuItem + base-style padding).

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/view/src/rocprofvis_data_provider.h Outdated
Comment thread src/view/src/rocprofvis_project.h Outdated
Comment thread src/view/src/rocprofvis_timeline_view.h Outdated
@drchen-amd

Copy link
Copy Markdown
Member

I also think some sort of UI element would improve discoverability. Maybe something like
image

- Rename DataProvider::SetTrackDisplayOrder -> SetTrackIndex (TrackInfo
  only keeps an index, not a display order).
- Reuse the existing "order" project key for the remembered custom order
  and drop the separate "custom_order" key; loading applies it only when
  the sort mode is custom (legacy projects still restore).
- Point at TrackTopology's cached order via a const pointer instead of a
  std::function provider.
- Add a full-width down-arrow button at the bottom of the track-list
  header to open the sort menu, with its height clamped to the arrow.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/view/src/rocprofvis_timeline_view.h Outdated
Comment thread src/view/src/rocprofvis_timeline_view.h
Comment thread src/view/src/rocprofvis_timeline_view.cpp Outdated
Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/view/src/rocprofvis_timeline_view.cpp Outdated
Comment thread src/view/src/rocprofvis_timeline_view.h Outdated
Comment thread src/view/src/rocprofvis_data_provider.cpp
- Commit m_sort_mode only after the reorder is confirmed; ApplyTrackOrder
  now reports success/failure so a rejected order can't desync view state.
- SetTrackIndex validates the whole order before reindexing, so a bad id
  can no longer leave the track list half-updated.
- Apply a deferred topology sort once instead of retrying every frame.
- Remove unused GetSortMode() and dead hidden_tracks variable.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants