diff --git a/common/validators.cpp b/common/validators.cpp index 86a2a6d1db..f1ffe96b4d 100644 --- a/common/validators.cpp +++ b/common/validators.cpp @@ -31,7 +31,7 @@ #include -FOOTPRINT_NAME_VALIDATOR::FOOTPRINT_NAME_VALIDATOR( wxString* aValue ) : +FILE_NAME_CHAR_VALIDATOR::FILE_NAME_CHAR_VALIDATOR( wxString* aValue ) : wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, aValue ) { // The Windows (DOS) file system forbidden characters already include the forbidden diff --git a/eeschema/dialogs/dialog_sch_sheet_props.cpp b/eeschema/dialogs/dialog_sch_sheet_props.cpp index 747a8d115f..4f47e572b1 100644 --- a/eeschema/dialogs/dialog_sch_sheet_props.cpp +++ b/eeschema/dialogs/dialog_sch_sheet_props.cpp @@ -1,13 +1,17 @@ #include #include +#include + DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) : DIALOG_SCH_SHEET_PROPS_BASE( parent ) { + m_textFileName->SetValidator( FILE_NAME_CHAR_VALIDATOR() ); m_textFileName->SetFocus(); m_sdbSizer1OK->SetDefault(); } + void DIALOG_SCH_SHEET_PROPS::SetFileName( const wxString& aFileName ) { // Filenames are stored using unix notation @@ -18,6 +22,7 @@ void DIALOG_SCH_SHEET_PROPS::SetFileName( const wxString& aFileName ) m_textFileName->SetValue( fname ); } + const wxString DIALOG_SCH_SHEET_PROPS::GetFileName() { // Filenames are stored using unix notation diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index bbaa213e88..f1e9bd7db2 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -75,6 +75,10 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) if( !fileName.IsOk() ) { DisplayError( this, _( "File name is not valid!" ) ); + + if( m_canvas ) + m_canvas->Refresh(); + return false; } @@ -85,6 +89,10 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) { DisplayError( this, wxString::Format( _( "A sheet named \"%s\" already exists." ), GetChars( dlg.GetSheetName() ) ) ); + + if( m_canvas ) + m_canvas->Refresh(); + return false; } @@ -121,7 +129,12 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) msg += _("\n\nDo you want to create a sheet with the contents of this file?" ); if( !IsOK( this, msg ) ) + { + if( m_canvas ) + m_canvas->Refresh(); + return false; + } } else // New file. { @@ -150,12 +163,12 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) if( useScreen != NULL ) { tmp.Printf( _( "A file named <%s> already exists in the current schematic hierarchy." ), - GetChars( newFullFilename ) ); + GetChars( newFullFilename ) ); } else { tmp.Printf( _( "A file named <%s> already exists." ), - GetChars( newFullFilename ) ); + GetChars( newFullFilename ) ); } msg += tmp; diff --git a/include/validators.h b/include/validators.h index ca98be89ab..9cca5b0951 100644 --- a/include/validators.h +++ b/include/validators.h @@ -30,16 +30,16 @@ #include /** - * Class FOOTPRINT_NAME_VALIDATOR + * Class FILE_NAME_CHAR_VALIDATOR * * This class provides a custom wxValidator object for limiting the allowable characters when * defining footprint names. Since the introduction of the PRETTY footprint library format, * footprint names cannot have any characters that would prevent file creation on any platform. */ -class FOOTPRINT_NAME_VALIDATOR : public wxTextValidator +class FILE_NAME_CHAR_VALIDATOR : public wxTextValidator { public: - FOOTPRINT_NAME_VALIDATOR( wxString* aValue = NULL ) : + FILE_NAME_CHAR_VALIDATOR( wxString* aValue = NULL ) : wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, aValue ) { // The Windows (DOS) file system forbidden characters already include the forbidden diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp index 0703853f47..c474218e08 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp @@ -64,7 +64,7 @@ DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) ); SetIcon( icon ); - m_FootprintNameCtrl->SetValidator( FOOTPRINT_NAME_VALIDATOR() ); + m_FootprintNameCtrl->SetValidator( FILE_NAME_CHAR_VALIDATOR() ); initModeditProperties(); m_sdbSizerStdButtonsOK->SetDefault(); GetSizer()->SetSizeHints( this ); diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 5a02231bbf..d64acb131c 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -718,7 +718,7 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName ) if( moduleName.IsEmpty() ) { wxTextEntryDialog dlg( this, FMT_MOD_REF, FMT_MOD_CREATE, moduleName ); - dlg.SetTextValidator( FOOTPRINT_NAME_VALIDATOR( &moduleName ) ); + dlg.SetTextValidator( FILE_NAME_CHAR_VALIDATOR( &moduleName ) ); if( dlg.ShowModal() != wxID_OK ) return NULL; //Aborted by user