Skip to content

Commit 51a51ba

Browse files
committed
fix compile and ui issue
1 parent 4fddb12 commit 51a51ba

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

crates/rnote-ui/src/appwindow/actions.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ impl RnAppWindow {
343343
&gettext("Unlock"), //padlock symbol ?
344344
clone!(@weak canvas, @weak appwindow => move |_reload_toast | {
345345
canvas.engine_mut().penholder.pen_mode_state_mut().unlock_pen(active_pen);
346-
appwindow.sidebar().settings_panel().lock_pen_switch().set_state(false);
346+
appwindow.sidebar().settings_panel().set_lock_state(active_pen,false);
347+
appwindow.sidebar().settings_panel().refresh_ui(&appwindow.active_tab_wrapper());
347348
}
348349
)
349350
, 2,

crates/rnote-ui/src/settingspanel/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub(crate) use penmoderow::RnPenModeRow;
88
pub(crate) use penshortcutrow::RnPenShortcutRow;
99

1010
use rnote_compose::ext::Vector2Ext;
11+
use rnote_engine::pens::PenMode;
1112

1213
// Imports
1314
use crate::{RnAppWindow, RnCanvasWrapper, RnIconPicker, RnUnitEntry};
@@ -351,8 +352,11 @@ impl RnSettingsPanel {
351352
self.imp().general_inertial_scrolling_row.clone()
352353
}
353354

354-
pub(crate) fn lock_pen_switch(&self) -> gtk4::Switch {
355-
self.imp().lock_pen_mode.imp().mode.clone()
355+
pub(crate) fn set_lock_state(&self, pen_mode: PenMode, state: bool) {
356+
match pen_mode {
357+
PenMode::Pen => self.imp().lock_pen_mode.get().set_lock_state(state),
358+
PenMode::Eraser => self.imp().lock_eraser_mode.get().set_lock_state(state),
359+
}
356360
}
357361

358362
pub(crate) fn document_layout(&self) -> Layout {

crates/rnote-ui/src/settingspanel/penmoderow.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ mod imp {
7777
row.emit_by_name::<()>("action-changed", &[]);
7878
});
7979

80-
// need to add the switch signal for the switch pen
81-
self.mode.get().connect_active_notify(|_ev| {
82-
println!("button pressed");
83-
});
84-
8580
obj.connect_local(
8681
"action-changed",
8782
false,
@@ -130,11 +125,11 @@ impl RnPenModeRow {
130125
*self.imp().action.borrow()
131126
}
132127

133-
/* #[allow(unused)]
128+
#[allow(unused)]
134129
pub(crate) fn set_action(&self, action: ShortcutAction) {
135130
*self.imp().action.borrow_mut() = action;
136131
self.emit_by_name::<()>("action-changed", &[]);
137-
} */
132+
}
138133

139134
pub(crate) fn pen_style(&self) -> PenStyle {
140135
PenStyle::try_from(self.selected()).unwrap()
@@ -144,6 +139,11 @@ impl RnPenModeRow {
144139
self.set_selected(style.to_u32().unwrap())
145140
}
146141

142+
pub(crate) fn set_lock_state(&self, state: bool) {
143+
self.imp().mode.get().set_state(state);
144+
self.imp().mode.get().set_active(state);
145+
}
146+
147147
fn update_ui(&self) {
148148
match self.action() {
149149
// either need a new action or something else

0 commit comments

Comments
 (0)