IDE: auto open package editor for modified packages

git-svn-id: trunk@24893 -
This commit is contained in:
mattias 2010-04-24 20:05:26 +00:00
parent 84d4e6bf32
commit 53acb8a2b2
6 changed files with 37 additions and 4 deletions

View File

@ -15805,6 +15805,9 @@ begin
if (FRemoteControlTimer=nil) and EnableRemoteControl then
SetupRemoteControl;
if Screen.GetCurrentModalForm=nil then
PkgBoss.OpenHiddenModifiedPackages;
end;
procedure TMainIDE.OnApplicationActivate(Sender: TObject);

View File

@ -93,6 +93,7 @@ type
protected
FCustomOptions: TConfigStorage;
FFilename: string;
FChangeStamp: integer;
function GetDirectoryExpanded: string; virtual; abstract;
function GetModified: boolean; virtual; abstract;
procedure SetFilename(const AValue: string); virtual; abstract;
@ -108,6 +109,7 @@ type
property Modified: boolean read GetModified write SetModified;
property DirectoryExpanded: string read GetDirectoryExpanded;
property CustomOptions: TConfigStorage read FCustomOptions;
property ChangeStamp: integer read FChangeStamp;
end;
type

View File

@ -121,6 +121,7 @@ type
function DoCloseAllPackageEditors: TModalResult; virtual; abstract;
function AddPackageDependency(APackage: TLazPackage; const ReqPackage: string;
OnlyTestIfPossible: boolean = false): TModalResult; virtual; abstract;
procedure OpenHiddenModifiedPackages; virtual; abstract;
// package graph
procedure DoShowPackageGraphPathList(PathList: TFPList); virtual; abstract;

View File

@ -581,6 +581,7 @@ type
FTranslated: string;
FUpdateLock: integer;
FUsageOptions: TPkgAdditionalCompilerOptions;
FUserIgnoreChangeStamp: integer;
FUserReadOnly: boolean;
function GetAutoIncrementVersionOnBuild: boolean;
function GetComponentCount: integer;
@ -787,6 +788,8 @@ type
property Translated: string read FTranslated write FTranslated;
property UsageOptions: TPkgAdditionalCompilerOptions read FUsageOptions;
property UserReadOnly: boolean read FUserReadOnly write SetUserReadOnly;
property UserIgnoreChangeStamp: integer read FUserIgnoreChangeStamp
write FUserIgnoreChangeStamp;
end;
PLazPackage = ^TLazPackage;
@ -2269,9 +2272,13 @@ end;
procedure TLazPackage.SetModified(const AValue: boolean);
begin
if AValue and (FModifiedLock>0) then exit;
if AValue then
Include(FFlags,lpfModified)
else
if AValue then begin
Include(FFlags,lpfModified);
if FChangeStamp<High(FChangeStamp) then
inc(FChangeStamp)
else
FChangeStamp:=low(FChangeStamp);
end else
Exclude(FFlags,lpfModified);
Exclude(FFlags,lpfSkipSaving);
if not AValue then

View File

@ -733,8 +733,11 @@ begin
Format(lisPckEditPackageHasChangedSavePackage, ['"', LazPackage.IDAsString,
'"', #13]),
mtConfirmation,[mbYes,mbNo,mbAbort],0);
if MsgResult=mrYes then begin
case MsgResult of
mrYes:
MsgResult:=PackageEditors.SavePackage(LazPackage,false);
mrNo:
LazPackage.UserIgnoreChangeStamp:=LazPackage.UserIgnoreChangeStamp;
end;
if MsgResult=mrAbort then CanClose:=false;
end;

View File

@ -273,6 +273,7 @@ type
function DoOpenPackageFile(AFilename: string;
Flags: TPkgOpenFlags;
ShowAbort: boolean): TModalResult; override;
procedure OpenHiddenModifiedPackages; override;
function DoSavePackage(APackage: TLazPackage;
Flags: TPkgSaveFlags): TModalResult; override;
function DoSaveAllPackages(Flags: TPkgSaveFlags): TModalResult; override;
@ -2507,6 +2508,22 @@ begin
MainIDEInterface.UpdateHighlighters;
end;
procedure TPkgManager.OpenHiddenModifiedPackages;
var
i: Integer;
APackage: TLazPackage;
Editor: TPackageEditorForm;
begin
for i:=0 to PackageGraph.Count-1 do begin
APackage:=PackageGraph.Packages[i];
if (APackage.Editor=nil) and APackage.Modified
and (APackage.UserIgnoreChangeStamp<>APackage.ChangeStamp) then begin
Editor:=PackageEditors.OpenEditor(APackage);
Editor.Visible:=true;
end;
end;
end;
function TPkgManager.DoSavePackage(APackage: TLazPackage;
Flags: TPkgSaveFlags): TModalResult;
var