Skip to content

Gradient Editor for Fill and Stroke Dialog

Mike Kowalski requested to merge mkov/inkscape:gradedit into master

This feature tries to fill the void left after removal of legacy gradient editor dialog. Instead of bringing back old dialog box, it implements gradient editing right inside Fill and Stroke dialog.

image

Here's the feature request, and how it evolved based on feedback and discussions on UX channel: ux#67 (closed)

During development I was able to reference existing functionality (gradient-toolbar.cpp, now gone gradient-vector.cpp) to inform implementation.

The two main files for review are gradient-editor and gradient-with-stops. Gradient editor is a new widget for F&S dialog, whereas gradient-with-stops is a little widget similar to gradient-image, but with stop handles and interactivity.

To make inclusion of new editor in F&S least disruptive I introduced gradient-selector-interface. This interface is what existing paint-selector uses to talk to real instances. Initially gradient editing duties were performed by gradient-selector. This class still exists and it is being used by swatch selector, as well as new gradient editor (in form of the gradient library popup).

Gradient editor widget is defined in Glade file (share/ui/gradient-edit.glade). Gradient stop handle template is also there (share/ui/gradient-stop.svg). BTW, SVG template uses CSS classes, so Inkscape 1.1 is needed to play with it.

Gradient editing functions were mostly available in gradient-chemistry already. I just added a few I needed. Some lifted from the now gone gradient-vector file, some newly created.

Most strings in the new editor have translations already. There's probably one ("Stop offset:"), that's new. Dialog should handle longer (translated) strings gracefully.

Note: Care has been taken for new gradient editor not to make F&S dialog wider than it already is. However it may grow by a few pixels...

A branch is up-to-date with master as of time of submission.

So, that's on a positive note. On a negative note, I couldn't bring myself to completely adopt prevailing coding style, I'm sorry, can't stomach it. So, I beg you to overlook it.

Merge request reports