dlggencfg.cpp
来自「gspiceui电子CAD仿真程序.用于电路参数模拟仿真」· C++ 代码 · 共 448 行 · 第 1/2 页
CPP
448 行
//*****************************************************************************// DlgGenCfg.cpp *// --------------- *// Started : 27/02/2004 *// Last Update : 21/07/2005 *// Copyright : (C) 2004 by M.S.Waters *// 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 "DlgGenCfg.hpp"//*****************************************************************************// Implement an event table.BEGIN_EVENT_TABLE( DlgGenCfg, wxDialog ) EVT_BUTTON( ID_BTN_OK, DlgGenCfg::OnBtnOk ) EVT_BUTTON( ID_BTN_CANCEL, DlgGenCfg::OnBtnCancel )END_EVENT_TABLE( )//*****************************************************************************// Constructor.DlgGenCfg::DlgGenCfg( wxWindow * poWin ) : wxDialog( poWin, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, wxDialogNameStr ){ SetTitle( wxT("Generator Setup") ); SetSize( wxSize( 290, 438 ) ); Init( ); bClear( );}//*****************************************************************************// Destructor.DlgGenCfg::~DlgGenCfg( ){}//*****************************************************************************// Initialize object attributes.void DlgGenCfg::Init( void ){ wxPanel * poPnl; wxBoxSizer * poSzr; wxSizerFlags oFlags; // Create and set the underlying dialogue sizer poSzr = new wxBoxSizer( wxVERTICAL ); SetSizer( poSzr ); // Create a panel to contain the total parameter controls poPnl = new wxPanel( this ); m_oPnlAmp .bCreate( poPnl, ID_PNL_AMP, 95 ); m_oPnlOffset.bCreate( poPnl, ID_PNL_OFFSET, 95 ); m_oPnlAmp .bSetName( wxT("Amplitude") ); m_oPnlOffset.bSetName( wxT("DC Offset") ); m_oPnlAmp .bSetUType( ChoUnits::eUNTS_SCLR ); m_oPnlOffset.bSetUType( ChoUnits::eUNTS_VOLT ); // Create and set the sizer for the pulse parameter controls poSzr = new wxStaticBoxSizer( wxVERTICAL, poPnl, wxT("Total") ); oFlags.Center( ); oFlags.Border( wxTOP | wxLEFT | wxRIGHT, 10 ); poSzr->Add( &m_oPnlAmp, oFlags ); oFlags.Border( wxBOTTOM, 5 ); poSzr->Add( &m_oPnlOffset, oFlags ); poPnl->SetSizer( poSzr ); poSzr->SetSizeHints( poPnl ); oFlags.Border( wxTOP | wxLEFT | wxRIGHT, 10 ); GetSizer( )->Add( poPnl, oFlags ); // Create a panel to contain the sine wave parameter controls poPnl = new wxPanel( this ); m_oPnlFreq .bCreate( poPnl, ID_PNL_FREQ, 95 ); m_oPnlPhase .bCreate( poPnl, ID_PNL_PHASE, 95 ); m_oPnlFreq .bSetName( wxT("Frequency") ); m_oPnlPhase .bSetName( wxT("Initial Phase") ); m_oPnlFreq .bSetUType( ChoUnits::eUNTS_FREQ ); m_oPnlPhase .bSetUType( ChoUnits::eUNTS_PHASE ); // Create and set the sizer for the sine wave parameter controls poSzr = new wxStaticBoxSizer( wxVERTICAL, poPnl, wxT("Sine Wave") ); oFlags.Border( wxTOP | wxLEFT | wxRIGHT, 10 ); poSzr->Add( &m_oPnlFreq, oFlags ); oFlags.Border( wxBOTTOM, 5 ); poSzr->Add( &m_oPnlPhase, oFlags ); poPnl->SetSizer( poSzr ); poSzr->SetSizeHints( poPnl ); oFlags.Border( wxTOP | wxLEFT | wxRIGHT, 10 ); GetSizer( )->Add( poPnl, oFlags ); // Create a panel to contain the pulse parameter controls poPnl = new wxPanel( this ); m_oPnlInitV .bCreate( poPnl, ID_PNL_INITV, 95 ); m_oPnlMinV .bCreate( poPnl, ID_PNL_MINV, 95 ); m_oPnlMaxV .bCreate( poPnl, ID_PNL_MAXV, 95 ); m_oPnlDelay .bCreate( poPnl, ID_PNL_DELAY, 95 ); m_oPnlRise .bCreate( poPnl, ID_PNL_RISE, 95 ); m_oPnlWidth .bCreate( poPnl, ID_PNL_WIDTH, 95 ); m_oPnlFall .bCreate( poPnl, ID_PNL_FALL, 95 ); m_oPnlPeriod.bCreate( poPnl, ID_PNL_PERIOD, 95 ); m_oPnlInitV .bSetName( wxT("Initial Value") ); m_oPnlMinV .bSetName( wxT("Minimum Level") ); m_oPnlMaxV .bSetName( wxT("Maximum Level") ); m_oPnlDelay .bSetName( wxT("Initial Delay") ); m_oPnlRise .bSetName( wxT("Rise Time") ); m_oPnlWidth .bSetName( wxT("Pulse Width") ); m_oPnlFall .bSetName( wxT("Fall Time") ); m_oPnlPeriod.bSetName( wxT("Period") ); m_oPnlInitV .bSetUType( ChoUnits::eUNTS_VOLT ); m_oPnlMinV .bSetUType( ChoUnits::eUNTS_VOLT ); m_oPnlMaxV .bSetUType( ChoUnits::eUNTS_VOLT ); m_oPnlDelay .bSetUType( ChoUnits::eUNTS_TIME ); m_oPnlRise .bSetUType( ChoUnits::eUNTS_TIME ); m_oPnlWidth .bSetUType( ChoUnits::eUNTS_TIME ); m_oPnlFall .bSetUType( ChoUnits::eUNTS_TIME ); m_oPnlPeriod.bSetUType( ChoUnits::eUNTS_TIME ); m_oPnlFreq.bSetRange( 0.0, 1000.0 ); m_oPnlFreq.bSetUnits( wxT("Hz") ); // Create and set the sizer for the pulse parameter controls poSzr = new wxStaticBoxSizer( wxVERTICAL, poPnl, wxT("Pulse") ); oFlags.Border( wxTOP, 10 ); poSzr->Add( &m_oPnlInitV, oFlags ); oFlags.Border( wxLEFT | wxRIGHT, 10 ); poSzr->Add( &m_oPnlMinV, oFlags ); poSzr->Add( &m_oPnlMaxV, oFlags ); poSzr->Add( &m_oPnlDelay, oFlags ); poSzr->Add( &m_oPnlRise, oFlags ); poSzr->Add( &m_oPnlWidth, oFlags ); poSzr->Add( &m_oPnlFall, oFlags ); oFlags.Border( wxBOTTOM, 5 ); poSzr->Add( &m_oPnlPeriod, oFlags ); poPnl->SetSizer( poSzr ); poSzr->SetSizeHints( poPnl ); oFlags.Border( wxALL, 10 ); GetSizer( )->Add( poPnl, oFlags ); // Create a panel for the buttons poPnl = new wxPanel( this ); m_oBtnOk .Create( poPnl, ID_BTN_OK, wxT("Ok") ); m_oBtnCancel.Create( poPnl, ID_BTN_CANCEL, wxT("Cancel") ); // Create and set the sizer for the buttons poSzr = new wxBoxSizer( wxHORIZONTAL ); oFlags.Border( wxTOP | wxLEFT | wxRIGHT, 10 ); poSzr->Add( &m_oBtnOk, oFlags ); poSzr->AddSpacer( 10 ); poSzr->Add( &m_oBtnCancel, oFlags ); poPnl->SetSizer( poSzr ); poSzr->SetSizeHints( poPnl ); oFlags.Border( wxBOTTOM, 20 ); GetSizer( )->Add( poPnl, oFlags ); // Set dialogues minimum size and initial size as calculated by the sizer GetSizer( )->SetSizeHints( this ); // Initialize temporary storage with the spin control values GetPnlValues( );}//*****************************************************************************// Get a reference to a value panel associated with a control ID number.//// Argument List:// iPnlID - The control ID number//// Return Values:// A reference to a value panelPnlValue & DlgGenCfg::roGetPanel( int iPnlID ){ // No argument tests here so use this function responsibly or suffer the pain switch( iPnlID ) { case ID_PNL_AMP : return( m_oPnlAmp ); case ID_PNL_OFFSET : return( m_oPnlOffset ); case ID_PNL_FREQ : return( m_oPnlFreq ); case ID_PNL_PHASE : return( m_oPnlPhase ); case ID_PNL_INITV : return( m_oPnlInitV ); case ID_PNL_MINV : return( m_oPnlMinV ); case ID_PNL_MAXV : return( m_oPnlMaxV ); case ID_PNL_DELAY : return( m_oPnlDelay ); case ID_PNL_RISE : return( m_oPnlRise ); case ID_PNL_WIDTH : return( m_oPnlWidth ); case ID_PNL_FALL : return( m_oPnlFall ); case ID_PNL_PERIOD : return( m_oPnlPeriod ); default : return( m_oPnlFreq ); }}//*****************************************************************************// Set the values in the spin controls from temporary storage.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?