mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 09:49:22 +02:00
IDE: optimized initializing IDE options
git-svn-id: trunk@24797 -
This commit is contained in:
parent
9cdfe72ef6
commit
89a92b3936
@ -7,7 +7,7 @@ unit educationlaz;
|
||||
interface
|
||||
|
||||
uses
|
||||
EduEnvOptsFrame, EduOptions, EduPkgSystem, EduCompPalette, EduMenu,
|
||||
EduEnvOptsFrame, EduOptions, EduPkgSystem, EduCompPalette, EduMenu,
|
||||
EduNewProgram, EduPropsEvents, EduOIPages, EduOptionsDlg, EduSpeedButtons,
|
||||
LazarusPackageIntf;
|
||||
|
||||
|
@ -329,7 +329,9 @@ end;
|
||||
|
||||
procedure TEduCompPaletteFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
FillComponentTreeView;
|
||||
if AOptions=EducationOptions then begin
|
||||
FillComponentTreeView;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEduCompPaletteFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
@ -348,7 +350,9 @@ end;
|
||||
|
||||
procedure TEduCompPaletteFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
SaveFillComponentTreeView;
|
||||
if AOptions=EducationOptions then begin
|
||||
SaveFillComponentTreeView;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TEduComponentPaletteOptions }
|
||||
@ -427,20 +431,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TEduComponentPaletteOptions.Apply(Enable: boolean);
|
||||
var
|
||||
i: Integer;
|
||||
Page: TBaseComponentPage;
|
||||
j: Integer;
|
||||
Comp: TRegisteredComponent;
|
||||
begin
|
||||
inherited Apply(Enable);
|
||||
for i:=0 to IDEComponentPalette.Count-1 do begin
|
||||
Page:=IDEComponentPalette[i];
|
||||
for j:=0 to Page.Count-1 do begin
|
||||
Comp:=Page[j];
|
||||
Comp.Visible:=(not Enable) or ComponentVisible[Comp.ComponentClass.ClassName];
|
||||
end;
|
||||
end;
|
||||
if IDEComponentPalette<>nil then
|
||||
IDEComponentPalette.UpdateVisible;
|
||||
end;
|
||||
|
@ -109,17 +109,18 @@ end;
|
||||
|
||||
procedure TEduEnvFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
EnableCheckBox.Checked:=EducationOptions.Enabled;
|
||||
//OnLoadIDEOptions(Self,EducationOptions);
|
||||
if AOptions=EducationOptions then begin
|
||||
EnableCheckBox.Checked:=EducationOptions.Enabled;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEduEnvFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
EducationOptions.Enabled:=EnableCheckBox.Checked;
|
||||
//OnSaveIDEOptions(Self,EducationOptions);
|
||||
if EducationOptions.Save<>mrOk then
|
||||
DebugLn(['TEduEnvFrame.WriteSettings Failed']);
|
||||
EducationOptions.Apply;
|
||||
if AOptions=EducationOptions then begin
|
||||
EducationOptions.Enabled:=EnableCheckBox.Checked;
|
||||
if EducationOptions.Save<>mrOk then
|
||||
DebugLn(['TEduEnvFrame.WriteSettings Failed']);
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TEduEnvFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
|
||||
|
@ -298,7 +298,9 @@ end;
|
||||
|
||||
procedure TEduMenuFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
FillMenuTree;
|
||||
if AOptions=EducationOptions then begin
|
||||
FillMenuTree;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEduMenuFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
@ -315,7 +317,9 @@ end;
|
||||
|
||||
procedure TEduMenuFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
SaveMenuTree;
|
||||
if AOptions=EducationOptions then begin
|
||||
SaveMenuTree;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TEduMenuOptions }
|
||||
|
@ -283,10 +283,12 @@ end;
|
||||
|
||||
procedure TEduNewPrgFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
AddNewPrgBtnCheckBox.Checked:=EduNewPrgOptions.AddButton;
|
||||
AddNewPrgMenuItmCheckBox.Checked:=EduNewPrgOptions.AddMenuItem;
|
||||
AddToNewDlgCheckBox.Checked:=EduNewPrgOptions.AddToNewDialog;
|
||||
SrcSynEdit.Lines.Text:=EduNewPrgOptions.Source.Text;
|
||||
if AOptions=EducationOptions then begin
|
||||
AddNewPrgBtnCheckBox.Checked:=EduNewPrgOptions.AddButton;
|
||||
AddNewPrgMenuItmCheckBox.Checked:=EduNewPrgOptions.AddMenuItem;
|
||||
AddToNewDlgCheckBox.Checked:=EduNewPrgOptions.AddToNewDialog;
|
||||
SrcSynEdit.Lines.Text:=EduNewPrgOptions.Source.Text;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEduNewPrgFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
@ -323,10 +325,12 @@ end;
|
||||
|
||||
procedure TEduNewPrgFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
EduNewPrgOptions.AddButton:=AddNewPrgBtnCheckBox.Checked;
|
||||
EduNewPrgOptions.AddMenuItem:=AddNewPrgMenuItmCheckBox.Checked;
|
||||
EduNewPrgOptions.AddToNewDialog:=AddToNewDlgCheckBox.Checked;
|
||||
EduNewPrgOptions.Source:=SrcSynEdit.Lines;
|
||||
if AOptions=EducationOptions then begin
|
||||
EduNewPrgOptions.AddButton:=AddNewPrgBtnCheckBox.Checked;
|
||||
EduNewPrgOptions.AddMenuItem:=AddNewPrgMenuItmCheckBox.Checked;
|
||||
EduNewPrgOptions.AddToNewDialog:=AddToNewDlgCheckBox.Checked;
|
||||
EduNewPrgOptions.Source:=SrcSynEdit.Lines;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TFileDescSingleFileProgram }
|
||||
|
@ -132,8 +132,10 @@ end;
|
||||
|
||||
procedure TEduOIPagesFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
ckBoxFavs.Checked:=EduOIPagesOptions.OIPageFavs;
|
||||
ckBoxRestricted.Checked:=EduOIPagesOptions.OIPageRestricted;
|
||||
if AOptions=EducationOptions then begin
|
||||
ckBoxFavs.Checked:=EduOIPagesOptions.OIPageFavs;
|
||||
ckBoxRestricted.Checked:=EduOIPagesOptions.OIPageRestricted;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEduOIPagesFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
@ -150,8 +152,10 @@ end;
|
||||
|
||||
procedure TEduOIPagesFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
EduOIPagesOptions.OIPageFavs:=ckBoxFavs.Checked;
|
||||
EduOIPagesOptions.OIPageRestricted:=ckBoxRestricted.Checked;
|
||||
if AOptions=EducationOptions then begin
|
||||
EduOIPagesOptions.OIPageFavs:=ckBoxFavs.Checked;
|
||||
EduOIPagesOptions.OIPageRestricted:=ckBoxRestricted.Checked;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$R *.lfm}
|
||||
|
@ -177,6 +177,7 @@ type
|
||||
function SaveToFile(Filename: string): TModalResult; virtual;
|
||||
function Load: TModalResult; virtual;
|
||||
function Save: TModalResult; virtual;
|
||||
procedure DoAfterWrite; override;
|
||||
procedure Apply; virtual;
|
||||
function GetFullFilename: string;
|
||||
function OnProjectOpened(Sender: TObject; AProject: TLazProject): TModalResult;
|
||||
@ -424,6 +425,12 @@ begin
|
||||
FLastSavedChangeStep:=TEduOptsRootNode(Root).ChangeStep;
|
||||
end;
|
||||
|
||||
procedure TEduOptions.DoAfterWrite;
|
||||
begin
|
||||
inherited DoAfterWrite;
|
||||
Apply;
|
||||
end;
|
||||
|
||||
procedure TEduOptions.Apply;
|
||||
begin
|
||||
Root.Apply(Enabled);
|
||||
|
@ -93,12 +93,14 @@ end;
|
||||
|
||||
procedure TEduPkgSystemFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
|
||||
if AOptions=EducationOptions then begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEduPkgSystemFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
|
||||
if AOptions=EducationOptions then begin
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TEduPkgSystemFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
|
||||
|
@ -222,15 +222,15 @@ end;
|
||||
|
||||
procedure TEduPropsEventsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
if AOptions=EducationOptions then begin
|
||||
PropsMinRadioBtn.Checked:=EduPropsEventsOptions.PropsMinimal;
|
||||
PropsExtRadioBtn.Checked:=EduPropsEventsOptions.PropsExt;
|
||||
PropsFullRadioBtn.Checked:=EduPropsEventsOptions.PropsFull;
|
||||
|
||||
PropsMinRadioBtn.Checked:=EduPropsEventsOptions.PropsMinimal;
|
||||
PropsExtRadioBtn.Checked:=EduPropsEventsOptions.PropsExt;
|
||||
PropsFullRadioBtn.Checked:=EduPropsEventsOptions.PropsFull;
|
||||
|
||||
EventsMinRadioBtn.Checked:=EduPropsEventsOptions.EventsMinimal;
|
||||
EventsExtRadioBtn.Checked:=EduPropsEventsOptions.EventsExt;
|
||||
EventsFullRadioBtn.Checked:=EduPropsEventsOptions.EventsFull;
|
||||
|
||||
EventsMinRadioBtn.Checked:=EduPropsEventsOptions.EventsMinimal;
|
||||
EventsExtRadioBtn.Checked:=EduPropsEventsOptions.EventsExt;
|
||||
EventsFullRadioBtn.Checked:=EduPropsEventsOptions.EventsFull;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEduPropsEventsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
@ -288,15 +288,15 @@ end;
|
||||
|
||||
procedure TEduPropsEventsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
if AOptions=EducationOptions then begin
|
||||
EduPropsEventsOptions.PropsMinimal:=PropsMinRadioBtn.Checked;
|
||||
EduPropsEventsOptions.PropsExt:=PropsExtRadioBtn.Checked;
|
||||
EduPropsEventsOptions.PropsFull:=PropsFullRadioBtn.Checked;
|
||||
|
||||
EduPropsEventsOptions.PropsMinimal:=PropsMinRadioBtn.Checked;
|
||||
EduPropsEventsOptions.PropsExt:=PropsExtRadioBtn.Checked;
|
||||
EduPropsEventsOptions.PropsFull:=PropsFullRadioBtn.Checked;
|
||||
|
||||
EduPropsEventsOptions.EventsMinimal:=EventsMinRadioBtn.Checked;
|
||||
EduPropsEventsOptions.EventsExt:=EventsExtRadioBtn.Checked;
|
||||
EduPropsEventsOptions.EventsFull:=EventsFullRadioBtn.Checked;
|
||||
|
||||
EduPropsEventsOptions.EventsMinimal:=EventsMinRadioBtn.Checked;
|
||||
EduPropsEventsOptions.EventsExt:=EventsExtRadioBtn.Checked;
|
||||
EduPropsEventsOptions.EventsFull:=EventsFullRadioBtn.Checked;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$R *.lfm}
|
||||
|
@ -444,7 +444,9 @@ end;
|
||||
|
||||
procedure TEduSpeedButtonsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
FillSpeedButtonsTreeView;
|
||||
if AOptions=EducationOptions then begin
|
||||
FillSpeedButtonsTreeView;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEduSpeedButtonsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
@ -453,7 +455,6 @@ begin
|
||||
HideAllButton.Caption:=ersHideAll;
|
||||
ShowSelectionButton.Caption:=ersShowSelection;
|
||||
SpeedButtonsGroupBox.Caption:=ersVisibleSpeedButtons;
|
||||
|
||||
end;
|
||||
|
||||
class function TEduSpeedButtonsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
|
||||
@ -463,7 +464,9 @@ end;
|
||||
|
||||
procedure TEduSpeedButtonsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
SaveFillSpeedButtonsTreeView;
|
||||
if AOptions=EducationOptions then begin
|
||||
SaveFillSpeedButtonsTreeView;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$R *.lfm}
|
||||
|
@ -92,8 +92,6 @@ var
|
||||
Options: TEditorOptions;
|
||||
begin
|
||||
Options := EditorOpts;
|
||||
if Assigned(OnSaveIDEOptions) then
|
||||
OnSaveIDEOptions(Self, Options);
|
||||
SplitPreviewSynEdit.Highlighter := GetHighlighter(Options);
|
||||
Options.GetSynEditPreviewSettings(SplitPreviewSynEdit);
|
||||
SplitPreviewSynEdit.Gutter.Visible := False;
|
||||
@ -101,14 +99,14 @@ begin
|
||||
SplitPreviewSynEdit.ReadOnly := True;
|
||||
end;
|
||||
|
||||
procedure TCodetoolsLineSplittingOptionsFrame.WriteBeautifyCodeOptions(Options: TBeautifyCodeOptions);
|
||||
procedure TCodetoolsLineSplittingOptionsFrame.WriteBeautifyCodeOptions(
|
||||
Options: TBeautifyCodeOptions);
|
||||
var
|
||||
ACodeToolsOptions: TCodeToolsOptions;
|
||||
begin
|
||||
ACodeToolsOptions := TCodeToolsOptions.Create;
|
||||
try
|
||||
if Assigned(OnSaveIDEOptions) then
|
||||
OnSaveIDEOptions(Self, ACodeToolsOptions);
|
||||
WriteSettings(ACodeToolsOptions);
|
||||
Options.Assign(ACodeToolsOptions);
|
||||
finally
|
||||
ACodeToolsOptions.Free;
|
||||
|
@ -96,8 +96,6 @@ var
|
||||
Options: TEditorOptions;
|
||||
begin
|
||||
Options := EditorOpts;
|
||||
if Assigned(OnSaveIDEOptions) then
|
||||
OnSaveIDEOptions(Self, Options);
|
||||
SpacePreviewSynEdit.Highlighter := GetHighlighter(Options);
|
||||
Options.GetSynEditPreviewSettings(SpacePreviewSynEdit);
|
||||
SpacePreviewSynEdit.Gutter.Visible := False;
|
||||
@ -112,8 +110,7 @@ var
|
||||
begin
|
||||
ACodeToolsOptions := TCodeToolsOptions.Create;
|
||||
try
|
||||
if Assigned(OnSaveIDEOptions) then
|
||||
OnSaveIDEOptions(Self, ACodeToolsOptions);
|
||||
WriteSettings(ACodeToolsOptions);
|
||||
Options.Assign(ACodeToolsOptions);
|
||||
finally
|
||||
ACodeToolsOptions.Free;
|
||||
|
@ -241,7 +241,9 @@ var
|
||||
i: integer;
|
||||
Rec: PIDEOptionsGroupRec;
|
||||
Instance: TAbstractIDEOptions;
|
||||
InstanceList: TFPList;
|
||||
begin
|
||||
InstanceList:=TFPList.Create;
|
||||
for i := 0 to IDEEditorGroups.Count - 1 do
|
||||
begin
|
||||
Rec := IDEEditorGroups[i];
|
||||
@ -252,8 +254,9 @@ begin
|
||||
if Rec^.GroupClass <> nil then
|
||||
begin
|
||||
Instance := Rec^.GroupClass.GetInstance;
|
||||
if Instance <> nil then
|
||||
if (InstanceList.IndexOf(Instance)<0) and (Instance <> nil) then
|
||||
begin
|
||||
InstanceList.Add(Instance);
|
||||
Instance.DoBeforeRead;
|
||||
ReadSettings(Instance);
|
||||
Instance.DoAfterRead;
|
||||
@ -263,6 +266,7 @@ begin
|
||||
end;
|
||||
// load settings that does not belong to any group
|
||||
ReadSettings(nil);
|
||||
InstanceList.Free;
|
||||
end;
|
||||
|
||||
procedure TIDEOptionsDialog.WriteAll;
|
||||
|
Loading…
Reference in New Issue
Block a user