mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-10 13:18:14 +02:00
fixed package editor autosizing. define templates are now all updated after editing graph properties
git-svn-id: trunk@8281 -
This commit is contained in:
parent
e90ca7f263
commit
dfdf56a0cd
@ -303,6 +303,7 @@ type
|
|||||||
FMacroVariables: TKeyWordFunctionList;
|
FMacroVariables: TKeyWordFunctionList;
|
||||||
FOnGetVirtualDirectoryAlias: TOnGetVirtualDirectoryAlias;
|
FOnGetVirtualDirectoryAlias: TOnGetVirtualDirectoryAlias;
|
||||||
FOnGetVirtualDirectoryDefines: TOnGetVirtualDirectoryDefines;
|
FOnGetVirtualDirectoryDefines: TOnGetVirtualDirectoryDefines;
|
||||||
|
FOnPrepareTree: TNotifyEvent;
|
||||||
FOnReadValue: TOnReadValue;
|
FOnReadValue: TOnReadValue;
|
||||||
FVirtualDirCache: TDirectoryDefines;
|
FVirtualDirCache: TDirectoryDefines;
|
||||||
function Calculate(DirDef: TDirectoryDefines): boolean;
|
function Calculate(DirDef: TDirectoryDefines): boolean;
|
||||||
@ -317,6 +318,7 @@ type
|
|||||||
function MacroFuncExtractFileName(Data: Pointer): boolean;
|
function MacroFuncExtractFileName(Data: Pointer): boolean;
|
||||||
function MacroFuncExtractFileNameOnly(Data: Pointer): boolean;
|
function MacroFuncExtractFileNameOnly(Data: Pointer): boolean;
|
||||||
procedure DoClearCache;
|
procedure DoClearCache;
|
||||||
|
procedure DoPrepareTree;
|
||||||
public
|
public
|
||||||
property RootTemplate: TDefineTemplate
|
property RootTemplate: TDefineTemplate
|
||||||
read FFirstDefineTemplate write FFirstDefineTemplate;
|
read FFirstDefineTemplate write FFirstDefineTemplate;
|
||||||
@ -328,6 +330,7 @@ type
|
|||||||
property OnGetVirtualDirectoryDefines: TOnGetVirtualDirectoryDefines
|
property OnGetVirtualDirectoryDefines: TOnGetVirtualDirectoryDefines
|
||||||
read FOnGetVirtualDirectoryDefines write FOnGetVirtualDirectoryDefines;
|
read FOnGetVirtualDirectoryDefines write FOnGetVirtualDirectoryDefines;
|
||||||
property OnReadValue: TOnReadValue read FOnReadValue write FOnReadValue;
|
property OnReadValue: TOnReadValue read FOnReadValue write FOnReadValue;
|
||||||
|
property OnPrepareTree: TNotifyEvent read FOnPrepareTree write FOnPrepareTree;
|
||||||
property MacroFunctions: TKeyWordFunctionList read FMacroFunctions;
|
property MacroFunctions: TKeyWordFunctionList read FMacroFunctions;
|
||||||
property MacroVariables: TKeyWordFunctionList read FMacroVariables;
|
property MacroVariables: TKeyWordFunctionList read FMacroVariables;
|
||||||
public
|
public
|
||||||
@ -1766,6 +1769,7 @@ var
|
|||||||
begin
|
begin
|
||||||
//DebugLn('[TDefineTree.GetDirDefinesForDirectory] "',Path,'"');
|
//DebugLn('[TDefineTree.GetDirDefinesForDirectory] "',Path,'"');
|
||||||
if (Path<>'') or (not WithVirtualDir) then begin
|
if (Path<>'') or (not WithVirtualDir) then begin
|
||||||
|
DoPrepareTree;
|
||||||
ExpPath:=TrimFilename(Path);
|
ExpPath:=TrimFilename(Path);
|
||||||
if (ExpPath<>'') and (ExpPath[length(ExpPath)]<>PathDelim) then
|
if (ExpPath<>'') and (ExpPath[length(ExpPath)]<>PathDelim) then
|
||||||
ExpPath:=ExpPath+PathDelim;
|
ExpPath:=ExpPath+PathDelim;
|
||||||
@ -1790,6 +1794,7 @@ end;
|
|||||||
|
|
||||||
function TDefineTree.GetDirDefinesForVirtualDirectory: TDirectoryDefines;
|
function TDefineTree.GetDirDefinesForVirtualDirectory: TDirectoryDefines;
|
||||||
begin
|
begin
|
||||||
|
DoPrepareTree;
|
||||||
if FVirtualDirCache=nil then begin
|
if FVirtualDirCache=nil then begin
|
||||||
//DebugLn('################ TDefineTree.GetDirDefinesForVirtualDirectory');
|
//DebugLn('################ TDefineTree.GetDirDefinesForVirtualDirectory');
|
||||||
FVirtualDirCache:=TDirectoryDefines.Create;
|
FVirtualDirCache:=TDirectoryDefines.Create;
|
||||||
@ -1853,6 +1858,11 @@ begin
|
|||||||
IncreaseChangeStep;
|
IncreaseChangeStep;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDefineTree.DoPrepareTree;
|
||||||
|
begin
|
||||||
|
if Assigned(OnPrepareTree) then OnPrepareTree(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TDefineTree.RemoveMarked;
|
procedure TDefineTree.RemoveMarked;
|
||||||
begin
|
begin
|
||||||
if FFirstDefineTemplate=nil then exit;
|
if FFirstDefineTemplate=nil then exit;
|
||||||
|
@ -787,7 +787,7 @@ begin
|
|||||||
Add('NOT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('NOT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('OBJECT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('OBJECT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('OF',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('OF',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
//Add('OPERATOR',{$ifdef FPC}@{$endif}AllwaysTrue); // not for Delphi
|
Add('OPERATOR',{$ifdef FPC}@{$endif}AllwaysTrue); // not for Delphi
|
||||||
//Add('ON',{$ifdef FPC}@{$endif}AllwaysTrue); // not for Delphi
|
//Add('ON',{$ifdef FPC}@{$endif}AllwaysTrue); // not for Delphi
|
||||||
//Add('OUT',{$ifdef FPC}@{$endif}AllwaysTrue); // not in MacPas mode
|
//Add('OUT',{$ifdef FPC}@{$endif}AllwaysTrue); // not in MacPas mode
|
||||||
Add('OR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('OR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
|
@ -1064,16 +1064,19 @@ begin
|
|||||||
Options.ExecuteAfter.ShowAllMessages:=ExecuteAfterShowAllCheckBox.Checked;
|
Options.ExecuteAfter.ShowAllMessages:=ExecuteAfterShowAllCheckBox.Checked;
|
||||||
if Options.ExecuteAfter is TProjectCompilationTool
|
if Options.ExecuteAfter is TProjectCompilationTool
|
||||||
then begin
|
then begin
|
||||||
TProjectCompilationTool(Options.ExecuteAfter).CompileReasons := MakeCompileReasons(
|
TProjectCompilationTool(Options.ExecuteAfter).CompileReasons :=
|
||||||
chkExecAfterCompile,
|
MakeCompileReasons(
|
||||||
chkExecAfterBuild,
|
chkExecAfterCompile,
|
||||||
chkExecAfterRun
|
chkExecAfterBuild,
|
||||||
);
|
chkExecAfterRun
|
||||||
|
);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// check for change and save
|
// check for change and save
|
||||||
if not OldCompOpts.IsEqual(Options)
|
if not OldCompOpts.IsEqual(Options) then begin
|
||||||
then Options.Modified:=true;
|
Options.Modified:=true;
|
||||||
|
IncreaseCompilerGraphStamp;
|
||||||
|
end;
|
||||||
OldCompOpts.Free;
|
OldCompOpts.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
17
ide/main.pp
17
ide/main.pp
@ -432,6 +432,7 @@ type
|
|||||||
procedure OnCodeToolBossFindDefineProperty(Sender: TObject;
|
procedure OnCodeToolBossFindDefineProperty(Sender: TObject;
|
||||||
const PersistentClassName, AncestorClassName, Identifier: string;
|
const PersistentClassName, AncestorClassName, Identifier: string;
|
||||||
var IsDefined: boolean);
|
var IsDefined: boolean);
|
||||||
|
procedure CodeToolBossPrepareTree(Sender: TObject);
|
||||||
function MacroFunctionProject(Data: Pointer): boolean;
|
function MacroFunctionProject(Data: Pointer): boolean;
|
||||||
procedure OnCompilerGraphStampIncreased;
|
procedure OnCompilerGraphStampIncreased;
|
||||||
|
|
||||||
@ -456,6 +457,7 @@ type
|
|||||||
|
|
||||||
FRunProcess: TProcess; // temp solution, will be replaced by dummydebugger
|
FRunProcess: TProcess; // temp solution, will be replaced by dummydebugger
|
||||||
|
|
||||||
|
FRebuildingCompilerGraphCodeToolsDefinesNeeded: boolean;
|
||||||
protected
|
protected
|
||||||
procedure SetToolStatus(const AValue: TIDEToolStatus); override;
|
procedure SetToolStatus(const AValue: TIDEToolStatus); override;
|
||||||
function DoResetToolStatus(Interactive: boolean): boolean;
|
function DoResetToolStatus(Interactive: boolean): boolean;
|
||||||
@ -10054,6 +10056,7 @@ begin
|
|||||||
@CodeToolBossGetVirtualDirectoryAlias;
|
@CodeToolBossGetVirtualDirectoryAlias;
|
||||||
CodeToolBoss.DefineTree.OnGetVirtualDirectoryDefines:=
|
CodeToolBoss.DefineTree.OnGetVirtualDirectoryDefines:=
|
||||||
@CodeToolBossGetVirtualDirectoryDefines;
|
@CodeToolBossGetVirtualDirectoryDefines;
|
||||||
|
CodeToolBoss.DefineTree.OnPrepareTree:=@CodeToolBossPrepareTree;
|
||||||
|
|
||||||
CodeToolBoss.DefineTree.MacroFunctions.AddExtended(
|
CodeToolBoss.DefineTree.MacroFunctions.AddExtended(
|
||||||
'PROJECT',nil,@MacroFunctionProject);
|
'PROJECT',nil,@MacroFunctionProject);
|
||||||
@ -10368,6 +10371,18 @@ begin
|
|||||||
Identifier,IsDefined);
|
Identifier,IsDefined);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.CodeToolBossPrepareTree(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if FRebuildingCompilerGraphCodeToolsDefinesNeeded then begin
|
||||||
|
FRebuildingCompilerGraphCodeToolsDefinesNeeded:=false;
|
||||||
|
CodeToolBoss.DefineTree.ClearCache;
|
||||||
|
if Project1<>nil then
|
||||||
|
Project1.DefineTemplates.AllChanged;
|
||||||
|
PkgBoss.RebuildDefineTemplates;
|
||||||
|
//DebugLn('TMainIDE.CodeToolBossPrepareTree CompilerGraphStamp=',dbgs(CompilerGraphStamp));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TMainIDE.MacroFunctionProject(Data: Pointer): boolean;
|
function TMainIDE.MacroFunctionProject(Data: Pointer): boolean;
|
||||||
var
|
var
|
||||||
FuncData: PReadFunctionData;
|
FuncData: PReadFunctionData;
|
||||||
@ -10392,7 +10407,7 @@ end;
|
|||||||
|
|
||||||
procedure TMainIDE.OnCompilerGraphStampIncreased;
|
procedure TMainIDE.OnCompilerGraphStampIncreased;
|
||||||
begin
|
begin
|
||||||
CodeToolBoss.DefineTree.ClearCache;
|
FRebuildingCompilerGraphCodeToolsDefinesNeeded:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.SaveSourceEditorChangesToCodeCache(PageIndex: integer);
|
procedure TMainIDE.SaveSourceEditorChangesToCodeCache(PageIndex: integer);
|
||||||
|
@ -130,6 +130,7 @@ type
|
|||||||
|
|
||||||
// package graph
|
// package graph
|
||||||
procedure DoShowPackageGraphPathList(PathList: TList); virtual; abstract;
|
procedure DoShowPackageGraphPathList(PathList: TList); virtual; abstract;
|
||||||
|
procedure RebuildDefineTemplates; virtual; abstract;
|
||||||
|
|
||||||
// package compilation
|
// package compilation
|
||||||
function DoCompileProjectDependencies(AProject: TProject;
|
function DoCompileProjectDependencies(AProject: TProject;
|
||||||
|
@ -390,15 +390,7 @@ begin
|
|||||||
HelpBitBtn.SetBounds(x,y1,ClientWidth-x,h);
|
HelpBitBtn.SetBounds(x,y1,ClientWidth-x,h);
|
||||||
MoreBitBtn.SetBounds(x,y2,ClientWidth-x,h);
|
MoreBitBtn.SetBounds(x,y2,ClientWidth-x,h);
|
||||||
|
|
||||||
x:=0;
|
FilePropsGroupBox.Height:=120;
|
||||||
y:=y2+h+2;
|
|
||||||
w:=ClientWidth;
|
|
||||||
h:=Max(10,ClientHeight-y-123-StatusBar.Height);
|
|
||||||
FilesTreeView.SetBounds(x,y,w,h);
|
|
||||||
|
|
||||||
inc(y,h+3);
|
|
||||||
h:=120;
|
|
||||||
FilePropsGroupBox.SetBounds(x,y,w,h);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.PublishClick(Sender: TObject);
|
procedure TPackageEditorForm.PublishClick(Sender: TObject);
|
||||||
@ -1215,8 +1207,7 @@ begin
|
|||||||
PackageEditors.OnImExportCompilerOptions;
|
PackageEditors.OnImExportCompilerOptions;
|
||||||
with CompilerOptsDlg do begin
|
with CompilerOptsDlg do begin
|
||||||
GetCompilerOptions;
|
GetCompilerOptions;
|
||||||
Caption:=Format(lisPckEditCompilerOptionsForPackage, [LazPackage.IDAsString]
|
Caption:=Format(lisPckEditCompilerOptionsForPackage,[LazPackage.IDAsString]);
|
||||||
);
|
|
||||||
ReadOnly:=LazPackage.ReadOnly;
|
ReadOnly:=LazPackage.ReadOnly;
|
||||||
ShowModal;
|
ShowModal;
|
||||||
Free;
|
Free;
|
||||||
@ -1410,6 +1401,7 @@ begin
|
|||||||
OnSelectionChanged:=@FilesTreeViewSelectionChanged;
|
OnSelectionChanged:=@FilesTreeViewSelectionChanged;
|
||||||
Options:=Options+[tvoRightClickSelect];
|
Options:=Options+[tvoRightClickSelect];
|
||||||
OnDblClick:=@FilesTreeViewDblClick;
|
OnDblClick:=@FilesTreeViewDblClick;
|
||||||
|
Anchors:=[akLeft,akRight,akTop,akBottom];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FilePropsGroupBox:=TGroupBox.Create(Self);
|
FilePropsGroupBox:=TGroupBox.Create(Self);
|
||||||
@ -1418,6 +1410,7 @@ begin
|
|||||||
Parent:=Self;
|
Parent:=Self;
|
||||||
Caption:=lisPckEditFileProperties;
|
Caption:=lisPckEditFileProperties;
|
||||||
OnResize:=@FilePropsGroupBoxResize;
|
OnResize:=@FilePropsGroupBoxResize;
|
||||||
|
Anchors:=[akLeft,akRight,akBottom];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CallRegisterProcCheckBox:=TCheckBox.Create(Self);
|
CallRegisterProcCheckBox:=TCheckBox.Create(Self);
|
||||||
@ -1506,6 +1499,16 @@ begin
|
|||||||
Parent:=Self;
|
Parent:=Self;
|
||||||
Align:=alBottom;
|
Align:=alBottom;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
FilePropsGroupBox.AnchorParallel(akLeft,0,Self);
|
||||||
|
FilePropsGroupBox.AnchorParallel(akRight,0,Self);
|
||||||
|
FilePropsGroupBox.AnchorToNeighbour(akBottom,0,StatusBar);
|
||||||
|
FilePropsGroupBox.Height:=120;
|
||||||
|
|
||||||
|
FilesTreeView.AnchorToNeighbour(akTop,0,CompileBitBtn);
|
||||||
|
FilesTreeView.AnchorParallel(akLeft,0,Self);
|
||||||
|
FilesTreeView.AnchorParallel(akRight,0,Self);
|
||||||
|
FilesTreeView.AnchorToNeighbour(akBottom,0,FilePropsGroupBox);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.UpdateAll;
|
procedure TPackageEditorForm.UpdateAll;
|
||||||
|
@ -120,10 +120,11 @@ type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
procedure Delete(Index: integer);
|
procedure Delete(Index: integer);
|
||||||
function Count: integer;
|
function Count: integer; // number of Packages
|
||||||
procedure BeginUpdate(Change: boolean);
|
procedure BeginUpdate(Change: boolean);
|
||||||
procedure EndUpdate;
|
procedure EndUpdate;
|
||||||
function Updating: boolean;
|
function Updating: boolean;
|
||||||
|
procedure RebuildDefineTemplates;
|
||||||
public
|
public
|
||||||
// searching
|
// searching
|
||||||
function CheckIfPackageCanBeClosed(APackage: TLazPackage): boolean;
|
function CheckIfPackageCanBeClosed(APackage: TLazPackage): boolean;
|
||||||
@ -259,7 +260,7 @@ type
|
|||||||
property OnDeletePackage: TPkgDeleteEvent read FOnDeletePackage
|
property OnDeletePackage: TPkgDeleteEvent read FOnDeletePackage
|
||||||
write FOnDeletePackage;
|
write FOnDeletePackage;
|
||||||
property OnEndUpdate: TEndUpdateEvent read FOnEndUpdate write FOnEndUpdate;
|
property OnEndUpdate: TEndUpdateEvent read FOnEndUpdate write FOnEndUpdate;
|
||||||
property Packages[Index: integer]: TLazPackage read GetPackages; default;
|
property Packages[Index: integer]: TLazPackage read GetPackages; default; // see Count for the number
|
||||||
property RegistrationFile: TPkgFile read FRegistrationFile;
|
property RegistrationFile: TPkgFile read FRegistrationFile;
|
||||||
property RegistrationPackage: TLazPackage read FRegistrationPackage
|
property RegistrationPackage: TLazPackage read FRegistrationPackage
|
||||||
write SetRegistrationPackage;
|
write SetRegistrationPackage;
|
||||||
@ -462,6 +463,14 @@ begin
|
|||||||
Result:=FUpdateLock>0;
|
Result:=FUpdateLock>0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLazPackageGraph.RebuildDefineTemplates;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
for i:=0 to Count-1 do
|
||||||
|
Packages[i].DefineTemplates.AllChanged;
|
||||||
|
end;
|
||||||
|
|
||||||
function TLazPackageGraph.FindLowestPkgNodeByName(const PkgName: string
|
function TLazPackageGraph.FindLowestPkgNodeByName(const PkgName: string
|
||||||
): TAVLTreeNode;
|
): TAVLTreeNode;
|
||||||
var
|
var
|
||||||
|
@ -233,6 +233,7 @@ type
|
|||||||
function DoShowPackageGraph: TModalResult;
|
function DoShowPackageGraph: TModalResult;
|
||||||
procedure DoShowPackageGraphPathList(PathList: TList); override;
|
procedure DoShowPackageGraphPathList(PathList: TList); override;
|
||||||
function ShowBrokenDependenciesReport(Dependencies: TList): TModalResult;
|
function ShowBrokenDependenciesReport(Dependencies: TList): TModalResult;
|
||||||
|
procedure RebuildDefineTemplates; override;
|
||||||
|
|
||||||
// project
|
// project
|
||||||
function OpenProjectDependencies(AProject: TProject;
|
function OpenProjectDependencies(AProject: TProject;
|
||||||
@ -2747,6 +2748,11 @@ begin
|
|||||||
Result:=MessageDlg(lisMissingPackages, Msg, mtError, [mbOk], 0);
|
Result:=MessageDlg(lisMissingPackages, Msg, mtError, [mbOk], 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPkgManager.RebuildDefineTemplates;
|
||||||
|
begin
|
||||||
|
PackageGraph.RebuildDefineTemplates;
|
||||||
|
end;
|
||||||
|
|
||||||
function TPkgManager.DoCompileProjectDependencies(AProject: TProject;
|
function TPkgManager.DoCompileProjectDependencies(AProject: TProject;
|
||||||
Flags: TPkgCompileFlags): TModalResult;
|
Flags: TPkgCompileFlags): TModalResult;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user