From c45be69293ddb47f1813ccc74eb8a567ddcaea6b Mon Sep 17 00:00:00 2001 From: Midas Date: Fri, 4 Jun 2010 12:02:30 +0200 Subject: The Channel up/down and Up/Down keys now allow to change zapping direction on a block event. --- control.c | 38 ++++++++++++++++++++++++++++++-------- control.h | 4 ++-- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/control.c b/control.c index c573439..c1ad30a 100644 --- a/control.c +++ b/control.c @@ -22,7 +22,8 @@ cControlBlock::cControlBlock(const cChannel *Channel, const cEvent *Present, con mFollowing(Following), mStart(0), mSwitch(true), - mOsd(NULL) + mOsd(NULL), + direction(0) { #if APIVERSNUM >= 10500 SetNeedsFastResponse(true); @@ -59,7 +60,7 @@ cControlBlock::~cControlBlock() if (mSwitch) { int lastchannel=cSetupBlock::LastChannel; // possibly first or last available channel, fall back to old channel - int direction = mChannel->Number() - lastchannel; + if (direction == 0) direction = 1; if (!cDevice::SwitchChannel(direction) && (lastchannel != 0)) @@ -104,6 +105,7 @@ dsyslog("plugin-block: userint Processing kNone (no user interaction)"); if (mStart == 0) Show(); else if (time_ms() - mStart > BlockTimeout()) { + direction = mChannel->Number() - cSetupBlock::LastChannel; mSwitch = true; return osEnd; } @@ -112,16 +114,36 @@ dsyslog("plugin-block: userint Processing kNone (no user interaction)"); case kUp: - case kDown: case kChanUp: +#ifdef LOGGING +dsyslog("plugin-block: userint Processing up event (userrequest)"); +#endif + if (mStart == 0) + Show(); + else + { + mRequested=false;//TODO:necessary? as below + direction = 1; + mSwitch = true; + return osEnd; + } + break; + case kDown: case kChanDn: #ifdef LOGGING -dsyslog("plugin-block: userint Processing k(Ch)Up/(Ch)Down event."); +dsyslog("plugin-block: userint Processing down event (userrequest)"); #endif - mRequested = false; - mSwitch = true; - return osEnd; - break; + if (mStart == 0) + Show(); + else + { + mRequested=false;//TODO:necessary? as below + direction = -1; + mSwitch = true; + return osEnd; + } + break; + default: break; diff --git a/control.h b/control.h index 3dfdc54..20d5ceb 100644 --- a/control.h +++ b/control.h @@ -14,8 +14,8 @@ class cControlBlock : public cControl { private: static bool mRequested; - - int mLastChannel; + int direction; + const cChannel *mChannel; const cEvent *mPresent; const cEvent *mFollowing; -- cgit v1.2.3