mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 15:39:30 +02:00
synedit: forgotten file
git-svn-id: trunk@17626 -
This commit is contained in:
parent
3f92aa3cef
commit
0d7c9d6052
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1415,6 +1415,7 @@ components/synedit/synedittexttrimmer.pas svneol=native#text/plain
|
|||||||
components/synedit/synedittypes.pp svneol=native#text/pascal
|
components/synedit/synedittypes.pp svneol=native#text/pascal
|
||||||
components/synedit/synexporthtml.pas svneol=native#text/pascal
|
components/synedit/synexporthtml.pas svneol=native#text/pascal
|
||||||
components/synedit/syngutter.pp svneol=native#text/plain
|
components/synedit/syngutter.pp svneol=native#text/plain
|
||||||
|
components/synedit/syngutterchanges.pas svneol=native#text/pascal
|
||||||
components/synedit/synguttercodefolding.pp svneol=native#text/plain
|
components/synedit/synguttercodefolding.pp svneol=native#text/plain
|
||||||
components/synedit/syngutterlinenumber.pp svneol=native#text/plain
|
components/synedit/syngutterlinenumber.pp svneol=native#text/plain
|
||||||
components/synedit/synguttermarks.pp svneol=native#text/plain
|
components/synedit/synguttermarks.pp svneol=native#text/plain
|
||||||
|
128
components/synedit/syngutterchanges.pas
Normal file
128
components/synedit/syngutterchanges.pas
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
unit SynGutterChanges;
|
||||||
|
|
||||||
|
{$I synedit.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, Graphics, LCLType, LCLIntf, SynGutter,
|
||||||
|
SynEditMiscProcs, SynEditMiscClasses, SynTextDrawer, SynEditFoldedView;
|
||||||
|
|
||||||
|
type
|
||||||
|
{ TSynGuterChanges }
|
||||||
|
|
||||||
|
TSynGutterChanges = class(TSynGutterPartBase)
|
||||||
|
private
|
||||||
|
FEdit: TSynEditBase;
|
||||||
|
FFoldView: TSynEditFoldedView;
|
||||||
|
FMarkupInfoModifiedLine: TSynSelectedColor;
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TSynEditBase; AFoldView: TSynEditFoldedView);
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure Assign(Source: TPersistent); override;
|
||||||
|
|
||||||
|
procedure Paint(Canvas: TCanvas; AClip: TRect; FirstLine, LastLine: integer); override;
|
||||||
|
function RealGutterWidth(CharWidth: integer): integer; override;
|
||||||
|
public
|
||||||
|
property MarkupInfoModifiedLine: TSynSelectedColor read FMarkupInfoModifiedLine;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
uses
|
||||||
|
SynEdit;
|
||||||
|
|
||||||
|
{ TSynGutterChanges }
|
||||||
|
|
||||||
|
constructor TSynGutterChanges.Create(AOwner : TSynEditBase; AFoldView : TSynEditFoldedView);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FEdit := AOwner;
|
||||||
|
FFoldView := AFoldView;
|
||||||
|
|
||||||
|
FMarkupInfoModifiedLine := TSynSelectedColor.Create;
|
||||||
|
FMarkupInfoModifiedLine.Background := clNone;
|
||||||
|
FMarkupInfoModifiedLine.Foreground := clGreen;
|
||||||
|
FMarkupInfoModifiedLine.FrameColor := $00E9FC;
|
||||||
|
FMarkupInfoModifiedLine.OnChange := @DoChange;
|
||||||
|
|
||||||
|
Width := 6;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TSynGutterChanges.Destroy;
|
||||||
|
begin
|
||||||
|
FMarkupInfoModifiedLine.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSynGutterChanges.Assign(Source : TPersistent);
|
||||||
|
var
|
||||||
|
Src: TSynGutterChanges;
|
||||||
|
begin
|
||||||
|
if Assigned(Source) and (Source is TSynGutterChanges) then
|
||||||
|
begin
|
||||||
|
Src := TSynGutterChanges(Source);
|
||||||
|
FMarkupInfoModifiedLine.Assign(Src.FMarkupInfoModifiedLine);
|
||||||
|
end;
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSynGutterChanges.RealGutterWidth(CharWidth: integer): integer;
|
||||||
|
begin
|
||||||
|
if not Visible then
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if AutoSize then
|
||||||
|
Width := 6;
|
||||||
|
Result := Width;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSynGutterChanges.Paint(Canvas: TCanvas; AClip: TRect; FirstLine, LastLine: integer);
|
||||||
|
var
|
||||||
|
i, iLine: integer;
|
||||||
|
LineHeight: Integer;
|
||||||
|
rcLine: TRect;
|
||||||
|
begin
|
||||||
|
if not Visible then exit;
|
||||||
|
|
||||||
|
LineHeight := TSynEdit(FEdit).LineHeight;
|
||||||
|
|
||||||
|
if MarkupInfoModifiedLine.Background <> clNone then
|
||||||
|
begin
|
||||||
|
Canvas.Brush.Color := MarkupInfoModifiedLine.Background;
|
||||||
|
Canvas.FillRect(AClip);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Canvas.Pen.Width := Width - 2;
|
||||||
|
Canvas.Pen.EndCap:= pecFlat;
|
||||||
|
|
||||||
|
rcLine := AClip;
|
||||||
|
rcLine.Left := rcLine.Left + Width div 2;
|
||||||
|
rcLine.Bottom := FirstLine * LineHeight;
|
||||||
|
for i := FirstLine to LastLine do
|
||||||
|
begin
|
||||||
|
iLine := FFoldView.DisplayNumber[i];
|
||||||
|
// next line rect
|
||||||
|
rcLine.Top := rcLine.Bottom;
|
||||||
|
Inc(rcLine.Bottom, LineHeight);
|
||||||
|
|
||||||
|
case TCustomSynEdit(FEdit).GetLineState(iLine) of
|
||||||
|
slsNone: ;
|
||||||
|
slsSaved:
|
||||||
|
begin
|
||||||
|
Canvas.Pen.Color := MarkupInfoModifiedLine.Foreground;
|
||||||
|
Canvas.Line(rcLine.Left, rcLine.Top, rcLine.Left, rcLine.Bottom);
|
||||||
|
end;
|
||||||
|
slsUnsaved:
|
||||||
|
begin
|
||||||
|
Canvas.Pen.Color := MarkupInfoModifiedLine.FrameColor;
|
||||||
|
Canvas.Line(rcLine.Left, rcLine.Top, rcLine.Left, rcLine.Bottom);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user