2013-10-18 13:32:22 +00:00
|
|
|
/*
|
|
|
|
* 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
|
2021-07-27 12:22:27 +00:00
|
|
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-10-18 13:32:22 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <wx/stockitem.h>
|
2017-07-20 13:03:33 +00:00
|
|
|
#include <wx/richmsgdlg.h>
|
2020-10-18 11:31:07 +00:00
|
|
|
#include <wx/choicdlg.h>
|
2017-09-23 09:20:10 +00:00
|
|
|
#include <confirm.h>
|
2021-09-14 18:26:03 +00:00
|
|
|
#include <dialogs/html_message_box.h>
|
2017-11-06 08:35:05 +00:00
|
|
|
#include <functional>
|
2018-02-21 17:26:45 +00:00
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
// Set of dialogs that have been chosen not to be shown again
|
|
|
|
static std::unordered_map<unsigned long, int> doNotShowAgainDlgs;
|
|
|
|
|
|
|
|
|
2021-01-08 21:20:29 +00:00
|
|
|
KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption,
|
|
|
|
long aStyle )
|
2018-09-09 04:24:29 +00:00
|
|
|
: wxRichMessageDialog( aParent, aMessage, aCaption, aStyle | wxCENTRE | wxSTAY_ON_TOP ),
|
2021-01-08 21:20:29 +00:00
|
|
|
m_hash( 0 ),
|
|
|
|
m_cancelMeansCancel( true )
|
2018-02-21 17:26:45 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-08 21:20:29 +00:00
|
|
|
KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType,
|
|
|
|
const wxString& aCaption )
|
2019-02-16 13:09:21 +00:00
|
|
|
: wxRichMessageDialog( aParent, aMessage, getCaption( aType, aCaption ), getStyle( aType ) ),
|
2021-01-08 21:20:29 +00:00
|
|
|
m_hash( 0 ),
|
|
|
|
m_cancelMeansCancel( true )
|
2018-02-21 17:26:45 +00:00
|
|
|
{
|
2018-08-29 22:37:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIDIALOG::DoNotShowCheckbox( wxString aUniqueId, int line )
|
|
|
|
{
|
|
|
|
ShowCheckBox( _( "Do not show again" ), false );
|
|
|
|
|
|
|
|
m_hash = std::hash<wxString>{}( aUniqueId ) + line;
|
2018-02-21 17:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-02 15:52:45 +00:00
|
|
|
bool KIDIALOG::DoNotShowAgain() const
|
2018-02-21 17:26:45 +00:00
|
|
|
{
|
2018-03-02 15:52:45 +00:00
|
|
|
return doNotShowAgainDlgs.count( m_hash ) > 0;
|
2018-02-21 17:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-02 15:52:45 +00:00
|
|
|
void KIDIALOG::ForceShowAgain()
|
2018-02-21 17:26:45 +00:00
|
|
|
{
|
2018-03-02 15:52:45 +00:00
|
|
|
doNotShowAgainDlgs.erase( m_hash );
|
2018-02-21 17:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-02 15:52:45 +00:00
|
|
|
bool KIDIALOG::Show( bool aShow )
|
2018-02-21 17:26:45 +00:00
|
|
|
{
|
2018-07-25 09:45:20 +00:00
|
|
|
// We should check the do-not-show-again setting only when the dialog is displayed
|
|
|
|
if( aShow )
|
|
|
|
{
|
|
|
|
// Check if this dialog should be shown to the user
|
|
|
|
auto it = doNotShowAgainDlgs.find( m_hash );
|
2018-02-21 17:26:45 +00:00
|
|
|
|
2018-07-25 09:45:20 +00:00
|
|
|
if( it != doNotShowAgainDlgs.end() )
|
|
|
|
return it->second;
|
|
|
|
}
|
2018-02-21 17:26:45 +00:00
|
|
|
|
2020-01-15 18:29:15 +00:00
|
|
|
int ret = wxRichMessageDialog::Show( aShow );
|
2018-02-21 17:26:45 +00:00
|
|
|
|
2021-01-08 21:20:29 +00:00
|
|
|
// Has the user asked not to show the dialog again?
|
|
|
|
// Note that we don't save a Cancel value unless the Cancel button is being used for some
|
|
|
|
// other function (which is actually more common than it being used for Cancel).
|
|
|
|
if( IsCheckBoxChecked() && (!m_cancelMeansCancel || ret != wxID_CANCEL ) )
|
2018-03-02 15:52:45 +00:00
|
|
|
doNotShowAgainDlgs[m_hash] = ret;
|
2018-02-21 17:26:45 +00:00
|
|
|
|
2018-03-02 15:52:45 +00:00
|
|
|
return ret;
|
2018-02-21 17:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-02 10:57:03 +00:00
|
|
|
int KIDIALOG::ShowModal()
|
2018-02-21 17:26:45 +00:00
|
|
|
{
|
|
|
|
// Check if this dialog should be shown to the user
|
2018-03-02 15:52:45 +00:00
|
|
|
auto it = doNotShowAgainDlgs.find( m_hash );
|
2018-02-21 17:26:45 +00:00
|
|
|
|
|
|
|
if( it != doNotShowAgainDlgs.end() )
|
|
|
|
return it->second;
|
|
|
|
|
2018-03-02 15:52:45 +00:00
|
|
|
int ret = wxRichMessageDialog::ShowModal();
|
2018-02-21 17:26:45 +00:00
|
|
|
|
2021-01-08 21:20:29 +00:00
|
|
|
// Has the user asked not to show the dialog again?
|
|
|
|
// Note that we don't save a Cancel value unless the Cancel button is being used for some
|
|
|
|
// other function (which is actually more common than it being used for Cancel).
|
|
|
|
if( IsCheckBoxChecked() && (!m_cancelMeansCancel || ret != wxID_CANCEL ) )
|
2018-03-02 15:52:45 +00:00
|
|
|
doNotShowAgainDlgs[m_hash] = ret;
|
2018-02-21 17:26:45 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-02 15:52:45 +00:00
|
|
|
wxString KIDIALOG::getCaption( KD_TYPE aType, const wxString& aCaption )
|
2018-02-21 17:26:45 +00:00
|
|
|
{
|
2018-03-02 15:52:45 +00:00
|
|
|
if( !aCaption.IsEmpty() )
|
|
|
|
return aCaption;
|
|
|
|
|
|
|
|
switch( aType )
|
|
|
|
{
|
2019-08-20 17:22:30 +00:00
|
|
|
case KD_NONE: /* fall through */
|
|
|
|
case KD_INFO: return _( "Message" );
|
|
|
|
case KD_QUESTION: return _( "Question" );
|
|
|
|
case KD_WARNING: return _( "Warning" );
|
|
|
|
case KD_ERROR: return _( "Error" );
|
2018-03-02 15:52:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return wxEmptyString;
|
2018-02-21 17:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-02 15:52:45 +00:00
|
|
|
long KIDIALOG::getStyle( KD_TYPE aType )
|
2018-02-21 17:26:45 +00:00
|
|
|
{
|
2018-09-09 04:24:29 +00:00
|
|
|
long style = wxOK | wxCENTRE | wxSTAY_ON_TOP;
|
2018-03-02 15:52:45 +00:00
|
|
|
|
|
|
|
switch( aType )
|
|
|
|
{
|
2019-08-20 17:22:30 +00:00
|
|
|
case KD_NONE: break;
|
|
|
|
case KD_INFO: style |= wxICON_INFORMATION; break;
|
|
|
|
case KD_QUESTION: style |= wxICON_QUESTION; break;
|
|
|
|
case KD_WARNING: style |= wxICON_WARNING; break;
|
|
|
|
case KD_ERROR: style |= wxICON_ERROR; break;
|
2018-03-02 15:52:45 +00:00
|
|
|
}
|
2018-02-21 17:26:45 +00:00
|
|
|
|
2018-03-02 15:52:45 +00:00
|
|
|
return style;
|
2018-02-21 17:26:45 +00:00
|
|
|
}
|
2017-11-06 08:35:05 +00:00
|
|
|
|
2007-12-05 20:54:11 +00:00
|
|
|
|
2021-08-31 21:38:45 +00:00
|
|
|
bool OverrideLock( wxWindow* aParent, const wxString& aMessage )
|
2021-08-31 14:03:40 +00:00
|
|
|
{
|
2021-08-31 21:38:45 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
// wxMessageDialog gets the button spacing wrong on Mac so we have to use wxRichMessageDialog.
|
|
|
|
// Note that its warning icon is more like wxMessageDialog's error icon, so we use it instead
|
|
|
|
// of wxICON_ERROR.
|
|
|
|
wxRichMessageDialog dlg( aParent, aMessage, _( "File Open Error" ),
|
|
|
|
wxYES_NO | wxICON_WARNING | wxCENTER );
|
|
|
|
dlg.SetExtendedMessage( _( "Interleaved saves may produce very unexpected results." )
|
|
|
|
+ wxS( "\n" ) );
|
|
|
|
dlg.SetYesNoLabels( _( "OK" ), _( "Open Anyway" ) );
|
|
|
|
#else
|
2021-08-31 18:41:40 +00:00
|
|
|
wxMessageDialog dlg( aParent, aMessage, _( "File Open Error" ),
|
2021-08-31 21:38:45 +00:00
|
|
|
wxYES_NO | wxICON_ERROR | wxCENTER );
|
|
|
|
dlg.SetExtendedMessage( _( "Interleaved saves may produce very unexpected results." ) );
|
|
|
|
dlg.SetYesNoLabels( _( "OK" ), _( "Open Anyway" ) );
|
|
|
|
#endif
|
2021-08-31 14:03:40 +00:00
|
|
|
|
|
|
|
return dlg.ShowModal() == wxID_NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-27 12:22:27 +00:00
|
|
|
int UnsavedChangesDialog( wxWindow* parent, const wxString& aMessage, bool* aApplyToAll )
|
2012-03-08 17:47:23 +00:00
|
|
|
{
|
2019-06-17 15:59:39 +00:00
|
|
|
static bool s_apply_to_all = false;
|
|
|
|
|
2021-06-17 17:23:58 +00:00
|
|
|
wxRichMessageDialog dlg( parent, aMessage, _( "Save Changes?" ),
|
2019-06-15 16:05:33 +00:00
|
|
|
wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_WARNING | wxCENTER );
|
2021-08-31 21:38:45 +00:00
|
|
|
dlg.SetExtendedMessage( _( "If you don't save, all your changes will be permanently lost." )
|
|
|
|
+ wxS( "\n" ) );
|
2019-06-17 15:59:39 +00:00
|
|
|
dlg.SetYesNoLabels( _( "Save" ), _( "Discard Changes" ) );
|
2018-08-01 23:06:12 +00:00
|
|
|
|
2019-06-15 16:05:33 +00:00
|
|
|
if( aApplyToAll )
|
2019-06-17 15:59:39 +00:00
|
|
|
dlg.ShowCheckBox( _( "Apply to all" ), s_apply_to_all );
|
2018-08-01 23:06:12 +00:00
|
|
|
|
|
|
|
int ret = dlg.ShowModal();
|
|
|
|
|
|
|
|
if( aApplyToAll )
|
2019-06-17 15:59:39 +00:00
|
|
|
{
|
2019-06-15 16:05:33 +00:00
|
|
|
*aApplyToAll = dlg.IsCheckBoxChecked();
|
2019-06-17 15:59:39 +00:00
|
|
|
s_apply_to_all = dlg.IsCheckBoxChecked();
|
|
|
|
}
|
2018-08-01 23:06:12 +00:00
|
|
|
|
|
|
|
// Returns wxID_YES, wxID_NO, or wxID_CANCEL
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-15 16:05:33 +00:00
|
|
|
int UnsavedChangesDialog( wxWindow* parent, const wxString& aMessage )
|
2018-10-03 21:44:17 +00:00
|
|
|
{
|
2019-06-17 15:59:39 +00:00
|
|
|
#ifdef __APPLE__
|
2021-08-31 21:38:45 +00:00
|
|
|
// wxMessageDialog gets the button order (and spacing) wrong on Mac so we have to use
|
|
|
|
// wxRichMessageDialog.
|
2019-06-17 15:59:39 +00:00
|
|
|
return UnsavedChangesDialog( parent, aMessage, nullptr );
|
|
|
|
#else
|
2021-09-30 03:00:08 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
// wxMessageDialog on windows invokes TaskDialogIndirect which is a native function for a dialog
|
|
|
|
// As a result it skips wxWidgets for modal management...and we don't parent frames properly
|
|
|
|
// among other things for Windows to do the right thing by default
|
|
|
|
// Disable all the windows manually to avoid being able to hit this dialog from the tool frame and kicad frame at the same time
|
|
|
|
wxWindowDisabler disable( true );
|
|
|
|
#endif
|
|
|
|
|
2021-06-17 17:23:58 +00:00
|
|
|
wxMessageDialog dlg( parent, aMessage, _( "Save Changes?" ),
|
2019-06-15 16:05:33 +00:00
|
|
|
wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_WARNING | wxCENTER );
|
|
|
|
dlg.SetExtendedMessage( _( "If you don't save, all your changes will be permanently lost." ) );
|
2019-06-17 15:59:39 +00:00
|
|
|
dlg.SetYesNoLabels( _( "Save" ), _( "Discard Changes" ) );
|
2018-10-03 21:44:17 +00:00
|
|
|
|
2019-06-15 16:05:33 +00:00
|
|
|
// Returns wxID_YES, wxID_NO, or wxID_CANCEL
|
|
|
|
return dlg.ShowModal();
|
2019-06-17 15:59:39 +00:00
|
|
|
#endif
|
2019-06-15 16:05:33 +00:00
|
|
|
}
|
2018-10-03 21:44:17 +00:00
|
|
|
|
2019-06-15 16:05:33 +00:00
|
|
|
|
|
|
|
bool ConfirmRevertDialog( wxWindow* parent, const wxString& aMessage )
|
|
|
|
{
|
|
|
|
wxMessageDialog dlg( parent, aMessage, wxEmptyString,
|
|
|
|
wxOK | wxCANCEL | wxOK_DEFAULT | wxICON_WARNING | wxCENTER );
|
|
|
|
dlg.SetExtendedMessage( _( "Your current changes will be permanently lost." ) );
|
2019-06-17 15:59:39 +00:00
|
|
|
dlg.SetOKCancelLabels( _( "Revert" ), _( "Cancel" ) );
|
2019-06-15 16:05:33 +00:00
|
|
|
|
|
|
|
return dlg.ShowModal() == wxID_OK;
|
2018-10-03 21:44:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-11 20:46:03 +00:00
|
|
|
bool HandleUnsavedChanges( wxWindow* aParent, const wxString& aMessage,
|
|
|
|
const std::function<bool()>& aSaveFunction )
|
|
|
|
{
|
2019-06-15 16:05:33 +00:00
|
|
|
switch( UnsavedChangesDialog( aParent, aMessage ) )
|
2018-08-11 20:46:03 +00:00
|
|
|
{
|
|
|
|
case wxID_YES: return aSaveFunction();
|
|
|
|
case wxID_NO: return true;
|
|
|
|
default:
|
|
|
|
case wxID_CANCEL: return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-15 16:05:33 +00:00
|
|
|
int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxString& aMessage,
|
2021-07-27 12:22:27 +00:00
|
|
|
const wxString& aDetailedMessage, const wxString& aOKLabel,
|
|
|
|
const wxString& aCancelLabel, bool* aApplyToAll )
|
2018-08-01 23:06:12 +00:00
|
|
|
{
|
2020-02-14 19:07:27 +00:00
|
|
|
wxRichMessageDialog dlg( aParent, aMessage, aWarning,
|
2019-06-15 16:05:33 +00:00
|
|
|
wxOK | wxCANCEL | wxOK_DEFAULT | wxICON_WARNING | wxCENTER );
|
2020-12-11 22:44:10 +00:00
|
|
|
|
2021-07-27 12:22:27 +00:00
|
|
|
dlg.SetOKCancelLabels( ( aOKLabel.IsEmpty() ) ? _( "OK" ) : aOKLabel,
|
|
|
|
( aCancelLabel.IsEmpty() ) ? _( "Cancel" ) : aCancelLabel );
|
2012-03-08 17:47:23 +00:00
|
|
|
|
2020-02-14 19:07:27 +00:00
|
|
|
if( !aDetailedMessage.IsEmpty() )
|
2020-12-11 22:44:10 +00:00
|
|
|
dlg.SetExtendedMessage( aDetailedMessage );
|
2020-02-14 19:07:27 +00:00
|
|
|
|
2019-06-15 16:05:33 +00:00
|
|
|
if( aApplyToAll )
|
|
|
|
dlg.ShowCheckBox( _( "Apply to all" ), true );
|
2018-08-01 13:36:42 +00:00
|
|
|
|
2012-03-08 17:47:23 +00:00
|
|
|
int ret = dlg.ShowModal();
|
2016-05-06 15:15:30 +00:00
|
|
|
|
2018-08-01 13:36:42 +00:00
|
|
|
if( aApplyToAll )
|
2019-06-15 16:05:33 +00:00
|
|
|
*aApplyToAll = dlg.IsCheckBoxChecked();
|
2018-08-01 13:36:42 +00:00
|
|
|
|
2019-06-15 16:05:33 +00:00
|
|
|
// Returns wxID_OK or wxID_CANCEL
|
2012-03-08 17:47:23 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2011-11-08 16:37:25 +00:00
|
|
|
|
2013-10-18 13:32:22 +00:00
|
|
|
|
2017-07-20 14:06:41 +00:00
|
|
|
// DisplayError should be deprecated, use DisplayErrorMessage instead
|
2019-08-20 17:22:30 +00:00
|
|
|
void DisplayError( wxWindow* aParent, const wxString& aText, int aDisplayTime )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2019-08-20 17:22:30 +00:00
|
|
|
wxMessageDialog* dlg;
|
|
|
|
int icon = aDisplayTime > 0 ? wxICON_INFORMATION : wxICON_ERROR;
|
2017-07-20 13:03:33 +00:00
|
|
|
|
2019-08-20 17:22:30 +00:00
|
|
|
dlg = new wxMessageDialog( aParent, aText, _( "Warning" ),
|
|
|
|
wxOK | wxCENTRE | wxRESIZE_BORDER | icon | wxSTAY_ON_TOP );
|
2007-12-05 20:54:11 +00:00
|
|
|
|
2019-08-20 17:22:30 +00:00
|
|
|
dlg->ShowModal();
|
|
|
|
dlg->Destroy();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-05 20:54:11 +00:00
|
|
|
|
2017-09-23 09:20:10 +00:00
|
|
|
void DisplayErrorMessage( wxWindow* aParent, const wxString& aText, const wxString& aExtraInfo )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2019-12-14 17:29:38 +00:00
|
|
|
wxMessageDialog* dlg;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2019-12-14 17:29:38 +00:00
|
|
|
dlg = new wxMessageDialog( aParent, aText, _( "Error" ),
|
|
|
|
wxOK | wxCENTRE | wxRESIZE_BORDER | wxICON_ERROR | wxSTAY_ON_TOP );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2017-07-20 13:03:33 +00:00
|
|
|
if( !aExtraInfo.IsEmpty() )
|
2019-12-14 17:29:38 +00:00
|
|
|
dlg->SetExtendedMessage( aExtraInfo );
|
2017-07-20 13:03:33 +00:00
|
|
|
|
|
|
|
dlg->ShowModal();
|
|
|
|
dlg->Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-23 09:20:10 +00:00
|
|
|
void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxString& aExtraInfo )
|
2017-07-20 13:03:33 +00:00
|
|
|
{
|
2021-08-31 18:41:40 +00:00
|
|
|
wxMessageDialog* dlg;
|
|
|
|
int icon = wxICON_INFORMATION;
|
2017-07-20 13:03:33 +00:00
|
|
|
|
2021-08-31 18:41:40 +00:00
|
|
|
dlg = new wxMessageDialog( aParent, aMessage, _( "Information" ),
|
|
|
|
wxOK | wxCENTRE | wxRESIZE_BORDER | icon | wxSTAY_ON_TOP );
|
2017-07-20 13:03:33 +00:00
|
|
|
|
|
|
|
if( !aExtraInfo.IsEmpty() )
|
2021-08-31 18:41:40 +00:00
|
|
|
dlg->SetExtendedMessage( aExtraInfo );
|
2017-07-20 13:03:33 +00:00
|
|
|
|
|
|
|
dlg->ShowModal();
|
|
|
|
dlg->Destroy();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-18 13:32:22 +00:00
|
|
|
bool IsOK( wxWindow* aParent, const wxString& aMessage )
|
|
|
|
{
|
|
|
|
wxMessageDialog dlg( aParent, aMessage, _( "Confirmation" ),
|
2018-09-09 03:16:07 +00:00
|
|
|
wxYES_NO | wxCENTRE | wxICON_QUESTION | wxSTAY_ON_TOP );
|
2019-02-07 14:41:58 +00:00
|
|
|
dlg.SetEscapeId( wxID_NO );
|
2013-10-18 13:32:22 +00:00
|
|
|
|
2013-10-19 13:22:24 +00:00
|
|
|
return dlg.ShowModal() == wxID_YES;
|
2013-10-18 13:32:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-15 16:05:33 +00:00
|
|
|
int SelectSingleOption( wxWindow* aParent, const wxString& aTitle,
|
|
|
|
const wxString& aMessage, const wxArrayString& aOptions )
|
2017-11-06 08:35:05 +00:00
|
|
|
{
|
2018-03-02 16:30:10 +00:00
|
|
|
wxSingleChoiceDialog dlg( aParent, aMessage, aTitle, aOptions );
|
2017-11-06 08:35:05 +00:00
|
|
|
|
2018-03-02 16:30:10 +00:00
|
|
|
if( dlg.ShowModal() != wxID_OK )
|
|
|
|
return -1;
|
2017-11-06 08:35:05 +00:00
|
|
|
|
2018-03-02 16:30:10 +00:00
|
|
|
return dlg.GetSelection();
|
2017-11-06 08:35:05 +00:00
|
|
|
}
|
|
|
|
|