Linux multi-monitor fullscreen support
[ryzomcore.git] / nel / tools / logic / logic_editor_dll / Counter.cpp
blob3a6afc9a3dfe93a85eafea8ef87955aae0cdd554
1 // Counter.cpp: implementation of the CCounter class.
2 //
3 //////////////////////////////////////////////////////////////////////
5 #include "stdafx.h"
6 #include "logic_editor.h"
7 #include "Counter.h"
9 #include "nel/logic/logic_variable.h"
11 #include <string>
13 using namespace std;
14 using namespace NLLOGIC;
16 #ifdef _DEBUG
17 #undef THIS_FILE
18 static char THIS_FILE[]=__FILE__;
19 #define new DEBUG_NEW
20 #endif
22 //////////////////////////////////////////////////////////////////////
23 // Construction/Destruction
24 //////////////////////////////////////////////////////////////////////
26 CCounter::CCounter(const CString &name)
28 m_sName = name;
29 m_sMode = "Loop";
30 m_sWay = "up";
32 m_nUpperLimit = 0;
33 m_nLowerLimit = 0;
36 CCounter::~CCounter()
41 //-----------------------------------------------------
42 // cCounterToCLogicCounter
44 //-----------------------------------------------------
45 void cCounterToCLogicCounter( CCounter& counter, CLogicCounter& logicCounter )
47 // counter name
48 logicCounter.setName(NLMISC::tStrToUtf8(counter.m_sName));
50 // running mode
51 if( counter.m_sMode == "Shuttle" )
53 logicCounter.Mode.setValue( CLogicCounter::SHUTTLE );
55 else
56 if( counter.m_sMode == "Loop" )
58 logicCounter.Mode.setValue( CLogicCounter::LOOP );
60 else
61 if( counter.m_sMode == "Stop on arrival" )
63 logicCounter.Mode.setValue( CLogicCounter::STOP_AT_LIMIT );
65 else
67 // default value
68 logicCounter.Mode.setValue( CLogicCounter::STOP_AT_LIMIT );
71 // running state
72 logicCounter.Control.setValue( CLogicCounter::RUN );
74 /// lower limit for counter
75 logicCounter.LowLimit.setValue( counter.m_nLowerLimit );
77 /// higher limit for counter
78 logicCounter.HighLimit.setValue( counter.m_nUpperLimit );
80 // TODO : phase, period,...
82 } // cCounterToCLogicCounter //
85 //-----------------------------------------------------
86 // cLogicCounterToCCounter
88 //-----------------------------------------------------
89 void cLogicCounterToCCounter( const CLogicCounter& logicCounter, CCounter& counter )
91 // counter name
92 counter.m_sName = CString( logicCounter.getName().c_str() );
94 // running mode
95 switch( logicCounter.Mode.getValue() )
97 case CLogicCounter::SHUTTLE : counter.m_sMode = "Shuttle"; break;
98 case CLogicCounter::LOOP : counter.m_sMode = "Loop"; break;
99 case CLogicCounter::STOP_AT_LIMIT : counter.m_sMode = "Stop on arrival"; break;
102 // lower limit for counter
103 counter.m_nLowerLimit = (long)logicCounter.LowLimit.getValue();
105 // higher limit for counter
106 counter.m_nUpperLimit = (long)logicCounter.HighLimit.getValue();
110 } // cLogicCounterToCCounter //