aboutsummaryrefslogtreecommitdiff
path: root/Perl/demos/Tk
diff options
context:
space:
mode:
authorvinot2003-07-03 10:13:26 +0000
committervinot2003-07-03 10:13:26 +0000
commite1cf77a6f4615dc32927858b08485cad9d01c7ab (patch)
treea850766a9418ff1ae57d029a8a9d032cac9e405f /Perl/demos/Tk
parentd02e6a467ae30cff5bbbc723b6e4ccbfd964dee6 (diff)
downloadtkzinc-e1cf77a6f4615dc32927858b08485cad9d01c7ab.zip
tkzinc-e1cf77a6f4615dc32927858b08485cad9d01c7ab.tar.gz
tkzinc-e1cf77a6f4615dc32927858b08485cad9d01c7ab.tar.bz2
tkzinc-e1cf77a6f4615dc32927858b08485cad9d01c7ab.tar.xz
add some interactions
circus items (button interaction) polygons items (rotate interaction) use conical gradient change default font
Diffstat (limited to 'Perl/demos/Tk')
-rw-r--r--Perl/demos/Tk/demos/zinc_lib/testGraphics.pl1098
1 files changed, 621 insertions, 477 deletions
diff --git a/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl b/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl
index 992326b..fe9c35a 100644
--- a/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl
+++ b/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl
@@ -13,8 +13,10 @@ use Tk;
use Tk::Zinc;
use Tk::Zinc::Graphics;
use Getopt::Long;
+use Math::Trig;
use strict 'vars';
+my $previousangle = 0;
my $rotate_angle = .1;
my $zoomfactor = .1;
my $curview;
@@ -23,7 +25,7 @@ my ($dx, $dy);
my $tabanchor = 'n';
my $tabalign = 'left';
-my $font_9b = '8x13bold';
+my $font_9b = '7x13bold';
# the original font is not standard, even if it is fully free:
# my $font_9b = '-cenapii-bleriot mini-bold-r-normal--9-90-75-75-p-75-iso8859-15';
@@ -43,6 +45,8 @@ my %gradset = (# gradients zinc
'pushbtn2' => '=axial 270|#ccccff;100 0|#ffffff;100 10|#5a5a7a;100 80|#bbbbee;100 100',
'pushbtn3' => '=radial -15 -15|#ffffff;100 0|#333344;100 100',
'pushbtn4' => '=axial 270|#ccccff;100 0|#ffffff;100 10|#7a7a9a;100 80|#bbbbee;100 100',
+ 'conical_edge' => '=conical 0 0 -45|#ffffff;100 0|#888899;100 30|#555566;100 50|#888899;100 70|#ffffff;100 100',
+ 'conical_ext' => '=conical 0 0 135|#ffffff;100 0|#777788;100 30|#444455;100 50|#777788;100 70|#ffffff;100 100',
'pushbtn_edge' => '=axial 140|#ffffff;100 0|#555566;100 100',
'pushbtn_edge2' => '=axial 92|#ffffff;100 0|#555566;100 100',
'logoshape' => '=axial 270|#ffffff|#7192aa',
@@ -222,73 +226,95 @@ my %pagesconf = ('Rectangle' => {'consigne' => {-itemtype => 'text',
},
},
},
- 'Hippodrome' => {'hp1edge' => {-itemtype => 'hippodrome',
- -coords => [[-206, -126], [-114, 46]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn_edge',
- -linewidth => 1,
- -linecolor => '#ffffff',
- -priority => 10,
+ 'Hippodrome' => {'consigne' => {-itemtype => 'text',
+ -coords => [-285, 165],
+ -params => {-font => $font_9b,
+ -text => "Click hippo Buttons with mouse button 1.\n",
+ -color => '#2222cc',
},
- },
- 'hp1' => {-itemtype => 'hippodrome',
- -coords => [[-200, -120], [-120, 40]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn1',
- -linewidth => 3,
- -linecolor => '#000000',
- -priority => 20,
+ },
+ 'hp1' => {-itemtype => 'group',
+ -coords => [-163, -40],
+ -params => {-priority => 40,
},
- },
+ -items => {'edge' => {-itemtype => 'hippodrome',
+ -coords => [[-46, -86], [46, 86]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn_edge',
+ -linewidth => 1,
+ -linecolor => '#ffffff',
+ -priority => 10,
+ },
+ },
+ 'form' => {-itemtype => 'hippodrome',
+ -coords => [[-40, -80], [40, 80]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn1',
+ -linewidth => 3,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['b1','pushbtn'],
+ },
+ },
+ },
+ },
- 'hp2edge' => {-itemtype => 'hippodrome',
- -coords => [[-86, -126], [6, 46]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn_edge',
- -linewidth => 1,
- -linecolor => '#ffffff',
- -priority => 10,
- },
- },
- 'hp2T' => {-itemtype => 'hippodrome',
- -coords => [[-80, -120], [0, -68]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn1',
- -linewidth => 3,
- -linecolor => '#000000',
- -priority => 20,
- },
- -orientation => 'vertical',
- -trunc => 'bottom',
- },
- 'hp2C' => {-itemtype => 'hippodrome',
- -coords => [[-80, -66.5], [0, -13.5]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn1',
- -linewidth => 3,
- -linecolor => '#000000',
- -priority => 20,
+ 'hp2' => {-itemtype => 'group',
+ -coords => [-50, -40],
+ -params => {-priority => 40,
},
- -trunc => 'both',
- },
- 'hp2B' => {-itemtype => 'hippodrome',
- -coords => [[-80, -12], [0, 40]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn1',
- -linewidth => 3,
- -linecolor => '#000000',
- -priority => 20,
- },
- -orientation => 'vertical',
- -trunc => 'top',
- },
-
+ -items => {'edge' => {-itemtype => 'hippodrome',
+ -coords => [[-46, -86], [46, 86]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn_edge',
+ -linewidth => 1,
+ -linecolor => '#ffffff',
+ -priority => 10,
+ },
+ },
+ 'formT' => {-itemtype => 'hippodrome',
+ -coords => [[-40, -80], [40, -28]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn1',
+ -linewidth => 3,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['b2t','pushbtn'],
+ },
+ -orientation => 'vertical',
+ -trunc => 'bottom',
+ },
+ 'formC' => {-itemtype => 'hippodrome',
+ -coords => [[-40, -26.5], [40, 26.5]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn1',
+ -linewidth => 3,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['b2c','pushbtn'],
+ },
+ -trunc => 'both',
+ },
+ 'formB' => {-itemtype => 'hippodrome',
+ -coords => [[-40, 28], [40, 80]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn1',
+ -linewidth => 3,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['b2b','pushbtn'],
+ },
+ -orientation => 'vertical',
+ -trunc => 'top',
+ },
+ },
+ },
'hp3edge' => {-itemtype => 'hippodrome',
-coords => [[-204, 96], [204, 144]],
-params => {-closed => 1,
@@ -299,455 +325,508 @@ my %pagesconf = ('Rectangle' => {'consigne' => {-itemtype => 'text',
-priority => 10,
},
},
- 'hp3G' => {-itemtype => 'hippodrome',
- -coords => [[-200, 100], [-120, 140]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn2',
- -linewidth => 2,
- -linecolor => '#000000',
- -priority => 20,
+ 'hp3g' => {-itemtype => 'group',
+ -coords => [-160, 120],
+ -params => {-priority => 40,
},
- -trunc => 'right',
- },
- 'hp3Gico' => {-itemtype => 'curve',
- -coords => [[-180, 120],[-164, 128],[-164, 112]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => '#000000',
- -linewidth => 1,
- -linecolor => '#aaaaaa',
- -relief => 'raised',
- -priority => 30,
- },
- -contours => [['add',-1,[[-160, 120],[-144, 128],[-144, 112]]]],
- },
-
- 'hp3C1' => {-itemtype => 'hippodrome',
- -coords => [[-118, 100], [-41, 140]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn2',
- -linewidth => 2,
- -linecolor => '#000000',
- -priority => 20,
+ -items => {'form' => {-itemtype => 'hippodrome',
+ -coords => [[-40, -20], [40, 20]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn2',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['b3g','pushbtn'],
+ },
+ -trunc => 'right',
+ },
+ 'ico' => {-itemtype => 'curve',
+ -coords => [[-20, 0],[-4, 8],[-4, -8]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => '#000000',
+ -linewidth => 1,
+ -linecolor => '#aaaaaa',
+ -relief => 'raised',
+ -priority => 30,
+ -tags => ['b3g','pushbtn'],
+ },
+ -contours => [['add',-1,[[0, 0],[16, 8],[16, -8]]]],
+ },
+ },
+ },
+ 'hp3c1' => {-itemtype => 'group',
+ -coords => [-80, 120],
+ -params => {-priority => 40,
},
- -trunc => 'both',
+ -items => {'form' => {-itemtype => 'hippodrome',
+ -coords => [[-38, -20], [39, 20]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn2',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['b3c1','pushbtn'],
+ },
+ -trunc => 'both',
+ },
+ 'ico' => {-itemtype => 'curve',
+ -coords => [[-8, 0],[8, 8],[8, -8]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => '#000000',
+ -linewidth => 1,
+ -linecolor => '#aaaaaa',
+ -priority => 30,
+ -relief => 'raised',
+ -tags => ['b3c1','pushbtn'],
+ },
+ },
+ },
},
- 'hp3C1ico' => {-itemtype => 'curve',
- -coords => [[-88, 120],[-72, 128],[-72, 112]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => '#000000',
- -linewidth => 1,
- -linecolor => '#aaaaaa',
- -priority => 30,
- -relief => 'raised',
- },
- },
-
- 'hp3C2' => {-itemtype => 'hippodrome',
- -coords => [[-39, 100], [39, 140]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn2',
- -linewidth => 2,
- -linecolor => '#000000',
- -priority => 20,
+ 'hp3c2' => {-itemtype => 'group',
+ -coords => [0, 120],
+ -params => {-priority => 40,
},
- -trunc => 'both',
+ -items => {'form' => {-itemtype => 'hippodrome',
+ -coords => [[-39, -20], [39, 20]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn2',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['b3c2','pushbtn'],
+ },
+ -trunc => 'both',
+ },
+ 'ico' => {-itemtype => 'rectangle',
+ -coords => [[-6, -6],[6, 6]],
+ -params => {-filled => 1,
+ -fillcolor => '#000000',
+ -linewidth => 1,
+ -linecolor => '#aaaaaa',
+ -priority => 30,
+ -tags => ['b3c2','pushbtn'],
+ },
+ },
+ },
},
- 'hp3C2ico' => {-itemtype => 'rectangle',
- -coords => [[-6, 114],[6, 126]],
- -params => {-filled => 1,
- -fillcolor => '#000000',
- -linewidth => 1,
- -linecolor => '#aaaaaa',
- -priority => 30,
- },
- },
- 'hp3C3' => {-itemtype => 'hippodrome',
- -coords => [[41, 100], [118, 140]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn2',
- -linewidth => 2,
- -linecolor => '#000000',
- -priority => 20,
+ 'hp3c3' => {-itemtype => 'group',
+ -coords => [80, 120],
+ -params => {-priority => 40,
},
- -trunc => 'both',
+ -items => {'form' => {-itemtype => 'hippodrome',
+ -coords => [[-39, -20], [38, 20]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn2',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['b3c3','pushbtn'],
+ },
+ -trunc => 'both',
+ },
+ 'ico' => {-itemtype => 'curve',
+ -coords => [[8, 0],[-8, 8],[-8, -8]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => '#000000',
+ -linewidth => 1,
+ -linecolor => '#aaaaaa',
+ -priority => 30,
+ -relief => 'raised',
+ -tags => ['b3c3','pushbtn'],
+ },
+ },
+ },
},
- 'hp3C3ico' => {-itemtype => 'curve',
- -coords => [[88, 120],[72, 112],[72, 128]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => '#000000',
- -linewidth => 1,
- -linecolor => '#aaaaaa',
- -priority => 30,
- -relief => 'raised',
- },
- },
- 'hp3D' => {-itemtype => 'hippodrome',
- -coords => [[120, 100], [200, 140]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn2',
- -linewidth => 2,
- -linecolor => '#000000',
- -priority => 20,
+ 'hp3d' => {-itemtype => 'group',
+ -coords => [160, 120],
+ -params => {-priority => 40,
},
- -trunc => 'left',
+ -items => {'form' => {-itemtype => 'hippodrome',
+ -coords => [[-40, -20], [40, 20]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn2',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['b3d','pushbtn'],
+ },
+ -trunc => 'left',
+ },
+ 'ico' => {-itemtype => 'curve',
+ -coords => [[20, 0],[4, -8],[4, 8]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => '#000000',
+ -linewidth => 1,
+ -linecolor => '#aaaaaa',
+ -relief => 'raised',
+ -priority => 30,
+ -tags => ['b3d','pushbtn'],
+ },
+ -contours => [['add',-1,[[0, 0],[-16, -8],[-16, 8]]]],
+ },
+ },
},
- 'hp3Dico' => {-itemtype => 'curve',
- -coords => [[180, 120],[164, 112],[164, 128]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => '#000000',
- -linewidth => 1,
- -linecolor => '#aaaaaa',
- -priority => 30,
- -relief => 'raised',
- },
- -contours => [['add',-1,[[160, 120],[144, 112],[144, 128]]]],
- },
- 'hp4aedge' => {-itemtype => 'hippodrome',
- -coords => [[27, -126], [85, -68]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn_edge',
- -linewidth => 1,
- -linecolor => '#ffffff',
- -priority => 20,
- },
- },
- 'hp4a' => {-itemtype => 'hippodrome',
- -coords => [[32, -121], [80, -73]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn3',
- -linewidth => 3,
- -linecolor => '#000000',
- -priority => 30,
+ 'hp4a' => {-itemtype => 'group',
+ -coords => [48, -97],
+ -params => {-priority => 40,
},
- },
- 'hp4bedge' => {-itemtype => 'hippodrome',
- -coords => [[94, -126], [206, -14]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn_edge',
- -linewidth => 1,
- -linecolor => '#ffffff',
- -priority => 20,
- },
- },
- 'hp4b' => {-itemtype => 'hippodrome',
- -coords => [[102, -118], [198, -22]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn3',
- -linewidth => 3,
- -linecolor => '#000000',
- -priority => 30,
- },
- },
- 'hp5aedge' => {-itemtype => 'hippodrome',
- -coords => [[-19, -34], [19, 34]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn_edge',
- -linewidth => 1,
- -linecolor => '#ffffff',
- -priority => 10,
- },
- -rotate => 30,
- -translate => [45, 30],
- },
- 'hp5a' => {-itemtype => 'hippodrome',
- -coords => [[-15, -30], [15, 30]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn1',
- -linewidth => 2,
- -linecolor => '#000000',
- -priority => 20,
- },
- -rotate => 30,
- -translate => [45, 30],
- },
- 'hp5bedge' => {-itemtype => 'hippodrome',
- -coords => [[-19, -34], [19, 34]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn_edge',
- -linewidth => 1,
- -linecolor => '#ffffff',
- -priority => 10,
- },
- -rotate => 30,
- -translate => [90, 30],
- },
- 'hp5b' => {-itemtype => 'hippodrome',
- -coords => [[-15, -30], [15, 30]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn1',
- -linewidth => 2,
- -linecolor => '#000000',
- -priority => 20,
+ -repeat => {-num => 2,
+ -dxy => [0, 64],
},
- -rotate => 30,
- -translate => [90, 30],
+ -items => {'edge' => {-itemtype => 'hippodrome',
+ -coords => [[-29, -29], [29, 29]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn_edge',
+ -linewidth => 1,
+ -linecolor => '#ffffff',
+ -priority => 0,
+ },
+ },
+ 'form' => {-itemtype => 'hippodrome',
+ -coords => [[-24, -24], [24, 24]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn3',
+ -linewidth => 3,
+ -linecolor => '#000000',
+ -priority => 30,
+ -tags => ['b4a','pushbtn'],
+ },
+ },
+ },
},
- 'hp5cedge' => {-itemtype => 'hippodrome',
- -coords => [[-19, -34], [19, 34]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn_edge',
- -linewidth => 1,
- -linecolor => '#ffffff',
- -priority => 10,
- },
- -rotate => 30,
- -translate => [135, 30],
- },
- 'hp5c' => {-itemtype => 'hippodrome',
- -coords => [[-15, -30], [15, 30]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn1',
- -linewidth => 2,
- -linecolor => '#000000',
- -priority => 20,
+ 'hp4b' => {-itemtype => 'group',
+ -coords => [145, -65],
+ -params => {-priority => 40,
},
- -rotate => 30,
- -translate => [135, 30],
+ -items => {'edge' => {-itemtype => 'hippodrome',
+ -coords => [[-60, -60], [60, 60]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'conical_edge',
+ -linewidth => 1,
+ -linecolor => '#ffffff',
+ -priority => 0,
+ },
+ },
+ 'ext' => {-itemtype => 'hippodrome',
+ -coords => [[-53, -53], [53, 53]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'conical_ext',
+ -linewidth => 3,
+ -linecolor => '#000000',
+ -priority => 10,
+ -tags => ['b4b','pushbtn'],
+ },
+ },
+ 'int' => {-itemtype => 'hippodrome',
+ -coords => [[-41, -41], [40, 40]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => '=path 10 10|#ffffff 0|#ccccd0 50|#99999f 80|#99999f;0 100',
+ -linewidth => 0, #1,
+ -linecolor => '#cccccc;80',
+ -priority => 30,
+ -tags => ['b4b','pushbtn'],
+ },
+ },
+ },
},
- 'hp5dedge' => {-itemtype => 'hippodrome',
- -coords => [[-19, -34], [19, 34]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn_edge',
- -linewidth => 1,
- -linecolor => '#ffffff',
- -priority => 10,
- },
- -rotate => 30,
- -translate => [180, 30],
- },
- 'hp5d' => {-itemtype => 'hippodrome',
- -coords => [[-15, -30], [15, 30]],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'pushbtn1',
- -linewidth => 2,
- -linecolor => '#000000',
- -priority => 20,
- },
- -rotate => 30,
- -translate => [180, 30],
- },
+ 'hp5' => {-itemtype => 'group',
+ -coords => [60, 25],
+ -params => {-priority => 40,
+ },
+ -rotate => 30,
+ -repeat => {-num => 4,
+ -dxy => [45, 0],
+ },
+ -items => {'edge' => {-itemtype => 'hippodrome',
+ -coords => [[-19, -34], [19, 34]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn_edge',
+ -linewidth => 1,
+ -linecolor => '#ffffff',
+ -priority => 10,
+ },
+ },
+ 'form' => {-itemtype => 'hippodrome',
+ -coords => [[-15, -30], [15, 30]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn1',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['b5','pushbtn'],
+ },
+ },
+ },
+ },
},
- 'Polygone' => {'triangle' => {-itemtype => 'polygone',
+ 'Polygone' => {'consigne' => {-itemtype => 'text',
+ -coords => [-285, 165],
+ -params => {-font => $font_9b,
+ -text => "Click and Drag inside Polygons for rotate them",
+ -color => '#2222cc',
+ },
+ },
+ 'triangle' => {-itemtype => 'group',
-coords => [-210, -90],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'roundpolyg',
- -linewidth => 2,
- -linecolor => '#330000',
- -priority => 20,
- },
- -numsides => 3,
- -radius => 78,
- -corner_radius => 10,
- -startangle => 90,
+ -items => {'form' => {-itemtype => 'polygone',
+ -coords => [0, 0],
+ -numsides => 3,
+ -radius => 78,
+ -corner_radius => 10,
+ -startangle => 90,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundpolyg',
+ -linewidth => 2,
+ -linecolor => '#330000',
+ -priority => 20,
+ -tags => ['p1', 'poly'],
+ },
+ },
+ 'text' => {-itemtype => 'text',
+ -coords => [0, 0],
+ -params => {-font => $font_9b,
+ -text => "Triangle",
+ -anchor => 'center',
+ -alignment => 'center',
+ -color => '#660000',
+ -priority => 50,
+ },
+ },
+ },
},
- 'text1' => {-itemtype => 'text',
- -coords => [-210, -90],
- -params => {-font => $font_9b,
- -text => "Triangle",
- -anchor => 'center',
- -alignment => 'center',
- -color => '#660000',
- -priority => 50,
- },
- },
- 'carre' => {-itemtype => 'polygone',
- -coords => [-80, -70],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'roundpolyg',
- -linewidth => 2,
- -linecolor => '#330000',
- -priority => 20,
- },
- -numsides => 4,
- -radius => 70,
- -corner_radius => 10,
- -startangle => 90,
- },
- 'text2' => {-itemtype => 'text',
+ 'carre' => {-itemtype => 'group',
-coords => [-80, -70],
- -params => {-font => $font_9b,
- -text => 'Carré',
- -anchor => 'center',
- -alignment => 'center',
- -color => '#660000',
- -priority => 50,
- },
+ -items => {'form' => {-itemtype => 'polygone',
+ -coords => [0, 0],
+ -numsides => 4,
+ -radius => 70,
+ -corner_radius => 10,
+ -startangle => 90,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundpolyg',
+ -linewidth => 2,
+ -linecolor => '#330000',
+ -priority => 20,
+ -tags => ['p2', 'poly'],
+ },
+ },
+ 'text' => {-itemtype => 'text',
+ -coords => [0, 0],
+ -params => {-font => $font_9b,
+ -text => "Carré",
+ -anchor => 'center',
+ -alignment => 'center',
+ -color => '#660000',
+ -priority => 50,
+ },
+ },
+ },
},
- 'pentagone' => {-itemtype => 'polygone',
+
+ 'pentagone' => {-itemtype => 'group',
-coords => [65, -70],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'roundpolyg',
- -linewidth => 2,
- -linecolor => '#330000',
- -priority => 20,
- },
- -numsides => 5,
- -radius => 70,
- -corner_radius => 10,
- -startangle => 270,
+ -items => {'form' => {-itemtype => 'polygone',
+ -coords => [0, 0],
+ -numsides => 5,
+ -radius => 70,
+ -corner_radius => 10,
+ -startangle => 270,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundpolyg',
+ -linewidth => 2,
+ -linecolor => '#330000',
+ -priority => 20,
+ -tags => ['p3', 'poly'],
+ },
+ },
+ 'text' => {-itemtype => 'text',
+ -coords => [0, 0],
+ -params => {-font => $font_9b,
+ -text => "Pentagone",
+ -anchor => 'center',
+ -alignment => 'center',
+ -color => '#660000',
+ -priority => 50,
+ },
+ },
+ },
},
- 'text3' => {-itemtype => 'text',
- -coords => [65, -70],
- -params => {-font => $font_9b,
- -text => 'Pentagone',
- -anchor => 'center',
- -alignment => 'center',
- -color => '#660000',
- -priority => 50,
- },
- },
-
- 'hexagone' => {-itemtype => 'polygone',
+ 'hexagone' => {-itemtype => 'group',
-coords => [210, -70],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'roundpolyg',
- -linewidth => 2,
- -linecolor => '#330000',
- -priority => 20,
- },
- -numsides => 6,
- -radius => 68,
- -corner_radius => 10,
+ -items => {'form' => {-itemtype => 'polygone',
+ -coords => [0, 0],
+ -numsides => 6,
+ -radius => 68,
+ -corner_radius => 10,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundpolyg',
+ -linewidth => 2,
+ -linecolor => '#330000',
+ -priority => 20,
+ -tags => ['p4', 'poly'],
+ },
+ },
+ 'text' => {-itemtype => 'text',
+ -coords => [0, 0],
+ -params => {-font => $font_9b,
+ -text => "Hexagone",
+ -anchor => 'center',
+ -alignment => 'center',
+ -color => '#660000',
+ -priority => 50,
+ },
+ },
+ },
},
- 'text4' => {-itemtype => 'text',
- -coords => [210, -70],
- -params => {-font => $font_9b,
- -text => 'Hexagone',
- -anchor => 'center',
- -alignment => 'center',
- -color => '#660000',
- -priority => 50,
- },
- },
- 'heptagone' => {-itemtype => 'polygone',
- -coords => [-215, 90],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'roundpolyg',
- -linewidth => 2,
- -linecolor => '#330000',
- -priority => 20,
- },
- -numsides => 7,
- -radius => 64,
- -corner_radius => 10,
- },
- 'text5' => {-itemtype => 'text',
- -coords => [-215, 90],
- -params => {-font => $font_9b,
- -text => 'Heptagone',
- -anchor => 'center',
- -alignment => 'center',
- -color => '#660000',
- -priority => 50,
- },
- },
- 'octogone' => {-itemtype => 'polygone',
- -coords => [-76, 90],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'roundpolyg',
- -linewidth => 2,
- -linecolor => '#330000',
- -priority => 20,
- },
- -numsides => 8,
- -radius => 64,
- -corner_radius => 10,
- },
- 'text6' => {-itemtype => 'text',
- -coords => [-76, 90],
- -params => {-font => $font_9b,
- -text => 'Octogone',
- -anchor => 'center',
- -alignment => 'center',
- -color => '#660000',
- -priority => 50,
- },
- },
- 'petagone' => {-itemtype => 'polygone',
- -coords => [66, 90],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'roundpolyg',
- -linewidth => 2,
- -linecolor => '#330000',
- -priority => 20,
+ 'heptagone' => {-itemtype => 'group',
+ -coords => [-215, 90],
+ -items => {'form' => {-itemtype => 'polygone',
+ -coords => [0, 0],
+ -numsides => 7,
+ -radius => 64,
+ -corner_radius => 10,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundpolyg',
+ -linewidth => 2,
+ -linecolor => '#330000',
+ -priority => 20,
+ -tags => ['p5', 'poly'],
+ },
+ },
+ 'text' => {-itemtype => 'text',
+ -coords => [0, 0],
+ -params => {-font => $font_9b,
+ -text => "Heptagone",
+ -anchor => 'center',
+ -alignment => 'center',
+ -color => '#660000',
+ -priority => 50,
+ },
+ },
},
- -numsides => 32,
- -radius => 64,
- -corner_radius => 10,
+ },
+
+
+ 'octogone' => {-itemtype => 'group',
+ -coords => [-76, 90],
+ -items => {'form' => {-itemtype => 'polygone',
+ -coords => [0, 0],
+ -numsides => 8,
+ -radius => 64,
+ -corner_radius => 10,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundpolyg',
+ -linewidth => 2,
+ -linecolor => '#330000',
+ -priority => 20,
+ -tags => ['p6', 'poly'],
+ },
+ },
+ 'text' => {-itemtype => 'text',
+ -coords => [0, 0],
+ -params => {-font => $font_9b,
+ -text => "Octogone",
+ -anchor => 'center',
+ -alignment => 'center',
+ -color => '#660000',
+ -priority => 50,
+ },
+ },
+ },
},
- 'text7' => {-itemtype => 'text',
- -coords => [66, 90],
- -params => {-font => $font_9b,
- -text => '32 cotés...',
- -anchor => 'center',
- -alignment => 'center',
- -color => '#660000',
- -priority => 50,
- },
- },
- 'etoile' => {-itemtype => 'polygone',
- -coords => [210, 90],
- -params => {-closed => 1,
- -filled => 1,
- -fillcolor => 'roundpolyg',
- -linewidth => 2,
- -linecolor => '#330000',
- -priority => 20,
+
+ 'petagone' => {-itemtype => 'group',
+ -coords => [66, 90],
+ -items => {'form' => {-itemtype => 'polygone',
+ -coords => [0, 0],
+ -numsides => 32,
+ -radius => 64,
+ -corner_radius => 10,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundpolyg',
+ -linewidth => 2,
+ -linecolor => '#330000',
+ -priority => 20,
+ -tags => ['p7', 'poly'],
+ },
+ },
+ 'text' => {-itemtype => 'text',
+ -coords => [0, 0],
+ -params => {-font => $font_9b,
+ -text => "32 cotés...",
+ -anchor => 'center',
+ -alignment => 'center',
+ -color => '#660000',
+ -priority => 50,
+ },
+ },
},
- -numsides => 5,
- -radius => 92,
- -inner_radius => 36,
- -corner_radius => 10,
- -startangle => 270,
- -corners => [1,0,1,0,1,0,1,0,1,0],
- },
- 'text8' => {-itemtype => 'text',
+ },
+
+ 'etoile' => {-itemtype => 'group',
-coords => [210, 90],
- -params => {-font => $font_9b,
- -text => 'Etoile',
- -anchor => 'center',
- -alignment => 'center',
- -color => '#660000',
- -priority => 50,
- },
- },
+ -items => {'form' => {-itemtype => 'polygone',
+ -coords => [0, 0],
+ -numsides => 5,
+ -radius => 92,
+ -inner_radius => 36,
+ -corner_radius => 10,
+ -startangle => 270,
+ -corners => [1,0,1,0,1,0,1,0,1,0],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundpolyg',
+ -linewidth => 2,
+ -linecolor => '#330000',
+ -priority => 20,
+ -tags => ['p8', 'poly'],
+ },
+ },
+ 'text' => {-itemtype => 'text',
+ -coords => [0, 0],
+ -params => {-font => $font_9b,
+ -text => "Etoile",
+ -anchor => 'center',
+ -alignment => 'center',
+ -color => '#660000',
+ -priority => 50,
+ },
+ },
+ },
+ },
+
},
'Polyline' => {'consigne' => {-itemtype => 'text',
@@ -1440,8 +1519,26 @@ foreach my $pagename (reverse @pagenames) {
while (my ($name, $style) = each(%{$itemstyle->{'-items'}})) {
&buildZincItem($zinc, $subgroup, $style, undef, $name);
}
+
+ if ($itemstyle->{'-repeat'}) {
+ my $num = $itemstyle->{'-repeat'}->{'-num'};
+ my ($dx, $dy) = @{$itemstyle->{'-repeat'}->{'-dxy'}};
+ for (my $i = 1; $i < $num; $i++) {
+ my $clone = $zinc->clone($subgroup);
+ $zinc->translate($clone, $dx*$i, $dy*$i);
+ my @items = $zinc->find('withtag', ".$clone*");
+ foreach my $item (@items) {
+ my @tags = $zinc->itemcget($item, -tags);
+ if (@tags) {
+ my ($name, $type) = @tags;
+ $zinc->itemconfigure($item, -tags => [$name.$i, $type]);
+ }
+ }
+ }
+ }
} else {
my $group = ($itemname eq 'consigne') ? $zinc->group($pgroup) : $pgroup;
+
&buildZincItem($zinc, $group, $itemstyle, undef, $itemname);
}
}
@@ -1492,6 +1589,12 @@ sub setBindings {
$zinc->bind('move', '<1>', sub {&mobileStart();});
$zinc->bind('move', '<B1-Motion>', sub {&mobileMove();});
$zinc->bind('move', '<ButtonRelease>', sub {&mobileStop();});
+
+ $zinc->bind('pushbtn', '<1>', sub {&pushButton();});
+ $zinc->bind('pushbtn', '<ButtonRelease>', sub {&pullButton();});
+
+ $zinc->bind('poly', '<1>', sub {&startRotatePolygone();});
+ $zinc->bind('poly', '<B1-Motion>', sub {&rotatePolygone();});
}
@@ -1585,6 +1688,47 @@ sub clickSelector {
#-----------------------------------------------------------------------------------
+# Callback sur evt CLICK des items tagés 'pushbtn'
+#-----------------------------------------------------------------------------------
+sub pushButton {
+ my $tag = ($zinc->itemcget('current', -tags))[0];
+ $zinc->scale($tag, .975, .975);
+ $zinc->translate($tag, 1, 1);
+}
+
+#-----------------------------------------------------------------------------------
+# Callback sur evt RELEASE des items tagés 'pushbtn'
+#-----------------------------------------------------------------------------------
+sub pullButton {
+ my $tag = ($zinc->itemcget('current', -tags))[0];
+ $zinc->treset($tag);
+}
+
+#-----------------------------------------------------------------------------------
+# Callback sur evt CATCH des items tagés 'poly'
+# armement de rotation des polygones
+#-----------------------------------------------------------------------------------
+sub startRotatePolygone {
+ my $ev = $zinc->XEvent;
+ my ($xref, $yref) = $zinc->transform($zinc->group('current'), 1, [0, 0]);
+ $previousangle = &lineAngle($ev->x, $ev->y, $xref, $yref);
+}
+
+#-----------------------------------------------------------------------------------
+# Callback sur evt MOTION des items tagés 'poly'
+# rotation des polygones
+#-----------------------------------------------------------------------------------
+sub rotatePolygone {
+ my $tag = ($zinc->itemcget('current', -tags))[0];
+ my $ev = $zinc->XEvent;
+ my ($xref, $yref) = $zinc->transform($zinc->group('current'), 1, [0, 0]);
+ my $newangle = &lineAngle($ev->x, $ev->y, $xref, $yref);
+
+ $zinc->rotate($tag, deg2rad($newangle - $previousangle));
+ $previousangle = $newangle;
+}
+
+#-----------------------------------------------------------------------------------
# Callback CATCH de sélection (début de déplacement) des items tagés 'move'
#-----------------------------------------------------------------------------------
sub mobileStart {