Recent

Author Topic: synedit and highlighting  (Read 3644 times)

taazz

  • Hero Member
  • *****
  • Posts: 5368
synedit and highlighting
« on: September 20, 2014, 03:02:19 am »
I'm collecting enhancements for my codelibrarian from various sources and there are a couple of things requested that on one hand made me grind thinking WTF and on the other it makes sense on some level so in the next few days I might ask stupid questions about synedit and here comes the first.

Is it possible to define a range of text that will have specific text properties different from the attached highligher's colors and if yes how many of those could we define? If not how hard it will be to extend synedit with something like that?

The idea behind this is to be a able to highlight some text to make it more visible for what ever reason you might need it, eg studying the code and you want to group visually various commands or you talk about your library to some one and you want to make it visible what you are talking about with out loosing the highlighting from one moment to the other between clicks and keyboard events (unless the user selects a reset or something of course).

If you think this is a silly request and you have a better idea/wish you want to see implemented jump over to
http://forum.lazarus.freepascal.org/index.php/topic,25876.0.html and voice your mind.
Everything is welcomed, there is no deadline on the horizon so take your time if you need it.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9870
  • Debugger - SynEdit - and more
    • wiki
Re: synedit and highlighting
« Reply #1 on: September 20, 2014, 03:36:22 am »
WEll a similar thing is done by http://wiki.lazarus.freepascal.org/New_IDE_features_since#Multiple_user_defined_word_highlight.2Fmarkup

Only it is about highlight by content, rather than position.

It is done in
unit SynEditMarkupHighAll;
class TSynEditMarkupHighlightAllMulti

and TSynEditMarkup is the answer to your question. I need to find time to write more details... 

And if it is position, than you need to move with the text, see SynEditPointClasses, the selection can move with the text.

Sorry, this is very brief.....

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: synedit and highlighting
« Reply #2 on: September 20, 2014, 04:18:56 am »
WEll a similar thing is done by http://wiki.lazarus.freepascal.org/New_IDE_features_since#Multiple_user_defined_word_highlight.2Fmarkup

Only it is about highlight by content, rather than position.

It is done in
unit SynEditMarkupHighAll;
class TSynEditMarkupHighlightAllMulti

and TSynEditMarkup is the answer to your question. I need to find time to write more details... 

And if it is position, than you need to move with the text, see SynEditPointClasses, the selection can move with the text.

Sorry, this is very brief.....

No need to be sorry I have a beginning, something to work with. I'm very grateful for you help.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9870
  • Debugger - SynEdit - and more
    • wiki
Re: synedit and highlighting
« Reply #3 on: September 20, 2014, 10:38:42 am »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9870
  • Debugger - SynEdit - and more
    • wiki
Re: synedit and highlighting
« Reply #4 on: September 20, 2014, 10:52:53 am »
come to think of it, what you want is to replicate the selection (persistent selection).

That does exactly this: highlight a block, and keep it highlighted.

And selection uses Markup too.

Only you do not want to create like 20 selections. But on selection, with a list of start end pairs).
And a markup dealing with it


  FBlockSelection := TSynEditSelection.Create(FTheLinesView, True);
  fMarkupSelection := TSynEditMarkupSelection.Create(self, FBlockSelection);

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: synedit and highlighting
« Reply #5 on: September 20, 2014, 12:56:08 pm »
Noted it, I do have some reading to do thanks. Keep in mind that what has been requested was based on RTF abilities so people are asking for Text style for some silly reason including multiple fonts but I think I can get away if I can give them the ability to highlight multiple portions of the text in the different colors and sizes for each one, I'll be alright.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9870
  • Debugger - SynEdit - and more
    • wiki
Re: synedit and highlighting
« Reply #6 on: September 20, 2014, 06:37:35 pm »
Actually one of the markups already has a list build in, so it should be almost ready to use.

Font, or anything not monospaced will be a lot more work.


 

TinyPortal © 2005-2018