📄 filetasks.cpp
字号:
// TRUE - Success// FALSE - Failurebool FileTasks::bOkGNetList( void ){ wxString os1; // Check that gnetlist exists and is accessible if( ! m_oPrcGNetList.bBinExists( ) ) { if( m_poFrmMain != NULL ) { os1 << wxT("\nCan't find ") << m_oPrcGNetList.roGetBinary( ).GetFullName( ) << wxT(" which is required to import a schematic\nfile. ") << wxT("There is no path to it or it has not been installed.\n\n"); m_poFrmMain->DlgErrMsg( wxT("Configuration Fault"), os1 ); } return( FALSE ); } return( TRUE );}//*****************************************************************************// Set the schematic file name/s.//// Argument List:// roasFileName - A string arraay containing the full path and file name/s//// Return Values:// TRUE - Success// FALSE - Failurebool FileTasks::bSetSchems( const wxArrayString & roasFileNames ){ if( ! bClear( ) ) return( FALSE ); if( ! m_oPrcGNetList.bSetSchems( roasFileNames ) ) return( FALSE ); if( m_poFrmMain != NULL ) m_poFrmMain->bSetTitle( ); // Set frame title text return( TRUE );}//*****************************************************************************// Set a Guile procedure name to be used for importing schematic files using// GNetList.//// Argument List:// rosProcName - The Guile procedure name// (Refer to GNetList documentation for list of procedure names)bool FileTasks::bSetGuileProc( const wxString & rosProcName ){ return( m_oPrcGNetList.bSetGuileProc( rosProcName ) );}//*****************************************************************************// Set the net list file name.//// Argument List:// psFileName - A string containing the full path and file name//// Return Values:// TRUE - Success// FALSE - Failurebool FileTasks::bSetNetList( const wxString & rosFileName ){ if( ! bClear( ) ) return( FALSE ); if( ! m_oPrcGNetList.bSetNetList( rosFileName ) ) return( FALSE ); if( m_poFrmMain != NULL ) m_poFrmMain->bSetTitle( ); // Set frame title text return( TRUE );}//*****************************************************************************// Set the temporary file management strategy on close or exit.//// Argument List:// eTmpFileMgt - An enumerated type indicating what to do with temp. files//// Return Values:// TRUE - Success// FALSE - Failurebool FileTasks::bSetTmpFileMgnt( eTmpFileMgntType eTmpFileMgnt ){ if( eTmpFileMgnt<eTFM_FST || eTmpFileMgnt>eTFM_LST ) return( FALSE ); m_eTmpFileMgnt = eTmpFileMgnt; return( TRUE );}//*****************************************************************************// Get an array containing the schematic file name/s.//// Return Values:// An array of schematic file namesconst wxArrayString & FileTasks::roasGetSchems( void ){ static wxArrayString oas1; wxString os1; size_t szt1; oas1.Clear( ); for( szt1=0; szt1<m_oPrcGNetList.sztGetSchemCnt( ); szt1++ ) { os1 = m_oPrcGNetList.roGetSchem( szt1 ).GetFullPath( ); if( ! os1.IsEmpty( ) ) oas1.Add( os1 ); } return( oas1 );}//*****************************************************************************// Get the currently selected Guile procedure.//// Return Values:// The currently selected Guile procedureconst wxString & FileTasks::rosGetGuileProc( void ){ return( m_oPrcGNetList.rosGetGuileProc( ) );}//*****************************************************************************// Get the net list file name.//// Return Values:// The net list file nameconst wxString & FileTasks::rosGetNetList( void ){ static wxString os1; os1 = m_oPrcGNetList.roGetNetList( ).GetFullPath( ); return( os1 );}//*****************************************************************************// Open and load a circuit description (net list) file into a Simulation// object.//// Argument List:// roSim - The Simulation object to be loaded//// Return Values:// TRUE - Success// FALSE - Failurebool FileTasks::bOpen( Simulation & roSim ){ bool bRtn=TRUE; wxString os1; // Get the net list file name from the user if( ! bDlgOpen( ) ) return( FALSE ); // Change the cursor to the wait symbol ::wxSetCursor( wxCursor( wxCURSOR_WAIT ) ); // Clear the main frame object attributes m_poFrmMain->bClear( ); // Display the net list page m_poFrmMain->m_oNbkTxtCtls.bSetPage( NbkTxtCtls::ePAGE_NETLIST ); DELAY_MS( 100 ); // Allow time for the GUI to be updated // Attempt to load the circuit description file if( ! bLoadFile( roSim ) ) bRtn = FALSE; // Change the cursor to the default ::wxSetCursor( wxNullCursor ); return( bRtn );}//*****************************************************************************// Import a schematic file by converting it to a net list using GNetList and// then loading it into a Simulation object.//// Argument List:// roSim - The Simulation object to be loaded//// Return Values:// TRUE - Success// FALSE - Failurebool FileTasks::bImport( Simulation & roSim ){ bool bRtn=TRUE; wxString os1; // Check that gNetList binary exists and is accessible if( ! bOkGNetList( ) ) return( FALSE ); // Get the schematic file name/s from the user if( ! bDlgImport( ) ) return( FALSE ); // Change the cursor to the wait symbol ::wxSetCursor( wxCursor( wxCURSOR_WAIT ) ); // Clear the main frame object attributes m_poFrmMain->bClear( ); // Display the console page m_poFrmMain->m_oNbkTxtCtls.bSetPage( NbkTxtCtls::ePAGE_CONSOLE ); DELAY_MS( 100 ); // Allow time for the GUI to be updated // Convert the schematic file/s to a net list file if( ! bExecImport( ) ) bRtn = FALSE; // Attempt to load the circuit description file if( bRtn && !bLoadFile( roSim ) ) bRtn = FALSE; // Change the cursor to the default ::wxSetCursor( wxNullCursor ); return( bRtn );}//*****************************************************************************// Reload a Simulation object whether it be from a schematic or net list file.//// Return Values:// TRUE - Success// FALSE - Failurebool FileTasks::bReload( Simulation & roSim ){ bool bRtn=TRUE; // Change the cursor to the wait symbol ::wxSetCursor( wxCursor( wxCURSOR_WAIT ) ); // If a schematic file/s has been specified import it if( m_oPrcGNetList.sztGetSchemCnt( ) > 0 ) if( ! bExecImport( ) ) bRtn = FALSE; // Attempt to load the circuit description file if( bRtn ) if( ! bLoadFile( roSim ) ) bRtn = FALSE; // Change the cursor to the default ::wxSetCursor( wxNullCursor ); return( bRtn );}//*****************************************************************************// Close the circuit description file.void FileTasks::Close( void ){ DelTmpFiles( ); // Delete temporary files bClear( ); // Clear the object attributes}//*****************************************************************************// Delete temporary file before the application exits.void FileTasks::Exit( void ){ DelTmpFiles( ); // Delete temporary files}//*****************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -