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

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

  1. If it is or MAC system, block signal pipe first;
  2. wxSocketBase::Initialize();
  3. 打开fatal exception handler,假如系统crash,会调用::OnFatalException,在此处可以采集一些调试信息;
  4. InitXmlResource:通过wxMemoryFSHandler加载资源文件到内存,包括很多PNG文件和xml文件;
  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) - 全文阅读

Debian Lenny编译wxWidgets与Code::Blocks SVN版

debian-linux

研究跨平台开发,选择了和Code::Blocks搭挡,那么编译和Code::Blocks最新的版本(不选择Code::Blocks 8.02的原因是现在的版本修复了8.02大量BUG,而且使用最新的版本,同时报告使用中出现的问题,本身也是对Code::Blocks开发的支持)就不可避免了。
在Ubuntu下编译,两都都很顺利,但当基于 Lenny系统来编译时,CB却出现了问题:

codeblocks: error while loading shared libraries: libcodeblocks.so.0: cannot open shared object file: No such file or directory

就是这个错误,导致CB根本无法启动。试着把相应文件拷贝到codeblocks主程序所在的/usr/local/bin目录中(还是Windows的思维),仍然出错。经查找资料,发现此时只要把libcodeblocks.so.0所在的目录加入环境变量中就可以了。

sudo /etc/ld.so.conf #编译该文件
/usr/local/lib #将该行加入到该文件的末尾
sudo ldconfig #重新配置

这样就可以正常启动Code::Blocks了。

Continue reading Debian Lenny编译wxWidgets与Code::Blocks SVN版 - 全文阅读

Contact us

Admin: Bryan Wu