예제 #1
0
KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, KIWAY_PLAYER* aParent )
{
    // Since this will be called from python, cannot assume that code will
    // not pass a bad aFrameType.
    if( unsigned( aFrameType ) >= KIWAY_PLAYER_COUNT )
    {
        // @todo : throw an exception here for python's benefit, at least that
        // way it gets some explanatory text.

        wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFrameType" ) );
        return NULL;
    }

    // return the previously opened window
    KIWAY_PLAYER* frame = GetPlayerFrame( aFrameType );

    if( frame )
        return frame;

    if( doCreate )
    {
        FACE_T face_type = KifaceType( aFrameType );
        wxASSERT( face_type != FACE_T(-1) );

        KIFACE* kiface = KiFACE( face_type );
        wxASSERT( kiface );

        if( kiface )
        {
            frame = (KIWAY_PLAYER*) kiface->CreateWindow(
                    aParent,    // Parent window of frame, NULL in non modal mode
                    aFrameType,
                    this,
                    m_ctl       // questionable need, these same flags where passed to the KIFACE::OnKifaceStart()
                    );
            wxASSERT( frame );

            m_playerFrameName[aFrameType] = frame->GetName();

            return frame;
        }
    }

    return NULL;
}
FOOTPRINT_PREVIEW_PANEL_BASE* FOOTPRINT_PREVIEW_PANEL_BASE::Create(
        wxWindow* aParent, KIWAY& aKiway )
{
    FOOTPRINT_PREVIEW_PANEL_BASE* panel = nullptr;

    try {
        KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB );

        auto window = kiface->CreateWindow( aParent, FRAME_PCB_FOOTPRINT_PREVIEW, &aKiway );

        panel = dynamic_cast<FOOTPRINT_PREVIEW_PANEL_BASE*>( window );

        if( window && !panel )
            delete window;
    } catch( ... )
    {}

    return panel;
}
예제 #3
0
void KICAD_MANAGER_FRAME::OnEditFpLibTable( wxCommandEvent& aEvent )
{
    KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_PCB );
    kiface->CreateWindow( this, DIALOG_PCB_LIBRARY_TABLE, &Kiway() );
}