Be more consistent about annotation warngings.
This can be a particular problem if you go to run ERC, it shows the annotation warnging so you re-annotate (but don't notice that your scope is set to Selection). Also adds some missing defensive code around closing a modeless RC checker before the document (which we had for DRC dialog but not the ERC dialog). Also fixes a missing override of GetSeverity which kept ERC messages from having the right prefix.
This commit is contained in:
parent
054f8ed7bd
commit
3a51fb6ac6
|
@ -33,7 +33,7 @@
|
|||
#include <tools/ee_selection.h>
|
||||
#include <tools/ee_selection_tool.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
#include <dialog_erc.h>
|
||||
|
||||
void SCH_EDIT_FRAME::mapExistingAnnotation( std::map<wxString, wxString>& aMap )
|
||||
{
|
||||
|
@ -114,6 +114,11 @@ void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool* aA
|
|||
// Update the references for the sheet that is currently being displayed.
|
||||
GetCurrentSheet().UpdateAllScreenReferences();
|
||||
|
||||
wxWindow* erc_dlg = wxWindow::FindWindowByName( DIALOG_ERC_WINDOW_NAME );
|
||||
|
||||
if( erc_dlg )
|
||||
static_cast<DIALOG_ERC*>( erc_dlg )->UpdateAnnotationWarning();
|
||||
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
|
@ -330,6 +335,11 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
|
|||
GetCurrentSheet().UpdateAllScreenReferences();
|
||||
SetSheetNumberAndCount();
|
||||
|
||||
wxWindow* erc_dlg = wxWindow::FindWindowByName( DIALOG_ERC_WINDOW_NAME );
|
||||
|
||||
if( erc_dlg )
|
||||
static_cast<DIALOG_ERC*>( erc_dlg )->UpdateAnnotationWarning();
|
||||
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
|
|
|
@ -32,17 +32,14 @@
|
|||
#include <bitmaps.h>
|
||||
#include <reporter.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <sch_view.h>
|
||||
#include <sch_marker.h>
|
||||
#include <connection_graph.h>
|
||||
#include <tools/ee_actions.h>
|
||||
#include <tools/ee_inspection_tool.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <dialog_erc.h>
|
||||
#include <erc.h>
|
||||
#include <id.h>
|
||||
#include <confirm.h>
|
||||
#include <widgets/infobar.h>
|
||||
#include <dialogs/wx_html_report_box.h>
|
||||
#include <wx/ffile.h>
|
||||
#include <wx/filedlg.h>
|
||||
|
@ -60,6 +57,8 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
|
|||
m_ercRun( false ),
|
||||
m_severities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING )
|
||||
{
|
||||
SetName( DIALOG_ERC_WINDOW_NAME ); // Set a window name to be able to find it
|
||||
|
||||
EESCHEMA_SETTINGS* settings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
m_severities = settings->m_Appearance.erc_severities;
|
||||
|
||||
|
@ -86,26 +85,7 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
|
|||
m_warningsBadge->SetMaximumNumber( 999 );
|
||||
m_exclusionsBadge->SetMaximumNumber( 999 );
|
||||
|
||||
if( m_parent->CheckAnnotate( []( ERCE_T, const wxString&, SCH_REFERENCE*,
|
||||
SCH_REFERENCE* ) {} ) )
|
||||
{
|
||||
wxHyperlinkCtrl* button = new wxHyperlinkCtrl( m_infoBar, wxID_ANY,
|
||||
_("Show Annotation dialog"),
|
||||
wxEmptyString );
|
||||
|
||||
button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
|
||||
[&]( wxHyperlinkEvent& aEvent )
|
||||
{
|
||||
wxHtmlLinkEvent htmlEvent( aEvent.GetId(),
|
||||
wxHtmlLinkInfo( aEvent.GetURL() ) );
|
||||
OnLinkClicked( htmlEvent );
|
||||
} ) );
|
||||
|
||||
m_infoBar->RemoveAllButtons();
|
||||
m_infoBar->AddButton( button );
|
||||
m_infoBar->ShowMessage( _( "Schematic is not fully annotated. "
|
||||
"ERC results will be incomplete." ) );
|
||||
}
|
||||
UpdateAnnotationWarning();
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
finishDialogSettings();
|
||||
|
@ -124,6 +104,42 @@ DIALOG_ERC::~DIALOG_ERC()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::UpdateAnnotationWarning()
|
||||
{
|
||||
if( m_parent->CheckAnnotate( []( ERCE_T, const wxString&, SCH_REFERENCE*, SCH_REFERENCE* )
|
||||
{ } ) )
|
||||
{
|
||||
if( !m_infoBar->IsShown() )
|
||||
{
|
||||
wxHyperlinkCtrl* button = new wxHyperlinkCtrl( m_infoBar, wxID_ANY,
|
||||
_("Show Annotation dialog"),
|
||||
wxEmptyString );
|
||||
|
||||
button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
|
||||
[&]( wxHyperlinkEvent& aEvent )
|
||||
{
|
||||
wxHtmlLinkEvent htmlEvent( aEvent.GetId(),
|
||||
wxHtmlLinkInfo( aEvent.GetURL() ) );
|
||||
OnLinkClicked( htmlEvent );
|
||||
} ) );
|
||||
|
||||
m_infoBar->RemoveAllButtons();
|
||||
m_infoBar->AddButton( button );
|
||||
m_infoBar->ShowMessage( _( "Schematic is not fully annotated. "
|
||||
"ERC results will be incomplete." ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_infoBar->IsShown() )
|
||||
{
|
||||
m_infoBar->RemoveAllButtons();
|
||||
m_infoBar->Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// PROGRESS_REPORTER calls
|
||||
|
||||
bool DIALOG_ERC::updateUI()
|
||||
|
@ -250,11 +266,6 @@ void DIALOG_ERC::OnLinkClicked( wxHtmlLinkEvent& event )
|
|||
{
|
||||
wxCommandEvent dummy;
|
||||
m_parent->OnAnnotate( dummy );
|
||||
|
||||
// We don't actually get notified when the annotation error is resolved, but we can assume
|
||||
// that the user will take corrective action. If they don't, we can just show the infobar
|
||||
// again.
|
||||
m_infoBar->Hide();
|
||||
}
|
||||
|
||||
|
||||
|
@ -264,7 +275,7 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event )
|
|||
|
||||
SCHEMATIC* sch = &m_parent->Schematic();
|
||||
|
||||
m_infoBar->Hide();
|
||||
UpdateAnnotationWarning();
|
||||
|
||||
m_parent->RecordERCExclusions();
|
||||
deleteAllMarkers( true );
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
#include <erc_settings.h>
|
||||
|
||||
|
||||
#define DIALOG_ERC_WINDOW_NAME "DialogErcWindowName"
|
||||
|
||||
|
||||
class DIALOG_ERC : public DIALOG_ERC_BASE, PROGRESS_REPORTER_BASE
|
||||
{
|
||||
public:
|
||||
|
@ -49,6 +52,8 @@ public:
|
|||
void NextMarker();
|
||||
void ExcludeMarker();
|
||||
|
||||
void UpdateAnnotationWarning();
|
||||
|
||||
private:
|
||||
// from DIALOG_ERC_BASE:
|
||||
void OnCloseErcDialog( wxCloseEvent& event ) override;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <project.h>
|
||||
#include <project/project_file.h>
|
||||
#include <project/net_settings.h>
|
||||
#include <dialog_erc.h>
|
||||
#include <python_scripting.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sch_painter.h>
|
||||
|
@ -310,6 +311,12 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
|
|||
// Ensure m_canvasType is up to date, to save it in config
|
||||
m_canvasType = GetCanvas()->GetBackend();
|
||||
|
||||
// Close modeless dialogs
|
||||
wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_ERC_WINDOW_NAME );
|
||||
|
||||
if( open_dlg )
|
||||
open_dlg->Close( true );
|
||||
|
||||
// Shutdown all running tools
|
||||
if( m_toolManager )
|
||||
{
|
||||
|
@ -675,6 +682,13 @@ bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
// Close modeless dialogs. They're trouble when they get destroyed after the frame and/or
|
||||
// board.
|
||||
wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_ERC_WINDOW_NAME );
|
||||
|
||||
if( open_dlg )
|
||||
open_dlg->Close( true );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -783,6 +797,12 @@ void SCH_EDIT_FRAME::ResolveERCExclusions()
|
|||
}
|
||||
|
||||
|
||||
SEVERITY SCH_EDIT_FRAME::GetSeverity( int aErrorCode ) const
|
||||
{
|
||||
return Schematic().ErcSettings().GetSeverity( aErrorCode );
|
||||
}
|
||||
|
||||
|
||||
wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
|
||||
{
|
||||
// Filename is rootSheetName-sheetName-...-sheetName
|
||||
|
|
|
@ -192,6 +192,8 @@ public:
|
|||
*/
|
||||
void ResolveERCExclusions();
|
||||
|
||||
SEVERITY GetSeverity( int aErrorCode ) const override;
|
||||
|
||||
/**
|
||||
* Return a human-readable description of the current screen.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue