源码阅读SourceInsight
2017-08-11 18:04
507 查看
一、创建项目。
二、字体设置。
打开SourceInsight, 在菜单栏中点击Options-->Document Options
A、Screen fonts 设置字体为Times New Roman, 常规, 五号。
B、显示行号, 勾选右下角show line numbers。
三、注释相关宏定义
1、 Open project “base”, add the follow content to the file utiles.em
//add or remove "//" to each line; 定义快捷键为Ctrl+/:
macro MultiLineComment()
{
hwnd = GetCurrentWnd()
selection = GetWndSel(hwnd)
LnFirst = GetWndSelLnFirst(hwnd) //取首行行号
LnLast = GetWndSelLnLast(hwnd) //取末行行号
hbuf = GetCurrentBuf()
if(GetBufLine(hbuf, 0) == "//magic-number:tph85666031"){
stop
}
Ln = Lnfirst
buf = GetBufLine(hbuf, Ln)
len = strlen(buf)
while(Ln <= Lnlast) {
buf = GetBufLine(hbuf, Ln) //取Ln对应的行
if(buf == ""){ //跳过空行
Ln = Ln + 1
continue
}
if(StrMid(buf, 0, 1) == "/") { //需要取消注释,防止只有单字符的行
if(StrMid(buf, 1, 2) == "/"){
PutBufLine(hbuf, Ln, StrMid(buf, 2, Strlen(buf)))
}
}
if(StrMid(buf,0,1) != "/"){ //需要添加注释
PutBufLine(hbuf, Ln, Cat("//", buf))
}
Ln = Ln + 1
}
SetWndSel(hwnd, selection)
}
//add or remove "#if 0" to the begin and "#endif" to the end of content; 定义快捷键为Ctrl+#:
macro AddMacroComment()
{
hwnd=GetCurrentWnd()
sel=GetWndSel(hwnd)
lnFirst=GetWndSelLnFirst(hwnd)
lnLast=GetWndSelLnLast(hwnd)
hbuf=GetCurrentBuf()
if(LnFirst == 0) {
szIfStart = ""
}else{
szIfStart = GetBufLine(hbuf, LnFirst-1)
}
szIfEnd = GetBufLine(hbuf, lnLast+1)
if(szIfStart == "#if 0" && szIfEnd == "#endif") {
DelBufLine(hbuf, lnLast+1)
DelBufLine(hbuf, lnFirst-1)
sel.lnFirst = sel.lnFirst - 1
sel.lnLast = sel.lnLast - 1
}else{
InsBufLine(hbuf, lnFirst, "#if 0")
InsBufLine(hbuf, lnLast+2, "#endif")
sel.lnFirst = sel.lnFirst + 1
sel.lnLast = sel.lnLast + 1
}
SetWndSel( hwnd, sel )
}
// add or remove "/*" to the begin , "*/" to the end of the content;
定义快捷键为Ctrl+*:
macro CommentSelStr()
{
hwnd=GetCurrentWnd()
sel=GetWndSel(hwnd)
lnFirst=GetWndSelLnFirst(hwnd)
lnLast=GetWndSelLnLast(hwnd)
hbuf=GetCurrentBuf()
if(LnFirst == 0) {
szIfStart = ""
}else{
szIfStart = GetBufLine(hbuf, LnFirst-1)
}
szIfEnd = GetBufLine(hbuf, lnLast+1)
if(szIfStart == "/*" && szIfEnd == "*/") {
DelBufLine(hbuf, lnLast+1)
DelBufLine(hbuf, lnFirst-1)
sel.lnFirst = sel.lnFirst - 1
sel.lnLast = sel.lnLast - 1
}else{
InsBufLine(hbuf, lnFirst, "/*")
InsBufLine(hbuf, lnLast+2, "*/")
sel.lnFirst = sel.lnFirst + 1
sel.lnLast = sel.lnLast + 1
}
SetWndSel( hwnd, sel )
}
2、add fast key
Options-> key assignments->assign New Key…->OK
四、删除行快捷键。
五、搜索快捷键
Ctrl+f
F3、F4上下跳转
File…按钮可进入整个项目搜索,需要勾选project wide
六、快速跳转行
F5
七、代码排版
利用AStyle插件进行排版。
代码风格http://astyle.sourceforge.net/astyle.html#_default_bracket_style
AStyle工具下载,目前最新版为AStyle_2.06_windows.zip
下载网址http://astyle.sourceforge.net/
步骤
1、工具包解压后,找到AStyle.exe放到安装目录下
C:\Program Files\Source Insight 3
2、添加Option-》custom commands里面
命令名称AStyle
Run "C:\Program Files\Source Insight 3\AStyle.exe" --style=bsd %f
这里的--style=bsd可以换成--style=java
3、添加快捷键ctrl+shift+p
二、字体设置。
打开SourceInsight, 在菜单栏中点击Options-->Document Options
A、Screen fonts 设置字体为Times New Roman, 常规, 五号。
B、显示行号, 勾选右下角show line numbers。
三、注释相关宏定义
1、 Open project “base”, add the follow content to the file utiles.em
//add or remove "//" to each line; 定义快捷键为Ctrl+/:
macro MultiLineComment()
{
hwnd = GetCurrentWnd()
selection = GetWndSel(hwnd)
LnFirst = GetWndSelLnFirst(hwnd) //取首行行号
LnLast = GetWndSelLnLast(hwnd) //取末行行号
hbuf = GetCurrentBuf()
if(GetBufLine(hbuf, 0) == "//magic-number:tph85666031"){
stop
}
Ln = Lnfirst
buf = GetBufLine(hbuf, Ln)
len = strlen(buf)
while(Ln <= Lnlast) {
buf = GetBufLine(hbuf, Ln) //取Ln对应的行
if(buf == ""){ //跳过空行
Ln = Ln + 1
continue
}
if(StrMid(buf, 0, 1) == "/") { //需要取消注释,防止只有单字符的行
if(StrMid(buf, 1, 2) == "/"){
PutBufLine(hbuf, Ln, StrMid(buf, 2, Strlen(buf)))
}
}
if(StrMid(buf,0,1) != "/"){ //需要添加注释
PutBufLine(hbuf, Ln, Cat("//", buf))
}
Ln = Ln + 1
}
SetWndSel(hwnd, selection)
}
//add or remove "#if 0" to the begin and "#endif" to the end of content; 定义快捷键为Ctrl+#:
macro AddMacroComment()
{
hwnd=GetCurrentWnd()
sel=GetWndSel(hwnd)
lnFirst=GetWndSelLnFirst(hwnd)
lnLast=GetWndSelLnLast(hwnd)
hbuf=GetCurrentBuf()
if(LnFirst == 0) {
szIfStart = ""
}else{
szIfStart = GetBufLine(hbuf, LnFirst-1)
}
szIfEnd = GetBufLine(hbuf, lnLast+1)
if(szIfStart == "#if 0" && szIfEnd == "#endif") {
DelBufLine(hbuf, lnLast+1)
DelBufLine(hbuf, lnFirst-1)
sel.lnFirst = sel.lnFirst - 1
sel.lnLast = sel.lnLast - 1
}else{
InsBufLine(hbuf, lnFirst, "#if 0")
InsBufLine(hbuf, lnLast+2, "#endif")
sel.lnFirst = sel.lnFirst + 1
sel.lnLast = sel.lnLast + 1
}
SetWndSel( hwnd, sel )
}
// add or remove "/*" to the begin , "*/" to the end of the content;
定义快捷键为Ctrl+*:
macro CommentSelStr()
{
hwnd=GetCurrentWnd()
sel=GetWndSel(hwnd)
lnFirst=GetWndSelLnFirst(hwnd)
lnLast=GetWndSelLnLast(hwnd)
hbuf=GetCurrentBuf()
if(LnFirst == 0) {
szIfStart = ""
}else{
szIfStart = GetBufLine(hbuf, LnFirst-1)
}
szIfEnd = GetBufLine(hbuf, lnLast+1)
if(szIfStart == "/*" && szIfEnd == "*/") {
DelBufLine(hbuf, lnLast+1)
DelBufLine(hbuf, lnFirst-1)
sel.lnFirst = sel.lnFirst - 1
sel.lnLast = sel.lnLast - 1
}else{
InsBufLine(hbuf, lnFirst, "/*")
InsBufLine(hbuf, lnLast+2, "*/")
sel.lnFirst = sel.lnFirst + 1
sel.lnLast = sel.lnLast + 1
}
SetWndSel( hwnd, sel )
}
2、add fast key
Options-> key assignments->assign New Key…->OK
四、删除行快捷键。
五、搜索快捷键
Ctrl+f
F3、F4上下跳转
File…按钮可进入整个项目搜索,需要勾选project wide
六、快速跳转行
F5
七、代码排版
利用AStyle插件进行排版。
代码风格http://astyle.sourceforge.net/astyle.html#_default_bracket_style
AStyle工具下载,目前最新版为AStyle_2.06_windows.zip
下载网址http://astyle.sourceforge.net/
步骤
1、工具包解压后,找到AStyle.exe放到安装目录下
C:\Program Files\Source Insight 3
2、添加Option-》custom commands里面
命令名称AStyle
Run "C:\Program Files\Source Insight 3\AStyle.exe" --style=bsd %f
这里的--style=bsd可以换成--style=java
3、添加快捷键ctrl+shift+p
相关文章推荐
- Windows下阅读linux源码的强大软件Source Insight
- 阅读linux源码的强大软件Source Insight
- day05 UART实战、源码阅读工具(Sourceinsight/Ctags)、Makefile编写
- 看图配置Source Insight的Android源码阅读的环境
- Linux 源码阅读工具----------Source Insight 经典教程
- Linux 源码阅读工具----------Source Insight 经典教程
- 使用SftpDrive+SourceInsight阅读开源代码
- 【Java】【Fulme】Flume-NG源码阅读之SpoolDirectorySource
- Tools - 源代码阅读分析工具Source Insight
- Flume-NG源码阅读之SpoolDirectorySource
- sourceinsight 工程和源码不在同一个盘符下
- sourceinsight 查看源码的利器
- 源码解读之工具--Source Insight
- 使用SftpDrive+SourceInsight阅读开源代码
- 代码阅读工具:Source Navigator和Source Insight
- OBS源码阅读笔记--如何给source添加展示画面的地方呢?
- Flume-NG源码阅读之SpoolDirectorySource(原创)
- Source Insight源代码阅读工具
- 使用SftpDrive+SourceInsight阅读开源代码
- 用source insight阅读python代码