Skip to content

Commit

Permalink
fix compile and ui issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Doublonmousse committed Jun 19, 2024
1 parent 4fddb12 commit 51a51ba
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
3 changes: 2 additions & 1 deletion crates/rnote-ui/src/appwindow/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ impl RnAppWindow {
&gettext("Unlock"), //padlock symbol ?
clone!(@weak canvas, @weak appwindow => move |_reload_toast | {
canvas.engine_mut().penholder.pen_mode_state_mut().unlock_pen(active_pen);
appwindow.sidebar().settings_panel().lock_pen_switch().set_state(false);
appwindow.sidebar().settings_panel().set_lock_state(active_pen,false);
appwindow.sidebar().settings_panel().refresh_ui(&appwindow.active_tab_wrapper());
}
)
, 2,
Expand Down
8 changes: 6 additions & 2 deletions crates/rnote-ui/src/settingspanel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub(crate) use penmoderow::RnPenModeRow;
pub(crate) use penshortcutrow::RnPenShortcutRow;

use rnote_compose::ext::Vector2Ext;
use rnote_engine::pens::PenMode;

// Imports
use crate::{RnAppWindow, RnCanvasWrapper, RnIconPicker, RnUnitEntry};
Expand Down Expand Up @@ -351,8 +352,11 @@ impl RnSettingsPanel {
self.imp().general_inertial_scrolling_row.clone()
}

pub(crate) fn lock_pen_switch(&self) -> gtk4::Switch {
self.imp().lock_pen_mode.imp().mode.clone()
pub(crate) fn set_lock_state(&self, pen_mode: PenMode, state: bool) {
match pen_mode {
PenMode::Pen => self.imp().lock_pen_mode.get().set_lock_state(state),
PenMode::Eraser => self.imp().lock_eraser_mode.get().set_lock_state(state),
}
}

pub(crate) fn document_layout(&self) -> Layout {
Expand Down
14 changes: 7 additions & 7 deletions crates/rnote-ui/src/settingspanel/penmoderow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ mod imp {
row.emit_by_name::<()>("action-changed", &[]);
});

// need to add the switch signal for the switch pen
self.mode.get().connect_active_notify(|_ev| {
println!("button pressed");
});

obj.connect_local(
"action-changed",
false,
Expand Down Expand Up @@ -130,11 +125,11 @@ impl RnPenModeRow {
*self.imp().action.borrow()
}

/* #[allow(unused)]
#[allow(unused)]
pub(crate) fn set_action(&self, action: ShortcutAction) {
*self.imp().action.borrow_mut() = action;
self.emit_by_name::<()>("action-changed", &[]);
} */
}

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

pub(crate) fn set_lock_state(&self, state: bool) {
self.imp().mode.get().set_state(state);
self.imp().mode.get().set_active(state);
}

fn update_ui(&self) {
match self.action() {
// either need a new action or something else
Expand Down

0 comments on commit 51a51ba

Please sign in to comment.