editing: Add save edited file

This commit is contained in:
Sophie Herold 2024-10-18 15:51:34 +02:00
parent a2d5493714
commit 05dbee6a0b
6 changed files with 154 additions and 29 deletions

View file

@ -1,3 +1,20 @@
// Copyright (c) 2024 Sophie Herold
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// SPDX-License-Identifier: GPL-3.0-or-later
use glycin::Operations;
use tiling::RenderOptions;
@ -28,7 +45,7 @@ impl imp::LpImage {
}
impl LpImage {
pub fn set_operations(&self, operations: Option<glycin::Operations>) {
pub fn set_operations(&self, operations: Option<Arc<glycin::Operations>>) {
let imp = self.imp();
if operations.is_none() {
@ -55,19 +72,4 @@ impl LpImage {
imp.configure_best_fit();
self.queue_draw();
}
pub fn add_operation(&self, operation: glycin::Operation) {
let imp = self.imp();
let mut operations = imp
.operations
.borrow()
.as_ref()
.map(|x| x.operations().to_vec())
.unwrap_or_default();
operations.push(operation);
self.set_operations(Some(Operations::new(operations)));
}
}