3.0 KiB
3.0 KiB
Implementation: Separate per-filter settings dialogs
Changes required
1. HcieAppState additions
File: crates/hcie-gui-egui/src/app/mod.rs
- Add to
HcieAppState(orHcieAppif using a struct-level state):pub filter_selected_id: Stringpub filter_params_open: boolpub filter_preview_active: boolpub filter_sky_path: String
- Initialize to defaults in the struct constructor.
2. Filter dialog redesign
File: crates/hcie-gui-egui/src/app/filter_dialog.rs
- Replace the monolithic filter dialog with two windows:
- Main filter dialog — filter list only + common controls (Close, Undo Last Filter, Apply-to-New-Layer)
- Per-filter settings window — opened when a filter is selected
3. New functions in filter_dialog.rs
show_filter_list_window(app, ctx)— shows the filter category tree- Calls
egui_panel_filters::show_filter_list_ui(...) - On filter click: set
app.filter_selected_id, openapp.filter_params_open = true
- Calls
show_filter_params_window(app, ctx)— shows the selected filter's controls- Uses
get_filter_panel(filter_id)to get the panel spec - Renders
render_module_panelfor the parameter widgets - Renders sky-path input for
sky_replacement - Buttons: Preview / Stop Preview, Apply, Reset, Close
- Close button sets
filter_params_open = false
- Uses
4. Preview feature
- In
show_filter_params_window:- If
filter_preview_activeis true:- On widget change: call
engine.filter_preview_restore()+engine.filter_preview_begin()+engine.apply_filter_preview(id, params) - Show "Stop Preview" button instead of "Preview"
- On widget change: call
- If not previewing:
- "Preview" button starts preview:
engine.filter_preview_begin(), then apply once - Set
filter_preview_active = true
- "Preview" button starts preview:
- On window close: if preview active, call
engine.filter_preview_restore()and clear flag
- If
5. Reset feature
- "Reset" button:
- Re-initialize all widget values to defaults from
get_filter_panel(filter_id) - If preview active, also restore original pixels and stop preview
- Keep window open
- Re-initialize all widget values to defaults from
6. Apply feature
- "Apply" button:
- Compile params with
compile_filter_params - If preview active, restore first
- Call
engine.apply_filter(id, params) - Clear
filter_selected_id, setfilter_params_open = false
- Compile params with
7. is_raster check
- Pass
is_rasterfrom the engine to both windows - Main filter list shows the mismatch warning if not raster
- Per-filter window is disabled/hidden if not raster
8. FilterType to string ID mapping
File: crates/hcie-gui-egui/src/app/menus.rs
- Add a helper function
filter_type_to_id(ft: FilterType) -> &'static str - Map each menu item's filter type to the corresponding ID string
- Update menu handlers to set both
app.show_filter = trueandapp.filter_selected_id = id
Implementation order
- Add state fields to HcieApp
- Implement
show_filter_params_window - Implement
show_filter_list_window - Update main filter dialog to use new windows
- Add preview/reset logic
- Update menus