mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 21:35:57 +02:00
added TLazProject.ProjectInfoFile, fixed saving editor files if deleted
git-svn-id: trunk@7204 -
This commit is contained in:
parent
31d368a4d8
commit
dc21f3484c
@ -32,7 +32,7 @@ unit FPCUnitLazIDEIntf;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LazIDEIntf, ProjectIntf, testcaseopts;
|
Classes, SysUtils, LazIDEIntf, ProjectIntf, Controls, Forms,testcaseopts;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TFPCUnitApplicationDescriptor }
|
{ TFPCUnitApplicationDescriptor }
|
||||||
@ -42,8 +42,8 @@ type
|
|||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
function GetLocalizedName: string; override;
|
function GetLocalizedName: string; override;
|
||||||
function GetLocalizedDescription: string; override;
|
function GetLocalizedDescription: string; override;
|
||||||
procedure InitProject(AProject: TLazProject); override;
|
Function InitProject(AProject: TLazProject) : TModalResult; override;
|
||||||
procedure CreateStartFiles(AProject: TLazProject); override;
|
Function CreateStartFiles(AProject: TLazProject): TModalResult; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFileDescPascalUnitFPCUnitTestCase }
|
{ TFileDescPascalUnitFPCUnitTestCase }
|
||||||
@ -109,7 +109,7 @@ begin
|
|||||||
+'automatically maintained by Lazarus.';
|
+'automatically maintained by Lazarus.';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPCUnitApplicationDescriptor.InitProject(AProject: TLazProject);
|
Function TFPCUnitApplicationDescriptor.InitProject(AProject: TLazProject) : TModalResult;
|
||||||
var
|
var
|
||||||
le: string;
|
le: string;
|
||||||
NewSource: String;
|
NewSource: String;
|
||||||
@ -146,12 +146,14 @@ begin
|
|||||||
|
|
||||||
// compiler options
|
// compiler options
|
||||||
AProject.LazCompilerOptions.UseLineInfoUnit:=true;
|
AProject.LazCompilerOptions.UseLineInfoUnit:=true;
|
||||||
|
Result:=mrOK;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPCUnitApplicationDescriptor.CreateStartFiles(AProject: TLazProject);
|
Function TFPCUnitApplicationDescriptor.CreateStartFiles(AProject: TLazProject) :TModalResult;
|
||||||
begin
|
begin
|
||||||
LazarusIDE.DoNewEditorFile(FileDescriptorFPCUnitTestCase,'','',
|
LazarusIDE.DoNewEditorFile(FileDescriptorFPCUnitTestCase,'','',
|
||||||
[nfIsPartOfProject,nfOpenInEditor,nfCreateDefaultSrc]);
|
[nfIsPartOfProject,nfOpenInEditor,nfCreateDefaultSrc]);
|
||||||
|
Result:=mrOK;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFileDescPascalUnitFPCUnitTestCase }
|
{ TFileDescPascalUnitFPCUnitTestCase }
|
||||||
|
13
ide/main.pp
13
ide/main.pp
@ -859,12 +859,12 @@ begin
|
|||||||
writeln(PrimaryConfPathOptLong,' <path>');
|
writeln(PrimaryConfPathOptLong,' <path>');
|
||||||
writeln('or ',PrimaryConfPathOptShort,' <path>');
|
writeln('or ',PrimaryConfPathOptShort,' <path>');
|
||||||
writeln(BreakString(lisprimaryConfigDirectoryWhereLazarusStoresItsConfig,
|
writeln(BreakString(lisprimaryConfigDirectoryWhereLazarusStoresItsConfig,
|
||||||
75, 22), GetPrimaryConfigPath);
|
75, 22), LazConf.GetPrimaryConfigPath);
|
||||||
writeln('');
|
writeln('');
|
||||||
writeln(SecondaryConfPathOptLong,' <path>');
|
writeln(SecondaryConfPathOptLong,' <path>');
|
||||||
writeln('or ',SecondaryConfPathOptShort,' <path>');
|
writeln('or ',SecondaryConfPathOptShort,' <path>');
|
||||||
writeln(BreakString(lissecondaryConfigDirectoryWhereLazarusSearchesFor,
|
writeln(BreakString(lissecondaryConfigDirectoryWhereLazarusSearchesFor,
|
||||||
75, 22), GetSecondaryConfigPath);
|
75, 22), LazConf.GetSecondaryConfigPath);
|
||||||
writeln('');
|
writeln('');
|
||||||
writeln(DebugLogOpt,' <file>');
|
writeln(DebugLogOpt,' <file>');
|
||||||
writeln(BreakString(lisFileWhereDebugOutputIsWritten, 75, 22));
|
writeln(BreakString(lisFileWhereDebugOutputIsWritten, 75, 22));
|
||||||
@ -4896,6 +4896,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// if nothing modified then a simple Save can be skipped
|
// if nothing modified then a simple Save can be skipped
|
||||||
|
//writeln('TMainIDE.DoSaveEditorFile A ',ActiveUnitInfo.Filename,' ',ActiveUnitInfo.NeedsSaveToDisk);
|
||||||
if ([sfSaveToTestDir,sfSaveAs]*Flags=[])
|
if ([sfSaveToTestDir,sfSaveAs]*Flags=[])
|
||||||
and (not ActiveUnitInfo.NeedsSaveToDisk) then begin
|
and (not ActiveUnitInfo.NeedsSaveToDisk) then begin
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
@ -4922,7 +4923,7 @@ begin
|
|||||||
|
|
||||||
// save source
|
// save source
|
||||||
if not (sfSaveToTestDir in Flags) then begin
|
if not (sfSaveToTestDir in Flags) then begin
|
||||||
if ActiveUnitInfo.Modified then begin
|
if ActiveUnitInfo.Modified or ActiveUnitInfo.NeedsSaveToDisk then begin
|
||||||
// save source to file
|
// save source to file
|
||||||
Result:=ActiveUnitInfo.WriteUnitSource;
|
Result:=ActiveUnitInfo.WriteUnitSource;
|
||||||
if Result=mrAbort then exit;
|
if Result=mrAbort then exit;
|
||||||
@ -5712,8 +5713,9 @@ begin
|
|||||||
SaveSourceEditorChangesToCodeCache(-1);
|
SaveSourceEditorChangesToCodeCache(-1);
|
||||||
SkipSavingMainSource:=false;
|
SkipSavingMainSource:=false;
|
||||||
|
|
||||||
|
|
||||||
{$IFDEF IDE_DEBUG}
|
{$IFDEF IDE_DEBUG}
|
||||||
writeln('TMainIDE.DoSaveProject A SaveAs=',sfSaveAs in Flags,' SaveToTestDir=',sfSaveToTestDir in Flags);
|
writeln('TMainIDE.DoSaveProject A SaveAs=',sfSaveAs in Flags,' SaveToTestDir=',sfSaveToTestDir in Flags,' ProjectInfoFile=',Project1.ProjectInfoFile);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
// check that all new units are saved first to get valid filenames
|
// check that all new units are saved first to get valid filenames
|
||||||
@ -11559,6 +11561,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.867 2005/05/26 20:17:49 mattias
|
||||||
|
added TLazProject.ProjectInfoFile, fixed saving editor files if deleted
|
||||||
|
|
||||||
Revision 1.866 2005/05/26 15:54:02 mattias
|
Revision 1.866 2005/05/26 15:54:02 mattias
|
||||||
changed OI SHow Hints option to resource string, added TProjectDescriptor.DoInitDescriptor
|
changed OI SHow Hints option to resource string, added TProjectDescriptor.DoInitDescriptor
|
||||||
|
|
||||||
|
@ -229,6 +229,10 @@ type
|
|||||||
|
|
||||||
procedure FindInFilesPerDialog(AProject: TProject); virtual; abstract;
|
procedure FindInFilesPerDialog(AProject: TProject); virtual; abstract;
|
||||||
procedure FindInFiles(AProject: TProject; const FindText: string); virtual; abstract;
|
procedure FindInFiles(AProject: TProject; const FindText: string); virtual; abstract;
|
||||||
|
|
||||||
|
function GetPrimaryConfigPath: String; override;
|
||||||
|
function GetSecondaryConfigPath: String; override;
|
||||||
|
procedure CopySecondaryConfigFile(const AFilename: String); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -383,6 +387,21 @@ begin
|
|||||||
MainIDEInterface:=nil;
|
MainIDEInterface:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TMainIDEInterface.GetPrimaryConfigPath: String;
|
||||||
|
begin
|
||||||
|
Result:=LazConf.GetPrimaryConfigPath;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMainIDEInterface.GetSecondaryConfigPath: String;
|
||||||
|
begin
|
||||||
|
Result:=LazConf.GetSecondaryConfigPath;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDEInterface.CopySecondaryConfigFile(const AFilename: String);
|
||||||
|
begin
|
||||||
|
LazConf.CopySecondaryConfigFile(AFilename);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TFileDescPascalUnitWithForm }
|
{ TFileDescPascalUnitWithForm }
|
||||||
|
|
||||||
constructor TFileDescPascalUnitWithForm.Create;
|
constructor TFileDescPascalUnitWithForm.Create;
|
||||||
|
@ -399,7 +399,6 @@ type
|
|||||||
function GetFirstUnitWithEditorIndex: TUnitInfo;
|
function GetFirstUnitWithEditorIndex: TUnitInfo;
|
||||||
function GetMainFilename: String;
|
function GetMainFilename: String;
|
||||||
function GetMainUnitInfo: TUnitInfo;
|
function GetMainUnitInfo: TUnitInfo;
|
||||||
function GetProjectInfoFile: string;
|
|
||||||
function GetTargetFilename: string;
|
function GetTargetFilename: string;
|
||||||
function GetUnits(Index: integer): TUnitInfo;
|
function GetUnits(Index: integer): TUnitInfo;
|
||||||
function JumpHistoryCheckPosition(
|
function JumpHistoryCheckPosition(
|
||||||
@ -413,7 +412,6 @@ type
|
|||||||
procedure SetAutoOpenDesignerFormsDisabled(const AValue: boolean);
|
procedure SetAutoOpenDesignerFormsDisabled(const AValue: boolean);
|
||||||
procedure SetCompilerOptions(const AValue: TProjectCompilerOptions);
|
procedure SetCompilerOptions(const AValue: TProjectCompilerOptions);
|
||||||
procedure SetModified(const AValue: boolean);
|
procedure SetModified(const AValue: boolean);
|
||||||
procedure SetProjectInfoFile(const NewFilename: string);
|
|
||||||
procedure SetTargetFilename(const NewTargetFilename: string);
|
procedure SetTargetFilename(const NewTargetFilename: string);
|
||||||
procedure SetUnits(Index:integer; AUnitInfo: TUnitInfo);
|
procedure SetUnits(Index:integer; AUnitInfo: TUnitInfo);
|
||||||
procedure SetMainUnitID(const AValue: Integer);
|
procedure SetMainUnitID(const AValue: Integer);
|
||||||
@ -425,6 +423,8 @@ type
|
|||||||
function GetFiles(Index: integer): TLazProjectFile; override;
|
function GetFiles(Index: integer): TLazProjectFile; override;
|
||||||
procedure SetFiles(Index: integer; const AValue: TLazProjectFile); override;
|
procedure SetFiles(Index: integer; const AValue: TLazProjectFile); override;
|
||||||
procedure SetFlags(const AValue: TProjectFlags); override;
|
procedure SetFlags(const AValue: TProjectFlags); override;
|
||||||
|
function GetProjectInfoFile: string; override;
|
||||||
|
procedure SetProjectInfoFile(const NewFilename: string); override;
|
||||||
protected
|
protected
|
||||||
// special unit lists
|
// special unit lists
|
||||||
procedure AddToList(AnUnitInfo: TUnitInfo; ListType: TUnitInfoList);
|
procedure AddToList(AnUnitInfo: TUnitInfo; ListType: TUnitInfoList);
|
||||||
@ -1796,7 +1796,7 @@ function TProject.NewUniqueUnitName(const AnUnitName: string):string;
|
|||||||
begin
|
begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
ExpName:=ExpandedUnitName(AnUnitName);
|
ExpName:=ExpandedUnitName(AnUnitName);
|
||||||
if ExtractFileNameOnly(fProjectInfoFile)=Expname then exit;
|
if ExtractFileNameOnly(fProjectInfoFile)=ExpName then exit;
|
||||||
for i:=0 to UnitCount-1 do
|
for i:=0 to UnitCount-1 do
|
||||||
if (Units[i].IsPartOfProject)
|
if (Units[i].IsPartOfProject)
|
||||||
and (ExpandedUnitName(Units[i].FileName)=ExpName) then
|
and (ExpandedUnitName(Units[i].FileName)=ExpName) then
|
||||||
@ -2034,7 +2034,8 @@ end;
|
|||||||
|
|
||||||
function TProject.IsVirtual: boolean;
|
function TProject.IsVirtual: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=(MainUnitID>=0) and MainUnitInfo.IsVirtual;
|
Result:=((MainUnitID>=0) and MainUnitInfo.IsVirtual)
|
||||||
|
or (ProjectInfoFile='') or (not FilenameIsAbsolute(ProjectInfoFile));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProject.IndexOf(AUnitInfo: TUnitInfo):integer;
|
function TProject.IndexOf(AUnitInfo: TUnitInfo):integer;
|
||||||
@ -2240,6 +2241,7 @@ procedure TProject.SetProjectInfoFile(const NewFilename:string);
|
|||||||
var
|
var
|
||||||
NewProjectInfoFile: String;
|
NewProjectInfoFile: String;
|
||||||
OldProjectInfoFile: String;
|
OldProjectInfoFile: String;
|
||||||
|
DefaultTitle: String;
|
||||||
begin
|
begin
|
||||||
NewProjectInfoFile:=TrimFilename(NewFilename);
|
NewProjectInfoFile:=TrimFilename(NewFilename);
|
||||||
if NewProjectInfoFile='' then exit;
|
if NewProjectInfoFile='' then exit;
|
||||||
@ -2247,9 +2249,10 @@ begin
|
|||||||
if fProjectInfoFile=NewProjectInfoFile then exit;
|
if fProjectInfoFile=NewProjectInfoFile then exit;
|
||||||
OldProjectInfoFile:=fProjectInfoFile;
|
OldProjectInfoFile:=fProjectInfoFile;
|
||||||
fProjectInfoFile:=NewProjectInfoFile;
|
fProjectInfoFile:=NewProjectInfoFile;
|
||||||
if (AnsiCompareText(Title,ExtractFileNameOnly(OldProjectInfoFile))=0)
|
DefaultTitle:=ExtractFileNameOnly(OldProjectInfoFile);
|
||||||
|
if (CompareText(Title,DefaultTitle)=0)
|
||||||
or (OldProjectInfoFile='') or (Title='') then begin
|
or (OldProjectInfoFile='') or (Title='') then begin
|
||||||
Title:=ExtractFileNameOnly(NewProjectInfoFile);
|
Title:=DefaultTitle;
|
||||||
end;
|
end;
|
||||||
UpdateProjectDirectory;
|
UpdateProjectDirectory;
|
||||||
Modified:=true;
|
Modified:=true;
|
||||||
@ -3172,6 +3175,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.184 2005/05/26 20:17:49 mattias
|
||||||
|
added TLazProject.ProjectInfoFile, fixed saving editor files if deleted
|
||||||
|
|
||||||
Revision 1.183 2005/05/26 15:54:02 mattias
|
Revision 1.183 2005/05/26 15:54:02 mattias
|
||||||
changed OI SHow Hints option to resource string, added TProjectDescriptor.DoInitDescriptor
|
changed OI SHow Hints option to resource string, added TProjectDescriptor.DoInitDescriptor
|
||||||
|
|
||||||
|
@ -73,8 +73,12 @@ type
|
|||||||
Flags: TOpenFlags): TModalResult; virtual; abstract;
|
Flags: TOpenFlags): TModalResult; virtual; abstract;
|
||||||
function DoOpenFileAndJumpToIdentifier(const AFilename, AnIdentifier: string;
|
function DoOpenFileAndJumpToIdentifier(const AFilename, AnIdentifier: string;
|
||||||
PageIndex: integer; Flags: TOpenFlags): TModalResult; virtual; abstract;
|
PageIndex: integer; Flags: TOpenFlags): TModalResult; virtual; abstract;
|
||||||
|
function GetPrimaryConfigPath: String; virtual; abstract;
|
||||||
|
function GetSecondaryConfigPath: String; virtual; abstract;
|
||||||
|
procedure CopySecondaryConfigFile(const AFilename: String); virtual; abstract;
|
||||||
public
|
public
|
||||||
property ActiveProject: TLazProject read GetActiveProject;
|
property ActiveProject: TLazProject read GetActiveProject;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
@ -430,14 +430,12 @@ type
|
|||||||
private
|
private
|
||||||
FDefaultExt: string;
|
FDefaultExt: string;
|
||||||
FFlags: TProjectFlags;
|
FFlags: TProjectFlags;
|
||||||
FInitialized: boolean;
|
|
||||||
FName: string;
|
FName: string;
|
||||||
FReferenceCount: integer;
|
FReferenceCount: integer;
|
||||||
FVisibleInNewDialog: boolean;
|
FVisibleInNewDialog: boolean;
|
||||||
protected
|
protected
|
||||||
procedure SetName(const AValue: string); virtual;
|
procedure SetName(const AValue: string); virtual;
|
||||||
procedure SetFlags(const AValue: TProjectFlags); virtual;
|
procedure SetFlags(const AValue: TProjectFlags); virtual;
|
||||||
procedure SetInitialized;
|
|
||||||
function DoInitDescriptor: TModalResult; virtual;// put here option dialogs
|
function DoInitDescriptor: TModalResult; virtual;// put here option dialogs
|
||||||
public
|
public
|
||||||
constructor Create; virtual;
|
constructor Create; virtual;
|
||||||
@ -453,7 +451,6 @@ type
|
|||||||
property VisibleInNewDialog: boolean read FVisibleInNewDialog write FVisibleInNewDialog;
|
property VisibleInNewDialog: boolean read FVisibleInNewDialog write FVisibleInNewDialog;
|
||||||
property Flags: TProjectFlags read FFlags write SetFlags;
|
property Flags: TProjectFlags read FFlags write SetFlags;
|
||||||
property DefaultExt: string read FDefaultExt write FDefaultExt;
|
property DefaultExt: string read FDefaultExt write FDefaultExt;
|
||||||
property Initialized: boolean read FInitialized;
|
|
||||||
end;
|
end;
|
||||||
TProjectDescriptorClass = class of TProjectDescriptor;
|
TProjectDescriptorClass = class of TProjectDescriptor;
|
||||||
|
|
||||||
@ -488,6 +485,8 @@ type
|
|||||||
procedure SetFiles(Index: integer; const AValue: TLazProjectFile); virtual; abstract;
|
procedure SetFiles(Index: integer; const AValue: TLazProjectFile); virtual; abstract;
|
||||||
procedure SetTitle(const AValue: String); virtual;
|
procedure SetTitle(const AValue: String); virtual;
|
||||||
procedure SetFlags(const AValue: TProjectFlags); virtual;
|
procedure SetFlags(const AValue: TProjectFlags); virtual;
|
||||||
|
function GetProjectInfoFile: string; virtual; abstract;
|
||||||
|
procedure SetProjectInfoFile(const NewFilename: string); virtual; abstract;
|
||||||
public
|
public
|
||||||
constructor Create(ProjectDescription: TProjectDescriptor); virtual;
|
constructor Create(ProjectDescription: TProjectDescriptor); virtual;
|
||||||
function CreateProjectFile(const Filename: string
|
function CreateProjectFile(const Filename: string
|
||||||
@ -507,6 +506,8 @@ type
|
|||||||
property Flags: TProjectFlags read FFlags write SetFlags;
|
property Flags: TProjectFlags read FFlags write SetFlags;
|
||||||
property LazCompilerOptions: TLazCompilerOptions read FLazCompilerOptions
|
property LazCompilerOptions: TLazCompilerOptions read FLazCompilerOptions
|
||||||
write SetLazCompilerOptions;
|
write SetLazCompilerOptions;
|
||||||
|
property ProjectInfoFile: string
|
||||||
|
read GetProjectInfoFile write SetProjectInfoFile;
|
||||||
end;
|
end;
|
||||||
TLazProjectClass = class of TLazProject;
|
TLazProjectClass = class of TLazProject;
|
||||||
|
|
||||||
@ -841,11 +842,6 @@ begin
|
|||||||
FFlags:=AValue;
|
FFlags:=AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectDescriptor.SetInitialized;
|
|
||||||
begin
|
|
||||||
FInitialized:=true;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TProjectDescriptor.DoInitDescriptor: TModalResult;
|
function TProjectDescriptor.DoInitDescriptor: TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
@ -891,11 +887,7 @@ end;
|
|||||||
|
|
||||||
function TProjectDescriptor.InitDescriptor: TModalResult;
|
function TProjectDescriptor.InitDescriptor: TModalResult;
|
||||||
begin
|
begin
|
||||||
if not Initialized then begin
|
|
||||||
Result:=DoInitDescriptor;
|
Result:=DoInitDescriptor;
|
||||||
SetInitialized;
|
|
||||||
end else
|
|
||||||
Result:=mrOk;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProjectDescriptor.InitProject(AProject: TLazProject): TModalResult;
|
function TProjectDescriptor.InitProject(AProject: TLazProject): TModalResult;
|
||||||
|
Loading…
Reference in New Issue
Block a user