bool SCH_PRINTOUT::OnPrintPage( int page )
{
    SCH_SHEET_LIST sheetList( g_RootSheet );

    wxCHECK_MSG( page >= 1 && page <= (int)sheetList.size(), false,
                 wxT( "Cannot print invalid page number." ) );

    wxCHECK_MSG( sheetList[ page - 1].LastScreen() != NULL, false,
                 wxT( "Cannot print page with NULL screen." ) );

    wxString msg;
    msg.Printf( _( "Print page %d" ), page );
    m_parent->ClearMsgPanel();
    m_parent->AppendMsgPanel( msg, wxEmptyString, CYAN );

    SCH_SCREEN*     screen       = m_parent->GetScreen();
    SCH_SHEET_PATH  oldsheetpath = m_parent->GetCurrentSheet();
    m_parent->SetCurrentSheet( sheetList[ page - 1 ] );
    m_parent->GetCurrentSheet().UpdateAllScreenReferences();
    m_parent->SetSheetNumberAndCount();
    screen = m_parent->GetCurrentSheet().LastScreen();
    DrawPage( screen );
    m_parent->SetCurrentSheet( oldsheetpath );
    m_parent->GetCurrentSheet().UpdateAllScreenReferences();
    m_parent->SetSheetNumberAndCount();

    return true;
}
示例#2
0
/**
 * Function RunPlugin
 * run the plugin command line
 */
void DIALOG_BOM::OnRunPlugin( wxCommandEvent& event )
{
    wxFileName  fn;
    wxString    fileWildcard;
    wxString    title = _( "Save Netlist File" );

    // Calculate the xml netlist filename
    fn = g_RootSheet->GetScreen()->GetFileName();

    if( fn.GetPath().IsEmpty() )
       fn.SetPath( wxPathOnly( Prj().GetProjectFullName() ) );

    fn.ClearExt();
    wxString fullfilename = fn.GetFullPath();
    m_parent->ClearMsgPanel();

    m_parent->SetNetListerCommand( m_textCtrlCommand->GetValue() );
    m_parent->CreateNetlist( -1, fullfilename, 0 );
}