63#define RESOLVE_PAGE( T, pageIndex ) static_cast<T*>( m_treebook->ResolvePage( pageIndex ) )
66 PAGED_DIALOG( aParentWindow ? aParentWindow : aFrame,
_(
"Board Setup" ), false, false,
67 _(
"Import Settings from Another Board..." ), wxSize( 980, 600 ) ),
93 SetEvtHandlerEnabled(
false );
109 [
this]( wxWindow* aParent ) -> wxWindow*
112 },
_(
"Board Editor Layers" ) );
116 [
this]( wxWindow* aParent ) -> wxWindow*
121 },
_(
"Physical Stackup" ) );
125 [
this]( wxWindow* aParent ) -> wxWindow*
128 },
_(
"Board Finish" ) );
132 [
this]( wxWindow* aParent ) -> wxWindow*
135 },
_(
"Solder Mask/Paste" ) );
139 [
this]( wxWindow* aParent ) -> wxWindow*
142 },
_(
"Drill Chart" ) );
148 [
this]( wxWindow* aParent ) -> wxWindow*
151 },
_(
"Defaults" ) );
155 [
this]( wxWindow* aParent ) -> wxWindow*
158 },
_(
"Formatting" ) );
161 [
this]( wxWindow* aParent ) -> wxWindow*
164 },
_(
"Text Variables" ) );
170 [
this]( wxWindow* aParent ) -> wxWindow*
173 },
_(
"Constraints" ) );
177 [
this]( wxWindow* aParent ) -> wxWindow*
180 },
_(
"Pre-defined Sizes" ) );
184 [
this]( wxWindow* aParent ) -> wxWindow*
188 _(
"Microvia Stacks" ) );
192 [
this]( wxWindow* aParent ) -> wxWindow*
200 [
this]( wxWindow* aParent ) -> wxWindow*
203 },
_(
"Teardrops" ) );
207 [
this]( wxWindow* aParent ) -> wxWindow*
215 },
_(
"Length-tuning Patterns" ) );
219 [
this]( wxWindow* aParent ) -> wxWindow*
223 m_frame->Prj().GetProjectFile().TuningProfileParameters() );
225 _(
"Tuning Profiles" ) );
229 [
this]( wxWindow* aParent ) -> wxWindow*
233 m_frame->Prj().GetProjectFile().NetSettings(),
236 },
_(
"Net Classes" ) );
240 [
this]( wxWindow* aParent ) -> wxWindow*
244 aParent,
m_frame,
m_frame->Prj().GetProjectFile().ComponentClassSettings(),
247 _(
"Component Classes" ) );
251 [
this]( wxWindow* aParent ) -> wxWindow*
255 _(
"Custom Rules" ) );
259 [
this]( wxWindow* aParent ) -> wxWindow*
265 _(
"Violation Severity" ) );
270 [
this]( wxWindow* aParent ) -> wxWindow*
274 std::vector<EMBEDDED_FILES*> inheritedFiles;
277 inheritedFiles.push_back( fp->GetEmbeddedFiles() );
281 _(
"Embedded Files" ) );
285 for(
size_t i = 0; i <
m_treebook->GetPageCount(); ++i )
288 SetEvtHandlerEnabled(
true );
296 if(
Prj().IsReadOnly() )
298 m_infoBar->ShowMessage(
_(
"Project is missing or read-only. Some settings will not be editable." ),
302 wxBookCtrlEvent evt( wxEVT_TREEBOOK_PAGE_CHANGED, wxID_ANY, 0 );
319 if( !rules || !rules->IsModified() )
322 return OKOrCancelDialog(
this,
_(
"Confirmation" ),
_(
"Discard changes to custom rules?" ), wxEmptyString,
323 _(
"Discard Changes" ) ) == wxID_OK;
362 auto* tuningProfiles =
367 const std::map<wxString, wxString> renames = tuningProfiles->TakeProfileRenames();
369 if( !renames.empty() )
371 std::shared_ptr<NET_SETTINGS>& netSettings =
m_frame->Prj().GetProjectFile().NetSettings();
373 auto remapProfile = [&renames](
const std::shared_ptr<NETCLASS>& aNetclass )
375 auto it = renames.find( aNetclass->GetTuningProfile() );
377 if( it != renames.end() )
378 aNetclass->SetTuningProfile( it->second );
381 remapProfile( netSettings->GetDefaultNetclass() );
383 for(
const auto& [
name, netclass] : netSettings->GetNetclasses() )
384 remapProfile( netclass );
386 netSettings->ClearAllCaches();
398 size_t page = aEvent.GetSelection();
439 if(
Prj().IsReadOnly() )
453 if( importDlg.
ShowModal() == wxID_CANCEL )
463 wxFileName projectFn( boardFn );
466 wxString msg = wxString::Format(
_(
"Error importing settings from board:\n"
467 "Associated project file %s could not be loaded" ),
468 projectFn.GetFullPath() );
482 bool okToProceed =
true;
485 std::unique_ptr<BOARD> otherBoard;
491 pi->SetProgressReporter( &progressReporter );
493 otherBoard = pi->LoadBoard( boardFn.GetFullPath() );
500 okToProceed =
m_layers->CheckCopperLayerCount( loadedBoard, otherBoard.get() );
515 wxString msg = wxString::Format(
_(
"Error loading board file:\n%s" ), boardFn.GetFullPath() );
528 BOARD* other = otherBoard.get();
535 const bool activeProject = ( otherPrj == &
m_frame->Prj() );
537 struct BOARD_DETACH_GUARD
541 ~BOARD_DETACH_GUARD() {
if( board && !skip ) board->
ClearProject(); }
542 } detachGuard{ other, activeProject };
550 m_layers->ImportSettingsFrom( other );
Container for design settings for a BOARD object.
std::map< int, SEVERITY > m_DRCSeverities
PNS::MEANDER_SETTINGS m_DiffPairMeanderSettings
PNS::MEANDER_SETTINGS m_SingleTrackMeanderSettings
PNS::MEANDER_SETTINGS m_SkewMeanderSettings
Information pertinent to a Pcbnew printed circuit board.
EMBEDDED_FILES * GetEmbeddedFiles() override
std::set< wxString > GetNetClassAssignmentCandidates() const
Return the set of netname candidates for netclass assignment.
const FOOTPRINTS & Footprints() const
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
BOARD_DESIGN_SETTINGS & GetDesignSettings()
size_t m_embeddedFilesPage
DIALOG_BOARD_SETUP(PCB_EDIT_FRAME *aFrame, wxWindow *aWindow=nullptr)
size_t m_tracksAndViasPage
void onCancelButton(wxCommandEvent &aEvent)
size_t m_physicalStackupPage
void onPageChanging(wxBookCtrlEvent &aEvent) override
PANEL_SETUP_TUNING_PROFILES * m_tuningProfiles
void onAuxiliaryAction(wxCommandEvent &aEvent) override
size_t m_tuningPatternsPage
PANEL_SETUP_BOARD_STACKUP * m_physicalStackup
PANEL_SETUP_ZONES * m_zones
PANEL_SETUP_BOARD_FINISH * m_boardFinish
PANEL_SETUP_LAYERS * m_layers
size_t m_tuningProfilesPage
bool TransferDataFromWindow() override
size_t m_componentClassesPage
size_t m_maskAndPastePage
void onPageChanged(wxBookCtrlEvent &aEvent) override
PANEL_SETUP_NETCLASSES * m_netClasses
void onCloseWindow(wxCloseEvent &aEvent)
wxCheckBox * m_CustomRulesOpt
wxCheckBox * m_ZoneHatchingOffsetsOpt
wxCheckBox * m_MaskAndPasteOpt
wxCheckBox * m_ConstraintsOpt
wxCheckBox * m_ComponentClassesOpt
wxCheckBox * m_TuningPatternsOpt
wxCheckBox * m_SeveritiesOpt
wxCheckBox * m_TextAndGraphicsOpt
wxCheckBox * m_TuningProfilesOpt
wxCheckBox * m_FormattingOpt
wxCheckBox * m_TeardropsOpt
wxCheckBox * m_TracksAndViasOpt
wxCheckBox * m_NetclassesOpt
wxString GetFilePath() const
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
An exception saying that the user cancelled an interactive part of a load, import,...
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
WX_TREEBOOK * GetTreebook()
PAGED_DIALOG(wxWindow *aParent, const wxString &aTitle, bool aShowReset, bool aShowOpenFolder, const wxString &aAuxiliaryAction=wxEmptyString, const wxSize &aInitialSize=wxDefaultSize)
bool TransferDataFromWindow() override
virtual void onPageChanging(wxBookCtrlEvent &aEvent)
virtual void onPageChanged(wxBookCtrlEvent &aEvent)
Board-wide drill chart and map setup.
The main frame for Pcbnew.
@ KICAD_SEXP
S-expression Pcbnew file format.
static PCB_IO * FindPlugin(PCB_FILE_T aFileType)
Return a PCB_IO which the caller can use to import, export, save, or load design documents.
The backing store for a PROJECT, in JSON format.
std::shared_ptr< NET_SETTINGS > m_NetSettings
Net settings for this project (owned here)
std::shared_ptr< TUNING_PROFILES > & TuningProfileParameters()
std::shared_ptr< COMPONENT_CLASS_SETTINGS > m_ComponentClassSettings
Component class settings for the project (owned here)
Container for project specific data.
virtual PROJECT_FILE & GetProjectFile() const
Move-only RAII wrapper for "load a foreign PROJECT non-active and unload it on scope exit.
bool IsValid() const
True iff the project loaded (or was already loaded).
PROJECT * GetProject() const
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
int OKOrCancelDialog(wxWindow *aParent, const wxString &aWarning, const wxString &aMessage, const wxString &aDetailedMessage, const wxString &aOKLabel, const wxString &aCancelLabel, bool *aApplyToAll)
Display a warning dialog with aMessage and returns the user response.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
#define RESOLVE_PAGE(T, pageIndex)
static const std::string ProjectFileExtension
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
KICOMMON_API void Disable(wxWindow *aWindow)
Makes a window read-only.
Definition of file extensions used in Kicad.