Vdr menujen logiikka

Juttua VDR:n ja VDR pluginien patcheistä
Avatar
Frodo
Säätäjä
Viestit: 418
Liittynyt: 09.09.2003 3:00
Viesti:

Vdr menujen logiikka

Viesti Kirjoittaja Frodo » 28.11.2003 23:27

Mua häiritsi noi menu näppylöitten toiminta logiikka, mielestäni toisen kerran niitä painettaessa pitäisi menusta poistua eikä näyttää taas uudelleen samaa menua, MITÄ LOGIIKKAA SIINÄ ON?

No kuitenkin tuossa on pätsi jos jotakin kiinnostaa....

Koodi: Valitse kaikki

--- vdr.c_old   2003-11-28 21:41:09.000000000 +0200
+++ vdr.c       2003-11-29 12:24:09.000000000 +0200
@@ -458,6 +458,7 @@ int main(int argc, char *argv[])
 
   cOsdObject *Menu = NULL;
   cOsdObject *Temp = NULL;
+  eOSState LastMenu = osUnknown;
   int LastChannel = -1;
   int LastTimerChannel = -1;
   int PreviousChannel[2] = { 1, 1 };
@@ -532,6 +533,7 @@ int main(int argc, char *argv[])
           // Menu control:
           case kMenu:
                key = kNone; // nobody else needs to see this key
+               LastMenu = osUnknown;
                if (Menu) {
                   DELETENULL(Menu);
                   if (!Temp)
@@ -542,6 +544,13 @@ int main(int argc, char *argv[])
                Menu = new cMenuMain(cControl::Control());
                Temp = NULL;
                break;
+          #define DefMenuAction(state...)\
+            if (Menu && LastMenu==state) {\
+               DELETENULL(Menu);\
+               LastMenu = osUnknown;\
+               if (!Temp) break;\
+               }\
+            LastMenu = state;
           #define DirectMainFunction(function...)\
             DELETENULL(Menu);\
             if (cControl::Control())\
@@ -549,12 +558,12 @@ int main(int argc, char *argv[])
             Menu = new cMenuMain(cControl::Control(), function);\
             Temp = NULL;\
             key = kNone; // nobody else needs to see this key
-          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;
+          case kSchedule:   DefMenuAction(osSchedule);DirectMainFunction(osSchedule); break;
+          case kChannels:   DefMenuAction(osChannels);DirectMainFunction(osChannels); break;
+          case kTimers:     DefMenuAction(osTimers);DirectMainFunction(osTimers); break;
+          case kRecordings: DefMenuAction(osRecordings);DirectMainFunction(osRecordings); break;
+          case kSetup:      DefMenuAction(osSetup);DirectMainFunction(osSetup); break;
+          case kCommands:   DefMenuAction(osCommands);DirectMainFunction(osCommands); break;
           case kUser1 ... kUser9: cRemote::PutMacro(key); key = kNone; break;
           case k_Plugin:    DirectMainFunction(osPlugin, cRemote::GetPlugin()); break;
           // Channel up/down:
@@ -674,6 +683,7 @@ int main(int argc, char *argv[])
                             else
                                cControl::Shutdown();
                             Temp = NULL;
+                            LastMenu = osUnknown;
                             break;
              default:       ;
              }