| 1 | # ############################################################################## | ||
| 2 | # # Script : Canvasprintdialog.pl # | ||
| 3 | # # -------------------------------------------------------------------------- # | ||
| 4 | # # Copyright : This program is free software; you can redistribute it and/or # | ||
| 5 | # # modify it under the same terms as Perl itself. # | ||
| 6 | # # Author : Jürgen von Brietzke JvBSoft # | ||
| 7 | # # Version : 1.2.01 16.Jun.2013 # | ||
| 8 | # ############################################################################## | ||
| 9 | # # http://incrtcl.sourceforge.net/iwidgets/iwidgets/canvasprintdialog.html # | ||
| 10 | # ############################################################################## | ||
| 11 | |||
| 12 | use strict; | ||
| 13 | use warnings; | ||
| 14 | |||
| 15 | use Tkx::TclTk::Bind::IWidgets; | ||
| 16 | |||
| 17 | # ############################################################################## | ||
| 18 | |||
| 19 | our $sz = "A4"; | ||
| 20 | our $or = "landscape"; | ||
| 21 | |||
| 22 | my $main_window = Tkx::widget->new(q{.}); | ||
| 23 | $main_window->Tkx::wm_title('Canvasprintdialog Example'); | ||
| 24 | |||
| 25 | my $canvasprintdialog = $main_window->new_iwidgets__Canvasprintdialog( | ||
| 26 | -printcmd => 'lpr', | ||
| 27 | -modality => 'application', | ||
| 28 | -pagesize => $sz, | ||
| 29 | -orient => $or, | ||
| 30 | -posterize => 1, | ||
| 31 | -hpagecnt => 1, | ||
| 32 | -vpagecnt => 2, | ||
| 33 | -textbackground => 'ghostwhite', | ||
| 34 | ); | ||
| 35 | $canvasprintdialog->buttonconfigure( 'OK', -text => 'Print' ); | ||
| 36 | $canvasprintdialog->buttonconfigure( 'Apply', | ||
| 37 | -command => $canvasprintdialog->refresh ); | ||
| 38 | my $x1 = "1.0c"; | ||
| 39 | my $x2 = "20.0c"; | ||
| 40 | my $y1 = "1.0c"; | ||
| 41 | my $y2 = "28.7c"; | ||
| 42 | my $canvas = $main_window->new_tk__canvas(); | ||
| 43 | Tkx::pack( $canvas, -expand => 'true', -fill => 'both' ); | ||
| 44 | $canvas->create( 'rectangle', $x1, $y1, $x2, $y2 ); | ||
| 45 | my $y = 150; | ||
| 46 | my $j = 0; | ||
| 47 | |||
| 48 | while ( $j < 3 ) { | ||
| 49 | my $i = 0; | ||
| 50 | my $x = 150; | ||
| 51 | while ( $i < 15 ) { | ||
| 52 | my $item; | ||
| 53 | $item = $canvas->create( 'oval', -50, -50, 50, 50, -fill => 'red' ); | ||
| 54 | $canvas->move( $item, $x, $y ); | ||
| 55 | $item = $canvas->create( 'rectangle', -10, 0, 70, 100, -fill => 'blue' ); | ||
| 56 | $canvas->move( $item, $x, $y ); | ||
| 57 | $item = $canvas->create( 'text', 10, 130, -text => 'TEST!!!!' ); | ||
| 58 | $canvas->move( $item, $x, $y ); | ||
| 59 | $item = $canvas->create( 'bitmap', 20, 150, -bitmap => 'hourglass' ); | ||
| 60 | $canvas->move( $item, $x, $y ); | ||
| 61 | $x += 50; | ||
| 62 | $i++; | ||
| 63 | } | ||
| 64 | $y += 200; | ||
| 65 | $j++; | ||
| 66 | } | ||
| 67 | $canvasprintdialog->setcanvas($canvas); | ||
| 68 | Tkx::pack( forget => $canvas ); | ||
| 69 | |||
| 70 | $canvasprintdialog->activate(); | ||
| 71 | Tkx::MainLoop(); | ||
| 72 | |||
| 73 | # ############################################################################## | ||
| 74 | # # E N D # | ||
| 75 | # ############################################################################## |