Blame view

GUI/SW2/SRC/src/base/PnlAnaBase.hpp 6 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
//**************************************************************************************************
//                                         PnlAnaBase.hpp                                          *
//                                        ----------------                                         *
// Description : This class derives from the wxPanel class and provides a base class for all       *
//               analysis panel classes.                                                           *
// Started     : 2004-04-26                                                                        *
// Last Update : 2016-11-09                                                                        *
// Copyright   : (C) 2004-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 PNLANABASE_HPP
#define PNLANABASE_HPP

// Application Includes

#include "TypeDefs.hpp"
#include "netlist/Component.hpp"
#include "utility/PnlValue.hpp"
#include "utility/StrUtils.hpp"

// wxWidgets Library Includes

#include <wx/gbsizer.h>

// Local Constant Declarations

// It's bad not using a layout manager but it's how it's done at present. I've invented the
// pre-processor flag "LAYOUT_MNGR" to help transition to full use of layout managers. The idea is
// to switch between layout manager and hard coded layout. Ie. keep the hard coded layout code until
// I'm sure the new layout manager code works.
//#define  LAYOUT_MNGR

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

class PnlAnaBase : public wxPanel
{
  protected :

    // The analysis type of the panel
    eTypeCmd        m_eAnaType;

    // An array containing the signal source components
    ArrayComponent  m_oaCpntSrcs;

    // Error message
    wxString        m_osErrMsg;

    // Sweep settings
    wxStaticBox     m_oSbxSwpPars;
    PnlValue        m_oPnlStart;
    PnlValue        m_oPnlStop;
    PnlValue        m_oPnlStep;

    // Radio control used for various purposes depending on the analysis type
    wxRadioBox      m_oRbxSweep;

    // Parameters to be calculated
    wxStaticBox     m_oSbxCalcPars;
    wxCheckBox      m_oCbxVoltage;
    wxCheckBox      m_oCbxCurrent;
    wxCheckBox      m_oCbxPower;
    wxCheckBox      m_oCbxResist;

    // Complex Parts
    wxStaticBox     m_oSbxCpxPrt;
    wxCheckBox      m_oCbxMag;
    wxCheckBox      m_oCbxPhase;
    wxCheckBox      m_oCbxReal;
    wxCheckBox      m_oCbxImag;
    wxCheckBox      m_oCbxMagDb;

    // Input signal source, value and units
    wxStaticBox     m_oSbxSigSrc;
    wxChoice        m_oChoSrcName;
    PnlValue        m_oPnlSrcLvl;

    // .OPTIONS configuration dialog button
    wxButton        m_oBtnOPTIONS;

    // Analysis temperature
    wxStaticBox     m_oSbxTemp;
    PnlValue        m_oPnlTemp;

    // Functions to create the display objects
    virtual  void  CreateBase  ( void );
    virtual  void  CreateScale ( void );
    virtual  void  CreateInitC ( void );
    virtual  void  CreateSigSrc( void );
    virtual  void  CreateCpxPrt( void );
    virtual  void  CreateTemp  ( void );

    virtual  void  DoLayout( void );

    virtual  void  InitScale( void ) { }
    virtual  bool  bSetScale( eTypeScale eScale );

             bool  bSetInitC   ( eTypeInitC eInitC );
             void  LoadSrcNames( ArrayComponent & roaCpnts, wxString osPrefixes );
             bool  bSetSrcCpnt ( Component & roCpnt );
             void  ToolTips    ( void );                      // ??? Not yet implemented

  public :

    // The last sweep source selected by the user
    static  Component  m_oCpntSwpSrc;

                       PnlAnaBase( wxWindow * poWin );
                      ~PnlAnaBase( );

    virtual  bool      bClear( void );
             bool      bIsOk( void )          { return( m_osErrMsg.IsEmpty( ) ); }

             bool      bSetAnalysType( eTypeCmd eAnaType );
             eTypeCmd  eGetAnalysType( void ) { return( m_eAnaType ); }

    // Get or set the error message
    const wxString & rosGetErrMsg( void )     { return( m_osErrMsg ); }
          void          SetErrMsg( const wxString & rosErrMsg )
                                              { if( bIsOk( ) ) m_osErrMsg = rosErrMsg; }

    // Event handlers
    void  OnSrcName( wxCommandEvent & roEvtCmd );

    friend  class  NbkSimrBase;
    friend  class  NbkGnuCap;
    friend  class  NbkNgSpice;

    // 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 ePnlItemID
    {
      ID_PNL_START = 1,
      ID_PNL_STOP,
      ID_PNL_STEP,

      ID_RBX_SWEEP,
      ID_RBX_SCALE,
      ID_RBX_INITC,

      ID_CHO_SRCNAME,
      ID_PNL_SRCLVL,

      ID_CBX_MAG,
      ID_CBX_PHASE,
      ID_CBX_REAL,
      ID_CBX_IMAG,
      ID_CBX_MAGDB,

      ID_CBX_VOLT,
      ID_CBX_CURR,
      ID_CBX_PWR,
      ID_CBX_RES,

      ID_BTN_OPTIONS,

      ID_PNL_TEMP,

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

      ID_FST = ID_PNL_START,
      ID_LST = ID_PNL_TEMP
    };

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

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

#endif // PNLANABASE_HPP