]> git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdc-mediasize.cxx
Merge changes from CUPS 1.4svn-r7614.
[thirdparty/cups.git] / ppdc / ppdc-mediasize.cxx
1 //
2 // "$Id$"
3 //
4 // Shared media size class for the CUPS PPD Compiler.
5 //
6 // Copyright 2007 by Apple Inc.
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
25 #include "ppdc.h"
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 {
44 name = new ppdcString(n);
45 text = new ppdcString(t);
46 width = w;
47 length = l;
48 left = lm;
49 bottom = bm;
50 right = rm;
51 top = tm;
52 size_code = new ppdcString(sc);
53 region_code = new ppdcString(rc);
54
55 if (left < 0.0f)
56 left = 0.0f;
57 if (bottom < 0.0f)
58 bottom = 0.0f;
59 if (right < 0.0f)
60 right = 0.0f;
61 if (top < 0.0f)
62 top = 0.0f;
63 }
64
65
66 //
67 // 'ppdcMediaSize::~ppdcMediaSize()' - Destroy a media size.
68 //
69
70 ppdcMediaSize::~ppdcMediaSize()
71 {
72 name->release();
73 text->release();
74 size_code->release();
75 region_code->release();
76 }
77
78
79 //
80 // End of "$Id$".
81 //