print_media.cpp
来自「ncbi源码」· C++ 代码 · 共 215 行
CPP
215 行
/* * =========================================================================== * PRODUCTION $Log: print_media.cpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 21:04:11 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4 * PRODUCTION * =========================================================================== *//* $Id: print_media.cpp,v 1000.1 2004/06/01 21:04:11 gouriano Exp $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software / database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software / database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Authors: Peter Meric * * File Description: * CMedia - dimensions for physical print media * */#include <ncbi_pch.hpp>#include <gui/print/print_media.hpp>BEGIN_NCBI_SCOPECMedia::CMedia(const string& name, float width, float height, CUnit::TUnit unit) : m_Name(name), m_Width(width), m_Height(height),m_Unit(unit){ x_SetDimensions();}CMedia::~CMedia(){}void CMedia::x_SetDimensions(void){ switch (m_Unit) { case CUnit::eInch: m_UnitWidth = InchesToPdfUnits(m_Width); m_UnitHeight = InchesToPdfUnits(m_Height); break; case CUnit::eMillimeter: m_UnitWidth = MmToPdfUnits(m_Width); m_UnitHeight = MmToPdfUnits(m_Height); break; case CUnit::ePdfUnit: m_UnitWidth = m_Width; m_UnitHeight = m_Height; break; default: NCBI_THROW(CException, eUnknown, "CMedia::x_SetDimensions: unknown unit"); }}const string& CMedia::GetName(void) const{ return m_Name;}CUnit::TPdfUnit CMedia::GetWidth(void) const{ return m_UnitWidth;}CUnit::TPdfUnit CMedia::GetHeight(void) const{ return m_UnitHeight;}float CMedia::GetNativeWidth(void) const{ return m_Width;}float CMedia::GetNativeHeight(void) const{ return m_Height;}CUnit::TUnit CMedia::GetUnit(void) const{ return m_Unit;}const CMedia& CMedia::GetMedia(const string& media){ if (media == "Letter") { return Letter; } if (media == "Legal") { return Legal; } if (media == "Ledger") { return Ledger; } if (media == "A0") { return A0; } if (media == "A1") { return A1; } if (media == "A2") { return A2; } if (media == "A3") { return A3; } if (media == "A4") { return A4; } if (media == "A5") { return A5; } if (media == "A6") { return A6; } if (media == "B0") { return B0; } if (media == "B1") { return B1; } if (media == "B2") { return B2; } if (media == "B3") { return B3; } if (media == "B4") { return B4; } if (media == "B5") { return B5; } if (media == "B6") { return B6; } NCBI_THROW(CException, eUnknown, "CMedia::GetMedia: unknown media " + media);}END_NCBI_SCOPE/* * =========================================================================== * $Log: print_media.cpp,v $ * Revision 1000.1 2004/06/01 21:04:11 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4 * * Revision 1.4 2004/05/21 22:27:50 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.3 2003/08/15 17:02:16 meric * Updates include paths for print-related files from gui/utils to gui/print * * Revision 1.2 2003/06/24 17:27:33 meric * Use CUnit::TPdfUnit * * Revision 1.1 2003/06/16 16:01:38 dicuccio * Moved generic print code code from opengl/print to utils. * * Revision 1.2 2003/06/16 12:44:52 dicuccio * Clean-up after initial commit * * Revision 1.1 2003 / 06 / 13 18:13:56 meric * Initial version * * =========================================================================== */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?