Stimfit  0.13.15
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
smalldlgs.h
Go to the documentation of this file.
00001 // This program is free software; you can redistribute it and/or
00002 // modify it under the terms of the GNU General Public License
00003 // as published by the Free Software Foundation; either version 2
00004 // of the License, or (at your option) any later version.
00005 
00006 // This program is distributed in the hope that it will be useful,
00007 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00008 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009 // GNU General Public License for more details.
00010 
00011 // You should have received a copy of the GNU General Public License
00012 // along with this program; if not, write to the Free Software
00013 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00014 
00021 #ifndef _SMALLDLGS_H
00022 #define _SMALLDLGS_H
00023 
00028 #include <wx/dirctrl.h>
00029 #include <wx/filename.h>
00030 #include <vector>
00031 #include "./../../stf.h"
00032 
00034 class wxStfFileInfoDlg : public wxDialog 
00035 {
00036     DECLARE_EVENT_TABLE()
00037 
00038 private:
00039     wxStdDialogButtonSizer* m_sdbSizer;
00040 
00041 public:
00043 
00053     wxStfFileInfoDlg(
00054             wxWindow* parent,
00055             const std::string& szGeneral,
00056             const std::string& szFile,
00057             const std::string& szSection,
00058             int id = wxID_ANY,
00059             wxString title = wxT("File information"),
00060             wxPoint pos = wxDefaultPosition,
00061             wxSize size = wxDefaultSize,
00062             int style = wxCAPTION
00063     );
00064 
00065 };
00066 
00068 class wxStfChannelSelDlg : public wxDialog 
00069 {
00070     DECLARE_EVENT_TABLE()
00071 
00072 private:
00073     int m_selChannel1, m_selChannel2;
00074     wxStdDialogButtonSizer* m_sdbSizer;
00075     wxComboBox *m_comboBoxCh1,*m_comboBoxCh2;
00076 
00077     void OnComboCh1( wxCommandEvent& event );
00078     void OnComboCh2( wxCommandEvent& event );
00079 
00081 
00083     bool OnOK();
00084 
00085 public:
00087 
00095     wxStfChannelSelDlg(
00096             wxWindow* parent,
00097             const std::vector<wxString>& channelNames=
00098                 std::vector<wxString>(0),
00099                 int id = wxID_ANY,
00100                 wxString title = wxT("Select channels"),
00101                 wxPoint pos = wxDefaultPosition,
00102                 wxSize size = wxDefaultSize,
00103                 int style = wxCAPTION
00104     );
00105     
00107 
00110     virtual void EndModal(int retCode);
00111 
00113 
00115     int GetSelCh1() const {return m_selChannel1;}
00116 
00118 
00120     int GetSelCh2() const {return m_selChannel2;}
00121 };
00122 
00124 class wxStfAlignDlg : public wxDialog 
00125 {
00126     DECLARE_EVENT_TABLE()
00127 
00128 private:
00129     int m_alignRise;
00130     wxRadioBox* m_radioBox;
00131     wxStdDialogButtonSizer* m_sdbSizer;
00132 
00134 
00136     bool OnOK();
00137 
00138 public:
00140 
00147     wxStfAlignDlg(
00148             wxWindow* parent,
00149             int id = wxID_ANY,
00150             wxString title = wxT("Alignment mode"),
00151             wxPoint pos = wxDefaultPosition,
00152             wxSize size = wxDefaultSize,
00153             int style = wxCAPTION
00154     );
00155 
00157 
00160     int AlignRise() const {return m_alignRise;}
00161     
00163 
00166     virtual void EndModal(int retCode);
00167 };
00168 
00170 class wxStfFilterSelDlg : public wxDialog 
00171 {
00172     DECLARE_EVENT_TABLE()
00173 
00174 private:
00175     int m_filterSelect;
00176     wxRadioBox* m_radioBox;
00177     wxStdDialogButtonSizer* m_sdbSizer;
00178 
00180 
00182     bool OnOK();
00183 
00184 public:
00186 
00193     wxStfFilterSelDlg(
00194             wxWindow* parent,
00195             int id = wxID_ANY,
00196             wxString title = wxT("Filter function"),
00197             wxPoint pos = wxDefaultPosition,
00198             wxSize size = wxDefaultSize,
00199             int style = wxCAPTION
00200     );
00201 
00203 
00205     int GetFilterSelect() const {return m_filterSelect;}
00206     
00208 
00211     virtual void EndModal(int retCode);
00212 };
00213 
00215 class wxStfTransformDlg : public wxDialog 
00216 {
00217     DECLARE_EVENT_TABLE()
00218         
00219 private:
00220     int m_fSelect;
00221     wxRadioBox* m_radioBox;
00222     wxStdDialogButtonSizer* m_sdbSizer;
00223 
00225 
00227     bool OnOK();
00228 
00229 public:
00231 
00238     wxStfTransformDlg(
00239             wxWindow* parent,
00240             int id = wxID_ANY,
00241             wxString title = wxT("Choose function"),
00242             wxPoint pos = wxDefaultPosition,
00243             wxSize size = wxDefaultSize,
00244             int style = wxCAPTION
00245     );
00246 
00248 
00250     int GetFSelect() const {return m_fSelect;}
00251     
00253 
00256     virtual void EndModal(int retCode);
00257 };
00258 
00260 class wxStfFitInfoDlg : public wxDialog 
00261 {
00262     DECLARE_EVENT_TABLE()
00263 
00264 private:
00265     wxStdDialogButtonSizer* m_sdbSizer;
00266 
00267 public:
00269 
00277     wxStfFitInfoDlg(
00278             wxWindow* parent,
00279             const wxString& info,
00280             int id = wxID_ANY,
00281             wxString title = wxT("Fit information"),
00282             wxPoint pos = wxDefaultPosition,
00283             wxSize size = wxDefaultSize,
00284             int style = wxCAPTION
00285     );
00286 };
00287 
00289 struct BatchOption {
00291   BatchOption( ) : label( wxT("\0") ), selection(false), index(-1) {}
00292     
00297   BatchOption(const wxString& lab, bool sel, int id) : label(lab), selection(sel), index(id) {}
00298     
00299     wxString label; 
00300     bool selection; 
00301     int index;      
00302 };
00303 
00305 class wxStfBatchDlg : public wxDialog 
00306 {
00307     DECLARE_EVENT_TABLE()
00308 
00309     private:
00310     std::vector<BatchOption> batchOptions;
00311     
00312     wxCheckListBox*     m_checkList;    
00313     wxStdDialogButtonSizer* m_sdbSizer;
00314 
00316 
00318     bool OnOK();
00319     BatchOption LookUp( int index ) const;
00320 
00321     enum {
00322         id_base=0,
00323         id_basesd,
00324         id_threshold,
00325         id_slopethresholdtime,
00326         id_peakzero,
00327         id_peakbase,
00328         id_peakthreshold,
00329         id_peaktime,
00330         id_rtLoHi,
00331         id_innerLoHi,
00332         id_outerLoHi,
00333         id_t50,
00334         id_t50se,
00335         id_slopes,
00336         id_slopetimes,
00337         id_latencies,
00338         id_fit,
00339 #ifdef WITH_PSLOPE
00340         id_pslopes,
00341 #endif
00342         id_crossings
00343     };
00344     
00345 public:
00347 
00354     wxStfBatchDlg(
00355             wxWindow* parent,
00356             int id = wxID_ANY,
00357             wxString title = wxT("Choose values"),
00358             wxPoint pos = wxDefaultPosition,
00359             wxSize size = wxDefaultSize,
00360             int style = wxCAPTION
00361     );
00362 
00364 
00366     bool PrintBase() const {return LookUp(id_base).selection;}
00367 
00369 
00371     bool PrintBaseSD() const {return LookUp(id_basesd).selection;}
00372 
00374 
00376     bool PrintThreshold() const {return LookUp(id_threshold).selection;}
00377 
00379 
00381     bool PrintSlopeThresholdTime() const {return LookUp(id_slopethresholdtime).selection;}
00382 
00384 
00386     bool PrintPeakZero() const {return LookUp(id_peakzero).selection;}
00387 
00389 
00391     bool PrintPeakBase() const {return LookUp(id_peakbase).selection;}
00392     
00394 
00396     bool PrintPeakThreshold() const {return LookUp(id_peakthreshold).selection;}
00397 
00399 
00401     bool PrintPeakTime() const {return LookUp(id_peaktime).selection;}
00402 
00404 
00406     bool PrintRTLoHi() const {return LookUp(id_rtLoHi).selection;}
00407 
00409 
00411     bool PrintInnerRTLoHi() const {return LookUp(id_innerLoHi).selection;}
00412 
00414 
00416     bool PrintOuterRTLoHi() const {return LookUp(id_outerLoHi).selection;}
00417 
00419 
00421     bool PrintT50() const {return  LookUp(id_t50).selection;}
00422 
00424 
00426     bool PrintT50SE() const {return  LookUp(id_t50se).selection;}
00427 
00429 
00431     bool PrintSlopes() const {return  LookUp(id_slopes).selection;}
00432 
00434 
00436     bool PrintSlopeTimes() const {return LookUp(id_slopetimes).selection;}
00437 
00438 #ifdef WITH_PSLOPE
00439 
00440 
00442     bool PrintPSlopes() const {return  LookUp(id_pslopes).selection;}
00443 #endif
00444 
00446 
00448     bool PrintThr() const {return LookUp(id_crossings).selection;}
00449 
00451 
00453     bool PrintLatencies() const {return LookUp(id_latencies).selection;}
00454 
00456 
00458     bool PrintFitResults() const {return LookUp(id_fit).selection;}
00459     
00461 
00464     virtual void EndModal(int retCode);
00465 };
00466 
00468 class wxStfPreprintDlg : public wxDialog 
00469 {
00470     DECLARE_EVENT_TABLE()
00471 
00472 private:
00473     bool m_gimmicks,m_isFile;
00474     int m_downsampling;
00475     wxStdDialogButtonSizer* m_sdbSizer;
00476     wxCheckBox* m_checkBox;
00477     wxTextCtrl* m_textCtrl;
00478 
00480 
00482     bool OnOK();
00483 
00484 public:
00486 
00494     wxStfPreprintDlg(
00495             wxWindow* parent,
00496             bool isFile=false,
00497             int id = wxID_ANY,
00498             wxString title = wxT("Settings"),
00499             wxPoint pos = wxDefaultPosition,
00500             wxSize size = wxDefaultSize,
00501             int style = wxCAPTION
00502     );
00503 
00505 
00507     bool GetGimmicks() const {return m_gimmicks;}
00508     
00510 
00512     int GetDownSampling() const {return m_downsampling;}
00513     
00515 
00518     virtual void EndModal(int retCode);
00519 };
00520 
00522 class wxStfGaussianDlg : public wxDialog 
00523 {
00524     DECLARE_EVENT_TABLE()
00525 
00526 private:
00527     double m_width;
00528     double m_center;
00529     double m_amp;
00530     wxStdDialogButtonSizer* m_sdbSizer;
00531     wxSlider* m_slider;
00532     wxTextCtrl *m_textCtrlCenter, *m_textCtrlWidth;
00533 
00535 
00537     bool OnOK();
00538 
00539 public:
00541 
00548     wxStfGaussianDlg(
00549             wxWindow* parent,
00550             int id = wxID_ANY,
00551             wxString title = wxT("Settings for Gaussian function"),
00552             wxPoint pos = wxDefaultPosition,
00553             wxSize size = wxDefaultSize,
00554             int style = wxCAPTION
00555     );
00556 
00558 
00560     double Width() const {return m_width;}
00561 
00563 
00565     double Center() const {return m_center;}
00566 
00568 
00570     double Amp() const {return m_amp;}
00571     
00573 
00576     virtual void EndModal(int retCode);
00577 };
00578 
00580 class wxStfTextImportDlg : public wxDialog 
00581 {
00582     DECLARE_EVENT_TABLE()
00583 
00584 private:
00585     int m_hLines;
00586     bool m_toSection;
00587     bool m_firstIsTime;
00588     bool m_isSeries;
00589     int m_ncolumns;
00590     double m_sr;
00591     wxString m_yUnits;
00592     wxString m_yUnitsCh2;
00593     wxString m_xUnits;
00594     bool m_applyToAll;
00595 
00596     void disableSenseless();
00597 
00598     wxStdDialogButtonSizer* m_sdbSizer;
00599     wxTextCtrl *m_textCtrlHLines, *m_textCtrlYUnits, *m_textCtrlYUnitsCh2,
00600     *m_textCtrlXUnits, *m_textCtrlSR;
00601     wxComboBox *m_comboBoxNcolumns,*m_comboBoxFirsttime,*m_comboBoxSecorch;
00602     wxCheckBox *m_checkBoxApplyToAll;
00603     void OnComboNcolumns( wxCommandEvent& event );
00604     void OnComboFirsttime( wxCommandEvent& event );
00605     void OnComboSecorch( wxCommandEvent& event ); 
00606 
00608 
00610     bool OnOK();
00611 
00612 public:
00614 
00625     wxStfTextImportDlg(
00626             wxWindow* parent,
00627             const wxString& textPreview=wxT("\0"),
00628             int hLines_=1,
00629             bool isSeries=false,
00630             int id = wxID_ANY,
00631             wxString title = wxT("Text file import settings"),
00632             wxPoint pos = wxDefaultPosition,
00633             wxSize size = wxDefaultSize,
00634             int style = wxCAPTION
00635     );
00636 
00638 
00640     int GetHLines() const {return m_hLines;}
00641 
00643 
00645     bool ToSection() const {return m_toSection;}
00646 
00648 
00650     bool FirstIsTime() const {return m_firstIsTime;}
00651 
00653 
00655     int GetNColumns() const {return m_ncolumns;}
00656 
00658 
00660     double GetSR() const {return m_sr;}
00661 
00663 
00665     const wxString& GetYUnits() const {return m_yUnits;}
00666 
00668 
00670     const wxString& GetYUnitsCh2() const {return m_yUnitsCh2;}
00671 
00673 
00675     const wxString& GetXUnits() const {return m_xUnits;}
00676 
00678 
00680     bool ApplyToAll() const {return m_applyToAll;}
00681 
00683 
00685     stfio::txtImportSettings GetTxtImport() const;
00686 
00688 
00691     virtual void EndModal(int retCode);
00692 };
00693 
00694 class wxDirPickerCtrl;
00695 
00697 class wxStfConvertDlg : public wxDialog 
00698 {
00699     DECLARE_EVENT_TABLE()
00700 
00701 private:
00702     wxGenericDirCtrl *mySrcDirCtrl, *myDestDirCtrl; 
00703     wxString srcDir,destDir;
00704     wxString srcFilter;
00705 
00706     stfio::filetype srcFilterExt, destFilterExt;
00707     std::vector<wxString> srcFileNames;
00708 
00709     bool ReadPath(const wxString& path);
00710 
00711     void OnComboBoxSrcExt(wxCommandEvent& event);
00712     void OnComboBoxDestExt(wxCommandEvent& event);
00713 
00715 
00717     bool OnOK();
00718 
00719 public:
00721 
00728     wxStfConvertDlg( wxWindow* parent, int id = wxID_ANY, wxString title = wxT("Convert file series"),
00729             wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION );
00730 
00732 
00734     wxString GetSrcDir() const {return srcDir;}
00735 
00737 
00739     wxString GetDestDir() const {return destDir;}
00740 
00742 
00744     wxString GetSrcFilter() const {return srcFilter;}
00745 
00747 
00749     stfio::filetype GetSrcFileExt() const {return srcFilterExt;}
00750 
00752 
00754     stfio::filetype GetDestFileExt() const {return destFilterExt;}
00755 
00757 
00759     std::vector<wxString> GetSrcFileNames() const {return srcFileNames;}
00760     
00762 
00765     virtual void EndModal(int retCode);
00766 
00767 };
00768 
00769 class wxListCtrl;
00770 
00772 class wxStfOrderChannelsDlg : public wxDialog 
00773 {
00774     DECLARE_EVENT_TABLE()
00775 
00776 private:
00777     wxListCtrl* m_List;
00778     std::vector<int> channelOrder;
00779 
00780     void OnUparrow( wxCommandEvent& event );
00781     void OnDownarrow( wxCommandEvent& event );
00782     void SwapItems(long itemId1, long itemId2);
00783 
00785 
00787     bool OnOK();
00788 
00789 public:
00791 
00799     wxStfOrderChannelsDlg(
00800             wxWindow* parent,
00801             const std::vector<wxString>& channelNames=
00802                 std::vector<wxString>(0),
00803                 int id = wxID_ANY,
00804                 wxString title = wxT("Re-order channels"),
00805                 wxPoint pos = wxDefaultPosition,
00806                 wxSize size = wxDefaultSize,
00807                 int style = wxCAPTION
00808     );
00809 
00811 
00813     std::vector<int> GetChannelOrder() const {return channelOrder;}
00814     
00816 
00819     virtual void EndModal(int retCode);
00820 };
00821 
00822 /* @} */
00823 
00824 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines