OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [iwidgets3.0.0/] [generic/] [canvasprintdialog.itk] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#
2
# CanvasPrintDialog v1.5
3
# ----------------------------------------------------------------------
4
# Implements a print dialog for printing the contents of a canvas widget
5
# to a printer or a file. It is possible to specify page orientation, the
6
# number of pages to print the image on and if the output should be
7
# stretched to fit the page. The CanvasPrintDialog is derived from the
8
# Dialog class and is composed of a CanvasPrintBox with attributes set to
9
# manipulate the dialog buttons.
10
#
11
# ----------------------------------------------------------------------
12
#  AUTHOR: Tako Schotanus              EMAIL: Tako.Schotanus@bouw.tno.nl
13
# ----------------------------------------------------------------------
14
#                                  Copyright (c) 1995  Tako Schotanus
15
# ======================================================================
16
# Permission is hereby granted, without written agreement and without
17
# license or royalty fees, to use, copy, modify, and distribute this
18
# software and its documentation for any purpose, provided that the
19
# above copyright notice and the following two paragraphs appear in
20
# all copies of this software.
21
#
22
# IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
23
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
24
# ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
25
# IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
26
# DAMAGE.
27
#
28
# THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
29
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
30
# FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
31
# ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
32
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
33
# ======================================================================
34
 
35
#
36
# Option database default resources:
37
#
38
option add *Canvasprintdialog.filename "canvas.ps" widgetDefault
39
option add *Canvasprintdialog.hPageCnt 1 widgetDefault
40
option add *Canvasprintdialog.orient landscape widgetDefault
41
option add *Canvasprintdialog.output printer widgetDefault
42
option add *Canvasprintdialog.pageSize A4 widgetDefault
43
option add *Canvasprintdialog.posterize 0 widgetDefault
44
option add *Canvasprintdialog.printCmd lpr widgetDefault
45
option add *Canvasprintdialog.printRegion "" widgetDefault
46
option add *Canvasprintdialog.vPageCnt 1 widgetDefault
47
option add *Canvasprintdialog.title "Canvas Print Dialog" widgetDefault
48
option add *Canvasprintdialog.master "." widgetDefault
49
 
50
#
51
# Usual options.
52
#
53
itk::usual Canvasprintdialog {
54
        keep -background -cursor -foreground -modality
55
}
56
 
57
# ------------------------------------------------------------------
58
# CANVASPRINTDIALOG
59
# ------------------------------------------------------------------
60
class iwidgets::Canvasprintdialog {
61
        inherit iwidgets::Dialog
62
 
63
        constructor {args} {}
64
        destructor {}
65
 
66
        method deactivate {args} {}
67
        method getoutput {} {}
68
        method setcanvas {canv} {}
69
        method refresh {} {}
70
        method print {} {}
71
}
72
 
73
#
74
# Provide a lowercased access method for the Canvasprintdialog class.
75
#
76
proc ::iwidgets::canvasprintdialog {args} {
77
        uplevel ::iwidgets::Canvasprintdialog $args
78
}
79
 
80
# ------------------------------------------------------------------
81
# CONSTRUCTOR
82
#
83
# Create new file selection dialog.
84
# ------------------------------------------------------------------
85
body iwidgets::Canvasprintdialog::constructor {args} {
86
        component hull configure -borderwidth 0
87
 
88
        #
89
        # Instantiate a file selection box widget.
90
        #
91
        itk_component add cpb {
92
                iwidgets::Canvasprintbox $itk_interior.cpb
93
        } {
94
                usual
95
                keep -printregion -output -printcmd -filename -pagesize \
96
                     -orient -stretch -posterize -hpagecnt -vpagecnt
97
        }
98
        pack $itk_component(cpb) -fill both -expand yes
99
 
100
        #
101
        # Hide the apply and help buttons.
102
        #
103
        buttonconfigure OK -text Print
104
        buttonconfigure Apply -command [code $this refresh] -text Refresh
105
        hide Help
106
 
107
        eval itk_initialize $args
108
}
109
 
110
# ------------------------------------------------------------------
111
# METHOD: deactivate
112
#
113
# Redefines method of dialog shell class. Stops the drawing of the
114
# thumbnail (when busy) upon deactivation of the dialog.
115
# ------------------------------------------------------------------
116
body iwidgets::Canvasprintdialog::deactivate {args} {
117
        $itk_component(cpb) stop
118
        return [eval Shell::deactivate $args]
119
}
120
 
121
# ------------------------------------------------------------------
122
# METHOD: getoutput
123
#
124
# Thinwrapped method of canvas print box class.
125
# ------------------------------------------------------------------
126
body iwidgets::Canvasprintdialog::getoutput {} {
127
        return [$itk_component(cpb) getoutput]
128
}
129
 
130
# ------------------------------------------------------------------
131
# METHOD: setcanvas
132
#
133
# Thinwrapped method of canvas print box class.
134
# ------------------------------------------------------------------
135
body iwidgets::Canvasprintdialog::setcanvas {canv} {
136
        return [$itk_component(cpb) setcanvas $canv]
137
}
138
 
139
# ------------------------------------------------------------------
140
# METHOD: refresh
141
#
142
# Thinwrapped method of canvas print box class.
143
# ------------------------------------------------------------------
144
body iwidgets::Canvasprintdialog::refresh {} {
145
        return [$itk_component(cpb) refresh]
146
}
147
 
148
# ------------------------------------------------------------------
149
# METHOD: print
150
#
151
# Thinwrapped method of canvas print box class.
152
# ------------------------------------------------------------------
153
body iwidgets::Canvasprintdialog::print {} {
154
        return [$itk_component(cpb) print]
155
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.