116 m_report.requiresConnectivityRebuild =
m_plan.requiresConnectivityRebuild;
118 auto result = std::make_unique<BOARD>();
121 std::map<KIID_PATH, const ITEM_RESOLUTION*> actionsById;
124 actionsById[r.
id] = &r;
130 auto readProjectSiblingFile =
131 [](
const BOARD* aBoard,
const wxString& aName,
bool aIsFullName ) -> wxString
134 return wxEmptyString;
138 if( boardPath.IsEmpty() )
139 return wxEmptyString;
141 wxFileName fn( boardPath );
144 fn.SetFullName( aName );
148 if( !fn.FileExists() )
149 return wxEmptyString;
151 wxFile file( fn.GetFullPath() );
153 if( !file.IsOpened() )
154 return wxEmptyString;
157 file.ReadAll( &contents );
161 auto readSiblingRules =
162 [&](
const BOARD* aBoard ) -> wxString
168 auto readFpLibTable =
169 [&](
const BOARD* aBoard ) -> wxString
175 auto readSymLibTable =
176 [&](
const BOARD* aBoard ) -> wxString
190 auto docIt = actionsById.find( docPath );
192 if( docIt != actionsById.end() )
193 docRes = docIt->second;
199 switch( docRes->
kind )
213 auto detachNetSettingsFor =
226 auto adoptNetSettings =
227 [&](
const BOARD* aSource )
229 if( !aSource || !aSource->GetDesignSettings().m_NetSettings
230 || !
result->GetDesignSettings().m_NetSettings )
235 result->GetDesignSettings().m_NetSettings->CopyFrom( *aSource->GetDesignSettings().m_NetSettings );
240 [&](
const BOARD* aSource )
242 result->SetEnabledLayers( aSource->GetEnabledLayers() );
244 for(
PCB_LAYER_ID layer : aSource->GetEnabledLayers().Seq() )
246 const wxString
name = aSource->GetLayerName( layer );
248 result->SetLayerType( layer, aSource->GetLayerType( layer ) );
267 adoptLayers( settingsSrc );
268 detachNetSettingsFor(
result.get() );
269 adoptNetSettings( settingsSrc );
284 static const std::map<int, SEVERITY> s_emptySeverities;
285 const std::map<int, SEVERITY>& ancDrc =
m_ancestor ?
m_ancestor->GetDesignSettings().m_DRCSeverities
288 const bool oursDrcChanged =
m_ours &&
m_ours->GetDesignSettings().m_DRCSeverities != ancDrc;
289 const bool theirsDrcChanged =
m_theirs &&
m_theirs->GetDesignSettings().m_DRCSeverities != ancDrc;
294 auto netSettingsEqual =
301 const auto& rhs = aRhs->GetDesignSettings().m_NetSettings;
319 const wxString ancRules = readSiblingRules(
m_ancestor );
320 const wxString oursRules = readSiblingRules(
m_ours );
321 const wxString theirsRules = readSiblingRules(
m_theirs );
323 const bool oursRulesChanged =
m_ours && oursRules != ancRules;
324 const bool theirsRulesChanged =
m_theirs && theirsRules != ancRules;
330 if( oursRulesChanged || theirsRulesChanged )
332 if( settingsSrc ==
m_ours )
333 m_report.customDrcRules = oursRules;
335 m_report.customDrcRules = theirsRules;
346 const wxString ancFp = readFpLibTable(
m_ancestor );
347 const wxString oursFp = readFpLibTable(
m_ours );
348 const wxString theirsFp = readFpLibTable(
m_theirs );
350 const bool oursFpChanged =
m_ours && oursFp != ancFp;
351 const bool theirsFpChanged =
m_theirs && theirsFp != ancFp;
353 if( oursFpChanged || theirsFpChanged )
355 if( settingsSrc ==
m_ours )
365 const wxString ancSym = readSymLibTable(
m_ancestor );
366 const wxString oursSym = readSymLibTable(
m_ours );
367 const wxString theirsSym = readSymLibTable(
m_theirs );
369 const bool oursSymChanged =
m_ours && oursSym != ancSym;
370 const bool theirsSymChanged =
m_theirs && theirsSym != ancSym;
372 if( oursSymChanged || theirsSymChanged )
374 if( settingsSrc ==
m_ours )
386 auto drawingSheet = [](
const BOARD* aBoard ) -> wxString
389 return wxEmptyString;
394 const wxString ancSheet = drawingSheet(
m_ancestor );
395 const bool sheetDiverged =
407 if( sheetDiverged && settingsSrc && settingsSrc->
GetProject() )
411 m_report.drawingSheetFileSet =
true;
414 if( oursDrcChanged || theirsDrcChanged )
416 m_report.drcSeveritiesTouched =
true;
420 if( oursNetChanged || theirsNetChanged )
426 if( sheetDiverged || oursRulesChanged || theirsRulesChanged
427 || oursFpChanged || theirsFpChanged || oursSymChanged || theirsSymChanged )
447 bool pageTouched =
false;
451 const BOARD* src = pickBoard( prop.
kind );
477 std::map<wxString, wxString> props =
result->GetProperties();
481 props[key] = it->second;
485 result->SetProperties( props );
493 result->AddVariant( variant );
498 result->DeleteVariant( variant );
509 result->GetDesignSettings().GetStackupDescriptor() =
522 m_report.drcSeveritiesTouched =
true;
527 m_report.fpLibTable = readFpLibTable( src );
533 m_report.symLibTable = readSymLibTable( src );
546 m_report.customDrcRules = readSiblingRules( src );
561 &&
result->GetDesignSettings().m_NetSettings )
581 m_report.drawingSheetFileSet =
true;
593 files->
AddFile( std::make_shared<EMBEDDED_FILES::EMBEDDED_FILE>( *file ) );
607 result->SetPageSettings( merged );
614 std::set<KIID> allIds;
623 path.push_back( aUuid );
625 auto it = actionsById.find(
path );
627 if( it == actionsById.end() )
635 std::set<KIID_PATH> consumedActions;
637 for(
const KIID& uuid : allIds )
640 topPath.push_back( uuid );
642 if( actionsById.count( topPath ) )
643 consumedActions.insert( topPath );
734 const BOARD_ITEM* base = ours ? ours : ( ancestor ? ancestor : theirs );
761 std::map<KIID, FOOTPRINT*> footprintsByUuid;
766 footprintsByUuid[fp->m_Uuid] = fp;
769 for(
const auto& [actionPath, action] : actionsById )
771 if( consumedActions.count( actionPath ) )
774 if( actionPath.size() < 2 )
777 const KIID& parentUuid = actionPath.at( 0 );
778 const KIID& childUuid = actionPath.at( 1 );
781 auto fpIt = footprintsByUuid.find( parentUuid );
782 FOOTPRINT* parentFp = fpIt != footprintsByUuid.end() ? fpIt->second :
nullptr;
791 if(
pad->m_Uuid == childUuid )
802 if( g && g->m_Uuid == childUuid )
814 if( z && z->m_Uuid == childUuid )
826 if( f && ( f->m_Uuid == childUuid ||
PcbDiffItemId( *f ) == childUuid ) )
836 auto adoptChildFrom =
837 [&](
const BOARD* aSide )
857 parentFp->
Remove( targetChild );
859 targetChild =
nullptr;
865 std::unique_ptr<EDA_ITEM> cloned( src->
Clone() );
867 if(
auto* childClone =
dynamic_cast<BOARD_ITEM*
>( cloned.get() ) )
876 switch( action->kind )
916 parentFp->
Remove( targetChild );
942 entry.
refdes = fp->GetReference();
944 entry.
id.push_back( fp->m_Uuid );
953 m_report.connectivityRebuildPerformed =
m_plan.requiresConnectivityRebuild;
Describe the page size and margins of a paper page on which to eventually print or plot.
bool SetType(PAGE_SIZE_TYPE aPageSize, bool aIsPortrait=false)
Set the name of the page type and also the sizes and margins commonly associated with that type name.