mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 21:59:16 +02:00
IDE: add a GUI for compiler defines. Synchronized with Custom Options.
git-svn-id: trunk@42262 -
This commit is contained in:
parent
3882730b78
commit
e34bd5faf0
@ -187,11 +187,16 @@ type
|
|||||||
|
|
||||||
TCompilerOptReader = class
|
TCompilerOptReader = class
|
||||||
private
|
private
|
||||||
|
// Defines (-d...) are separated from custom options and stored here.
|
||||||
|
fDefines: TStringList;
|
||||||
|
// All options except for defines.
|
||||||
|
fOtherOptions: TStringList;
|
||||||
// Lists of selections parsed from "fpc -i". Contains supported technologies.
|
// Lists of selections parsed from "fpc -i". Contains supported technologies.
|
||||||
fSupportedCategories: TStringList;
|
fSupportedCategories: TStringList;
|
||||||
|
// Hierarchy of options parsed from "fpc -h".
|
||||||
fRootOptGroup: TCompilerOptGroup;
|
fRootOptGroup: TCompilerOptGroup;
|
||||||
fCompilerExecutable: string;
|
fCompilerExecutable: string; // Copiler path must be set by caller.
|
||||||
fCompilerVersion: string;
|
fCompilerVersion: string; // Parsed from "fpc -h".
|
||||||
fErrorMsg: String;
|
fErrorMsg: String;
|
||||||
function ReadFpcWithParam(aParam: string; aLines: TStringList): TModalResult;
|
function ReadFpcWithParam(aParam: string; aLines: TStringList): TModalResult;
|
||||||
procedure ReadVersion(s: string);
|
procedure ReadVersion(s: string);
|
||||||
@ -207,6 +212,8 @@ type
|
|||||||
function FromCustomOptions(aStrings: TStrings): TModalResult;
|
function FromCustomOptions(aStrings: TStrings): TModalResult;
|
||||||
function ToCustomOptions(aStrings: TStrings; aUseComments: Boolean): TModalResult;
|
function ToCustomOptions(aStrings: TStrings; aUseComments: Boolean): TModalResult;
|
||||||
public
|
public
|
||||||
|
property Defines: TStringList read fDefines;
|
||||||
|
property OtherOptions: TStringList read fOtherOptions;
|
||||||
property SupportedCategories: TStringList read fSupportedCategories;
|
property SupportedCategories: TStringList read fSupportedCategories;
|
||||||
property RootOptGroup: TCompilerOptGroup read fRootOptGroup;
|
property RootOptGroup: TCompilerOptGroup read fRootOptGroup;
|
||||||
property CompilerExecutable: string read fCompilerExecutable write fCompilerExecutable;
|
property CompilerExecutable: string read fCompilerExecutable write fCompilerExecutable;
|
||||||
@ -722,6 +729,8 @@ end;
|
|||||||
constructor TCompilerOptReader.Create;
|
constructor TCompilerOptReader.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
fDefines := TStringList.Create;
|
||||||
|
fOtherOptions := TStringList.Create;
|
||||||
fSupportedCategories := TStringList.Create;
|
fSupportedCategories := TStringList.Create;
|
||||||
fRootOptGroup := TCompilerOptGroup.Create(Nil);
|
fRootOptGroup := TCompilerOptGroup.Create(Nil);
|
||||||
end;
|
end;
|
||||||
@ -734,6 +743,8 @@ begin
|
|||||||
for i := 0 to fSupportedCategories.Count-1 do
|
for i := 0 to fSupportedCategories.Count-1 do
|
||||||
fSupportedCategories.Objects[i].Free;
|
fSupportedCategories.Objects[i].Free;
|
||||||
fSupportedCategories.Free;
|
fSupportedCategories.Free;
|
||||||
|
fOtherOptions.Free;
|
||||||
|
fDefines.Free;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -971,6 +982,7 @@ end;
|
|||||||
function TCompilerOptReader.FromCustomOptions(aStrings: TStrings): TModalResult;
|
function TCompilerOptReader.FromCustomOptions(aStrings: TStrings): TModalResult;
|
||||||
var
|
var
|
||||||
i, j, CommentPos: Integer;
|
i, j, CommentPos: Integer;
|
||||||
|
HasDefine: Boolean;
|
||||||
s: String;
|
s: String;
|
||||||
sl: TStringList;
|
sl: TStringList;
|
||||||
begin
|
begin
|
||||||
@ -984,11 +996,20 @@ begin
|
|||||||
CommentPos := Pos('//', s);
|
CommentPos := Pos('//', s);
|
||||||
if CommentPos > 0 then // Remove possible comment.
|
if CommentPos > 0 then // Remove possible comment.
|
||||||
s := TrimRight(Copy(s, 1, CommentPos));
|
s := TrimRight(Copy(s, 1, CommentPos));
|
||||||
|
HasDefine := Pos('-d', s) > 0;
|
||||||
|
if not HasDefine then
|
||||||
|
fOtherOptions.Add(s); // Don't split the line for other options if no defines.
|
||||||
sl.StrictDelimiter := True;
|
sl.StrictDelimiter := True;
|
||||||
sl.Delimiter := ' ';
|
sl.Delimiter := ' ';
|
||||||
sl.DelimitedText := s; // Split the line with space as a separator.
|
sl.DelimitedText := s; // Split the line with space as a separator.
|
||||||
for j := 0 to sl.Count-1 do
|
for j := 0 to sl.Count-1 do
|
||||||
fRootOptGroup.SelectOption(sl[j]);
|
if AnsiStartsStr('-d', sl[j]) then
|
||||||
|
fDefines.Add(sl[j])
|
||||||
|
else begin
|
||||||
|
fRootOptGroup.SelectOption(sl[j]);
|
||||||
|
if HasDefine then
|
||||||
|
fOtherOptions.Add(sl[j]);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
sl.Free;
|
sl.Free;
|
||||||
@ -1007,10 +1028,10 @@ function TCompilerOptReader.ToCustomOptions(aStrings: TStrings;
|
|||||||
Result := '';
|
Result := '';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CopyOptions(aRoot: TCompilerOpt): integer;
|
procedure CopyOptions(aRoot: TCompilerOpt);
|
||||||
var
|
var
|
||||||
Children: TCompilerOptList;
|
Children: TCompilerOptList;
|
||||||
i, Res: Integer;
|
i: Integer;
|
||||||
s: string;
|
s: string;
|
||||||
begin
|
begin
|
||||||
if aRoot is TCompilerOptGroup then
|
if aRoot is TCompilerOptGroup then
|
||||||
@ -1024,7 +1045,7 @@ function TCompilerOptReader.ToCustomOptions(aStrings: TStrings;
|
|||||||
end
|
end
|
||||||
else begin // TCompilerOptGroup
|
else begin // TCompilerOptGroup
|
||||||
for i := 0 to Children.Count-1 do // Recursive call for children.
|
for i := 0 to Children.Count-1 do // Recursive call for children.
|
||||||
Res := CopyOptions(TCompilerOpt(Children[i]));
|
CopyOptions(TCompilerOpt(Children[i]));
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else begin // TCompilerOpt
|
else begin // TCompilerOpt
|
||||||
@ -1036,12 +1057,13 @@ function TCompilerOptReader.ToCustomOptions(aStrings: TStrings;
|
|||||||
aStrings.Add(aRoot.Option + aRoot.Value + PossibleComment(aRoot));
|
aStrings.Add(aRoot.Option + aRoot.Value + PossibleComment(aRoot));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Result := Res;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
Result := mrOK;
|
||||||
aStrings.Clear;
|
aStrings.Clear;
|
||||||
Result := CopyOptions(fRootOptGroup);
|
CopyOptions(fRootOptGroup);
|
||||||
|
aStrings.AddStrings(fDefines);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -702,7 +702,6 @@ object CompilerOtherOptionsFrame: TCompilerOtherOptionsFrame
|
|||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object memoCustomOptions: TMemo
|
object memoCustomOptions: TMemo
|
||||||
AnchorSideLeft.Control = grpCustomOptions
|
AnchorSideLeft.Control = grpCustomOptions
|
||||||
AnchorSideRight.Control = btnAllOptions
|
|
||||||
AnchorSideBottom.Control = grpCustomOptions
|
AnchorSideBottom.Control = grpCustomOptions
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -713,11 +712,38 @@ object CompilerOtherOptionsFrame: TCompilerOtherOptionsFrame
|
|||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object btnAllOptions: TButton
|
object Label1: TLabel
|
||||||
|
AnchorSideRight.Control = grpCustomOptions
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 417
|
||||||
|
Height = 15
|
||||||
|
Top = 30
|
||||||
|
Width = 38
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Right = 21
|
||||||
|
Caption = 'Under'
|
||||||
|
Font.Color = clMaroon
|
||||||
|
ParentColor = False
|
||||||
|
ParentFont = False
|
||||||
|
end
|
||||||
|
object Label2: TLabel
|
||||||
|
AnchorSideRight.Control = grpCustomOptions
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 385
|
||||||
|
Height = 15
|
||||||
|
Top = 45
|
||||||
|
Width = 91
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
Caption = 'construction...'
|
||||||
|
Font.Color = clMaroon
|
||||||
|
ParentColor = False
|
||||||
|
ParentFont = False
|
||||||
|
end
|
||||||
|
object btnAllOptions: TBitBtn
|
||||||
AnchorSideRight.Control = grpCustomOptions
|
AnchorSideRight.Control = grpCustomOptions
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 381
|
Left = 381
|
||||||
Height = 25
|
Height = 26
|
||||||
Top = 4
|
Top = 4
|
||||||
Width = 95
|
Width = 95
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
@ -726,27 +752,21 @@ object CompilerOtherOptionsFrame: TCompilerOtherOptionsFrame
|
|||||||
OnClick = btnAllOptionsClick
|
OnClick = btnAllOptionsClick
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object Label1: TLabel
|
object btnDefines: TBitBtn
|
||||||
AnchorSideLeft.Control = btnAllOptions
|
AnchorSideTop.Control = btnAllOptions
|
||||||
Left = 381
|
AnchorSideTop.Side = asrBottom
|
||||||
Height = 15
|
AnchorSideRight.Control = btnAllOptions
|
||||||
Top = 28
|
AnchorSideRight.Side = asrBottom
|
||||||
Width = 38
|
Left = 399
|
||||||
Caption = 'Under'
|
Height = 26
|
||||||
Font.Color = clMaroon
|
Top = 70
|
||||||
ParentColor = False
|
Width = 77
|
||||||
ParentFont = False
|
Anchors = [akTop, akRight]
|
||||||
end
|
AutoSize = True
|
||||||
object Label2: TLabel
|
BorderSpacing.Top = 40
|
||||||
AnchorSideLeft.Control = btnAllOptions
|
Caption = 'Defines ...'
|
||||||
Left = 381
|
OnClick = btnDefinesClick
|
||||||
Height = 15
|
TabOrder = 2
|
||||||
Top = 44
|
|
||||||
Width = 91
|
|
||||||
Caption = 'construction...'
|
|
||||||
Font.Color = clMaroon
|
|
||||||
ParentColor = False
|
|
||||||
ParentFont = False
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -33,14 +33,15 @@ uses
|
|||||||
CodeToolsCfgScript, KeywordFuncLists, LazarusIDEStrConsts,
|
CodeToolsCfgScript, KeywordFuncLists, LazarusIDEStrConsts,
|
||||||
IDEOptionsIntf, CompOptsIntf, IDECommands, Project,
|
IDEOptionsIntf, CompOptsIntf, IDECommands, Project,
|
||||||
CompilerOptions, AllCompilerOptions, EditorOptions, PackageDefs,
|
CompilerOptions, AllCompilerOptions, EditorOptions, PackageDefs,
|
||||||
SynEdit, SynEditKeyCmds, SynCompletion, SourceSynEditor;
|
SynEdit, SynEditKeyCmds, SynCompletion, SourceSynEditor, CustomDefines;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TCompilerOtherOptionsFrame }
|
{ TCompilerOtherOptionsFrame }
|
||||||
|
|
||||||
TCompilerOtherOptionsFrame = class(TAbstractIDEOptionsEditor)
|
TCompilerOtherOptionsFrame = class(TAbstractIDEOptionsEditor)
|
||||||
btnAllOptions: TButton;
|
btnDefines: TBitBtn;
|
||||||
|
btnAllOptions: TBitBtn;
|
||||||
grpCustomOptions: TGroupBox;
|
grpCustomOptions: TGroupBox;
|
||||||
grpConditionals: TGroupBox;
|
grpConditionals: TGroupBox;
|
||||||
CondStatusbar: TStatusBar;
|
CondStatusbar: TStatusBar;
|
||||||
@ -50,6 +51,7 @@ type
|
|||||||
Label2: TLabel;
|
Label2: TLabel;
|
||||||
memoCustomOptions: TMemo;
|
memoCustomOptions: TMemo;
|
||||||
procedure btnAllOptionsClick(Sender: TObject);
|
procedure btnAllOptionsClick(Sender: TObject);
|
||||||
|
procedure btnDefinesClick(Sender: TObject);
|
||||||
procedure CondSynEditChange(Sender: TObject);
|
procedure CondSynEditChange(Sender: TObject);
|
||||||
procedure CondSynEditKeyPress(Sender: TObject; var Key: char);
|
procedure CondSynEditKeyPress(Sender: TObject; var Key: char);
|
||||||
procedure CondSynEditProcessUserCommand(Sender: TObject;
|
procedure CondSynEditProcessUserCommand(Sender: TObject;
|
||||||
@ -117,6 +119,7 @@ begin
|
|||||||
AllOpts.CustomOptions := memoCustomOptions.Lines;
|
AllOpts.CustomOptions := memoCustomOptions.Lines;
|
||||||
if AllOpts.ShowModal = mrOK then
|
if AllOpts.ShowModal = mrOK then
|
||||||
begin
|
begin
|
||||||
|
// Synchronize with custom options memo
|
||||||
AllOpts.ToCustomOptions(memoCustomOptions.Lines);
|
AllOpts.ToCustomOptions(memoCustomOptions.Lines);
|
||||||
memoCustomOptions.Invalidate;
|
memoCustomOptions.Invalidate;
|
||||||
end;
|
end;
|
||||||
@ -125,6 +128,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCompilerOtherOptionsFrame.btnDefinesClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
EditForm: TCustomDefinesForm;
|
||||||
|
begin
|
||||||
|
EditForm:=TCustomDefinesForm.Create(Nil);
|
||||||
|
try
|
||||||
|
EditForm.DefinesCheckList.Items.Assign(Project1.CustomDefines);
|
||||||
|
EditForm.FromCustomOptions(memoCustomOptions.Lines);
|
||||||
|
if EditForm.ShowModal=mrOK then
|
||||||
|
begin
|
||||||
|
Project1.CustomDefines.Assign(EditForm.DefinesCheckList.Items);
|
||||||
|
// Synchronize with custom options memo
|
||||||
|
EditForm.ToCustomOptions(memoCustomOptions.Lines);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
EditForm.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
// Events dealing with conditionals SynEdit :
|
// Events dealing with conditionals SynEdit :
|
||||||
|
|
||||||
procedure TCompilerOtherOptionsFrame.CondSynEditChange(Sender: TObject);
|
procedure TCompilerOtherOptionsFrame.CondSynEditChange(Sender: TObject);
|
||||||
@ -138,9 +160,8 @@ begin
|
|||||||
//debugln(['TCompilerOtherOptionsFrame.CondSynEditKeyPress ',ord(Key)]);
|
//debugln(['TCompilerOtherOptionsFrame.CondSynEditKeyPress ',ord(Key)]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCompilerOtherOptionsFrame.CondSynEditProcessUserCommand(
|
procedure TCompilerOtherOptionsFrame.CondSynEditProcessUserCommand(Sender: TObject;
|
||||||
Sender: TObject; var Command: TSynEditorCommand; var AChar: TUTF8Char;
|
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
|
||||||
Data: pointer);
|
|
||||||
begin
|
begin
|
||||||
if (Command=ecWordCompletion) or (Command=ecIdentCompletion) then
|
if (Command=ecWordCompletion) or (Command=ecIdentCompletion) then
|
||||||
StartCompletion;
|
StartCompletion;
|
||||||
@ -630,6 +651,8 @@ begin
|
|||||||
grpCustomOptions.Caption := lisCustomOptions2;
|
grpCustomOptions.Caption := lisCustomOptions2;
|
||||||
memoCustomOptions.Hint := lisCustomOptHint;
|
memoCustomOptions.Hint := lisCustomOptHint;
|
||||||
grpConditionals.Caption := lisConditionals;
|
grpConditionals.Caption := lisConditionals;
|
||||||
|
btnAllOptions.Caption := lisDlgAllOptions;
|
||||||
|
btnDefines.Caption := lisDlgDefines;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCompilerOtherOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
procedure TCompilerOtherOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||||
|
@ -6,13 +6,12 @@ object GenericListEditForm: TGenericListEditForm
|
|||||||
Caption = 'GenericListEditForm'
|
Caption = 'GenericListEditForm'
|
||||||
ClientHeight = 301
|
ClientHeight = 301
|
||||||
ClientWidth = 343
|
ClientWidth = 343
|
||||||
OnCreate = FormCreate
|
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '0.9.31'
|
LCLVersion = '1.1'
|
||||||
object ButtonPanel1: TButtonPanel
|
object ButtonPanel1: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 26
|
Height = 33
|
||||||
Top = 269
|
Top = 262
|
||||||
Width = 331
|
Width = 331
|
||||||
OKButton.Name = 'OKButton'
|
OKButton.Name = 'OKButton'
|
||||||
OKButton.DefaultCaption = True
|
OKButton.DefaultCaption = True
|
||||||
@ -30,7 +29,7 @@ object GenericListEditForm: TGenericListEditForm
|
|||||||
end
|
end
|
||||||
object Memo1: TMemo
|
object Memo1: TMemo
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 263
|
Height = 256
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 343
|
Width = 343
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
@ -15,7 +15,6 @@ type
|
|||||||
TGenericListEditForm = class(TForm)
|
TGenericListEditForm = class(TForm)
|
||||||
ButtonPanel1: TButtonPanel;
|
ButtonPanel1: TButtonPanel;
|
||||||
Memo1: TMemo;
|
Memo1: TMemo;
|
||||||
procedure FormCreate(Sender:TObject);
|
|
||||||
private
|
private
|
||||||
|
|
||||||
public
|
public
|
||||||
@ -29,13 +28,5 @@ implementation
|
|||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
{ TGenericListEditForm }
|
|
||||||
|
|
||||||
procedure TGenericListEditForm.FormCreate(Sender:TObject);
|
|
||||||
begin
|
|
||||||
ButtonPanel1.OKButton.Caption:=lisMenuOk;
|
|
||||||
ButtonPanel1.CancelButton.Caption:=lisCancel;
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -3144,7 +3144,6 @@ resourcestring
|
|||||||
lisLazBuildABOChooseOutputDir = 'Choose output directory of the IDE executable ';
|
lisLazBuildABOChooseOutputDir = 'Choose output directory of the IDE executable ';
|
||||||
lisLazBuildDefines = 'Defines';
|
lisLazBuildDefines = 'Defines';
|
||||||
lisLazBuildEditDefines = 'Edit Defines';
|
lisLazBuildEditDefines = 'Edit Defines';
|
||||||
lisLazBuildEditDefinesDialogCaption = 'Edit Defines';
|
|
||||||
lisLazBuildNameOfTheActiveProfile = 'Name of the active profile';
|
lisLazBuildNameOfTheActiveProfile = 'Name of the active profile';
|
||||||
lisLazBuildManageProfiles2 = 'Manage profiles';
|
lisLazBuildManageProfiles2 = 'Manage profiles';
|
||||||
lisLazBuildDefinesWithoutD = 'Defines without -d';
|
lisLazBuildDefinesWithoutD = 'Defines without -d';
|
||||||
@ -5371,6 +5370,8 @@ resourcestring
|
|||||||
lisHintADefaultValueCanBeDefinedInTheConditionals = 'Hint: A default value '
|
lisHintADefaultValueCanBeDefinedInTheConditionals = 'Hint: A default value '
|
||||||
+'can be defined in the conditionals.';
|
+'can be defined in the conditionals.';
|
||||||
lisConditionals = 'Conditionals';
|
lisConditionals = 'Conditionals';
|
||||||
|
lisDlgAllOptions = 'All options ...';
|
||||||
|
lisDlgDefines = 'Defines ...';
|
||||||
lisWithIncludes = '%s, with includes %s';
|
lisWithIncludes = '%s, with includes %s';
|
||||||
lisWithIncludes2 = ', with includes ';
|
lisWithIncludes2 = ', with includes ';
|
||||||
lisParsed = ', parsed ';
|
lisParsed = ', parsed ';
|
||||||
|
@ -773,6 +773,7 @@ type
|
|||||||
FStateFlags: TLazProjectStateFlags;
|
FStateFlags: TLazProjectStateFlags;
|
||||||
FStorePathDelim: TPathDelimSwitch;
|
FStorePathDelim: TPathDelimSwitch;
|
||||||
FUnitList: TFPList; // list of _all_ units (TUnitInfo)
|
FUnitList: TFPList; // list of _all_ units (TUnitInfo)
|
||||||
|
FCustomDefines: TStrings; // list of user selectable defines for custom options
|
||||||
FUpdateLock: integer;
|
FUpdateLock: integer;
|
||||||
FUseAsDefault: Boolean;
|
FUseAsDefault: Boolean;
|
||||||
procedure ClearBuildModes;
|
procedure ClearBuildModes;
|
||||||
@ -1078,6 +1079,7 @@ type
|
|||||||
property StorePathDelim: TPathDelimSwitch read FStorePathDelim write SetStorePathDelim;
|
property StorePathDelim: TPathDelimSwitch read FStorePathDelim write SetStorePathDelim;
|
||||||
property TargetFilename: string read GetTargetFilename write SetTargetFilename;
|
property TargetFilename: string read GetTargetFilename write SetTargetFilename;
|
||||||
property Units[Index: integer]: TUnitInfo read GetUnits;
|
property Units[Index: integer]: TUnitInfo read GetUnits;
|
||||||
|
property CustomDefines: TStrings read FCustomDefines;
|
||||||
property UpdateLock: integer read FUpdateLock;
|
property UpdateLock: integer read FUpdateLock;
|
||||||
property UseAsDefault: Boolean read FUseAsDefault write FUseAsDefault; // for dialog only (used to store options once)
|
property UseAsDefault: Boolean read FUseAsDefault write FUseAsDefault; // for dialog only (used to store options once)
|
||||||
end;
|
end;
|
||||||
@ -2565,6 +2567,7 @@ begin
|
|||||||
FRunParameters:=TRunParamsOptions.Create;
|
FRunParameters:=TRunParamsOptions.Create;
|
||||||
Title := '';
|
Title := '';
|
||||||
FUnitList := TFPList.Create; // list of TUnitInfo
|
FUnitList := TFPList.Create; // list of TUnitInfo
|
||||||
|
FCustomDefines := TStringList.Create;
|
||||||
|
|
||||||
FResources := TProjectResources.Create(Self);
|
FResources := TProjectResources.Create(Self);
|
||||||
ProjResources.OnModified := @EmbeddedObjectModified;
|
ProjResources.OnModified := @EmbeddedObjectModified;
|
||||||
@ -2586,6 +2589,7 @@ begin
|
|||||||
FreeAndNil(FAllEditorsInfoList);
|
FreeAndNil(FAllEditorsInfoList);
|
||||||
FreeThenNil(FResources);
|
FreeThenNil(FResources);
|
||||||
FreeThenNil(FBookmarks);
|
FreeThenNil(FBookmarks);
|
||||||
|
FreeThenNil(FCustomDefines);
|
||||||
FreeThenNil(FUnitList);
|
FreeThenNil(FUnitList);
|
||||||
FreeThenNil(FJumpHistory);
|
FreeThenNil(FJumpHistory);
|
||||||
FreeThenNil(FSourceDirectories);
|
FreeThenNil(FSourceDirectories);
|
||||||
@ -2797,6 +2801,17 @@ function TProject.WriteProject(ProjectWriteFlags: TProjectWriteFlags;
|
|||||||
aConfig.SetDeleteValue(Path+'Units/Count',SaveUnitCount,0);
|
aConfig.SetDeleteValue(Path+'Units/Count',SaveUnitCount,0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure SaveCustomDefines(aConfig: TXMLConfig; const Path: string);
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
for i:=0 to FCustomDefines.Count-1 do begin
|
||||||
|
aConfig.SetDeleteValue(Path+'CustomDefines/Define'+IntToStr(i)+'/Value',
|
||||||
|
FCustomDefines[i],'');
|
||||||
|
end;
|
||||||
|
aConfig.SetDeleteValue(Path+'CustomDefines/Count',FCustomDefines.Count,0);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure SaveSessionInfo(aConfig: TXMLConfig; const Path: string);
|
procedure SaveSessionInfo(aConfig: TXMLConfig; const Path: string);
|
||||||
begin
|
begin
|
||||||
aConfig.DeleteValue(Path+'General/ActiveEditorIndexAtStart/Value');
|
aConfig.DeleteValue(Path+'General/ActiveEditorIndexAtStart/Value');
|
||||||
@ -2966,8 +2981,11 @@ begin
|
|||||||
// save units
|
// save units
|
||||||
SaveUnits(XMLConfig,Path,true,SaveSessionInfoInLPI);
|
SaveUnits(XMLConfig,Path,true,SaveSessionInfoInLPI);
|
||||||
|
|
||||||
// save session info
|
|
||||||
if SaveSessionInfoInLPI then begin
|
if SaveSessionInfoInLPI then begin
|
||||||
|
// save custom defines
|
||||||
|
SaveCustomDefines(XMLConfig,Path);
|
||||||
|
|
||||||
|
// save session info
|
||||||
SaveSessionInfo(XMLConfig,Path);
|
SaveSessionInfo(XMLConfig,Path);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3050,7 +3068,10 @@ begin
|
|||||||
// save all units
|
// save all units
|
||||||
SaveUnits(XMLConfig,Path,true,true);
|
SaveUnits(XMLConfig,Path,true,true);
|
||||||
|
|
||||||
// save session
|
// save custom defines
|
||||||
|
SaveCustomDefines(XMLConfig,Path);
|
||||||
|
|
||||||
|
// save session info
|
||||||
SaveSessionInfo(XMLConfig,Path);
|
SaveSessionInfo(XMLConfig,Path);
|
||||||
|
|
||||||
// notifiy hooks
|
// notifiy hooks
|
||||||
@ -3447,7 +3468,21 @@ var
|
|||||||
end;
|
end;
|
||||||
FFlags:=FFlags-[pfUseDefaultCompilerOptions];
|
FFlags:=FFlags-[pfUseDefaultCompilerOptions];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure LoadCustomDefines(XMLConfig: TXMLConfig; const Path: string; Merge: boolean);
|
||||||
|
var
|
||||||
|
Cnt, i: Integer;
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
Cnt := XMLConfig.GetValue(Path+'CustomDefines/Count', 0);
|
||||||
|
for i := 0 to Cnt-1 do
|
||||||
|
begin
|
||||||
|
s := XMLConfig.GetValue(Path+'CustomDefines/Define'+IntToStr(i)+'/Value', '');
|
||||||
|
if s <> '' then
|
||||||
|
FCustomDefines.Add(s);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure LoadSessionInfo(XMLConfig: TXMLConfig; const Path: string; Merge: boolean);
|
procedure LoadSessionInfo(XMLConfig: TXMLConfig; const Path: string; Merge: boolean);
|
||||||
var
|
var
|
||||||
NewUnitInfo: TUnitInfo;
|
NewUnitInfo: TUnitInfo;
|
||||||
@ -3705,6 +3740,10 @@ begin
|
|||||||
PublishOptions.LoadFromXMLConfig(xmlconfig,
|
PublishOptions.LoadFromXMLConfig(xmlconfig,
|
||||||
Path+'PublishOptions/',fPathDelimChanged);
|
Path+'PublishOptions/',fPathDelimChanged);
|
||||||
|
|
||||||
|
// load session info
|
||||||
|
if not LoadParts then
|
||||||
|
LoadCustomDefines(XMLConfig,Path,false);
|
||||||
|
|
||||||
// load session info
|
// load session info
|
||||||
if not LoadParts then
|
if not LoadParts then
|
||||||
LoadSessionInfo(XMLConfig,Path,false);
|
LoadSessionInfo(XMLConfig,Path,false);
|
||||||
@ -3743,6 +3782,9 @@ begin
|
|||||||
// load MacroValues and compiler options
|
// load MacroValues and compiler options
|
||||||
LoadBuildModes(XMLConfig,Path,false);
|
LoadBuildModes(XMLConfig,Path,false);
|
||||||
|
|
||||||
|
// load custom defines
|
||||||
|
LoadCustomDefines(XMLConfig,Path,true);
|
||||||
|
|
||||||
// load session info
|
// load session info
|
||||||
LoadSessionInfo(XMLConfig,Path,true);
|
LoadSessionInfo(XMLConfig,Path,true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user