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.
This commit is contained in:
jean-pierre charras 2011-09-04 20:35:14 +02:00
parent 4da0bfc20b
commit 9b97938a8a
7 changed files with 44 additions and 25 deletions

View File

@ -17,7 +17,6 @@ set( COMMON_ABOUT_DLG_SRCS
dialogs/dialog_get_component_base.cpp
dialogs/dialog_hotkeys_editor.cpp
dialogs/dialog_hotkeys_editor_base.cpp
dialogs/dialog_load_error.cpp
dialogs/dialog_page_settings_base.cpp
)
@ -58,6 +57,7 @@ set(COMMON_SRCS
gr_basic.cpp
hotkeys_basic.cpp
hotkey_grid_table.cpp
html_messagebox.cpp
msgpanel.cpp
netlist_keywords.cpp
newstroke_font.cpp

View File

@ -1,22 +1,22 @@
#include "fctsys.h"
#include "dialog_load_error.h"
#include "html_messagebox.h"
#include "macros.h"
DIALOG_LOAD_ERROR::DIALOG_LOAD_ERROR( wxWindow* parent )
:
DIALOG_DISPLAY_HTML_TEXT_BASE( parent, wxID_ANY, _("Load Error!"),wxDefaultPosition, wxSize( 450,250 ) )
HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* parent, const wxString & aTitle,
wxPoint aPos, wxSize aSize)
: DIALOG_DISPLAY_HTML_TEXT_BASE( parent, wxID_ANY, aTitle, aPos, aSize )
{
SetFocus();
ListClear();
}
void DIALOG_LOAD_ERROR::OnCloseButtonClick( wxCommandEvent& event )
void HTML_MESSAGE_BOX::OnCloseButtonClick( wxCommandEvent& event )
{
EndModal(0);
}
void DIALOG_LOAD_ERROR::ListClear(void)
void HTML_MESSAGE_BOX::ListClear(void)
{
m_htmlWindow->SetPage(wxEmptyString);
}
@ -26,7 +26,7 @@ void DIALOG_LOAD_ERROR::ListClear(void)
* Add a list of items.
* @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 );
@ -48,7 +48,7 @@ void DIALOG_LOAD_ERROR::ListSet(const wxString &aList)
* Add a list of 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>");
for ( unsigned ii = 0; ii < aList.GetCount(); ii ++ )
@ -65,10 +65,20 @@ void DIALOG_LOAD_ERROR::ListSet(const wxArrayString &aList)
* Add a message (in bold) to message list.
* @param message = the message
*/
void DIALOG_LOAD_ERROR::MessageSet(const wxString &message)
void HTML_MESSAGE_BOX::MessageSet(const wxString &message)
{
wxString message_value;
message_value.Printf(wxT("<b>%s</b><br>"), GetChars( message ) );
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 );
}

View File

@ -17,7 +17,7 @@
#include "dialog_cvpcb_config.h"
#include "class_DisplayFootprintsFrame.h"
#include "cvpcb_id.h"
#include "dialog_load_error.h"
#include "html_messagebox.h"
#include "build_version.h"
@ -578,7 +578,7 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
/* Display error messages, if any */
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() )
{

View File

@ -11,7 +11,7 @@
#include "general.h"
#include "class_library.h"
#include "dialog_load_error.h"
#include "html_messagebox.h"
/**
@ -94,7 +94,7 @@ void SCH_EDIT_FRAME::LoadLibraries( void )
/* Print the libraries not found */
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.ListSet( libraries_not_found );
libraries_not_found.empty();

View File

@ -70,7 +70,7 @@
#include <math.h>
#include "dialog_load_error.h"
#include "html_messagebox.h"
extern int ReadInt( 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 )
// Display errors list
if( m_Messages.size() > 0 )
{
DIALOG_LOAD_ERROR dlg( this );
HTML_MESSAGE_BOX dlg( this, _("Files not found") );
dlg.ListSet( m_Messages );
dlg.ShowModal();
}

View File

@ -10,7 +10,7 @@
#include "gerbview.h"
#include "class_GERBER.h"
#include "dialog_load_error.h"
#include "html_messagebox.h"
/* Read a gerber file, RS274D or RS274X format.
*/
@ -156,7 +156,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
// Display errors list
if( m_Messages.size() > 0 )
{
DIALOG_LOAD_ERROR dlg( this );
HTML_MESSAGE_BOX dlg( this, _("Errors") );
dlg.ListSet(m_Messages);
dlg.ShowModal();
}

View File

@ -1,5 +1,5 @@
#ifndef __dialog_load_error_h_
#define __dialog_load_error_h_
#ifndef _html_messagebox_
#define _html_messagebox_
/**
@file
@ -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"
/** Implementing DIALOG_LOAD_ERROR */
class DIALOG_LOAD_ERROR : public DIALOG_DISPLAY_HTML_TEXT_BASE
/** Implementing HTML_MESSAGE_BOX */
class HTML_MESSAGE_BOX : public DIALOG_DISPLAY_HTML_TEXT_BASE
{
protected:
// Handlers for DIALOG_LOAD_ERROR_BASE events.
// Handlers for HTML_MESSAGE_BOX_BASE events.
void OnCloseButtonClick( wxCommandEvent& event );
public:
/** Constructor */
DIALOG_LOAD_ERROR( wxWindow* parent );
HTML_MESSAGE_BOX( wxWindow* parent, const wxString & aTitle,
wxPoint aPos = wxDefaultPosition,
wxSize aSize = wxSize( 450,250 ) );
/**
* Function ListSet
@ -39,6 +41,13 @@ public:
* @param message = the 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_