f4ad22b55b
- Implemented a theme system in `iced-panel-adapter` for consistent styling across panels. - Created `iced-panel-ai-chat` for an AI assistant interface, including message handling and UI components. - Developed `iced-panel-script` for a DSL editor with execution capabilities, allowing procedural drawing commands. - Introduced message types for interaction in both chat and script panels. - Added color and theme management for improved visual consistency.
6.8 KiB
6.8 KiB
Plan: Full egui → Iced Feature Port
Scope
Port ALL egui GUI features to Iced. The egui GUI has:
- 11 dockable panels + document tabs
- 4 external panel crates (filters, AI chat, script, AI script)
- 14 modal dialogs
- 10 top-level menus
- 20 toolbox slots (30+ tools)
- Brush panel (30+ styles, 3 view modes)
- Color panel (HSL wheel, HSV square, palettes)
- Brush editor (4 tabs, live preview)
- Shell infrastructure (viewer, tablet, clipboard, themes)
- ~60 unique features total
Phase 1: Fix Critical Bugs + Working Canvas (MUST DO FIRST)
Files: app.rs, canvas/mod.rs
1.1 Fix ButtonPressed → dispatch CanvasPointerPressed
- Add
last_cursor_pos: Option<(f32, f32)>toHcieIcedApp - Track cursor position in
CursorMovedhandler ButtonPresseddispatchesCanvasPointerPressedusing tracked position
1.2 Call refresh_composite() after every stroke
- After
CanvasPointerMovedandCanvasPointerReleased, callcanvas::render::refresh_composite()
1.3 Fix coordinate mapping with mouse_area
- Wrap canvas with
iced::widget::mouse_area on_press,on_move,on_scrollprovide widget-relative coords- Simplify
screen_to_canvasto just divide by zoom
1.4 Request repaint after state changes
- Return
iced::Task::perform(async {}, |_| Message::CompositeRefresh)from drawing messages
1.5 Remove global subscription
- Remove
iced::event::listen_with - All events come from
mouse_areaon canvas
Phase 2: Core Panels
2.1 Layers Panel
File: New panels/layers.rs
- Layer list with visibility toggle, opacity slider, blend mode selector
- Active layer highlighting
- Lock toggle
- Add/delete/merge down/flatten buttons
- Hierarchical group fold/collapse
- Reorder (move up/down buttons)
- Uses
engine.layer_infos(),engine.set_layer_visible(),engine.set_layer_opacity(),engine.set_layer_blend_mode(), etc.
2.2 History Panel
File: New panels/history.rs
- Undo/redo timeline list
- Jump-to-history-index on click
- Shows
engine.history_description(idx)for each entry - Current position highlighting
2.3 Properties Panel
File: New panels/properties.rs
- Dynamic properties based on active tool
- Text tool: font, size, color, alignment
- Vector shapes: position, size, rotation, fill/stroke
- Brush: size, opacity, hardness
2.4 Brushes & Tips Panel
File: New panels/brushes.rs
- Brush preset browser with categories
- Grid/list/card view modes
- Brush style selection (30+ styles)
- Size/opacity/hardness sliders
- Rendered stroke preview
- Custom preset save/load
- Uses
engine.set_brush_tip(),engine.set_color(), etc.
2.5 Color Palette Panel
File: New panels/color_panel.rs
- HSV saturation/value square
- Hue slider
- RGB sliders with numeric inputs
- Hex input
- Palette grid (saved swatches)
- Recent colors
2.6 Toolbar (Top)
File: New panels/toolbar.rs
- New/Open/Save buttons
- Undo/Redo buttons
- Zoom in/out/reset
- Active tool mode + size/opacity sliders
- Theme toggle
2.7 Status Bar (Bottom)
File: New panels/status_bar.rs
- Active tool name
- Canvas coordinates
- Zoom slider (logarithmic)
- Canvas dimensions
Phase 3: Tool-Specific Panels
3.1 Text Editor Panel
File: New panels/text_editor.rs
- Font selector, size, color
- Alignment (left/center/right/justify)
- Orientation (horizontal/vertical)
- Text effects (rotation, warp, extrude)
- Accept/Cancel buttons
3.2 Vector Geometry Panel
File: New panels/geometry.rs
- List vector shapes on active layer
- Per-shape: position, size, rotation, fill, stroke, line cap
- Boolean operations between shapes
3.3 Layer Styles Panel
File: New panels/layer_styles.rs
- 10 style types with toggles
- Drop shadow, inner shadow, outer/inner glow
- Bevel/emboss, satin, color/gradient/pattern overlay, stroke
- Per-style parameter sliders and color pickers
3.4 Layer Details Panel
File: New panels/layer_details.rs
- Layer ID, name, fill opacity
- Clipping mask toggle
- Adjustment type display
- Effects list
Phase 4: Filter System
4.1 Filters Panel (ported from egui-panel-filters)
File: New panels/filters.rs
- Category tree (Blur, Sharpen, Pixelate, Distort, Stylize, Color & Light, Restore, Noise & Pattern, Procedural Textures)
- Filter selection with bullet indicators
- Dynamic parameter panel via
iced-panel-adapter - Apply/Reset buttons
- Instant preview for applicable filters
4.2 Filter Dialogs
File: New dialogs/filters.rs
- Parameter dialogs for each filter category
- Uses
ModulePanel+render_module_panel()from iced-panel-adapter
Phase 5: Menus
5.1 Menu Bar
File: New panels/menus.rs
- File: New, Open, Save, Save As, Import, Export, Close, Exit
- Edit: Undo, Redo, Cut, Copy, Paste, Fill, Free Transform, Preferences
- Tools: All tool shortcuts
- Image: Adjustments, Image Size, Canvas Size, Rotation, Flip
- Layer: New, Delete, Merge Down, Flatten, Styles, Align
- Filter: All filter categories with submenus
- Select: All, Deselect, Invert, Grow, Shrink, Feather
- View: Zoom, Reset Pan, Panels submenu, Theme submenu
- Window: Documents list, Dock Layout
- Help: About
Phase 6: Dialogs
6.1 New Image Dialog
6.2 Adjustments Dialog (Brightness/Contrast, HSL)
6.3 Close Confirm Dialog
6.4 Selection Operation Dialog
6.5 Settings/Preferences Dialog
6.6 Expand Canvas Dialog
Phase 7: External Panel Crates
7.1 iced-panel-filters (port from egui-panel-filters)
- All 35+ filter definitions
- Parameter panels via iced-panel-adapter
- Instant preview integration
7.2 iced-panel-ai-chat (port from egui-panel-ai-chat)
- Streaming chat UI
- LLM connectivity (Ollama, OpenAI)
- Tool calling (execute on canvas)
- DSL script execution
7.3 iced-panel-script (port from egui-panel-script)
- Script editor with line numbers
- DSL parser and executor
- Command reference
7.4 iced-panel-ai-script (port from egui-panel-ai-script)
- AI-assisted script generation
- Multiple LLM providers
Phase 8: Infrastructure
8.1 Tablet/Stylus Input
- Pen pressure via evdev or winit events
- Map pressure to stroke_to()
8.2 Clipboard
- Copy/paste images via arboard
- PNG clipboard support
8.3 File I/O
- Open/Save/Import/Export
- Recent files list
- Format support (PNG, JPG, WebP, PSD, KRA, HCIE native)
8.4 Themes
- 5 theme presets
- Theme switching at runtime
8.5 Multi-Document Tabs
- Tab bar for multiple open documents
- Tab switching
Phase 9: Dock Layout
9.1 Pane Grid Layout
- Use iced's
PaneGridfor dockable panels - Panel drag-and-drop
- Panel resize
- Layout save/load
Verification
After each phase:
cargo build -p hcie-iced-gui— compilescargo run -p hcie-iced-gui— visual verificationcargo build -p hcie-gui-egui— no regression