mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-20 19:39:29 +01:00
SynEdit: remove circular dependency between SynEdit and SynGutterMarks
git-svn-id: trunk@64491 -
This commit is contained in:
parent
31541c7ab1
commit
a38a50b397
@ -525,7 +525,6 @@ type
|
||||
FMouseDownShift: TShiftState;
|
||||
FConfirmMouseDownMatchAct: TSynEditMouseAction;
|
||||
FConfirmMouseDownMatchFound: Boolean;
|
||||
fBookMarkOpt: TSynBookMarkOpt;
|
||||
FMouseWheelAccumulator, FMouseWheelLinesAccumulator: Array [Boolean] of integer;
|
||||
fOverwriteCaret: TSynEditCaretType;
|
||||
fInsertCaret: TSynEditCaretType;
|
||||
@ -614,7 +613,6 @@ type
|
||||
aCaretMode: TSynCaretAdjustMode; const AValue: String);
|
||||
procedure SetVisibleSpecialChars(AValue: TSynVisibleSpecialChars);
|
||||
procedure SurrenderPrimarySelection;
|
||||
procedure BookMarkOptionsChanged(Sender: TObject);
|
||||
procedure ComputeCaret(X, Y: Integer);
|
||||
procedure DoBlockIndent;
|
||||
procedure DoBlockUnindent;
|
||||
@ -1150,7 +1148,6 @@ type
|
||||
property HiddenCodeLineColor: TSynSelectedColor read GetHiddenCodeLineColor write SetHiddenCodeLineColor;
|
||||
|
||||
property Beautifier: TSynCustomBeautifier read fBeautifier write SetBeautifier;
|
||||
property BookMarkOptions: TSynBookMarkOpt read fBookMarkOpt write fBookMarkOpt;
|
||||
property BlockIndent: integer read FBlockIndent write SetBlockIndent default 2;
|
||||
property BlockTabIndent: integer read FBlockTabIndent write SetBlockTabIndent default 0;
|
||||
property Highlighter: TSynCustomHighlighter read fHighlighter write SetHighlighter;
|
||||
@ -2280,8 +2277,6 @@ begin
|
||||
{$ENDIF} // WithSynExperimentalCharWidth
|
||||
FPaintLineColor := TSynSelectedColor.Create;
|
||||
FPaintLineColor2 := TSynSelectedColor.Create;
|
||||
fBookMarkOpt := TSynBookMarkOpt.Create(Self);
|
||||
fBookMarkOpt.OnChange := @BookMarkOptionsChanged;
|
||||
|
||||
FLeftGutter := CreateGutter(self, gsLeft, FTextDrawer);
|
||||
FLeftGutter.RegisterChangeHandler(@GutterChanged);
|
||||
@ -2673,7 +2668,6 @@ begin
|
||||
FreeAndNil(FImeHandler);
|
||||
{$ENDIF}
|
||||
FreeAndNil(fMarkupManager);
|
||||
FreeAndNil(fBookMarkOpt);
|
||||
FreeAndNil(fKeyStrokes);
|
||||
FreeAndNil(FMouseActionSearchHandlerList);
|
||||
FreeAndNil(FMouseActionExecHandlerList);
|
||||
@ -6251,7 +6245,7 @@ begin
|
||||
ImageIndex := Bookmark;
|
||||
BookmarkNumber := Bookmark;
|
||||
Visible := true;
|
||||
InternalImage := (fBookMarkOpt.BookmarkImages = nil);
|
||||
InternalImage := (BookMarkOptions.BookmarkImages = nil);
|
||||
end;
|
||||
for i := 0 to 9 do
|
||||
if assigned(fBookMarks[i]) and (fBookMarks[i].Line = Y) then
|
||||
@ -6460,9 +6454,9 @@ begin
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
if (fBookmarkOpt <> nil) then
|
||||
if (AComponent = fBookmarkOpt.BookmarkImages) then begin
|
||||
fBookmarkOpt.BookmarkImages := nil;
|
||||
if (BookMarkOptions <> nil) then
|
||||
if (AComponent = BookMarkOptions.BookmarkImages) then begin
|
||||
BookMarkOptions.BookmarkImages := nil;
|
||||
InvalidateGutterLines(-1, -1);
|
||||
end;
|
||||
end;
|
||||
@ -8194,11 +8188,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.BookMarkOptionsChanged(Sender: TObject);
|
||||
begin
|
||||
InvalidateGutter;
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.SetOptions(Value: TSynEditorOptions);
|
||||
var
|
||||
ChangedOptions: TSynEditorOptions;
|
||||
|
||||
@ -88,8 +88,6 @@ type
|
||||
|
||||
TSynUndoRedoItemEvent = function (Caller: TObject; Item: TSynEditUndoItem): Boolean of object;
|
||||
|
||||
TSynSelectedColor = class;
|
||||
|
||||
{ TSynWordBreaker }
|
||||
|
||||
TSynWordBreaker = class
|
||||
@ -132,6 +130,8 @@ type
|
||||
end;
|
||||
|
||||
TLazSynSurface = class;
|
||||
TSynSelectedColor = class;
|
||||
TSynBookMarkOpt = class;
|
||||
|
||||
{ TSynEditBase }
|
||||
|
||||
@ -140,6 +140,8 @@ type
|
||||
FMouseOptions: TSynEditorMouseOptions;
|
||||
fReadOnly: Boolean;
|
||||
fHideSelection: boolean;
|
||||
fBookMarkOpt: TSynBookMarkOpt;
|
||||
procedure BookMarkOptionsChanged(Sender: TObject);
|
||||
procedure SetHideSelection(Value: boolean);
|
||||
protected
|
||||
FWordBreaker: TSynWordBreaker;
|
||||
@ -222,6 +224,7 @@ type
|
||||
property WordBreaker: TSynWordBreaker read FWordBreaker;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
function FindGutterFromGutterPartList(const APartList: TObject): TObject; virtual; abstract;
|
||||
public
|
||||
@ -321,6 +324,7 @@ type
|
||||
Index, PhysicalPos: integer): integer; virtual; abstract;
|
||||
function PhysicalLineLength(Line: String; Index: integer): integer; virtual; abstract;
|
||||
public
|
||||
property BookMarkOptions: TSynBookMarkOpt read fBookMarkOpt write fBookMarkOpt; // ToDo: check "write fBookMarkOpt"
|
||||
property ExtraCharSpacing: integer read GetExtraCharSpacing write SetExtraCharSpacing default 0;
|
||||
property ExtraLineSpacing: integer read GetExtraLineSpacing write SetExtraLineSpacing default 0;
|
||||
property Lines: TStrings read GetLines write SetLines;
|
||||
@ -874,6 +878,20 @@ begin
|
||||
inherited Create(AOwner);
|
||||
|
||||
FMouseOptions := SYNEDIT_DEFAULT_MOUSE_OPTIONS;
|
||||
fBookMarkOpt := TSynBookMarkOpt.Create(Self);
|
||||
fBookMarkOpt.OnChange := @BookMarkOptionsChanged;
|
||||
end;
|
||||
|
||||
procedure TSynEditBase.BookMarkOptionsChanged(Sender: TObject);
|
||||
begin
|
||||
InvalidateGutter;
|
||||
end;
|
||||
|
||||
destructor TSynEditBase.Destroy;
|
||||
begin
|
||||
FreeAndNil(fBookMarkOpt);
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TSynEditBase.GetReadOnly: boolean;
|
||||
|
||||
@ -43,9 +43,6 @@ type
|
||||
end;
|
||||
|
||||
implementation
|
||||
uses
|
||||
SynEdit;
|
||||
|
||||
|
||||
{ TSynGutterMarks }
|
||||
|
||||
@ -60,7 +57,7 @@ end;
|
||||
procedure TSynGutterMarks.Init;
|
||||
begin
|
||||
inherited Init;
|
||||
FBookMarkOpt := TCustomSynEdit(SynEdit).BookMarkOptions;
|
||||
FBookMarkOpt := SynEdit.BookMarkOptions;
|
||||
end;
|
||||
|
||||
function TSynGutterMarks.PreferedWidth: Integer;
|
||||
@ -155,9 +152,9 @@ begin
|
||||
j := ViewedTextBuffer.DisplayView.ViewToTextIndexEx(aScreenLine, iRange);
|
||||
if aScreenLine <> iRange.Top then
|
||||
exit;
|
||||
if (j < 0) or (j >= TCustomSynEdit(SynEdit).Lines.Count) then
|
||||
if (j < 0) or (j >= SynEdit.Lines.Count) then
|
||||
exit;
|
||||
MLine := TCustomSynEdit(SynEdit).Marks.Line[j + 1];
|
||||
MLine := (SynEdit.Marks as TSynEditMarkList).Line[j + 1];
|
||||
if MLine = nil then
|
||||
exit;
|
||||
|
||||
@ -166,7 +163,7 @@ begin
|
||||
else
|
||||
MLine.Sort(smsoBookMarkLast, smsoPriority);
|
||||
|
||||
LineHeight := TCustomSynEdit(SynEdit).LineHeight;
|
||||
LineHeight := SynEdit.LineHeight;
|
||||
//Gutter.Paint always supplies AClip.Left = GutterPart.Left
|
||||
lm := LeftMarginAtCurrentPPI;
|
||||
MarkRect := Rect(AClip.Left + lm,
|
||||
@ -239,7 +236,7 @@ begin
|
||||
rcLine.Bottom := rcLine.Top;
|
||||
if FBookMarkOpt.GlyphsVisible and (LastLine >= FirstLine) then
|
||||
begin
|
||||
LineHeight := TCustomSynEdit(SynEdit).LineHeight;
|
||||
LineHeight := SynEdit.LineHeight;
|
||||
for i := FirstLine to LastLine do begin
|
||||
rcLine.Top := rcLine.Bottom;
|
||||
rcLine.Bottom := Min(AClip.Bottom, rcLine.Top + LineHeight);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user