]>
Commit | Line | Data |
---|---|---|
ac884b6a MS |
1 | // |
2 | // "$Id$" | |
3 | // | |
4 | // Shared media size class for the CUPS PPD Compiler. | |
5 | // | |
94da7e34 | 6 | // Copyright 2007-2009 by Apple Inc. |
ac884b6a MS |
7 | // Copyright 2002-2005 by Easy Software Products. |
8 | // | |
9 | // These coded instructions, statements, and computer programs are the | |
10 | // property of Apple Inc. and are protected by Federal copyright | |
11 | // law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
12 | // which should have been included with this file. If this file is | |
13 | // file is missing or damaged, see the license at "http://www.cups.org/". | |
14 | // | |
15 | // Contents: | |
16 | // | |
17 | // ppdcMediaSize::ppdcMediaSize() - Create a new media size. | |
18 | // ppdcMediaSize::~ppdcMediaSize() - Destroy a media size. | |
19 | // | |
20 | ||
21 | // | |
22 | // Include necessary headers... | |
23 | // | |
24 | ||
38e73f87 | 25 | #include "ppdc-private.h" |
ac884b6a MS |
26 | |
27 | ||
28 | // | |
29 | // 'ppdcMediaSize::ppdcMediaSize()' - Create a new media size. | |
30 | // | |
31 | ||
32 | ppdcMediaSize::ppdcMediaSize(const char *n, // I - Name of media size | |
33 | const char *t, // I - Text of media size | |
34 | float w, // I - Width in points | |
35 | float l, // I - Length in points | |
36 | float lm, // I - Left margin in points | |
37 | float bm, // I - Bottom margin in points | |
38 | float rm, // I - Right margin in points | |
39 | float tm, // I - Top margin in points | |
40 | const char *sc, // I - PageSize code, if any | |
41 | const char *rc) // I - PageRegion code, if any | |
42 | : ppdcShared() | |
43 | { | |
94da7e34 MS |
44 | PPDC_NEW; |
45 | ||
ac884b6a MS |
46 | name = new ppdcString(n); |
47 | text = new ppdcString(t); | |
48 | width = w; | |
49 | length = l; | |
50 | left = lm; | |
51 | bottom = bm; | |
52 | right = rm; | |
53 | top = tm; | |
54 | size_code = new ppdcString(sc); | |
55 | region_code = new ppdcString(rc); | |
56 | ||
57 | if (left < 0.0f) | |
58 | left = 0.0f; | |
59 | if (bottom < 0.0f) | |
60 | bottom = 0.0f; | |
61 | if (right < 0.0f) | |
62 | right = 0.0f; | |
63 | if (top < 0.0f) | |
64 | top = 0.0f; | |
65 | } | |
66 | ||
67 | ||
68 | // | |
69 | // 'ppdcMediaSize::~ppdcMediaSize()' - Destroy a media size. | |
70 | // | |
71 | ||
72 | ppdcMediaSize::~ppdcMediaSize() | |
73 | { | |
94da7e34 MS |
74 | PPDC_DELETE; |
75 | ||
ac884b6a MS |
76 | name->release(); |
77 | text->release(); | |
78 | size_code->release(); | |
79 | region_code->release(); | |
80 | } | |
81 | ||
82 | ||
83 | // | |
84 | // End of "$Id$". | |
85 | // |