IDE: Show Frame's contents in designer also when its component package is installed in palette. Issue #39488.

(cherry picked from commit 05382f4ddf)
This commit is contained in:
Juha 2021-11-26 21:17:20 +02:00 committed by Maxim Ganetsky
parent 8b4a580354
commit 69e9028c85
5 changed files with 28 additions and 28 deletions

View File

@ -748,8 +748,8 @@ begin
FCollapsedComps := TAVLTree.Create;
FRoot2CollapasedMap[RootObject] := FCollapsedComps;
end;
RestoreExpand(RootNode); // then restore the Expanded/Collapsed state.
end;
RestoreExpand(RootNode); // then restore the Expanded/Collapsed state.
MakeSelectionVisible;
end;
EndUpdate;

View File

@ -9,7 +9,7 @@ object CheckLFMDialog: TCheckLFMDialog
ClientWidth = 552
OnClose = FormClose
OnCreate = CheckLFMDialogCreate
LCLVersion = '1.1'
LCLVersion = '2.3.0.0'
object NoteLabel: TLabel
Left = 0
Height = 15
@ -17,7 +17,6 @@ object CheckLFMDialog: TCheckLFMDialog
Width = 552
Align = alTop
Caption = 'NoteLabel'
ParentColor = False
WordWrap = True
end
object LFMGroupBox: TGroupBox
@ -585,7 +584,6 @@ object CheckLFMDialog: TCheckLFMDialog
Caption = 'Cancel'
Kind = bkCancel
ModalResult = 2
NumGlyphs = 0
TabOrder = 0
end
object RemoveAllButton: TBitBtn
@ -597,7 +595,6 @@ object CheckLFMDialog: TCheckLFMDialog
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Remove all invalid properties'
NumGlyphs = 0
OnClick = RemoveAllButtonClick
TabOrder = 1
end
@ -605,12 +602,6 @@ object CheckLFMDialog: TCheckLFMDialog
object SynLFMSyn1: TSynLFMSyn
DefaultFilter = 'Lazarus Form Files (*.lfm)|*.lfm'
Enabled = False
CommentAttri.FrameEdges = sfeAround
IdentifierAttri.FrameEdges = sfeAround
KeyAttri.FrameEdges = sfeAround
NumberAttri.FrameEdges = sfeAround
SpaceAttri.FrameEdges = sfeAround
StringAttri.FrameEdges = sfeAround
left = 129
top = 104
end

View File

@ -178,6 +178,8 @@ var
end;
procedure FindMissingClass(ObjNode: TLFMObjectNode);
// Add a missing or nested class to MissingClasses.
// A nested class means a TFrame installed as a component.
var
i: Integer;
AClassName: String;
@ -194,14 +196,16 @@ var
// search in designer base classes
if BaseFormEditor1.FindDesignerBaseClassByName(AClassName,true)<>nil then
exit;
// search in global registered classes
if GetClass(ObjNode.TypeName)<>nil then
exit;
// search in registered classes
RegComp:=IDEComponentPalette.FindRegComponent(ObjNode.TypeName);
if (RegComp<>nil) and (RegComp.GetUnitName<>'') then exit;
// search in global registered classes
if GetClass(ObjNode.TypeName) <> nil then
Exit;
if (RegComp<>nil) and (RegComp.GetUnitName<>'')
and not RegComp.ComponentClass.InheritsFrom(TCustomFrame) then // Nested TFrame
exit;
// class is missing
DebugLn(['FindMissingClass ',ObjNode.Name,':',ObjNode.TypeName,' IsInherited=',ObjNode.IsInherited]);
DebugLn(['QuickCheckLFMBuffer->FindMissingClass ',ObjNode.Name,':',ObjNode.TypeName,' IsInherited=',ObjNode.IsInherited]);
if MissingClasses=nil then
MissingClasses:=TStringList.Create;
MissingClasses.Add(AClassName);

View File

@ -2220,12 +2220,13 @@ begin
or (IndexOfDesignerBaseClass(TComponentClass(AClass))>=0) then begin
exit;
end;
//DebugLn(['TCustomFormEditor.JITListFindAncestors Class=',DbgSName(AClass)]);
AnUnitInfo:=Project1.UnitWithComponentClass(TComponentClass(AClass));
DebugLn(['TCustomFormEditor.JITListFindAncestors Class=',DbgSName(AClass)]);
AnUnitInfo:=Project1.UnitWithComponentClassName(AClass.ClassName);
//AnUnitInfo:=Project1.UnitWithComponentClass(TComponentClass(AClass));
while AnUnitInfo<>nil do begin
{$IFDEF VerboseFormEditor}
{.$IFDEF VerboseFormEditor}
DebugLn(['TCustomFormEditor.JITListFindAncestors FOUND ancestor ',DbgSName(AnUnitInfo.Component),', streaming ...']);
{$ENDIF}
{.$ENDIF}
Ancestor:=AnUnitInfo.Component;
BinStream:=nil;
if SaveUnitComponentToBinStream(AnUnitInfo,BinStream)<>mrOk then begin
@ -2254,7 +2255,9 @@ var
begin
//DebugLn(['TCustomFormEditor.JITListFindClass ',ComponentClassName]);
RegComp:=IDEComponentPalette.FindRegComponent(ComponentClassName);
if RegComp<>nil then begin
if (RegComp<>nil) and
not RegComp.ComponentClass.InheritsFrom(TCustomFrame) then // Nested TFrame
begin
//DebugLn(['TCustomFormEditor.JITListFindClass ',ComponentClassName,' is registered as ',DbgSName(RegComp.ComponentClass)]);
ComponentClass:=RegComp.ComponentClass;
end else begin
@ -2264,7 +2267,7 @@ begin
AnUnitInfo:=TUnitInfo(JITList.ContextObject);
if AnUnitInfo.ComponentFallbackClasses<>nil then
for i:=0 to AnUnitInfo.ComponentFallbackClasses.Count-1 do begin
if SysUtils.CompareText(AnUnitInfo.ComponentFallbackClasses[i],ComponentClassName)=0
if CompareText(AnUnitInfo.ComponentFallbackClasses[i],ComponentClassName)=0
then begin
{$IFDEF EnableNestedComponentsWithoutLFM}
ComponentClass:=TComponentClass(Pointer(AnUnitInfo.ComponentFallbackClasses.Objects[i]));
@ -2281,7 +2284,7 @@ begin
AnUnitInfo:=Project1.FirstUnitWithComponent;
while AnUnitInfo<>nil do begin
Component:=AnUnitInfo.Component;
if SysUtils.CompareText(Component.ClassName,ComponentClassName)=0 then
if CompareText(Component.ClassName,ComponentClassName)=0 then
begin
DebugLn(['TCustomFormEditor.JITListFindClass found nested class '+DbgSName(Component)+' in unit '+AnUnitInfo.Filename]);
ComponentClass:=TComponentClass(Component.ClassType);
@ -2293,8 +2296,7 @@ begin
//DebugLn(['TCustomFormEditor.JITListFindClass Searched=',ComponentClassName,' Found=',DbgSName(ComponentClass)]);
end;
function TCustomFormEditor.GetDesignerBaseClasses(Index: integer
): TComponentClass;
function TCustomFormEditor.GetDesignerBaseClasses(Index: integer): TComponentClass;
begin
Result:=TComponentClass(FDesignerBaseClasses[Index]);
end;

View File

@ -6602,7 +6602,8 @@ var
if FoundComponentClass=nil then
begin
RegComp:=IDEComponentPalette.FindRegComponent(aClassName);
if RegComp<>nil then
if (RegComp<>nil) and
not RegComp.ComponentClass.InheritsFrom(TCustomFrame) then // Nested TFrame
FoundComponentClass:=RegComp.ComponentClass;
end;
if FoundComponentClass=nil then
@ -6820,7 +6821,8 @@ var
// search ancestor in registered classes
if TryRegisteredClasses(AncestorClassName,AncestorClass,TheModalResult) then
exit(true);
raise Exception.Create('TryFindDeclaration: TryRegisteredClasses returned True!');
//exit(true);
{$IFDEF VerboseLFMSearch}
debugln(['TryFindDeclaration declaration of ',AComponentClassName,' found at ',NewTool.CleanPosToStr(NewNode.StartPos),' Ancestor="',AncestorClassName,'", but no lfm and no registered class found']);
@ -6868,7 +6870,8 @@ var
end;
StoreComponentClassDeclaration(UnitFilename);
if TryRegisteredClasses(AncestorClassName,AncestorClass,TheModalResult) then
exit(true);
raise Exception.Create('TryUsedUnitInterface: TryRegisteredClasses returned True!');
//exit(true);
end;
var