gehe zur Dokumentation dieser Datei00001
00049
00050 #include "wx/wxprec.h"
00051
00052 #ifdef __BORLANDC__
00053 #pragma hdrstop
00054 #endif
00055
00056 #ifndef WX_PRECOMP
00057 #include "wx/wx.h"
00058 #endif
00059
00060
00061
00062
00063 #include "OutputDevDlg.h"
00064
00069 IMPLEMENT_DYNAMIC_CLASS( OutputDevDlg, OutputDevDlgBase )
00070
00071 BEGIN_EVENT_TABLE( OutputDevDlg, OutputDevDlgBase )
00072 EVT_CHOICE( XRCID("DeviceChoice"), OutputDevDlg::OnChoiceSelected )
00073 EVT_BUTTON( ::wxID_REMOVE, OutputDevDlg::OnRemoveClick )
00074 EVT_FILEPICKER_CHANGED(XRCID ("MidiFilePicker"),
00075 OutputDevDlg::OnFileChanged)
00076 EVT_FILEPICKER_CHANGED(XRCID ("GuidoFilePicker"),
00077 OutputDevDlg::OnFileChanged)
00078 END_EVENT_TABLE()
00079
00083
00084
00085 OutputDevDlg::OutputDevDlg( wxWindow* parent):OutputDevDlgBase(parent)
00086 {
00087 DeviceChoice->Clear();
00088 DeviceChoice->Append(_("MIDI Device"),new TypeData(DTMidiPort));
00089 DeviceChoice->Append(_("MIDI file"),new TypeData(DTMidiFile));
00090 DeviceChoice->Append(_("GUIDO file"),new TypeData(DTGis));
00091
00092 TypeBox = DeviceChoice->GetContainingSizer();
00093 PortBox = PortChoice->GetContainingSizer();
00094 MidiFileBox = MidiFilePicker->GetContainingSizer();
00095 DEBUGLOG (other,_T ("MidiFilePicker Growable: %d"), MidiFilePicker->IsPickerCtrlGrowable());
00096 if (MidiFilePicker->HasTextCtrl()) {
00097 DEBUGLOG (other,_T ("MidiFileTextCtrl Growable: %d"),
00098 MidiFilePicker->IsTextCtrlGrowable());
00099 MidiFilePicker->SetTextCtrlGrowable(true);
00100 DEBUGLOG (other,_T ("MidiFileTextCtrl Growable: %d"),
00101 MidiFilePicker->IsTextCtrlGrowable());
00102 }
00103 GuidoFileBox = GuidoFilePicker->GetContainingSizer();
00104
00105
00106
00107
00108 }
00109
00114 bool OutputDevDlg::ShowToolTips()
00115 {
00116 return TRUE;
00117 }
00118
00123 wxBitmap OutputDevDlg::GetBitmapResource( const wxString& name )
00124 {
00125
00127 return wxNullBitmap;
00129 }
00130
00135 wxIcon OutputDevDlg::GetIconResource( const wxString& name )
00136 {
00137
00139 return wxNullIcon;
00141 }
00142
00147 void OutputDevDlg::OnChoiceSelected( wxCommandEvent& event )
00148 {
00149 DevType data = GetType();
00150 UpdateLayout(data);
00151 event.Skip();
00152 }
00153
00154 void OutputDevDlg::UpdateLayout(DevType type)
00155 {
00156 DEBUGLOG (other, _T("type: %d"),type);
00157 if (type == DTNotSet) {
00158 DEBUGLOG (other, _T("Type not set"));
00159 if (FindType (type) == wxNOT_FOUND)
00160 DeviceChoice->Insert (_ ("Choose device type"),
00161 0,
00162 new TypeData (type));
00163 } else {
00164 int notset = FindType (DTNotSet);
00165 if (notset != wxNOT_FOUND) {
00166 DeviceChoice->Delete (notset);
00167 }
00168
00169 if (type == DTUnknown) {
00170 if (FindType (type) == wxNOT_FOUND)
00171 DeviceChoice->Insert (_ ("Unknown device type"),
00172 0,
00173 new TypeData (type));
00174 }
00175 }
00176 int Type = FindType (type);
00177 DeviceChoice -> SetSelection (Type);
00178
00179 DEBUGLOG (other, _T("found Number %d (wxNOT_FOUND=%d)"),type,wxNOT_FOUND);
00180 wxSizer * sizer = GetSizer();
00181
00182 DEBUGLOG (other, _T("DTMidiPort=%d"),DTMidiPort);
00183 sizer->Show(PortBox, type == DTMidiPort, true);
00184 DEBUGLOG (other, _T("DTMidiFile=%d"),DTMidiFile);
00185 sizer->Show(MidiFileBox, (type == DTMidiFile), true);
00186 DEBUGLOG (other, _T("DTGis=%d"),DTGis);
00187 sizer->Show(GuidoFileBox, (type == DTGis) , true);
00188
00189
00190
00191
00192 Layout();
00193 GetSizer()->SetSizeHints(this);
00194 Fit();
00195 }
00196
00197
00202 void OutputDevDlg::OnRemoveClick( wxCommandEvent& event )
00203 {
00204 EndModal(::wxID_REMOVE);
00205 }
00206
00207 void OutputDevDlg::OnFileChanged ( wxFileDirPickerEvent & event )
00208 {
00209 DEBUGLOG (other,_T ("Path changed: %s"),event.GetPath().c_str());
00210 SetSize(wxDefaultSize);
00211 Layout();
00212 Fit();
00213 }
00214
00215
00216 int OutputDevDlg::FindType (DevType t)
00217 {
00218 TypeData * Data;
00219 for (unsigned int i = 0; i < DeviceChoice->GetCount(); i++) {
00220 DEBUGLOG (other,_T ("Choice #%d of %d"),i, DeviceChoice->GetCount());
00221 Data = (TypeData *)DeviceChoice->GetClientObject(i);
00222 if (Data) {
00223 if (*Data == t) return i;
00224 }
00225 }
00226 return wxNOT_FOUND;
00227 }
00228