Recent

Author Topic: How can I add a breakpoint in Synedit like in IDE?  (Read 7922 times)

shaoziyang

  • New Member
  • *
  • Posts: 16
How can I add a breakpoint in Synedit like in IDE?
« on: October 14, 2011, 04:51:41 am »
How can I add a breakpoint in Synedit like in IDE? With a mark line?

It seemed that synedit can't add breakpoint, it can add bookmark only.


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5524
    • wiki
Re: How can I add a breakpoint in Synedit like in IDE?
« Reply #1 on: October 14, 2011, 11:33:12 am »
1) For the icon in the gutter:

Code: [Select]
uses SynEditMarks;
AMark := TSynEditMark.Create(TheSynEdit);
TheSynEdit.Marks.Add(AMark)

Look through the properties.

For the image either use:
Code: [Select]
TheSynEdit.BookMarkOpt.BookmarkImages
//or
AMark.ImageList // I have not actually tested that.

and then
Code: [Select]
AMark.ImageIndex
2) for the lines color:

Code: [Select]
uses SyneditMarkupSpecialline
TheSynEdit.MarkupByClass[TSynEditMarkupSpecialLine].OnSpecialLineColors

this callback will be called very often and during paint. So it must be fast, and not do any big stuff. Do not modify other components/controls.

---
alternatively, use TSynEditMarkupGutterMark (that is what the IDE does)

See unit SourceSynEditor for how to set it up.
In this case, you need to create marks of the class TSynEditMarkupMark

All defined in SynEditMarkupGutterMark

Only to add you own markup-class, you need to subclass synedit, as MarkupManager is protected

shaoziyang

  • New Member
  • *
  • Posts: 16
Re: How can I add a breakpoint in Synedit like in IDE?
« Reply #2 on: October 14, 2011, 05:07:35 pm »
I try to use TSynEditMarkupGutterMark, but it is not wok yet.

And bookmark number is limit to 10, but breakpoint has not number limit. How it is works?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5524
    • wiki
Re: How can I add a breakpoint in Synedit like in IDE?
« Reply #3 on: October 14, 2011, 06:07:46 pm »
A Mark does not necessarily have to be a bookmark. the marks have a flag, if they are a bookmark.

You can add as many marks as you want. You can add more bookmarks too, if you provide images. you can have the multiply bookmarks with the same number...

SynEdit has internal images for bookmarks 0-9. All other images you must provide.

shaoziyang

  • New Member
  • *
  • Posts: 16
Re: How can I add a breakpoint in Synedit like in IDE?
« Reply #4 on: October 15, 2011, 10:19:16 am »
It is still not work. Where can I find document about mark? or some examples?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5524
    • wiki
Re: How can I add a breakpoint in Synedit like in IDE?
« Reply #5 on: October 15, 2011, 12:02:31 pm »
Sorry there is no documentation.

the following code works here (no line color, just a gutter mark, with an image.

Put a SynEdit on the form. Add an imagelist, with a picture (in the example index = 0)

You must add "SynEditMarks" to the uses. ("SynEdit" is added automatically)

Add this into a buttonclick (or wherever you need it):
Code: [Select]
procedure TForm1.Button1Click(Sender: TObject);
var
  m: TSynEditMark;
begin
  m := TSynEditMark.Create(SynEdit1);
  m.Line := 2;
  m.ImageList := ImageList1;
  m.ImageIndex := 0;
  m.Visible := true;
  SynEdit1.Marks.Add(m);
end;

The line ("2") must exist (can be empty text, but must be there, e.g must show a line number.

Can you attach a small self-containing example of what you try to do (for the line color)?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5524
    • wiki
Re: How can I add a breakpoint in Synedit like in IDE?
« Reply #6 on: October 15, 2011, 01:40:58 pm »
I added an example to 0.9.31. will be in snapshots tomorrow.

shaoziyang

  • New Member
  • *
  • Posts: 16
Re: How can I add a breakpoint in Synedit like in IDE?
« Reply #7 on: October 16, 2011, 03:28:02 pm »
It works. Thank you very much.