Commit 9b97938a authored by jean-pierre charras's avatar jean-pierre charras

Code cleaning: rename DIALOG_LOAD_ERROR (a stupid name) class to the more...

Code cleaning: rename DIALOG_LOAD_ERROR (a stupid name)  class to the more understandable  HTML_MESSAGE_BOX.
rename corresponding files are move them in a better place.
parent 4da0bfc2
...@@ -17,7 +17,6 @@ set( COMMON_ABOUT_DLG_SRCS ...@@ -17,7 +17,6 @@ set( COMMON_ABOUT_DLG_SRCS
dialogs/dialog_get_component_base.cpp dialogs/dialog_get_component_base.cpp
dialogs/dialog_hotkeys_editor.cpp dialogs/dialog_hotkeys_editor.cpp
dialogs/dialog_hotkeys_editor_base.cpp dialogs/dialog_hotkeys_editor_base.cpp
dialogs/dialog_load_error.cpp
dialogs/dialog_page_settings_base.cpp dialogs/dialog_page_settings_base.cpp
) )
...@@ -58,6 +57,7 @@ set(COMMON_SRCS ...@@ -58,6 +57,7 @@ set(COMMON_SRCS
gr_basic.cpp gr_basic.cpp
hotkeys_basic.cpp hotkeys_basic.cpp
hotkey_grid_table.cpp hotkey_grid_table.cpp
html_messagebox.cpp
msgpanel.cpp msgpanel.cpp
netlist_keywords.cpp netlist_keywords.cpp
newstroke_font.cpp newstroke_font.cpp
......
#include "fctsys.h" #include "fctsys.h"
#include "dialog_load_error.h" #include "html_messagebox.h"
#include "macros.h" #include "macros.h"
DIALOG_LOAD_ERROR::DIALOG_LOAD_ERROR( wxWindow* parent ) HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* parent, const wxString & aTitle,
: wxPoint aPos, wxSize aSize)
DIALOG_DISPLAY_HTML_TEXT_BASE( parent, wxID_ANY, _("Load Error!"),wxDefaultPosition, wxSize( 450,250 ) ) : DIALOG_DISPLAY_HTML_TEXT_BASE( parent, wxID_ANY, aTitle, aPos, aSize )
{ {
SetFocus(); SetFocus();
ListClear(); ListClear();
} }
void DIALOG_LOAD_ERROR::OnCloseButtonClick( wxCommandEvent& event ) void HTML_MESSAGE_BOX::OnCloseButtonClick( wxCommandEvent& event )
{ {
EndModal(0); EndModal(0);
} }
void DIALOG_LOAD_ERROR::ListClear(void) void HTML_MESSAGE_BOX::ListClear(void)
{ {
m_htmlWindow->SetPage(wxEmptyString); m_htmlWindow->SetPage(wxEmptyString);
} }
...@@ -26,7 +26,7 @@ void DIALOG_LOAD_ERROR::ListClear(void) ...@@ -26,7 +26,7 @@ void DIALOG_LOAD_ERROR::ListClear(void)
* Add a list of items. * Add a list of items.
* @param aList = a string containing items. Items are separated by '\n' * @param aList = a string containing items. Items are separated by '\n'
*/ */
void DIALOG_LOAD_ERROR::ListSet(const wxString &aList) void HTML_MESSAGE_BOX::ListSet(const wxString &aList)
{ {
wxArrayString* wxStringSplit( wxString txt, wxChar splitter ); wxArrayString* wxStringSplit( wxString txt, wxChar splitter );
...@@ -48,7 +48,7 @@ void DIALOG_LOAD_ERROR::ListSet(const wxString &aList) ...@@ -48,7 +48,7 @@ void DIALOG_LOAD_ERROR::ListSet(const wxString &aList)
* Add a list of items. * Add a list of items.
* @param aList = a wxArrayString containing items * @param aList = a wxArrayString containing items
*/ */
void DIALOG_LOAD_ERROR::ListSet(const wxArrayString &aList) void HTML_MESSAGE_BOX::ListSet(const wxArrayString &aList)
{ {
wxString msg = wxT("<ul>"); wxString msg = wxT("<ul>");
for ( unsigned ii = 0; ii < aList.GetCount(); ii ++ ) for ( unsigned ii = 0; ii < aList.GetCount(); ii ++ )
...@@ -65,10 +65,20 @@ void DIALOG_LOAD_ERROR::ListSet(const wxArrayString &aList) ...@@ -65,10 +65,20 @@ void DIALOG_LOAD_ERROR::ListSet(const wxArrayString &aList)
* Add a message (in bold) to message list. * Add a message (in bold) to message list.
* @param message = the message * @param message = the message
*/ */
void DIALOG_LOAD_ERROR::MessageSet(const wxString &message) void HTML_MESSAGE_BOX::MessageSet(const wxString &message)
{ {
wxString message_value; wxString message_value;
message_value.Printf(wxT("<b>%s</b><br>"), GetChars( message ) ); message_value.Printf(wxT("<b>%s</b><br>"), GetChars( message ) );
m_htmlWindow->AppendToPage( message_value ); m_htmlWindow->AppendToPage( message_value );
} }
/**
* Function AddHTML_Text
* Add a text to message list.
* @param message = the text to add
*/
void HTML_MESSAGE_BOX::AddHTML_Text(const wxString &message)
{
m_htmlWindow->AppendToPage( message );
}
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "dialog_cvpcb_config.h" #include "dialog_cvpcb_config.h"
#include "class_DisplayFootprintsFrame.h" #include "class_DisplayFootprintsFrame.h"
#include "cvpcb_id.h" #include "cvpcb_id.h"
#include "dialog_load_error.h" #include "html_messagebox.h"
#include "build_version.h" #include "build_version.h"
...@@ -578,7 +578,7 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles() ...@@ -578,7 +578,7 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
/* Display error messages, if any */ /* Display error messages, if any */
if( !m_footprints.m_filesNotFound.IsEmpty() || !m_footprints.m_filesInvalid.IsEmpty() ) if( !m_footprints.m_filesNotFound.IsEmpty() || !m_footprints.m_filesInvalid.IsEmpty() )
{ {
DIALOG_LOAD_ERROR dialog( NULL ); HTML_MESSAGE_BOX dialog( this, _("Load Error") );
if( !m_footprints.m_filesNotFound.IsEmpty() ) if( !m_footprints.m_filesNotFound.IsEmpty() )
{ {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "general.h" #include "general.h"
#include "class_library.h" #include "class_library.h"
#include "dialog_load_error.h" #include "html_messagebox.h"
/** /**
...@@ -94,7 +94,7 @@ void SCH_EDIT_FRAME::LoadLibraries( void ) ...@@ -94,7 +94,7 @@ void SCH_EDIT_FRAME::LoadLibraries( void )
/* Print the libraries not found */ /* Print the libraries not found */
if( !libraries_not_found.IsEmpty() ) if( !libraries_not_found.IsEmpty() )
{ {
DIALOG_LOAD_ERROR dialog( this ); HTML_MESSAGE_BOX dialog( this, _("Files not found") );
dialog.MessageSet( _( "The following libraries could not be found:" ) ); dialog.MessageSet( _( "The following libraries could not be found:" ) );
dialog.ListSet( libraries_not_found ); dialog.ListSet( libraries_not_found );
libraries_not_found.empty(); libraries_not_found.empty();
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
#include <math.h> #include <math.h>
#include "dialog_load_error.h" #include "html_messagebox.h"
extern int ReadInt( char*& text, bool aSkipSeparator = true ); extern int ReadInt( char*& text, bool aSkipSeparator = true );
extern double ReadDouble( char*& text, bool aSkipSeparator = true ); extern double ReadDouble( char*& text, bool aSkipSeparator = true );
...@@ -180,7 +180,7 @@ bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName ) ...@@ -180,7 +180,7 @@ bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
// Display errors list // Display errors list
if( m_Messages.size() > 0 ) if( m_Messages.size() > 0 )
{ {
DIALOG_LOAD_ERROR dlg( this ); HTML_MESSAGE_BOX dlg( this, _("Files not found") );
dlg.ListSet( m_Messages ); dlg.ListSet( m_Messages );
dlg.ShowModal(); dlg.ShowModal();
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "gerbview.h" #include "gerbview.h"
#include "class_GERBER.h" #include "class_GERBER.h"
#include "dialog_load_error.h" #include "html_messagebox.h"
/* Read a gerber file, RS274D or RS274X format. /* Read a gerber file, RS274D or RS274X format.
*/ */
...@@ -156,7 +156,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName, ...@@ -156,7 +156,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
// Display errors list // Display errors list
if( m_Messages.size() > 0 ) if( m_Messages.size() > 0 )
{ {
DIALOG_LOAD_ERROR dlg( this ); HTML_MESSAGE_BOX dlg( this, _("Errors") );
dlg.ListSet(m_Messages); dlg.ListSet(m_Messages);
dlg.ShowModal(); dlg.ShowModal();
} }
......
#ifndef __dialog_load_error_h_ #ifndef _html_messagebox_
#define __dialog_load_error_h_ #define _html_messagebox_
/** /**
@file @file
...@@ -8,16 +8,18 @@ Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder. ...@@ -8,16 +8,18 @@ Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder.
#include "../common/dialogs/dialog_display_info_HTML_base.h" #include "../common/dialogs/dialog_display_info_HTML_base.h"
/** Implementing DIALOG_LOAD_ERROR */ /** Implementing HTML_MESSAGE_BOX */
class DIALOG_LOAD_ERROR : public DIALOG_DISPLAY_HTML_TEXT_BASE class HTML_MESSAGE_BOX : public DIALOG_DISPLAY_HTML_TEXT_BASE
{ {
protected: protected:
// Handlers for DIALOG_LOAD_ERROR_BASE events. // Handlers for HTML_MESSAGE_BOX_BASE events.
void OnCloseButtonClick( wxCommandEvent& event ); void OnCloseButtonClick( wxCommandEvent& event );
public: public:
/** Constructor */ /** Constructor */
DIALOG_LOAD_ERROR( wxWindow* parent ); HTML_MESSAGE_BOX( wxWindow* parent, const wxString & aTitle,
wxPoint aPos = wxDefaultPosition,
wxSize aSize = wxSize( 450,250 ) );
/** /**
* Function ListSet * Function ListSet
...@@ -39,6 +41,13 @@ public: ...@@ -39,6 +41,13 @@ public:
* @param message = the message * @param message = the message
*/ */
void MessageSet(const wxString &message); void MessageSet(const wxString &message);
/**
* Function AddHTML_Text
* Add a html text (without any change) to message list.
* @param message = the text to add
*/
void AddHTML_Text(const wxString &message);
}; };
#endif // __dialog_load_error_h_ #endif // _html_messagebox_
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