From 8f632960a6dd61e350cda1e4426c2c13649d81fa Mon Sep 17 00:00:00 2001 From: juha Date: Tue, 20 Dec 2016 00:08:59 +0000 Subject: [PATCH] IDE: Remove SynEdit dependency from Project unit. git-svn-id: trunk@53726 - --- components/ideintf/srceditorintf.pas | 2 ++ ide/project.pp | 34 +++++++++++++++------------- ide/sourceeditor.pp | 13 +++++++++++ 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/components/ideintf/srceditorintf.pas b/components/ideintf/srceditorintf.pas index 682c03a100..8b2b18d319 100644 --- a/components/ideintf/srceditorintf.pas +++ b/components/ideintf/srceditorintf.pas @@ -120,6 +120,8 @@ type out Action: TSrcEditReplaceAction); virtual; abstract; procedure CopyToClipboard; virtual; abstract; procedure CutToClipboard; virtual; abstract; + function GetBookMark(BookMark: Integer; out X, Y: Integer): Boolean; virtual; abstract; + procedure SetBookMark(BookMark: Integer; X, Y: Integer); virtual; abstract; // screen and text position mapping function LineCount: Integer; virtual; abstract; diff --git a/ide/project.pp b/ide/project.pp index e285cb8092..a763ba19d3 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -56,8 +56,6 @@ uses // IDEIntf PropEdits, CompOptsIntf, ProjectIntf, MacroIntf, MacroDefIntf, UnitResources, PackageIntf, SrcEditorIntf, IDEOptionsIntf, IDEDialogs, LazIDEIntf, ProjPackIntf, - // SynEdit - SynEdit, // IDE CompOptsModes, ProjectResources, LazConf, W32Manifest, ProjectIcon, IDECmdLine, LazarusIDEStrConsts, CompilerOptions, @@ -80,7 +78,7 @@ type TOnChangeProjectInfoFile = procedure(TheProject: TProject) of object; TOnSaveUnitSessionInfoInfo = procedure(AUnitInfo: TUnitInfo) of object; - + TUnitInfoList = ( uilPartOfProject, uilWithEditorIndex, @@ -1721,6 +1719,7 @@ var AFilename: String; i, X, Y: Integer; s: String; + BM: TFileBookmark; begin // global data AFilename:=Filename; @@ -1765,15 +1764,16 @@ begin XMLConfig.SetDeleteValue(Path+'UsageCount/Value',RoundToInt(fUsageCount),-1); if OpenEditorInfoCount > 0 then - for i := Bookmarks.Count - 1 downto 0 do begin - if (Project.Bookmarks.BookmarkWithID(Bookmarks[i].ID) = nil) or - (Project.Bookmarks.BookmarkWithID(Bookmarks[i].ID).UnitInfo <> self) + for i := Bookmarks.Count - 1 downto 0 do + begin + BM := Bookmarks[i]; + if (Project.Bookmarks.BookmarkWithID(BM.ID) = nil) or + (Project.Bookmarks.BookmarkWithID(BM.ID).UnitInfo <> self) then Bookmarks.Delete(i) else - if TSynEdit(OpenEditorInfo[0].EditorComponent.EditorControl).GetBookMark(Bookmarks[i].ID, X{%H-}, Y{%H-}) - then - Bookmarks[i].CursorPos := Point(X, Y); + if OpenEditorInfo[0].EditorComponent.GetBookMark(BM.ID, X, Y) then + BM.CursorPos := Point(X, Y); end; FBookmarks.SaveToXMLConfig(XMLConfig,Path+'Bookmarks/'); XMLConfig.SetDeleteValue(Path+'Loaded/Value',fLoaded,false); @@ -1941,7 +1941,8 @@ end; procedure TUnitInfo.UpdatePageIndex; var HasPageIndex: Boolean; - BookmarkID, i, j: integer; + i, j: integer; + BM: TFileBookmark; begin HasPageIndex := False; i := FEditorInfoList.Count - 1; @@ -1952,17 +1953,18 @@ begin end; UpdateList(uilWithEditorIndex, HasPageIndex); - if assigned(Project1) and assigned(Project1.Bookmarks) then begin + if Assigned(Project1) and Assigned(Project1.Bookmarks) then + begin if OpenEditorInfoCount > 0 then begin inc(FSetBookmarLock); try // Adjust bookmarks - for i := Bookmarks.Count - 1 downto 0 do begin - BookmarkID := Bookmarks[i].ID; - j := Project1.Bookmarks.IndexOfID(BookmarkID); + for i := Bookmarks.Count-1 downto 0 do + begin + BM := Bookmarks[i]; + j := Project1.Bookmarks.IndexOfID(BM.ID); if (j < 0) then - TSynEdit(OpenEditorInfo[0].EditorComponent.EditorControl).SetBookMark(BookmarkID, - Bookmarks[i].CursorPos.X, Bookmarks[i].CursorPos.Y); + OpenEditorInfo[0].EditorComponent.SetBookMark(BM.ID, BM.CursorPos.X, BM.CursorPos.Y); end; finally dec(FSetBookmarLock); diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index f34deed216..cd6f2d1ce4 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -425,6 +425,8 @@ type procedure SetSelection(const AValue: string); override; procedure CopyToClipboard; override; procedure CutToClipboard; override; + function GetBookMark(BookMark: Integer; out X, Y: Integer): Boolean; override; + procedure SetBookMark(BookMark: Integer; X, Y: Integer); override; procedure ExportAsHtml(AFileName: String); @@ -4552,6 +4554,17 @@ begin FEditor.CutToClipboard; end; +function TSourceEditor.GetBookMark(BookMark: Integer; out X, Y: Integer): Boolean; +begin + X := 0; Y := 0; + Result := FEditor.GetBookMark(BookMark, X, Y); +end; + +procedure TSourceEditor.SetBookMark(BookMark: Integer; X, Y: Integer); +begin + FEditor.SetBookMark(BookMark, X, Y); +end; + procedure TSourceEditor.ExportAsHtml(AFileName: String); var Html: TSynExporterHTML;