mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-07 23:59:54 +01:00
IDE: Store defines added by user to compiler options. Works also for packages. Issue #28887.
git-svn-id: trunk@50184 -
This commit is contained in:
parent
e16565eebb
commit
e92ffb6dc2
@ -173,6 +173,7 @@ type
|
|||||||
procedure SetTrashVariables(const AValue: Boolean);
|
procedure SetTrashVariables(const AValue: Boolean);
|
||||||
procedure SetUncertainOpt(const AValue: Boolean);
|
procedure SetUncertainOpt(const AValue: Boolean);
|
||||||
procedure SetUseAnsiStr(const AValue: Boolean);
|
procedure SetUseAnsiStr(const AValue: Boolean);
|
||||||
|
procedure SetUseCommentsInCustomOptions(AValue: Boolean);
|
||||||
procedure SetUseExternalDbgSyms(const AValue: Boolean);
|
procedure SetUseExternalDbgSyms(const AValue: Boolean);
|
||||||
procedure SetUseHeaptrc(const AValue: Boolean);
|
procedure SetUseHeaptrc(const AValue: Boolean);
|
||||||
procedure SetUseLineInfoUnit(const AValue: Boolean);
|
procedure SetUseLineInfoUnit(const AValue: Boolean);
|
||||||
@ -434,7 +435,8 @@ type
|
|||||||
property CustomConfigFile: Boolean read fCustomConfigFile write SetCustomConfigFile;
|
property CustomConfigFile: Boolean read fCustomConfigFile write SetCustomConfigFile;
|
||||||
property ConfigFilePath: String read fConfigFilePath write SetConfigFilePath;
|
property ConfigFilePath: String read fConfigFilePath write SetConfigFilePath;
|
||||||
property CustomOptions: string read GetCustomOptions write SetCustomOptions;
|
property CustomOptions: string read GetCustomOptions write SetCustomOptions;
|
||||||
property UseCommentsInCustomOptions: Boolean read fUseCommentsInCustomOptions write fUseCommentsInCustomOptions;
|
property UseCommentsInCustomOptions: Boolean read fUseCommentsInCustomOptions
|
||||||
|
write SetUseCommentsInCustomOptions;
|
||||||
|
|
||||||
// execute other
|
// execute other
|
||||||
procedure SetAlternativeCompile(const Command: string; ScanFPCMsgs: boolean); virtual; abstract; // disable normal compile and call this instead
|
procedure SetAlternativeCompile(const Command: string; ScanFPCMsgs: boolean); virtual; abstract; // disable normal compile and call this instead
|
||||||
@ -815,6 +817,13 @@ begin
|
|||||||
IncreaseChangeStamp;
|
IncreaseChangeStamp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLazCompilerOptions.SetUseCommentsInCustomOptions(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
if fUseCommentsInCustomOptions=AValue then Exit;
|
||||||
|
fUseCommentsInCustomOptions:=AValue;
|
||||||
|
IncreaseChangeStamp;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLazCompilerOptions.SetUseExternalDbgSyms(const AValue: Boolean);
|
procedure TLazCompilerOptions.SetUseExternalDbgSyms(const AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
if FUseExternalDbgSyms=AValue then exit;
|
if FUseExternalDbgSyms=AValue then exit;
|
||||||
|
|||||||
@ -307,12 +307,11 @@ type
|
|||||||
class function GetPrimaryConfigPath: String; virtual; abstract;
|
class function GetPrimaryConfigPath: String; virtual; abstract;
|
||||||
class function GetSecondaryConfigPath: String; virtual; abstract;
|
class function GetSecondaryConfigPath: String; virtual; abstract;
|
||||||
procedure CopySecondaryConfigFile(const AFilename: String); virtual; abstract;
|
procedure CopySecondaryConfigFile(const AFilename: String); virtual; abstract;
|
||||||
procedure DoOpenIDEOptions(AEditor: TAbstractIDEOptionsEditorClass = nil;
|
function DoOpenIDEOptions(AEditor: TAbstractIDEOptionsEditorClass = nil;
|
||||||
ACaption: String = ''); overload;
|
ACaption: String = ''): Boolean; overload;
|
||||||
procedure DoOpenIDEOptions(AEditor: TAbstractIDEOptionsEditorClass;
|
function DoOpenIDEOptions(AEditor: TAbstractIDEOptionsEditorClass;
|
||||||
ACaption: String;
|
ACaption: String; AOptionsFilter: array of TAbstractIDEOptionsClass;
|
||||||
AOptionsFilter: array of TAbstractIDEOptionsClass;
|
ASettings: TIDEOptionsEditorSettings): Boolean; overload; virtual; abstract;
|
||||||
ASettings: TIDEOptionsEditorSettings); overload; virtual; abstract;
|
|
||||||
|
|
||||||
// filenames, paths
|
// filenames, paths
|
||||||
function CreateNewUniqueFilename(const Prefix, Ext: string;
|
function CreateNewUniqueFilename(const Prefix, Ext: string;
|
||||||
@ -654,9 +653,10 @@ begin
|
|||||||
Result:=DoNewFile(NewFileDescriptor,NewFilename,NewSource,NewFlags,nil);
|
Result:=DoNewFile(NewFileDescriptor,NewFilename,NewSource,NewFlags,nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLazIDEInterface.DoOpenIDEOptions(AEditor: TAbstractIDEOptionsEditorClass; ACaption: String);
|
function TLazIDEInterface.DoOpenIDEOptions(AEditor: TAbstractIDEOptionsEditorClass;
|
||||||
|
ACaption: String): Boolean;
|
||||||
begin
|
begin
|
||||||
DoOpenIDEOptions(AEditor, ACaption, [], []);
|
Result := DoOpenIDEOptions(AEditor, ACaption, [], []);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLazIDEInterface.DoShowSearchResultsView(Show: boolean;
|
procedure TLazIDEInterface.DoShowSearchResultsView(Show: boolean;
|
||||||
|
|||||||
@ -423,6 +423,7 @@ type
|
|||||||
fInheritedOptParseStamps: integer;
|
fInheritedOptParseStamps: integer;
|
||||||
FParsedOpts: TParsedCompilerOptions;
|
FParsedOpts: TParsedCompilerOptions;
|
||||||
FStorePathDelim: TPathDelimSwitch;
|
FStorePathDelim: TPathDelimSwitch;
|
||||||
|
FOtherDefines: TStrings; // list of user selectable defines for custom options
|
||||||
FFPCMsgFile: TFPCMsgFilePoolItem;
|
FFPCMsgFile: TFPCMsgFilePoolItem;
|
||||||
|
|
||||||
// other tools
|
// other tools
|
||||||
@ -560,6 +561,7 @@ type
|
|||||||
|
|
||||||
// stored properties
|
// stored properties
|
||||||
property StorePathDelim: TPathDelimSwitch read FStorePathDelim write FStorePathDelim;
|
property StorePathDelim: TPathDelimSwitch read FStorePathDelim write FStorePathDelim;
|
||||||
|
property OtherDefines: TStrings read FOtherDefines;
|
||||||
|
|
||||||
// compilation
|
// compilation
|
||||||
property CompilerPath: String read GetCompilerPath write SetCompilerPath;
|
property CompilerPath: String read GetCompilerPath write SetCompilerPath;
|
||||||
@ -1093,6 +1095,7 @@ constructor TBaseCompilerOptions.Create(const AOwner: TObject;
|
|||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FParsedOpts := TParsedCompilerOptions.Create(Self);
|
FParsedOpts := TParsedCompilerOptions.Create(Self);
|
||||||
|
FOtherDefines := TStringList.Create;
|
||||||
FExecuteBefore := AToolClass.Create(Self);
|
FExecuteBefore := AToolClass.Create(Self);
|
||||||
FExecuteBefore.OnChanged := @OnItemChanged;
|
FExecuteBefore.OnChanged := @OnItemChanged;
|
||||||
FExecuteAfter := AToolClass.Create(Self);
|
FExecuteAfter := AToolClass.Create(Self);
|
||||||
@ -1118,6 +1121,7 @@ begin
|
|||||||
FreeAndNil(fBuildMacros);
|
FreeAndNil(fBuildMacros);
|
||||||
FreeThenNil(fExecuteBefore);
|
FreeThenNil(fExecuteBefore);
|
||||||
FreeThenNil(fExecuteAfter);
|
FreeThenNil(fExecuteAfter);
|
||||||
|
FreeThenNil(FOtherDefines);
|
||||||
FreeThenNil(FParsedOpts);
|
FreeThenNil(FParsedOpts);
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -1507,7 +1511,8 @@ var
|
|||||||
var
|
var
|
||||||
b: boolean;
|
b: boolean;
|
||||||
dit: TCompilerDbgSymbolType;
|
dit: TCompilerDbgSymbolType;
|
||||||
i: Integer;
|
i, Cnt: Integer;
|
||||||
|
s: String;
|
||||||
begin
|
begin
|
||||||
{ Load the compiler options from the XML file }
|
{ Load the compiler options from the XML file }
|
||||||
p:=Path;
|
p:=Path;
|
||||||
@ -1671,6 +1676,15 @@ begin
|
|||||||
CustomOptions := LineBreaksToSystemLineBreaks(aXMLConfig.GetValue(p+'CustomOptions/Value', ''));
|
CustomOptions := LineBreaksToSystemLineBreaks(aXMLConfig.GetValue(p+'CustomOptions/Value', ''));
|
||||||
UseCommentsInCustomOptions := aXMLConfig.GetValue(p+'ConfigFile/UseCommentsInCustomOptions/Value', false);
|
UseCommentsInCustomOptions := aXMLConfig.GetValue(p+'ConfigFile/UseCommentsInCustomOptions/Value', false);
|
||||||
|
|
||||||
|
FOtherDefines.Clear;
|
||||||
|
Cnt := aXMLConfig.GetValue(p+'OtherDefines/Count', 0);
|
||||||
|
for i := 0 to Cnt-1 do
|
||||||
|
begin
|
||||||
|
s := aXMLConfig.GetValue(p+'OtherDefines/Define'+IntToStr(i)+'/Value', '');
|
||||||
|
if s <> '' then
|
||||||
|
FOtherDefines.Add(s);
|
||||||
|
end;
|
||||||
|
|
||||||
{ Compilation }
|
{ Compilation }
|
||||||
CompilerPath := f(aXMLConfig.GetValue(p+'CompilerPath/Value',DefaultCompilerPath));
|
CompilerPath := f(aXMLConfig.GetValue(p+'CompilerPath/Value',DefaultCompilerPath));
|
||||||
|
|
||||||
@ -1729,6 +1743,7 @@ var
|
|||||||
|
|
||||||
var
|
var
|
||||||
P, s: string;
|
P, s: string;
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
{ Save the compiler options to the XML file }
|
{ Save the compiler options to the XML file }
|
||||||
p:=Path;
|
p:=Path;
|
||||||
@ -1852,6 +1867,11 @@ begin
|
|||||||
LineBreaksToSystemLineBreaks(CustomOptions),''); // do not touch / \ characters
|
LineBreaksToSystemLineBreaks(CustomOptions),''); // do not touch / \ characters
|
||||||
aXMLConfig.SetDeleteValue(p+'ConfigFile/UseCommentsInCustomOptions/Value', UseCommentsInCustomOptions,false);
|
aXMLConfig.SetDeleteValue(p+'ConfigFile/UseCommentsInCustomOptions/Value', UseCommentsInCustomOptions,false);
|
||||||
|
|
||||||
|
for i:=0 to FOtherDefines.Count-1 do
|
||||||
|
aXMLConfig.SetDeleteValue(p+'OtherDefines/Define'+IntToStr(i)+'/Value',
|
||||||
|
FOtherDefines[i],'');
|
||||||
|
aXMLConfig.SetDeleteValue(p+'OtherDefines/Count',FOtherDefines.Count,0);
|
||||||
|
|
||||||
{ Compilation }
|
{ Compilation }
|
||||||
aXMLConfig.SetDeleteValue(p+'CompilerPath/Value', f(CompilerPath),DefaultCompilerPath);
|
aXMLConfig.SetDeleteValue(p+'CompilerPath/Value', f(CompilerPath),DefaultCompilerPath);
|
||||||
ExecuteBefore.SaveToXMLConfig(aXMLConfig,p+'ExecuteBefore/',UsePathDelim);
|
ExecuteBefore.SaveToXMLConfig(aXMLConfig,p+'ExecuteBefore/',UsePathDelim);
|
||||||
@ -3396,6 +3416,7 @@ begin
|
|||||||
ClearInheritedOptions;
|
ClearInheritedOptions;
|
||||||
ParsedOpts.Assign(CompOpts.ParsedOpts);
|
ParsedOpts.Assign(CompOpts.ParsedOpts);
|
||||||
FStorePathDelim := CompOpts.FStorePathDelim;
|
FStorePathDelim := CompOpts.FStorePathDelim;
|
||||||
|
FOtherDefines.Assign(CompOpts.FOtherDefines);
|
||||||
|
|
||||||
// compilation
|
// compilation
|
||||||
CompilerPath := CompOpts.CompilerPath;
|
CompilerPath := CompOpts.CompilerPath;
|
||||||
@ -3541,6 +3562,7 @@ begin
|
|||||||
if Done(Tool.AddDiff('ConfigFilePath',fConfigFilePath,CompOpts.fConfigFilePath)) then exit;
|
if Done(Tool.AddDiff('ConfigFilePath',fConfigFilePath,CompOpts.fConfigFilePath)) then exit;
|
||||||
if Done(Tool.AddDiff('StopAfterErrCount',fStopAfterErrCount,CompOpts.fStopAfterErrCount)) then exit;
|
if Done(Tool.AddDiff('StopAfterErrCount',fStopAfterErrCount,CompOpts.fStopAfterErrCount)) then exit;
|
||||||
if Done(Tool.AddDiff('CustomOptions',CustomOptions,CompOpts.CustomOptions)) then exit;
|
if Done(Tool.AddDiff('CustomOptions',CustomOptions,CompOpts.CustomOptions)) then exit;
|
||||||
|
if Done(Tool.AddDiff('OtherDefines',OtherDefines.Text,CompOpts.OtherDefines.Text)) then exit;
|
||||||
|
|
||||||
// compilation
|
// compilation
|
||||||
if Tool<>nil then Tool.Path:='Compilation';
|
if Tool<>nil then Tool.Path:='Compilation';
|
||||||
|
|||||||
@ -31,7 +31,7 @@ uses
|
|||||||
Classes, SysUtils, math, AVL_Tree, LazLogger, Forms, Controls, Graphics,
|
Classes, SysUtils, math, AVL_Tree, LazLogger, Forms, Controls, Graphics,
|
||||||
Dialogs, StdCtrls, ComCtrls, ExtCtrls, Buttons, LCLType, LazUTF8,
|
Dialogs, StdCtrls, ComCtrls, ExtCtrls, Buttons, LCLType, LazUTF8,
|
||||||
CodeToolsCfgScript, KeywordFuncLists, LazarusIDEStrConsts,
|
CodeToolsCfgScript, KeywordFuncLists, LazarusIDEStrConsts,
|
||||||
IDEOptionsIntf, CompOptsIntf, IDECommands, LazIDEIntf, Project, PackageDefs,
|
IDEOptionsIntf, CompOptsIntf, IDECommands, PackageDefs,
|
||||||
CompilerOptions, Compiler, AllCompilerOptions, DefinesGui,
|
CompilerOptions, Compiler, AllCompilerOptions, DefinesGui,
|
||||||
EditorOptions, SynEdit, SynEditKeyCmds, SynCompletion, SourceSynEditor;
|
EditorOptions, SynEdit, SynEditKeyCmds, SynCompletion, SourceSynEditor;
|
||||||
|
|
||||||
@ -62,6 +62,7 @@ type
|
|||||||
FCompOptions: TBaseCompilerOptions;
|
FCompOptions: TBaseCompilerOptions;
|
||||||
FIdleConnected: Boolean;
|
FIdleConnected: Boolean;
|
||||||
FIsPackage: boolean;
|
FIsPackage: boolean;
|
||||||
|
FLocalOtherDefines: TStrings;
|
||||||
FCompletionHistory: TStrings;
|
FCompletionHistory: TStrings;
|
||||||
FCompletionValues: TStrings;
|
FCompletionValues: TStrings;
|
||||||
FDefaultVariables: TCTCfgScriptVariables;
|
FDefaultVariables: TCTCfgScriptVariables;
|
||||||
@ -157,11 +158,11 @@ begin
|
|||||||
EditForm.OptionsReader := FOptionsReader;
|
EditForm.OptionsReader := FOptionsReader;
|
||||||
EditForm.OptionsThread := FOptionsThread;
|
EditForm.OptionsThread := FOptionsThread;
|
||||||
EditForm.CustomOptions := memoCustomOptions.Lines;
|
EditForm.CustomOptions := memoCustomOptions.Lines;
|
||||||
EditForm.DefinesCheckList.Items.Assign(Project1.OtherDefines);
|
EditForm.DefinesCheckList.Items.Assign(FLocalOtherDefines);
|
||||||
EditForm.UseComments := FUseComments;
|
EditForm.UseComments := FUseComments;
|
||||||
if EditForm.ShowModal = mrOK then
|
if EditForm.ShowModal = mrOK then
|
||||||
begin
|
begin
|
||||||
Project1.OtherDefines.Assign(EditForm.DefinesCheckList.Items);
|
FLocalOtherDefines.Assign(EditForm.DefinesCheckList.Items);
|
||||||
// Synchronize with custom options memo
|
// Synchronize with custom options memo
|
||||||
EditForm.ToCustomOptions(memoCustomOptions.Lines);
|
EditForm.ToCustomOptions(memoCustomOptions.Lines);
|
||||||
memoCustomOptions.Invalidate;
|
memoCustomOptions.Invalidate;
|
||||||
@ -673,6 +674,7 @@ end;
|
|||||||
constructor TCompilerOtherOptionsFrame.Create(TheOwner: TComponent);
|
constructor TCompilerOtherOptionsFrame.Create(TheOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
|
FLocalOtherDefines:=TStringList.Create;
|
||||||
FCompletionValues:=TStringList.Create;
|
FCompletionValues:=TStringList.Create;
|
||||||
FCompletionHistory:=TStringList.Create;
|
FCompletionHistory:=TStringList.Create;
|
||||||
fDefaultVariables:=TCTCfgScriptVariables.Create;
|
fDefaultVariables:=TCTCfgScriptVariables.Create;
|
||||||
@ -702,10 +704,11 @@ begin
|
|||||||
IdleConnected:=false;
|
IdleConnected:=false;
|
||||||
FreeAndNil(fOptionsThread);
|
FreeAndNil(fOptionsThread);
|
||||||
FreeAndNil(FOptionsReader);
|
FreeAndNil(FOptionsReader);
|
||||||
|
FreeAndNil(fEngine);
|
||||||
|
FreeAndNil(fDefaultVariables);
|
||||||
FreeAndNil(FCompletionHistory);
|
FreeAndNil(FCompletionHistory);
|
||||||
FreeAndNil(FCompletionValues);
|
FreeAndNil(FCompletionValues);
|
||||||
FreeAndNil(fDefaultVariables);
|
FreeAndNil(FLocalOtherDefines);
|
||||||
FreeAndNil(fEngine);
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -757,6 +760,7 @@ begin
|
|||||||
memoCustomOptions.Text := FCompOptions.CustomOptions;
|
memoCustomOptions.Text := FCompOptions.CustomOptions;
|
||||||
memoCustomOptions.OnChange(Nil);
|
memoCustomOptions.OnChange(Nil);
|
||||||
FUseComments := FCompOptions.UseCommentsInCustomOptions;
|
FUseComments := FCompOptions.UseCommentsInCustomOptions;
|
||||||
|
FLocalOtherDefines.Assign(FCompOptions.OtherDefines);
|
||||||
|
|
||||||
UpdateStatusBar;
|
UpdateStatusBar;
|
||||||
end;
|
end;
|
||||||
@ -767,11 +771,13 @@ var
|
|||||||
begin
|
begin
|
||||||
//debugln(['TCompilerOtherOptionsFrame.WriteSettings ',DbgSName(AOptions)]);
|
//debugln(['TCompilerOtherOptionsFrame.WriteSettings ',DbgSName(AOptions)]);
|
||||||
CurOptions := AOptions as TBaseCompilerOptions;
|
CurOptions := AOptions as TBaseCompilerOptions;
|
||||||
with CurOptions do
|
CurOptions.Conditionals := CondSynEdit.Lines.Text;
|
||||||
|
CurOptions.CustomOptions := memoCustomOptions.Text;
|
||||||
|
CurOptions.UseCommentsInCustomOptions := FUseComments;
|
||||||
|
if not CurOptions.OtherDefines.Equals(FLocalOtherDefines) then
|
||||||
begin
|
begin
|
||||||
Conditionals := CondSynEdit.Lines.Text;
|
CurOptions.OtherDefines.Assign(FLocalOtherDefines);
|
||||||
CustomOptions := memoCustomOptions.Text;
|
CurOptions.IncreaseChangeStamp;
|
||||||
UseCommentsInCustomOptions := FUseComments;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
58
ide/main.pp
58
ide/main.pp
@ -450,6 +450,7 @@ type
|
|||||||
private
|
private
|
||||||
fBuilder: TLazarusBuilder;
|
fBuilder: TLazarusBuilder;
|
||||||
function DoBuildLazarusSub(Flags: TBuildLazarusFlags): TModalResult;
|
function DoBuildLazarusSub(Flags: TBuildLazarusFlags): TModalResult;
|
||||||
|
procedure ProjectOptionsHelper(AFilter: array of TAbstractIDEOptionsClass);
|
||||||
// Global IDE events
|
// Global IDE events
|
||||||
procedure HandleProcessIDECommand(Sender: TObject; Command: word;
|
procedure HandleProcessIDECommand(Sender: TObject; Command: word;
|
||||||
var Handled: boolean);
|
var Handled: boolean);
|
||||||
@ -471,9 +472,9 @@ type
|
|||||||
// Environment options dialog events
|
// Environment options dialog events
|
||||||
procedure DoLoadIDEOptions(Sender: TObject; AOptions: TAbstractIDEOptions);
|
procedure DoLoadIDEOptions(Sender: TObject; AOptions: TAbstractIDEOptions);
|
||||||
procedure DoSaveIDEOptions(Sender: TObject; AOptions: TAbstractIDEOptions);
|
procedure DoSaveIDEOptions(Sender: TObject; AOptions: TAbstractIDEOptions);
|
||||||
procedure DoOpenIDEOptions(AEditor: TAbstractIDEOptionsEditorClass;
|
function DoOpenIDEOptions(AEditor: TAbstractIDEOptionsEditorClass;
|
||||||
ACaption: String; AOptionsFilter: array of TAbstractIDEOptionsClass;
|
ACaption: String; AOptionsFilter: array of TAbstractIDEOptionsClass;
|
||||||
ASettings: TIDEOptionsEditorSettings); override;
|
ASettings: TIDEOptionsEditorSettings): Boolean; override;
|
||||||
|
|
||||||
procedure DoEnvironmentOptionsBeforeRead(Sender: TObject);
|
procedure DoEnvironmentOptionsBeforeRead(Sender: TObject);
|
||||||
procedure DoEnvironmentOptionsBeforeWrite(Sender: TObject; Restore: boolean);
|
procedure DoEnvironmentOptionsBeforeWrite(Sender: TObject; Restore: boolean);
|
||||||
@ -3509,11 +3510,6 @@ end;
|
|||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
|
|
||||||
procedure TMainIDE.mnuChgBuildModeClicked(Sender: TObject);
|
|
||||||
begin
|
|
||||||
DoOpenIDEOptions(TCompilerPathOptionsFrame, '', [TProjectCompilerOptions], []);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TMainIDE.CreateDesignerForComponent(AnUnitInfo: TUnitInfo;
|
function TMainIDE.CreateDesignerForComponent(AnUnitInfo: TUnitInfo;
|
||||||
AComponent: TComponent): TCustomForm;
|
AComponent: TComponent): TCustomForm;
|
||||||
var
|
var
|
||||||
@ -4097,16 +4093,38 @@ begin
|
|||||||
OpenMainUnit(-1,-1,[]);
|
OpenMainUnit(-1,-1,[]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuProjectOptionsClicked(Sender: TObject);
|
procedure TMainIDE.ProjectOptionsHelper(AFilter: array of TAbstractIDEOptionsClass);
|
||||||
|
var
|
||||||
|
Capt: String;
|
||||||
begin
|
begin
|
||||||
if Project1=nil then exit;
|
if Project1=nil then exit;
|
||||||
DoOpenIDEOptions(nil, Format(dlgProjectOptionsFor, [Project1.GetTitleOrName]),
|
// This is kind of a hack. Copy OtherDefines from project to current
|
||||||
[TProjectIDEOptions, TProjectCompilerOptions], []);
|
// buildmode's compiler options and then back after they are modified.
|
||||||
|
// Only needed for projects, packages don't have buildmodes.
|
||||||
|
Project1.CompilerOptions.OtherDefines.Assign(Project1.OtherDefines);
|
||||||
|
|
||||||
|
Capt := Format(dlgProjectOptionsFor, [Project1.GetTitleOrName]);
|
||||||
|
if DoOpenIDEOptions(nil, Capt, AFilter, [])
|
||||||
|
and not Project1.OtherDefines.Equals(Project1.CompilerOptions.OtherDefines) then
|
||||||
|
begin
|
||||||
|
Project1.OtherDefines.Assign(Project1.CompilerOptions.OtherDefines);
|
||||||
|
Project1.Modified:=True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.mnuProjectOptionsClicked(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ProjectOptionsHelper([TProjectIDEOptions, TProjectCompilerOptions]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.mnuChgBuildModeClicked(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ProjectOptionsHelper([TProjectCompilerOptions]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuBuildModeClicked(Sender: TObject);
|
procedure TMainIDE.mnuBuildModeClicked(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
DoOpenIDEOptions(TCompilerPathOptionsFrame, '', [TProjectCompilerOptions], []);
|
ProjectOptionsHelper([TProjectCompilerOptions]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.UpdateProjectPOFile(AProject: TProject): TModalResult;
|
function TMainIDE.UpdateProjectPOFile(AProject: TProject): TModalResult;
|
||||||
@ -4648,9 +4666,9 @@ begin
|
|||||||
SaveDesktopSettings(AOptions as TEnvironmentOptions);
|
SaveDesktopSettings(AOptions as TEnvironmentOptions);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.DoOpenIDEOptions(AEditor: TAbstractIDEOptionsEditorClass;
|
function TMainIDE.DoOpenIDEOptions(AEditor: TAbstractIDEOptionsEditorClass;
|
||||||
ACaption: String; AOptionsFilter: array of TAbstractIDEOptionsClass;
|
ACaption: String; AOptionsFilter: array of TAbstractIDEOptionsClass;
|
||||||
ASettings: TIDEOptionsEditorSettings);
|
ASettings: TIDEOptionsEditorSettings): Boolean;
|
||||||
var
|
var
|
||||||
IDEOptionsDialog: TIDEOptionsDialog;
|
IDEOptionsDialog: TIDEOptionsDialog;
|
||||||
OptionsFilter: TIDEOptionsEditorFilter;
|
OptionsFilter: TIDEOptionsEditorFilter;
|
||||||
@ -4668,8 +4686,7 @@ begin
|
|||||||
else
|
else
|
||||||
OptionsFilter[0] := TAbstractIDEEnvironmentOptions;
|
OptionsFilter[0] := TAbstractIDEEnvironmentOptions;
|
||||||
end
|
end
|
||||||
else
|
else begin
|
||||||
begin
|
|
||||||
SetLength(OptionsFilter, Length(AOptionsFilter));
|
SetLength(OptionsFilter, Length(AOptionsFilter));
|
||||||
for i := 0 to Length(AOptionsFilter) - 1 do
|
for i := 0 to Length(AOptionsFilter) - 1 do
|
||||||
OptionsFilter[i] := AOptionsFilter[i];
|
OptionsFilter[i] := AOptionsFilter[i];
|
||||||
@ -4680,17 +4697,16 @@ begin
|
|||||||
IDEOptionsDialog.OnLoadIDEOptionsHook:=@DoLoadIDEOptions;
|
IDEOptionsDialog.OnLoadIDEOptionsHook:=@DoLoadIDEOptions;
|
||||||
IDEOptionsDialog.OnSaveIDEOptionsHook:=@DoSaveIDEOptions;
|
IDEOptionsDialog.OnSaveIDEOptionsHook:=@DoSaveIDEOptions;
|
||||||
IDEOptionsDialog.ReadAll;
|
IDEOptionsDialog.ReadAll;
|
||||||
if IDEOptionsDialog.ShowModal = mrOk then begin
|
Result := IDEOptionsDialog.ShowModal = mrOk;
|
||||||
IDEOptionsDialog.WriteAll(false);
|
IDEOptionsDialog.WriteAll(not Result); // Restore if user cancelled.
|
||||||
DebugLn(['TMainIDE.DoOpenIDEOptions: Options saved, updating Palette and TaskBar.']);
|
if Result then
|
||||||
|
begin
|
||||||
|
DebugLn(['TMainIDE.DoOpenIDEOptions: Options saved, updating TaskBar.']);
|
||||||
// Update TaskBarBehavior immediately.
|
// Update TaskBarBehavior immediately.
|
||||||
if EnvironmentOptions.Desktop.SingleTaskBarButton then
|
if EnvironmentOptions.Desktop.SingleTaskBarButton then
|
||||||
Application.TaskBarBehavior := tbSingleButton
|
Application.TaskBarBehavior := tbSingleButton
|
||||||
else
|
else
|
||||||
Application.TaskBarBehavior := tbDefault;
|
Application.TaskBarBehavior := tbDefault;
|
||||||
end else begin
|
|
||||||
// restore
|
|
||||||
IDEOptionsDialog.WriteAll(true);
|
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
IDEOptionsDialog.Free;
|
IDEOptionsDialog.Free;
|
||||||
|
|||||||
@ -2782,7 +2782,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
s := FXMLConfig.GetValue(Path+SubPath+'Define'+IntToStr(i)+'/Value', '');
|
s := FXMLConfig.GetValue(Path+SubPath+'Define'+IntToStr(i)+'/Value', '');
|
||||||
if s <> '' then
|
if s <> '' then
|
||||||
OtherDefines.Add(s);
|
FOtherDefines.Add(s);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user