mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 09:39:25 +02:00
SynEdit: LineMap, update all views, after new DisplayView
git-svn-id: trunk@63449 -
This commit is contained in:
parent
e6d5ca1609
commit
8fb8e98b28
@ -561,7 +561,6 @@ type
|
|||||||
FNotifyLists: Array [TSynEditNotifyReason] of TMethodList;
|
FNotifyLists: Array [TSynEditNotifyReason] of TMethodList;
|
||||||
function GetSynTextView(Index: integer): TSynEditStringsLinked;
|
function GetSynTextView(Index: integer): TSynEditStringsLinked;
|
||||||
function GetSynTextViewByClass(Index: TSynEditStringsLinkedClass): TSynEditStringsLinked;
|
function GetSynTextViewByClass(Index: TSynEditStringsLinkedClass): TSynEditStringsLinked;
|
||||||
procedure ReconnectViews;
|
|
||||||
procedure SetTextBuffer(AValue: TSynEditStringListBase);
|
procedure SetTextBuffer(AValue: TSynEditStringListBase);
|
||||||
protected
|
protected
|
||||||
procedure AddGenericHandler(AReason: TSynEditNotifyReason; AHandler: TMethod);
|
procedure AddGenericHandler(AReason: TSynEditNotifyReason; AHandler: TMethod);
|
||||||
@ -571,11 +570,13 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(ATextBuffer: TSynEditStringListBase; ATopViewChangedCallback: TNotifyEvent);
|
constructor Create(ATextBuffer: TSynEditStringListBase; ATopViewChangedCallback: TNotifyEvent);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
procedure ReconnectViews;
|
||||||
|
|
||||||
Procedure AddTextView(aTextView : TSynEditStringsLinked; AsFirst: Boolean = False);
|
Procedure AddTextView(aTextView : TSynEditStringsLinked; AsFirst: Boolean = False);
|
||||||
Procedure AddTextView(aTextView : TSynEditStringsLinked; AIndex: Integer);
|
Procedure AddTextView(aTextView : TSynEditStringsLinked; AIndex: Integer);
|
||||||
Procedure AddTextView(aTextView : TSynEditStringsLinked; AnAfter: TSynEditStringsLinked);
|
Procedure AddTextView(aTextView : TSynEditStringsLinked; AnAfter: TSynEditStringsLinked);
|
||||||
Procedure RemoveSynTextView(aTextView : TSynEditStringsLinked; aDestroy: Boolean = False);
|
Procedure RemoveSynTextView(aTextView : TSynEditStringsLinked; aDestroy: Boolean = False);
|
||||||
|
function IndexOf(aTextView : TSynEditStringsLinked): integer;
|
||||||
function Count: Integer;
|
function Count: Integer;
|
||||||
property SynTextView[Index: integer]: TSynEditStringsLinked read GetSynTextView;
|
property SynTextView[Index: integer]: TSynEditStringsLinked read GetSynTextView;
|
||||||
property SynTextViewByClass[Index: TSynEditStringsLinkedClass]: TSynEditStringsLinked read GetSynTextViewByClass;
|
property SynTextViewByClass[Index: TSynEditStringsLinkedClass]: TSynEditStringsLinked read GetSynTextViewByClass;
|
||||||
@ -2010,6 +2011,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSynTextViewsManager.IndexOf(aTextView: TSynEditStringsLinked
|
||||||
|
): integer;
|
||||||
|
begin
|
||||||
|
Result := Count - 1;
|
||||||
|
while (Result >= 0) and (aTextView <> TSynEditStringsLinked(FTextViewsList[Result])) do
|
||||||
|
dec(Result);
|
||||||
|
end;
|
||||||
|
|
||||||
function TSynTextViewsManager.Count: Integer;
|
function TSynTextViewsManager.Count: Integer;
|
||||||
begin
|
begin
|
||||||
Result := FTextViewsList.Count;
|
Result := FTextViewsList.Count;
|
||||||
|
@ -1491,6 +1491,7 @@ procedure TSynEditLineMappingView.SetDisplayView(
|
|||||||
begin
|
begin
|
||||||
FDisplayFiew.Free;
|
FDisplayFiew.Free;
|
||||||
FDisplayFiew := ADisplayView;
|
FDisplayFiew := ADisplayView;
|
||||||
|
Manager.ReconnectViews;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynEditLineMappingView.GetLengthOfLongestLine: integer;
|
function TSynEditLineMappingView.GetLengthOfLongestLine: integer;
|
||||||
|
@ -1763,12 +1763,15 @@ begin
|
|||||||
FLineMapView := TSynEditLineMappingView(TSynEdit(Editor).TextViewsManager.SynTextViewByClass[TSynEditLineMappingView]);
|
FLineMapView := TSynEditLineMappingView(TSynEdit(Editor).TextViewsManager.SynTextViewByClass[TSynEditLineMappingView]);
|
||||||
if FLineMapView = nil then begin
|
if FLineMapView = nil then begin
|
||||||
FLineMapView := TSynEditLineMappingView.Create;
|
FLineMapView := TSynEditLineMappingView.Create;
|
||||||
FLineMapView.SetDisplayView(TLazSynDisplayWordWrap.Create(FLineMapView, Self));
|
|
||||||
TSynEdit(Editor).TextViewsManager.AddTextView(FLineMapView);
|
TSynEdit(Editor).TextViewsManager.AddTextView(FLineMapView);
|
||||||
end;
|
end
|
||||||
if FLineMapView.PageMapCreator <> nil then
|
else
|
||||||
|
if (not(FLineMapView.DisplayView is TLazSynDisplayLineMapping)) or
|
||||||
|
(FLineMapView.PageMapCreator <> nil)
|
||||||
|
then
|
||||||
raise Exception.Create('Conflicting Plugin detected');
|
raise Exception.Create('Conflicting Plugin detected');
|
||||||
|
|
||||||
|
FLineMapView.SetDisplayView(TLazSynDisplayWordWrap.Create(FLineMapView, Self));
|
||||||
FLineMapView.PageMapCreator := @CreatePageMapNode;
|
FLineMapView.PageMapCreator := @CreatePageMapNode;
|
||||||
FLineMapView.WrapInfoForViewedXYProc := @GetWrapInfoForViewedXY;
|
FLineMapView.WrapInfoForViewedXYProc := @GetWrapInfoForViewedXY;
|
||||||
FLineMapView.AddLinesChangedHandler(@DoLinesChanged);
|
FLineMapView.AddLinesChangedHandler(@DoLinesChanged);
|
||||||
|
Loading…
Reference in New Issue
Block a user