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