diff options
Diffstat (limited to 'src/MTools/Comp/MWritable.pm')
-rw-r--r-- | src/MTools/Comp/MWritable.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/MTools/Comp/MWritable.pm b/src/MTools/Comp/MWritable.pm index ec7fbd8..f4826b3 100644 --- a/src/MTools/Comp/MWritable.pm +++ b/src/MTools/Comp/MWritable.pm @@ -76,6 +76,8 @@ sub new { binding ($src, "<Button-$button>", [\&__beginWrite, $self, Ev('x'), Ev('y'), Ev('t')]); binding ($src, "<Button$button-Motion>", [\&__writing, $self, Ev('x'), Ev('y'), Ev('t')]); binding ($src, "<ButtonRelease-$button>", [\&__endWrite, $self, Ev('x'), Ev('y'), Ev('t')]); + $self -> {__button} = $button; + $self -> {__source} = $src; $self -> {__curves} = (); $self -> {__points} = (); $self -> {__current_curves} = (); @@ -322,5 +324,24 @@ sub addCurves { push( @{$self -> {__curves}} , $clone ); } } +sub reinitBindings +{ + my ($self) = @_; + my $button = $self->{__button}; + binding ($self->{__source}, "<Button-$button>", [\&__beginWrite, $self, Ev('x'), Ev('y'), Ev('t')]); + binding ($self->{__source}, "<Button$button-Motion>", [\&__writing, $self, Ev('x'), Ev('y'), Ev('t')]); + binding ($self->{__source}, "<ButtonRelease-$button>", [\&__endWrite, $self, Ev('x'), Ev('y'), Ev('t')]); + +} +sub eraseAll { + my ($self) = @_; + foreach my $curve (@{$self -> {__curves}}) + { + mdelete($curve); + } + + $self -> {__curves} = (); + $self -> {__old_coords} = (); +} 1; |