[dasher: 20/21] Rename DynamicButtons::Event to ButtonEvent
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher: 20/21] Rename DynamicButtons::Event to ButtonEvent
- Date: Thu, 14 Jul 2011 17:32:49 +0000 (UTC)
commit 36935f3585b1faf4747ffde4c69d4b594bf1b1c2
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Thu Jul 14 12:45:00 2011 +0100
Rename DynamicButtons::Event to ButtonEvent
Src/DasherCore/DynamicButtons.cpp | 11 ++++-------
Src/DasherCore/DynamicButtons.h | 16 ++++++++++++++--
2 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/Src/DasherCore/DynamicButtons.cpp b/Src/DasherCore/DynamicButtons.cpp
index fa35644..6861f86 100644
--- a/Src/DasherCore/DynamicButtons.cpp
+++ b/Src/DasherCore/DynamicButtons.cpp
@@ -33,7 +33,7 @@ CDynamicButtons::CDynamicButtons(CSettingsUser *pCreator, CDasherInterfaceBase *
bool CDynamicButtons::Timer(unsigned long iTime, CDasherView *pDasherView, CDasherInput *pInput, CDasherModel *m_pDasherModel, CExpansionPolicy **pol)
{
if(m_bKeyDown && !m_bKeyHandled && ((iTime - m_iKeyDownTime) > GetLongParameter(LP_HOLD_TIME))) {
- Event(iTime, m_iHeldId, 1, m_pDasherModel);
+ ButtonEvent(iTime, m_iHeldId, 1, m_pDasherModel);
m_bKeyHandled = true;
//return true; //ACL although that's what old DynamicButtons did, surely we should progress normally?
}
@@ -62,7 +62,7 @@ void CDynamicButtons::KeyDown(unsigned long iTime, int iId, CDasherView *pView,
return;
// Pass the basic key down event to the handler
- Event(iTime, iId, 0, pModel);
+ ButtonEvent(iTime, iId, 0, pModel);
// Store the key down time so that long presses can be determined
// TODO: This is going to cause problems if multiple buttons are
@@ -78,10 +78,7 @@ void CDynamicButtons::KeyUp(unsigned long iTime, int iId, CDasherView *pView, CD
if (iId == m_iHeldId) m_bKeyDown = false;
}
-void CDynamicButtons::Event(int iTime, int iButton, int iType, CDasherModel *pModel) {
- // Types known at this point in inheritance hierarchy:
- // 0 = ordinary click
- // 1 = long click
+void CDynamicButtons::ButtonEvent(int iTime, int iButton, int iType, CDasherModel *pModel) {
// TODO: Check that state diagram implemented here is what we
// decided upon
@@ -159,4 +156,4 @@ void CDynamicButtons::run()
void CDynamicButtons::ApplyOffset(CDasherModel *pModel, int iOffset) {
(m_pModel=pModel)->Offset(iOffset);
-}
\ No newline at end of file
+}
diff --git a/Src/DasherCore/DynamicButtons.h b/Src/DasherCore/DynamicButtons.h
index 40c6c9f..bb93712 100644
--- a/Src/DasherCore/DynamicButtons.h
+++ b/Src/DasherCore/DynamicButtons.h
@@ -40,8 +40,20 @@ class CDynamicButtons : public CDynamicFilter, public CSettingsObserver {
//respond to changes to BP_DASHER_PAUSED to keep m_iState in sync
virtual void HandleEvent(int iParameter);
protected:
- virtual void ActionButton(int iTime, int iButton, int iType, CDasherModel *pModel) = 0;
- virtual void Event(int iTime, int iButton, int iType, CDasherModel *pModel);
+ ///Called when a key event is detected - could be a single press (a la KeyDown/KeyUp),
+ /// but is also called with explicit indication of "long" or other types of press,
+ /// avoiding need for subclasses to try to detect these manually. In the default implementation:
+ /// if paused, any key restarts; if reversing, any key pauses; if running, short presses
+ /// of button 0 or 100 act as a dedicated reverse button, and button 1 pauses; any other
+ /// press type or button is passed onto ActionButton.
+ /// \param iType 0=normal press, 1=long press; see also CButtonMultiPress.
+ virtual void ButtonEvent(int long iTime, int iButton, int iType, CDasherModel *pModel);
+
+ ///Called to handle key events when the Filter is running forwards normally.
+ /// Short presses of buttons 0, 100 and 1 have been handled already, but all
+ /// other buttons/press-types will be passed here.
+ /// \param iType 0=normal press, 1=long press; see also CButtonMultiPress.
+ virtual void ActionButton(unsigned long iTime, int iButton, int iType, CDasherModel *pModel) = 0;
bool m_bKeyDown;
bool m_bKeyHandled;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]