From c24a3080832b63fc5fc64c680bf25c5c958341af Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 25 Nov 2011 00:01:44 +0000 Subject: [PATCH] IDE: options: reduced some overhead on loading/saving git-svn-id: trunk@33768 - --- ide/frames/codeexplorer_categories_options.pas | 7 +++++++ ide/frames/codeobserver_options.pas | 6 ++++++ ide/frames/codetools_linesplitting_options.pas | 6 ++++++ ide/frames/codetools_wordpolicy_options.pas | 6 ++++++ ide/frames/compiler_codegen_options.pas | 7 +++++++ ide/frames/compiler_inherited_options.pas | 6 ++++++ ide/frames/editor_codefolding_options.pas | 6 ++++++ ide/frames/editor_codetools_options.pas | 7 +++++++ ide/frames/help_general_options.pas | 6 ++++++ ide/frames/naming_options.pas | 6 ++++++ ide/frames/project_application_options.pas | 6 ++++++ ide/frames/project_misc_options.pas | 6 ++++++ 12 files changed, 75 insertions(+) diff --git a/ide/frames/codeexplorer_categories_options.pas b/ide/frames/codeexplorer_categories_options.pas index ab94b129f7..906ef467e6 100644 --- a/ide/frames/codeexplorer_categories_options.pas +++ b/ide/frames/codeexplorer_categories_options.pas @@ -34,6 +34,9 @@ type TCodeExplorerCategoriesOptionsFrame = class(TAbstractIDEOptionsEditor) CategoriesCheckGroup: TCheckGroup; + private + fLoaded: Boolean; + FSaved: Boolean; public function GetTitle: String; override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; @@ -68,6 +71,8 @@ procedure TCodeExplorerCategoriesOptionsFrame.ReadSettings( var c: TCodeExplorerCategory; begin + if fLoaded then exit; + fLoaded:=true; with AOptions as TCodeExplorerOptions do for c := FirstCodeExplorerCategory to high(TCodeExplorerCategory) do CategoriesCheckGroup.Checked[ord(c) - 1] := c in Categories; @@ -79,6 +84,8 @@ var NewCategories: TCodeExplorerCategories; c: TCodeExplorerCategory; begin + if FSaved then exit; + FSaved:=true; NewCategories:=[]; for c := FirstCodeExplorerCategory to high(TCodeExplorerCategory) do if CategoriesCheckGroup.Checked[ord(c) - 1] then diff --git a/ide/frames/codeobserver_options.pas b/ide/frames/codeobserver_options.pas index 8d4e033f58..8184de3b8b 100644 --- a/ide/frames/codeobserver_options.pas +++ b/ide/frames/codeobserver_options.pas @@ -52,6 +52,8 @@ type private FCategoryCheckBoxes: array [TCEObserverCategory] of TCheckBox; FGroupCheckBoxes: array [TCEObserverCategoryGroup] of TCheckBox; + fLoaded: Boolean; + FSaved: Boolean; public function GetTitle: String; override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; @@ -166,6 +168,8 @@ var c: TCEObserverCategory; Tmp: TStrings; begin + if fLoaded then exit; + fLoaded:=true; with TCodeExplorerOptions(AOptions) do begin for c := Low(c) to High(c) do @@ -191,6 +195,8 @@ var NewCategories: TCEObserverCategories; c: TCEObserverCategory; begin + if FSaved then exit; + FSaved:=true; NewCategories := []; for c := Low(c) to high(c) do if FCategoryCheckBoxes[c].Checked then diff --git a/ide/frames/codetools_linesplitting_options.pas b/ide/frames/codetools_linesplitting_options.pas index 87e144586e..b811c6c0c7 100644 --- a/ide/frames/codetools_linesplitting_options.pas +++ b/ide/frames/codetools_linesplitting_options.pas @@ -42,6 +42,8 @@ type private BeautifyCodeOptions: TBeautifyCodeOptions; FHighlighter: TPreviewPasSyn; + fLoaded: Boolean; + FSaved: Boolean; procedure UpdateSplitLineExample; procedure UpdatePreviewSettings; procedure WriteBeautifyCodeOptions(Options: TBeautifyCodeOptions); @@ -171,6 +173,8 @@ end; procedure TCodetoolsLineSplittingOptionsFrame.ReadSettings( AOptions: TAbstractIDEOptions); begin + if fLoaded then exit; + fLoaded:=true; with AOptions as TCodetoolsOptions do begin LineLengthEdit.Text := IntToStr(LineLength); @@ -182,6 +186,8 @@ end; procedure TCodetoolsLineSplittingOptionsFrame.WriteSettings( AOptions: TAbstractIDEOptions); begin + if FSaved then exit; + FSaved:=true; with AOptions as TCodetoolsOptions do begin LineLength := StrToIntDef(LineLengthEdit.Text, 80); diff --git a/ide/frames/codetools_wordpolicy_options.pas b/ide/frames/codetools_wordpolicy_options.pas index d5712e7b75..6455cbff01 100644 --- a/ide/frames/codetools_wordpolicy_options.pas +++ b/ide/frames/codetools_wordpolicy_options.pas @@ -36,6 +36,8 @@ type IdentifierPolicyRadioGroup: TRadioGroup; KeyWordPolicyRadioGroup: TRadioGroup; private + fLoaded: Boolean; + FSaved: Boolean; { private declarations } public function GetTitle: String; override; @@ -87,6 +89,8 @@ end; procedure TCodetoolsWordPolicyOptionsFrame.ReadSettings( AOptions: TAbstractIDEOptions); begin + if fLoaded then exit; + fLoaded:=true; with AOptions as TCodetoolsOptions do begin case KeyWordPolicy of @@ -117,6 +121,8 @@ end; procedure TCodetoolsWordPolicyOptionsFrame.WriteSettings( AOptions: TAbstractIDEOptions); begin + if FSaved then exit; + FSaved:=true; with AOptions as TCodetoolsOptions do begin case KeyWordPolicyRadioGroup.ItemIndex of diff --git a/ide/frames/compiler_codegen_options.pas b/ide/frames/compiler_codegen_options.pas index 6fcb2f1acf..56a8fd65dc 100644 --- a/ide/frames/compiler_codegen_options.pas +++ b/ide/frames/compiler_codegen_options.pas @@ -45,6 +45,9 @@ type TargetCPUComboBox: TComboBox; TargetOSComboBox: TComboBox; TargetProcessorProcComboBox: TComboBox; + private + fLoaded: Boolean; + FSaved: Boolean; public function GetTitle: string; override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; @@ -219,6 +222,8 @@ procedure TCompilerCodegenOptionsFrame.ReadSettings(AOptions: TAbstractIDEOption var i: longint; begin + if fLoaded then exit; + fLoaded:=true; with AOptions as TBaseCompilerOptions do begin chkSmartLinkUnit.Checked := SmartLinkUnit; @@ -267,6 +272,8 @@ var NewTargetOS: string; NewTargetCPU: string; begin + if FSaved then exit; + FSaved:=true; with AOptions as TBaseCompilerOptions do begin SmartLinkUnit := chkSmartLinkUnit.Checked; diff --git a/ide/frames/compiler_inherited_options.pas b/ide/frames/compiler_inherited_options.pas index c72f4bfbe0..b71eddf6ba 100644 --- a/ide/frames/compiler_inherited_options.pas +++ b/ide/frames/compiler_inherited_options.pas @@ -52,6 +52,8 @@ type InhTreeView: TTreeView; procedure InhTreeViewSelectionChanged(Sender: TObject); private + fLoaded: Boolean; + FSaved: Boolean; ImageIndexInherited: Integer; ImageIndexRequired: Integer; ImageIndexPackage: Integer; @@ -98,11 +100,15 @@ end; procedure TCompilerInheritedOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); begin + if fLoaded then exit; + fLoaded:=true; UpdateInheritedTree(AOptions as TBaseCompilerOptions); end; procedure TCompilerInheritedOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions); begin + if FSaved then exit; + FSaved:=true; end; diff --git a/ide/frames/editor_codefolding_options.pas b/ide/frames/editor_codefolding_options.pas index bc29c32ae8..f7c27df1f1 100644 --- a/ide/frames/editor_codefolding_options.pas +++ b/ide/frames/editor_codefolding_options.pas @@ -58,7 +58,9 @@ type FHighlighters: array[TLazSyntaxHighlighter] of TSrcIDEHighlighter; FCurHighlighter: TSrcIDEHighlighter; FCurFoldInfo: TEditorOptionsFoldRecord; + fLoaded: Boolean; FModeLock: Boolean; + FSaved: Boolean; procedure UpdateFoldHideRadio; protected function GetHighlighter(SynType: TLazSyntaxHighlighter; @@ -249,6 +251,8 @@ var i: Integer; rf: TEditorOptionsFoldRecord; begin + if fLoaded then exit; + fLoaded:=true; FModeLock := False; with AOptions as TEditorOptions do begin @@ -275,6 +279,8 @@ procedure TEditorCodefoldingOptionsFrame.WriteSettings( var i: TLazSyntaxHighlighter; begin + if FSaved then exit; + FSaved:=true; with AOptions as TEditorOptions do begin UseCodeFolding := chkCodeFoldingEnabled.Checked; diff --git a/ide/frames/editor_codetools_options.pas b/ide/frames/editor_codetools_options.pas index d865f29bf4..84ca42c005 100644 --- a/ide/frames/editor_codetools_options.pas +++ b/ide/frames/editor_codetools_options.pas @@ -49,6 +49,9 @@ type AutoToolTipSymbToolsCheckBox: TCheckBox; AutoRemoveEmptyMethodsOnSave: TCheckBox; procedure AutoDelayTrackBarChange(Sender: TObject); + private + fLoaded: Boolean; + FSaved: Boolean; public function GetTitle: String; override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; @@ -95,6 +98,8 @@ end; procedure TEditorCodetoolsOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); begin + if fLoaded then exit; + fLoaded:=true; with AOptions as TEditorOptions do begin AutoCompleteBlockCheckBox.Checked := AutoBlockCompletion; @@ -113,6 +118,8 @@ end; procedure TEditorCodetoolsOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions); begin + if FSaved then exit; + FSaved:=true; with AOptions as TEditorOptions do begin AutoBlockCompletion := AutoCompleteBlockCheckBox.Checked; diff --git a/ide/frames/help_general_options.pas b/ide/frames/help_general_options.pas index ec19118594..9be8fe7e4d 100644 --- a/ide/frames/help_general_options.pas +++ b/ide/frames/help_general_options.pas @@ -35,6 +35,8 @@ type procedure FPCDocHTMLBrowseButtonClick(Sender: TObject); procedure ViewersListBoxSelectionChange(Sender: TObject; User: boolean); private + fLoaded: Boolean; + FSaved: Boolean; ViewersPropertiesGrid: TCustomPropertiesGrid; DatabasesPropertiesGrid: TCustomPropertiesGrid; procedure FillViewersList; @@ -195,6 +197,8 @@ end; procedure THelpGeneralOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); begin + if fLoaded then exit; + fLoaded:=true; with AOptions as THelpOptions do begin FPCDocHTMLEdit.Text := FPCDocsHTMLDirectory; @@ -207,6 +211,8 @@ end; procedure THelpGeneralOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions); begin + if FSaved then exit; + FSaved:=true; with AOptions as THelpOptions do begin FPCDocsHTMLDirectory := FPCDocHTMLEdit.Text; diff --git a/ide/frames/naming_options.pas b/ide/frames/naming_options.pas index a538300ba1..0759fcac5b 100644 --- a/ide/frames/naming_options.pas +++ b/ide/frames/naming_options.pas @@ -40,6 +40,8 @@ type PascalFileExtRadiogroup: TRadioGroup; UnitReferencesRadioGroup: TRadioGroup; private + fLoaded: Boolean; + FSaved: Boolean; public function GetTitle: String; override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; @@ -130,6 +132,8 @@ procedure TNamingOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); var i: integer; begin + if fLoaded then exit; + fLoaded:=true; with AOptions as TEnvironmentOptions do begin for i := 0 to PascalFileExtRadiogroup.Items.Count-1 do @@ -146,6 +150,8 @@ end; procedure TNamingOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions); begin + if FSaved then exit; + FSaved:=true; with AOptions as TEnvironmentOptions do begin if PascalFileExtRadiogroup.ItemIndex >= 0 then diff --git a/ide/frames/project_application_options.pas b/ide/frames/project_application_options.pas index 94967add67..c79f2912d9 100644 --- a/ide/frames/project_application_options.pas +++ b/ide/frames/project_application_options.pas @@ -40,7 +40,9 @@ type procedure SaveIconButtonClick(Sender: TObject); procedure UseXPManifestCheckBoxChange(Sender: TObject); private + fLoaded: Boolean; FProject: TProject; + FSaved: Boolean; procedure SetIconFromStream(Value: TStream); function GetIconAsStream: TStream; public @@ -212,6 +214,8 @@ procedure TProjectApplicationOptionsFrame.ReadSettings(AOptions: TAbstractIDEOpt var AStream: TStream; begin + if fLoaded then exit; + fLoaded:=true; FProject := AOptions as TProject; with FProject do begin @@ -233,6 +237,8 @@ procedure TProjectApplicationOptionsFrame.WriteSettings(AOptions: TAbstractIDEOp var AStream: TStream; begin + if FSaved then exit; + FSaved:=true; with AOptions as TProject do begin Title := TitleEdit.Text; diff --git a/ide/frames/project_misc_options.pas b/ide/frames/project_misc_options.pas index a8566e5789..e07970874c 100644 --- a/ide/frames/project_misc_options.pas +++ b/ide/frames/project_misc_options.pas @@ -31,6 +31,8 @@ type UseFPCResourcesRadioButton: TRadioButton; UseLRSFilesRadioButton: TRadioButton; private + fLoaded: Boolean; + FSaved: Boolean; { private declarations } public function GetTitle: string; override; @@ -74,6 +76,8 @@ end; procedure TProjectMiscOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); begin + if fLoaded then exit; + fLoaded:=true; with AOptions as TProject do begin MainUnitIsPascalSourceCheckBox.Checked := (pfMainUnitIsPascalSource in Flags); @@ -112,6 +116,8 @@ var end; begin + if FSaved then exit; + FSaved:=true; NewFlags := Project.Flags; SetProjectFlag(pfMainUnitIsPascalSource, MainUnitIsPascalSourceCheckBox.Checked);