[Lazarus] Synedit: background colours and f(o)nts

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Mon Feb 20 10:24:24 CET 2012


I've got a Synedit here which uses code as below to rule alternate 
background lines to a light colour:

procedure TListForm.PaneMainEditSpecialLineColors(Sender: TObject; Line: 
integer;
                                         var Special: boolean; var FG, 
BG: TColor);

begin
   MusicRuleColour(line, FG, BG)
end { TListForm.PaneMainEditSpecialLineColors } ;

PROCEDURE MusicRuleColour(line: INTEGER; VAR FG, BG: TColor);

CONST	lightRed= $00F0F0FF;
	lightGreen= $00E0FFE0;
	lightBlue= $00FFF0F0;

BEGIN
   FG:= ListForm.PaneMainEdit.Font.Color;
   IF ListForm.MenuMainViewMusicRuled.Checked AND Odd(Line) THEN
     CASE ListForm.GlobalState.MusicRuleColour OF
       RuledLightBlue: BG:= lightBlue;
       RuledLightRed:  BG:= lightRed
     ELSE
       BG:= lightGreen
     END
   ELSE
     BG:= ListForm.PaneMainEdit.Color
END { MusicRuleColour } ;

This works well with both GTK and GTK2 up to around 0.9.26, but at some 
point after that the event continues being called but the background is 
entirely the default colour. Is there an accessible property that will 
restore the original behaviour?

In the same program (running on Linux), the Synedit font appears to 
force itself to a generic Sans at runtime, irrespective of what is 
actually selected (e.g. Monospace). Again, this is OK up to around 0.9.26.

The application is a fairly simple file viewer, available on a wide 
range of systems and starting as rapidly as possible- usually when 
somebody's on the 'phone hassling me for info. As such, I'm trying to 
keep it compiling on GTK and a rather elderly Delphi, which means that I 
try to be careful what goes into the .lfm files.

Finally and as a subsidiary question: if I've got a local svn to help 
moving projects between machines I try to keep them tested on, what 
files should go into it? Specifically, should I be storing .lrs or are 
these better recreated on demand?

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list