dialog/objects: Centre blendModePopup() + cleanups
When reviewing the Controller MR, Mike was bemused that the blend mode
popover opens wherever the pointer was. It was already thus! But it is
fairly easy to always point to the middle of the icon, so do so; hence
it is consistent where we pop up, & we don't obscure the context icon.
* Factor out from getting the expander x to get_cell_area() -> rectangle
* Use it to get cell area for blend mode icon. Change to popup at middle
* Use Controller::has_flag() to more clearly check for pressed modifiers
See MR for full details, unsquashed commits. Highlights for git blame...
ui/controller|ui/manage: new helpers for following
…commits. We have manage() to get gtkmm4-like behaviour here in gtkmm3,
get_current_event_state() to replicate a method that only GTK4 has, and
more importantly a pile of helpers to make gesture creation/adding nice
tool-base +get_latin_keyval for EventControllerKey
This will be used to replace GdkEvents in the following & future commits
dialog/align-dist ::button-press → Button::clicked
It is not really clear to me at all why we were listening to button
press events here, instead of just GtkButton::clicked, or in some cases
simply using GtkActionable. This moves to doing the former, works fine.
color-item ::button-press|enter|leave → Controller
Ditto previous commit, and we don't need to know about GdkEventButton
anymore, which is also nice. Also + #include for RefPtr, just in case.
Updated: Also replace ::enter|leave-event with GtkEventControllerMotion,
noting we seemingly need still to add_events(), and to use PHASE_TARGET.
dialog-notebook: mv from ::button-press to Gesture
Keep connecting after as before, and we need to NOT claim, else
primary-click does not switch tabs.
LPEeditor: Replace enter/leave w/ ControllerMotion
We can't use Utils::make_g_callback() because that only supports member
functions, and we have multiple LPEDrag per instance of ourself. And
it's not worth it anyway since GTK4 should make this far easier with
Widget.set_cursor(). So just do it the ugly way, via the C API.
widget/selected-style: ::button-press→GestureClick
and in doing so, make us consistently listen only for releases, like the
first two tools already did, in particular so that menus act as expected
widget/ink-spinscale: GdkEvents to Controllers and
simplify setting our cursor: use C++ API, don't set it for every motion
event but only on enter (and unset on leave), rm ineffective mask test.
* Add noexcept to things that can be, i.e. cannot invoke disconnect()
* Avoid move-constructor redundantly disconnect()ing empty connection
* Use std::exchange() instead of a two-step
* Fix move-assignment did not disconnect existing connection (if any)
* Implement swap() so that swapping won't disconnect either operand -
- which it otherwise would do now that operator=() rightly does so.
auto-connection: TODO: use sigc::scoped_connection
Add a TODO that once we depend on sigc++ 3.6 or later, that will now
have a scoped_connection doing the same thing, which I authored. :-)
Once upstream has that we should stop rolling our own variant of it.
* Fix header order per coding style wiki. Add formatting rules footers.
* Tidy includes and add some more forward-declarations 'just in case'.
* Fix indentation & braces style. Remove empty lines at start of funcs
* Remove unnecessary declarations of default destructors, doing nothing
* Make the class final & event handlers private; no one derives or calls
* Add a const getter for the Adjustment; it might be useful one day.
* Move label ustrings into our member, instead of copying