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