feature: PDF and PDF thumbnails and refresh UI
- Implement PDF and PDF thumbnail generation with incremental loading - Add UI refresh mechanism (tick counter + RefreshView message) - Improve fl! macro with named parameters - Clean up code organization (mod.rs: wiring, model.rs: state only)
This commit is contained in:
parent
220a886acc
commit
1182b7b55d
30 changed files with 1929 additions and 691 deletions
|
|
@ -1,88 +1,71 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/app/message.rs
|
||||
//
|
||||
// All application messages (events, user actions, signals).
|
||||
// Application messages: events, user actions, and internal signals.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::app::ContextPage;
|
||||
|
||||
/// Messages emitted by user actions, async I/O, or internal signals.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum AppMessage {
|
||||
// === File / Navigation ===
|
||||
/// Open a file at the given path.
|
||||
// File / navigation.
|
||||
#[allow(dead_code)]
|
||||
OpenPath(PathBuf),
|
||||
/// Navigate to the next document in folder.
|
||||
NextDocument,
|
||||
/// Navigate to the previous document in folder.
|
||||
PrevDocument,
|
||||
GotoPage(u32),
|
||||
GenerateThumbnailPage(u32),
|
||||
|
||||
// === Transformations ===
|
||||
/// Rotate 90° clockwise.
|
||||
// Transformations.
|
||||
RotateCW,
|
||||
/// Rotate 90° counter-clockwise.
|
||||
RotateCCW,
|
||||
/// Flip horizontally (mirror).
|
||||
FlipHorizontal,
|
||||
/// Flip vertically.
|
||||
FlipVertical,
|
||||
|
||||
// === Zoom ===
|
||||
/// Zoom in by a fixed step.
|
||||
// View / zoom.
|
||||
ZoomIn,
|
||||
/// Zoom out by a fixed step.
|
||||
ZoomOut,
|
||||
/// Reset zoom to 100%.
|
||||
ZoomReset,
|
||||
/// Fit document to window.
|
||||
ZoomFit,
|
||||
/// Update zoom and pan from viewer (mouse interaction).
|
||||
ViewerStateChanged { scale: f32, offset_x: f32, offset_y: f32 },
|
||||
ViewerStateChanged {
|
||||
scale: f32,
|
||||
offset_x: f32,
|
||||
offset_y: f32,
|
||||
},
|
||||
|
||||
// === Pan ===
|
||||
/// Pan image left.
|
||||
// Pan control.
|
||||
PanLeft,
|
||||
/// Pan image right.
|
||||
PanRight,
|
||||
/// Pan image up.
|
||||
PanUp,
|
||||
/// Pan image down.
|
||||
PanDown,
|
||||
/// Reset pan to center.
|
||||
PanReset,
|
||||
|
||||
// === Tool Modes ===
|
||||
/// Toggle crop mode.
|
||||
// Tool modes.
|
||||
ToggleCropMode,
|
||||
/// Toggle scale mode.
|
||||
ToggleScaleMode,
|
||||
|
||||
// === Panels (COSMIC-managed) ===
|
||||
/// Toggle a context drawer page.
|
||||
// Panels.
|
||||
ToggleContextPage(ContextPage),
|
||||
/// Toggle the nav bar (left panel) visibility.
|
||||
ToggleNavBar,
|
||||
|
||||
// === Metadata ===
|
||||
/// Refresh metadata from the current document.
|
||||
// Metadata.
|
||||
#[allow(dead_code)]
|
||||
RefreshMetadata,
|
||||
|
||||
// === Wallpaper ===
|
||||
/// Set current image as wallpaper.
|
||||
// Wallpaper.
|
||||
SetAsWallpaper,
|
||||
|
||||
// === Errors ===
|
||||
/// Display an error message.
|
||||
// Errors.
|
||||
#[allow(dead_code)]
|
||||
ShowError(String),
|
||||
/// Clear the current error.
|
||||
#[allow(dead_code)]
|
||||
ClearError,
|
||||
|
||||
/// Fallback for unhandled or no-op cases.
|
||||
// UI refresh.
|
||||
RefreshView,
|
||||
|
||||
// Fallback.
|
||||
#[allow(dead_code)]
|
||||
NoOp,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue