37#include <wx/dcclient.h>
83 m_rescuer( &aRescuer ),
84 m_currentSheet( aCurrentSheet ),
85 m_askShowAgain( aAskShowAgain )
87 wxASSERT( aCurrentSheet );
96 wxString
info =
_(
"This schematic was made using older symbol libraries which may break the "
97 "schematic. Some symbols may need to be linked to a different symbol name. "
98 "Some symbols may need to be \"rescued\" (copied and renamed) into a new library.\n\n"
99 "The following changes are recommended to update the project." );
103 wxString header =
_(
"Accept" );
108 wxClientDC dc(
this );
112 int width = dc.GetTextExtent( header ).GetWidth() * 1.25;
114 m_ListOfConflicts->AppendToggleColumn( header, wxDATAVIEW_CELL_ACTIVATABLE, width, wxALIGN_CENTER );
116 header =
_(
"Symbol Name" );
117 width = dc.GetTextExtent( header ).GetWidth() * 2;
120 header =
_(
"Action Taken" );
121 width = dc.GetTextExtent( header ).GetWidth() * 10;
124 header =
_(
"Reference" );
125 width = dc.GetTextExtent( header ).GetWidth() * 2;
128 header =
_(
"Value" );
129 width = dc.GetTextExtent( header ).GetWidth() * 10;
140 int approx_info_height = ( 2 * info_size.x / prompt_size.x ) * font_size.y;
141 m_htmlPrompt->SetSizeHints( 2 * prompt_size.x / 3, approx_info_height );
147 GetSizer()->SetSizeHints(
this );
156 if( !wxDialog::TransferDataToWindow() )
171 wxVector<wxVariant> data;
176 data.push_back( wxVariant(
true ) );
200 if( row == wxNOT_FOUND )
205 wxVector<wxVariant> data;
213 SCH_FIELD* valueField = eachSymbol->GetField( FIELD_T::VALUE );
217 data.push_back( valueField ? valueField->
GetText() : wxString( wxT(
"" ) ) );
222 wxString msg = wxString::Format(
_(
"Instances of this symbol (%d items):" ), count );
263 if( !wxDialog::TransferDataFromWindow() )
270 bool rescue_part = val.GetBool();
282 wxMessageDialog dlg( GetParent(),
283 _(
"Stop showing this tool?\n"
284 "No changes will be made.\n\n"
285 "This setting can be changed from the \"Preferences\" dialog,\n"
286 "and the tool can be activated manually from the \"Tools\" menu." ),
287 _(
"Rescue Symbols" ), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION );
288 int resp = dlg.ShowModal ();
290 if( resp == wxID_YES )
313 DIALOG_RESCUE_EACH dlg( aParent, aRescuer, aCurrentSheet, aGalBackEndType, aAskShowAgain );
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
Class DIALOG_RESCUE_EACH_BASE.
wxBoxSizer * m_SizerNewPanel
HTML_WINDOW * m_htmlPrompt
wxBoxSizer * m_SizerOldPanel
wxButton * m_stdButtonsCancel
wxButton * m_stdButtonsOK
virtual void OnCancelClick(wxCommandEvent &event)
wxPanel * m_previewNewPanel
wxDataViewListCtrl * m_ListOfConflicts
wxPanel * m_previewOldPanel
wxButton * m_btnNeverShowAgain
wxDataViewListCtrl * m_ListOfInstances
wxStdDialogButtonSizer * m_stdButtons
wxStaticText * m_titleInstances
void PopulateConflictList()
DIALOG_RESCUE_EACH(wxWindow *aParent, RESCUER &aRescuer, SCH_SHEET_PATH *aCurrentSheet, EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackEndType, bool aAskShowAgain)
This dialog asks the user which rescuable, cached parts he wants to rescue.
void OnNeverShowClick(wxCommandEvent &aEvent) override
bool TransferDataToWindow() override
void OnCancelClick(wxCommandEvent &aEvent) override
SYMBOL_PREVIEW_WIDGET * m_previewNewWidget
~DIALOG_RESCUE_EACH()=default
bool TransferDataFromWindow() override
void OnConflictSelect(wxDataViewEvent &aEvent) override
SYMBOL_PREVIEW_WIDGET * m_previewOldWidget
void PopulateInstanceList()
void displayItemsInConflict()
SCH_SHEET_PATH * m_currentSheet
void SetupStandardButtons(std::map< int, wxString > aLabels={})
virtual const wxString & GetText() const
Return the string associated with the text object.
bool AppendToPage(const wxString &aSource)
APP_SETTINGS_BASE * KifaceSettings() const
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
std::vector< RESCUE_CANDIDATE * > m_chosen_candidates
std::vector< SCH_SYMBOL * > * GetSymbols()
Get the list of symbols that need rescued.
size_t GetCandidateCount()
Return the number of rescue candidates found.
boost::ptr_vector< RESCUE_CANDIDATE > m_all_candidates
virtual wxString GetActionDescription() const =0
Get a description of the action proposed, for displaying in the UI.
virtual LIB_SYMBOL * GetCacheCandidate() const
Get the part that can be loaded from the project cache, if possible, or else NULL.
virtual wxString GetRequestedName() const
Get the name that was originally requested in the schematic.
virtual LIB_SYMBOL * GetLibCandidate() const
Get the part the would be loaded from the libraries, if possible, or else NULL.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
int InvokeDialogRescueEach(wxWindow *aParent, RESCUER &aRescuer, SCH_SHEET_PATH *aCurrentSheet, EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackEndType, bool aAskShowAgain)
This dialog asks the user which rescuable, cached parts he wants to rescue.
Definition for symbol library class.