mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 02:59:17 +02:00
IDE: Enable fppkg configuration file selection. Issue #40850, patch by Peacoor.
This commit is contained in:
parent
b4fe56e351
commit
30950b1cc2
@ -407,7 +407,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
|
|||||||
Width = 23
|
Width = 23
|
||||||
Anchors = [akTop, akRight, akBottom]
|
Anchors = [akTop, akRight, akBottom]
|
||||||
Caption = '...'
|
Caption = '...'
|
||||||
OnClick = FilesButtonClick
|
OnClick = FppkgConfigurationFileButtonClick
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
TabOrder = 17
|
TabOrder = 17
|
||||||
|
@ -81,6 +81,7 @@ type
|
|||||||
procedure CompilerTranslationFileButtonClick(Sender:TObject);
|
procedure CompilerTranslationFileButtonClick(Sender:TObject);
|
||||||
procedure FilesButtonClick(Sender: TObject);
|
procedure FilesButtonClick(Sender: TObject);
|
||||||
procedure DirectoriesButtonClick(Sender: TObject);
|
procedure DirectoriesButtonClick(Sender: TObject);
|
||||||
|
procedure FppkgConfigurationFileButtonClick(Sender: TObject);
|
||||||
procedure ShowCompileDialogCheckBoxChange(Sender: TObject);
|
procedure ShowCompileDialogCheckBoxChange(Sender: TObject);
|
||||||
private
|
private
|
||||||
FOldLazarusDir: string;
|
FOldLazarusDir: string;
|
||||||
@ -104,6 +105,7 @@ type
|
|||||||
function CheckTestDir: boolean;
|
function CheckTestDir: boolean;
|
||||||
function CheckMake: boolean;
|
function CheckMake: boolean;
|
||||||
function CheckFPCMsgFile: boolean;
|
function CheckFPCMsgFile: boolean;
|
||||||
|
function CheckFppkgConfigurationFile: boolean;
|
||||||
public
|
public
|
||||||
function Check: Boolean; override;
|
function Check: Boolean; override;
|
||||||
function GetTitle: String; override;
|
function GetTitle: String; override;
|
||||||
@ -135,15 +137,16 @@ begin
|
|||||||
if Sender = CompilerPathButton then begin
|
if Sender = CompilerPathButton then begin
|
||||||
OpenDialog.Title := Format(lisChooseCompilerExecutable,[GetDefaultCompilerFilename]);
|
OpenDialog.Title := Format(lisChooseCompilerExecutable,[GetDefaultCompilerFilename]);
|
||||||
lDirText := CompilerPathComboBox.Text;
|
lDirText := CompilerPathComboBox.Text;
|
||||||
|
lDirName := EnvironmentOptions.GetParsedValue(eopCompilerFilename, lDirText);
|
||||||
end
|
end
|
||||||
else if Sender=MakePathButton then begin
|
else if Sender=MakePathButton then begin
|
||||||
OpenDialog.Title := lisChooseMakeExecutable;
|
OpenDialog.Title := lisChooseMakeExecutable;
|
||||||
lDirText := MakePathComboBox.Text;
|
lDirText := MakePathComboBox.Text;
|
||||||
|
lDirName := EnvironmentOptions.GetParsedValue(eopMakeFilename, lDirText);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
lDirName := EnvironmentOptions.GetParsedValue(eopCompilerFilename, lDirText);
|
|
||||||
lExpandedName := CleanAndExpandFilename(lDirName);
|
lExpandedName := CleanAndExpandFilename(lDirName);
|
||||||
lDirName := GetValidDirectoryAndFilename(lDirName, {out} lDirNameF);
|
lDirName := GetValidDirectoryAndFilename(lDirName, {out} lDirNameF);
|
||||||
OpenDialog.InitialDir := lDirName;
|
OpenDialog.InitialDir := lDirName;
|
||||||
@ -171,6 +174,78 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFilesOptionsFrame.DirectoriesButtonClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
lDirText : string;
|
||||||
|
|
||||||
|
function ParsedDirName(aParseType: TEnvOptParseType): string;
|
||||||
|
begin
|
||||||
|
if lDirText = '' then
|
||||||
|
Result := EnvironmentOptions.GetParsedValue(aParseType, '')
|
||||||
|
else
|
||||||
|
Result := EnvironmentOptions.GetParsedValue(aParseType, lDirText);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
OpenDialog: TSelectDirectoryDialog;
|
||||||
|
lDirName, loDirNameF, lExpandedName: string;
|
||||||
|
begin
|
||||||
|
OpenDialog := TSelectDirectoryDialog.Create(nil);
|
||||||
|
try
|
||||||
|
InputHistories.ApplyFileDialogSettings(OpenDialog);
|
||||||
|
OpenDialog.Options := OpenDialog.Options+[ofExtensionDifferent, ofPathMustExist];
|
||||||
|
// set title
|
||||||
|
if Sender = LazarusDirButton then begin
|
||||||
|
OpenDialog.Title := lisChooseLazarusSourceDirectory;
|
||||||
|
lDirText := LazarusDirComboBox.Text;
|
||||||
|
lDirName := ParsedDirName(eopLazarusDirectory);
|
||||||
|
end
|
||||||
|
else if Sender = FPCSourceDirButton then begin
|
||||||
|
OpenDialog.Title := lisChooseFPCSourceDir;
|
||||||
|
lDirText := FPCSourceDirComboBox.Text;
|
||||||
|
lDirName := ParsedDirName(eopFPCSourceDirectory);
|
||||||
|
end
|
||||||
|
else if Sender=TestBuildDirButton then begin
|
||||||
|
OpenDialog.Title := lisChooseTestBuildDir;
|
||||||
|
lDirText := TestBuildDirComboBox.Text;
|
||||||
|
lDirName := ParsedDirName(eopTestBuildDirectory);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
exit;
|
||||||
|
|
||||||
|
lExpandedName := CleanAndExpandDirectory(lDirName);
|
||||||
|
lDirName := GetValidDirectoryAndFilename(lDirName, loDirNameF);
|
||||||
|
|
||||||
|
OpenDialog.InitialDir := IncludeTrailingBackslash(lDirName);
|
||||||
|
OpenDialog.FileName := loDirNameF;
|
||||||
|
|
||||||
|
if OpenDialog.Execute then begin
|
||||||
|
lDirName := CleanAndExpandDirectory(OpenDialog.Filename);
|
||||||
|
if UpperCase(lDirName)<>UpperCase(lExpandedName) then begin
|
||||||
|
lDirText := lDirName;
|
||||||
|
if Sender = LazarusDirButton then begin
|
||||||
|
// check lazarus directory
|
||||||
|
SetComboBoxText(LazarusDirComboBox,lDirText,cstFilename);
|
||||||
|
CheckLazarusDir([mbOk]);
|
||||||
|
end
|
||||||
|
else if Sender = FPCSourceDirButton then begin
|
||||||
|
// check fpc source directory
|
||||||
|
SetComboBoxText(FPCSourceDirComboBox,lDirText,cstFilename);
|
||||||
|
CheckFPCSourceDir([mbOK]);
|
||||||
|
end
|
||||||
|
else if Sender = TestBuildDirButton then begin
|
||||||
|
// check test directory
|
||||||
|
SetComboBoxText(TestBuildDirComboBox,lDirText,cstFilename);
|
||||||
|
CheckTestDir;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
InputHistories.StoreFileDialogSettings(OpenDialog);
|
||||||
|
finally
|
||||||
|
OpenDialog.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFilesOptionsFrame.CompilerTranslationFileButtonClick(Sender:TObject);
|
procedure TFilesOptionsFrame.CompilerTranslationFileButtonClick(Sender:TObject);
|
||||||
var
|
var
|
||||||
OpenDialog: TOpenDialog;
|
OpenDialog: TOpenDialog;
|
||||||
@ -193,64 +268,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFilesOptionsFrame.DirectoriesButtonClick(Sender: TObject);
|
procedure TFilesOptionsFrame.FppkgConfigurationFileButtonClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
OpenDialog: TSelectDirectoryDialog;
|
OpenDialog: TOpenDialog;
|
||||||
lDirText : string;
|
AFilename: string;
|
||||||
lExpandedName: string;
|
|
||||||
lDirName, loDirNameF: string;
|
|
||||||
begin
|
begin
|
||||||
OpenDialog := TSelectDirectoryDialog.Create(nil);
|
OpenDialog:=IDEOpenDialogClass.Create(nil);
|
||||||
try
|
try
|
||||||
InputHistories.ApplyFileDialogSettings(OpenDialog);
|
InputHistories.ApplyFileDialogSettings(OpenDialog);
|
||||||
OpenDialog.Options := OpenDialog.Options+[ofExtensionDifferent, ofPathMustExist];
|
OpenDialog.Options:=OpenDialog.Options+[ofPathMustExist];
|
||||||
// set title
|
OpenDialog.Title:=lisChooseFppkgConfigurationFile;
|
||||||
if Sender = LazarusDirButton then begin
|
OpenDialog.Filter:=dlgFilterFppkgConfigurationFile+' (*.cfg)|*.cfg|'+
|
||||||
OpenDialog.Title := lisChooseLazarusSourceDirectory;
|
dlgFilterAll+'|'+GetAllFilesMask;
|
||||||
lDirText := LazarusDirComboBox.Text;
|
|
||||||
end
|
|
||||||
else if Sender = FPCSourceDirButton then begin
|
|
||||||
OpenDialog.Title := lisChooseFPCSourceDir;
|
|
||||||
lDirText := FPCSourceDirComboBox.Text;
|
|
||||||
end
|
|
||||||
else if Sender=TestBuildDirButton then begin
|
|
||||||
OpenDialog.Title := lisChooseTestBuildDir;
|
|
||||||
lDirText := TestBuildDirComboBox.Text;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
exit;
|
|
||||||
|
|
||||||
if lDirText = '' then
|
|
||||||
lDirName := EnvironmentOptions.GetParsedValue(eopLazarusDirectory, '')
|
|
||||||
else
|
|
||||||
lDirName := EnvironmentOptions.GetParsedValue(eopLazarusDirectory, lDirText);
|
|
||||||
|
|
||||||
lExpandedName := CleanAndExpandDirectory(lDirName);
|
|
||||||
lDirName := GetValidDirectoryAndFilename(lDirName, loDirNameF);
|
|
||||||
|
|
||||||
OpenDialog.InitialDir := IncludeTrailingBackslash(lDirName);
|
|
||||||
OpenDialog.FileName := loDirNameF;
|
|
||||||
|
|
||||||
if OpenDialog.Execute then begin
|
if OpenDialog.Execute then begin
|
||||||
lDirName := CleanAndExpandDirectory(OpenDialog.Filename);
|
AFilename:=CleanAndExpandFilename(OpenDialog.Filename);
|
||||||
if UpperCase(lDirName)<>UpperCase(lExpandedName) then begin
|
SetComboBoxText(FppkgConfigurationFileComboBox,AFilename,cstFilename);
|
||||||
lDirText := lDirName;
|
|
||||||
if Sender = LazarusDirButton then begin
|
|
||||||
// check lazarus directory
|
|
||||||
SetComboBoxText(LazarusDirComboBox,lDirText,cstFilename);
|
|
||||||
CheckLazarusDir([mbOk]);
|
|
||||||
end
|
|
||||||
else if Sender = FPCSourceDirButton then begin
|
|
||||||
// check fpc source directory
|
|
||||||
SetComboBoxText(FPCSourceDirComboBox,lDirText,cstFilename);
|
|
||||||
CheckFPCSourceDir([mbOK]);
|
|
||||||
end
|
|
||||||
else if Sender = TestBuildDirButton then begin
|
|
||||||
// check test directory
|
|
||||||
SetComboBoxText(TestBuildDirComboBox,lDirText,cstFilename);
|
|
||||||
CheckTestDir;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
InputHistories.StoreFileDialogSettings(OpenDialog);
|
InputHistories.StoreFileDialogSettings(OpenDialog);
|
||||||
finally
|
finally
|
||||||
@ -350,6 +382,8 @@ begin
|
|||||||
if not CheckTestDir then exit;
|
if not CheckTestDir then exit;
|
||||||
// check fpc messages file
|
// check fpc messages file
|
||||||
if not CheckFPCMsgFile then exit;
|
if not CheckFPCMsgFile then exit;
|
||||||
|
// check fppkg configuration file
|
||||||
|
if not CheckFppkgConfigurationFile then exit;
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -593,6 +627,25 @@ begin
|
|||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TFilesOptionsFrame.CheckFppkgConfigurationFile: boolean;
|
||||||
|
var
|
||||||
|
NewFppkgCfgFile: String;
|
||||||
|
begin
|
||||||
|
if EnvironmentOptions.FppkgConfigFile=fOldFppkcConfigurationFilename then exit(true);
|
||||||
|
EnvironmentOptions.FppkgConfigFile:=FppkgConfigurationFileComboBox.Text;
|
||||||
|
if EnvironmentOptions.FppkgConfigFile<>'' then begin
|
||||||
|
NewFppkgCfgFile:=EnvironmentOptions.GetParsedFppkgConfig;
|
||||||
|
if not FileExistsUTF8(NewFppkgCfgFile) then begin
|
||||||
|
if IDEMessageDialog(lisCCOErrorCaption, Format(
|
||||||
|
lisFppkgConfigurationFileNotFound, [#13, NewFppkgCfgFile]), mtError, [mbCancel,
|
||||||
|
mbIgnore])<>mrIgnore
|
||||||
|
then
|
||||||
|
exit(false);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
class function TFilesOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
|
class function TFilesOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
|
||||||
begin
|
begin
|
||||||
Result := TEnvironmentOptions;
|
Result := TEnvironmentOptions;
|
||||||
|
@ -1068,6 +1068,7 @@ resourcestring
|
|||||||
lisChooseDebuggerExecutable = 'Choose debugger executable';
|
lisChooseDebuggerExecutable = 'Choose debugger executable';
|
||||||
lisChooseTestBuildDir = 'Choose the directory for tests';
|
lisChooseTestBuildDir = 'Choose the directory for tests';
|
||||||
lisChooseExecutable = 'Choose an executable';
|
lisChooseExecutable = 'Choose an executable';
|
||||||
|
lisChooseFppkgConfigurationFile = 'Choose the fppkg configuration file';
|
||||||
|
|
||||||
// dialogs
|
// dialogs
|
||||||
lisProjectChanged = 'Project changed';
|
lisProjectChanged = 'Project changed';
|
||||||
@ -1571,6 +1572,7 @@ resourcestring
|
|||||||
dlgFilterPascalFile = 'Pascal file';
|
dlgFilterPascalFile = 'Pascal file';
|
||||||
dlgFilterDciFile = 'DCI file';
|
dlgFilterDciFile = 'DCI file';
|
||||||
dlgFilterFPCMessageFile = 'FPC message file';
|
dlgFilterFPCMessageFile = 'FPC message file';
|
||||||
|
dlgFilterFppkgConfigurationFile = 'Fppkg configuration file';
|
||||||
dlgFilterCodetoolsTemplateFile = 'CodeTools template file';
|
dlgFilterCodetoolsTemplateFile = 'CodeTools template file';
|
||||||
dlgFilterImagesPng = 'PNG images';
|
dlgFilterImagesPng = 'PNG images';
|
||||||
dlgFilterImagesBitmap = 'Bitmap images';
|
dlgFilterImagesBitmap = 'Bitmap images';
|
||||||
@ -2529,6 +2531,7 @@ resourcestring
|
|||||||
lisUnableToReadProcessExitStatus = 'unable to read process ExitStatus';
|
lisUnableToReadProcessExitStatus = 'unable to read process ExitStatus';
|
||||||
lisFreeingBufferLines = 'freeing buffer lines: %s';
|
lisFreeingBufferLines = 'freeing buffer lines: %s';
|
||||||
lisCompilerMessagesFileNotFound = 'Compiler messages file not found:%s%s';
|
lisCompilerMessagesFileNotFound = 'Compiler messages file not found:%s%s';
|
||||||
|
lisFppkgConfigurationFileNotFound = 'Fppkg configuration file not found:%s%s';
|
||||||
lisUnableToOpen = 'Unable to open "%s"';
|
lisUnableToOpen = 'Unable to open "%s"';
|
||||||
lisCompilerDoesNotSupportTarget = 'Compiler "%s" does not support target %s-%s';
|
lisCompilerDoesNotSupportTarget = 'Compiler "%s" does not support target %s-%s';
|
||||||
lisInvalidMode = 'Invalid mode %s';
|
lisInvalidMode = 'Invalid mode %s';
|
||||||
|
Loading…
Reference in New Issue
Block a user