Syntax hilighting IDE memo


If I'm using IDEDIalog, IDEScripter, andIDEEngine as per "ScripterProIDE" demo, is there a way to control the syntax hilighting colours in editor? Or enable/disable code folding?

I figured out how to add AdvAppStyler support to "theme enable" the IDE, but how do I add AdvPascalMemoStyler support so I can change the colours to something I prefer?

TIA.

Cheers,
EdB

Currently the TIDEEngine creates a private pascal and basic styler and assigns it to the memo whenever the script being displayed in pascal or basic. The only current (ugly) workaround is to define an Memo.OnChange event handler in OnCreateEditor event (see ScripterProIDE):


    IDEEngine1.Memo.OnChange := MemoChange;


and then get the SyntaxStyler from that:

  if IDEEngine1.Memo.SyntaxStyles is TScrPascalStyler then {use it}

In case anyone is interested...

I dropped a TScrPascalMemoStyler (and set the options I wanted) on the form and added the code below as the MemoChange event.

I couldn't get assign to do what I expected it to do, so had to loop through and assign fonts.

Also, AllStyles[n].Font.Name and Font.size are ignored - had to set the memo.Font.Size.

Setting the memo.Font.Name throws everything off (lose colours etc).

Cheers,
EdB


procedure TForm1.OnMemoChange(Sender: TObject);
var
 k:integer;
begin
  IDEEngine1.Memo.Font.Size:=14; // SyntaxStyles font size ignored so set here

  if IDEEngine1.Memo.SyntaxStyles is TScrPascalMemoStyler then begin
    with IDEEngine1.Memo.SyntaxStyles do begin
      CommentStyle.TextColor  := ScrPascalMemoStyler1.CommentStyle.TextColor;
      CommentStyle.BkColor    := ScrPascalMemoStyler1.CommentStyle.BkColor;
      CommentStyle.Style      := ScrPascalMemoStyler1.CommentStyle.Style;

      NumberStyle.TextColor   := ScrPascalMemoStyler1.NumberStyle.TextColor;
      NumberStyle.BkColor     := ScrPascalMemoStyler1.NumberStyle.BkColor;
      NumberStyle.Style       := ScrPascalMemoStyler1.NumberStyle.Style;

      HighlightStyle.TextColor:= ScrPascalMemoStyler1.HighlightStyle.TextColor;
      HighlightStyle.BkColor  := ScrPascalMemoStyler1.HighlightStyle.BkColor;
      HighlightStyle.Style    := ScrPascalMemoStyler1.HighlightStyle.Style;
    end;

   //AllStyles.Assign(ScrPascalMemoStyler1.AllStyles); // doesn't work  
 
  // ignores font name and size, but keeps style and color
    for k := 0 to pred(IDEEngine1.Memo.SyntaxStyles.AllStyles.Count) do
      IDEEngine1.Memo.SyntaxStyles.AllStyles[k].Font.Assign(ScrPascalMemoStyler1.AllStyles[k].font);
  end;
end;


I disabled themes in the project, and this works quite nicely (the 'assign' works).

Still ignores font name and size in "AllStyles" though.


procedure TForm1.OnMemoChange(Sender: TObject);
// NOTE - need to add "ScrMps," to uses clause
var
 k:integer;
begin
 IDEEngine1.Memo.Font.Name:='Consolas';
 IDEEngine1.Memo.Font.Size:=12; // SyntaxStyles font size ignored so set here

  if IDEEngine1.Memo.SyntaxStyles is TScrPascalMemoStyler then begin
    with IDEEngine1.Memo.SyntaxStyles do begin
      CommentStyle.TextColor  := ScrPascalMemoStyler1.CommentStyle.TextColor;
      CommentStyle.BkColor    := ScrPascalMemoStyler1.CommentStyle.BkColor;
      CommentStyle.Style      := ScrPascalMemoStyler1.CommentStyle.Style;

      NumberStyle.TextColor   := ScrPascalMemoStyler1.NumberStyle.TextColor;
      NumberStyle.BkColor     := ScrPascalMemoStyler1.NumberStyle.BkColor;
      NumberStyle.Style       := ScrPascalMemoStyler1.NumberStyle.Style;

      HighlightStyle.TextColor:= ScrPascalMemoStyler1.HighlightStyle.TextColor;
      HighlightStyle.BkColor  := ScrPascalMemoStyler1.HighlightStyle.BkColor;
      HighlightStyle.Style    := ScrPascalMemoStyler1.HighlightStyle.Style;
    end;

   IDEEngine1.Memo.SyntaxStyles.AllStyles.Assign(ScrPascalMemoStyler1.AllStyles); // doesn't work
  end;
end;