NCBI C++ ToolKit
print_media.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef GUI_UTILS__PRINT_MEDIA_HPP
2 #define GUI_UTILS__PRINT_MEDIA_HPP
3 
4 /* $Id: print_media.hpp 28446 2013-07-12 15:35:17Z falkrb $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Peter Meric
30  *
31  * File Description:
32  * CMedia - dimensions for physical print media
33  *
34  */
35 
36 #include <corelib/ncbistd.hpp>
38 #include <gui/utils/vect2.hpp>
39 
40 
42 
43 
44 
46 {
47 public:
48  /// Note that the standard allows a maximum width/height in pdf units
49  /// (the MediaBox width/height written to the file) of 14400. UserUnit
50  /// option allows pdf 1.4+ files to render beyond that.
51  CMedia(const string& name,
52  float width,
53  float height,
55  virtual ~CMedia();
56 
57  const string& GetName(void) const;
58  CUnit::TPdfUnit GetWidth(void) const;
59  CUnit::TPdfUnit GetHeight(void) const;
60  float GetNativeWidth(void) const;
61  float GetNativeHeight(void) const;
62  CUnit::TUnit GetUnit(void) const;
63  bool Inside(const CVect2<float>& pt) const;
64 
65  static const CMedia& GetMedia(const string& media);
66 
67 private:
68  void x_SetDimensions(void);
69 
70  string m_Name;
71  float m_Width, m_Height;
73 
74  //
75  // the unit height/width is always in default user coordinates (1/72 inch)
76  //
78 };
79 
80 
81 //
82 // US imperial paper formats
83 //
84 static const CMedia Letter("Letter", 8.5, 11, CUnit::eInch);
85 static const CMedia Legal("Legal", 8.5, 14, CUnit::eInch);
86 static const CMedia Ledger("Ledger", 11, 17, CUnit::eInch);
87 
88 //
89 // ISO paper formats
90 //
91 static const CMedia A0("A0", 841, 1189, CUnit::eMillimeter);
92 static const CMedia A1("A1", 594, 841, CUnit::eMillimeter);
93 static const CMedia A2("A2", 420, 594, CUnit::eMillimeter);
94 static const CMedia A3("A3", 297, 420, CUnit::eMillimeter);
95 static const CMedia A4("A4", 210, 297, CUnit::eMillimeter);
96 static const CMedia A5("A5", 148, 210, CUnit::eMillimeter);
97 static const CMedia A6("A6", 105, 148, CUnit::eMillimeter);
98 
99 static const CMedia B0("B0", 1000, 1414, CUnit::eMillimeter);
100 static const CMedia B1("B1", 707, 1000, CUnit::eMillimeter);
101 static const CMedia B2("B2", 500, 707, CUnit::eMillimeter);
102 static const CMedia B3("B3", 353, 500, CUnit::eMillimeter);
103 static const CMedia B4("B4", 250, 353, CUnit::eMillimeter);
104 static const CMedia B5("B5", 176, 250, CUnit::eMillimeter);
105 static const CMedia B6("B6", 125, 176, CUnit::eMillimeter);
106 
107 
108 
110 
111 
112 #endif // GUI_UTILS__PRINT_MEDIA_HPP
CUnit::TUnit m_Unit
Definition: print_media.hpp:72
string m_Name
Definition: print_media.hpp:70
CUnit::TPdfUnit m_UnitWidth
Definition: print_media.hpp:77
float m_Width
Definition: print_media.hpp:71
enum EUnit TUnit
Definition: print_utils.hpp:55
float TPdfUnit
Definition: print_utils.hpp:59
@ ePdfUnit
Definition: print_utils.hpp:52
@ eMillimeter
Definition: print_utils.hpp:51
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUIPRINT_EXPORT
Definition: gui_export.h:516
static const CMedia A4("A4", 210, 297, CUnit::eMillimeter)
static const CMedia Letter("Letter", 8.5, 11, CUnit::eInch)
static const CMedia B4("B4", 250, 353, CUnit::eMillimeter)
static const CMedia B3("B3", 353, 500, CUnit::eMillimeter)
static const CMedia A0("A0", 841, 1189, CUnit::eMillimeter)
static const CMedia B0("B0", 1000, 1414, CUnit::eMillimeter)
static const CMedia B6("B6", 125, 176, CUnit::eMillimeter)
static const CMedia B2("B2", 500, 707, CUnit::eMillimeter)
static const CMedia A1("A1", 594, 841, CUnit::eMillimeter)
static const CMedia A2("A2", 420, 594, CUnit::eMillimeter)
static const CMedia B5("B5", 176, 250, CUnit::eMillimeter)
static const CMedia Ledger("Ledger", 11, 17, CUnit::eInch)
static const CMedia Legal("Legal", 8.5, 14, CUnit::eInch)
static const CMedia A6("A6", 105, 148, CUnit::eMillimeter)
static const CMedia A5("A5", 148, 210, CUnit::eMillimeter)
static const CMedia A3("A3", 297, 420, CUnit::eMillimeter)
static const CMedia B1("B1", 707, 1000, CUnit::eMillimeter)
Modified on Wed May 22 11:33:54 2024 by modify_doxy.py rev. 669887