IDE: options: reduced some overhead on loading/saving

git-svn-id: trunk@33768 -
This commit is contained in:
mattias 2011-11-25 00:01:44 +00:00
parent 9534efa9f7
commit c24a308083
12 changed files with 75 additions and 0 deletions

View File

@ -34,6 +34,9 @@ type
TCodeExplorerCategoriesOptionsFrame = class(TAbstractIDEOptionsEditor) TCodeExplorerCategoriesOptionsFrame = class(TAbstractIDEOptionsEditor)
CategoriesCheckGroup: TCheckGroup; CategoriesCheckGroup: TCheckGroup;
private
fLoaded: Boolean;
FSaved: Boolean;
public public
function GetTitle: String; override; function GetTitle: String; override;
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
@ -68,6 +71,8 @@ procedure TCodeExplorerCategoriesOptionsFrame.ReadSettings(
var var
c: TCodeExplorerCategory; c: TCodeExplorerCategory;
begin begin
if fLoaded then exit;
fLoaded:=true;
with AOptions as TCodeExplorerOptions do with AOptions as TCodeExplorerOptions do
for c := FirstCodeExplorerCategory to high(TCodeExplorerCategory) do for c := FirstCodeExplorerCategory to high(TCodeExplorerCategory) do
CategoriesCheckGroup.Checked[ord(c) - 1] := c in Categories; CategoriesCheckGroup.Checked[ord(c) - 1] := c in Categories;
@ -79,6 +84,8 @@ var
NewCategories: TCodeExplorerCategories; NewCategories: TCodeExplorerCategories;
c: TCodeExplorerCategory; c: TCodeExplorerCategory;
begin begin
if FSaved then exit;
FSaved:=true;
NewCategories:=[]; NewCategories:=[];
for c := FirstCodeExplorerCategory to high(TCodeExplorerCategory) do for c := FirstCodeExplorerCategory to high(TCodeExplorerCategory) do
if CategoriesCheckGroup.Checked[ord(c) - 1] then if CategoriesCheckGroup.Checked[ord(c) - 1] then

View File

@ -52,6 +52,8 @@ type
private private
FCategoryCheckBoxes: array [TCEObserverCategory] of TCheckBox; FCategoryCheckBoxes: array [TCEObserverCategory] of TCheckBox;
FGroupCheckBoxes: array [TCEObserverCategoryGroup] of TCheckBox; FGroupCheckBoxes: array [TCEObserverCategoryGroup] of TCheckBox;
fLoaded: Boolean;
FSaved: Boolean;
public public
function GetTitle: String; override; function GetTitle: String; override;
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
@ -166,6 +168,8 @@ var
c: TCEObserverCategory; c: TCEObserverCategory;
Tmp: TStrings; Tmp: TStrings;
begin begin
if fLoaded then exit;
fLoaded:=true;
with TCodeExplorerOptions(AOptions) do with TCodeExplorerOptions(AOptions) do
begin begin
for c := Low(c) to High(c) do for c := Low(c) to High(c) do
@ -191,6 +195,8 @@ var
NewCategories: TCEObserverCategories; NewCategories: TCEObserverCategories;
c: TCEObserverCategory; c: TCEObserverCategory;
begin begin
if FSaved then exit;
FSaved:=true;
NewCategories := []; NewCategories := [];
for c := Low(c) to high(c) do for c := Low(c) to high(c) do
if FCategoryCheckBoxes[c].Checked then if FCategoryCheckBoxes[c].Checked then

View File

@ -42,6 +42,8 @@ type
private private
BeautifyCodeOptions: TBeautifyCodeOptions; BeautifyCodeOptions: TBeautifyCodeOptions;
FHighlighter: TPreviewPasSyn; FHighlighter: TPreviewPasSyn;
fLoaded: Boolean;
FSaved: Boolean;
procedure UpdateSplitLineExample; procedure UpdateSplitLineExample;
procedure UpdatePreviewSettings; procedure UpdatePreviewSettings;
procedure WriteBeautifyCodeOptions(Options: TBeautifyCodeOptions); procedure WriteBeautifyCodeOptions(Options: TBeautifyCodeOptions);
@ -171,6 +173,8 @@ end;
procedure TCodetoolsLineSplittingOptionsFrame.ReadSettings( procedure TCodetoolsLineSplittingOptionsFrame.ReadSettings(
AOptions: TAbstractIDEOptions); AOptions: TAbstractIDEOptions);
begin begin
if fLoaded then exit;
fLoaded:=true;
with AOptions as TCodetoolsOptions do with AOptions as TCodetoolsOptions do
begin begin
LineLengthEdit.Text := IntToStr(LineLength); LineLengthEdit.Text := IntToStr(LineLength);
@ -182,6 +186,8 @@ end;
procedure TCodetoolsLineSplittingOptionsFrame.WriteSettings( procedure TCodetoolsLineSplittingOptionsFrame.WriteSettings(
AOptions: TAbstractIDEOptions); AOptions: TAbstractIDEOptions);
begin begin
if FSaved then exit;
FSaved:=true;
with AOptions as TCodetoolsOptions do with AOptions as TCodetoolsOptions do
begin begin
LineLength := StrToIntDef(LineLengthEdit.Text, 80); LineLength := StrToIntDef(LineLengthEdit.Text, 80);

View File

@ -36,6 +36,8 @@ type
IdentifierPolicyRadioGroup: TRadioGroup; IdentifierPolicyRadioGroup: TRadioGroup;
KeyWordPolicyRadioGroup: TRadioGroup; KeyWordPolicyRadioGroup: TRadioGroup;
private private
fLoaded: Boolean;
FSaved: Boolean;
{ private declarations } { private declarations }
public public
function GetTitle: String; override; function GetTitle: String; override;
@ -87,6 +89,8 @@ end;
procedure TCodetoolsWordPolicyOptionsFrame.ReadSettings( procedure TCodetoolsWordPolicyOptionsFrame.ReadSettings(
AOptions: TAbstractIDEOptions); AOptions: TAbstractIDEOptions);
begin begin
if fLoaded then exit;
fLoaded:=true;
with AOptions as TCodetoolsOptions do with AOptions as TCodetoolsOptions do
begin begin
case KeyWordPolicy of case KeyWordPolicy of
@ -117,6 +121,8 @@ end;
procedure TCodetoolsWordPolicyOptionsFrame.WriteSettings( procedure TCodetoolsWordPolicyOptionsFrame.WriteSettings(
AOptions: TAbstractIDEOptions); AOptions: TAbstractIDEOptions);
begin begin
if FSaved then exit;
FSaved:=true;
with AOptions as TCodetoolsOptions do with AOptions as TCodetoolsOptions do
begin begin
case KeyWordPolicyRadioGroup.ItemIndex of case KeyWordPolicyRadioGroup.ItemIndex of

View File

@ -45,6 +45,9 @@ type
TargetCPUComboBox: TComboBox; TargetCPUComboBox: TComboBox;
TargetOSComboBox: TComboBox; TargetOSComboBox: TComboBox;
TargetProcessorProcComboBox: TComboBox; TargetProcessorProcComboBox: TComboBox;
private
fLoaded: Boolean;
FSaved: Boolean;
public public
function GetTitle: string; override; function GetTitle: string; override;
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
@ -219,6 +222,8 @@ procedure TCompilerCodegenOptionsFrame.ReadSettings(AOptions: TAbstractIDEOption
var var
i: longint; i: longint;
begin begin
if fLoaded then exit;
fLoaded:=true;
with AOptions as TBaseCompilerOptions do with AOptions as TBaseCompilerOptions do
begin begin
chkSmartLinkUnit.Checked := SmartLinkUnit; chkSmartLinkUnit.Checked := SmartLinkUnit;
@ -267,6 +272,8 @@ var
NewTargetOS: string; NewTargetOS: string;
NewTargetCPU: string; NewTargetCPU: string;
begin begin
if FSaved then exit;
FSaved:=true;
with AOptions as TBaseCompilerOptions do with AOptions as TBaseCompilerOptions do
begin begin
SmartLinkUnit := chkSmartLinkUnit.Checked; SmartLinkUnit := chkSmartLinkUnit.Checked;

View File

@ -52,6 +52,8 @@ type
InhTreeView: TTreeView; InhTreeView: TTreeView;
procedure InhTreeViewSelectionChanged(Sender: TObject); procedure InhTreeViewSelectionChanged(Sender: TObject);
private private
fLoaded: Boolean;
FSaved: Boolean;
ImageIndexInherited: Integer; ImageIndexInherited: Integer;
ImageIndexRequired: Integer; ImageIndexRequired: Integer;
ImageIndexPackage: Integer; ImageIndexPackage: Integer;
@ -98,11 +100,15 @@ end;
procedure TCompilerInheritedOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); procedure TCompilerInheritedOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
begin begin
if fLoaded then exit;
fLoaded:=true;
UpdateInheritedTree(AOptions as TBaseCompilerOptions); UpdateInheritedTree(AOptions as TBaseCompilerOptions);
end; end;
procedure TCompilerInheritedOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions); procedure TCompilerInheritedOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
begin begin
if FSaved then exit;
FSaved:=true;
end; end;

View File

@ -58,7 +58,9 @@ type
FHighlighters: array[TLazSyntaxHighlighter] of TSrcIDEHighlighter; FHighlighters: array[TLazSyntaxHighlighter] of TSrcIDEHighlighter;
FCurHighlighter: TSrcIDEHighlighter; FCurHighlighter: TSrcIDEHighlighter;
FCurFoldInfo: TEditorOptionsFoldRecord; FCurFoldInfo: TEditorOptionsFoldRecord;
fLoaded: Boolean;
FModeLock: Boolean; FModeLock: Boolean;
FSaved: Boolean;
procedure UpdateFoldHideRadio; procedure UpdateFoldHideRadio;
protected protected
function GetHighlighter(SynType: TLazSyntaxHighlighter; function GetHighlighter(SynType: TLazSyntaxHighlighter;
@ -249,6 +251,8 @@ var
i: Integer; i: Integer;
rf: TEditorOptionsFoldRecord; rf: TEditorOptionsFoldRecord;
begin begin
if fLoaded then exit;
fLoaded:=true;
FModeLock := False; FModeLock := False;
with AOptions as TEditorOptions do with AOptions as TEditorOptions do
begin begin
@ -275,6 +279,8 @@ procedure TEditorCodefoldingOptionsFrame.WriteSettings(
var var
i: TLazSyntaxHighlighter; i: TLazSyntaxHighlighter;
begin begin
if FSaved then exit;
FSaved:=true;
with AOptions as TEditorOptions do with AOptions as TEditorOptions do
begin begin
UseCodeFolding := chkCodeFoldingEnabled.Checked; UseCodeFolding := chkCodeFoldingEnabled.Checked;

View File

@ -49,6 +49,9 @@ type
AutoToolTipSymbToolsCheckBox: TCheckBox; AutoToolTipSymbToolsCheckBox: TCheckBox;
AutoRemoveEmptyMethodsOnSave: TCheckBox; AutoRemoveEmptyMethodsOnSave: TCheckBox;
procedure AutoDelayTrackBarChange(Sender: TObject); procedure AutoDelayTrackBarChange(Sender: TObject);
private
fLoaded: Boolean;
FSaved: Boolean;
public public
function GetTitle: String; override; function GetTitle: String; override;
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
@ -95,6 +98,8 @@ end;
procedure TEditorCodetoolsOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); procedure TEditorCodetoolsOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
begin begin
if fLoaded then exit;
fLoaded:=true;
with AOptions as TEditorOptions do with AOptions as TEditorOptions do
begin begin
AutoCompleteBlockCheckBox.Checked := AutoBlockCompletion; AutoCompleteBlockCheckBox.Checked := AutoBlockCompletion;
@ -113,6 +118,8 @@ end;
procedure TEditorCodetoolsOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions); procedure TEditorCodetoolsOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
begin begin
if FSaved then exit;
FSaved:=true;
with AOptions as TEditorOptions do with AOptions as TEditorOptions do
begin begin
AutoBlockCompletion := AutoCompleteBlockCheckBox.Checked; AutoBlockCompletion := AutoCompleteBlockCheckBox.Checked;

View File

@ -35,6 +35,8 @@ type
procedure FPCDocHTMLBrowseButtonClick(Sender: TObject); procedure FPCDocHTMLBrowseButtonClick(Sender: TObject);
procedure ViewersListBoxSelectionChange(Sender: TObject; User: boolean); procedure ViewersListBoxSelectionChange(Sender: TObject; User: boolean);
private private
fLoaded: Boolean;
FSaved: Boolean;
ViewersPropertiesGrid: TCustomPropertiesGrid; ViewersPropertiesGrid: TCustomPropertiesGrid;
DatabasesPropertiesGrid: TCustomPropertiesGrid; DatabasesPropertiesGrid: TCustomPropertiesGrid;
procedure FillViewersList; procedure FillViewersList;
@ -195,6 +197,8 @@ end;
procedure THelpGeneralOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); procedure THelpGeneralOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
begin begin
if fLoaded then exit;
fLoaded:=true;
with AOptions as THelpOptions do with AOptions as THelpOptions do
begin begin
FPCDocHTMLEdit.Text := FPCDocsHTMLDirectory; FPCDocHTMLEdit.Text := FPCDocsHTMLDirectory;
@ -207,6 +211,8 @@ end;
procedure THelpGeneralOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions); procedure THelpGeneralOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
begin begin
if FSaved then exit;
FSaved:=true;
with AOptions as THelpOptions do with AOptions as THelpOptions do
begin begin
FPCDocsHTMLDirectory := FPCDocHTMLEdit.Text; FPCDocsHTMLDirectory := FPCDocHTMLEdit.Text;

View File

@ -40,6 +40,8 @@ type
PascalFileExtRadiogroup: TRadioGroup; PascalFileExtRadiogroup: TRadioGroup;
UnitReferencesRadioGroup: TRadioGroup; UnitReferencesRadioGroup: TRadioGroup;
private private
fLoaded: Boolean;
FSaved: Boolean;
public public
function GetTitle: String; override; function GetTitle: String; override;
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
@ -130,6 +132,8 @@ procedure TNamingOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
var var
i: integer; i: integer;
begin begin
if fLoaded then exit;
fLoaded:=true;
with AOptions as TEnvironmentOptions do with AOptions as TEnvironmentOptions do
begin begin
for i := 0 to PascalFileExtRadiogroup.Items.Count-1 do for i := 0 to PascalFileExtRadiogroup.Items.Count-1 do
@ -146,6 +150,8 @@ end;
procedure TNamingOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions); procedure TNamingOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
begin begin
if FSaved then exit;
FSaved:=true;
with AOptions as TEnvironmentOptions do with AOptions as TEnvironmentOptions do
begin begin
if PascalFileExtRadiogroup.ItemIndex >= 0 then if PascalFileExtRadiogroup.ItemIndex >= 0 then

View File

@ -40,7 +40,9 @@ type
procedure SaveIconButtonClick(Sender: TObject); procedure SaveIconButtonClick(Sender: TObject);
procedure UseXPManifestCheckBoxChange(Sender: TObject); procedure UseXPManifestCheckBoxChange(Sender: TObject);
private private
fLoaded: Boolean;
FProject: TProject; FProject: TProject;
FSaved: Boolean;
procedure SetIconFromStream(Value: TStream); procedure SetIconFromStream(Value: TStream);
function GetIconAsStream: TStream; function GetIconAsStream: TStream;
public public
@ -212,6 +214,8 @@ procedure TProjectApplicationOptionsFrame.ReadSettings(AOptions: TAbstractIDEOpt
var var
AStream: TStream; AStream: TStream;
begin begin
if fLoaded then exit;
fLoaded:=true;
FProject := AOptions as TProject; FProject := AOptions as TProject;
with FProject do with FProject do
begin begin
@ -233,6 +237,8 @@ procedure TProjectApplicationOptionsFrame.WriteSettings(AOptions: TAbstractIDEOp
var var
AStream: TStream; AStream: TStream;
begin begin
if FSaved then exit;
FSaved:=true;
with AOptions as TProject do with AOptions as TProject do
begin begin
Title := TitleEdit.Text; Title := TitleEdit.Text;

View File

@ -31,6 +31,8 @@ type
UseFPCResourcesRadioButton: TRadioButton; UseFPCResourcesRadioButton: TRadioButton;
UseLRSFilesRadioButton: TRadioButton; UseLRSFilesRadioButton: TRadioButton;
private private
fLoaded: Boolean;
FSaved: Boolean;
{ private declarations } { private declarations }
public public
function GetTitle: string; override; function GetTitle: string; override;
@ -74,6 +76,8 @@ end;
procedure TProjectMiscOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); procedure TProjectMiscOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
begin begin
if fLoaded then exit;
fLoaded:=true;
with AOptions as TProject do with AOptions as TProject do
begin begin
MainUnitIsPascalSourceCheckBox.Checked := (pfMainUnitIsPascalSource in Flags); MainUnitIsPascalSourceCheckBox.Checked := (pfMainUnitIsPascalSource in Flags);
@ -112,6 +116,8 @@ var
end; end;
begin begin
if FSaved then exit;
FSaved:=true;
NewFlags := Project.Flags; NewFlags := Project.Flags;
SetProjectFlag(pfMainUnitIsPascalSource, SetProjectFlag(pfMainUnitIsPascalSource,
MainUnitIsPascalSourceCheckBox.Checked); MainUnitIsPascalSourceCheckBox.Checked);