An Ideal Inkscape

From Inkscape Wiki
Jump to navigation Jump to search

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:

  1. Render the SVG.
  2. Manipulate the SVG.
  3. Save/load SVG

We also want convenience features:

  1. Undo/redo
  2. Customization/preferences
  3. Editing aids (grids, guidelines)
  4. Extensions

GUI Functions

What must the GUI then do?

  1. Render
    1. SVG
    2. Editing aids
      1. Guides
      2. Grids
      3. Nodes
  2. Manipulate the SVG
    1. File Operations
      1. Load
      2. Save
      3. Export
    2. Nodes (elements, text, etc.) Operations
      1. Create
      2. Destroy
      3. Move
    3. Attributes Operations
      1. Create
      2. Remove
      3. Alter
    4. Properties Operations
      1. Add
      2. Remove
      3. Change
    5. Undo/Redo: save state
  3. Preferences
    1. Per session
    2. Per document
    3. Per window

Required Widgets

This suggests a group of required widgets:

  1. Those that alter nodes
  2. Those that alter attributes
  3. Those that alter properties
  4. Those that alter preferences

Each group of widgets needs instances that manipulate each type of attribute/value:

  1. Integer
  2. Float
  3. Length
  4. Fill
  5. 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.