mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-28 06:43:44 +02:00
IDE: project compiler options: added checkbox to save as default, from Dmitry Boyarintsev, bug #14154
git-svn-id: trunk@23041 -
This commit is contained in:
parent
d66e61ad9d
commit
64232ae461
@ -9,8 +9,6 @@ uses
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, fMasterSite, fclientform, EasyDockMgr;
|
||||
|
||||
{$IFDEF WINDOWS}{$R MakeSite.rc}{$ENDIF}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMasterSite, MasterSite);
|
||||
|
@ -390,7 +390,7 @@ begin
|
||||
try
|
||||
// create compiler command line options
|
||||
CmdLineParams:=Options.MakeOptionsString(BogusFilename,nil,
|
||||
[ccloAddVerboseAll,ccloDoNotAppendOutFileOption,cclAbsolutePaths])
|
||||
[ccloAddVerboseAll,ccloDoNotAppendOutFileOption,ccloAbsolutePaths])
|
||||
+' '+BogusFilename;
|
||||
|
||||
CompileTool:=TExternalToolOptions.Create;
|
||||
|
@ -430,7 +430,7 @@ type
|
||||
ccloNoLinkerOpts, // exclude linker options
|
||||
ccloAddVerboseAll, // add -va
|
||||
ccloDoNotAppendOutFileOption, // do not add -o option
|
||||
cclAbsolutePaths
|
||||
ccloAbsolutePaths
|
||||
);
|
||||
TCompilerCmdLineOptions = set of TCompilerCmdLineOption;
|
||||
|
||||
@ -572,7 +572,7 @@ type
|
||||
procedure SetTargetFilename(const AValue: String); override;
|
||||
procedure SetModified(const AValue: boolean); override;
|
||||
protected
|
||||
procedure LoadTheCompilerOptions(const Path: string); virtual;
|
||||
function LoadTheCompilerOptions(const Path: string): TModalResult; virtual;
|
||||
procedure SaveTheCompilerOptions(const Path: string); virtual;
|
||||
procedure ClearInheritedOptions;
|
||||
procedure SetDefaultMakeOptionsFlags(const AValue: TCompilerCmdLineOptions);
|
||||
@ -586,7 +586,7 @@ type
|
||||
procedure LoadFromXMLConfig(AXMLConfig: TXMLConfig; const Path: string);
|
||||
procedure SaveToXMLConfig(AXMLConfig: TXMLConfig; const Path: string);
|
||||
|
||||
procedure LoadCompilerOptions(UseExistingFile: Boolean);
|
||||
function LoadCompilerOptions(UseExistingFile: Boolean): TModalResult;
|
||||
procedure SaveCompilerOptions(UseExistingFile: Boolean);
|
||||
procedure Assign(Source: TPersistent); override;
|
||||
function IsEqual(CompOpts: TBaseCompilerOptions): boolean; virtual;
|
||||
@ -610,6 +610,7 @@ type
|
||||
Parsed: TCompilerOptionsParseType = coptParsed
|
||||
): string; virtual;
|
||||
function GetDefaultMainSourceFileName: string; virtual;
|
||||
function CanBeDefaulForProject: boolean; virtual;
|
||||
function NeedsLinkerOpts: boolean;
|
||||
function GetUnitPath(RelativeToBaseDir: boolean;
|
||||
Parsed: TCompilerOptionsParseType = coptParsed;
|
||||
@ -1154,13 +1155,15 @@ end;
|
||||
{------------------------------------------------------------------------------
|
||||
TBaseCompilerOptions LoadCompilerOptions
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TBaseCompilerOptions.LoadCompilerOptions(UseExistingFile: Boolean);
|
||||
function TBaseCompilerOptions.LoadCompilerOptions(UseExistingFile: Boolean
|
||||
): TModalResult;
|
||||
var
|
||||
confPath: String;
|
||||
begin
|
||||
Result:=mrCancel;
|
||||
if (UseExistingFile and (XMLConfigFile <> nil)) then
|
||||
begin
|
||||
LoadTheCompilerOptions('CompilerOptions');
|
||||
Result:=LoadTheCompilerOptions('CompilerOptions');
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -1170,6 +1173,7 @@ begin
|
||||
LoadTheCompilerOptions('CompilerOptions');
|
||||
XMLConfigFile.Free;
|
||||
XMLConfigFile := nil;
|
||||
Result:=mrOk;
|
||||
except
|
||||
on E: Exception do begin
|
||||
DebugLn('TBaseCompilerOptions.LoadCompilerOptions '+Classname+' '+E.Message);
|
||||
@ -1316,7 +1320,7 @@ end;
|
||||
{------------------------------------------------------------------------------
|
||||
TfrmCompilerOptions LoadTheCompilerOptions
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TBaseCompilerOptions.LoadTheCompilerOptions(const Path: string);
|
||||
function TBaseCompilerOptions.LoadTheCompilerOptions(const Path: string): TModalResult;
|
||||
var
|
||||
p: String;
|
||||
PathDelimChange: boolean;
|
||||
@ -1363,6 +1367,7 @@ var
|
||||
end;
|
||||
|
||||
begin
|
||||
Result:=mrOk;
|
||||
{ Load the compiler options from the XML file }
|
||||
p:=Path;
|
||||
FileVersion:=XMLConfigFile.GetValue(p+'Version/Value', 0);
|
||||
@ -1528,9 +1533,9 @@ begin
|
||||
CreateMakefileOnBuild:=XMLConfigFile.GetValue(p+'CreateMakefileOnBuild/Value',false);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TfrmCompilerOptions SaveCompilerOptions }
|
||||
{------------------------------------------------------------------------------}
|
||||
{------------------------------------------------------------------------------
|
||||
TfrmCompilerOptions SaveCompilerOptions
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TBaseCompilerOptions.SaveCompilerOptions(UseExistingFile: Boolean);
|
||||
var
|
||||
confPath: String;
|
||||
@ -1549,7 +1554,7 @@ begin
|
||||
XMLConfigFile := nil;
|
||||
except
|
||||
on E: Exception do begin
|
||||
DebugLn('TBaseCompilerOptions.LoadCompilerOptions '+Classname+' '+E.Message);
|
||||
DebugLn('TBaseCompilerOptions.SaveCompilerOptions '+Classname+' '+E.Message);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -1846,6 +1851,11 @@ begin
|
||||
Result:='';
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.CanBeDefaulForProject: boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.NeedsLinkerOpts: boolean;
|
||||
begin
|
||||
Result:=not (ccloNoLinkerOpts in fDefaultMakeOptionsFlags);
|
||||
@ -2534,7 +2544,7 @@ begin
|
||||
// inherited Linker options
|
||||
if (not (ccloNoLinkerOpts in Flags)) then begin
|
||||
InhLinkerOpts:=GetInheritedOption(icoLinkerOptions,
|
||||
not (cclAbsolutePaths in Flags),coptParsed);
|
||||
not (ccloAbsolutePaths in Flags),coptParsed);
|
||||
if InhLinkerOpts<>'' then
|
||||
switches := switches + ' ' + ConvertOptionsToCmdLine(' ','-k', InhLinkerOpts);
|
||||
end;
|
||||
@ -2618,27 +2628,27 @@ begin
|
||||
{ ------------- Search Paths ---------------- }
|
||||
|
||||
// include path
|
||||
CurIncludePath:=GetIncludePath(not (cclAbsolutePaths in Flags),
|
||||
CurIncludePath:=GetIncludePath(not (ccloAbsolutePaths in Flags),
|
||||
coptParsed,false);
|
||||
if (CurIncludePath <> '') then
|
||||
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fi', CurIncludePath);
|
||||
|
||||
// library path
|
||||
if (not (ccloNoLinkerOpts in Flags)) then begin
|
||||
CurLibraryPath:=GetLibraryPath(not (cclAbsolutePaths in Flags),
|
||||
CurLibraryPath:=GetLibraryPath(not (ccloAbsolutePaths in Flags),
|
||||
coptParsed,false);
|
||||
if (CurLibraryPath <> '') then
|
||||
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fl', CurLibraryPath);
|
||||
end;
|
||||
|
||||
// object path
|
||||
CurObjectPath:=GetObjectPath(not (cclAbsolutePaths in Flags),
|
||||
CurObjectPath:=GetObjectPath(not (ccloAbsolutePaths in Flags),
|
||||
coptParsed,false);
|
||||
if (CurObjectPath <> '') then
|
||||
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fo', CurObjectPath);
|
||||
|
||||
// unit path
|
||||
CurUnitPath:=GetUnitPath(not (cclAbsolutePaths in Flags));
|
||||
CurUnitPath:=GetUnitPath(not (ccloAbsolutePaths in Flags));
|
||||
//debugln('TBaseCompilerOptions.MakeOptionsString A ',dbgsName(Self),' CurUnitPath="',CurUnitPath,'"');
|
||||
// always add the current directory to the unit path, so that the compiler
|
||||
// checks for changed files in the directory
|
||||
@ -2650,7 +2660,7 @@ begin
|
||||
{ Unit output directory }
|
||||
if (UnitOutputDirectory<>'') then begin
|
||||
CurOutputDir:=ParsedOpts.GetParsedValue(pcosOutputDir);
|
||||
if not (cclAbsolutePaths in Flags) then
|
||||
if not (ccloAbsolutePaths in Flags) then
|
||||
CurOutputDir:=CreateRelativePath(CurOutputDir,BaseDirectory,true);
|
||||
end else
|
||||
CurOutputDir:='';
|
||||
@ -2721,7 +2731,7 @@ begin
|
||||
((CompareFileNames(NewTargetFilename,ChangeFileExt(CurMainSrcFile,''))<>0) or
|
||||
(CurOutputDir<>'')) then
|
||||
begin
|
||||
if not (cclAbsolutePaths in Flags) then
|
||||
if not (ccloAbsolutePaths in Flags) then
|
||||
NewTargetFilename := CreateRelativePath(NewTargetFilename, BaseDirectory);
|
||||
NewTargetDirectory := ExtractFilePath(NewTargetFilename);
|
||||
if NewTargetDirectory <> '' then
|
||||
@ -2810,14 +2820,14 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TBaseCompilerOptions.GetXMLConfigPath: String;
|
||||
var
|
||||
fn: String;
|
||||
AFilename: String;
|
||||
begin
|
||||
// Setup the filename to write to
|
||||
fn := XMLFile;
|
||||
if (fn = '') then
|
||||
fn := Config_Filename;
|
||||
Result := GetPrimaryConfigPath + '/' + fn;
|
||||
CopySecondaryConfigFile(fn);
|
||||
AFilename := XMLFile;
|
||||
if (AFilename = '') then
|
||||
AFilename := Config_Filename;
|
||||
Result := AppendPathDelim(GetPrimaryConfigPath) + AFilename;
|
||||
CopySecondaryConfigFile(AFilename);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -1,7 +1,7 @@
|
||||
object frmCompilerOptions: TfrmCompilerOptions
|
||||
Left = 368
|
||||
Left = 321
|
||||
Height = 528
|
||||
Top = 187
|
||||
Top = 101
|
||||
Width = 669
|
||||
ActiveControl = MainNotebook
|
||||
Align = alClient
|
||||
@ -17,7 +17,7 @@ object frmCompilerOptions: TfrmCompilerOptions
|
||||
object MainNotebook: TNotebook
|
||||
AnchorSideBottom.Control = BtnPanel
|
||||
Left = 126
|
||||
Height = 480
|
||||
Height = 462
|
||||
Top = 0
|
||||
Width = 543
|
||||
Align = alClient
|
||||
@ -905,16 +905,16 @@ object frmCompilerOptions: TfrmCompilerOptions
|
||||
object CfgCmpMsgPage: TPage
|
||||
Caption = 'CfgCmpMsgPage'
|
||||
ClientWidth = 537
|
||||
ClientHeight = 441
|
||||
ClientHeight = 423
|
||||
object grpCompilerMessages: TGroupBox
|
||||
Left = 6
|
||||
Height = 429
|
||||
Height = 411
|
||||
Top = 6
|
||||
Width = 525
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'grpCompilerMessages'
|
||||
ClientHeight = 407
|
||||
ClientHeight = 389
|
||||
ClientWidth = 517
|
||||
TabOrder = 0
|
||||
object chkUseMsgFile: TCheckBox
|
||||
@ -971,7 +971,7 @@ object frmCompilerOptions: TfrmCompilerOptions
|
||||
AnchorSideBottom.Control = grpCompilerMessages
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 367
|
||||
Height = 349
|
||||
Top = 34
|
||||
Width = 505
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
@ -1740,7 +1740,7 @@ object frmCompilerOptions: TfrmCompilerOptions
|
||||
end
|
||||
object CategoryTreeView: TTreeView
|
||||
Left = 0
|
||||
Height = 480
|
||||
Height = 462
|
||||
Top = 0
|
||||
Width = 121
|
||||
Align = alLeft
|
||||
@ -1752,8 +1752,23 @@ object frmCompilerOptions: TfrmCompilerOptions
|
||||
end
|
||||
object CategorySplitter: TSplitter
|
||||
Left = 121
|
||||
Height = 480
|
||||
Height = 462
|
||||
Top = 0
|
||||
Width = 5
|
||||
end
|
||||
object chkUseAsDefault: TCheckBox
|
||||
AnchorSideTop.Control = MainNotebook
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Control = BtnPanel
|
||||
Left = 10
|
||||
Height = 18
|
||||
Top = 462
|
||||
Width = 659
|
||||
Align = alBottom
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
AutoSize = False
|
||||
BorderSpacing.Left = 10
|
||||
Caption = 'chkUseAsDefault'
|
||||
TabOrder = 4
|
||||
end
|
||||
end
|
||||
|
@ -1,14 +1,14 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TfrmCompilerOptions','FORMDATA',[
|
||||
'TPF0'#19'TfrmCompilerOptions'#18'frmCompilerOptions'#4'Left'#3'p'#1#6'Height'
|
||||
+#3#16#2#3'Top'#3#187#0#5'Width'#3#157#2#13'ActiveControl'#7#12'MainNotebook'
|
||||
+#5'Align'#7#8'alClient'#11'BorderIcons'#11#12'biSystemMenu'#0#7'Caption'#6#18
|
||||
'TPF0'#19'TfrmCompilerOptions'#18'frmCompilerOptions'#4'Left'#3'A'#1#6'Height'
|
||||
+#3#16#2#3'Top'#2'e'#5'Width'#3#157#2#13'ActiveControl'#7#12'MainNotebook'#5
|
||||
+'Align'#7#8'alClient'#11'BorderIcons'#11#12'biSystemMenu'#0#7'Caption'#6#18
|
||||
+'frmCompilerOptions'#12'ClientHeight'#3#16#2#11'ClientWidth'#3#157#2#21'Cons'
|
||||
+'traints.MinHeight'#3#244#1#20'Constraints.MinWidth'#3'X'#2#7'OnClose'#7#23
|
||||
+'frmCompilerOptionsClose'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6
|
||||
+'0.9.29'#0#9'TNotebook'#12'MainNotebook'#24'AnchorSideBottom.Control'#7#8'Bt'
|
||||
+'nPanel'#4'Left'#2'~'#6'Height'#3#224#1#3'Top'#2#0#5'Width'#3#31#2#5'Align'#7
|
||||
+'nPanel'#4'Left'#2'~'#6'Height'#3#206#1#3'Top'#2#0#5'Width'#3#31#2#5'Align'#7
|
||||
+#8'alClient'#9'PageIndex'#2#6#8'TabOrder'#2#0#0#5'TPage'#8'PathPage'#7'Capti'
|
||||
+'on'#6#8'PathPage'#11'ClientWidth'#3#25#2#12'ClientHeight'#3#185#1#0#6'TLabe'
|
||||
+'l'#13'lblOtherUnits'#4'Left'#2#6#6'Height'#2#18#3'Top'#2#6#5'Width'#3#13#2#5
|
||||
@ -298,10 +298,10 @@ LazarusResources.Add('TfrmCompilerOptions','FORMDATA',[
|
||||
+'t'#11'edtErrorCnt'#4'Left'#2#6#6'Height'#2#22#3'Top'#2#6#5'Width'#3#249#1#5
|
||||
+'Align'#7#5'alTop'#20'BorderSpacing.Around'#2#6#8'TabOrder'#2#0#4'Text'#6#11
|
||||
+'edtErrorCnt'#0#0#0#0#5'TPage'#13'CfgCmpMsgPage'#7'Caption'#6#13'CfgCmpMsgPa'
|
||||
+'ge'#11'ClientWidth'#3#25#2#12'ClientHeight'#3#185#1#0#9'TGroupBox'#19'grpCo'
|
||||
+'mpilerMessages'#4'Left'#2#6#6'Height'#3#173#1#3'Top'#2#6#5'Width'#3#13#2#5
|
||||
+'ge'#11'ClientWidth'#3#25#2#12'ClientHeight'#3#167#1#0#9'TGroupBox'#19'grpCo'
|
||||
+'mpilerMessages'#4'Left'#2#6#6'Height'#3#155#1#3'Top'#2#6#5'Width'#3#13#2#5
|
||||
+'Align'#7#8'alClient'#20'BorderSpacing.Around'#2#6#7'Caption'#6#19'grpCompil'
|
||||
+'erMessages'#12'ClientHeight'#3#151#1#11'ClientWidth'#3#5#2#8'TabOrder'#2#0#0
|
||||
+'erMessages'#12'ClientHeight'#3#133#1#11'ClientWidth'#3#5#2#8'TabOrder'#2#0#0
|
||||
+#9'TCheckBox'#13'chkUseMsgFile'#22'AnchorSideLeft.Control'#7#19'grpCompilerM'
|
||||
+'essages'#21'AnchorSideTop.Control'#7#15'editMsgFileName'#18'AnchorSideTop.S'
|
||||
+'ide'#7#9'asrCenter'#4'Left'#2#6#6'Height'#2#16#3'Top'#2#9#5'Width'#2'b'#20
|
||||
@ -323,7 +323,7 @@ LazarusResources.Add('TfrmCompilerOptions','FORMDATA',[
|
||||
+#7#15'editMsgFileName'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRi'
|
||||
,'ght.Control'#7#19'grpCompilerMessages'#20'AnchorSideRight.Side'#7#9'asrBott'
|
||||
+'om'#24'AnchorSideBottom.Control'#7#19'grpCompilerMessages'#21'AnchorSideBot'
|
||||
+'tom.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#3'o'#1#3'Top'#2'"'#5'Width'#3
|
||||
+'tom.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#3']'#1#3'Top'#2'"'#5'Width'#3
|
||||
+#249#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSp'
|
||||
+'acing.Around'#2#6#10'ItemHeight'#2#0#7'OnClick'#7#19'chklistCompMsgClick'#6
|
||||
+'Sorted'#9#8'TabOrder'#2#3#0#0#0#0#5'TPage'#9'OtherPage'#7'Caption'#6#9'Othe'
|
||||
@ -654,11 +654,16 @@ LazarusResources.Add('TfrmCompilerOptions','FORMDATA',[
|
||||
+'ze'#9#20'BorderSpacing.Around'#2#6#6'Cancel'#9#7'Caption'#6#6'Cancel'#21'Co'
|
||||
+'nstraints.MinHeight'#2#25#20'Constraints.MinWidth'#2'K'#4'Kind'#7#8'bkCance'
|
||||
+'l'#11'ModalResult'#2#2#9'NumGlyphs'#2#0#8'TabOrder'#2#5#0#0#0#9'TTreeView'
|
||||
+#16'CategoryTreeView'#4'Left'#2#0#6'Height'#3#224#1#3'Top'#2#0#5'Width'#2'y'
|
||||
+#16'CategoryTreeView'#4'Left'#2#0#6'Height'#3#206#1#3'Top'#2#0#5'Width'#2'y'
|
||||
+#5'Align'#7#6'alLeft'#17'DefaultItemHeight'#2#19#8'ReadOnly'#9#8'TabOrder'#2
|
||||
+#2#18'OnSelectionChanged'#7' CategoryTreeViewSelectionChanged'#7'Options'#11
|
||||
+#17'tvoAutoItemHeight'#16'tvoHideSelection'#21'tvoKeepCollapsedNodes'#11'tvo'
|
||||
+'ReadOnly'#14'tvoShowButtons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTip'
|
||||
+'s'#0#0#0#9'TSplitter'#16'CategorySplitter'#4'Left'#2'y'#6'Height'#3#224#1#3
|
||||
+'Top'#2#0#5'Width'#2#5#0#0#0
|
||||
+'s'#0#0#0#9'TSplitter'#16'CategorySplitter'#4'Left'#2'y'#6'Height'#3#206#1#3
|
||||
+'Top'#2#0#5'Width'#2#5#0#0#9'TCheckBox'#15'chkUseAsDefault'#21'AnchorSideTop'
|
||||
+'.Control'#7#12'MainNotebook'#18'AnchorSideTop.Side'#7#9'asrBottom'#24'Ancho'
|
||||
+'rSideBottom.Control'#7#8'BtnPanel'#4'Left'#2#10#6'Height'#2#18#3'Top'#3#206
|
||||
+#1#5'Width'#3#147#2#5'Align'#7#8'alBottom'#7'Anchors'#11#5'akTop'#6'akLeft'#7
|
||||
+'akRight'#8'akBottom'#0#8'AutoSize'#8#18'BorderSpacing.Left'#2#10#7'Caption'
|
||||
+#6#15'chkUseAsDefault'#8'TabOrder'#2#4#0#0#0
|
||||
]);
|
||||
|
@ -63,6 +63,7 @@ type
|
||||
|
||||
TfrmCompilerOptions = class(TForm)
|
||||
CategoryTreeView: TTreeView;
|
||||
chkUseAsDefault: TCheckBox;
|
||||
MainNoteBook: TNoteBook;
|
||||
|
||||
{ Search Paths Controls }
|
||||
@ -290,6 +291,7 @@ type
|
||||
procedure UpdateInheritedTab;
|
||||
procedure ClearInheritedTree;
|
||||
procedure SetCompilerMessages;
|
||||
function GetUseAsDefault: Boolean;
|
||||
public
|
||||
CompilerOpts: TBaseCompilerOptions;
|
||||
OldCompOpts: TBaseCompilerOptions; // set on loading, used for revert
|
||||
@ -304,6 +306,7 @@ type
|
||||
DestCompilerOptions: TBaseCompilerOptions): boolean;
|
||||
public
|
||||
property ReadOnly: boolean read FReadOnly write SetReadOnly;
|
||||
property UseAsDefault: boolean read GetUseAsDefault;
|
||||
property OnImExportCompilerOptions: TNotifyEvent
|
||||
read FOnImExportCompilerOptions write FOnImExportCompilerOptions;
|
||||
end;
|
||||
@ -468,6 +471,9 @@ begin
|
||||
SetupCompilationTab(Page);
|
||||
inc(Page);
|
||||
SetupButtonBar;
|
||||
chkUseAsDefault.Caption := dlgCOUseAsDefault;
|
||||
chkUseAsDefault.ShowHint:=true;
|
||||
chkUseAsDefault.Hint:=lisWhenEnabledTheCurrentOptionsAreSavedToTheTemplateW;
|
||||
|
||||
CategoryTreeView.Selected:=CategoryTreeView.Items.GetFirstNode;
|
||||
CategoryTreeViewSelectionChanged(nil);
|
||||
@ -642,6 +648,7 @@ begin
|
||||
DisableAlign;
|
||||
try
|
||||
EnabledLinkerOpts:=Options.NeedsLinkerOpts;
|
||||
chkUseAsDefault.Visible:=Options.CanBeDefaulForProject;
|
||||
|
||||
{ Get the compiler options and apply them to the dialog }
|
||||
|
||||
@ -2036,7 +2043,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function TfrmCompilerOptions.GetUseAsDefault: Boolean;
|
||||
begin
|
||||
Result := chkUseAsDefault.Checked;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I compileroptionsdlg.lrs}
|
||||
|
@ -1511,6 +1511,10 @@ resourcestring
|
||||
|
||||
// compiler options
|
||||
dlgCompilerOptions = 'Compiler Options';
|
||||
dlgCOUseAsDefault = 'Use these settings as default for new projects';
|
||||
lisWhenEnabledTheCurrentOptionsAreSavedToTheTemplateW = 'When enabled the '
|
||||
+'current options are saved to the template, which is used when creating '
|
||||
+'new projects';
|
||||
lisPkgEdOnlineHelpNotYetImplemented = 'Online Help not yet implemented';
|
||||
lisPkgEdRightClickOnTheItemsTreeToGetThePopupmenuWithAllAv = 'Right click '
|
||||
+'on the items tree to get the popupmenu with all available package '
|
||||
|
18
ide/main.pp
18
ide/main.pp
@ -754,6 +754,7 @@ type
|
||||
procedure MarkUnitsModifiedUsingSubComponent(SubComponent: TComponent);
|
||||
|
||||
// project(s)
|
||||
procedure DoLoadDefaultCompilerOptions(AProject: TProject);
|
||||
function DoNewProject(ProjectDesc: TProjectDescriptor): TModalResult; override;
|
||||
function DoSaveProject(Flags: TSaveFlags): TModalResult; override;
|
||||
function DoCloseProject: TModalResult; override;
|
||||
@ -3792,7 +3793,11 @@ begin
|
||||
MainBuildBoss.RescanCompilerDefines(true,true);
|
||||
Project1.DefineTemplates.AllChanged;
|
||||
IncreaseCompilerParseStamp;
|
||||
UpdateHighlighters;
|
||||
UpdateHighlighters; // because of FPC/Delphi mode
|
||||
if frmCompilerOptions.UseAsDefault then begin
|
||||
// save to primary config directory
|
||||
Project1.CompilerOptions.SaveCompilerOptions(false);
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
frmCompilerOptions.Free;
|
||||
@ -8872,6 +8877,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoLoadDefaultCompilerOptions(AProject: TProject);
|
||||
begin
|
||||
// load default compiler options
|
||||
if AProject.CompilerOptions.LoadCompilerOptions(false)<>mrOk then
|
||||
DebugLn(['TMainIDE.DoLoadDefaultCompilerOptions failed']);
|
||||
end;
|
||||
|
||||
function TMainIDE.DoNewProject(ProjectDesc: TProjectDescriptor):TModalResult;
|
||||
var
|
||||
i:integer;
|
||||
@ -8915,6 +8927,7 @@ begin
|
||||
Project1.BeginUpdate(true);
|
||||
try
|
||||
Project1.CompilerOptions.CompilerPath:='$(CompPath)';
|
||||
DoLoadDefaultCompilerOptions(Project1);
|
||||
Project1.AutoAddOutputDirToIncPath;
|
||||
UpdateCaption;
|
||||
if ProjInspector<>nil then ProjInspector.LazProject:=Project1;
|
||||
@ -9428,6 +9441,7 @@ begin
|
||||
MainUnitInfo:=Project1.MainUnitInfo;
|
||||
MainUnitInfo.Source:=ProgramBuf;
|
||||
Project1.ProjectInfoFile:=ChangeFileExt(ProgramBuf.Filename,'.lpi');
|
||||
DoLoadDefaultCompilerOptions(Project1);
|
||||
UpdateCaption;
|
||||
IncreaseCompilerParseStamp;
|
||||
|
||||
@ -9969,7 +9983,7 @@ begin
|
||||
//DebugLn(['TMainIDE.DoBuildProject CompilerFilename="',CompilerFilename,'" CompilerPath="',Project1.CompilerOptions.CompilerPath,'"']);
|
||||
// Note: use absolute paths, because some external tools resolve symlinked directories
|
||||
CompilerParams :=
|
||||
Project1.CompilerOptions.MakeOptionsString(SrcFilename,nil,[cclAbsolutePaths])
|
||||
Project1.CompilerOptions.MakeOptionsString(SrcFilename,nil,[ccloAbsolutePaths])
|
||||
+ ' ' + PrepareCmdLineOption(SrcFilename);
|
||||
//DebugLn('TMainIDE.DoBuildProject WorkingDir="',WorkingDir,'" SrcFilename="',SrcFilename,'" CompilerFilename="',CompilerFilename,'" CompilerParams="',CompilerParams,'"');
|
||||
|
||||
|
@ -396,7 +396,7 @@ type
|
||||
FOwnerProject: TProject;
|
||||
FCompileReasons: TCompileReasons;
|
||||
protected
|
||||
procedure LoadTheCompilerOptions(const APath: string); override;
|
||||
function LoadTheCompilerOptions(const APath: string): TModalResult; override;
|
||||
procedure SaveTheCompilerOptions(const APath: string); override;
|
||||
|
||||
procedure SetTargetCPU(const AValue: string); override;
|
||||
@ -414,6 +414,7 @@ type
|
||||
constructor Create(const AOwner: TObject); override;
|
||||
destructor Destroy; override;
|
||||
procedure Clear; override;
|
||||
function CanBeDefaulForProject: boolean; override;
|
||||
function GetOwnerName: string; override;
|
||||
function GetDefaultMainSourceFileName: string; override;
|
||||
procedure GetInheritedCompilerOptions(var OptionsList: TFPList); override;
|
||||
@ -4862,9 +4863,10 @@ end;
|
||||
|
||||
{ TProjectCompilerOptions }
|
||||
|
||||
procedure TProjectCompilerOptions.LoadTheCompilerOptions(const APath: string);
|
||||
function TProjectCompilerOptions.LoadTheCompilerOptions(
|
||||
const APath: string): TModalResult;
|
||||
begin
|
||||
inherited LoadTheCompilerOptions(APath);
|
||||
Result:=inherited LoadTheCompilerOptions(APath);
|
||||
|
||||
// old compatebility
|
||||
if XMLConfigFile.GetValue(APath+'SkipCompiler/Value',false)
|
||||
@ -5046,6 +5048,11 @@ begin
|
||||
FBuildModes.ClearModes;
|
||||
end;
|
||||
|
||||
function TProjectCompilerOptions.CanBeDefaulForProject: boolean;
|
||||
begin
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function TProjectCompilerOptions.GetOwnerName: string;
|
||||
begin
|
||||
Result:=OwnerProject.Title;
|
||||
|
@ -103,7 +103,7 @@ var
|
||||
begin
|
||||
Flags:=CompilerOpts.DefaultMakeOptionsFlags;
|
||||
if not RelativePathsCheckBox.Checked then
|
||||
Include(Flags,cclAbsolutePaths);
|
||||
Include(Flags,ccloAbsolutePaths);
|
||||
CurOptions := CompilerOpts.MakeOptionsString(nil,Flags);
|
||||
CmdLineMemo.Lines.Text:=CurOptions;
|
||||
end;
|
||||
|
@ -392,7 +392,7 @@ type
|
||||
FLazPackage: TLazPackage;
|
||||
FSkipCompiler: Boolean;
|
||||
protected
|
||||
procedure LoadTheCompilerOptions(const APath: string); override;
|
||||
function LoadTheCompilerOptions(const APath: string): TModalResult; override;
|
||||
procedure SaveTheCompilerOptions(const APath: string); override;
|
||||
|
||||
procedure SetLazPackage(const AValue: TLazPackage);
|
||||
@ -3700,9 +3700,9 @@ end;
|
||||
|
||||
{ TPkgCompilerOptions }
|
||||
|
||||
procedure TPkgCompilerOptions.LoadTheCompilerOptions(const APath: string);
|
||||
function TPkgCompilerOptions.LoadTheCompilerOptions(const APath: string): TModalResult;
|
||||
begin
|
||||
inherited LoadTheCompilerOptions(APath);
|
||||
Result:=inherited LoadTheCompilerOptions(APath);
|
||||
|
||||
FSkipCompiler := XMLConfigFile.GetValue(APath+'SkipCompiler/Value', False);
|
||||
end;
|
||||
|
@ -2969,7 +2969,7 @@ begin
|
||||
CompilerFilename:=APackage.GetCompilerFilename;
|
||||
// Note: use absolute paths, because some external tools resolve symlinked directories
|
||||
CompilerParams:=APackage.CompilerOptions.MakeOptionsString(Globals,
|
||||
APackage.CompilerOptions.DefaultMakeOptionsFlags+[cclAbsolutePaths])
|
||||
APackage.CompilerOptions.DefaultMakeOptionsFlags+[ccloAbsolutePaths])
|
||||
+' '+CreateRelativePath(SrcFilename,APackage.Directory);
|
||||
//DebugLn(['TLazPackageGraph.CompilePackage SrcFilename="',SrcFilename,'" CompilerFilename="',CompilerFilename,'" CompilerParams="',CompilerParams,'" TargetCPU=',Globals.TargetCPU,' TargetOS=',Globals.TargetOS]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user