XNODE* NETLIST_EXPORTER_GENERIC::makeDesignHeader() { SCH_SCREEN* screen; XNODE* xdesign = node( wxT( "design" ) ); XNODE* xtitleBlock; XNODE* xsheet; XNODE* xcomment; wxString sheetTxt; wxFileName sourceFileName; // the root sheet is a special sheet, call it source xdesign->AddChild( node( wxT( "source" ), g_RootSheet->GetScreen()->GetFileName() ) ); xdesign->AddChild( node( wxT( "date" ), DateAndTime() ) ); // which Eeschema tool xdesign->AddChild( node( wxT( "tool" ), wxT( "Eeschema " ) + GetBuildVersion() ) ); /* Export the sheets information */ SCH_SHEET_LIST sheetList( g_RootSheet ); for( unsigned i = 0; i < sheetList.size(); i++ ) { screen = sheetList[i].LastScreen(); xdesign->AddChild( xsheet = node( wxT( "sheet" ) ) ); // get the string representation of the sheet index number. // Note that sheet->GetIndex() is zero index base and we need to increment the // number by one to make it human readable sheetTxt.Printf( wxT( "%u" ), i + 1 ); xsheet->AddAttribute( wxT( "number" ), sheetTxt ); xsheet->AddAttribute( wxT( "name" ), sheetList[i].PathHumanReadable() ); xsheet->AddAttribute( wxT( "tstamps" ), sheetList[i].Path() ); TITLE_BLOCK tb = screen->GetTitleBlock(); xsheet->AddChild( xtitleBlock = node( wxT( "title_block" ) ) ); xtitleBlock->AddChild( node( wxT( "title" ), tb.GetTitle() ) ); xtitleBlock->AddChild( node( wxT( "company" ), tb.GetCompany() ) ); xtitleBlock->AddChild( node( wxT( "rev" ), tb.GetRevision() ) ); xtitleBlock->AddChild( node( wxT( "date" ), tb.GetDate() ) ); // We are going to remove the fileName directories. sourceFileName = wxFileName( screen->GetFileName() ); xtitleBlock->AddChild( node( wxT( "source" ), sourceFileName.GetFullName() ) ); xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) ); xcomment->AddAttribute( wxT("number"), wxT("1") ); xcomment->AddAttribute( wxT( "value" ), tb.GetComment1() ); xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) ); xcomment->AddAttribute( wxT("number"), wxT("2") ); xcomment->AddAttribute( wxT( "value" ), tb.GetComment2() ); xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) ); xcomment->AddAttribute( wxT("number"), wxT("3") ); xcomment->AddAttribute( wxT( "value" ), tb.GetComment3() ); xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) ); xcomment->AddAttribute( wxT("number"), wxT("4") ); xcomment->AddAttribute( wxT( "value" ), tb.GetComment4() ); } return xdesign; }
bool DIALOG_PAGES_SETTINGS::SavePageSettings() { bool success = false; wxString fileName = GetWksFileName(); if( fileName != BASE_SCREEN::m_PageLayoutDescrFileName ) { wxString fullFileName = WORKSHEET_LAYOUT::MakeFullFileName( fileName, m_projectPath ); if( !fullFileName.IsEmpty() && !wxFileExists( fullFileName ) ) { wxString msg; msg.Printf( _( "Page layout description file \"%s\" not found." ), GetChars( fullFileName ) ); wxMessageBox( msg ); return false; } BASE_SCREEN::m_PageLayoutDescrFileName = fileName; WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance(); pglayout.SetPageLayout( fullFileName ); m_localPrjConfigChanged = true; } int idx = std::max( m_paperSizeComboBox->GetSelection(), 0 ); const wxString paperType = m_pageFmt[idx]; if( paperType.Contains( PAGE_INFO::Custom ) ) { GetCustomSizeMilsFromDialog(); success = m_pageInfo.SetType( PAGE_INFO::Custom ); if( success ) { PAGE_INFO::SetCustomWidthMils( m_layout_size.x ); PAGE_INFO::SetCustomHeightMils( m_layout_size.y ); m_pageInfo.SetWidthMils( m_layout_size.x ); m_pageInfo.SetHeightMils( m_layout_size.y ); } } else { // search for longest common string first, e.g. A4 before A if( paperType.Contains( PAGE_INFO::USLetter ) ) success = m_pageInfo.SetType( PAGE_INFO::USLetter ); else if( paperType.Contains( PAGE_INFO::USLegal ) ) success = m_pageInfo.SetType( PAGE_INFO::USLegal ); else if( paperType.Contains( PAGE_INFO::USLedger ) ) success = m_pageInfo.SetType( PAGE_INFO::USLedger ); else if( paperType.Contains( PAGE_INFO::GERBER ) ) success = m_pageInfo.SetType( PAGE_INFO::GERBER ); else if( paperType.Contains( PAGE_INFO::A4 ) ) success = m_pageInfo.SetType( PAGE_INFO::A4 ); else if( paperType.Contains( PAGE_INFO::A3 ) ) success = m_pageInfo.SetType( PAGE_INFO::A3 ); else if( paperType.Contains( PAGE_INFO::A2 ) ) success = m_pageInfo.SetType( PAGE_INFO::A2 ); else if( paperType.Contains( PAGE_INFO::A1 ) ) success = m_pageInfo.SetType( PAGE_INFO::A1 ); else if( paperType.Contains( PAGE_INFO::A0 ) ) success = m_pageInfo.SetType( PAGE_INFO::A0 ); else if( paperType.Contains( PAGE_INFO::A ) ) success = m_pageInfo.SetType( PAGE_INFO::A ); else if( paperType.Contains( PAGE_INFO::B ) ) success = m_pageInfo.SetType( PAGE_INFO::B ); else if( paperType.Contains( PAGE_INFO::C ) ) success = m_pageInfo.SetType( PAGE_INFO::C ); else if( paperType.Contains( PAGE_INFO::D ) ) success = m_pageInfo.SetType( PAGE_INFO::D ); else if( paperType.Contains( PAGE_INFO::E ) ) success = m_pageInfo.SetType( PAGE_INFO::E ); if( success ) { int choice = m_orientationComboBox->GetSelection(); m_pageInfo.SetPortrait( choice != 0 ); } } if( !success ) { wxASSERT_MSG( false, _( "the translation for paper size must preserve original spellings" ) ); m_pageInfo.SetType( PAGE_INFO::A4 ); } m_parent->SetPageSettings( m_pageInfo ); m_tb.SetRevision( m_TextRevision->GetValue() ); m_tb.SetDate( m_TextDate->GetValue() ); m_tb.SetCompany( m_TextCompany->GetValue() ); m_tb.SetTitle( m_TextTitle->GetValue() ); m_tb.SetComment1( m_TextComment1->GetValue() ); m_tb.SetComment2( m_TextComment2->GetValue() ); m_tb.SetComment3( m_TextComment3->GetValue() ); m_tb.SetComment4( m_TextComment4->GetValue() ); m_parent->SetTitleBlock( m_tb ); #ifdef EESCHEMA // Exports settings to other sheets if requested: SCH_SCREEN* screen; // Build the screen list SCH_SCREENS ScreenList; // Update title blocks for all screens for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) { if( screen == m_screen ) continue; TITLE_BLOCK tb2 = screen->GetTitleBlock(); if( m_RevisionExport->IsChecked() ) tb2.SetRevision( m_tb.GetRevision() ); if( m_DateExport->IsChecked() ) tb2.SetDate( m_tb.GetDate() ); if( m_TitleExport->IsChecked() ) tb2.SetTitle( m_tb.GetTitle() ); if( m_CompanyExport->IsChecked() ) tb2.SetCompany( m_tb.GetCompany() ); if( m_Comment1Export->IsChecked() ) tb2.SetComment1( m_tb.GetComment1() ); if( m_Comment2Export->IsChecked() ) tb2.SetComment2( m_tb.GetComment2() ); if( m_Comment3Export->IsChecked() ) tb2.SetComment3( m_tb.GetComment3() ); if( m_Comment4Export->IsChecked() ) tb2.SetComment4( m_tb.GetComment4() ); screen->SetTitleBlock( tb2 ); } #endif return true; }