Merged dialog_load_error_base and dialog_display_info_HTML_base, code cleaning
This commit is contained in:
parent
1700a6a78d
commit
3be6ba4234
|
@ -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
|
||||
|
|
|
@ -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("<ul>") );
|
||||
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("<b>%s</b><br>"), message->GetData() );
|
||||
message_value.Printf(wxT("<b>%s</b><br>"), message.GetData() );
|
||||
m_htmlWindow->AppendToPage( message_value );
|
||||
}
|
||||
|
||||
|
|
|
@ -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,25 +136,25 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
|
|||
|
||||
|
||||
/* Display if there are mdc files not found */
|
||||
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_LOAD_ERROR *dialog = new DIALOG_LOAD_ERROR(NULL);
|
||||
dialog->Show();
|
||||
dialog->MessageSet(&message);
|
||||
dialog->ListSet(&mdc_files_not_found);
|
||||
mdc_files_not_found = wxT("");
|
||||
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("");
|
||||
dialog.MessageSet( _("Some MDC files are invalid!"));
|
||||
dialog.ListSet(mdc_files_invalid);
|
||||
mdc_files_invalid.Empty();
|
||||
}
|
||||
dialog.ShowModal();
|
||||
}
|
||||
|
||||
list.sort();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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_
|
||||
|
|
Loading…
Reference in New Issue