Implemented the new port-management and grid workflow.

Right-click blocks in the graph, Document tree, or Libraries tree and choose “Port Options…”.
Unified port list with:Add/remove port
Name
Type (Signal currently)
Input/output orientation

New ports start at (0, 0) in the icon editor.
Connected ports cannot be removed, reoriented, or changed incompatibly.
Added a PortType registry; connections require matching port types.
Removed/hid the separate Add Input and Add Output workspace tools.
Library port changes are written back to the library JSON.
Added independent graph and icon grid-size settings.
Components, interface terminals, icon shapes, resize handles, and icon ports snap to their corresponding grid.
Icon canvases and component hitboxes are now fixed at 128×128.
Selected icon shapes show a bottom-right resize handle.
Circles preserve equal width and height while resizing.
Shapes and ports are constrained to the icon hitbox.

Fixed the icon-editor crash and grid behavior.
Renamed the resize handle’s shape attribute, which was overriding Qt’s required shape() method.
Icon shapes, resize handles, and port anchors now snap while dragging.
Graph blocks and interface terminals also snap while dragging.
Replaced the nearly invisible dotted graph grid with higher-contrast grid lines.
Retained final release-time snapping as a safety check.
Python compilation and diff validation pass.
This commit is contained in:
2026-07-19 22:06:36 +02:00
parent 09824195c9
commit dbca41640f
10 changed files with 551 additions and 59 deletions

View File

@@ -134,18 +134,18 @@ Every component owns its ports, declarative icon, properties, and child graph:
"name": "My Component",
"position": {"x": 0, "y": 0},
"interface": {
"inputs": [{"id": "in", "name": "Input", "properties": {
"inputs": [{"id": "in", "name": "Input", "type": "signal", "properties": {
"iconPosition": {"x": 0, "y": 40}
}}],
"outputs": [{"id": "out", "name": "Output", "properties": {
"iconPosition": {"x": 120, "y": 40}
"outputs": [{"id": "out", "name": "Output", "type": "signal", "properties": {
"iconPosition": {"x": 128, "y": 64}
}}]
},
"icon": {
"size": {"width": 120, "height": 80},
"size": {"width": 128, "height": 128},
"elements": [{
"type": "rectangle", "x": 1, "y": 1,
"width": 118, "height": 78,
"width": 126, "height": 126,
"cornerRadius": 5,
"fill": "#dbeafe", "stroke": "#245c9c",
"lineWidth": 1.5, "lineStyle": "solid"
@@ -168,6 +168,8 @@ text components use `"implementation": {"kind": "text", "source": ...}` and
never own a graph. Vector icons can contain rectangles, circles, ellipses,
lines, triangles, and text. Each element owns its geometry, fill, stroke, and
line style; ports keep their icon anchor in `properties.iconPosition`. The
port type registry controls which types may connect (currently `signal` only).
Graph and icon grid sizes are configured independently in Settings. The
recursive model is under `src/bedit/document/`, library loading
and the live Current Document tree are under `src/bedit/library/`, and graphics
are isolated under `src/bedit/workspace/`.