yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
song_browser_view.h
Go to the documentation of this file.
1#ifndef YAZE_EDITOR_MUSIC_SONG_BROWSER_VIEW_H
2#define YAZE_EDITOR_MUSIC_SONG_BROWSER_VIEW_H
3
4#include <functional>
5#include <string>
6#include <vector>
7
9
10namespace yaze {
11namespace editor {
12namespace music {
13
14using namespace yaze::zelda3::music;
15
20 public:
21 SongBrowserView() = default;
22 ~SongBrowserView() = default;
23
28 void Draw(MusicBank& bank);
29
33 void SetOnSongSelected(std::function<void(int)> callback) {
34 on_song_selected_ = callback;
35 }
36
40 void SetOnEditCallback(std::function<void()> callback) { on_edit_ = callback; }
41 void SetOnEdit(std::function<void()> callback) { on_edit_ = callback; }
42
46 void SetOnOpenTracker(std::function<void(int)> callback) {
47 on_open_tracker_ = callback;
48 }
49
53 void SetOnOpenPianoRoll(std::function<void(int)> callback) {
54 on_open_piano_roll_ = callback;
55 }
56
60 void SetOnExportAsm(std::function<void(int)> callback) {
61 on_export_asm_ = callback;
62 }
63
67 void SetOnImportAsm(std::function<void(int)> callback) {
68 on_import_asm_ = callback;
69 }
70
72 void SetSelectedSongIndex(int index) { selected_song_index_ = index; }
73
74 private:
75 void DrawCustomSection(MusicBank& bank, int current_index);
76 void DrawSongItem(MusicBank& bank, int index, bool is_selected, bool is_custom);
77 void HandleContextMenu(MusicBank& bank, int index, bool is_custom);
78
79 // Search
80 char search_buffer_[64] = "";
81 bool MatchesSearch(const std::string& name) const;
82
83 // Callbacks
84 std::function<void(int)> on_song_selected_;
85 std::function<void(int)> on_open_tracker_;
86 std::function<void(int)> on_open_piano_roll_;
87 std::function<void(int)> on_export_asm_;
88 std::function<void(int)> on_import_asm_;
89 std::function<void()> on_edit_;
90
91 // State
94};
95
96} // namespace music
97} // namespace editor
98} // namespace yaze
99
100#endif // YAZE_EDITOR_MUSIC_SONG_BROWSER_VIEW_H
UI component for browsing and managing songs.
std::function< void(int)> on_open_piano_roll_
void SetOnOpenTracker(std::function< void(int)> callback)
Set callback for opening tracker on a song.
std::function< void(int)> on_song_selected_
std::function< void(int)> on_export_asm_
bool MatchesSearch(const std::string &name) const
void SetOnEdit(std::function< void()> callback)
void DrawSongItem(MusicBank &bank, int index, bool is_selected, bool is_custom)
void SetOnEditCallback(std::function< void()> callback)
Set callback for when edits occur (e.g. renaming).
std::function< void(int)> on_open_tracker_
void Draw(MusicBank &bank)
Draw the song browser.
std::function< void(int)> on_import_asm_
void SetOnSongSelected(std::function< void(int)> callback)
Set callback for when a song is selected.
void DrawCustomSection(MusicBank &bank, int current_index)
void SetOnExportAsm(std::function< void(int)> callback)
Set callback for exporting a song to ASM.
void SetOnOpenPianoRoll(std::function< void(int)> callback)
Set callback for opening piano roll on a song.
void HandleContextMenu(MusicBank &bank, int index, bool is_custom)
void SetOnImportAsm(std::function< void(int)> callback)
Set callback for importing ASM to a song.
Manages the collection of songs, instruments, and samples from a ROM.
Definition music_bank.h:27
Contains classes and functions for handling music data in Zelda 3.