00001
00025 #if defined(__GNUG__) && !defined(__APPLE__)
00026 #pragma implementation "OutputDevDlg.h"
00027 #endif
00028
00029
00030 #include "wx/wxprec.h"
00031
00032 #ifdef __BORLANDC__
00033 #pragma hdrstop
00034 #endif
00035
00036 #ifndef WX_PRECOMP
00037 #include "wx/wx.h"
00038 #else
00039 #include "wx/filedlg.h"
00040 #endif
00041
00044
00045 #include "OutputDevDlg.h"
00046
00049
00050 #include "valNum.h"
00051
00056 IMPLEMENT_DYNAMIC_CLASS( OutputDevDlg, wxDialog )
00057
00058
00062 BEGIN_EVENT_TABLE( OutputDevDlg, wxDialog )
00063
00065 EVT_CHOICE( ID_CHOICE2, OutputDevDlg::OnChoice2Selected )
00066
00067 EVT_BUTTON( ID_BUTTON2, OutputDevDlg::OnButton2Click )
00068
00069 EVT_BUTTON( ID_BUTTON3, OutputDevDlg::OnButton3Click )
00070
00071 EVT_BUTTON( wxID_REMOVE, OutputDevDlg::OnRemoveClick )
00072
00074
00075 END_EVENT_TABLE()
00076
00081 OutputDevDlg::OutputDevDlg( )
00082 {}
00083
00084 OutputDevDlg::OutputDevDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00085 {
00086 Create(parent, id, caption, pos, size, style);
00087 }
00088
00093 bool OutputDevDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00094 {
00096 ctrlPanel = NULL;
00097 ctrlType = NULL;
00098 ctrlMidiDevicePanel = NULL;
00099 ctrlMidiDevice = NULL;
00100 ctrlMidiFilePanel = NULL;
00101 ctrlMidiFile = NULL;
00102 ctrlGUIDOFilePanel = NULL;
00103 ctrlGUIDOFile = NULL;
00105
00107 SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
00108 wxDialog::Create( parent, id, caption, pos, size, style );
00109
00110 CreateControls();
00111 GetSizer()->Fit(this);
00112 GetSizer()->SetSizeHints(this);
00113 Centre();
00115 return TRUE;
00116 }
00117
00122 void OutputDevDlg::CreateControls()
00123 {
00125 OutputDevDlg* itemDialog1 = this;
00126
00127 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
00128 itemDialog1->SetSizer(itemBoxSizer2);
00129
00130 wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
00131 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00132
00133 ctrlPanel = new wxBoxSizer(wxVERTICAL);
00134 itemBoxSizer3->Add(ctrlPanel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
00135
00136 wxStaticBox* itemStaticBoxSizer5Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Device Type"));
00137 wxStaticBoxSizer* itemStaticBoxSizer5 = new wxStaticBoxSizer(itemStaticBoxSizer5Static, wxHORIZONTAL);
00138 ctrlPanel->Add(itemStaticBoxSizer5, 0, wxGROW|wxALL, 5);
00139
00140 wxString ctrlTypeStrings[] = {
00141 _("Midi Device"),
00142 _("Midi File"),
00143 _("GUIDO File")
00144 };
00145 ctrlType = new wxChoice( itemDialog1, ID_CHOICE2, wxDefaultPosition, wxDefaultSize, 3, ctrlTypeStrings, 0 );
00146 ctrlType->SetStringSelection(_("Midi Device"));
00147 itemStaticBoxSizer5->Add(ctrlType, 1, wxALIGN_CENTER_VERTICAL|wxALL, 0);
00148
00149 wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Midi Device"));
00150 ctrlMidiDevicePanel = new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL);
00151 ctrlPanel->Add(ctrlMidiDevicePanel, 0, wxGROW|wxALL, 5);
00152
00153 wxString* ctrlMidiDeviceStrings = NULL;
00154 ctrlMidiDevice = new wxChoice( itemDialog1, ID_CHOICE3, wxDefaultPosition, wxDefaultSize, 0, ctrlMidiDeviceStrings, 0 );
00155 ctrlMidiDevicePanel->Add(ctrlMidiDevice, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
00156
00157 wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
00158 ctrlMidiDevicePanel->Add(itemBoxSizer9, 0, wxALIGN_RIGHT|wxALL, 0);
00159
00160 wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("Bending Range"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
00161 itemBoxSizer9->Add(itemStaticText10, 1, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 5);
00162
00163 wxTextCtrl* itemTextCtrl11 = new wxTextCtrl( itemDialog1, ID_TEXTCTRL4, _T(""), wxDefaultPosition, wxSize(40, -1), 0 );
00164 itemBoxSizer9->Add(itemTextCtrl11, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
00165
00166 wxStaticBox* itemStaticBoxSizer12Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Midi File"));
00167 ctrlMidiFilePanel = new wxStaticBoxSizer(itemStaticBoxSizer12Static, wxVERTICAL);
00168 ctrlPanel->Add(ctrlMidiFilePanel, 0, wxGROW|wxALL, 5);
00169
00170 ctrlMidiFile = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
00171 ctrlMidiFilePanel->Add(ctrlMidiFile, 0, wxGROW|wxALL, 0);
00172
00173 wxButton* itemButton14 = new wxButton( itemDialog1, ID_BUTTON2, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
00174 ctrlMidiFilePanel->Add(itemButton14, 0, wxALIGN_RIGHT|wxLEFT|wxTOP, 5);
00175
00176 wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxHORIZONTAL);
00177 ctrlMidiFilePanel->Add(itemBoxSizer15, 0, wxALIGN_RIGHT|wxALL, 0);
00178
00179 wxStaticText* itemStaticText16 = new wxStaticText( itemDialog1, wxID_STATIC, _("Bending Range"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
00180 itemBoxSizer15->Add(itemStaticText16, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 5);
00181
00182 wxTextCtrl* itemTextCtrl17 = new wxTextCtrl( itemDialog1, ID_TEXTCTRL5, _T(""), wxDefaultPosition, wxSize(40, -1), 0 );
00183 itemBoxSizer15->Add(itemTextCtrl17, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
00184
00185 wxStaticBox* itemStaticBoxSizer18Static = new wxStaticBox(itemDialog1, wxID_ANY, _("GUIDO File"));
00186 ctrlGUIDOFilePanel = new wxStaticBoxSizer(itemStaticBoxSizer18Static, wxVERTICAL);
00187 ctrlPanel->Add(ctrlGUIDOFilePanel, 0, wxGROW|wxALL, 5);
00188
00189 ctrlGUIDOFile = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
00190 ctrlGUIDOFilePanel->Add(ctrlGUIDOFile, 0, wxGROW|wxALL, 0);
00191
00192 wxButton* itemButton20 = new wxButton( itemDialog1, ID_BUTTON3, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
00193 ctrlGUIDOFilePanel->Add(itemButton20, 0, wxALIGN_RIGHT|wxLEFT|wxTOP, 5);
00194
00195 wxBoxSizer* itemBoxSizer21 = new wxBoxSizer(wxVERTICAL);
00196 itemBoxSizer3->Add(itemBoxSizer21, 0, wxALIGN_TOP|wxALL, 5);
00197
00198 wxButton* itemButton22 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
00199 itemBoxSizer21->Add(itemButton22, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00200
00201 wxButton* itemButton23 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
00202 itemBoxSizer21->Add(itemButton23, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00203
00204 wxButton* itemButton24 = new wxButton( itemDialog1, wxID_REMOVE, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
00205 itemBoxSizer21->Add(itemButton24, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00206
00207 wxButton* itemButton25 = new wxButton( itemDialog1, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
00208 itemBoxSizer21->Add(itemButton25, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00209
00210
00211 ctrlType->SetValidator( wxGenericValidator(& Type) );
00212 ctrlMidiDevice->SetValidator( wxGenericValidator(& MidiDevice) );
00213 itemTextCtrl11->SetValidator( wxNumValidator(& MidiDeviceBending, NV_BOTH, 0, 12) );
00214 ctrlMidiFile->SetValidator( wxTextValidator(wxFILTER_NONE, & MidiFile) );
00215 itemTextCtrl17->SetValidator( wxNumValidator(& MidiFileBending, NV_BOTH, 0, 12) );
00216 ctrlGUIDOFile->SetValidator( wxTextValidator(wxFILTER_NONE, & GUIDOFile) );
00218 }
00219
00224 bool OutputDevDlg::ShowToolTips()
00225 {
00226 return TRUE;
00227 }
00228
00233 wxBitmap OutputDevDlg::GetBitmapResource( const wxString& name )
00234 {
00235
00237 return wxNullBitmap;
00239 }
00240
00245 wxIcon OutputDevDlg::GetIconResource( const wxString& name )
00246 {
00247
00249 return wxNullIcon;
00251 }
00252
00257 void OutputDevDlg::OnChoice2Selected( wxCommandEvent& event )
00258 {
00259 UpdateLayout(ctrlType->GetSelection());
00261
00262 event.Skip();
00264 }
00265
00266
00267 void OutputDevDlg::UpdateLayout(int type)
00268
00269 {
00270 ctrlPanel->Show(ctrlMidiDevicePanel, type == 0, true);
00271 ctrlPanel->Show(ctrlMidiFilePanel, type == 1, true);
00272 ctrlPanel->Show(ctrlGUIDOFilePanel, type == 2, true);
00273 ctrlPanel->Layout();
00274 GetSizer()->SetSizeHints(this);
00275 Fit();
00276 }
00277
00282 void OutputDevDlg::OnRemoveClick( wxCommandEvent& event )
00283 {
00284 EndModal(wxID_REMOVE);
00285 }
00286
00287
00292 void OutputDevDlg::OnButton2Click( wxCommandEvent& event )
00293 {
00294 wxString OldFileName;
00295
00296 if ( !ctrlMidiFile->GetValue().empty() )
00297 OldFileName = ctrlMidiFile->GetValue();
00298
00299 wxString NewFileName = wxFileSelector(_("Select Midi-File file"),
00300 _T(""), OldFileName, _T(""), _("Midi-file (*.mid*)|*.mid*|All files (*.*)|*.*"),
00301 #ifdef __WXCOCOA__
00302 0);
00303
00304 #else
00305 wxFD_OPEN | wxFD_FILE_MUST_EXIST);
00306 #endif
00307 if ( !NewFileName.empty() )
00308 ctrlMidiFile->SetValue(NewFileName);
00309 event.Skip();
00310 }
00311
00316 void OutputDevDlg::OnButton3Click( wxCommandEvent& event )
00317 {
00318 wxString OldFileName;
00319
00320 if ( !ctrlMidiFile->GetValue().empty() )
00321 OldFileName = ctrlMidiFile->GetValue();
00322
00323 wxString NewFileName = wxFileSelector(_("Select Midi-File file"),
00324 _T(""), OldFileName, _T(""), _("GUIDO-file (*.gmn)|*.gmn|All files (*.*)|*.*"),
00325 #ifdef __WXCOCOA__
00326 0);
00327
00328 #else
00329 wxFD_OPEN | wxFD_FILE_MUST_EXIST);
00330 #endif
00331 if ( !NewFileName.empty() )
00332 ctrlMidiFile->SetValue(NewFileName);
00333 event.Skip();
00334 }
00335
00336
00337
00338