Improve symbol rescue dialog.

* Fix some minor layout issues on Linux.
* Use button labels to clarify rescue actions.
This commit is contained in:
Wayne Stambaugh 2022-10-13 10:36:39 -04:00
parent 46a41e2e34
commit 41461f7a69
4 changed files with 41 additions and 35 deletions

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2015-2022 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -114,7 +114,7 @@ DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH( wxWindow* aParent,
dc.SetFont( font ); dc.SetFont( font );
int width = dc.GetTextExtent( header ).GetWidth(); int width = dc.GetTextExtent( header ).GetWidth() * 1.25;
m_ListOfConflicts->AppendToggleColumn( header, wxDATAVIEW_CELL_ACTIVATABLE, width, m_ListOfConflicts->AppendToggleColumn( header, wxDATAVIEW_CELL_ACTIVATABLE, width,
wxALIGN_CENTER ); wxALIGN_CENTER );
@ -138,9 +138,6 @@ DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH( wxWindow* aParent,
m_previewOldWidget->SetLayoutDirection( wxLayout_LeftToRight ); m_previewOldWidget->SetLayoutDirection( wxLayout_LeftToRight );
m_previewNewWidget->SetLayoutDirection( wxLayout_LeftToRight ); m_previewNewWidget->SetLayoutDirection( wxLayout_LeftToRight );
Layout();
setSizeInDU( 480, 360 );
// Make sure the HTML window is large enough. Some fun size juggling and // Make sure the HTML window is large enough. Some fun size juggling and
// fudge factors here but it does seem to work pretty reliably. // fudge factors here but it does seem to work pretty reliably.
wxSize info_size = m_htmlPrompt->GetTextExtent( info ); wxSize info_size = m_htmlPrompt->GetTextExtent( info );
@ -150,10 +147,12 @@ DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH( wxWindow* aParent,
m_htmlPrompt->SetSizeHints( 2 * prompt_size.x / 3, approx_info_height ); m_htmlPrompt->SetSizeHints( 2 * prompt_size.x / 3, approx_info_height );
SetupStandardButtons(); SetupStandardButtons();
m_stdButtonsOK->SetLabel( _( "Rescue Symbols" ) );
m_stdButtonsCancel->SetLabel( _( "Skip Symbol Rescue" ) );
m_stdButtons->Layout();
GetSizer()->SetSizeHints( this );
Layout(); Layout();
GetSizer()->SetSizeHints( this );
setSizeInDU( 480, 360 );
Center(); Center();
} }
@ -181,6 +180,7 @@ bool DIALOG_RESCUE_EACH::TransferDataToWindow()
void DIALOG_RESCUE_EACH::PopulateConflictList() void DIALOG_RESCUE_EACH::PopulateConflictList()
{ {
wxVector<wxVariant> data; wxVector<wxVariant> data;
for( RESCUE_CANDIDATE& each_candidate : m_Rescuer->m_all_candidates ) for( RESCUE_CANDIDATE& each_candidate : m_Rescuer->m_all_candidates )
{ {
data.clear(); data.clear();
@ -195,6 +195,7 @@ void DIALOG_RESCUE_EACH::PopulateConflictList()
{ {
// Select the first choice // Select the first choice
m_ListOfConflicts->SelectRow( 0 ); m_ListOfConflicts->SelectRow( 0 );
// Ensure this choice is displayed: // Ensure this choice is displayed:
displayItemsInConflict(); displayItemsInConflict();
} }
@ -284,6 +285,7 @@ bool DIALOG_RESCUE_EACH::TransferDataFromWindow()
if( rescue_part ) if( rescue_part )
m_Rescuer->m_chosen_candidates.push_back( &m_Rescuer->m_all_candidates[index] ); m_Rescuer->m_chosen_candidates.push_back( &m_Rescuer->m_all_candidates[index] );
} }
return true; return true;
} }
@ -291,11 +293,11 @@ bool DIALOG_RESCUE_EACH::TransferDataFromWindow()
void DIALOG_RESCUE_EACH::OnNeverShowClick( wxCommandEvent& aEvent ) void DIALOG_RESCUE_EACH::OnNeverShowClick( wxCommandEvent& aEvent )
{ {
wxMessageDialog dlg( GetParent(), wxMessageDialog dlg( GetParent(),
_( "Stop showing this tool?\n" _( "Stop showing this tool?\n"
"No changes will be made.\n\n" "No changes will be made.\n\n"
"This setting can be changed from the \"Symbol Libraries\" dialog,\n" "This setting can be changed from the \"Symbol Libraries\" dialog,\n"
"and the tool can be activated manually from the \"Tools\" menu." ), "and the tool can be activated manually from the \"Tools\" menu." ),
_( "Rescue Symbols" ), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION ); _( "Rescue Symbols" ), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION );
int resp = dlg.ShowModal (); int resp = dlg.ShowModal ();
if( resp == wxID_YES ) if( resp == wxID_YES )

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0) // C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -11,7 +11,7 @@
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 ) 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( 400,-1 ), wxDefaultSize ); this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* bSizerMain; wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL ); bSizerMain = new wxBoxSizer( wxVERTICAL );
@ -27,24 +27,24 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i
m_titleSymbols = new wxStaticText( this, wxID_ANY, _("Symbols to update:"), wxDefaultPosition, wxDefaultSize, 0 ); m_titleSymbols = new wxStaticText( this, wxID_ANY, _("Symbols to update:"), wxDefaultPosition, wxDefaultSize, 0 );
m_titleSymbols->Wrap( -1 ); m_titleSymbols->Wrap( -1 );
m_titleSymbols->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); m_titleSymbols->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizer8->Add( m_titleSymbols, 0, wxLEFT|wxRIGHT, 10 ); bSizer8->Add( m_titleSymbols, 0, wxEXPAND|wxLEFT|wxRIGHT, 10 );
m_ListOfConflicts = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_ListOfConflicts = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_ListOfConflicts, 2, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); bSizer8->Add( m_ListOfConflicts, 2, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 );
m_titleInstances = new wxStaticText( this, wxID_ANY, _("Instances of this symbol:"), wxDefaultPosition, wxDefaultSize, 0 ); m_titleInstances = new wxStaticText( this, wxID_ANY, _("Instances of this symbol:"), wxDefaultPosition, wxDefaultSize, 0 );
m_titleInstances->Wrap( -1 ); m_titleInstances->Wrap( -1 );
m_titleInstances->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); m_titleInstances->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizer8->Add( m_titleInstances, 0, wxRIGHT|wxLEFT, 10 ); bSizer8->Add( m_titleInstances, 0, wxEXPAND|wxLEFT|wxRIGHT, 10 );
m_ListOfInstances = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_ListOfInstances = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_ListOfInstances, 2, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); bSizer8->Add( m_ListOfInstances, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 );
bSizerMain->Add( bSizer8, 2, wxEXPAND, 5 ); bSizerMain->Add( bSizer8, 3, wxEXPAND, 5 );
wxBoxSizer* bSizerPreviews; wxBoxSizer* bSizerPreviews;
bSizerPreviews = new wxBoxSizer( wxHORIZONTAL ); bSizerPreviews = new wxBoxSizer( wxHORIZONTAL );
@ -54,11 +54,13 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i
m_previewOldLabel = new wxStaticText( this, wxID_ANY, _("Cached Symbol:"), wxDefaultPosition, wxDefaultSize, 0 ); m_previewOldLabel = new wxStaticText( this, wxID_ANY, _("Cached Symbol:"), wxDefaultPosition, wxDefaultSize, 0 );
m_previewOldLabel->Wrap( -1 ); m_previewOldLabel->Wrap( -1 );
m_previewOldLabel->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); m_previewOldLabel->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizerLeftPreview->Add( m_previewOldLabel, 0, 0, 5 ); bSizerLeftPreview->Add( m_previewOldLabel, 0, 0, 5 );
m_previewOldPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_previewOldPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_previewOldPanel->SetMinSize( wxSize( 350,-1 ) );
m_SizerOldPanel = new wxBoxSizer( wxVERTICAL ); m_SizerOldPanel = new wxBoxSizer( wxVERTICAL );
@ -75,11 +77,13 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i
m_previewNewLabel = new wxStaticText( this, wxID_ANY, _("Library Symbol:"), wxDefaultPosition, wxDefaultSize, 0 ); m_previewNewLabel = new wxStaticText( this, wxID_ANY, _("Library Symbol:"), wxDefaultPosition, wxDefaultSize, 0 );
m_previewNewLabel->Wrap( -1 ); m_previewNewLabel->Wrap( -1 );
m_previewNewLabel->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); m_previewNewLabel->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizerRightPreview->Add( m_previewNewLabel, 0, 0, 5 ); bSizerRightPreview->Add( m_previewNewLabel, 0, 0, 5 );
m_previewNewPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_previewNewPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_previewNewPanel->SetMinSize( wxSize( 350,-1 ) );
m_SizerNewPanel = new wxBoxSizer( wxVERTICAL ); m_SizerNewPanel = new wxBoxSizer( wxVERTICAL );
@ -92,7 +96,7 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i
bSizerPreviews->Add( bSizerRightPreview, 1, wxEXPAND, 5 ); bSizerPreviews->Add( bSizerRightPreview, 1, wxEXPAND, 5 );
bSizerMain->Add( bSizerPreviews, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 ); bSizerMain->Add( bSizerPreviews, 2, wxEXPAND|wxRIGHT|wxLEFT, 10 );
wxBoxSizer* bSizer5; wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxHORIZONTAL ); bSizer5 = new wxBoxSizer( wxHORIZONTAL );

View File

@ -44,7 +44,7 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size">400,-1</property> <property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_RESCUE_EACH_BASE</property> <property name="name">DIALOG_RESCUE_EACH_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">-1,-1</property> <property name="size">-1,-1</property>
@ -65,7 +65,7 @@
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">2</property> <property name="proportion">3</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizer8</property> <property name="name">bSizer8</property>
@ -131,7 +131,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">10</property> <property name="border">10</property>
<property name="flag">wxLEFT|wxRIGHT</property> <property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -220,7 +220,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">10</property> <property name="border">10</property>
<property name="flag">wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -282,7 +282,7 @@
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">10</property> <property name="border">10</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">2</property> <property name="proportion">1</property>
<object class="wxDataViewListCtrl" expanded="1"> <object class="wxDataViewListCtrl" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="context_help"></property> <property name="context_help"></property>
@ -311,7 +311,7 @@
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">10</property> <property name="border">10</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property> <property name="proportion">2</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizerPreviews</property> <property name="name">bSizerPreviews</property>
@ -422,9 +422,9 @@
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property> <property name="min_size">-1,-1</property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size">350,-1</property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_previewOldPanel</property> <property name="name">m_previewOldPanel</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
@ -556,10 +556,10 @@
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size">-1,-1</property>
<property name="min_size"></property> <property name="min_size">-1,-1</property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size">350,-1</property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_previewNewPanel</property> <property name="name">m_previewNewPanel</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0) // C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!