Recent

Author Topic: Can SynEdit Do This???  (Read 2350 times)

pixelink

  • Hero Member
  • *****
  • Posts: 1269
Can SynEdit Do This???
« on: April 14, 2019, 04:12:09 pm »
Hi,

I know SynEdit can do a lot of different Syntax code-based text,

But, I haven't really found if it can do custom tags such as these....

This is from a .NET application I made.
I would like to convert it to LAZ.

Can SynEdit do this kind of tag??
Its a music chord with square brackets around it.

Ex. Bb is [Bb] (with the red color for the chord)

Thanks
« Last Edit: April 14, 2019, 04:13:42 pm by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 4.2.0 •  VSSTUDIO(.Net) 2022 • Win11 • 32G RAM • Nvida RTX 4070 Ti Super

pixelink

  • Hero Member
  • *****
  • Posts: 1269
Re: Can SynEdit Do This???
« Reply #1 on: April 14, 2019, 04:13:00 pm »
Also... is there a page that has all the info I need to make a custom SynEdit lex file?
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 4.2.0 •  VSSTUDIO(.Net) 2022 • Win11 • 32G RAM • Nvida RTX 4070 Ti Super

Thaddy

  • Hero Member
  • *****
  • Posts: 19393
  • Glad to be alive.
Re: Can SynEdit Do This???
« Reply #2 on: April 14, 2019, 04:37:18 pm »
You mean: "Capo on first fret."?  :o :-X :D
But Yes that can be done.
objects are fine constructs. You can even initialize them with constructors.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12518
  • Debugger - SynEdit - and more
    • wiki
Re: Can SynEdit Do This???
« Reply #3 on: April 14, 2019, 04:45:09 pm »
I am not sure what you mean with the chord... You can do the coloring.

And if whatever you want to display is part of a font, then you should be able to add the utf8 for it.  That is it has to be a monospaced font.

About the lexer, I guess you mean highlighter. There is a tutorial (sample files are in the Lazarus installation's example folder)
http://wiki.lazarus.freepascal.org/SynEdit_Highlighter


If you have "[ Bb ]" in the text, and want that to be displayed as some other char...

That is a bit more complicated, and if at all (not tested) will only work for read-only mode. You would have write and insert a custom "view" of the textbuffer (such as TSynEditStringTabExpander), including a TLazSynDisplayView.
Those can replace text before display. But I am not sure this will work with caret movement, or text-selection. (Again, never tested that).
For this part "display view" their is no doc, but the code. Further more, those classes will change in future...


pixelink

  • Hero Member
  • *****
  • Posts: 1269
Re: Can SynEdit Do This???
« Reply #4 on: April 14, 2019, 05:37:19 pm »
Well, doesn't matter now.

I can't get ATSynEdit to work in LAZ 2.0

Thanks
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 4.2.0 •  VSSTUDIO(.Net) 2022 • Win11 • 32G RAM • Nvida RTX 4070 Ti Super

Thaddy

  • Hero Member
  • *****
  • Posts: 19393
  • Glad to be alive.
Re: Can SynEdit Do This???
« Reply #5 on: April 14, 2019, 05:45:22 pm »
You asked for synedit help, not ATsynedit, which is considerably different.
With Martin's tips it is quite easy if the chord names are keywords for a highlighter (SynAnySyn) and you use a fixed font.
objects are fine constructs. You can even initialize them with constructors.

pixelink

  • Hero Member
  • *****
  • Posts: 1269
Re: Can SynEdit Do This???
« Reply #6 on: April 14, 2019, 05:49:04 pm »
You asked for synedit help, not ATsynedit, which is considerably different.
With Martin's tips it is quite easy if the chord names are keywords for a highlighter (SynAnySyn) and you use a fixed font.

Yes you are right.

I for got which thread I was on.

Since I can't get ATSynEdit working

I will have to use SynEdit.

Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 4.2.0 •  VSSTUDIO(.Net) 2022 • Win11 • 32G RAM • Nvida RTX 4070 Ti Super

pixelink

  • Hero Member
  • *****
  • Posts: 1269
Re: Can SynEdit Do This???
« Reply #7 on: April 14, 2019, 05:54:22 pm »
So, there is no custom Lexer/Tokens/regx that I have to make. How does all the other "lexers" Html, PHP, xml etc have therr own interlines colors etc??

Just trying to understand..

Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 4.2.0 •  VSSTUDIO(.Net) 2022 • Win11 • 32G RAM • Nvida RTX 4070 Ti Super

pixelink

  • Hero Member
  • *****
  • Posts: 1269
Re: Can SynEdit Do This???
« Reply #8 on: April 14, 2019, 05:57:13 pm »
With my .NET, i made a separte XML lexer file that specified tags, regx, lexers etc.

Does Synedit have one too?
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 4.2.0 •  VSSTUDIO(.Net) 2022 • Win11 • 32G RAM • Nvida RTX 4070 Ti Super

Edson

  • Hero Member
  • *****
  • Posts: 1329
Re: Can SynEdit Do This???
« Reply #9 on: April 14, 2019, 06:02:51 pm »
Creating highlighters in SynFacilSyn is not so simple as it can be done in a few minutes. It's better to take one and modify it to adapt to your needs.

You can use my SynFacilSyn highlighter (https://github.com/t-edson/SynFacilSyn) and use this XML syntax file:

Code: XML  [Select][+][-]
  1. <?xml version="1.0"?>
  2. <Language >
  3.   <Token Start="[" End="]" Attribute='Number'/>
  4. </Language>
  5.  

This paint all text between brackets. I don't know if this is what you want.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

pixelink

  • Hero Member
  • *****
  • Posts: 1269
Re: Can SynEdit Do This???
« Reply #10 on: April 14, 2019, 06:12:24 pm »
Yes... that is basically it.

Okay... I think I will give this a try.

Of course I may need some more help along the way.

I sure do wish SynEdit had text wrapping!!!!
That's why I want to give ATSynEdit a try
Thanks
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 4.2.0 •  VSSTUDIO(.Net) 2022 • Win11 • 32G RAM • Nvida RTX 4070 Ti Super

Edson

  • Hero Member
  • *****
  • Posts: 1329
Re: Can SynEdit Do This???
« Reply #11 on: April 14, 2019, 06:17:27 pm »
I sure do wish SynEdit had text wrapping!!!!
That's why I want to give ATSynEdit a try
Thanks

SynFacilSyn is mainly designed to SynEdit, but there is simple adapter for ATSynEdit (https://github.com/t-edson/SynFacilSyn/tree/1.21/synfacil_adapter_atsynedit) I'm not sure if it works in the recents versions.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

 

TinyPortal © 2005-2018