aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Perl/demos/Tk/demos/zinc_lib/transforms.pl35
1 files changed, 19 insertions, 16 deletions
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('<Right>', \&moveright);
$zinc->Tk::bind('<Down>', \&movedown);
$zinc->Tk::bind('<Next>', \&scaledown);
$zinc->Tk::bind('<Prior>', \&scaleup);
-$zinc->Tk::bind('<Home>', \&reset);
-$zinc->Tk::bind('<Shift-Home>', \&resetchildren);
+$zinc->Tk::bind('<Delete>', \&reset);
+$zinc->Tk::bind('<Shift-Delete>', \&resetchildren);
$zinc->Tk::bind('<End>', \&rotateleft);
-$zinc->Tk::bind('<Delete>', \&rotateright);
+$zinc->Tk::bind('<Home>', \&rotateright);
$zinc->Tk::bind('<Insert>', \&swapaxis);
$zinc->Tk::bind('<Configure>', [\&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();