* Add `Object:{is_class_of,is_extended_by}` to check inverse relationships
* Make tab scrolling more flexible
This adds tab scrolling commands and connects them to mouse scroll
events.
This way scrolling behavior can be customized more easily.
For example an alternative behavior could be:
```lua
keymap.add({
["wheelup"] = "root:switch-to-hovered-previous-tab",
["wheeldown"] = "root:switch-to-hovered-next-tab"
})
```
* Send `mouseleft` event when the mouse leaves the window
* Call `View:on_mouse_left` when the mouse leaves the `View`
Previously `View:on_mouse_left` was called only when the mouse left the
window, and it was called on every visible `View`.
Now it gets also called when the mouse "changes" `View`, and only the
last `View` the mouse was on will receive the event.
Fix a problem introduced when fixing the dirty pixel problem, commit
cb08c5c. The node, when determining the layout was rounding the size
of the fixed-size view. In turns this latter was calling move_towards
to the default_size it wanted. If default_size was non-integer the
value vas never archieved because it was rounded during layout and
move_towars was keeping the editor busy by setting the
core.need_redraw flag.
Fixing the Node's clipping rectangle make the clipping in DocView:draw()
partially redundant. This latter is now no longer needed to clip
on the right when drawing the document's lines but it still serves to
the purpose of clipping on the left, before the gutter region.
The last column of pixel on the window's right side isn't correctly
drawn and pixels appear dirty and more noticeably when the a NagView
message was previously shown, a stripe of red pixels remains on the right.
We use now a more souding roundig scheme. Now the rectangles to clip or to
draw are passed around as Lua numbers without any rounding. In turns, when
the rect coordinates are passed to the renderer we ensure the border of the
rect are correctly snapped to the pixel's grid. It works by computing the
coordinates of the edges, round them to integers and then compute the rect's
width based on the rounded coordinates values.
There are really multiple things here in the close_all_docviews
function:
1. we reset the Node's tab_offset
2. we ensure the core's active_view is properly set
3. we close LogViews as well as DocViews
Some conditions seems to never happen but we stay safe and try
to cover all possible cases.
In the function Node:get_divider_overlapping_point() we check if we
hit a divider (separator between two nodes). If yes the event is
intercepted and used to set the cursor and drag the separator if
appropriate.
In reality, on mouse move events, when one of the node is a split
and one of its child is not resizable we don't set the cursor to
and we don't intercept the event. However on a mouse pressed event
the event was intercepted regardless of the fact that the child
nodes are resizable or not. This latter behavior was unwanted as it
prevents mouse clicks to be processed because of a divided that is
inactive.
In addition it prevented processing of mouse clicks when the child
node was invisible leading to issue #363. For this latter the issue
was the invisible NagView in the upper part of the window.
To fix the problem we provide a divider with
Node:get_divider_overlapping_point() only if its child node are
resizable. In this way the mouse clicks or movements are intercepted
only if the divider is actually active.
The method RootView:on_mouse_pressed was copied in the contextmenu plugin with
a small modification to intercept the mouse clicks of the active view.
This approach is problematic because a relatively large portion of code is
duplicated.
We introduced a function named RootView.on_view_mouse_pressed to let plugins
like contextmenu intercepts mouse clicks in the active area without duplicating
the function RootView:on_mouse_pressed.