2 #include "../Common/Common.h"
4 #include "DynamicFilter.h"
5 #include "DasherInterfaceBase.h"
8 CDynamicFilter::CDynamicFilter(Dasher::CEventHandler
* pEventHandler
, CSettingsStore
*pSettingsStore
, CDasherInterfaceBase
*pInterface
)
9 : CInputFilter(pEventHandler
, pSettingsStore
, pInterface
, 6, 1, "Dynamic Mode") {
12 m_iTargetX
= new int[2];
13 m_iTargetY
= new int[2];
21 if(GetBoolParameter(BP_BUTTONPULSING
))
29 CDynamicFilter::~CDynamicFilter() {
34 bool CDynamicFilter::DecorateView(CDasherView
*pView
) {
36 CDasherScreen
*pScreen(pView
->Screen());
44 pView
->Dasher2Screen(-100, 1000, x1
, y1
);
45 pView
->Dasher2Screen(-200, 4096, x2
, y2
);
48 pView
->Dasher2Screen(-100, 0, x1
, y1
);
49 pView
->Dasher2Screen(-200, 3096, x2
, y2
);
52 pScreen
->DrawRectangle(x1
, y1
, x2
, y2
, 1, 1, Opts::ColorSchemes(Objects
), true, false, 1);
55 pView
->Dasher2Screen(-100, 0, x1
, y1
);
56 pView
->Dasher2Screen(-200, 3096, x2
, y2
);
59 pView
->Dasher2Screen(-100, 1000, x1
, y1
);
60 pView
->Dasher2Screen(-200, 4096, x2
, y2
);
63 pScreen
->DrawRectangle(x1
, y1
, x2
, y2
, 2, 2, Opts::ColorSchemes(Objects
), true, false, 1);
68 void CDynamicFilter::Timer(int Time
, CDasherView
*m_pDasherView
, CDasherModel
*m_pDasherModel
) {
73 m_pDasherModel
->Tap_on_display(3096,2048, Time
, 0, 0);
75 if( GetBoolParameter(BP_BUTTONSTEADY
) || !bStarted
|| (Time
- m_iKeyTime
> 1000)) {
76 iX
= m_iTargetX
[m_iTarget
];
77 iY
= m_iTargetY
[m_iTarget
];
80 iX
= ((Time
- m_iKeyTime
) * m_iTargetX
[m_iTarget
] + (1000 - (Time
- m_iKeyTime
)) * 2048) / 1000;
81 iY
= ((Time
- m_iKeyTime
) * m_iTargetY
[m_iTarget
] + (1000 - (Time
- m_iKeyTime
)) * 2048) / 1000;
84 m_pDasherModel
->Tap_on_display(iX
, iY
, Time
, 0, 0);
88 void CDynamicFilter::KeyDown(int iTime
, int iId
, CDasherModel
*pModel
) {
89 if((iId
== 2) || (iId
== 3) || (iId
== 4)) {
90 if(GetBoolParameter(BP_DASHER_PAUSED
)) {
91 m_pInterface
->Unpause(iTime
);
95 m_iTarget
= 1 - m_iTarget
;
104 if(GetBoolParameter(BP_DASHER_PAUSED
)) {
105 m_pInterface
->Unpause(iTime
);
109 m_pInterface
->PauseAt(0,0);
114 void CDynamicFilter::KeyUp(int iTime
, int iId
, CDasherModel
*pModel
) {
122 void CDynamicFilter::HandleEvent(Dasher::CEvent
* pEvent
) {
123 if(pEvent
->m_iEventType
== 1) {
124 Dasher::CParameterNotificationEvent
* pEvt(static_cast < Dasher::CParameterNotificationEvent
* >(pEvent
));
126 switch (pEvt
->m_iParameter
) {
127 case BP_BUTTONSTEADY
:
128 case BP_BUTTONPULSING
:
129 // Delibarate fall through
130 if(GetBoolParameter(BP_BUTTONPULSING
))