tag 标签: insight

相关博文
  • 热度 19
    2014-5-3 14:13
    1953 次阅读|
    0 个评论
    在默认情况下,往Source Insight里输入中文,字间距相当的大,下面将帮助你解决这个问题。具体设置如下: 1.Options-Style Properties 2. 在左边Style Name下找到Comment Multi Line和Comment.在其右边对应的Font属性框下的Font Name中选“Pick...” 设置为宋体、常规、小四。确定,退回Style Properties界面,Size设为10。最后设置Clolors框下Foreground,点“Pick...”选择一种自己喜欢的颜色就OK了。 3.完成 Source Insight3 中文操作(左右键、删除和后退键)支持宏: 解决方法: 1.打开 Project→Open Project,打开Base项目; 2.复制下面的宏代码段复制粘贴到utils.em文件中,使其添加入Base项目; 3.重启SourceInsight; 4.Options→Key Assignments,将Marco: SuperBackspace绑定到BackSpace键; 5.同样的操作Del键和左右键,分别绑定相应的键位。 1、后退键 * * 代替SourceInsight原有的Backspace功能(希望如此) * 增加了对双字节汉字的支持,在删除汉字的时候也能同时删除汉字的高字节而缓解半个汉字问题 * 能够对光标在汉字中间的情况进行自动修正 * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ macro SuperBackspace() {     hwnd = GetCurrentWnd();     hbuf = GetCurrentBuf();     if (hbuf == 0)         stop;   // empty buffer     // get current cursor postion     ipos = GetWndSelIchFirst(hwnd);     // get current line number     ln = GetBufLnCur(hbuf);     if ((GetBufSelText(hbuf) != "") || (GetWndSelLnFirst(hwnd) != GetWndSelLnLast(hwnd))) {         // sth. was selected, del selection         SetBufSelText(hbuf, " "); // stupid buggy sourceinsight :(         // del the " "         SuperBackspace(1);         stop;     }     // copy current line     text = GetBufLine(hbuf, ln);     // get string length     len = strlen(text);     // if the cursor is at the start of line, combine with prev line     if (ipos == 0 || len == 0) {         if (ln = 0)             stop;   // top of file         ln = ln - 1;    // do not use "ln--" for compatibility with older versions         prevline = GetBufLine(hbuf, ln);         prevlen = strlen(prevline);         // combine two lines         text = cat(prevline, text);         // del two lines         DelBufLine(hbuf, ln);         DelBufLine(hbuf, ln);         // insert the combined one         InsBufLine(hbuf, ln, text);         // set the cursor position         SetBufIns(hbuf, ln, prevlen);         stop;     }     num = 1; // del one char     if (ipos = 1) {         // process Chinese character         i = ipos;         count = 0;         while (AsciiFromChar(text ) = 160) {             i = i - 1;             count = count + 1;             if (i == 0)                 break;         }         if (count 0) {             // I think it might be a two-byte character             num = 2;             // This idiot does not support mod and bitwise operators             if ((count / 2 * 2 != count) (ipos len))                 ipos = ipos + 1;    // adjust cursor position         }     }     // keeping safe     if (ipos - num 0)         num = ipos;     // del char(s)     text = cat(strmid(text, 0, ipos - num), strmid(text, ipos, len));     DelBufLine(hbuf, ln);     InsBufLine(hbuf, ln, text);     SetBufIns(hbuf, ln, ipos - num);     stop; } 参考上面以及SourceInsight中的chm帮助文档; 有缺点:(1)移动箭头也会记录到历史操作步骤,应该能够避免这些操作被记录;(2)函数没有整理,有冗余; 2、删除键——SuperDelete.em macro SuperDelete() {     hwnd = GetCurrentWnd();     hbuf = GetCurrentBuf();     if (hbuf == 0)         stop;   // empty buffer     // get current cursor postion     ipos = GetWndSelIchFirst(hwnd);     // get current line number     ln = GetBufLnCur(hbuf);     if ((GetBufSelText(hbuf) != "") || (GetWndSelLnFirst(hwnd) != GetWndSelLnLast(hwnd))) {         // sth. was selected, del selection         SetBufSelText(hbuf, " "); // stupid buggy sourceinsight :(         // del the " "         SuperDelete(1);         stop;     }     // copy current line     text = GetBufLine(hbuf, ln);     // get string length     len = strlen(text);     if (ipos == len || len == 0) { totalLn = GetBufLineCount (hbuf); lastText = GetBufLine(hBuf, totalLn-1); lastLen = strlen(lastText);         if (ipos == lastLen)// end of file    stop;         ln = ln + 1;    // do not use "ln--" for compatibility with older versions         nextline = GetBufLine(hbuf, ln);         nextlen = strlen(nextline);         // combine two lines         text = cat(text, nextline);         // del two lines         DelBufLine(hbuf, ln-1);         DelBufLine(hbuf, ln-1);         // insert the combined one         InsBufLine(hbuf, ln-1, text);         // set the cursor position         SetBufIns(hbuf, ln-1, len);         stop;     }     num = 1; // del one char     if (ipos 0) {         // process Chinese character         i = ipos;         count = 0;         while (AsciiFromChar(text ) = 160) {             i = i - 1;             count = count + 1;             if (i == 0)                 break;         }         if (count 0) {             // I think it might be a two-byte character             num = 2;             // This idiot does not support mod and bitwise operators             if (((count / 2 * 2 != count) || count == 0) (ipos len-1))                 ipos = ipos + 1;    // adjust cursor position         } // keeping safe if (ipos - num 0)             num = ipos;     }     else { i = ipos; count = 0; while(AsciiFromChar(text ) = 160) {      i = i + 1;      count = count + 1;      if(i == len-1)    break; } if(count 0) {      num = 2; }     }     text = cat(strmid(text, 0, ipos), strmid(text, ipos+num, len));     DelBufLine(hbuf, ln);     InsBufLine(hbuf, ln, text);     SetBufIns(hbuf, ln, ipos);     stop; } 3、左移键——SuperCursorLeft.em macro IsComplexCharacter() { hwnd = GetCurrentWnd(); hbuf = GetCurrentBuf(); if (hbuf == 0)    return 0; //当前位置 pos = GetWndSelIchFirst(hwnd); //当前行数 ln = GetBufLnCur(hbuf); //得到当前行 text = GetBufLine(hbuf, ln); //得到当前行长度 len = strlen(text); //从头计算汉字字符的个数 if(pos 0) {    i=pos;    count=0;    while(AsciiFromChar(text ) = 160)    {      i = i - 1;     count = count+1;     if(i == 0)       break;    }    if((count/2)*2==count|| count==0)     return 0;    else     return 1; } return 0; } macro moveleft() { hwnd = GetCurrentWnd(); hbuf = GetCurrentBuf(); if (hbuf == 0)         stop;   // empty buffer ln = GetBufLnCur(hbuf); ipos = GetWndSelIchFirst(hwnd); if(GetBufSelText(hbuf) != "" || (ipos == 0 ln == 0))   // 第0行或者是选中文字,则不移动 {    SetBufIns(hbuf, ln, ipos);    stop; } if(ipos == 0) {    preLine = GetBufLine(hbuf, ln-1);    SetBufIns(hBuf, ln-1, strlen(preLine)-1); } else {    SetBufIns(hBuf, ln, ipos-1); } } macro SuperCursorLeft() { moveleft(); if(IsComplexCharacter())    moveleft(); } 4、右移键——SuperCursorRight.em macro moveRight() { hwnd = GetCurrentWnd(); hbuf = GetCurrentBuf(); if (hbuf == 0)         stop;   // empty buffer ln = GetBufLnCur(hbuf); ipos = GetWndSelIchFirst(hwnd); totalLn = GetBufLineCount(hbuf); text = GetBufLine(hbuf, ln);  if(GetBufSelText(hbuf) != "")   //选中文字 {    ipos = GetWndSelIchLim(hwnd);    ln = GetWndSelLnLast(hwnd);    SetBufIns(hbuf, ln, ipos);    stop; } if(ipos == strlen(text)-1 ln == totalLn-1) // 末行    stop;      if(ipos == strlen(text)) {    SetBufIns(hBuf, ln+1, 0); } else {    SetBufIns(hBuf, ln, ipos+1); } } macro SuperCursorRight() { moveRight(); if(IsComplexCharacter()) // defined in SuperCursorLeft.em    moveRight(); } 5、shift+右移键——ShiftCursorRight.em macro IsShiftRightComplexCharacter() { hwnd = GetCurrentWnd(); hbuf = GetCurrentBuf(); if (hbuf == 0)    return 0; selRec = GetWndSel(hwnd); pos = selRec.ichLim; ln = selRec.lnLast; text = GetBufLine(hbuf, ln); len = strlen(text); if(len == 0 || len pos)    return 1; //Msg("@len@;@pos@;"); if(pos 0) {    i=pos;    count=0;     while(AsciiFromChar(text ) = 160)    {      i = i - 1;     count = count+1;       if(i == 0)       break;       }    if((count/2)*2==count|| count==0)     return 0;    else     return 1; } return 0; } macro shiftMoveRight() { hwnd = GetCurrentWnd(); hbuf = GetCurrentBuf(); if (hbuf == 0)         stop;   ln = GetBufLnCur(hbuf); ipos = GetWndSelIchFirst(hwnd); totalLn = GetBufLineCount(hbuf); text = GetBufLine(hbuf, ln);  selRec = GetWndSel(hwnd);   curLen = GetBufLineLength(hbuf, selRec.lnLast); if(selRec.ichLim == curLen+1 || curLen == 0) {     if(selRec.lnLast == totalLn -1)     stop;    selRec.lnLast = selRec.lnLast + 1;     selRec.ichLim = 1;    SetWndSel(hwnd, selRec);    if(IsShiftRightComplexCharacter())     shiftMoveRight();    stop; } selRec.ichLim = selRec.ichLim+1; SetWndSel(hwnd, selRec); } macro SuperShiftCursorRight() {        if(IsComplexCharacter())    SuperCursorRight(); shiftMoveRight(); if(IsShiftRightComplexCharacter())    shiftMoveRight(); } 6、shift+左移键——ShiftCursorLeft.em macro IsShiftLeftComplexCharacter() { hwnd = GetCurrentWnd(); hbuf = GetCurrentBuf(); if (hbuf == 0)    return 0; selRec = GetWndSel(hwnd); pos = selRec.ichFirst; ln = selRec.lnFirst; text = GetBufLine(hbuf, ln); len = strlen(text); if(len == 0 || len pos)    return 1; //Msg("@len@;@pos@;"); if(pos 0) {    i=pos;    count=0;     while(AsciiFromChar(text ) = 160)    {      i = i - 1;     count = count+1;       if(i == 0)       break;       }    if((count/2)*2==count|| count==0)     return 0;    else     return 1; } return 0; } macro shiftMoveLeft() { hwnd = GetCurrentWnd(); hbuf = GetCurrentBuf(); if (hbuf == 0)         stop;   ln = GetBufLnCur(hbuf); ipos = GetWndSelIchFirst(hwnd); totalLn = GetBufLineCount(hbuf); text = GetBufLine(hbuf, ln);  selRec = GetWndSel(hwnd);   //curLen = GetBufLineLength(hbuf, selRec.lnFirst); //Msg("@curLen@;@selRec@"); if(selRec.ichFirst == 0) {     if(selRec.lnFirst == 0)     stop;    selRec.lnFirst = selRec.lnFirst - 1;    selRec.ichFirst = GetBufLineLength(hbuf, selRec.lnFirst)-1;    SetWndSel(hwnd, selRec);    if(IsShiftLeftComplexCharacter())     shiftMoveLeft();    stop; } selRec.ichFirst = selRec.ichFirst-1; SetWndSel(hwnd, selRec); } macro SuperShiftCursorLeft() { if(IsComplexCharacter())    SuperCursorLeft(); shiftMoveLeft(); if(IsShiftLeftComplexCharacter())    shiftMoveLeft(); }
  • 热度 22
    2013-9-19 16:28
    1795 次阅读|
    0 个评论
      SourceInsight,从软件的英文名字上来解读就是“深入到源代码”,该软件只具有代码的阅读、编辑和简单的语法检查功能,而不具有编译等功能。尤其是在阅读大规模工程代码的时候,SourceInsight在代码导航、高亮注释,颜色区分,代码关联等,在编辑功能上稍稍有所欠缺,尤其是需要经常在键盘和鼠标之间切换,但是如果你对快捷键掌握比较熟悉的话,这个是可以稍稍避免的。对于编辑功能上,竞争软件有很多如:Vim,Ultra Edit等。 图片教程如下: 快捷键集锦: Ctrl+= :Jump to definition Alt+/ :Look up reference  F9 :Jump to next reference F7 :Look up symbols F8 :Look up local symbols F9 :Ident left F10 :Ident right Alt+, :Jump backword Alt+. : Jump forward F2: switch to next page F3 : search backward F4 : search forward F5: Jump to line ? Ctrl+,/Ctrl+. Jump to last/past Shift+F3 : search the word under cursor backward Shift+F4 : forward F12 : incremental search Shift+Ctrl+f : search in project Others(Common in Windows system) Shift+Tab: Moving foward(After text selected) Tab:Moving backward(After text selected) Shift+(Up,Down,Left,Rght):Select code,do not have to using mouse cursor     转自:http://hi.baidu.com/fifnjftqyobgimd/item/26b7a2403a76be0fc01613da  
  • 热度 25
    2013-7-5 19:29
    6436 次阅读|
    3 个评论
         Source Insight是一个支持多种开发语言(java,C,C++等)的编辑器,编写代码很是方便。当然由于它的查找,定位,彩色显示等功能的强大,也被当成源代码阅读工具使用。由于Source Insight不能编译代码,却可以与其它刻下载编译代码软件同步,在这里就举例Source Insight和IAR的同步使用。   1 在IAR中新建一个工程TEST。菜单栏 File-New-Workspace; 菜单Project-Create New Project然后选C下的main,点击OK,选择保存路径和工程名。        我这里IAR当时主要是用于学习MSP430,工程存在F盘。   2  在Source Insight中新建一个工程test。Project-New Project,然后是工程保存路径和gongchengming,这些都可以自己定。我选的是默认路径。点击OK后其他默认,到了下面这个图片呢,就可以往工程中加入文件了。这里找到刚才创建的IAR工程test将main.c文件加入(选中文件点Add按钮然后close)。     3 添加新的.c文件,File-New,命名,可以在其中编写代码,保存。可以保存到创建的IAR工程文件夹下,如图。     在IAR中工程下右键-Add File可以添加该文件。在Source Insight中该文件下编写代码后保存代码便可同步到IAR中。     4  对于.h头文件,已有的可以直接添加,比如这里的io430.h文件IAR创建之初便已存在与TEST中,Source Insight可直接找到添加(Project-Add and Remove Project Files )。Source Insight也可新建.h文件,File-New名字后缀改为.h,点击OK。保存的话会记住以前的路径直接保存在IAR工程文件夹下。     在main.c(也可是其他)中加入#include "CC2500.h",然后保存。在IAR的TEST工程中main下便有了CC2500.h头文件。     弄好之后,在Source Insight中修改和编写代码,保存后就直接同步到IAR中了,会比较方便些。
相关资源