diff --git a/components/jcf2/IdePlugin/lazarus/jcfidemain.pas b/components/jcf2/IdePlugin/lazarus/jcfidemain.pas index 36e4bfa186..ebf2ebae48 100644 --- a/components/jcf2/IdePlugin/lazarus/jcfidemain.pas +++ b/components/jcf2/IdePlugin/lazarus/jcfidemain.pas @@ -84,7 +84,7 @@ uses { jcf } JcfStringUtils, { local } - fAbout, frFiles, JcfRegistrySettings{, fRegistrySettings}; + fAbout, frFiles, JcfSettings; function FileIsAllowedType(const psFileName: string): boolean; @@ -116,12 +116,9 @@ begin end; function TJcfIdeMain.CanFormat(const AMsg: String): Boolean; -var - JCFRegistrySettings: TJCFRegistrySettings; begin Result := True; - JCFRegistrySettings := GetRegSettings; - if JCFRegistrySettings.ConfirmFormat then + if FormattingSettings.ConfirmFormat then if MessageDlg(AMsg, mtConfirmation, [mbYes, mbNo], 0) <> mrYes then Result := False end; diff --git a/components/jcf2/ReadWrite/ConvertTypes.pas b/components/jcf2/ReadWrite/ConvertTypes.pas index 6670738ab3..6b590bac47 100644 --- a/components/jcf2/ReadWrite/ConvertTypes.pas +++ b/components/jcf2/ReadWrite/ConvertTypes.pas @@ -58,7 +58,7 @@ type TShowParseTreeOption = (eShowAlways, eShowOnError, eShowNever); const - OLD_REG_ROOT_KEY = 'Software\Jedi\JediCodeFormat'; + OLD_REG_ROOT_KEY = '\Software\Jedi\JediCodeFormat'; {$IFDEF FPC} REG_ROOT_KEY = OLD_REG_ROOT_KEY; {$ENDIF} {$IFDEF DELPHI1} REG_ROOT_KEY = '\Software\Borland\Delphi\1.0\Jedi\JCF'; {$ENDIF} {$IFDEF DELPHI2} REG_ROOT_KEY = '\Software\Borland\Delphi\2.0\Jedi\JCF'; {$ENDIF} diff --git a/components/jcf2/Settings/JcfRegistrySettings.pas b/components/jcf2/Settings/JcfRegistrySettings.pas index 388124c292..83bdfae4cf 100644 --- a/components/jcf2/Settings/JcfRegistrySettings.pas +++ b/components/jcf2/Settings/JcfRegistrySettings.pas @@ -60,10 +60,10 @@ type fShowParseTreeOption: TShowParseTreeOption; { ui settings } - fsFormatConfigFileName: string; + fsFormatConfigFileName: string; fbFormatConfigNameSpecified: boolean; - fsLastSettingsPage: string; + fsLastSettingsPage: string; feFormatFileWriteOption: TFormatFileWriteOption; {notepad settings } @@ -96,7 +96,6 @@ type fbEditorIntegration: boolean; fbFormatBeforeSave: boolean; fbFormatAfterLoad: boolean; - fbConfirmFormat: boolean; procedure ReadMRUFiles; procedure WriteMRUFiles; @@ -181,7 +180,6 @@ type Write fbEditorIntegration; property FormatBeforeSave: boolean Read fbFormatBeforeSave Write fbFormatBeforeSave; property FormatAfterLoad: boolean Read fbFormatAfterLoad Write fbFormatAfterLoad; - property ConfirmFormat: boolean Read fbConfirmFormat Write fbConfirmFormat; end; function GetRegSettings: TJCFRegistrySettings; @@ -230,7 +228,6 @@ const REG_EDITOR_INTEGRATION = 'EditorIntegration'; REG_FORMAT_BEFORE_SAVE = 'FormatBeforeSave'; REG_FORMAT_AFTER_LOAD = 'FormatAfterLoad'; - REG_CONFIRM_FORMAT = 'ConfirmFormat'; { file-based settings, ie @@ -438,7 +435,6 @@ begin fbEditorIntegration := fcReg.ReadBool(REG_IDE_SECTION, REG_EDITOR_INTEGRATION, False); fbFormatBeforeSave := fcReg.ReadBool(REG_IDE_SECTION, REG_FORMAT_BEFORE_SAVE, False); fbFormatAfterLoad := fcReg.ReadBool(REG_IDE_SECTION, REG_FORMAT_AFTER_LOAD, False); - fbConfirmFormat := fcReg.ReadBool(REG_IDE_SECTION, REG_CONFIRM_FORMAT, True); fbHasRead := True; end; @@ -488,7 +484,6 @@ begin fcReg.WriteBool(REG_IDE_SECTION, REG_EDITOR_INTEGRATION, fbEditorIntegration); fcReg.WriteBool(REG_IDE_SECTION, REG_FORMAT_BEFORE_SAVE, fbFormatBeforeSave); fcReg.WriteBool(REG_IDE_SECTION, REG_FORMAT_AFTER_LOAD, fbFormatAfterLoad); - fcReg.WriteBool(REG_IDE_SECTION, REG_CONFIRM_FORMAT, fbConfirmFormat); end; function TJCFRegistrySettings.CanClearMRU: boolean; diff --git a/components/jcf2/Settings/JcfSettings.pas b/components/jcf2/Settings/JcfSettings.pas index 0f5110121d..204ec5f920 100644 --- a/components/jcf2/Settings/JcfSettings.pas +++ b/components/jcf2/Settings/JcfSettings.pas @@ -78,6 +78,7 @@ type fsDescription: string; fdtWriteDateTime: TDateTime; fsWriteVersion: string; + fsConfirmFormat: Boolean; procedure FromStream(const pcStream: TSettingsInput); public @@ -125,6 +126,7 @@ type property WriteOnExit: boolean Read fbWriteOnExit Write fbWriteOnExit; property Dirty: boolean Read fbDirty Write fbDirty; property HasRead: boolean read fbHasRead write fbHasRead; + property ConfirmFormat: boolean read fsConfirmFormat write fsConfirmFormat; end; function FormattingSettings: TFormattingSettings; @@ -267,6 +269,7 @@ const REG_VERSION = 'WriteVersion'; REG_WRITE_DATETIME = 'WriteDateTime'; REG_DESCRIPTION = 'Description'; + REG_CONFIRM_FORMAT = 'ConfirmFormat'; procedure TFormattingSettings.Read; var @@ -397,6 +400,7 @@ begin pcStream.Write(REG_VERSION, PROGRAM_VERSION); pcStream.Write(REG_WRITE_DATETIME, Now); pcStream.Write(REG_DESCRIPTION, Description); + pcStream.Write(REG_CONFIRM_FORMAT, fsConfirmFormat); WriteToStream(fcObfuscate); WriteToStream(fcClarify); @@ -464,6 +468,7 @@ begin try fsWriteVersion := pcStream.Read(REG_VERSION, ''); fsDescription := pcStream.Read(REG_DESCRIPTION, ''); + fsConfirmFormat := pcStream.Read(REG_CONFIRM_FORMAT, True); fdtWriteDateTime := pcStream.Read(REG_WRITE_DATETIME, 0.0); ReadFromStream(fcObfuscate); diff --git a/components/jcf2/Ui/Settings/frFiles.pas b/components/jcf2/Ui/Settings/frFiles.pas index f860836845..f767a435fb 100644 --- a/components/jcf2/Ui/Settings/frFiles.pas +++ b/components/jcf2/Ui/Settings/frFiles.pas @@ -72,7 +72,7 @@ begin lcSet := GetRegSettings; cbConfirmFormat.Caption := lisFrFileConfirmFormat; - cbConfirmFormat.Checked := lcSet.ConfirmFormat; + cbConfirmFormat.Checked := FormattingSettings.ConfirmFormat; lblFormatFileName.Caption := Format(lisFrFilesFormatFileIs, [lcSet.FormatConfigFileName]); //lblFormatFileName.Caption := PathCompactPath(lblFormatFileName.Canvas.Handle, 'Format file is ' + lcSet.FormatConfigFileName, 450, cpCenter); @@ -110,14 +110,9 @@ begin end; procedure TfFiles.WriteSettings(AOptions: TAbstractIDEOptions); -var - lcSet: TJCFRegistrySettings; begin FormattingSettings.Description := mDescription.Text; - - lcSet := GetRegSettings; - lcSet.ConfirmFormat := cbConfirmFormat.Checked; - lcSet.WriteAll; + FormattingSettings.ConfirmFormat := cbConfirmFormat.Checked; end; procedure TfFiles.FrameResize(Sender: TObject);