Recent

Author Topic: Several gutter mark parts  (Read 3335 times)

Basile-B

  • Sr. Member
  • ****
  • Posts: 457
    • GH...
Several gutter mark parts
« on: October 28, 2017, 04:32:11 am »
Hi my project has reached the point where i can't use a single gutter mark part for the icons (linter results, breakpoints, coverage result, etc lead to overlap) anymore so I've tried to add a TSynGutterMarks derived but immediatly noticed that the marks for the default mark part are also displayed in my derived instance.

How does this work ?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5573
    • wiki
Re: Several gutter mark parts
« Reply #1 on: October 28, 2017, 05:52:55 am »
It doesnt at the moment.

The Marks object is on the SynEdit

line 129
Code: Pascal  [Select]
  1.   MLine := TCustomSynEdit(SynEdit).Marks.Line[j + 1];
  2.  

And that is what it paints.

--
With that info, you can copy the class, and give it its own Marks.

Of course bookmarks must stay on the SynEdit, but other marks can go into separate objects. (probably)

-------
Also I think, if you increase the width of the gutterpart, then it will paint more marks.

Basile-B

  • Sr. Member
  • ****
  • Posts: 457
    • GH...
Re: Several gutter mark parts
« Reply #2 on: October 28, 2017, 07:26:37 am »
Quote
Also I think, if you increase the width of the gutterpart, then it will paint more marks.

Yeah, I see with Lazarus bookmarks + breakpoint that it should work but here it doesn't, although the code shows well that there's a paint rect moved to the right for each icon on a line (TSynGutterMarks.PaintMarks).

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5573
    • wiki
Re: Several gutter mark parts
« Reply #3 on: October 28, 2017, 05:35:09 pm »
Quote
Also I think, if you increase the width of the gutterpart, then it will paint more marks.

Yeah, I see with Lazarus bookmarks + breakpoint that it should work but here it doesn't, although the code shows well that there's a paint rect moved to the right for each icon on a line (TSynGutterMarks.PaintMarks).

The gutterpart doesnt autosize, but that does not happen with 2 individual parts either.

In the IDE, the width is for 2 marks.
There is a trick to get more items per line in the IDE, put bookmarks into several lines, then join the lines. And then max 2 are shown. (That is expected behaviour, clean cut off, if does not fit.)

But if you set the width bigger by hand, then they should show... (you need to know, the max count of items on one line)
Well if not then it sounds like a bug, and needs a reproducible case.


Basile-B

  • Sr. Member
  • ****
  • Posts: 457
    • GH...
Re: Several gutter mark parts
« Reply #4 on: October 29, 2017, 02:12:42 am »
Yeah i suggested a bug since i have disabled autosize and set the width to more than necessary. Also during debugging i have verified that the TRect passed when the glyph is drawn is well moved to the right.

I'm gonna fill a Mantis issue later.

Basile-B

  • Sr. Member
  • ****
  • Posts: 457
    • GH...
Re: Several gutter mark parts
« Reply #5 on: October 29, 2017, 07:58:13 am »
Issue: https://bugs.freepascal.org/view.php?id=32622

I also attach the sample project here in case someone would find how to make things working without a change to the package (would be ideal for me since i need the feature in the next weeks).

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5573
    • wiki
Re: Several gutter mark parts
« Reply #6 on: October 29, 2017, 05:29:08 pm »
Fixed 1 of 3 issues. Provided workarounds for the other 2.

Also note, that:
1)
Code: Pascal  [Select]
  1. SynEdit1.BookMarkOptions.DrawBookmarksFirst := false;
may help, if you do not use bookmarks.
If the setting is true (default), the first column is kept empty /reserved for bookmarks.

2) If you do not set SynEdit1.BookMarkOptions.BookmarkImages
then you must disable shortcuts (and any other  means ) of setting bookmarks. The trigger an exception, if there is no imagelist.
That should be no problem, since you have to set SynEdit1.BookMarkOptions.BookmarkImages to an empty list (or a list for bookmark marks)