This adds a new adw::AboutWindow containing information about version, authors, license, links etc.
It is opened via a new menu button in the toolbar, which opens a menu containing an "About Helvum" button.
The version and authors are pulled from the Cargo.toml file.
This reworks the adding of a port to nodes, to avoid assigning multiple nodes
to the same grid cell when a node which was not the last in its column has previously
been removed. Instead, the grid is emptied and repopulated each time.
This also lets us sort the nodes each time by name.
Finally, this hides the seperator if a node has no nodes, as it is unneeded.
Nodes now have a background using the libadwaita .card style class.
Ports now have a circular handle, which is positioned on the edge of the node so that half of the circle sticks out.
Ports are also no longer themed like a button and don't receive a color based on the guessed media type, in a future commit,
the handle will be colored instead.
This ports the application to libadwaita, enabling us to use the libadwaita stylesheet and
widgets to better implement the Gnome Human Interface Guidelines.
Format params for links and ports are now being watched for in the pipewire connection code.
The parsed media type is then set on the port widget / link object
and they are colored accordingly.
For ports, which were already colored before, this new method of determining the media type
should be more reliable and accurate as this uses the real Format/EnumFormat
params instead of parsing optional properties.
Cursor movement during port drag-and-drop on the graph is now being tracked
and a link is drawn from the dragged port to the cursor.
If the cursor is hovering a port the source port can link to,
the second end of the link instead attaches to the ports link anchor
so that the link "snaps" to the linkable port.
Instead of different types for each direction to avoid linking ports
of the same direction, we reject the drop early if directions of both
ports are the same.
The direction check is easily extendable to also deny links between
ports of different media types in the future.
The graph widgets management (watching a glib receiver, adding and removing
Nodes, Ports and Links) currently done in the `Application` and `GraphView`
objects has been extracted into a new GraphManager object, which watches the
receiver instead, pushes changes directly to the widgets, and reacts to their signals.
This seperates widget logic and management logic cleanly instead of both
being mixed into the GraphView, and also reduces the code size for the
Application object.
Previously, the allocated height and width to a node on the graph was divided by the zoom factor,
to account for the changed size from them being zoomed.
To zoom each node, we `size_allocate` it with a GskTransform that scales it.
However, using a scaling transform to allocate the node already takes care of scaling the height and
width, so us also scaling the height and width manually means we were overcompensating.
This resulted in the allocation becoming to big when zooming out, and to small when zooming in.
This is observable as labels will become smaller when zooming in and ellipsize their content.
The commit removes the extra manual scaling so nodes get allocated properly when zoomed.
This sets a maximum width of 20 chars on labels on nodes and ports.
Longer labels will wrap to a second line.
For labels longer than two lines, the label is ellipsized at the end.
The full label can still be viewed via hovering for a tooltip.
Co-authored-by: Roger Roger <me@rogerrogert.de>
The new widget sits in the headerbar, and allows for changing the zoom level with "+" and "-" buttons, via text entry, and a dropdown where a list of predefined levels can be clicked.
The graphview widget now implements the gtk::Scrollable interface, so it is no longer wrapped inside a gtk::Viewport when used in a gtk::ScrollWindow anymore.
Instead, it repositions its content itself when scrolled, and also skips rendering any content that is not inside the visible area, which should improve performance
when the graph becomes big.
This commit also makes the canvas a fixed size, with much space to each side from the starting area.
This will hopefully improve user experience, as the view can now be moved around more freely, and nodes can be dragged left and above the starting area.
This makes gtk draw the background grid for us via CSS, instead of manually drawing each line via cairo.
This improves performance, as the grid may now be drawn via GPU, and gets rid of the custom drawing code we had.