当前位置: 首页>>代码示例>>C++>>正文


C++ KIWAY_PLAYER::Kiway方法代码示例

本文整理汇总了C++中KIWAY_PLAYER::Kiway方法的典型用法代码示例。如果您正苦于以下问题:C++ KIWAY_PLAYER::Kiway方法的具体用法?C++ KIWAY_PLAYER::Kiway怎么用?C++ KIWAY_PLAYER::Kiway使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KIWAY_PLAYER的用法示例。


在下文中一共展示了KIWAY_PLAYER::Kiway方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetActiveFootprintViewer

FOOTPRINT_VIEWER_FRAME* FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer( const KIWAY_PLAYER* aParent )
{
    wxASSERT( aParent );

    // We search only within the current project, and do so by limiting
    // the search scope to a wxWindow hierarchy subset.  Find the top most
    // KIWAY_PLAYER which is part of this PROJECT by matching its KIWAY* to the
    // most immediate parent's.

    // NOTE: an open FOOTPRINT_VIEWER_FRAME may have either the PCB_EDIT_FRAME
    // or the FOOTPRINT_EDIT_FRAME as parent.

    KIWAY*      kiway = &aParent->Kiway();
    wxWindow*   frame;

    while( (frame = aParent->GetParent()) != NULL )
    {
        // will go NULL when we reach a non-KIWAY_PLAYER
        KIWAY_PLAYER* kwp = dynamic_cast<KIWAY_PLAYER*>( frame );

        if( kwp && &kwp->Kiway() == kiway )
            aParent = kwp;
        else
            break;
    }

    return (FOOTPRINT_VIEWER_FRAME*) wxWindow::FindWindowByName(
        GetFootprintViewerFrameName(), aParent );
}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:29,代码来源:modview_frame.cpp

示例2: OnImportEagleFiles

void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
{
    // Close other windows.
    if( !Kiway().PlayersClose( false ) )
        return;


    wxString title = _( "Import Eagle Project Files" );
    int style = wxFD_OPEN | wxFD_FILE_MUST_EXIST;
    wxString default_dir = GetMruPath();

    ClearMsg();

    wxFileDialog schdlg( this, title, default_dir, wxEmptyString,
                         EagleFilesWildcard(), style );

    if( schdlg.ShowModal() == wxID_CANCEL )
        return;


    wxFileName sch( schdlg.GetPath() );

    sch.SetExt( SchematicFileExtension );

    wxFileName pro = sch;

    pro.SetExt( ProjectFileExtension );

    wxString protitle = _( "KiCad Project Destination" );

    // Don't use wxFileDialog here.  On GTK builds, the default path is returned unless a
    // file is actually selected.
    wxDirDialog prodlg( this, protitle, pro.GetPath(), wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );

    if( prodlg.ShowModal() == wxID_CANCEL )
        return;

    pro.SetPath( prodlg.GetPath() );

    // Check if the project directory is empty
    wxDir directory( pro.GetPath() );

    if( directory.HasFiles() )
    {
        wxString msg = _( "The selected directory is not empty.  We recommend you "
                          "create projects in their own clean directory.\n\nDo you "
                          "want to create a new empty directory for the project?" );

        KIDIALOG dlg( this, msg, _( "Confirmation" ), wxYES_NO | wxICON_WARNING );
        dlg.DoNotShowCheckbox( __FILE__, __LINE__ );

        if( dlg.ShowModal() == wxID_YES )
        {
            // Append a new directory with the same name of the project file
            // and try to create it
            pro.AppendDir( pro.GetName() );

            if( !wxMkdir( pro.GetPath() ) )
                // There was a problem, undo
                pro.RemoveLastDir();
        }
    }

    wxFileName pcb( sch );
    pro.SetExt( ProjectFileExtension );         // enforce extension
    pcb.SetExt( LegacyPcbFileExtension );       // enforce extension

    if( !pro.IsAbsolute() )
        pro.MakeAbsolute();

    SetProjectFileName( pro.GetFullPath() );
    wxString prj_filename = GetProjectFileName();

    if( sch.FileExists() )
    {
        KIWAY_PLAYER* schframe = Kiway().Player( FRAME_SCH, false );

        if( !schframe )
        {
            try     // SCH frame was not available, try to start it
            {
                schframe = Kiway().Player( FRAME_SCH, true );
            }
            catch( const IO_ERROR& err )
            {
                wxMessageBox( _( "Eeschema failed to load:\n" ) + err.What(),
                        _( "KiCad Error" ), wxOK | wxICON_ERROR, this );
                return;
            }
        }

        std::string packet = StrPrintf( "%d\n%s", SCH_IO_MGR::SCH_EAGLE,
                                                  TO_UTF8( sch.GetFullPath() ) );
        schframe->Kiway().ExpressMail( FRAME_SCH, MAIL_IMPORT_FILE, packet, this );

        if( !schframe->IsShown() )      // the frame exists, (created by the dialog field editor)
                                        // but no project loaded.
        {
            schframe->Show( true );
        }
//.........这里部分代码省略.........
开发者ID:johnbeard,项目名称:kicad,代码行数:101,代码来源:import_project.cpp


注:本文中的KIWAY_PLAYER::Kiway方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。