aboutsummaryrefslogtreecommitdiff
path: root/Perl/demos/Tk
diff options
context:
space:
mode:
authormertz2003-06-24 08:47:19 +0000
committermertz2003-06-24 08:47:19 +0000
commita5226e6d70495710f122f517db617e5a2f0f3b51 (patch)
treeb18faddcb260c61d16bdab7e247d9b737917496a /Perl/demos/Tk
parent1e6a0f1565eeefe908d89b9f2f8ef4cb671f6231 (diff)
downloadtkzinc-a5226e6d70495710f122f517db617e5a2f0f3b51.zip
tkzinc-a5226e6d70495710f122f517db617e5a2f0f3b51.tar.gz
tkzinc-a5226e6d70495710f122f517db617e5a2f0f3b51.tar.bz2
tkzinc-a5226e6d70495710f122f517db617e5a2f0f3b51.tar.xz
Ajout de la librairie Zinc::Graphics de JLV
et d'une demonstration faite par JLV
Diffstat (limited to 'Perl/demos/Tk')
-rw-r--r--Perl/demos/Tk/demos/zinc_data/paper.gifbin0 -> 1529 bytes
-rw-r--r--Perl/demos/Tk/demos/zinc_lib/testGraphics.pl1707
2 files changed, 1707 insertions, 0 deletions
diff --git a/Perl/demos/Tk/demos/zinc_data/paper.gif b/Perl/demos/Tk/demos/zinc_data/paper.gif
new file mode 100644
index 0000000..3247d35
--- /dev/null
+++ b/Perl/demos/Tk/demos/zinc_data/paper.gif
Binary files differ
diff --git a/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl b/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl
new file mode 100644
index 0000000..c79ace0
--- /dev/null
+++ b/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl
@@ -0,0 +1,1707 @@
+#!/usr/bin/perl
+#-----------------------------------------------------------------------------------
+#
+# testGraphics.pl
+# Fichier test du module Graphics
+#
+# Authors: Jean-Luc Vinot <vinot@cena.fr>
+#
+# $Id:
+#-----------------------------------------------------------------------------------
+
+use Tk;
+use Tk::Zinc;
+use Graphics;
+use Getopt::Long;
+use strict 'vars';
+
+my $rotate_angle = .1;
+my $zoomfactor = .1;
+my $curview;
+my ($dx, $dy);
+
+my $tabanchor = 'n';
+my $tabalign = 'left';
+
+my $font_9b = '-cenapii-bleriot mini-bold-r-normal--9-90-75-75-p-75-iso8859-15';
+
+my %gradset = (# gradiants zinc
+ 'boitonglet' => '=axial 0|#ff7777|#ffff99',
+ 'roundrect1' => '=axial 270|#a7ffa7;70 0|#ffffff;90 5|#00bd00;80 8|#b7ffb7;50 80|#ffffff;70 91|#00ac00;70 95|#006700;60 100',
+ 'roundrect2' => '=axial 270|#00bd00;80 |#d7ffd7;60',
+ 'roundrect3' => '=axial 270|#00bd00;100 0|#ffffff;100 14|#ffffff;100 16|#00bd00;90 25|#b7ffb7;60 100',
+ 'roundrect4' => '=axial 0|#00bd00;100 0|#ffffff;100 20|#00bd00;50 30|#00bd00;90 80|#b7ffb7;60 100',
+ 'roundrect4ed' => '=path 48 48|#e7ffe7;20 0 70|#007900;20',
+ 'roundcurve2' => '=axial 270|#d7ffd7;60|#7777ff;80',
+ 'roundcurve1' => '=axial 270|#2222ff;80 |#d7ffd7;60',
+ 'roundcurve' => '=axial 270|#7777ff;80 |#d7ffd7;60',
+ 'roundpolyg' => '=radial -15 -20|#ffb7b7;50|#bd6622;90',
+ 'rpolyline' => '=axial 90|#ffff77;80 |#ff7700;60',
+ 'pushbtn1' => '=axial 0|#cccccc;100 0|#ffffff;100 10|#5a5a6a;100 80|#aaaadd;100 100',
+ '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',
+ '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',
+ 'logopoint' => '=radial -20 -20|#ffffff 0|#f70000 48|#900000 80|#ab0000 100',
+ 'logoptshad' => '=path 0 0|#770000;64 0|#770000;70 78|#770000;0 100',
+ );
+
+
+# contenu des pages exemples
+my %pagesconf = ('Rectangle' => {'consigne' => {-itemtype => 'text',
+ -coords => [-285, 155],
+ -params => {-font => $font_9b,
+ -text => "Mouse button 1 drag objects,\nEscape key reset transfos.",
+ -color => '#2222cc',
+ },
+ },
+ # roudedrectangle simple + radius 20
+ 'rr1' => {-itemtype => 'roundedrectangle',
+ -coords => [[-200, 30], [50, 130]],
+ -radius => 20,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundrect2',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['move'],
+ },
+ },
+
+ # roudedrectangle 'carré' (radius automatique)
+ 'rr2' => {-itemtype => 'roundedrectangle',
+ -coords => [[-250, -100], [-90, 60]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundrect1',
+ -linewidth => 3,
+ -linecolor => '#000000',
+ -priority => 30,
+ -tags => ['move'],
+ },
+ },
+ # cas particulier -> hippodrome (radius = h/2)
+ 'rr3' => {-itemtype => 'roundedrectangle',
+ -coords => [[-30, 80], [130, 160]],
+ -radius => 40,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundrect3',
+ -linewidth => 4,
+ -linecolor => '#000000',
+ -priority => 30,
+ -tags => ['move'],
+ },
+ },
+
+ # utilisation de l'option -corners (pétales de fleur)
+ 'rr4a' => {-itemtype => 'roundedrectangle',
+ -coords => [[-30, -60], [110, 10]],
+ -radius => 40,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundrect3',
+ -linewidth => 3,
+ -linecolor => '#000000',
+ -priority => 30,
+ -tags => ['move'],
+ },
+ -corners => [1, 0, 1, 0],
+ },
+ 'rr4b' => {-itemtype => 'roundedrectangle',
+ -coords => [[118, -68], [220, -132]],
+ -radius => 40,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundrect3',
+ -linewidth => 3,
+ -linecolor => '#000000',
+ -priority => 30,
+ -tags => ['move'],
+ },
+ -corners => [1, 0, 1, 0],
+ },
+ 'rr4c' => {-itemtype => 'roundedrectangle',
+ -coords => [[118, -60], [190, 30]],
+ -radius => 40,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundrect3',
+ -linewidth => 3,
+ -linecolor => '#000000',
+ -priority => 30,
+ -tags => ['move'],
+ },
+ -corners => [0, 1, 0, 1],
+ },
+ 'rr4d' => {-itemtype => 'roundedrectangle',
+ -coords => [[40, -152], [110, -68]],
+ -radius => 40,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundrect3',
+ -linewidth => 3,
+ -linecolor => '#000000',
+ -priority => 30,
+ -tags => ['move'],
+ },
+ -corners => [0, 1, 0, 1],
+ },
+
+ # groupe de 2 boutons avec bordure externe
+ 'gr8' => {-itemtype => 'group',
+ -coords => [0, 0],
+ -params => {-priority => 10,
+ -tags => ['move'],
+ -atomic => 1,
+ },
+ -items => {'edge' => {-itemtype => 'roundedrectangle',
+ -coords => [[174, -36],[266, 146]],
+ -radius => 26,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundrect4ed',
+ -linewidth => 1,
+ -linecolor => '#ffffff',
+ -priority => 20,
+ },
+ },
+ 'top' => {-itemtype => 'roundedrectangle',
+ -coords => [[180, -30], [260, 53]],
+ -parentgroup => 'gr8',
+ -radius => 20,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundrect4',
+ -linewidth => 2.5,
+ -linecolor => '#000000',
+ -priority => 30,
+ },
+ -corners => [1, 0, 0, 1],
+ },
+ 'topico' => {-itemtype => 'curve',
+ -parentgroup => 'gr8',
+ -coords => [[220, -10],[200, 30],[240, 30]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => '#ffff00;80',
+ -linewidth => 1,
+ -linecolor => '#007900;80',
+ -priority => 50,
+ },
+ },
+ 'bottom' => {-itemtype => 'roundedrectangle',
+ -parentgroup => 'gr8',
+ -coords => [[180, 57], [260, 140]],
+ -radius => 20,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundrect4',
+ -linewidth => 2.5,
+ -linecolor => '#000000',
+ -priority => 30,
+ },
+ -corners => [0, 1, 1, 0],
+ },
+ 'bottomico' => {-itemtype => 'curve',
+ -parentgroup => 'gr8',
+ -coords => [[220, 120],[240, 80],[200, 80]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => '#ffff00;80',
+ -linewidth => 1,
+ -linecolor => '#007900;80',
+ -priority => 50,
+ },
+ },
+ },
+ },
+ },
+ 'Hippodrome' => {'hp1edge' => {-itemtype => 'hippodrome',
+ -coords => [[-206, -126], [-114, 46]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn_edge',
+ -linewidth => 1,
+ -linecolor => '#ffffff',
+ -priority => 10,
+ },
+ },
+ 'hp1' => {-itemtype => 'hippodrome',
+ -coords => [[-200, -120], [-120, 40]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn1',
+ -linewidth => 3,
+ -linecolor => '#000000',
+ -priority => 20,
+ },
+ },
+
+ '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,
+ },
+ -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',
+ },
+
+ 'hp3edge' => {-itemtype => 'hippodrome',
+ -coords => [[-204, 96], [204, 144]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn_edge2',
+ -linewidth => 1,
+ -linecolor => '#ffffff',
+ -priority => 10,
+ },
+ },
+ 'hp3G' => {-itemtype => 'hippodrome',
+ -coords => [[-200, 100], [-120, 140]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn2',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 20,
+ },
+ -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,
+ },
+ -trunc => 'both',
+ },
+ '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,
+ },
+ -trunc => 'both',
+ },
+ '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,
+ },
+ -trunc => 'both',
+ },
+ '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,
+ },
+ -trunc => 'left',
+ },
+ '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,
+ },
+ },
+ '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,
+ },
+ -rotate => 30,
+ -translate => [90, 30],
+ },
+
+ '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,
+ },
+ -rotate => 30,
+ -translate => [135, 30],
+ },
+
+ '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],
+ },
+
+ },
+
+ 'Polygone' => {'triangle' => {-itemtype => 'polygone',
+ -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,
+ },
+ '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',
+ -coords => [-80, -70],
+ -params => {-font => $font_9b,
+ -text => 'Carré',
+ -anchor => 'center',
+ -alignment => 'center',
+ -color => '#660000',
+ -priority => 50,
+ },
+ },
+ 'pentagone' => {-itemtype => 'polygone',
+ -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,
+ },
+
+ 'text3' => {-itemtype => 'text',
+ -coords => [65, -70],
+ -params => {-font => $font_9b,
+ -text => 'Pentagone',
+ -anchor => 'center',
+ -alignment => 'center',
+ -color => '#660000',
+ -priority => 50,
+ },
+ },
+
+ 'hexagone' => {-itemtype => 'polygone',
+ -coords => [210, -70],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundpolyg',
+ -linewidth => 2,
+ -linecolor => '#330000',
+ -priority => 20,
+ },
+ -numsides => 6,
+ -radius => 68,
+ -corner_radius => 10,
+ },
+ '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,
+ },
+ -numsides => 32,
+ -radius => 64,
+ -corner_radius => 10,
+ },
+ '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,
+ },
+ -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',
+ -coords => [210, 90],
+ -params => {-font => $font_9b,
+ -text => 'Etoile',
+ -anchor => 'center',
+ -alignment => 'center',
+ -color => '#660000',
+ -priority => 50,
+ },
+ },
+ },
+
+ 'Polyline' => {'consigne' => {-itemtype => 'text',
+ -coords => [-285, 155],
+ -params => {-font => $font_9b,
+ -text => "Mouse button 1 drag objects,\nEscape key reset transfos.",
+ -color => '#2222cc',
+ },
+ },
+ 'a' => {-itemtype => 'polyline',
+ -coords => [[-200, -115],[-200, -100],[-218, -115],[-280, -115],[-280, -16],
+ [-218, -16],[-200, -31],[-200, -17.5],[-150, -17.5],[-150,-115]],
+ -corners_radius => [0, 0, 42, 47, 47, 42, 0, 0, 0, 0, 0, 0],
+ -params => {-closed => 1,
+ -filled => 1,
+ -visible => 1,
+ -fillcolor => 'rpolyline',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 50,
+ -tags => ['move'],
+ },
+ -contours => [['add', -1, [[-230, -80],[-230, -50],[-200, -50],[-200, -80]],15]],
+ },
+ 'b' => {-itemtype => 'polyline',
+ -coords => [[-138, -150],[-138, -17.5],[-88, -17.5],[-88, -31],[-70, -16],
+ [-8, -16],[-8, -115],[-70, -115],[-88, -100],[-88, -150]],
+ -corners_radius => [0, 0, 0, 0, 42, 47, 47, 42, 0, 0, 0, 0, 0, 0],
+ -params => {-closed => 1,
+ -filled => 1,
+ -visible => 1,
+ -fillcolor => 'rpolyline',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 50,
+ -tags => ['move'],
+ },
+ -contours => [['add', -1, [[-88, -80],[-88, -50],[-58, -50],[-58, -80]],15]],
+ },
+ 'c' => {-itemtype => 'polyline',
+ -coords => [[80, -76],[80, -110],[60, -115],[0, -115],[0, -16],
+ [60, -16],[80, -21],[80, -57],[50, -47],[50, -86]],
+ -corners_radius => [0, 0, 70, 47, 47, 70, 0, 0, 14, 14, 0, 0, 0,0 ],
+ -params => {-closed => 1,
+ -filled => 1,
+ -visible => 1,
+ -fillcolor => 'rpolyline',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 50,
+ -tags => ['move'],
+ },
+ },
+ 'spirale' => {-itemtype => 'polyline',
+ -coords => [[215, -144],[139, -144],[139, 0],[268, 0],[268, -116],
+ [162.5, -116],[162.5, -21],[248, -21],[248, -96],[183, -96],
+ [183, -40],[231,-40],[231, -80],[199, -80],[199, -55],[215, -55]],
+ -corners_radius => [0, 76, 68, 61, 55, 50, 45, 40, 35, 30, 26, 22, 18, 14, 11],
+ -params => {-closed => 1,
+ -filled => 1,
+ -visible => 1,
+ -fillcolor => 'rpolyline',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 50,
+ -tags => ['move'],
+ },
+ },
+ 'logo' => {-itemtype => 'group',
+ -coords => [0, 0],
+ -params => {-priority => 30,
+ -atomic => 1,
+ -tags => ['move'],
+ },
+ -items => {'tkzinc' => {-itemtype => 'polyline',
+ -coords => [[-150,10],[-44,10],[-44,68],[-28,51],[6,51],
+ [-19,79],[3,109],[53,51],[5,51],[5,10],[140,10],
+ [52,115],[96,115],[96,47],[196,47],[196,158],
+ [155,158],[155,89],[139,89],[139,160],[101, 160],
+ [101,132],[85,132],[85,160],[-42,160],[-2,115],
+ [-30,115],[-46,91],[-46,115],[-76,115],[-76,51],
+ [-98,51],[-98,115],[-130,115],[-130,51],[-150, 51]],
+ -corners_radius => [0,0,0,0,0,0,0,0,0,0,30,0,0,50,50,
+ 0,0,8,8,0,0,8,8,0,27],
+ -params => {-closed => 1,
+ -filled => 1,
+ -visible => 1,
+ -fillcolor => 'logoshape',
+ -linewidth => 2.5,
+ -linecolor => '#000000',
+ -priority => 10,
+ -fillrule => 'nonzero',
+ },
+ -contours => [['add',1,[[245,88],[245,47],[190,47],[190,158],
+ [259,158],[259,117],[230,117],[230,88]],
+ 0, undef, [0,0,55,55,0,0,15,15]]],
+ },
+ 'shad' => {-itemtype => 'arc',
+ -coords => [[75, 91],[115,131]],
+ -params => {-priority => 20,
+ -filled => 1,
+ -linewidth => 0,
+ -fillcolor => 'logoptshad',
+ -closed => 1,
+ },
+ },
+ 'point' => {-itemtype => 'arc',
+ -coords => [[70, 86],[110,126]],
+ -params => {-priority => 50,
+ -filled => 1,
+ -linewidth => 1,
+ -linecolor => '#a10000',
+ -fillcolor => 'logopoint',
+ -closed => 1,
+ },
+ },
+ },
+ },
+ },
+
+ 'MultiContours' => {'consigne' => {-itemtype => 'text',
+ -coords => [-285, 155],
+ -params => {-font => $font_9b,
+ -text => "Mouse button 1 drag objects,\nEscape key reset transfos.",
+ -color => '#2222cc',
+ },
+ },
+ 'mc1' => {-itemtype => 'roundedcurve',
+ -coords => [[-30, -170], [-130, 0],[70, 0]],
+ -radius => 14,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundcurve2',
+ -linewidth => 1,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['move'],
+ -fillrule => 'odd',
+ },
+ -contours => [['add',1,[[-30,-138],[-100,-18],[40,-18]],8],
+ ['add',1,[[-30,-130],[ -92,-22],[32,-22]],5],
+ ['add',1,[[-30,-100],[ -68,-36],[8,-36]],5],
+ ['add',1,[[-30, -92],[ -60,-40],[0,-40]],3],],
+ },
+ 'mc2' => {-itemtype => 'polyline',
+ -coords => [[-250,-80], [-240,-10],[-285,-10],[-285,80],
+ [-250, 80],[-250, 40],[-170, 40],[-170,80],
+ [-100,80],[-100,40],[-20,40],[-20,80],[30,80],
+ [-10, 0],[-74, -10],[-110, -80]],
+ -corners_radius => [24,4, 40, 20, 0, 40, 40, 0, 0, 40, 40, 0, 30, 75, 0, 104],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundcurve1',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 30,
+ -tags => ['move'],
+ },
+ -contours => [['add',-1,[[-240,-72],[-230,0],[-169,0],[-185, -72]],
+ 0, undef, [16, 16, 0, 0]],
+ ['add', -1, [[-175,-72],[-159,0],[-78,0],[-116, -72]],
+ 0, undef, [0, 0, 8, 88]],
+ ['add', 1, [[-245,45],[-245,115],[-175,115],[-175, 45]],
+ 35],
+ ['add', -1, [[-225,65],[-225,95],[-195,95],[-195, 65]],
+ 15],
+ ['add', 1, [[-95,45],[-95,115],[-25,115],[-25, 45]],
+ 35],
+ ['add', -1, [[-75,65],[-75,95],[-45,95],[-45, 65]],
+ 15],
+ ],
+ },
+ 'mc3' => {-itemtype => 'roundedcurve',
+ -coords => [[-10, 170], [256, 170],[312, 60],[48, 60]],
+ -radius => 34,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundcurve2',
+ -linewidth => 2.5,
+ -linecolor => '#000000',
+ -priority => 40,
+ -tags => ['move'],
+ },
+ -contours => [['add', -1, [[58, 62],[12, 144],[60, 172],[104, 88]],27],
+ ['add', 1, [[48, 77],[48, 119],[90, 119],[90, 77]],21],
+ ['add', -1, [[244, 58],[198, 140],[246, 168],[290, 84]],27],
+ ['add', 1, [[213, 110],[213, 152],[255, 152],[255, 110]],21],
+ ['add', -1, [[150, 60],[150, 170],[160, 170],[160, 60]],0]],
+ },
+ 'mc4' => {-itemtype => 'roundedcurve',
+ -coords => [[222, -150],[138, -150],[180, -50],[138, -150],
+ [80, -92],[180, -50],[80, -92],[80, -8],
+ [180, -50],[80, -8],[138, 50],[180, -50],
+ [138, 50],[222, 50],[179.8, -50],[222, 50],
+ [280, -8],[180, -50],[280, -8],[280, -92],
+ [180, -50],[280, -92],[222,-150],[180,-50]],
+ -radius => 28,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'roundcurve',
+ -linewidth => 2,
+ -linecolor => '#000000',
+ -priority => 30,
+ -tags => ['move'],
+ },
+ -contours => [['add', -1, [[160, -70],[160, -30],[200, -30],[200, -70]],20]],
+ },
+ },
+
+ 'TabBox' => {'bo1' => {-itemtype => 'tabbox',
+ -coords => [[-240, -140], [240, 120]],
+ -radius => 8,
+ -tabwidth => 72,
+ -tabheight => 28,
+ -numpages => 8,
+ -anchor => 'n',
+ -alignment => 'left',
+ -overlap => 3,
+ -tabtitles => ['A', 'B', 'C', 'D', 'E', 'F','G','H'],
+ -params => {-closed => 1,
+ -priority => 100,
+ -filled => 1,
+ -fillcolor => '#ffffff',
+ -linewidth => 1.2,
+ -linecolor => '#000000',
+ -tags => ['div2', 'divider', 'intercalaire'],
+ },
+ },
+
+ 'back' => {-itemtype => 'roundedrectangle',
+ -coords => [[-242, -142], [242, 122]],
+ -radius => 10,
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => '#777777;80',
+ -linewidth => 1,
+ -linecolor => '#777777;80',
+ },
+ },
+
+ 'anchor' => {-itemtype => 'text',
+ -coords => [-120, 138],
+ -params => {-text => 'tabs anchor',
+ -color => '#2222cc',
+ -font => $font_9b,
+ -anchor => 'center',
+ -alignment => 'center',
+ -priority => 40,
+ },
+ },
+
+ 'anchorN' => {-itemtype => 'hippodrome',
+ -coords => [[-210, 150], [-165, 176]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn4',
+ -linewidth => 1.5,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['sel1','n','btn','selector'],
+ },
+ -trunc => 'right',
+ },
+ 'txtanN' => {-itemtype => 'text',
+ -coords => [-187, 163],
+ -params => {-text => 'N',
+ -color => '#000000',
+ -font => $font_9b,
+ -anchor => 'center',
+ -alignment => 'center',
+ -priority => 40,
+ -tags => ['sel1','n','btntext','selector'],
+ },
+ },
+
+ 'anchorE' => {-itemtype => 'hippodrome',
+ -coords => [[-163, 150], [-120, 176]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn4',
+ -linewidth => 1.5,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['sel1','e','btn','selector'],
+ },
+ -trunc => 'both',
+ },
+ 'txtanE' => {-itemtype => 'text',
+ -coords => [-141.5, 163],
+ -params => {-text => 'E',
+ -color => '#000000',
+ -font => $font_9b,
+ -anchor => 'center',
+ -alignment => 'center',
+ -priority => 40,
+ -tags => ['sel1','e','btntext','selector'],
+ },
+ },
+
+ 'anchorS' => {-itemtype => 'hippodrome',
+ -coords => [[-118, 150], [-75, 176]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn4',
+ -linewidth => 1.5,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['sel1','s','btn','selector'],
+ },
+ -trunc => 'both',
+ },
+ 'txtanS' => {-itemtype => 'text',
+ -coords => [-96.5, 163],
+ -params => {-text => 'S',
+ -color => '#000000',
+ -font => $font_9b,
+ -anchor => 'center',
+ -alignment => 'center',
+ -priority => 40,
+ -tags => ['sel1','s','btntext','selector'],
+ },
+ },
+ 'anchorW' => {-itemtype => 'hippodrome',
+ -coords => [[-73, 150], [-28, 176]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn4',
+ -linewidth => 1.5,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['sel1','w','btn','selector'],
+ },
+ -trunc => 'left',
+ },
+ 'txtanW' => {-itemtype => 'text',
+ -coords => [-52, 163],
+ -params => {-text => 'W',
+ -color => '#000000',
+ -font => $font_9b,
+ -anchor => 'center',
+ -alignment => 'center',
+ -priority => 40,
+ -tags => ['sel1','w','btntext','selector'],
+ },
+ },
+ 'alignment' => {-itemtype => 'text',
+ -coords => [120, 138],
+ -params => {-text => 'tabs alignment',
+ -color => '#2222cc',
+ -font => $font_9b,
+ -anchor => 'center',
+ -alignment => 'center',
+ -priority => 40,
+ },
+ },
+ 'alignG' => {-itemtype => 'hippodrome',
+ -coords => [[30, 150], [90, 176]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn4',
+ -linewidth => 1.5,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['sel2','left','btn','selector'],
+ },
+ -trunc => 'right',
+ },
+ 'txtalG' => {-itemtype => 'text',
+ -coords => [60, 163],
+ -params => {-text => 'left',
+ -color => '#000000',
+ -font => $font_9b,
+ -anchor => 'center',
+ -alignment => 'center',
+ -priority => 40,
+ -tags => ['sel2','left','btntext','selector'],
+ },
+ },
+ 'alignC' => {-itemtype => 'hippodrome',
+ -coords => [[92, 150], [148, 176]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn4',
+ -linewidth => 1.5,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['sel2','center','btn','selector'],
+ },
+ -trunc => 'both',
+ },
+ 'txtalC' => {-itemtype => 'text',
+ -coords => [120, 163],
+ -params => {-text => 'center',
+ -color => '#000000',
+ -font => $font_9b,
+ -anchor => 'center',
+ -alignment => 'center',
+ -priority => 40,
+ -tags => ['sel2','center','btntext','selector'],
+ },
+ },
+ 'alignD' => {-itemtype => 'hippodrome',
+ -coords => [[150, 150], [210, 176]],
+ -params => {-closed => 1,
+ -filled => 1,
+ -fillcolor => 'pushbtn4',
+ -linewidth => 1.5,
+ -linecolor => '#000000',
+ -priority => 20,
+ -tags => ['sel2','right','btn','selector'],
+ },
+ -trunc => 'left',
+ },
+ 'txtalD' => {-itemtype => 'text',
+ -coords => [180, 163],
+ -params => {-text => 'right',
+ -color => '#000000',
+ -font => $font_9b,
+ -anchor => 'center',
+ -alignment => 'center',
+ -priority => 40,
+ -tags => ['sel2','right','btntext','selector'],
+ },
+ },
+ },
+
+ 'PathLine' => {'consigne' => {-itemtype => 'text',
+ -coords => [-285, 155],
+ -params => {-font => $font_9b,
+ -text => "Mouse button 1 drag objects,\nEscape key reset transfos.",
+ -color => '#2222cc',
+ },
+ },
+ 'pl1' => {-itemtype => 'pathline',
+ -metacoords => {-type => 'polygone',
+ -coords => [0, 0],
+ -numsides => 12,
+ -radius => 200,
+ -inner_radius => 100,
+ -startangle => -8,
+ },
+ -linewidth => 20,
+ -closed => 1,
+ -graduate => {-type => 'linear',
+ -colors => ['#ff0000', '#ff00ff', '#0000ff', '#00ffff',
+ '#00ff00', '#ffff00', '#ff0000'],
+ },
+ -params => {-priority => 100,
+ -tags => ['move'],
+ },
+ },
+
+ 'pl2' => {-itemtype => 'group',
+ -coords => [0, 0],
+ -params => {-priority => 200,
+ -atomic => 1,
+ -tags => ['move'],
+ },
+ -items => {'in' => {-itemtype => 'pathline',
+ -coords => [[30, -60],[-30, -60],[-30, -30],
+ [-60, -30],[-60, 30],[-30, 30],
+ [-30, 60],[30, 60],[30, 30],
+ [60, 30],[60, -30],[30, -30]],
+ -linewidth => 16,
+ -closed => 1,
+ -shifting => 'left',
+ -graduate => {-type => 'transversal',
+ -colors => ['#00aa77;100', '#00aa77;0'],
+ },
+ -params => {-priority => 10,
+ },
+ },
+
+ 'out' => {-itemtype => 'pathline',
+ -coords => [[30, -60],[-30, -60],[-30, -30],
+ [-60, -30],[-60, 30],[-30, 30],
+ [-30, 60],[30, 60],[30, 30],
+ [60, 30],[60, -30],[30, -30]],
+ -linewidth => 10,
+ -closed => 1,
+ -shifting => 'right',
+ -graduate => {-type => 'transversal',
+ -colors => ['#00aa77;100', '#00aa77;0'],
+ },
+ -params => {-priority => 10,
+ },
+ },
+ },
+ },
+
+ 'pl3' => {-itemtype => 'group',
+ -coords => [0, 0],
+ -params => {-priority => 100,
+ -atomic => 1,
+ -tags => ['move'],
+ },
+ -items => {'back' => {-itemtype => 'arc',
+ -coords => [[-150, -150],[150,150]],
+ -params => {-priority => 10,
+ -closed => 1,
+ -filled => 1,
+ -fillcolor => '=radial 15 15|#ffffff;40|#aaaaff;10',
+ -linewidth => 0,
+ },
+ },
+ 'light' => {-itemtype => 'pathline',
+ -metacoords => {-type => 'polygone',
+ -coords => [0, 0],
+ -numsides => 30,
+ -radius => 150,
+ -startangle => 240,
+ },
+ -linewidth => 20,
+ -shifting => 'right',
+ -closed => 1,
+ -graduate => {-type => 'double',
+ -colors => [['#ffffff;0', '#222299;0', '#ffffff;0'],
+ ['#ffffff;100', '#222299;70', '#ffffff;100']],
+ },
+ -params => {-priority => 50,
+ },
+ },
+ 'bord' => {-itemtype => 'arc',
+ -coords => [[-150, -150],[150,150]],
+ -params => {-priority => 100,
+ -closed => 1,
+ -filled => 0,
+ -linewidth => 2,
+ -linecolor => '#000033;80'
+ },
+ },
+
+ },
+ },
+ },
+
+ );
+
+my %tabtable = ('n' => {-numpages => 8,
+ -titles => ['A','B','C','D','E','F','G','H'],
+ -names => ['Avant Garde','Bodini','Clarendon','Didot',
+ 'Eras','Frutiger','Garamond','Helvetica'],
+ -images => ['avantgarde.gif','bodini.gif','clarendon.gif','didot.gif',
+ 'eras.gif','frutiger.gif','garamond.gif','helvetica.gif'],
+ },
+ 'e' => {-numpages => 5,
+ -titles => ['I','J','K','L','M'],
+ -names => ['Impact','Jenson','Kabel','Lubalin Graph','Matura'],
+ -images => ['impact.gif','jenson.gif','kabel.gif','lubalingraph.gif','matura.gif'],
+ },
+ 's' => {-numpages => 8,
+ -titles => ['N','O','P','Q','R','S','T','U'],
+ -names => ['New Century Scoolbook','Optima','Peignot','Quorum',
+ 'Revue','Souvenir','Times New Roman', 'Univers'],
+ -images => ['newcenturyscoolbook.gif','optima.gif','peignot.gif','quorum.gif',
+ 'revue.gif','souvenir.gif','timesnewroman.gif','univers.gif'],
+ },
+ 'w' => {-numpages => 5,
+ -titles => ['V','W','X','Y','Z'],
+ -names => ['Veljovic','Warnock','X-files','Yellow Submarine','zapf Chancery'],
+ -images => ['veljovic.gif','warnock.gif','xfiles.gif','yellowsubmarine.gif','zapfchancery.gif'],
+ },
+ );
+
+
+
+# creation de la fenetre principale
+my $mw = MainWindow->new();
+$mw->geometry("700x560+0+0");
+$mw->title('Test Graphics Module');
+
+
+# creation du widget Zinc
+my $zinc = $mw->Zinc(-render => 1,
+ -width => 700,
+ -height => 560,
+ -borderwidth => 0,
+ -lightangle => 140,
+ -borderwidth => 0,
+ -backcolor => '#cccccc',);
+$zinc->pack(-fill => 'both', -expand => 1);
+
+
+# initialise les gradiants nommés
+&setGradiants($zinc, \%gradset);
+
+# initialise les images de fontes
+while (my ($anchor, $table) = each(%tabtable)) {
+ my @images;
+ foreach my $filename (@{$table->{'-images'}}) {
+ my $image = $zinc->Photo(-file => Tk::findINC($filename));
+ push(@images, $image);
+ }
+ $tabtable{$anchor}->{'-images'} = \@images;
+}
+
+# création de la vue principale
+my $tgroup = $zinc->add('group', 1);
+$zinc->coords($tgroup, [350, 240]);
+
+# consigne globale
+$zinc->add('text', 1,
+ -position => [50, 470],
+ -text => "Global interations :\n<Up>, <Down>, <Left> and <Right> keys move content of TabBox pages\n<Plus> and <Minus> keys zoom out and zoom in this page\n<Greater> and <Less> keys rotate this page\n<Escape> key reset transfos",
+ -font => $font_9b,
+ -color => '#555555',
+ -spacing => 2,
+ );
+
+# Création des pages d'exemples
+my ($shapes, $tcoords) = &TabBoxCoords([[-315, -210],[315, 210]],
+ -numpages => 7,
+ -overlap => 2,
+ -radius => 8,
+ -tabheight => 26,
+ -tabwidth => [92,100,82,82,82,120,80],
+ );
+
+# to find some images (used as textures) needed by this demo
+push @INC , Tk->findINC('demos/zinc_data');
+#print "image_path=$image_path\n";
+my $texture = $zinc->Photo(-file => Tk::findINC('paper.gif'));
+
+# création des items zinc correspondants
+my $i = scalar(@{$shapes}) - 1;
+my @pagenames = ('Rectangle', 'Hippodrome', 'Polygone', 'Polyline', 'PathLine', 'MultiContours', 'TabBox');
+my @pagegroups;
+foreach my $shape (reverse @{$shapes}) {
+ my $divgroup = $zinc->add('group', $tgroup);
+
+ # création de l'intercalaire
+ my $divider = $zinc->add('curve', $divgroup,
+ $shape,
+ -closed => 1,
+ -priority => 10,
+ -linewidth => 1,
+ -linecolor => '#000000',
+ -filled => 1,
+ -tile => $texture,
+ -tags => ['div1', $i, 'divider', 'intercalaire'],
+ );
+
+ # groupe page clippé
+ my $page = $zinc->add('group', $divgroup,
+ -priority => 100,
+ -tags => ['div1', $i, 'page'],
+ );
+ my $clip = $zinc->add('rectangle', $page,
+ [[-300, -170],[300, 195]],
+ -linewidth => 1,
+ -linecolor => '#000099',
+ -filled => 1,
+ -fillcolor => '#000000;4',
+ );
+ $zinc->itemconfigure($page, -clip => $clip);
+
+ my $pgroup = $zinc->add('group', $page,
+ -tags => ['div1', $i, 'content'],
+ );
+
+ push(@pagegroups, $pgroup);
+
+ # titre de l'intercalaire
+ $zinc->add('text', $divgroup,
+ -position => $tcoords->[$i],
+ -text => $pagenames[$i],
+ -font => $font_9b,
+ -alignment => 'center',
+ -anchor => 'center',
+ -color => '#000099',
+ -priority => 200,
+ -tags => ['div1', $i, 'divider','titre'],
+ );
+ $i--;
+}
+
+# création du contenu des pages
+my $i = 0;
+foreach my $pagename (reverse @pagenames) {
+ my $pagestyle = $pagesconf{$pagename};
+ if ($pagestyle) {
+ my $pgroup = $pagegroups[$i];
+ while (my ($itemname, $itemstyle) = each(%{$pagestyle})) {
+ if ($itemstyle->{'-itemtype'} eq 'tabbox') {
+ &buildTabBox($zinc, $pgroup, $itemstyle, $itemname);
+
+ } else {
+ if ($itemstyle->{'-itemtype'} eq 'group') {
+ my $subgroup = &buildZincItem($zinc, $pgroup, $itemstyle, undef, $itemname);
+ while (my ($name, $style) = each(%{$itemstyle->{'-items'}})) {
+ &buildZincItem($zinc, $subgroup, $style, undef, $name);
+ }
+ } else {
+ my $group = ($itemname eq 'consigne') ? $zinc->group($pgroup) : $pgroup;
+ &buildZincItem($zinc, $group, $itemstyle, undef, $itemname);
+ }
+ }
+ }
+ }
+ $i++;
+}
+
+&clickSelector('sel1','n');
+&clickSelector('sel2','left');
+&selectDivider('div1', 0);
+
+&setBindings;
+
+
+MainLoop;
+#----------------------------------------------------------------------- fin de MAIN
+
+
+sub setBindings {
+ # grab keyboard
+ $mw->Tk::focus();
+
+ # plus,moins : Zoom++, Zoom--
+ $mw->Tk::bind('<plus>', sub {viewZoom('up');});
+ $mw->Tk::bind('<minus>', sub {viewZoom('down');});
+
+ # Up, Down, Right, Left : Translate
+ $mw->Tk::bind('<KeyPress-Up>', sub {viewTranslate('up');});
+ $mw->Tk::bind('<KeyPress-Down>', sub {viewTranslate('down');});
+ $mw->Tk::bind('<KeyPress-Left>', sub {viewTranslate('left');});
+ $mw->Tk::bind('<KeyPress-Right>', sub {viewTranslate('right');});
+
+
+ # >, < : Rotate counterclockwise et clockwise
+ $mw->Tk::bind('<greater>', sub {viewRotate('cw');});
+ $mw->Tk::bind('<less>', sub {viewRotate('ccw');});
+
+ # Escape : reset transfos
+ $mw->Tk::bind('<Escape>', sub {$zinc->treset('move');
+ $zinc->raise('move');
+ $zinc->treset($curview);});
+
+ $zinc->bind('divider', '<1>', sub {&selectDivider();});
+
+ $zinc->bind('selector', '<1>', sub {&clickSelector();});
+
+ $zinc->bind('move', '<1>', sub {&mobileStart();});
+ $zinc->bind('move', '<B1-Motion>', sub {&mobileMove();});
+ $zinc->bind('move', '<ButtonRelease>', sub {&mobileStop();});
+}
+
+
+sub selectDivider {
+ my ($divname, $numpage) = @_;
+ if (!defined $divname) {
+ my @tags = $zinc->itemcget('current', -tags);
+ $divname = $tags[0];
+ $numpage = $tags[1];
+ }
+
+ $zinc->itemconfigure("($divname && titre)", -color => '#000099');
+ $zinc->itemconfigure("($divname && intercalaire)", -linewidth => 1.4);
+ $zinc->itemconfigure("($divname && page)", -visible => 0);
+
+ my $divgroup = $zinc->group("($divname && $numpage)");
+ $zinc->raise($divgroup);
+ $curview = "($divname && $numpage && content)";
+ $zinc->itemconfigure("($divname && $numpage && titre)", -color => '#000000');
+ $zinc->itemconfigure("($divname && $numpage && intercalaire)", -linewidth => 2);
+ $zinc->itemconfigure("($divname && $numpage && page)", -visible => 1);
+
+ if ($divname eq 'div2') {
+ my $fontname = $tabtable{$tabanchor}->{'-names'}->[$numpage];
+ my $fontimage = $tabtable{$tabanchor}->{'-images'}->[$numpage];
+ $zinc->itemconfigure("($divname && fontname)", -text => $fontname);
+ $zinc->raise("($divname && fontname)");
+ $zinc->itemconfigure("($divname && fontimage)", -image => $fontimage);
+ $zinc->raise("($divname && fontimage)");
+ }
+}
+
+
+sub clickSelector {
+ my ($btngroup, $value) = @_;
+
+ if (!defined $btngroup and !defined $value) {
+ my @tags = $zinc->itemcget('current', -tags);
+ $btngroup = $tags[0];
+ $value = $tags[1];
+ }
+
+ $zinc->treset($btngroup);
+ $zinc->itemconfigure("($btngroup && btntext)", -color => '#444444');
+ $zinc->itemconfigure("($btngroup && $value && btntext)", -color => '#2222bb');
+ $zinc->translate("($btngroup && $value)", 0, 1);
+
+ if ($value eq 'n' or $value eq 'e' or $value eq 's' or $value eq 'w') {
+ $tabanchor = $value;
+
+ } elsif ($value eq 'left' or $value eq 'center' or $value eq 'right') {
+ $tabalign = $value;
+ }
+
+ my $tabtable = $tabtable{$tabanchor};
+ my $numpages = $tabtable->{'-numpages'};
+ my %tabparams = (-radius => 8,
+ -tabwidth => 72,
+ -tabheight => 28,
+ -numpages => $numpages,
+ -anchor => $tabanchor,
+ -alignment => $tabalign,
+ -overlap => 3,
+ );
+
+ my ($shapes, $tcoords) = &TabBoxCoords([[-240, -140], [240, 120]], %tabparams);
+
+ for (my $index = 7; $index >= 0; $index--) {
+ my $divgroup = $zinc->group("(div2 && $index && intercalaire)");
+ $zinc->itemconfigure($divgroup, -visible => ($index < $numpages));
+
+ if ($index >= $numpages) {
+ $zinc->lower($divgroup);
+
+ } else {
+ $zinc->raise($divgroup);
+ $zinc->itemconfigure("(div2 && $index)", -visible => 1);
+ $zinc->coords("(div2 && $index && intercalaire)", $shapes->[$index]);
+ $zinc->coords("(div2 && $index && titre)", $tcoords->[$index]);
+ $zinc->itemconfigure("(div2 && $index && titre)", -text => $tabtable->{'-titles'}->[$index]);
+ }
+
+ }
+
+ &selectDivider('div2', 0);
+}
+
+
+#-----------------------------------------------------------------------------------
+# Callback CATCH de sélection (début de déplacement) des items tagés 'move'
+#-----------------------------------------------------------------------------------
+sub mobileStart {
+ my $ev = $zinc->XEvent;
+ ($dx, $dy) = (0 - $ev->x, 0 - $ev->y);
+
+ $zinc->raise('current');
+
+}
+
+
+#-----------------------------------------------------------------------------------
+# Callback MOVE de déplacement des items tagés 'move'
+#-----------------------------------------------------------------------------------
+sub mobileMove {
+ my $ev = $zinc->XEvent;
+ $zinc->translate('current', $ev->x + $dx, $ev->y +$dy);
+ ($dx, $dy) = (0 - $ev->x, 0 - $ev->y);
+
+}
+
+
+#-----------------------------------------------------------------------------------
+# Callback RELEASE de relaché (fin de déplacement) des items tagés 'move'
+#-----------------------------------------------------------------------------------
+sub mobileStop {
+ &mobileMove;
+}
+
+
+sub viewTranslate {
+ my $way = shift;
+
+ my $dx = ($way eq 'left') ? -10 : ($way eq 'right') ? 10 : 0;
+ my $dy = ($way eq 'up') ? -10 : ($way eq 'down') ? 10 : 0;
+
+ $zinc->translate($curview, $dx, $dy);
+
+}
+
+sub viewZoom {
+ my $key = shift;
+ my $scaleratio = ($key eq 'up') ? 1+$zoomfactor : 1-$zoomfactor;
+
+ $zinc->scale($curview, $scaleratio, $scaleratio);
+
+}
+
+sub viewRotate {
+ my $way = shift;
+ my $delta_angle = $rotate_angle;
+
+ $delta_angle *= -1 if ($way eq 'cw');
+
+ $zinc->rotate($curview, $delta_angle);
+
+}
+
+
+
+
+sub buildTabBox {
+ my ($zinc, $parentgroup, $style, $name) = @_;
+ my $params = delete $style->{'-params'};
+ my @tags = @{$params->{'-tags'}};
+ my $coords = delete $style->{'-coords'};
+ my $table = $tabtable{$style->{'-anchor'}};
+ my $titles = $style->{'-tabtitles'};
+ my ($shapes, $tcoords, $invert) = &TabBoxCoords($coords, %{$style});
+ my $k = ($invert) ? scalar @{$shapes} : -1;
+ foreach my $shape (reverse @{$shapes}) {
+ $k += ($invert) ? -1 : +1;
+ my $group = $zinc->add('group', $parentgroup);
+ $params->{'-tags'} = [$tags[0], $k, $tags[1], 'intercalaire'];
+ $zinc->add('curve', $group, $shape, %{$params});
+
+ if ($style->{'-page'}) {
+ &buildZincItem($zinc, $group, $style->{'-page'});
+ }
+
+ my $tindex = ($invert) ? $k : $#{$shapes} - $k;
+ if ($titles) {
+ my $titltags = [$tags[0], $k, $tags[1], 'titre'];
+ $zinc->add('text', $group,
+ -position => $tcoords->[$tindex],
+ -text => $titles->[$tindex],
+ -font => $font_9b,
+ -alignment => 'center',
+ -anchor => 'center',
+ -color => '#000099',
+ -priority => 200,
+ -tags => $titltags,
+ );
+
+ }
+
+ # exemple fonte
+ if ($tindex == 0) {
+ $zinc->add('text', $parentgroup,
+ -position => [-130, -84],
+ -text => $table->{'-names'}->[0],
+ -font => $font_9b,
+ -alignment => 'left',
+ -anchor => 'w',
+ -color => '#000000',
+ -priority => 500,
+ -tags => [$tags[0], 'fontname'],
+ );
+
+ # as I do not want to put lot of images in TkZinc demos, I
+ # commented out the following lines!
+# $zinc->add('icon', $parentgroup,
+# -position => [-130, -70],
+# -priority => 200,
+# -image => $table->{'-images'}->[0],
+# -tags => [$tags[0], 'fontimage'],
+# );
+ }
+
+ }
+
+ &selectDivider($tags[0], $k);
+}
+
+
+1;