Development Strip Editor Code Map - ShadobaDev/Platemaker-qt GitHub Wiki
Strip editor β code map
Where the code for each part of the screen lives, what each folder may use, and how the parts talk. The why is in the tool framework; the file-by-file recipes for adding a tool, a shape or a kind of object are in Extending the strip editor.
The screen is the folder tree
Every folder under widgets/stripeditor/ is one region of the editor, named as it is on screen.
βββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββ
β TOOL RAIL β β OBJECT STATE β
β toolrail/ β β objectstate/ β
β β CANVAS β β
βββββββββββββββββ€ canvas/ βββββββββββββββββββββββββ€
β TOOL OPTIONS β β OBJECT STACK β
β tooloptions/ β what is drawn on it: objects/ β objectstack/ β
βββββββββββββββββ΄βββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββ
editor.* (the root) builds all five and wires them together
Two folders are not regions. objects/ is what sits on the canvas and the controller that owns it.
properties/ holds the editors that TOOL OPTIONS and OBJECT STATE both show.
Folders and their files
widgets/stripeditor/
βββ editor.{hpp,cpp,ui} the shell: builds the regions, wires them, zoom, the grade's glue
βββ presetstore.* named looks: built-ins, the user library, packs
βββ scrolledpage.hpp wraps a panel page in a scroll area
βββ toolrail/ LEFT, TOP
β βββ toolregistry.* the tool table: one row per tool, what it does to the canvas
β βββ toolrail.* a tile per row, and the colour pair under them
β βββ colourpair.* primary/secondary colours: furniture, not a tool
β βββ cursors.* which cursor, from the tool and what is under the pointer
βββ tooloptions/ LEFT, BOTTOM: what the next object will be
β βββ tooloptionsstack.* one page per tool, and the page for tools with none
β βββ bubbletooloptions.* Speech bubble and Text
β βββ artworktooloptions.* Artwork: which picture the next placement puts down
β βββ gradetooloptions.*/.ui Colour correction
βββ canvas/ CENTRE: the strip and what a press on it does
β βββ stripitem.* draws every page as one seam-free item
β βββ pagesource.* page memory: proxy, sharp and graded images
β βββ canvasinput.* the viewport's event filter, routed by the armed tool
β βββ sampling.* the colour under the eyedropper
βββ objects/ what is placed on the strip
β βββ object.* the base every object answers to
β βββ bubbleobject.* a balloon or lettering Platemaker drew (plain text is a
β β bubble with no balloon)
β βββ artworkobject.* imported artwork, raster or vector
β βββ objectcontroller.* the objects, the selection, the drag, and every operation
β βββ placement.* a Create tool's drag: the rubber band and what it places
β βββ resize.* the eight grips' resize maths, a pure function
β βββ selectionchrome.* the selection's box, grips and tail handles, above every object
β βββ striplayout.* the strip's pages: where each sits, what an overlay anchors to
βββ properties/ SHARED by TOOL OPTIONS and OBJECT STATE: one editor per group
β βββ propertygroup.* the group list
β βββ propertygroupeditor.* the base: live `changed`, settled `committed`
β βββ propertygroupset.* a balloon's four look editors, and the rules for applying them
β βββ shapeeditor.* skineditor.* styleeditor.* texteditor.*
β βββ taileditor.* taillisteditor.* nexttaileditor.*
β βββ blendeditor.* the one property every kind carries
β βββ colouradjustment.* one named part of the grade
βββ objectstate/ RIGHT, TOP: what the selected thing is
β βββ objectstatestack.* which panel shows, from what is selected
β βββ objectstate.* an object, several, or a tail
β βββ stripstate.* the strip or a page
βββ objectstack/ RIGHT, BOTTOM: every object in composite order
βββ objectstack.* the tree: rows, chips, drag to reorder, mute
βββ objectmenu.* the right-click menu, on the stack and the canvas alike
βββ rowglyph.* the object drawn small for its row
widgets/objectrecord/ outside the editor: the project and the main window use it too
βββ objectrecord.hpp what a bubble is: the record an overlay is rendered from
βββ propertygroups.hpp the groups a record is made of: Shape, Skin, Style, Text, Tails
βββ recordpainter.* draws a record (namespace Painter)
βββ recordsvg.* a record as SVG and back (namespace Svg)
βββ recordstore.* every open project's records, by project uid
What may include what
toolrail ββββββ
tooloptions βββΌβββΊ properties βββΊ widgets/objectrecord
objectstate βββ β²
objectstack βββΊ objects β
canvas ββββββββΊ objects
editor (root) βββΊ everything β the only place the regions meet
- A region never includes another region. TOOL OPTIONS and OBJECT STATE meet through
properties/(the same editor classes) and throughEditor(the wiring). - Nothing includes
editor.hpp. The root's other files (presetstore,scrolledpage) are shared. - Includes name their folder:
#include "objects/object.hpp".widgets/stripeditoris the only include root, so an include line is the dependency, and an unqualified one does not compile.
It is checked on every build. cmake/check_layers.cmake runs before Platemaker compiles, and as
the strip_editor_layers test. A violation stops the build with file:line: error: tooloptions/ may not include objectstate/.
A few headers are allowed across a region line. The script lists each one with its reason, and warns when one is no longer used. Today they are:
- the tool table and the cursor rule (
toolrail/toolregistry,toolrail/cursors), for the canvas, TOOL OPTIONS and the objects; - the strip's layout, for OBJECT STATE;
loadArtwork(), for the Artwork tool's preview;- the colour pair, for the object menu.
How the parts talk
MainWindow / Project (persistence, one undo history per project)
β² recordCreated, overlaysCommitted, β setOverlaySource,
β artworkImportRequested, β setColourCorrection,
β colourCorrectionCommitted βΌ setPreviewSource
ββββββββββββββββββββββββββββββ Editor ββββββββββββββββββββββββββββββ
β β
TOOL RAIL ββ toolPicked βββΊ Editor::setTool βββΊ TOOL OPTIONS page, CanvasInput β
β
CanvasInput ββ a Create drag ββββββββββΊ Placement βββΊ ObjectController β
ββ sampleRequested ββββββββΊ Editor βββΊ sampleCanvas βββΊ ColourPair β
ββ colourApplyRequested βββΊ Editor βββΊ ObjectController β
ββ artworkDropped, zoomStepRequested βββΊ Editor β
β
OBJECT STATE ββ changed / committed βββββββββββββββββββΊ ObjectController β
ββ boundToRecord, boundToTail, boundToRecordsβ¦ ββ (via Editor) β
β
OBJECT STACK, object menu ββ read the controller's getters, call its methods β
ββ stackChanged, selectionChanged, subjectRowChanged β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- ObjectController is the model and the selection. It holds no widget of any region. The stack and the menu are views of it, the way a list view is a view of a model. OBJECT STATE may not include it, so the controller tells it what to show by signal, and the Editor connects the two.
- No edit is final in the editor. Every change leaves as a signal, MainWindow pushes it onto the
project's undo history, and the result comes back through
setOverlaySource(). See History and undo. - Live and settled have one spelling.
β¦changedis live (preview, no history step);β¦committedis settled (one undo step). Every editor and panel uses the pair.
I want toβ¦ β look in
| I want to⦠| Look in |
|---|---|
| add a kind of object | objects/ (a subclass of Object); its record in widgets/objectrecord/ |
| add or change a property | the struct in widgets/objectrecord/propertygroups.hpp, its editor in properties/, the group in properties/propertygroup.hpp |
| add a tool | a row in toolrail/toolregistry.cpp; its page in tooloptions/, registered by the Editor (the stack asserts every tool has one) |
| link a tool's options to an object's properties | properties/propertygroupset.* and the page's prototype() |
| use the colour pair | toolrail/colourpair.*; it is read by the bucket (canvas/canvasinput β ObjectController::applyColourAt), written by the eyedropper (canvas/sampling), and read by the menu's Fill and Outline |
| change what the strip or a page shows | objects/striplayout.* (geometry), canvas/stripitem.* (drawing), objectstate/stripstate.* (its panel) |
| add a filter like the grade | toolrail/ (row) + tooloptions/gradetooloptions.*; the glue is in editor.cpp |
| make a filter reach the render | the library: a model field, its codec, the strip builder. No GUI folder makes that cheap |
| change what a right-click offers | objectstack/objectmenu.* for the entries; the operation itself in objects/objectcontroller.* |
| change a cursor | toolrail/cursors.* |
See also: Tool framework Β· Object state and tool options Β· Architecture