Stimfit  0.13.15
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
childframe.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 _CHILDFRAME_H
00022 #define _CHILDFRAME_H
00023 
00028 #include <wx/aui/aui.h>
00029 #include <wx/grid.h>
00030 #include <wx/dnd.h>
00031 #include <wx/spinctrl.h>
00032 
00033 #include "./../stf.h"
00034 
00035 // Define a new frame
00036 class wxStfGraph;
00037 class wxStfTable;
00038 class wxStfGrid;
00039 
00041 #ifdef WITH_AUIDOCVIEW
00042 typedef wxAuiDocMDIChildFrame wxStfChildType;
00043 #else
00044 typedef wxDocMDIChildFrame wxStfChildType;
00045 #endif
00046 
00048 #ifdef WITH_AUIDOCVIEW
00049 typedef wxAuiDocMDIParentFrame wxStfParentType;
00050 #else
00051 typedef wxDocMDIParentFrame wxStfParentType;
00052 #endif
00053 
00055 
00056 const wxString defaultPersp =
00057 wxT("layout2| \
00058 name=Results;caption=Results;state=2044;dir=1;layer=0;row=0;pos=1;prop=167270; \
00059 bestw=200;besth=184;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1| \
00060 name=Selection;caption=Trace selection;state=2044;dir=1;layer=0;row=0;pos=0;prop=32730; \
00061 bestw=128;besth=64;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1| \
00062 name=Traces;caption=Traces;state=18428;dir=5;layer=0;row=0;pos=0;prop=100000; \
00063 bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|");
00064 
00065 #if wxUSE_DRAG_AND_DROP
00066 class wxStfFileDrop : public wxFileDropTarget {
00067 protected:
00068     virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
00069 };
00070 #endif
00071 
00073 
00076 class StfDll wxStfChildFrame : public wxStfChildType
00077 {
00078     DECLARE_CLASS( wxStfChildFrame )
00079 public:
00081 
00091     wxStfChildFrame(
00092             wxDocument* doc,
00093             wxView* view,
00094             wxStfParentType* parent,
00095             wxWindowID id,
00096             const wxString& title,
00097             const wxPoint& pos = wxPoint(48,48),
00098             const wxSize& size = wxDefaultSize,
00099             long style = wxDEFAULT_FRAME_STYLE,
00100             const wxString& name = wxT("frame")
00101     );
00103     ~wxStfChildFrame();
00104 
00106 
00109     void ShowTable(const stf::Table& table,const wxString& caption);
00110 
00112 
00114     std::size_t GetCurTrace() const;
00115 
00117 
00119     void SetCurTrace(std::size_t);
00120 
00122 
00124     void CreateMenuTraces(std::size_t value);
00125 
00126 
00128 
00130     void CreateComboChannels( const wxArrayString& channelNames );
00131 
00133 
00135     void SetSelected(std::size_t value);
00136 
00138 
00141     void SetChannels( std::size_t act, std::size_t inact );
00142 
00144     void UpdateChannels( );
00145 
00147 
00150     void UpdateResults();
00151 
00153 
00155     wxAuiManager* GetMgr() {return &m_mgr;}
00156 
00158 
00160     wxStfGrid* GetCopyGrid() {return m_table;}
00161 
00163     void Saveperspective();
00164 
00166     void Loadperspective();
00167 
00169     void Restoreperspective();
00170 
00172 
00174     bool ShowSelected() const {return pShowSelected->IsChecked();}
00175 
00177 
00179     bool ShowSecond();// const {return pShowSecond->IsChecked();}
00180 
00182 
00184     bool ShowAll() const {return pShowAll->IsChecked();}
00185     
00187     void ActivateGraph();
00188 
00189     void OnActivate(wxActivateEvent &event);
00190 
00192 
00194     virtual wxMenuBar *GetMenuBar() const {
00195         if (wxStfChildType::GetMenuBar()) {
00196             return wxStfChildType::GetMenuBar();
00197         } else {
00198             return m_parent->GetMenuBar();
00199         }
00200     }
00201     
00202  private:
00203     wxStfParentType* m_parent;
00204     wxAuiManager m_mgr;
00205     wxAuiNotebook* m_notebook;
00206     long m_notebook_style;
00207     wxPanel *m_traceCounter;
00208     wxPanel *m_channelCounter;
00209     wxStaticText *pSize;
00210     wxComboBox *pActChannel, *pInactChannel;
00211     wxSpinCtrl *trace_spinctrl;
00212     wxStfGrid* m_table;
00213     wxCheckBox *pZeroIndex, *pShowSelected, *pShowSecond, *pShowAll;
00214     std::size_t sizemax;
00215 
00216     wxAuiNotebook* CreateNotebook();
00217     wxPanel* CreateTraceCounter();
00218     wxPanel* CreateChannelCounter();
00219     wxStfGrid* CreateTable();
00220     void OnMenuHighlight(wxMenuEvent& event);
00221     void OnShowselected(wxCommandEvent& event);
00222     void OnZeroIndex(wxCommandEvent& event);
00223     void OnSpinCtrlTraces(wxSpinEvent& event);
00224     void OnComboActChannel(wxCommandEvent& event);
00225     void OnComboInactChannel(wxCommandEvent& event);
00226 
00227     DECLARE_EVENT_TABLE()
00228 };
00229 
00232 #endif
00233 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines