[lazarus] Pascal Code Editor

Marius Popa mapopa at netsoft.ro
Sat Jun 16 16:57:43 EDT 2001


I have atached the body (begin ...end)
of the procedure TEditorOptions.ReadAttribute(Attri:TSynHighlightElement); 
with the modifications 
for the Twilight Color scheme
the only thing that remains is the modifying
combobox for the changing the Default Scheme

 
> Just change in editoroptions.pp the default settings of 
> 
> procedure TEditorOptions.ReadAttribute(Attri:TSynHighlightElement);
> 
> and send me the code. I will add the Twilight Color scheme.
> 
> Mattias
> 
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>     archives at http://www.miraclec.com/list_archives/lazarus
> 


procedure TEditorOptions.ReadAttribute(Attri:TSynHighlightElement);
var b:boolean;
  fs:TFontStyles;
  AttriName:string;
  a:integer;
  DefBGCol,DefFGCol:TColor;
  DefFontStyles:TFontStyles;
begin
  AttriName:=Attri.Name;
  DefFGCol:=clNone;
  DefBGCol:=clNone;
  DefFontStyles:=[];
  if ColorScheme ='Twilight'  then
  begin
   DefBGCol:=clBlack;
   DefFGCol:=clWhite;
   if AttriName='Assembler' then begin
    DefFGCol:=clLime;
   end else if AttriName='Comment' then begin
    DefFGCol:=clGray;
   end else if AttriName='Reserved word' then begin
    DefFGCol:=clAqua;
    DefFontStyles:=[fsBold];
   end else if AttriName='Number' then begin
      DefFGCol:=clFuchsia;
   end else if AttriName='String' then begin
     DefFGCol:=clYellow;
   end else if AttriName='Symbol' then begin
     DefFGCol:=clAqua;
   end else if AttriName=AdditionalHiglightAttributes[0] then begin
     DefBGCol:=clWhite;
     DefFGCol:=clBlack
   end else if AttriName=AdditionalHiglightAttributes[1] then begin
     DefBGCol:=clBlue;
     DefFGCol:=clWhite;
   end else if AttriName=AdditionalHiglightAttributes[2] then begin
     DefBGCol:=clRed;
     DefFGCol:=clWhite;
   end else if AttriName=AdditionalHiglightAttributes[3] then begin
     DefBGCol:=clLime;
     DefFGCol:=clRed;
   end else if AttriName=AdditionalHiglightAttributes[4] then begin
     DefBGCol:=$50a0ff;
     DefFGCol:=clBlack;
   end;
   end
  else
  begin
  if AttriName='Assembler' then begin
    DefFGCol:=clGreen;
  end else if AttriName='Comment' then begin
    DefFGCol:=clBlue;
    DefFontStyles:=[fsBold];
  end else if AttriName='Reserved word' then begin
    DefFontStyles:=[fsBold];
  end else if AttriName='Number' then begin
    DefFGCol:=clNavy;
  end else if AttriName='String' then begin
    DefFGCol:=clBlue;
  end else if AttriName='Symbol' then begin
    DefFGCol:=clRed;
  end else if AttriName=AdditionalHiglightAttributes[0] then begin
    DefBGCol:=clNavy;
    DefFGCol:=clWhite;
  end else if AttriName=AdditionalHiglightAttributes[1] then begin
    DefBGCol:=clDKGray;
    DefFGCol:=clWhite;
  end else if AttriName=AdditionalHiglightAttributes[2] then begin
    DefBGCol:=clRed;
    DefFGCol:=clBlack;
  end else if AttriName=AdditionalHiglightAttributes[3] then begin
    DefBGCol:=clGreen;
    DefFGCol:=clBlack;
  end else if AttriName=AdditionalHiglightAttributes[4] then begin
    DefBGCol:=$50a0ff;
    DefFGCol:=clBlack;
  end;
  end;
  for a:=1 to length(AttriName) do
    if (not (AttriName[a] in ['a'..'z','A'..'Z'])) then
      AttriName[a]:='_';
  Attri.BackGround:=XMLConfig.GetValue(
    'EditorOptions/Color/'+ColorScheme+'/'+AttriName+'/BackgroundColor',DefBGCol);
  Attri.ForeGround:=XMLConfig.GetValue(
    'EditorOptions/Color/'+ColorScheme+'/'+AttriName+'/ForegroundColor',DefFGCol);
  fs:=[];
  b:=XMLConfig.GetValue(
    'EditorOptions/Color/'+ColorScheme+'/'+AttriName+'/Bold'
    ,fsBold in DefFontStyles);
  if b then fs:=fs+[fsBold];
  b:=XMLConfig.GetValue(
    'EditorOptions/Color/'+ColorScheme+'/'+AttriName+'/Italic'
    ,fsItalic in DefFontStyles);
  if b then fs:=fs+[fsItalic];
  b:=XMLConfig.GetValue(
    'EditorOptions/Color/'+ColorScheme+'/'+AttriName+'/Underline'
    ,fsUnderLine in DefFontStyles);
  if b then fs:=fs+[fsUnderline];
  Attri.Style:=fs;
end;






More information about the Lazarus mailing list