pnlgnucapop.cpp

来自「gspiceui电子CAD仿真程序.用于电路参数模拟仿真」· C++ 代码 · 共 292 行

CPP
292
字号
//*****************************************************************************//                               PnlGnuCapOP.cpp                              *//                              -----------------                             *//  Started     : 06/11/2003                                                  *//  Last Update : 20/07/2005                                                  *//  Copyright   : (C) 2003 by MSWaters                                        *//  Email       : M.Waters@bom.gov.au                                         *//*****************************************************************************//*****************************************************************************//                                                                            *//    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 2 of the License, or       *//    (at your option) any later version.                                     *//                                                                            *//*****************************************************************************#include "PnlGnuCapOP.hpp"//*****************************************************************************// Implement an event table.BEGIN_EVENT_TABLE( PnlGnuCapOP, PnlAnaBase )  EVT_RADIOBOX( ID_RBX_SCALE,   PnlGnuCapOP::OnScale   )  EVT_CHOICE  ( ID_CHO_SRCCPNT, PnlGnuCapOP::OnSrcCpnt )END_EVENT_TABLE( )//*****************************************************************************// Constructor.//// Argunebt List://   poWin - A pointer to the parent windowPnlGnuCapOP::PnlGnuCapOP( wxWindow * poWin ) : PnlAnaBase( poWin ){  bSetType( Simulation::eANA_OP );  Create( );  bClear( );}//*****************************************************************************// Destructor.PnlGnuCapOP::~PnlGnuCapOP( ){}//*****************************************************************************// Create the display objects.void  PnlGnuCapOP::Create( void ){  int  ix, iy;  // Set the frequency sweep parameter labels  m_oSbxSwpPars.GetSize( &ix, &iy );  m_oSbxSwpPars.SetSize(  ix, 167 );  m_oSbxSwpPars.SetLabel( wxT("Temperature Sweep") );  m_oPnlStart  .bSetName( wxT("Start Temperature") );  m_oPnlStop   .bSetName( wxT("Stop Temperature") );  // Set sweep parameter units  m_oPnlStart.bSetUType( ChoUnits::eUNTS_TEMP );  m_oPnlStop .bSetUType( ChoUnits::eUNTS_TEMP );  m_oPnlStep .bSetUType( ChoUnits::eUNTS_TEMP );  // Create and add the scale radio buttons  wxString  osScale[2] = { wxT("Lin  "),wxT("Log ") };  m_oRbxScale.Create( this, ID_RBX_SCALE, wxT("Step Scale"), wxPoint( 13, 123 ),                      wxDefaultSize, 2, osScale, 2 );  bSetScale( eSCALE_LIN );  CreateSrc( );  // Create input source controls}//*****************************************************************************// Set the state of the step scale radio box.//// Argument List://   eScale - The enumerated scale specifier//// Return Values://   Success - TRUE//   Failure - FALSEbool  PnlGnuCapOP::bSetScale( eScaleType eScale ){  wxCommandEvent  oEvtCmd;  if( eScale<eSCALE_FST || eScale>eSCALE_LST ) return( FALSE );  if( m_oRbxScale.GetCount( ) < eScale+1 )     return( FALSE );  m_oRbxScale.SetSelection( (int) eScale );  OnScale( oEvtCmd );  return( TRUE );}//*****************************************************************************// Clear the object attributes.//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PnlGnuCapOP::bClear( void ){  bool  bRtn=TRUE;  // Clear the base class  if( ! PnlAnaBase::bClear( ) )   bRtn = FALSE;  m_oPnlStep.bSetValue( (float) 1.0 );  // Set the step scale default  if( ! bSetScale( eSCALE_LIN ) ) bRtn = FALSE;  return( bRtn );}//*****************************************************************************// Load information from a Simulation object.//// Argument List://   roSim - The Simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PnlGnuCapOP::bLoad( Simulation & roSim ){  wxString  os1;  bool  bRtn=TRUE;  uint  ui1;  // Load the components into the source choice box  m_oChoSrcCpnt.Clear( );  m_oChoSrcCpnt.Append( wxT("None") );  const wxArrayString & roasCpnts = roSim.roasGetCpntLbls( );  for( ui1=0; ui1<roasCpnts.GetCount( ); ui1++ )  {    os1 = roasCpnts.Item( ui1 );    if( os1.Length( ) <= 0 ) continue;    switch( wxToupper( os1.GetChar( 0 ) ) )    {      case wxT('C'):      case wxT('L'):      case wxT('R'):      case wxT('I'):      case wxT('V'): break;      default : continue;    }    m_oChoSrcCpnt.Append( os1 );  }  m_oChoSrcCpnt.SetStringSelection( wxT("None") );  // Don't go any further if the analysis type doesn't match  if( roSim.eGetAnaType( ) != eGetType( ) ) return( bRtn );  // Perform any base class load tasks  if( ! PnlAnaBase::bLoad( roSim ) ) bRtn = FALSE;  // Set the sweep scale  m_oRbxScale.SetSelection( roSim.iGetSwpScale( ) );  wxCommandEvent oEvtCmd;  OnScale( oEvtCmd );  return( bRtn );}//*****************************************************************************// Reload information from a Simulation object.//// Argument List://   roSim - The Simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PnlGnuCapOP::bReload( Simulation & roSim ){  ChoUnits::eUnitsType  eUType;  wxString  os1, os2;  os1 = m_oChoSrcCpnt.GetStringSelection( );  eUType = m_oPnlSrcLvl.eGetUType( );  os2 = m_oPnlSrcLvl.rosGetValue( );  if( ! bLoad( roSim ) ) return( FALSE );  if( !os1.IsEmpty( ) && os1!=wxT("None") )  {    m_oChoSrcCpnt.SetStringSelection( os1 );    m_oPnlSrcLvl.bSetUType( eUType );    m_oPnlSrcLvl.bSetValue( os2 );  }  return( TRUE );}//*****************************************************************************// Save information to a Simulation object.//// Argument List://   roSim - The simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PnlGnuCapOP::bSave( Simulation & roSim ){  float  f1;  int    i1;  // Execute base class save tasks  PnlAnaBase::bSave( roSim );  // Check that the step size is valid  if( m_oRbxScale.GetSelection( ) == 0 )  {    f1 = fabs( roSim.fGetSwpStop( ) - roSim.fGetSwpStart( ) );    if( f1>0.0 && roSim.fGetSwpStep( ) > f1 )      SetError( wxT("Step size is greater than sweep range.") );  }  // Set the sweep scale  i1 = m_oRbxScale.GetSelection( );  if( i1 == (int) eSCALE_LOG )    if( m_oPnlStep.dfGetValue( ) == 1.0 )      SetError( wxT("Step multiplier invalid, must be non-unity.") );  if( ! roSim.bSetSwpScale( i1 ) )    SetError( wxT("Sweep scale couldn't be set.") );  return( bIsOk( ) );}//*****************************************************************************//                                                                            *//                             Event Handlers                                 *//                                                                            *//*****************************************************************************// Step scale radio box event handler.//// Argument List://   roEvtCmd - An object holding information about the eventvoid  PnlGnuCapOP::OnScale( wxCommandEvent & roEvtCmd ){  switch( m_oRbxScale.GetSelection( ) )  {    case eSCALE_LIN:      m_oPnlStep.bSetName( wxT("Step Increment") );      m_oPnlStep.bSetParms( 1.0, 0.1, 100.0, 1.0, 10.0 );      m_oPnlStep.bShowChoUnts( TRUE );      break;    case eSCALE_LOG:      m_oPnlStep.bSetName( wxT("Step Multiplier") );      m_oPnlStep.bSetParms( 1.1, 0.1, 100.0, 1.0, 10.0 );      m_oPnlStep.bShowChoUnts( FALSE );      break;    default:      break;  }}//*****************************************************************************// Source component choice box event handler.//// Argument List://   roEvtCmd - An object holding information about the eventvoid  PnlGnuCapOP::OnSrcCpnt( wxCommandEvent & roEvtCmd ){  if( m_oChoSrcCpnt.GetSelection( ) == 0 )    m_oPnlSrcLvl.bSetValue( (double) 0.0 );  else if( m_oPnlSrcLvl.dfGetValue( ) == 0.0 )    m_oPnlSrcLvl.bSetValue( (double) 1.0 );  SetSrcUType( );  if( m_oPnlSrcLvl.eGetUType( ) == ChoUnits::eUNTS_VOLT )    m_oPnlSrcLvl.bSetUnits( wxT("V") );}//*****************************************************************************

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?