diff --git a/converter/convertdelphi.pas b/converter/convertdelphi.pas index c5209f3f78..cc9107fd9f 100644 --- a/converter/convertdelphi.pas +++ b/converter/convertdelphi.pas @@ -131,6 +131,8 @@ type fCachedUnitNames: TStringToStringTree; // Map of case incorrect unit name -> real unit name. fCachedRealUnitNames: TStringToStringTree; + // The user selected path when searching missing units. + fPrevSelectedPath: string; // Missing units that are commented automatically in all units. fAllMissingUnits: TStringList; fSettings: TConvertSettings; @@ -641,7 +643,6 @@ function TConvertDelphiUnit.AskUnitPathFromUser: TModalResult; var TryAgain: Boolean; UnitDirDialog: TSelectDirectoryDialog; - PrevMiss: LongInt; begin // ask user what to do repeat @@ -660,10 +661,10 @@ begin mrYes: begin UnitDirDialog:=TSelectDirectoryDialog.Create(nil); try - UnitDirDialog.InitialDir:=fSettings.MainPath; + UnitDirDialog.InitialDir:=fOwnerConverter.fPrevSelectedPath; UnitDirDialog.Title:='All sub-directories will be scanned for unit files'; if UnitDirDialog.Execute and Assigned(fOwnerConverter) then begin - PrevMiss:=fMissingUnits.Count; + fOwnerConverter.fPrevSelectedPath:=ExtractFilePath(UnitDirDialog.Filename); // Add the new path to project if missing units are found. fOwnerConverter.CacheUnitsInPath(UnitDirDialog.Filename); TryAgain:=fOwnerConverter.DoMissingUnits(fMissingUnits)>0; @@ -780,6 +781,7 @@ begin fSettings.MainFilename:=fOrigPFilename; fAllMissingUnits:=TStringList.Create; fAllMissingUnits.Sorted:=true; + fPrevSelectedPath:=fSettings.MainPath; // Scan unit files a level above project path. Used later for missing units. CacheUnitsInPath(TrimFilename(fSettings.MainPath+'../')); end; diff --git a/converter/convertsettings.lfm b/converter/convertsettings.lfm index 9f75a0d424..83524455dc 100644 --- a/converter/convertsettings.lfm +++ b/converter/convertsettings.lfm @@ -3,7 +3,7 @@ object ConvertSettingsForm: TConvertSettingsForm Height = 400 Top = 292 Width = 611 - ActiveControl = MainPathEdit + ActiveControl = ProjectPathEdit Caption = 'Convert Delphi unit, project or package ' ClientHeight = 400 ClientWidth = 611 @@ -176,24 +176,24 @@ object ConvertSettingsForm: TConvertSettingsForm TabOrder = 2 end end - object MainPathEdit: TLabeledEdit - Left = 80 + object ProjectPathEdit: TLabeledEdit + Left = 96 Height = 21 Top = 15 Width = 503 Anchors = [akTop, akLeft, akRight] BorderStyle = bsNone Color = clBtnFace - EditLabel.AnchorSideLeft.Control = MainPathEdit - EditLabel.AnchorSideTop.Control = MainPathEdit + EditLabel.AnchorSideLeft.Control = ProjectPathEdit + EditLabel.AnchorSideTop.Control = ProjectPathEdit EditLabel.AnchorSideTop.Side = asrCenter - EditLabel.AnchorSideRight.Control = MainPathEdit - EditLabel.AnchorSideBottom.Control = MainPathEdit - EditLabel.Left = 15 + EditLabel.AnchorSideRight.Control = ProjectPathEdit + EditLabel.AnchorSideBottom.Control = ProjectPathEdit + EditLabel.Left = 19 EditLabel.Height = 16 EditLabel.Top = 17 - EditLabel.Width = 58 - EditLabel.Caption = 'Main Path:' + EditLabel.Width = 70 + EditLabel.Caption = 'Project Path:' EditLabel.ParentColor = False LabelPosition = lpLeft LabelSpacing = 7 @@ -201,7 +201,7 @@ object ConvertSettingsForm: TConvertSettingsForm TabOrder = 3 end object BackupCheckBox: TCheckBox - AnchorSideTop.Control = MainPathEdit + AnchorSideTop.Control = ProjectPathEdit AnchorSideTop.Side = asrBottom Left = 16 Height = 21 diff --git a/converter/convertsettings.pas b/converter/convertsettings.pas index abcd28503c..5d63fcdc0c 100644 --- a/converter/convertsettings.pas +++ b/converter/convertsettings.pas @@ -96,7 +96,7 @@ type TConvertSettingsForm = class(TForm) BackupCheckBox: TCheckBox; SameDFMCheckBox: TCheckBox; - MainPathEdit: TLabeledEdit; + ProjectPathEdit: TLabeledEdit; TargetRadioGroup: TRadioGroup; ReplacementsButton: TBitBtn; btnCancel: TBitBtn; @@ -164,7 +164,7 @@ begin with SettingsForm do try Caption:=fTitle; - MainPathEdit.Text:=fMainPath; + ProjectPathEdit.Text:=fMainPath; { // ToDo: Load from XML. // Settings --> UI. @@ -293,9 +293,10 @@ procedure TConvertSettingsForm.FormCreate(Sender: TObject); const // Move later to resourcestrings lisUseSameDFMFile = 'Use the same DFM file for Lazarus (ToDo...)'; begin - MainPathEdit.Text:=''; - btnOK.Caption:=lisStartConversion; + ProjectPathEdit.Text:=''; + ProjectPathEdit.EditLabel.Caption:=lisProjectPath; BackupCheckBox.Caption:=lisBackupChangedFiles; + btnOK.Caption:=lisStartConversion; TargetRadioGroup.Items.Clear; TargetRadioGroup.Items.Append(lisConvertTarget1); TargetRadioGroup.Items.Append(lisConvertTarget2); diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index dfceb69567..11e4eefd9d 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -453,8 +453,9 @@ resourcestring lisNotADelphiProject = 'Not a Delphi project'; lisTheFileIsNotADelphiProjectDpr = 'The file %s%s%s is not a Delphi ' +'project (.dpr)'; - lisStartConversion = 'Start Conversion'; + lisProjectPath = 'Project Path:'; lisBackupChangedFiles = 'Make backup of changed files'; + lisStartConversion = 'Start Conversion'; lisConvertTarget1 = 'Lazarus/LCL'; lisConvertTarget2 = 'Lazarus/LCL for Windows only'; lisConvertTarget3 = 'Both Lazarus/LCL and Delphi';