feat: import Rnote notebooks (Issue #47)

The import (menu entry and drag & drop) now also accepts .rnote files
from Rnote 0.5.10 on, including the transformation and document config
layouts that changed in 0.13 and 0.15. Taken over: brush strokes with
their pressure curve, shapes as outlines, texts, bitmap images and SVG
images, which are rasterized with resvg (Rnote stores imported PDF
pages as SVG). Fixed-size and continuous documents keep their pages;
infinite ones become an endless notebook.

The parts shared with the Xournal++ import moved to src/import.rs.
resvg and its dependencies were added to the Flatpak cargo sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
haraldandClaude Opus 5.5 committed 2026-10-27 11:40:51 +01:00
1 parent 2bd697ef82
commit 46026eb8e5
14 files changed
+1567 -187

No files matched your search

+11 -4
View File
@@ -1,4 +1,4 @@
//! Eingebaute, stift- und fingertaugliche Dateiauswahl für Bilder, PDFs und Xournal++-Dateien.
//! Eingebaute, stift- und fingertaugliche Dateiauswahl für Bilder und importierbare Dateien (PDF, Xournal++, Rnote).
//!
//! Bewusst ohne Systemdialog: der bräuchte GTK oder das Desktop-Portal, die unter WSL und auf
//! schlanken Systemen oft fehlen. Die Auswahl zeigt Ordner und die passenden Dateien des
@@ -22,7 +22,7 @@ pub struct PickerEntry {
pub enum PickerKind {
/// Bilder zum Einfügen auf der aktuellen Seite
Image,
/// PDF or Xournal++ file to import as a new notebook
/// PDF, Xournal++ or Rnote file to import as a new notebook
Import,
}
@@ -31,7 +31,7 @@ impl PickerKind {
pub fn accepts(self, path: &Path) -> bool {
match self {
PickerKind::Image => is_supported_image_path(path),
PickerKind::Import => is_pdf_path(path) || crate::xopp::is_xopp_path(path),
PickerKind::Import => crate::import::is_importable_path(path),
}
}
}
@@ -193,6 +193,7 @@ mod tests {
"c.webp",
"Skript.PDF",
"mathe.xopp",
"skizze.rnote",
] {
std::fs::write(dir.path().join(name), b"x").unwrap();
}
@@ -213,7 +214,13 @@ mod tests {
);
assert_eq!(
names(PickerKind::Import),
["aOrdner", "zOrdner", "mathe.xopp", "Skript.PDF"]
[
"aOrdner",
"zOrdner",
"mathe.xopp",
"skizze.rnote",
"Skript.PDF"
]
);
}