mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 21:30:23 +02:00
IDE: Remove SourceFileMgr singleton. Change its methods into global functions which they logically are. No functional changes.
git-svn-id: trunk@58963 -
This commit is contained in:
parent
2cfe697409
commit
af2a77e682
138
ide/main.pp
138
ide/main.pp
@ -741,8 +741,6 @@ type
|
|||||||
function DoNewFile(NewFileDescriptor: TProjectFileDescriptor;
|
function DoNewFile(NewFileDescriptor: TProjectFileDescriptor;
|
||||||
var NewFilename: string; NewSource: string;
|
var NewFilename: string; NewSource: string;
|
||||||
NewFlags: TNewFlags; NewOwner: TObject): TModalResult; override;
|
NewFlags: TNewFlags; NewOwner: TObject): TModalResult; override;
|
||||||
procedure CreateFileDialogFilterForSourceEditorFiles(Filter: string;
|
|
||||||
out AllEditorMask, AllMask: string);
|
|
||||||
|
|
||||||
function DoSaveEditorFile(AEditor: TSourceEditorInterface;
|
function DoSaveEditorFile(AEditor: TSourceEditorInterface;
|
||||||
Flags: TSaveFlags): TModalResult; override;
|
Flags: TSaveFlags): TModalResult; override;
|
||||||
@ -750,7 +748,7 @@ type
|
|||||||
Flags: TSaveFlags): TModalResult; override;
|
Flags: TSaveFlags): TModalResult; override;
|
||||||
|
|
||||||
function DoCloseEditorFile(AEditor: TSourceEditorInterface;
|
function DoCloseEditorFile(AEditor: TSourceEditorInterface;
|
||||||
Flags: TCloseFlags):TModalResult; override;
|
Flags: TCloseFlags): TModalResult; override;
|
||||||
function DoCloseEditorFile(const Filename: string;
|
function DoCloseEditorFile(const Filename: string;
|
||||||
Flags: TCloseFlags): TModalResult; override;
|
Flags: TCloseFlags): TModalResult; override;
|
||||||
|
|
||||||
@ -806,8 +804,6 @@ type
|
|||||||
function DoPublishProject(Flags: TSaveFlags;
|
function DoPublishProject(Flags: TSaveFlags;
|
||||||
ShowDialog: boolean): TModalResult; override;
|
ShowDialog: boolean): TModalResult; override;
|
||||||
procedure DoShowProjectInspector(State: TIWGetFormState = iwgfShowOnTop); override;
|
procedure DoShowProjectInspector(State: TIWGetFormState = iwgfShowOnTop); override;
|
||||||
function DoAddActiveUnitToProject: TModalResult;
|
|
||||||
function DoRemoveFromProjectDialog: TModalResult;
|
|
||||||
function DoWarnAmbiguousFiles: TModalResult;
|
function DoWarnAmbiguousFiles: TModalResult;
|
||||||
function DoSaveForBuild(AReason: TCompileReason): TModalResult; override;
|
function DoSaveForBuild(AReason: TCompileReason): TModalResult; override;
|
||||||
function DoBuildProject(const AReason: TCompileReason;
|
function DoBuildProject(const AReason: TCompileReason;
|
||||||
@ -2083,7 +2079,7 @@ begin
|
|||||||
if PkgBoss.DoCloseAllPackageEditors<>mrOk then exit;
|
if PkgBoss.DoCloseAllPackageEditors<>mrOk then exit;
|
||||||
|
|
||||||
// save project
|
// save project
|
||||||
if SourceFileMgr.AskSaveProject(lisDoYouStillWantToQuit,lisDiscardChangesAndQuit)<>mrOk then
|
if AskSaveProject(lisDoYouStillWantToQuit,lisDiscardChangesAndQuit)<>mrOk then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
CanClose:=(DoCloseProject <> mrAbort);
|
CanClose:=(DoCloseProject <> mrAbort);
|
||||||
@ -2931,7 +2927,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Category:=NewIDEItems.FindByName(FileDescGroupName);
|
Category:=NewIDEItems.FindByName(FileDescGroupName);
|
||||||
Template:=Category.FindTemplateByName(EnvironmentOptions.NewUnitTemplate);
|
Template:=Category.FindTemplateByName(EnvironmentOptions.NewUnitTemplate);
|
||||||
SourceFileMgr.NewUnitOrForm(Template, FileDescriptorUnit);
|
NewUnitOrForm(Template, FileDescriptorUnit);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuNewFormClicked(Sender: TObject);
|
procedure TMainIDE.mnuNewFormClicked(Sender: TObject);
|
||||||
@ -2941,12 +2937,12 @@ var
|
|||||||
begin
|
begin
|
||||||
Category:=NewIDEItems.FindByName(FileDescGroupName);
|
Category:=NewIDEItems.FindByName(FileDescGroupName);
|
||||||
Template:=Category.FindTemplateByName(EnvironmentOptions.NewFormTemplate);
|
Template:=Category.FindTemplateByName(EnvironmentOptions.NewFormTemplate);
|
||||||
SourceFileMgr.NewUnitOrForm(Template, FileDescriptorForm);
|
NewUnitOrForm(Template, FileDescriptorForm);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuNewOtherClicked(Sender: TObject);
|
procedure TMainIDE.mnuNewOtherClicked(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
SourceFileMgr.NewOther;
|
NewOther;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuOpenClicked(Sender: TObject);
|
procedure TMainIDE.mnuOpenClicked(Sender: TObject);
|
||||||
@ -3132,7 +3128,7 @@ end;
|
|||||||
|
|
||||||
procedure TMainIDE.mnuCloseAllClicked(Sender: TObject);
|
procedure TMainIDE.mnuCloseAllClicked(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
SourceFileMgr.CloseAll;
|
CloseAll;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuCleanDirectoryClicked(Sender: TObject);
|
procedure TMainIDE.mnuCleanDirectoryClicked(Sender: TObject);
|
||||||
@ -3162,7 +3158,7 @@ begin
|
|||||||
PageIndex := SrcNoteBook.PageIndex;
|
PageIndex := SrcNoteBook.PageIndex;
|
||||||
end;
|
end;
|
||||||
// Close all but the active editor
|
// Close all but the active editor
|
||||||
SourceFileMgr.InvertedFileClose(PageIndex, SrcNoteBook);
|
InvertedFileClose(PageIndex, SrcNoteBook);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
mnuCloseClicked(Sender); // close only the clicked source editor
|
mnuCloseClicked(Sender); // close only the clicked source editor
|
||||||
@ -4009,7 +4005,7 @@ end;
|
|||||||
|
|
||||||
procedure TMainIDE.mnuNewProjectFromFileClicked(Sender: TObject);
|
procedure TMainIDE.mnuNewProjectFromFileClicked(Sender: TObject);
|
||||||
Begin
|
Begin
|
||||||
SourceFileMgr.NewProjectFromFile;
|
NewProjectFromFile;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuOpenProjectClicked(Sender: TObject);
|
procedure TMainIDE.mnuOpenProjectClicked(Sender: TObject);
|
||||||
@ -4019,7 +4015,7 @@ begin
|
|||||||
MenuItem := nil;
|
MenuItem := nil;
|
||||||
if Sender is TIDEMenuItem then
|
if Sender is TIDEMenuItem then
|
||||||
MenuItem := TIDEMenuItem(Sender);
|
MenuItem := TIDEMenuItem(Sender);
|
||||||
SourceFileMgr.OpenProject(MenuItem);
|
OpenProject(MenuItem);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuCloseProjectClicked(Sender: TObject);
|
procedure TMainIDE.mnuCloseProjectClicked(Sender: TObject);
|
||||||
@ -4035,7 +4031,7 @@ begin
|
|||||||
if not CloseQueryIDEWindows then exit;
|
if not CloseQueryIDEWindows then exit;
|
||||||
|
|
||||||
// check project
|
// check project
|
||||||
if SourceFileMgr.SomethingOfProjectIsModified then begin
|
if SomethingOfProjectIsModified then begin
|
||||||
DlgResult:=IDEQuestionDialog(lisProjectChanged,
|
DlgResult:=IDEQuestionDialog(lisProjectChanged,
|
||||||
Format(lisSaveChangesToProject, [Project1.GetTitleOrName]),
|
Format(lisSaveChangesToProject, [Project1.GetTitleOrName]),
|
||||||
mtConfirmation, [mrYes, lisMenuSave,
|
mtConfirmation, [mrYes, lisMenuSave,
|
||||||
@ -4128,12 +4124,12 @@ end;
|
|||||||
|
|
||||||
procedure TMainIDE.mnuAddToProjectClicked(Sender: TObject);
|
procedure TMainIDE.mnuAddToProjectClicked(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
DoAddActiveUnitToProject;
|
AddActiveUnitToProject;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuRemoveFromProjectClicked(Sender: TObject);
|
procedure TMainIDE.mnuRemoveFromProjectClicked(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
DoRemoveFromProjectDialog;
|
RemoveFromProjectDialog;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuViewProjectSourceClicked(Sender: TObject);
|
procedure TMainIDE.mnuViewProjectSourceClicked(Sender: TObject);
|
||||||
@ -4460,7 +4456,7 @@ var
|
|||||||
LFMUnitInfo: TUnitInfo;
|
LFMUnitInfo: TUnitInfo;
|
||||||
begin
|
begin
|
||||||
GetCurrentUnit(LFMSrcEdit,LFMUnitInfo);
|
GetCurrentUnit(LFMSrcEdit,LFMUnitInfo);
|
||||||
SourceFileMgr.CheckLFMInEditor(LFMUnitInfo, false);
|
CheckLFMInEditor(LFMUnitInfo, false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuToolConvertDelphiUnitClicked(Sender: TObject);
|
procedure TMainIDE.mnuToolConvertDelphiUnitClicked(Sender: TObject);
|
||||||
@ -5198,7 +5194,7 @@ end;
|
|||||||
function TMainIDE.DoOpenComponent(const UnitFilename: string;
|
function TMainIDE.DoOpenComponent(const UnitFilename: string;
|
||||||
OpenFlags: TOpenFlags; CloseFlags: TCloseFlags; out Component: TComponent): TModalResult;
|
OpenFlags: TOpenFlags; CloseFlags: TCloseFlags; out Component: TComponent): TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=SourceFileMgr.OpenComponent(UnitFilename, OpenFlags, CloseFlags, Component);
|
Result:=OpenComponent(UnitFilename, OpenFlags, CloseFlags, Component);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoFixupComponentReferences(
|
function TMainIDE.DoFixupComponentReferences(
|
||||||
@ -5372,8 +5368,7 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// load resource hidden
|
// load resource hidden
|
||||||
Result:=SourceFileMgr.LoadLFM(RefUnitInfo,LFMCode,
|
Result:=LoadLFM(RefUnitInfo,LFMCode, OpenFlags+[ofLoadHiddenResource],[]);
|
||||||
OpenFlags+[ofLoadHiddenResource],[]);
|
|
||||||
//DebugLn(['LoadDependencyHidden ',dbgsname(RefUnitInfo.Component)]);
|
//DebugLn(['LoadDependencyHidden ',dbgsname(RefUnitInfo.Component)]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -5532,7 +5527,7 @@ begin
|
|||||||
// menu items
|
// menu items
|
||||||
if UpdateSaveAll then
|
if UpdateSaveAll then
|
||||||
MainIDEBar.itmProjectSave.Enabled :=
|
MainIDEBar.itmProjectSave.Enabled :=
|
||||||
SourceFileMgr.SomethingOfProjectIsModified or ((Project1<>nil) and Project1.IsVirtual);
|
SomethingOfProjectIsModified or ((Project1<>nil) and Project1.IsVirtual);
|
||||||
MainIDEBar.itmFileSave.Enabled := ((SrcEdit<>nil) and SrcEdit.Modified)
|
MainIDEBar.itmFileSave.Enabled := ((SrcEdit<>nil) and SrcEdit.Modified)
|
||||||
or ((AnUnitInfo<>nil) and AnUnitInfo.IsVirtual);
|
or ((AnUnitInfo<>nil) and AnUnitInfo.IsVirtual);
|
||||||
MainIDEBar.itmFileExportHtml.Enabled := (SrcEdit<>nil);
|
MainIDEBar.itmFileExportHtml.Enabled := (SrcEdit<>nil);
|
||||||
@ -5599,35 +5594,28 @@ function TMainIDE.DoNewFile(NewFileDescriptor: TProjectFileDescriptor;
|
|||||||
var NewFilename: string; NewSource: string;
|
var NewFilename: string; NewSource: string;
|
||||||
NewFlags: TNewFlags; NewOwner: TObject): TModalResult;
|
NewFlags: TNewFlags; NewOwner: TObject): TModalResult;
|
||||||
begin
|
begin
|
||||||
Result := SourceFileMgr.NewFile(NewFileDescriptor, NewFilename, NewSource,
|
Result := NewFile(NewFileDescriptor, NewFilename, NewSource, NewFlags, NewOwner);
|
||||||
NewFlags, NewOwner);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TMainIDE.CreateFileDialogFilterForSourceEditorFiles(Filter: string;
|
|
||||||
out AllEditorMask, AllMask: string);
|
|
||||||
begin
|
|
||||||
SourceFileMgr.CreateFileDialogFilterForSourceEditorFiles(Filter, AllEditorMask, AllMask);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoSaveEditorFile(AEditor: TSourceEditorInterface; Flags: TSaveFlags): TModalResult;
|
function TMainIDE.DoSaveEditorFile(AEditor: TSourceEditorInterface; Flags: TSaveFlags): TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=SourceFileMgr.SaveEditorFile(AEditor, Flags);
|
Result:=SaveEditorFile(AEditor, Flags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoSaveEditorFile(const Filename: string; Flags: TSaveFlags): TModalResult;
|
function TMainIDE.DoSaveEditorFile(const Filename: string; Flags: TSaveFlags): TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=SourceFileMgr.SaveEditorFile(Filename, Flags);
|
Result:=SaveEditorFile(Filename, Flags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoCloseEditorFile(const Filename: string; Flags: TCloseFlags): TModalResult;
|
function TMainIDE.DoCloseEditorFile(const Filename: string; Flags: TCloseFlags): TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=SourceFileMgr.CloseEditorFile(Filename, Flags);
|
Result:=CloseEditorFile(Filename, Flags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoCloseEditorFile(AEditor: TSourceEditorInterface;
|
function TMainIDE.DoCloseEditorFile(AEditor: TSourceEditorInterface;
|
||||||
Flags: TCloseFlags): TModalResult;
|
Flags: TCloseFlags): TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=SourceFileMgr.CloseEditorFile(AEditor, Flags);
|
Result:=CloseEditorFile(AEditor, Flags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoSaveAll(Flags: TSaveFlags): TModalResult;
|
function TMainIDE.DoSaveAll(Flags: TSaveFlags): TModalResult;
|
||||||
@ -5736,7 +5724,7 @@ begin
|
|||||||
UnitList := TStringList.Create;
|
UnitList := TStringList.Create;
|
||||||
try
|
try
|
||||||
dummy := false;
|
dummy := false;
|
||||||
if SourceFileMgr.SelectUnitComponents(lisSelectFrame,piFrame,UnitList, false, dummy) <> mrOk
|
if SelectUnitComponents(lisSelectFrame,piFrame,UnitList, false, dummy) <> mrOk
|
||||||
then
|
then
|
||||||
exit;
|
exit;
|
||||||
for i := 0 to UnitList.Count-1 do
|
for i := 0 to UnitList.Count-1 do
|
||||||
@ -5770,8 +5758,8 @@ begin
|
|||||||
Project1.UpdateIsPartOfProjectFromMainUnit;
|
Project1.UpdateIsPartOfProjectFromMainUnit;
|
||||||
UnitList := TViewUnitEntries.Create;
|
UnitList := TViewUnitEntries.Create;
|
||||||
try
|
try
|
||||||
if SourceFileMgr.SelectProjectItems(UnitList, UseItemType[OnlyForms],
|
if SelectProjectItems(UnitList, UseItemType[OnlyForms],
|
||||||
true, MultiSelectCheckedState[OnlyForms]) = mrOk then
|
true, MultiSelectCheckedState[OnlyForms]) = mrOk then
|
||||||
begin
|
begin
|
||||||
{ This is where we check what the user selected. }
|
{ This is where we check what the user selected. }
|
||||||
AnUnitInfo := nil;
|
AnUnitInfo := nil;
|
||||||
@ -6237,8 +6225,8 @@ begin
|
|||||||
// close current project first
|
// close current project first
|
||||||
if Project1<>nil then begin
|
if Project1<>nil then begin
|
||||||
if not DoResetToolStatus([rfInteractive, rfSuccessOnTrigger]) then exit;
|
if not DoResetToolStatus([rfInteractive, rfSuccessOnTrigger]) then exit;
|
||||||
if SourceFileMgr.AskSaveProject(lisDoYouStillWantToCreateTheNewProject,
|
if AskSaveProject(lisDoYouStillWantToCreateTheNewProject,
|
||||||
lisDiscardChangesCreateNewProject)<>mrOK then exit;
|
lisDiscardChangesCreateNewProject)<>mrOK then exit;
|
||||||
GlobalDesignHook.LookupRoot:=nil;
|
GlobalDesignHook.LookupRoot:=nil;
|
||||||
Result:=DoCloseProject;
|
Result:=DoCloseProject;
|
||||||
if Result=mrAbort then exit;
|
if Result=mrAbort then exit;
|
||||||
@ -6254,7 +6242,7 @@ begin
|
|||||||
|
|
||||||
// create new project
|
// create new project
|
||||||
Project1:=CreateProjectObject(ProjectDesc,ProjectDescriptorProgram);
|
Project1:=CreateProjectObject(ProjectDesc,ProjectDescriptorProgram);
|
||||||
Result:=SourceFileMgr.InitNewProject(ProjectDesc);
|
Result:=InitNewProject(ProjectDesc);
|
||||||
|
|
||||||
{$push}{$overflowchecks off}
|
{$push}{$overflowchecks off}
|
||||||
Inc(BookmarksStamp);
|
Inc(BookmarksStamp);
|
||||||
@ -6263,12 +6251,12 @@ end;
|
|||||||
|
|
||||||
function TMainIDE.DoSaveProject(Flags: TSaveFlags):TModalResult;
|
function TMainIDE.DoSaveProject(Flags: TSaveFlags):TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=SourceFileMgr.SaveProject(Flags);
|
Result:=SaveProject(Flags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoCloseProject: TModalResult;
|
function TMainIDE.DoCloseProject: TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=SourceFileMgr.CloseProject;
|
Result:=CloseProject;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.DoNoProjectWizard(Sender: TObject);
|
procedure TMainIDE.DoNoProjectWizard(Sender: TObject);
|
||||||
@ -6291,7 +6279,7 @@ begin
|
|||||||
if not FileExistsUTF8(ARecentProject) then
|
if not FileExistsUTF8(ARecentProject) then
|
||||||
EnvironmentOptions.RemoveFromRecentProjectFiles(ARecentProject)
|
EnvironmentOptions.RemoveFromRecentProjectFiles(ARecentProject)
|
||||||
else
|
else
|
||||||
SourceFileMgr.AddRecentProjectFile(ARecentProject);
|
AddRecentProjectFile(ARecentProject);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
tpws_examples:
|
tpws_examples:
|
||||||
@ -6308,10 +6296,10 @@ function TMainIDE.DoOpenProjectFile(AFileName: string; Flags: TOpenFlags): TModa
|
|||||||
var
|
var
|
||||||
OriginalFilename: string;
|
OriginalFilename: string;
|
||||||
|
|
||||||
procedure RemoveRecentProjectFile;
|
procedure RemoveRecentPrjFile;
|
||||||
begin
|
begin
|
||||||
EnvironmentOptions.RemoveFromRecentProjectFiles(OriginalFilename);
|
EnvironmentOptions.RemoveFromRecentProjectFiles(OriginalFilename);
|
||||||
SourceFileMgr.RemoveRecentProjectFile(AFileName);
|
RemoveRecentProjectFile(AFileName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -6340,7 +6328,7 @@ begin
|
|||||||
// check if it is a directory
|
// check if it is a directory
|
||||||
if DirPathExistsCached(AFileName) then begin
|
if DirPathExistsCached(AFileName) then begin
|
||||||
debugln(['Error: (lazarus) [TMainIDE.DoOpenProjectFile] file is a directory']);
|
debugln(['Error: (lazarus) [TMainIDE.DoOpenProjectFile] file is a directory']);
|
||||||
RemoveRecentProjectFile;
|
RemoveRecentPrjFile;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -6349,7 +6337,7 @@ begin
|
|||||||
ACaption:=lisFileNotFound;
|
ACaption:=lisFileNotFound;
|
||||||
AText:=Format(lisPkgMangFileNotFound, [AFilename]);
|
AText:=Format(lisPkgMangFileNotFound, [AFilename]);
|
||||||
Result:=IDEMessageDialog(ACaption, AText, mtError, [mbAbort]);
|
Result:=IDEMessageDialog(ACaption, AText, mtError, [mbAbort]);
|
||||||
RemoveRecentProjectFile;
|
RemoveRecentPrjFile;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -6385,13 +6373,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
if ofAddToRecent in Flags then
|
if ofAddToRecent in Flags then
|
||||||
SourceFileMgr.AddRecentProjectFile(AFileName);
|
AddRecentProjectFile(AFileName);
|
||||||
|
|
||||||
if not DoResetToolStatus([rfInteractive, rfSuccessOnTrigger]) then exit;
|
if not DoResetToolStatus([rfInteractive, rfSuccessOnTrigger]) then exit;
|
||||||
|
|
||||||
// save old project
|
// save old project
|
||||||
if SourceFileMgr.AskSaveProject(lisDoYouStillWantToOpenAnotherProject,
|
if AskSaveProject(lisDoYouStillWantToOpenAnotherProject,
|
||||||
lisDiscardChangesAndOpenProject)<>mrOk then exit;
|
lisDiscardChangesAndOpenProject)<>mrOk then exit;
|
||||||
|
|
||||||
Result:=DoCloseProject;
|
Result:=DoCloseProject;
|
||||||
if Result=mrAbort then exit;
|
if Result=mrAbort then exit;
|
||||||
@ -6401,7 +6389,7 @@ begin
|
|||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoOpenProjectFile B');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoOpenProjectFile B');{$ENDIF}
|
||||||
Project1:=CreateProjectObject(ProjectDescriptorProgram,
|
Project1:=CreateProjectObject(ProjectDescriptorProgram,
|
||||||
ProjectDescriptorProgram);
|
ProjectDescriptorProgram);
|
||||||
Result:=SourceFileMgr.InitOpenedProjectFile(AFileName, Flags);
|
Result:=InitOpenedProjectFile(AFileName, Flags);
|
||||||
|
|
||||||
{$push}{$overflowchecks off}
|
{$push}{$overflowchecks off}
|
||||||
Inc(BookmarksStamp);
|
Inc(BookmarksStamp);
|
||||||
@ -6453,15 +6441,9 @@ begin
|
|||||||
IDEWindowCreators.ShowForm(ProjInspector,State=iwgfShowOnTop);
|
IDEWindowCreators.ShowForm(ProjInspector,State=iwgfShowOnTop);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoAddActiveUnitToProject: TModalResult;
|
function TMainIDE.DoAddUnitToProject(AEditor: TSourceEditorInterface): TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=SourceFileMgr.AddActiveUnitToProject;
|
Result := AddUnitToProject(AEditor);
|
||||||
end;
|
|
||||||
|
|
||||||
function TMainIDE.DoAddUnitToProject(AEditor: TSourceEditorInterface
|
|
||||||
): TModalResult;
|
|
||||||
begin
|
|
||||||
Result := SourceFileMgr.AddUnitToProject(AEditor);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.DoAddWordsToIdentCompletion(Sender: TIdentifierList;
|
procedure TMainIDE.DoAddWordsToIdentCompletion(Sender: TIdentifierList;
|
||||||
@ -6514,11 +6496,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoRemoveFromProjectDialog: TModalResult;
|
|
||||||
Begin
|
|
||||||
Result:=SourceFileMgr.RemoveFromProjectDialog;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TMainIDE.DoWarnAmbiguousFiles: TModalResult;
|
function TMainIDE.DoWarnAmbiguousFiles: TModalResult;
|
||||||
var
|
var
|
||||||
AnUnitInfo: TUnitInfo;
|
AnUnitInfo: TUnitInfo;
|
||||||
@ -6717,7 +6694,7 @@ begin
|
|||||||
|
|
||||||
// clear old error lines
|
// clear old error lines
|
||||||
SourceEditorManager.ClearErrorLines;
|
SourceEditorManager.ClearErrorLines;
|
||||||
SourceFileMgr.ArrangeSourceEditorAndMessageView(false);
|
ArrangeSourceEditorAndMessageView(false);
|
||||||
|
|
||||||
// check common mistakes in search paths
|
// check common mistakes in search paths
|
||||||
Result:=PkgBoss.CheckUserSearchPaths(Project1.CompilerOptions);
|
Result:=PkgBoss.CheckUserSearchPaths(Project1.CompilerOptions);
|
||||||
@ -7572,7 +7549,7 @@ begin
|
|||||||
|
|
||||||
// clear old error lines
|
// clear old error lines
|
||||||
SourceEditorManager.ClearErrorLines;
|
SourceEditorManager.ClearErrorLines;
|
||||||
SourceFileMgr.ArrangeSourceEditorAndMessageView(false);
|
ArrangeSourceEditorAndMessageView(false);
|
||||||
|
|
||||||
Result:=DoSaveAll([sfDoNotSaveVirtualFiles]);
|
Result:=DoSaveAll([sfDoNotSaveVirtualFiles]);
|
||||||
if Result<>mrOk then begin
|
if Result<>mrOk then begin
|
||||||
@ -8225,7 +8202,7 @@ begin
|
|||||||
if CodeToolBoss.CheckSyntax(ActiveUnitInfo.Source,NewCode,NewX,NewY,
|
if CodeToolBoss.CheckSyntax(ActiveUnitInfo.Source,NewCode,NewX,NewY,
|
||||||
NewTopLine,ErrorMsg) then
|
NewTopLine,ErrorMsg) then
|
||||||
begin
|
begin
|
||||||
SourceFileMgr.ArrangeSourceEditorAndMessageView(false);
|
ArrangeSourceEditorAndMessageView(false);
|
||||||
MessagesView.ClearCustomMessages;
|
MessagesView.ClearCustomMessages;
|
||||||
MessagesView.AddCustomMessage(mluImportant,lisMenuQuickSyntaxCheckOk);
|
MessagesView.AddCustomMessage(mluImportant,lisMenuQuickSyntaxCheckOk);
|
||||||
end else begin
|
end else begin
|
||||||
@ -8576,7 +8553,7 @@ begin
|
|||||||
while AnUnitInfo<>nil do begin
|
while AnUnitInfo<>nil do begin
|
||||||
NextUnitInfo:=AnUnitInfo.NextUnitWithComponent;
|
NextUnitInfo:=AnUnitInfo.NextUnitWithComponent;
|
||||||
if not AnUnitInfo.NeedsSaveToDisk then
|
if not AnUnitInfo.NeedsSaveToDisk then
|
||||||
SourceFileMgr.CloseUnitComponent(AnUnitInfo,[]);
|
CloseUnitComponent(AnUnitInfo,[]);
|
||||||
AnUnitInfo:=NextUnitInfo;
|
AnUnitInfo:=NextUnitInfo;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -9112,7 +9089,7 @@ end;
|
|||||||
function TMainIDE.FindUnitFile(const AFilename: string; TheOwner: TObject;
|
function TMainIDE.FindUnitFile(const AFilename: string; TheOwner: TObject;
|
||||||
Flags: TFindUnitFileFlags): string;
|
Flags: TFindUnitFileFlags): string;
|
||||||
begin
|
begin
|
||||||
Result:=SourceFileMgr.FindUnitFile(AFilename, TheOwner, Flags);
|
Result:=FindUnitFileImpl(AFilename, TheOwner, Flags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -9133,7 +9110,7 @@ end;
|
|||||||
function TMainIDE.FindSourceFile(const AFilename, BaseDirectory: string;
|
function TMainIDE.FindSourceFile(const AFilename, BaseDirectory: string;
|
||||||
Flags: TFindSourceFlags): string;
|
Flags: TFindSourceFlags): string;
|
||||||
begin
|
begin
|
||||||
Result:=SourceFileMgr.FindSourceFile(AFilename, BaseDirectory, Flags);
|
Result:=FindSourceFileImpl(AFilename, BaseDirectory, Flags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -9829,13 +9806,12 @@ end;
|
|||||||
function TMainIDE.SaveSourceEditorChangesToCodeCache(AEditor: TSourceEditorInterface): boolean;
|
function TMainIDE.SaveSourceEditorChangesToCodeCache(AEditor: TSourceEditorInterface): boolean;
|
||||||
// save all open sources to code tools cache
|
// save all open sources to code tools cache
|
||||||
begin
|
begin
|
||||||
Result:=SourceFileMgr.SaveSourceEditorChangesToCodeCache(AEditor);
|
Result:=SaveEditorChangesToCodeCache(AEditor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.FindUnitsOfOwner(TheOwner: TObject;
|
function TMainIDE.FindUnitsOfOwner(TheOwner: TObject; Flags: TFindUnitsOfOwnerFlags): TStrings;
|
||||||
Flags: TFindUnitsOfOwnerFlags): TStrings;
|
|
||||||
begin
|
begin
|
||||||
Result:=SourceFileMgr.FindUnitsOfOwner(TheOwner,Flags);
|
Result:=FindUnitsOfOwnerImpl(TheOwner,Flags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoJumpToSourcePosition(const Filename: string; NewX, NewY,
|
function TMainIDE.DoJumpToSourcePosition(const Filename: string; NewX, NewY,
|
||||||
@ -9911,7 +9887,7 @@ begin
|
|||||||
Result:=DoOpenEditorFile(NewSource.Filename,-1,-1,
|
Result:=DoOpenEditorFile(NewSource.Filename,-1,-1,
|
||||||
[ofOnlyIfExists,ofRegularFile,ofDoNotLoadResource]);
|
[ofOnlyIfExists,ofRegularFile,ofDoNotLoadResource]);
|
||||||
if Result<>mrOk then begin
|
if Result<>mrOk then begin
|
||||||
SourceFileMgr.UpdateSourceNames;
|
UpdateSourceNames;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
NewSrcEdit := SourceEditorManager.ActiveEditor;
|
NewSrcEdit := SourceEditorManager.ActiveEditor;
|
||||||
@ -9956,7 +9932,7 @@ begin
|
|||||||
|
|
||||||
if jfFocusEditor in Flags then
|
if jfFocusEditor in Flags then
|
||||||
SourceEditorManager.ShowActiveWindowOnTop(True);
|
SourceEditorManager.ShowActiveWindowOnTop(True);
|
||||||
SourceFileMgr.UpdateSourceNames;
|
UpdateSourceNames;
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
finally
|
finally
|
||||||
SourceEditorManager.EndAutoFocusLock;
|
SourceEditorManager.EndAutoFocusLock;
|
||||||
@ -10087,14 +10063,14 @@ var
|
|||||||
begin
|
begin
|
||||||
if (Screen.GetCurrentModalForm<>nil) or (CodeToolBoss.ErrorMessage='') then
|
if (Screen.GetCurrentModalForm<>nil) or (CodeToolBoss.ErrorMessage='') then
|
||||||
begin
|
begin
|
||||||
SourceFileMgr.UpdateSourceNames;
|
UpdateSourceNames;
|
||||||
if ConsoleVerbosity>0 then
|
if ConsoleVerbosity>0 then
|
||||||
debugln('Note: (lazarus) TMainIDE.DoJumpToCodeToolBossError No errormessage');
|
debugln('Note: (lazarus) TMainIDE.DoJumpToCodeToolBossError No errormessage');
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
// syntax error -> show error and jump
|
// syntax error -> show error and jump
|
||||||
// show error in message view
|
// show error in message view
|
||||||
SourceFileMgr.ArrangeSourceEditorAndMessageView(false);
|
ArrangeSourceEditorAndMessageView(false);
|
||||||
DoShowCodeToolBossError;
|
DoShowCodeToolBossError;
|
||||||
|
|
||||||
// jump to error in source editor
|
// jump to error in source editor
|
||||||
@ -10131,7 +10107,7 @@ begin
|
|||||||
ActiveSrcEdit.ErrorLine:=ErrorCaret.Y;
|
ActiveSrcEdit.ErrorLine:=ErrorCaret.Y;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
SourceFileMgr.UpdateSourceNames;
|
UpdateSourceNames;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.DoFindDeclarationAtCursor;
|
procedure TMainIDE.DoFindDeclarationAtCursor;
|
||||||
@ -12097,7 +12073,7 @@ begin
|
|||||||
AnUnitInfo:=Project1.UnitInfoWithFilename(FileItem^.Name);
|
AnUnitInfo:=Project1.UnitInfoWithFilename(FileItem^.Name);
|
||||||
if AnUnitInfo=nil then continue;
|
if AnUnitInfo=nil then continue;
|
||||||
if AnUnitInfo.Component=nil then continue;
|
if AnUnitInfo.Component=nil then continue;
|
||||||
SourceFileMgr.CloseUnitComponent(AnUnitInfo,[]);
|
CloseUnitComponent(AnUnitInfo,[]);
|
||||||
end;
|
end;
|
||||||
FreeAndNil(FDesignerToBeFreed);
|
FreeAndNil(FDesignerToBeFreed);
|
||||||
end;
|
end;
|
||||||
@ -12437,7 +12413,7 @@ begin
|
|||||||
UnitInfos:=TFPList.Create;
|
UnitInfos:=TFPList.Create;
|
||||||
try
|
try
|
||||||
UnitInfos.Add(AnUnitInfo);
|
UnitInfos.Add(AnUnitInfo);
|
||||||
Result:=SourceFileMgr.RemoveFilesFromProject(UnitInfos);
|
Result:=RemoveFilesFromProject(UnitInfos);
|
||||||
finally
|
finally
|
||||||
UnitInfos.Free;
|
UnitInfos.Free;
|
||||||
end;
|
end;
|
||||||
@ -12573,7 +12549,7 @@ begin
|
|||||||
if ((Result=nil) or (Result.Designer=nil)) and LoadForm
|
if ((Result=nil) or (Result.Designer=nil)) and LoadForm
|
||||||
and FilenameIsPascalSource(AnUnitInfo.Filename) then begin
|
and FilenameIsPascalSource(AnUnitInfo.Filename) then begin
|
||||||
//DebugLn(['TMainIDE.GetFormOfSource ',AnUnitInfo.Filename,' ',dbgsName(AnUnitInfo.Component)]);
|
//DebugLn(['TMainIDE.GetFormOfSource ',AnUnitInfo.Filename,' ',dbgsName(AnUnitInfo.Component)]);
|
||||||
SourceFileMgr.LoadLFM(AnUnitInfo,[],[]);
|
LoadLFM(AnUnitInfo,[],[]);
|
||||||
end;
|
end;
|
||||||
if (Result=nil) and (AnUnitInfo.Component<>nil) then
|
if (Result=nil) and (AnUnitInfo.Component<>nil) then
|
||||||
Result:=FormEditor1.GetDesignerForm(AnUnitInfo.Component);
|
Result:=FormEditor1.GetDesignerForm(AnUnitInfo.Component);
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user