mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-05 04:20:19 +02:00
Began adding code to save project to the output directory. Added TODO
comments and cleaned up some of the code. CAW git-svn-id: trunk@179 -
This commit is contained in:
parent
03b52d2c2c
commit
a2e58fdb3b
@ -42,6 +42,7 @@ type
|
|||||||
fBreakpoints: TList;
|
fBreakpoints: TList;
|
||||||
fCursorPos: LongInt;
|
fCursorPos: LongInt;
|
||||||
fFilename: String;
|
fFilename: String;
|
||||||
|
fLoaded: Boolean;
|
||||||
fReadOnly: Boolean;
|
fReadOnly: Boolean;
|
||||||
fSource: TStrings;
|
fSource: TStrings;
|
||||||
fSyntaxHighlighter: String;
|
fSyntaxHighlighter: String;
|
||||||
@ -52,6 +53,7 @@ type
|
|||||||
|
|
||||||
function ReadUnit: Boolean;
|
function ReadUnit: Boolean;
|
||||||
function WriteUnit: Boolean;
|
function WriteUnit: Boolean;
|
||||||
|
procedure Clear;
|
||||||
|
|
||||||
{ Properties }
|
{ Properties }
|
||||||
property AutoCreate: Boolean read fAutoCreate write fAutoCreate;
|
property AutoCreate: Boolean read fAutoCreate write fAutoCreate;
|
||||||
@ -59,6 +61,7 @@ type
|
|||||||
property Breakpoints: TList read fBreakpoints write fBreakpoints;
|
property Breakpoints: TList read fBreakpoints write fBreakpoints;
|
||||||
property CursorPos: LongInt read fCursorPos write fCursorPos;
|
property CursorPos: LongInt read fCursorPos write fCursorPos;
|
||||||
property Filename: String read fFilename write fFilename;
|
property Filename: String read fFilename write fFilename;
|
||||||
|
property Loaded: Boolean read fLoaded write fLoaded;
|
||||||
property ReadOnly: Boolean read fReadOnly write fReadOnly;
|
property ReadOnly: Boolean read fReadOnly write fReadOnly;
|
||||||
property Source: TStrings read fSource write fSource;
|
property Source: TStrings read fSource write fSource;
|
||||||
property SyntaxHighlighter: String read fSyntaxHighlighter write fSyntaxHighlighter;
|
property SyntaxHighlighter: String read fSyntaxHighlighter write fSyntaxHighlighter;
|
||||||
@ -73,6 +76,7 @@ type
|
|||||||
fAliases: String;
|
fAliases: String;
|
||||||
fCompilerOptions: TCompilerOptions;
|
fCompilerOptions: TCompilerOptions;
|
||||||
fIconPath: String;
|
fIconPath: String;
|
||||||
|
fLoaded: Boolean;
|
||||||
fMainUnit: String;
|
fMainUnit: String;
|
||||||
fOutputDirectory: String;
|
fOutputDirectory: String;
|
||||||
fProjectFile: String;
|
fProjectFile: String;
|
||||||
@ -101,11 +105,13 @@ type
|
|||||||
{ Procedures }
|
{ Procedures }
|
||||||
procedure AddUnit(AUnit: TUnitInfo);
|
procedure AddUnit(AUnit: TUnitInfo);
|
||||||
procedure RemoveUnit(AUnitName: String);
|
procedure RemoveUnit(AUnitName: String);
|
||||||
|
procedure Clear;
|
||||||
|
|
||||||
{ Properties }
|
{ Properties }
|
||||||
property Aliases: String read fAliases write fAliases;
|
property Aliases: String read fAliases write fAliases;
|
||||||
property CompilerOptions: TCompilerOptions read fCompilerOptions write fCompilerOptions;
|
property CompilerOptions: TCompilerOptions read fCompilerOptions write fCompilerOptions;
|
||||||
property IconPath: String read fIconPath write fIconPath;
|
property IconPath: String read fIconPath write fIconPath;
|
||||||
|
property Loaded: Boolean read fLoaded write fLoaded;
|
||||||
property MainUnit: String read fMainUnit write fMainUnit;
|
property MainUnit: String read fMainUnit write fMainUnit;
|
||||||
property OutputDirectory: String read fOutputDirectory write fOutputDirectory;
|
property OutputDirectory: String read fOutputDirectory write fOutputDirectory;
|
||||||
property ProjectFile: String read fProjectFile write fProjectFile;
|
property ProjectFile: String read fProjectFile write fProjectFile;
|
||||||
@ -143,6 +149,7 @@ begin
|
|||||||
fBreakpoints := TList.Create;
|
fBreakpoints := TList.Create;
|
||||||
fCursorPos := 0;
|
fCursorPos := 0;
|
||||||
fFilename := '';
|
fFilename := '';
|
||||||
|
fLoaded := false;
|
||||||
fReadOnly := false;
|
fReadOnly := false;
|
||||||
fSource := TStringList.Create;
|
fSource := TStringList.Create;
|
||||||
fSyntaxHighlighter := 'freepascal';
|
fSyntaxHighlighter := 'freepascal';
|
||||||
@ -186,11 +193,29 @@ begin
|
|||||||
try
|
try
|
||||||
// Load unit source code
|
// Load unit source code
|
||||||
Source.LoadFromFile(Filename);
|
Source.LoadFromFile(Filename);
|
||||||
|
Loaded := true;
|
||||||
except
|
except
|
||||||
Result := false;
|
Result := false;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
TUnitInfo Clear
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TUnitInfo.Clear;
|
||||||
|
begin
|
||||||
|
fAutoCreate := true;
|
||||||
|
fBookmarks.Clear;
|
||||||
|
fBreakpoints.Clear;
|
||||||
|
fCursorPos := 0;
|
||||||
|
fFilename := '';
|
||||||
|
fLoaded := false;
|
||||||
|
fReadOnly := false;
|
||||||
|
fSource.Clear;
|
||||||
|
fSyntaxHighlighter := 'freepascal';
|
||||||
|
fUnitName := '';
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TProject Class
|
TProject Class
|
||||||
@ -210,7 +235,7 @@ begin
|
|||||||
fCompilerOptions := TCompilerOptions.Create;
|
fCompilerOptions := TCompilerOptions.Create;
|
||||||
fIconPath := '';
|
fIconPath := '';
|
||||||
fMainUnit := '';
|
fMainUnit := '';
|
||||||
fOutputDirectory := '';
|
fOutputDirectory := '.';
|
||||||
fProjectFile := '';
|
fProjectFile := '';
|
||||||
fProjectInfoFile := '';
|
fProjectInfoFile := '';
|
||||||
fSource := TStringList.Create;
|
fSource := TStringList.Create;
|
||||||
@ -218,7 +243,7 @@ begin
|
|||||||
fTitle := '';
|
fTitle := '';
|
||||||
fUnitList := TList.Create;
|
fUnitList := TList.Create;
|
||||||
fUnitNameList := '';
|
fUnitNameList := '';
|
||||||
fUnitOutputDirectory := '';
|
fUnitOutputDirectory := '.';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -260,6 +285,12 @@ begin
|
|||||||
xmlcfg.SetValue('ProjectOptions/General/UnitOutputDirectory/Value', UnitOutputDirectory);
|
xmlcfg.SetValue('ProjectOptions/General/UnitOutputDirectory/Value', UnitOutputDirectory);
|
||||||
|
|
||||||
// Save project source code
|
// Save project source code
|
||||||
|
{TODO:
|
||||||
|
Check OutputDirectory to see if last character is /. If not, add one. If so, leave it as is
|
||||||
|
Add code to check to ensure we have a good ProjectFile (not nil)
|
||||||
|
Add code to split filename and put output directory into OutputDirectory property and
|
||||||
|
filename into ProjectFile property
|
||||||
|
}
|
||||||
Source.SaveToFile(ProjectFile);
|
Source.SaveToFile(ProjectFile);
|
||||||
|
|
||||||
// Set options for each Unit
|
// Set options for each Unit
|
||||||
@ -325,8 +356,8 @@ begin
|
|||||||
IconPath := xmlcfg.GetValue('ProjectOptions/General/IconPath/Value', './');
|
IconPath := xmlcfg.GetValue('ProjectOptions/General/IconPath/Value', './');
|
||||||
TargetFileExt := xmlcfg.GetValue('ProjectOptions/General/TargetFileExt/Value', '');
|
TargetFileExt := xmlcfg.GetValue('ProjectOptions/General/TargetFileExt/Value', '');
|
||||||
Title := xmlcfg.GetValue('ProjectOptions/General/Title/Value', '');
|
Title := xmlcfg.GetValue('ProjectOptions/General/Title/Value', '');
|
||||||
OutputDirectory := xmlcfg.GetValue('ProjectOptions/General/OutputDirectory/Value', './');
|
OutputDirectory := xmlcfg.GetValue('ProjectOptions/General/OutputDirectory/Value', '.');
|
||||||
UnitOutputDirectory := xmlcfg.GetValue('ProjectOptions/General/UnitOutputDirectory/Value', './');
|
UnitOutputDirectory := xmlcfg.GetValue('ProjectOptions/General/UnitOutputDirectory/Value', '.');
|
||||||
|
|
||||||
// Save project source code
|
// Save project source code
|
||||||
Source.LoadFromFile(ProjectFile);
|
Source.LoadFromFile(ProjectFile);
|
||||||
@ -420,6 +451,28 @@ begin
|
|||||||
}
|
}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
TProject Clear
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TProject.Clear;
|
||||||
|
begin
|
||||||
|
xmlcfg := nil;
|
||||||
|
|
||||||
|
fAliases := '';
|
||||||
|
fCompilerOptions.Clear;
|
||||||
|
fIconPath := '';
|
||||||
|
fMainUnit := '';
|
||||||
|
fOutputDirectory := '.';
|
||||||
|
fProjectFile := '';
|
||||||
|
fProjectInfoFile := '';
|
||||||
|
fSource.Clear;
|
||||||
|
fTargetFileExt := '';
|
||||||
|
fTitle := '';
|
||||||
|
fUnitList.Clear;
|
||||||
|
fUnitNameList := '';
|
||||||
|
fUnitOutputDirectory := '.';
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TProject GetUnitList
|
TProject GetUnitList
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -476,6 +529,10 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.7 2001/02/08 06:08:13 lazarus
|
||||||
|
Began adding code to save project to the output directory. Added TODO
|
||||||
|
comments and cleaned up some of the code. CAW
|
||||||
|
|
||||||
Revision 1.6 2001/01/31 13:03:33 lazarus
|
Revision 1.6 2001/01/31 13:03:33 lazarus
|
||||||
Commitng source with new editor.
|
Commitng source with new editor.
|
||||||
Shane
|
Shane
|
||||||
|
Loading…
Reference in New Issue
Block a user