Commit e47a2bc5 authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

happy Easter

parent a985255f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -182,7 +182,9 @@ set( COMMON_SRCS
    html_messagebox.cpp
    kiface_i.cpp
    kiway.cpp
    kiway_express.cpp
    kiway_holder.cpp
    kiway_player.cpp
    msgpanel.cpp
    netlist_keywords.cpp
    newstroke_font.cpp
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ static const wxString GridColorEntryKeyword( wxT( "GridColor" ) );
static const wxString LastGridSizeIdKeyword( wxT( "_LastGridSize" ) );


BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME )
BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
    EVT_MOUSEWHEEL( EDA_DRAW_FRAME::OnMouseEvent )
    EVT_MENU_OPEN( EDA_DRAW_FRAME::OnMenuOpen )
    EVT_ACTIVATE( EDA_DRAW_FRAME::OnActivate )
+29 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include <macros.h>
#include <kiway.h>
#include <kiway_player.h>
#include <kiway_express.h>
#include <config.h>
#include <wx/debug.h>
#include <wx/stdpaths.h>
@@ -292,3 +293,31 @@ bool KIWAY::PlayersClose( bool doForce )

    return ret;
}


void KIWAY::ExpressMail( FRAME_T aDestination,
                int aCommand, const std::string& aPayload, wxWindow* aSource )
{
    KIWAY_EXPRESS   mail( aDestination, aCommand, aPayload, aSource );

    ProcessEvent( mail );
}


bool KIWAY::ProcessEvent( wxEvent& aEvent )
{
    KIWAY_EXPRESS* mail = dynamic_cast<KIWAY_EXPRESS*>( &aEvent );

    if( mail )
    {
        FRAME_T dest = mail->Dest();

        // see if recipient is alive
        KIWAY_PLAYER* alive = Player( dest, false );

        if( alive )
            return alive->ProcessEvent( aEvent );
    }

    return false;
}
+49 −0
Original line number Diff line number Diff line
/*
 * 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_express.h>

//IMPLEMENT_DYNAMIC_CLASS( KIWAY_EXPRESS, wxEvent )


const wxEventType KIWAY_EXPRESS::wxEVENT_ID = wxNewEventType();


KIWAY_EXPRESS::KIWAY_EXPRESS( const KIWAY_EXPRESS& anOther ) :
    wxEvent( anOther )
{
    m_destination = anOther.m_destination;
    m_payload     = anOther.m_payload;
}


KIWAY_EXPRESS::KIWAY_EXPRESS( FRAME_T aDestination, int aCommand,
        const std::string& aPayload, wxWindow* aSource ) :
    wxEvent( aCommand, wxEVENT_ID ),
    m_destination( aDestination ),
    m_payload( aPayload )
{
    SetEventObject( aSource );
}
+56 −0
Original line number Diff line number Diff line


#include <kiway_player.h>
#include <kiway_express.h>
#include <typeinfo>


BEGIN_EVENT_TABLE( KIWAY_PLAYER, EDA_BASE_FRAME )
    /* have not been able to get this to work yet:
    EVT_KIWAY_EXPRESS( KIWAY_PLAYER::kiway_express )
    Use Connect() in constructor until this can be sorted out
    */
END_EVENT_TABLE()



KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
        const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
        long aStyle, const wxString& aWdoName ) :
    EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aWdoName ),
    KIWAY_HOLDER( aKiway )
{
    DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
    Connect( KIWAY_EXPRESS::wxEVENT_ID, wxKiwayExressHandler( KIWAY_PLAYER::kiway_express ) );
}


KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& aTitle,
        const wxPoint& aPos, const wxSize& aSize, long aStyle,
        const wxString& aWdoName ) :
    EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName ),
    KIWAY_HOLDER( 0 )
{
    DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
    Connect( KIWAY_EXPRESS::wxEVENT_ID, wxKiwayExressHandler( KIWAY_PLAYER::kiway_express ) );
}


void KIWAY_PLAYER::kiway_express( KIWAY_EXPRESS& aEvent )
{
    // logging support
#if defined(DEBUG)
    const char* class_name = typeid(this).name();

    printf( "%s:  cmd:%d  pay:'%s'\n", class_name,
        aEvent.GetEventType(), aEvent.GetPayload().c_str() );
#endif

    KiwayMailIn( aEvent );     // call the virtual, overload in derived.
}


void KIWAY_PLAYER::KiwayMailIn( KIWAY_EXPRESS& aEvent )
{
    // overload this.
}
Loading