From: <pst...@us...> - 2010-07-18 03:14:53
|
Revision: 816 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=816&view=rev Author: pstieber Date: 2010-07-18 03:14:47 +0000 (Sun, 18 Jul 2010) Log Message: ----------- Added code to set the sample wav file. Modified Paths: -------------- trunk/jazz/src/Dialogs/SamplesDialog.cpp trunk/jazz/src/Dialogs/SamplesDialog.h trunk/jazz/src/Resources.h Modified: trunk/jazz/src/Dialogs/SamplesDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/SamplesDialog.cpp 2010-07-18 03:13:45 UTC (rev 815) +++ trunk/jazz/src/Dialogs/SamplesDialog.cpp 2010-07-18 03:14:47 UTC (rev 816) @@ -21,8 +21,12 @@ #include "SamplesDialog.h" #include "../Audio.h" +#include "../Resources.h" +#include "../Sample.h" #include <wx/button.h> +#include <wx/filedlg.h> +#include <wx/filename.h> #include <wx/listbox.h> #include <wx/sizer.h> #include <wx/slider.h> @@ -33,8 +37,15 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(JZSamplesDialog, wxDialog) + EVT_BUTTON(IDC_BN_SD_FILE_SELECT_BROWSE, OnSelectSampleFile) +END_EVENT_TABLE() + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- JZSamplesDialog::JZSamplesDialog(wxWindow* pParent, JZSampleSet& SampleSet) : wxDialog(pParent, wxID_ANY, wxString("Samples Settings")), + mSampleSet(SampleSet), mpListBox(0), mpLabelEdit(0), mpFileNameEdit(0), @@ -65,8 +76,7 @@ mpFileNameBrowseButton = new wxButton( this, - wxID_ANY, -// IDC_BN_SD_FILE_SELECT_BROWSE, + IDC_BN_SD_FILE_SELECT_BROWSE, "Browse..."); mpVolumeSlider = new wxSlider( @@ -179,3 +189,30 @@ pTopSizer->SetSizeHints(this); pTopSizer->Fit(this); } + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZSamplesDialog::OnSelectSampleFile(wxCommandEvent& Event) +{ + int Selection = mpListBox->GetSelection(); + if (Selection != wxNOT_FOUND) + { + wxFileDialog FileOpenDialog( + this, + "Choose a sound file", + wxEmptyString, + wxEmptyString, + "WAV files (*.wav)|*.wav", + wxFD_OPEN | wxFD_CHANGE_DIR); + if (FileOpenDialog.ShowModal() == wxID_OK) + { + wxFileName FileName = FileOpenDialog.GetPath(); + mSampleSet[Selection].SetFileName(FileName.GetFullPath()); + mpFileNameEdit->ChangeValue(FileName.GetFullPath()); + mpLabelEdit->ChangeValue(FileName.GetName()); + wxString Label; + Label << Selection + 1 << ' ' << FileName.GetFullName(); + mpListBox->SetString(Selection, Label); + } + } +} Modified: trunk/jazz/src/Dialogs/SamplesDialog.h =================================================================== --- trunk/jazz/src/Dialogs/SamplesDialog.h 2010-07-18 03:13:45 UTC (rev 815) +++ trunk/jazz/src/Dialogs/SamplesDialog.h 2010-07-18 03:14:47 UTC (rev 816) @@ -41,6 +41,12 @@ private: + void OnSelectSampleFile(wxCommandEvent& Event); + + private: + + JZSampleSet& mSampleSet; + wxListBox* mpListBox; wxTextCtrl* mpLabelEdit; wxTextCtrl* mpFileNameEdit; @@ -48,6 +54,8 @@ wxSlider* mpVolumeSlider; wxSlider* mpPanSlider; wxSlider* mpPitchSlider; + + DECLARE_EVENT_TABLE() }; #endif // !defined(JZ_SAMPLESDIALOG_H) Modified: trunk/jazz/src/Resources.h =================================================================== --- trunk/jazz/src/Resources.h 2010-07-18 03:13:45 UTC (rev 815) +++ trunk/jazz/src/Resources.h 2010-07-18 03:14:47 UTC (rev 816) @@ -136,4 +136,7 @@ // JZTransposeDialog resource IDs. #define IDC_KB_AMOUNT wxID_HIGHEST + 1232 +// JZSamplesDialog resource IDs. +#define IDC_BN_SD_FILE_SELECT_BROWSE wxID_HIGHEST + 1240 + #endif // !defined(JZ_RESOURCES_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |