Replace DisplayError to an infobar for missing footprint library
This commit is contained in:
parent
db8e15ce88
commit
c19804bb95
|
@ -65,6 +65,9 @@
|
||||||
#include <wx/srchctrl.h>
|
#include <wx/srchctrl.h>
|
||||||
#include <wx/tokenzr.h>
|
#include <wx/tokenzr.h>
|
||||||
#include <wx/choice.h>
|
#include <wx/choice.h>
|
||||||
|
#include <wx/hyperlink.h>
|
||||||
|
|
||||||
|
#include "invoke_pcb_dialog.h"
|
||||||
|
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
|
|
||||||
|
@ -1060,20 +1063,51 @@ bool FOOTPRINT_VIEWER_FRAME::ShowModal( wxString* aFootprint, wxWindow* aParent
|
||||||
if( fpid.IsValid() )
|
if( fpid.IsValid() )
|
||||||
{
|
{
|
||||||
wxString libraryName = fpid.GetLibNickname();
|
wxString libraryName = fpid.GetLibNickname();
|
||||||
|
WX_INFOBAR* infobar;
|
||||||
|
wxHyperlinkCtrl* button;
|
||||||
|
bool hasInfobar = false;
|
||||||
|
|
||||||
|
if( !fpTable->HasLibrary( fpid.GetLibNickname(), false )
|
||||||
|
|| !fpTable->HasLibrary( fpid.GetLibNickname(), true ) )
|
||||||
|
{
|
||||||
|
CreateInfoBar();
|
||||||
|
if( infobar = GetInfoBar() )
|
||||||
|
{
|
||||||
|
hasInfobar = true;
|
||||||
|
button = new wxHyperlinkCtrl( infobar, wxID_ANY,
|
||||||
|
_( "Manage symol libraries" ),
|
||||||
|
wxEmptyString );
|
||||||
|
button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent & aEvent )>(
|
||||||
|
[=]( wxHyperlinkEvent& aEvent )
|
||||||
|
{
|
||||||
|
InvokePcbLibTableEditor( &Kiway(), this );
|
||||||
|
} ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( !fpTable->HasLibrary( fpid.GetLibNickname(), false ) )
|
if( !fpTable->HasLibrary( fpid.GetLibNickname(), false ) )
|
||||||
{
|
{
|
||||||
msg.sprintf( _( "The current configuration does not include library '%s'. Use "
|
if( hasInfobar )
|
||||||
"Manage Footprint Libraries to edit the configuration." ),
|
{
|
||||||
libraryName );
|
msg.Printf( _( "Footprint library not found. The current configuration does "
|
||||||
DisplayErrorMessage( aParent, _( "Footprint library not found." ), msg );
|
"not include library '%s'." ), libraryName );
|
||||||
|
infobar->RemoveAllButtons();
|
||||||
|
infobar->AddButton( button );
|
||||||
|
infobar->AddCloseButton();
|
||||||
|
infobar->ShowMessage( msg, wxICON_INFORMATION );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( !fpTable->HasLibrary( fpid.GetLibNickname(), true ) )
|
else if ( !fpTable->HasLibrary( fpid.GetLibNickname(), true ) )
|
||||||
{
|
{
|
||||||
msg.sprintf( _( "Library '%s' is not enabled in the current configuration. Use "
|
if( hasInfobar )
|
||||||
"Manage Footprint Libraries to edit the configuration." ),
|
{
|
||||||
libraryName );
|
msg.Printf( _( "Footprint library not enabled. Library '%s' is not enabled "
|
||||||
DisplayErrorMessage( aParent, _( "Footprint library not enabled." ), msg );
|
"in the current configuration." ), libraryName );
|
||||||
|
infobar->RemoveAllButtons();
|
||||||
|
infobar->AddButton( button );
|
||||||
|
infobar->AddCloseButton();
|
||||||
|
infobar->ShowMessage( msg, wxICON_INFORMATION );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue