UI component for displaying and editing music tracks. More...
#include <tracker_view.h>
Public Member Functions | |
| TrackerView ()=default | |
| ~TrackerView ()=default | |
| void | Draw (MusicSong *song, const MusicBank *bank=nullptr) |
| Draw the tracker view for the given song. | |
| void | SetOnEditCallback (std::function< void()> callback) |
| Set callback for when edits occur (to trigger undo save) | |
Private Member Functions | |
| void | DrawToolbar (MusicSong *song) |
| void | DrawGrid (MusicSong *song, const MusicBank *bank) |
| void | DrawChannelHeader (int channel_idx) |
| void | DrawEventCell (MusicTrack &track, int event_index, int channel_idx, uint16_t tick, const MusicBank *bank) |
| void | HandleKeyboardInput (MusicSong *song) |
| void | HandleNavigation () |
| void | HandleEditShortcuts (MusicSong *song) |
Private Attributes | |
| int | current_tick_ = 0 |
| float | row_height_ = 20.0f |
| bool | follow_playback_ = false |
| int | ticks_per_row_ = 18 |
| int | selected_row_ = 0 |
| int | selected_col_ = 0 |
| int | selection_anchor_row_ = -1 |
| int | selection_anchor_col_ = -1 |
| std::function< void()> | on_edit_ |
UI component for displaying and editing music tracks.
Renders an 8-channel tracker view where rows represent time (ticks) and columns represent audio channels.
Definition at line 21 of file tracker_view.h.
|
default |
|
default |
Draw the tracker view for the given song.
| song | The song to display and edit (can be nullptr). |
| bank | The music bank for resolving instrument names (optional). |
Definition at line 112 of file tracker_view.cc.
References DrawGrid(), DrawToolbar(), HandleEditShortcuts(), HandleKeyboardInput(), and HandleNavigation().
Referenced by yaze::editor::MusicEditor::DrawSongTrackerWindow(), and yaze::editor::MusicEditor::DrawTrackerView().
|
inline |
Set callback for when edits occur (to trigger undo save)
Definition at line 36 of file tracker_view.h.
References on_edit_.
|
private |
Definition at line 133 of file tracker_view.cc.
References yaze::zelda3::music::MusicSong::bank, yaze::zelda3::music::MusicSong::GetTotalDuration(), yaze::zelda3::music::MusicSong::name, and ticks_per_row_.
Referenced by Draw().
|
private |
Definition at line 150 of file tracker_view.cc.
References DrawEventCell(), row_height_, yaze::zelda3::music::MusicSong::segments, selected_col_, selected_row_, selection_anchor_col_, selection_anchor_row_, and ticks_per_row_.
Referenced by Draw().
|
private |
|
private |
Definition at line 260 of file tracker_view.cc.
References yaze::zelda3::music::MusicTrack::events, yaze::zelda3::music::MusicBank::GetInstrument(), yaze::zelda3::music::MusicBank::GetInstrumentCount(), yaze::zelda3::music::Note::GetNoteName(), yaze::zelda3::music::MusicTrack::InsertEvent(), yaze::zelda3::music::kDurationSixteenth, yaze::zelda3::music::kNoteMaxPitch, yaze::zelda3::music::kNoteMinPitch, yaze::zelda3::music::TrackEvent::MakeNote(), yaze::zelda3::music::TrackEvent::note, on_edit_, yaze::editor::music::anonymous_namespace{tracker_view.cc}::CommandOption::opcode, and yaze::zelda3::music::Note::pitch.
Referenced by DrawGrid().
|
private |
Definition at line 526 of file tracker_view.cc.
References yaze::zelda3::music::kDurationSixteenth, yaze::zelda3::music::kNoteMinPitch, yaze::zelda3::music::TrackEvent::MakeNote(), on_edit_, yaze::zelda3::music::MusicSong::segments, selected_col_, selected_row_, selection_anchor_row_, and ticks_per_row_.
Referenced by Draw().
|
private |
Definition at line 469 of file tracker_view.cc.
References selected_col_, selected_row_, selection_anchor_col_, and selection_anchor_row_.
Referenced by Draw().
|
private |
Definition at line 626 of file tracker_view.cc.
References yaze::zelda3::music::TrackEvent::MakeCommand(), on_edit_, yaze::zelda3::music::MusicSong::segments, selected_col_, selected_row_, and ticks_per_row_.
Referenced by Draw().
|
private |
Definition at line 46 of file tracker_view.h.
|
private |
Definition at line 47 of file tracker_view.h.
Referenced by DrawGrid().
|
private |
Definition at line 48 of file tracker_view.h.
|
private |
Definition at line 49 of file tracker_view.h.
Referenced by DrawGrid(), DrawToolbar(), HandleEditShortcuts(), and HandleKeyboardInput().
|
private |
Definition at line 52 of file tracker_view.h.
Referenced by DrawGrid(), HandleEditShortcuts(), HandleKeyboardInput(), and HandleNavigation().
|
private |
Definition at line 53 of file tracker_view.h.
Referenced by DrawGrid(), HandleEditShortcuts(), HandleKeyboardInput(), and HandleNavigation().
|
private |
Definition at line 54 of file tracker_view.h.
Referenced by DrawGrid(), HandleKeyboardInput(), and HandleNavigation().
|
private |
Definition at line 55 of file tracker_view.h.
Referenced by DrawGrid(), and HandleNavigation().
|
private |
Definition at line 63 of file tracker_view.h.
Referenced by DrawEventCell(), HandleEditShortcuts(), HandleKeyboardInput(), and SetOnEditCallback().