PPresenter
view release on metacpan or search on metacpan
PPresenter/Export/Handouts/PostScript.pm view on Meta::CPAN
}
sub makeTkPostscript($)
{ my ($export, $canvas, $mode, $rotate, $file) = @_;
my $err = $canvas->postscript
( -colormode => $mode
, -rotate => $rotate
, -file => $file
);
print "$err\n" if $err;
}
#
# The user interface to this module.
#
sub popup($$)
{ my ($export, $show, $screen) = @_;
return $export->{popup}
if exists $export->{popup};
$export->{popup} = my $popup = MainWindow->new(-screen => $screen
, -title => 'Export slides with Tk Postscript'
);
$popup->withdraw;
my $vp = $export->tkViewportSettings($show, $popup);
my $ps = $export->tkPostscript($show, $popup);
my $options = $popup->Frame;
$options->Label
( -text => 'export'
, -anchor => 'e'
)->grid($export->tkSlideSelector($popup), -sticky => 'ew');
$options->Label
( -text => 'output dir'
, -anchor => 'e'
)->grid($options->Entry(-textvariable => \$export->{-outputDir})
, -sticky => 'ew');
my $commands = $popup->Frame;
$commands->Button
( -text => 'Export'
, -relief => 'ridge'
, -command => sub {$export->exportPostscript($show, $popup)}
)->grid($commands->Button
( -text => 'Cancel'
, -relief => 'sunken'
, -command => sub {$popup->withdraw}
)
, -padx => 10, -pady => 10
);
if(defined $vp)
{ $vp->grid($ps, -sticky => 'ewns');
$options->grid('^', -sticky => 'ew');
}
else {$options->grid($ps, -sticky => 'ew')}
$commands->grid(-columnspan => 2, -sticky => 'ew');
if(grep {$_->device ne 'printer'} $show->viewports)
{ my $warning = $popup->LabFrame
( -label => 'warning'
, -labelside => 'acrosstop'
)->grid(-columnspan => 2, -sticky => 'ew');
$warning->Label(-text => <<WARN
The background-color will be lost, so you better
specify `-device=>printer' for all viewports.
WARN
)->grid(-sticky=>'nwsw');
}
return $popup;
}
sub tkPostscript($$)
{ my ($export, $show, $parent) = @_;
my $ps = $parent->LabFrame
( -label => 'Postscript'
, -labelside => 'acrosstop'
);
$ps->Label
( -text => 'Color-mode'
, -anchor => 'w'
)->grid($export->optionlist($ps, qw/-colorMode color gray mono/ )
, '-', -sticky => 'ew');
$ps->Label
( -text => 'Paper size'
, -anchor => 'w'
)->grid($export->optionlist($ps, '-paperSize', map {$_->[0]} @papersizes)
, '-', -sticky => 'ew');
$ps->Label
( -text => 'width'
, -anchor => 'e'
)->grid( $ps->Entry( -textvariable => \$export->{-paperWidth})
, $export->optionlist($ps, qw/-paperUnits in cm pt/ )
, -sticky => 'nsew'
);
$ps->Label
( -text => 'height'
, -anchor => 'e'
)->grid( $ps->Entry( -textvariable => \$export->{-paperHeight})
, '^', -sticky => 'ew'
);
$ps->Label
( -text => 'Density'
, -anchor => 'w'
)->grid( $ps->Entry( -textvariable => \$export->{-density})
, $ps->Label( -anchor => 'w', -text => 'dpi' )
, -sticky => 'ew');
$ps->Label
( -text => 'Orientation'
, -anchor => 'w'
)->grid($export->optionlist($ps, qw/-orientation Landscape Portrait/
, 'Best fit') , '-', -sticky => 'ew');
$ps;
}
( run in 0.460 second using v1.01-cache-2.11-cpan-39bf76dae61 )