Eeschema: remove rogue symbol libraries from project file.

Check for symbol libraries that somehow ended up in the project file
after remapping occurred and remove all of them to prevent potentially
broken symbol library links.

Add nagware dialog to warn the user and a checkbox to never show the
dialog again.

Fixes lp:1838185

https://bugs.launchpad.net/kicad/+bug/1838185
This commit is contained in:
Wayne Stambaugh 2019-08-01 13:26:21 -04:00
parent 9dcf3b862c
commit 8789ab9265
4 changed files with 44 additions and 6 deletions

View File

@ -115,7 +115,7 @@ COLOR4D GetInvisibleItemColor()
}
void SCH_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
void SCH_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
{
wxTreebook* book = aParent->GetTreebook();
@ -123,8 +123,9 @@ void SCH_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
book->AddPage( new PANEL_EESCHEMA_SETTINGS( this, book ), _( "Eeschema" ) );
book->AddSubPage( new PANEL_EESCHEMA_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
book->AddSubPage( new PANEL_EESCHEMA_COLOR_CONFIG( this, book ), _( "Colors" ) );
book->AddSubPage( new PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( this, book ), _( "Field Name Templates" ) );
book->AddSubPage( new PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( this, book ),
_( "Field Name Templates" ) );
aHotkeysPanel->AddHotKeys( GetToolManager() );
}
@ -258,6 +259,7 @@ static const wxString PrintSheetRefEntry = "PrintSheetReferenceAndTitle
static const wxString RepeatStepXEntry = "RepeatStepX";
static const wxString RepeatStepYEntry = "RepeatStepY";
static const wxString RepeatLabelIncrementEntry = "RepeatLabelIncrement";
static const wxString ShowIllegalSymboLibDialog = "ShowIllegalSymbolLibDialog";
// Library editor wxConfig entry names.
static const wxChar defaultLibWidthEntry[] = wxT( "LibeditLibWidth" );
@ -296,6 +298,9 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings()
m_configSettings.push_back( new PARAM_CFG_INT( true, RepeatLabelIncrementEntry,
&m_repeatDeltaLabel, DEFAULT_REPEAT_LABEL_INC,
-10, +10 ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, ShowIllegalSymboLibDialog,
&m_showIllegalSymbolLibDialog, true ) );
return m_configSettings;
}
@ -406,7 +411,8 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
{
EDA_DRAW_FRAME::LoadSettings( aCfg );
SetDefaultLineThickness( (int) aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
SetDefaultLineThickness( (int) aCfg->Read( DefaultDrawLineWidthEntry,
DEFAULTDRAWLINETHICKNESS ) );
SetDefaultPinLength( (int) aCfg->Read( DefaultPinLengthEntry, DEFAULTPINLENGTH ) );
m_textPinNumDefaultSize = (int) aCfg->Read( defaultPinNumSizeEntry, DEFAULTPINNUMSIZE );
m_textPinNameDefaultSize = (int) aCfg->Read( defaultPinNameSizeEntry, DEFAULTPINNAMESIZE );

View File

@ -348,6 +348,36 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
}
else
{
// Double check to ensure no legacy library list entries have been
// added to the projec file symbol library list.
wxString paths;
wxArrayString libNames;
PART_LIBS::LibNamesAndPaths( &Prj(), false, &paths, &libNames );
if( !libNames.IsEmpty() )
{
if( m_showIllegalSymbolLibDialog )
{
wxRichMessageDialog invalidLibDlg(
this,
_( "Illegal entry found in project file symbol library list." ),
_( "Project Load Warning" ),
wxOK | wxCENTER | wxICON_EXCLAMATION );
invalidLibDlg.SetExtendedMessage(
_( "Symbol libraries defined in the project file symbol library list "
"are no longer supported and will be\nremoved. This may cause "
"broken symbol library links under certain conditions." ) );
invalidLibDlg.ShowCheckBox( _( "Do not show this dialog again." ) );
invalidLibDlg.ShowModal();
m_showIllegalSymbolLibDialog = !invalidLibDlg.IsCheckBoxChecked();
}
libNames.Clear();
paths.Clear();
PART_LIBS::LibNamesAndPaths( &Prj(), true, &paths, &libNames );
}
// Check to see whether some old library parts need to be rescued
// Only do this if RescueNeverShow was not set.
wxConfigBase *config = Kiface().KifaceSettings();

View File

@ -242,6 +242,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
SetShowPageLimits( true );
m_undoItem = NULL;
m_hasAutoSave = true;
m_showIllegalSymbolLibDialog = true;
m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
m_AboutTitle = "Eeschema";
@ -1178,4 +1179,4 @@ void SCH_EDIT_FRAME::FixupJunctions()
SetCurrentSheet( currSheet );
GetCurrentSheet().UpdateAllScreenReferences();
SetScreen( GetCurrentSheet().LastScreen() );
}
}

View File

@ -107,7 +107,7 @@ private:
PARAM_CFG_ARRAY m_configSettings;
ERC_SETTINGS m_ercSettings;
wxPageSetupDialogData m_pageSetupData;
bool m_printMonochrome; ///< Print monochrome instead of grey scale.
bool m_printMonochrome; ///< Print monochrome instead of grey scale.
bool m_printSheetReference;
SCH_ITEM* m_item_to_repeat; ///< Last item to insert by the repeat command.
int m_repeatLabelDelta; ///< Repeat label number increment step.
@ -125,6 +125,7 @@ private:
bool m_autoplaceJustify; ///< allow autoplace to change justification
bool m_autoplaceAlign; ///< align autoplaced fields to the grid
bool m_footprintPreview; ///< whether to show footprint previews
bool m_showIllegalSymbolLibDialog;
DIALOG_SCH_FIND* m_findReplaceDialog;
STATUS_TEXT_POPUP* m_findReplaceStatusPopup;