An Ideal Inkscape
This is an attempt to describe an ideal Inkscape from a programmers perspective. It is motivated by constant frustration with working on Inkscape's code.
Inkscape is a fork of Sodipodi. Lauris Kaplinski did most of the work on Sodipodi. He had a clear, consistent vision of how the code should work which is still evident in the Inkscape code base.
As a reaction to the difficulty in contributing to Sodipodi, the founders of Inkscape made it easy for anyone to get write access to the code repository... two accepted patches and you were in. This lead to a flood of contributions which rapidly pushed Inkscape far ahead in capability. But it came with a price. Instead of a clear, consistent vision, Inkscape's codebase is a mess. It is full of complicated and worse, undocumented code. There are often multiple ways of doing the same thing as people instead of reusing existing code reinvent the wheel.
The first step is to decide exactly what Inkscape is. I believe that:
Inkscape is a graphical SVG editor.
In order for Inkscape to be a graphical SVG editor, what do we need to do? We need to be able to:
- Render the SVG.
- Manipulate the SVG.
- Save/load SVG
We also want convenience features:
- Editing aids (grids, guidelines)
What must the GUI then do?
- Editing aids
- Manipulate the SVG
- File Operations
- Nodes (elements, text, etc.) Operations
- Attributes Operations
- Properties Operations
- Undo/Redo: save state
- File Operations
- Per session
- Per document
- Per window
This suggests a group of required widgets:
- Those that alter nodes
- Those that alter attributes
- Those that alter properties
- Those that alter preferences
Each group of widgets needs instances that manipulate each type of attribute/value:
What we have (see src/ui/widgets):
- Registered widgets: includes write_to_xml/undo
- RegisteredCheckButton (Gtk::CheckButton)
- RegisteredToggleButton (Gtk::ToggleButton)
- RegisteredUnitMenu (Labelled)
- RegisteredScalarUnit (ScalarUnit)
- RegisteredScalar (Scalar)
- RegisteredText (Text)
- RegisteredColorPicker (ColorPicker)
- RegisteredSuffixedInteger (Scalar)
- RegisteredRadioButtonPair (Gtk::HBox, two Gtk::RadioButton
- RegisteredPoint (Point)
- RegisteredTransformedPoint (Point)
- RegisteredVector (Point)
- RegisteredRandom (Random)
- RegisteredFontButton (FontButton)
- Labelled (adds label to widget with optional icon/suffix)
- Point (tGtk::VBox with two Scalar)
- Entry (Gtk::Entry)
- Text (Gtk::Entry)
- FontButton (Gtk::FontButton)
- Scalar (SpinButton, optional Gtk::Scale)
- LabelledComboBoxEnum (ComboBoxEnum)
- SpinScale (Gtk::Box, contains InkSpinScale)
- DualSpinScale (Gtk::Box, contains two InkSpinScale)
- SpinSlider (Gtk::HBox with linked Gtk::Scale and SpinButton) UNUSED
- DualSpinSlider (Gtk::HBox with two SpinSlider) UNUSED
- ComboBoxEnum (Gtk::ComboBox)
- Lots of classes inside ui/dialog/filter-effects-dialog.cpp
- Dialog related
- Dock (wrapper around GdlDock)
- DockItem (wrapper around GdlDockItem)
- Panel (Gtk::Box) Basis of all dialogs.
- AddToIcon (Gtk::CellRendererPixbuf) Objects dialog
- AnchorSelector (Gtk::Bin/Gtk::Grid) Choose which edge to align to.
- Button [Deprecated]
- ClipMaksIcon (Gtk::CellRendererPixbuf) Objects dialog
- SimpleFilterModifier (filter-effects-chooser) Common blend/blur/opacity.
- Frame (Gtk::Frame) HIGS compliant frame.
- ImageIcon (Gtk::VBox) SVG viewer for FileChooser.
- Random (Scaler)
- Rotatable (Gtk::EventBox, adjust value by dragging away from axis)
- ScalerUnit (Scalar with unit)
- SelectedStyle (Gtk::HBox) The complex widget at the bottom left corner.
- SpinButton (Gtk::SpinButton with expression parsing)
- StyleSubject [Not a widget]
- StyleSwatch (Gtk::HBox) The complex widget at the end of a tool bar showing style.
- ToleranceSlider (Complex widget used in DocumentProperties snapping tab)
- UnitMenu (Gtk::ComboBoxText) Chooser for units.
- UnitTracker [Not a widget]
- Actions (toolbar/menu items)
- button (different from button in ui/widgets)