本文介绍: KICAD_MANAGER_CONTROL::NewProject中的具体实现调用了KICAD_MANAGER_FRAME的CreateNewProject和LoadProject

创建工程

创建工程打开工程触发事件

KICAD_MANAGER_ACTIONS::newProject
KICAD_MANAGER_ACTIONS::openProject

newProject和OpenProject事件响应具体实现,在KICAD_MANAGER_CONTROL类中实现:

 Go( &KICAD_MANAGER_CONTROL::NewProject,         KICAD_MANAGER_ACTIONS::newProject.MakeEvent() );

KICAD_MANAGER_CONTROL::NewProject中的具体实现中调用了KICAD_MANAGER_FRAME的CreateNewProject和LoadProject。

KICAD_MANAGER_FRAME* m_frame;
 m_frame->CreateNewProject( pro );
    m_frame->LoadProject( pro );

ProjectTree页面创建

创建ProjectTree在kiaca/kicad_manager_frame.cpp中是实现,

m_leftWin = new PROJECT_TREE_PANE( this );

btdabs/PROJECT_TREE_PANEZ

void PROJECT_TREE_PANE::ReCreateTreePrj()

project treee右键事件

void PROJECT_TREE_PANE::onRight( wxTreeEvent& Event )

创建sch工程文件

void BTDABS_MANAGER_FRAME::CreateSchFile(const wxFileName& aProjectFileName)
{
    wxFileName fn( aProjectFileName.GetFullPath() );
    fn.SetExt( BTDSchematicFileExtension );

    // If a <project>.btd_sch file does not exist, create a "stub" file ( minimal schematic
    // file ).
    if( !fn.FileExists() )
    {
        wxFFile file( fn.GetFullPath(), "wb" );

        if( file.IsOpened() )
            file.Write( wxString::Format( "(btd_sch (version %d) (generator eeschema)n"
                                            "  (paper "A4")n  (lib_symbols)n"
                                            "  (symbol_instances)n)n",
                                            SEXPR_SCHEMATIC_FILE_VERSION ) );

        // wxFFile dtor will close the file
    }
}

int KICAD_MANAGER_CONTROL::CreateSch( const TOOL_EVENT&amp; aEvent )
{
    auto fileName = Prj().GetProjectFullName();
    if(false == fileName.IsEmpty())
    {
        m_frame->CreateSchFile(fileName);
    }

    return 0;
}

FlowManager

/kicad/FLOW_MANAGER_MODEL类:

void FLOW_MANAGER_MODEL::RebuildFlow()
{
CreateFlowNode( wxID_ANY, _("Create"), "", false, parentNode, &amp;KICAD_MANAGER_ACTIONS::createSch );
KICAD_MANAGER_ACTIONS::createSch 

createSch事件响应函数

 Go( &amp;KICAD_MANAGER_CONTROL::CreateSch, KICAD_MANAGER_ACTIONS::createSch.MakeEvent() );

指定路径创建文件夹

   wxString absWorkDir;
   wxFileName dirName( absWorkDir + wxFileName::GetPathSeparator());
    if( !dirName.DirExists() )
    {
        if( !dirName.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL | wxPATH_RMDIR_RECURSIVE ) )
        {
            wxLogMessage( "Failed to create directory: %s", absWorkDir );
            return "";
        }
    }

原文地址:https://blog.csdn.net/haimianjie2012/article/details/134782819

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_43338.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注