mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-03 10:18:17 +02:00
projectgroups: resourcestrings, SelfTarget, let editor find out itself what options have changed
git-svn-id: trunk@61513 -
This commit is contained in:
parent
9c2eafe647
commit
2036d96cd5
@ -78,7 +78,7 @@ begin
|
||||
if Opts.Modified then begin
|
||||
Opts.SaveSafe;
|
||||
if IDEProjectGroupManager.OnEditorOptionsChanged<>nil then
|
||||
IDEProjectGroupManager.OnEditorOptionsChanged(true,true);
|
||||
IDEProjectGroupManager.OnEditorOptionsChanged(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -199,14 +199,12 @@ type
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
|
||||
TEditorOptionsChangedEvent = procedure(Colors, NodeTexts: boolean) of object;
|
||||
|
||||
{ TIDEProjectGroupManager }
|
||||
|
||||
TIDEProjectGroupManager = Class(TProjectGroupManager)
|
||||
private
|
||||
FIdleConnected: boolean;
|
||||
FOnEditorOptionsChanged: TEditorOptionsChangedEvent;
|
||||
FOnEditorOptionsChanged: TNotifyEvent;
|
||||
FUndoList: TObjectList; // list of TPGUndoItem
|
||||
FRedoList: TObjectList; // list of TPGUndoItem
|
||||
FOptions: TIDEProjectGroupOptions;
|
||||
@ -243,7 +241,7 @@ type
|
||||
public
|
||||
property Options: TIDEProjectGroupOptions read FOptions;
|
||||
property IdleConnected: boolean read FIdleConnected write SetIdleConnected;
|
||||
property OnEditorOptionsChanged: TEditorOptionsChangedEvent read FOnEditorOptionsChanged write FOnEditorOptionsChanged;
|
||||
property OnEditorOptionsChanged: TNotifyEvent read FOnEditorOptionsChanged write FOnEditorOptionsChanged;
|
||||
end;
|
||||
|
||||
TEditProjectGroupHandler = procedure(Sender: TObject; AProjectGroup: TProjectGroup);
|
||||
@ -895,11 +893,11 @@ constructor TIDEProjectGroup.Create(aCompileTarget: TIDECompileTarget);
|
||||
begin
|
||||
inherited Create;
|
||||
if aCompileTarget=nil then begin
|
||||
FCompileTarget:=TRootProjectGroupTarget.Create(Self);
|
||||
FSelfTarget:=TRootProjectGroupTarget.Create(Self);
|
||||
end else begin
|
||||
FCompileTarget:=aCompileTarget;
|
||||
if FCompileTarget.Parent<>nil then
|
||||
FParent:=FCompileTarget.Parent.ProjectGroup;
|
||||
FSelfTarget:=aCompileTarget;
|
||||
if FSelfTarget.Parent<>nil then
|
||||
FParent:=FSelfTarget.Parent.ProjectGroup;
|
||||
end;
|
||||
FTargets:=TFPObjectList.Create(True);
|
||||
end;
|
||||
@ -907,7 +905,7 @@ end;
|
||||
destructor TIDEProjectGroup.Destroy;
|
||||
begin
|
||||
FreeAndNil(FTargets);
|
||||
FreeAndNil(FCompileTarget);
|
||||
FreeAndNil(FSelfTarget);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -939,7 +937,7 @@ begin
|
||||
if not FilenameIsAbsolute(AFileName) then
|
||||
RaiseGDBException('TIDEProjectGroup.AddTarget [20190629165305] '+AFileName);
|
||||
CheckInvalidCycle(AFileName);
|
||||
Result:=TIDECompileTarget.Create(CompileTarget);
|
||||
Result:=TIDECompileTarget.Create(SelfTarget);
|
||||
Result.FileName:=AFileName;
|
||||
FTargets.Add(Result);
|
||||
IncreaseChangeStamp;
|
||||
@ -959,7 +957,7 @@ begin
|
||||
if Index>TargetCount then
|
||||
RaiseGDBException('TIDEProjectGroup.InsertTarget [20190629165009]');
|
||||
FTargets.Insert(Index,Target);
|
||||
TIDECompileTarget(Target).SetParent(CompileTarget);
|
||||
TIDECompileTarget(Target).SetParent(SelfTarget);
|
||||
IncreaseChangeStamp;
|
||||
DoTargetInserted(Self,Target);
|
||||
Result:=FTargets.IndexOf(Target);
|
||||
|
@ -156,9 +156,9 @@ type
|
||||
FProjectGroup: TProjectGroup;
|
||||
FProjectGroupTVNode: TTreeNode;
|
||||
FActiveTarget: TPGCompileTarget;
|
||||
FLastShowTargetPaths: boolean;
|
||||
// Project group callbacks
|
||||
procedure IDEProjectGroupManagerEditorOptionsChanged(Colors,
|
||||
NodeTexts: boolean);
|
||||
procedure IDEProjectGroupManagerEditorOptionsChanged(Sender: TObject);
|
||||
procedure InitTVNode(Node: TTreeNode; Const ACaption: String;
|
||||
ANodeData: TNodeData);
|
||||
procedure OnApplicationActivate(Sender: TObject);
|
||||
@ -384,6 +384,9 @@ begin
|
||||
ConfigAction(ATargetCopyFilename,0,lisTargetCopyFilename,'',Nil);
|
||||
ConfigAction(ATargetCompileFromHere,0,lisTargetCompileFromHere,'',Nil);
|
||||
ConfigAction(AProjectGroupReload,0,lisProjectGroupReload,'',Nil);
|
||||
ConfigAction(AProjectGroupUndo, 0, lisUndo, '', nil);
|
||||
ConfigAction(AProjectGroupRedo, 0, lisRedo, '', nil);
|
||||
ConfigAction(AProjectGroupOptions, 0, lisOptions, '', nil);
|
||||
TBMore.Caption:=lisMore;
|
||||
end;
|
||||
|
||||
@ -951,7 +954,7 @@ Var
|
||||
T: TPGCompileTarget;
|
||||
begin
|
||||
T:=SelectedTarget;
|
||||
(Sender as TAction).Enabled:=(T<>nil) and (T<>ProjectGroup.CompileTarget);
|
||||
(Sender as TAction).Enabled:=(T<>nil) and (T<>ProjectGroup.SelfTarget);
|
||||
UpdateIDEMenuCommandFromAction(Sender,MnuCmdTargetRemove);
|
||||
end;
|
||||
|
||||
@ -1189,10 +1192,14 @@ begin
|
||||
end;
|
||||
|
||||
procedure TProjectGroupEditorForm.IDEProjectGroupManagerEditorOptionsChanged(
|
||||
Colors, NodeTexts: boolean);
|
||||
Sender: TObject);
|
||||
var
|
||||
Opts: TIDEProjectGroupOptions;
|
||||
begin
|
||||
if Colors then Invalidate;
|
||||
if NodeTexts then UpdateNodeTexts;
|
||||
Invalidate;
|
||||
Opts:=IDEProjectGroupManager.Options;
|
||||
if FLastShowTargetPaths<>Opts.ShowTargetPaths then
|
||||
UpdateNodeTexts;
|
||||
end;
|
||||
|
||||
procedure TProjectGroupEditorForm.OnApplicationActivate(Sender: TObject);
|
||||
@ -1368,7 +1375,7 @@ begin
|
||||
if (N='') then
|
||||
Caption:=lisNewProjectGroup
|
||||
else
|
||||
Caption:=Format(LisProjectGroup,[DisplayFileName(FProjectGroup.CompileTarget)]);
|
||||
Caption:=Format(LisProjectGroup,[DisplayFileName(FProjectGroup.SelfTarget)]);
|
||||
if Assigned(FProjectGroupTVNode) then
|
||||
FProjectGroupTVNode.Text:=DisplayFileName(FProjectGroupTVNode);
|
||||
end;
|
||||
@ -1424,6 +1431,7 @@ procedure TProjectGroupEditorForm.ShowProjectGroup;
|
||||
Var
|
||||
N: TTreeNode;
|
||||
begin
|
||||
FLastShowTargetPaths:=IDEProjectGroupManager.Options.ShowTargetPaths;
|
||||
TVPG.BeginUpdate;
|
||||
try
|
||||
FreeNodeData;
|
||||
@ -1431,12 +1439,12 @@ begin
|
||||
TVPG.Items.Clear;
|
||||
if FProjectGroup<>nil then begin
|
||||
FProjectGroupTVNode:=CreateTargetNode(Nil,
|
||||
ntProjectGroup,ProjectGroup.CompileTarget);
|
||||
ntProjectGroup,ProjectGroup.SelfTarget);
|
||||
FillProjectGroupNode(FProjectGroupTVNode,FProjectGroup);
|
||||
N:=FindTVNodeOfTarget(FActiveTarget);
|
||||
if (N=Nil) then
|
||||
begin
|
||||
FActiveTarget:=ProjectGroup.CompileTarget;
|
||||
FActiveTarget:=ProjectGroup.SelfTarget;
|
||||
TVPG.Selected:=FProjectGroupTVNode;
|
||||
end else
|
||||
TVPG.Selected:=N;
|
||||
@ -1460,6 +1468,7 @@ procedure TProjectGroupEditorForm.UpdateNodeTexts;
|
||||
var
|
||||
TVNode: TTreeNode;
|
||||
begin
|
||||
FLastShowTargetPaths:=IDEProjectGroupManager.Options.ShowTargetPaths;
|
||||
TVPG.BeginUpdate;
|
||||
try
|
||||
for TVNode in TVPG.Items do begin
|
||||
|
@ -135,7 +135,7 @@ Type
|
||||
FLastSavedChangeStamp: int64;
|
||||
procedure SetModified(AValue: Boolean);
|
||||
protected
|
||||
FCompileTarget: TPGCompileTarget;
|
||||
FSelfTarget: TPGCompileTarget;
|
||||
FParent: TProjectGroup;
|
||||
procedure SetFileName(AValue: String); virtual;
|
||||
function GetModified: Boolean; virtual;
|
||||
@ -153,7 +153,7 @@ Type
|
||||
destructor Destroy; override;
|
||||
function GetRootGroup: TProjectGroup;
|
||||
property FileName: String Read FFileName Write SetFileName; // absolute
|
||||
property CompileTarget: TPGCompileTarget read FCompileTarget; // this group as target
|
||||
property SelfTarget: TPGCompileTarget read FSelfTarget; // this group as target
|
||||
property Parent: TProjectGroup read FParent;
|
||||
// actions
|
||||
function Perform(Index: Integer; AAction: TPGTargetAction): TPGActionResult;
|
||||
@ -300,8 +300,8 @@ begin
|
||||
if FFileName=AValue then Exit;
|
||||
FFileName:=AValue;
|
||||
IncreaseChangeStamp;
|
||||
if CompileTarget<>nil then
|
||||
CompileTarget.Filename:=Filename;
|
||||
if SelfTarget<>nil then
|
||||
SelfTarget.Filename:=Filename;
|
||||
end;
|
||||
|
||||
function TProjectGroup.GetModified: Boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user