1 //************************************************************************************************** 2 // PnlAnaBase.hpp * 3 // ---------------- * 4 // Description : This class derives from the wxPanel class and provides a base class for all * 5 // analysis panel classes. * 6 // Started : 2004-04-26 * 7 // Last Update : 2015-01-31 * 8 // Copyright : (C) 2004 by MSWaters * 9 //************************************************************************************************** 10 11 //************************************************************************************************** 12 // * 13 // This program is free software; you can redistribute it and/or modify it under the * 14 // terms of the GNU General Public License as published by the Free Software Foundation; * 15 // either version 3 of the License, or (at your option) any later version. * 16 // * 17 //************************************************************************************************** 18 19 #ifndef PNLANABASE_HPP 20 #define PNLANABASE_HPP 21 22 // Application Includes 23 24 #include "TypeDefs.hpp" 25 #include "netlist/Component.hpp" 26 #include "utility/PnlValue.hpp" 27 #include "utility/StrUtils.hpp" 28 29 // wxWidgets Library Includes 30 31 #include <wx/gbsizer.h> 32 33 // Local Constant Declarations 34 35 // It's bad not using a layout manager but it's how it's done at present. I've invented the 36 // pre-processor flag "LAYOUT_MNGR" to help transition to full use of layout managers. The idea is 37 // to switch between layout manager and hard coded layout. Ie. keep the hard coded layout code until 38 // I'm sure the new layout manager code works. 39 //#define LAYOUT_MNGR 40 41 //************************************************************************************************** 42 43 class PnlAnaBase : public wxPanel 44 { 45 protected : 46 47 // The analysis type of the panel 48 eTypeCmd m_eAnaType; 49 50 // An array containing the signal source components 51 ArrayComponent m_oaCpntSrcs; 52 53 // Error message 54 wxString m_osErrMsg; 55 56 // Sweep settings 57 wxStaticBox m_oSbxSwpPars; 58 PnlValue m_oPnlStart; 59 PnlValue m_oPnlStop; 60 PnlValue m_oPnlStep; 61 62 // Radio control used for various purposes depending on the analysis type 63 wxRadioBox m_oRbxSweep; 64 65 // Parameters to be calculated 66 wxStaticBox m_oSbxCalcPars; 67 wxCheckBox m_oCbxVoltage; 68 wxCheckBox m_oCbxCurrent; 69 wxCheckBox m_oCbxPower; 70 wxCheckBox m_oCbxResist; 71 72 // Complex Parts 73 wxStaticBox m_oSbxCpxPrt; 74 wxCheckBox m_oCbxMag; 75 wxCheckBox m_oCbxPhase; 76 wxCheckBox m_oCbxReal; 77 wxCheckBox m_oCbxImag; 78 wxCheckBox m_oCbxMagDb; 79 80 // Input signal source, value and units 81 wxStaticBox m_oSbxSigSrc; 82 wxChoice m_oChoSrcName; 83 PnlValue m_oPnlSrcLvl; 84 85 // .OPTIONS configuration dialog button 86 wxButton m_oBtnOPTIONS; 87 88 // Analysis temperature 89 wxStaticBox m_oSbxTemp; 90 PnlValue m_oPnlTemp; 91 92 // Functions to create the display objects 93 virtual void CreateBase ( void ); 94 virtual void CreateScale ( void ); 95 virtual void CreateInitC ( void ); 96 virtual void CreateSigSrc( void ); 97 virtual void CreateCpxPrt( void ); 98 virtual void CreateTemp ( void ); 99 100 virtual void DoLayout( void ); 101 InitScale(void)102 virtual void InitScale( void ) { } 103 virtual bool bSetScale( eTypeScale eScale ); 104 105 bool bSetInitC ( eTypeInitC eInitC ); 106 void LoadSrcNames( ArrayComponent & roaCpnts, wxString osPrefixes ); 107 bool bSetSrcCpnt ( Component & roCpnt ); 108 void ToolTips ( void ); // ??? Not yet implemented 109 110 public : 111 112 // The last sweep source selected by the user 113 static Component m_oCpntSwpSrc; 114 115 PnlAnaBase( wxWindow * poWin ); 116 ~PnlAnaBase( ); 117 118 virtual bool bClear( void ); 119 bIsOk(void)120 bool bIsOk( void ) { return( m_osErrMsg.IsEmpty( ) ); } 121 122 bool bSetAnalysType( eTypeCmd eAnaType ); 123 eGetAnalysType(void)124 eTypeCmd eGetAnalysType( void ) { return( m_eAnaType ); } 125 126 // Get or set the error message rosGetErrMsg(void)127 const wxString & rosGetErrMsg( void ) { return( m_osErrMsg ); } SetErrMsg(const wxString & rosErrMsg)128 void SetErrMsg( const wxString & rosErrMsg ) 129 { if( bIsOk( ) ) m_osErrMsg = rosErrMsg; } 130 131 // Event handlers 132 void OnSrcName( wxCommandEvent & roEvtCmd ); 133 134 friend class NbkSimrBase; 135 friend class NbkGnuCap; 136 friend class NbkNgSpice; 137 138 // In order to be able to react to a menu command, it must be given a 139 // unique identifier such as a const or an enum. 140 enum ePnlItemID 141 { 142 ID_PNL_START = 1, 143 ID_PNL_STOP, 144 ID_PNL_STEP, 145 146 ID_RBX_SWEEP, 147 ID_RBX_SCALE, 148 ID_RBX_INITC, 149 150 ID_CHO_SRCNAME, 151 ID_PNL_SRCLVL, 152 153 ID_CBX_MAG, 154 ID_CBX_PHASE, 155 ID_CBX_REAL, 156 ID_CBX_IMAG, 157 ID_CBX_MAGDB, 158 159 ID_CBX_VOLT, 160 ID_CBX_CURR, 161 ID_CBX_PWR, 162 ID_CBX_RES, 163 164 ID_BTN_OPTIONS, 165 166 ID_PNL_TEMP, 167 168 ID_UNUSED, // Assigned to controls for which events are not used 169 170 ID_FST = ID_PNL_START, 171 ID_LST = ID_PNL_TEMP 172 }; 173 174 // Leave this as the last line as private access is envoked by macro 175 wxDECLARE_EVENT_TABLE( ); 176 }; 177 178 //************************************************************************************************** 179 180 #endif // PNLANABASE_HPP 181