|
From: <pst...@us...> - 2008-04-06 22:47:56
|
Revision: 427
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=427&view=rev
Author: pstieber
Date: 2008-04-06 15:47:54 -0700 (Sun, 06 Apr 2008)
Log Message:
-----------
Changed to record settings.
Modified Paths:
--------------
trunk/jazz/src/SynthesizerSettingsDialog.cpp
trunk/jazz/src/SynthesizerSettingsDialog.h
Modified: trunk/jazz/src/SynthesizerSettingsDialog.cpp
===================================================================
--- trunk/jazz/src/SynthesizerSettingsDialog.cpp 2008-04-06 22:47:03 UTC (rev 426)
+++ trunk/jazz/src/SynthesizerSettingsDialog.cpp 2008-04-06 22:47:54 UTC (rev 427)
@@ -30,6 +30,14 @@
//*****************************************************************************
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+BEGIN_EVENT_TABLE(JZSynthesizerDialog, wxDialog)
+
+ EVT_BUTTON(wxID_HELP, JZSynthesizerDialog::OnHelp)
+
+END_EVENT_TABLE()
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
JZSynthesizerDialog::JZSynthesizerDialog(wxWindow* pParent)
: wxDialog(pParent, wxID_ANY, wxString("Synthesizer Settings")),
mpSynthesizerListbox(0),
@@ -37,20 +45,14 @@
{
mpSynthesizerListbox = new wxListBox(this, wxID_ANY);
- int Selection = 0;
- int Index = 0;
for (
- vector<pair<string, int> >::const_iterator iPair = gSynthesizerTypes.begin();
+ vector<pair<string, int> >::const_iterator iPair =
+ gSynthesizerTypes.begin();
iPair != gSynthesizerTypes.end();
- ++iPair, ++Index)
+ ++iPair)
{
mpSynthesizerListbox->Append(iPair->first.c_str());
- if (strcmp(iPair->first.c_str(), gpConfig->StrValue(C_SynthType)) == 0)
- {
- Selection = Index;
- }
}
- mpSynthesizerListbox->SetSelection(Selection);
mpStartListbox = new wxListBox(this, wxID_ANY);
@@ -58,8 +60,6 @@
mpStartListbox->Append("Song Start");
mpStartListbox->Append("Start Play");
- mpStartListbox->SetSelection(gpConfig->GetValue(C_SendSynthReset));
-
wxButton* pOkButton = new wxButton(this, wxID_OK, "&OK");
wxButton* pCancelButton = new wxButton(this, wxID_CANCEL, "Cancel");
wxButton* pHelpButton = new wxButton(this, wxID_HELP, "Help");
@@ -103,3 +103,64 @@
pTopSizer->SetSizeHints(this);
pTopSizer->Fit(this);
}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZSynthesizerDialog::TransferDataToWindow()
+{
+ int Selection(0), Index(0);
+ for (
+ vector<pair<string, int> >::const_iterator iPair =
+ gSynthesizerTypes.begin();
+ iPair != gSynthesizerTypes.end();
+ ++iPair, ++Index)
+ {
+ if (strcmp(iPair->first.c_str(), gpConfig->StrValue(C_SynthType)) == 0)
+ {
+ mOldSynthTypeName = iPair->first;
+ Selection = Index;
+ }
+ }
+ mpSynthesizerListbox->SetSelection(Selection);
+
+ mpStartListbox->SetSelection(gpConfig->GetValue(C_SendSynthReset));
+
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZSynthesizerDialog::TransferDataFromWindow()
+{
+ string SynthTypeName(mOldSynthTypeName);
+ wxString SelectionString = mpSynthesizerListbox->GetStringSelection();
+ if (!SelectionString.empty())
+ {
+ SynthTypeName = SelectionString;
+ }
+
+ int Selection = mpStartListbox->GetSelection();
+ if (Selection != wxNOT_FOUND)
+ {
+ gpConfig->Put(C_SendSynthReset, Selection);
+ }
+
+ if (mOldSynthTypeName != SynthTypeName)
+ {
+ gpConfig->Put(C_SynthType, SynthTypeName.c_str());
+
+ ::wxMessageBox(
+ "Restart jazz for the synthesizer type change to take effect",
+ "Info",
+ wxOK);
+ }
+
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZSynthesizerDialog::OnHelp(wxCommandEvent& Event)
+{
+// gpHelpInstance->ShowTopic("Synthesizer Type Settings");
+}
Modified: trunk/jazz/src/SynthesizerSettingsDialog.h
===================================================================
--- trunk/jazz/src/SynthesizerSettingsDialog.h 2008-04-06 22:47:03 UTC (rev 426)
+++ trunk/jazz/src/SynthesizerSettingsDialog.h 2008-04-06 22:47:54 UTC (rev 427)
@@ -21,6 +21,8 @@
#ifndef JZ_SYNTHESIZERSETTINGDIALOG_H
#define JZ_SYNTHESIZERSETTINGDIALOG_H
+#include <string>
+
//*****************************************************************************
//*****************************************************************************
class JZSynthesizerDialog : public wxDialog
@@ -31,9 +33,21 @@
private:
+ virtual bool TransferDataToWindow();
+
+ virtual bool TransferDataFromWindow();
+
+ void OnHelp(wxCommandEvent& Event);
+
+ private:
+
+ std::string mOldSynthTypeName;
+
wxListBox* mpSynthesizerListbox;
wxListBox* mpStartListbox;
+
+ DECLARE_EVENT_TABLE();
};
#endif // !defined(JZ_SYNTHESIZERSETTINGDIALOG_H)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|