Allow for reduced nagging with wider use of KIDIALOG.

(cherry picked from commit c2dd5df)
This commit is contained in:
Jeff Young 2018-07-10 15:33:04 +01:00
parent a52605957e
commit 99db5cb543
13 changed files with 96 additions and 49 deletions

View File

@ -152,9 +152,12 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event )
if( old_part )
{
msg.Printf( _( "Symbol \"%s\" already exists. Overwrite it?" ), part->GetName() );
msg.Printf( _( "Symbol \"%s\" already exists." ), part->GetName() );
KIDIALOG errorDlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
errorDlg.SetOKLabel( _( "Overwrite" ) );
errorDlg.DoNotShowCheckbox();
if( !IsOK( this, msg ) )
if( errorDlg.ShowModal() == wxID_CANCEL )
return;
}
}

View File

@ -92,9 +92,16 @@ void LIB_EDIT_FRAME::SelectActiveLibrary( const wxString& aLibrary )
bool LIB_EDIT_FRAME::LoadComponentAndSelectLib( const LIB_ID& aLibId )
{
if( GetScreen()->IsModify()
&& !IsOK( this, _( "The current symbol is not saved.\n\nDiscard current changes?" ) ) )
if( GetScreen()->IsModify() )
{
KIDIALOG dlg( this, _( "The current symbol contains unsaved changes." ),
_( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
dlg.SetOKLabel( _( "Discard Changes" ) );
dlg.DoNotShowCheckbox();
if( dlg.ShowModal() == wxID_CANCEL )
return false;
}
SelectActiveLibrary( aLibId.GetLibNickname() );
return LoadComponentFromCurrentLib( aLibId.GetLibItemName() );

View File

@ -205,10 +205,14 @@ void LIB_EDIT_FRAME::PlacePin()
{
m_canvas->SetIgnoreMouseEvents( true );
wxString msg;
msg.Printf( _( "This position is already occupied by another pin, in unit %d.\n"
"Continue?" ), pin->GetUnit() );
msg.Printf( _( "This position is already occupied by another pin, in unit %d." ),
pin->GetUnit() );
bool status = IsOK( this, msg );
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
dlg.SetOKLabel( _( "Create Pin Anyway" ) );
dlg.DoNotShowCheckbox();
bool status = dlg.ShowModal() == wxID_OK;
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );

View File

@ -98,7 +98,10 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
"create projects in their own clean directory.\n\nDo you "
"want to create a new empty directory for the project?" );
if( IsOK( this, msg ) )
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxYES_NO | wxICON_WARNING );
dlg.DoNotShowCheckbox();
if( dlg.ShowModal() == wxID_YES )
{
// Append a new directory with the same name of the project file
// and try to create it

View File

@ -359,19 +359,15 @@ void KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate( wxCommandEvent& event )
wxString extendedMsg = _( "Overwriting files:" ) + "\n";
for( const auto& file : overwrittenFiles )
{
extendedMsg += "\n" + file.GetFullName();
}
wxMessageDialog owDlg( this,
_( "Are you sure you want to overwrite files in "
"the destination folder?" ),
_( "Warning!" ),
wxYES_NO | wxICON_QUESTION | wxCENTER );
owDlg.SetExtendedMessage( extendedMsg );
owDlg.SetYesNoLabels( _( "Overwrite" ), _( "Do Not Overwrite" ) );
KIDIALOG msgDlg( this, _( "Similar files already exist in the destination folder." ),
_( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
msgDlg.SetExtendedMessage( extendedMsg );
msgDlg.SetOKLabel( _( "Overwrite" ) );
msgDlg.DoNotShowCheckbox();
if( owDlg.ShowModal() == wxID_NO )
if( msgDlg.ShowModal() == wxID_CANCEL )
return;
}
}

View File

@ -36,6 +36,7 @@
// IDF export header generated by wxFormBuilder
#include <dialog_export_idf_base.h>
#include <pcb_edit_frame.h>
#include <confirm.h>
#define OPTKEY_IDF_THOU wxT( "IDFExportThou" )
#define OPTKEY_IDF_REF_AUTOADJ wxT( "IDFRefAutoAdj" )
@ -166,9 +167,12 @@ bool DIALOG_EXPORT_IDF3::TransferDataFromWindow()
if( fn.FileExists() )
{
if( wxMessageBox( _( "Are you sure you want to overwrite the existing file?" ),
_( "Warning" ), wxYES_NO | wxCENTER | wxICON_QUESTION, this ) == wxNO )
return false;
wxString msg = wxString::Format( _( "File %s already exists." ), fn.GetPath() );
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
dlg.SetOKLabel( _( "Overwrite" ) );
dlg.DoNotShowCheckbox();
return ( dlg.ShowModal() == wxID_OK );
}
return true;

View File

@ -121,7 +121,14 @@ bool DIALOG_GENCAD_EXPORT_OPTIONS::TransferDataFromWindow()
wxString fn = GetFileName();
if( wxFile::Exists( fn ) )
return IsOK( this, wxString::Format( _( "File %s already exists. Overwrite?" ), fn ) );
{
wxString msg = wxString::Format( _( "File %s already exists." ), fn );
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
dlg.SetOKLabel( _( "Overwrite" ) );
dlg.DoNotShowCheckbox();
return ( dlg.ShowModal() == wxID_OK );
}
return true;
}

View File

@ -215,9 +215,9 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
if( IsCopperLayer( layer ) )
{
// An graphic item is put on a copper layer.
// This is sometimes useful, for instance for microwave applications ans net tees.
// Because the DRC does not handle graphic items, it can break boards.
// Therefore a confirmation is requested
// This is sometimes useful, for instance for microwave applications and net tees.
// However, because the DRC does not handle graphic items, it can break boards.
// Therefore a confirmation is required.
if( !IsOK( this, _( "The graphic item will be on a copper layer.\n"
"This is very dangerous because DRC does not handle it.\n"
"Are you sure?" ) ) )

View File

@ -298,7 +298,12 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
if( GetScreen()->IsModify() && !GetBoard()->IsEmpty() )
{
if( !IsOK( this, _( "Current Footprint will be lost and this operation cannot be undone. Continue ?" ) ) )
KIDIALOG dlg( this, _( "The current footprint contains unsaved changes." ),
_( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
dlg.SetOKLabel( _( "Discard Changes" ) );
dlg.DoNotShowCheckbox();
if( dlg.ShowModal() == wxID_CANCEL )
break;
}
@ -524,7 +529,12 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( GetScreen()->IsModify() && !GetBoard()->IsEmpty() )
{
if( !IsOK( this, _( "Current Footprint will be lost and this operation cannot be undone. Continue ?" ) ) )
KIDIALOG dlg( this, _( "The current footprint contains unsaved changes." ),
_( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
dlg.SetOKLabel( _( "Discard Changes" ) );
dlg.DoNotShowCheckbox();
if( dlg.ShowModal() == wxID_CANCEL )
break;
}

View File

@ -58,15 +58,11 @@
// unique, "file local" translations:
#define FMT_OK_OVERWRITE _( "Library \"%s\" exists, OK to replace ?" )
#define FMT_CREATE_LIB _( "Create New Library Folder (the .pretty folder is the library)" )
#define FMT_OK_DELETE _( "OK to delete footprint \"%s\" in library \"%s\"" )
#define FMT_IMPORT_MODULE _( "Import Footprint" )
#define FMT_FILE_NOT_FOUND _( "File \"%s\" not found" )
#define FMT_NOT_MODULE _( "Not a footprint file" )
#define FMT_MOD_NOT_FOUND _( "Unable to find or load footprint \"%s\" from lib path \"%s\"" )
#define FMT_BAD_PATH _( "Unable to find or load footprint from path \"%s\"" )
#define FMT_BAD_PATHS _( "The footprint library \"%s\" could not be found in any of the search paths." )
#define FMT_LIB_READ_ONLY _( "Library \"%s\" is read only, not writable" )
#define FMT_EXPORT_MODULE _( "Export Footprint" )
@ -76,7 +72,6 @@
#define FMT_MOD_DELETED _( "Footprint \"%s\" deleted from library \"%s\"" )
#define FMT_MOD_CREATE _( "New Footprint" )
#define FMT_MOD_EXISTS _( "Footprint \"%s\" already exists in library \"%s\"" )
#define FMT_NO_REF_ABORTED _( "No footprint name defined." )
#define FMT_SELECT_LIB _( "Select Library" )
@ -514,9 +509,12 @@ wxString PCB_BASE_EDIT_FRAME::CreateNewLibrary(const wxString& aLibName )
}
else
{
wxString msg = wxString::Format( FMT_OK_OVERWRITE, GetChars( libPath ) );
wxString msg = wxString::Format( _( "Library %s already exists." ), libPath );
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
dlg.SetOKLabel( _( "Overwrite" ) );
dlg.DoNotShowCheckbox();
if( !IsOK( this, msg ) )
if( dlg.ShowModal() == wxID_CANCEL )
return wxEmptyString;
pi->FootprintLibDelete( libPath );

View File

@ -997,7 +997,12 @@ void ROUTER_TOOL::performDragging( int aMode )
if( m_startItem && m_startItem->IsLocked() )
{
if( !IsOK( frame(), _( "The item is locked. Do you want to continue?" ) ) )
KIDIALOG dlg( frame(), _( "The selected item is locked." ), _( "Confirmation" ),
wxOK | wxCANCEL | wxICON_WARNING );
dlg.SetOKLabel( _( "Drag Anyway" ) );
dlg.DoNotShowCheckbox();
if( dlg.ShowModal() == wxID_CANCEL )
return;
}
@ -1146,8 +1151,13 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
if( m_startItem && m_startItem->IsLocked() )
{
if( !IsOK( frame(), _( "The item is locked. Do you want to continue?" ) ) )
return false;
KIDIALOG dlg( frame(), _( "The selected item is locked." ), _( "Confirmation" ),
wxOK | wxCANCEL | wxICON_WARNING );
dlg.SetOKLabel( _( "Drag Anyway" ) );
dlg.DoNotShowCheckbox();
if( dlg.ShowModal() == wxID_CANCEL )
return 0;
}
VECTOR2I p0 = controls()->GetCursorPosition();

View File

@ -237,11 +237,14 @@ int ALIGN_DISTRIBUTE_TOOL::checkLockedStatus( const SELECTION &selection ) const
if( containsLocked )
{
if( IsOK( getEditFrame< PCB_EDIT_FRAME >(),
_( "Selection contains locked items. Do you want to continue?" ) ) )
{
KIDIALOG dlg( getEditFrame< PCB_EDIT_FRAME >(),
_( "Selection contains locked items. Do you want to continue?" ),
_( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
dlg.SetOKLabel( _( "Continue" ) );
dlg.DoNotShowCheckbox();
if( dlg.ShowModal() == wxID_OK )
return SELECTION_LOCK_OVERRIDE;
}
else
return SELECTION_LOCKED;
}

View File

@ -185,17 +185,19 @@ bool ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
if( aCheck )
{
bool cancel = !outOfDate || !IsOK( nullptr, _( "Zone fills are out-of-date. Re-fill?" ) );
bool refill = false;
if( m_progressReporter )
if( outOfDate )
{
// Sigh. Patch another case of "fall behind" dialogs on Mac.
if( m_progressReporter->GetParent() )
m_progressReporter->GetParent()->Raise();
m_progressReporter->Raise();
KIDIALOG dlg( m_progressReporter, _( "Zone fills are out-of-date. Refill?" ),
_( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
dlg.SetOKCancelLabels( _( "Refill" ), _( "Continue without Refill" ) );
dlg.DoNotShowCheckbox();
refill = ( dlg.ShowModal() == wxID_OK );
}
if( cancel )
if( !refill )
{
if( m_commit )
m_commit->Revert();