# Iced GUI — Remaining Tasks & Reprioritized Plan ## Current Status The iced GUI has ~5000 lines across 33 source files. It compiles successfully (16 warnings, 0 errors). Major features are working: dock layout, toolbox with SVG icons, menu system, canvas with checkerboard, dialogs, keyboard shortcuts, brush params, selection, vector shapes, layer management, and theme system. --- ## Completed (reference — do not re-do) | # | Feature | Status | Files | |---|---------|--------|-------| | 1 | Dock PaneGrid with centered canvas | DONE | `dock/state.rs`, `dock/view.rs` | | 2 | Brush params wired (size/opacity/hardness/style) | DONE | `app.rs` | | 3 | Adjustment dialogs (Brightness/Contrast, HSL) | DONE | `dialogs/adjustments.rs` | | 4 | Selection tool (rectangular drag) | DONE | `app.rs` | | 5 | Vector shape drawing (Rect/Circle/Line) | DONE | `app.rs` | | 6 | Keyboard shortcuts (Ctrl+Z/Y/S/N/O/C/V, Esc) | DONE | `app.rs` | | 7 | CLI file open (`load_path`) | DONE | `main.rs`, `app.rs` | | 8 | Filter parameters (FilterParamChanged) | DONE | `app.rs` | | 9 | Menu system (9 menus, dropdown items) | DONE | `panels/menus.rs` | | 10 | Multi-document tab bar | DONE | `dock/view.rs` | | 11 | Theme system (5 presets, ThemeColors) | DONE | `theme.rs`, `iced-panel-adapter/theme.rs` | | 12 | Custom title bar (app name, version, doc info) | DONE | `panels/title_bar.rs` | | 13 | Properties, Layer Details, Geometry panels | DONE | `panels/*.rs` | | 14 | SVG icons (64 icons, tool rendering) | DONE | `sidebar/mod.rs` | | 15 | Checkerboard on canvas | DONE | `canvas/mod.rs` | | 16 | Clickable color palette swatches | DONE | `sidebar/mod.rs` | | 17 | Constant pressure for mouse input | DONE | `app.rs` | | 18 | Toolbox expand/collapse (1→2 column) | DONE | `sidebar/mod.rs` | | 19 | AI Chat panel (UI only) | DONE | `panels/ai_chat_panel.rs` | | 20 | Layer Styles panel | DONE | `panels/layer_styles.rs` | | 21 | Script/AI Script panels | DONE | `panels/script_panel.rs`, `ai_script_panel.rs` | --- ## Remaining Tasks (prioritized) ### P0 — High Impact, Must Fix #### 1. Custom Window Frame (decorations: false) **Impact:** Professional look, eliminates OS chrome mismatch **Files:** `main.rs` (L58-66), `app.rs` (view method), `panels/title_bar.rs` Current: OS title bar is visible, custom title bar is redundant below it. Need: - Set `decorations: false` in window settings - Add `Message::WindowDrag`, `WindowMinimize`, `WindowMaximize`, `WindowClose` - Use `iced::window::drag()`, `minimize()`, `toggle_maximize()` - Merge menu bar INTO title bar (Photoshop-style: app name | menu items | window controls, all in one 28px bar) - Title bar: make entire bar draggable, buttons on right side #### 2. Menu Dropdown as Overlay (not inline) **Impact:** Menus currently push content down when opened **Files:** `panels/menus.rs`, `app.rs` Current: Dropdown renders below the menu bar as a `column![bar, dropdown]`, shifting all content down. Need: - Wrap main content + dropdown in `iced::widget::Stack` - Position dropdown absolutely at top-left - Add `mouse_area` backdrop to close on click-outside - Keep `active_menu` tracking (already exists) - Style dropdown with proper hover states per item #### 3. Unused Warning Cleanup (16 warnings) **Impact:** Code cleanliness, prevents confusion **Files:** `panels/styles.rs`, `panels/text_editor.rs`, `theme.rs` Warnings: - `panel_header` unused in styles.rs → use in dock title bars - `hover_item_bg` unused → wire into menu/tool hover states - `menubar_background` unused → use in menu bar container - `dropdown_background` unused → use in menu dropdown - `view` in text_editor.rs → wire into text tool - `set_preset` in theme.rs → add theme switcher to menu --- ### P1 — Important UX Polish #### 4. Menu Actions Fully Wired **Impact:** Many menu items dispatch to `NoOp` or incomplete handlers **Files:** `app.rs` (MenuAction handler ~L1340-1410) Missing wiring: - Edit menu: Cut (X), Select All (A), Deselect (D), Fill - Image menu: Canvas Size, Image Size, Rotate CW/CCW/180, Flip H/V, Crop to Selection - Layer menu: Duplicate, Delete, Clear, Layer Styles, Align - Filter menu: Color & Light (Levels, Vibrance, Exposure, Posterize, Threshold, Dehaze) - Select menu: Grow, Shrink, Feather (open SelectionOp dialog) - View menu: Fit to Window (auto-calc zoom), Debug Mode - File menu: Export PNG, Export JPEG, Close #### 5. Hover States for Tool Buttons & Menu Items **Impact:** No visual feedback on hover **Files:** `sidebar/mod.rs`, `panels/menus.rs` Currently: Buttons use static styles, no hover highlight. Need: - Track hover state via `iced::widget::mouse_area.on_hover()` or iced hover interaction - Apply `colors.bg_hover` on hover for tool buttons and menu items - iced 0.13: use `button::on_hover()` or `style` closure that checks `Status::Hovered` #### 6. Panel Title Bar Modernization **Impact:** Current title bars use generic styling **Files:** `dock/view.rs` Currently: Title bars show text + close/maximize buttons. Missing: - Panel type icon (from SVG assets) next to title - Close/maximize buttons should be hover-only (opacity change) - Use `colors.bg_hover` for header background (not hardcoded) - Remove the `horizontal_rule(1)` still used in some places --- ### P2 — Functional Completeness #### 7. Text Tool Implementation **Impact:** Text tool is placeholder (TODO handlers) **Files:** `app.rs` (CanvasPointerPressed handler), new panel Currently: Text tool selected, but no text input UI. Need: - When Text tool active + click on canvas: show text input overlay - Track: text content, font size, font family, alignment, color - On confirm: call `engine.draw_text()` to rasterize - Messages: `TextSizeChanged`, `TextColorChanged`, `TextAccept`, `TextCancel` (exist but unused) #### 8. Brush Editor (Advanced Params) **Impact:** Only basic brush params are exposed (size/opacity/hardness/style) **Files:** `panels/brushes.rs` Currently: 3 sliders + 4 style buttons. Need: - Spacing slider (already in ToolState but not in UI) - Jitter slider - Scatter slider - Brush preview canvas (show brush tip shape) - Brush presets list (save/load) #### 9. AI Chat Connection **Impact:** AI panel shows UI but doesn't connect to any provider **Files:** `panels/ai_chat_panel.rs`, `app.rs` Currently: Provider buttons (Ollama/Claude/OpenAI) dispatch NoOp. Need: - Wire to `hcie-engine-api` AI client (Ollama compatible) - Async HTTP requests via `iced::Subscription` or `Task::perform` - Stream responses into message list - Map AI commands to engine operations #### 10. Settings Dialog **Impact:** No way to configure app settings **Files:** new: `dialogs/settings.rs` Need: - Theme selector (switch between 5 presets) - Tablet pressure curve settings - Default brush params - Canvas background color - Grid/snap settings --- ### P3 — Nice to Have #### 11. Context Menu on Panel Titles - Right-click to Pin, Float, Close panel - Would require `mouse_area` with secondary click detection #### 12. Dock Profiles / Reset Layout - Save/restore panel arrangements - "Reset to Default" button in Window menu #### 13. Import SVG/PSD/KRA - Wire file open dialog to `engine.open_image()` for more formats - Currently supports PNG/JPG/WebP only via engine #### 14. Export PNG/JPEG - Use `engine.get_composite_pixels()` + `image::save_buffer()` - Wire to File > Export menu items #### 15. Undo/Redo Visual Feedback - Highlight current position in history panel - Show undo count in status bar --- ## Execution Order (recommended next session) | Phase | Task | Est. Time | |-------|------|-----------| | 1 | Custom window frame (decorations: false + draggable title bar) | 45 min | | 2 | Menu overlay (Stack-based dropdown) | 30 min | | 3 | Wire unused style functions + fix warnings | 15 min | | 4 | Wire all menu actions | 30 min | | 5 | Hover states for tool/menu items | 20 min | | 6 | Panel title icons + modernize | 20 min | | 7 | Text tool | 45 min | | 8 | Brush editor (spacing/jitter/scatter) | 30 min | **Total: ~3.5 hours for P0+P1+P2 first 3 items** --- ## Verification 1. `cargo check -p hcie-iced-gui` — 0 warnings, 0 errors 2. `cargo run -p hcie-iced-gui` — launch and verify: - No OS title bar, custom title bar with drag - Menu dropdowns overlay without pushing content - All menu items dispatch correct actions - Tool buttons highlight on hover - Panel titles show icons 3. Test drawing: brush, eraser, vector shapes, text 4. Test dialogs: New Image, Adjustments, Close Confirm 5. Test dock: drag panels, resize splits, close/maximize