noctua/src/app/message.rs

89 lines
2.1 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
//
2026-01-14 17:16:25 +01:00
// All application messages (events, user actions, signals).
2026-01-07 20:22:49 +01:00
use std::path::PathBuf;
2026-01-14 17:16:25 +01:00
use crate::app::ContextPage;
/// Messages emitted by user actions, async I/O, or internal signals.
2026-01-07 20:22:49 +01:00
#[derive(Debug, Clone)]
pub enum AppMessage {
2026-01-14 17:16:25 +01:00
// === File / Navigation ===
/// Open a file at the given path.
#[allow(dead_code)]
2026-01-07 20:22:49 +01:00
OpenPath(PathBuf),
2026-01-14 17:16:25 +01:00
/// Navigate to the next document in folder.
2026-01-07 20:22:49 +01:00
NextDocument,
2026-01-14 17:16:25 +01:00
/// Navigate to the previous document in folder.
2026-01-07 20:22:49 +01:00
PrevDocument,
2026-01-14 17:16:25 +01:00
// === Transformations ===
/// Rotate 90° clockwise.
RotateCW,
/// Rotate 90° counter-clockwise.
RotateCCW,
/// Flip horizontally (mirror).
FlipHorizontal,
/// Flip vertically.
FlipVertical,
2026-01-07 20:22:49 +01:00
2026-01-14 17:16:25 +01:00
// === Zoom ===
/// Zoom in by a fixed step.
2026-01-07 20:22:49 +01:00
ZoomIn,
2026-01-14 17:16:25 +01:00
/// Zoom out by a fixed step.
2026-01-07 20:22:49 +01:00
ZoomOut,
2026-01-14 17:16:25 +01:00
/// Reset zoom to 100%.
2026-01-07 20:22:49 +01:00
ZoomReset,
2026-01-14 17:16:25 +01:00
/// Fit document to window.
2026-01-07 20:22:49 +01:00
ZoomFit,
/// Update zoom and pan from viewer (mouse interaction).
ViewerStateChanged { scale: f32, offset_x: f32, offset_y: f32 },
2026-01-07 20:22:49 +01:00
2026-01-14 17:16:25 +01:00
// === Pan ===
/// Pan image left.
2026-01-07 20:22:49 +01:00
PanLeft,
2026-01-14 17:16:25 +01:00
/// Pan image right.
2026-01-07 20:22:49 +01:00
PanRight,
2026-01-14 17:16:25 +01:00
/// Pan image up.
2026-01-07 20:22:49 +01:00
PanUp,
2026-01-14 17:16:25 +01:00
/// Pan image down.
2026-01-07 20:22:49 +01:00
PanDown,
2026-01-14 17:16:25 +01:00
/// Reset pan to center.
2026-01-07 20:22:49 +01:00
PanReset,
2026-01-14 17:16:25 +01:00
// === Tool Modes ===
/// Toggle crop mode.
2026-01-07 20:22:49 +01:00
ToggleCropMode,
2026-01-14 17:16:25 +01:00
/// Toggle scale mode.
2026-01-07 20:22:49 +01:00
ToggleScaleMode,
2026-01-14 17:16:25 +01:00
// === Panels (COSMIC-managed) ===
/// Toggle a context drawer page.
ToggleContextPage(ContextPage),
/// Toggle the nav bar (left panel) visibility.
ToggleNavBar,
2026-01-14 17:16:25 +01:00
// === Metadata ===
/// Refresh metadata from the current document.
#[allow(dead_code)]
2026-01-14 17:16:25 +01:00
RefreshMetadata,
2026-01-07 20:22:49 +01:00
// === Wallpaper ===
/// Set current image as wallpaper.
SetAsWallpaper,
2026-01-14 17:16:25 +01:00
// === Errors ===
/// Display an error message.
#[allow(dead_code)]
2026-01-07 20:22:49 +01:00
ShowError(String),
2026-01-14 17:16:25 +01:00
/// Clear the current error.
#[allow(dead_code)]
2026-01-07 20:22:49 +01:00
ClearError,
/// Fallback for unhandled or no-op cases.
#[allow(dead_code)]
2026-01-07 20:22:49 +01:00
NoOp,
}