Decouple SCH_EDIT_FRAME from symbol rescue and remap dialogs.
Do not keep pointer to SCH_EDIT_FRAME in the rescuer object to prevent it from creating dialogs with itself as the parent when call from the rescue dialog which is itself a grandchild of the frame window.
This commit is contained in:
parent
0c6ec7dbb3
commit
44cb979e91
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,6 +33,8 @@
|
|||
#include <project_rescue.h>
|
||||
#include <eeschema_config.h>
|
||||
#include <symbol_preview_widget.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
|
||||
|
||||
class DIALOG_RESCUE_EACH: public DIALOG_RESCUE_EACH_BASE
|
||||
{
|
||||
|
@ -44,18 +46,21 @@ public:
|
|||
*
|
||||
* @param aParent - the SCH_EDIT_FRAME calling this
|
||||
* @param aRescuer - the active RESCUER instance
|
||||
* @param aCurrentSheet the current sheet in the schematic editor frame
|
||||
* @param aGalBackEndType the current GAL type used to render symbols
|
||||
* @param aAskShowAgain - if true, a "Never Show Again" button will be included
|
||||
*/
|
||||
DIALOG_RESCUE_EACH( SCH_EDIT_FRAME* aParent, RESCUER& aRescuer, bool aAskShowAgain );
|
||||
DIALOG_RESCUE_EACH( wxWindow* aParent, RESCUER& aRescuer, SCH_SHEET_PATH* aCurrentSheet,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackEndType, bool aAskShowAgain );
|
||||
|
||||
~DIALOG_RESCUE_EACH();
|
||||
|
||||
private:
|
||||
SCH_EDIT_FRAME* m_Parent;
|
||||
SYMBOL_PREVIEW_WIDGET* m_previewNewWidget;
|
||||
SYMBOL_PREVIEW_WIDGET* m_previewOldWidget;
|
||||
wxConfigBase* m_Config;
|
||||
RESCUER* m_Rescuer;
|
||||
SCH_SHEET_PATH* m_currentSheet;
|
||||
bool m_AskShowAgain;
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
|
@ -72,17 +77,22 @@ private:
|
|||
};
|
||||
|
||||
|
||||
DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH( SCH_EDIT_FRAME* aParent, RESCUER& aRescuer,
|
||||
DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH( wxWindow* aParent,
|
||||
RESCUER& aRescuer,
|
||||
SCH_SHEET_PATH* aCurrentSheet,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackEndType,
|
||||
bool aAskShowAgain )
|
||||
: DIALOG_RESCUE_EACH_BASE( aParent ),
|
||||
m_Parent( aParent ),
|
||||
m_Rescuer( &aRescuer ),
|
||||
m_currentSheet( aCurrentSheet ),
|
||||
m_AskShowAgain( aAskShowAgain )
|
||||
{
|
||||
m_previewOldWidget = new SYMBOL_PREVIEW_WIDGET( m_previewOldPanel, Kiway(), m_Parent->GetGalCanvas()->GetBackend() );
|
||||
wxASSERT( aCurrentSheet );
|
||||
|
||||
m_previewOldWidget = new SYMBOL_PREVIEW_WIDGET( m_previewOldPanel, Kiway(), aGalBackEndType );
|
||||
m_SizerOldPanel->Add( m_previewOldWidget, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_previewNewWidget = new SYMBOL_PREVIEW_WIDGET( m_previewNewPanel, Kiway(), m_Parent->GetGalCanvas()->GetBackend() );
|
||||
m_previewNewWidget = new SYMBOL_PREVIEW_WIDGET( m_previewNewPanel, Kiway(), aGalBackEndType );
|
||||
m_SizerNewPanel->Add( m_previewNewWidget, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_Config = Kiface().KifaceSettings();
|
||||
|
@ -212,7 +222,7 @@ void DIALOG_RESCUE_EACH::PopulateInstanceList()
|
|||
SCH_FIELD* valueField = each_component->GetField( 1 );
|
||||
|
||||
data.clear();
|
||||
data.push_back( each_component->GetRef( & m_Parent->GetCurrentSheet() ) );
|
||||
data.push_back( each_component->GetRef( m_currentSheet ) );
|
||||
data.push_back( valueField ? valueField->GetText() : wxT( "" ) );
|
||||
m_ListOfInstances->AppendItem( data );
|
||||
count++;
|
||||
|
@ -274,7 +284,7 @@ bool DIALOG_RESCUE_EACH::TransferDataFromWindow()
|
|||
|
||||
void DIALOG_RESCUE_EACH::OnNeverShowClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxMessageDialog dlg( m_Parent,
|
||||
wxMessageDialog dlg( GetParent(),
|
||||
_( "Stop showing this tool?\n"
|
||||
"No changes will be made.\n\n"
|
||||
"This setting can be changed from the \"Symbol Libraries\" dialog,\n"
|
||||
|
@ -298,8 +308,9 @@ void DIALOG_RESCUE_EACH::OnCancelClick( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int InvokeDialogRescueEach( SCH_EDIT_FRAME* aCaller, RESCUER& aRescuer, bool aAskShowAgain )
|
||||
int InvokeDialogRescueEach( wxWindow* aParent, RESCUER& aRescuer, SCH_SHEET_PATH* aCurrentSheet,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackEndType, bool aAskShowAgain )
|
||||
{
|
||||
DIALOG_RESCUE_EACH dlg( aCaller, aRescuer, aAskShowAgain );
|
||||
return dlg.ShowModal();
|
||||
DIALOG_RESCUE_EACH dlg( aParent, aRescuer, aCurrentSheet, aGalBackEndType, aAskShowAgain );
|
||||
return dlg.ShowQuasiModal();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
|
@ -32,12 +32,14 @@
|
|||
#include <wx_html_report_panel.h>
|
||||
|
||||
#include <class_library.h>
|
||||
#include <project_rescue.h>
|
||||
#include <sch_io_mgr.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_component.h>
|
||||
#include <sch_screen.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <viewlib_frame.h>
|
||||
#include <env_paths.h>
|
||||
|
||||
#include <dialog_symbol_remap.h>
|
||||
|
@ -85,7 +87,21 @@ void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
|
|||
// Ignore the never show rescue setting for one last rescue of legacy symbol
|
||||
// libraries before remapping to the symbol library table. This ensures the
|
||||
// best remapping results.
|
||||
parent->RescueLegacyProject( false );
|
||||
LEGACY_RESCUER rescuer( Prj(), &parent->GetCurrentSheet(),
|
||||
parent->GetGalCanvas()->GetBackend() );
|
||||
|
||||
if( RESCUER::RescueProject( this, rescuer, false ) )
|
||||
{
|
||||
LIB_VIEW_FRAME* viewer = (LIB_VIEW_FRAME*) parent->Kiway().Player( FRAME_SCH_VIEWER, false );
|
||||
|
||||
if( viewer )
|
||||
viewer->ReCreateListLib();
|
||||
|
||||
parent->GetScreen()->ClearUndoORRedoList( parent->GetScreen()->m_UndoList, 1 );
|
||||
parent->SyncView();
|
||||
parent->GetCanvas()->Refresh();
|
||||
parent->OnModify();
|
||||
}
|
||||
|
||||
// The schematic is fully loaded, any legacy library symbols have been rescued. Now
|
||||
// check to see if the schematic has not been converted to the symbol library table
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2013 CERN (www.cern.ch)
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2013-2017 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2013-2019 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -43,12 +42,14 @@
|
|||
#include <set>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <class_draw_panel_gal.h>
|
||||
|
||||
class wxFrame;
|
||||
class wxDialog;
|
||||
class LIB_PART;
|
||||
class PART_LIBS;
|
||||
class SCH_COMPONENT;
|
||||
class SCH_SHEET_PATH;
|
||||
class RESCUER;
|
||||
|
||||
// Often this is not used in the prototypes, since wxFrame is good enough and would
|
||||
|
@ -56,14 +57,17 @@ class RESCUER;
|
|||
class SCH_EDIT_FRAME;
|
||||
|
||||
/**
|
||||
* Function InvokeDialogRescueEach
|
||||
* This dialog asks the user which rescuable, cached parts he wants to rescue.
|
||||
* Any rejects will be pruned from aCandidates.
|
||||
* @param aCaller - the SCH_EDIT_FRAME calling this
|
||||
* Any rejects will be pruned from \a aCandidates.
|
||||
*
|
||||
* @param aParent - the wxWindow object calling this dialog
|
||||
* @param aRescuer - the active RESCUER instance
|
||||
* @param aCurrentSheet the current sheet in the schematic editor frame
|
||||
* @param aGalBackEndType the current GAL type used to render symbols
|
||||
* @param aAskShowAgain - if true, a "Never Show Again" button will be included
|
||||
*/
|
||||
int InvokeDialogRescueEach( SCH_EDIT_FRAME* aCaller, RESCUER& aRescuer, bool aAskShowAgain );
|
||||
int InvokeDialogRescueEach( wxWindow* aParent, RESCUER& aRescuer, SCH_SHEET_PATH* aCurrentSheet,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackEndType, bool aAskShowAgain );
|
||||
|
||||
/// 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
|
||||
|
@ -82,9 +86,9 @@ int InvokeDialogUpdateFields( SCH_EDIT_FRAME* aCaller,
|
|||
const std::list<SCH_COMPONENT*> aComponents, bool aCreateUndoEntry );
|
||||
|
||||
/**
|
||||
* Function InvokeDialogNetList
|
||||
* creates and shows NETLIST_DIALOG and returns whatever
|
||||
* Create and shows NETLIST_DIALOG and returns whatever
|
||||
* NETLIST_DIALOG::ShowModal() returns.
|
||||
*
|
||||
* @param int - NET_PLUGIN_CHANGE means user added or deleted a plugin,
|
||||
* wxID_OK, or wxID_CANCEL.
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Chris Pavlina <pavlina.chris@gmail.com>
|
||||
* Copyright (C) 2015-2018 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2015-2019 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -378,7 +378,7 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
|
|||
cache_match = find_component( part_id.Format().wx_str(), aRescuer.GetPrj()->SchLibs(),
|
||||
true );
|
||||
|
||||
lib_match = aRescuer.GetFrame()->GetLibPart( part_id );
|
||||
lib_match = SchGetLibPart( part_id, aRescuer.GetPrj()->SchSymbolLibTable() );
|
||||
|
||||
if( !cache_match && !lib_match )
|
||||
continue;
|
||||
|
@ -464,11 +464,13 @@ bool RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::PerformAction( RESCUER* aRescuer )
|
|||
}
|
||||
|
||||
|
||||
RESCUER::RESCUER( SCH_EDIT_FRAME& aEditFrame, PROJECT& aProject )
|
||||
RESCUER::RESCUER( PROJECT& aProject, SCH_SHEET_PATH* aCurrentSheet,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackEndType )
|
||||
{
|
||||
get_components( m_components );
|
||||
m_prj = &aProject;
|
||||
m_edit_frame = &aEditFrame;
|
||||
m_currentSheet = aCurrentSheet;
|
||||
m_galBackEndType = aGalBackEndType;
|
||||
}
|
||||
|
||||
|
||||
|
@ -510,7 +512,7 @@ void RESCUER::UndoRescues()
|
|||
|
||||
bool SCH_EDIT_FRAME::RescueLegacyProject( bool aRunningOnDemand )
|
||||
{
|
||||
LEGACY_RESCUER rescuer( *this, Prj() );
|
||||
LEGACY_RESCUER rescuer( Prj(), &GetCurrentSheet(), GetGalCanvas()->GetBackend() );
|
||||
|
||||
return rescueProject( rescuer, aRunningOnDemand );
|
||||
}
|
||||
|
@ -518,21 +520,40 @@ bool SCH_EDIT_FRAME::RescueLegacyProject( bool aRunningOnDemand )
|
|||
|
||||
bool SCH_EDIT_FRAME::RescueSymbolLibTableProject( bool aRunningOnDemand )
|
||||
{
|
||||
SYMBOL_LIB_TABLE_RESCUER rescuer( *this, Prj() );
|
||||
SYMBOL_LIB_TABLE_RESCUER rescuer( Prj(), &GetCurrentSheet(), GetGalCanvas()->GetBackend() );
|
||||
|
||||
return rescueProject( rescuer, aRunningOnDemand );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_EDIT_FRAME::rescueProject( RESCUER& aRescuer, bool aRunningOnDemand )
|
||||
{
|
||||
if( !RESCUER::RescueProject( this, aRescuer, aRunningOnDemand ) )
|
||||
return false;
|
||||
|
||||
LIB_VIEW_FRAME* viewer = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
|
||||
|
||||
if( viewer )
|
||||
viewer->ReCreateListLib();
|
||||
|
||||
GetScreen()->ClearUndoORRedoList( GetScreen()->m_UndoList, 1 );
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RESCUER::RescueProject( wxWindow* aParent, RESCUER& aRescuer, bool aRunningOnDemand )
|
||||
{
|
||||
aRescuer.FindCandidates();
|
||||
|
||||
if( ! aRescuer.GetCandidateCount() )
|
||||
if( !aRescuer.GetCandidateCount() )
|
||||
{
|
||||
if( aRunningOnDemand )
|
||||
{
|
||||
wxMessageDialog dlg( this, _( "This project has nothing to rescue." ),
|
||||
wxMessageDialog dlg( aParent, _( "This project has nothing to rescue." ),
|
||||
_( "Project Rescue Helper" ) );
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
@ -541,20 +562,18 @@ bool SCH_EDIT_FRAME::rescueProject( RESCUER& aRescuer, bool aRunningOnDemand )
|
|||
}
|
||||
|
||||
aRescuer.RemoveDuplicates();
|
||||
|
||||
aRescuer.InvokeDialog( !aRunningOnDemand );
|
||||
aRescuer.InvokeDialog( aParent, !aRunningOnDemand );
|
||||
|
||||
// If no symbols were rescued, let the user know what's going on. He might
|
||||
// have clicked cancel by mistake, and should have some indication of that.
|
||||
if( !aRescuer.GetChosenCandidateCount() )
|
||||
{
|
||||
wxMessageDialog dlg( this, _( "No symbols were rescued." ),
|
||||
wxMessageDialog dlg( aParent, _( "No symbols were rescued." ),
|
||||
_( "Project Rescue Helper" ) );
|
||||
dlg.ShowModal();
|
||||
|
||||
// Set the modified flag even on Cancel. Many users seem to instinctively want to Save at
|
||||
// this point, due to the reloading of the symbols, so we'll make the save button active.
|
||||
OnModify();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -566,17 +585,7 @@ bool SCH_EDIT_FRAME::rescueProject( RESCUER& aRescuer, bool aRunningOnDemand )
|
|||
return false;
|
||||
}
|
||||
|
||||
aRescuer.WriteRescueLibrary( this );
|
||||
|
||||
LIB_VIEW_FRAME* viewer = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
|
||||
|
||||
if( viewer )
|
||||
viewer->ReCreateListLib();
|
||||
|
||||
GetScreen()->ClearUndoORRedoList( GetScreen()->m_UndoList, 1 );
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
aRescuer.WriteRescueLibrary( aParent );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -620,9 +629,10 @@ void LEGACY_RESCUER::FindCandidates()
|
|||
}
|
||||
|
||||
|
||||
void LEGACY_RESCUER::InvokeDialog( bool aAskShowAgain )
|
||||
void LEGACY_RESCUER::InvokeDialog( wxWindow* aParent, bool aAskShowAgain )
|
||||
{
|
||||
InvokeDialogRescueEach( m_edit_frame, static_cast< RESCUER& >( *this ), aAskShowAgain );
|
||||
InvokeDialogRescueEach( aParent, static_cast< RESCUER& >( *this ), m_currentSheet,
|
||||
m_galBackEndType, aAskShowAgain );
|
||||
}
|
||||
|
||||
|
||||
|
@ -658,7 +668,7 @@ void LEGACY_RESCUER::OpenRescueLibrary()
|
|||
}
|
||||
|
||||
|
||||
bool LEGACY_RESCUER::WriteRescueLibrary( SCH_EDIT_FRAME *aEditFrame )
|
||||
bool LEGACY_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -670,7 +680,7 @@ bool LEGACY_RESCUER::WriteRescueLibrary( SCH_EDIT_FRAME *aEditFrame )
|
|||
|
||||
msg.Printf( _( "Failed to create symbol library file \"%s\"" ),
|
||||
m_rescue_lib->GetFullFileName() );
|
||||
DisplayError( aEditFrame, msg );
|
||||
DisplayError( aParent, msg );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -750,9 +760,10 @@ void LEGACY_RESCUER::AddPart( LIB_PART* aNewPart )
|
|||
}
|
||||
|
||||
|
||||
SYMBOL_LIB_TABLE_RESCUER::SYMBOL_LIB_TABLE_RESCUER( SCH_EDIT_FRAME& aEditFrame,
|
||||
PROJECT& aProject ) :
|
||||
RESCUER( aEditFrame, aProject )
|
||||
SYMBOL_LIB_TABLE_RESCUER::SYMBOL_LIB_TABLE_RESCUER( PROJECT& aProject,
|
||||
SCH_SHEET_PATH* aCurrentSheet,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackEndType ) :
|
||||
RESCUER( aProject, aCurrentSheet, aGalBackEndType )
|
||||
{
|
||||
m_properties = std::make_unique<PROPERTIES>();
|
||||
}
|
||||
|
@ -764,9 +775,10 @@ void SYMBOL_LIB_TABLE_RESCUER::FindCandidates()
|
|||
}
|
||||
|
||||
|
||||
void SYMBOL_LIB_TABLE_RESCUER::InvokeDialog( bool aAskShowAgain )
|
||||
void SYMBOL_LIB_TABLE_RESCUER::InvokeDialog( wxWindow* aParent, bool aAskShowAgain )
|
||||
{
|
||||
InvokeDialogRescueEach( m_edit_frame, static_cast< RESCUER& >( *this ), aAskShowAgain );
|
||||
InvokeDialogRescueEach( aParent, static_cast< RESCUER& >( *this ), m_currentSheet,
|
||||
m_galBackEndType, aAskShowAgain );
|
||||
}
|
||||
|
||||
|
||||
|
@ -777,7 +789,7 @@ void SYMBOL_LIB_TABLE_RESCUER::OpenRescueLibrary()
|
|||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary( SCH_EDIT_FRAME *aEditFrame )
|
||||
bool SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
||||
{
|
||||
wxString msg;
|
||||
wxFileName fn = GetRescueLibraryFileName();
|
||||
|
@ -793,7 +805,7 @@ bool SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary( SCH_EDIT_FRAME *aEditFrame )
|
|||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
msg.Printf( _( "Failed to save rescue library %s." ), fn.GetFullPath() );
|
||||
DisplayErrorMessage( aEditFrame, msg, ioe.What() );
|
||||
DisplayErrorMessage( aParent, msg, ioe.What() );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -817,7 +829,7 @@ bool SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary( SCH_EDIT_FRAME *aEditFrame )
|
|||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
msg.Printf( _( "Error occurred saving project specific symbol library table." ) );
|
||||
DisplayErrorMessage( aEditFrame, msg, ioe.What() );
|
||||
DisplayErrorMessage( aParent, msg, ioe.What() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Chris Pavlina <pavlina.chris@gmail.com>
|
||||
* Copyright (C) 2015-2017 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2015-2019 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include <class_libentry.h>
|
||||
#include <sch_legacy_plugin.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
|
||||
|
||||
class LIB_PART;
|
||||
|
@ -52,6 +53,7 @@ class SCH_COMPONENT;
|
|||
class RESCUER;
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCH_LEGACY_PLUGIN;
|
||||
class SCH_SHEET_PATH;
|
||||
|
||||
|
||||
enum RESCUE_TYPE
|
||||
|
@ -219,7 +221,8 @@ protected:
|
|||
|
||||
std::vector<SCH_COMPONENT*> m_components;
|
||||
PROJECT* m_prj;
|
||||
SCH_EDIT_FRAME* m_edit_frame;
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE m_galBackEndType;
|
||||
SCH_SHEET_PATH* m_currentSheet;
|
||||
|
||||
boost::ptr_vector<RESCUE_CANDIDATE> m_all_candidates;
|
||||
std::vector<RESCUE_CANDIDATE*> m_chosen_candidates;
|
||||
|
@ -227,7 +230,8 @@ protected:
|
|||
std::vector<RESCUE_LOG> m_rescue_log;
|
||||
|
||||
public:
|
||||
RESCUER( SCH_EDIT_FRAME& aEditFrame, PROJECT& aProject );
|
||||
RESCUER( PROJECT& aProject, SCH_SHEET_PATH* aCurrentSheet,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackeEndType );
|
||||
|
||||
/**
|
||||
* Writes out the rescue library. Called after successful PerformAction()s. If this fails,
|
||||
|
@ -235,7 +239,7 @@ public:
|
|||
*
|
||||
* @return True on success.
|
||||
*/
|
||||
virtual bool WriteRescueLibrary( SCH_EDIT_FRAME *aEditFrame ) = 0;
|
||||
virtual bool WriteRescueLibrary( wxWindow *aParent ) = 0;
|
||||
|
||||
virtual void OpenRescueLibrary() = 0;
|
||||
|
||||
|
@ -251,9 +255,7 @@ public:
|
|||
*
|
||||
* @param aAskShowAgain - whether the "Never Show Again" button should be visible
|
||||
*/
|
||||
virtual void InvokeDialog( bool aAskShowAgain ) = 0;
|
||||
|
||||
SCH_EDIT_FRAME* GetFrame() { return m_edit_frame; }
|
||||
virtual void InvokeDialog( wxWindow* aParent, bool aAskShowAgain ) = 0;
|
||||
|
||||
/**
|
||||
* Filter out duplicately named rescue candidates.
|
||||
|
@ -297,6 +299,8 @@ public:
|
|||
* Reverse the effects of all rescues on the project.
|
||||
*/
|
||||
void UndoRescues();
|
||||
|
||||
static bool RescueProject( wxWindow* aParent, RESCUER& aRescuer, bool aRunningOnDemand );
|
||||
};
|
||||
|
||||
|
||||
|
@ -306,18 +310,19 @@ private:
|
|||
std::unique_ptr<PART_LIB> m_rescue_lib;
|
||||
|
||||
public:
|
||||
LEGACY_RESCUER( SCH_EDIT_FRAME& aEditFrame, PROJECT& aProject ) :
|
||||
RESCUER( aEditFrame, aProject )
|
||||
LEGACY_RESCUER( PROJECT& aProject, SCH_SHEET_PATH* aCurrentSheet,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackEndType ) :
|
||||
RESCUER( aProject, aCurrentSheet, aGalBackEndType )
|
||||
{
|
||||
}
|
||||
|
||||
virtual void FindCandidates() override;
|
||||
|
||||
virtual void InvokeDialog( bool aAskShowAgain ) override;
|
||||
virtual void InvokeDialog( wxWindow* aParent, bool aAskShowAgain ) override;
|
||||
|
||||
virtual void OpenRescueLibrary() override;
|
||||
|
||||
virtual bool WriteRescueLibrary( SCH_EDIT_FRAME *aEditFrame ) override;
|
||||
virtual bool WriteRescueLibrary( wxWindow *aParent ) override;
|
||||
|
||||
virtual void AddPart( LIB_PART* aNewPart ) override;
|
||||
};
|
||||
|
@ -331,15 +336,16 @@ private:
|
|||
std::unique_ptr< PROPERTIES > m_properties; ///< Library plugin properties
|
||||
|
||||
public:
|
||||
SYMBOL_LIB_TABLE_RESCUER( SCH_EDIT_FRAME& aEditFrame, PROJECT& aProject );
|
||||
SYMBOL_LIB_TABLE_RESCUER( PROJECT& aProject, SCH_SHEET_PATH* aCurrentSheet,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackeEndType );
|
||||
|
||||
virtual void FindCandidates() override;
|
||||
|
||||
virtual void InvokeDialog( bool aAskShowAgain ) override;
|
||||
virtual void InvokeDialog( wxWindow* aParent, bool aAskShowAgain ) override;
|
||||
|
||||
virtual void OpenRescueLibrary() override;
|
||||
|
||||
virtual bool WriteRescueLibrary( SCH_EDIT_FRAME *aEditFrame ) override;
|
||||
virtual bool WriteRescueLibrary( wxWindow* aParent ) override;
|
||||
|
||||
virtual void AddPart( LIB_PART* aNewPart ) override;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue