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