diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index c32e886f26..e6e62b94ee 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -24,7 +24,6 @@ set(COMMON_SRCS
copy_to_clipboard.cpp
dialog_display_info_HTML_base.cpp
dialog_load_error.cpp
- dialog_load_error_base.cpp
dcsvg.cpp
displlst.cpp
dlist.cpp
diff --git a/common/dialog_load_error.cpp b/common/dialog_load_error.cpp
index 9f3fb9b282..ced37f883a 100644
--- a/common/dialog_load_error.cpp
+++ b/common/dialog_load_error.cpp
@@ -10,7 +10,7 @@ DIALOG_DISPLAY_HTML_TEXT_BASE( parent, wxID_ANY, _("Load Error!"),wxDefaultPosit
void DIALOG_LOAD_ERROR::OnCloseButtonClick( wxCommandEvent& event )
{
- Destroy();
+ EndModal(0);
}
@@ -23,11 +23,11 @@ void DIALOG_LOAD_ERROR::ListClear(void)
* Add a list of items.
* @param list = a pointer on a string containing items. Items are separated by '\n'
*/
-void DIALOG_LOAD_ERROR::ListSet(wxString *list)
+void DIALOG_LOAD_ERROR::ListSet(const wxString &list)
{
wxArrayString* wxStringSplit( wxString txt, wxChar splitter );
- wxArrayString* strings_list = wxStringSplit( *list, wxChar('\n') );
+ wxArrayString* strings_list = wxStringSplit( list, wxChar('\n') );
m_htmlWindow->AppendToPage(wxT("
") );
for ( unsigned ii = 0; ii < strings_list->GetCount(); ii ++ )
{
@@ -44,10 +44,10 @@ void DIALOG_LOAD_ERROR::ListSet(wxString *list)
* Add a message (in bold) to message list.
* @param message = a pointer to the message
*/
-void DIALOG_LOAD_ERROR::MessageSet(wxString *message)
+void DIALOG_LOAD_ERROR::MessageSet(const wxString &message)
{
wxString message_value;
- message_value.Printf(wxT("%s
"), message->GetData() );
+ message_value.Printf(wxT("%s
"), message.GetData() );
m_htmlWindow->AppendToPage( message_value );
}
diff --git a/cvpcb/listlib.cpp b/cvpcb/listlib.cpp
index e67661c277..6a20fc7bdb 100644
--- a/cvpcb/listlib.cpp
+++ b/cvpcb/listlib.cpp
@@ -76,9 +76,7 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
if( !tmp )
{
- msg.Printf( _( "PCB foot print library file <%s> could not be found in the default search paths." ),
- filename.GetFullName().c_str() );
- wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
+ mdc_files_not_found << filename.GetFullName() << wxT("\n");
continue;
}
@@ -87,9 +85,7 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
if( file == NULL )
{
- msg.Printf( _( "Could not open PCB foot print library file <%s>." ),
- tmp.c_str() );
- wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
+ mdc_files_invalid << tmp << _(" (file cannot be opened)") << wxT("\n");
continue;
}
@@ -97,9 +93,7 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
fgets( buffer, 32, file );
if( strncmp( buffer, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
{
- msg.Printf( _( "<%s> is not a valid Kicad PCB foot print library" ),
- tmp.c_str() );
- wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
+ mdc_files_invalid << tmp << _(" (Not a Kicad file)") << wxT("\n");
fclose( file );
continue;
}
@@ -129,9 +123,7 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
if( !end )
{
- msg.Printf( _( "Unexpected end of file occurred while parsing PCB foot print library <%s>." ),
- tmp.c_str() );
- wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
+ mdc_files_invalid << tmp << _(" (Unexpected end of file)") << wxT("\n");
}
}
}
@@ -144,26 +136,26 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
/* Display if there are mdc files not found */
- if( !mdc_files_not_found.IsEmpty() )
- {
- wxString message = _("Some MDC files could not be found!");
- DIALOG_LOAD_ERROR *dialog = new DIALOG_LOAD_ERROR(NULL);
- dialog->Show();
- dialog->MessageSet(&message);
- dialog->ListSet(&mdc_files_not_found);
- mdc_files_not_found = wxT("");
- }
+ if( !mdc_files_not_found.IsEmpty() || !mdc_files_invalid.IsEmpty() )
+ {
+ DIALOG_LOAD_ERROR dialog(NULL);
+ if( !mdc_files_not_found.IsEmpty() )
+ {
+ wxString message = _("Some MDC files could not be found!");
+ dialog.MessageSet(message);
+ dialog.ListSet(mdc_files_not_found);
+ mdc_files_not_found.Empty();
+ }
- /* Display if there are mdc files invalid */
- if( !mdc_files_invalid.IsEmpty() )
- {
- wxString message = _("Some MDC files are invalid!");
- DIALOG_LOAD_ERROR *dialog = new DIALOG_LOAD_ERROR(NULL);
- dialog->Show();
- dialog->MessageSet(&message);
- dialog->ListSet(&mdc_files_invalid);
- mdc_files_invalid = wxT("");
- }
+ /* Display if there are mdc files invalid */
+ if( !mdc_files_invalid.IsEmpty() )
+ {
+ dialog.MessageSet( _("Some MDC files are invalid!"));
+ dialog.ListSet(mdc_files_invalid);
+ mdc_files_invalid.Empty();
+ }
+ dialog.ShowModal();
+ }
list.sort();
diff --git a/eeschema/eelibs_read_libraryfiles.cpp b/eeschema/eelibs_read_libraryfiles.cpp
index 9f427581c3..1528bc270a 100644
--- a/eeschema/eelibs_read_libraryfiles.cpp
+++ b/eeschema/eelibs_read_libraryfiles.cpp
@@ -168,12 +168,11 @@ void LoadLibraries( WinEDA_SchematicFrame* frame )
/* Print the libraries not found */
if( !libraries_not_found.IsEmpty() )
{
- wxString message = _("The following libraries could not be found:");
- DIALOG_LOAD_ERROR *dialog = new DIALOG_LOAD_ERROR(NULL);
- dialog->Show();
- dialog->MessageSet(&message);
- dialog->ListSet(&libraries_not_found);
- libraries_not_found = wxT("");
+ DIALOG_LOAD_ERROR dialog(frame);
+ dialog.MessageSet(_("The following libraries could not be found:"));
+ dialog.ListSet(libraries_not_found);
+ libraries_not_found.empty();
+ dialog.ShowModal();
}
diff --git a/include/dialog_load_error.h b/include/dialog_load_error.h
index b44eaf7d2c..36c2254004 100644
--- a/include/dialog_load_error.h
+++ b/include/dialog_load_error.h
@@ -20,15 +20,15 @@ public:
DIALOG_LOAD_ERROR( wxWindow* parent );
/** Function ListSet
* Add a list of items.
- * @param list = a pointer on a string containing items. Items are separated by '\n'
+ * @param list = a string containing items. Items are separated by '\n'
*/
- void ListSet(wxString *list);
+ void ListSet(const wxString &list);
void ListClear();
/** Function MessageSet
* Add a message (in bold) to message list.
- * @param message = a pointer to the message
+ * @param message = the message
*/
- void MessageSet(wxString *message);
+ void MessageSet(const wxString &message);
};
#endif // __dialog_load_error_h_