Recent

Author Topic: Is there a way of setting SynEdit LineState?  (Read 2339 times)

Pascal

  • Hero Member
  • *****
  • Posts: 919
Is there a way of setting SynEdit LineState?
« on: December 14, 2015, 12:57:35 pm »
Hello,

is there a way of setting the line state (sfModified, sfSaved)?
I want to mark all lines which where changed since last svn checkin and not only those
in the current edit session.

Pascal
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (2004)

x2nie

  • Sr. Member
  • ****
  • Posts: 488
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Is there a way of setting SynEdit LineState?
« Reply #1 on: December 14, 2015, 02:23:19 pm »
Yes.


1. create a new gutter to do that
2. add that gutter to SynEdit.


in english:
1. You need to inherit TSynGutterPartBase. let's name it TSynGutterSVNChanges
in this class, your chance is override method "Paint"
What you should check? Well, you might learn & reimplement TSynGutterChanges (SynGutterChanges.pas)


2. every SynEdit has 2 place to put new gutter: the left side and the right one. (Gutter & RightGutter)
in TForm1.Create, add this line:
Code: Pascal  [Select][+][-]
  1. TSynGutterSVNChanges.Create(S.RightGutter.Parts);


I wish it help.
When you were logged in, you can see attachments.
Lazarus Trunk @ Windows7 64bit, XP 32bit, Debian under VirtualMachine

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6798
  • Debugger - SynEdit - and more
    • wiki
Re: Is there a way of setting SynEdit LineState?
« Reply #2 on: December 14, 2015, 03:59:19 pm »
I am not sure the original linestate will help. Because even if you set it to "modified", then it will become "saved" when the user saves.

If "saved" is the state you are after, then maybe....

You need to inherhit SynEdit.
Code: Pascal  [Select][+][-]
  1. TSynEditStringList(SynEdit.TextBuffer).MarkModified(from, to);
  2. TSynEditStringList(SynEdit.TextBuffer).MarkSaved();

Also this is very internal and undocumented. While not likely, it is possible that it changes. (But then some other way will be introduced).

Creating a public accessors can be discussed.

Pascal

  • Hero Member
  • *****
  • Posts: 919
Re: Is there a way of setting SynEdit LineState?
« Reply #3 on: December 14, 2015, 04:21:45 pm »
Thanks,

saved is the state i want to show so this will be okay for me.
I will try later.

Pascal
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (2004)

 

TinyPortal © 2005-2018