mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 12:40:36 +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;
|
sl: TStringList;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
DestComps.Clear;
|
||||||
if fOrigComponentPageCache.Find(PageName, i) then
|
if fOrigComponentPageCache.Find(PageName, i) then
|
||||||
begin
|
begin
|
||||||
sl := fOrigComponentPageCache.Objects[i] as TStringList;
|
sl := fOrigComponentPageCache.Objects[i] as TStringList;
|
||||||
for i := 0 to sl.Count-1 do
|
for i := 0 to sl.Count-1 do
|
||||||
if FindComponent(sl[i]).Visible then
|
if FindComponent(sl[i]).Visible then
|
||||||
DestComps.Add(sl[i]);
|
DestComps.Add(sl[i]);
|
||||||
end
|
end;
|
||||||
else
|
|
||||||
raise Exception.Create(Format('AssignOrigVisibleCompsForPage: %s not found in cache.', [PageName]));
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TComponentPalette.RefUserCompsForPage(PageName: string): TStringList;
|
function TComponentPalette.RefUserCompsForPage(PageName: string): TStringList;
|
||||||
|
@ -215,27 +215,26 @@ var
|
|||||||
PgName: String;
|
PgName: String;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
OrigComps := Nil;
|
OrigComps := TStringList.Create;
|
||||||
cpo.ComponentPages.Clear;
|
try
|
||||||
for i := 1 to PagesListBox.Count-1 do // Skip all components page
|
cpo.ComponentPages.Clear;
|
||||||
begin
|
for i := 1 to PagesListBox.Count-1 do // Skip all components page
|
||||||
PgName := PagesListBox.Items[i];
|
begin
|
||||||
UserComps := PagesListBox.Items.Objects[i] as TStringList;
|
PgName := PagesListBox.Items[i];
|
||||||
Assert(Assigned(UserComps), 'TCompPaletteOptionsFrame.WriteComponents: No UserComps for '+PgName);
|
UserComps := PagesListBox.Items.Objects[i] as TStringList;
|
||||||
Pg := IDEComponentPalette.GetPage(PgName);
|
Assert(Assigned(UserComps), 'TCompPaletteOptionsFrame.WriteComponents: No UserComps for '+PgName);
|
||||||
try
|
Pg := IDEComponentPalette.GetPage(PgName);
|
||||||
if Assigned(Pg) and Pg.Visible then // Can be Nil if this page was added or renamed.
|
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.
|
// Collect original visible components from this page.
|
||||||
IDEComponentPalette.AssignOrigVisibleCompsForPage(OrigComps, PgName)
|
IDEComponentPalette.AssignOrigVisibleCompsForPage(OrigComps, PgName)
|
||||||
end;
|
else
|
||||||
|
OrigComps.Clear;
|
||||||
// Differs from original order -> add configuration for components.
|
// 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);
|
cpo.AssignComponentPage(PgName, UserComps);
|
||||||
finally
|
|
||||||
FreeAndNil(OrigComps);
|
|
||||||
end;
|
end;
|
||||||
|
finally
|
||||||
|
OrigComps.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user