1 {
2 ***************************************************************************
3 * *
4 * This source is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This code is distributed in the hope that it will be useful, but *
10 * WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * General Public License for more details. *
13 * *
14 * A copy of the GNU General Public License is available on the World *
15 * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
16 * obtain it by writing to the Free Software Foundation, *
17 * Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA. *
18 * *
19 ***************************************************************************
20
21 Abtract:
22 Frame for environment options for main paths, like
23 Lazarus directory, compiler path.
24 }
25 unit Files_Options;
26
27 {$mode objfpc}{$H+}
28
29 interface
30
31 uses
32 SysUtils,
33 // LCL
34 StdCtrls, Dialogs, Controls, Spin,
35 // LazUtils
36 FileUtil, LazFileUtils,
37 // IDE
38 EnvironmentOpts,
39 // CodeTools
40 CodeToolManager, DefineTemplates,
41 // IdeIntf
42 IDEOptionsIntf, IDEOptEditorIntf, IDEDialogs, IDEUtils,
43 // IDE
44 LazarusIDEStrConsts, InputHistory, LazConf, DialogProcs, InitialSetupProc, Classes;
45
46 type
47
48 { TFilesOptionsFrame }
49
50 TFilesOptionsFrame = class(TAbstractIDEOptionsEditor)
51 AutoCloseCompileDialogCheckBox: TCheckBox;
52 CompilerTranslationFileButton:TButton;
53 CompilerTranslationFileComboBox:TComboBox;
54 CompilerTranslationFileLabel:TLabel;
55 CompilerPathButton:TButton;
56 CompilerPathComboBox:TComboBox;
57 CompilerPathLabel:TLabel;
58 FPCSourceDirButton:TButton;
59 FPCSourceDirComboBox:TComboBox;
60 FPCSourceDirLabel:TLabel;
61 lblCenter: TLabel;
62 LazarusDirButton:TButton;
63 LazarusDirComboBox:TComboBox;
64 LazarusDirLabel:TLabel;
65 MakePathButton:TButton;
66 MakePathComboBox:TComboBox;
67 MakePathLabel:TLabel;
68 MaxRecentOpenFilesSpin: TSpinEdit;
69 MaxRecentOpenFilesLabel: TLabel;
70 MaxRecentProjectFilesSpin: TSpinEdit;
71 MaxRecentProjectFilesLabel: TLabel;
72 ShowCompileDialogCheckBox: TCheckBox;
73 TestBuildDirButton:TButton;
74 TestBuildDirComboBox:TComboBox;
75 TestBuildDirLabel:TLabel;
76 FppkgConfigurationFileLabel: TLabel;
77 FppkgConfigurationFileComboBox: TComboBox;
78 FppkgConfigurationFileButton: TButton;
79 procedure CompilerTranslationFileButtonClick(Sender:TObject);
80 procedure FilesButtonClick(Sender: TObject);
81 procedure DirectoriesButtonClick(Sender: TObject);
82 procedure ShowCompileDialogCheckBoxChange(Sender: TObject);
83 private
84 FOldLazarusDir: string;
85 FOldRealLazarusDir: string;
86 FOldCompilerFilename: string;
87 FOldRealCompilerFilename: string;
88 FOldFPCSourceDir: string;
89 FOldRealFPCSourceDir: string;
90 FOldMakeFilename: string;
91 FOldRealMakeFilename: string;
92 FOldTestDir: string;
93 FOldRealTestDir: string;
94 fOldCompilerMessagesFilename: string;
95 fOldRealCompilerMessagesFilename: string;
96 fOldFppkcConfigurationFilename: string;
97 FOldMaxRecentOpenFiles: integer;
98 FOldMaxRecentProjectFiles: integer;
99 fOldShowCompileDialog: boolean;
100 fOldAutoCloseCompileDialog: boolean;
CheckLazarusDirnull101 function CheckLazarusDir(Buttons: TMsgDlgButtons): boolean;
CheckCompilernull102 function CheckCompiler(Buttons: TMsgDlgButtons): boolean;
CheckFPCSourceDirnull103 function CheckFPCSourceDir(Buttons: TMsgDlgButtons): boolean;
CheckTestDirnull104 function CheckTestDir: boolean;
CheckMakenull105 function CheckMake: boolean;
CheckFPCMsgFilenull106 function CheckFPCMsgFile: boolean;
107 public
Checknull108 function Check: Boolean; override;
GetTitlenull109 function GetTitle: String; override;
110 procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
111 procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
112 procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
113 procedure RestoreSettings(AOptions: TAbstractIDEOptions); override;
SupportedOptionsClassnull114 class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
115 end;
116
117 implementation
118
119 {$R *.lfm}
120
121 { TFilesOptionsFrame }
122
123 procedure TFilesOptionsFrame.FilesButtonClick(Sender: TObject);
124 var
125 OpenDialog: TOpenDialog;
126 lDirText : string;
127 lExpandedName: string; // Expanded name before Dialog
128 lDirName, lDirNameF : string;
129 begin
130 OpenDialog := IDEOpenDialogClass.Create(nil);
131 try
132 InputHistories.ApplyFileDialogSettings(OpenDialog);
133 OpenDialog.Options := OpenDialog.Options+[ofPathMustExist];
134 // set title
135 if Sender = CompilerPathButton then begin
136 OpenDialog.Title := Format(lisChooseCompilerExecutable,[GetDefaultCompilerFilename]);
137 lDirText := CompilerPathComboBox.Text;
138 end
139 else if Sender=MakePathButton then begin
140 OpenDialog.Title := lisChooseMakeExecutable;
141 lDirText := MakePathComboBox.Text;
142 end
143 else
144 exit;
145
146 lDirName := EnvironmentOptions.GetParsedValue(eopCompilerFilename, lDirText);
147 lExpandedName := CleanAndExpandFilename(lDirName);
148 lDirName := GetValidDirectoryAndFilename(lDirName, {out} lDirNameF);
149 OpenDialog.InitialDir := lDirName;
150 OpenDialog.FileName := lDirNameF;
151
152 if OpenDialog.Execute then begin
153 lDirNameF := CleanAndExpandFilename(OpenDialog.Filename);
154 if UpperCase(lExpandedName) <> UpperCase(lDirNameF) then begin // Changed ?
155 lDirText := lDirNameF;
156 if Sender=CompilerPathButton then begin
157 // check compiler filename
158 SetComboBoxText(CompilerPathComboBox,lDirText,cstFilename);
159 CheckCompiler([mbOk]);
160 end
161 else if Sender = MakePathButton then begin
162 // check make filename
163 SetComboBoxText(MakePathComboBox,lDirText,cstFilename);
164 CheckMake;
165 end;
166 end;
167 end;
168 InputHistories.StoreFileDialogSettings(OpenDialog);
169 finally
170 OpenDialog.Free;
171 end;
172 end;
173
174 procedure TFilesOptionsFrame.CompilerTranslationFileButtonClick(Sender:TObject);
175 var
176 OpenDialog: TOpenDialog;
177 AFilename: string;
178 begin
179 OpenDialog:=IDEOpenDialogClass.Create(nil);
180 try
181 InputHistories.ApplyFileDialogSettings(OpenDialog);
182 OpenDialog.Options:=OpenDialog.Options+[ofPathMustExist];
183 OpenDialog.Title:=lisChooseCompilerMessages;
184 OpenDialog.Filter:=dlgFilterFPCMessageFile+' (*.msg)|*.msg|'+dlgFilterAll+'|'+
185 GetAllFilesMask;
186 if OpenDialog.Execute then begin
187 AFilename:=CleanAndExpandFilename(OpenDialog.Filename);
188 SetComboBoxText(CompilerTranslationFileComboBox,AFilename,cstFilename);
189 end;
190 InputHistories.StoreFileDialogSettings(OpenDialog);
191 finally
192 OpenDialog.Free;
193 end;
194 end;
195
196 procedure TFilesOptionsFrame.DirectoriesButtonClick(Sender: TObject);
197 var
198 OpenDialog: TSelectDirectoryDialog;
199 lDirText : string;
200 lExpandedName: string;
201 lDirName, lDirNameF: string;
202 begin
203 OpenDialog := TSelectDirectoryDialog.Create(nil);
204 try
205 InputHistories.ApplyFileDialogSettings(OpenDialog);
206 OpenDialog.Options := OpenDialog.Options+[ofPathMustExist];
207 // set title
208 if Sender = LazarusDirButton then begin
209 OpenDialog.Title := lisChooseLazarusSourceDirectory;
210 lDirText := LazarusDirComboBox.Text;
211 end
212 else if Sender = FPCSourceDirButton then begin
213 OpenDialog.Title := lisChooseFPCSourceDir;
214 lDirText := FPCSourceDirComboBox.Text;
215 end
216 else if Sender=TestBuildDirButton then begin
217 OpenDialog.Title := lisChooseTestBuildDir;
218 lDirText := TestBuildDirComboBox.Text;
219 end
220 else
221 exit;
222
223 if lDirText = '' then
224 lDirName := EnvironmentOptions.GetParsedValue(eopLazarusDirectory, '')
225 else
226 lDirName := EnvironmentOptions.GetParsedValue(eopLazarusDirectory, lDirText);
227
228 lExpandedName := CleanAndExpandDirectory(lDirName);
229 lDirName := GetValidDirectoryAndFilename(lDirName, lDirNameF);
230 {
231 if lDirNameF = '' then begin
232 lDirName := ExtractFilePath(lDirName);
233 lDirNameF := ExtractFileName(lDirName);
234 end;
235 }
236
237 OpenDialog.InitialDir := IncludeTrailingBackslash(lDirName);
238 OpenDialog.FileName := lDirNameF;
239
240 if OpenDialog.Execute then begin
241 lDirName := CleanAndExpandDirectory(OpenDialog.Filename);
242 if UpperCase(lDirName)<>UpperCase(lExpandedName) then begin
243 lDirText := lDirName;
244 if Sender = LazarusDirButton then begin
245 // check lazarus directory
246 SetComboBoxText(LazarusDirComboBox,lDirText,cstFilename);
247 CheckLazarusDir([mbOk]);
248 end
249 else if Sender = FPCSourceDirButton then begin
250 // check fpc source directory
251 SetComboBoxText(FPCSourceDirComboBox,lDirText,cstFilename);
252 CheckFPCSourceDir([mbOK]);
253 end
254 else if Sender = TestBuildDirButton then begin
255 // check test directory
256 SetComboBoxText(TestBuildDirComboBox,lDirText,cstFilename);
257 CheckTestDir;
258 end;
259 end;
260 end;
261 InputHistories.StoreFileDialogSettings(OpenDialog);
262 finally
263 OpenDialog.Free;
264 end;
265 end;
266
267 procedure TFilesOptionsFrame.ShowCompileDialogCheckBoxChange(Sender: TObject);
268 begin
269 AutoCloseCompileDialogCheckBox.Enabled := ShowCompileDialogCheckBox.Checked;
270 end;
271
272 procedure TFilesOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
273 begin
274 MaxRecentOpenFilesLabel.Caption:=dlgMaxRecentFiles;
275 MaxRecentOpenFilesLabel.Hint:=dlgMaxRecentHint;
276 MaxRecentProjectFilesLabel.Caption:=dlgMaxRecentProjs;
277 MaxRecentProjectFilesLabel.Hint:=dlgMaxRecentHint;
278 ShowCompileDialogCheckBox.Visible:=false;
279 AutoCloseCompileDialogCheckBox.Visible:=false;
280 LazarusDirLabel.Caption:=dlgLazarusDir;
281 with LazarusDirComboBox.Items do
282 begin
283 BeginUpdate;
284 Add(ProgramDirectoryWithBundle);
285 EndUpdate;
286 end;
287
288 CompilerPathLabel.Caption:=Format(dlgFpcExecutable,[GetDefaultCompilerFilename]);
289 FPCSourceDirLabel.Caption:=dlgFpcSrcPath;
290 FppkgConfigurationFileLabel.Caption:=dlgFppkgConfigurationFile;
291 MakePathLabel.Caption:=dlgMakeExecutable;
292 with MakePathComboBox.Items do
293 begin
294 BeginUpdate;
295 Add('make');
296 Add('gmake');
297 EndUpdate;
298 end;
299
300 TestBuildDirLabel.Caption:=dlgTestPrjDir;
301 with TestBuildDirComboBox.Items do
302 begin
303 BeginUpdate;
304 {$IFDEF Unix}
305 Add('~/tmp');
306 Add('/tmp');
307 Add('/var/tmp');
308 {$ELSE}
309 Add('c:\tmp');
310 Add('c:\windows\temp');
311 {$ENDIF}
312 EndUpdate;
313 end;
314
315 CompilerTranslationFileLabel.Caption:=dlgCompilerMessages;
316 CompilerTranslationFileLabel.Hint:=
317 lisSetThisToTranslateTheCompilerMessagesToAnotherLang;
318 CompilerTranslationFileButton.Hint:=CompilerTranslationFileLabel.Hint;
319 CompilerTranslationFileComboBox.Hint:=CompilerTranslationFileLabel.Hint;
320 with CompilerTranslationFileComboBox.Items do
321 begin
322 Add(GetForcedPathDelims('$(FPCSrcDir)/compiler/msg/errordu.msg'));
323 end;
324 end;
325
TFilesOptionsFrame.GetTitlenull326 function TFilesOptionsFrame.GetTitle: String;
327 begin
328 Result := dlgEnvFiles;
329 end;
330
TFilesOptionsFrame.Checknull331 function TFilesOptionsFrame.Check: Boolean;
332 begin
333 Result := False;
334 with EnvironmentOptions do
335 begin
336 LazarusDirectory:=LazarusDirComboBox.Text;
337 CompilerFilename:=CompilerPathComboBox.Text;
338 FPCSourceDirectory:=FPCSourceDirComboBox.Text;
339 MakeFilename:=MakePathComboBox.Text;
340 TestBuildDirectory:=TestBuildDirComboBox.Text;
341 CompilerMessagesFilename:=CompilerTranslationFileComboBox.Text;
342 FppkgConfigFile:=FppkgConfigurationFileComboBox.Text;
343 end;
344 // check lazarus directory
345 if not CheckLazarusDir([mbIgnore,mbCancel]) then exit;
346 // check compiler filename
347 if not CheckCompiler([mbIgnore,mbCancel]) then exit;
348 // check fpc source directory
349 if not CheckFPCSourceDir([mbIgnore,mbCancel]) then exit;
350 // check make filename
351 if not CheckMake then exit;
352 // check test directory
353 if not CheckTestDir then exit;
354 // check fpc messages file
355 if not CheckFPCMsgFile then exit;
356 Result := True;
357 end;
358
359 procedure TFilesOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
360 begin
361 with AOptions as TEnvironmentOptions do
362 begin
363 // Lazarus dir
364 FOldLazarusDir:=LazarusDirectory;
365 FOldRealLazarusDir:=GetParsedLazarusDirectory;
366 if LazarusDirHistory.Count>0 then
367 LazarusDirComboBox.Items.Assign(LazarusDirHistory);
368 SetComboBoxText(LazarusDirComboBox,LazarusDirectory,cstFilename,MaxComboBoxCount);
369
370 // compiler filename
371 FOldCompilerFilename:=CompilerFilename;
372 FOldRealCompilerFilename:=GetParsedCompilerFilename;
373 with CompilerPathComboBox do
374 begin
375 Items.BeginUpdate;
376 Items.Assign(CompilerFileHistory);
377 AddFilenameToList(Items,FindDefaultCompilerPath);
378 AddFilenameToList(Items,FindDefaultExecutablePath('fpc'+GetExecutableExt));
379 Items.EndUpdate;
380 end;
381 SetComboBoxText(CompilerPathComboBox,CompilerFilename,cstFilename,MaxComboBoxCount);
382
383 // FPC src dir
384 FOldFPCSourceDir:=FPCSourceDirectory;
385 FOldRealFPCSourceDir:=GetParsedFPCSourceDirectory;
386 if FPCSourceDirHistory.Count>0 then
387 FPCSourceDirComboBox.Items.Assign(FPCSourceDirHistory);
388 SetComboBoxText(FPCSourceDirComboBox,FPCSourceDirectory,cstFilename,MaxComboBoxCount);
389
390 // "make"
391 FOldMakeFilename:=MakeFilename;
392 FOldRealMakeFilename:=GetParsedMakeFilename;
393 if MakeFileHistory.Count>0 then
394 MakePathComboBox.Items.Assign(MakeFileHistory);
395 SetComboBoxText(MakePathComboBox,MakeFilename,cstFilename,MaxComboBoxCount);
396
397 // test build dir
398 FOldTestDir:=TestBuildDirectory;
399 FOldRealTestDir:=GetParsedTestBuildDirectory;
400 if TestBuildDirHistory.Count>0 then
401 TestBuildDirComboBox.Items.Assign(TestBuildDirHistory);
402 SetComboBoxText(TestBuildDirComboBox,TestBuildDirectory,cstFilename,MaxComboBoxCount);
403
404 // compiler messages file
405 fOldCompilerMessagesFilename:=CompilerMessagesFilename;
406 fOldRealCompilerMessagesFilename:=GetParsedCompilerMessagesFilename;
407 if CompilerMessagesFileHistory.Count>0 then
408 CompilerTranslationFileComboBox.Items.Assign(CompilerMessagesFileHistory);
409 SetComboBoxText(CompilerTranslationFileComboBox,CompilerMessagesFilename,cstFilename,MaxComboBoxCount);
410
411 // fppkg configuration file
412 fOldFppkcConfigurationFilename:=FppkgConfigFile;
413 fOldRealCompilerMessagesFilename:=GetParsedFppkgConfig;
414 if FppkgConfigFileHistory.Count>0 then
415 FppkgConfigurationFileComboBox.Items.Assign(FppkgConfigFileHistory);
416 SetComboBoxText(FppkgConfigurationFileComboBox,FppkgConfigFile,cstFilename,MaxComboBoxCount);
417
418 // recent files and directories
419 FOldMaxRecentOpenFiles := MaxRecentOpenFiles;
420 MaxRecentOpenFilesSpin.Value := MaxRecentOpenFiles;
421 FOldMaxRecentProjectFiles := MaxRecentProjectFiles;
422 MaxRecentProjectFilesSpin.Value := MaxRecentProjectFiles;
423
424 // compile dialog
425 fOldShowCompileDialog:=ShowCompileDialog;
426 ShowCompileDialogCheckBox.Checked:=ShowCompileDialog;
427 fOldAutoCloseCompileDialog:=AutoCloseCompileDialog;
428 AutoCloseCompileDialogCheckBox.Checked:=AutoCloseCompileDialog;
429 AutoCloseCompileDialogCheckBox.Enabled:=ShowCompileDialogCheckBox.Checked;
430 end;
431 end;
432
433 procedure TFilesOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
434 begin
435 with AOptions as TEnvironmentOptions do
436 begin
437 LazarusDirectory:=LazarusDirComboBox.Text;
438 LazarusDirHistory.Assign(LazarusDirComboBox.Items);
439 CompilerFilename:=CompilerPathComboBox.Text;
440 CompilerFileHistory.Assign(CompilerPathComboBox.Items);
441 FPCSourceDirectory:=FPCSourceDirComboBox.Text;
442 FPCSourceDirHistory.Assign(FPCSourceDirComboBox.Items);
443 MakeFilename:=MakePathComboBox.Text;
444 MakeFileHistory.Assign(MakePathComboBox.Items);
445 TestBuildDirHistory.Assign(TestBuildDirComboBox.Items);
446 TestBuildDirectory:=TestBuildDirComboBox.Text;
447 CompilerMessagesFileHistory.Assign(CompilerTranslationFileComboBox.Items);
448 CompilerMessagesFilename:=CompilerTranslationFileComboBox.Text;
449 FppkgConfigFileHistory.Assign(FppkgConfigurationFileComboBox.Items);
450 FppkgConfigFile:=FppkgConfigurationFileComboBox.Text;
451
452 // recent files and directories
453 MaxRecentOpenFiles := MaxRecentOpenFilesSpin.Value;
454 MaxRecentProjectFiles := MaxRecentProjectFilesSpin.Value;
455 ShowCompileDialog := ShowCompileDialogCheckBox.Checked;
456 AutoCloseCompileDialog := AutoCloseCompileDialogCheckBox.Checked;
457 end;
458 end;
459
460 procedure TFilesOptionsFrame.RestoreSettings(AOptions: TAbstractIDEOptions);
461 begin
462 inherited RestoreSettings(AOptions);
463 with AOptions as TEnvironmentOptions do
464 begin
465 LazarusDirectory:=FOldLazarusDir;
466 CompilerFilename:=FOldCompilerFilename;
467 FPCSourceDirectory:=FOldFPCSourceDir;
468 MakeFilename:=FOldMakeFilename;
469 TestBuildDirectory:=FOldTestDir;
470 CompilerMessagesFilename:=fOldCompilerMessagesFilename;
471 FppkgConfigFile:=fOldFppkcConfigurationFilename;
472
473 // recent files and directories
474 MaxRecentOpenFiles := FOldMaxRecentOpenFiles;
475 MaxRecentProjectFiles := FOldMaxRecentProjectFiles;
476 ShowCompileDialog := fOldShowCompileDialog;
477 AutoCloseCompileDialog := fOldAutoCloseCompileDialog;
478 end;
479 end;
480
TFilesOptionsFrame.CheckLazarusDirnull481 function TFilesOptionsFrame.CheckLazarusDir(Buttons: TMsgDlgButtons): boolean;
482 var
483 NewLazarusDir: string;
484 Quality: TSDFilenameQuality;
485 Note: string;
486 begin
487 if EnvironmentOptions.LazarusDirectory=FOldLazarusDir then exit(true);
488 Result := False;
489 EnvironmentOptions.LazarusDirectory:=LazarusDirComboBox.Text;
490 NewLazarusDir := EnvironmentOptions.GetParsedLazarusDirectory;
491 Quality:=CheckLazarusDirectoryQuality(NewLazarusDir,Note);
492 if Quality<>sddqCompatible then
493 begin
494 if IDEMessageDialog(lisCCOWarningCaption,
495 Format(lisTheLazarusDirectoryDoesNotLookCorrect,
496 [NewLazarusDir, LineEnding, Note]),
497 mtWarning, Buttons)<>mrIgnore
498 then
499 exit;
500 end;
501 Result := true;
502 end;
503
TFilesOptionsFrame.CheckFPCSourceDirnull504 function TFilesOptionsFrame.CheckFPCSourceDir(Buttons: TMsgDlgButtons): boolean;
505 var
506 NewFPCSrcDir: string;
507 Note: string;
508 Quality: TSDFilenameQuality;
509 CfgCache: TPCTargetConfigCache;
510 FPCVer: String;
511 begin
512 if EnvironmentOptions.FPCSourceDirectory=FOldFPCSourceDir then exit(true);
513 Result:=false;
514 CfgCache:=CodeToolBoss.CompilerDefinesCache.ConfigCaches.Find(
515 EnvironmentOptions.GetParsedCompilerFilename,'','','',true);
516 FPCVer:=CfgCache.GetFPCVer;
517 EnvironmentOptions.FPCSourceDirectory:=FPCSourceDirComboBox.Text;
518 NewFPCSrcDir:=EnvironmentOptions.GetParsedFPCSourceDirectory;
519 Quality:=CheckFPCSrcDirQuality(NewFPCSrcDir,Note,FPCVer);
520 if Quality<>sddqCompatible then
521 begin
522 if IDEMessageDialog(lisCCOWarningCaption,
523 Format(lisTheFPCSourceDirectoryDoesNotLookCorrect,
524 [NewFPCSrcDir, LineEnding, Note]),
525 mtWarning, Buttons)<>mrIgnore
526 then
527 exit;
528 end;
529 Result:=true;
530 end;
531
TFilesOptionsFrame.CheckCompilernull532 function TFilesOptionsFrame.CheckCompiler(Buttons: TMsgDlgButtons): boolean;
533 var
534 NewCompilerFilename: String;
535 Note: string;
536 Quality: TSDFilenameQuality;
537 begin
538 if EnvironmentOptions.CompilerFilename=FOldCompilerFilename then exit(true);
539 Result:=false;
540 EnvironmentOptions.CompilerFilename:=CompilerPathComboBox.Text;
541 NewCompilerFilename:=EnvironmentOptions.GetParsedCompilerFilename;
542 Quality:=CheckFPCExeQuality(NewCompilerFilename,Note,
543 CodeToolBoss.CompilerDefinesCache.TestFilename);
544 if Quality<>sddqCompatible then
545 begin
546 if IDEMessageDialog(lisCCOWarningCaption,
547 Format(lisTheCompilerFileDoesNotLookCorrect,
548 [NewCompilerFilename, LineEnding, Note]),
549 mtWarning, Buttons)<>mrIgnore
550 then
551 exit;
552 end;
553 Result:=true;
554 end;
555
CheckTestDirnull556 function TFilesOptionsFrame.CheckTestDir: boolean;
557 var
558 NewTestDir: string;
559 StopChecking: boolean;
560 begin
561 if EnvironmentOptions.TestBuildDirectory=FOldTestDir then exit(true);
562 EnvironmentOptions.TestBuildDirectory:=TestBuildDirComboBox.Text;
563 NewTestDir:=EnvironmentOptions.GetParsedTestBuildDirectory;
564 Result:=SimpleDirectoryCheck(FOldRealTestDir,NewTestDir,
565 lisEnvOptDlgTestDirNotFoundMsg,StopChecking);
566 end;
567
TFilesOptionsFrame.CheckMakenull568 function TFilesOptionsFrame.CheckMake: boolean;
569 var
570 NewMakeFilename: String;
571 begin
572 if EnvironmentOptions.MakeFilename=FOldMakeFilename then exit(true);
573 EnvironmentOptions.MakeFilename:=MakePathComboBox.Text;
574 NewMakeFilename:=EnvironmentOptions.GetParsedMakeFilename;
575 Result:=CheckExecutable(FOldRealMakeFilename,NewMakeFilename,
576 lisCCOWarningCaption, Format(lisThePathOfMakeIsNotCorrect, [NewMakeFilename]));
577 end;
578
TFilesOptionsFrame.CheckFPCMsgFilenull579 function TFilesOptionsFrame.CheckFPCMsgFile: boolean;
580 var
581 NewMsgFile: String;
582 begin
583 if EnvironmentOptions.CompilerMessagesFilename=FOldCompilerFilename then exit(true);
584 EnvironmentOptions.CompilerMessagesFilename:=CompilerTranslationFileComboBox.Text;
585 if EnvironmentOptions.CompilerMessagesFilename<>'' then begin
586 NewMsgFile:=EnvironmentOptions.GetParsedCompilerMessagesFilename;
587 if not FileExistsUTF8(NewMsgFile) then begin
588 if IDEMessageDialog(lisCCOErrorCaption, Format(
589 lisCompilerMessagesFileNotFound, [#13, NewMsgFile]), mtError, [mbCancel,
590 mbIgnore])<>mrIgnore
591 then
592 exit(false);
593 end;
594 end;
595 Result:=true;
596 end;
597
TFilesOptionsFrame.SupportedOptionsClassnull598 class function TFilesOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
599 begin
600 Result := TEnvironmentOptions;
601 end;
602
603 initialization
604 RegisterIDEOptionsEditor(GroupEnvironment, TFilesOptionsFrame, EnvOptionsFiles);
605 end.
606
607