yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::music::SongBrowserView Class Reference

UI component for browsing and managing songs. More...

#include <song_browser_view.h>

Public Member Functions

 SongBrowserView ()=default
 
 ~SongBrowserView ()=default
 
void Draw (MusicBank &bank)
 Draw the song browser.
 
void SetOnSongSelected (std::function< void(int)> callback)
 Set callback for when a song is selected.
 
void SetOnEditCallback (std::function< void()> callback)
 Set callback for when edits occur (e.g. renaming).
 
void SetOnEdit (std::function< void()> callback)
 
void SetOnOpenTracker (std::function< void(int)> callback)
 Set callback for opening tracker on a song.
 
void SetOnOpenPianoRoll (std::function< void(int)> callback)
 Set callback for opening piano roll on a song.
 
void SetOnExportAsm (std::function< void(int)> callback)
 Set callback for exporting a song to ASM.
 
void SetOnImportAsm (std::function< void(int)> callback)
 Set callback for importing ASM to a song.
 
int GetSelectedSongIndex () const
 
void SetSelectedSongIndex (int index)
 

Private Member Functions

void DrawCustomSection (MusicBank &bank, int current_index)
 
void DrawSongItem (MusicBank &bank, int index, bool is_selected, bool is_custom)
 
void HandleContextMenu (MusicBank &bank, int index, bool is_custom)
 
bool MatchesSearch (const std::string &name) const
 

Private Attributes

char search_buffer_ [64] = ""
 
std::function< void(int)> on_song_selected_
 
std::function< void(int)> on_open_tracker_
 
std::function< void(int)> on_open_piano_roll_
 
std::function< void(int)> on_export_asm_
 
std::function< void(int)> on_import_asm_
 
std::function< void()> on_edit_
 
int selected_song_index_ = 0
 
int rename_target_index_ = -1
 

Detailed Description

UI component for browsing and managing songs.

Definition at line 19 of file song_browser_view.h.

Constructor & Destructor Documentation

◆ SongBrowserView()

yaze::editor::music::SongBrowserView::SongBrowserView ( )
default

◆ ~SongBrowserView()

yaze::editor::music::SongBrowserView::~SongBrowserView ( )
default

Member Function Documentation

◆ Draw()

void yaze::editor::music::SongBrowserView::Draw ( MusicBank & bank)

Draw the song browser.

Parameters
bankThe music bank containing songs.
Todo
Implement SPC/MML import
Todo
Open rename popup

Definition at line 16 of file song_browser_view.cc.

References yaze::zelda3::music::MusicBank::AllSongsFit(), yaze::zelda3::music::MusicBank::Auxiliary, yaze::zelda3::music::MusicBank::CalculateSpaceUsage(), yaze::zelda3::music::MusicBank::CreateNewSong(), yaze::zelda3::music::MusicBank::Credits, yaze::zelda3::music::MusicBank::DeleteSong(), yaze::zelda3::music::MusicBank::Dungeon, yaze::zelda3::music::MusicBank::DuplicateSong(), yaze::zelda3::music::MusicBank::GetExpandedBankInfo(), yaze::zelda3::music::MusicBank::GetSong(), yaze::zelda3::music::MusicBank::GetSongCount(), yaze::zelda3::music::MusicBank::HasExpandedMusicPatch(), ICON_MD_ADD, ICON_MD_AUDIOTRACK, ICON_MD_CHECK, ICON_MD_CHECK_CIRCLE, ICON_MD_CONTENT_COPY, ICON_MD_DELETE, ICON_MD_DRIVE_FILE_RENAME_OUTLINE, ICON_MD_EDIT, ICON_MD_ERROR, ICON_MD_FILE_DOWNLOAD, ICON_MD_FILE_UPLOAD, ICON_MD_LIBRARY_MUSIC, ICON_MD_MUSIC_NOTE, ICON_MD_PIANO, ICON_MD_SEARCH, ICON_MD_STORAGE, ICON_MD_WARNING, yaze::zelda3::music::MusicBank::IsVanilla(), MatchesSearch(), on_edit_, on_export_asm_, on_import_asm_, on_open_piano_roll_, on_open_tracker_, on_song_selected_, yaze::zelda3::music::MusicBank::Overworld, yaze::zelda3::music::MusicBank::OverworldExpanded, rename_target_index_, search_buffer_, and selected_song_index_.

Referenced by yaze::editor::MusicSongBrowserPanel::Draw(), and yaze::editor::MusicEditor::DrawSongBrowser().

◆ SetOnSongSelected()

void yaze::editor::music::SongBrowserView::SetOnSongSelected ( std::function< void(int)> callback)
inline

Set callback for when a song is selected.

Definition at line 33 of file song_browser_view.h.

References on_song_selected_.

Referenced by yaze::editor::MusicSongBrowserPanel::SetOnSongSelected().

◆ SetOnEditCallback()

void yaze::editor::music::SongBrowserView::SetOnEditCallback ( std::function< void()> callback)
inline

Set callback for when edits occur (e.g. renaming).

Definition at line 40 of file song_browser_view.h.

References on_edit_.

◆ SetOnEdit()

void yaze::editor::music::SongBrowserView::SetOnEdit ( std::function< void()> callback)
inline

Definition at line 41 of file song_browser_view.h.

References on_edit_.

Referenced by yaze::editor::MusicSongBrowserPanel::SetOnEdit().

◆ SetOnOpenTracker()

void yaze::editor::music::SongBrowserView::SetOnOpenTracker ( std::function< void(int)> callback)
inline

Set callback for opening tracker on a song.

Definition at line 46 of file song_browser_view.h.

References on_open_tracker_.

Referenced by yaze::editor::MusicSongBrowserPanel::SetOnOpenTracker().

◆ SetOnOpenPianoRoll()

void yaze::editor::music::SongBrowserView::SetOnOpenPianoRoll ( std::function< void(int)> callback)
inline

Set callback for opening piano roll on a song.

Definition at line 53 of file song_browser_view.h.

References on_open_piano_roll_.

Referenced by yaze::editor::MusicSongBrowserPanel::SetOnOpenPianoRoll().

◆ SetOnExportAsm()

void yaze::editor::music::SongBrowserView::SetOnExportAsm ( std::function< void(int)> callback)
inline

Set callback for exporting a song to ASM.

Definition at line 60 of file song_browser_view.h.

References on_export_asm_.

Referenced by yaze::editor::MusicSongBrowserPanel::SetOnExportAsm().

◆ SetOnImportAsm()

void yaze::editor::music::SongBrowserView::SetOnImportAsm ( std::function< void(int)> callback)
inline

Set callback for importing ASM to a song.

Definition at line 67 of file song_browser_view.h.

References on_import_asm_.

Referenced by yaze::editor::MusicSongBrowserPanel::SetOnImportAsm().

◆ GetSelectedSongIndex()

int yaze::editor::music::SongBrowserView::GetSelectedSongIndex ( ) const
inline

◆ SetSelectedSongIndex()

void yaze::editor::music::SongBrowserView::SetSelectedSongIndex ( int index)
inline

◆ DrawCustomSection()

void yaze::editor::music::SongBrowserView::DrawCustomSection ( MusicBank & bank,
int current_index )
private

◆ DrawSongItem()

void yaze::editor::music::SongBrowserView::DrawSongItem ( MusicBank & bank,
int index,
bool is_selected,
bool is_custom )
private

◆ HandleContextMenu()

void yaze::editor::music::SongBrowserView::HandleContextMenu ( MusicBank & bank,
int index,
bool is_custom )
private

◆ MatchesSearch()

bool yaze::editor::music::SongBrowserView::MatchesSearch ( const std::string & name) const
private

Definition at line 248 of file song_browser_view.cc.

References search_buffer_.

Referenced by Draw().

Member Data Documentation

◆ search_buffer_

char yaze::editor::music::SongBrowserView::search_buffer_[64] = ""
private

Definition at line 80 of file song_browser_view.h.

Referenced by Draw(), and MatchesSearch().

◆ on_song_selected_

std::function<void(int)> yaze::editor::music::SongBrowserView::on_song_selected_
private

Definition at line 84 of file song_browser_view.h.

Referenced by Draw(), and SetOnSongSelected().

◆ on_open_tracker_

std::function<void(int)> yaze::editor::music::SongBrowserView::on_open_tracker_
private

Definition at line 85 of file song_browser_view.h.

Referenced by Draw(), and SetOnOpenTracker().

◆ on_open_piano_roll_

std::function<void(int)> yaze::editor::music::SongBrowserView::on_open_piano_roll_
private

Definition at line 86 of file song_browser_view.h.

Referenced by Draw(), and SetOnOpenPianoRoll().

◆ on_export_asm_

std::function<void(int)> yaze::editor::music::SongBrowserView::on_export_asm_
private

Definition at line 87 of file song_browser_view.h.

Referenced by Draw(), and SetOnExportAsm().

◆ on_import_asm_

std::function<void(int)> yaze::editor::music::SongBrowserView::on_import_asm_
private

Definition at line 88 of file song_browser_view.h.

Referenced by Draw(), and SetOnImportAsm().

◆ on_edit_

std::function<void()> yaze::editor::music::SongBrowserView::on_edit_
private

Definition at line 89 of file song_browser_view.h.

Referenced by Draw(), SetOnEdit(), and SetOnEditCallback().

◆ selected_song_index_

int yaze::editor::music::SongBrowserView::selected_song_index_ = 0
private

Definition at line 92 of file song_browser_view.h.

Referenced by Draw(), GetSelectedSongIndex(), and SetSelectedSongIndex().

◆ rename_target_index_

int yaze::editor::music::SongBrowserView::rename_target_index_ = -1
private

Definition at line 93 of file song_browser_view.h.

Referenced by Draw().


The documentation for this class was generated from the following files: