The new baseclass TSynEditMarkupMouseLink has a procedure to tell the markup on which MouseAction it should react:
procedure AddMouseActionCommand(ACommand: TSynEditorMouseCommand);
Just thinking about how that would best be done.
Normally Markup are passive, so the "correct" way would be a SynEdit Plugin (like SyncroEdit), and the plugin installs a markup (but mouse action handled in the plugin).
On the other hand, it currently just works fine to have it all in the Markup...
Note: the action is still part of synedit itself. The Markup just get to know a copy of it, to detect the keys for underlining.
Except you probably cant select the desired action in the object inspector. (well markups are not currently designable at all, but even if they were)
A pluging would have its own action list, and the plugin would hook the detection of the action.
But the plugin could also inform the markup of the correct action....
Anyway, we can leave it......
The compatibility class TSynEditMarkupCtrlMouseLink which is a subclass of the new base class does a call to
AddMouseActionCommand(emcMousLink) in it's constructor as it always and only reacts on emcMouseLink.
That will depend on creation order. And also break if the actions are changed after the markup was created.
The markup needs to search at runtime.
If I remember rightly Option2 of emcMouseLink isn't used at the moment, so we can use it for a SynEditCommad.
Or should we leave this extension as a user could have used Option2 for his own?
Why not use the existing action for the command? (you loose the option to hide the underline, but that does not matter / you can change the markupcolor anyway (clnone))
We can make the old interface deprecated to make the users aware of the new interface to MouseLinks.
yes and no. that would require the markup to become active.
In that case I would write a plugin that makes use of the markup....
But currently I would leave the old code as it is.
Problem is, that user apps when SynEdit is saved as lfm, may have that streamed in the lfm.
I never dug that deep into the properties of a SynEdit in object inspector. But is it generally possible to change the internal
MouseTextAction for emcMouseLink? Or will a new emcMousLink over write the internal one?
The current markup needs emcMouseLink, as it uses this for the search.
Your new class does not need to search, so it can have any command you want.