]>
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 | // |
e3101897 | 7 | // Licensed under Apache License v2.0. See the file "LICENSE" for more information. |
ac884b6a MS |
8 | // |
9 | ||
10 | // | |
11 | // Include necessary headers... | |
12 | // | |
13 | ||
38e73f87 | 14 | #include "ppdc-private.h" |
ac884b6a MS |
15 | |
16 | ||
17 | // | |
18 | // 'ppdcMediaSize::ppdcMediaSize()' - Create a new media size. | |
19 | // | |
20 | ||
21 | ppdcMediaSize::ppdcMediaSize(const char *n, // I - Name of media size | |
22 | const char *t, // I - Text of media size | |
23 | float w, // I - Width in points | |
24 | float l, // I - Length in points | |
25 | float lm, // I - Left margin in points | |
26 | float bm, // I - Bottom margin in points | |
27 | float rm, // I - Right margin in points | |
28 | float tm, // I - Top margin in points | |
29 | const char *sc, // I - PageSize code, if any | |
30 | const char *rc) // I - PageRegion code, if any | |
31 | : ppdcShared() | |
32 | { | |
94da7e34 MS |
33 | PPDC_NEW; |
34 | ||
ac884b6a MS |
35 | name = new ppdcString(n); |
36 | text = new ppdcString(t); | |
37 | width = w; | |
38 | length = l; | |
39 | left = lm; | |
40 | bottom = bm; | |
41 | right = rm; | |
42 | top = tm; | |
43 | size_code = new ppdcString(sc); | |
44 | region_code = new ppdcString(rc); | |
45 | ||
46 | if (left < 0.0f) | |
47 | left = 0.0f; | |
48 | if (bottom < 0.0f) | |
49 | bottom = 0.0f; | |
50 | if (right < 0.0f) | |
51 | right = 0.0f; | |
52 | if (top < 0.0f) | |
53 | top = 0.0f; | |
54 | } | |
55 | ||
56 | ||
57 | // | |
58 | // 'ppdcMediaSize::~ppdcMediaSize()' - Destroy a media size. | |
59 | // | |
60 | ||
61 | ppdcMediaSize::~ppdcMediaSize() | |
62 | { | |
94da7e34 MS |
63 | PPDC_DELETE; |
64 | ||
ac884b6a MS |
65 | name->release(); |
66 | text->release(); | |
67 | size_code->release(); | |
68 | region_code->release(); | |
69 | } |