source insight下载 的官方用户手册哪有翻译的中文版

SourceInsight_3.5.[中文汉化].[破解版].rar_百度知道
大小:2.7 MB
所需财富值:0
已经过百度安全检测,请放心下载4318人阅读
用了许久source Insight写C/C++代码,发现其中没有块注释功能很不方便,于是今天研究了下怎样让sourceInsight实现块注释。
网上介绍了很多方法实现块注释,但是都是对代码利用“//”逐行注释,没有用“/* */”实现的,我个人比较倾向于用/* */注释代码块,所以今天自己动手写了利用”/* */“实现块注释代码。
好了,废话不多说,直接上宏代码,后面会介绍使用方法:
macro _tsGetTabSize()
szTabSize = GetReg(&TabSize&);
if (szTabSize != &&)
tabSize = AsciiFromChar(szTabSize[0]) - AsciiFromChar(&0&);
tabSize = 4;
return tabS
macro CommentBlock_Joyce()
hbuf = GetCurrentBuf();
hwnd = GetCurrentWnd();
sel = GetWndSel(hwnd);
iLine = sel.lnF
// indicate the comment char according to the file type
// for example, using &#& for perl file(.pl) and &/* */& for C/C++.
filename = tolower(GetBufName(hbuf));
suffix = &&;
len = strlen(filename);
i = len - 1;
while (i &= 0)
if (filename[i-1] == &.&)
suffix = strmid(filename, i, len)
( suffix == &pl& )
filetype = 2; // PERL
filetype = 1; // C
szLine = GetBufLine(hbuf, iLine);
if (filetype == 1)
szLine = cat(&/* &, szLine);
szLine = cat(&# &, szLine);
PutBufLine(hbuf, iLine, szLine);
iLine = sel.lnL
szLine = GetBufLine(hbuf, iLine);
if (filetype == 1)
szLine = cat(szLine, &*/ &);
szLine = cat(&# &, szLine);
PutBufLine(hbuf, iLine, szLine);
if (sel.lnFirst == sel.lnLast)
tabSize = _tsGetTabSize() - 1;
sel.ichFirst = sel.ichFirst + tabS
sel.ichLim = sel.ichLim + tabS
SetWndSel(hwnd, sel);
// Undo the CommentBlock for the selected text.
macro UnCommentBlock_Joyce()
hbuf = GetCurrentBuf();
hwnd = GetCurrentWnd();
sel = GetWndSel(hwnd);
iLine = sel.lnF
// indicate the comment char according to the file type
// for example, using &#& for perl file(.pl) and &/* */& for C/C++.
filename = tolower(GetBufName(hbuf));
suffix = &&;
len = strlen(filename);
i = len - 1;
while (i &= 0)
if (filename[i-1] == &.&)
suffix = strmid(filename, i, len)
( suffix == &pl& )
filetype = 2; // PERL
filetype = 1; // C
tabSize = 0;
endLine = GetBufLine(hbuf, sel.lnLast);
endLineLen = strlen(endLine);
szLine = GetBufLine(hbuf, iLine);
len = strlen(szLine);
szNewLine = &&;
commentState = 1;
if (szLine[0] == &/& && szLine[1] == &*&)
if(endLine[endLineLen-2] == &/& && endLine[endLineLen-3] == &*&)
if (filetype == 1)
if (len & 1)
if (szLine[0] == &/& && szLine[1] == &*&)
if (len & 2)
if (AsciiFromChar(szLine[2]) == 9)
tabSize = _tsGetTabSize() - 1;
szNewLine = strmid(szLine, 3, strlen(szLine));
if (szNewLine == &&)
szNewLine = strmid(szLine, 2, strlen(szLine));
tabSize = 2;
PutBufLine(hbuf, iLine, szNewLine);
if (filetype == 2)
if (len & 0)
if (szLine[0] == &#&)
if (len & 1)
if (AsciiFromChar(szLine[1]) == 9)
tabSize = _tsGetTabSize() - 1;
szNewLine = strmid(szLine, 2, strlen(szLine));
if (szNewLine == &&)
szNewLine = strmid(szLine, 1, strlen(szLine));
tabSize = 2;
PutBufLine(hbuf, iLine, szNewLine);
iLine = sel.lnL
szLine = GetBufLine(hbuf, iLine);
len = strlen(szLine);
szNewLine = &&;
if (filetype == 1)
if (len & 1)
if (szLine[strlen(szLine)-2] == &/& && szLine[strlen(szLine)-3] == &*&)
if (len & 2)
if (AsciiFromChar(szLine[2]) == 9)
tabSize = _tsGetTabSize() - 1;
szNewLine = strmid(szLine, 0, strlen(szLine)-2);
if (szNewLine == &&)
szNewLine = strmid(szLine, 0, strlen(szLine)-3);
tabSize = 2;
PutBufLine(hbuf, iLine, szNewLine);
if (filetype == 2)
if (len & 0)
if (szLine[0] == &#&)
if (len & 1)
if (AsciiFromChar(szLine[1]) == 9)
tabSize = _tsGetTabSize() - 1;
szNewLine = strmid(szLine, 2, strlen(szLine));
if (szNewLine == &&)
szNewLine = strmid(szLine, 1, strlen(szLine));
tabSize = 2;
PutBufLine(hbuf, iLine, szNewLine);
if (sel.lnFirst == sel.lnLast)
sel.ichFirst = sel.ichFirst - tabS
sel.ichLim = sel.ichLim - tabS
SetWndSel(hwnd, sel);
下面介绍下使用方法:
1)&&&&&&首先,打开sourceInsight 的&项目-&打开项目-&base”中的Utils.em文件,将以上宏代码复制到文件末尾,然后保存。
2)&&&&&& 启用宏。& 菜单 “Options” -& “Key assignment”(中文版是选项-&菜单关联)。& 在列表框中找到下面的宏:CommentBlock_Joyce、UnCommentBlock_Joyce
3)&给这些宏分配按键。点击“键..”,选中你需要分配按键的宏,点击“分配新键..”,然后在键盘上选择你喜欢的按键吧~设置好之后,点击“好”。
好了,设置完毕,试试吧~
下面把网上有大神写的单行注释和利用“//”进行多行注释的代码一起贴上来,方便大家使用,设置方法和前面的一样。
macro SingleLineComment()
szMyName = &Joyce&
// Get a handle to the current file buffer and the name
// and location of the current symbol where the cursor is.
hbuf = GetCurrentBuf()
ln = GetBufLnCur(hbuf)
// Get current time
szTime = GetSysTime(1)
Hour = szTime.Hour
Minute = szTime.Minute
Second = szTime.Second
Day = szTime.Day
Month = szTime.Month
Year = szTime.Year
if (Day & 10)
szDay = &0@Day@&
szDay = Day
//szMonth = NumToName(Month)
if (Month & 10)
szMonth = &0@Month@&
szMonth = Month
szDescription = Ask(&请输入修改原因&)
// begin assembling the title string
InsBufLine(hbuf, ln+1, &/*@szDescription@ @szMyName@.xmyanfa @Year@-@szMonth@-@szDay@*/&)
macro MultiLineCommentHeader()
szMyName = &Joyce&
// Get a handle to the current file buffer and the name
// and location of the current symbol where the cursor is.
hbuf = GetCurrentBuf()
ln = GetBufLnCur(hbuf)
// Get current time
szTime = GetSysTime(1)
Hour = szTime.Hour
Minute = szTime.Minute
Second = szTime.Second
Day = szTime.Day
Month = szTime.Month
Year = szTime.Year
if (Day & 10)
szDay = &0@Day@&
szDay = Day
//szMonth = NumToName(Month)
if (Month & 10)
szMonth = &0@Month@&
szMonth = Month
szDescription = Ask(&请输入修改原因:&)
// begin assembling the title string
InsBufLine(hbuf, ln + 1, &/*@szDescription@ @szMyName@.xmyanfa @Year@-@szMonth@-@szDay@ begin*/&)
macro MultiLineCommentEnd()
szMyName = &Joyce&
// Get a handle to the current file buffer and the name
// and location of the current symbol where the cursor is.
hbuf = GetCurrentBuf()
ln = GetBufLnCur(hbuf)
// Get current time
szTime = GetSysTime(1)
Hour = szTime.Hour
Minute = szTime.Minute
Second = szTime.Second
Day = szTime.Day
Month = szTime.Month
Year = szTime.Year
if (Day & 10)
szDay = &0@Day@&
szDay = Day
//szMonth = NumToName(Month)
if (Month & 10)
szMonth = &0@Month@&
szMonth = Month
InsBufLine(hbuf, ln + 1, &/*@szMyName@.xmyanfa @Year@-@szMonth@-@szDay@ end*/&)
// Comment the selected block of text using single line comments and indent it
macro CommentBlock()
hbuf = GetCurrentBuf();
hwnd = GetCurrentWnd();
sel = GetWndSel(hwnd);
iLine = sel.lnF
// added by Yongqiang, indicate the comment char according to the file type
// for example, using &#& for perl file(.pl) and &//& for others.
filename = tolower(GetBufName(hbuf));
suffix = &&;
len = strlen(filename);
i = len - 1;
while (i &= 0)
if (filename[i-1] == &.&)
suffix = strmid(filename, i, len)
( suffix == &pl& )
filetype = 2; // PERL
filetype = 1; // C
while (iLine &= sel.lnLast)
szLine = GetBufLine(hbuf, iLine);
if (filetype == 1)
szLine = cat(&// &, szLine);
szLine = cat(&# &, szLine);
PutBufLine(hbuf, iLine, szLine);
iLine = iLine + 1;
if (sel.lnFirst == sel.lnLast)
tabSize = _tsGetTabSize() - 1;
sel.ichFirst = sel.ichFirst + tabS
sel.ichLim = sel.ichLim + tabS
SetWndSel(hwnd, sel);
// Undo the CommentBlock for the selected text.
macro UnCommentBlock()
hbuf = GetCurrentBuf();
hwnd = GetCurrentWnd();
sel = GetWndSel(hwnd);
iLine = sel.lnF
// added by Yongqiang, indicate the comment char according to the file type
// for example, using &#& for perl file(.pl) and &//& for others.
filename = tolower(GetBufName(hbuf));
suffix = &&;
len = strlen(filename);
i = len - 1;
while (i &= 0)
if (filename[i-1] == &.&)
suffix = strmid(filename, i, len)
( suffix == &pl& )
filetype = 2; // PERL
filetype = 1; // C
tabSize = 0;
while (iLine &= sel.lnLast)
szLine = GetBufLine(hbuf, iLine);
len = strlen(szLine);
szNewLine = &&;
if (filetype == 1)
if (len & 1)
if (szLine[0] == &/& && szLine[1] == &/&)
if (len & 2)
if (AsciiFromChar(szLine[2]) == 9)
tabSize = _tsGetTabSize() - 1;
szNewLine = strmid(szLine, 3, strlen(szLine));
if (szNewLine == &&)
szNewLine = strmid(szLine, 2, strlen(szLine));
tabSize = 2;
PutBufLine(hbuf, iLine, szNewLine);
if (filetype == 2)
if (len & 0)
if (szLine[0] == &#&)
if (len & 1)
if (AsciiFromChar(szLine[1]) == 9)
tabSize = _tsGetTabSize() - 1;
szNewLine = strmid(szLine, 2, strlen(szLine));
if (szNewLine == &&)
szNewLine = strmid(szLine, 1, strlen(szLine));
tabSize = 2;
PutBufLine(hbuf, iLine, szNewLine);
iLine = iLine + 1;
if (sel.lnFirst == sel.lnLast)
sel.ichFirst = sel.ichFirst - tabS
sel.ichLim = sel.ichLim - tabS
SetWndSel(hwnd, sel);
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场}

我要回帖

更多关于 source insight 教程 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信