mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 10:39:18 +02:00
implemented getting define properties for Repair broken LFM wizard
git-svn-id: trunk@5757 -
This commit is contained in:
parent
966f3701b9
commit
ae15cfe4a8
@ -60,6 +60,8 @@ type
|
|||||||
const TheUnitName, TheUnitInFilename: string
|
const TheUnitName, TheUnitInFilename: string
|
||||||
): TCodeBuffer of object;
|
): TCodeBuffer of object;
|
||||||
TOnCodeToolCheckAbort = function: boolean of object;
|
TOnCodeToolCheckAbort = function: boolean of object;
|
||||||
|
TOnGetDefinePropertiesForClass = procedure(Sender: TObject;
|
||||||
|
const ComponentClassName: string; var List: TStrings) of object;
|
||||||
|
|
||||||
TCodeToolManager = class
|
TCodeToolManager = class
|
||||||
private
|
private
|
||||||
@ -83,6 +85,7 @@ type
|
|||||||
FOnCheckAbort: TOnCodeToolCheckAbort;
|
FOnCheckAbort: TOnCodeToolCheckAbort;
|
||||||
FOnGatherExternalChanges: TOnGatherExternalChanges;
|
FOnGatherExternalChanges: TOnGatherExternalChanges;
|
||||||
FOnGetDefineProperties: TOnGetDefineProperties;
|
FOnGetDefineProperties: TOnGetDefineProperties;
|
||||||
|
FOnGetDefinePropertiesForClass: TOnGetDefinePropertiesForClass;
|
||||||
FOnSearchUsedUnit: TOnSearchUsedUnit;
|
FOnSearchUsedUnit: TOnSearchUsedUnit;
|
||||||
FResourceTool: TResourceCodeTool;
|
FResourceTool: TResourceCodeTool;
|
||||||
FSetPropertyVariablename: string;
|
FSetPropertyVariablename: string;
|
||||||
@ -353,6 +356,9 @@ type
|
|||||||
// resources
|
// resources
|
||||||
property OnGetDefineProperties: TOnGetDefineProperties
|
property OnGetDefineProperties: TOnGetDefineProperties
|
||||||
read FOnGetDefineProperties write FOnGetDefineProperties;
|
read FOnGetDefineProperties write FOnGetDefineProperties;
|
||||||
|
property OnGetDefinePropertiesForClass: TOnGetDefinePropertiesForClass
|
||||||
|
read FOnGetDefinePropertiesForClass
|
||||||
|
write FOnGetDefinePropertiesForClass;
|
||||||
function FindLFMFileName(Code: TCodeBuffer): string;
|
function FindLFMFileName(Code: TCodeBuffer): string;
|
||||||
function CheckLFM(UnitCode, LFMBuf: TCodeBuffer;
|
function CheckLFM(UnitCode, LFMBuf: TCodeBuffer;
|
||||||
var LFMTree: TLFMTree;
|
var LFMTree: TLFMTree;
|
||||||
@ -371,6 +377,9 @@ type
|
|||||||
KeepPath: boolean): boolean;
|
KeepPath: boolean): boolean;
|
||||||
function RenameIncludeDirective(Code: TCodeBuffer; LinkIndex: integer;
|
function RenameIncludeDirective(Code: TCodeBuffer; LinkIndex: integer;
|
||||||
const NewFilename: string; KeepPath: boolean): boolean;
|
const NewFilename: string; KeepPath: boolean): boolean;
|
||||||
|
procedure DefaultGetDefineProperties(Sender: TObject;
|
||||||
|
const ClassContext: TFindContext; LFMNode: TLFMTreeNode;
|
||||||
|
const IdentName: string; var DefineProperties: TStrings);
|
||||||
|
|
||||||
// register proc
|
// register proc
|
||||||
function HasInterfaceRegisterProc(Code: TCodeBuffer;
|
function HasInterfaceRegisterProc(Code: TCodeBuffer;
|
||||||
@ -489,6 +498,7 @@ constructor TCodeToolManager.Create;
|
|||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
FCheckFilesOnDisk:=true;
|
FCheckFilesOnDisk:=true;
|
||||||
|
FOnGetDefineProperties:=@DefaultGetDefineProperties;
|
||||||
DefineTree:=TDefineTree.Create;
|
DefineTree:=TDefineTree.Create;
|
||||||
DefineTree.OnReadValue:=@OnDefineTreeReadValue;
|
DefineTree.OnReadValue:=@OnDefineTreeReadValue;
|
||||||
DefinePool:=TDefinePool.Create;
|
DefinePool:=TDefinePool.Create;
|
||||||
@ -2189,6 +2199,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCodeToolManager.DefaultGetDefineProperties(Sender: TObject;
|
||||||
|
const ClassContext: TFindContext; LFMNode: TLFMTreeNode;
|
||||||
|
const IdentName: string; var DefineProperties: TStrings);
|
||||||
|
var
|
||||||
|
ComponentClassName: String;
|
||||||
|
begin
|
||||||
|
if Assigned(OnGetDefinePropertiesForClass) then begin
|
||||||
|
ComponentClassName:=ClassContext.Tool.ExtractClassName(
|
||||||
|
ClassContext.Node,false);
|
||||||
|
OnGetDefinePropertiesForClass(ClassContext.Tool,ComponentClassName,
|
||||||
|
DefineProperties);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCodeToolManager.FindCreateFormStatement(Code: TCodeBuffer;
|
function TCodeToolManager.FindCreateFormStatement(Code: TCodeBuffer;
|
||||||
StartPos: integer;
|
StartPos: integer;
|
||||||
const AClassName, AVarName: string;
|
const AClassName, AVarName: string;
|
||||||
|
@ -971,7 +971,8 @@ var
|
|||||||
ObjectNode.DefineProperties.Add('TOP');
|
ObjectNode.DefineProperties.Add('TOP');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Result:=ObjectNode.DefineProperties.IndexOf(IdentName)>=0;
|
Result:=(ObjectNode.DefineProperties<>nil)
|
||||||
|
and (ObjectNode.DefineProperties.IndexOf(IdentName)>=0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FindLFMIdentifier(LFMNode: TLFMTreeNode;
|
function FindLFMIdentifier(LFMNode: TLFMTreeNode;
|
||||||
|
@ -207,7 +207,7 @@ var
|
|||||||
|
|
||||||
function CheckProperties: boolean;
|
function CheckProperties: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=CheckLFMBuffer(UnitCode,LFMBuffer,nil,false,false);
|
Result:=CheckLFMBuffer(UnitCode,LFMBuffer,nil,false,false)=mrOk;
|
||||||
if not Result and (CodeToolBoss.ErrorMessage<>'') then
|
if not Result and (CodeToolBoss.ErrorMessage<>'') then
|
||||||
MainIDEInterface.DoJumpToCodeToolBossError;
|
MainIDEInterface.DoJumpToCodeToolBossError;
|
||||||
end;
|
end;
|
||||||
|
@ -80,12 +80,12 @@ type
|
|||||||
|
|
||||||
function CheckLFMBuffer(PascalBuffer, LFMBuffer: TCodeBuffer;
|
function CheckLFMBuffer(PascalBuffer, LFMBuffer: TCodeBuffer;
|
||||||
const OnOutput: TOnOutputString;
|
const OnOutput: TOnOutputString;
|
||||||
RootMustBeClassInIntf, ObjectsMustExists: boolean): boolean;
|
RootMustBeClassInIntf, ObjectsMustExists: boolean): TModalResult;
|
||||||
function CheckLFMText(PascalBuffer: TCodeBuffer; var LFMText: string;
|
function CheckLFMText(PascalBuffer: TCodeBuffer; var LFMText: string;
|
||||||
const OnOutput: TOnOutputString;
|
const OnOutput: TOnOutputString;
|
||||||
RootMustBeClassInIntf, ObjectsMustExists: boolean): boolean;
|
RootMustBeClassInIntf, ObjectsMustExists: boolean): TModalResult;
|
||||||
function ShowRepairLFMWizard(LFMBuffer: TCodeBuffer;
|
function ShowRepairLFMWizard(LFMBuffer: TCodeBuffer;
|
||||||
LFMTree: TLFMTree): boolean;
|
LFMTree: TLFMTree): TModalResult;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -99,7 +99,7 @@ type
|
|||||||
|
|
||||||
function CheckLFMBuffer(PascalBuffer, LFMBuffer: TCodeBuffer;
|
function CheckLFMBuffer(PascalBuffer, LFMBuffer: TCodeBuffer;
|
||||||
const OnOutput: TOnOutputString;
|
const OnOutput: TOnOutputString;
|
||||||
RootMustBeClassInIntf, ObjectsMustExists: boolean): boolean;
|
RootMustBeClassInIntf, ObjectsMustExists: boolean): TModalResult;
|
||||||
var
|
var
|
||||||
LFMTree: TLFMTree;
|
LFMTree: TLFMTree;
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FixMissingComponentClasses: boolean;
|
function FixMissingComponentClasses: TModalResult;
|
||||||
// returns true, if after adding units to uses section all errors are fixed
|
// returns true, if after adding units to uses section all errors are fixed
|
||||||
var
|
var
|
||||||
CurError: TLFMError;
|
CurError: TLFMError;
|
||||||
@ -134,7 +134,7 @@ var
|
|||||||
RegComp: TRegisteredComponent;
|
RegComp: TRegisteredComponent;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=mrCancel;
|
||||||
MissingObjectTypes:=TStringList.Create;
|
MissingObjectTypes:=TStringList.Create;
|
||||||
try
|
try
|
||||||
// collect all missing object types
|
// collect all missing object types
|
||||||
@ -157,29 +157,34 @@ var
|
|||||||
if MissingObjectTypes.Count=0 then exit;
|
if MissingObjectTypes.Count=0 then exit;
|
||||||
|
|
||||||
// there are missing object types with registered component classes
|
// there are missing object types with registered component classes
|
||||||
if PackageEditingInterface.AddUnitDependenciesForComponentClasses(
|
Result:=PackageEditingInterface.AddUnitDependenciesForComponentClasses(
|
||||||
PascalBuffer.Filename,MissingObjectTypes)<>mrOk
|
PascalBuffer.Filename,MissingObjectTypes);
|
||||||
then
|
if Result<>mrOk then exit;
|
||||||
exit;
|
|
||||||
|
|
||||||
// check LFM again
|
// check LFM again
|
||||||
LFMTree.Free;
|
LFMTree.Free;
|
||||||
LFMTree:=nil;
|
LFMTree:=nil;
|
||||||
Result:=CodeToolBoss.CheckLFM(PascalBuffer,LFMBuffer,LFMTree,
|
if CodeToolBoss.CheckLFM(PascalBuffer,LFMBuffer,LFMTree,
|
||||||
RootMustBeClassInIntf,ObjectsMustExists);
|
RootMustBeClassInIntf,ObjectsMustExists)
|
||||||
|
then
|
||||||
|
Result:=mrOk;
|
||||||
finally
|
finally
|
||||||
MissingObjectTypes.Free;
|
MissingObjectTypes.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
Result:=mrCancel;
|
||||||
LFMTree:=nil;
|
LFMTree:=nil;
|
||||||
try
|
try
|
||||||
Result:=CodeToolBoss.CheckLFM(PascalBuffer,LFMBuffer,LFMTree,
|
if CodeToolBoss.CheckLFM(PascalBuffer,LFMBuffer,LFMTree,
|
||||||
RootMustBeClassInIntf,ObjectsMustExists);
|
RootMustBeClassInIntf,ObjectsMustExists)
|
||||||
if Result then exit;
|
then begin
|
||||||
|
Result:=mrOk;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
Result:=FixMissingComponentClasses;
|
Result:=FixMissingComponentClasses;
|
||||||
if Result then exit;
|
if Result in [mrAbort,mrOk] then exit;
|
||||||
WriteLFMErrors;
|
WriteLFMErrors;
|
||||||
Result:=ShowRepairLFMWizard(LFMBuffer,LFMTree);
|
Result:=ShowRepairLFMWizard(LFMBuffer,LFMTree);
|
||||||
finally
|
finally
|
||||||
@ -189,11 +194,11 @@ end;
|
|||||||
|
|
||||||
function CheckLFMText(PascalBuffer: TCodeBuffer; var LFMText: string;
|
function CheckLFMText(PascalBuffer: TCodeBuffer; var LFMText: string;
|
||||||
const OnOutput: TOnOutputString;
|
const OnOutput: TOnOutputString;
|
||||||
RootMustBeClassInIntf, ObjectsMustExists: boolean): boolean;
|
RootMustBeClassInIntf, ObjectsMustExists: boolean): TModalResult;
|
||||||
var
|
var
|
||||||
LFMBuf: TCodeBuffer;
|
LFMBuf: TCodeBuffer;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=mrCancel;
|
||||||
LFMBuf:=CodeToolBoss.CreateTempFile('temp.lfm');
|
LFMBuf:=CodeToolBoss.CreateTempFile('temp.lfm');
|
||||||
try
|
try
|
||||||
LFMBuf.Source:=LFMText;
|
LFMBuf.Source:=LFMText;
|
||||||
@ -206,17 +211,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function ShowRepairLFMWizard(LFMBuffer: TCodeBuffer;
|
function ShowRepairLFMWizard(LFMBuffer: TCodeBuffer;
|
||||||
LFMTree: TLFMTree): boolean;
|
LFMTree: TLFMTree): TModalResult;
|
||||||
var
|
var
|
||||||
CheckLFMDialog: TCheckLFMDialog;
|
CheckLFMDialog: TCheckLFMDialog;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=mrCancel;
|
||||||
CheckLFMDialog:=TCheckLFMDialog.Create(Application);
|
CheckLFMDialog:=TCheckLFMDialog.Create(Application);
|
||||||
CheckLFMDialog.LFMTree:=LFMTree;
|
CheckLFMDialog.LFMTree:=LFMTree;
|
||||||
CheckLFMDialog.LFMSource:=LFMBuffer;
|
CheckLFMDialog.LFMSource:=LFMBuffer;
|
||||||
CheckLFMDialog.LoadLFM;
|
CheckLFMDialog.LoadLFM;
|
||||||
if CheckLFMDialog.ShowModal=mrOk then
|
Result:=CheckLFMDialog.ShowModal;
|
||||||
Result:=true;
|
|
||||||
CheckLFMDialog.Free;
|
CheckLFMDialog.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ uses
|
|||||||
MemCheck,
|
MemCheck,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
// LCL+FCL
|
// LCL+FCL
|
||||||
Classes, SysUtils, TypInfo, Math, Controls, Forms, Menus, Dialogs,
|
Classes, SysUtils, TypInfo, Math, LCLProc, Controls, Forms, Menus, Dialogs,
|
||||||
// components
|
// components
|
||||||
AVL_Tree, PropEdits, ObjectInspector, IDECommands,
|
AVL_Tree, PropEdits, ObjectInspector, IDECommands,
|
||||||
// IDE
|
// IDE
|
||||||
@ -119,6 +119,7 @@ each control that's dropped onto the form
|
|||||||
// component
|
// component
|
||||||
FSelection: TPersistentSelectionList;
|
FSelection: TPersistentSelectionList;
|
||||||
FObj_Inspector: TObjectInspector;
|
FObj_Inspector: TObjectInspector;
|
||||||
|
FDefineProperties: TAVLTree;
|
||||||
function GetPropertyEditorHook: TPropertyEditorHook;
|
function GetPropertyEditorHook: TPropertyEditorHook;
|
||||||
protected
|
protected
|
||||||
FNonControlForms: TAVLTree; // tree of TNonControlForm sorted for LookupRoot
|
FNonControlForms: TAVLTree; // tree of TNonControlForm sorted for LookupRoot
|
||||||
@ -198,6 +199,10 @@ each control that's dropped onto the form
|
|||||||
ParentControl: TWinControl): TIComponentInterface; override;
|
ParentControl: TWinControl): TIComponentInterface; override;
|
||||||
Procedure SetComponentNameAndClass(CI: TIComponentInterface;
|
Procedure SetComponentNameAndClass(CI: TIComponentInterface;
|
||||||
const NewName, NewClassName: shortstring);
|
const NewName, NewClassName: shortstring);
|
||||||
|
|
||||||
|
// define properties
|
||||||
|
procedure GetDefineProperties(const AComponentClassname: string;
|
||||||
|
List: TStrings);
|
||||||
|
|
||||||
// keys
|
// keys
|
||||||
function TranslateKeyToDesignerCommand(Key: word; Shift: TShiftState): word;
|
function TranslateKeyToDesignerCommand(Key: word; Shift: TShiftState): word;
|
||||||
@ -210,8 +215,50 @@ each control that's dropped onto the form
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TDefinePropertiesCacheItem }
|
||||||
|
|
||||||
|
TDefinePropertiesCacheItem = class
|
||||||
|
public
|
||||||
|
ComponentClassname: string;
|
||||||
|
RegisteredComponent: TRegisteredComponent;
|
||||||
|
DefineProperties: TStrings;
|
||||||
|
destructor Destroy; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TDefinePropertiesReader }
|
||||||
|
|
||||||
|
TDefinePropertiesReader = class(TFiler)
|
||||||
|
private
|
||||||
|
FDefinePropertyNames: TStrings;
|
||||||
|
protected
|
||||||
|
procedure AddPropertyName(const Name: string);
|
||||||
|
public
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure DefineProperty(const Name: string;
|
||||||
|
ReadData: TReaderProc; WriteData: TWriterProc;
|
||||||
|
HasData: Boolean); override;
|
||||||
|
procedure DefineBinaryProperty(const Name: string;
|
||||||
|
ReadData, WriteData: TStreamProc;
|
||||||
|
HasData: Boolean); override;
|
||||||
|
property DefinePropertyNames: TStrings read FDefinePropertyNames;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TDefinePropertiesComponent( }
|
||||||
|
|
||||||
|
TDefinePropertiesComponent = class(TComponent)
|
||||||
|
public
|
||||||
|
procedure PublicDefineProperties(Filer: TFiler);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function CompareComponentInterfaces(Data1, Data2: Pointer): integer;
|
function CompareComponentInterfaces(Data1, Data2: Pointer): integer;
|
||||||
function CompareComponentAndInterface(Key, Data: Pointer): integer;
|
function CompareComponentAndInterface(Key, Data: Pointer): integer;
|
||||||
|
function CompareDefPropCacheItems(Item1, Item2: TDefinePropertiesCacheItem): integer;
|
||||||
|
function CompareCompClassNameAndDefPropCacheItem(Key: Pointer;
|
||||||
|
Item: TDefinePropertiesCacheItem): integer;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -236,7 +283,19 @@ begin
|
|||||||
Result:=integer(AComponent)-integer(CompIntf.Component);
|
Result:=integer(AComponent)-integer(CompIntf.Component);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{TComponentInterface}
|
function CompareDefPropCacheItems(Item1, Item2: TDefinePropertiesCacheItem
|
||||||
|
): integer;
|
||||||
|
begin
|
||||||
|
Result:=CompareText(Item1.ComponentClassname,Item2.ComponentClassname);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CompareCompClassNameAndDefPropCacheItem(Key: Pointer;
|
||||||
|
Item: TDefinePropertiesCacheItem): integer;
|
||||||
|
begin
|
||||||
|
Result:=CompareText(AnsiString(Key),Item.ComponentClassname);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TComponentInterface }
|
||||||
|
|
||||||
constructor TComponentInterface.Create;
|
constructor TComponentInterface.Create;
|
||||||
begin
|
begin
|
||||||
@ -691,6 +750,8 @@ destructor TCustomFormEditor.Destroy;
|
|||||||
begin
|
begin
|
||||||
FormEditingHook:=nil;
|
FormEditingHook:=nil;
|
||||||
DesignerMenuItemClick:=nil;
|
DesignerMenuItemClick:=nil;
|
||||||
|
FDefineProperties.FreeAndClear;
|
||||||
|
FreeAndNil(FDefineProperties);
|
||||||
FreeAndNil(JITFormList);
|
FreeAndNil(JITFormList);
|
||||||
FreeAndNil(JITDataModuleList);
|
FreeAndNil(JITDataModuleList);
|
||||||
FreeAndNil(FComponentInterfaces);
|
FreeAndNil(FComponentInterfaces);
|
||||||
@ -1341,6 +1402,73 @@ begin
|
|||||||
AComponent.Name:=NewName;
|
AComponent.Name:=NewName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomFormEditor.GetDefineProperties(
|
||||||
|
const AComponentClassname: string; List: TStrings);
|
||||||
|
var
|
||||||
|
CacheItem: TDefinePropertiesCacheItem;
|
||||||
|
AComponent: TComponent;
|
||||||
|
DefinePropertiesReader: TDefinePropertiesReader;
|
||||||
|
ANode: TAVLTreeNode;
|
||||||
|
begin
|
||||||
|
List.Clear;
|
||||||
|
if FDefineProperties=nil then
|
||||||
|
FDefineProperties:=TAVLTree.Create(@CompareDefPropCacheItems);
|
||||||
|
ANode:=FDefineProperties.FindKey(PChar(AComponentClassname),
|
||||||
|
@CompareCompClassNameAndDefPropCacheItem);
|
||||||
|
if ANode=nil then begin
|
||||||
|
// cache component class, try to retrieve the define properties
|
||||||
|
CacheItem:=TDefinePropertiesCacheItem.Create;
|
||||||
|
CacheItem.ComponentClassname:=AComponentClassname;
|
||||||
|
FDefineProperties.Add(CacheItem);
|
||||||
|
CacheItem.RegisteredComponent:=IDEComponentPalette.FindComponent(
|
||||||
|
AComponentClassname);
|
||||||
|
if (CacheItem.RegisteredComponent<>nil)
|
||||||
|
and (CacheItem.RegisteredComponent.ComponentClass<>nil) then begin
|
||||||
|
// try creating a component class and call DefineProperties
|
||||||
|
AComponent:=nil;
|
||||||
|
DefinePropertiesReader:=nil;
|
||||||
|
try
|
||||||
|
try
|
||||||
|
AComponent:=CacheItem.RegisteredComponent.ComponentClass.Create(nil);
|
||||||
|
DefinePropertiesReader:=TDefinePropertiesReader.Create;
|
||||||
|
TDefinePropertiesComponent(AComponent).PublicDefineProperties(
|
||||||
|
DefinePropertiesReader);
|
||||||
|
except
|
||||||
|
on E: Exception do begin
|
||||||
|
debugln('TCustomFormEditor.GetDefineProperties Error creating ',
|
||||||
|
CacheItem.RegisteredComponent.ComponentClass.Classname,
|
||||||
|
': ',E.Message);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
try
|
||||||
|
AComponent.Free;
|
||||||
|
except
|
||||||
|
on E: Exception do begin
|
||||||
|
debugln('TCustomFormEditor.GetDefineProperties Error freeing ',
|
||||||
|
CacheItem.RegisteredComponent.ComponentClass.Classname,
|
||||||
|
': ',E.Message);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
// cache defined properties
|
||||||
|
if (DefinePropertiesReader<>nil)
|
||||||
|
and (DefinePropertiesReader.DefinePropertyNames<>nil) then begin
|
||||||
|
CacheItem.DefineProperties:=TStringList.Create;
|
||||||
|
CacheItem.DefineProperties.Assign(
|
||||||
|
DefinePropertiesReader.DefinePropertyNames);
|
||||||
|
debugln('TCustomFormEditor.GetDefineProperties CompClass=',AComponentClassname,
|
||||||
|
' DefineProps=',CacheItem.DefineProperties.Text);
|
||||||
|
DefinePropertiesReader.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
CacheItem:=TDefinePropertiesCacheItem(ANode.Data);
|
||||||
|
end;
|
||||||
|
if CacheItem.DefineProperties<>nil then
|
||||||
|
List.Assign(CacheItem.DefineProperties);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomFormEditor.JITListReaderError(Sender: TObject;
|
procedure TCustomFormEditor.JITListReaderError(Sender: TObject;
|
||||||
ErrorType: TJITFormError; var Action: TModalResult);
|
ErrorType: TJITFormError; var Action: TModalResult);
|
||||||
var
|
var
|
||||||
@ -1526,5 +1654,47 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TDefinePropertiesCacheItem }
|
||||||
|
|
||||||
|
destructor TDefinePropertiesCacheItem.Destroy;
|
||||||
|
begin
|
||||||
|
DefineProperties.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TDefinePropertiesReader }
|
||||||
|
|
||||||
|
procedure TDefinePropertiesReader.AddPropertyName(const Name: string);
|
||||||
|
begin
|
||||||
|
if FDefinePropertyNames=nil then FDefinePropertyNames:=TStringList.Create;
|
||||||
|
if FDefinePropertyNames.IndexOf(Name)<=0 then
|
||||||
|
FDefinePropertyNames.Add(Name);
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TDefinePropertiesReader.Destroy;
|
||||||
|
begin
|
||||||
|
FDefinePropertyNames.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDefinePropertiesReader.DefineProperty(const Name: string;
|
||||||
|
ReadData: TReaderProc; WriteData: TWriterProc; HasData: Boolean);
|
||||||
|
begin
|
||||||
|
AddPropertyName(Name);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDefinePropertiesReader.DefineBinaryProperty(const Name: string;
|
||||||
|
ReadData, WriteData: TStreamProc; HasData: Boolean);
|
||||||
|
begin
|
||||||
|
AddPropertyName(Name);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TDefinePropertiesComponent }
|
||||||
|
|
||||||
|
procedure TDefinePropertiesComponent.PublicDefineProperties(Filer: TFiler);
|
||||||
|
begin
|
||||||
|
DefineProperties(Filer);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
25
ide/main.pp
25
ide/main.pp
@ -386,12 +386,14 @@ type
|
|||||||
var Abort: boolean);
|
var Abort: boolean);
|
||||||
procedure OnAfterCodeToolBossApplyChanges(Manager: TCodeToolManager);
|
procedure OnAfterCodeToolBossApplyChanges(Manager: TCodeToolManager);
|
||||||
function OnCodeToolBossSearchUsedUnit(const SrcFilename: string;
|
function OnCodeToolBossSearchUsedUnit(const SrcFilename: string;
|
||||||
const TheUnitName, TheUnitInFilename: string): TCodeBuffer;
|
const TheUnitName, TheUnitInFilename: string): TCodeBuffer;
|
||||||
function OnCodeToolBossCheckAbort: boolean;
|
function OnCodeToolBossCheckAbort: boolean;
|
||||||
procedure CodeToolBossGetVirtualDirectoryAlias(Sender: TObject;
|
procedure CodeToolBossGetVirtualDirectoryAlias(Sender: TObject;
|
||||||
var RealDir: string);
|
var RealDir: string);
|
||||||
procedure CodeToolBossGetVirtualDirectoryDefines(DefTree: TDefineTree;
|
procedure CodeToolBossGetVirtualDirectoryDefines(DefTree: TDefineTree;
|
||||||
DirDef: TDirectoryDefines);
|
DirDef: TDirectoryDefines);
|
||||||
|
procedure OnCodeToolBossGetDefineProperties(Sender: TObject;
|
||||||
|
const ComponentClassName: string; var List: TStrings);
|
||||||
function MacroFunctionProject(Data: Pointer): boolean;
|
function MacroFunctionProject(Data: Pointer): boolean;
|
||||||
procedure OnCompilerGraphStampIncreased;
|
procedure OnCompilerGraphStampIncreased;
|
||||||
|
|
||||||
@ -6550,8 +6552,8 @@ begin
|
|||||||
DoArrangeSourceEditorAndMessageView(false);
|
DoArrangeSourceEditorAndMessageView(false);
|
||||||
|
|
||||||
// parse the LFM file and the pascal unit
|
// parse the LFM file and the pascal unit
|
||||||
if not CheckLFMBuffer(PascalBuf,LFMUnitInfo.Source,@MessagesView.AddMsg,
|
if CheckLFMBuffer(PascalBuf,LFMUnitInfo.Source,@MessagesView.AddMsg,
|
||||||
true,true)
|
true,true)<>mrOk
|
||||||
then begin
|
then begin
|
||||||
DoJumpToCompilerMessage(-1,true);
|
DoJumpToCompilerMessage(-1,true);
|
||||||
end;
|
end;
|
||||||
@ -6638,7 +6640,7 @@ begin
|
|||||||
if HasDFMFile and (LFMCode=nil) then
|
if HasDFMFile and (LFMCode=nil) then
|
||||||
writeln('WARNING: TMainIDE.DoConvertDelphiUnit unable to load LFMCode');
|
writeln('WARNING: TMainIDE.DoConvertDelphiUnit unable to load LFMCode');
|
||||||
if (LFMCode<>nil)
|
if (LFMCode<>nil)
|
||||||
and (not CheckLFMBuffer(UnitCode,LFMCode,@MessagesView.AddMsg,true,true))
|
and (CheckLFMBuffer(UnitCode,LFMCode,@MessagesView.AddMsg,true,true)<>mrOk)
|
||||||
then begin
|
then begin
|
||||||
DoJumpToCompilerMessage(-1,true);
|
DoJumpToCompilerMessage(-1,true);
|
||||||
exit;
|
exit;
|
||||||
@ -8575,6 +8577,7 @@ begin
|
|||||||
OnBeforeApplyChanges:=@OnBeforeCodeToolBossApplyChanges;
|
OnBeforeApplyChanges:=@OnBeforeCodeToolBossApplyChanges;
|
||||||
OnAfterApplyChanges:=@OnAfterCodeToolBossApplyChanges;
|
OnAfterApplyChanges:=@OnAfterCodeToolBossApplyChanges;
|
||||||
OnSearchUsedUnit:=@OnCodeToolBossSearchUsedUnit;
|
OnSearchUsedUnit:=@OnCodeToolBossSearchUsedUnit;
|
||||||
|
OnGetDefinePropertiesForClass:=@OnCodeToolBossGetDefineProperties;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeToolsOpts.AssignGlobalDefineTemplatesToTree(CodeToolBoss.DefineTree);
|
CodeToolsOpts.AssignGlobalDefineTemplatesToTree(CodeToolBoss.DefineTree);
|
||||||
@ -8776,6 +8779,13 @@ begin
|
|||||||
Project1.GetVirtualDefines(DefTree,DirDef);
|
Project1.GetVirtualDefines(DefTree,DirDef);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.OnCodeToolBossGetDefineProperties(Sender: TObject;
|
||||||
|
const ComponentClassName: string; var List: TStrings);
|
||||||
|
begin
|
||||||
|
List:=TStringList.Create;
|
||||||
|
FormEditor1.GetDefineProperties(ComponentClassName,List);
|
||||||
|
end;
|
||||||
|
|
||||||
function TMainIDE.MacroFunctionProject(Data: Pointer): boolean;
|
function TMainIDE.MacroFunctionProject(Data: Pointer): boolean;
|
||||||
var
|
var
|
||||||
FuncData: PReadFunctionData;
|
FuncData: PReadFunctionData;
|
||||||
@ -10533,6 +10543,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.749 2004/08/09 15:46:34 mattias
|
||||||
|
implemented getting define properties for Repair broken LFM wizard
|
||||||
|
|
||||||
Revision 1.748 2004/08/08 21:52:01 mattias
|
Revision 1.748 2004/08/08 21:52:01 mattias
|
||||||
change component class dlg now works with child controls
|
change component class dlg now works with child controls
|
||||||
|
|
||||||
|
@ -212,7 +212,6 @@ else
|
|||||||
UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
|
UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
|
||||||
endif
|
endif
|
||||||
PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
|
PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
|
||||||
override TARGET_DIRS+=registration
|
|
||||||
override CLEAN_FILES+=$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))
|
override CLEAN_FILES+=$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))
|
||||||
ifdef REQUIRE_UNITSDIR
|
ifdef REQUIRE_UNITSDIR
|
||||||
override UNITSDIR+=$(REQUIRE_UNITSDIR)
|
override UNITSDIR+=$(REQUIRE_UNITSDIR)
|
||||||
@ -1391,68 +1390,24 @@ endif
|
|||||||
fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
|
fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
|
||||||
fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
|
fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
|
||||||
fpc_makefiles: fpc_makefile fpc_makefile_dirs
|
fpc_makefiles: fpc_makefile fpc_makefile_dirs
|
||||||
TARGET_DIRS_REGISTRATION=1
|
all:
|
||||||
ifdef TARGET_DIRS_REGISTRATION
|
debug:
|
||||||
registration_all:
|
smart:
|
||||||
$(MAKE) -C registration all
|
release:
|
||||||
registration_debug:
|
examples:
|
||||||
$(MAKE) -C registration debug
|
shared:
|
||||||
registration_smart:
|
install:
|
||||||
$(MAKE) -C registration smart
|
sourceinstall:
|
||||||
registration_release:
|
exampleinstall:
|
||||||
$(MAKE) -C registration release
|
distinstall:
|
||||||
registration_examples:
|
zipinstall:
|
||||||
$(MAKE) -C registration examples
|
zipsourceinstall:
|
||||||
registration_shared:
|
zipexampleinstall:
|
||||||
$(MAKE) -C registration shared
|
zipdistinstall:
|
||||||
registration_install:
|
clean: fpc_clean
|
||||||
$(MAKE) -C registration install
|
distclean: fpc_distclean
|
||||||
registration_sourceinstall:
|
|
||||||
$(MAKE) -C registration sourceinstall
|
|
||||||
registration_exampleinstall:
|
|
||||||
$(MAKE) -C registration exampleinstall
|
|
||||||
registration_distinstall:
|
|
||||||
$(MAKE) -C registration distinstall
|
|
||||||
registration_zipinstall:
|
|
||||||
$(MAKE) -C registration zipinstall
|
|
||||||
registration_zipsourceinstall:
|
|
||||||
$(MAKE) -C registration zipsourceinstall
|
|
||||||
registration_zipexampleinstall:
|
|
||||||
$(MAKE) -C registration zipexampleinstall
|
|
||||||
registration_zipdistinstall:
|
|
||||||
$(MAKE) -C registration zipdistinstall
|
|
||||||
registration_clean:
|
|
||||||
$(MAKE) -C registration clean
|
|
||||||
registration_distclean:
|
|
||||||
$(MAKE) -C registration distclean
|
|
||||||
registration_cleanall:
|
|
||||||
$(MAKE) -C registration cleanall
|
|
||||||
registration_info:
|
|
||||||
$(MAKE) -C registration info
|
|
||||||
registration_makefiles:
|
|
||||||
$(MAKE) -C registration makefiles
|
|
||||||
registration:
|
|
||||||
$(MAKE) -C registration all
|
|
||||||
.PHONY: registration_all registration_debug registration_smart registration_release registration_examples registration_shared registration_install registration_sourceinstall registration_exampleinstall registration_distinstall registration_zipinstall registration_zipsourceinstall registration_zipexampleinstall registration_zipdistinstall registration_clean registration_distclean registration_cleanall registration_info registration_makefiles registration
|
|
||||||
endif
|
|
||||||
all: $(addsuffix _all,$(TARGET_DIRS))
|
|
||||||
debug: $(addsuffix _debug,$(TARGET_DIRS))
|
|
||||||
smart: $(addsuffix _smart,$(TARGET_DIRS))
|
|
||||||
release: $(addsuffix _release,$(TARGET_DIRS))
|
|
||||||
examples: $(addsuffix _examples,$(TARGET_DIRS))
|
|
||||||
shared: $(addsuffix _shared,$(TARGET_DIRS))
|
|
||||||
install: $(addsuffix _install,$(TARGET_DIRS))
|
|
||||||
sourceinstall: $(addsuffix _sourceinstall,$(TARGET_DIRS))
|
|
||||||
exampleinstall: $(addsuffix _exampleinstall,$(TARGET_DIRS))
|
|
||||||
distinstall: $(addsuffix _distinstall,$(TARGET_DIRS))
|
|
||||||
zipinstall: $(addsuffix _zipinstall,$(TARGET_DIRS))
|
|
||||||
zipsourceinstall: $(addsuffix _zipsourceinstall,$(TARGET_DIRS))
|
|
||||||
zipexampleinstall: $(addsuffix _zipexampleinstall,$(TARGET_DIRS))
|
|
||||||
zipdistinstall: $(addsuffix _zipdistinstall,$(TARGET_DIRS))
|
|
||||||
clean: fpc_clean $(addsuffix _clean,$(TARGET_DIRS))
|
|
||||||
distclean: fpc_distclean $(addsuffix _distclean,$(TARGET_DIRS))
|
|
||||||
info: fpc_info
|
info: fpc_info
|
||||||
makefiles: fpc_makefiles $(addsuffix _makefiles,$(TARGET_DIRS))
|
makefiles: fpc_makefiles
|
||||||
.PHONY: all debug smart release examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean info makefiles
|
.PHONY: all debug smart release examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean info makefiles
|
||||||
ifneq ($(wildcard fpcmake.loc),)
|
ifneq ($(wildcard fpcmake.loc),)
|
||||||
include fpcmake.loc
|
include fpcmake.loc
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
[target]
|
[target]
|
||||||
dirs=registration
|
|
||||||
|
|
||||||
[clean]
|
[clean]
|
||||||
files=$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))
|
files=$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))
|
||||||
|
Loading…
Reference in New Issue
Block a user