pnlgnucapfo.cpp

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

CPP
263
字号
//*****************************************************************************//                                PnlGnuCapFO.cpp                             *//                               -----------------                            *//  Started     : 26/04/2004                                                  *//  Last Update : 01/07/2005                                                  *//  Copyright   : (C) 2004 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 "PnlGnuCapFO.hpp"//*****************************************************************************// Implement an event table.BEGIN_EVENT_TABLE( PnlGnuCapFO, PnlAnaBase )  EVT_BUTTON( ID_BTN_SETUP, PnlGnuCapFO::OnBtnSetup )END_EVENT_TABLE( )//*****************************************************************************// Constructor.PnlGnuCapFO::PnlGnuCapFO( wxWindow * poWin )                        : PnlAnaBase( poWin ), m_oDlgGenCfg( poWin ){  bSetType( Simulation::eANA_FO );  Create( );  InitGen( );  bClear( );}//*****************************************************************************// Destructor.PnlGnuCapFO::~PnlGnuCapFO( ){}//*****************************************************************************// Create the display objects.void  PnlGnuCapFO::Create( void ){  // Set the frequency sweep parameter labels  m_oSbxSwpPars.SetLabel( wxT("Frequency Sweep") );  m_oPnlStart  .bSetName( wxT("Start Frequency") );  m_oPnlStop   .bSetName( wxT("Stop Frequency") );  m_oPnlStep   .bSetName( wxT("Step Increment") );  // Set sweep parameter units  m_oPnlStart.bSetUType( ChoUnits::eUNTS_FREQ );  m_oPnlStop .bSetUType( ChoUnits::eUNTS_FREQ );  m_oPnlStep .bSetUType( ChoUnits::eUNTS_FREQ );  // Create and add generator controls  new wxStaticBox     ( this, ID_UNUSED, wxT("Generator"),    wxPoint(  6, 175 ),                        wxSize( 228, 55 ) );	m_oChoSrcCpnt.Create( this, ID_CHO_SRCCPNT,                 wxPoint( 18, 195 ),                        wxSize( 107, 27 ) );  m_oBtnSetup  .Create( this, ID_BTN_SETUP, wxT("Setup ..."), wxPoint(130, 195 ),                        wxSize( 95, 27 ) );  // Create and add the analysis temperature controls  CreateTemp( );}//*****************************************************************************// Initialize the generator dialog.void  PnlGnuCapFO::InitGen( void ){  m_oDlgGenCfg.bSetPnlValue( DlgGenCfg::ID_PNL_AMP,    1.0, wxT("x 1")    );  m_oDlgGenCfg.bSetPnlValue( DlgGenCfg::ID_PNL_OFFSET, 0.0, wxT("mV")     );  m_oDlgGenCfg.bSetPnlValue( DlgGenCfg::ID_PNL_FREQ,  10.0, wxT("kHz")    );  m_oDlgGenCfg.bSetPnlValue( DlgGenCfg::ID_PNL_PHASE,  0.0, wxT("Degree") );  m_oDlgGenCfg.bSetPnlValue( DlgGenCfg::ID_PNL_INITV,  0.0 );  m_oDlgGenCfg.bSetPnlValue( DlgGenCfg::ID_PNL_MINV,   0.0 );  m_oDlgGenCfg.bSetPnlValue( DlgGenCfg::ID_PNL_MAXV,   0.0 );  m_oDlgGenCfg.bSetPnlValue( DlgGenCfg::ID_PNL_RISE,   0.0 );  m_oDlgGenCfg.bSetPnlValue( DlgGenCfg::ID_PNL_FALL,   0.0 );  m_oDlgGenCfg.bSetPnlValue( DlgGenCfg::ID_PNL_DELAY,  0.0 );  m_oDlgGenCfg.bSetPnlValue( DlgGenCfg::ID_PNL_WIDTH,  0.0 );  m_oDlgGenCfg.bSetPnlValue( DlgGenCfg::ID_PNL_PERIOD, 0.0 );  m_oDlgGenCfg.bEnablePanel( DlgGenCfg::ID_PNL_INITV,  FALSE );  m_oDlgGenCfg.bEnablePanel( DlgGenCfg::ID_PNL_MINV,   FALSE );  m_oDlgGenCfg.bEnablePanel( DlgGenCfg::ID_PNL_MAXV,   FALSE );  m_oDlgGenCfg.bEnablePanel( DlgGenCfg::ID_PNL_RISE,   FALSE );  m_oDlgGenCfg.bEnablePanel( DlgGenCfg::ID_PNL_FALL,   FALSE );  m_oDlgGenCfg.bEnablePanel( DlgGenCfg::ID_PNL_DELAY,  FALSE );  m_oDlgGenCfg.bEnablePanel( DlgGenCfg::ID_PNL_WIDTH,  FALSE );  m_oDlgGenCfg.bEnablePanel( DlgGenCfg::ID_PNL_PERIOD, FALSE );}//*****************************************************************************// Clear the object attributes.//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PnlGnuCapFO::bClear( void ){  bool  bRtn=TRUE;  // Clear the base class  if( ! PnlAnaBase::bClear( ) ) bRtn = FALSE;  m_oPnlStart.bSetValue( (float)  1.0 );  m_oPnlStep .bSetValue( (float) 10.0 );  // Set input source default values  m_oChoSrcCpnt.Clear( );  m_oChoSrcCpnt.Append( wxT("None") );  m_oChoSrcCpnt.SetSelection( 0 );    // Clear the generator dialog  InitGen( );  return( bRtn );}//*****************************************************************************// Load information from a Simulation object.//// Argument List://   roSim - The Simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PnlGnuCapFO::bLoad( Simulation & roSim ){  wxString  os1;  bool  bRtn=TRUE;  uint  ui1;  m_oChoSrcCpnt.Clear( );  m_oChoSrcCpnt.Append( wxT("None") );  // Load the components into the generator component choice box  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('V'):      case wxT('I'): 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;  return( bRtn );}//*****************************************************************************// Reload information from a Simulation object.//// Argument List://   roSim - The Simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PnlGnuCapFO::bReload( Simulation & roSim ){  wxString  os1;  os1 = m_oChoSrcCpnt.GetStringSelection( );    if( ! bLoad( roSim ) ) return( FALSE );  if( !os1.IsEmpty( ) && os1!=wxT("None") )    m_oChoSrcCpnt.SetStringSelection( os1 );  return( TRUE );}//*****************************************************************************// Save information to a Simulation object.//// Argument List://   roSim - The Simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PnlGnuCapFO::bSave( Simulation & roSim ){  wxStringTokenizer  ostok1;  wxString  os1;  size_t    szt1;  // Execute base class save tasks  PnlAnaBase::bSave( roSim );  // Set the component to be used as the sweep source  if( m_oChoSrcCpnt.GetSelection( ) > 0 )  { // Find the component to used as a generator    for( szt1=0; szt1<roSim.roasGetCpnts( ).GetCount( ); szt1++ )    {      os1 = roSim.roasGetCpnts( ).Item( szt1 );      if( os1.BeforeFirst( wxT(' ') ) == m_oChoSrcCpnt.GetStringSelection( ) )        break;    }    // Convert the component string to a generator string    ostok1.SetString( os1 );    os1.Empty( );    for( szt1=0; szt1<3; szt1++ ) os1 << ostok1.GetNextToken( ) << wxT(' ');    os1 << wxT("GENERATOR(1)");    // Add the generator definition command line    roSim.bAddSimCmd( m_oDlgGenCfg.rosGetGenCmd( ) );  }  else os1 = wxT("");  if( ! roSim.bSetSrcCpnt( os1 ) )    SetError( wxT("Source (generator) component couldn't be set.") );  return( TRUE );}//*****************************************************************************//                                                                            *//                             Event Handlers                                 *//                                                                            *//*****************************************************************************// Generator component setup button control event handler.//// Argument List://   roEvtCmd - An object holding information about the eventvoid  PnlGnuCapFO::OnBtnSetup( wxCommandEvent & roEvtCmd ){  m_oDlgGenCfg.CenterOnParent( );  m_oDlgGenCfg.ShowModal( );}//*****************************************************************************

⌨️ 快捷键说明

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