diff --git a/AUTHORS.txt b/AUTHORS.txt index 8c228c3b23..103047ca8c 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -40,6 +40,8 @@ Mario Luzeiro <mrluzeiro[at]ua-dot-pt> Mateusz Skowroński <skowri[at]gmail-dot-com> Cheng Sheng <chengsheng[at]google-dot-com> Google Inc. Kristoffer Ödmark <kristoffer.odmark90[at]gmail-dot-com> +Oliver Walters <oliver.henry.walters[at]gmail-dot-com> + See also CHANGELOG.txt for contributors. diff --git a/common/confirm.cpp b/common/confirm.cpp index af25736e95..d8711b4a97 100644 --- a/common/confirm.cpp +++ b/common/confirm.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -28,6 +28,7 @@ */ #include <wx/stockitem.h> +#include <wx/richmsgdlg.h> #include <bitmaps.h> #include <html_messagebox.h> @@ -70,31 +71,47 @@ void DisplayError( wxWindow* parent, const wxString& text, int displaytime ) { wxMessageDialog* dialog; - if( displaytime > 0 ) - dialog = new wxMessageDialog( parent, text, _( "Warning" ), - wxOK | wxCENTRE | wxICON_INFORMATION - | wxRESIZE_BORDER - ); - else - dialog = new wxMessageDialog( parent, text, _( "Error" ), - wxOK | wxCENTRE | wxICON_ERROR - | wxRESIZE_BORDER - ); + int icon = displaytime > 0 ? wxICON_INFORMATION : wxICON_ERROR; + + dialog = new wxMessageDialog( parent, text, _( "Warning" ), + wxOK | wxCENTRE | wxRESIZE_BORDER | icon ); dialog->ShowModal(); dialog->Destroy(); } -void DisplayInfoMessage( wxWindow* parent, const wxString& text, int displaytime ) +void DisplayErrorMessage( wxWindow* aParent, const wxString& aText, const wxString aExtraInfo ) { - wxMessageDialog* dialog; + wxRichMessageDialog* dlg; - dialog = new wxMessageDialog( parent, text, _( "Info" ), - wxOK | wxCENTRE | wxICON_INFORMATION ); + dlg = new wxRichMessageDialog( aParent, aText, _( "Error" ), + wxOK | wxCENTRE | wxRESIZE_BORDER | wxICON_ERROR ); - dialog->ShowModal(); - dialog->Destroy(); + if( !aExtraInfo.IsEmpty() ) + { + dlg->ShowDetailedText( aExtraInfo ); + } + + dlg->ShowModal(); + dlg->Destroy(); +} + + +void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxString aExtraInfo ) +{ + wxRichMessageDialog* dlg; + + dlg = new wxRichMessageDialog( aParent, aMessage, _( "Info" ), + wxOK | wxCENTRE | wxRESIZE_BORDER | wxICON_INFORMATION ); + + if( !aExtraInfo.IsEmpty() ) + { + dlg->ShowDetailedText( aExtraInfo ); + } + + dlg->ShowModal(); + dlg->Destroy(); } diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index 5f626b571a..e1a50e14e8 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -85,7 +85,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic, { wxString msg; msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count ); - DisplayInfoMessage( NULL, msg, 2 ); + DisplayInfoMessage( NULL, msg ); } } diff --git a/include/confirm.h b/include/confirm.h index ff2c64e9cc..9d8822d5b3 100644 --- a/include/confirm.h +++ b/include/confirm.h @@ -57,13 +57,26 @@ int DisplayExitDialog( wxWindow* aParent, const wxString& aMessage ); */ void DisplayError( wxWindow* parent, const wxString& aMessage, int displaytime = 0 ); +/** + * Function DisplayErrorMessage + * displays an error message with \a aMessage + * + * @param aParent is the parent window + * @param aMessage is the message text to display + * @param aExtraInfo is extra data that can be optionally displayed in a collapsible pane + */ +void DisplayErrorMessage( wxWindow* aParent, const wxString& aMessage, const wxString aExtraInfo = wxEmptyString ); + + /** * Function DisplayInfoMessage * displays an informational message box with \a aMessage. * - * @warning Setting \a displaytime does not work. Do not use it. + * @param aParent is the parent window + * @param aMessage is the message text to display + * @param aExtraInfo is the extra data that can be optionally displayed in a collapsible pane */ -void DisplayInfoMessage( wxWindow* parent, const wxString& aMessage, int displaytime = 0 ); +void DisplayInfoMessage( wxWindow* parent, const wxString& aMessage, const wxString aExtraInfo = wxEmptyString ); /** * Function IsOK