Added extra information to error and info messages
Optional extra information string which is displayed in a drop-down "details" box
This commit is contained in:
parent
6d52987928
commit
a0a3ca6646
|
@ -40,6 +40,8 @@ Mario Luzeiro <mrluzeiro[at]ua-dot-pt>
|
||||||
Mateusz Skowroński <skowri[at]gmail-dot-com>
|
Mateusz Skowroński <skowri[at]gmail-dot-com>
|
||||||
Cheng Sheng <chengsheng[at]google-dot-com> Google Inc.
|
Cheng Sheng <chengsheng[at]google-dot-com> Google Inc.
|
||||||
Kristoffer Ödmark <kristoffer.odmark90[at]gmail-dot-com>
|
Kristoffer Ödmark <kristoffer.odmark90[at]gmail-dot-com>
|
||||||
|
Oliver Walters <oliver.henry.walters[at]gmail-dot-com>
|
||||||
|
|
||||||
See also CHANGELOG.txt for contributors.
|
See also CHANGELOG.txt for contributors.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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) 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <wx/stockitem.h>
|
#include <wx/stockitem.h>
|
||||||
|
#include <wx/richmsgdlg.h>
|
||||||
|
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
#include <html_messagebox.h>
|
#include <html_messagebox.h>
|
||||||
|
@ -70,31 +71,47 @@ void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
|
||||||
{
|
{
|
||||||
wxMessageDialog* dialog;
|
wxMessageDialog* dialog;
|
||||||
|
|
||||||
if( displaytime > 0 )
|
int icon = displaytime > 0 ? wxICON_INFORMATION : wxICON_ERROR;
|
||||||
dialog = new wxMessageDialog( parent, text, _( "Warning" ),
|
|
||||||
wxOK | wxCENTRE | wxICON_INFORMATION
|
dialog = new wxMessageDialog( parent, text, _( "Warning" ),
|
||||||
| wxRESIZE_BORDER
|
wxOK | wxCENTRE | wxRESIZE_BORDER | icon );
|
||||||
);
|
|
||||||
else
|
|
||||||
dialog = new wxMessageDialog( parent, text, _( "Error" ),
|
|
||||||
wxOK | wxCENTRE | wxICON_ERROR
|
|
||||||
| wxRESIZE_BORDER
|
|
||||||
);
|
|
||||||
|
|
||||||
dialog->ShowModal();
|
dialog->ShowModal();
|
||||||
dialog->Destroy();
|
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" ),
|
dlg = new wxRichMessageDialog( aParent, aText, _( "Error" ),
|
||||||
wxOK | wxCENTRE | wxICON_INFORMATION );
|
wxOK | wxCENTRE | wxRESIZE_BORDER | wxICON_ERROR );
|
||||||
|
|
||||||
dialog->ShowModal();
|
if( !aExtraInfo.IsEmpty() )
|
||||||
dialog->Destroy();
|
{
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count );
|
msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count );
|
||||||
DisplayInfoMessage( NULL, msg, 2 );
|
DisplayInfoMessage( NULL, msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,13 +57,26 @@ int DisplayExitDialog( wxWindow* aParent, const wxString& aMessage );
|
||||||
*/
|
*/
|
||||||
void DisplayError( wxWindow* parent, const wxString& aMessage, int displaytime = 0 );
|
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
|
* Function DisplayInfoMessage
|
||||||
* displays an informational message box with \a aMessage.
|
* 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
|
* Function IsOK
|
||||||
|
|
Loading…
Reference in New Issue