refactor: centralize file handling, fix zoom display and cleanup
File handling (document/file.rs): - move file operations from app/mod.rs to document/file.rs - add open_file_dialog() for native file picker - add collect_directory_siblings() for navigation context - add open_document_from_path() as main entry point Zoom/View (panels.rs, canvas.rs, model.rs): - fix zoom display using ViewMode enum - ViewMode::Fit shows Fit, ActualSize shows 100%, Custom shows percentage Model/Update cleanup: - adjust model.rs for new file handling - update.rs: use centralized file functions - document/mod.rs: re-exports for file module i18n: BB ctua.ftl with new/changed strings" A - update noctua.ftl with new/changed strings"
This commit is contained in:
parent
4de63d8549
commit
4c10a80b67
8 changed files with 212 additions and 259 deletions
|
|
@ -14,7 +14,7 @@ pub mod vector;
|
|||
use cosmic::iced::widget::image as iced_image;
|
||||
use cosmic::iced_renderer::graphics::image::image_rs::ImageFormat as CosmicImageFormat;
|
||||
use std::fmt;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::path::Path;
|
||||
|
||||
use self::portable::PortableDocument;
|
||||
use self::raster::RasterDocument;
|
||||
|
|
@ -89,15 +89,6 @@ impl DocumentContent {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the underlying filesystem path of this document, if any.
|
||||
pub fn path(&self) -> Option<&PathBuf> {
|
||||
match self {
|
||||
DocumentContent::Raster(doc) => doc.path.as_ref(),
|
||||
DocumentContent::Vector(doc) => Some(&doc.path),
|
||||
DocumentContent::Portable(doc) => Some(&doc.path),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the native dimensions (width, height) of the document in pixels.
|
||||
///
|
||||
/// For raster images this is the actual pixel size.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue