使用说明: 可以实现在sourceinsight中快速添加修改注释。 1. Project->Open Project... 打开Base工程(该工程一般在我的文档//Source Insight//Projects//Base中); 2. 搜索utils.em 里的字串"chenjsa" 改成自己的姓名 3. Project->Add and Remove Project Files... 加入宏文件(即utils.em); 4. Options->Menu Assignments 打开Menu Assignments窗口, 在Command中输入Macro, 选中要使用的宏(SingleLineComment ,MultiLineCommentHeader,MultiLineCommentEnd), 添加到合适的菜单中. macro SingleLineComment() { szMyName = "gs06116" // 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@" else szDay = Day //szMonth = NumToName(Month) if (Month < 10) szMonth = "0@Month@" else szMonth = Month szDescription = Ask("请输入修改原因") // begin assembling the title string //added by gs06116 InsBufLine(hbuf, ln, "//Added by @szMyName@ @Year@/@szMonth@/@szDay@ for @szDescription@ ") //InsBufLine(hbuf, ln+1, "/*@szDescription@ xmyanfa @Year@-@szMonth@-@szDay@*/") } macro MultiLineCommentHeader() { szMyName = "gs06116" // 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@" else szDay = Day //szMonth = NumToName(Month) if (Month < 10) szMonth = "0@Month@" else szMonth = Month szDescription = Ask("请输入修改原因:") // begin assembling the title string //added by gs06116 InsBufLine(hbuf, ln, "/*Begin:Added by @szMyName@ @Year@/@szMonth@/@szDay@ for @szDescription@ */") } macro MultiLineCommentEnd() { szMyName = "gs06116" // 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@" else szDay = Day //szMonth = NumToName(Month) if (Month < 10) szMonth = "0@Month@" else szMonth = Month //InsBufLine(hbuf, ln + 1, "/*@szMyName@.xmyanfa @Year@-@szMonth@-@szDay@ end*/") //added by gs06116 InsBufLine(hbuf, ln, "/*End:Added by @szMyName@ @Year@/@szMonth@/@szDay@ */") } macro DeSingleLineComment() { szMyName = "gs06116" // 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@" else szDay = Day //szMonth = NumToName(Month) if (Month < 10) szMonth = "0@Month@" else szMonth = Month szDescription = Ask("请输入修改原因") // begin assembling the title string //added by gs06116 InsBufLine(hbuf, ln, "//Deleted by @szMyName@ @Year@/@szMonth@/@szDay@ for @szDescription@ ") //InsBufLine(hbuf, ln+1, "/*@szDescription@ xmyanfa @Year@-@szMonth@-@szDay@*/") } macro DeMultiLineCommentHeader() { szMyName = "gs06116" // 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@" else szDay = Day //szMonth = NumToName(Month) if (Month < 10) szMonth = "0@Month@" else szMonth = Month szDescription = Ask("请输入修改原因:") // begin assembling the title string //added by gs06116 InsBufLine(hbuf, ln, "/*Begin:Deleted by @szMyName@ @Year@/@szMonth@/@szDay@ for @szDescription@ */") } macro DeMultiLineCommentEnd() { szMyName = "gs06116" // 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@" else szDay = Day //szMonth = NumToName(Month) if (Month < 10) szMonth = "0@Month@" else szMonth = Month //InsBufLine(hbuf, ln + 1, "/*@szMyName@.xmyanfa @Year@-@szMonth@-@szDay@ end*/") //added by gs06116 InsBufLine(hbuf, ln, "/*End:Deleted by @szMyName@ @Year@/@szMonth@/@szDay@ */") }
Source Insight中快速添加注释
最新推荐文章于 2024-10-09 20:19:05 发布