Yet Another C++ Plugin Template...
-
This was originally mentioned in THIS THREAD in the Dec 17 2023 1:04PM POSTING.
-
@ThosRTanner said in Yet Another C++ Plugin Template...:
One comment, just a thought…
Since you are making a C++ template, perhaps instead of:
LRESULT send_to_editor(UINT message, WPARAM = 0, LPARAM = 0) const noexcept LRESULT send_to_editor(UINT message, WPARAM wParam, void const *buff) const noexcept
it would be better to set up the Scintilla C++ API.
Because of an annoyance with exception handling — ScintillaCall.h defines an exception but doesn’t derive it from std::exception, which prevents Notepad++ from displaying a sensible error message — I created a macro wrapper for ScintillaCall.h for Columns++, which you can see here.
There is also an oddity whereby the C++ interface will raise an exception due to a leftover failure status code previously set but never cleared in the C interface, making it appear that something went wrong in the plugin using the C++ interface. Executing Scintilla::ScintillaCall::SetStatus(Scintilla::Status::Ok) before executing other C++ Scintilla calls avoids that, so it’s a good idea to call that somewhere in entry code each time before the plugin gets control.
-
I like it, guys, keep up the good work!
-
@Coises thanks. I shall go and have a look at that. I possibly need to fiddle with scintilla a bit before I release that…
-
…mapped shortcuts other than Scintilla commands are sent to Notepad++ when used in a non-modal dialog that doesn’t register with NPPM_MODELESSDIALOG. Apparently many plugins never did this, because the most commonly used shortcuts were Scintilla commands. Moving three very common shortcuts from Scintilla commands to Notepad++ accelerators changes that.
Maybe it is appropriate to have the correct way of doing the above shown in a plugin template. Then future plugin authors are less likely to do it wrong. Just a thought.
-
@Alan-Kilborn Indeed. On my todo list.
Addendum - it actually already does that for docking dialogues.
Not for non-docking dialogues which I don’t currently support. Though if someone would like to point me to a plugin that creates floating dialogues, I’d be happy to have a play.
-
@ThosRTanner said in Yet Another C++ Plugin Template...:
a plugin that creates floating dialogues
-
Latest version now has a Non_Modal_Dialogue_Interface class (after a chunk of refactoring!)
-
Hello, was wondering about how mature your template is now?
@PeterJones 's posting HERE got me thinking about other plugin templates… -
A Alan Kilborn referenced this topic on
-
@Alan-Kilborn fairly mature. I have a couple of other tweaks to do while trying to do a version of the linter plugin, which needed some extra functionality to make a few things simpler.
That and it’s not really a template of course. It’s a library you can use.