Commit 5156a1c1 authored by jerryjacobs's avatar jerryjacobs

Added load error dialog. To display file load errors in a wxTextCtrl with a...

Added load error dialog. To display file load errors in a wxTextCtrl with a message, this is the BUG 2802441 enhancement
parent aa9e61ed
...@@ -23,6 +23,8 @@ set(COMMON_SRCS ...@@ -23,6 +23,8 @@ set(COMMON_SRCS
confirm.cpp confirm.cpp
copy_to_clipboard.cpp copy_to_clipboard.cpp
dialog_display_info_HTML_base.cpp dialog_display_info_HTML_base.cpp
dialog_load_error.cpp
dialog_load_error_base.cpp
dcsvg.cpp dcsvg.cpp
displlst.cpp displlst.cpp
dlist.cpp dlist.cpp
......
#include "dialog_load_error.h"
DIALOG_LOAD_ERROR::DIALOG_LOAD_ERROR( wxWindow* parent )
:
DIALOG_LOAD_ERROR_BASE( parent )
{
}
void DIALOG_LOAD_ERROR::OnOkClick( wxCommandEvent& event )
{
Destroy();
}
void DIALOG_LOAD_ERROR::ListClear(void)
{
TextCtrlList->Clear();
}
void DIALOG_LOAD_ERROR::ListSet(wxString *list)
{
wxString list_value = *list;
TextCtrlList->SetValue(list_value);
}
void DIALOG_LOAD_ERROR::MessageSet(wxString *message)
{
wxString message_value = *message;
StaticTextMessage->SetLabel(message_value);
}
#ifndef __dialog_load_error__
#define __dialog_load_error__
/**
@file
Subclass of DIALOG_LOAD_ERROR_BASE, which is generated by wxFormBuilder.
*/
#include "dialog_load_error_base.h"
/** Implementing DIALOG_LOAD_ERROR_BASE */
class DIALOG_LOAD_ERROR : public DIALOG_LOAD_ERROR_BASE
{
protected:
// Handlers for DIALOG_LOAD_ERROR_BASE events.
void OnOkClick( wxCommandEvent& event );
public:
/** Constructor */
DIALOG_LOAD_ERROR( wxWindow* parent );
void ListSet(wxString *list);
void ListClear();
void MessageSet(wxString *message);
};
#endif // __dialog_load_error__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 19 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_load_error_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_LOAD_ERROR_BASE::DIALOG_LOAD_ERROR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( 320,240 ), wxDefaultSize );
wxBoxSizer* MainSizer;
MainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* MessageSizer;
MessageSizer = new wxBoxSizer( wxVERTICAL );
StaticTextMessage = new wxStaticText( this, wxID_ANY, _("message dummy"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
StaticTextMessage->Wrap( -1 );
MessageSizer->Add( StaticTextMessage, 0, wxALIGN_LEFT|wxALIGN_TOP|wxALL|wxEXPAND, 5 );
MainSizer->Add( MessageSizer, 0, wxALIGN_BOTTOM|wxALIGN_LEFT|wxALIGN_RIGHT|wxALIGN_TOP|wxEXPAND, 5 );
wxBoxSizer* ListSizer;
ListSizer = new wxBoxSizer( wxVERTICAL );
TextCtrlList = new wxTextCtrl( this, wxID_ANY, _("list dummy"), wxPoint( 0,0 ), wxSize( -1,-1 ), wxTE_DONTWRAP|wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL|wxNO_BORDER|wxVSCROLL );
ListSizer->Add( TextCtrlList, 1, wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP|wxEXPAND|wxALL, 5 );
MainSizer->Add( ListSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxVERTICAL );
OkButton = new wxButton( this, wxID_ANY, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 );
OkButton->SetDefault();
bSizer5->Add( OkButton, 0, wxALIGN_RIGHT|wxALL, 5 );
MainSizer->Add( bSizer5, 0, wxEXPAND, 5 );
this->SetSizer( MainSizer );
this->Layout();
MainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
OkButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LOAD_ERROR_BASE::OnOkClick ), NULL, this );
}
DIALOG_LOAD_ERROR_BASE::~DIALOG_LOAD_ERROR_BASE()
{
// Disconnect Events
OkButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LOAD_ERROR_BASE::OnOkClick ), NULL, this );
}
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="9" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_load_error_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">dialog_load_error</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">320,240</property>
<property name="name">DIALOG_LOAD_ERROR_BASE</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Load Error!</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">MainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_BOTTOM|wxALIGN_LEFT|wxALIGN_RIGHT|wxALIGN_TOP|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">MessageSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_LEFT|wxALIGN_TOP|wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">message dummy</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">StaticTextMessage</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxALIGN_LEFT</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">ListSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP|wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size">-1,-1</property>
<property name="name">TextCtrlList</property>
<property name="permission">protected</property>
<property name="pos">0,0</property>
<property name="size">-1,-1</property>
<property name="style">wxTE_DONTWRAP|wxTE_MULTILINE|wxTE_READONLY</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="value">list dummy</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxHSCROLL|wxNO_BORDER|wxVSCROLL</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer5</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Ok</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">OkButton</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOkClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 19 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_load_error_base__
#define __dialog_load_error_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LOAD_ERROR_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_LOAD_ERROR_BASE : public wxDialog
{
private:
protected:
wxStaticText* StaticTextMessage;
wxTextCtrl* TextCtrlList;
wxButton* OkButton;
// Virtual event handlers, overide them in your derived class
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
public:
DIALOG_LOAD_ERROR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Load Error!"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER );
~DIALOG_LOAD_ERROR_BASE();
};
#endif //__dialog_load_error_base__
...@@ -19,13 +19,10 @@ ...@@ -19,13 +19,10 @@
#include "cvpcb.h" #include "cvpcb.h"
#include "protos.h" #include "protos.h"
/* MDC file strings */
/* Bla */
wxString mdc_files_not_found; wxString mdc_files_not_found;
wxString mdc_files_invalid; wxString mdc_files_invalid;
/* routines locales : */ /* routines locales : */
static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list ); static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list );
...@@ -141,21 +138,28 @@ bool LoadFootprintFiles( const wxArrayString& libNames, ...@@ -141,21 +138,28 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
ReadDocLib( tmp, list ); ReadDocLib( tmp, list );
} }
/* Display if there are mdc files not found */ /* Display if there are mdc files not found */
if( mdc_files_not_found != wxT("")) if( !mdc_files_not_found.IsEmpty() )
{ {
wxString message = _("The following mdc files could not be found:\n\n"); wxString message = _("Some MDC files could not be found!");
message += mdc_files_not_found; DIALOG_LOAD_ERROR *dialog = new DIALOG_LOAD_ERROR(NULL);
wxMessageBox( message, _("Load error!"), wxOK | wxICON_ERROR ); dialog->Show();
dialog->MessageSet(&message);
dialog->ListSet(&mdc_files_not_found);
mdc_files_not_found = wxT(""); mdc_files_not_found = wxT("");
} }
/* Display if there are mdc files invalid */ /* Display if there are mdc files invalid */
if( mdc_files_invalid != wxT("")) if( !mdc_files_invalid.IsEmpty() )
{ {
wxString message = _("The following mdc files are invalid:\n\n"); wxString message = _("Some MDC files are invalid!");
message += mdc_files_invalid; DIALOG_LOAD_ERROR *dialog = new DIALOG_LOAD_ERROR(NULL);
wxMessageBox( message, _("Load error!"), wxOK | wxICON_ERROR ); dialog->Show();
dialog->MessageSet(&message);
dialog->ListSet(&mdc_files_invalid);
mdc_files_invalid = wxT(""); mdc_files_invalid = wxT("");
} }
......
...@@ -166,9 +166,12 @@ void LoadLibraries( WinEDA_SchematicFrame* frame ) ...@@ -166,9 +166,12 @@ void LoadLibraries( WinEDA_SchematicFrame* frame )
/* Print the libraries not found */ /* Print the libraries not found */
if( !libraries_not_found.IsEmpty() ) if( !libraries_not_found.IsEmpty() )
{ {
wxString message = _("The following libraries could not be found:\n\n"); wxString message = _("The following libraries could not be found:");
message += libraries_not_found; DIALOG_LOAD_ERROR *dialog = new DIALOG_LOAD_ERROR(NULL);
wxMessageBox( message, _("Load error!"), wxOK | wxICON_ERROR, frame ); dialog->Show();
dialog->MessageSet(&message);
dialog->ListSet(&libraries_not_found);
libraries_not_found = wxT("");
} }
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
#include "wx/confbase.h" #include "wx/confbase.h"
#include "wx/fileconf.h" #include "wx/fileconf.h"
/* TODO how do i else need to include a common dialog ? */
#include "../common/dialog_load_error.h"
class wxAboutDialogInfo; class wxAboutDialogInfo;
class BASE_SCREEN; class BASE_SCREEN;
class WinEDA_DrawFrame; class WinEDA_DrawFrame;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment