diff --git a/assets/icons/icon-ab-dark_16x16.png b/assets/icons/icon-ab-dark_16x16.png new file mode 100644 index 0000000..a20475a Binary files /dev/null and b/assets/icons/icon-ab-dark_16x16.png differ diff --git a/assets/icons/icon-ab-light_16x16.png b/assets/icons/icon-ab-light_16x16.png new file mode 100644 index 0000000..2b8a070 Binary files /dev/null and b/assets/icons/icon-ab-light_16x16.png differ diff --git a/assets/icons/icon-loop-dark_16x16.png b/assets/icons/icon-loop-dark_16x16.png new file mode 100644 index 0000000..e693992 Binary files /dev/null and b/assets/icons/icon-loop-dark_16x16.png differ diff --git a/assets/icons/icon-loop-light_16x16.png b/assets/icons/icon-loop-light_16x16.png new file mode 100644 index 0000000..29a87ee Binary files /dev/null and b/assets/icons/icon-loop-light_16x16.png differ diff --git a/assets/icons/icon-mute-dark_16x16.png b/assets/icons/icon-mute-dark_16x16.png new file mode 100644 index 0000000..947cf99 Binary files /dev/null and b/assets/icons/icon-mute-dark_16x16.png differ diff --git a/assets/icons/icon-mute-light_16x16.png b/assets/icons/icon-mute-light_16x16.png new file mode 100644 index 0000000..964a997 Binary files /dev/null and b/assets/icons/icon-mute-light_16x16.png differ diff --git a/assets/icons/icon-play-dark_16x16.png b/assets/icons/icon-play-dark_16x16.png new file mode 100644 index 0000000..86c52d3 Binary files /dev/null and b/assets/icons/icon-play-dark_16x16.png differ diff --git a/assets/icons/icon-play-light_16x16.png b/assets/icons/icon-play-light_16x16.png new file mode 100644 index 0000000..6646268 Binary files /dev/null and b/assets/icons/icon-play-light_16x16.png differ diff --git a/assets/icons/icon-stop-dark_16x16.png b/assets/icons/icon-stop-dark_16x16.png new file mode 100644 index 0000000..39f0cc9 Binary files /dev/null and b/assets/icons/icon-stop-dark_16x16.png differ diff --git a/assets/icons/icon-stop-light_16x16.png b/assets/icons/icon-stop-light_16x16.png new file mode 100644 index 0000000..110767c Binary files /dev/null and b/assets/icons/icon-stop-light_16x16.png differ diff --git a/meson.build b/meson.build index bae49b3..4c51e12 100755 --- a/meson.build +++ b/meson.build @@ -17,13 +17,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -project('SampleHive', 'cpp', +project('SampleHive', + 'cpp', version : 'v0.8.4_alpha.1', license : 'GPL v3', default_options : ['warning_level=1', 'cpp_std=c++11']) meson_src_root = meson.current_source_dir() +meson_build_root = meson.current_build_dir() # Save important directories prefix = get_option('prefix') @@ -41,10 +43,16 @@ config_data.set_quoted('DATADIR', datadir) config_data.set_quoted('SAMPLEHIVE_DATADIR', samplehive_datadir) # Create samplehive-config.h based on configuration -config_h = configure_file( - output: 'SampleHiveConfig.hpp', - configuration: config_data, -) +config_h = configure_file(output: 'SampleHiveConfig.hpp', + configuration: config_data,) + +# Import CMake +cmake = import('cmake') +cmake_opts = cmake.subproject_options() +cmake_opts.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON', + 'CMAKE_INSTALL_PREFIX': prefix, + 'CMAKE_BUILD_TYPE': 'Release', + 'CMAKE_CXX_COMPILER': 'g++'}) # Source files to be compiled src = [ @@ -62,32 +70,77 @@ src = [ ] -wxconfig = find_program(['wx-config-gtk3', 'wx-config']) -wx_modules = ['media', 'std'] -wx_cxx_flags = [] -wx_libs = [] - -foreach module : wx_modules - wx_cxx_flags += run_command(wxconfig, '--cxxflags', module).stdout().strip().split() - wx_libs += run_command(wxconfig, '--libs', module).stdout().strip().split() -endforeach - # Dependencies -wx = dependency('wxwidgets', version: '>=3.0.4') -taglib = dependency('taglib', version: '>=1.11') -sqlite3 = dependency('sqlite3') -yaml = dependency('yaml-cpp') -snd = dependency('sndfile') +wx = dependency('wxwidgets', version: '>=3.1.5', required: false) -install_subdir( - 'assets', - install_dir: samplehive_datadir, - exclude_directories: 'screenshots' -) +wx_found = false -executable('SampleHive', - sources: src, - cpp_args: [wx_cxx_flags], - link_args: [wx_libs], - dependencies: [wx, taglib, sqlite3, yaml, snd], - install: true) +if not wx.found() + wx_found = false + + wx_subproject = cmake.subproject('wxwidgets', options: cmake_opts) + wx_core = wx_subproject.dependency('wxcore') + wx_base = wx_subproject.dependency('wxbase') + wx_media = wx_subproject.dependency('wxmedia') + wx = [wx_core, wx_base, wx_media] +else + wx_found = true + + wxconfig = find_program(['wx-config-gtk3', 'wx-config']) + wx_modules = ['media', 'std'] + wx_cxx_flags = [] + wx_libs = [] + + foreach module : wx_modules + wx_cxx_flags += run_command(wxconfig, '--cxxflags', module).stdout().strip().split() + wx_libs += run_command(wxconfig, '--libs', module).stdout().strip().split() + endforeach +endif + +taglib = dependency('taglib', version: '>=1.12', required: false) +if not taglib.found() + taglib_subproject = cmake.subproject('taglib', options: cmake_opts) + taglib = taglib_subproject.dependency('tag') +endif + +sqlite3 = dependency('sqlite3', required: true) +yaml = dependency('yaml-cpp', required: true) +snd = dependency('sndfile', required: true) + +install_subdir('assets', + install_dir: samplehive_datadir, + exclude_directories: 'screenshots') + +if wx_found + executable('SampleHive', + sources: src, + cpp_args: [wx_cxx_flags], + link_args: [wx_libs], + dependencies: [wx, taglib, sqlite3, yaml, snd], + install: true, + install_rpath: prefix / 'lib') +else + executable('SampleHive', + sources: src, + dependencies: [wx, taglib, sqlite3, yaml, snd], + install: true, + install_rpath: prefix / 'lib') +endif + +summary( + { + # 'Program name': get_option ('program_name'), + 'Debug': get_option('debug'), + 'Optimization': get_option('optimization'), + }, + section: 'General') + +summary( + { + 'prefix': prefix, + 'bindir': bindir, + 'libdir': libdir, + 'datadir': datadir, + 'samplehive_datadir': samplehive_datadir, + }, + section: 'Directories') diff --git a/src/ControlID_Enums.hpp b/src/ControlID_Enums.hpp index 459b0ce..272af52 100644 --- a/src/ControlID_Enums.hpp +++ b/src/ControlID_Enums.hpp @@ -35,8 +35,7 @@ enum ControlIDs BC_Settings, BC_Loop, BC_Stop, - BC_LoopPointButton, - BC_LoopPointText, + BC_LoopABButton, BC_Mute, BC_Autoplay, BC_Volume, diff --git a/src/Database.cpp b/src/Database.cpp index c1d5162..bd0b1bc 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -382,7 +382,7 @@ void Database::UpdateHive(const std::string& dbPath, const std::string& hiveOldN } else { - wxLogInfo("Hive updated successfully. %s", m_ErrMsg); + wxLogDebug("Hive updated successfully. %s", m_ErrMsg); } sqlite3_close(m_Database); @@ -565,7 +565,7 @@ std::string Database::GetSampleType(const std::string& dbPath, const std::string if (sqlite3_step(m_Stmt) == SQLITE_ROW) { - wxLogInfo("Record found, fetching.."); + wxLogDebug("Record found, fetching.."); type = std::string(reinterpret_cast(sqlite3_column_text(m_Stmt, 0))); } @@ -581,7 +581,7 @@ std::string Database::GetSampleType(const std::string& dbPath, const std::string } else { - wxLogInfo("Selected data from table successfully."); + wxLogDebug("Selected data from table successfully."); } sqlite3_close(m_Database); @@ -610,7 +610,7 @@ int Database::GetFavoriteColumnValueByFilename(const std::string& dbPath, const if (sqlite3_step(m_Stmt) == SQLITE_ROW) { - wxLogInfo("Record found, fetching.."); + wxLogDebug("Record found, fetching.."); value = sqlite3_column_int(m_Stmt, 0); } @@ -625,7 +625,7 @@ int Database::GetFavoriteColumnValueByFilename(const std::string& dbPath, const } else { - wxLogInfo("Selected data from table successfully."); + wxLogDebug("Selected data from table successfully."); } sqlite3_close(m_Database); @@ -654,7 +654,7 @@ std::string Database::GetHiveByFilename(const std::string& dbPath, const std::st if (sqlite3_step(m_Stmt) == SQLITE_ROW) { - wxLogInfo("Record found, fetching.."); + wxLogDebug("Record found, fetching.."); hive = std::string(reinterpret_cast(sqlite3_column_text(m_Stmt, 0))); } @@ -670,7 +670,7 @@ std::string Database::GetHiveByFilename(const std::string& dbPath, const std::st } else { - wxLogInfo("Selected data from table successfully."); + wxLogDebug("Selected data from table successfully."); } sqlite3_close(m_Database); @@ -777,7 +777,7 @@ std::string Database::GetSamplePathByFilename(const std::string& dbPath, const s if (sqlite3_step(m_Stmt) == SQLITE_ROW) { - wxLogInfo("Record found, fetching.."); + wxLogDebug("Record found, fetching.."); path = std::string(reinterpret_cast(sqlite3_column_text(m_Stmt, 0))); } @@ -792,7 +792,7 @@ std::string Database::GetSamplePathByFilename(const std::string& dbPath, const s } else { - wxLogInfo("Selected data from table successfully."); + wxLogDebug("Selected data from table successfully."); } sqlite3_close(m_Database); @@ -821,7 +821,7 @@ std::string Database::GetSampleFileExtension(const std::string& dbPath, const st if (sqlite3_step(m_Stmt) == SQLITE_ROW) { - wxLogInfo("Record found, fetching.."); + wxLogDebug("Record found, fetching.."); extension = std::string(reinterpret_cast(sqlite3_column_text(m_Stmt, 0))); } @@ -836,7 +836,7 @@ std::string Database::GetSampleFileExtension(const std::string& dbPath, const st } else { - wxLogInfo("Selected data from table successfully."); + wxLogDebug("Selected data from table successfully."); } sqlite3_close(m_Database); @@ -1038,7 +1038,7 @@ Database::FilterDatabaseBySampleName(const std::string& dbPath, wxVector(sqlite3_column_text(m_Stmt, 1)))); wxString sample_pack = wxString(std::string(reinterpret_cast(sqlite3_column_text(m_Stmt, 2)))); @@ -1140,7 +1140,7 @@ Database::FilterDatabaseByHiveName(const std::string& dbPath, wxVector(sqlite3_column_text(m_Stmt, 1)))); wxString sample_pack = wxString(std::string(reinterpret_cast(sqlite3_column_text(m_Stmt, 2)))); @@ -1233,7 +1233,7 @@ void Database::LoadHivesDatabase(const std::string& dbPath, wxDataViewTreeCtrl& { while (SQLITE_ROW == sqlite3_step(m_Stmt)) { - wxLogInfo("Record found, fetching.."); + wxLogDebug("Record found, fetching.."); wxString hive = wxString(std::string(reinterpret_cast(sqlite3_column_text(m_Stmt, 0)))); treeCtrl.AppendContainer(wxDataViewItem(wxNullPtr), hive); @@ -1313,7 +1313,7 @@ bool Database::IsTrashed(const std::string& dbPath, const std::string& filename) if (sqlite3_step(m_Stmt) == SQLITE_ROW) { - wxLogInfo("Record found, fetching.."); + wxLogDebug("Record found, fetching.."); if (sqlite3_column_int(m_Stmt, 0) == 1) return true; @@ -1330,7 +1330,7 @@ bool Database::IsTrashed(const std::string& dbPath, const std::string& filename) } else { - wxLogInfo("Selected data from table successfully."); + wxLogDebug("Selected data from table successfully."); } sqlite3_close(m_Database); diff --git a/src/MainFrame.cpp b/src/MainFrame.cpp index b0d35cf..0d0cc5c 100644 --- a/src/MainFrame.cpp +++ b/src/MainFrame.cpp @@ -50,14 +50,14 @@ #include #include #include -#include +// #include #include #include #include #include #include #include -#include +// #include #include "MainFrame.hpp" #include "ControlID_Enums.hpp" @@ -78,8 +78,18 @@ #define ICON_HIVE_256px SAMPLEHIVE_DATADIR "/assets/icons/icon-hive_256x256.png" #define ICON_STAR_FILLED_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-star_filled_16x16.png" #define ICON_STAR_EMPTY_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-star_empty_16x16.png" -#define APP_CONFIG_DIR wxStandardPaths::Get().GetUserConfigDir() + "/.config/SampleHive" -#define APP_DATA_DIR wxStandardPaths::Get().GetDocumentsDir() + "/.local/share/SampleHive" +#define ICON_PLAY_DARK_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-play-dark_16x16.png" +#define ICON_STOP_DARK_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-stop-dark_16x16.png" +#define ICON_AB_DARK_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-ab-dark_16x16.png" +#define ICON_LOOP_DARK_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-loop-dark_16x16.png" +#define ICON_MUTE_DARK_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-mute-dark_16x16.png" +#define ICON_PLAY_LIGHT_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-play-light_16x16.png" +#define ICON_STOP_LIGHT_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-stop-light_16x16.png" +#define ICON_AB_LIGHT_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-ab-light_16x16.png" +#define ICON_LOOP_LIGHT_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-loop-light_16x16.png" +#define ICON_MUTE_LIGHT_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-mute-light_16x16.png" +#define APP_CONFIG_DIR wxGetHomeDir() + "/.config/SampleHive" +#define APP_DATA_DIR wxGetHomeDir() + "/.local/share/SampleHive" #define CONFIG_FILEPATH APP_CONFIG_DIR + "/config.yaml" #define DATABASE_FILEPATH APP_DATA_DIR "/sample.hive" @@ -197,7 +207,7 @@ MainFrame::MainFrame() _("All files|*|Ogg files (*.ogg)|*.ogg|Wav files (*.wav)|*.wav|" "Flac files (*.flac)|*.flac"), 0); - wxString path = wxStandardPaths::Get().GetDocumentsDir(); + wxString path = wxGetHomeDir(); m_DirCtrl->SetPath(path); // This panel will hold 2nd page of wxNotebook @@ -248,20 +258,12 @@ MainFrame::MainFrame() m_TopControlsPanel = new wxPanel(m_TopPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER); // Looping region controls - m_LoopPointAButton = new wxToggleButton(m_TopControlsPanel, BC_LoopPointButton, _("A"), wxDefaultPosition, wxDefaultSize, 0); - m_LoopPointAButton->SetToolTip("Set Loop point A"); - m_LoopPointAButton->Disable(); - m_LoopPointAText = new wxTextCtrl(m_TopControlsPanel, BC_LoopPointText, _("00:00"), wxDefaultPosition, wxDefaultSize, wxTE_RIGHT | wxTE_PROCESS_ENTER); - m_LoopPointAText->Disable(); - m_LoopPointAText->SetMinSize(wxSize(60, -1)); - m_LoopPointAText->SetMaxSize(wxSize(60, -1)); - m_LoopPointBButton = new wxToggleButton(m_TopControlsPanel, BC_LoopPointButton, _("B"), wxDefaultPosition, wxDefaultSize, 0); - m_LoopPointBButton->SetToolTip("Set Loop point B"); - m_LoopPointBButton->Disable(); - m_LoopPointBText = new wxTextCtrl(m_TopControlsPanel, BC_LoopPointText, _("00:00"), wxDefaultPosition, wxDefaultSize, wxTE_RIGHT | wxTE_PROCESS_ENTER); - m_LoopPointBText->Disable(); - m_LoopPointBText->SetMinSize(wxSize(60, -1)); - m_LoopPointBText->SetMaxSize(wxSize(60, -1)); + if (m_Theme.IsDark()) + m_LoopABButton = new wxBitmapToggleButton(m_TopControlsPanel, BC_LoopABButton, static_cast(ICON_AB_LIGHT_16px), wxDefaultPosition, wxDefaultSize, 0); + else + m_LoopABButton = new wxBitmapToggleButton(m_TopControlsPanel, BC_LoopABButton, static_cast(ICON_AB_DARK_16px), wxDefaultPosition, wxDefaultSize, 0); + + m_LoopABButton->SetToolTip(_("Loop selected region")); // Initializing browser controls on top panel. m_AutoPlayCheck = new wxCheckBox(m_TopControlsPanel, BC_Autoplay, _("Autoplay"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE); @@ -274,16 +276,36 @@ MainFrame::MainFrame() wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL); // Initialize browser control buttons - m_PlayButton = new wxButton(m_TopControlsPanel, BC_Play, _("Play"), wxDefaultPosition, wxDefaultSize, 0); + if (m_Theme.IsDark()) + { + m_PlayButton = new wxBitmapButton(m_TopControlsPanel, BC_Play, static_cast(ICON_PLAY_LIGHT_16px), + wxDefaultPosition, wxDefaultSize, 0); + m_LoopButton = new wxBitmapToggleButton(m_TopControlsPanel, BC_Loop, static_cast(ICON_LOOP_LIGHT_16px), + wxDefaultPosition, wxDefaultSize, 0); + m_StopButton = new wxBitmapButton(m_TopControlsPanel, BC_Stop, static_cast(ICON_STOP_LIGHT_16px), + wxDefaultPosition, wxDefaultSize, 0); + m_MuteButton = new wxBitmapToggleButton(m_TopControlsPanel, BC_Mute, static_cast(ICON_MUTE_LIGHT_16px), + wxDefaultPosition, wxDefaultSize, 0); + } + else + { + m_PlayButton = new wxBitmapButton(m_TopControlsPanel, BC_Play, static_cast(ICON_PLAY_DARK_16px), + wxDefaultPosition, wxDefaultSize, 0); + m_LoopButton = new wxBitmapToggleButton(m_TopControlsPanel, BC_Loop, static_cast(ICON_LOOP_DARK_16px), + wxDefaultPosition, wxDefaultSize, 0); + m_StopButton = new wxBitmapButton(m_TopControlsPanel, BC_Stop, static_cast(ICON_STOP_DARK_16px), + wxDefaultPosition, wxDefaultSize, 0); + m_MuteButton = new wxBitmapToggleButton(m_TopControlsPanel, BC_Mute, static_cast(ICON_MUTE_DARK_16px), + wxDefaultPosition, wxDefaultSize, 0); + } + m_PlayButton->SetToolTip(_("Play")); - m_LoopButton = new wxToggleButton(m_TopControlsPanel, BC_Loop, _("Loop"), wxDefaultPosition, wxDefaultSize, 0); m_LoopButton->SetToolTip(_("Loop")); - m_StopButton = new wxButton(m_TopControlsPanel, BC_Stop, _("Stop"), wxDefaultPosition, wxDefaultSize, 0); m_StopButton->SetToolTip(_("Stop")); + m_MuteButton->SetToolTip(_("Mute")); + m_SettingsButton = new wxButton(m_TopControlsPanel, BC_Settings, _("Settings"), wxDefaultPosition, wxDefaultSize, 0); m_SettingsButton->SetToolTip(_("Settings")); - m_MuteButton = new wxToggleButton(m_TopControlsPanel, BC_Mute, _("Mute"), wxDefaultPosition, wxDefaultSize, 0); - m_MuteButton->SetToolTip(_("Mute")); // Initializing wxSearchCtrl on bottom panel. m_SearchBox = new wxSearchCtrl(m_BottomRightPanel, BC_Search, _("Search for samples.."), wxDefaultPosition, @@ -404,10 +426,7 @@ MainFrame::MainFrame() Bind(wxEVT_TOGGLEBUTTON, &MainFrame::OnClickMute, this, BC_Mute); Bind(wxEVT_MEDIA_FINISHED, &MainFrame::OnMediaFinished, this, BC_MediaCtrl); Bind(wxEVT_BUTTON, &MainFrame::OnClickSettings, this, BC_Settings); - Bind(wxEVT_TOGGLEBUTTON, &MainFrame::OnClickLoopPointsButton, this, BC_LoopPointButton); - Bind(wxEVT_TOGGLEBUTTON, &MainFrame::OnClickLoopPointsButton, this, BC_LoopPointButton); - Bind(wxEVT_TEXT_ENTER, &MainFrame::OnEnterLoopPoints, this, BC_LoopPointText); - Bind(wxEVT_TEXT_ENTER, &MainFrame::OnEnterLoopPoints, this, BC_LoopPointText); + // Bind(wxEVT_TOGGLEBUTTON, &MainFrame::OnClickLoopABButton, this, BC_LoopABButton); Bind(wxEVT_CHECKBOX, &MainFrame::OnCheckAutoplay, this, BC_Autoplay); Bind(wxEVT_SCROLL_THUMBTRACK, &MainFrame::OnSlideVolume, this, BC_Volume); Bind(wxEVT_SCROLL_THUMBRELEASE, &MainFrame::OnReleaseVolumeSlider, this, BC_Volume); @@ -442,20 +461,17 @@ MainFrame::MainFrame() m_TopSizer->Add(m_TopSplitter, 1, wxALL | wxEXPAND, 0); - m_BrowserControlSizer->Add(m_PlayButton, 0, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 2); - m_BrowserControlSizer->Add(m_LoopButton, 0, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 2); - m_BrowserControlSizer->Add(m_StopButton, 0, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 2); - m_BrowserControlSizer->Add(m_SettingsButton, 0, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 2); + m_BrowserControlSizer->Add(m_PlayButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); + m_BrowserControlSizer->Add(m_StopButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); + m_BrowserControlSizer->Add(m_LoopButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); + m_BrowserControlSizer->Add(m_LoopABButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); + m_BrowserControlSizer->Add(m_SettingsButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); m_BrowserControlSizer->Add(0,0,1, wxALL | wxEXPAND, 0); - m_BrowserControlSizer->Add(m_SamplePosition, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 2); + m_BrowserControlSizer->Add(m_SamplePosition, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); m_BrowserControlSizer->Add(30,0,0, wxALL | wxEXPAND, 0); - m_BrowserControlSizer->Add(m_LoopPointAButton, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 2); - m_BrowserControlSizer->Add(m_LoopPointAText, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 2); - m_BrowserControlSizer->Add(m_LoopPointBButton, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 2); - m_BrowserControlSizer->Add(m_LoopPointBText, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 2); - m_BrowserControlSizer->Add(m_MuteButton, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 2); - m_BrowserControlSizer->Add(m_VolumeSlider, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 2); - m_BrowserControlSizer->Add(m_AutoPlayCheck, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 2); + m_BrowserControlSizer->Add(m_MuteButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); + m_BrowserControlSizer->Add(m_VolumeSlider, 1, wxALL | wxALIGN_CENTER_VERTICAL, 2); + m_BrowserControlSizer->Add(m_AutoPlayCheck, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); m_TopPanelMainSizer->Add(m_TopWaveformPanel, 1, wxALL | wxEXPAND, 2); m_TopPanelMainSizer->Add(m_TopControlsPanel, 0, wxALL | wxEXPAND, 2); @@ -943,7 +959,7 @@ void MainFrame::OnClickPlay(wxCommandEvent& event) wxString sample_path = GetFilenamePathAndExtension(selection).Path; - if (bLoop && m_LoopPointAButton->GetValue() && m_LoopPointBButton->GetValue()) + if (bLoopPointsSet && m_LoopABButton->GetValue()) PlaySample(sample_path.ToStdString(), selection.ToStdString(), true, m_LoopA.ToDouble(), wxFromStart); else PlaySample(sample_path.ToStdString(), selection.ToStdString()); @@ -952,17 +968,9 @@ void MainFrame::OnClickPlay(wxCommandEvent& event) void MainFrame::OnClickLoop(wxCommandEvent& event) { if (m_LoopButton->GetValue()) - { bLoop = true; - m_LoopPointAButton->Enable(true); - m_LoopPointBButton->Enable(true); - } else - { bLoop = false; - m_LoopPointAButton->Disable(); - m_LoopPointBButton->Disable(); - } } void MainFrame::OnClickStop(wxCommandEvent& event) @@ -1041,7 +1049,7 @@ void MainFrame::UpdateElapsedTime(wxTimerEvent& event) m_TopControlsPanel->Refresh(); m_TopWaveformPanel->Refresh(); - if (bLoop && m_LoopPointAButton->GetValue() && m_LoopPointBButton->GetValue()) + if (bLoopPointsSet && m_LoopABButton->GetValue()) if (static_cast(m_MediaCtrl->Tell()) >= m_LoopB.ToDouble()) m_MediaCtrl->Seek(m_LoopA.ToDouble(), wxFromStart); } @@ -1106,6 +1114,8 @@ void MainFrame::OnClickLibrary(wxDataViewEvent& event) // Update the waveform bitmap m_TopWaveformPanel->ResetDC(); + m_LoopABButton->SetValue(false); + if (m_Timer->IsRunning()) { m_Timer->Stop(); @@ -1153,11 +1163,13 @@ void MainFrame::OnClickLibrary(wxDataViewEvent& event) if (bAutoplay) { - if (bLoop && m_LoopPointAButton->GetValue() && m_LoopPointBButton->GetValue()) + if (bLoopPointsSet && m_LoopABButton->GetValue()) PlaySample(sample_path.ToStdString(), selection.ToStdString(), true, m_LoopA.ToDouble(), wxFromStart); else PlaySample(sample_path.ToStdString(), selection.ToStdString()); } + else + m_MediaCtrl->Stop(); } else { @@ -2711,7 +2723,7 @@ void MainFrame::OnHiveStartEditing(wxDataViewEvent &event) void MainFrame::OnSelectAddFile(wxCommandEvent& event) { - wxFileDialog file_dialog(this, wxFileSelectorPromptStr, wxStandardPaths::Get().GetDocumentsDir(), + wxFileDialog file_dialog(this, wxFileSelectorPromptStr, wxGetHomeDir(), wxEmptyString, wxFileSelectorDefaultWildcardStr, wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE | wxFD_PREVIEW, wxDefaultPosition, wxDefaultSize); @@ -2734,7 +2746,7 @@ void MainFrame::OnSelectAddFile(wxCommandEvent& event) void MainFrame::OnSelectAddDirectory(wxCommandEvent& event) { - wxDirDialog dir_dialog(this, wxDirSelectorPromptStr, wxStandardPaths::Get().GetDocumentsDir(), + wxDirDialog dir_dialog(this, wxDirSelectorPromptStr, wxGetHomeDir(), wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST, wxDefaultPosition, wxDefaultSize); switch (dir_dialog.ShowModal()) @@ -2923,35 +2935,9 @@ void MainFrame::SetAfterFrameCreate() m_BottomSplitter->SetSashPosition(300); } -void MainFrame::OnClickLoopPointsButton(wxCommandEvent& event) +void MainFrame::OnClickLoopABButton(wxCommandEvent& event) { wxLogDebug("Loop point button clicked"); - - if (bLoop) - { - m_LoopPointAButton->Enable(true); - m_LoopPointBButton->Enable(true); - - if (m_LoopPointAButton->GetValue()) - m_LoopPointAText->Enable(true); - else - m_LoopPointAText->Disable(); - - if (m_LoopPointBButton->GetValue()) - m_LoopPointBText->Enable(true); - else - m_LoopPointBText->Disable(); - } - else - { - m_LoopPointAButton->Disable(); - m_LoopPointBButton->Disable(); - } -} - -void MainFrame::OnEnterLoopPoints(wxCommandEvent& event) -{ - wxLogDebug("Loop point text changed"); } void MainFrame::OnRecieveLoopPoints(SampleHive::SH_LoopPointsEvent& event) @@ -2971,8 +2957,9 @@ void MainFrame::OnRecieveLoopPoints(SampleHive::SH_LoopPointsEvent& event) wxLogDebug(wxString::Format("LoopA: %2i:%02i, LoopB: %2i:%02i", loopA_min, loopA_sec, loopB_min, loopB_sec)); - m_LoopPointAText->SetValue(wxString::Format("%2i:%02i", loopA_min, loopA_sec)); - m_LoopPointBText->SetValue(wxString::Format("%2i:%02i", loopB_min, loopB_sec)); + m_LoopABButton->SetValue(true); + + bLoopPointsSet = true; wxLogDebug("%s Event processed successfully..", __FUNCTION__); } @@ -2986,14 +2973,10 @@ void MainFrame::OnRecieveStatusBarStatus(SampleHive::SH_SetStatusBarMessageEvent void MainFrame::ClearLoopPoints() { - m_LoopPointAText->SetValue("00:00"); - m_LoopPointBText->SetValue("00:00"); - - m_LoopPointAButton->Disable(); - m_LoopPointBButton->Disable(); - m_LoopA = 0; m_LoopB = 0; + + bLoopPointsSet = false; } void MainFrame::PlaySample(const std::string& filepath, const std::string& sample, bool seek, wxFileOffset where, wxSeekMode mode) diff --git a/src/MainFrame.hpp b/src/MainFrame.hpp index 27320cc..d90c47b 100644 --- a/src/MainFrame.hpp +++ b/src/MainFrame.hpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -40,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -51,9 +53,9 @@ #include #include -#include +#include #include -#include +#include #include "WaveformViewer.hpp" #include "SH_Event.hpp" @@ -115,15 +117,12 @@ class MainFrame : public wxFrame wxBoxSizer* m_TopPanelMainSizer; wxBoxSizer* m_WaveformDisplaySizer; wxBoxSizer* m_BrowserControlSizer; - wxButton* m_PlayButton; - wxToggleButton* m_LoopButton; - wxButton* m_StopButton; + wxBitmapButton* m_PlayButton; + wxBitmapToggleButton* m_LoopButton; + wxBitmapButton* m_StopButton; wxButton* m_SettingsButton; - wxToggleButton* m_MuteButton; - wxToggleButton* m_LoopPointAButton; - wxToggleButton* m_LoopPointBButton; - wxTextCtrl* m_LoopPointAText; - wxTextCtrl* m_LoopPointBText; + wxBitmapToggleButton* m_MuteButton; + wxBitmapToggleButton* m_LoopABButton; wxStaticText* m_SamplePosition; wxSlider* m_VolumeSlider; wxCheckBox* m_AutoPlayCheck; @@ -179,6 +178,10 @@ class MainFrame : public wxFrame bool bMuted = false; bool bStopped = false; bool bFiltered = false; + bool bLoopPointsSet = false; + + // ------------------------------------------------------------------- + wxSystemAppearance m_Theme = wxSystemSettings::GetAppearance(); // ------------------------------------------------------------------- const std::string m_ConfigFilepath; @@ -196,8 +199,7 @@ class MainFrame : public wxFrame void OnSlideVolume(wxScrollEvent& event); void OnReleaseVolumeSlider(wxScrollEvent& event); void OnClickSettings(wxCommandEvent& event); - void OnClickLoopPointsButton(wxCommandEvent& event); - void OnEnterLoopPoints(wxCommandEvent& event); + void OnClickLoopABButton(wxCommandEvent& event); // ------------------------------------------------------------------- // DirCtrl event handlers diff --git a/src/Serialize.cpp b/src/Serialize.cpp index 93835bb..93568a8 100644 --- a/src/Serialize.cpp +++ b/src/Serialize.cpp @@ -23,7 +23,7 @@ #include #include -#include +// #include #include #include @@ -42,7 +42,7 @@ Serializer::Serializer(const std::string& filepath) wxColour colour = "#FE9647"; - std::string dir = wxStandardPaths::Get().GetDocumentsDir().ToStdString(); + std::string dir = wxGetHomeDir().ToStdString(); if (!ifstrm) { diff --git a/src/SettingsDialog.cpp b/src/SettingsDialog.cpp index dfc3a9d..c8a7f0e 100644 --- a/src/SettingsDialog.cpp +++ b/src/SettingsDialog.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +// #include #include #include "ControlID_Enums.hpp" @@ -73,7 +73,7 @@ Settings::Settings(wxWindow* window, const std::string& configFilepath, const st m_CollectionImportDirSizer = new wxBoxSizer(wxHORIZONTAL); m_ShowFileExtensionSizer = new wxBoxSizer(wxHORIZONTAL); - wxString defaultDir = wxStandardPaths::Get().GetDocumentsDir(); + wxString defaultDir = wxGetHomeDir(); m_AutoImportCheck = new wxCheckBox(m_CollectionSettingPanel, SD_AutoImport, "Auto import", wxDefaultPosition, wxDefaultSize, 0); m_ImportDirLocation = new wxTextCtrl(m_CollectionSettingPanel, wxID_ANY, defaultDir, wxDefaultPosition, wxDefaultSize, 0); @@ -118,29 +118,29 @@ Settings::Settings(wxWindow* window, const std::string& configFilepath, const st // Adding controls to sizers m_NotebookSizer->Add(m_Notebook, 1, wxALL | wxEXPAND, 2); - m_GeneralMainSizer->Add(m_ConfigLabel, 0, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 2); + m_GeneralMainSizer->Add(m_ConfigLabel, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); m_GeneralMainSizer->Add(m_ConfigText, 1, wxALL | wxALIGN_CENTER_VERTICAL | wxEXPAND, 2); - m_GeneralMainSizer->Add(m_ConfigBrowse, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 2); + m_GeneralMainSizer->Add(m_ConfigBrowse, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); - m_GeneralMainSizer->Add(m_DatabaseLabel, 0, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 2); + m_GeneralMainSizer->Add(m_DatabaseLabel, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); m_GeneralMainSizer->Add(m_DatabaseText, 1, wxALL | wxALIGN_CENTER_VERTICAL | wxEXPAND, 2); - m_GeneralMainSizer->Add(m_DatabaseBrowse, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 2); + m_GeneralMainSizer->Add(m_DatabaseBrowse, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); m_DisplayFontSizer->Add(m_FontTypeText, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); m_DisplayFontSizer->Add(m_FontType, 1, wxALL | wxALIGN_CENTER_VERTICAL, 2); m_DisplayFontSizer->Add(m_FontSize, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); - m_DisplayFontSizer->Add(m_FontBrowseButton, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 2); + m_DisplayFontSizer->Add(m_FontBrowseButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); m_WaveformColourSizer->Add(m_WaveformColourLabel, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); m_WaveformColourSizer->Add(m_WaveformColourPickerCtrl, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); m_DisplayTopSizer->Add(m_DisplayFontSizer, 0, wxALL | wxEXPAND, 2); m_DisplayTopSizer->Add(m_WaveformColourSizer, 0, wxALL | wxEXPAND, 2); - m_CollectionImportDirSizer->Add(m_AutoImportCheck, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 2); + m_CollectionImportDirSizer->Add(m_AutoImportCheck, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); m_CollectionImportDirSizer->Add(m_ImportDirLocation, 1, wxALL | wxALIGN_CENTER_VERTICAL, 2); - m_CollectionImportDirSizer->Add(m_BrowseAutoImportDirButton, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 2); + m_CollectionImportDirSizer->Add(m_BrowseAutoImportDirButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2); - m_ShowFileExtensionSizer->Add(m_ShowFileExtensionCheck, 0, wxALL | wxALIGN_LEFT, 2); + m_ShowFileExtensionSizer->Add(m_ShowFileExtensionCheck, 0, wxALL, 2); m_CollectionTopSizer->Add(m_CollectionImportDirSizer, 0, wxALL | wxEXPAND, 2); m_CollectionTopSizer->Add(m_ShowFileExtensionSizer, 0, wxALL | wxEXPAND, 2); @@ -178,7 +178,7 @@ Settings::Settings(wxWindow* window, const std::string& configFilepath, const st void Settings::OnClickConfigBrowse(wxCommandEvent& event) { - wxString initial_dir = wxStandardPaths::Get().GetDocumentsDir(); + wxString initial_dir = wxGetHomeDir(); m_DirDialog = new wxDirDialog(this, "Select a directory..", initial_dir, wxDD_DEFAULT_STYLE | @@ -201,7 +201,7 @@ void Settings::OnClickConfigBrowse(wxCommandEvent& event) void Settings::OnClickDatabaseBrowse(wxCommandEvent& event) { - wxString initial_dir = wxStandardPaths::Get().GetDocumentsDir(); + wxString initial_dir = wxGetHomeDir(); m_DirDialog = new wxDirDialog(this, "Select a directory..", initial_dir, wxDD_DEFAULT_STYLE | @@ -264,7 +264,7 @@ void Settings::OnClickBrowseAutoImportDir(wxCommandEvent& event) { Serializer serializer(m_ConfigFilepath); - wxString initial_dir = wxStandardPaths::Get().GetDocumentsDir(); + wxString initial_dir = wxGetHomeDir(); m_DirDialog = new wxDirDialog(this, "Select a directory..", initial_dir, wxDD_DEFAULT_STYLE | diff --git a/src/Tags.cpp b/src/Tags.cpp index 69089d9..9a6947d 100644 --- a/src/Tags.cpp +++ b/src/Tags.cpp @@ -18,9 +18,9 @@ * along with this program. If not, see . */ -#include +#include #include -#include +#include #include "Tags.hpp" diff --git a/src/WaveformViewer.cpp b/src/WaveformViewer.cpp index 805b03b..15715c0 100644 --- a/src/WaveformViewer.cpp +++ b/src/WaveformViewer.cpp @@ -233,7 +233,7 @@ void WaveformViewer::UpdateWaveformBitmap() // Draw code wxMemoryDC mdc(m_WaveformBitmap); - mdc.SetBrush(*wxBLACK); + mdc.SetBackground(wxBrush(wxColour(0, 0, 0, 150), wxBRUSHSTYLE_SOLID)); mdc.Clear(); m_WaveformColour = serializer.DeserializeWaveformColour(); diff --git a/subprojects/taglib.wrap b/subprojects/taglib.wrap new file mode 100644 index 0000000..503feef --- /dev/null +++ b/subprojects/taglib.wrap @@ -0,0 +1,3 @@ +[wrap-git] +url = https://github.com/taglib/taglib.git +revision = master diff --git a/subprojects/wxwidgets.wrap b/subprojects/wxwidgets.wrap new file mode 100644 index 0000000..301cf22 --- /dev/null +++ b/subprojects/wxwidgets.wrap @@ -0,0 +1,3 @@ +[wrap-git] +url = https://github.com/wxWidgets/wxWidgets +revision = master