diff --git a/ide/debugmanager.pas b/ide/debugmanager.pas index 0100ccb485..c9a8431e09 100644 --- a/ide/debugmanager.pas +++ b/ide/debugmanager.pas @@ -2067,7 +2067,7 @@ var SrcFilename: String; begin if (AnUnitInfo.EditorIndex < 0) or Destroying then exit; - ASrcEdit := SourceNotebook.FindSourceEditorWithPageIndex(AnUnitInfo.EditorIndex); + ASrcEdit := TSourceEditor(AnUnitInfo.EditorComponent); // set breakpoints for this unit SrcFilename:=AnUnitInfo.Filename; for i := 0 to FBreakpoints.Count-1 do diff --git a/ide/main.pp b/ide/main.pp index 5bbc4d04bd..a897a6b1d7 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -852,7 +852,6 @@ type var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo); override; procedure GetUnitWithPersistent(APersistent: TPersistent; var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo); override; - function GetSourceEditorForUnitInfo(AnUnitInfo: TUnitInfo): TSourceEditor; override; function CreateSrcEditPageName(const AnUnitName, AFilename: string; IgnorePageIndex: integer): string; function GetAncestorUnit(AnUnitInfo: TUnitInfo): TUnitInfo; @@ -4773,7 +4772,7 @@ var IsPascal: Boolean; begin if AnUnitInfo<>nil then - SrcEdit:=GetSourceEditorForUnitInfo(AnUnitInfo) + SrcEdit := TSourceEditor(AnUnitInfo.EditorComponent) else SrcEdit:=nil; //debugln('TMainIDE.DoShowSaveFileAsDialog ',AnUnitInfo.Filename); @@ -5363,7 +5362,7 @@ begin OldFilename:=AnUnitInfo.Filename; OldFilePath:=ExtractFilePath(OldFilename); OldLFMFilename:=ChangeFileExt(OldFilename,'.lfm'); - SrcEdit:=GetSourceEditorForUnitInfo(AnUnitInfo); + SrcEdit := TSourceEditor(AnUnitInfo.EditorComponent); if NewUnitName='' then NewUnitName:=AnUnitInfo.Unit_Name; debugln(['TMainIDE.DoRenameUnit ',AnUnitInfo.Filename,' NewUnitName=',NewUnitName,' OldUnitName=',AnUnitInfo.Unit_Name,' ResourceCode=',ResourceCode<>nil,' NewFilename="',NewFilename,'"']); @@ -5811,7 +5810,7 @@ begin for BookmarkID:=0 to 9 do begin i:=Project1.Bookmarks.IndexOfID(BookmarkID); if i<0 then continue; - if (Project1.Bookmarks[i].EditorIndex=AnUnitInfo.EditorIndex) then begin + if (Project1.Bookmarks[i].EditorComponent=AnUnitInfo.EditorComponent) then begin //writeln('TMainIDE.DoRestoreBookMarks ',BookmarkID,' ', // Project1.Bookmarks[i].CursorPos.X,' ',Project1.Bookmarks[i].CursorPos.Y); ASrcEdit.EditorComponent.SetBookmark(BookmarkID, @@ -7196,8 +7195,7 @@ begin if Project1.MainUnitID>=0 then begin MainUnitInfo:=Project1.MainUnitInfo; if MainUnitInfo.Loaded then begin - MainUnitSrcEdit:=SourceNoteBook.FindSourceEditorWithPageIndex( - MainUnitInfo.EditorIndex); + MainUnitSrcEdit := TSourceEditor(MainUnitInfo.EditorComponent); if (MainUnitSrcEdit<>nil) and UpdateModified and MainUnitSrcEdit.Modified then begin MainUnitSrcEdit.UpdateCodeBuffer; @@ -7213,9 +7211,8 @@ var BookmarkID, BookmarkX, BookmarkY: integer; ASrcEdit: TSourceEditor; begin - Project1.Bookmarks.DeleteAllWithEditorIndex(AnUnitInfo.EditorIndex); - ASrcEdit:= - SourceNoteBook.FindSourceEditorWithPageIndex(AnUnitInfo.EditorIndex); + Project1.Bookmarks.DeleteAllWithEditorComponent(AnUnitInfo.EditorComponent); + ASrcEdit := TSourceEditor(AnUnitInfo.EditorComponent); if ASrcEdit=nil then exit; AnUnitInfo.TopLine:=ASrcEdit.EditorComponent.TopLine; AnUnitInfo.CursorPos:=ASrcEdit.EditorComponent.CaretXY; @@ -11467,8 +11464,7 @@ begin ActiveUnitInfo:=Project1.FirstUnitWithComponent; while ActiveUnitInfo<>nil do begin if ActiveUnitInfo.Component=APersistent then begin - ActiveSourceEditor:=SourceNoteBook.FindSourceEditorWithPageIndex( - ActiveUnitInfo.EditorIndex); + ActiveSourceEditor := TSourceEditor(ActiveUnitInfo.EditorComponent); exit; end; ActiveUnitInfo:=ActiveUnitInfo.NextUnitWithComponent; @@ -11478,12 +11474,6 @@ begin ActiveUnitInfo:=nil; end; -function TMainIDE.GetSourceEditorForUnitInfo(AnUnitInfo: TUnitInfo - ): TSourceEditor; -begin - Result:=SourceNoteBook.FindSourceEditorWithPageIndex(AnUnitInfo.EditorIndex); -end; - function TMainIDE.DoLoadMemoryStreamFromFile(MemStream: TMemoryStream; const AFilename:string): TModalResult; var FileStream: TFileStream; @@ -12705,7 +12695,7 @@ begin AnUnitInfo.Modified := True; if AnUnitInfo.Loaded then begin - SrcEdit := SourceNotebook.FindSourceEditorWithPageIndex(AnUnitInfo.EditorIndex); + SrcEdit := TSourceEditor(AnUnitInfo.EditorComponent); if SrcEdit <> nil then begin SrcEdit.Modified := True; diff --git a/ide/mainbase.pas b/ide/mainbase.pas index 877c4111a7..6384a6952b 100644 --- a/ide/mainbase.pas +++ b/ide/mainbase.pas @@ -153,7 +153,6 @@ type var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo); virtual; abstract; procedure GetUnitWithPersistent(APersistent: TPersistent; var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo); virtual; abstract; - function GetSourceEditorForUnitInfo(AnUnitInfo: TUnitInfo): TSourceEditor; virtual; abstract; function DoOpenMacroFile(Sender: TObject; const AFilename: string ): TModalResult; override; diff --git a/ide/project.pp b/ide/project.pp index 9424116c97..2a84f1d763 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -683,7 +683,6 @@ type procedure RemoveFromList(AnUnitInfo: TUnitInfo; ListType: TUnitInfoList); procedure AddToOrRemoveFromAutoRevertLockedList(AnUnitInfo: TUnitInfo); - procedure AddToOrRemoveFromEditorWithIndexList(AnUnitInfo: TUnitInfo); procedure AddToOrRemoveFromComponentList(AnUnitInfo: TUnitInfo); procedure AddToOrRemoveFromLoadedList(AnUnitInfo: TUnitInfo); procedure AddToOrRemoveFromPartOfProjectList(AnUnitInfo: TUnitInfo); @@ -2783,8 +2782,8 @@ begin end; // delete bookmarks of this unit - if OldUnitInfo.EditorIndex>=0 then - Bookmarks.DeleteAllWithEditorIndex(OldUnitInfo.EditorIndex); + if OldUnitInfo.EditorComponent <> nil then + Bookmarks.DeleteAllWithEditorComponent(OldUnitInfo.EditorComponent); // adjust MainUnit if MainUnitID>=Index then dec(fMainUnitID); @@ -3292,15 +3291,6 @@ begin while (Result>=0) and (Units[Result]<>AUnitInfo) do dec(Result); end; -procedure TProject.AddToOrRemoveFromEditorWithIndexList(AnUnitInfo: TUnitInfo); -begin - if AnUnitInfo.EditorIndex<0 then begin - RemoveFromList(AnUnitInfo,uilWithEditorIndex); - end else begin - AddToList(AnUnitInfo,uilWithEditorIndex); - end; -end; - procedure TProject.AddToOrRemoveFromComponentList(AnUnitInfo: TUnitInfo); begin if AnUnitInfo.Component=nil then begin @@ -3657,7 +3647,7 @@ var UnitMark: TFileBookmark; ProjectMark: TProjectBookmark; begin - if AnUnitInfo.EditorIndex<0 then exit; + if AnUnitInfo.EditorComponent = nil then exit; for i:=0 to AnUnitInfo.Bookmarks.Count-1 do begin UnitMark:=AnUnitInfo.Bookmarks[i]; ProjectMark:=Bookmarks.BookmarkWithIndex(UnitMark.ID); @@ -4353,7 +4343,7 @@ function TProject.JumpHistoryCheckPosition( var i: integer; begin i:=IndexOfFilename(APosition.Filename); - Result:=(i>=0) and (Units[i].EditorIndex>=0); + Result:=(i>=0) and (Units[i].EditorComponent <> nil); end; function TProject.SomethingModified(CheckData, CheckSession: boolean): boolean; @@ -4642,7 +4632,7 @@ begin Result:=UnitCount-1; while (Result>=0) do begin if (pfsfOnlyEditorFiles in SearchFlags) - and (Units[Result].EditorIndex<0) then begin + and (Units[Result].EditorComponent = nil) then begin dec(Result); continue; end; diff --git a/ide/projectdefs.pas b/ide/projectdefs.pas index a754c98e17..865e3c9443 100644 --- a/ide/projectdefs.pas +++ b/ide/projectdefs.pas @@ -205,8 +205,8 @@ type procedure DeleteAllWithEditorComponent(AEditor:TSourceEditorInterface); function IndexOfID(ID:integer):integer; function BookmarkWithIndex(ID: integer): TProjectBookmark; - procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); - procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string); + procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); deprecated 'Does not link to Editorcomponent'; + procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string); deprecated 'Does not link to Editorcomponent'; end; type