|
|
|
@ -1,3 +1,27 @@ |
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application. |
|
|
|
* |
|
|
|
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> |
|
|
|
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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 |
|
|
|
* 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 <kiway_player.h>
|
|
|
|
@ -5,6 +29,7 @@ |
|
|
|
#include <kiway.h>
|
|
|
|
#include <id.h>
|
|
|
|
#include <typeinfo>
|
|
|
|
#include <wx/utils.h>
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE( KIWAY_PLAYER, EDA_BASE_FRAME ) |
|
|
|
@ -46,51 +71,6 @@ void KIWAY_PLAYER::KiwayMailIn( KIWAY_EXPRESS& aEvent ) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void makeModal( wxFrame* aFrame, bool IsModal ) |
|
|
|
{ |
|
|
|
// disable or enable all other top level windows
|
|
|
|
#if wxCHECK_VERSION(2, 9, 4)
|
|
|
|
wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst(); |
|
|
|
|
|
|
|
while( node ) |
|
|
|
{ |
|
|
|
wxWindow* win = node->GetData(); |
|
|
|
|
|
|
|
if( win != aFrame ) |
|
|
|
win->Enable( !IsModal ); |
|
|
|
|
|
|
|
node = node->GetNext(); |
|
|
|
} |
|
|
|
#else
|
|
|
|
// Deprecated since wxWidgets 2.9.4
|
|
|
|
aFrame->MakeModal( IsModal ); |
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* toggle global wxFrame enable/disable state, does the re-enable part even |
|
|
|
* if an exception is thrown. |
|
|
|
*/ |
|
|
|
struct ENABLE_DISABLE |
|
|
|
{ |
|
|
|
wxFrame* m_frame; |
|
|
|
|
|
|
|
ENABLE_DISABLE( wxFrame* aFrame ) : |
|
|
|
m_frame( aFrame ) |
|
|
|
{ |
|
|
|
makeModal( aFrame, true ); |
|
|
|
} |
|
|
|
|
|
|
|
~ENABLE_DISABLE() |
|
|
|
{ |
|
|
|
// Re-enable all frames, (oops, even if they were previously inactive).
|
|
|
|
// This is probably why this function was deprecated in wx.
|
|
|
|
makeModal( m_frame, false ); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
bool KIWAY_PLAYER::ShowModal( wxString* aResult ) |
|
|
|
{ |
|
|
|
/*
|
|
|
|
@ -103,10 +83,10 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult ) |
|
|
|
vtable and therefore cross-module capable. |
|
|
|
*/ |
|
|
|
|
|
|
|
volatile bool dismissed = false; |
|
|
|
volatile bool dismissed = false; |
|
|
|
|
|
|
|
// disable all frames except the modal one, re-enable on exit, exception safe.
|
|
|
|
ENABLE_DISABLE toggle( this ); |
|
|
|
wxWindowDisabler toggle( this ); |
|
|
|
|
|
|
|
m_modal_dismissed = &dismissed; |
|
|
|
|
|
|
|
|