From b4e9d9b6f71a3257e8856d01a596805118485459 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Sun, 26 Nov 2017 18:13:42 -0500 Subject: [PATCH] Symbol rescue dialog improvements. Make the user prompt an HTML control for improved layout. Fix some column title sizing issues. This is not a complete fix but it seems better than the default sizing done by wxWidgets. Use symbol terminology instead of part and/or component. Create trace string source files for a common place for them and their Doxygen comments. --- eeschema/dialogs/dialog_rescue_each.cpp | 48 +++++++++++++++----- eeschema/dialogs/dialog_rescue_each_base.cpp | 17 ++++--- eeschema/dialogs/dialog_rescue_each_base.fbp | 25 +++++----- eeschema/dialogs/dialog_rescue_each_base.h | 15 +++--- 4 files changed, 65 insertions(+), 40 deletions(-) diff --git a/eeschema/dialogs/dialog_rescue_each.cpp b/eeschema/dialogs/dialog_rescue_each.cpp index bc34d2cbfc..9e3dc06ab0 100644 --- a/eeschema/dialogs/dialog_rescue_each.cpp +++ b/eeschema/dialogs/dialog_rescue_each.cpp @@ -81,13 +81,44 @@ DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH( SCH_EDIT_FRAME* aParent, RESCUER& aRescu m_stdButtonsOK->SetDefault(); // Set the info message, customized to include the proper suffix. - wxString info_message = - _( "It looks like this project was made using older schematic symbol libraries.\n" - "Some parts may need to be relinked to a different symbol name, and some symbols\n" - "may need to be \"rescued\" (cloned and renamed) into a new library.\n" - "\n" + wxString info = + _( "This schematic was made using older symbol libraries which may break the " + "schematic. Some symbols may need to be linked to a different symbol name. " + "Some symbols may need to be \"rescued\" (copied and renamed) into a new library.\n\n" "The following changes are recommended to update the project." ); - m_lblInfo->SetLabel( info_message ); + m_htmlPrompt->AppendToPage( info ); + + // wxDataViewListCtrl seems to do a poor job of laying itself out so help it along here. + wxString header = _( "Accept" ); + wxFont font = m_ListOfConflicts->GetFont(); + + font.MakeBold(); + + wxClientDC dc( this ); + + dc.SetFont( font ); + + int padding = 30; + int width = dc.GetTextExtent( header ).GetWidth(); + + m_ListOfConflicts->AppendToggleColumn( header, wxDATAVIEW_CELL_ACTIVATABLE, width, + wxALIGN_CENTER ); + + header = _( "Symbol Name" ); + width = dc.GetTextExtent( header ).GetWidth() + padding; + m_ListOfConflicts->AppendTextColumn( header, wxDATAVIEW_CELL_INERT, width ); + + header = _( "Action Taken" ); + width = dc.GetTextExtent( header ).GetWidth() + padding; + m_ListOfConflicts->AppendTextColumn( header, wxDATAVIEW_CELL_INERT, width ); + + header = _( "Reference" ); + width = dc.GetTextExtent( header ).GetWidth() + padding; + m_ListOfInstances->AppendTextColumn( header, wxDATAVIEW_CELL_INERT, width ); + + header = _( "Value" ); + width = dc.GetTextExtent( header ).GetWidth() + padding; + m_ListOfInstances->AppendTextColumn( header, wxDATAVIEW_CELL_INERT, width ); m_componentViewOld->SetLayoutDirection( wxLayout_LeftToRight ); m_componentViewNew->SetLayoutDirection( wxLayout_LeftToRight ); @@ -104,11 +135,6 @@ bool DIALOG_RESCUE_EACH::TransferDataToWindow() if( !wxDialog::TransferDataToWindow() ) return false; - m_ListOfConflicts->AppendToggleColumn( _( "Accept" ) ); - m_ListOfConflicts->AppendTextColumn( _( "Symbol" ) ); - m_ListOfConflicts->AppendTextColumn( _( "Action" ) ); - m_ListOfInstances->AppendTextColumn( _( "Reference" ) ); - m_ListOfInstances->AppendTextColumn( _( "Value" ) ); PopulateConflictList(); PopulateInstanceList(); diff --git a/eeschema/dialogs/dialog_rescue_each_base.cpp b/eeschema/dialogs/dialog_rescue_each_base.cpp index d4d5f4def3..7a78c8fe0a 100644 --- a/eeschema/dialogs/dialog_rescue_each_base.cpp +++ b/eeschema/dialogs/dialog_rescue_each_base.cpp @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version May 6 2016) +// C++ code generated with wxFormBuilder (version Nov 22 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO "NOT" EDIT THIS FILE! +// PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #include "dialog_rescue_each_base.h" @@ -11,20 +11,19 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxSize( 450,100 ), wxDefaultSize ); + this->SetSizeHints( wxSize( 500,-1 ), wxDefaultSize ); wxBoxSizer* bSizerMain; bSizerMain = new wxBoxSizer( wxVERTICAL ); - m_lblInfo = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_lblInfo->Wrap( 500 ); - bSizerMain->Add( m_lblInfo, 0, wxALL|wxEXPAND, 5 ); + m_htmlPrompt = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO ); + bSizerMain->Add( m_htmlPrompt, 1, wxALL|wxEXPAND, 5 ); m_titleSymbols = new wxStaticText( this, wxID_ANY, _("Symbols to update:"), wxDefaultPosition, wxDefaultSize, 0 ); m_titleSymbols->Wrap( -1 ); m_titleSymbols->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); - bSizerMain->Add( m_titleSymbols, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + bSizerMain->Add( m_titleSymbols, 0, wxLEFT|wxRIGHT, 5 ); m_ListOfConflicts = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); bSizerMain->Add( m_ListOfConflicts, 2, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); @@ -44,7 +43,7 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i wxBoxSizer* bSizer6; bSizer6 = new wxBoxSizer( wxVERTICAL ); - m_staticText2 = new wxStaticText( this, wxID_ANY, _("Cached Part:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText2 = new wxStaticText( this, wxID_ANY, _("Cached Symbol:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText2->Wrap( -1 ); m_staticText2->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); @@ -61,7 +60,7 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i wxBoxSizer* bSizer7; bSizer7 = new wxBoxSizer( wxVERTICAL ); - m_staticText3 = new wxStaticText( this, wxID_ANY, _("Library Part:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText3 = new wxStaticText( this, wxID_ANY, _("Library Symbol:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText3->Wrap( -1 ); m_staticText3->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); diff --git a/eeschema/dialogs/dialog_rescue_each_base.fbp b/eeschema/dialogs/dialog_rescue_each_base.fbp index 05671bd35a..c8428a921a 100644 --- a/eeschema/dialogs/dialog_rescue_each_base.fbp +++ b/eeschema/dialogs/dialog_rescue_each_base.fbp @@ -41,10 +41,10 @@ 0 wxID_ANY - 450,100 + 500,-1 DIALOG_RESCUE_EACH_BASE - 529,593 + 500,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Project Rescue Helper @@ -96,8 +96,8 @@ 5 wxALL|wxEXPAND - 0 - + 1 + 1 1 1 @@ -125,7 +125,6 @@ 0 0 wxID_ANY - 0 @@ -133,7 +132,7 @@ 0 1 - m_lblInfo + m_htmlPrompt 1 @@ -143,17 +142,19 @@ Resizable 1 - - + wxHW_SCROLLBAR_AUTO + ; forward_declare 0 - 500 + + + @@ -178,7 +179,7 @@ 5 - wxTOP|wxRIGHT|wxLEFT + wxLEFT|wxRIGHT 0 1 @@ -528,7 +529,7 @@ 0 0 wxID_ANY - Cached Part: + Cached Symbol: 0 @@ -702,7 +703,7 @@ 0 0 wxID_ANY - Library Part: + Library Symbol: 0 diff --git a/eeschema/dialogs/dialog_rescue_each_base.h b/eeschema/dialogs/dialog_rescue_each_base.h index c8b9d8e541..bf3e707725 100644 --- a/eeschema/dialogs/dialog_rescue_each_base.h +++ b/eeschema/dialogs/dialog_rescue_each_base.h @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version May 6 2016) +// C++ code generated with wxFormBuilder (version Nov 22 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO "NOT" EDIT THIS FILE! +// PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #ifndef __DIALOG_RESCUE_EACH_BASE_H__ @@ -11,15 +11,14 @@ #include #include #include -class DIALOG_SHIM; - #include "dialog_shim.h" -#include -#include +#include #include #include #include #include +#include +#include #include #include #include @@ -37,7 +36,7 @@ class DIALOG_RESCUE_EACH_BASE : public DIALOG_SHIM private: protected: - wxStaticText* m_lblInfo; + wxHtmlWindow* m_htmlPrompt; wxStaticText* m_titleSymbols; wxDataViewListCtrl* m_ListOfConflicts; wxStaticText* m_titleInstances; @@ -62,7 +61,7 @@ class DIALOG_RESCUE_EACH_BASE : public DIALOG_SHIM public: - DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Project Rescue Helper"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 529,593 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Project Rescue Helper"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_RESCUE_EACH_BASE(); };