aboutsummaryrefslogtreecommitdiff
path: root/sandbox
diff options
context:
space:
mode:
authorlecoanet2002-11-05 09:13:59 +0000
committerlecoanet2002-11-05 09:13:59 +0000
commitfc0a7b5b93c7f751c266278264e3f0d14838e6ce (patch)
tree256adc3917c753048096419dadd99a2dd60bceaa /sandbox
parenteba83044803dde4e4992c489b9376d1833cdf53a (diff)
downloadtkzinc-fc0a7b5b93c7f751c266278264e3f0d14838e6ce.zip
tkzinc-fc0a7b5b93c7f751c266278264e3f0d14838e6ce.tar.gz
tkzinc-fc0a7b5b93c7f751c266278264e3f0d14838e6ce.tar.bz2
tkzinc-fc0a7b5b93c7f751c266278264e3f0d14838e6ce.tar.xz
*** empty log message ***
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/testshape.pl79
1 files changed, 71 insertions, 8 deletions
diff --git a/sandbox/testshape.pl b/sandbox/testshape.pl
index 9d6a76e..a55de42 100644
--- a/sandbox/testshape.pl
+++ b/sandbox/testshape.pl
@@ -9,21 +9,84 @@ $mw = MainWindow->new();
$top = 1;
$zinc = $mw->Zinc(-render => 1,
-borderwidth => 0,
- -fullreshape => 0,
+# -fullreshape => 0,
-relief => 'sunken');
$zinc->pack(-expand => 1, -fill => 'both');
$zinc->configure(-width => 500, -height => 500);
-$arc = $zinc->add('arc', $top, [50, 50, 200, 100],
- -visible => 0);
-$cv = $zinc->add('curve', $top, [50, 50, 100, 150, 270, 70,
- 220, 0, 200, 20, 180, -100,
- 140, 40, 70, -100],
- -visible => 0);
-$zinc->itemconfigure($top, -clip => $arc);
+# $arc = $zinc->add('arc', $top, [50, 50, 200, 100],
+# -visible => 0);
+#$zinc->itemconfigure($top, -clip => $arc);
$view = $zinc->add('group', $top, -tags => "controls");
+# $cv = $zinc->add('curve', $view, [50, 50, 100, 150, 270, 70,
+# 220, 0, 200, 20, 180, 100,
+# 140, 40, 70, 100],
+# -visible => 1,
+# -closed => 1,
+# -filled => 1);
+
+$arc = $zinc->add('arc', $view, [90,0, 160,50],
+ -visible => 0,
+ -linewidth => 0,
+ -filled => 1,
+ -fillcolor => 'brown');
+# $rect = $zinc->add('rectangle', $view, [200,230, 220,250],
+# -visible => 1,
+# -linewidth => 2,
+# -relief => 'sunken',
+# -filled => 1,
+# -linecolor => 'white',
+# -fillcolor => 'tan');
+$cv2 = $zinc->add('curve', $view, [],
+ -visible => 1,
+ -linewidth => 2,
+ -linecolor => 'white',
+ -fillcolor => 'tan',
+ -relief => 'sunken',
+ -closed => 1,
+ -filled => 1);
+$text = $zinc->add('text', $view,
+ -visible => 1,
+ -text => 'Un Texte ICI',
+ -position => [200, 100],
+ -color => '#008000');
+$zinc->contour($cv2, 'add', [[20, 20], [20, 100, 'c'], [120, 100], [120, 20]]);
+$zinc->contour($cv2, 'addhole', [40, 40, 80, 40, 80, 80, 40, 80]);
+$zinc->contour($cv2, 'add', [60, 50, 60, 60, 70, 60, 70, 50]);
+$zinc->contour($cv2, 'addhole', [90, 70, 150, 70, 150, 150, 90, 150]);
+$zinc->contour($cv2, 'add', [200, 200, 200, 220, 220, 220, 220, 200]);
+$zinc->contour($cv2, 'addhole', [100, 10, 180, 10, 180, 60, 100, 60]);
+
+$zinc->contour($cv2, 'add', $arc);
+$zinc->contour($cv2, 'add', $text);
+
+# $rect2 = $zinc->add('rectangle', $view, [40,81, 80,130],
+# -visible => 1,
+# -linewidth => 1,
+# -relief => 'sunken',
+# -filled => 1,
+# -linecolor => 'white',
+# -fillcolor => 'tan');
new Controls($zinc);
+$zinc->Tk::bind('<a>', sub {print "hop\n", $zinc->contour($cv2, 'remove', 1);});
+$zinc->Tk::bind('<b>', sub {my ($x,$y,$c) = $zinc->coords($cv2, 0, 1);
+ if ($c eq 'c') {
+ $zinc->coords($cv2, 0, 1, [[20, 100]]);
+ }
+ else {
+ $zinc->coords($cv2, 0, 1, [[20, 100, 'c']]);
+ }});
+$zinc->Tk::bind('<1>', sub {
+ my $ev = $zinc->XEvent();
+ my $it = $zinc->find('closest', $ev->x, $ev->y);
+ my @t = $zinc->vertexat($it, $ev->x, $ev->y);
+ print "Closest: $it\n";
+ print "VertexAt: ", join(', ', @t), "\n";
+ });
+
+$zinc->focusFollowsMouse();
+
MainLoop();