void wxPlaylist::Play() { PLEntry *ple; if (!HasValidEntries()) return; RefreshCurrent(); if (m_cur_entry >= (s32)gf_list_count(m_entries)) { if (!m_pApp->m_loop) return; m_cur_entry = 0; } ple = (PLEntry *) gf_list_get(m_entries, m_cur_entry); if (!ple || ple->m_bIsDead) { m_cur_entry++; Play(); } else { char szPLE[20]; ple->m_bIsPlaying = 1; UpdateEntry(m_cur_entry); sprintf(szPLE, "%d", m_cur_entry); gf_cfg_set_key(m_pApp->m_user.config, "General", "PLEntry", szPLE); m_pApp->DoConnect(); } }
void Playlist::Play() { PLEntry *ple; if (!HasValidEntries()) return; RefreshCurrent(); if (m_cur_entry==-1) m_cur_entry = 0; if (m_cur_entry >= (s32)gf_list_count(m_entries)) { if (!GetApp()->m_Loop) return; m_cur_entry = 0; } ple = (PLEntry *) gf_list_get(m_entries, m_cur_entry); assert(ple); if (ple->m_bIsDead) { m_cur_entry++; Play(); } else { char szPLE[20]; ple->m_bIsPlaying = GF_TRUE; UpdateEntry(m_cur_entry); sprintf(szPLE, "%d", m_cur_entry); gf_cfg_set_key(GetApp()->m_user.config, "General", "PLEntry", szPLE); GetApp()->m_pMainWnd->PostMessage(WM_OPENURL); } }
eOSState cOsdMenu::CloseSubMenu() { delete subMenu; subMenu = NULL; RefreshCurrent(); Display(); return osContinue; // convenience return value }
void Playlist::PlayPrev() { RefreshCurrent(); if (m_cur_entry>0) { m_cur_entry--; Play(); } }
void Playlist::OnPlPlay() { POSITION pos = m_FileList.GetFirstSelectedItemPosition(); RefreshCurrent(); m_cur_entry = m_FileList.GetNextSelectedItem(pos); Play(); }
void Playlist::OnDblclkFilelist(NMHDR* pNMHDR, LRESULT* pResult) { POSITION pos = m_FileList.GetFirstSelectedItemPosition(); RefreshCurrent(); m_cur_entry = m_FileList.GetNextSelectedItem(pos); Play(); *pResult = 0; }
void wxPlaylist::PlayNext() { RefreshCurrent(); if (1+m_cur_entry < (s32)gf_list_count(m_entries)) { m_cur_entry++; Play(); } }
void wxPlaylist::OnItemActivate(wxListEvent &WXUNUSED(event) ) { long item = m_FileList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item==-1) return; RefreshCurrent(); m_cur_entry = item; Play(); }
eOSState cOsdMenu::HotKey(eKeys Key) { bool match = false; bool highlight = false; int item_nr; int i; if (Key == kNone) { if (lastActivity.TimedOut()) Key = kOk; else return osContinue; } else lastActivity.Set(MENUKEY_TIMEOUT); for (cOsdItem *item = Last(); item; item = Prev(item)) { const char *s = item->Text(); i = 0; item_nr = 0; if (s && (s = skipspace(s)) != '\0' && '0' <= s[i] && s[i] <= '9') { do { item_nr = item_nr * 10 + (s[i] - '0'); } while ( !((s[++i] == '\t')||(s[i] == ' ')) && (s[i] != '\0') && ('0' <= s[i]) && (s[i] <= '9')); if ((Key == kOk) && (item_nr == key_nr)) { current = item->Index(); RefreshCurrent(); Display(); cRemote::Put(kOk, true); key_nr = -1; break; } else if (Key != kOk) { if (!highlight && (item_nr == (Key - k0))) { highlight = true; current = item->Index(); } if (!match && (key_nr == -1) && ((item_nr / 10) == (Key - k0))) { match = true; key_nr = (Key - k0); } else if (((key_nr == -1) && (item_nr == (Key - k0))) || (!match && (key_nr >= 0) && (item_nr == (10 * key_nr + Key - k0)))) { current = item->Index(); cRemote::Put(kOk, true); key_nr = -1; break; } } } } if ((!match) && (Key != kNone)) key_nr = -1; return osContinue; }
void Playlist::PlayNext() { s32 count = (s32)gf_list_count(m_entries); RefreshCurrent(); if (1+m_cur_entry < count) { m_cur_entry++; Play(); } else if ((1+m_cur_entry == count) && GetApp()->m_Loop) { m_cur_entry=0; Play(); } }
eOSState cOsdMenu::HotKey(eKeys Key) { for (cOsdItem *item = First(); item; item = Next(item)) { const char *s = item->Text(); if (s && (s = skipspace(s)) != NULL) { if (*s == Key - k1 + '1') { current = item->Index(); RefreshCurrent(); Display(); cRemote::Put(kOk, true); break; } } } return osContinue; }
eOSState cMenuEpgTimers::OnOff(void) { if (HasSubMenu()) return osContinue; cTimer *timer = CurrentTimer(); if (timer) { timer->OnOff(); timer->SetEventFromSchedule(); RefreshCurrent(); DisplayCurrent(true); if (timer->FirstDay()) isyslog("timer %s first day set to %s", *timer->ToDescr(), *timer->PrintFirstDay()); else isyslog("timer %s %sactivated", *timer->ToDescr(), timer->HasFlags(tfActive) ? "" : "de"); Timers.SetModified(); //update helpkeys helpKeys = -1; } return osContinue; }
eOSState cMenuSwitchTimers::ProcessKey(eKeys Key) { eOSState state = cOsdMenu::ProcessKey(Key); if (state == osUnknown) { switch (Key) { case kOk: state = Summary(); break; case kGreen: state = DeleteAll(); break; case kYellow: state = Delete(); break; case kRed: if (HasSubMenu()) return osContinue; if (CurrentSwitchTimer()) state = AddSubMenu(new cMenuEditSwitchTimer(CurrentSwitchTimer())); else state = osContinue; break; case k0: if (CurrentSwitchTimer()) { cSwitchTimer* switchTimer = CurrentSwitchTimer(); switchTimer->announceOnly = 1 - switchTimer->announceOnly; cMutexLock SwitchTimersLock(&SwitchTimers); SwitchTimers.Save(); RefreshCurrent(); Display(); } break; default: break; } } return state; }
eOSState cOsdMenu::HotKey(eKeys Key) { #ifdef USE_LIEMIEXT bool match = false; bool highlight = false; int item_nr; int i; if (Key == kNone) { if (lastActivity.TimedOut()) Key = kOk; else return osContinue; } else { lastActivity.Set(MENUKEY_TIMEOUT); } for (cOsdItem *item = Last(); item; item = Prev(item)) { #else for (cOsdItem *item = First(); item; item = Next(item)) { #endif /* LIEMIEXT */ const char *s = item->Text(); #ifdef USE_LIEMIEXT i = 0; item_nr = 0; if (s && (s = skipspace(s)) != '\0' && '0' <= s[i] && s[i] <= '9') { do { item_nr = item_nr * 10 + (s[i] - '0'); } while ( !((s[++i] == '\t')||(s[i] == ' ')) && (s[i] != '\0') && ('0' <= s[i]) && (s[i] <= '9')); if ((Key == kOk) && (item_nr == key_nr)) { #else if (s && (s = skipspace(s)) != NULL) { if (*s == Key - k1 + '1') { #endif /* LIEMIEXT */ current = item->Index(); RefreshCurrent(); Display(); cRemote::Put(kOk, true); #ifdef USE_LIEMIEXT key_nr = -1; #endif /* LIEMIEXT */ break; } #ifdef USE_LIEMIEXT else if (Key != kOk) { if (!highlight && (item_nr == (Key - k0))) { highlight = true; current = item->Index(); } if (!match && (key_nr == -1) && ((item_nr / 10) == (Key - k0))) { match = true; key_nr = (Key - k0); } else if (((key_nr == -1) && (item_nr == (Key - k0))) || (!match && (key_nr >= 0) && (item_nr == (10 * key_nr + Key - k0)))) { current = item->Index(); cRemote::Put(kOk, true); key_nr = -1; break; } } #endif /* LIEMIEXT */ } } #ifdef USE_LIEMIEXT if ((!match) && (Key != kNone)) { key_nr = -1; } #endif /* LIEMIEXT */ #if REELVDR // RC: returning osContinue prevents the main menu and prob. others from automatic closing. side effects? //DDD("return osUnknown"); return osUnknown; #else return osContinue; #endif } eOSState cOsdMenu::AddSubMenu(cOsdMenu *SubMenu) { delete subMenu; subMenu = SubMenu; #if REELVDR /* close any preview/pip channels when adding a submenu, since it does not belong to the submenu*/ if(cReelBoxBase::Instance()) { cReelBoxBase::Instance()->StartPip(false); printf("\033[0;92mStop pip\033[0m\n"); } // Clear ID3 tags and cover-art/thumbnails that are stored in skinreel3's // global variables, // new osd should set the necessary thumbnails and id3 infos itself. #if 0 // thumbnails in install wizard were not shown! cPlugin *skinPlugin = cPluginManager::GetPlugin("skinreel3"); if (skinPlugin) { skinPlugin->Service("setThumb", NULL); skinPlugin->Service("setId3Infos", NULL); } #endif #endif subMenu->Display(); return osContinue; // convenience return value } eOSState cOsdMenu::CloseSubMenu() { delete subMenu; subMenu = NULL; RefreshCurrent(); Display(); return osContinue; // convenience return value } #ifdef REELVDR //#define SEPARATORS ":-\0" #define SEPARATORS ":-" ///< take menu-title substrings befor one of this chars eOSState cOsdMenu::DisplayHelpMenu(const char *Title) { char title[128]; // if we get Menu at first we assume Main Menu if (strstr(Title,tr("Main Menu")) == Title) { strncpy(title,tr("Main Menu"),128); } else { const char *sep = SEPARATORS; while (*sep != '\0') { //printf (" \t\t --- sep %c \n", *sep); char *s = NULL; strncpy(title,Title,128); title[127] = '\0'; s = strchr(title,*sep); if (s) { *s = '\0'; //break; } sep++; } } //cHelpSection *hs = HelpMenus.GetSectionByTitle(title); //return AddSubMenu(new cMenuHelp(hs, title)); } #endif /* REELVDR */ eOSState cOsdMenu::ProcessKey(eKeys Key) { if (subMenu) { eOSState state = subMenu->ProcessKey(Key); if (state == osBack) return CloseSubMenu(); return state; } cOsdItem *item = Get(current); if (marked < 0 && item) { eOSState state = item->ProcessKey(Key); if (state != osUnknown) { DisplayCurrent(true); return state; } } switch (int(Key)) { #ifdef USE_LIEMIEXT case kNone: case k0...k9: return hasHotkeys ? HotKey(Key) : osUnknown; #else case k0: return osUnknown; case k1...k9: return hasHotkeys ? HotKey(Key) : osUnknown; #endif /* LIEMIEXT */ case kUp|k_Repeat: case kUp: CursorUp(); break; case kDown|k_Repeat: case kDown: CursorDown(); break; case kLeft|k_Repeat: case kLeft: PageUp(); break; case kRight|k_Repeat: case kRight: PageDown(); break; case kBack: return osBack; #ifdef REELVDR case kInfo: return DisplayHelpMenu(title); #endif /* REELVDR */ case kOk: if (marked >= 0) { SetStatus(NULL); if (marked != current) Move(marked, current); marked = -1; break; } // else run into default default: if (marked < 0) return osUnknown; } return osContinue; }
eOSState cMenuMoveChannelInFavBouquet::ProcessKey(eKeys Key) { eOSState state = osUnknown; if (channel) switch (Key) { case kBack: if (channel) { channel = NULL; Set(); state = osContinue; } break; case kLeft: case kLeft|k_Repeat: case kRight: case kRight|k_Repeat: // ignore PageUp and PageDown keys for now state = osContinue; break; case kUp|k_Repeat: case kUp: { cOsdItem *item = Get(Current()); if (!item) break; int currIdx = item->Index(); Move(currIdx, currIdx-1); printf("Move %d -> %d\n", currIdx, currIdx -1); SetCurrent(item); Display(); // not set state = osContinue; } break; case kDown|k_Repeat: case kDown: { cOsdItem *item = Get(Current()); if (!item) break; int currIdx = item->Index(); Move(currIdx, currIdx+1); printf("Move %d -> %d\n", currIdx, currIdx +1); SetCurrent(item); Display(); // not set state = osContinue; } break; case kOk: { cOsdItem *item = Get(Current()); cOsdItem *nextItem = Get(Current()+1); cOsdChannelItem *From = dynamic_cast<cOsdChannelItem*> (item); cOsdChannelItem *To = dynamic_cast<cOsdChannelItem*> (nextItem); MoveFavChannel(From->Channel(),To?To->Channel():NULL); state = osRefreshPage; } break; default: break; } if (state == osUnknown) state = cOsdMenu::ProcessKey(Key); if (state == osUnknown) { switch (Key) { case kOk: { cOsdChannelItem *chItem = dynamic_cast<cOsdChannelItem*> (Get(Current())); if (chItem && chItem->Channel() && !channel) { channel = chItem->Channel(); chItem->SetMarked(true); RefreshCurrent(); Display(); } } state = osContinue; break; default: break; } // switch } // if return state; }