mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 04:19:12 +02:00
IDE: fix a bug in component palette configuration.
git-svn-id: trunk@47109 -
This commit is contained in:
parent
574751850e
commit
be294a7bed
@ -618,15 +618,14 @@ var
|
||||
sl: TStringList;
|
||||
i: Integer;
|
||||
begin
|
||||
DestComps.Clear;
|
||||
if fOrigComponentPageCache.Find(PageName, i) then
|
||||
begin
|
||||
sl := fOrigComponentPageCache.Objects[i] as TStringList;
|
||||
for i := 0 to sl.Count-1 do
|
||||
if FindComponent(sl[i]).Visible then
|
||||
DestComps.Add(sl[i]);
|
||||
end
|
||||
else
|
||||
raise Exception.Create(Format('AssignOrigVisibleCompsForPage: %s not found in cache.', [PageName]));
|
||||
end;
|
||||
end;
|
||||
|
||||
function TComponentPalette.RefUserCompsForPage(PageName: string): TStringList;
|
||||
|
@ -215,27 +215,26 @@ var
|
||||
PgName: String;
|
||||
i: Integer;
|
||||
begin
|
||||
OrigComps := Nil;
|
||||
cpo.ComponentPages.Clear;
|
||||
for i := 1 to PagesListBox.Count-1 do // Skip all components page
|
||||
begin
|
||||
PgName := PagesListBox.Items[i];
|
||||
UserComps := PagesListBox.Items.Objects[i] as TStringList;
|
||||
Assert(Assigned(UserComps), 'TCompPaletteOptionsFrame.WriteComponents: No UserComps for '+PgName);
|
||||
Pg := IDEComponentPalette.GetPage(PgName);
|
||||
try
|
||||
OrigComps := TStringList.Create;
|
||||
try
|
||||
cpo.ComponentPages.Clear;
|
||||
for i := 1 to PagesListBox.Count-1 do // Skip all components page
|
||||
begin
|
||||
PgName := PagesListBox.Items[i];
|
||||
UserComps := PagesListBox.Items.Objects[i] as TStringList;
|
||||
Assert(Assigned(UserComps), 'TCompPaletteOptionsFrame.WriteComponents: No UserComps for '+PgName);
|
||||
Pg := IDEComponentPalette.GetPage(PgName);
|
||||
if Assigned(Pg) and Pg.Visible then // Can be Nil if this page was added or renamed.
|
||||
begin
|
||||
OrigComps := TStringList.Create;
|
||||
// Collect original visible components from this page.
|
||||
IDEComponentPalette.AssignOrigVisibleCompsForPage(OrigComps, PgName)
|
||||
end;
|
||||
else
|
||||
OrigComps.Clear;
|
||||
// Differs from original order -> add configuration for components.
|
||||
if (OrigComps=Nil) or not OrigComps.Equals(UserComps) then
|
||||
if (OrigComps.Count=0) or not OrigComps.Equals(UserComps) then
|
||||
cpo.AssignComponentPage(PgName, UserComps);
|
||||
finally
|
||||
FreeAndNil(OrigComps);
|
||||
end;
|
||||
finally
|
||||
OrigComps.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user