From fc06e0835731ec39d2a0c53bd7720b2b40ccc97a Mon Sep 17 00:00:00 2001 From: didier Date: Fri, 23 Nov 2007 16:58:58 +0000 Subject: Reinitialisation des bindings(MWritable MReconizer) ->Effacement de toutes les curves (MWritable) ->Variables Position fleche pour la MMultiselection --- src/MTools/Comp/MMultiSelection.pm | 20 +++++++++++--------- src/MTools/Comp/MReconizer.pm | 26 ++++++++++++++++++++++++-- src/MTools/Comp/MWritable.pm | 21 +++++++++++++++++++++ 3 files changed, 56 insertions(+), 11 deletions(-) (limited to 'src/MTools/Comp') diff --git a/src/MTools/Comp/MMultiSelection.pm b/src/MTools/Comp/MMultiSelection.pm index 14c0c26..8be6ecc 100644 --- a/src/MTools/Comp/MMultiSelection.pm +++ b/src/MTools/Comp/MMultiSelection.pm @@ -362,8 +362,8 @@ sub __fleche_pressed { else { $self -> {__drag_started} = 1; - $self -> {__lx} = $x; - $self -> {__ly} = $y; + $self -> {position_fleche_x} = $x; + $self -> {position_fleche_y} = $y; $self -> notify ('FLECHEPRESSED', $x, $y, $t); } } @@ -385,9 +385,9 @@ sub __fleche_released { } else { - $self -> notify ('FLECHERELEASED', $x - $self -> {__lx}, $y - $self -> {__ly}, $t); - $self -> {__lx} = $x; - $self -> {__ly} = $y; + $self -> notify ('FLECHERELEASED', $x - $self -> {position_fleche_x}, $y - $self -> {position_fleche_y}, $t); + $self -> {position_fleche_x} = $x; + $self -> {position_fleche_y} = $y; } } @@ -427,10 +427,10 @@ sub __fleche_moved { } else { - $self -> notify ('FLECHEMOVED', $x - $self -> {__lx}, $y - $self -> {__ly}, $t); - $self -> __translate_selection ($x - $self -> {__lx}, $y - $self -> {__ly}); - $self -> {__lx} = $x; - $self -> {__ly} = $y; + $self -> notify ('FLECHEMOVED', $x - $self -> {position_fleche_x}, $y - $self -> {position_fleche_y}, $t); + $self -> __translate_selection ($x - $self -> {position_fleche_x}, $y - $self -> {position_fleche_y}); + $self -> {position_fleche_x} = $x; + $self -> {position_fleche_y} = $y; } } @@ -468,6 +468,8 @@ sub __translate_selection { sub __update_fleche_moved { my ($self, $x, $y) = @_; my $pt; + $self -> {position_fleche_x} = $x; + $self -> {position_fleche_y} = $y; if (@{$self -> {__fleche_points}} > 2) { $pt = $self -> {__fleche_points}[@{$self -> {__fleche_points}} - 3]; diff --git a/src/MTools/Comp/MReconizer.pm b/src/MTools/Comp/MReconizer.pm index b3238d4..f30ec20 100644 --- a/src/MTools/Comp/MReconizer.pm +++ b/src/MTools/Comp/MReconizer.pm @@ -60,7 +60,6 @@ sub new { $self -> recordProperty ('callback', undef); $self -> mconfigure (%options); - binding ($src, "", [\&__pressed, $self, Ev('x'), Ev('y')]); binding ($src, "", [\&__moved, $self, Ev('x'), Ev('y')]); binding ($src, "", [\&__released, $self, Ev('x'), Ev('y')]); @@ -72,6 +71,8 @@ sub new { executer ($methode, @_); } }); + $self -> {__button} = $button; + $self -> {__source} = $src; $self -> {__dessin} = undef; $self -> {__dessin} = my $dessin = new MTools::GUI::MGroup (1); @@ -141,6 +142,27 @@ sub __released { $self -> {__anim__disparition} -> start (); } } - +sub getpoints { + my ($self) = @_; + return $self -> {__points}; +} +sub stopanim +{ + my ($self) = @_; + if ($self -> {__anim__disparition}) + { + + $self -> {__anim__disparition}->stop(); + } +} +sub reinitBindings +{ + my ($self) = @_; + my $button = $self->{__button}; + binding ($self->{__source}, "", [\&__pressed, $self, Ev('x'), Ev('y')]); + binding ($self->{__source}, "", [\&__moved, $self, Ev('x'), Ev('y')]); + binding ($self->{__source}, "", [\&__released, $self, Ev('x'), Ev('y')]); + +} 1; 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, "", [\&__beginWrite, $self, Ev('x'), Ev('y'), Ev('t')]); binding ($src, "", [\&__writing, $self, Ev('x'), Ev('y'), Ev('t')]); binding ($src, "", [\&__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}, "", [\&__beginWrite, $self, Ev('x'), Ev('y'), Ev('t')]); + binding ($self->{__source}, "", [\&__writing, $self, Ev('x'), Ev('y'), Ev('t')]); + binding ($self->{__source}, "", [\&__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; -- cgit v1.1