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.
Requirements
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:
- Undo/redo
- Customization/preferences
- Editing aids (grids, guidelines)
- Extensions
GUI Functions
What must the GUI then do?
- Render
- SVG
- Editing aids
- Guides
- Grids
- Nodes
- Manipulate the SVG
- File Operations
- Load
- Save
- Export
- Nodes (elements, text, etc.) Operations
- Create
- Destroy
- Move
- Attributes Operations
- Create
- Remove
- Alter
- Properties Operations
- Add
- Remove
- Change
- Undo/Redo: save state
- File Operations
- Preferences
- Per session
- Per document
- Per window
Required Widgets
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:
- Integer
- Float
- Length
- Fill
- etc.
Existing Widgets
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)
- AttrWidget
- 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
- Color
- color-entry
- color-notebook
- color-picker
- color-scales
- color-slider
- color-wheel-selector
- Dialog related
- Dock (wrapper around GdlDock)
- DockItem (wrapper around GdlDockItem)
- Panel (Gtk::Box) Basis of all dialogs.
- Other
- 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]
In src/widgets
- Toolbars
- arc-toolbar
- box3d-toolbar
- etc.
- Actions (toolbar/menu items)
- ege-adjustment-action
- ege-output-action
- ege-select-one-action
- ink-action
- ink-comboboxentery-action
- ink-radio-action
- ink-toggle-action
- ink-tool-menu-action
- Other
- button (different from button in ui/widgets)
- dash-selector
- desktop-widget
- eek-preview
- ege-paint-def
- fill-n-stroke-factory
- fill-style
- font-selector
- gradient-image
- gradient-selector
- gradient-vector
- paint-selector
- sp-attribute-wiget
- spinbutton-events
- sp-widget
- spw-utilities
- sp-xmlview-attr-list
- sp-xmlview-content
- sp-xmlview-tree
- stroke-marker-selector
- stroke-style
- swatch-selector
- toolbox
In src/live_effects/parameter:
- array
- bool
- colorpicker
- enum
- etc.