noctua/src/ui/message.rs

102 lines
1.7 KiB
Rust
Raw Normal View History

2026-01-07 20:42:28 +01:00
// SPDX-License-Identifier: GPL-3.0-or-later
2026-01-07 20:22:49 +01:00
// src/app/message.rs
//
// Application messages: events, user actions, and internal signals.
2026-01-07 20:22:49 +01:00
use std::path::PathBuf;
use crate::ui::components::crop::DragHandle;
2026-01-14 17:16:25 +01:00
2026-01-07 20:22:49 +01:00
#[derive(Debug, Clone)]
pub enum AppMessage {
// File / navigation.
#[allow(dead_code)]
2026-01-07 20:22:49 +01:00
OpenPath(PathBuf),
NextDocument,
PrevDocument,
GotoPage(usize),
GenerateThumbnailPage(usize),
2026-01-07 20:22:49 +01:00
// Transformations.
2026-01-14 17:16:25 +01:00
RotateCW,
RotateCCW,
FlipHorizontal,
FlipVertical,
2026-01-07 20:22:49 +01:00
// View / zoom.
2026-01-07 20:22:49 +01:00
ZoomIn,
ZoomOut,
ZoomReset,
ZoomFit,
ViewerStateChanged {
scale: f32,
offset_x: f32,
offset_y: f32,
canvas_size: cosmic::iced::Size,
image_size: cosmic::iced::Size,
},
2026-01-07 20:22:49 +01:00
// Pan control.
2026-01-07 20:22:49 +01:00
PanLeft,
PanRight,
PanUp,
PanDown,
PanReset,
// Tool modes.
2026-01-07 20:22:49 +01:00
ToggleCropMode,
ToggleScaleMode,
// Crop operations.
StartCrop,
CancelCrop,
ApplyCrop,
CropDragStart {
x: f32,
y: f32,
handle: DragHandle,
},
CropDragMove {
x: f32,
y: f32,
max_x: f32,
max_y: f32,
},
CropDragEnd,
// Panels.
ToggleContextPage(crate::ui::app::ContextPage),
ToggleNavBar,
OpenFormatPanel,
// Menu.
ToggleMainMenu,
// Format operations.
SetPaperFormat(super::model::PaperFormat),
SetOrientation(super::model::Orientation),
2026-01-14 17:16:25 +01:00
// Metadata.
#[allow(dead_code)]
2026-01-14 17:16:25 +01:00
RefreshMetadata,
2026-01-07 20:22:49 +01:00
// Save operations.
SaveAs,
// Wallpaper.
SetAsWallpaper,
// Errors.
#[allow(dead_code)]
2026-01-07 20:22:49 +01:00
ShowError(String),
#[allow(dead_code)]
2026-01-07 20:22:49 +01:00
ClearError,
// UI refresh.
RefreshView,
// Fallback.
#[allow(dead_code)]
2026-01-07 20:22:49 +01:00
NoOp,
}