Change KIDIALOG hashing algorithm to __FILE__ + __LINE__.
Using Title + Message wasn't working for all the dialogs which did substitutions in the message (which was a lot of them). Fixes: lp:1789348 * https://bugs.launchpad.net/kicad/+bug/1789348
This commit is contained in:
parent
9125d7fdb6
commit
c90a3efea2
|
@ -46,7 +46,6 @@ KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage,
|
||||||
const wxString& aCaption, long aStyle )
|
const wxString& aCaption, long aStyle )
|
||||||
: wxRichMessageDialog( aParent, aMessage, aCaption, aStyle | wxCENTRE )
|
: wxRichMessageDialog( aParent, aMessage, aCaption, aStyle | wxCENTRE )
|
||||||
{
|
{
|
||||||
setHash();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +53,14 @@ KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage,
|
||||||
KD_TYPE aType, const wxString& aCaption )
|
KD_TYPE aType, const wxString& aCaption )
|
||||||
: wxRichMessageDialog( aParent, aMessage, getCaption( aType, aCaption ), getStyle( aType ) )
|
: wxRichMessageDialog( aParent, aMessage, getCaption( aType, aCaption ), getStyle( aType ) )
|
||||||
{
|
{
|
||||||
setHash();
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KIDIALOG::DoNotShowCheckbox( wxString aUniqueId, int line )
|
||||||
|
{
|
||||||
|
ShowCheckBox( _( "Do not show again" ), false );
|
||||||
|
|
||||||
|
m_hash = std::hash<wxString>{}( aUniqueId ) + line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,14 +116,6 @@ int KIDIALOG::ShowModal()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KIDIALOG::setHash()
|
|
||||||
{
|
|
||||||
std::size_t h1 = std::hash<wxString>{}( GetMessage() );
|
|
||||||
std::size_t h2 = std::hash<wxString>{}( GetTitle() );
|
|
||||||
m_hash = h1 ^ ( h2 << 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxString KIDIALOG::getCaption( KD_TYPE aType, const wxString& aCaption )
|
wxString KIDIALOG::getCaption( KD_TYPE aType, const wxString& aCaption )
|
||||||
{
|
{
|
||||||
if( !aCaption.IsEmpty() )
|
if( !aCaption.IsEmpty() )
|
||||||
|
|
|
@ -328,7 +328,7 @@ void DIALOG_CONFIGURE_PATHS::OnGridCellChanging( wxGridEvent& event )
|
||||||
"the external environment variable(s) from your system." );
|
"the external environment variable(s) from your system." );
|
||||||
KIDIALOG dlg( this, msg1, KIDIALOG::KD_WARNING );
|
KIDIALOG dlg( this, msg1, KIDIALOG::KD_WARNING );
|
||||||
dlg.ShowDetailedText( msg2 );
|
dlg.ShowDetailedText( msg2 );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
}
|
}
|
||||||
else if( col == EV_NAME_COL && m_EnvVars->GetCellValue( row, EV_NAME_COL ) != text )
|
else if( col == EV_NAME_COL && m_EnvVars->GetCellValue( row, EV_NAME_COL ) != text )
|
||||||
|
|
|
@ -215,7 +215,7 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
|
||||||
|
|
||||||
KIDIALOG dlg( this, message, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
KIDIALOG dlg( this, message, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
dlg.SetOKLabel( _( "Clear and Annotate" ) );
|
dlg.SetOKLabel( _( "Clear and Annotate" ) );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxCANCEL )
|
if( dlg.ShowModal() == wxCANCEL )
|
||||||
return;
|
return;
|
||||||
|
@ -261,7 +261,7 @@ void DIALOG_ANNOTATE::OnClearAnnotationCmpClick( wxCommandEvent& event )
|
||||||
|
|
||||||
KIDIALOG dlg( this, message, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
KIDIALOG dlg( this, message, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
dlg.SetOKLabel( _( "Clear Annotation" ) );
|
dlg.SetOKLabel( _( "Clear Annotation" ) );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -152,7 +152,7 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event )
|
||||||
|
|
||||||
KIDIALOG errorDlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
KIDIALOG errorDlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
errorDlg.SetOKLabel( _( "Overwrite" ) );
|
errorDlg.SetOKLabel( _( "Overwrite" ) );
|
||||||
errorDlg.DoNotShowCheckbox();
|
errorDlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
if( errorDlg.ShowModal() == wxID_CANCEL )
|
if( errorDlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -210,7 +210,7 @@ void LIB_EDIT_FRAME::PlacePin()
|
||||||
|
|
||||||
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
dlg.SetOKLabel( _( "Create Pin Anyway" ) );
|
dlg.SetOKLabel( _( "Create Pin Anyway" ) );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
bool status = dlg.ShowModal() == wxID_OK;
|
bool status = dlg.ShowModal() == wxID_OK;
|
||||||
|
|
||||||
|
|
|
@ -51,10 +51,7 @@ public:
|
||||||
KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType, const wxString& aCaption = "" );
|
KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType, const wxString& aCaption = "" );
|
||||||
|
|
||||||
///> Shows the 'do not show again' checkbox
|
///> Shows the 'do not show again' checkbox
|
||||||
void DoNotShowCheckbox()
|
void DoNotShowCheckbox( wxString file, int line );
|
||||||
{
|
|
||||||
ShowCheckBox( _( "Do not show again" ), false );
|
|
||||||
}
|
|
||||||
|
|
||||||
///> Checks the 'do not show again' setting for the dialog
|
///> Checks the 'do not show again' setting for the dialog
|
||||||
bool DoNotShowAgain() const;
|
bool DoNotShowAgain() const;
|
||||||
|
@ -64,9 +61,6 @@ public:
|
||||||
int ShowModal() override;
|
int ShowModal() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///> Sets the dialog hash value
|
|
||||||
void setHash();
|
|
||||||
|
|
||||||
///> Unique identifier of the dialog
|
///> Unique identifier of the dialog
|
||||||
unsigned long m_hash;
|
unsigned long m_hash;
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
|
||||||
"want to create a new empty directory for the project?" );
|
"want to create a new empty directory for the project?" );
|
||||||
|
|
||||||
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxYES_NO | wxICON_WARNING );
|
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxYES_NO | wxICON_WARNING );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_YES )
|
if( dlg.ShowModal() == wxID_YES )
|
||||||
{
|
{
|
||||||
|
|
|
@ -365,7 +365,7 @@ void KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate( wxCommandEvent& event )
|
||||||
_( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
_( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
msgDlg.SetExtendedMessage( extendedMsg );
|
msgDlg.SetExtendedMessage( extendedMsg );
|
||||||
msgDlg.SetOKLabel( _( "Overwrite" ) );
|
msgDlg.SetOKLabel( _( "Overwrite" ) );
|
||||||
msgDlg.DoNotShowCheckbox();
|
msgDlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
if( msgDlg.ShowModal() == wxID_CANCEL )
|
if( msgDlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -230,7 +230,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
|
||||||
KIDIALOG dlg( this, _( "The legacy segment fill mode is not recommended."
|
KIDIALOG dlg( this, _( "The legacy segment fill mode is not recommended."
|
||||||
"Convert zone to polygon fill? "), _( "Legacy Warning" ),
|
"Convert zone to polygon fill? "), _( "Legacy Warning" ),
|
||||||
wxYES_NO | wxICON_WARNING );
|
wxYES_NO | wxICON_WARNING );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxYES )
|
if( dlg.ShowModal() == wxYES )
|
||||||
m_settings.m_FillMode = ZFM_POLYGONS;
|
m_settings.m_FillMode = ZFM_POLYGONS;
|
||||||
|
|
|
@ -170,7 +170,7 @@ bool DIALOG_EXPORT_IDF3::TransferDataFromWindow()
|
||||||
wxString msg = wxString::Format( _( "File %s already exists." ), fn.GetPath() );
|
wxString msg = wxString::Format( _( "File %s already exists." ), fn.GetPath() );
|
||||||
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
dlg.SetOKLabel( _( "Overwrite" ) );
|
dlg.SetOKLabel( _( "Overwrite" ) );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
return ( dlg.ShowModal() == wxID_OK );
|
return ( dlg.ShowModal() == wxID_OK );
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ bool DIALOG_GENCAD_EXPORT_OPTIONS::TransferDataFromWindow()
|
||||||
wxString msg = wxString::Format( _( "File %s already exists." ), fn );
|
wxString msg = wxString::Format( _( "File %s already exists." ), fn );
|
||||||
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
dlg.SetOKLabel( _( "Overwrite" ) );
|
dlg.SetOKLabel( _( "Overwrite" ) );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
return ( dlg.ShowModal() == wxID_OK );
|
return ( dlg.ShowModal() == wxID_OK );
|
||||||
}
|
}
|
||||||
|
|
|
@ -328,7 +328,7 @@ bool DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange( const std::vector<D_PAD*>& c
|
||||||
|
|
||||||
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
dlg.SetOKLabel( _( "Continue" ) );
|
dlg.SetOKLabel( _( "Continue" ) );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
return dlg.ShowModal() == wxID_OK;
|
return dlg.ShowModal() == wxID_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -490,7 +490,7 @@ wxString PCB_BASE_EDIT_FRAME::CreateNewLibrary(const wxString& aLibName )
|
||||||
wxString msg = wxString::Format( _( "Library %s already exists." ), libPath );
|
wxString msg = wxString::Format( _( "Library %s already exists." ), libPath );
|
||||||
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
dlg.SetOKLabel( _( "Overwrite" ) );
|
dlg.SetOKLabel( _( "Overwrite" ) );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
|
@ -804,7 +804,7 @@ bool PNS_KICAD_IFACE::syncZone( PNS::NODE* aWorld, ZONE_CONTAINER* aZone )
|
||||||
wxString::Format( _( "%s\nThis zone cannot be handled by the track layout tool.\n"
|
wxString::Format( _( "%s\nThis zone cannot be handled by the track layout tool.\n"
|
||||||
"Please verify it is not a self-intersecting polygon." ),
|
"Please verify it is not a self-intersecting polygon." ),
|
||||||
aZone->GetSelectMenuText( MILLIMETRES ) ) );
|
aZone->GetSelectMenuText( MILLIMETRES ) ) );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ void ROUTER_TOOL::performDragging( int aMode )
|
||||||
KIDIALOG dlg( frame(), _( "The selected item is locked." ), _( "Confirmation" ),
|
KIDIALOG dlg( frame(), _( "The selected item is locked." ), _( "Confirmation" ),
|
||||||
wxOK | wxCANCEL | wxICON_WARNING );
|
wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
dlg.SetOKLabel( _( "Drag Anyway" ) );
|
dlg.SetOKLabel( _( "Drag Anyway" ) );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
@ -1162,7 +1162,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
||||||
KIDIALOG dlg( frame(), _( "The selected item is locked." ), _( "Confirmation" ),
|
KIDIALOG dlg( frame(), _( "The selected item is locked." ), _( "Confirmation" ),
|
||||||
wxOK | wxCANCEL | wxICON_WARNING );
|
wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
dlg.SetOKLabel( _( "Drag Anyway" ) );
|
dlg.SetOKLabel( _( "Drag Anyway" ) );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -241,7 +241,7 @@ int ALIGN_DISTRIBUTE_TOOL::checkLockedStatus( const SELECTION &selection ) const
|
||||||
_( "Selection contains locked items. Do you want to continue?" ),
|
_( "Selection contains locked items. Do you want to continue?" ),
|
||||||
_( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
_( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
dlg.SetOKLabel( _( "Continue" ) );
|
dlg.SetOKLabel( _( "Continue" ) );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_OK )
|
if( dlg.ShowModal() == wxID_OK )
|
||||||
return SELECTION_LOCK_OVERRIDE;
|
return SELECTION_LOCK_OVERRIDE;
|
||||||
|
|
|
@ -196,7 +196,7 @@ bool ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
|
||||||
_( "Zone fills are out-of-date. Refill?" ),
|
_( "Zone fills are out-of-date. Refill?" ),
|
||||||
_( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
_( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
dlg.SetOKCancelLabels( _( "Refill" ), _( "Continue without Refill" ) );
|
dlg.SetOKCancelLabels( _( "Refill" ), _( "Continue without Refill" ) );
|
||||||
dlg.DoNotShowCheckbox();
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
refill = ( dlg.ShowModal() == wxID_OK );
|
refill = ( dlg.ShowModal() == wxID_OK );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue