From 2df45127939155e6279dd1c5415c0a6849daf375 Mon Sep 17 00:00:00 2001 From: mertz Date: Fri, 19 Mar 2004 11:34:25 +0000 Subject: acces to data files are now bug free, when empty demos/zinc_data/ directory exists somewhere in the PERL searched directories --- Perl/demos/Tk/demos/zinc_lib/groups_in_ATC_strips.pl | 14 ++++++-------- Perl/demos/Tk/demos/zinc_lib/simpleradar.pl | 9 +++------ Perl/demos/Tk/demos/zinc_lib/testGraphics.pl | 6 ++---- 3 files changed, 11 insertions(+), 18 deletions(-) (limited to 'Perl/demos') diff --git a/Perl/demos/Tk/demos/zinc_lib/groups_in_ATC_strips.pl b/Perl/demos/Tk/demos/zinc_lib/groups_in_ATC_strips.pl index 6d3cd77..35292b5 100644 --- a/Perl/demos/Tk/demos/zinc_lib/groups_in_ATC_strips.pl +++ b/Perl/demos/Tk/demos/zinc_lib/groups_in_ATC_strips.pl @@ -47,11 +47,6 @@ use Tk; use Tk::Zinc; use strict; -# to find some images (used as textures) needed by this demo -# we avoids empty 'demos/zinc_data' directory! -my $image_path = Tk->findINC('demos/zinc_data/background_texture.gif'); -$image_path =~ s:/background_texture.gif$:: ; - $| = 1; @@ -469,7 +464,8 @@ sub createStrip { if ($sstyle->{'-texture'}) { if (!exists($textures{'-strip'})) { - my $texture = $zinc->Photo($sstyle->{'-texture'}, -file => "$image_path/$sstyle->{'-texture'}"); + my $texture = $zinc->Photo($sstyle->{'-texture'}, + -file => Tk->findINC("demos/zinc_data/".$sstyle->{-texture})); $textures{'-strip'} = $texture; } @@ -613,7 +609,8 @@ sub buildContent { if ($zonestyle->{'-texture'}) { if (!exists($textures{$name})) { - my $texture = $zinc->Photo($zonestyle->{'-texture'}, -file => "$image_path/$zonestyle->{'-texture'}"); + my $texture = $zinc->Photo($zonestyle->{'-texture'}, + -file => Tk->findINC("demos/zinc_data/".$zonestyle->{-texture})); $textures{$name} = $texture; } @@ -694,7 +691,8 @@ sub buildExtent { if ($infostyle->{'-texture'}) { if (!exists($textures{'-zinfo'})) { - my $texture = $zinc->Photo($infostyle->{'-texture'}, -file => "$image_path/$infostyle->{'-texture'}"); + my $texture = $zinc->Photo($infostyle->{'-texture'}, + -file => Tk->findINC("demos/zinc_data/".$infostyle->{-texture})); $textures{'-zinfo'} = $texture; } $zinc->itemconfigure($rectzone, -tile => $textures{'-zinfo'}); diff --git a/Perl/demos/Tk/demos/zinc_lib/simpleradar.pl b/Perl/demos/Tk/demos/zinc_lib/simpleradar.pl index 4cc1363..12c45a9 100644 --- a/Perl/demos/Tk/demos/zinc_lib/simpleradar.pl +++ b/Perl/demos/Tk/demos/zinc_lib/simpleradar.pl @@ -17,9 +17,6 @@ use strict; # to find the SimpleRadarControls module require Tk->findINC('demos/zinc_pm/SimpleRadarControls.pm'); -# to find some maps needed by these demo -my $map_path = Tk->findINC('demos/zinc_data'); - my $mw = MainWindow->new(); my $text = $mw->Text(-relief => 'sunken', -borderwidth => 2, @@ -424,9 +421,9 @@ $zinc->bind("$ministrip:$field", '', ################################################### # creation map ################################################### -$mw->videomap("load", "$map_path/videomap_paris-w_90_2", 0, "paris-w"); -$mw->videomap("load", "$map_path/videomap_orly", 17, "orly"); -$mw->videomap("load", "$map_path/hegias_parouest_TE.vid", 0, "paris-ouest"); +$mw->videomap("load", Tk->findINC("demos/zinc_data/videomap_paris-w_90_2"), 0, "paris-w"); +$mw->videomap("load", Tk->findINC("demos/zinc_data/videomap_orly"), 17, "orly"); +$mw->videomap("load", Tk->findINC("demos/zinc_data/hegias_parouest_TE.vid"), 0, "paris-ouest"); my $map = $zinc->add("map", $radar, -color => 'gray80'); diff --git a/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl b/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl index f20ae69..5fa8f88 100644 --- a/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl +++ b/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl @@ -1468,10 +1468,8 @@ my ($shapes, $tcoords) = &tabBoxCoords([[-315, -210],[315, 210]], -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')); +# an image (used as texture) needed by this demo +my $texture = $zinc->Photo(-file => Tk->findINC('demos/zinc_data/paper.gif')); # création des items zinc correspondants my $i = scalar(@{$shapes}) - 1; -- cgit v1.1