Overview
TheCanvas class represents a Pure Data patch’s visual canvas. It manages object creation, connections, selection, viewport, and rendering. Each canvas corresponds to one Pure Data patch (pd::Patch) and provides the interactive editing environment.
Location: Source/Canvas.h and Source/Canvas.cpp
Class Hierarchy
Constructor
PluginEditor*
The plugin editor that owns this canvas.
pd::Patch::Ptr
The Pure Data patch this canvas represents.
Component*
default:"nullptr"
Optional parent graph component (for graph-on-parent subpatches).
Key Properties
PluginEditor*
Parent plugin editor.
PluginProcessor*
Reference to the plugin processor/Pure Data instance.
pd::Patch&
The underlying Pure Data patch.
std::unique_ptr<CanvasViewport>
Viewport for scrolling and zooming the canvas.
PooledPtrArray<Object>
All objects on this canvas.
PooledPtrArray<Connection>
All patch connections on this canvas.
SelectedItemSet<WeakReference<Component>>
Currently selected objects and connections.
Value
Whether the canvas is in locked (run) mode vs edit mode.
Value
Whether the canvas is in presentation mode (showing only GUI objects).
Value
Current zoom level (1.0 = 100%).
Object Management
void
void
Selection and Editing
void
void
SmallArray<T*>
Clipboard Operations
void
void
void
void
void
Advanced Editing
void
void
void
void
Undo/Redo
void
Viewport and Navigation
void
void
void
Rendering
void
Overlays and Display Options
bool
File Operations
void
Message Handling
void
pd::MessageListener).Suggestions and Autocomplete
void
Inspector Integration
ObjectParameters&
Constants
static constexpr int
Maximum canvas size: 128,000 pixels
Usage Example
See Also
Object- Individual patch objectsConnection- Patch cord connectionsPluginEditor- Editor windowpd::Patch- Underlying Pure Data patchCanvasViewport- Viewport and scrolling
