mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 09:21:35 +02:00
IDE: formatting and some comments
git-svn-id: trunk@33005 -
This commit is contained in:
parent
436d4002ce
commit
3ddecfefbe
@ -279,8 +279,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDesktopOptionsFrame.LoadDesktopSettingsFromFileButtonClick(
|
procedure TDesktopOptionsFrame.LoadDesktopSettingsFromFileButtonClick(Sender: TObject);
|
||||||
Sender: TObject);
|
|
||||||
var
|
var
|
||||||
AnEnvironmentOptions: TEnvironmentOptions;
|
AnEnvironmentOptions: TEnvironmentOptions;
|
||||||
OpenDialog: TOpenDialog;
|
OpenDialog: TOpenDialog;
|
||||||
|
@ -137,8 +137,7 @@ begin
|
|||||||
LazarusHelp.ShowHelpForIDEControl(Self);
|
LazarusHelp.ShowHelpForIDEControl(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDEOptionsDialog.IDEOptionsDialogKeyPress(Sender: TObject;
|
procedure TIDEOptionsDialog.IDEOptionsDialogKeyPress(Sender: TObject; var Key: char);
|
||||||
var Key: char);
|
|
||||||
begin
|
begin
|
||||||
debugln(['TIDEOptionsDialog.IDEOptionsDialogKeyPress ',ord(Key)]);
|
debugln(['TIDEOptionsDialog.IDEOptionsDialogKeyPress ',ord(Key)]);
|
||||||
end;
|
end;
|
||||||
@ -263,19 +262,15 @@ end;
|
|||||||
|
|
||||||
procedure TIDEOptionsDialog.ReadAll;
|
procedure TIDEOptionsDialog.ReadAll;
|
||||||
type
|
type
|
||||||
TStage = (
|
TStage = (sBefore, sRead, sAfter);
|
||||||
sBefore,
|
|
||||||
sRead,
|
|
||||||
sAfter
|
|
||||||
);
|
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
Rec: PIDEOptionsGroupRec;
|
Rec: PIDEOptionsGroupRec;
|
||||||
Instance: TAbstractIDEOptions;
|
Instance: TAbstractIDEOptions;
|
||||||
InstanceList: TFPList;
|
InstanceList: TFPList;
|
||||||
s: TStage;
|
stag: TStage;
|
||||||
begin
|
begin
|
||||||
for s:=low(TStage) to High(TStage) do
|
for stag:=low(TStage) to High(TStage) do
|
||||||
begin
|
begin
|
||||||
InstanceList:=TFPList.Create;
|
InstanceList:=TFPList.Create;
|
||||||
for i := 0 to IDEEditorGroups.Count - 1 do
|
for i := 0 to IDEEditorGroups.Count - 1 do
|
||||||
@ -283,27 +278,24 @@ begin
|
|||||||
Rec := IDEEditorGroups[i];
|
Rec := IDEEditorGroups[i];
|
||||||
if not PassesFilter(Rec) then
|
if not PassesFilter(Rec) then
|
||||||
Continue;
|
Continue;
|
||||||
if Rec^.Items <> nil then
|
if Assigned(Rec^.Items) and Assigned(Rec^.GroupClass) then
|
||||||
begin
|
begin
|
||||||
if Rec^.GroupClass <> nil then
|
Instance := Rec^.GroupClass.GetInstance;
|
||||||
|
if (InstanceList.IndexOf(Instance)<0) and Assigned(Instance) then
|
||||||
begin
|
begin
|
||||||
Instance := Rec^.GroupClass.GetInstance;
|
InstanceList.Add(Instance);
|
||||||
if (InstanceList.IndexOf(Instance)<0) and (Instance <> nil) then
|
case stag of
|
||||||
begin
|
sBefore:
|
||||||
InstanceList.Add(Instance);
|
Instance.DoBeforeRead;
|
||||||
case s of
|
sRead:
|
||||||
sBefore:
|
TraverseSettings(Instance,iodaRead);
|
||||||
Instance.DoBeforeRead;
|
sAfter:
|
||||||
sRead:
|
Instance.DoAfterRead;
|
||||||
TraverseSettings(Instance,iodaRead);
|
|
||||||
sAfter:
|
|
||||||
Instance.DoAfterRead;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if s=sRead then
|
if stag=sRead then
|
||||||
TraverseSettings(nil,iodaRead); // load settings that does not belong to any group
|
TraverseSettings(nil,iodaRead); // load settings that does not belong to any group
|
||||||
InstanceList.Free;
|
InstanceList.Free;
|
||||||
end;
|
end;
|
||||||
@ -311,48 +303,41 @@ end;
|
|||||||
|
|
||||||
procedure TIDEOptionsDialog.WriteAll(Restore: boolean);
|
procedure TIDEOptionsDialog.WriteAll(Restore: boolean);
|
||||||
type
|
type
|
||||||
TStage = (
|
TStage = (sBefore, sWrite, sAfter);
|
||||||
sBefore,
|
|
||||||
sWrite,
|
|
||||||
sAfter
|
|
||||||
);
|
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
Rec: PIDEOptionsGroupRec;
|
Rec: PIDEOptionsGroupRec;
|
||||||
Instance: TAbstractIDEOptions;
|
Instance: TAbstractIDEOptions;
|
||||||
s: TStage;
|
stag: TStage;
|
||||||
begin
|
begin
|
||||||
for s:=low(TStage) to High(TStage) do
|
for stag:=low(TStage) to High(TStage) do
|
||||||
begin
|
begin
|
||||||
for i := 0 to IDEEditorGroups.Count - 1 do
|
for i := 0 to IDEEditorGroups.Count - 1 do
|
||||||
begin
|
begin
|
||||||
Rec := IDEEditorGroups[i];
|
Rec := IDEEditorGroups[i];
|
||||||
if not PassesFilter(Rec) then
|
if not PassesFilter(Rec) then
|
||||||
Continue;
|
Continue;
|
||||||
if Rec^.Items <> nil then
|
if Assigned(Rec^.Items) and Assigned(Rec^.GroupClass) then
|
||||||
begin
|
begin
|
||||||
if Rec^.GroupClass <> nil then
|
Instance := Rec^.GroupClass.GetInstance;
|
||||||
|
if Assigned(Instance) then
|
||||||
begin
|
begin
|
||||||
Instance := Rec^.GroupClass.GetInstance;
|
case stag of
|
||||||
if Instance <> nil then
|
sBefore:
|
||||||
begin
|
Instance.DoBeforeWrite(Restore);
|
||||||
case s of
|
sWrite:
|
||||||
sBefore:
|
if Restore then
|
||||||
Instance.DoBeforeWrite(Restore);
|
TraverseSettings(Instance,iodaRestore)
|
||||||
sWrite:
|
else
|
||||||
if Restore then
|
TraverseSettings(Instance,iodaWrite);
|
||||||
TraverseSettings(Instance,iodaRestore)
|
sAfter:
|
||||||
else
|
Instance.DoAfterWrite(Restore);
|
||||||
TraverseSettings(Instance,iodaWrite);
|
|
||||||
sAfter:
|
|
||||||
Instance.DoAfterWrite(Restore);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if s=sWrite then
|
if stag=sWrite then
|
||||||
TraverseSettings(nil,iodaWrite); // save settings that does not belong to any group
|
TraverseSettings(nil,iodaWrite); // save settings that does not belong to any group
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -401,13 +386,10 @@ procedure TIDEOptionsDialog.CreateEditors;
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
if Node = nil then
|
if Node = nil then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
if (Node.Data <> nil) and (TAbstractIDEOptionsEditor(Node.Data).Tag = Index) then
|
if (Node.Data <> nil) and (TAbstractIDEOptionsEditor(Node.Data).Tag = Index) then
|
||||||
Result := Node;
|
Result := Node;
|
||||||
|
|
||||||
if Result <> nil then
|
if Result <> nil then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
Result := SearchNode(Node.GetFirstChild, Index);
|
Result := SearchNode(Node.GetFirstChild, Index);
|
||||||
if Result <> nil then
|
if Result <> nil then
|
||||||
Exit;
|
Exit;
|
||||||
|
32
ide/main.pp
32
ide/main.pp
@ -4765,22 +4765,19 @@ end;
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TMainIDE.SaveDesktopSettings(TheEnvironmentOptions: TEnvironmentOptions);
|
procedure TMainIDE.SaveDesktopSettings(TheEnvironmentOptions: TEnvironmentOptions);
|
||||||
|
// Called also before reading EnvironmentOptions
|
||||||
begin
|
begin
|
||||||
IDEWindowCreators.SimpleLayoutStorage.StoreWindowPositions;
|
IDEWindowCreators.SimpleLayoutStorage.StoreWindowPositions;
|
||||||
// do not auto show the search results view
|
// do not auto show the search results view
|
||||||
IDEWindowCreators.SimpleLayoutStorage.ItemByFormID(
|
IDEWindowCreators.SimpleLayoutStorage.ItemByFormID(
|
||||||
NonModalIDEWindowNames[nmiwSearchResultsViewName]).Visible:=false;
|
NonModalIDEWindowNames[nmiwSearchResultsViewName]).Visible:=false;
|
||||||
|
|
||||||
with TheEnvironmentOptions do begin
|
TheEnvironmentOptions.ObjectInspectorOptions.Assign(ObjectInspector1);
|
||||||
ObjectInspectorOptions.Assign(ObjectInspector1);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.LoadDesktopSettings(TheEnvironmentOptions: TEnvironmentOptions);
|
procedure TMainIDE.LoadDesktopSettings(TheEnvironmentOptions: TEnvironmentOptions);
|
||||||
begin
|
begin
|
||||||
with TheEnvironmentOptions do begin
|
TheEnvironmentOptions.ObjectInspectorOptions.AssignTo(ObjectInspector1);
|
||||||
ObjectInspectorOptions.AssignTo(ObjectInspector1);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.UpdateDefaultPascalFileExtensions;
|
procedure TMainIDE.UpdateDefaultPascalFileExtensions;
|
||||||
@ -4827,7 +4824,6 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
IDEOptionsDialog := TIDEOptionsDialog.Create(nil);
|
IDEOptionsDialog := TIDEOptionsDialog.Create(nil);
|
||||||
|
|
||||||
try
|
try
|
||||||
if ACaption <> '' then
|
if ACaption <> '' then
|
||||||
IDEOptionsDialog.Caption := ACaption;
|
IDEOptionsDialog.Caption := ACaption;
|
||||||
@ -4848,13 +4844,9 @@ begin
|
|||||||
IDEOptionsDialog.OptionsFilter := OptionsFilter;
|
IDEOptionsDialog.OptionsFilter := OptionsFilter;
|
||||||
IDEOptionsDialog.Settings := ASettings;
|
IDEOptionsDialog.Settings := ASettings;
|
||||||
IDEOptionsDialog.OpenEditor(AEditor);
|
IDEOptionsDialog.OpenEditor(AEditor);
|
||||||
|
IDEOptionsDialog.OnLoadIDEOptions:=@Self.OnLoadIDEOptions;
|
||||||
with IDEOptionsDialog do
|
IDEOptionsDialog.OnSaveIDEOptions:=@Self.OnSaveIDEOptions;
|
||||||
begin
|
IDEOptionsDialog.ReadAll;
|
||||||
OnLoadIDEOptions:=@Self.OnLoadIDEOptions;
|
|
||||||
OnSaveIDEOptions:=@Self.OnSaveIDEOptions;
|
|
||||||
ReadAll;
|
|
||||||
end;
|
|
||||||
if IDEOptionsDialog.ShowModal = mrOk then begin
|
if IDEOptionsDialog.ShowModal = mrOk then begin
|
||||||
IDEOptionsDialog.WriteAll(false);
|
IDEOptionsDialog.WriteAll(false);
|
||||||
UpdateHighlighters(True);
|
UpdateHighlighters(True);
|
||||||
@ -4864,8 +4856,7 @@ begin
|
|||||||
else
|
else
|
||||||
Application.TaskBarBehavior := tbDefault;
|
Application.TaskBarBehavior := tbDefault;
|
||||||
end else begin
|
end else begin
|
||||||
// restore
|
IDEOptionsDialog.WriteAll(true); // restore
|
||||||
IDEOptionsDialog.WriteAll(true);
|
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
IDEOptionsDialog.Free;
|
IDEOptionsDialog.Free;
|
||||||
@ -4878,16 +4869,14 @@ begin
|
|||||||
SaveDesktopSettings(EnvironmentOptions);
|
SaveDesktopSettings(EnvironmentOptions);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.DoEnvironmentOptionsBeforeWrite(Sender: TObject;
|
procedure TMainIDE.DoEnvironmentOptionsBeforeWrite(Sender: TObject; Restore: boolean);
|
||||||
Restore: boolean);
|
|
||||||
begin
|
begin
|
||||||
if Restore then exit;
|
if Restore then exit;
|
||||||
OldCompilerFilename:=EnvironmentOptions.CompilerFilename;
|
OldCompilerFilename:=EnvironmentOptions.CompilerFilename;
|
||||||
OldLanguage:=EnvironmentOptions.LanguageID;
|
OldLanguage:=EnvironmentOptions.LanguageID;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.DoEnvironmentOptionsAfterWrite(Sender: TObject;
|
procedure TMainIDE.DoEnvironmentOptionsAfterWrite(Sender: TObject; Restore: boolean);
|
||||||
Restore: boolean);
|
|
||||||
var
|
var
|
||||||
MacroValueChanged,
|
MacroValueChanged,
|
||||||
FPCSrcDirChanged, FPCCompilerChanged,
|
FPCSrcDirChanged, FPCCompilerChanged,
|
||||||
@ -4998,8 +4987,7 @@ begin
|
|||||||
CodeToolsOpts.AssignTo(CodeToolBoss);
|
CodeToolsOpts.AssignTo(CodeToolBoss);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.DoCodeExplorerOptionsAfterWrite(Sender: TObject;
|
procedure TMainIDE.DoCodeExplorerOptionsAfterWrite(Sender: TObject; Restore: boolean);
|
||||||
Restore: boolean);
|
|
||||||
begin
|
begin
|
||||||
if Restore then exit;
|
if Restore then exit;
|
||||||
if CodeExplorerView<>nil then
|
if CodeExplorerView<>nil then
|
||||||
|
@ -1441,8 +1441,7 @@ begin
|
|||||||
dec(Result);
|
dec(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEWindowCreatorList.FindWithName(FormName: string
|
function TIDEWindowCreatorList.FindWithName(FormName: string): TIDEWindowCreator;
|
||||||
): TIDEWindowCreator;
|
|
||||||
var
|
var
|
||||||
i: LongInt;
|
i: LongInt;
|
||||||
begin
|
begin
|
||||||
@ -1485,15 +1484,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDEWindowCreatorList.ShowForm(AForm: TCustomForm;
|
procedure TIDEWindowCreatorList.ShowForm(AForm: TCustomForm; BringToFront: boolean);
|
||||||
BringToFront: boolean);
|
|
||||||
var
|
var
|
||||||
Layout: TSimpleWindowLayout;
|
Layout: TSimpleWindowLayout;
|
||||||
begin
|
begin
|
||||||
if (AForm.Name='') or (not IsValidIdent(AForm.Name)) then
|
if (AForm.Name='') or (not IsValidIdent(AForm.Name)) then
|
||||||
raise Exception.Create('TIDEWindowCreatorList.ShowForm invalid form name '+AForm.Name);
|
raise Exception.Create('TIDEWindowCreatorList.ShowForm invalid form name '+AForm.Name);
|
||||||
|
|
||||||
// auto create a storage for every shown form
|
// auto create a layput storage for every shown form
|
||||||
Layout:=SimpleLayoutStorage.ItemByFormID(AForm.Name);
|
Layout:=SimpleLayoutStorage.ItemByFormID(AForm.Name);
|
||||||
if Layout=nil then begin
|
if Layout=nil then begin
|
||||||
if not (csDesigning in AForm.ComponentState) then
|
if not (csDesigning in AForm.ComponentState) then
|
||||||
|
Loading…
Reference in New Issue
Block a user