use Tk;
our $MW = MainWindow->new(-title => " PROXY FOR MW");
$MW->geometry("+4+5");
RC::review($MW);
MainLoop;
package RC;
use Tk;
use Tk::PNG;
use Tk::LabFrame;
use Tk::Radiobutton;
use Tk::Pane;
use File::Basename;
use feature ':5.10';
use strict;
sub review
{
my ($MW) = @_;
my ($RW, $FW, $CW) = makeReviewScreen($MW); # Review window has file & canvas sections
paint_Info($MW, $CW, 1);
}
sub makeReviewScreen
{
my ($MW) = @_;
our $width = $MW->screenwidth - 145;
state $zoomLevel = 1;
my $RW = $MW->Toplevel(-title => ' Review2');
$RW->geometry("+0+5");
my $LW = $RW->Frame;
my $FW = $LW->Scrolled('Frame', -scrollbars => 'e')->pack(-expand => '1', -fill => 'y');
my $ZW = $LW->LabFrame(-label => " ZOOM ", -labelside => "acrosstop", -bg => 'white');
my $CW = $RW->Scrolled('Canvas', -width => $width,
-height => '480',
-background => 'white',
-borderwidth => '3',
-scrollbars => 'se',
-relief => 'sunken',
-scrollregion => [-100,0, 6000,4000]);
foreach my $zoom (-4, -3, -2, 1, 2, 3) # Make the diagram zoom buttons here
{
my $text = ($zoom > 0) ? 100 * $zoom : 100 / $zoom;
$text = int($text);
$ZW->Radiobutton( -text => "$text Percent",
-bg => 'white',
-value => $zoom,
-variable => \$zoomLevel,
-command => sub { zoom($MW, $CW, $zoom);
say "make $currentDwg - $text %"; }
)->pack;
}
$ZW->pack(-pady => 5);
$LW->pack(-side => 'left', -fill => 'y', -expand => '1', -anchor => 'nw', );
$CW->pack(-side => 'left', -fill => 'both', -expand => '1' );
return( $RW, $FW, $CW);
}
sub paint_Info # ($MW, $Config)
{
my ($MW, $CW, $zoom) = @_;
$CW->createOval( 30, 30,
15, 15,
-outline => 'red', -width => 2,
-tags => ['INFO']);
my $zfactor = ($zoom > 0) ? $zoom : -1 / $zoom;
$CW->scale('all', 0, 0, $zfactor, $zfactor);
}
sub zoom
{
my ($MW, $CW, $zoom) = @_;
state $already_zoom = 1;
my $zoomleft = $zoom / $already_zoom;
$already_zoom= $zoom;
my $zfactor = ($zoomleft > 0) ? $zoomleft : -1 / $zoomleft;
$CW->scale('all', 0, 0, $zfactor, $zfactor);
}
1;
####
use Tk;
use Tk::DialogBox;
use Tk::LabEntry;
use Tk::Balloon;
use Tk::LabFrame;
use Tk::Scale;
use warnings;
use feature ':5.12';
use review2;
our $MW = MainWindow->new(-title => 'Title MW');
$MW->geometry("+120+50");
our $FW = $MW->Frame->pack;
our $F2 = $FW->LabFrame( -label=> ' This Frame', -relief => 'groove')->pack( -side => 'left');
our $RC = $F2->Button(-text => 'Review', -command => sub{
RC::review($MW);
})->pack(-side => 'left');
MainLoop;
##
##
package RC;
use Tk;
use Tk::PNG;
use Tk::LabFrame;
use Tk::Radiobutton;
use Tk::Pane;
use File::Basename;
use feature ':5.10';
use strict;
our $currentDwg = '';
sub review
{
my ($MW) = @_;
my ($RW, $FW, $CW) = makeReviewScreen($MW); # Review window has file & canvas sections
paint_Info($MW, $CW, 1);
}
sub makeReviewScreen
{
my ($MW) = @_;
our $width = $MW->screenwidth - 145;
state $zoomLevel = 1;
my $RW = $MW->Toplevel(-title => ' Review2');
$RW->geometry("+0+5");
my $LW = $RW->Frame;
my $FW = $LW->Scrolled('Frame', -scrollbars => 'e')->pack(-expand => '1', -fill => 'y');
my $ZW = $LW->LabFrame(-label => " ZOOM ", -labelside => "acrosstop", -bg => 'white');
my $CW = $RW->Scrolled('Canvas', -width => $width,
-height => '480',
-background => 'white',
-borderwidth => '3',
-scrollbars => 'se',
-relief => 'sunken',
-scrollregion => [-100,0, 6000,4000]);
foreach my $zoom (-4, -3, -2, 1, 2, 3) # Make the diagram zoom buttons here
{
my $text = ($zoom > 0) ? 100 * $zoom : 100 / $zoom;
$text = int($text);
$ZW->Radiobutton( -text => "$text Percent",
-bg => 'white',
-value => $zoom,
-variable => \$zoomLevel,
-command => sub { zoom($MW, $CW, $zoom);
say "make $currentDwg - $text %"; }
)->pack;
}
$ZW->pack(-pady => 5);
$LW->pack(-side => 'left', -fill => 'y', -expand => '1', -anchor => 'nw', );
$CW->pack(-side => 'left', -fill => 'both', -expand => '1' );
return( $RW, $FW, $CW);
}
sub paint_Info # ($MW, $Config)
{
my ($MW, $CW, $zoom) = @_;
$CW->createOval( 30, 30,
15, 15,
-outline => 'red', -width => 2,
-tags => ['INFO']);
my $zfactor = ($zoom > 0) ? $zoom : -1 / $zoom;
$CW->scale('all', 0, 0, $zfactor, $zfactor);
}
sub zoom
{
my ($MW, $CW, $zoom) = @_;
state $already_zoom = 1;
my $zoomleft = $zoom / $already_zoom;
$already_zoom= $zoom;
my $zfactor = ($zoomleft > 0) ? $zoomleft : -1 / $zoomleft;
$CW->scale('all', 0, 0, $zfactor, $zfactor);
}
1;