edit/crop: Apply crop on save

This commit is contained in:
Sophie Herold 2025-01-22 15:41:56 +01:00
parent 9cb08d288d
commit 729f5249ed
6 changed files with 78 additions and 28 deletions

View file

@ -1,4 +1,4 @@
// Copyright (c) 2024 Sophie Herold
// Copyright (c) 2024-2025 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
@ -17,7 +17,7 @@
use gtk::prelude::*;
use crate::widgets::LpWindow;
use crate::widgets::{LpEditWindow, LpWindow};
pub trait ParentWindow: WidgetExt {
fn window(&self) -> LpWindow {
@ -29,6 +29,15 @@ pub trait ParentWindow: WidgetExt {
result.unwrap()
}
fn edit_window(&self) -> LpEditWindow {
let parent = self.parent().unwrap();
parent
.clone()
.downcast()
.unwrap_or_else(|_| parent.edit_window())
}
}
impl<T: WidgetExt> ParentWindow for T {}