From 4c8d3d791b49fd8ca73550c75ccb45c7a4d18422 Mon Sep 17 00:00:00 2001 From: juha Date: Fri, 10 Sep 2010 15:04:48 +0000 Subject: [PATCH] Converter: improved GUI and added options for settings. Cleanup. git-svn-id: trunk@27291 - --- converter/convcodetool.pas | 33 ++++--- converter/convertdelphi.pas | 3 +- converter/convertsettings.lfm | 136 +++++++++++++++++++---------- converter/convertsettings.pas | 114 ++++++++++++++++-------- converter/missingpropertiesdlg.pas | 2 +- ide/lazarusidestrconsts.pas | 10 +-- 6 files changed, 188 insertions(+), 110 deletions(-) diff --git a/converter/convcodetool.pas b/converter/convcodetool.pas index 34504a3f19..bc94a495a1 100755 --- a/converter/convcodetool.pas +++ b/converter/convcodetool.pas @@ -35,7 +35,6 @@ type fLowerCaseRes: boolean; fDfmDirectiveStart: integer; fDfmDirectiveEnd: integer; - fTarget: TConvertTarget; // List of units to remove. fUnitsToRemove: TStringList; // Units to rename. Map of unit name -> real unit name. @@ -44,8 +43,10 @@ type fUnitsToComment: TStringList; // Delphi Function names to replace with FCL/LCL functions. fDefinedProcNames: TStringList; - fReplaceFuncs: TFuncsAndCategories; - fFuncsToReplace: TObjectList; // List of TFuncReplacement. + // List of TFuncReplacement. + fFuncsToReplace: TObjectList; + fSettings: TConvertSettings; // Conversion settings. + function AddDelphiAndLCLSections: boolean; function AddModeDelphiDirective: boolean; function RenameResourceDirectives: boolean; @@ -70,11 +71,10 @@ type property Ask: Boolean read fAsk write fAsk; property HasFormFile: boolean read fHasFormFile write fHasFormFile; property LowerCaseRes: boolean read fLowerCaseRes write fLowerCaseRes; - property Target: TConvertTarget read fTarget write fTarget; property UnitsToRemove: TStringList read fUnitsToRemove write fUnitsToRemove; property UnitsToRename: TStringToStringTree read fUnitsToRename write fUnitsToRename; property UnitsToComment: TStringList read fUnitsToComment write fUnitsToComment; - property ReplaceFuncs: TFuncsAndCategories read fReplaceFuncs write fReplaceFuncs; + property Settings: TConvertSettings read fSettings write fSettings; end; @@ -88,7 +88,6 @@ begin // Default values for vars. fAsk:=true; fLowerCaseRes:=false; - fTarget:=ctLazarus; fUnitsToRemove:=nil; // These are set from outside. fUnitsToComment:=nil; fUnitsToRename:=nil; @@ -141,17 +140,18 @@ begin // these changes can be applied together without rescan if not AddModeDelphiDirective then exit; if not RenameResourceDirectives then exit; - if not ReplaceFuncCalls(aIsConsoleApp) then exit; + if fSettings.EnableReplaceFuncs then + if not ReplaceFuncCalls(aIsConsoleApp) then exit; if not fSrcCache.Apply then exit; finally fSrcCache.EndUpdate; end; - if fTarget=ctLazarus then begin + if fSettings.Target=ctLazarus then begin // One way conversion -> remove, rename and comment out units. if not RemoveUnits then exit; if not RenameUnits then exit; end; - if fTarget=ctLazarusAndDelphi then begin + if fSettings.Target=ctLazarusAndDelphi then begin // Support Delphi. Add IFDEF blocks for units. if not AddDelphiAndLCLSections then exit; end @@ -278,7 +278,7 @@ begin ReadNextAtom; // semicolon InsertPos:=CurPos.EndPos; nl:=fSrcCache.BeautifyCodeOptions.LineEnd; - if fTarget=ctLazarusAndDelphi then + if fSettings.Target=ctLazarusAndDelphi then s:='{$IFDEF FPC}'+nl+' {$MODE Delphi}'+nl+'{$ENDIF}' else s:='{$MODE Delphi}'; @@ -323,7 +323,7 @@ begin if (LowKey='dfm') or (LowKey='xfm') then begin // Lowercase existing key. (Future, when the same dfm file can be used) // faUseDfm: if Key<>LowKey then NewKey:=LowKey; - if fTarget=ctLazarusAndDelphi then begin + if fSettings.Target=ctLazarusAndDelphi then begin // Later IFDEF will be added so that Delphi can still use .dfm. fDfmDirectiveStart:=ACleanPos; fDfmDirectiveEnd:=ParamPos+6; @@ -348,7 +348,7 @@ begin ACleanPos:=FindCommentEnd(Src, ACleanPos, Scanner.NestedComments); until false; // if there is already .lfm file, don't add IFDEF for .dfm / .lfm. - if (fTarget=ctLazarusAndDelphi) and (fDfmDirectiveStart<>-1) and not AlreadyIsLfm then + if (fSettings.Target=ctLazarusAndDelphi) and (fDfmDirectiveStart<>-1) and not AlreadyIsLfm then begin // Add IFDEF for .lfm and .dfm allowing Delphi to use .dfm. nl:=fSrcCache.BeautifyCodeOptions.LineEnd; @@ -705,14 +705,14 @@ var with fCodeTool do begin while (IdentEndPos<=MaxPos) and (IsIdentChar[Src[IdentEndPos]]) do inc(IdentEndPos); - for i:=0 to fReplaceFuncs.Funcs.Count-1 do begin - FuncName:=fReplaceFuncs.Funcs[i]; + for i:=0 to fSettings.ReplaceFuncs.Funcs.Count-1 do begin + FuncName:=fSettings.ReplaceFuncs.Funcs[i]; if (IdentEndPos-xStart=length(FuncName)) and (CompareIdentifiers(PChar(Pointer(FuncName)),@Src[xStart])=0) and not fDefinedProcNames.Find(FuncName, x) then begin - FuncDefInfo:=fReplaceFuncs.FuncAtInd(i); - if fReplaceFuncs.Categories.Find(FuncDefInfo.Category, x) + FuncDefInfo:=fSettings.ReplaceFuncs.FuncAtInd(i); + if fSettings.ReplaceFuncs.Categories.Find(FuncDefInfo.Category, x) and not (aIsConsoleApp and (FuncDefInfo.Category='UTF8Names')) then begin // Create a new replacement object for params, position and other info. @@ -1113,7 +1113,6 @@ var const GrandParentContext, ClassContext: TFindContext): boolean; var CurLFMNode: TLFMTreeNode; - i: Integer; begin CurLFMNode:=LFMObject.FirstChild; while CurLFMNode<>nil do begin diff --git a/converter/convertdelphi.pas b/converter/convertdelphi.pas index ac18f2db63..0e942a3520 100644 --- a/converter/convertdelphi.pas +++ b/converter/convertdelphi.pas @@ -553,8 +553,7 @@ begin ConvTool.Ask:=Assigned(fOwnerConverter); ConvTool.LowerCaseRes:=FileExistsUTF8(ChangeFileExt(fLazUnitFilename, '.res')); ConvTool.HasFormFile:=DfmFilename<>''; - ConvTool.Target:=fSettings.Target; - ConvTool.ReplaceFuncs:=fSettings.ReplaceFuncs; + ConvTool.Settings:=fSettings; ConvTool.UnitsToRemove:=fUnitsToRemove; ConvTool.UnitsToRename:=fUnitsToRename; ConvTool.UnitsToComment:=fUnitsToComment; diff --git a/converter/convertsettings.lfm b/converter/convertsettings.lfm index 0a0aaefa77..1688d7739a 100644 --- a/converter/convertsettings.lfm +++ b/converter/convertsettings.lfm @@ -1,10 +1,10 @@ object ConvertSettingsForm: TConvertSettingsForm Left = 346 - Height = 462 + Height = 483 Top = 298 Width = 637 Caption = 'Convert Delphi unit, project or package ' - ClientHeight = 462 + ClientHeight = 483 ClientWidth = 637 Constraints.MinHeight = 400 OnCreate = FormCreate @@ -16,85 +16,126 @@ object ConvertSettingsForm: TConvertSettingsForm AnchorSideTop.Side = asrBottom AnchorSideBottom.Control = ButtonPanel Left = 0 - Height = 192 + Height = 213 Top = 219 Width = 637 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Top = 3 - Caption = 'Units, Types and Properties' - ClientHeight = 173 + Caption = 'Replacements' + ClientHeight = 194 ClientWidth = 633 TabOrder = 0 - object AutoRemovePropCheckBox: TCheckBox - Left = 303 - Height = 21 - Hint = 'If unchecked, there will be interactive dialogs for editing / accepting changes.' - Top = 40 - Width = 282 - Caption = 'Automatic removal of unknown properties' + object UnitReplaceButton: TBitBtn + Left = 11 + Height = 30 + Hint = 'Unit names in uses section of a source unit' + Top = 36 + Width = 272 + Caption = 'Unit Replacements' + OnClick = UnitReplaceButtonClick ParentShowHint = False ShowHint = True TabOrder = 0 end - object UnitReplacementsButton: TBitBtn + object TypeReplaceButton: TBitBtn Left = 11 Height = 30 - Hint = 'Unit names in uses section of a source unit' - Top = 12 + Hint = 'Unknown types in form file (DFM/LFM)' + Top = 76 Width = 272 - Caption = 'Unit Replacements' - OnClick = UnitReplacementsButtonClick + Caption = 'Type Replacements' + OnClick = TypeReplaceButtonClick ParentShowHint = False ShowHint = True TabOrder = 1 end - object TypeReplacementsButton: TBitBtn - Left = 11 - Height = 30 - Hint = 'Unknown types in form file (DFM/LFM)' - Top = 52 - Width = 272 - Caption = 'Type Replacements' - OnClick = TypeReplacementsButtonClick + object UnitReplaceAutoCheckBox: TCheckBox + Left = 303 + Height = 21 + Hint = 'If unchecked, there will be interactive dialogs for editing / accepting changes.' + Top = 41 + Width = 161 + Caption = 'Replace automatically' ParentShowHint = False ShowHint = True TabOrder = 2 end - object AutoReplaceUnitsCheckBox: TCheckBox - Left = 303 - Height = 21 - Hint = 'If unchecked, there will be interactive dialogs for editing / accepting changes.' - Top = 12 - Width = 255 - Caption = 'Automatic replacement of unit names' + object FuncReplaceButton: TBitBtn + Left = 11 + Height = 30 + Hint = 'Some Delphi functions can be replaced with a LCL function' + Top = 116 + Width = 272 + Caption = 'Function Replacements' + OnClick = FuncReplaceButtonClick ParentShowHint = False ShowHint = True TabOrder = 3 end - object FuncReplacementsButton: TBitBtn + object VisualOffsButton: TBitBtn Left = 11 Height = 30 Hint = 'Some Delphi functions can be replaced with a LCL function' - Top = 132 + Top = 156 Width = 272 - Caption = 'Function Replacements' - OnClick = FuncReplacementsButtonClick + Caption = 'Top Coordinate Offsets' + OnClick = VisualOffsButtonClick ParentShowHint = False ShowHint = True TabOrder = 4 end - object VisualOffsetsButton: TBitBtn - Left = 11 - Height = 30 - Hint = 'Some Delphi functions can be replaced with a LCL function' - Top = 92 - Width = 272 - Caption = 'Top Coordinate Offsets' - OnClick = VisualOffsetsButtonClick + object PropRemoveAutoCheckBox: TCheckBox + Left = 303 + Height = 21 + Hint = 'If unchecked, there will be interactive dialogs for editing / accepting changes.' + Top = 4 + Width = 161 + Caption = 'Remove automatically' ParentShowHint = False ShowHint = True TabOrder = 5 end + object Label1: TLabel + AnchorSideRight.Control = UnitReplaceButton + AnchorSideRight.Side = asrBottom + Left = 135 + Height = 16 + Top = 6 + Width = 148 + Anchors = [akTop, akRight] + Caption = 'Unknown properties' + Font.Color = clBtnShadow + Font.Style = [fsBold] + ParentColor = False + ParentFont = False + end + object TypeReplInfoLabel: TLabel + Left = 303 + Height = 16 + Top = 84 + Width = 67 + Caption = 'Interactive' + ParentColor = False + end + object VisualOffsEnableCheckBox: TCheckBox + Left = 303 + Height = 21 + Top = 161 + Width = 65 + Caption = 'Enable' + TabOrder = 6 + end + object FuncReplaceEnableCheckBox: TCheckBox + Left = 303 + Height = 21 + Hint = 'If unchecked, there will be interactive dialogs for editing / accepting changes.' + Top = 121 + Width = 65 + Caption = 'Enable' + ParentShowHint = False + ShowHint = True + TabOrder = 7 + end end object SettingsGroupBox: TGroupBox Left = 0 @@ -109,7 +150,7 @@ object ConvertSettingsForm: TConvertSettingsForm Left = 11 Height = 112 Hint = 'Converter adds conditional compilation to support different targets' - Top = 3 + Top = -1 Width = 272 AutoFill = True Caption = 'Target' @@ -140,11 +181,12 @@ object ConvertSettingsForm: TConvertSettingsForm Left = 303 Height = 21 Hint = 'Separate form files allow different properties' - Top = 62 + Top = 7 Width = 312 BorderSpacing.Left = 13 BorderSpacing.Around = 7 Caption = 'Lazarus uses the same DFM form file as Delphi' + OnChange = SameDFMCheckBoxChange ParentShowHint = False ShowHint = True TabOrder = 1 @@ -197,7 +239,7 @@ object ConvertSettingsForm: TConvertSettingsForm object ButtonPanel: TButtonPanel Left = 6 Height = 39 - Top = 417 + Top = 438 Width = 625 OKButton.Name = 'OKButton' OKButton.Caption = '&OK' diff --git a/converter/convertsettings.pas b/converter/convertsettings.pas index a7f8859af8..84054f056e 100755 --- a/converter/convertsettings.pas +++ b/converter/convertsettings.pas @@ -53,8 +53,10 @@ type fBackupFiles: boolean; fTarget: TConvertTarget; fSameDFMFile: boolean; - fAutoReplaceUnits: boolean; fAutoRemoveProperties: boolean; + fAutoReplaceUnits: boolean; + fEnableReplaceFuncs: boolean; + fEnableVisualOffs: boolean; // Delphi units mapped to Lazarus units, will be replaced or removed. fReplaceUnits: TStringToStringTree; // Delphi types mapped to Lazarus types, will be replaced. @@ -94,8 +96,10 @@ type property BackupFiles: boolean read fBackupFiles; property Target: TConvertTarget read fTarget; property SameDFMFile: boolean read fSameDFMFile; - property AutoReplaceUnits: boolean read fAutoReplaceUnits; property AutoRemoveProperties: boolean read fAutoRemoveProperties; + property AutoReplaceUnits: boolean read fAutoReplaceUnits; + property EnableReplaceFuncs: boolean read fEnableReplaceFuncs; + property EnableVisualOffs: boolean read fEnableVisualOffs; property ReplaceUnits: TStringToStringTree read fReplaceUnits; property ReplaceTypes: TStringToStringTree read fReplaceTypes; property VisualOffsets: TStringToStringTree read fVisualOffsets; @@ -106,23 +110,28 @@ type { TConvertSettingsForm } TConvertSettingsForm = class(TForm) - AutoReplaceUnitsCheckBox: TCheckBox; + PropRemoveAutoCheckBox: TCheckBox; + UnitReplaceAutoCheckBox: TCheckBox; BackupCheckBox: TCheckBox; ButtonPanel: TButtonPanel; - VisualOffsetsButton: TBitBtn; - TypeReplacementsButton: TBitBtn; + FuncReplaceEnableCheckBox: TCheckBox; + VisualOffsEnableCheckBox: TCheckBox; + Label1: TLabel; + TypeReplInfoLabel: TLabel; + VisualOffsButton: TBitBtn; + TypeReplaceButton: TBitBtn; SameDFMCheckBox: TCheckBox; ProjectPathEdit: TLabeledEdit; TargetRadioGroup: TRadioGroup; - FuncReplacementsButton: TBitBtn; - UnitReplacementsButton: TBitBtn; + FuncReplaceButton: TBitBtn; + UnitReplaceButton: TBitBtn; SettingsGroupBox: TGroupBox; MissingStuffGroupBox: TGroupBox; - AutoRemovePropCheckBox: TCheckBox; - procedure FuncReplacementsButtonClick(Sender: TObject); - procedure TypeReplacementsButtonClick(Sender: TObject); - procedure VisualOffsetsButtonClick(Sender: TObject); - procedure UnitReplacementsButtonClick(Sender: TObject); + procedure FuncReplaceButtonClick(Sender: TObject); + procedure SameDFMCheckBoxChange(Sender: TObject); + procedure TypeReplaceButtonClick(Sender: TObject); + procedure VisualOffsButtonClick(Sender: TObject); + procedure UnitReplaceButtonClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure TargetRadioGroupClick(Sender: TObject); @@ -297,6 +306,8 @@ begin fSameDFMFile :=fConfigStorage.GetValue('SameDFMFile', false); fAutoReplaceUnits :=fConfigStorage.GetValue('AutoReplaceUnits', true); fAutoRemoveProperties :=fConfigStorage.GetValue('AutoRemoveProperties', true); + fEnableReplaceFuncs :=fConfigStorage.GetValue('EnableReplaceFuncs', true); + fEnableVisualOffs :=fConfigStorage.GetValue('EnableVisualOffs', true); LoadStringToStringTree(fConfigStorage, 'UnitReplacements/', fReplaceUnits); LoadStringToStringTree(fConfigStorage, 'TypeReplacements/', fReplaceTypes); LoadStringToStringTree(fConfigStorage, 'VisualTopOffsets/', fVisualOffsets); @@ -395,8 +406,10 @@ begin fConfigStorage.SetDeleteValue('BackupFiles', fBackupFiles, true); fConfigStorage.SetDeleteValue('ConvertTarget', integer(fTarget), 0); fConfigStorage.SetDeleteValue('SameDFMFile', fSameDFMFile, false); - fConfigStorage.SetDeleteValue('AutoReplaceUnits', fAutoReplaceUnits, false); - fConfigStorage.SetDeleteValue('AutoRemoveProperties', fAutoRemoveProperties, false); + fConfigStorage.SetDeleteValue('AutoReplaceUnits', fAutoReplaceUnits, true); + fConfigStorage.SetDeleteValue('AutoRemoveProperties', fAutoRemoveProperties, true); + fConfigStorage.SetDeleteValue('EnableReplaceFuncs', fEnableReplaceFuncs, true); + fConfigStorage.SetDeleteValue('EnableVisualOffs', fEnableVisualOffs, true); SaveStringToStringTree(fConfigStorage, 'UnitReplacements/', fReplaceUnits); SaveStringToStringTree(fConfigStorage, 'TypeReplacements/', fReplaceTypes); SaveStringToStringTree(fConfigStorage, 'VisualTopOffsets/', fVisualOffsets); @@ -424,16 +437,20 @@ begin BackupCheckBox.Checked :=fBackupFiles; TargetRadioGroup.ItemIndex :=integer(fTarget); SameDFMCheckBox.Checked :=fSameDFMFile; - AutoReplaceUnitsCheckBox.Checked :=fAutoReplaceUnits; - AutoRemovePropCheckBox.Checked :=fAutoRemoveProperties; + PropRemoveAutoCheckBox.Checked :=fAutoRemoveProperties; + UnitReplaceAutoCheckBox.Checked :=fAutoReplaceUnits; + FuncReplaceEnableCheckBox.Checked:=fEnableReplaceFuncs; + VisualOffsEnableCheckBox.Checked :=fEnableVisualOffs; Result:=ShowModal; // Let the user change settings in a form. if Result=mrOK then begin // UI --> Settings. Will be saved to ConfigSettings later. fBackupFiles :=BackupCheckBox.Checked; fTarget :=TConvertTarget(TargetRadioGroup.ItemIndex); fSameDFMFile :=SameDFMCheckBox.Checked; - fAutoReplaceUnits :=AutoReplaceUnitsCheckBox.Checked; - fAutoRemoveProperties:=AutoRemovePropCheckBox.Checked; + fAutoRemoveProperties:=PropRemoveAutoCheckBox.Checked; + fAutoReplaceUnits :=UnitReplaceAutoCheckBox.Checked; + fEnableReplaceFuncs :=FuncReplaceEnableCheckBox.Checked; + fEnableVisualOffs :=VisualOffsEnableCheckBox.Checked; end; finally Free; @@ -545,32 +562,44 @@ begin ProjectPathEdit.Text:=''; ProjectPathEdit.EditLabel.Caption:=lisProjectPath; ProjectPathEdit.Hint:=lisProjectPathHint; + BackupCheckBox.Caption:=lisBackupChangedFiles; BackupCheckBox.Hint:=lisBackupHint; + ButtonPanel.OKButton.Caption:=lisStartConversion; ButtonPanel.HelpButton.Caption:=lisMenuHelp; ButtonPanel.CancelButton.Caption:=dlgCancel; + + SameDFMCheckBox.Caption:=lisConvUseSameDFM; + SameDFMCheckBox.Hint:=lisConvUseSameDFMHint; + + MissingStuffGroupBox.Caption:= lisReplacements; //lisConvUnitsTypesProp; + PropRemoveAutoCheckBox.Caption:=lisConvAutoRemove; + PropRemoveAutoCheckBox.Hint:=lisConvAutoHint; + + UnitReplaceButton.Caption:=lisConvUnitReplacements; + UnitReplaceButton.Hint:=lisConvUnitReplHint; + UnitReplaceAutoCheckBox.Caption:=lisConvAutoReplace; // lisMenuReplace + UnitReplaceAutoCheckBox.Hint:=lisConvAutoHint; + + TypeReplaceButton.Caption:=lisConvTypeReplacements; + TypeReplaceButton.Hint:=lisConvTypeReplHint; + TypeReplInfoLabel.Caption:=lisInteractive; + + FuncReplaceButton.Caption:=lisConvFuncReplacements; + FuncReplaceButton.Hint:=lisConvFuncReplHint; + FuncReplaceEnableCheckBox.Caption:=lisEnable; + + VisualOffsButton.Caption:=lisConvTopCoordOffs; + VisualOffsButton.Hint:=lisConvTopCoordHint; + VisualOffsEnableCheckBox.Caption:=lisEnable; + TargetRadioGroup.Items.Clear; TargetRadioGroup.Items.Append(lisConvertTarget1); TargetRadioGroup.Items.Append(lisConvertTarget2); TargetRadioGroup.Items.Append(lisConvertTarget3); TargetRadioGroup.ItemIndex:=0; TargetRadioGroup.Hint:=lisConvertTargetHint; - SameDFMCheckBox.Caption:=lisConvUseSameDFM; - SameDFMCheckBox.Hint:=lisConvUseSameDFMHint; - MissingStuffGroupBox.Caption:= lisConvUnitsTypesProp; - AutoRemovePropCheckBox.Caption:=lisConvAutoRemoveProp; - AutoRemovePropCheckBox.Hint:=lisConvAutoRemovePropHint; - AutoReplaceUnitsCheckBox.Caption:=lisConvAutoReplaceUnits; - AutoReplaceUnitsCheckBox.Hint:=lisConvAutoReplaceUnitHint; - UnitReplacementsButton.Caption:=lisConvUnitReplacements; - UnitReplacementsButton.Hint:=lisConvUnitReplHint; - TypeReplacementsButton.Caption:=lisConvTypeReplacements; - TypeReplacementsButton.Hint:=lisConvTypeReplHint; - VisualOffsetsButton.Caption:=lisConvTopCoordOffs; - VisualOffsetsButton.Hint:=lisConvTopCoordHint; - FuncReplacementsButton.Caption:=lisConvFuncReplacements; - FuncReplacementsButton.Hint:=lisConvFuncReplHint; TargetRadioGroupClick(TargetRadioGroup); end; @@ -585,27 +614,36 @@ var Trg: TConvertTarget; begin Trg:=TConvertTarget((Sender as TRadioGroup).ItemIndex); - if Trg<>ctLazarusAndDelphi then + if Trg<>ctLazarusAndDelphi then begin SameDFMCheckBox.Checked:=false; + end; SameDFMCheckBox.Enabled:=Trg=ctLazarusAndDelphi; end; -procedure TConvertSettingsForm.UnitReplacementsButtonClick(Sender: TObject); +procedure TConvertSettingsForm.SameDFMCheckBoxChange(Sender: TObject); +begin + if (Sender as TCheckBox).Checked then + VisualOffsEnableCheckBox.Checked:=False; +end; + +// Edit replacements in grids + +procedure TConvertSettingsForm.UnitReplaceButtonClick(Sender: TObject); begin EditMap(fSettings.ReplaceUnits, lisConvUnitsToReplace, lisConvDelphiName, lisConvNewName); end; -procedure TConvertSettingsForm.TypeReplacementsButtonClick(Sender: TObject); +procedure TConvertSettingsForm.TypeReplaceButtonClick(Sender: TObject); begin EditMap(fSettings.ReplaceTypes, lisConvTypesToReplace, lisConvDelphiName, lisConvNewName); end; -procedure TConvertSettingsForm.VisualOffsetsButtonClick(Sender: TObject); +procedure TConvertSettingsForm.VisualOffsButtonClick(Sender: TObject); begin EditMap(fSettings.VisualOffsets, lisConvTopCoordOffs, lisConvParentContainer, lisConvTopCoordOff); end; -procedure TConvertSettingsForm.FuncReplacementsButtonClick(Sender: TObject); +procedure TConvertSettingsForm.FuncReplaceButtonClick(Sender: TObject); begin EditFuncReplacements(fSettings.ReplaceFuncs, lisConvFuncsToReplace); end; diff --git a/converter/missingpropertiesdlg.pas b/converter/missingpropertiesdlg.pas index bf31e96f6a..a1942070a9 100644 --- a/converter/missingpropertiesdlg.pas +++ b/converter/missingpropertiesdlg.pas @@ -454,7 +454,7 @@ begin until (Result in [mrOK, mrCancel]) or (LoopCount=10); // Show remaining errors to user. WriteLFMErrors; - if Result=mrOK then begin + if (Result=mrOK) and fSettings.EnableVisualOffs then begin // Fix top offsets of some components in visual containers if ConvTool.CheckTopOffsets(fLFMBuffer, fLFMTree, fSettings.VisualOffsets, ValueTreeNodes) then diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index cf557ba426..455696bcc8 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -465,11 +465,9 @@ resourcestring lisConvertTargetHint = 'Converter adds conditional compilation to support different targets'; lisConvUseSameDFM = 'Lazarus uses the same DFM form file as Delphi'; lisConvUseSameDFMHint = 'Separate form files allow different properties'; - lisConvUnitsTypesProp = 'Units, Types and Properties'; - lisConvAutoRemoveProp = 'Automatic removal of unknown properties'; - lisConvAutoRemovePropHint = 'If unchecked, there will be interactive dialogs for editing / accepting changes'; - lisConvAutoReplaceUnits = 'Automatic replacement of unit names'; - lisConvAutoReplaceUnitHint = 'If unchecked, there will be interactive dialogs for editing / accepting changes.'; + lisConvAutoReplace = 'Replace automatically'; + lisConvAutoRemove = 'Remove automatically'; + lisConvAutoHint = 'If unchecked, there will be interactive dialogs for editing / accepting changes'; lisConvUnitsToReplace = 'Units to replace'; lisConvTypesToReplace = 'Types to replace'; lisConvTopCoordOff = 'Top coordinate offset'; @@ -488,6 +486,8 @@ resourcestring lisConvDelphiFunc = 'Delphi Function'; lisReplacement = 'Replacement'; lisReplacements = 'Replacements'; + lisInteractive = 'Interactive'; + lisEnable = 'Enable'; lisProperties = 'Properties (replace or delete)'; lisTypes = 'Types (not removed if no replacement)'; lisReplaceRemoveUnknown = 'Fix unknown properties and types';