|
From: <pst...@us...> - 2008-12-30 22:53:39
|
Revision: 661
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=661&view=rev
Author: pstieber
Date: 2008-12-30 22:53:35 +0000 (Tue, 30 Dec 2008)
Log Message:
-----------
1. Added some pointers to the initializer list.
2. Put the code that initializes the patch list in a separate member function called
SetPatchListEntries.
3. Added code to determine if the track is changing from or to a drum channel and
update the patch list if this changes.
Modified Paths:
--------------
trunk/jazz/src/Dialogs/TrackDialog.cpp
trunk/jazz/src/Dialogs/TrackDialog.h
Modified: trunk/jazz/src/Dialogs/TrackDialog.cpp
===================================================================
--- trunk/jazz/src/Dialogs/TrackDialog.cpp 2008-12-27 18:49:04 UTC (rev 660)
+++ trunk/jazz/src/Dialogs/TrackDialog.cpp 2008-12-30 22:53:35 UTC (rev 661)
@@ -53,47 +53,17 @@
JZTrackDialog::JZTrackDialog(JZTrack& Track, wxWindow* pParent)
: wxDialog(pParent, wxID_ANY, wxString("Track Settings")),
mTrack(Track),
+ mLastTrackChannelWasDrums(Track.IsDrumTrack()),
mpTrackNameEdit(0),
- mpPatchListBox(0)
+ mpPatchListBox(0),
+ mpChannelValue(0),
+ mpChannelKnob(0)
{
mpTrackNameEdit = new wxTextCtrl(this, wxID_ANY);
mpPatchListBox = new wxListBox(this, wxID_ANY);
- if (mTrack.IsDrumTrack())
- {
- const vector<pair<string, int> >& DrumSets = gpConfig->GetDrumSets();
- for (
- vector<pair<string, int> >::const_iterator iDrumSet =
- DrumSets.begin();
- iDrumSet != DrumSets.end();
- ++iDrumSet)
- {
- const string& DrumSet = iDrumSet->first;
+ SetPatchListEntries();
- if (!DrumSet.empty())
- {
- mpPatchListBox->Append(DrumSet.c_str());
- }
- }
- }
- else
- {
- const vector<pair<string, int> >& VoiceNames = gpConfig->GetVoiceNames();
- for (
- vector<pair<string, int> >::const_iterator iVoiceName =
- VoiceNames.begin();
- iVoiceName != VoiceNames.end();
- ++iVoiceName)
- {
- const string& VoiceName = iVoiceName->first;
-
- if (!VoiceName.empty())
- {
- mpPatchListBox->Append(VoiceName.c_str());
- }
- }
- }
-
mpChannelValue = new wxStaticText(this, wxID_ANY, "00");
mpChannelKnob = new JZKnob(this, IDC_KB_CHANNEL, 0, 1, 16);
@@ -150,6 +120,48 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+void JZTrackDialog::SetPatchListEntries()
+{
+ mpPatchListBox->Clear();
+
+ if (mTrack.IsDrumTrack())
+ {
+ const vector<pair<string, int> >& DrumSets = gpConfig->GetDrumSets();
+ for (
+ vector<pair<string, int> >::const_iterator iDrumSet =
+ DrumSets.begin();
+ iDrumSet != DrumSets.end();
+ ++iDrumSet)
+ {
+ const string& DrumSet = iDrumSet->first;
+
+ if (!DrumSet.empty())
+ {
+ mpPatchListBox->Append(DrumSet.c_str());
+ }
+ }
+ }
+ else
+ {
+ const vector<pair<string, int> >& VoiceNames = gpConfig->GetVoiceNames();
+ for (
+ vector<pair<string, int> >::const_iterator iVoiceName =
+ VoiceNames.begin();
+ iVoiceName != VoiceNames.end();
+ ++iVoiceName)
+ {
+ const string& VoiceName = iVoiceName->first;
+
+ if (!VoiceName.empty())
+ {
+ mpPatchListBox->Append(VoiceName.c_str());
+ }
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
bool JZTrackDialog::TransferDataToWindow()
{
mpTrackNameEdit->ChangeValue(mTrack.GetName());
@@ -195,6 +207,17 @@
ostringstream Oss;
Oss << Value;
mpChannelValue->SetLabel(Oss.str().c_str());
+ mTrack.Channel = Value;
+
+ // Test to determine if the track channel toggled in our out of drum mode.
+ if (mLastTrackChannelWasDrums != mTrack.IsDrumTrack())
+ {
+ // If it did switch, update the patch list entries.
+ SetPatchListEntries();
+ }
+
+ // Record if the current value for the channel indicates drums.
+ mLastTrackChannelWasDrums = mTrack.IsDrumTrack();
}
//-----------------------------------------------------------------------------
Modified: trunk/jazz/src/Dialogs/TrackDialog.h
===================================================================
--- trunk/jazz/src/Dialogs/TrackDialog.h 2008-12-27 18:49:04 UTC (rev 660)
+++ trunk/jazz/src/Dialogs/TrackDialog.h 2008-12-30 22:53:35 UTC (rev 661)
@@ -40,6 +40,8 @@
private:
+ void SetPatchListEntries();
+
virtual bool TransferDataToWindow();
virtual bool TransferDataFromWindow();
@@ -52,6 +54,8 @@
JZTrack& mTrack;
+ bool mLastTrackChannelWasDrums;
+
wxTextCtrl* mpTrackNameEdit;
wxListBox* mpPatchListBox;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|