ProjectManager, Project and ProjectFile in Code::Blocks

CB-Project-File Code Blocks IDE的内部实现中,关于项目和文件之间的关系和数据保存主要维护在Project,和ProjectFile这几个类里面。在里面有几个部分:1)View:包括m_pNotebook, m_pTree, m_plugin等;2)Status:包括m_isLoadingProject, m_isclosingProject, m_isCheckingForExternallyModifiedProject等,从字面意义上就可以看出它们的用途;3)Project:包括m_pActiveProject和指针*m_pProjects。这个当前活动的项目m_pActiveProject就是Project类的实例。

Continue reading ProjectManager, Project and ProjectFile in Code::Blocks - 全文阅读

CodeLite Plugin Internal(1) – IPlugin interface

icosahedronFeather 所有的CodeLite插件都以动态库的形式(.dll or .so)保存在/plugins下,通过程序初始化时调用Frame::LoadPlugins加载[CodeLite的初始化分析在另外一篇文章中已有详述,请在ide.cbforge.com站内参阅]。插件相关的配置保存在/config/plugins.xml文件。文件为XML格式,每一插件项都保存有以下几项:SerializedObject Name, Name,Author,Description and Version。关于插件的实现我们会分几篇文章分析,这个第一篇主要关注接口的实现。

is the interface that defines a for CodeLite. Each must implement the pure virtual methods of this interface. The gains access to CodeLite data by using the m_mgr member.

Continue reading CodeLite Plugin Internal(1) – IPlugin interface - 全文阅读

CodeLite Initializaion analysis - 初始化流程分析(1)

china-03_03 转载请注明出处,该文章来源于cbforge.com by Bryan Wu. 的主应用程序类实现在文件 /liteeditor/app.cpp中,系统初始化时,从继承的App类会调用OnInit成员函数,bool App::OnInit()

  1. If it is Linux or MAC system, block signal pipe first;
  2. wxSocketBase::Initialize();
  3. 打开fatal exception handler,假如系统crash,会调用::OnFatalException,在此处可以采集一些调试信息;
  4. InitXmlResource:通过wxMemoryFSHandler加载资源文件到内存,包括很多PNG文件和文件;
  5. 调用wxCmdLineParser解析命令行参数,命令行描述如下:

    假如是h,会打印帮助并推出,如果有b,重新设置basedir。static const wxCmdLineEntryDesc cmdLineDesc[] = {
        {wxCMD_LINE_SWITCH, “v“, “version”, “Print current version”, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
        {wxCMD_LINE_SWITCH, “h“, “help”, “Print usage”, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
        {wxCMD_LINE_OPTION, “l“, “line”, “Open the file at a given line number”, wxCMD_LINE_VAL_NUMBER, wxCMD_LINE_PARAM_OPTIONAL },
        {wxCMD_LINE_OPTION, “b“, “basedir”,  “The base directory of CodeLite”, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
        {wxCMD_LINE_PARAM,  NULL, NULL, “Input file”, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE|wxCMD_LINE_PARAM_OPTIONAL },
        {wxCMD_LINE_NONE }
    };

     

  6. 设置各种目录,包括homeDir,installPath,CurDir,StartupDir等;
  7. Load Menu resource, rc/menu.xrc
  8. Initialize the configuration file locater,ConfFileLocator::Instance()->Initialize
  9. 初始化Manager类,该类从 template而来;
  10. read the last frame size from the configuration file and initialise editor configuration files;
  11. 加入SingleInstance为真,我们需要通过调用wxSingleInstanceChecker来检查CodeLite运行实例是否唯一;
  12. Update PATH environment variable with the install directory and MinGW default installation (if exists)
  13. 显示,图片存储在 /images/splashscreen.png(可选,配置在GeneralInfo中)
  14. 重头戏来了,Frame::Initialize,初始化Frame中会包括很多内容,下面详述;
  15. update the accelerators table;
  16. 显示由第14步初始化的Frame并置为top window;
  17. 刚才第5步中解析的结果中如果有line,和input file,会依次打开并跳转至line-1行;
  18. 最后一步:通过wxLogMessage打印Install path和Startup Path信息,Over。

Continue reading CodeLite Initializaion analysis - 初始化流程分析(1) - 全文阅读

CodeLite代码分析之 – Create New Project流程

2590501425-tools3通过点击菜单Workspace->Create New Project,系统会 1)调用:Frame::OnProjectNewProject

2) 该函数中将创建对话框 NewProjectDlg,其中会读取 templates/projects目录下所有项目模板文件和编译器列表

3) 读取从第二步对话框中得到的数据并调用Manager::CreateProject ( ProjectData &data )创建项目。

所有的项目模板文件都是XML格式的,所以如果我们有新模板需求的话,可以定制自己的模板文件供用户使用。

Continue reading CodeLite代码分析之 – Create New Project流程 - 全文阅读

Contact us

Admin: Bryan Wu