Implemented additional dedicated keys

This commit is contained in:
Klaus Schmidinger 2002-10-27 14:32:06 +01:00
parent 462463404d
commit 74c74fb5d2
9 changed files with 389 additions and 121 deletions

18
HISTORY
View File

@ -1611,7 +1611,7 @@ Video Disk Recorder Revision History
shall be executed from the "Recordings" menu; see MANUAL and 'man vdr(5)' for
details (suggested by Gerhard Steiner).
2002-10-26: Version 1.1.14
2002-10-27: Version 1.1.14
- Fixed some faulty default parameter initializations (thanks to Robert Schiele).
- Added further satellites to 'sources.conf' (thanks to Reinhard Walter Buchner
@ -1647,3 +1647,19 @@ Video Disk Recorder Revision History
- Now the name of the remote control is displayed when learning the keys.
- Fixed learning remote control keys in case there is more than one remote
control (thanks to Oliver Endriss for reporting this one).
- Implemented additional dedicated keys for "Play", "Pause", "Stop", "Record",
"FastFwd", "FastRew", "Channel+" and "Channel-". If your remote control supports
any of these keys you can delete your 'remote.conf' file and restart VDR to
go through the key learning procedure again in order to assign these new keys.
See MANUAL for more information.
Authors of player plugins should update their ProcessKey() functions so that
the new player keys have the same functionality as the "Up", "Down", "Left",
"Right" and "Blue" keys, respectively. Note that the existing functionality
of these keys should by all means be retained, since VDR (and any plugins)
shall be fully usable with just the basic set of keys. These new keys are only
for additional comfort in case the remote control in use supports them.
- Implemented new keys to directly access the VDR main menu functions "Schedule",
"Channels", "Timers", "Recordings", "Setup" and "Commands". If your remote
control provides keys you want to assign these functions to, you can delete
your 'remote.cof' file and restart VDR to go through the key learning procedure
again in order to assign these new keys. See MANUAL for more information.

29
MANUAL
View File

@ -23,10 +23,31 @@ Video Disk Recorder User's Manual
Blue - Stop/Resume Mark On/Off(1) - Summary Stop
0..9 Ch select - - - Numeric inp. Exec cmd(2) Editing
Power Shutdown
Volume+ Volume up
Volume- Volume down
Mute Mute
If your remote control provides additional keys, they can be used for the
following functions:
Play resume normal replay
Pause pause replay
Stop stop replay
Record instant recording
FastFwd fast forward
FastRew fast rewind
Channel+ channel up
Channel- channel down
Power shutdown
Volume+ volume up
Volume- volume down
Mute mute
Schedule \
Channels |
Timers | directly access the VDR
Recordings | main menu functions
Setup |
Commands /
(1) The "On/Off" button in the "Timers" menu only works if sorting the timers
has been enabled in the "Setup" menu. Otherwise the Blue button is used

View File

@ -1064,11 +1064,12 @@ consider here are
<i>Play</i>, <i>Pause</i>, <i>Fast Rewind</i> and <i>Fast Forward</i>, respectively
(provided that this particular player can implement these functions) if the player
is not currently showing any menu. If there is a menu, they shall allow the user
to navigate in the menu.
to navigate in the menu. The dedicated <i>Play</i>, <i>Pause</i>, <i>FastRew</i>
and <i>FastFwd</i> keys shall always result in their specific functionality.
<li>The <i>Green</i> and <i>Yellow</i> buttons shall skip back- and forward by an
amount of time suitable for this player (provided that this particular player can
implement these functions).
<li>The <i>Blue</i> button shall immediately stop the replay session.
<li>The <i>Blue</i> and <i>Stop</i> button shall immediately stop the replay session.
</ul>
Of course, these are only suggestions which should make it easier for VDR users to
enjoy additional players, since they will be able to control them with actions

130
i18n.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: i18n.c 1.98 2002/10/26 12:04:20 kls Exp $
* $Id: i18n.c 1.99 2002/10/27 14:24:00 kls Exp $
*
* Translations provided by:
*
@ -2786,6 +2786,102 @@ const tI18nPhrase Phrases[] = {
"Albastru",
"Kék",
},
{ "Play",
"Wiedergabe",
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
},
{ "Pause",
"Pause",
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
},
{ "Stop",
"Stop",
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
},
{ "Record",
"Aufnehmen",
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
},
{ "FastFwd",
"Vorlauf",
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
},
{ "FastRew",
"Rücklauf",
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
},
{ "Power",
"Ausschalten",
"Izklop",
@ -2802,6 +2898,38 @@ const tI18nPhrase Phrases[] = {
"Pornit",
"Kikapcsolni",
},
{ "Channel+",
"Kanal+",
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
},
{ "Channel-",
"Kanal-",
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
"",// TODO
},
{ "Volume+",
"Lautstärke+",
"Glasnost+",

72
keys.c
View File

@ -4,40 +4,54 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: keys.c 1.1 2002/09/29 09:56:51 kls Exp $
* $Id: keys.c 1.2 2002/10/27 14:00:49 kls Exp $
*/
#include "keys.h"
static tKey keyTable[] = { // "Up" and "Down" must be the first two keys!
{ kUp, "Up" },
{ kDown, "Down" },
{ kMenu, "Menu" },
{ kOk, "Ok" },
{ kBack, "Back" },
{ kLeft, "Left" },
{ kRight, "Right" },
{ kRed, "Red" },
{ kGreen, "Green" },
{ kYellow, "Yellow" },
{ kBlue, "Blue" },
{ k0, "0" },
{ k1, "1" },
{ k2, "2" },
{ k3, "3" },
{ k4, "4" },
{ k5, "5" },
{ k6, "6" },
{ k7, "7" },
{ k8, "8" },
{ k9, "9" },
{ kPower, "Power" },
{ kVolUp, "Volume+" },
{ kVolDn, "Volume-" },
{ kMute, "Mute" },
{ kNone, "" },
{ k_Setup, "_Setup" },
{ kNone, NULL },
{ kUp, "Up" },
{ kDown, "Down" },
{ kMenu, "Menu" },
{ kOk, "Ok" },
{ kBack, "Back" },
{ kLeft, "Left" },
{ kRight, "Right" },
{ kRed, "Red" },
{ kGreen, "Green" },
{ kYellow, "Yellow" },
{ kBlue, "Blue" },
{ k0, "0" },
{ k1, "1" },
{ k2, "2" },
{ k3, "3" },
{ k4, "4" },
{ k5, "5" },
{ k6, "6" },
{ k7, "7" },
{ k8, "8" },
{ k9, "9" },
{ kPlay, "Play" },
{ kPause, "Pause" },
{ kStop, "Stop" },
{ kRecord, "Record" },
{ kFastFwd, "FastFwd" },
{ kFastRew, "FastRew" },
{ kPower, "Power" },
{ kChanUp, "Channel+" },
{ kChanDn, "Channel-" },
{ kVolUp, "Volume+" },
{ kVolDn, "Volume-" },
{ kMute, "Mute" },
{ kSchedule, "Schedule" },
{ kChannels, "Channels" },
{ kTimers, "Timers" },
{ kRecordings, "Recordings" },
{ kSetup, "Setup" },
{ kCommands, "Commands" },
{ kNone, "" },
{ k_Setup, "_Setup" },
{ kNone, NULL },
};
// -- cKey -------------------------------------------------------------------

23
keys.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: keys.h 1.1 2002/09/29 09:55:52 kls Exp $
* $Id: keys.h 1.2 2002/10/27 13:58:55 kls Exp $
*/
#ifndef __KEYS_H
@ -26,10 +26,24 @@ enum eKeys { // "Up" and "Down" must be the first two keys!
kYellow,
kBlue,
k0, k1, k2, k3, k4, k5, k6, k7, k8, k9,
kPlay,
kPause,
kStop,
kRecord,
kFastFwd,
kFastRew,
kPower,
kChanUp,
kChanDn,
kVolUp,
kVolDn,
kMute,
kSchedule,
kChannels,
kTimers,
kRecordings,
kSetup,
kCommands,
kNone,
k_Setup,
// The following flags are OR'd with the above codes:
@ -47,9 +61,10 @@ enum eKeys { // "Up" and "Down" must be the first two keys!
#define kEditCut k2
#define kEditTest k8
#define RAWKEY(k) (eKeys((k) & ~k_Flags))
#define ISRAWKEY(k) ((k) != kNone && ((k) & k_Flags) == 0)
#define NORMALKEY(k) (eKeys((k) & ~k_Repeat))
#define RAWKEY(k) (eKeys((k) & ~k_Flags))
#define ISRAWKEY(k) ((k) != kNone && ((k) & k_Flags) == 0)
#define NORMALKEY(k) (eKeys((k) & ~k_Repeat))
#define ISMODELESSKEY(k) (RAWKEY(k) > k9)
struct tKey {
eKeys type;

48
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.220 2002/10/20 14:22:09 kls Exp $
* $Id: menu.c 1.221 2002/10/27 14:06:02 kls Exp $
*/
#include "menu.h"
@ -1226,6 +1226,7 @@ eOSState cMenuWhatsOn::ProcessKey(eKeys Key)
if (state == osUnknown) {
switch (Key) {
case kRecord:
case kRed: return Record();
case kYellow: state = osBack;
// continue with kGreen
@ -1369,6 +1370,7 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key)
if (state == osUnknown) {
switch (Key) {
case kRecord:
case kRed: return Record();
case kGreen: if (schedules) {
if (!now && !next) {
@ -2162,7 +2164,12 @@ cMenuMain::cMenuMain(bool Replaying, eOSState State)
// Initial submenus:
switch (State) {
case osSchedule: AddSubMenu(new cMenuSchedule); break;
case osChannels: AddSubMenu(new cMenuChannels); break;
case osTimers: AddSubMenu(new cMenuTimers); break;
case osRecordings: AddSubMenu(new cMenuRecordings(NULL, 0, true)); break;
case osSetup: AddSubMenu(new cMenuSetup); break;
case osCommands: AddSubMenu(new cMenuCommands(tr("Commands"), &Commands)); break;
default: break;
}
}
@ -2289,6 +2296,7 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
}
break;
default: switch (Key) {
case kRecord:
case kRed: if (!HasSubMenu())
state = osRecord;
break;
@ -2351,6 +2359,7 @@ cDisplayChannel::cDisplayChannel(eKeys FirstKey)
:cOsdObject(true)
{
group = -1;
lines = 0;
number = 0;
lastTime = time_ms();
int EpgLines = Setup.ShowInfoOnChSwitch ? 5 : 1;
@ -2443,6 +2452,14 @@ void cDisplayChannel::DisplayInfo(void)
}
}
void cDisplayChannel::Refresh(void)
{
Interface->Clear();
DisplayChannel(Channels.GetByNumber(cDevice::CurrentChannel()));
lastTime = time_ms();
lines = 0;
}
eOSState cDisplayChannel::ProcessKey(eKeys Key)
{
switch (Key) {
@ -2490,6 +2507,18 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key)
}
lastTime = time_ms();
break;
case kUp|k_Repeat:
case kUp:
case kDown|k_Repeat:
case kDown:
cDevice::SwitchChannel(NORMALKEY(Key) == kUp ? 1 : -1);
// no break here
case kChanUp|k_Repeat:
case kChanUp:
case kChanDn|k_Repeat:
case kChanDn:
Refresh();
break;
case kNone:
if (number && time_ms() - lastTime > DIRECTCHANNELTIMEOUT) {
if (Channels.GetByNumber(number))
@ -2509,7 +2538,7 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key)
case kOk: if (group >= 0)
Channels.SwitchTo(Channels.Get(Channels.GetNextNormal(group))->Number());
return osEnd;
default: if (NORMALKEY(Key) == kUp || NORMALKEY(Key) == kDown || (Key & (k_Repeat | k_Release)) == 0) {
default: if ((Key & (k_Repeat | k_Release)) == 0) {
cRemote::Put(Key);
return osEnd;
}
@ -3080,19 +3109,23 @@ void cReplayControl::TimeSearchProcess(eKeys Key)
TimeSearchDisplay();
}
break;
case kFastRew:
case kLeft:
case kFastFwd:
case kRight: {
int dir = (Key == kRight ? 1 : -1);
int dir = ((Key == kRight || Key == kFastFwd) ? 1 : -1);
if (dir > 0)
Seconds = min(Total - Current - STAY_SECONDS_OFF_END, Seconds);
SkipSeconds(Seconds * dir);
timeSearchActive = false;
}
break;
case kPlay:
case kUp:
case kPause:
case kDown:
Seconds = min(Total - STAY_SECONDS_OFF_END, Seconds);
Goto(Seconds * FRAMESPERSEC, Key == kDown);
Goto(Seconds * FRAMESPERSEC, Key == kDown || Key == kPause);
timeSearchActive = false;
break;
default:
@ -3237,19 +3270,26 @@ eOSState cReplayControl::ProcessKey(eKeys Key)
bool DoShowMode = true;
switch (Key) {
// Positioning:
case kPlay:
case kUp: Play(); break;
case kPause:
case kDown: Pause(); break;
case kFastRew|k_Release:
case kLeft|k_Release:
if (Setup.MultiSpeedMode) break;
case kFastRew:
case kLeft: Backward(); break;
case kFastFwd|k_Release:
case kRight|k_Release:
if (Setup.MultiSpeedMode) break;
case kFastFwd:
case kRight: Forward(); break;
case kRed: TimeSearch(); break;
case kGreen|k_Repeat:
case kGreen: SkipSeconds(-60); break;
case kYellow|k_Repeat:
case kYellow: SkipSeconds( 60); break;
case kStop:
case kBlue: Hide();
Stop();
return osEnd;

3
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.h 1.48 2002/10/13 10:34:09 kls Exp $
* $Id: menu.h 1.49 2002/10/27 12:04:49 kls Exp $
*/
#ifndef __MENU_H
@ -35,6 +35,7 @@ private:
int number;
void DisplayChannel(const cChannel *Channel);
void DisplayInfo(void);
void Refresh(void);
public:
cDisplayChannel(int Number, bool Switched);
cDisplayChannel(eKeys FirstKey);

182
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
* $Id: vdr.c 1.128 2002/10/20 12:09:45 kls Exp $
* $Id: vdr.c 1.129 2002/10/27 14:32:06 kls Exp $
*/
#include <getopt.h>
@ -456,6 +456,25 @@ int main(int argc, char *argv[])
Menu = new cMenuMain(cControl::Control());
Temp = NULL;
break;
#define DirectMainFunction(function)\
DELETENULL(Menu);\
if (cControl::Control())\
cControl::Control()->Hide();\
Menu = new cMenuMain(cControl::Control(), function);\
Temp = NULL;
case kSchedule: DirectMainFunction(osSchedule); break;
case kChannels: DirectMainFunction(osChannels); break;
case kTimers: DirectMainFunction(osTimers); break;
case kRecordings: DirectMainFunction(osRecordings); break;
case kSetup: DirectMainFunction(osSetup); break;
case kCommands: DirectMainFunction(osCommands); break;
// Channel up/down:
case kChanUp|k_Repeat:
case kChanUp:
case kChanDn|k_Repeat:
case kChanDn:
cDevice::SwitchChannel(NORMALKEY(key) == kChanUp ? 1 : -1);
break;
// Volume Control:
case kVolUp|k_Repeat:
case kVolUp:
@ -487,81 +506,94 @@ int main(int argc, char *argv[])
}
LastActivity = 1; // not 0, see below!
break;
default:
if (Interact) {
switch (Interact->ProcessKey(key)) {
case osRecord: DELETENULL(Menu);
Temp = NULL;
if (!cRecordControls::Start())
Interface->Error(tr("No free DVB device to record!"));
break;
case osRecordings:
DELETENULL(Menu);
cControl::Shutdown();
Temp = NULL;
Menu = new cMenuMain(false, osRecordings);
break;
case osReplay: DELETENULL(Menu);
cControl::Shutdown();
Temp = NULL;
cControl::Launch(new cReplayControl);
break;
case osStopReplay:
DELETENULL(Menu);
cControl::Shutdown();
Temp = NULL;
break;
case osSwitchDvb:
DELETENULL(Menu);
cControl::Shutdown();
Temp = NULL;
Interface->Info(tr("Switching primary DVB..."));
cDevice::SetPrimaryDevice(Setup.PrimaryDVB);
break;
case osBack:
case osEnd: if (Interact == Menu)
DELETENULL(Menu);
else
cControl::Shutdown();
Temp = NULL;
break;
default: ;
}
}
else {
// Key functions in "normal" viewing mode:
switch (key) {
// Toggle channels:
case k0: {
int CurrentChannel = cDevice::CurrentChannel();
Channels.SwitchTo(PreviousChannel);
PreviousChannel = CurrentChannel;
break;
}
// Direct Channel Select:
case k1 ... k9:
Menu = new cDisplayChannel(key);
break;
// Left/Right rotates trough channel groups:
case kLeft|k_Repeat:
case kLeft:
case kRight|k_Repeat:
case kRight:
Menu = new cDisplayChannel(NORMALKEY(key));
break;
// Up/Down Channel Select:
case kUp|k_Repeat:
case kUp:
case kDown|k_Repeat:
case kDown:
cDevice::SwitchChannel(NORMALKEY(key) == kUp ? 1 : -1);
break;
// Viewing Control:
case kOk: LastChannel = -1; break; // forces channel display
default: break;
}
}
default: break;
}
Interact = Menu ? Menu : cControl::Control(); // might have been closed in the mean time
if (Interact) {
eOSState state = Interact->ProcessKey(key);
if (state == osUnknown && ISMODELESSKEY(key) && cControl::Control() && Interact != cControl::Control())
state = cControl::Control()->ProcessKey(key);
switch (state) {
case osRecord: DELETENULL(Menu);
Temp = NULL;
if (cRecordControls::Start())
Interface->Info(tr("Recording"));
else
Interface->Error(tr("No free DVB device to record!"));
break;
case osRecordings:
DELETENULL(Menu);
cControl::Shutdown();
Temp = NULL;
Menu = new cMenuMain(false, osRecordings);
break;
case osReplay: DELETENULL(Menu);
cControl::Shutdown();
Temp = NULL;
cControl::Launch(new cReplayControl);
break;
case osStopReplay:
DELETENULL(Menu);
cControl::Shutdown();
Temp = NULL;
break;
case osSwitchDvb:
DELETENULL(Menu);
cControl::Shutdown();
Temp = NULL;
Interface->Info(tr("Switching primary DVB..."));
cDevice::SetPrimaryDevice(Setup.PrimaryDVB);
break;
case osBack:
case osEnd: if (Interact == Menu)
DELETENULL(Menu);
else
cControl::Shutdown();
Temp = NULL;
break;
default: ;
}
}
else {
// Key functions in "normal" viewing mode:
switch (key) {
// Toggle channels:
case k0: {
int CurrentChannel = cDevice::CurrentChannel();
Channels.SwitchTo(PreviousChannel);
PreviousChannel = CurrentChannel;
break;
}
// Direct Channel Select:
case k1 ... k9:
Menu = new cDisplayChannel(key);
break;
// Left/Right rotates trough channel groups:
case kLeft|k_Repeat:
case kLeft:
case kRight|k_Repeat:
case kRight:
Menu = new cDisplayChannel(NORMALKEY(key));
break;
// Up/Down Channel Select:
case kUp|k_Repeat:
case kUp:
case kDown|k_Repeat:
case kDown:
cDevice::SwitchChannel(NORMALKEY(key) == kUp ? 1 : -1);
break;
// Viewing Control:
case kOk: LastChannel = -1; break; // forces channel display
// Instant recording:
case kRecord:
if (cRecordControls::Start())
Interface->Info(tr("Recording"));
else
Interface->Error(tr("No free DVB device to record!"));
break;
default: break;
}
}
if (!Menu) {
EITScanner.Process();
if (!cCutter::Active() && cCutter::Ended()) {