Blame view

GUI/SW2/SRC/src/main/FrmMain.hpp 8.19 KB
886c558b   Steve Greedy   SACAMOS Public Re...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
//**************************************************************************************************
//                                          FrmMain.hpp                                            *
//                                         -------------                                           *
// Description : The main frame used to contain the applications display objects.                  *
// Started     : 2003-08-18                                                                        *
// Last Update : 2016-10-08                                                                        *
// Copyright   : (C) 2003-2016 MSWaters                                                            *
//**************************************************************************************************

//**************************************************************************************************
//                                                                                                 *
//      This program is free software; you can redistribute it and/or modify it under the          *
//      terms of the GNU General Public License as published by the Free Software Foundation;      *
//      either version 3 of the License, or (at your option) any later version.                    *
//                                                                                                 *
//**************************************************************************************************

#ifndef FRMMAIN_HPP
#define FRMMAIN_HPP

// Application Includes

#include "TypeDefs.hpp"
#include "Config.hpp"

#include "main/FileTasks.hpp"
#include "main/HelpTasks.hpp"
#include "main/NbkTxtCtls.hpp"
#include "main/DlgPrefs.hpp"

#include "netlist/NetList.hpp"
#include "netlist/SimnNgSpice.hpp"
#include "netlist/SimnGnuCap.hpp"

#include "process/PrcGSchem.hpp"
#include "process/PrcNgSpice.hpp"
#include "process/PrcGnuCap.hpp"
#include "process/PrcGaw.hpp"
#include "process/PrcGWave.hpp"

#include "gnucap/NbkGnuCap.hpp"
#include "ngspice/NbkNgSpice.hpp"

// wxWidgets Includes

#include <wx/config.h>
#include <wx/process.h>
#include <wx/cursor.h>
#include <wx/tooltip.h>
#include <wx/gbsizer.h>
#include <wx/progdlg.h>


// gSpiceUI vSACAMOS Includes
#include <wx/dir.h>
#include <wx/utils.h>
#include <wx/wfstream.h>
#include <wx/txtstrm.h>

#include <iostream>
#include <fstream>
#include <sstream>

//**************************************************************************************************

class FrmMain : public wxFrame
{
  private :
  
      wxString		resultsFile, inputFile;	// gSpiceUI vSACAMOS variables

    // Define an enumerated type for the different status bar panes
    enum ePaneType
    {
      ePANE_MESAGE = 0,
      ePANE_SIMENG = 1,
      ePANE_VIEWER = 2,

      ePANE_LAST = ePANE_VIEWER
    };

    // Object attributes
    bool            m_bIsOpen;      // Flag indicating when the frame has closed
    uint            m_uiFrmLayout;  // Indicator of which main frame layout to use

    FileTasks       m_oFileTasks;   // Class to handler file operations
    HelpTasks       m_oHelpTasks;   // Class to handler help operations

    NetList         m_oNetLst;      // The netlist object
    SimnNgSpice     m_oSimnNgSp;    // NG-Spice simulation object
    SimnGnuCap      m_oSimnGCap;    // GNU-Cap  simulation object
    SimnBase      * m_poSimn;       // A pointer to the simulation object

    PrcSimEngBase * m_poPrcSimEng;  // Pointer to the simulator engine process
    PrcGSchem       m_oPrc_gschem;  // Process object to schematic capture
    PrcGaw          m_oPrc_gaw;     // Process object to view simulation results
    PrcGWave        m_oPrc_gwave;   // Process object to view simulation results

    // Display control objects
    NbkSimEngBase * m_poNbkSimEng;  // Pointer to the simulation engine notebook
    wxLabel         m_oLblNodes;    // Label above the test nodes list
    wxListBox       m_oLbxNodes;    // List of possible test nodes
    wxLabel         m_oLblCpnts;    // Label above the test components list
    wxListBox       m_oLbxCpnts;    // List of possible test components
    NbkTxtCtls      m_oNbkTxtCtls;  // Notebook containing the text controls

    // Object initialization functions
    void  Initialize  ( void );
    void  InitMenuBar ( void );
    void  InitToolBar ( void );
    void  InitLstBoxs ( void );
    void  InitNbkTCtls( void );
    void  InitStatBar ( void );
    void  InitToolTips( void );
    void  InitSimEng  ( void );
    void  InitLogFiles( void );
    void  InitPosnSize( void );
    void  DoLayout    ( void );

	  // Read / write simulation information from / to file
    bool  bSimnLoad  ( void );
    bool  bSimnReload( void );
    bool  bSimnSave  ( void );

    // Check that helper utilities are present & accounted for
    bool  bIsOkSimEng( PrcBase * poPrcSimEng );
    bool  bIsOkViewer( PrcBase * poPrcViewer );
    bool  bIsOkBinary( PrcBase * poProcess, const wxString & rosPurpose );

    void  LockGUI( bool bEnable );  // Lock GUI controls

  public :

          FrmMain( const wxApp * poApp=NULL );
         ~FrmMain( );

    bool  bIsOpen( void ) { return( m_bIsOpen ); }

    bool  bClear( void );  // Clear the object attributes

    // Display a dialogue containing an error message
    void  DlgErrMsg( const wxString & rosTitle=wxT(""), const wxString & rosMsg=wxT("") );

  private :

    // Event handlers
    void  OnOpen      ( wxCommandEvent & roEvtCmd   );
    void  OnImport    ( wxCommandEvent & roEvtCmd   );
    void  OnReload    ( wxCommandEvent & roEvtCmd   );
    void  OnClose     ( wxCommandEvent & roEvtCmd   );
    void  OnQuit      ( wxCommandEvent & roEvtCmd   );

    void  OnSimCreate ( wxCommandEvent & roEvtCmd   );
    void  OnSimRun    ( wxCommandEvent & roEvtCmd   );
    void  OnSimStop   ( wxCommandEvent & roEvtCmd   );
    void  OnSchematic ( wxCommandEvent & roEvtCmd   );
    void  OnViewData  ( wxCommandEvent & roEvtCmd   );
	
	// BEGIN: Event handlers for vSACAMOS
    void  OngUpSym    ( wxCommandEvent & roEvtCmd   );	
    void  Ongschem    ( wxCommandEvent & roEvtCmd   );	
    void  Ongnetlist  ( wxCommandEvent & roEvtCmd   );	
    void  OnSResults  ( wxCommandEvent & roEvtCmd   ); 	
    // END: Event handlers for vSACAMOS

    void  OnSelSimEng ( wxCommandEvent & roEvtCmd   );
    void  OnPrefs     ( wxCommandEvent & roEvtCmd   );
    void  OnManualUser( wxCommandEvent & roEvtCmd   );
    void  OnManualNGSP( wxCommandEvent & roEvtCmd   ) { } // Not yet implemented ???
    void  OnManualGCAP( wxCommandEvent & roEvtCmd   ) { } // Not yet implemented ???
    void  OnAbout     ( wxCommandEvent & roEvtCmd   );
    void  OnToolEnter ( wxCommandEvent & roEvtCmd   );
    void  OnSysExit   ( wxCloseEvent   & roEvtClose );

    friend  class  FileTasks;

    // In order to be able to react to a menu command, it must be given a
    // unique identifier such as a const or an enum.
    enum eFrmItemID
    {
      ID_MNU_OPEN = 1,
      ID_MNU_IMPORT,
      ID_MNU_RELOAD,
      ID_MNU_CLOSE,
      ID_MNU_QUIT,
      ID_MNU_CREATE,
	  
      ID_MNU_RUN,
      ID_MNU_STOP,
      ID_MNU_SCHEM,
      ID_MNU_VIEWER,
	    	  
	  // BEGIN: Menu item ID for vSACAMOS
      ID_MNU_GUPSYM,
      ID_MNU_GSCHEM,
      ID_MNU_GNETLIST,
      ID_MNU_SRESULTS,
	  // END: Menu item ID for vSACAMOS
	  
	  
      ID_MNU_NGSPICE,
      ID_MNU_GNUCAP,
      ID_MNU_PREFS,
      ID_MNU_MAN_USER,
      ID_MNU_MAN_NGSP,
      ID_MNU_MAN_GCAP,
      ID_MNU_ABOUT,

      ID_TBR_OPEN,
      ID_TBR_IMPORT,
      ID_TBR_RELOAD,
      ID_TBR_CLOSE,
	  
      ID_TBR_CREATE,
      ID_TBR_RUN,
      ID_TBR_STOP,
      ID_TBR_SCHEM,
      ID_TBR_VIEWER,
	  
	  // BEGIN: Menu item ID for vSACAMOS
	  ID_TBR_GUPSYM,
      ID_TBR_GSCHEM,
      ID_TBR_GNETLIST,
      ID_TBR_SRESULTS,
	  // END: Menu item ID for vSACAMOS
	  
      ID_TBR_HELP,
      ID_TBR_FST = ID_TBR_OPEN,
      ID_TBR_LST = ID_TBR_HELP,

      ID_LBX_NODES,
      ID_LBX_CPNTS,

      ID_NBK_ANALYSIS,
      ID_NBK_TXTCTRLS,

      ID_UNUSED,      // Assigned to controls for which events are not used
    };

    // Leave this as the last line as private access is envoked by this macro
    wxDECLARE_EVENT_TABLE( );
};

//**************************************************************************************************

#endif // FRMMAIN_HPP