mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 17:50:19 +02:00
projectgroups: show missing target files
git-svn-id: trunk@61509 -
This commit is contained in:
parent
0b20f40263
commit
61add3f64e
@ -75,8 +75,11 @@ begin
|
|||||||
Opts.OpenLastGroupOnStart:=OpenLastGroupOnStartCheckBox.Checked;
|
Opts.OpenLastGroupOnStart:=OpenLastGroupOnStartCheckBox.Checked;
|
||||||
Opts.ShowTargetPaths:=ShowTargetPathsCheckBox.Checked;
|
Opts.ShowTargetPaths:=ShowTargetPathsCheckBox.Checked;
|
||||||
|
|
||||||
if Opts.Modified then
|
if Opts.Modified then begin
|
||||||
Opts.SaveSafe;
|
Opts.SaveSafe;
|
||||||
|
if IDEProjectGroupManager.Editor<>nil then
|
||||||
|
IDEProjectGroupManager.Editor.Invalidate;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjGrpOptionsFrame.RestoreSettings(AOptions: TAbstractIDEOptions);
|
procedure TProjGrpOptionsFrame.RestoreSettings(AOptions: TAbstractIDEOptions);
|
||||||
|
@ -139,6 +139,7 @@ type
|
|||||||
procedure RemoveTarget(Index: Integer); override;
|
procedure RemoveTarget(Index: Integer); override;
|
||||||
procedure ExchangeTargets(OldIndex, NewIndex: Integer); override;
|
procedure ExchangeTargets(OldIndex, NewIndex: Integer); override;
|
||||||
procedure ActiveTargetChanged(T: TPGCompileTarget);
|
procedure ActiveTargetChanged(T: TPGCompileTarget);
|
||||||
|
function UpdateMissing: boolean; override;
|
||||||
function LoadFromFile(Options: TProjectGroupLoadOptions): Boolean;
|
function LoadFromFile(Options: TProjectGroupLoadOptions): Boolean;
|
||||||
function SaveToFile: Boolean;
|
function SaveToFile: Boolean;
|
||||||
property OnFileNameChange: TNotifyEvent Read FOnFileNameChange Write FOnFileNameChange;
|
property OnFileNameChange: TNotifyEvent Read FOnFileNameChange Write FOnFileNameChange;
|
||||||
@ -1001,6 +1002,28 @@ begin
|
|||||||
Root.OnTargetActiveChanged(Self,T);
|
Root.OnTargetActiveChanged(Self,T);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TIDEProjectGroup.UpdateMissing: boolean;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Target: TPGCompileTarget;
|
||||||
|
Missing: Boolean;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
for i:=0 to TargetCount-1 do
|
||||||
|
begin
|
||||||
|
Target:=Targets[i];
|
||||||
|
Missing:=not FileExistsCached(Target.Filename);
|
||||||
|
if Target.Missing<>Missing then begin
|
||||||
|
Target.Missing:=Missing;
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
// todo sub groups
|
||||||
|
end;
|
||||||
|
if Result then
|
||||||
|
if ProjectGroupManager.Editor<>nil then
|
||||||
|
ProjectGroupManager.Editor.Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
function TIDEProjectGroup.LoadFromFile(Options: TProjectGroupLoadOptions
|
function TIDEProjectGroup.LoadFromFile(Options: TProjectGroupLoadOptions
|
||||||
): Boolean;
|
): Boolean;
|
||||||
Var
|
Var
|
||||||
|
@ -9,6 +9,7 @@ object ProjectGroupEditorForm: TProjectGroupEditorForm
|
|||||||
OnCloseQuery = FormCloseQuery
|
OnCloseQuery = FormCloseQuery
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
|
OnShow = FormShow
|
||||||
LCLVersion = '2.1.0.0'
|
LCLVersion = '2.1.0.0'
|
||||||
object TBProjectGroup: TToolBar
|
object TBProjectGroup: TToolBar
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -101,6 +102,7 @@ object ProjectGroupEditorForm: TProjectGroupEditorForm
|
|||||||
RightClickSelect = True
|
RightClickSelect = True
|
||||||
StateImages = ImageListMain
|
StateImages = ImageListMain
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
|
OnAdvancedCustomDrawItem = TVPGAdvancedCustomDrawItem
|
||||||
OnDblClick = TVPGDblClick
|
OnDblClick = TVPGDblClick
|
||||||
OnMouseDown = TVPGMouseDown
|
OnMouseDown = TVPGMouseDown
|
||||||
OnSelectionChanged = TVPGSelectionChanged
|
OnSelectionChanged = TVPGSelectionChanged
|
||||||
|
@ -140,7 +140,11 @@ type
|
|||||||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure FormDestroy(Sender: TObject);
|
procedure FormDestroy(Sender: TObject);
|
||||||
|
procedure FormShow(Sender: TObject);
|
||||||
procedure PopupMenuMorePopup(Sender: TObject);
|
procedure PopupMenuMorePopup(Sender: TObject);
|
||||||
|
procedure TVPGAdvancedCustomDrawItem(Sender: TCustomTreeView;
|
||||||
|
Node: TTreeNode; {%H-}State: TCustomDrawState; Stage: TCustomDrawStage;
|
||||||
|
var {%H-}PaintImages, {%H-}DefaultDraw: Boolean);
|
||||||
procedure TVPGDblClick(Sender: TObject);
|
procedure TVPGDblClick(Sender: TObject);
|
||||||
procedure TVPGMouseDown(Sender: TObject; Button: TMouseButton;
|
procedure TVPGMouseDown(Sender: TObject; Button: TMouseButton;
|
||||||
Shift: TShiftState; X, Y: Integer);
|
Shift: TShiftState; X, Y: Integer);
|
||||||
@ -152,6 +156,7 @@ type
|
|||||||
// Project group callbacks
|
// Project group callbacks
|
||||||
procedure InitTVNode(Node: TTreeNode; Const ACaption: String;
|
procedure InitTVNode(Node: TTreeNode; Const ACaption: String;
|
||||||
ANodeData: TNodeData);
|
ANodeData: TNodeData);
|
||||||
|
procedure OnApplicationActivate(Sender: TObject);
|
||||||
procedure OnIDEClose(Sender: TObject);
|
procedure OnIDEClose(Sender: TObject);
|
||||||
procedure OnProjectGroupDestroy(Sender: TObject);
|
procedure OnProjectGroupDestroy(Sender: TObject);
|
||||||
procedure OnProjectGroupFileNameChanged(Sender: TObject);
|
procedure OnProjectGroupFileNameChanged(Sender: TObject);
|
||||||
@ -513,6 +518,7 @@ procedure TProjectGroupEditorForm.FormCreate(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
if ProjectGroupEditorForm=nil then
|
if ProjectGroupEditorForm=nil then
|
||||||
ProjectGroupEditorForm:=Self;
|
ProjectGroupEditorForm:=Self;
|
||||||
|
ProjectGroupManager.Editor:=Self;
|
||||||
PGEditMenuSectionMisc.MenuItem:=PopupMenuMore.Items;
|
PGEditMenuSectionMisc.MenuItem:=PopupMenuMore.Items;
|
||||||
SetItem(MnuCmdTargetAdd,@AProjectGroupAddExistingExecute);
|
SetItem(MnuCmdTargetAdd,@AProjectGroupAddExistingExecute);
|
||||||
SetItem(MnuCmdTargetRemove,@AProjectGroupDeleteExecute);
|
SetItem(MnuCmdTargetRemove,@AProjectGroupDeleteExecute);
|
||||||
@ -528,18 +534,25 @@ begin
|
|||||||
SetItem(MnuCmdProjGrpRedo,@AProjectGroupRedoExecute);
|
SetItem(MnuCmdProjGrpRedo,@AProjectGroupRedoExecute);
|
||||||
|
|
||||||
LazarusIDE.AddHandlerOnIDEClose(@OnIDEClose);
|
LazarusIDE.AddHandlerOnIDEClose(@OnIDEClose);
|
||||||
|
Application.AddOnActivateHandler(@OnApplicationActivate);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectGroupEditorForm.FormDestroy(Sender: TObject);
|
procedure TProjectGroupEditorForm.FormDestroy(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
debugln(['TProjectGroupEditorForm.FormDestroy START ',ProjectGroup<>nil]);
|
//debugln(['TProjectGroupEditorForm.FormDestroy START ',ProjectGroup<>nil]);
|
||||||
ProjectGroup:=nil;
|
ProjectGroup:=nil;
|
||||||
if ProjectGroupEditorForm=Self then
|
if ProjectGroupEditorForm=Self then
|
||||||
ProjectGroupEditorForm:=nil;
|
ProjectGroupEditorForm:=nil;
|
||||||
|
ProjectGroupManager.Editor:=Self;
|
||||||
if (PGEditMenuSectionMisc<>nil)
|
if (PGEditMenuSectionMisc<>nil)
|
||||||
and (PGEditMenuSectionMisc.MenuItem=PopupMenuMore.Items) then
|
and (PGEditMenuSectionMisc.MenuItem=PopupMenuMore.Items) then
|
||||||
PGEditMenuSectionMisc.MenuItem:=nil;
|
PGEditMenuSectionMisc.MenuItem:=nil;
|
||||||
debugln(['TProjectGroupEditorForm.FormDestroy END ',ProjectGroup<>nil]);
|
//debugln(['TProjectGroupEditorForm.FormDestroy END ',ProjectGroup<>nil]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjectGroupEditorForm.FormShow(Sender: TObject);
|
||||||
|
begin
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectGroupEditorForm.PopupMenuMorePopup(Sender: TObject);
|
procedure TProjectGroupEditorForm.PopupMenuMorePopup(Sender: TObject);
|
||||||
@ -560,6 +573,26 @@ begin
|
|||||||
PMIRunMenuItem.Visible:=taRun in AllowedActions;
|
PMIRunMenuItem.Visible:=taRun in AllowedActions;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TProjectGroupEditorForm.TVPGAdvancedCustomDrawItem(
|
||||||
|
Sender: TCustomTreeView; Node: TTreeNode; State: TCustomDrawState;
|
||||||
|
Stage: TCustomDrawStage; var PaintImages, DefaultDraw: Boolean);
|
||||||
|
var
|
||||||
|
ND: TNodeData;
|
||||||
|
r: TRect;
|
||||||
|
y: LongInt;
|
||||||
|
begin
|
||||||
|
if Stage=cdPostPaint then begin
|
||||||
|
ND:=TNodeData(Node.Data);
|
||||||
|
if (ND.Target<>nil) and ND.Target.Missing then begin
|
||||||
|
// Missing target file: draw red line strike through text
|
||||||
|
r:=Node.DisplayRect(true);
|
||||||
|
TVPG.Canvas.Pen.Color:=clRed;
|
||||||
|
y:=(r.Top+r.Bottom) div 2;
|
||||||
|
TVPG.Canvas.Line(r.Left,y,r.Right,y);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TProjectGroupEditorForm.TVPGDblClick(Sender: TObject);
|
procedure TProjectGroupEditorForm.TVPGDblClick(Sender: TObject);
|
||||||
Var
|
Var
|
||||||
ND: TNodeData;
|
ND: TNodeData;
|
||||||
@ -800,6 +833,7 @@ begin
|
|||||||
// ToDo: revert
|
// ToDo: revert
|
||||||
IDEMessageDialog(lisNeedSave, lisPleaseSaveYourChangesBeforeReloadingTheProjectGrou,
|
IDEMessageDialog(lisNeedSave, lisPleaseSaveYourChangesBeforeReloadingTheProjectGrou,
|
||||||
mtError,[mbOK]);
|
mtError,[mbOK]);
|
||||||
|
PG.UpdateMissing;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
ProjectGroup:=nil;
|
ProjectGroup:=nil;
|
||||||
@ -808,7 +842,8 @@ begin
|
|||||||
finally
|
finally
|
||||||
ProjectGroup:=PG;
|
ProjectGroup:=PG;
|
||||||
end;
|
end;
|
||||||
end;
|
end else
|
||||||
|
PG.UpdateMissing;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectGroupEditorForm.AProjectGroupSaveAsUpdate(Sender: TObject);
|
procedure TProjectGroupEditorForm.AProjectGroupSaveAsUpdate(Sender: TObject);
|
||||||
@ -1139,6 +1174,12 @@ begin
|
|||||||
Node.StateIndex:=-1;
|
Node.StateIndex:=-1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TProjectGroupEditorForm.OnApplicationActivate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if ProjectGroup<>nil then
|
||||||
|
ProjectGroup.UpdateMissing;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TProjectGroupEditorForm.OnIDEClose(Sender: TObject);
|
procedure TProjectGroupEditorForm.OnIDEClose(Sender: TObject);
|
||||||
var
|
var
|
||||||
Opts: TIDEProjectGroupOptions;
|
Opts: TIDEProjectGroupOptions;
|
||||||
@ -1296,10 +1337,10 @@ begin
|
|||||||
if (NodeData.Target<>nil)
|
if (NodeData.Target<>nil)
|
||||||
and (not IDEProjectGroupManager.Options.ShowTargetPaths) then
|
and (not IDEProjectGroupManager.Options.ShowTargetPaths) then
|
||||||
begin
|
begin
|
||||||
if NodeData.Target.TargetType in [ttPascalFile] then
|
if NodeData.Target.TargetType in [ttProject,ttPackage,ttProjectGroup] then
|
||||||
Result:=ExtractFileName(NodeData.Target.Filename)
|
Result:=ExtractFileNameOnly(NodeData.Target.Filename)
|
||||||
else
|
else
|
||||||
Result:=ExtractFileNameOnly(NodeData.Target.Filename);
|
Result:=ExtractFileName(NodeData.Target.Filename);
|
||||||
end else begin
|
end else begin
|
||||||
Result:='';
|
Result:='';
|
||||||
if NodeData.ParentTarget<>nil then
|
if NodeData.ParentTarget<>nil then
|
||||||
|
@ -8,7 +8,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, IDEOptionsIntf, PackageIntf, ProjectIntf, LazFileUtils,
|
Classes, SysUtils, IDEOptionsIntf, PackageIntf, ProjectIntf, LazFileUtils,
|
||||||
LazFileCache, LazMethodList, LazLoggerBase;
|
LazFileCache, LazMethodList, LazLoggerBase, Forms;
|
||||||
|
|
||||||
Type
|
Type
|
||||||
TPGTargetType = (
|
TPGTargetType = (
|
||||||
@ -173,6 +173,7 @@ Type
|
|||||||
property Targets[Index: Integer]: TPGCompileTarget Read GetTarget;
|
property Targets[Index: Integer]: TPGCompileTarget Read GetTarget;
|
||||||
property TargetCount: Integer Read GetTargetCount;
|
property TargetCount: Integer Read GetTargetCount;
|
||||||
property ActiveTarget: TPGCompileTarget Read GetActiveTarget Write SetActiveTarget;
|
property ActiveTarget: TPGCompileTarget Read GetActiveTarget Write SetActiveTarget;
|
||||||
|
function UpdateMissing: boolean; virtual; abstract; // true if something changed
|
||||||
public
|
public
|
||||||
// modified
|
// modified
|
||||||
procedure IncreaseChangeStamp;
|
procedure IncreaseChangeStamp;
|
||||||
@ -198,6 +199,7 @@ Type
|
|||||||
|
|
||||||
TProjectGroupManager = Class(TPersistent)
|
TProjectGroupManager = Class(TPersistent)
|
||||||
protected
|
protected
|
||||||
|
FEditor: TForm;
|
||||||
function GetCurrentProjectGroup: TProjectGroup; virtual; abstract;
|
function GetCurrentProjectGroup: TProjectGroup; virtual; abstract;
|
||||||
public
|
public
|
||||||
procedure LoadProjectGroup(AFileName: string; AOptions: TProjectGroupLoadOptions); virtual; abstract;
|
procedure LoadProjectGroup(AFileName: string; AOptions: TProjectGroupLoadOptions); virtual; abstract;
|
||||||
@ -207,6 +209,7 @@ Type
|
|||||||
procedure Undo; virtual; abstract;
|
procedure Undo; virtual; abstract;
|
||||||
procedure Redo; virtual; abstract;
|
procedure Redo; virtual; abstract;
|
||||||
property CurrentProjectGroup: TProjectGroup Read GetCurrentProjectGroup; // Always top-level.
|
property CurrentProjectGroup: TProjectGroup Read GetCurrentProjectGroup; // Always top-level.
|
||||||
|
property Editor: TForm read FEditor write FEditor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user