Показать сообщение отдельно
Старый 20.01.2007, 12:59   #6  
kashperuk is offline
kashperuk
Участник
Аватар для kashperuk
MCBMSS
Соотечественники
Сотрудники Microsoft Dynamics
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии 2011
Лучший по профессии 2009
 
4,361 / 2084 (78) +++++++++
Регистрация: 30.05.2004
Адрес: Atlanta, GA, USA
-> Classes\EditorScripts\comments_projectTxt
Вот такой скрипт использую я:

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).