|
![]() |
#1 |
Moderator
|
См. класс EditorScripts.
__________________
Андрей. |
|
|
За это сообщение автора поблагодарили: aidsua (2), blitzkrieg (1), cleverMan (1), Prophetic (1). |
![]() |
#2 |
Участник
|
![]()
Вот такой скрипт использую я:
X++: //<EditorExtensions_ikash date=2007-01-20 txt='Inserts a comment with current date, userId and comments on the modification'> #define.StartComment("//<\%1_\%2 date=\%3 txt='\%4'>\n") #define.EndComment ("//</\%1_\%2>\n") #define.CurrentVersion(1) void comments_projectTxt(Editor e) { Dialog dialog = new Dialog("Вставка комментариев", this); DialogField dlgFieldMod = dialog.addField(typeId(FreeText), "Введите код модификации"); DialogField dlgFieldTxt = dialog.addField(typeId(SourceLine), "Введите комментарий к коду"); int start, end, firstSym; container packedData; SourceLine projectDescription; FreeText projectCode; int version; ; packedData = xSysLastValue::getValue(curExt(), curUserId(), UtilElementType::Class, classId2Name(classIdGet(this)), funcName()); try { if (conLen(packedData) && conPeek(packedData, 1) == #CurrentVersion) [version, projectCode, projectDescription] = packedData; } catch { projectCode = ''; projectDescription = ''; } dlgFieldMod.value(projectCode); dlgFieldTxt.value(projectDescription); if (dialog.run()) { projectCode = dlgFieldMod.value(); projectDescription = dlgFieldTxt.value(); start = e.selectionStartLine(); end = e.selectionEndLine(); e.gotoLine(start); firstSym = strnfind(e.currentLine(), " ", 1, strlen(e.currentLine())); e.unmark(); if (start > 1) { e.gotoLine(end + 1); e.gotoCol(1); e.insertLines(strrep(" ", firstSym - 1) + strfmt(#EndComment, projectCode, curUserId())); } e.gotoLine(start); e.gotoCol(1); e.insertLines(strrep(" ", firstSym - 1) + strfmt(#StartComment, projectCode, curUserId(), date2str(SystemDateGet(),321,2,3,2,3,4), projectDescription)); xSysLastValue::putValue([#CurrentVersion, projectCode, projectDescription], curExt(), curUserId(), UtilElementType::Class, classId2Name(classIdGet(this)), funcName()); } } Последний раз редактировалось kashperuk; 20.01.2007 в 13:00. Причина: Исправил кракозяблики |
|
|
За это сообщение автора поблагодарили: kvg6 (1), aidsua (2), cleverMan (1), Prophetic (1). |
Теги |
editor script, комментарий, программно |
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|