Stroika Library 3.0d18
 
Loading...
Searching...
No Matches
Units.cpp
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4
5#include "Stroika/Foundation/StroikaPreComp.h"
6
7#if defined(WIN32)
8#include <afxwin.h>
9#endif
10
11#include "LedItResources.h"
12
13#include "Units.h"
14
15using namespace Stroika::Foundation;
16using namespace Stroika::Frameworks::Led;
17
18/*
19 ********************************************************************************
20 *********************************** Unit ***************************************
21 ********************************************************************************
22 */
23Unit::Unit (int nTPU, int nSmallDiv, int nMediumDiv, int nLargeDiv, int nMinMove, const char* nAbbrev, BOOL bSpaceAbbrev)
24{
25 m_nTPU = nTPU;
26 m_nSmallDiv = nSmallDiv;
27 m_nMediumDiv = nMediumDiv;
28 m_nLargeDiv = nLargeDiv;
29 m_nMinMove = nMinMove;
30 m_strAbbrev = nAbbrev;
31 m_bSpaceAbbrev = bSpaceAbbrev;
32}
33
34/*
35 ********************************************************************************
36 *********************************** StandardUnits ******************************
37 ********************************************************************************
38 */
39const char IDS_INCH1_ABBREV[] = "\"\"";
40const char IDS_INCH2_ABBREV[] = "in";
41const char IDS_INCH3_ABBREV[] = "inch";
42const char IDS_INCH4_ABBREV[] = "inches";
43const char IDS_CM_ABBREV[] = "cm";
44const char IDS_POINT_ABBREV[] = "pt";
45const char IDS_PICA_ABBREV[] = "pi";
46const Unit StandardUnits::kUnits[StandardUnits::kNumUnits] = {
47 // TPU, SmallDiv, MedDiv, LargeDiv, MinMove, szAbbrev, bSpace
48 Unit (1440, 180, 720, 1440, 90, IDS_INCH1_ABBREV, FALSE), //inches
49 Unit (568, 142, 284, 568, 142, IDS_CM_ABBREV, TRUE), //centimeters
50 Unit (20, 120, 720, 720, 100, IDS_POINT_ABBREV, TRUE), //points
51 Unit (240, 240, 1440, 1440, 120, IDS_PICA_ABBREV, TRUE), //picas
52 Unit (1440, 180, 720, 1440, 90, IDS_INCH2_ABBREV, FALSE), //in
53 Unit (1440, 180, 720, 1440, 90, IDS_INCH3_ABBREV, FALSE), //inch
54 Unit (1440, 180, 720, 1440, 90, IDS_INCH4_ABBREV, FALSE) //inches
55};
56
57Unit StandardUnits::GetCurrentUnits ()
58{
59#if 0
60 TCHAR buf[2];
61 buf[0] = NULL;
62 GetLocaleInfo(GetUserDefaultLCID(), LOCALE_IMEASURE, buf, 2);
63 int nDefUnits = buf[0] == '1' ? 0 : 1;
64 SetUnits(GetProfileInt(szSection, szUnits, nDefUnits));
65#endif
66 return kUnits[0];
67}