Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-10

Column ruler on TSynEdit

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

Is there a painless way to get a column ruler at the top of a TSynEdit, without having to do something like having multiple controls in a frame and forcing sideways scrolling to track?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Martin
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote
Is there a painless way to get a column ruler at the top of a TSynEdit, without having to do something like having multiple controls in a frame and forcing sideways scrolling to track?

You can write a subclass of SynEdit, similar (but smaller than) to TIDESynEditor (in ide SourceSynEditor.pas)

using something like (this displays the procedure top hint)
     FTopInfoDisplay: TSourceLazSynTopInfoView;

That is reserving one line of the display for whatever you want it to be. It is some work though....

Or go the full 9 yards: Implement a top/bottom gutter (and submit it as patch).

In synedit, you have
     FPaintArea: TLazSynSurfaceManager;
   FPaintArea := TLazSynSurfaceManager.Create(Self);
   FPaintArea.TextArea := FTextArea;
   FPaintArea.LeftGutterArea := FLeftGutterArea;
   FPaintArea.RightGutterArea := FRightGutterArea;
   FPaintArea.DisplayView := FDisplayView;

So that allows to add top/bottom gutter, and reserve the space needed (set correct boundaries for all other elements.

Note there must be no gaps between them. Gaps will not be painted at all.

Reply by email

Martin
to Martin
Martin wrote 19 lines
On 22/10/2013 12:28, Mark Morgan Lloyd wrote: > Is there a painless way to get a column ruler at the top of a > TSynEdit, without having to do something like having multiple > controls in a frame and forcing sideways scrolling to track? > You can write a subclass of SynEdit, similar (but smaller than) to TIDESynEditor (in ide SourceSynEditor.pas) using something like (this displays the procedure top hint) FTopInfoDisplay: TSourceLazSynTopInfoView; That is reserving one line of the display for whatever you want it to be. It is some work though.... Or go the full 9 yards: Implement a top/bottom gutter (and submit it as patch).

Just a note, about optimizing painting. purely optional.

On some widgetset, invalidate always is the minimum enclosure rectangle for all invalidated parts.

So invalidating a bit of text at the visible bottom of the editor paints this bit of text (actually the full line)

But invalidating a bit of text at the visible bottom AND a bit of text (or gutter) on the top, will paint ALL lines inbetween too.

-------------
For that reason the overview gutter (which often invalidates on a different Y pos, than the rest of synEdit) creates a wincontrol of its own. This is a child to the SynEdit.

Reply by email

Mark Morgan Lloyd
to Martin: You can write a subclass of SynEdit, similar (but smaller than) to TIDESynEditor (in ide…
Martin wrote 35 lines
On 22/10/2013 12:28, Mark Morgan Lloyd wrote: > Is there a painless way to get a column ruler at the top of a > TSynEdit, without having to do something like having multiple controls > in a frame and forcing sideways scrolling to track? > You can write a subclass of SynEdit, similar (but smaller than) to TIDESynEditor (in ide SourceSynEditor.pas) using something like (this displays the procedure top hint) FTopInfoDisplay: TSourceLazSynTopInfoView; That is reserving one line of the display for whatever you want it to be. It is some work though.... Or go the full 9 yards: Implement a top/bottom gutter (and submit it as patch). In synedit, you have FPaintArea: TLazSynSurfaceManager; FPaintArea := TLazSynSurfaceManager.Create(Self); FPaintArea.TextArea := FTextArea; FPaintArea.LeftGutterArea := FLeftGutterArea; FPaintArea.RightGutterArea := FRightGutterArea; FPaintArea.DisplayView := FDisplayView; So that allows to add top/bottom gutter, and reserve the space needed (set correct boundaries for all other elements. Note there must be no gaps between them. Gaps will not be , I'll give that some thought. In practice it's only to show where

e.g. column 7 is on a punched card image.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email