From ec84ea97085147b265ed807e5100b3d598ca1552 Mon Sep 17 00:00:00 2001 From: etienne Date: Tue, 12 Oct 2004 09:13:44 +0000 Subject: Updated ballonhelp. --- Perl/Zinc/Debug.pm | 154 +++++++++++++++++++++++++---------------------------- 1 file changed, 73 insertions(+), 81 deletions(-) (limited to 'Perl/Zinc') diff --git a/Perl/Zinc/Debug.pm b/Perl/Zinc/Debug.pm index bc9a7d0..4c9444c 100644 --- a/Perl/Zinc/Debug.pm +++ b/Perl/Zinc/Debug.pm @@ -53,6 +53,7 @@ my %on_command; my %off_command; my @znpackinfo; my $screenwidth; +my $balloonhelp; #--------------------------------------------------------------------------- # # Initialisation functions for plugin usage @@ -152,7 +153,7 @@ sub init { for (values(%button)) { $_->configure(-selectcolor => $bg); } - my $balloonhelp = &balloonhelp(); + $balloonhelp = &balloonhelp(); $button{balloon}->toggle; $control_tl->withdraw(); $button{zn}->configure(-command => \&focuscommand); @@ -1136,6 +1137,10 @@ sub showtransfoparams { my $btn = $fm1->Button(-text => "Show item with transformation\nset to identity", -bg => $bgcolor, )->pack(-side => 'top', -padx => 5, -pady => 10); + $balloonhelp->attach($btn,-balloonmsg => + "Click and maintain to show the transformation \n". + "animation. Use btn1, btn2 or btn3 to select the\n". + "best background color for a good visibility. "); $btn->bind('<1>', [\&showtransfo, $zinc, $item, 0]); $btn->bind('<2>', [\&showtransfo, $zinc, $item, 1]); $btn->bind('<3>', [\&showtransfo, $zinc, $item, 2]); @@ -1278,9 +1283,6 @@ sub showresult { $control_tl->raise; my $fm = $result_tl{$label}->Frame()->pack(-side => 'bottom', ); - $fm->Button(-text => 'Help', - -command => [\&showHelpAboutAttributes, $zinc] - )->pack(-side => 'left', -padx => 40, -pady => 10); $fm->Button(-text => 'Close', -command => sub { $result_tl{$label}->destroy; @@ -1551,25 +1553,35 @@ sub showattributes { $idbtn->bind('<1>', [\&highlightitem, $zinc, $item, 0]); $idbtn->bind('<2>', [\&highlightitem, $zinc, $item, 1]); $idbtn->bind('<3>', [\&highlightitem, $zinc, $item, 2]); + $balloonhelp->attach($idbtn,-balloonmsg => + "Click and maintain to show the item. \n". + "Use btn1, btn2 or btn3 to select the best\n". + "background color for a good visibility. "); # type if ($type eq 'group') { - $fm->Button(-text => $type, - -command => sub { - my @items = $zinc->find('withtag', $item."."); - &showresult("Content of group $item", $zinc, @items); - }) - ->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 5); + my $gbtn = + $fm->Button(-text => $type, + -command => sub { + my @items = $zinc->find('withtag', $item."."); + &showresult("Content of group $item", $zinc, @items); + }); + $gbtn->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 5); + $balloonhelp->attach($gbtn,-balloonmsg => + "Click to display the group's content."); } else { $fm->Label(-text => $type, -relief => 'ridge') ->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 5); } - # group + # parent group my $group = $zinc->group($item); - $fm->Button(-text => $group, - -command => [\&showresult, - "Attributes of group $group (parent of $item)", - $zinc, $group]) - ->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 5); + my $pgbtn = + $fm->Button(-text => $group, + -command => [\&showresult, + "Attributes of group $group (parent of $item)", + $zinc, $group]); + $pgbtn->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 5); + $balloonhelp->attach($pgbtn,-balloonmsg => + "Click to display the parent group's attributes."); # priority &entryoption($fm, $item, $zinc, -priority) ->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 2); @@ -1588,10 +1600,15 @@ sub showattributes { my ($xt, $yt, $xsc, $ysc, $a, $xsk) = $zinc->tget($item, 'all'); $tlabel = 'no' if ($xt == 0 and $yt == 0 and $xsc == 1 and $ysc == 1 and $a == 0 and $xsk == 0); - $fm->Button(-text => $tlabel, - -command => [\&showtransfoparams, $label, $zinc, $item], - ) - ->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 5); + my $tbtn = + $fm->Button(-text => $tlabel, + -command => [\&showtransfoparams, $label, $zinc, $item], + ); + $tbtn->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 5); + $balloonhelp->attach($tbtn,-balloonmsg => + "Click to display transformation parameters.\n". + "Some of them can be updated. "); + # coords my @coords = $zinc->coords($item); my $coords; @@ -1614,9 +1631,11 @@ sub showattributes { } } if (@coords > 2) { - $fm->Button(-text => $coords, - -command => [\&showcoords, $label, $zinc, $item]) - ->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 2); + my $cbtn = $fm->Button(-text => $coords, + -command => [\&showcoords, $label, $zinc, $item]); + $cbtn->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 2); + $balloonhelp->attach($cbtn,-balloonmsg => + "Click to show all coordinates."); } else { $fm->Label(-text => $coords, -relief => 'ridge') ->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 5); @@ -1642,9 +1661,12 @@ sub showattributes { } } if (@coords > 2) { - $fm->Button(-text => $coords, - -command => [\&showdevicecoords, $label, $zinc, $item]) - ->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 2); + my $dcbtn = + $fm->Button(-text => $coords, + -command => [\&showdevicecoords, $label, $zinc, $item]); + $dcbtn->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 2); + $balloonhelp->attach($dcbtn,-balloonmsg => + "Click to show all device coordinates."); } else { $fm->Label(-text => $coords, -relief => 'ridge') ->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 5); @@ -1661,6 +1683,8 @@ sub showattributes { ->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 5); $btn->bind('<1>', [\&showbbox, $zinc, $item]); $btn->bind('', [\&hidebbox, $zinc]) ; + $balloonhelp->attach($btn,-balloonmsg => + "Click to show the bounding box."); } else { $fm->Label(-text => "--", , -relief => 'ridge') ->grid(-row => $i, -column => $c++, -sticky => 'nswe', -ipadx => 5); @@ -2270,58 +2294,6 @@ sub showHelpAboutTree { } # end showHelpAboutTree -sub showHelpAboutAttributes { - - my $zinc = shift; - $helptree_tl->destroy if $helptree_tl and Tk::Exists($helptree_tl); - $helptree_tl = $zinc->Toplevel; - $helptree_tl->title("Help about attributes"); - - my $text = $helptree_tl->Scrolled('Text', - -font => scalar $zinc->cget(-font), - -wrap => 'word', - -height => 30, - -foreground => 'gray10', - -scrollbars => 'oe', - ); - &wheelmousebindings($text); - $text->tagConfigure('keyword', -foreground => 'darkblue'); - $text->tagConfigure('title', -foreground => 'ivory', - -background => 'gray60', - -spacing1 => 3, - -spacing3 => 3); - - - $text->insert('end', " To highlight a specific item\n", 'title'); - $text->insert('end', - "\nThe column labeled 'Id' contains items identifiers buttons you ". - "can press to highlight corresponding items in the application.\n"); - &infoAboutHighlighting($text); - $text->insert('end', "\n\nThe column labeled 'Group' contains groups identifiers ". - "buttons you can press to display groups content and attributes.\n\n"); - $text->insert('end', " To display the bounding box of an item\n", 'title'); - $text->insert('end', "\nUse the buttons of the column labeled ". - "'Bounding Box'.\n\n"); - $text->insert('end', " To change the value of attributes\n", 'title'); - $text->insert('end', "\nMost of information fields are editable. A simple ". - "colored feedback shows which attributes have changed. Use <"); - $text->insert('end', "Control-z", "keyword"); - $text->insert('end', "> sequence to restore the initial value\n\n"); - $text->insert('end', " To visualize item's transformations\n", 'title'); - $text->insert('end', "\nClick on the "); - $text->insert('end', "treset", "keyword"); - $text->insert('end', " button in the first column. This action restores the item's transformation to its initial state. Transition is displayed with a fade-in/fade-out animation (needs OpenGL rendering)\n"); - - $text->configure(-state => 'disabled'); - - $helptree_tl->Button(-command => sub {$helptree_tl->destroy}, - -text => 'Close')->pack(-side => 'bottom', - -pady => 10); - $text->pack->pack(-side => 'top', -pady => 10, -padx => 10); - -} # end showHelpAboutAttributes - - sub showHelpAboutCoords { my $zinc = shift; @@ -2396,6 +2368,18 @@ sub infoAboutHighlighting { } # end infoAboutHighlighting +sub entryballoonhelp { + + my $e = shift; + my $msg = shift; + $msg .= "Editable field. To restore the inital value\n". + "after edition, enter sequence. "; + $balloonhelp->attach($e, -balloonposition => 'mouse', + -balloonmsg => $msg); + +} # end entryballoonhelp + + sub balloonhelp { my $b = $control_tl->Balloon(-balloonposition => 'widget', @@ -2417,9 +2401,12 @@ sub balloonhelp { "is selected, draw rectangle using \n". "left mouse button. "); $b->attach($button{tree}, -balloonmsg => - "Display the items hierarchy. Can\n". - "build perl code corresponding to\n". - "a specific branch. "); + #"Display the items hierarchy. Can\n". + #"build perl code corresponding to\n". + #"a specific branch. "); + "Display the items hierarchy. Provide\n". + "some related functions, like building\n". + "perl code corresponding to a branch."); $b->attach($button{item}, -balloonmsg => "Locate an item in the items tree. \n". "When this mode is on, select in \n". @@ -2430,6 +2417,9 @@ sub balloonhelp { "enter an item's id you want to inspect."); $b->attach($button{snapshot}, -balloonmsg => "Snapshot the application window."); + $b->attach($button{cursorxy}, -balloonmsg => + "Display the device coordinates\n". + "of the X cursor. "); $b->attach($button{zoomminus}, -balloonmsg => "Shrink the top group."); $b->attach($button{zoomplus}, -balloonmsg => @@ -2706,6 +2696,7 @@ sub entryoption { $e = $fm->Entry(); $i0 = 0; } + &entryballoonhelp($e); my $width = length($def); $width = $widthmax if defined($widthmax) and $width > $widthmax; $width = $widthmin if defined($widthmin) and $width < $widthmin; @@ -2756,6 +2747,7 @@ sub entrytransfo { my $i0; my $e; $e = $fm->Entry(-textvariable => $var); + &entryballoonhelp($e); $i0 = 0; my $width = length($def); $e->configure(-width => $width); -- cgit v1.1