diff --git a/ide/frames/files_options.lfm b/ide/frames/files_options.lfm index 7af3b46b21..c17f38099a 100644 --- a/ide/frames/files_options.lfm +++ b/ide/frames/files_options.lfm @@ -9,15 +9,15 @@ object FilesOptionsFrame: TFilesOptionsFrame ClientWidth = 569 TabOrder = 0 Visible = False - DesignLeft = 119 - DesignTop = 158 + DesignLeft = 441 + DesignTop = 249 object MaxRecentOpenFilesLabel: TLabel AnchorSideLeft.Control = Owner AnchorSideTop.Control = Owner Left = 2 - Height = 16 + Height = 15 Top = 2 - Width = 164 + Width = 145 Caption = 'MaxRecentOpenFilesLabel' ParentColor = False end @@ -25,9 +25,9 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideLeft.Control = lblCenter AnchorSideTop.Control = Owner Left = 287 - Height = 16 + Height = 15 Top = 2 - Width = 174 + Width = 155 BorderSpacing.Left = 3 Caption = 'MaxRecentProjectFilesLabel' ParentColor = False @@ -38,9 +38,9 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Side = asrBottom Left = 2 - Height = 18 - Top = 42 - Width = 227 + Height = 24 + Top = 50 + Width = 212 BorderSpacing.Top = 6 Caption = 'OpenLastProjectAtStartCheckBox' TabOrder = 0 @@ -51,9 +51,9 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Side = asrBottom Left = 2 - Height = 18 - Top = 60 - Width = 207 + Height = 24 + Top = 74 + Width = 188 Caption = 'ShowCompileDialogCheckBox' OnChange = ShowCompileDialogCheckBoxChange TabOrder = 1 @@ -63,9 +63,9 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Control = AutoCloseCompileDialogCheckBox AnchorSideTop.Side = asrBottom Left = 2 - Height = 16 - Top = 106 - Width = 101 + Height = 15 + Top = 132 + Width = 87 BorderSpacing.Top = 10 Caption = 'LazarusDirLabel' ParentColor = False @@ -78,8 +78,8 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideBottom.Control = LazarusDirComboBox AnchorSideBottom.Side = asrBottom Left = 542 - Height = 21 - Top = 122 + Height = 27 + Top = 147 Width = 25 Anchors = [akTop, akRight, akBottom] Caption = '...' @@ -92,8 +92,8 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = LazarusDirButton Left = 2 - Height = 21 - Top = 122 + Height = 27 + Top = 147 Width = 540 Anchors = [akTop, akLeft, akRight] ItemHeight = 0 @@ -106,8 +106,8 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = CompilerPathButton Left = 2 - Height = 21 - Top = 165 + Height = 27 + Top = 195 Width = 540 Anchors = [akTop, akLeft, akRight] ItemHeight = 0 @@ -121,8 +121,8 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideBottom.Control = CompilerPathComboBox AnchorSideBottom.Side = asrBottom Left = 542 - Height = 21 - Top = 165 + Height = 27 + Top = 195 Width = 25 Anchors = [akTop, akRight, akBottom] Caption = '...' @@ -134,9 +134,9 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Control = LazarusDirComboBox AnchorSideTop.Side = asrBottom Left = 2 - Height = 16 - Top = 149 - Width = 118 + Height = 15 + Top = 180 + Width = 103 BorderSpacing.Top = 6 Caption = 'CompilerPathLabel' ParentColor = False @@ -147,8 +147,8 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = FPCSourceDirButton Left = 2 - Height = 21 - Top = 208 + Height = 27 + Top = 243 Width = 540 Anchors = [akTop, akLeft, akRight] ItemHeight = 0 @@ -162,8 +162,8 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideBottom.Control = FPCSourceDirComboBox AnchorSideBottom.Side = asrBottom Left = 542 - Height = 21 - Top = 208 + Height = 27 + Top = 243 Width = 25 Anchors = [akTop, akRight, akBottom] Caption = '...' @@ -175,9 +175,9 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Control = CompilerPathComboBox AnchorSideTop.Side = asrBottom Left = 2 - Height = 16 - Top = 192 - Width = 118 + Height = 15 + Top = 228 + Width = 104 BorderSpacing.Top = 6 Caption = 'FPCSourceDirLabel' ParentColor = False @@ -187,9 +187,9 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Control = FPCSourceDirComboBox AnchorSideTop.Side = asrBottom Left = 2 - Height = 16 - Top = 235 - Width = 94 + Height = 15 + Top = 276 + Width = 83 BorderSpacing.Top = 6 Caption = 'MakePathLabel' ParentColor = False @@ -199,9 +199,9 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Control = MakePathComboBox AnchorSideTop.Side = asrBottom Left = 2 - Height = 16 - Top = 278 - Width = 110 + Height = 15 + Top = 324 + Width = 97 BorderSpacing.Top = 6 Caption = 'TestBuildDirLabel' ParentColor = False @@ -212,8 +212,8 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = MakePathButton Left = 2 - Height = 21 - Top = 251 + Height = 27 + Top = 291 Width = 540 Anchors = [akTop, akLeft, akRight] ItemHeight = 0 @@ -227,8 +227,8 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideBottom.Control = MakePathComboBox AnchorSideBottom.Side = asrBottom Left = 542 - Height = 21 - Top = 251 + Height = 27 + Top = 291 Width = 25 Anchors = [akTop, akRight, akBottom] Caption = '...' @@ -241,8 +241,8 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = TestBuildDirButton Left = 2 - Height = 21 - Top = 294 + Height = 27 + Top = 339 Width = 540 Anchors = [akTop, akLeft, akRight] ItemHeight = 0 @@ -256,8 +256,8 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideBottom.Control = TestBuildDirComboBox AnchorSideBottom.Side = asrBottom Left = 542 - Height = 21 - Top = 294 + Height = 27 + Top = 339 Width = 25 Anchors = [akTop, akRight, akBottom] Caption = '...' @@ -270,54 +270,60 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Side = asrBottom Left = 32 - Height = 18 - Top = 78 - Width = 238 + Height = 24 + Top = 98 + Width = 215 BorderSpacing.Left = 30 Caption = 'AutoCloseCompileDialogCheckBox' TabOrder = 12 end - object CompilerMessagesLabel: TLabel + object CompilerTranslationFileLabel: TLabel AnchorSideLeft.Control = Owner AnchorSideTop.Control = TestBuildDirComboBox AnchorSideTop.Side = asrBottom Left = 2 - Height = 16 - Top = 321 - Width = 152 + Height = 15 + Top = 372 + Width = 158 Alignment = taRightJustify BorderSpacing.Top = 6 - Caption = 'CompilerMessagesLabel' + Caption = 'CompilerTranslationFileLabel' ParentColor = False + ParentShowHint = False + ShowHint = True end - object CompilerMessagesButton: TButton - AnchorSideTop.Control = CompilerMessagesComboBox + object CompilerTranslationFileButton: TButton + AnchorSideTop.Control = CompilerTranslationFileComboBox AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = CompilerMessagesComboBox + AnchorSideBottom.Control = CompilerTranslationFileComboBox AnchorSideBottom.Side = asrBottom Left = 542 - Height = 21 - Top = 337 + Height = 27 + Top = 387 Width = 25 Anchors = [akTop, akRight, akBottom] Caption = '...' - OnClick = CompilerMessagesButtonClick + OnClick = CompilerTranslationFileButtonClick + ParentShowHint = False + ShowHint = True TabOrder = 13 end - object CompilerMessagesComboBox: TComboBox + object CompilerTranslationFileComboBox: TComboBox AnchorSideLeft.Control = Owner - AnchorSideTop.Control = CompilerMessagesLabel + AnchorSideTop.Control = CompilerTranslationFileLabel AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = CompilerMessagesButton + AnchorSideRight.Control = CompilerTranslationFileButton Left = 2 - Height = 21 - Top = 337 + Height = 27 + Top = 387 Width = 540 Anchors = [akTop, akLeft, akRight] ItemHeight = 0 + ParentShowHint = False + ShowHint = True TabOrder = 14 - Text = 'CompilerMessagesComboBox' + Text = 'CompilerTranslationFileComboBox' end object lblCenter: TLabel AnchorSideLeft.Control = Owner @@ -335,8 +341,8 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideRight.Control = lblCenter AnchorSideRight.Side = asrBottom Left = 2 - Height = 16 - Top = 20 + Height = 25 + Top = 19 Width = 278 Anchors = [akTop, akLeft, akRight] BorderSpacing.Right = 3 @@ -350,8 +356,8 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 289 - Height = 16 - Top = 20 + Height = 25 + Top = 19 Width = 278 Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 3 diff --git a/ide/frames/files_options.pas b/ide/frames/files_options.pas index c621957c50..ef0693fcd0 100644 --- a/ide/frames/files_options.pas +++ b/ide/frames/files_options.pas @@ -40,9 +40,9 @@ type TFilesOptionsFrame = class(TAbstractIDEOptionsEditor) AutoCloseCompileDialogCheckBox: TCheckBox; - CompilerMessagesButton:TButton; - CompilerMessagesComboBox:TComboBox; - CompilerMessagesLabel:TLabel; + CompilerTranslationFileButton:TButton; + CompilerTranslationFileComboBox:TComboBox; + CompilerTranslationFileLabel:TLabel; CompilerPathButton:TButton; CompilerPathComboBox:TComboBox; CompilerPathLabel:TLabel; @@ -65,7 +65,7 @@ type TestBuildDirButton:TButton; TestBuildDirComboBox:TComboBox; TestBuildDirLabel:TLabel; - procedure CompilerMessagesButtonClick(Sender:TObject); + procedure CompilerTranslationFileButtonClick(Sender:TObject); procedure FilesButtonClick(Sender: TObject); procedure DirectoriesButtonClick(Sender: TObject); procedure ShowCompileDialogCheckBoxChange(Sender: TObject); @@ -92,6 +92,7 @@ type function CheckFPCSourceDir(Buttons: TMsgDlgButtons): boolean; function CheckTestDir: boolean; function CheckMake: boolean; + function CheckFPCMsgFile: boolean; public function Check: Boolean; override; function GetTitle: String; override; @@ -145,7 +146,7 @@ begin end; end; -procedure TFilesOptionsFrame.CompilerMessagesButtonClick(Sender:TObject); +procedure TFilesOptionsFrame.CompilerTranslationFileButtonClick(Sender:TObject); var OpenDialog: TOpenDialog; AFilename: string; @@ -159,7 +160,7 @@ begin GetAllFilesMask; if OpenDialog.Execute then begin AFilename:=CleanAndExpandFilename(OpenDialog.Filename); - SetComboBoxText(CompilerMessagesComboBox,AFilename,cstFilename); + SetComboBoxText(CompilerTranslationFileComboBox,AFilename,cstFilename); end; InputHistories.StoreFileDialogSettings(OpenDialog); finally @@ -223,7 +224,6 @@ begin ShowCompileDialogCheckBox.Caption:=dlgQShowCompileDialog; AutoCloseCompileDialogCheckBox.Caption:=dlgQAutoCloseCompileDialog; LazarusDirLabel.Caption:=dlgLazarusDir; - with LazarusDirComboBox.Items do begin BeginUpdate; @@ -234,7 +234,6 @@ begin CompilerPathLabel.Caption:=Format(dlgFpcPath,[GetDefaultCompilerFilename]); FPCSourceDirLabel.Caption:=dlgFpcSrcPath; MakePathLabel.Caption:=dlgMakePath; - with MakePathComboBox.Items do begin BeginUpdate; @@ -244,17 +243,29 @@ begin end; TestBuildDirLabel.Caption:=dlgTestPrjDir; - with TestBuildDirComboBox.Items do begin BeginUpdate; + {$IFDEF Unix} + Add('~/tmp'); Add('/tmp'); Add('/var/tmp'); - Add('c:/tmp'); - Add('c:/windows/temp'); + {$ELSE} + Add('c:\tmp'); + Add('c:\windows\temp'); + {$ENDIF} EndUpdate; end; - CompilerMessagesLabel.Caption:=dlgCompilerMessages; + + CompilerTranslationFileLabel.Caption:=dlgCompilerMessages; + CompilerTranslationFileLabel.Hint:= + lisSetThisToTranslateTheCompilerMessagesToAnotherLang; + CompilerTranslationFileButton.Hint:=CompilerTranslationFileLabel.Hint; + CompilerTranslationFileComboBox.Hint:=CompilerTranslationFileLabel.Hint; + with CompilerTranslationFileComboBox.Items do + begin + Add(SetDirSeparators('$(FPCSrcDir)/compiler/msg/errordu.msg')); + end; end; function TFilesOptionsFrame.GetTitle: String; @@ -272,7 +283,7 @@ begin FPCSourceDirectory:=FPCSourceDirComboBox.Text; MakeFilename:=MakePathComboBox.Text; TestBuildDirectory:=TestBuildDirComboBox.Text; - CompilerMessagesFilename:=CompilerMessagesComboBox.Text; + CompilerMessagesFilename:=CompilerTranslationFileComboBox.Text; end; // check lazarus directory if not CheckLazarusDir([mbIgnore,mbCancel]) then exit; @@ -284,6 +295,8 @@ begin if not CheckMake then exit; // check test directory if not CheckTestDir then exit; + // check fpc messages file + if not CheckFPCMsgFile then exit; Result := True; end; @@ -294,8 +307,13 @@ begin // Lazarus dir FOldLazarusDir:=LazarusDirectory; FOldRealLazarusDir:=GetParsedLazarusDirectory; - LazarusDirComboBox.Items.Assign(LazarusDirHistory); + if LazarusDirHistory.Count>0 then + LazarusDirComboBox.Items.Assign(LazarusDirHistory); SetComboBoxText(LazarusDirComboBox,LazarusDirectory,cstFilename,MaxComboBoxCount); + + // compiler filename + FOldCompilerFilename:=CompilerFilename; + FOldRealCompilerFilename:=GetParsedCompilerFilename; with CompilerPathComboBox do begin Items.BeginUpdate; @@ -304,35 +322,35 @@ begin AddFilenameToList(Items,FindDefaultExecutablePath('fpc'+GetExecutableExt)); Items.EndUpdate; end; - - // compiler filename - FOldCompilerFilename:=CompilerFilename; - FOldRealCompilerFilename:=GetParsedCompilerFilename; SetComboBoxText(CompilerPathComboBox,CompilerFilename,cstFilename,MaxComboBoxCount); // FPC src dir FOldFPCSourceDir:=FPCSourceDirectory; FOldRealFPCSourceDir:=GetParsedFPCSourceDirectory; - FPCSourceDirComboBox.Items.Assign(FPCSourceDirHistory); + if FPCSourceDirHistory.Count>0 then + FPCSourceDirComboBox.Items.Assign(FPCSourceDirHistory); SetComboBoxText(FPCSourceDirComboBox,FPCSourceDirectory,cstFilename,MaxComboBoxCount); // "make" FOldMakeFilename:=MakeFilename; FOldRealMakeFilename:=GetParsedMakeFilename; - MakePathComboBox.Items.Assign(MakeFileHistory); + if MakeFileHistory.Count>0 then + MakePathComboBox.Items.Assign(MakeFileHistory); SetComboBoxText(MakePathComboBox,MakeFilename,cstFilename,MaxComboBoxCount); // test build dir FOldTestDir:=TestBuildDirectory; FOldRealTestDir:=GetParsedTestBuildDirectory; - TestBuildDirComboBox.Items.Assign(TestBuildDirHistory); + if TestBuildDirHistory.Count>0 then + TestBuildDirComboBox.Items.Assign(TestBuildDirHistory); SetComboBoxText(TestBuildDirComboBox,TestBuildDirectory,cstFilename,MaxComboBoxCount); // compiler messages file fOldCompilerMessagesFilename:=CompilerMessagesFilename; fOldRealCompilerMessagesFilename:=GetParsedCompilerMessagesFilename; - CompilerMessagesComboBox.Items.Assign(CompilerMessagesFileHistory); - SetComboBoxText(CompilerMessagesComboBox,CompilerMessagesFilename,cstFilename,MaxComboBoxCount); + if CompilerMessagesFileHistory.Count>0 then + CompilerTranslationFileComboBox.Items.Assign(CompilerMessagesFileHistory); + SetComboBoxText(CompilerTranslationFileComboBox,CompilerMessagesFilename,cstFilename,MaxComboBoxCount); // recent files and directories FOldMaxRecentOpenFiles := MaxRecentOpenFiles; @@ -367,8 +385,8 @@ begin MakeFileHistory.Assign(MakePathComboBox.Items); TestBuildDirHistory.Assign(TestBuildDirComboBox.Items); TestBuildDirectory:=TestBuildDirComboBox.Text; - CompilerMessagesFileHistory.Assign(CompilerMessagesComboBox.Items); - CompilerMessagesFilename:=CompilerMessagesComboBox.Text; + CompilerMessagesFileHistory.Assign(CompilerTranslationFileComboBox.Items); + CompilerMessagesFilename:=CompilerTranslationFileComboBox.Text; // recent files and directories MaxRecentOpenFiles := MaxRecentOpenFilesSpin.Value; @@ -498,6 +516,23 @@ begin lisCCOWarningCaption, Format(lisThePathOfMakeIsNotCorrect, [NewMakeFilename])); end; +function TFilesOptionsFrame.CheckFPCMsgFile: boolean; +var + NewMsgFile: String; +begin + if EnvironmentOptions.CompilerMessagesFilename=FOldCompilerFilename then exit(true); + EnvironmentOptions.CompilerMessagesFilename:=CompilerTranslationFileComboBox.Text; + NewMsgFile:=EnvironmentOptions.GetParsedCompilerMessagesFilename; + if not FileExistsUTF8(NewMsgFile) then begin + if IDEMessageDialog(lisCCOErrorCaption, Format( + lisCompilerMessagesFileNotFound, [#13, NewMsgFile]), mtError, [mbCancel, + mbIgnore])<>mrIgnore + then + exit(false); + end; + Result:=true; +end; + class function TFilesOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass; begin Result := TEnvironmentOptions; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 6d7563522a..46f194f3a9 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -1220,7 +1220,10 @@ resourcestring dlgFpcPath = 'Compiler path (e.g. %s)'; dlgFpcSrcPath = 'FPC source directory'; dlgMakePath = 'Make path'; - dlgCompilerMessages = 'Compiler messages language file'; + dlgCompilerMessages = 'Compiler messages language file (*.msg)'; + lisSetThisToTranslateTheCompilerMessagesToAnotherLang = 'Set this to ' + +'translate the compiler messages to another language (i.e. not English). ' + +'For example: German: $(FPCSrcDir)/compiler/msg/errordu.msg.'; dlgDebugType = 'Debugger type and path'; dlgTestPrjDir = 'Directory for building test projects'; dlgQShowGrid = 'Show grid'; @@ -2111,6 +2114,7 @@ resourcestring dlgCCOTestMissingPPU = 'Test: Checking missing fpc ppu ...'; dlgCCOTestCompilerDate = 'Test: Checking compiler date ...'; lisCCOErrorCaption = 'Error'; + lisCompilerMessagesFileNotFound = 'Compiler messages file not found:%s%s'; lisUnableToOpen = 'Unable to open "%s"'; lisCompilerDoesNotSupportTarget = 'Compiler "%s" does not support target %s-%s'; lisInvalidMode = 'Invalid mode %s';