From c5866f304210618979d03c561b1e3f6f83200bce Mon Sep 17 00:00:00 2001 From: ribet Date: Wed, 21 Mar 2007 10:19:39 +0000 Subject: Import initial --- exemples/Comete.pm | 75 ++++++ exemples/Lien.pm | 115 ++++++++ exemples/Rattrapage.pm | 181 +++++++++++++ exemples/Selec.pm | 91 +++++++ exemples/Strip.pm | 199 ++++++++++++++ exemples/StripAntiRecouvre.pm | 71 +++++ exemples/Target.pm | 69 +++++ exemples/Visage.pm | 50 ++++ exemples/data/Ampoule.svg | 15 ++ exemples/data/Malouco.svg | 61 +++++ exemples/data/VisageNormal.svg | 58 ++++ exemples/data/comete.svg | 105 ++++++++ exemples/data/fond_etiquette.png | Bin 0 -> 455 bytes exemples/data/miniclochet.png | Bin 0 -> 957 bytes exemples/data/miniclochev.png | Bin 0 -> 1551 bytes exemples/data/rattrapage.svg | 256 ++++++++++++++++++ exemples/data/strip.svg | 197 ++++++++++++++ exemples/data/strip_approche_arrival.svg | 437 +++++++++++++++++++++++++++++++ exemples/exemple_MMover_MInertie.pl | 69 +++++ exemples/exemple_Rattrapage.pl | 52 ++++ exemples/exemple_SVG.pl | 59 +++++ exemples/exemple_Strip.pl | 54 ++++ exemples/exemple_anti_recouvrement.pl | 39 +++ exemples/exemple_multi_selection.pl | 72 +++++ exemples/exemple_skin_plink.pl | 38 +++ 25 files changed, 2363 insertions(+) create mode 100644 exemples/Comete.pm create mode 100644 exemples/Lien.pm create mode 100644 exemples/Rattrapage.pm create mode 100644 exemples/Selec.pm create mode 100644 exemples/Strip.pm create mode 100644 exemples/StripAntiRecouvre.pm create mode 100644 exemples/Target.pm create mode 100644 exemples/Visage.pm create mode 100644 exemples/data/Ampoule.svg create mode 100644 exemples/data/Malouco.svg create mode 100644 exemples/data/VisageNormal.svg create mode 100644 exemples/data/comete.svg create mode 100644 exemples/data/fond_etiquette.png create mode 100644 exemples/data/miniclochet.png create mode 100644 exemples/data/miniclochev.png create mode 100644 exemples/data/rattrapage.svg create mode 100644 exemples/data/strip.svg create mode 100644 exemples/data/strip_approche_arrival.svg create mode 100755 exemples/exemple_MMover_MInertie.pl create mode 100755 exemples/exemple_Rattrapage.pl create mode 100755 exemples/exemple_SVG.pl create mode 100755 exemples/exemple_Strip.pl create mode 100755 exemples/exemple_anti_recouvrement.pl create mode 100755 exemples/exemple_multi_selection.pl create mode 100755 exemples/exemple_skin_plink.pl (limited to 'exemples') diff --git a/exemples/Comete.pm b/exemples/Comete.pm new file mode 100644 index 0000000..bb86c66 --- /dev/null +++ b/exemples/Comete.pm @@ -0,0 +1,75 @@ +package Comete; +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +use strict; + +use MTools; + +use vars qw /@ISA/; + +use MTools::MGroup; +use MTools::Comp::MMover; + + +BEGIN +{ + @ISA = qw /MTools::MGroup/; +} + +sub new { + my ($class, $parent, $name, $x, $y) = @_; + my $self = new MTools::MGroup ($parent); + bless $self, $class; + + $self -> recordProperty ('x', $x); + $self -> recordProperty ('y', $y); + $self -> recordProperty ('name', $name); + $self -> recordProperty ('cautrax', 0); + $self -> recordProperty ('cautray', 0); + + $self -> plisten ('x', sub { + my ($src, $key, $value) = @_; + $self -> mconfigure ('cautrax' => $value / 25); + } + ); + + $self -> plisten ('y', sub { + my ($src, $key, $value) = @_; + $self -> mconfigure ('cautray' => $value / 25); + } + ); + + + my $target = minstanciate ('comete.svg#comete', 1); + $target -> translate ($x, $y); + plink ([$self, 'name'], [mfind ($target, 'callsign'), '-text']); + + my $mover = new MTools::Comp::MMover ($target, $target, 1, x_max => 800, y_max => 600, y_min => 0, x_min => 0); + + plink ([$self, 'x'], [$mover, 'x']); + plink ([$self, 'y'], [$mover, 'y']); + + return $self; +} + +sub addRattrapage { +} + +sub removeRattrapage { +} + +1; diff --git a/exemples/Lien.pm b/exemples/Lien.pm new file mode 100644 index 0000000..d8665bc --- /dev/null +++ b/exemples/Lien.pm @@ -0,0 +1,115 @@ +package Lien; +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +use strict; + +use MTools; +use MTools::MGroup; +use MTools::GUI::MCurve; + +use vars qw /@ISA/; + + +BEGIN +{ + @ISA = qw /MTools::MGroup/; +} + +sub new { + my ($class, $parent, $comete_1, $comete_2, %options) = @_; + my $self = new MTools::MGroup ($parent); + bless $self, $class; + + $self -> recordProperty ('comete_1', $comete_1); + $self -> recordProperty ('comete_2', $comete_2); + $self -> recordProperty ('distance', 100); + $self -> recordProperty ('c_x', 0); + $self -> recordProperty ('c_y', 0); + $self -> recordProperty ('warning', 0); + + $self -> {__lien} = new MTools::GUI::MCurve ($self, [[0, 0], [0, 0]], + -linecolor => defined $options {color} ? $options {color} : '#243033;60', + -linestyle => 'dashed', + -linewidth => defined $options {width} ? $options {width} : 2, + -filled => 0, -visible => 1, -sensitive => 0 + ); + $self -> plisten ('warning', sub { + my ($src, $key, $val, $old) = @_; + if ($val) + { + $self -> {__lien} -> mconfigure ( + -linecolor => 'red', + -linewidth => 8, + -linestyle => 'simple', + ); + } + else + { + $self -> {__lien} -> mconfigure ( + -linecolor => '#243033;60', + -linestyle => 'dashed', + -linewidth => defined $options {width} ? $options {width} : 2, + ); + } + }); + $self -> {__c1_x} = $comete_1 -> plisten ('x', [$self, 'redraw']); + $self -> {__c1_y} = $comete_1 -> plisten ('y', [$self, 'redraw']); + $self -> {__c2_x} = $comete_2 -> plisten ('x', [$self, 'redraw']); + $self -> {__c2_y} = $comete_2 -> plisten ('y', [$self, 'redraw']); + + $comete_1 -> addRattrapage ($self); + $comete_2 -> addRattrapage ($self); + + return $self; +} + +sub mdelete { + my ($self) = @_; + my $comete_1 = $self -> mget ('comete_1'); + my $comete_2 = $self -> mget ('comete_2'); + $comete_1 -> unplisten ('x', $self -> {__c1_x}); + $comete_1 -> unplisten ('y', $self -> {__c1_y}); + $comete_2 -> unplisten ('x', $self -> {__c2_x}); + $comete_2 -> unplisten ('y', $self -> {__c2_y}); + $comete_1 -> removeRattrapage ($self); + $comete_2 -> removeRattrapage ($self); + MTools::mdelete ($self); +} + +sub redraw { + my ($self) = @_; + my $comete_1 = $self -> mget ('comete_1'); + my $comete_2 = $self -> mget ('comete_2'); + my $x0 = $comete_1 -> mget ('x'); + my $y0 = $comete_1 -> mget ('y'); + my $x1 = $comete_2 -> mget ('x'); + my $y1 = $comete_2 -> mget ('y'); + $self -> {__lien} -> coords ([$x0, $y0, $x1, $y1]); + my $cautra_x0 = $comete_1 -> mget ('cautrax'); + my $cautra_y0 = $comete_1 -> mget ('cautray'); + my $cautra_x1 = $comete_2 -> mget ('cautrax'); + my $cautra_y1 = $comete_2 -> mget ('cautray'); + my $dist = sqrt (($cautra_x1 - $cautra_x0) ** 2 + ($cautra_y1 - $cautra_y0) ** 2); + $self -> mconfigure ( + distance => int ($dist * 10) / 10, + c_x => ($x0 + $x1) / 2, + c_y => ($y0 + $y1) / 2, + ); + +} + +1; diff --git a/exemples/Rattrapage.pm b/exemples/Rattrapage.pm new file mode 100644 index 0000000..c6ec0bc --- /dev/null +++ b/exemples/Rattrapage.pm @@ -0,0 +1,181 @@ +package Rattrapage; +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +use strict; + +use vars qw /@ISA/; + +use MTools; +use MTools::MGroup; +use MTools::Widget::MToggleBouton; +use MTools::Widget::MBouton; +use Lien; + +use Tk; + +BEGIN +{ + @ISA = qw /MTools::MGroup/; +} + +sub new { + my ($class, $parent, $comete1, $comete2, $manager, %options) = @_; + my $lien = new Lien ($parent, $comete1, $comete2); + my $self = new MTools::MGroup ($parent); + bless $self, $class; + + $self -> {__lien} = $lien; + $self -> {__manager} = $manager; + + $self -> recordProperty ('seuil', 8); + $self -> recordProperty ('mesure', 10); + $self -> recordProperty ('statut', 'editable'); + $self -> mconfigure (%options); + $self -> recordProperty ('warning', 0); + + $self -> {__listener} = $manager -> plisten ('-visible', sub { + my ($src, $key, $val, $old) = @_; + $self -> mconfigure ('statut' => $val ? 'editable':'non_editable'); + }); + + plink ([$lien, 'distance'], [$self, 'mesure']); + $lien -> plisten ('c_x', sub { + my ($src, $key, $val, $old) = @_; + $self -> translate ($val - $old, 0); + }); + $lien -> plisten ('c_y', sub { + my ($src, $key, $val, $old) = @_; + $self -> translate (0, $val - $old); + }); + $self -> translate ($lien -> mget ('c_x'), $lien -> mget ('c_y')); + + my $bck = minstanciate ('rattrapage.svg#bck', $self); + + my $evolution = new MTools::MSwitch ( + $self, + stable => ['rattrapage.svg#stable'], + montee => ['rattrapage.svg#croissant'], + descente => ['rattrapage.svg#decroissant'], + ); + $self -> plisten ('mesure', sub { + my ($src, $key, $val, $old) = @_; + $self -> {__old_val} = $self -> {__old_val_wait}; + my $tval = $self -> {__old_val}; + if ($val < $tval) + { + $evolution -> mconfigure (state => 'descente'); + } + elsif ($val > $tval) + { + $evolution -> mconfigure (state => 'montee'); + } + $self -> {__old_val_wait} = $old; + if ($val <= $self -> mget ('seuil')) + { + $self -> mconfigure (warning => 1); + } + else + { + $self -> mconfigure (warning => 0); + } + }); + $self -> plisten ('seuil', sub { + my ($src, $key, $val, $old) = @_; + if ($val >= $self -> mget ('mesure')) + { + $self -> mconfigure (warning => 1); + } + else + { + $self -> mconfigure (warning => 0); + } + }); + + my $mesure = minstanciate ('rattrapage.svg#mesure', $self); + my $seuil = minstanciate ('rattrapage.svg#seuil', $self); + minstanciate ('rattrapage.svg#cdr_seuil_h', $self); + minstanciate ('rattrapage.svg#cdr_seuil_b', $self); + + my $bouton_cloche = new MTools::Widget::MToggleBouton ( + parent => $self, + g_on => 'rattrapage.svg#cloche', + g_off => 'rattrapage.svg#cloche_fantome', + e_press => 'CLOCHE', + e_release => 'PAS_CLOCHE' + ); + + my $bouton_delete = new MTools::Widget::MBouton ( + parent => $self, + g_on => 'rattrapage.svg#delete_on', + g_off => 'rattrapage.svg#delete_off', + e_release => 'DELETE' + ); + + my $gp_mask = new MTools::MGroup ($self); + $self -> {__down} = minstanciate ('rattrapage.svg#mask_seuil_down', $gp_mask); + $self -> {__down} -> mconfigure (-visible => 0); + $self -> {__up} = minstanciate ('rattrapage.svg#mask_seuil', $gp_mask); + my $seuil_mask = minstanciate ('rattrapage.svg#seuil', $gp_mask); + minstanciate ('rattrapage.svg#cdr_seuil_h_edit', $gp_mask); + minstanciate ('rattrapage.svg#cdr_seuil_b_edit', $gp_mask); + + my $editable = new MTools::MSwitch ( + $self, + editable => [$bouton_delete, $gp_mask, $bouton_cloche], + non_editable => [], + ); + + $gp_mask -> binding ('', ['pressed', $self, Ev ('y')]); + $gp_mask -> binding ('', ['motion', $self, Ev ('y')]); + $gp_mask -> binding ('', ['released', $self, Ev ('y')]); + $bouton_delete -> binding ('DELETE', ['mdelete', $self]); + + plink ([$self, 'mesure'], [$mesure, '-text']); + plink ([$self, 'seuil'], [$seuil, '-text'], [$seuil_mask, '-text']); + plink ([$self, 'statut'], [$editable, 'state']); + plink ([$self, 'warning'], [$lien, 'warning']); + + return $self; +} + +sub mdelete { + my ($self) = @_; + $self -> {__manager} -> unplisten ('-visible', $self -> {__listener}); + $self -> {__lien} -> mdelete (); + MTools::mdelete ($self); +} + +sub pressed { + my ($self, $y) = @_; + $self -> {__y} = $y; + $self -> {__init_value} = $self -> mget ('seuil'); + $self -> {__down} -> mconfigure (-visible => 1); + $self -> {__up} -> mconfigure (-visible => 0); +} + +sub motion { + my ($self, $y) = @_; + $self -> mconfigure ('seuil', $self -> {__init_value} - int (($y - $self -> {__y}) / 20) * 0.5); +} + +sub released { + my ($self, $y) = @_; + $self -> {__down} -> mconfigure (-visible => 0); + $self -> {__up} -> mconfigure (-visible => 1); +} + +1; diff --git a/exemples/Selec.pm b/exemples/Selec.pm new file mode 100644 index 0000000..28237ac --- /dev/null +++ b/exemples/Selec.pm @@ -0,0 +1,91 @@ +package Selec; +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +use strict; + +use MTools; + +use vars qw /@ISA/; + +use MTools::MGroup; + +use MTools::GUI::MRect; +use MTools::GUI::MCircle; + +BEGIN +{ + @ISA = qw /MTools::MGroup/; +} + +sub new { + my ($class, $parent, $style, $x, $y) = @_; + my $self = new MTools::MGroup ($parent); + bless $self, $class; + + $self -> recordProperty ('barycentre_x' => 0); + $self -> recordProperty ('barycentre_y' => 0); + $self -> recordProperty ('x' => $x); + $self -> recordProperty ('y' => $y); + $self -> recordProperty ('selected' => 0); + + my $obj; + + if ($style eq 'rectangle') + { + $obj = new MTools::GUI::MRect ($self, $x - 5, $y -5, 10, 10, -filled => 1); + } + elsif ($style eq 'circle') + { + $obj = new MTools::GUI::MCircle ($self, $x, $y, 6, -filled => 1); + } + elsif ($style eq 'point') + { + $obj = new MTools::GUI::MCircle ($self, $x, $y, 3, -filled => 1); + } + + $self -> plisten ('selected', sub { + my ($src, $key, $val) = @_; + if ($val) + { + $obj -> mconfigure ( + -fillcolor => 'red', + -linecolor => 'red', + ); + } + else + { + $obj -> mconfigure ( + -fillcolor => 'black', + -linecolor => 'black', + ); + } + }); + + return $self; +} + +sub setSelected { + my ($self, $val) = @_; + $self -> mconfigure ('selected' => $val); +} + +sub isSelected { + my ($self) = @_; + return $self -> mget ('selected'); +} + +1; diff --git a/exemples/Strip.pm b/exemples/Strip.pm new file mode 100644 index 0000000..2997e25 --- /dev/null +++ b/exemples/Strip.pm @@ -0,0 +1,199 @@ +package Strip; +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +use strict; + +use vars qw /@ISA/; + +use MTools; +use MTools::MGroup; +use MTools::Widget::MToggleBouton; +use MTools::Comp::MMover; +use MTools::Comp::MReconizer; +use MTools::Comp::MInertie; + +BEGIN +{ + @ISA = qw /MTools::MGroup/; +} + +sub new { + my ($class, $parent, %options) = @_; + my $self = new MTools::MGroup ($parent); + bless $self, $class; + + $self -> recordEvent ('SET_FOCUS'); + $self -> recordEvent ('GET_FOCUS'); + $self -> recordProperty ('x', 0); + $self -> recordProperty ('y', 0); + + my $gp1 = new MTools::MGroup ($self); + my $gp2 = new MTools::MGroup ($self); + my $gp3 = new MTools::MGroup ($self); + my $gp4 = new MTools::MGroup ($self); + + # Instanciation d'un petit bouton rouge qui aura pour objectif + # de fixer ou non le strip (desactiver le comportement de mover) + my $bouton1 = new MTools::Widget::MToggleBouton ( + parent => $self, + g_on => 'strip.svg#alarme_on', + g_off => 'strip.svg#alarme_off', + e_press => 'ALARME_PRESS', + e_release => 'ALARME_RELEASE' + ); + + # Instanciation des objets textes situe sur la premiere partie du strip + # Disparaitra lorsque le strip est shoote + minstanciate ('strip.svg#vitesse', $gp2); + minstanciate ('strip.svg#fl', $gp2); + + # Instanciation des objets textes situ? sur la deuxieme partie du strip + # Disparaitra lorsque le strip est deplace + minstanciate ('strip.svg#balise1', $gp3); + minstanciate ('strip.svg#fl1', $gp3); + minstanciate ('strip.svg#balise2', $gp3); + minstanciate ('strip.svg#fl2', $gp3); + + # Instanciation du callsign toujours visible + my $callsign = minstanciate ('strip.svg#callsign', $self); + mconfigure ($callsign, -text => $options {callsign}); + + # Instanciation de la fleche de tendance qui peut avoir trois etat different + $self -> {evolution} = new MTools::MSwitch ( + $gp2, + stable => ['strip.svg#evolution_stable'], + montee => ['strip.svg#evolution_monte'], + descente => ['strip.svg#evolution_descend'], + ); + $self -> {evolution} -> mconfigure (state => 'montee'); + + # Definition des trois etats des strips + $self -> {strip} = new MTools::MSwitch ( + $gp1, + grand => ['strip.svg#strip_grand', $gp2, $gp3, $callsign, $bouton1], + mini => ['strip.svg#strip_mini', $gp2, $callsign, $bouton1], + shoote => ['strip.svg#strip_shoote', $callsign], + ); + $self -> {strip} -> setState ('grand'); + + # Instanciation du comportement de prehensible + $self -> {mover} = my $mover = new MTools::Comp::MMover($self -> {strip}, $self, 1, + x_min => 0, + y_min => 0, + x_max => 700, + y_max => 300, + ); + + # Instanciation du comportement d'inertie + new MTools::Comp::MInertie ($self -> {mover}); + + # On modifie la valeur des propriete x et y sur deplacement + $mover -> binding ('MOVED', sub { + my ($x, $y) = @_; + mconfigure ($self, x => $x); + mconfigure ($self, y => $y); + }); + + # Instanciation des mask pour la reco de geste + $self -> {mask} = new MTools::MSwitch ( + $gp4, + grand => ['strip.svg#mask_grand'], + mini => ['strip.svg#mask_mini'], + shoote => [], + ); + $self -> {mask} -> setState ('grand'); + + # Lorsque la propriete y est modifiee, on appel la fonction 'moved' + # Cette fonction modifiera l'etat du strip en fonction de la position de celui-ci + $self -> plisten ('y', ['moved', $self]); + + # Instanciation de la reco de geste + new MTools::Comp::MReconizer ($self -> {mask}, 1, callback => [$self, \&geste_reconnu]); + + # Activation et desactivation du comportement prehensible sur pression sur le petit bouton rouge + $bouton1 -> binding ('ALARME_PRESS', sub { + $mover -> mconfigure (-visible => 0); + }); + $bouton1 -> binding ('ALARME_RELEASE', sub { + $mover -> mconfigure (-visible => 1); + }); + + # Feedback de selection + $self -> {selected} = new MTools::MSwitch ( + $self, + selected => ['strip.svg#selected'], + unselected => [], + ); + $self -> {selected} -> setState ('unselected'); + + # Mise ? jour du focus sur pression (capt?e par le MMover) + $mover -> binding ('PRESSED', sub { + $self -> {selected} -> setState ('selected'); + $self -> notify ('GET_FOCUS', $self); + }); + + # Mise ? jour du focus par message externe + $self -> binding ('SET_FOCUS', sub { + $self -> {selected} -> setState ('unselected'); + }); + + return $self; +} + +sub geste_reconnu { + my ($self, $geste) = @_; + print "geste : $geste\n"; +} + +sub moved { + my ($self) = @_; + my $x = $self -> mget ('x'); + my $y = $self -> mget ('y'); + + if ($x < 50) + { + $self -> {strip} -> setState ('grand'); + $self -> {mask} -> setState ('grand'); + $self -> {evolution} -> setState ('montee'); + } + if (($x >= 50) && ($x < 100)) + { + $self -> {strip} -> setState ('grand'); + $self -> {mask} -> setState ('grand'); + $self -> {evolution} -> setState ('stable'); + } + if (($x >= 100) && ($x < 300)) + { + $self -> {strip} -> setState ('mini'); + $self -> {mask} -> setState ('mini'); + $self -> {evolution} -> setState ('stable'); + } + if (($x >= 300) && ($x < 600)) + { + $self -> {strip} -> setState ('mini'); + $self -> {mask} -> setState ('mini'); + $self -> {evolution} -> setState ('descente'); + } + if (($x >= 600) && ($x < 700)) + { + $self -> {strip} -> setState ('shoote'); + $self -> {mask} -> setState ('shoote'); + $self -> {evolution} -> setState ('descente'); + } +} + +1; diff --git a/exemples/StripAntiRecouvre.pm b/exemples/StripAntiRecouvre.pm new file mode 100644 index 0000000..4e2c001 --- /dev/null +++ b/exemples/StripAntiRecouvre.pm @@ -0,0 +1,71 @@ +########################################################### +# UN STRIP Q'on peut Bouger par le CallSIGN ############### +########################################################### + +package StripAntiRecouvre; +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +use strict; + +use MTools; + +use vars qw /@ISA/; + +use MTools; +use MTools::MGroup; +use MTools::Comp::MMover; +use MTools::Comp::MInertie; +use MTools::GUI::MAntiRecouvrementGroup; +use Data::Dumper; + +BEGIN +{ + @ISA = qw /MTools::GUI::MAntiRecouvrementGroup/; +} + +sub new { + my ($class, $parent, $frame, %options) = @_; + my $self = new MTools::GUI::MAntiRecouvrementGroup ($parent, height => 91, width => 351, xmin => 0, ymin => 0, xmax=>800, ymax => 600); + bless $self, $class; + + $self -> recordProperty('callsign', $options{callsign}); + $self -> recordProperty('color', 'grey'); + + my $gp1 = new MTools::MGroup ($self); + my $gp2 = new MTools::MGroup ($self); + my $gp3 = new MTools::MGroup ($self); + my $gp4 = new MTools::MGroup ($self); + my $gp5 = new MTools::MGroup ($self); + $self -> {cadre} = minstanciate ("strip_approche_arrival.svg#cadre_strip", $gp1); + plink([$self, 'color'], [mfind($self->{cadre},'cadre'),'-fillcolor']); + $self -> {infosavion} = minstanciate ("strip_approche_arrival.svg#infosavion", $gp2); + $self -> {header} = minstanciate ("strip_approche_arrival.svg#header", $gp3); + $self -> {instruction_zone} = minstanciate ("strip_approche_arrival.svg#instruction_zone", $gp4); + $self -> {coordination_zone} = minstanciate ("strip_approche_arrival.svg#coordination_zone", $gp5); + $self -> {ecriture_zone} = minstanciate ("strip_approche_arrival.svg#ecriture_zone", $gp5); + $self -> {QFU_zone} = minstanciate ("strip_approche_arrival.svg#QFU_zone", $gp5); + $self -> {IAF_zone} = minstanciate ("strip_approche_arrival.svg#IAF_zone", $gp5); + + plink ([$self, 'callsign'], [mfind ($self->{header}, 'callsign'), '-text']); + mconfigure($self,'color',"RGB:FF/98/FF"); + $self -> {mover} = my $mover = new MTools::Comp::MMover($self, $self, 1); + $self -> {inertie} = new MTools::Comp::MInertie($self -> {mover}); + + return $self; +} + +1; diff --git a/exemples/Target.pm b/exemples/Target.pm new file mode 100644 index 0000000..c2fb566 --- /dev/null +++ b/exemples/Target.pm @@ -0,0 +1,69 @@ +package Target; +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +use strict; + +use MTools; + +use vars qw /@ISA/; + +use MTools::MGroup; + +use MTools::GUI::MText; +use MTools::GUI::MCircle; + +BEGIN +{ + @ISA = qw /MTools::MGroup/; +} + +sub new { + my ($class, $parent, $x, $y) = @_; + my $self = new MTools::MGroup ($parent, -atomic => 1); + bless $self, $class; + + my $ob = new MTools::GUI::MCircle ($self, $x, $y, 20, -filled => 1); + my $txt = new MTools::GUI::MText ($self, '', $x - 100, $y + 30); + + $self -> recordEvent ('DRAGENTER'); + $self -> recordEvent ('DRAGLEAVE'); + $self -> recordEvent ('RELEASEDOVER'); + + binding ($self, 'DRAGENTER', sub { + $ob -> mconfigure ('-fillcolor' => 'blue'); + } + ); + binding ($self, 'DRAGLEAVE', sub { + $ob -> mconfigure ('-fillcolor' => 'black'); + } + ); + binding ($self, 'RELEASEDOVER', sub { + my ($multi) = @_; + $ob -> mconfigure ('-fillcolor' => 'black'); + my $selected_plan = $multi -> getSelectedPlan (); + my @selection = $multi -> getSelection (); + $txt -> mconfigure ('-text' => @selection.' elements du plan '.$selected_plan); + } + ); + + + + + return $self; +} + +1; diff --git a/exemples/Visage.pm b/exemples/Visage.pm new file mode 100644 index 0000000..67c0064 --- /dev/null +++ b/exemples/Visage.pm @@ -0,0 +1,50 @@ +package Visage; +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +use strict; + +use vars qw /@ISA/; + +use MTools; +use MTools::MGroup; +use MTools::GUI::MText; + +BEGIN +{ + @ISA = qw /MTools::MGroup/; +} + +sub new { + my ($class, $parent, $file) = @_; + my $self = new MTools::MGroup ($parent); + bless $self, $class; + + $self -> recordProperty ('nom', $file); + + my $visage = minstanciate ("$file#litso", $self); + my $pupille = minstanciate ("$file#pupille", $self); + + my $txt = new MTools::GUI::MText ($self, "", 500, 500); + + plink ([$self, 'nom'], [$txt, '-text']); + + return $self; +} + + + +1; diff --git a/exemples/data/Ampoule.svg b/exemples/data/Ampoule.svg new file mode 100644 index 0000000..6f0866e --- /dev/null +++ b/exemples/data/Ampoule.svg @@ -0,0 +1,15 @@ + + + + + +]> + + + + + + + diff --git a/exemples/data/Malouco.svg b/exemples/data/Malouco.svg new file mode 100644 index 0000000..1307282 --- /dev/null +++ b/exemples/data/Malouco.svg @@ -0,0 +1,61 @@ + + + +Tilt diff --git a/exemples/data/VisageNormal.svg b/exemples/data/VisageNormal.svg new file mode 100644 index 0000000..31ccc67 --- /dev/null +++ b/exemples/data/VisageNormal.svg @@ -0,0 +1,58 @@ + + + + diff --git a/exemples/data/comete.svg b/exemples/data/comete.svg new file mode 100644 index 0000000..d2b280e --- /dev/null +++ b/exemples/data/comete.svg @@ -0,0 +1,105 @@ + + +image/svg+xmlCALLSIGN + \ No newline at end of file diff --git a/exemples/data/fond_etiquette.png b/exemples/data/fond_etiquette.png new file mode 100644 index 0000000..3cfde5d Binary files /dev/null and b/exemples/data/fond_etiquette.png differ diff --git a/exemples/data/miniclochet.png b/exemples/data/miniclochet.png new file mode 100644 index 0000000..32976b8 Binary files /dev/null and b/exemples/data/miniclochet.png differ diff --git a/exemples/data/miniclochev.png b/exemples/data/miniclochev.png new file mode 100644 index 0000000..07b5a3c Binary files /dev/null and b/exemples/data/miniclochev.png differ diff --git a/exemples/data/rattrapage.svg b/exemples/data/rattrapage.svg new file mode 100644 index 0000000..b162bcc --- /dev/null +++ b/exemples/data/rattrapage.svg @@ -0,0 +1,256 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + 7.5 + 7.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/exemples/data/strip.svg b/exemples/data/strip.svg new file mode 100644 index 0000000..0f5bdb6 --- /dev/null +++ b/exemples/data/strip.svg @@ -0,0 +1,197 @@ + + + +AFR6178A48110160DIJ230OMAKO diff --git a/exemples/data/strip_approche_arrival.svg b/exemples/data/strip_approche_arrival.svg new file mode 100644 index 0000000..ecb9fe5 --- /dev/null +++ b/exemples/data/strip_approche_arrival.svg @@ -0,0 +1,437 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + + + TYPA + M + DEPT + DEST + + + + BALISE + HAP + / + DL + + + + QFU + + + + C + FL + Vi + + + + + C + XXX + Vi + FL + XXX + XXX + + + >> + >> + CallSign + + Company xxxxx + + + + + + + + + + + + + diff --git a/exemples/exemple_MMover_MInertie.pl b/exemples/exemple_MMover_MInertie.pl new file mode 100755 index 0000000..fd1f4f1 --- /dev/null +++ b/exemples/exemple_MMover_MInertie.pl @@ -0,0 +1,69 @@ +#!/usr/bin/perl +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +BEGIN { + unshift @INC, ".", "./data", "../src"; +} + +use MTools; +use MTools::Comp::MMover; +use MTools::GUI::MRect; +use MTools::Comp::MInertie; + +# Creation de la frame +new MTools (800, 600, 'Exemple MMover et MInertie'); + +# Creation des objets delimitant l'espace +new MTools::GUI::MRect (1, 0, 0, 650, 450, -fillcolor => "=axial 90 | #526266 | #667C80", -filled => 1); +new MTools::GUI::MRect (1, 250, 300, 400, 150, -linecolor => 'black'); + +# Creation de l'objet deplace +my $target = minstanciate ('Ampoule.svg#on', 1); + +# Ajout du comportement MMover à l'objet +my $mover = new MTools::Comp::MMover($target, $target, 1, x_max => 600, y_max => 400, y_min => 0, x_min => 0, allower => \&allowmove); +# Ajout du comportement MInertie au comportement de mover +new MTools::Comp::MInertie ($mover); + + +# RUN +mrun; + +# La fonction permet de conserver l'objet dans un espace controle +# Elle recoit en parametre l'ancienne position de l'objet ainsi que le deplacement suggerer +# Elle retourne un vecteur correspondant a la correction effectuee sur le deplacement +sub allowmove { + my ($x, $y, $dx, $dy) = @_; + if ($x > 200) + { + if ($y + $dy > 250) + { + $dy = $y + $dy - 250; + return (0, $dy); + } + } + elsif ($x + $dx > 200) + { + if ($y + $dy > 250) + { + $dx = $x + $dx - 200; + return ($dx, 0); + } + } + return (0, 0); +} + diff --git a/exemples/exemple_Rattrapage.pl b/exemples/exemple_Rattrapage.pl new file mode 100755 index 0000000..ca2b0f2 --- /dev/null +++ b/exemples/exemple_Rattrapage.pl @@ -0,0 +1,52 @@ +#!/usr/bin/perl +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +BEGIN { + unshift @INC, ".", "./data", "../src"; +} + +use MTools; +use Rattrapage; +use Comete; +use MTools::MTimer; + +new MTools (800, 600, 'Exemple SVG'); + +my $com1 = new Comete (1, 'AFR6830', 180, 200); +my $com2 = new Comete (1, 'BAW753', 400, 180); +my $com3 = new Comete (1, 'AZA322', 350, 340); + +my $manager = new MTools::MGroup (1); +$manager -> mconfigure (-visible => 0); + +new Rattrapage (1, $com1, $com2, $manager); +new Rattrapage (1, $com2, $com3, $manager); + +my $bouton = new MTools::Widget::MToggleBouton ( + parent => 1, + g_on => 'rattrapage.svg#delete_on', + g_off => 'rattrapage.svg#delete_off', + e_press => 'EDIT', + e_release => 'NON_EDIT' +); + +$bouton -> translate (50, 50); + +$bouton -> binding ('EDIT', sub { $manager -> mconfigure ('-visible' => 1); }); +$bouton -> binding ('NON_EDIT', sub { $manager -> mconfigure ('-visible' => 0); }); + +mrun; diff --git a/exemples/exemple_SVG.pl b/exemples/exemple_SVG.pl new file mode 100755 index 0000000..f19e856 --- /dev/null +++ b/exemples/exemple_SVG.pl @@ -0,0 +1,59 @@ +#!/usr/bin/perl +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +BEGIN { + unshift @INC, ".", "./data", "../src"; +} + +use MTools; +use MTools::Comp::MMover; +use MTools::GUI::MRect; +use MTools::Comp::MInertie; + + +# Creation de la frame +new MTools (800, 600, 'Exemple SVG'); + + +# Creation des objets 'litso' et 'pupille' depuis le fichier Malouco.svg +my $visage = minstanciate ('Malouco.svg#litso', 1); +my $pupille = minstanciate ('Malouco.svg#pupille', 1); +MTools::MObjet::recordEvent ($pupille, 'PING'); +# Recherche du sous arbre 'tilt' dans l'objet pupille +my $tilt = mfind ($pupille, 'tilt'); +# On rend l'objet tilt invisible +mconfigure ($tilt, -visible => 0); + +# Quelques interactions sur les objets instancies +$visage -> binding ('', sub {$pupille -> mconfigure (-visible => 0); $pupille -> notify ('PING')}); +$visage -> binding ('', sub {$pupille -> mconfigure (-visible => 1)}); +$pupille -> binding ('', sub {mconfigure (mfind ($pupille, 'tilt'), -visible => 1)}); +$pupille -> binding ('', sub {mconfigure (mfind ($pupille, 'tilt'), -visible => 0)}); + +my $cb = [\&unb, $pupille]; +$pupille -> binding ('PING', $cb); + +# RUN +mrun; + +sub unb { + my ($self) = @_; + print "UNBINDING !!!\n"; + $self -> unbinding ('PING', $cb); + $self -> notify ('PING'); + print "YOUPIE HOURrA, pas de boucle !\n"; +} diff --git a/exemples/exemple_Strip.pl b/exemples/exemple_Strip.pl new file mode 100755 index 0000000..004580e --- /dev/null +++ b/exemples/exemple_Strip.pl @@ -0,0 +1,54 @@ +#!/usr/bin/perl +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +BEGIN { + unshift @INC, ".", "./data", "../src"; +} + +use MTools; +use Strip; +use MTools::Comp::MFocuser; + +# Instanciation d'une frame +new MTools (800, 600, "Exemple de strips"); + +# Instanciation de trois composants strips +my $strip1 = new Strip (1, callsign => "AFR6845"); +my $strip2 = new Strip (1, callsign => "BAW45D"); +my $strip3 = new Strip (1, callsign => "RAE458X"); + +# Gestion du focus entre les differents objets +my $strip_focuser = new MTools::Comp::MFocuser ($strip1, $strip2, $strip3); + +# Instanication d'un petit bouton rouge +my $bouton1 = new MTools::Widget::MToggleBouton ( + parent => 1, + g_on => 'strip.svg#alarme_on', + g_off => 'strip.svg#alarme_off', + e_press => 'PRENDRE_FOCUS', + e_release => 'PRENDRE_FOCUS' +); +$bouton1 -> recordEvent('SET_FOCUS'); +$bouton1 -> recordEvent('GET_FOCUS'); +$bouton1 -> binding ('PRENDRE_FOCUS', sub {$bouton1 -> notify ('GET_FOCUS', $bouton1)}); +$bouton1 -> translate (100, 500); + +# Gestion du focus entre l'objet de focus principal et le petit bouton rouge +new MTools::Comp::MFocuser ($strip_focuser, $bouton1); + + +mrun; diff --git a/exemples/exemple_anti_recouvrement.pl b/exemples/exemple_anti_recouvrement.pl new file mode 100755 index 0000000..4a6b9e4 --- /dev/null +++ b/exemples/exemple_anti_recouvrement.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +BEGIN { + unshift @INC, ".", "./data", "../src"; +} + +use strict; +use MTools; +use MTools::MGroup; +use MTools::Comp::MAntiRecouvrement; +use StripAntiRecouvre; + +my $frame = new MTools (1280, 1024, "Test"); +my $antirecouvrementgroup = new MTools::Comp::MAntiRecouvrement (); +my $strip1 = new StripAntiRecouvre (1, $frame, callsign => "AFR6845"); +my $strip2 = new StripAntiRecouvre (1, $frame, callsign => "CTM5285"); +my $strip3 = new StripAntiRecouvre (1, $frame, callsign => "AF850HJ"); +my $strip4 = new StripAntiRecouvre (1, $frame, callsign => "DLH8285"); +$antirecouvrementgroup -> addObject($strip1); +$antirecouvrementgroup -> addObject($strip2); +$antirecouvrementgroup -> addObject($strip3); +$antirecouvrementgroup -> addObject($strip4); + +mrun; diff --git a/exemples/exemple_multi_selection.pl b/exemples/exemple_multi_selection.pl new file mode 100755 index 0000000..389233c --- /dev/null +++ b/exemples/exemple_multi_selection.pl @@ -0,0 +1,72 @@ +#!/usr/bin/perl +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +BEGIN { + unshift @INC, ".", "./data", "../src"; +} + +use MTools; +use MTools::GUI::MRect; +use Selec; +use MTools::GUI::MText; +use MTools::Comp::MMultiSelection; +use Target; + +my $frame = new MTools (800, 600, 'Exemple SVG'); + +my $bck = new MTools::GUI::MRect (1, 0, 0, 800, 600, -filled => 1, -fillcolor => '#aaaaaa'); + +my $objs = new MTools::MGroup (1); + +my $multi = new MTools::Comp::MMultiSelection ( + $bck, + 1, + $frame, + 0, +); + +new MTools::GUI::MText ($objs, '1er plan', 5, 90); +new MTools::GUI::MText ($objs, '2ieme plan', 5, 190); +new MTools::GUI::MText ($objs, '3ieme plan', 5, 290); + +my $ob = new Selec ($objs, 'rectangle', 110, 100); +$multi -> addObject ($ob, 0); +my $ob = new Selec ($objs, 'circle', 110, 200); +$multi -> addObject ($ob, 1); +my $ob = new Selec ($objs, 'point', 110, 300); +$multi -> addObject ($ob, 2); + +my $ob = new Selec ($objs, 'rectangle', 210, 100); +$multi -> addObject ($ob, 0); +my $ob = new Selec ($objs, 'circle', 210, 200); +$multi -> addObject ($ob, 1); +my $ob = new Selec ($objs, 'point', 210, 300); +$multi -> addObject ($ob, 2); + +my $ob = new Selec ($objs, 'rectangle', 310, 100); +$multi -> addObject ($ob, 0); +my $ob = new Selec ($objs, 'circle', 310, 200); +$multi -> addObject ($ob, 1); +my $ob = new Selec ($objs, 'point', 310, 300); +$multi -> addObject ($ob, 2); + +my $drop_target = new Target ($ob, 700, 500); +$multi -> addDropTarget ($drop_target); + + +mrun; + diff --git a/exemples/exemple_skin_plink.pl b/exemples/exemple_skin_plink.pl new file mode 100755 index 0000000..fdb6fec --- /dev/null +++ b/exemples/exemple_skin_plink.pl @@ -0,0 +1,38 @@ +#!/usr/bin/perl +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU GPL General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +# or refer to http://www.gnu.org/copyleft/gpl.html +# + +BEGIN { + unshift @INC, ".", "./data", "../src"; +} + +use MTools; +use Visage; + + +# Creation de la frame +new MTools (1200, 600, 'Exemple SVG'); + +my $fou = new Visage (1, 'Malouco.svg'); +my $normal = new Visage (1, 'VisageNormal.svg'); +$fou -> translate (500, 0); + +$normal -> mconfigure ('nom', 'Avant la reunion'); +$fou -> mconfigure ('nom', 'Apres'); + +# RUN +mrun; + -- cgit v1.1