bool CGUIDialogContextMenu::SourcesMenu(const CStdString &strType, const CFileItemPtr item, float posX, float posY) { // TODO: This should be callable even if we don't have any valid items if (!item) return false; // popup the context menu CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); if (pMenu) { // load our menu pMenu->Initialize(); // grab our context menu CContextButtons buttons; GetContextButtons(strType, item, buttons); // add the buttons and execute it for (CContextButtons::iterator it = buttons.begin(); it != buttons.end(); it++) pMenu->AddButton((*it).second); // position it correctly pMenu->OffsetPosition(posX, posY); pMenu->DoModal(); // translate our button press CONTEXT_BUTTON btn = CONTEXT_BUTTON_CANCELLED; if (pMenu->GetButton() > 0 && pMenu->GetButton() <= (int)buttons.size()) btn = buttons[pMenu->GetButton() - 1].first; if (btn != CONTEXT_BUTTON_CANCELLED) return OnContextButton(strType, item, btn); } return false; }
int CGUIDialogContextMenu::ShowAndGetChoice(const vector<CStdString> &choices, const CPoint *pos) { // no choices?? if (choices.size() == 0) return 0; // popup the context menu CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); if (pMenu) { // load our menu pMenu->Initialize(); for (unsigned int i = 0; i < choices.size(); i++) pMenu->AddButton(choices[i]); // position it correctly if (pos) pMenu->OffsetPosition(pos->x, pos->y); else pMenu->PositionAtCurrentFocus(); pMenu->DoModal(); if (pMenu->GetButton() > 0) return pMenu->GetButton(); } return 0; }
int CGUIDialogContextMenu::ShowAndGetChoice(const vector<CStdString> &choices, const CPoint &pos) { // no choices?? if (choices.size() == 0) return 0; // popup the context menu CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); if (pMenu) { // load our menu pMenu->Initialize(); for (unsigned int i = 0; i < choices.size(); i++) pMenu->AddButton(choices[i]); // position it correctly pMenu->SetPosition(pos.x - pMenu->GetWidth() / 2, pos.y - pMenu->GetHeight() / 2); pMenu->DoModal(); if (pMenu->GetButton() > 0) return pMenu->GetButton(); } return 0; }
void CGUIDialogVideoBookmarks::AddEpisodeBookmark() { vector<CVideoInfoTag> episodes; CVideoDatabase videoDatabase; CPoint pos; videoDatabase.Open(); videoDatabase.GetEpisodesByFile(g_application.CurrentFile(), episodes); videoDatabase.Close(); if(episodes.size() > 0) { CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); map<int, CVideoInfoTag*> buttons; const CGUIControl *pList = GetControl(CONTROL_ADD_EPISODE_BOOKMARK); if (pList) pos = pList->GetRenderPosition() + CPoint(pList->GetWidth() * 0.5f, pList->GetHeight() * 0.5f); if (pMenu) { pMenu->Initialize(); for (unsigned int i=0; i < episodes.size(); ++i) { CStdString strButton; strButton.Format("%s %i, %s %i", g_localizeStrings.Get(20373), episodes[i].m_iSeason, g_localizeStrings.Get(20359).c_str(), episodes[i].m_iEpisode); buttons[pMenu->AddButton(strButton)] = &episodes[i]; } pMenu->OffsetPosition(pos.x, pos.y); pMenu->DoModal(GetID()); int pressed = pMenu->GetButton(); if (buttons.find(pressed) != buttons.end()) AddBookmark(buttons[pressed]); } } }
void CGUIDialogContextMenu::SwitchMedia(const CStdString& strType, const CStdString& strPath) { // what should we display? vector <CStdString> vecTypes; if (!strType.Equals("music")) vecTypes.push_back(g_localizeStrings.Get(2)); // My Music if (!strType.Equals("video")) vecTypes.push_back(g_localizeStrings.Get(3)); // My Videos if (!strType.Equals("pictures")) vecTypes.push_back(g_localizeStrings.Get(1)); // My Pictures if (!strType.Equals("files")) vecTypes.push_back(g_localizeStrings.Get(7)); // My Files // something went wrong if (vecTypes.size() != 3) return; // create menu CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); pMenu->Initialize(); // add buttons int btn_Type[3]; for (int i=0; i<3; i++) { btn_Type[i] = pMenu->AddButton(vecTypes[i]); } // display menu pMenu->CenterWindow(); pMenu->DoModal(); // check selection int btn = pMenu->GetButton(); for (int i=0; i<3; i++) { if (btn == btn_Type[i]) { // map back to correct window int iWindow = WINDOW_INVALID; if (vecTypes[i].Equals(g_localizeStrings.Get(2))) iWindow = WINDOW_MUSIC_FILES; else if (vecTypes[i].Equals(g_localizeStrings.Get(3))) iWindow = WINDOW_VIDEO_FILES; else if (vecTypes[i].Equals(g_localizeStrings.Get(1))) iWindow = WINDOW_PICTURES; else if (vecTypes[i].Equals(g_localizeStrings.Get(7))) iWindow = WINDOW_FILES; //m_gWindowManager.ActivateWindow(iWindow, strPath); CUtil::ClearFileItemCache(); m_gWindowManager.ChangeActiveWindow(iWindow, strPath); return; } } return; }
EPLAYERCORES CPlayerCoreFactory::SelectPlayerDialog(VECPLAYERCORES &vecCores, float posX, float posY) { CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); // Reset menu pMenu->Initialize(); // Add all possible players auto_aptr<int> btn_Cores(NULL); if( vecCores.size() > 0 ) { btn_Cores = new int[ vecCores.size() ]; btn_Cores[0] = 0; CStdString strCaption; //Add default player strCaption = CPlayerCoreFactory::GetPlayerName(vecCores[0]); strCaption += " ("; strCaption += g_localizeStrings.Get(13278); strCaption += ")"; btn_Cores[0] = pMenu->AddButton(strCaption); //Add all other players for( unsigned int i = 1; i < vecCores.size(); i++ ) { strCaption = CPlayerCoreFactory::GetPlayerName(vecCores[i]); btn_Cores[i] = pMenu->AddButton(strCaption); } } // Display menu if (posX && posY) pMenu->OffsetPosition(posX, posY); else pMenu->CenterWindow(); pMenu->DoModal(); //Check what player we selected int btnid = pMenu->GetButton(); for( unsigned int i = 0; i < vecCores.size(); i++ ) { if( btnid == btn_Cores[i] ) { return vecCores[i]; } } return EPC_NONE; }
bool CGUIMediaWindow::OnPopupMenu(int iItem) { // popup the context menu // grab our context menu CContextButtons buttons; GetContextButtons(iItem, buttons); if (buttons.size()) { // mark the item if (iItem >= 0 && iItem < m_vecItems->Size()) m_vecItems->Get(iItem)->Select(true); CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); if (!pMenu) return false; // load our menu pMenu->Initialize(); // add the buttons and execute it for (CContextButtons::iterator it = buttons.begin(); it != buttons.end(); it++) pMenu->AddButton((*it).second); // position it correctly float posX = 200; float posY = 100; const CGUIControl *pList = GetControl(CONTROL_VIEW_START); if (pList) { posX = pList->GetXPosition() + pList->GetWidth() / 2; posY = pList->GetYPosition() + pList->GetHeight() / 2; } pMenu->SetPosition(posX - pMenu->GetWidth() / 2, posY - pMenu->GetHeight() / 2); pMenu->DoModal(); // translate our button press CONTEXT_BUTTON btn = CONTEXT_BUTTON_CANCELLED; if (pMenu->GetButton() > 0 && pMenu->GetButton() <= (int)buttons.size()) btn = buttons[pMenu->GetButton() - 1].first; // deselect our item if (iItem >= 0 && iItem < m_vecItems->Size()) m_vecItems->Get(iItem)->Select(false); if (btn != CONTEXT_BUTTON_CANCELLED) return OnContextButton(iItem, btn); } return false; }
int CGUIDialogContextMenu::ShowAndGetChoice(const CContextButtons &choices) { if (choices.size() == 0) return -1; CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); if (pMenu) { pMenu->m_buttons = choices; pMenu->Initialize(); pMenu->PositionAtCurrentFocus(); pMenu->DoModal(); return pMenu->m_clickedButton; } return -1; }
void CGUIDialogFavourites::OnPopupMenu(int item) { if (item < 0 || item >= m_favourites->Size()) return; CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); if (pMenu) { // highlight the item (*m_favourites)[item]->Select(true); // initialize the positioning float posX = 0; float posY = 0; const CGUIControl *pList = GetControl(FAVOURITES_LIST); if (pList) { posX = pList->GetXPosition() + pList->GetWidth() / 2; posY = pList->GetYPosition() + pList->GetHeight() / 2; } pMenu->Initialize(); int btn_MoveUp = m_favourites->Size() > 1 ? pMenu->AddButton(13332) : 0; int btn_MoveDown = m_favourites->Size() > 1 ? pMenu->AddButton(13333) : 0; int btn_Remove = pMenu->AddButton(15015); int btn_Rename = pMenu->AddButton(118); pMenu->SetPosition(GetPosX() + posX - pMenu->GetWidth() / 2, GetPosY() + posY - pMenu->GetHeight() / 2); pMenu->DoModal(GetID()); int button = pMenu->GetButton(); // unhighlight the item (*m_favourites)[item]->Select(false); if (button == btn_MoveUp) OnMoveItem(item, -1); else if (button == btn_MoveDown) OnMoveItem(item, 1); else if (button == btn_Remove) OnDelete(item); else if (button == btn_Rename) OnRename(item); } }
bool CGUIMediaWindow::OnPopupMenu(int iItem) { // popup the context menu // grab our context menu CContextButtons buttons; GetContextButtons(iItem, buttons); if (buttons.size()) { // mark the item if (iItem >= 0 && iItem < m_vecItems->Size()) m_vecItems->Get(iItem)->Select(true); CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); if (!pMenu) return false; // load our menu pMenu->Initialize(); // add the buttons and execute it for (CContextButtons::iterator it = buttons.begin(); it != buttons.end(); it++) pMenu->AddButton((*it).second); // position it correctly CPoint pos = GetContextPosition(); pMenu->OffsetPosition(pos.x, pos.y); pMenu->DoModal(); // translate our button press CONTEXT_BUTTON btn = CONTEXT_BUTTON_CANCELLED; if (pMenu->GetButton() > 0 && pMenu->GetButton() <= (int)buttons.size()) btn = buttons[pMenu->GetButton() - 1].first; // deselect our item if (iItem >= 0 && iItem < m_vecItems->Size()) m_vecItems->Get(iItem)->Select(false); if (btn != CONTEXT_BUTTON_CANCELLED) return OnContextButton(iItem, btn); } return false; }
void CGUIDialogFavourites::OnPopupMenu(int item) { if (item < 0 || item >= m_favourites->Size()) return; CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); if (pMenu) { // highlight the item (*m_favourites)[item]->Select(true); // initialize the positioning CPoint pos; const CGUIControl *pList = GetControl(FAVOURITES_LIST); if (pList) pos = pList->GetRenderPosition() + CPoint(pList->GetWidth() * 0.5f, pList->GetHeight() * 0.5f); pMenu->Initialize(); int btn_MoveUp = m_favourites->Size() > 1 ? pMenu->AddButton(13332) : 0; int btn_MoveDown = m_favourites->Size() > 1 ? pMenu->AddButton(13333) : 0; int btn_Remove = pMenu->AddButton(15015); int btn_Rename = pMenu->AddButton(118); pMenu->OffsetPosition(pos.x, pos.y); pMenu->DoModal(GetID()); int button = pMenu->GetButton(); // unhighlight the item (*m_favourites)[item]->Select(false); if (button == btn_MoveUp) OnMoveItem(item, -1); else if (button == btn_MoveDown) OnMoveItem(item, 1); else if (button == btn_Remove) OnDelete(item); else if (button == btn_Rename) OnRename(item); } }
bool CGUIWindowLoginScreen::OnPopupMenu(int iItem) { if ( iItem < 0 || iItem >= m_vecItems->Size() ) return false; // calculate our position float posX = 200, posY = 100; const CGUIControl *pList = GetControl(CONTROL_BIG_LIST); if (pList) { posX = pList->GetXPosition() + pList->GetWidth() / 2; posY = pList->GetYPosition() + pList->GetHeight() / 2; } bool bSelect = m_vecItems->Get(iItem)->IsSelected(); // mark the item m_vecItems->Get(iItem)->Select(true); // popup the context menu CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); if (!pMenu) return false; // initialize the menu (loaded on demand) pMenu->Initialize(); int btn_EditProfile = pMenu->AddButton(20067); int btn_DeleteProfile = 0; int btn_ResetLock = 0; /* if (m_viewControl.GetSelectedItem() != 0) // no deleting the default profile btn_DeleteProfile = pMenu->AddButton(117); */ if (iItem == 0 && g_passwordManager.iMasterLockRetriesLeft == 0) btn_ResetLock = pMenu->AddButton(12334); // position it correctly pMenu->SetPosition(posX - pMenu->GetWidth() / 2, posY - pMenu->GetHeight() / 2); pMenu->DoModal(); int btnid = pMenu->GetButton(); if (btnid > 0) { if (btnid == btn_ResetLock) { if (g_passwordManager.CheckLock(g_settings.m_vecProfiles[0].getLockMode(),g_settings.m_vecProfiles[0].getLockCode(),20075)) g_passwordManager.iMasterLockRetriesLeft = g_guiSettings.GetInt("masterlock.maxretries"); else // be inconvenient g_application.getApplicationMessenger().Shutdown(); return true; } if (!g_passwordManager.IsMasterLockUnlocked(true)) return false; if (btnid == btn_EditProfile) CGUIDialogProfileSettings::ShowForProfile(m_viewControl.GetSelectedItem()); if (btnid == btn_DeleteProfile) { int iDelete = m_viewControl.GetSelectedItem(); m_viewControl.Clear(); g_settings.DeleteProfile(iDelete); Update(); m_viewControl.SetSelectedItem(0); } } //NOTE: this can potentially (de)select the wrong item if the filelisting has changed because of an action above. if (iItem < (int)g_settings.m_vecProfiles.size()) m_vecItems->Get(iItem)->Select(bSelect); return (btnid > 0); }
void CGUIWindowSettingsProfile::OnPopupMenu(int iItem) { // calculate our position float posX = 200; float posY = 100; const CGUIControl *pList = GetControl(CONTROL_PROFILES); if (pList) { posX = pList->GetXPosition() + pList->GetWidth() / 2; posY = pList->GetYPosition() + pList->GetHeight() / 2; } // popup the context menu CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); if (!pMenu) return ; // load our menu pMenu->Initialize(); if (iItem == (int)g_settings.m_vecProfiles.size()) return; // add the needed buttons int btnLoad = pMenu->AddButton(20092); // load profile int btnDelete=0; if (iItem > 0) btnDelete = pMenu->AddButton(117); // Delete // position it correctly pMenu->OffsetPosition(posX, posY); pMenu->DoModal(); int iButton = pMenu->GetButton(); if (iButton == btnLoad) { unsigned iCtrlID = GetFocusedControlID(); g_application.StopPlaying(); CGUIMessage msg2(GUI_MSG_ITEM_SELECTED, g_windowManager.GetActiveWindow(), iCtrlID); g_windowManager.SendMessage(msg2); g_application.getNetwork().NetworkMessage(CNetwork::SERVICES_DOWN,1); #ifdef HAS_XBOX_NETWORK g_network.Deinitialize(); #endif bool bOldMaster = g_passwordManager.bMasterUser; g_passwordManager.bMasterUser = true; g_settings.LoadProfile(iItem); g_application.StartEventServer(); // event server could be needed in some situations g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].setDate(); g_settings.SaveProfiles(PROFILES_FILE); // to set last loaded g_passwordManager.bMasterUser = bOldMaster; CGUIMessage msg3(GUI_MSG_SETFOCUS, g_windowManager.GetActiveWindow(), iCtrlID, 0); OnMessage(msg3); CGUIMessage msgSelect(GUI_MSG_ITEM_SELECT, g_windowManager.GetActiveWindow(), iCtrlID, msg2.GetParam1(), msg2.GetParam2()); OnMessage(msgSelect); CWeather::GetInstance().Refresh(); } if (iButton == btnDelete) { if (g_settings.DeleteProfile(iItem)) iItem--; } LoadList(); CGUIMessage msg(GUI_MSG_ITEM_SELECT, GetID(),CONTROL_PROFILES,iItem); OnMessage(msg); }
void CGUIWindowFileManager::OnPopupMenu(int list, int item, bool bContextDriven /* = true */) { if (list < 0 || list > 2) return ; bool bDeselect = SelectItem(list, item); // calculate the position for our menu float posX = 200; float posY = 100; const CGUIControl *pList = GetControl(CONTROL_LEFT_LIST + list); if (pList) { posX = pList->GetXPosition() + pList->GetWidth() / 2; posY = pList->GetYPosition() + pList->GetHeight() / 2; } CFileItemPtr pItem = m_vecItems[list]->Get(item); if (!pItem.get()) return; if (m_Directory[list]->IsVirtualDirectoryRoot()) { if (item < 0) { // TODO: We should add the option here for shares to be added if there aren't any return ; } // and do the popup menu if (CGUIDialogContextMenu::SourcesMenu("files", pItem, posX, posY)) { m_rootDir.SetSources(g_settings.m_fileSources); if (m_Directory[1 - list]->IsVirtualDirectoryRoot()) Refresh(); else Refresh(list); return ; } pItem->Select(false); return ; } // popup the context menu CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); if (pMenu) { bool showEntry = false; if (item >= m_vecItems[list]->Size()) item = -1; if (item >= 0) showEntry=(!pItem->IsParentFolder() || (pItem->IsParentFolder() && m_vecItems[list]->GetSelectedCount()>0)); // determine available players VECPLAYERCORES vecCores; CPlayerCoreFactory::GetPlayers(*pItem, vecCores); // load our menu pMenu->Initialize(); // add the needed buttons int btn_SelectAll = pMenu->AddButton(188); // SelectAll int btn_HandleFavourite; // Add/Remove Favourite if (CFavourites::IsFavourite(pItem.get(), GetID())) btn_HandleFavourite = pMenu->AddButton(14077); else btn_HandleFavourite = pMenu->AddButton(14076); int btn_PlayUsing = pMenu->AddButton(15213); // Play Using .. int btn_Rename = pMenu->AddButton(118); // Rename int btn_Delete = pMenu->AddButton(117); // Delete int btn_Copy = pMenu->AddButton(115); // Copy int btn_Move = pMenu->AddButton(116); // Move int btn_NewFolder = pMenu->AddButton(20309); // New Folder int btn_Size = pMenu->AddButton(13393); // Calculate Size int btn_Settings = pMenu->AddButton(5); // Settings int btn_GoToRoot = pMenu->AddButton(20128); // Go To Root int btn_Switch = pMenu->AddButton(523); // switch media pMenu->EnableButton(btn_SelectAll, item >= 0); pMenu->EnableButton(btn_HandleFavourite, item >=0 && !pItem->IsParentFolder()); pMenu->EnableButton(btn_PlayUsing, item >= 0 && vecCores.size() > 1); pMenu->EnableButton(btn_Rename, item >= 0 && CanRename(list) && !pItem->IsParentFolder()); pMenu->EnableButton(btn_Delete, item >= 0 && CanDelete(list) && showEntry); pMenu->EnableButton(btn_Copy, item >= 0 && CanCopy(list) && showEntry); pMenu->EnableButton(btn_Move, item >= 0 && CanMove(list) && showEntry); pMenu->EnableButton(btn_NewFolder, CanNewFolder(list)); pMenu->EnableButton(btn_Size, item >=0 && pItem->m_bIsFolder && !pItem->IsParentFolder()); // position it correctly pMenu->OffsetPosition(posX, posY); pMenu->DoModal(); int btnid = pMenu->GetButton(); if (btnid == btn_SelectAll) { OnSelectAll(list); bDeselect=false; } if (btnid == btn_HandleFavourite) { CFavourites::AddOrRemove(pItem.get(), GetID()); return; } if (btnid == btn_PlayUsing) { VECPLAYERCORES vecCores; CPlayerCoreFactory::GetPlayers(*pItem, vecCores); g_application.m_eForcedNextPlayer = CPlayerCoreFactory::SelectPlayerDialog(vecCores); if (g_application.m_eForcedNextPlayer != EPC_NONE) OnStart(pItem.get()); } if (btnid == btn_Rename) OnRename(list); if (btnid == btn_Delete) OnDelete(list); if (btnid == btn_Copy) OnCopy(list); if (btnid == btn_Move) OnMove(list); if (btnid == btn_NewFolder) OnNewFolder(list); if (btnid == btn_Size) { // setup the progress dialog, and show it CGUIDialogProgress *progress = (CGUIDialogProgress *)m_gWindowManager.GetWindow(WINDOW_DIALOG_PROGRESS); if (progress) { progress->SetHeading(13394); for (int i=0; i < 3; i++) progress->SetLine(i, ""); progress->StartModal(); } // Calculate folder size for each selected item for (int i=0; i<m_vecItems[list]->Size(); ++i) { CFileItemPtr pItem2=m_vecItems[list]->Get(i); if (pItem2->m_bIsFolder && pItem2->IsSelected()) { __int64 folderSize = CalculateFolderSize(pItem2->m_strPath, progress); if (folderSize >= 0) { pItem2->m_dwSize = folderSize; if (folderSize == 0) pItem2->SetLabel2(StringUtils::SizeToString(folderSize)); else pItem2->SetFileSizeLabel(); } } } if (progress) progress->Close(); } if (btnid == btn_Settings) { m_gWindowManager.ActivateWindow(WINDOW_SETTINGS_MENU); return; } if (btnid == btn_GoToRoot) { Update(list,""); return; } if (btnid == btn_Switch) { CGUIDialogContextMenu::SwitchMedia("files", m_vecItems[list]->m_strPath); return; } if (bDeselect && item >= 0 && item < m_vecItems[list]->Size()) { // deselect item as we didn't do anything pItem->Select(false); } } }
bool CGUIWindowPrograms::OnChooseVideoModeAndLaunch(int item) { if (item < 0 || item >= m_vecItems->Size()) return false; // calculate our position float posX = 200; float posY = 100; const CGUIControl *pList = GetControl(CONTROL_LIST); if (pList) { posX = pList->GetXPosition() + pList->GetWidth() / 2; posY = pList->GetYPosition() + pList->GetHeight() / 2; } // grab the context menu CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); if (!pMenu) return false; pMenu->Initialize(); int btn_PAL; int btn_NTSCM; int btn_NTSCJ; int btn_PAL60; CStdString strPAL, strNTSCJ, strNTSCM, strPAL60; strPAL = "PAL"; strNTSCM = "NTSC-M"; strNTSCJ = "NTSC-J"; strPAL60 = "PAL-60"; int iRegion = GetRegion(item,true); if (iRegion == VIDEO_NTSCM) strNTSCM += " (default)"; if (iRegion == VIDEO_NTSCJ) strNTSCJ += " (default)"; if (iRegion == VIDEO_PAL50) strPAL += " (default)"; btn_PAL = pMenu->AddButton(strPAL); btn_NTSCM = pMenu->AddButton(strNTSCM); btn_NTSCJ = pMenu->AddButton(strNTSCJ); btn_PAL60 = pMenu->AddButton(strPAL60); pMenu->OffsetPosition(posX, posY); pMenu->DoModal(); int btnid = pMenu->GetButton(); if (btnid == btn_NTSCM) { m_iRegionSet = VIDEO_NTSCM; m_database.SetRegion(m_vecItems->Get(item)->GetPath(),1); } if (btnid == btn_NTSCJ) { m_iRegionSet = VIDEO_NTSCJ; m_database.SetRegion(m_vecItems->Get(item)->GetPath(),2); } if (btnid == btn_PAL) { m_iRegionSet = VIDEO_PAL50; m_database.SetRegion(m_vecItems->Get(item)->GetPath(),4); } if (btnid == btn_PAL60) { m_iRegionSet = VIDEO_PAL60; m_database.SetRegion(m_vecItems->Get(item)->GetPath(),8); } if (btnid > -1) return OnClick(item); return true; }