Remember annotation mode
This commit is contained in:
parent
3eaaae6847
commit
ea07c37fe0
2 changed files with 18 additions and 1 deletions
|
|
@ -489,12 +489,17 @@ mod imp {
|
|||
}
|
||||
});
|
||||
|
||||
// Connect draw mode button (headerbar toggle)
|
||||
// Remember annotation mode and apply it to each newly opened image.
|
||||
let draw_mode_settings = LpApplication::default().settings();
|
||||
imp.draw_mode_button.connect_toggled(glib::clone!(
|
||||
#[weak]
|
||||
obj,
|
||||
move |btn| {
|
||||
let active = btn.is_active();
|
||||
if let Err(err) = draw_mode_settings.set_boolean("annotation-mode", active)
|
||||
{
|
||||
tracing::warn!("Failed to save annotation mode setting: {err}");
|
||||
}
|
||||
let imp = obj.imp();
|
||||
imp.draw_toolbar_revealer.set_reveal_child(active);
|
||||
if let Some(img) = imp.image_view.current_image() {
|
||||
|
|
@ -509,6 +514,11 @@ mod imp {
|
|||
}
|
||||
}
|
||||
));
|
||||
imp.draw_mode_button.set_active(
|
||||
LpApplication::default()
|
||||
.settings()
|
||||
.boolean("annotation-mode"),
|
||||
);
|
||||
|
||||
// Tool buttons
|
||||
imp.draw_freeform_btn.connect_toggled(glib::clone!(
|
||||
|
|
@ -1004,6 +1014,9 @@ impl LpImageWindow {
|
|||
// Properties view
|
||||
let current_image: Option<LpImage> = current_page.as_ref().map(|x| x.image());
|
||||
imp.properties_view.set_image(current_image.as_ref());
|
||||
if let Some(image) = current_image.as_ref() {
|
||||
image.set_drawing_mode(imp.draw_mode_button.is_active());
|
||||
}
|
||||
|
||||
let has_image = current_page.is_some();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue