InputMidiFileDeviceShape.cpp
gehe zur Dokumentation dieser Datei
00001 // -*-C++ -*-
00002 
00069 #include "InputMidiFileDeviceShape.h"
00070 #include <limits>
00071 
00072 void MutInputMidiFileDeviceShape::InitializeDialog(InputDevDlg * in) const
00073 {
00074         wxASSERT(device);
00075         wxASSERT(device->GetType() == DTMidiFile);
00076         wxASSERT(in);
00077         in -> SetType(DTMidiFile);
00078         in -> SetMidiFile(device->GetName());
00079 }
00080 
00081 bool MutInputMidiFileDeviceShape::readDialog (InputDevDlg * in)
00082 {
00083         wxASSERT(device);
00084         wxASSERT(device->GetType() == DTMidiFile);
00085         wxASSERT(in);
00086         wxASSERT (in -> GetType() == DTMidiFile);
00087         device->SetName (in -> GetMidiFile());
00088         SetLabel (device->GetName());
00089         return true;
00090 }
00091 
00092 wxPanel * MutInputMidiFileDeviceShape::GetInputFilterPanel(wxWindow * parent, 
00093                                                        Route * route) const
00094 {
00095         const int maxint = std::numeric_limits<int>().max();
00096         MidiFileInputFilterPanel * panel = new MidiFileInputFilterPanel(parent);
00097         if (!panel) return NULL;
00098         InMidiFile * dev = dynamic_cast<InMidiFile *> (device);
00099         const int maxchannel = dev?dev->GetMaxChannel():maxint;
00100         const int minchannel = dev?dev->GetMinChannel():0;
00101         const int maxtrack = dev?dev->GetMaxTrack():maxint;
00102         const int mintrack = dev?dev->GetMinTrack():0;
00103         if (!route) {
00104                 panel->SetFromChannel(minchannel, minchannel, maxchannel);
00105                 panel->SetToChannel(maxchannel, minchannel, maxchannel);
00106                 panel->SetFromTrack(mintrack, mintrack, maxtrack);
00107                 panel->SetToTrack(maxtrack, mintrack, maxtrack);
00108                 panel->SetRouteType(RTall);
00109                 return panel;
00110         }
00111         panel->SetFromChannel(route->IFrom, minchannel, maxchannel);
00112         panel->SetToChannel(route->ITo, minchannel, maxchannel);
00113         panel->SetFromTrack(route->IFrom, mintrack, maxtrack);
00114         panel->SetToTrack(route->ITo, mintrack, maxtrack);
00115         panel->SetRouteType(route->GetType());
00116         return panel;
00117 }
00118 
00119 void MutInputMidiFileDeviceShape::ReadInputFilterPanel(wxWindow * panel, Route * route)
00120 {
00121         MidiFileInputFilterPanel * pan = dynamic_cast<MidiFileInputFilterPanel *> (panel);
00122         if (!pan) {
00123                 UNREACHABLEC;
00124                 return;
00125         }
00126         route->SetType(pan->GetRouteType());
00127         switch (route->GetType()) {
00128                 case RTall:
00129                 case RTelse:
00130                         // those have no data
00131                         break;
00132                 case RTchannel:
00133                         route->SetInputFrom(pan->GetFromChannel());
00134                         route->SetInputTo(pan->GetToChannel());
00135                         break;
00136                 case RTstaff:
00137                         route->SetInputFrom(pan->GetFromTrack());
00138                         route->SetInputTo(pan->GetToTrack());
00139                         break;
00140                 default:
00141                         UNREACHABLEC;
00142                         break;
00143         }
00144         return;
00145 }
00146 
00147 
00148 IMPLEMENT_DYNAMIC_CLASS(MutInputMidiFileDeviceShape, MutInputDeviceShape)
00149 
00150 /*
00151  * \}
00152  */

Erzeugt am Sun Aug 21 2011 10:51:55 für Mutabor von doxygen 1.7.4