The New SynEdit Gutter (breaking change) #86
Replies: 8 comments 10 replies
-
It souds good. How it will be in situatin when line has bookmark and you want to add another sign (breakpoint e.t.c.)? |
Beta Was this translation helpful? Give feedback.
-
These new changes look great. My gutter usage is limited to line numbers and bookmarks and in initial testing they both seem to work perfectly. |
Beta Was this translation helpful? Give feedback.
-
Don't you think about painting bookmarks instead of have ImageList? In the time of High DPI is Delphi image list limiting, cause it doesn't support vector graphics. I do painting numbered/unnumbered bookmarks e.t.c, dynamically long time already. |
Beta Was this translation helpful? Give feedback.
-
What about case, when user increase Synedit font size? My users can do it simply with Ctrl+MouseWheel as in browser. In this case gutter line numbers and other items on the gutter should reflect editor font size too. And as oposite, when you decrease font size, bookmarks from image list will be painted wrong. |
Beta Was this translation helpful? Give feedback.
-
Thank you for explanation |
Beta Was this translation helpful? Give feedback.
-
I'm seeing a problem where the autosize of the linenumbers is incorrect if I change the editor font and have UseFontStyle set to false (which I think means to use the editor font in the gutter.) I think the situation is that TSynGutter.CalcCharWidth is called when the editor is created but not updated if the font of the editor changes. In my case the initial editor font is Consolas 10 and then I change it in code to Consolas 12, and after that the line number display is too narrow. I'm testing with 50,000 lines or so and scrolled to the bottom to show the issue best. |
Beta Was this translation helpful? Give feedback.
-
I am fighting with new Gutter. |
Beta Was this translation helpful? Give feedback.
-
Finally solved using Synedit.OnGutterGetText event. |
Beta Was this translation helpful? Give feedback.
-
There is a lot of functionality that tries to fit into the limited space of the Gutter
The current system is inflexible and not easily extensible. The current properties, LeftOffset, RighOffset are insufficient for coping with the desired flexibility.
The New Gutter
The new gutter contains a collection of Bands accessible at design and run time through the published property Bands (TOwnedCollection). Each Band if of type TSynGutterBand the public interface of which is as follows:
The TSynGutterBandKind enumeration is defined as follows:
The Gutter constructor creates four bands: gbkMarks, gbkLineNumbers, gbkFold, gbkMargin in that order. The bands can be rearranged and custom bands can be added at design time. The width and visibility of the gbkLineNumbers and gbkFold bands are automatically calculated from the relevant Gutter and CodeFolding options. For the other bands the Visible and Width properties are used. The Width is unscaled and RealWidth provides the width scaled for PPI.
Here is the design time editor:
The Background property is an enumeration defined as follows;
The default is gbbGutter, which means that the standard Gutter background is painted before the band contents are painted transparently on top. gbbEditor applies the editor background instead and gbbNone can be used if you want to custom paint the Gutter background.
Here is an example in which the bands have been rearranged and the Fold band is painted with the editor background.
A new Gutter property allows you to access the Bands by kind:
property Band[Kind: TSynGutterBandKind]: TSynGutterBand read GetBandByKind;
New Demo
A new demo SimpleIDEDemo, showcasing a custom band, has been added. This is a port of a similar demo from the original SynEdit repository. A new custom band that displays debugger information is created and uses the OnPaintLines, OnClick and OnMouseCursor events.
Breaking change
This is a breaking change. A number of Gutter properties (LeftOffset, RightOffset, RightMargin) have been removed and other properties have been added. What this means is that you have to reinstall the components and then in the IDE open the form(s) which contain SynEdit ignoring all errors and save them. That should be enough.
Beta Was this translation helpful? Give feedback.
All reactions