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