From 07d34e442897f5ab48b9e47bc9b160946f3e77dc Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Tue, 23 Jun 2015 09:55:16 -0400 Subject: [PATCH] Eeschema: improve netlist generation useability. * Eliminate modal annotation warning dialog when generating a netlist fails due to components that are not annotated. * Add warning message to annotate dialog. --- eeschema/dialogs/dialog_annotate.cpp | 12 ++-- eeschema/dialogs/dialog_annotate_base.cpp | 6 ++ eeschema/dialogs/dialog_annotate_base.fbp | 83 +++++++++++++++++++++++ eeschema/dialogs/dialog_annotate_base.h | 1 + eeschema/invoke_sch_dialog.h | 2 +- eeschema/netlist.cpp | 13 ++-- 6 files changed, 104 insertions(+), 13 deletions(-) diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp index b439cc99e6..9b987bd362 100644 --- a/eeschema/dialogs/dialog_annotate.cpp +++ b/eeschema/dialogs/dialog_annotate.cpp @@ -44,6 +44,7 @@ class wxConfigBase; +namespace { /** * Class DIALOG_ANNOTATE @@ -51,7 +52,7 @@ class wxConfigBase; class DIALOG_ANNOTATE: public DIALOG_ANNOTATE_BASE { public: - DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent ); + DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, wxString message ); private: @@ -96,12 +97,15 @@ private: } }; +} // anonymous namespace -DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent ) +DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, wxString message ) : DIALOG_ANNOTATE_BASE( parent ) { m_Parent = parent; + m_userMessage->SetLabelText( message ); + m_userMessage->Show( !message.empty() ); InitValues(); Layout(); @@ -310,9 +314,9 @@ int DIALOG_ANNOTATE::GetAnnotateAlgo() } -int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller ) +int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, wxString message ) { - DIALOG_ANNOTATE dlg( aCaller ); + DIALOG_ANNOTATE dlg( aCaller, message ); return dlg.ShowModal(); } diff --git a/eeschema/dialogs/dialog_annotate_base.cpp b/eeschema/dialogs/dialog_annotate_base.cpp index 2e65004cd1..2ae59aac86 100644 --- a/eeschema/dialogs/dialog_annotate_base.cpp +++ b/eeschema/dialogs/dialog_annotate_base.cpp @@ -19,6 +19,12 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con wxBoxSizer* bupperSizer; bupperSizer = new wxBoxSizer( wxVERTICAL ); + m_userMessage = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_userMessage->Wrap( 1 ); + m_userMessage->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); + + bupperSizer->Add( m_userMessage, 0, wxALL, 5 ); + m_staticTextScope = new wxStaticText( this, wxID_ANY, _("Scope"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextScope->Wrap( -1 ); m_staticTextScope->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); diff --git a/eeschema/dialogs/dialog_annotate_base.fbp b/eeschema/dialogs/dialog_annotate_base.fbp index 5742fbfdc6..bc759c0580 100644 --- a/eeschema/dialogs/dialog_annotate_base.fbp +++ b/eeschema/dialogs/dialog_annotate_base.fbp @@ -102,6 +102,89 @@ bupperSizer wxVERTICAL none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + ,90,92,-1,70,0 + 0 + 0 + wxID_ANY + + + 0 + + + 0 + + 1 + m_userMessage + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + 6 wxALL diff --git a/eeschema/dialogs/dialog_annotate_base.h b/eeschema/dialogs/dialog_annotate_base.h index 856903308e..6ab175168e 100644 --- a/eeschema/dialogs/dialog_annotate_base.h +++ b/eeschema/dialogs/dialog_annotate_base.h @@ -50,6 +50,7 @@ class DIALOG_ANNOTATE_BASE : public DIALOG_SHIM private: protected: + wxStaticText* m_userMessage; wxStaticText* m_staticTextScope; wxRadioButton* m_rbEntireSchematic; wxRadioButton* m_rbCurrPage; diff --git a/eeschema/invoke_sch_dialog.h b/eeschema/invoke_sch_dialog.h index e4395ee2b3..fe36a41f79 100644 --- a/eeschema/invoke_sch_dialog.h +++ b/eeschema/invoke_sch_dialog.h @@ -66,7 +66,7 @@ int InvokeDialogRescueEach( SCH_EDIT_FRAME* aCaller, RESCUER& aRescuer, bool aAs /// Create and show DIALOG_ANNOTATE and return whatever /// DIALOG_ANNOTATE::ShowModal() returns. -int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller ); +int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, wxString message = "" ); /// Create the modeless DIALOG_ERC and show it, return something to /// destroy or close it. The dialog will have ID_DIALOG_ERC from id.h diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index 671112bc9b..54f28c83ae 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -44,7 +44,7 @@ #include #include #include - +#include #include #define IS_WIRE false @@ -63,13 +63,10 @@ bool SCH_EDIT_FRAME::prepareForNetlist() // Performs some controls: if( CheckAnnotate( NULL, 0 ) ) { - if( !IsOK( NULL, _( "Some items are not annotated\n" - "Do you want to annotate schematic?" ) ) ) - return false; - - // Schematic must be annotated: call Annotate dialog: - wxCommandEvent event; - OnAnnotate( event ); + // Schematic must be annotated: call Annotate dialog and tell + // the user why that is. + InvokeDialogAnnotate( this, _( "Exporting the netlist requires a " + "completely\nannotated schematic." ) ); if( CheckAnnotate( NULL, 0 ) ) return false;