mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-07 06:57:23 +01:00
IDE: Improve TargetDirectory handling in BuildLazarusDlg. Issue #41888, patch by Bruno K.
This commit is contained in:
parent
773de86e80
commit
20c0c91178
@ -303,6 +303,7 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
|
||||
BorderSpacing.Right = 6
|
||||
ItemHeight = 15
|
||||
TabOrder = 6
|
||||
OnExit = MRUComboBoxExit
|
||||
end
|
||||
object TargetOSLabel: TLabel
|
||||
AnchorSideLeft.Control = LCLWidgetTypeComboBox
|
||||
|
||||
@ -135,6 +135,7 @@ type
|
||||
procedure ShowOptsMenuItemClick(Sender: TObject);
|
||||
procedure SaveSettingsButtonClick(Sender: TObject);
|
||||
procedure TargetDirectoryButtonClick(Sender: TObject);
|
||||
procedure MRUComboBoxExit(Sender: TObject);
|
||||
private
|
||||
fBuilder: TLazarusBuilder;
|
||||
// Data is copied by caller before and after opening this dialog.
|
||||
@ -1353,24 +1354,36 @@ begin
|
||||
GetExecutableExt(fProfiles.Current.FPCTargetOS)+')';
|
||||
|
||||
{ Setup directory path }
|
||||
lDirName:=EnvironmentOptions.GetParsedValue(eopLazarusDirectory, TargetDirectoryComboBox.Text);
|
||||
lExpandedName:=CleanAndExpandDirectory(lDirName);
|
||||
lDirName:=EnvironmentOptions.GetParsedValue(eopTestBuildDirectory, TargetDirectoryComboBox.Text);
|
||||
lExpandedName:=ChompPathDelim(CleanAndExpandDirectory(lDirName));
|
||||
lDirName:=GetValidDirectoryAndFilename(lExpandedName, lDirNameF);
|
||||
|
||||
DirDialog.InitialDir:=ChompPathDelim(lExpandedName);
|
||||
DirDialog.InitialDir:=lDirName;
|
||||
DirDialog.FileName:=lDirNameF;
|
||||
|
||||
if DirDialog.Execute then begin
|
||||
lDirName:=CleanAndExpandDirectory(DirDialog.Filename);
|
||||
{ ~bk Here I wanted to keeep Macros but it doesn't seem to work
|
||||
if UpperCase(lDirName)<>UpperCase(lExpandedName) then }
|
||||
TargetDirectoryComboBox.AddHistoryItem(lDirName,10,true,true);
|
||||
lDirName:=ChompPathDelim(CleanAndExpandDirectory(DirDialog.Filename));
|
||||
if CompareFilenames(lDirName, lExpandedName)<>0 then
|
||||
SetComboBoxText(TargetDirectoryComboBox,lDirName,cstFilename,MaxComboBoxCount);
|
||||
end;
|
||||
finally
|
||||
DirDialog.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TConfigureBuildLazarusDlg.MRUComboBoxExit(Sender: TObject);
|
||||
var
|
||||
cb: TComboBox;
|
||||
begin
|
||||
cb := Sender as TComboBox;
|
||||
if cb.ItemIndex < 0 then
|
||||
SetComboBoxText(cb, cb.Text, cstFilename)
|
||||
else begin
|
||||
cb.Items.Move(cb.ItemIndex, 0);
|
||||
cb.ItemIndex := 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TConfigureBuildLazarusDlg.CopyProfileToUI(AProfile: TBuildLazarusProfile);
|
||||
var
|
||||
i: Integer;
|
||||
@ -1381,7 +1394,11 @@ begin
|
||||
LCLWidgetTypeComboBox.ItemIndex :=ord(AProfile.TargetPlatform);
|
||||
UpdateRevisionIncCheckBox.Checked :=AProfile.UpdateRevisionInc;
|
||||
TargetOSComboBox.Text :=AProfile.TargetOS;
|
||||
TargetDirectoryComboBox.Text :=AProfile.TargetDirectory;
|
||||
with AProfile do begin
|
||||
if TargetDirHistory.Count > 0 then
|
||||
TargetDirectoryComboBox.Items.Assign(TargetDirHistory);
|
||||
SetComboBoxText(TargetDirectoryComboBox,TargetDirectory,cstFilename,MaxComboBoxCount);
|
||||
end;
|
||||
TargetCPUComboBox.Text :=AProfile.TargetCPU;
|
||||
case AProfile.IdeBuildMode of
|
||||
bmBuild: CleanAutoRadioButton.Checked:=true;
|
||||
@ -1405,6 +1422,7 @@ begin
|
||||
AProfile.UpdateRevisionInc :=UpdateRevisionIncCheckBox.Checked;
|
||||
AProfile.TargetOS :=TargetOSComboBox.Text;
|
||||
AProfile.TargetDirectory :=TargetDirectoryComboBox.Text;
|
||||
AProfile.TargetDirHistory.Assign(TargetDirectoryComboBox.Items);
|
||||
AProfile.TargetCPU :=TargetCPUComboBox.Text;
|
||||
if CleanAllRadioButton.Checked then
|
||||
AProfile.IdeBuildMode := bmCleanAllBuild
|
||||
|
||||
@ -42,7 +42,7 @@ uses
|
||||
// IdeIntf
|
||||
IdeIntfStrConsts, IDEImagesIntf, IDEDialogs,
|
||||
// IdeConfig
|
||||
EnvironmentOpts, TransferMacros, IdeXmlConfigProcs,
|
||||
EnvironmentOpts, TransferMacros, IdeXmlConfigProcs, RecentListProcs,
|
||||
// IDE
|
||||
LazarusIDEStrConsts;
|
||||
|
||||
@ -72,7 +72,7 @@ type
|
||||
fUpdateRevisionInc: boolean;
|
||||
fOptions: TStringList; // User defined options.
|
||||
fDefines: TStringList; // Defines selected for this profile.
|
||||
|
||||
fTargetDirHistory: TStringList; // History
|
||||
function GetExtraOptions: string;
|
||||
procedure SetExtraOptions(const AValue: string);
|
||||
public
|
||||
@ -89,6 +89,7 @@ type
|
||||
property ExtraOptions: string read GetExtraOptions write SetExtraOptions;
|
||||
property TargetOS: string read fTargetOS write fTargetOS;
|
||||
property TargetDirectory: string read fTargetDirectory write fTargetDirectory;
|
||||
property TargetDirHistory: TStringList read fTargetDirHistory;
|
||||
property TargetCPU: string read fTargetCPU write fTargetCPU;
|
||||
property Subtarget: string read FSubtarget write FSubtarget;
|
||||
property TargetPlatform: TLCLPlatform read fTargetPlatform write fTargetPlatform;
|
||||
@ -205,12 +206,14 @@ begin
|
||||
fName:=AName;
|
||||
fOptions:=TStringList.Create;
|
||||
fDefines:=TStringList.Create;
|
||||
fTargetDirHistory:=TStringList.Create;
|
||||
end;
|
||||
|
||||
destructor TBuildLazarusProfile.Destroy;
|
||||
begin
|
||||
fDefines.Free;
|
||||
fOptions.Free;
|
||||
fTargetDirHistory.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -228,6 +231,8 @@ begin
|
||||
fTargetPlatform :=DirNameToLCLPlatform(LCLPlatformStr);
|
||||
FTargetDirectory:=AppendPathDelim(SetDirSeparators(
|
||||
XMLConfig.GetValue(Path+'TargetDirectory/Value', DefaultTargetDirectory)));
|
||||
LoadRecentList(XMLConfig,fTargetDirHistory,Path+'TargetDirectory/History/',rltFile);
|
||||
|
||||
IdeBuildMode:=StrToIdeBuildMode(XMLConfig.GetValue(Path+'IdeBuildMode/Value',''));
|
||||
CleanOnce:=XMLConfig.GetValue(Path+'CleanOnce/Value',false);
|
||||
FUpdateRevisionInc :=XMLConfig.GetValue(Path+'UpdateRevisionInc/Value',true);
|
||||
@ -247,6 +252,8 @@ begin
|
||||
'');
|
||||
XMLConfig.SetDeleteValue(Path+'TargetDirectory/Value',
|
||||
FTargetDirectory,DefaultTargetDirectory);
|
||||
SaveRecentList(XMLConfig,fTargetDirHistory,Path+'TargetDirectory/History/');
|
||||
|
||||
XMLConfig.SetDeleteValue(Path+'IdeBuildMode/Value',IdeBuildModeToStr(IdeBuildMode),'');
|
||||
XMLConfig.SetDeleteValue(Path+'CleanOnce/Value',CleanOnce,false);
|
||||
XMLConfig.SetDeleteValue(Path+'UpdateRevisionInc/Value',FUpdateRevisionInc,true);
|
||||
@ -261,6 +268,7 @@ begin
|
||||
fName :=Source.Name;
|
||||
TargetOS :=Source.TargetOS;
|
||||
TargetDirectory :=Source.TargetDirectory;
|
||||
fTargetDirHistory.Assign(Source.fTargetDirHistory);
|
||||
TargetCPU :=Source.TargetCPU;
|
||||
Subtarget :=Source.Subtarget;
|
||||
TargetPlatform :=Source.TargetPlatform;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user