Источник:
http://daxsol.blogspot.com/2009/04/2.html
==============
Класс
EditorScripts.Метод
Comments_Copyrights.
X++:
void Comments_Copyrights(Editor e)
{
int startLine = e.selectionStartLine();
int endLine = e.selectionEndLine();
int selectedLines = endLine - startLine;
int firstChar;
int endChar;
UserInfo userInfo;
;
select firstonly userInfo
where userInfo.id == curUserId();
if (!userInfo)
return;
e.unmark();
firstChar = strnfind(e.currentLine(), " ", 1, strlen(e.currentLine()));
if (!selectedLines && startLine > 1) // One line comment
{
e.gotoLine(startLine);
endChar = strlen(e.currentLine()) + 1;
e.gotoCol(endChar);
e.insertString(strfmt(" // %1 %2 %3", userInfo.name, systemDateGet(), SysUserInfo::find(curUserId()).RMSFolderId));
}
else if (!selectedLines && startLine == 1) // Method Copyrights
{
e.gotoLine(1);
e.gotoCol(1);
e.insertLines(strfmt("// %1 %2 %3\n", userInfo.name, systemDateGet(), SysUserInfo::find(curUserId()).RMSFolderId));
}
else // BlockComments
{
e.gotoLine(startLine);
firstChar = strnfind(e.currentLine(), " ", 1, strlen(e.currentLine()));
e.insertLines(strrep(" ", firstChar - 1) + strfmt("//+ %1 %2 %3\n", userInfo.name, systemDateGet(), SysUserInfo::find(curUserId()).RMSFolderId));
e.gotoLine(endLine + 1);
e.insertLines(strrep(" ", firstChar - 1) + strfmt("//- %1 %2 %3\n", userInfo.name, systemDateGet(), SysUserInfo::find(curUserId()).RMSFolderId));
}
}
Источник:
http://daxsol.blogspot.com/2009/04/2.html