diff --git a/common/confirm.cpp b/common/confirm.cpp index f2188a722d..4ae4ec96f7 100644 --- a/common/confirm.cpp +++ b/common/confirm.cpp @@ -151,14 +151,23 @@ long KIDIALOG::getStyle( KD_TYPE aType ) } -bool OverrideLock( wxWindow* aParent, const wxString& aMessage ) +bool OverrideLock( wxWindow* aParent, const wxString& aMessage ) { +#ifdef __APPLE__ + // wxMessageDialog gets the button spacing wrong on Mac so we have to use wxRichMessageDialog. + // Note that its warning icon is more like wxMessageDialog's error icon, so we use it instead + // of wxICON_ERROR. + wxRichMessageDialog dlg( aParent, aMessage, _( "File Open Error" ), + wxYES_NO | wxICON_WARNING | wxCENTER ); + dlg.SetExtendedMessage( _( "Interleaved saves may produce very unexpected results." ) + + wxS( "\n" ) ); + dlg.SetYesNoLabels( _( "OK" ), _( "Open Anyway" ) ); +#else wxMessageDialog dlg( aParent, aMessage, _( "File Open Error" ), - wxYES_NO | wxICON_ERROR | wxCENTER ); - - // Note: must use the "no" label to get the correct positioning/spacing for a (potentially) - // destructive action - dlg.SetYesNoLabels( _( "Do Not Open" ), _( "Open Anyway" ) ); + wxYES_NO | wxICON_ERROR | wxCENTER ); + dlg.SetExtendedMessage( _( "Interleaved saves may produce very unexpected results." ) ); + dlg.SetYesNoLabels( _( "OK" ), _( "Open Anyway" ) ); +#endif return dlg.ShowModal() == wxID_NO; } @@ -170,7 +179,8 @@ int UnsavedChangesDialog( wxWindow* parent, const wxString& aMessage, bool* aApp wxRichMessageDialog dlg( parent, aMessage, _( "Save Changes?" ), wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_WARNING | wxCENTER ); - dlg.SetExtendedMessage( _( "If you don't save, all your changes will be permanently lost." ) ); + dlg.SetExtendedMessage( _( "If you don't save, all your changes will be permanently lost." ) + + wxS( "\n" ) ); dlg.SetYesNoLabels( _( "Save" ), _( "Discard Changes" ) ); if( aApplyToAll ) @@ -192,7 +202,8 @@ int UnsavedChangesDialog( wxWindow* parent, const wxString& aMessage, bool* aApp int UnsavedChangesDialog( wxWindow* parent, const wxString& aMessage ) { #ifdef __APPLE__ - // wxWidgets gets the button order wrong on Mac so use the other dialog. + // wxMessageDialog gets the button order (and spacing) wrong on Mac so we have to use + // wxRichMessageDialog. return UnsavedChangesDialog( parent, aMessage, nullptr ); #else wxMessageDialog dlg( parent, aMessage, _( "Save Changes?" ), diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 8822a3b8ba..6f7e46ddb4 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -113,16 +113,15 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in return false; } - wxString fullFileName( aFileSet[0] ); + wxString fullFileName( aFileSet[0] ); + wxFileName wx_filename( fullFileName ); // We insist on caller sending us an absolute path, if it does not, we say it's a bug. - wxASSERT_MSG( wxFileName( fullFileName ).IsAbsolute(), wxT( "Path is not absolute!" ) ); + wxASSERT_MSG( wx_filename.IsAbsolute(), wxT( "Path is not absolute!" ) ); if( !LockFile( fullFileName ) ) { - msg.Printf( _( "Schematic file '%s' is already open.\n\n" - "Interleaved saves may produce very unexpected results.\n" ), - fullFileName ); + msg.Printf( _( "Schematic '%s' is already open." ), wx_filename.GetFullName() ); if( !OverrideLock( this, msg ) ) return false; @@ -1119,6 +1118,7 @@ bool SCH_EDIT_FRAME::doAutoSave() bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType ) { + wxFileName filename( aFileName ); wxFileName newfilename; SCH_SHEET_LIST sheetList = Schematic().GetSheets(); SCH_IO_MGR::SCH_FILE_T fileType = (SCH_IO_MGR::SCH_FILE_T) aFileType; @@ -1129,15 +1129,12 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType ) case SCH_IO_MGR::SCH_CADSTAR_ARCHIVE: case SCH_IO_MGR::SCH_EAGLE: // We insist on caller sending us an absolute path, if it does not, we say it's a bug. - wxASSERT_MSG( wxFileName( aFileName ).IsAbsolute(), - wxT( "Import schematic caller didn't send full filename" ) ); + wxASSERT_MSG( filename.IsAbsolute(), wxT( "Import schematic: path is not absolute!" ) ); if( !LockFile( aFileName ) ) { wxString msg; - msg.Printf( _( "Schematic file '%s' is already open.\n\n" - "Interleaved saves may produce very unexpected results.\n" ), - aFileName ); + msg.Printf( _( "Schematic '%s' is already open." ), filename.GetFullName() ); if( !OverrideLock( this, msg ) ) return false; diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 456e9c90b1..baee4fdd3c 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -563,24 +563,21 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in return false; } - wxString fullFileName( aFileSet[0] ); - wxString msg; + wxString fullFileName( aFileSet[0] ); + wxFileName wx_filename( fullFileName ); + wxString msg; if( Kiface().IsSingle() ) - { KIPLATFORM::APP::RegisterApplicationRestart( fullFileName ); - } // We insist on caller sending us an absolute path, if it does not, we say it's a bug. - wxASSERT_MSG( wxFileName( fullFileName ).IsAbsolute(), wxT( "Path is not absolute!" ) ); + wxASSERT_MSG( wx_filename.IsAbsolute(), wxT( "Path is not absolute!" ) ); std::unique_ptr lockFile = ::LockFile( fullFileName ); if( !lockFile || lockFile->IsAnotherRunning() ) { - msg.Printf( _( "PCB file '%s' is already open.\n\n" - "Interleaved saves may produce very unexpected results.\n" ), - fullFileName ); + msg.Printf( _( "PCB '%s' is already open." ), wx_filename.GetFullName() ); if( !OverrideLock( this, msg ) ) return false;