By Bryan Wu, on 六月 1st, 2009, Category: C++ Programming, CodeLite IDE, wxWidgets
Tags: CodeLite IDE, IPlugin, plugin, wxDynamicLibrary, wxWidgets, 动态链接库, 插件, 源代码
上回书说到IPlugin接口和众插件之间的关系,这里讲讲插件加载的过程。加载点在系统初始化时Framezhong 调用,上次也说过。这里主要是从PluginManager::Load() 说起。首先读取插件配置文件 config/plugins.xml,并将信息保存到std::map<wxString, PluginInfo> m_pluginsInfo中,这个成员m_pluginsInfo是属于PluginManager,这个map保存了插件名称和Pluginfo的映射关系。接着TagManagerST和LanguageST互相赋值。
现在进入重点循环,针对插件目录下的每个.dll/.so文件,会进行1)加载动态库;2)读插件信息;3)加载插件;4)调用插件相关创建toolbar和menu的函数。下面一一详述:
Continue reading CodeLite Plugin Internal(2)-Load: 插件加载分析 - 全文阅读
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) - 全文阅读
By Bryan Wu, on 五月 14th, 2009, Category: CodeLite IDE, wxWidgets
Tags: C++, code blocks, CodeLite IDE, cross platform, GPL, MinGW, plugin, wxWidgets, 开放源代码, 插件
Bryan @ CBForge:
本来打算整合cscope到code::blocks IDE中实现函数调用查找等功能,代码写了一半,发现CodeLite已经整合的很好了。:(
而且CodeLite IDE是一个轻量级的C、C++开发环境,其中很多功能非常适合开发一个开源版本的sourceinsight。
下面转载一篇介绍CodeLite的文章给大家。 Continue reading CodeLite IDE介绍 - 全文阅读
转载另一篇不错的代码分析文章,首先Bryan@cbforge(cbforge at gmail dot com)通过阅读CB源代码针对插件的实现有如下一些补充:
1)CB在系统初始化时,在InitFrame时调用MainFrame::ScanForPlugins来调用PluginManager的接口函数实现插件初始化;
2)除了本例中的binary plugin,CB还支持Script plugin,这是一个轻量级的插件功能,通过squirrel来支持;
3) compiler/debugger plugin实现了对其他编译器、调试器的统一接口;
Continue reading Code::Blocks中Plugin的实现原理 - 全文阅读
Author: Bryan Wu@CBForge (cbforge at gmail dot com)转载请保留
众所周知CB的一个优点就是开放式架构提供灵活的插件开发和支持,我们也相信在今后的发展上插件对CB的贡献会越来越大。
下面是现有核心插件和贡献插件的简介列表:
Core Plugins 核心插件(系统初始化时会自动加载,由CB官方开发团队维护)
The core plugins are installed by default and offer the basic functions of Code::Blocks. The core plugins are maintained / developed by the official development team.
Autosave
- Saves project files between intervals.
Class Wizard
- Provides wizard for creating new classes.
Code Completion[这个插件非常重要,现在处于重写阶段,估计很快会合大家见面]
- Provides code completion functionality and class browser.
Continue reading C::B IDE Plugin插件简介 - 全文阅读
|
|
|