📄 prrulerdrawerprovider.cpp
字号:
/* * * prrulerdrawerprovider.cpp * * Copyright (C) 2006 Michael H. Overlin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact at poster_printer@yahoo.com */#include "prrulerdrawerprovider.h"#include "..\lib\mathutils.h"// ** DO NOT DELETE THIS COMMENT **// I AM HARD-CODING A MINIMUM LABEL SEPARATION VALUE ("20") THAT REALLY DEPENDS// ON THE FONT USED TO DRAW THE RULER AND ON THE SIZE OF THE TEXT DRAWN,// WHICH ARE HARD CODED IN ListViewWindowPR_RulerDrawerProvider::PR_RulerDrawerProvider() { std::vector<uint> vuiTicks; //vuiTicks.push_back(2); //vuiTicks.push_back(2); //vuiTicks.push_back(2); //m_prdInches = new RulerDrawer(vuiTicks, 5, 20, 1.0, 1, TEXT("inches"), 0, 24); //vuiTicks.clear(); //vuiTicks.push_back(12); //vuiTicks.push_back(2); //vuiTicks.push_back(2); //// 6/1 ////m_prdFeet = new RulerDrawer(vuiTicks, 5, 20, 1.0/12, 1, TEXT("feet"), 0, 20); //m_prdFeet = new RulerDrawer(vuiTicks, 5, 20, 12.0, 1, TEXT("feet"), 0, 20); //vuiTicks.clear(); //vuiTicks.push_back(10); //vuiTicks.push_back(4); //// 6/1 ////m_prdTenFeet = new RulerDrawer(vuiTicks, 5, 20, 1.0/120, 10, TEXT("feet"), 0, 12); //m_prdTenFeet = new RulerDrawer(vuiTicks, 5, 20, 120.0, 10, TEXT("feet"), 0, 12); vuiTicks.push_back(2); vuiTicks.push_back(2); vuiTicks.push_back(2); m_prdInches = new RulerDrawer(vuiTicks, 13, 20, 1.0, 1, TEXT("inches"), 0, 12); vuiTicks.clear(); vuiTicks.push_back(4); vuiTicks.push_back(2); vuiTicks.push_back(2); m_prdInchesByFours = new RulerDrawer(vuiTicks, 13, 20, 4.0, 4, TEXT("inches"), 0, 12); vuiTicks.clear(); vuiTicks.push_back(3); vuiTicks.push_back(4); m_prdFeet = new RulerDrawer(vuiTicks, 13, 20, 12.0, 1, TEXT("feet"), 0, 9); vuiTicks.clear(); vuiTicks.push_back(3); vuiTicks.push_back(3); vuiTicks.push_back(4); m_prdYards = new RulerDrawer(vuiTicks, 13, 20, 36.0, 1, TEXT("yards"), 0, 12); vuiTicks.clear(); vuiTicks.push_back(2); vuiTicks.push_back(5); m_prdTenFeet = new RulerDrawer(vuiTicks, 13, 20, (10.0*12), 10, TEXT("ten feet"), 0, 12);}PR_RulerDrawerProvider::~PR_RulerDrawerProvider() { // NOT SURE WHY delete ON A const RulerDrawer * IS ALLOWED HERE delete m_prdInches; delete m_prdFeet; delete m_prdTenFeet;}const RulerDrawer *PR_RulerDrawerProvider::GetRulerDrawer(const double& dMaxExtent) const { const RulerDrawer *prd = NULL; if (dMaxExtent < MAX_RULER_INCHES) { int iStop = (int) /*RoundToLong(dMaxExtent + 1);*/ ::RoundUp(dMaxExtent); if (1 * 4 <= iStop && iStop < 1 * 12) { prd = m_prdInches; } else if (4 * 3 <= iStop && iStop < 4 * 12) { prd = m_prdInchesByFours; } else if (12 * 3 <= iStop && iStop < 12 * 9) { prd = m_prdFeet; } else if ( 12*3 * 3 <= iStop && iStop < 12*3 * 12) { prd = m_prdYards; } else if (12*3 * 12 <= iStop && iStop < 12*10 * 12) { prd = m_prdTenFeet; } //if (iStop < 24) { // prd = m_prdInches; //} else if (iStop < 20 * 12) { // iStop /= 12; // prd = m_prdFeet; //} else { // iStop /= 12*10; // prd = m_prdTenFeet; //} } return prd;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -