aboutsummaryrefslogtreecommitdiff
path: root/src/MTools
diff options
context:
space:
mode:
Diffstat (limited to 'src/MTools')
-rw-r--r--src/MTools/Comp/MMultiSelection.pm20
-rw-r--r--src/MTools/Comp/MReconizer.pm26
-rw-r--r--src/MTools/Comp/MWritable.pm21
3 files changed, 56 insertions, 11 deletions
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, "<Button-$button>", [\&__pressed, $self, Ev('x'), Ev('y')]);
binding ($src, "<Button$button-Motion>", [\&__moved, $self, Ev('x'), Ev('y')]);
binding ($src, "<ButtonRelease-$button>", [\&__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}, "<Button-$button>", [\&__pressed, $self, Ev('x'), Ev('y')]);
+ binding ($self->{__source}, "<Button$button-Motion>", [\&__moved, $self, Ev('x'), Ev('y')]);
+ binding ($self->{__source}, "<ButtonRelease-$button>", [\&__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, "<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;