CanvasItem refinements
Description
This MR does a bunch of refactoring of the code in display/control/ in preparation for !4876 (merged), split out to enable separate testing.
I also split out an initial commit consisting of trivial changes (formatting, renaming, obviously-correct changes) to make the rest easier to review, but will squash it back in at merge time.
Content
Like some kind of optical illusion, the change set here seems larger than it really is. Most of the touched files are just due to the conversion of CanvasItems to smart pointers. Even among the canvas-item-* files, the changes are not particularly deep. The major changes are really only the following:
- Smart-pointerization (through
CanvasItemPtr, a type ofstd::unique_ptralias). - Non-virtual interface is applied to
update()andrender(), moving common parts to the non-virtual wrapper function. - Removal is made to work through
->unlink()rather thandelete. - Duplicated state is moved to a new class
CanvasItemContext.
There are many other smaller cleanups too, but they are listed in the commit message.
Testing
Everything should work exactly as it did before, and this includes all the tools and all the things that appear on-canvas that aren't part of the drawing - snapping indicators, grids, etc. Fortunately, any bugs are likely to be obvious just from exercising the functionality once, rather than needing extensive usage to find them.