By Bryan Wu, on 六月 11th, 2009, Category: Code::Blocks, Open Source
Tags: CBForge Projects, code blocks, Programming, ProjectManager, wxWidgets, 代码分析, 字符串哈希
Code Blocks IDE的内部实现中,关于项目和文件之间的关系和数据保存主要维护在Project,ProjectManager和ProjectFile这几个类里面。在ProjectManager里面有几个部分: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 - 全文阅读
By Bryan Wu, on 五月 27th, 2009, Category: C++ Programming, CodeLite IDE, wxWidgets
Tags: CodeLite IDE, IPlugin, plugin, pure virtual method, 代码分析, 接口, 插件
所有的CodeLite插件都以动态库的形式(.dll or .so)保存在/plugins下,通过程序初始化时调用Frame::LoadPlugins加载[CodeLite的初始化分析在另外一篇文章中已有详述,请在ide.cbforge.com站内参阅]。插件相关的配置保存在/config/plugins.xml文件。文件为XML格式,每一插件项都保存有以下几项:SerializedObject Name,Plugin Name,Author,Description and Version。关于插件的实现我们会分几篇文章分析,这个第一篇主要关注IPlugin接口的实现。
IPlugin is the interface that defines a plugin for CodeLite. Each plugin must implement the pure virtual methods of this interface. The plugin gains access to CodeLite data by using the m_mgr member.
Continue reading CodeLite Plugin Internal(1) – IPlugin interface - 全文阅读
By Bryan Wu, on 五月 25th, 2009, Category: C++ Programming, CodeLite IDE, wxWidgets
Tags: accelerator, CodeLite IDE, GUI, plugin, Singleton Pattern, Splash Screen, wxApp, wxFrame, wxGTK, 代码分析, 插件
转载请注明出处,该文章来源于cbforge.com by Bryan Wu. CodeLite IDE的主应用程序类实现在文件 /liteeditor/app.cpp中,系统初始化时,从wxApp继承的App类会调用OnInit成员函数,bool App::OnInit()
- If it is Linux or MAC system, block signal pipe first;
- wxSocketBase::Initialize();
- 打开fatal exception handler,假如系统crash,会调用wxApp::OnFatalException,在此处可以采集一些调试信息;
- InitXmlResource:通过wxMemoryFSHandler加载资源文件到内存,包括很多PNG文件和xml文件;
- 调用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 }
};
- 设置各种目录,包括homeDir,installPath,CurDir,StartupDir等;
- Load Menu resource, rc/menu.xrc
- Initialize the configuration file locater,ConfFileLocator::Instance()->Initialize
- 初始化Manager类,该类从Singleton Pattern template而来;
- read the last frame size from the configuration file and initialise editor configuration files;
- 加入SingleInstance为真,我们需要通过调用wxSingleInstanceChecker来检查CodeLite运行实例是否唯一;
- Update PATH environment variable with the install directory and MinGW default installation (if exists)
- 显示splash screen,图片存储在 /images/splashscreen.png(可选,配置在GeneralInfo中)
- 重头戏来了,Frame::Initialize,初始化Frame中会包括很多内容,下面详述;
- update the accelerators table;
- 显示由第14步初始化的Frame并置为top window;
- 刚才第5步中解析的结果中如果有line,和input file,会依次打开并跳转至line-1行;
- 最后一步:通过wxLogMessage打印Install path和Startup Path信息,Over。
Continue reading CodeLite Initializaion analysis - 初始化流程分析(1) - 全文阅读
通过点击菜单Workspace->Create New Project,系统会 1)调用:Frame::OnProjectNewProject
2) 该函数中将创建对话框 NewProjectDlg,其中会读取 templates/projects目录下所有项目模板文件和编译器列表
3) 读取从第二步对话框中得到的数据并调用Manager::CreateProject ( ProjectData &data )创建项目。
所有的项目模板文件都是XML格式的,所以如果我们有新模板需求的话,可以定制自己的模板文件供用户使用。
Continue reading CodeLite代码分析之 – Create New Project流程 - 全文阅读
|
|
|