Inkscape Dialogs and GUI
I've spent the last couple weeks mocking up a possible future GUI framework for Inkscape. This came out of discussion on dialogs at both the Kiel and Seville hackfests. The problem that got me started on this is that the Gnome Docking Library (GDL) which manages the placement of our dialogs into docks is severely broken under the Wayland windowing system that many Linux distributions are moving to. We (Inkscape) appear to be the only major user of this library and fixing the problems seems to be non-trivial.

In Seville we had a brain-storming session on dialogs. Some of the designers using Inkscape pointed out Gimp's dialog handling as superior to Inkscape's. Gimp uses tabbed notebooks where dialogs can be easily brought forward or hidden. And the best of using notebooks is that dragging dialogs between them is built into GTK (GUI toolkit we use).

In Gimp, notebooks can be arranged flexibly side-by-side or on in columns. They can be put in floating docks or attached to either side of the document window. The whole layout uses a Multipane widget that is custom to Gimp. GTK includes a native Paned widget that can display two child widgets with a grab bar in between that allows the user to control the space allocated to each widget. By nesting Paned widgets, one can build up a Multipaned widget. (It seems that a Multipaned widget would be a natural for including in as a core GTK widget.)

Gimp uses a horizontal Multipane widget to position the toolbox widget and drawing widget along with columns of dialog notebooks on the sides. The columns are themselves vertical Multipane widgets. Gimp allows users to drag dialogs between notebooks as well as to drop them various places. A dialog dropped on the side of the window moves the dialog into a new notebook in a new column. Dropping at the top or bottom of an existing column, moves the dialog into a new notebook inserted at the top or bottom of that column. Dropping anywhere else causes the dialog to be put into a new notebook in a floating dock.

Default Gimp 2.10 Window (squeezed down) showing one column on the right with two notebooks and a column on the left with a notebook below the toolbox. New notebook drop zones are circled by green ovals. The bars with three dots in a row (red oval) are grab bars and can be dragged to reallocate the space between the panes.

                                     ★・・・・・・★・・・・・・★・・・・・・★

We can't just take Gimp's dialog handling and plug it into Inkscape. Our dialogs are constructed quite differently. Gimp also is written in C and is still using GTK2 while Inkscape uses C++ and GTK3. Thus I started work on a new implementation with Inkscape in mind.

While I was working on this project, I started to think about the larger picture. Our current code is an unholy mixture of legacy C (from our Sodipodi roots) and a hodgepodge of C++ code written by different people at different times. The dialogs are each implemented slightly differently which results in some having bugs, especially when multiple documents are being edited at the same time. Our code that keeps dialogs in-sync with documents is quite complex.

We have wanted to move from Gtk::Actions which are tied to specific GUI elements like buttons to the newer Gio::Actions which are GUI independent. (An "action" is simply an operation that changes the document or a setting in a well defined way such as changing the size of some text.) This will greatly simplify our code by allowing reuse of an action in multiple places or even from the command line. In order to use Gio::Actions we need to rebase our code on the GTK Application and Window classes.

So this might be a good time to restructure the foundation of Inkscape's GUI. I bowed to mission creep and added window handling to the project. This includes keeping dialogs in floating docks in sync with the current document window. Here is what I've arrived at:

The initial view of the Inkscape interface mock-up. Dialog drag drop zones are provided as they are in Gimp. An empty pane can also serve as a drop site. Note, the Status Bar should be at the bottom.

                                      ★・・・・・・★・・・・・・★・・・・・・★

                  The Inkscape interface mock-up after some dialogs have been added.

                                     ★・・・・・・★・・・・・・★・・・・・・★

Clearly there is a lot of tuning to do but much of it is just figuring out which CSS knobs to tweak. A bigger problem, is how easily will this be to integrate into the existing Inkscape GUI framework. The dialogs in notebooks will probably be fairly straight forward but the rest will probably need to be post Inkscape 1.0.

FEATURES:

  • Dialogs can be dragged and dropped between notebooks.
  • Dialogs can be dropped at window edges to be added to new notebooks.
  • Dialogs can be dropped on background to create a new floating dock.
  • Dialogs can be opened from main menu or from menu in notebook.
  • Attempting to add a duplicate dialog will flash the notebook containing the original dialog and bring it to the front.
  • Dialogs are linked to the document window they are in, or if in a floating dock to the last document window in focus.
  • Text in dialog tabs can be shown or hidden.

Ironically, some of the drag and drop features are not currently working with the X11 GDK back-end but do work with the Wayland back-end. This will need to be fixed.