I want to use sciLex to format a legend.
My code is
Code: Select all
def_style:appendStyledLine("ЗАДАННЫЕ ЦВЕТЫ",sciLexer_native::style_default),
        _=
            [ SciStyle  ||
                list::memberIndex_nd(State,Index, [cell::empty,cell::unlivable,cell::poisoned(1),cell::deserted]),
                cell::stateToFillColor(State)=FillColor,
                cell::stateToLetterColor(State)=LetterColor,
                SciStyle=Index+1,
                cell::translateState(State,_,RussianTranslation),
                def_style: used_lexer:styleSetFore(SciStyle,LetterColor),
                def_style: used_lexer:styleSetBack(SciStyle,FillColor),
                def_style:used_lexer:styleSetFont(SciStyle,Name),
                def_style:used_lexer:styleSetBold(SciStyle,false),
                def_style:used_lexer:styleSetUnderline(SciStyle,false),
                def_style:used_lexer:styleSetItalic(SciStyle,true),
                def_style:used_lexer:styleSetSize(SciStyle,FontSize),
                def_style:appendStyledLine(RussianTranslation,SciStyle)
            ],
            def_style:appendStyledLine("",sciLexer_native::style_default).Code: Select all
% Append styled line to the end of the contents of the control.
    appendStyledLine(TextWithoutNewLine,UsedStyle) :-
        appendStyledText(string::concat(TextWithoutNewLine,"\n"),UsedStyle).
 
    % Append styled text to the end of the contents of the control.
    % Use default style instead of missing styles.
    appendStyledText(Text,RequestedStyle) :-
        P1=used_lexer:currentPos,
        used_lexer:addText(Text),
        used_lexer:startStyling(P1,31), % Wired-in magic constant
        if toBoolean(styleNumSym(RequestedStyle,_))=true then
            AppliedStyle=RequestedStyle
        else
            AppliedStyle=style_default
        end if,
        used_lexer:setStyling(string::length(Text),AppliedStyle).Code: Select all
setStyling(Length, Style) :-
        sciLexer_api::setStyling(native, Length, Style).


