diff --git a/eeschema/dialogs/dialog_eeschema_config.cpp b/eeschema/dialogs/dialog_eeschema_config.cpp index 2bf2d719a2..17d110f220 100644 --- a/eeschema/dialogs/dialog_eeschema_config.cpp +++ b/eeschema/dialogs/dialog_eeschema_config.cpp @@ -42,6 +42,7 @@ #include #include #include +#include class SCH_EDIT_FRAME; @@ -129,7 +130,7 @@ DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( wxWindow* aParent, // Load setting for cache rescue m_config = Kiface().KifaceSettings(); bool rescueNeverShow = false; - m_config->Read( wxT("RescueNeverShow"), &rescueNeverShow, false ); + m_config->Read( RESCUE_NEVER_SHOW_KEY, &rescueNeverShow, false ); m_cbRescue->SetValue( !rescueNeverShow ); wxString msg = wxString::Format( _( @@ -249,7 +250,7 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event ) *m_callers_lib_names = list; } - m_config->Write( wxT("RescueNeverShow"), ! m_cbRescue->GetValue() ); + m_config->Write( RESCUE_NEVER_SHOW_KEY, ! m_cbRescue->GetValue() ); EndModal( wxID_OK ); } diff --git a/eeschema/dialogs/dialog_rescue_each.cpp b/eeschema/dialogs/dialog_rescue_each.cpp index 649895fd4e..d69d89149a 100644 --- a/eeschema/dialogs/dialog_rescue_each.cpp +++ b/eeschema/dialogs/dialog_rescue_each.cpp @@ -33,6 +33,7 @@ #include #include #include +#include class DIALOG_RESCUE_EACH: public DIALOG_RESCUE_EACH_BASE { @@ -84,6 +85,7 @@ DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH( SCH_EDIT_FRAME* aParent, std::vectorAppendToggleColumn( wxT("Rescue") ); m_ListOfConflicts->AppendTextColumn( wxT("Symbol Name") ); m_ListOfInstances->AppendTextColumn( wxT("Reference") ); @@ -135,6 +136,7 @@ void DIALOG_RESCUE_EACH::PopulateInstanceList() m_ListOfInstances->DeleteAllItems(); int row = m_ListOfConflicts->GetSelectedRow(); + if( row == wxNOT_FOUND ) row = 0; @@ -160,6 +162,7 @@ void DIALOG_RESCUE_EACH::PopulateInstanceList() void DIALOG_RESCUE_EACH::OnHandleCachePreviewRepaint( wxPaintEvent& aRepaintEvent ) { int row = m_ListOfConflicts->GetSelectedRow(); + if( row == wxNOT_FOUND ) row = 0; @@ -172,6 +175,7 @@ void DIALOG_RESCUE_EACH::OnHandleCachePreviewRepaint( wxPaintEvent& aRepaintEven void DIALOG_RESCUE_EACH::OnHandleLibraryPreviewRepaint( wxPaintEvent& aRepaintEvent ) { int row = m_ListOfConflicts->GetSelectedRow(); + if( row == wxNOT_FOUND ) row = 0; @@ -190,6 +194,7 @@ void DIALOG_RESCUE_EACH::OnDialogResize( wxSizeEvent& aSizeEvent ) // Render the preview in our m_componentView. If this gets more complicated, we should // probably have a derived class from wxPanel; but this keeps things local. +// Call it only from a Paint Event, because we are using a wxPaintDC to draw the component void DIALOG_RESCUE_EACH::renderPreview( LIB_PART* aComponent, int aUnit, wxPanel* aPanel ) { wxPaintDC dc( aPanel ); @@ -215,9 +220,7 @@ void DIALOG_RESCUE_EACH::renderPreview( LIB_PART* aComponent, int aUnit, wxPanel dc.SetUserScale( scale, scale ); - wxPoint offset = bBox.Centre(); - NEGATE( offset.x ); - NEGATE( offset.y ); + wxPoint offset = - bBox.Centre(); // Avoid rendering when either dimension is zero int width, height; @@ -236,18 +239,13 @@ void DIALOG_RESCUE_EACH::OnConflictSelect( wxDataViewEvent& aEvent ) // wxformbuilder connects this event to the _dialog_, not the data view. // Make sure the correct item triggered it, otherwise we trigger recursively // and get a stack overflow. - if( aEvent.GetEventObject() != m_ListOfConflicts ) return; + if( aEvent.GetEventObject() != m_ListOfConflicts ) + return; PopulateInstanceList(); - int row = m_ListOfConflicts->GetSelectedRow(); - if( row == wxNOT_FOUND ) - row = 0; - - RESCUE_CANDIDATE& selected_part = (*m_Candidates)[row]; - - renderPreview( selected_part.cache_candidate, 0, m_componentViewOld ); - renderPreview( selected_part.lib_candidate, 0, m_componentViewNew ); + m_componentViewOld->Refresh(); + m_componentViewNew->Refresh(); } @@ -283,7 +281,7 @@ void DIALOG_RESCUE_EACH::OnNeverShowClick( wxCommandEvent& aEvent ) if( resp == wxID_YES ) { - m_Config->Write( wxT("RescueNeverShow"), true ); + m_Config->Write( RESCUE_NEVER_SHOW_KEY, true ); m_Candidates->clear(); Close(); } diff --git a/eeschema/dialogs/dialog_rescue_each_base.cpp b/eeschema/dialogs/dialog_rescue_each_base.cpp index a716bdb217..c96ac22aff 100644 --- a/eeschema/dialogs/dialog_rescue_each_base.cpp +++ b/eeschema/dialogs/dialog_rescue_each_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 13 2015) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -16,7 +16,7 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i wxBoxSizer* bSizerMain; bSizerMain = new wxBoxSizer( wxVERTICAL ); - m_lblInfo = new wxStaticText( this, wxID_ANY, _("This project uses symbols that no longer match the symbols in the system libraries. Using this tool, you can rescue these cached symbols into a new library.\n\nChoose \"Rescue\" for any parts you would like to save from this project's cache, or press Cancel to allow the symbols to be updated to the new versions."), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblInfo = new wxStaticText( this, wxID_ANY, _("This project uses symbols that no longer match the symbols in the system libraries.\nUsing this tool, you can rescue these cached symbols into a new library.\n\nChoose \"Rescue\" for any parts you would like to save from this project's cache, or press Cancel to allow the symbols to be updated to the new versions."), wxDefaultPosition, wxDefaultSize, 0 ); m_lblInfo->Wrap( 500 ); bSizerMain->Add( m_lblInfo, 0, wxALL|wxEXPAND, 5 ); @@ -24,7 +24,7 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i m_staticText5->Wrap( -1 ); m_staticText5->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizerMain->Add( m_staticText5, 0, wxALL, 5 ); + bSizerMain->Add( m_staticText5, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_ListOfConflicts = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); bSizerMain->Add( m_ListOfConflicts, 2, wxALL|wxEXPAND, 5 ); @@ -33,7 +33,7 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i m_staticText4->Wrap( -1 ); m_staticText4->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizerMain->Add( m_staticText4, 0, wxALL, 5 ); + bSizerMain->Add( m_staticText4, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_ListOfInstances = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); bSizerMain->Add( m_ListOfInstances, 1, wxALL|wxEXPAND, 5 ); @@ -48,7 +48,7 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i m_staticText2->Wrap( -1 ); m_staticText2->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer6->Add( m_staticText2, 0, wxALL, 5 ); + bSizer6->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_componentViewOld = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); m_componentViewOld->SetMinSize( wxSize( 150,150 ) ); @@ -65,7 +65,7 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i m_staticText3->Wrap( -1 ); m_staticText3->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer7->Add( m_staticText3, 0, wxALL, 5 ); + bSizer7->Add( m_staticText3, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_componentViewNew = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); m_componentViewNew->SetMinSize( wxSize( 150,150 ) ); diff --git a/eeschema/dialogs/dialog_rescue_each_base.fbp b/eeschema/dialogs/dialog_rescue_each_base.fbp index d5209853ff..dc96440e2d 100644 --- a/eeschema/dialogs/dialog_rescue_each_base.fbp +++ b/eeschema/dialogs/dialog_rescue_each_base.fbp @@ -47,7 +47,7 @@ 529,593 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h - + Conflicts Checking @@ -125,7 +125,7 @@ 0 0 wxID_ANY - This project uses symbols that no longer match the symbols in the system libraries. Using this tool, you can rescue these cached symbols into a new library. Choose "Rescue" for any parts you would like to save from this project's cache, or press Cancel to allow the symbols to be updated to the new versions. + This project uses symbols that no longer match the symbols in the system libraries. Using this tool, you can rescue these cached symbols into a new library. Choose "Rescue" for any parts you would like to save from this project's cache, or press Cancel to allow the symbols to be updated to the new versions. 0 @@ -178,7 +178,7 @@ 5 - wxALL + wxTOP|wxRIGHT|wxLEFT 0 1 @@ -329,7 +329,7 @@ 5 - wxALL + wxTOP|wxRIGHT|wxLEFT 0 1 @@ -498,7 +498,7 @@ none 5 - wxALL + wxTOP|wxRIGHT|wxLEFT 0 1 @@ -672,7 +672,7 @@ none 5 - wxALL + wxTOP|wxRIGHT|wxLEFT 0 1 diff --git a/eeschema/dialogs/dialog_rescue_each_base.h b/eeschema/dialogs/dialog_rescue_each_base.h index d543edaadd..267541ab9a 100644 --- a/eeschema/dialogs/dialog_rescue_each_base.h +++ b/eeschema/dialogs/dialog_rescue_each_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 13 2015) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -62,7 +62,7 @@ class DIALOG_RESCUE_EACH_BASE : public DIALOG_SHIM public: - DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, 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 = _("Conflicts Checking"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 529,593 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_RESCUE_EACH_BASE(); }; diff --git a/eeschema/dialogs/dialog_rescue_summary.cpp b/eeschema/dialogs/dialog_rescue_summary.cpp index 5b0ae13064..cd68ed2ef6 100644 --- a/eeschema/dialogs/dialog_rescue_summary.cpp +++ b/eeschema/dialogs/dialog_rescue_summary.cpp @@ -48,7 +48,9 @@ private: DIALOG_RESCUE_SUMMARY::DIALOG_RESCUE_SUMMARY( SCH_EDIT_FRAME* aParent, std::vector& aRescueLog ) : DIALOG_RESCUE_SUMMARY_BASE( aParent ), m_Parent( aParent), m_RescueLog( &aRescueLog ) -{ } +{ + m_Config = Kiface().KifaceSettings(); +} bool DIALOG_RESCUE_SUMMARY::TransferDataToWindow() @@ -56,7 +58,6 @@ bool DIALOG_RESCUE_SUMMARY::TransferDataToWindow() if( !wxDialog::TransferDataToWindow() ) return false; - m_Config = Kiface().KifaceSettings(); m_ListOfChanges->AppendTextColumn( wxT( "Reference" ) ); m_ListOfChanges->AppendTextColumn( wxT( "Old Symbol" ), wxDATAVIEW_CELL_INERT, /*width*/ 100); m_ListOfChanges->AppendTextColumn( wxT( "New Symbol" ), wxDATAVIEW_CELL_INERT, /*width*/ 100); diff --git a/eeschema/dialogs/dialog_rescue_summary_base.cpp b/eeschema/dialogs/dialog_rescue_summary_base.cpp index 15aec6d6b2..816e7899c5 100644 --- a/eeschema/dialogs/dialog_rescue_summary_base.cpp +++ b/eeschema/dialogs/dialog_rescue_summary_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 13 2015) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -21,17 +21,19 @@ DIALOG_RESCUE_SUMMARY_BASE::DIALOG_RESCUE_SUMMARY_BASE( wxWindow* parent, wxWind m_staticText5 = new wxStaticText( this, wxID_ANY, _("The symbols of the following components were changed:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText5->Wrap( -1 ); - bupperSizer->Add( m_staticText5, 0, wxALL, 5 ); + bupperSizer->Add( m_staticText5, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_ListOfChanges = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_ListOfChanges->SetMinSize( wxSize( -1,200 ) ); + bupperSizer->Add( m_ListOfChanges, 1, wxALL|wxEXPAND, 5 ); - m_sdbSizer1 = new wxStdDialogButtonSizer(); - m_sdbSizer1OK = new wxButton( this, wxID_OK ); - m_sdbSizer1->AddButton( m_sdbSizer1OK ); - m_sdbSizer1->Realize(); + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizer->Realize(); - bupperSizer->Add( m_sdbSizer1, 0, wxEXPAND, 5 ); + bupperSizer->Add( m_sdbSizer, 0, wxEXPAND, 5 ); bmainSizer->Add( bupperSizer, 1, wxALL|wxEXPAND, 6 ); diff --git a/eeschema/dialogs/dialog_rescue_summary_base.fbp b/eeschema/dialogs/dialog_rescue_summary_base.fbp index bf528fbbfa..1913a9f8b8 100644 --- a/eeschema/dialogs/dialog_rescue_summary_base.fbp +++ b/eeschema/dialogs/dialog_rescue_summary_base.fbp @@ -104,7 +104,7 @@ none 5 - wxALL + wxTOP|wxRIGHT|wxLEFT 0 1 @@ -199,7 +199,7 @@ 0 wxID_ANY - + -1,200 m_ListOfChanges protected @@ -267,7 +267,7 @@ 0 0 - m_sdbSizer1 + m_sdbSizer protected diff --git a/eeschema/dialogs/dialog_rescue_summary_base.h b/eeschema/dialogs/dialog_rescue_summary_base.h index 68dcdf6fc5..0de3e99083 100644 --- a/eeschema/dialogs/dialog_rescue_summary_base.h +++ b/eeschema/dialogs/dialog_rescue_summary_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 13 2015) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -38,8 +38,8 @@ class DIALOG_RESCUE_SUMMARY_BASE : public DIALOG_SHIM protected: wxStaticText* m_staticText5; wxDataViewListCtrl* m_ListOfChanges; - wxStdDialogButtonSizer* m_sdbSizer1; - wxButton* m_sdbSizer1OK; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; public: diff --git a/eeschema/eeschema_config.h b/eeschema/eeschema_config.h index 34557e0538..e93160b56a 100644 --- a/eeschema/eeschema_config.h +++ b/eeschema/eeschema_config.h @@ -2,4 +2,12 @@ * @file eeschema_config.h */ +#ifndef EESCHEMA_CONFIG_H +#define EESCHEMA_CONFIG_H + #include + +// a key to read write in user config the visibility of the rescue library dialog +#define RESCUE_NEVER_SHOW_KEY wxT("RescueNeverShow") + +#endif // EESCHEMA_CONFIG_H diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 23ebcdb479..2058d63a55 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -44,6 +44,7 @@ #include #include #include +#include bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, bool aSaveUnderNewName, bool aCreateBackupFile ) @@ -310,7 +311,8 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in // Only do this if RescueNeverShow was not set. wxConfigBase *config = Kiface().KifaceSettings(); bool rescueNeverShow = false; - config->Read( wxT("RescueNeverShow"), &rescueNeverShow, false ); + config->Read( RESCUE_NEVER_SHOW_KEY, &rescueNeverShow, false ); + if( !rescueNeverShow ) { if( RescueCacheConflicts( false ) )