File tree 3 files changed +15
-10
lines changed
3 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -343,7 +343,8 @@ impl RnAppWindow {
343
343
& gettext( "Unlock" ) , //padlock symbol ?
344
344
clone!( @weak canvas, @weak appwindow => move |_reload_toast | {
345
345
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( ) ) ;
347
348
}
348
349
)
349
350
, 2 ,
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ pub(crate) use penmoderow::RnPenModeRow;
8
8
pub ( crate ) use penshortcutrow:: RnPenShortcutRow ;
9
9
10
10
use rnote_compose:: ext:: Vector2Ext ;
11
+ use rnote_engine:: pens:: PenMode ;
11
12
12
13
// Imports
13
14
use crate :: { RnAppWindow , RnCanvasWrapper , RnIconPicker , RnUnitEntry } ;
@@ -351,8 +352,11 @@ impl RnSettingsPanel {
351
352
self . imp ( ) . general_inertial_scrolling_row . clone ( )
352
353
}
353
354
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
+ }
356
360
}
357
361
358
362
pub ( crate ) fn document_layout ( & self ) -> Layout {
Original file line number Diff line number Diff line change @@ -77,11 +77,6 @@ mod imp {
77
77
row. emit_by_name :: < ( ) > ( "action-changed" , & [ ] ) ;
78
78
} ) ;
79
79
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
-
85
80
obj. connect_local (
86
81
"action-changed" ,
87
82
false ,
@@ -130,11 +125,11 @@ impl RnPenModeRow {
130
125
* self . imp ( ) . action . borrow ( )
131
126
}
132
127
133
- /* #[allow(unused)]
128
+ #[ allow( unused) ]
134
129
pub ( crate ) fn set_action ( & self , action : ShortcutAction ) {
135
130
* self . imp ( ) . action . borrow_mut ( ) = action;
136
131
self . emit_by_name :: < ( ) > ( "action-changed" , & [ ] ) ;
137
- } */
132
+ }
138
133
139
134
pub ( crate ) fn pen_style ( & self ) -> PenStyle {
140
135
PenStyle :: try_from ( self . selected ( ) ) . unwrap ( )
@@ -144,6 +139,11 @@ impl RnPenModeRow {
144
139
self . set_selected ( style. to_u32 ( ) . unwrap ( ) )
145
140
}
146
141
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
+
147
147
fn update_ui ( & self ) {
148
148
match self . action ( ) {
149
149
// either need a new action or something else
You can’t perform that action at this time.
0 commit comments