From 9569faffaa8ea30ff65dfc6cec362a8e1bcc3a82 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 31 May 2002 15:08:21 +0000 Subject: Changement des commandes de rotation et remise � z�ro. Changement de l'image affich�e pour l'icon. Correction d'un bug d'attribut sur text. Les flags composerotation et composescale sont lus depuis l'item et appliqu�s au rep�re graphique. --- Perl/demos/Tk/demos/zinc_lib/transforms.pl | 35 ++++++++++++++++-------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'Perl/demos') diff --git a/Perl/demos/Tk/demos/zinc_lib/transforms.pl b/Perl/demos/Tk/demos/zinc_lib/transforms.pl index 8838a65..63c4130 100644 --- a/Perl/demos/Tk/demos/zinc_lib/transforms.pl +++ b/Perl/demos/Tk/demos/zinc_lib/transforms.pl @@ -23,6 +23,8 @@ my $composerot = 1; my $composescale = 1; my $drag = 0; +my $logo = $mw->Photo(-file => "../zinc_data/zinc_anti.gif"); + my $text = $mw->Scrolled('Text', -relief => 'sunken', -borderwidth => 2, @@ -36,10 +38,10 @@ The available commands are: Button 2 on the background, add a group with initial translation Button 1 on item/group axes, select/deselect that item space Drag Button 1 on item/group axes, translate that item space - Home reset the transformation - Shift-Home reset a group direct children transformations + Del reset the transformation + Shift-Del reset a group direct children transformations PageUp/Down scale up/down - End/Del rotate right/left + End/Home rotate right/left Ins swap the Y axis 4 arrows translate in the 4 directions'); $text->configure(-state => 'disabled'); @@ -47,6 +49,7 @@ $text->configure(-state => 'disabled'); my $zinc = $mw->Zinc(-borderwidth => 3, -highlightthickness => 0, -relief => 'sunken', + -render => 0, -takefocus => 1); $zinc->pack(-expand => 1, -fill => 'both'); $zinc->configure(-width => 500, -height => 500); @@ -113,7 +116,7 @@ $zinc->add('text', $top, -anchor => 's', -color => $worldAxisColor, -alignment => 'center', - -tags => ["axis:$world"]); + -tags => ["axis:$world", 'text']); $currentgroup = $world; @@ -126,10 +129,10 @@ $zinc->Tk::bind('', \&moveright); $zinc->Tk::bind('', \&movedown); $zinc->Tk::bind('', \&scaledown); $zinc->Tk::bind('', \&scaleup); -$zinc->Tk::bind('', \&reset); -$zinc->Tk::bind('', \&resetchildren); +$zinc->Tk::bind('', \&reset); +$zinc->Tk::bind('', \&resetchildren); $zinc->Tk::bind('', \&rotateleft); -$zinc->Tk::bind('', \&rotateright); +$zinc->Tk::bind('', \&rotateright); $zinc->Tk::bind('', \&swapaxis); $zinc->Tk::bind('', [\&resize]); @@ -202,22 +205,24 @@ sub changeitem { my ($item) = @_; if (defined($currentitem) && !$drag) { - $zinc->itemconfigure("axis:$currentitem", + $zinc->itemconfigure("axis:$currentitem && !text", -linecolor => $inactiveAxisColor, -fillcolor => $inactiveAxisColor); if ($currentitem != $currentgroup) { - $zinc->itemconfigure("axis:$currentitem", + $zinc->itemconfigure("axis:$currentitem && !text", -linewidth => 1); } } if (!defined($currentitem) || ($item != $currentitem)) { - $zinc->itemconfigure("axis:$item", + $zinc->itemconfigure("axis:$item && !text", -linecolor => $activeAxisColor, -fillcolor => $activeAxisColor, -linewidth => 3); $currentitem = $item; $composerot = $zinc->itemcget($currentitem, -composerotation); + $zinc->itemconfigure("axisgrp:$currentitem", -composerotation => $composerot); $composescale = $zinc->itemcget($currentitem, -composescale); + $zinc->itemconfigure("axisgrp:$currentitem", -composescale => $composescale); } elsif (!$drag) { $currentitem = undef; @@ -240,7 +245,7 @@ sub changegroup { my ($grp) = @_; changeitem($grp); - $zinc->itemconfigure("axis:$currentgroup", + $zinc->itemconfigure("axis:$currentgroup && !text", -linewidth => 1); if (defined($currentitem)) { $currentgroup = $currentitem; @@ -249,7 +254,7 @@ sub changegroup { $currentgroup = $world; } - $zinc->itemconfigure("axis:$currentgroup", + $zinc->itemconfigure("axis:$currentgroup && !text", -linewidth => 3); } @@ -370,9 +375,8 @@ sub newtext { sub newicon { my $item = $zinc->add('icon', $currentgroup, - -mask => 'AtcSymbol1', - -anchor => 'center', - -color => 'black'); + -image => $logo, + -anchor => 'center'); return $item; } @@ -511,7 +515,6 @@ sub additem { } elsif ($itemtype eq 'icon') { $item = newicon(); - $itemontop = 1; } elsif ($itemtype eq 'text') { $item = newtext(); -- cgit v1.1