IDE: Reduce component palette updates at the start. Aims for snappier boot of Lazarus.

git-svn-id: trunk@47099 -
This commit is contained in:
juha 2014-12-04 17:12:09 +00:00
parent d16d9236fd
commit 34ca493ff0

View File

@ -3673,13 +3673,22 @@ begin
end; end;
procedure TMainIDE.UpdateIDEComponentPalette(IfFormChanged: boolean); procedure TMainIDE.UpdateIDEComponentPalette(IfFormChanged: boolean);
var
OldLastCompPaletteForm: TCustomForm;
begin begin
if IfFormChanged and (fLastCompPaletteForm=LastFormActivated) then exit; // Package manager updates the palette initially.
if not FIDEStarted
or (IfFormChanged and (fLastCompPaletteForm=LastFormActivated)) then
exit;
OldLastCompPaletteForm:=fLastCompPaletteForm;
fLastCompPaletteForm:=LastFormActivated; fLastCompPaletteForm:=LastFormActivated;
IDEComponentPalette.HideControls:=(LastFormActivated<>nil) Assert(Assigned(LastFormActivated), 'TMainIDE.UpdateIDEComponentPalette: LastFormActivated = Nil');
and (LastFormActivated.Designer<>nil) IDEComponentPalette.HideControls:= (LastFormActivated.Designer<>nil)
and (LastFormActivated.Designer.LookupRoot<>nil) and (LastFormActivated.Designer.LookupRoot<>nil)
and not (LastFormActivated.Designer.LookupRoot is TControl); and not (LastFormActivated.Designer.LookupRoot is TControl);
// Don't update palette at the first time if not hiding controls.
if (OldLastCompPaletteForm = Nil) and not IDEComponentPalette.HideControls then
exit;
{$IFDEF VerboseComponentPalette} {$IFDEF VerboseComponentPalette}
DebugLn(['* TMainIDE.UpdateIDEComponentPalette: Updating palette *', DebugLn(['* TMainIDE.UpdateIDEComponentPalette: Updating palette *',
', HideControls=', IDEComponentPalette.HideControls]); ', HideControls=', IDEComponentPalette.HideControls]);
@ -8589,7 +8598,8 @@ begin
NewForm.Invalidate; NewForm.Invalidate;
{$IFDEF VerboseComponentPalette} {$IFDEF VerboseComponentPalette}
DebugLn('***'); DebugLn('***');
DebugLn('** TMainIDE.OnControlSelectionFormChanged: Calling UpdateIDEComponentPalette(true) **'); DebugLn(['** TMainIDE.OnControlSelectionFormChanged: Calling UpdateIDEComponentPalette(true)',
', IDEStarted=', FIDEStarted, ' **']);
{$ENDIF} {$ENDIF}
UpdateIDEComponentPalette(true); UpdateIDEComponentPalette(true);
end; end;
@ -10528,7 +10538,8 @@ begin
LastFormActivated := (Sender as TDesigner).Form; LastFormActivated := (Sender as TDesigner).Form;
{$IFDEF VerboseComponentPalette} {$IFDEF VerboseComponentPalette}
DebugLn('***'); DebugLn('***');
DebugLn('** TMainIDE.OnDesignerActivated: Calling UpdateIDEComponentPalette(true) **'); DebugLn(['** TMainIDE.OnDesignerActivated: Calling UpdateIDEComponentPalette(true)',
', IDEStarted=', FIDEStarted, ' **']);
{$ENDIF} {$ENDIF}
UpdateIDEComponentPalette(true); UpdateIDEComponentPalette(true);
end; end;