fix #219 - Highlighter presets editor broken when building with Laz 1.8

This commit is contained in:
Basile Burg 2018-01-10 22:55:32 +01:00
parent 95d98216df
commit e815013bd9
1 changed files with 21 additions and 1 deletions

View File

@ -99,6 +99,8 @@ type
procedure propEdModified(sender: TObject);
procedure updateList;
procedure updateEditor;
protected
procedure SetVisible(Value: Boolean); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@ -273,6 +275,24 @@ begin
StyleMask:=stlMsk;
end;
procedure TCED2SynPresetsLoaderForm.SetVisible(Value: Boolean);
var
firstTime: boolean;
begin
inherited;
// extracted from the ctor : lazarus 1.8 regression
firstTime := fList.ItemIndex = -1;
if value and (firstTime or (fList.Items.Count >= 0)) then
begin
fEditor.Font.Assign(EditorOptions.font);
fEditor.Font.Size:=12;
fEditor.Font.Name:=EditorOptions.font.Name;
if firstTime then
fList.ItemIndex := 0;
lstBoxSelChange(nil);
end;
end;
constructor TCED2SynPresetsLoaderForm.Create(AOwner: TComponent);
var
fname: string;
@ -512,6 +532,7 @@ begin
fEditor.lines.Add(' int number = 0xDEADBEEF;');
fEditor.lines.Add(' asm{ xor RAX, RAX; }');
fEditor.lines.Add(' int error = 12G;');
fEditor.lines.Add(' alias fun = () => {};');
fEditor.lines.Add('}');
pnl := TPanel.Create(self);
pnl.Parent := self;
@ -562,7 +583,6 @@ begin
fPropEd.PropertyEditorHook.AddHandlerModified(@propEdModified);
//
fList.ItemIndex := 0;
//lstBoxSelChange(nil);
EntitiesConnector.addObserver(self);
end;