1 //
2 // Shared media size class for the CUPS PPD Compiler.
3 //
4 // Copyright 2007-2009 by Apple Inc.
5 // Copyright 2002-2005 by Easy Software Products.
6 //
7 // Licensed under Apache License v2.0. See the file "LICENSE" for more information.
8 //
9
10 //
11 // Include necessary headers...
12 //
13
14 #include "ppdc-private.h"
15
16
17 //
18 // 'ppdcMediaSize::ppdcMediaSize()' - Create a new media size.
19 //
20
ppdcMediaSize(const char * n,const char * t,float w,float l,float lm,float bm,float rm,float tm,const char * sc,const char * rc)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 {
33 PPDC_NEW;
34
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
~ppdcMediaSize()61 ppdcMediaSize::~ppdcMediaSize()
62 {
63 PPDC_DELETE;
64
65 name->release();
66 text->release();
67 size_code->release();
68 region_code->release();
69 }
70