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-18 20:35:12 +01:00
|
|
|
// Application messages: events, user actions, and internal 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;
|
|
|
|
|
|
2026-01-07 20:22:49 +01:00
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub enum AppMessage {
|
2026-01-18 20:35:12 +01:00
|
|
|
// File / navigation.
|
2026-01-15 18:21:50 +01:00
|
|
|
#[allow(dead_code)]
|
2026-01-07 20:22:49 +01:00
|
|
|
OpenPath(PathBuf),
|
|
|
|
|
NextDocument,
|
|
|
|
|
PrevDocument,
|
2026-01-18 20:35:12 +01:00
|
|
|
GotoPage(u32),
|
|
|
|
|
GenerateThumbnailPage(u32),
|
2026-01-07 20:22:49 +01:00
|
|
|
|
2026-01-18 20:35:12 +01:00
|
|
|
// Transformations.
|
2026-01-14 17:16:25 +01:00
|
|
|
RotateCW,
|
|
|
|
|
RotateCCW,
|
|
|
|
|
FlipHorizontal,
|
|
|
|
|
FlipVertical,
|
2026-01-07 20:22:49 +01:00
|
|
|
|
2026-01-18 20:35:12 +01:00
|
|
|
// View / zoom.
|
2026-01-07 20:22:49 +01:00
|
|
|
ZoomIn,
|
|
|
|
|
ZoomOut,
|
|
|
|
|
ZoomReset,
|
|
|
|
|
ZoomFit,
|
2026-01-18 20:35:12 +01:00
|
|
|
ViewerStateChanged {
|
|
|
|
|
scale: f32,
|
|
|
|
|
offset_x: f32,
|
|
|
|
|
offset_y: f32,
|
|
|
|
|
},
|
2026-01-07 20:22:49 +01:00
|
|
|
|
2026-01-18 20:35:12 +01:00
|
|
|
// Pan control.
|
2026-01-07 20:22:49 +01:00
|
|
|
PanLeft,
|
|
|
|
|
PanRight,
|
|
|
|
|
PanUp,
|
|
|
|
|
PanDown,
|
|
|
|
|
PanReset,
|
|
|
|
|
|
2026-01-18 20:35:12 +01:00
|
|
|
// Tool modes.
|
2026-01-07 20:22:49 +01:00
|
|
|
ToggleCropMode,
|
|
|
|
|
ToggleScaleMode,
|
|
|
|
|
|
2026-01-18 20:35:12 +01:00
|
|
|
// Panels.
|
2026-01-14 17:16:25 +01:00
|
|
|
ToggleContextPage(ContextPage),
|
2026-01-14 18:53:36 +01:00
|
|
|
ToggleNavBar,
|
2026-01-14 17:16:25 +01:00
|
|
|
|
2026-01-18 20:35:12 +01:00
|
|
|
// Metadata.
|
2026-01-15 18:21:50 +01:00
|
|
|
#[allow(dead_code)]
|
2026-01-14 17:16:25 +01:00
|
|
|
RefreshMetadata,
|
2026-01-07 20:22:49 +01:00
|
|
|
|
2026-01-18 20:35:12 +01:00
|
|
|
// Wallpaper.
|
2026-01-15 20:37:14 +01:00
|
|
|
SetAsWallpaper,
|
|
|
|
|
|
2026-01-18 20:35:12 +01:00
|
|
|
// Errors.
|
2026-01-15 18:21:50 +01:00
|
|
|
#[allow(dead_code)]
|
2026-01-07 20:22:49 +01:00
|
|
|
ShowError(String),
|
2026-01-15 18:21:50 +01:00
|
|
|
#[allow(dead_code)]
|
2026-01-07 20:22:49 +01:00
|
|
|
ClearError,
|
|
|
|
|
|
2026-01-18 20:35:12 +01:00
|
|
|
// UI refresh.
|
|
|
|
|
RefreshView,
|
|
|
|
|
|
|
|
|
|
// Fallback.
|
2026-01-15 18:21:50 +01:00
|
|
|
#[allow(dead_code)]
|
2026-01-07 20:22:49 +01:00
|
|
|
NoOp,
|
|
|
|
|
}
|