IDE: fix a bug in component palette configuration.

git-svn-id: trunk@47109 -
This commit is contained in:
juha 2014-12-04 23:28:54 +00:00
parent 574751850e
commit be294a7bed
2 changed files with 16 additions and 18 deletions

View File

@ -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;

View File

@ -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;