00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013
00014 #ifndef _MAINFRAME_H_
00015 #define _MAINFRAME_H_
00016
00017 #if defined(__GNUG__) && !defined(__APPLE__)
00018 #pragma interface "mainframe.h"
00019 #endif
00020
00025
00026 #include "wx/frame.h"
00027 #include "wx/laywin.h"
00028 #include "wx/notebook.h"
00029 #include "wx/tglbtn.h"
00030 #include "wx/spinctrl.h"
00031 #include "wx/splitter.h"
00032 #include "wx/toolbar.h"
00033 #include "wx/statusbr.h"
00035
00036
00037 #include "appsettings.h"
00042
00043 class wxSashLayoutWindow;
00044 class wxNotebook;
00045 class wxBoxSizer;
00046 class wxToggleButton;
00047 class wxSpinCtrl;
00048 class wxSplitterWindow;
00049 class wxStatusBar;
00051
00052 class DrawingPanel;
00053 class CursorChControl;
00057 #define ID_DRAWING_PANEL 30000
00058
00060 #define ID_MAIN_FRAME 10000
00061 #define SYMBOL_MAINFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxMAXIMIZE|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCLOSE_BOX
00062 #define SYMBOL_MAINFRAME_TITLE _("CAEN SCOPE")
00063 #define SYMBOL_MAINFRAME_IDNAME ID_MAIN_FRAME
00064 #define SYMBOL_MAINFRAME_SIZE wxSize(1024, 768)
00065 #define SYMBOL_MAINFRAME_POSITION wxDefaultPosition
00066 #define ID_SASHLAYOUTWINDOW2 10014
00067 #define ID_BOTTOM_NOTEBOOK 10008
00068 #define ID_COMMON_SCROLLEDWINDOW 10009
00069 #define ID_COMMON_RUN_TOGGLEBUTTON 10004
00070 #define ID_FRONT_PANEL_NIM_TOGGLEBUTTON 10039
00071 #define ID_SIZE_X_CHOICE 10034
00072 #define ID_EXT_CLOCK_CHECKBOX 10028
00073 #define ID_EXT_CLOCK_SPINCTRL 10026
00074 #define ID_TRIGGER_SCROLLEDWINDOW 10003
00075 #define ID_TRIGGER_EXT_TOGGLEBUTTON 10020
00076 #define ID_TRIGGER_AUTO_TOGGLEBUTTON 10021
00077 #define ID_TRIGGER_FORCE_BUTTON 10015
00078 #define ID_TRIGGER_POST_SPINCTRL 10016
00079 #define ID_TRIGGER_POSITION_KEEP_CHECKBOX 10038
00080 #define ID_TRIGGER_EDGE_CHOICE 10037
00081 #define ID_RECORD_SCROLLEDWINDOW 10027
00082 #define ID_RECORDTOGGLEBUTTON 10029
00083 #define ID_RECORDDIRTEXTCTRL 10030
00084 #define ID_RECORDDIRBUTTON 10031
00085 #define ID_SASHLAYOUTWINDOW 10011
00086 #define ID_LEFT_NOTEBOOK 10042
00087 #define ID_SCOPE_1_VIEW_NOTEBOOK 10042
00088 #define ID_VIEW_1_SCROLLEDWINDOW 10006
00089 #define ID_PANEL 10007
00090 #define ID_BACK_CHOOSE_COLOR_1_BUTTON 10025
00091 #define ID_SEC_PER_DIV_1_CHOICE 10005
00092 #define ID_OFFSET_SEC_1_SPINCTRL 10033
00093 #define ID_GRID_COLOR_1_PANEL 10019
00094 #define ID_GRID_CHOOSE_COLOR_1_BUTTON 10022
00095 #define ID_GRID_LINE_WIDTH_1_SPINCTRL 10023
00096 #define ID_GRID_LINE_TYPE_1_CHOICE 10024
00097 #define ID_CURSOR_1_SCROLLEDWINDOW 10036
00098 #define ID_SCOPE_2_VIEW_NOTEBOOK 10100
00099 #define ID_VIEW_2_SCROLLEDWINDOW 10043
00100 #define ID_PANEL6 10045
00101 #define ID_BACK_CHOOSE_COLOR_2_BUTTON 10048
00102 #define ID_SEC_PER_DIV_2_CHOICE 10049
00103 #define ID_OFFSET_SEC_2_SPINCTRL 10050
00104 #define ID_GRID_COLOR_2_PANEL 10051
00105 #define ID_GRID_CHOOSE_COLOR_2_BUTTON 10052
00106 #define ID_GRID_LINE_WIDTH_2_SPINCTRL 10053
00107 #define ID_GRID_LINE_TYPE_2_CHOICE 10054
00108 #define ID_CURSOR_2_SCROLLEDWINDOW 10055
00109 #define ID_SCOPE_3_VIEW_NOTEBOOK 10056
00110 #define ID_VIEW_3_SCROLLEDWINDOW 10057
00111 #define ID_PANEL3 10058
00112 #define ID_BACK_CHOOSE_COLOR_3_BUTTON 10059
00113 #define ID_SEC_PER_DIV_3_CHOICE 10060
00114 #define ID_OFFSET_SEC_3_SPINCTRL 10061
00115 #define ID_GRID_COLOR_3_PANEL 10062
00116 #define ID_GRID_CHOOSE_COLOR_3_BUTTON 10063
00117 #define ID_GRID_LINE_WIDTH_3_SPINCTRL 10064
00118 #define ID_GRID_LINE_TYPE_3_CHOICE 10065
00119 #define ID_CURSOR_3_SCROLLEDWINDOW 10066
00120 #define ID_SCOPE_4_VIEW_NOTEBOOK 10067
00121 #define ID_VIEW_4_SCROLLEDWINDOW 10068
00122 #define ID_PANEL5 10069
00123 #define ID_BACK_CHOOSE_COLOR_4_BUTTON 10070
00124 #define ID_SEC_PER_DIV_4_CHOICE 10071
00125 #define ID_OFFSET_SEC_4_SPINCTRL 10072
00126 #define ID_GRID_COLOR_4_PANEL 10073
00127 #define ID_GRID_CHOOSE_COLOR_4_BUTTON 10101
00128 #define ID_GRID_LINE_WIDTH_4_SPINCTRL 10075
00129 #define ID_GRID_LINE_TYPE_4_CHOICE 10076
00130 #define ID_CURSOR_4_SCROLLEDWINDOW 10077
00131 #define ID_SASHLAYOUTWINDOW1 10012
00132 #define ID_SCOPE_NOTEBOOK 10013
00133 #define ID_SCOPE_HORIZ_SPLITTERWINDOW 10040
00134 #define ID_MAIN_TOOLBAR 10001
00135 #define ID_EXIT_TOOL 10010
00136 #define ID_VIEW_LEFT_TOOL 10018
00137 #define ID_VIEW_BOTTOM_TOOL 10017
00138 #define ID_VIEW_SCOPE_LEFT_TOP_TOOL 10041
00139 #define ID_VIEW_SCOPE_RIGHT_TOP_TOOL 10044
00140 #define ID_VIEW_SCOPE_LEFT_BOTTOM_TOOL 10046
00141 #define ID_VIEW_SCOPE_RIGHT_BOTTOM_TOOL 10047
00142 #define ID_HELP_TOOL 10032
00143 #define ID_MAIN_STATUSBAR 10002
00144
00145
00146 #define ID_SCOPE_VERT_TOP_SPLITTERWINDOW 20000
00147 #define ID_SCOPE_VERT_BOTTOM_SPLITTERWINDOW 20001
00148
00153 #ifndef wxCLOSE_BOX
00154 #define wxCLOSE_BOX 0x1000
00155 #endif
00156
00161 class MainFrame: public wxFrame
00162 {
00163 DECLARE_CLASS( MainFrame )
00164 DECLARE_EVENT_TABLE()
00165
00166 public:
00167
00169 MainFrame( );
00170 MainFrame( wxWindow* parent, wxWindowID id = SYMBOL_MAINFRAME_IDNAME, const wxString& caption = SYMBOL_MAINFRAME_TITLE, const wxPoint& pos = SYMBOL_MAINFRAME_POSITION, const wxSize& size = SYMBOL_MAINFRAME_SIZE, long style = SYMBOL_MAINFRAME_STYLE);
00171
00172 bool Create( wxWindow* parent, wxWindowID id = SYMBOL_MAINFRAME_IDNAME, const wxString& caption = SYMBOL_MAINFRAME_TITLE, const wxPoint& pos = SYMBOL_MAINFRAME_POSITION, const wxSize& size = SYMBOL_MAINFRAME_SIZE, long style = SYMBOL_MAINFRAME_STYLE);
00173
00175 void CreateControls();
00176
00177 static wxString GetExecutablePath( void);
00178
00180
00182 void OnCloseWindow( wxCloseEvent& event );
00183
00185 void OnSize( wxSizeEvent& event );
00186
00188 void OnBottomWindowSashDragged( wxSashEvent& event );
00189
00191 void OnCommonRunTogglebuttonClick( wxCommandEvent& event );
00192
00194 void OnFrontPanelNimTogglebuttonClick( wxCommandEvent& event );
00195
00197 void OnSizeXChoiceSelected( wxCommandEvent& event );
00198
00200 void OnExtClockCheckboxClick( wxCommandEvent& event );
00201
00203 void OnExtClockSpinctrlUpdated( wxSpinEvent& event );
00204
00206 void OnTriggerExtTogglebuttonClick( wxCommandEvent& event );
00207
00209 void OnTriggerAutoTogglebuttonClick( wxCommandEvent& event );
00210
00212 void OnTriggerForceButtonClick( wxCommandEvent& event );
00213
00215 void OnTriggerPostSpinctrlUpdated( wxSpinEvent& event );
00216
00218 void OnTriggerPositionKeepCheckboxClick( wxCommandEvent& event );
00219
00221 void OnTriggerEdgeChoiceSelected( wxCommandEvent& event );
00222
00224 void OnRecordtogglebuttonClick( wxCommandEvent& event );
00225
00227 void OnRecorddirtextctrlUpdated( wxCommandEvent& event );
00228
00230 void OnRecorddirbuttonClick( wxCommandEvent& event );
00231
00233 void OnLeftWindowSashDragged( wxSashEvent& event );
00234
00236 void OnBackChooseColor1ButtonClick( wxCommandEvent& event );
00237
00239 void OnSecPerDiv1ChoiceSelected( wxCommandEvent& event );
00240
00242 void OnOffsetSec1SpinctrlUpdated( wxSpinEvent& event );
00243
00245 void OnGridChooseColor1ButtonClick( wxCommandEvent& event );
00246
00248 void OnGridLineWidth1SpinctrlUpdated( wxSpinEvent& event );
00249
00251 void OnGridLineType1ChoiceSelected( wxCommandEvent& event );
00252
00254 void OnBackChooseColor2ButtonClick( wxCommandEvent& event );
00255
00257 void OnSecPerDiv2ChoiceSelected( wxCommandEvent& event );
00258
00260 void OnOffsetSec2SpinctrlUpdated( wxSpinEvent& event );
00261
00263 void OnGridChooseColor2ButtonClick( wxCommandEvent& event );
00264
00266 void OnGridLineWidth2SpinctrlUpdated( wxSpinEvent& event );
00267
00269 void OnGridLineType2ChoiceSelected( wxCommandEvent& event );
00270
00272 void OnBackChooseColor3ButtonClick( wxCommandEvent& event );
00273
00275 void OnSecPerDiv3ChoiceSelected( wxCommandEvent& event );
00276
00278 void OnOffsetSec3SpinctrlUpdated( wxSpinEvent& event );
00279
00281 void OnGridChooseColor3ButtonClick( wxCommandEvent& event );
00282
00284 void OnGridLineWidth3SpinctrlUpdated( wxSpinEvent& event );
00285
00287 void OnGridLineType3ChoiceSelected( wxCommandEvent& event );
00288
00290 void OnBackChooseColor4ButtonClick( wxCommandEvent& event );
00291
00293 void OnSecPerDiv4ChoiceSelected( wxCommandEvent& event );
00294
00296 void OnOffsetSec4SpinctrlUpdated( wxSpinEvent& event );
00297
00299 void OnGridChooseColor4ButtonClick( wxCommandEvent& event );
00300
00302 void OnGridLineWidth4SpinctrlUpdated( wxSpinEvent& event );
00303
00305 void OnGridLineType4ChoiceSelected( wxCommandEvent& event );
00306
00308 void OnScopeHorizSplitterwindowSashPosChanged( wxSplitterEvent& event );
00309
00311 void OnExitToolClick( wxCommandEvent& event );
00312
00314 void OnViewLeftToolClick( wxCommandEvent& event );
00315
00317 void OnViewBottomToolClick( wxCommandEvent& event );
00318
00320 void OnViewScopeLeftTopToolClick( wxCommandEvent& event );
00321
00323 void OnViewScopeRightTopToolClick( wxCommandEvent& event );
00324
00326 void OnViewScopeLeftBottomToolClick( wxCommandEvent& event );
00327
00329 void OnViewScopeRightBottomToolClick( wxCommandEvent& event );
00330
00332 void OnHelpToolClick( wxCommandEvent& event );
00333
00335
00336 void OnGridLineWidth4SpinctrlTextUpdated( wxCommandEvent& event );
00337 void OnOffsetSec4SpinctrlTextUpdated( wxCommandEvent& event );
00338 void OnGridLineWidth3SpinctrlTextUpdated( wxCommandEvent& event );
00339 void OnOffsetSec3SpinctrlTextUpdated( wxCommandEvent& event );
00340 void OnGridLineWidth2SpinctrlTextUpdated( wxCommandEvent& event );
00341 void OnOffsetSec2SpinctrlTextUpdated( wxCommandEvent& event );
00342 void OnGridLineWidth1SpinctrlTextUpdated( wxCommandEvent& event );
00343 void OnOffsetSec1SpinctrlTextUpdated( wxCommandEvent& event );
00344 void OnTriggerPostSpinctrlTextUpdated( wxCommandEvent& event );
00345 void OnExtClockSpinctrlTextUpdated( wxCommandEvent& event );
00346 void OnRecorddirtextctrlEnter( wxCommandEvent& event );
00347 void OnScopeVertTopSplitterwindowSashPosChanged ( wxSplitterEvent& event);
00348 void OnScopeVertBottomSplitterwindowSashPosChanged( wxSplitterEvent& event);
00349
00351
00353 wxBitmap GetBitmapResource( const wxString& name );
00354
00356 wxIcon GetIconResource( const wxString& name );
00358
00360 static bool ShowToolTips();
00361
00363 wxSashLayoutWindow* m_bottom_pane;
00364 wxNotebook* m_common_settings_notebook;
00365 wxScrolledWindow* m_common_panel;
00366 wxBoxSizer* m_common_main_sizer;
00367 wxToggleButton* m_common_run_control;
00368 wxToggleButton* m_common_TTL_control;
00369 wxChoice* m_size_X_control;
00370 wxCheckBox* m_use_ext_clock_control;
00371 wxSpinCtrl* m_ext_clock_control;
00372 wxScrolledWindow* m_trigger_panel;
00373 wxBoxSizer* m_trigger_main_sizer;
00374 wxToggleButton* m_trigger_ext_control;
00375 wxToggleButton* m_trigger_auto_control;
00376 wxButton* m_force_trigger_control;
00377 wxSpinCtrl* m_trigger_post_control;
00378 wxCheckBox* m_trigger_position_keep_control;
00379 wxChoice* m_trigger_edge_control;
00380 wxScrolledWindow* m_record_panel;
00381 wxBoxSizer* m_record_main_sizer;
00382 wxToggleButton* m_record_start_stop_control;
00383 wxBoxSizer* m_record_folder_sizer;
00384 wxTextCtrl* m_record_dir_control;
00385 wxButton* m_record_dir_browse_button;
00386 wxSashLayoutWindow* m_left_pane;
00387 wxNotebook* m_specific_settings_notebook;
00388 wxNotebook* m_specific_settings_scope_1_notebook;
00389 wxScrolledWindow* m_view_scope_1_panel;
00390 wxBoxSizer* m_view_1_main_sizer;
00391 wxPanel* m_back_color_1_control;
00392 wxStaticBox* m_main_sizer_1_text;
00393 wxChoice* m_sec_per_div_1_control;
00394 wxSpinCtrl* m_offset_sec_1_control;
00395 wxPanel* m_grid_color_1_control;
00396 wxSpinCtrl* m_grid_line_width_1_control;
00397 wxChoice* m_grid_line_type_1_control;
00398 wxScrolledWindow* m_cursor_1_panel;
00399 wxBoxSizer* m_cursor_1_main_sizer;
00400 wxNotebook* m_specific_settings_scope_2_notebook;
00401 wxScrolledWindow* m_view_scope_2_panel;
00402 wxBoxSizer* m_view_2_main_sizer;
00403 wxPanel* m_back_color_2_control;
00404 wxStaticBox* m_main_sizer_2_text;
00405 wxChoice* m_sec_per_div_2_control;
00406 wxSpinCtrl* m_offset_sec_2_control;
00407 wxPanel* m_grid_color_2_control;
00408 wxSpinCtrl* m_grid_line_width_2_control;
00409 wxChoice* m_grid_line_type_2_control;
00410 wxScrolledWindow* m_cursor_2_panel;
00411 wxBoxSizer* m_cursor_2_main_sizer;
00412 wxNotebook* m_specific_settings_scope_3_notebook;
00413 wxScrolledWindow* m_view_scope_3_panel;
00414 wxBoxSizer* m_view_3_main_sizer;
00415 wxPanel* m_back_color_3_control;
00416 wxStaticBox* m_main_sizer_3_text;
00417 wxChoice* m_sec_per_div_3_control;
00418 wxSpinCtrl* m_offset_sec_3_control;
00419 wxPanel* m_grid_color_3_control;
00420 wxSpinCtrl* m_grid_line_width_3_control;
00421 wxChoice* m_grid_line_type_3_control;
00422 wxScrolledWindow* m_cursor_3_panel;
00423 wxBoxSizer* m_cursor_3_main_sizer;
00424 wxNotebook* m_specific_settings_scope_4_notebook;
00425 wxScrolledWindow* m_view_scope_4_panel;
00426 wxBoxSizer* m_view_4_main_sizer;
00427 wxPanel* m_back_color_4_control;
00428 wxStaticBox* m_main_sizer_4_text;
00429 wxChoice* m_sec_per_div_4_control;
00430 wxSpinCtrl* m_offset_sec_4_control;
00431 wxPanel* m_grid_color_4_control;
00432 wxSpinCtrl* m_grid_line_width_4_control;
00433 wxChoice* m_grid_line_type_4_control;
00434 wxScrolledWindow* m_cursor_4_panel;
00435 wxBoxSizer* m_cursor_4_main_sizer;
00436 wxSashLayoutWindow* m_top_pane;
00437 wxNotebook* m_scope_notebook;
00438 wxSplitterWindow* m_scope_horiz_splitter;
00439 wxToolBar* m_main_toolbar;
00440 wxStatusBar* m_main_statusbar;
00442 wxSplitterWindow* m_scope_vert_splitter_top;
00443 wxSplitterWindow* m_scope_vert_splitter_bottom;
00444 static void ScopeRefresh( int scope_index, bool erase_background);
00445 void UpdateSecPerDiv( int scope_index, int selection, wxSpinCtrl* offset_sec_control);
00446 static bool SetStsBarText( const wxString& text, int pane_index);
00447 protected:
00448 AppSettings *m_app_settings;
00449 bool CreateDynControls();
00450 bool UpdateControls( void);
00451 bool UpdateGrid( int scope_index);
00452 enum SCOPE_POSITIONS
00453 {
00454 SCOPE_POS_TOP_LEFT= 0,
00455 SCOPE_POS_TOP_RIGHT,
00456 SCOPE_POS_BOTTOM_LEFT,
00457 SCOPE_POS_BOTTOM_RIGHT,
00458 };
00459 DrawingPanel *m_scope_panel_array[ SCOPE_NUM_PANELS];
00460 static DrawingPanel *g_scope_panel_array[ SCOPE_NUM_PANELS];
00461 static wxStatusBar *g_main_statusbar;
00462 void UpdateGridLineWidth( int scope_index, int value);
00463 void UpdateTriggerPost( int value);
00464 void UpdateOffsetSec( int scope_index, int value);
00465 bool UpdateRecordFolder( void);
00466 void UpdateClock( int value);
00467 void UpdateTriggerEdge( void);
00468 void AdjustTriggerPost( void);
00469 void UpdateUseTTL( void);
00470 void DoStartStopRunning( void);
00471 void DoShowHideLeftPane( void);
00472 void DoShowHideBottomPane( void);
00473 void DoShowHideScopeLeftTopPane( bool do_check);
00474 void DoShowHideScopeRightTopPane( bool do_check);
00475 void DoShowHideScopeLeftBottomPane( bool do_check);
00476 void DoShowHideScopeRightBottomPane( bool do_check);
00477 void CheckScopeSplitters( void);
00478 void DoGridChooseColor( int scope_index, wxPanel *grid_color_control);
00479 void DoChooseColor( int scope_index, wxPanel *back_color_control);
00480 };
00481
00482 #endif
00483