aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Perl/Zinc/Logo.pm (renamed from Perl/debug/LogoZinc.pm)6
-rw-r--r--Perl/Zinc/Text.pm (renamed from Perl/ZincText.pm)10
-rw-r--r--Perl/Zinc/Trace.pm2
-rw-r--r--Perl/Zinc/TraceErrors.pm2
-rw-r--r--Perl/Zinc/TraceUtils.pm90
5 files changed, 100 insertions, 10 deletions
diff --git a/Perl/debug/LogoZinc.pm b/Perl/Zinc/Logo.pm
index 0b81b62..5e9db69 100644
--- a/Perl/debug/LogoZinc.pm
+++ b/Perl/Zinc/Logo.pm
@@ -2,7 +2,7 @@
#---------------------------------------------------------------
# Project : Harmony
# Module : Harmony
-# File : LogoZinc.pm
+# File : Logo.pm
#
# Copyright (C) 2001
# Centre d'Études de la Navigation Aérienne
@@ -10,13 +10,13 @@
#
#---------------------------------------------------------------
-package LogoZinc;
+package Tk::Zinc::Logo;
use strict;
use Carp;
use Math::Trig;
-Construct Tk::Widget 'LogoZinc';
+Construct Tk::Widget 'Tk::Zinc::Logo';
my @Gradiants;
diff --git a/Perl/ZincText.pm b/Perl/Zinc/Text.pm
index 26ff038..2cf4fd2 100644
--- a/Perl/ZincText.pm
+++ b/Perl/Zinc/Text.pm
@@ -1,5 +1,5 @@
-package ZincText;
+package Tk::Zinc::Text;
sub new {
@@ -149,14 +149,14 @@ __END__
=head1 NAME
-ZincText - Zinc extension for easing text input on text item or on fields
+Tk::Zinc::Text - Zinc extension for easing text input on text item or on fields
=head1 SYNOPSIS
- use ZincText;
+ use Tk::Zinc::Text;
$zinc = $mw->Zinc();
- new ZincText ($zinc);
+ new Tk::Zinc::Text ($zinc);
....
$zinc->addtag('text', 'withtag', $a_text);
$zinc->addtag('text', 'withtag', $a_track);
@@ -244,7 +244,7 @@ Patrick Lecoanet <lecoanet@cena.fr>
CENA (C) 2002
-ZincText is part of Zinc and has been developed by the CENA (Centres d'Etudes de la Navigation Aérienne)
+Tk::Zinc::Text is part of Zinc and has been developed by the CENA (Centres d'Etudes de la Navigation Aérienne)
for its own needs in advanced HMI (Human Machine Interfaces or Interactions). Because we are confident
in the benefit of free software, the CENA delivered this toolkit under the GNU
Library General Public License.
diff --git a/Perl/Zinc/Trace.pm b/Perl/Zinc/Trace.pm
index 0a2b7c4..e9bb01c 100644
--- a/Perl/Zinc/Trace.pm
+++ b/Perl/Zinc/Trace.pm
@@ -26,7 +26,7 @@ package ZincTrace;
use Tk;
use strict;
-use ZincTraceUtils;
+use Tk::Zinc::TraceUtils;
my $WidgetMethodfunction;
BEGIN {
diff --git a/Perl/Zinc/TraceErrors.pm b/Perl/Zinc/TraceErrors.pm
index f5d1069..43c4e3d 100644
--- a/Perl/Zinc/TraceErrors.pm
+++ b/Perl/Zinc/TraceErrors.pm
@@ -29,7 +29,7 @@ package ZincTraceErrors;
use Tk;
use strict;
-use ZincTraceUtils;
+use Tk::Zinc::TraceUtils;
my $WidgetMethodfunction;
my $bold = "";
diff --git a/Perl/Zinc/TraceUtils.pm b/Perl/Zinc/TraceUtils.pm
new file mode 100644
index 0000000..07b0413
--- /dev/null
+++ b/Perl/Zinc/TraceUtils.pm
@@ -0,0 +1,90 @@
+package Tk::Zinc::TraceUtils;
+
+use Tk;
+use strict;
+use Tk::Font;
+use Tk::Photo;
+use vars qw(@EXPORT);
+@EXPORT = qw(printItem printArray printList);
+
+
+### to print something
+sub printItem {
+ my ($value) = @_;
+ my $ref = ref($value);
+# print "VALUE=$value REF=$ref\n";
+ if ($ref eq 'ARRAY') {
+ printArray ( @{$value} );
+ }
+ elsif ($ref eq 'CODE') {
+ print "{CODE}";
+ }
+ elsif ($ref eq 'Tk::Photo') {
+# print " **** $value ***** ";
+ print "Tk::Photo(\"". scalar $value->cget('-file') . "\")";
+ }
+ elsif ($ref eq 'Tk::Font') {
+ print "'$value'";
+ }
+ elsif ($ref eq '') { # scalar
+ if (defined $value) {
+ if ($value eq '') {
+ print "''";
+ } elsif ($value =~ /\s/
+ or $value =~ /^[a-zA-Z]/
+ or $value =~ /^[\W]$/ ) {
+ print "'$value'";
+ } else {
+ print $value;
+ }
+ }
+ else {
+ print "undef";
+ }
+ }
+ else { # some class instance
+ return $value;
+ }
+
+} # end printitem
+
+
+### to print a list of something
+sub printArray {
+ my (@values) = @_;
+ if (! scalar @values) {
+ print "[]";
+ }
+ else { # the list is not empty
+ my @res;
+ print "[";
+ while (@values) {
+ my $value = shift @values;
+ &printItem ($value);
+ print ", " if (@values);
+ }
+ print "]" ;
+ }
+
+} # end printArray
+
+
+sub printList {
+ print "(";
+ while (@_) {
+ my $v = shift @_;
+ printItem $v;
+ if ($v =~ /^-\w+/) {
+ print " => ";
+ } elsif (@_) {
+ print ", ";
+ }
+ }
+ print ")";
+
+} # end printList
+
+1;
+
+
+