gehe zur Dokumentation dieser Datei00001
00066 #include "Defs.h"
00067
00068 #include "InputGuidoFileDeviceShape.h"
00069 #include <limits>
00070
00071
00072
00073
00074
00075
00076 class GisInputFilterPanel : public GisInputFilterPanelBase {
00077 public:
00078 GisInputFilterPanel(wxWindow * parent):GisInputFilterPanelBase(parent) {}
00079
00083 void SetFromBox(int current, int min, int max) {
00084 from_box->SetRange(min,max);
00085 from_box->SetValue(current);
00086 }
00087 int GetFromBox() const
00088 {
00089 return from_box->GetValue();
00090 }
00091
00092 void SetToBox(int current, int min, int max) {
00093 to_box->SetRange(min,max);
00094 to_box->SetValue(current);
00095 }
00096 int GetToBox() const
00097 {
00098 return to_box->GetValue();
00099 }
00100
00101 void SetFromStaff(int current, int min, int max) {
00102 from_staff->SetRange(min,max);
00103 from_staff->SetValue(current);
00104 }
00105 int GetFromStaff() const
00106 {
00107 return from_staff->GetValue();
00108 }
00109
00110 void SetToStaff(int current, int min, int max) {
00111 to_staff->SetRange(min,max);
00112 to_staff->SetValue(current);
00113 }
00114 int GetToStaff() const
00115 {
00116 return to_staff->GetValue();
00117 }
00118
00119 void SetRouteType(RouteType routetype) {
00120 wxPanel * panel;
00121 switch (routetype) {
00122 case RTall: panel = all_panel; break;
00123 case RTchannel: panel = box_tag_panel; break;
00124 case RTstaff: panel = staves_panel; break;
00125 case RTelse: panel = else_panel; break;
00126 default:
00127 UNREACHABLEC;
00128 std::cerr << "GisInputFilterPanel::SetRouteType: invaid route type "
00129 << routetype << std::endl;
00130 abort();
00131 }
00132 for (size_t i = 0 ; i < type->GetPageCount(); i++) {
00133 if (type -> GetPage(i) != panel) continue;
00134 type->SetSelection(i);
00135 }
00136 }
00137
00138 RouteType GetRouteType() {
00139 wxWindow * window = type->GetCurrentPage();
00140 if (window == all_panel)
00141 return RTall;
00142 else if (window == box_tag_panel)
00143 return RTchannel;
00144 else if (window == staves_panel)
00145 return RTstaff;
00146 else if (window == else_panel)
00147 return RTelse;
00148 else {
00149 UNREACHABLEC;
00150 return RTall;
00151 }
00152 }
00153
00154 };
00155
00156 void MutInputGuidoFileDeviceShape::InitializeDialog(InputDevDlg * in) const
00157 {
00158 wxASSERT(device);
00159 wxASSERT(device->GetType() == DTGis);
00160 wxASSERT(in);
00161 in -> SetType(DTGis);
00162 in -> SetGUIDOFile(device->GetName());
00163 }
00164
00165 bool MutInputGuidoFileDeviceShape::readDialog (InputDevDlg * in)
00166 {
00167 wxASSERT(device);
00168 wxASSERT(device->GetType() == DTGis);
00169 wxASSERT(in);
00170 wxASSERT (in -> GetType() == DTGis);
00171 DEBUGLOG (other,_T ("File %s"), (in -> GetGUIDOFile()).c_str());
00172 device->SetName (in -> GetGUIDOFile());
00173 SetLabel (device->GetName());
00174 return true;
00175 }
00176
00177 wxPanel * MutInputGuidoFileDeviceShape::GetInputFilterPanel(wxWindow * parent,
00178 Route * route) const
00179 {
00180 const int maxint = std::numeric_limits<int>().max();
00181 GisInputFilterPanel * panel = new GisInputFilterPanel(parent);
00182 if (!panel) return NULL;
00183 if (!route) {
00184 panel->SetFromBox(0, 0, maxint);
00185 panel->SetToBox(maxint, 0, maxint);
00186 panel->SetFromStaff(0, 0, maxint);
00187 panel->SetToStaff(maxint, 0, maxint);
00188 panel->SetRouteType(RTall);
00189 return panel;
00190 }
00191 panel->SetFromBox(route->IFrom, 0, maxint);
00192 panel->SetToBox(route->ITo, 0, maxint);
00193 panel->SetFromStaff(route->IFrom, 0, maxint);
00194 panel->SetToStaff(route->ITo, 0, maxint);
00195 panel->SetRouteType(route->GetType());
00196 return panel;
00197 }
00198
00199 void MutInputGuidoFileDeviceShape::ReadInputFilterPanel(wxWindow * panel, Route * route)
00200 {
00201 GisInputFilterPanel * pan = dynamic_cast<GisInputFilterPanel *> (panel);
00202 if (!pan) {
00203 UNREACHABLEC;
00204 return;
00205 }
00206 route->SetType(pan->GetRouteType());
00207 switch (route->GetType()) {
00208 case RTall:
00209 case RTelse:
00210
00211 break;
00212 case RTchannel:
00213 route->SetInputFrom(pan->GetFromBox());
00214 route->SetInputTo(pan->GetToBox());
00215 break;
00216 case RTstaff:
00217 route->SetInputFrom(pan->GetFromStaff());
00218 route->SetInputTo(pan->GetToStaff());
00219 break;
00220 default:
00221 UNREACHABLEC;
00222 break;
00223 }
00224 return;
00225
00226 }
00227
00228
00229 IMPLEMENT_DYNAMIC_CLASS(MutInputGuidoFileDeviceShape, MutInputDeviceShape)
00230
00231
00232
00233