bool CGUISliderControl::OnAction(const CAction &action) { switch ( action.GetID() ) { case ACTION_MOVE_LEFT: //case ACTION_OSD_SHOW_VALUE_MIN: Move( -1); return true; break; case ACTION_MOVE_RIGHT: //case ACTION_OSD_SHOW_VALUE_PLUS: Move(1); return true; break; default: return CGUIControl::OnAction(action); } }
bool CGUIWindowSettingsScreenCalibration::OnAction(const CAction &action) { switch (action.GetID()) { case ACTION_CALIBRATE_SWAP_ARROWS: { NextControl(); return true; } break; case ACTION_CALIBRATE_RESET: { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); pDialog->SetHeading(20325); CStdString strText; strText.Format(g_localizeStrings.Get(20326).c_str(), g_settings.m_ResInfo[m_Res[m_iCurRes]].strMode.c_str()); pDialog->SetLine(0, strText); pDialog->SetLine(1, 20327); pDialog->SetChoice(0, 222); pDialog->SetChoice(1, 186); pDialog->DoModal(); if (pDialog->IsConfirmed()) { g_graphicsContext.ResetScreenParameters(m_Res[m_iCurRes]); ResetControls(); } return true; } break; case ACTION_CHANGE_RESOLUTION: // choose the next resolution in our list { m_iCurRes = (m_iCurRes+1) % m_Res.size(); g_graphicsContext.SetVideoResolution(m_Res[m_iCurRes]); ResetControls(); return true; } break; } return CGUIWindow::OnAction(action); // base class to handle basic movement etc. }
bool CGUIControl::OnAction(const CAction &action) { switch (action.GetID()) { case ACTION_MOVE_DOWN: if (!HasFocus()) return false; OnDown(); return true; break; case ACTION_MOVE_UP: if (!HasFocus()) return false; OnUp(); return true; break; case ACTION_MOVE_LEFT: if (!HasFocus()) return false; OnLeft(); return true; break; case ACTION_MOVE_RIGHT: if (!HasFocus()) return false; OnRight(); return true; break; case ACTION_NEXT_CONTROL: if (!HasFocus()) return false; OnNextControl(); return true; break; case ACTION_PREV_CONTROL: if (!HasFocus()) return false; OnPrevControl(); return true; break; } return false; }
bool CGUIDialogPeripheralManager::OnAction(const CAction &action) { int iActionId = action.GetID(); if (iActionId == ACTION_PREVIOUS_MENU || iActionId == ACTION_PARENT_DIR) { Close(); return true; } else if (GetFocusedControlID() == CONTROL_LIST && (iActionId == ACTION_MOVE_DOWN || iActionId == ACTION_MOVE_UP || iActionId == ACTION_PAGE_DOWN || iActionId == ACTION_PAGE_UP)) { CGUIDialog::OnAction(action); int iSelected = m_viewControl.GetSelectedItem(); if (iSelected != m_iSelected) m_iSelected = iSelected; UpdateButtons(); return true; } return CGUIDialog::OnAction(action); }
// OnMouseAction - called by OnAction() EVENT_RESULT CGUIWindow::OnMouseAction(const CAction &action) { g_graphicsContext.SetScalingResolution(m_coordsRes, m_needsScaling); CPoint mousePoint(action.GetAmount(0), action.GetAmount(1)); g_graphicsContext.InvertFinalCoords(mousePoint.x, mousePoint.y); // create the mouse event CMouseEvent event(action.GetID(), action.GetHoldTime(), action.GetAmount(2), action.GetAmount(3)); if (m_exclusiveMouseControl) { CGUIControl *child = (CGUIControl *)GetControl(m_exclusiveMouseControl); if (child) { CPoint renderPos = child->GetRenderPosition() - CPoint(child->GetXPosition(), child->GetYPosition()); return child->OnMouseEvent(mousePoint - renderPos, event); } } UnfocusFromPoint(mousePoint); return SendMouseEvent(mousePoint, event); }
bool CGUIControl::OnAction(const CAction &action) { if (HasFocus()) { switch (action.GetID()) { case ACTION_MOVE_DOWN: OnDown(); return true; case ACTION_MOVE_UP: OnUp(); return true; case ACTION_MOVE_LEFT: OnLeft(); return true; case ACTION_MOVE_RIGHT: OnRight(); return true; case ACTION_SHOW_INFO: return OnInfo(); case ACTION_NAV_BACK: return OnBack(); case ACTION_NEXT_CONTROL: OnNextControl(); return true; case ACTION_PREV_CONTROL: OnPrevControl(); return true; } } return false; }
bool CGUIDialogPVRItemsViewBase::OnAction(const CAction &action) { if (m_viewControl.HasControl(GetFocusedControlID())) { switch (action.GetID()) { case ACTION_SHOW_INFO: case ACTION_SELECT_ITEM: case ACTION_MOUSE_LEFT_CLICK: ShowInfo(m_viewControl.GetSelectedItem()); return true; case ACTION_CONTEXT_MENU: case ACTION_MOUSE_RIGHT_CLICK: return ContextMenu(m_viewControl.GetSelectedItem()); default: break; } } return CGUIDialog::OnAction(action); }
bool CGUIDialogPictureInfo::OnAction(const CAction& action) { switch (action.GetID()) { // if we're running from slideshow mode, drop the "next picture" and "previous picture" actions through. case ACTION_NEXT_PICTURE: case ACTION_PREV_PICTURE: case ACTION_PLAYER_PLAY: case ACTION_PAUSE: if (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW) { CGUIWindow* pWindow = g_windowManager.GetWindow(WINDOW_SLIDESHOW); return pWindow->OnAction(action); } break; case ACTION_SHOW_INFO: Close(); return true; }; return CGUIDialog::OnAction(action); }
bool CGUIVisualisationControl::OnAction(const CAction &action) { if (!m_addon) return false; switch (action.GetID()) { case ACTION_VIS_PRESET_NEXT: return m_addon->OnAction(VIS_ACTION_NEXT_PRESET); case ACTION_VIS_PRESET_PREV: return m_addon->OnAction(VIS_ACTION_PREV_PRESET); case ACTION_VIS_PRESET_RANDOM: return m_addon->OnAction(VIS_ACTION_RANDOM_PRESET); case ACTION_VIS_RATE_PRESET_PLUS: return m_addon->OnAction(VIS_ACTION_RATE_PRESET_PLUS); case ACTION_VIS_RATE_PRESET_MINUS: return m_addon->OnAction(VIS_ACTION_RATE_PRESET_MINUS); case ACTION_VIS_PRESET_LOCK: return m_addon->OnAction(VIS_ACTION_LOCK_PRESET); default: return CGUIRenderingControl::OnAction(action); } }
bool CSeekHandler::SeekTimeCode(const CAction &action) { if (m_timeCodePosition <= 0) return false; switch (action.GetID()) { case ACTION_SELECT_ITEM: case ACTION_PLAYER_PLAY: case ACTION_PAUSE: { CSingleLock lock(m_critSection); g_application.m_pPlayer->SeekTime(GetTimeCodeSeconds() * 1000); Reset(); return true; } case ACTION_SMALL_STEP_BACK: case ACTION_STEP_BACK: case ACTION_BIG_STEP_BACK: case ACTION_CHAPTER_OR_BIG_STEP_BACK: { SeekSeconds(-GetTimeCodeSeconds()); return true; } case ACTION_STEP_FORWARD: case ACTION_BIG_STEP_FORWARD: case ACTION_CHAPTER_OR_BIG_STEP_FORWARD: { SeekSeconds(GetTimeCodeSeconds()); return true; } default: break; } return false; }
bool CGUIScrollBar::OnAction(const CAction &action) { switch ( action.GetID() ) { case ACTION_MOVE_LEFT: if (m_orientation == HORIZONTAL) { Move( -1); return true; } break; case ACTION_MOVE_RIGHT: if (m_orientation == HORIZONTAL) { Move(1); return true; } break; case ACTION_MOVE_UP: if (m_orientation == VERTICAL) { Move(-1); return true; } break; case ACTION_MOVE_DOWN: if (m_orientation == VERTICAL) { Move(1); return true; } break; } return CGUIControl::OnAction(action); }
bool CGUIWindowTestPattern::OnAction(const CAction &action) { switch (action.GetID()) { case ACTION_PREVIOUS_MENU: { g_windowManager.PreviousWindow(); return true; } break; case ACTION_MOVE_UP: case ACTION_MOVE_LEFT: m_pattern = m_pattern > 0 ? m_pattern - 1 : TEST_PATTERNS_COUNT - 1; break; case ACTION_MOVE_DOWN: case ACTION_MOVE_RIGHT: m_pattern = (m_pattern + 1) % TEST_PATTERNS_COUNT; break; } return CGUIWindow::OnAction(action); // base class to handle basic movement etc. }
bool CGUISliderControl::OnAction(const CAction &action) { switch ( action.GetID() ) { case ACTION_MOVE_LEFT: Move(-1); return true; case ACTION_MOVE_RIGHT: Move(1); return true; case ACTION_SELECT_ITEM: // switch between the two sliders if (m_rangeSelection) SwitchRangeSelector(); return true; default: break; } return CGUIControl::OnAction(action); }
bool CRetroPlayer::OnAction(const CAction &action) { switch (action.GetID()) { case ACTION_PLAYER_RESET: { if (m_gameClient) { float speed = static_cast<float>(m_gameClient->GetPlayback()->GetSpeed()); m_gameClient->GetPlayback()->SetSpeed(0.0); m_gameServices.PortManager().HardwareReset(); // If rewinding or paused, begin playback if (speed <= 0.0f) speed = 1.0f; SetSpeed(speed); } return true; } case ACTION_SHOW_OSD: { if (m_gameClient && m_gameClient->GetPlayback()->GetSpeed() == 0.0) { CloseOSD(); return true; } } default: break; } return false; }
bool CGUIDialogKeyboardGeneric::OnAction(const CAction &action) { bool handled(true); if (action.GetID() == ACTION_BACKSPACE) { Backspace(); } else if (action.GetID() == ACTION_ENTER) { OnOK(); } else if (action.GetID() == ACTION_CURSOR_LEFT) { MoveCursor( -1); } else if (action.GetID() == ACTION_CURSOR_RIGHT) { MoveCursor(1); } else if (action.GetID() == ACTION_SHIFT) { OnShift(); } else if (action.GetID() == ACTION_SYMBOLS) { OnSymbols(); } else if (action.GetID() >= KEY_ASCII) { // send action to the edit control CGUIControl *edit = GetControl(CTL_EDIT); if (edit) edit->OnAction(action); } else // unhandled by us - let's see if the baseclass wants it handled = CGUIDialog::OnAction(action); return handled; }
bool CGUIBaseContainer::OnAction(const CAction &action) { if (action.GetID() >= KEY_ASCII) { OnJumpLetter((char)(action.GetID() & 0xff)); return true; } switch (action.GetID()) { case ACTION_MOVE_LEFT: case ACTION_MOVE_RIGHT: case ACTION_MOVE_DOWN: case ACTION_MOVE_UP: case ACTION_NAV_BACK: { if (!HasFocus()) return false; if (action.GetHoldTime() > HOLD_TIME_START && ((m_orientation == VERTICAL && (action.GetID() == ACTION_MOVE_UP || action.GetID() == ACTION_MOVE_DOWN)) || (m_orientation == HORIZONTAL && (action.GetID() == ACTION_MOVE_LEFT || action.GetID() == ACTION_MOVE_RIGHT)))) { // action is held down - repeat a number of times float speed = std::min(1.0f, (float)(action.GetHoldTime() - HOLD_TIME_START) / (HOLD_TIME_END - HOLD_TIME_START)); unsigned int itemsPerFrame = 1; if (m_lastHoldTime) // number of rows/10 items/second max speed itemsPerFrame = std::max((unsigned int)1, (unsigned int)(speed * 0.0001f * GetRows() * (CTimeUtils::GetFrameTime() - m_lastHoldTime))); m_lastHoldTime = CTimeUtils::GetFrameTime(); if (action.GetID() == ACTION_MOVE_LEFT || action.GetID() == ACTION_MOVE_UP) while (itemsPerFrame--) MoveUp(false); else while (itemsPerFrame--) MoveDown(false); return true; } else { m_lastHoldTime = 0; return CGUIControl::OnAction(action); } } break; case ACTION_FIRST_PAGE: SelectItem(0); return true; case ACTION_LAST_PAGE: if (m_items.size()) SelectItem(m_items.size() - 1); return true; case ACTION_NEXT_LETTER: { OnNextLetter(); return true; } break; case ACTION_PREV_LETTER: { OnPrevLetter(); return true; } break; case ACTION_JUMP_SMS2: case ACTION_JUMP_SMS3: case ACTION_JUMP_SMS4: case ACTION_JUMP_SMS5: case ACTION_JUMP_SMS6: case ACTION_JUMP_SMS7: case ACTION_JUMP_SMS8: case ACTION_JUMP_SMS9: { OnJumpSMS(action.GetID() - ACTION_JUMP_SMS2 + 2); return true; } break; default: if (action.GetID()) { return OnClick(action.GetID()); } } return false; }
bool CGUIWindowSlideShow::OnAction(const CAction &action) { switch (action.GetID()) { case ACTION_SHOW_INFO: { CGUIDialogPictureInfo *pictureInfo = (CGUIDialogPictureInfo *)g_windowManager.GetWindow(WINDOW_DIALOG_PICTURE_INFO); if (pictureInfo) { // no need to set the picture here, it's done in Render() pictureInfo->Open(); } } break; case ACTION_STOP: if (m_slides.size()) AnnouncePlayerStop(m_slides.at(m_iCurrentSlide)); if (g_application.m_pPlayer->IsPlayingVideo()) g_application.m_pPlayer->CloseFile(); Close(); break; case ACTION_NEXT_PICTURE: ShowNext(); break; case ACTION_PREV_PICTURE: ShowPrevious(); break; case ACTION_MOVE_RIGHT: if (m_iZoomFactor == 1 || !m_Image[m_iCurrentPic].m_bCanMoveHorizontally) ShowNext(); else Move(PICTURE_MOVE_AMOUNT, 0); break; case ACTION_MOVE_LEFT: if (m_iZoomFactor == 1 || !m_Image[m_iCurrentPic].m_bCanMoveHorizontally) ShowPrevious(); else Move( -PICTURE_MOVE_AMOUNT, 0); break; case ACTION_MOVE_DOWN: Move(0, PICTURE_MOVE_AMOUNT); break; case ACTION_MOVE_UP: Move(0, -PICTURE_MOVE_AMOUNT); break; case ACTION_PAUSE: case ACTION_PLAYER_PLAY: if (m_slides.size() == 0) break; if (m_slides.at(m_iCurrentSlide)->IsVideo()) { if (!m_bPlayingVideo) { if (m_bSlideShow) { SetDirection(1); m_bPause = false; } PlayVideo(); } } else if (!m_bSlideShow || m_bPause) { m_bSlideShow = true; m_bPause = false; SetDirection(1); if (m_Image[m_iCurrentPic].IsLoaded()) { CSlideShowPic::DISPLAY_EFFECT effect = GetDisplayEffect(m_iCurrentSlide); if (m_Image[m_iCurrentPic].DisplayEffectNeedChange(effect)) m_Image[m_iCurrentPic].Reset(effect); } AnnouncePlayerPlay(m_slides.at(m_iCurrentSlide)); } else if (action.GetID() == ACTION_PAUSE) { m_bPause = true; AnnouncePlayerPause(m_slides.at(m_iCurrentSlide)); } else if (m_iZoomFactor > 1) Zoom(1); //Back to normal zoom and continue slideshow break; case ACTION_ZOOM_OUT: Zoom(m_iZoomFactor - 1); break; case ACTION_ZOOM_IN: Zoom(m_iZoomFactor + 1); break; case ACTION_GESTURE_SWIPE_UP: case ACTION_GESTURE_SWIPE_DOWN: if (m_iZoomFactor == 1 || !m_Image[m_iCurrentPic].m_bCanMoveVertically) { bool swipeOnLeft = action.GetAmount() < g_graphicsContext.GetWidth() / 2.0f; bool swipeUp = action.GetID() == ACTION_GESTURE_SWIPE_UP; if (swipeUp == swipeOnLeft) Rotate(90.0f); else Rotate(-90.0f); } break; case ACTION_ROTATE_PICTURE_CW: Rotate(90.0f); break; case ACTION_ROTATE_PICTURE_CCW: Rotate(-90.0f); break; case ACTION_ZOOM_LEVEL_NORMAL: case ACTION_ZOOM_LEVEL_1: case ACTION_ZOOM_LEVEL_2: case ACTION_ZOOM_LEVEL_3: case ACTION_ZOOM_LEVEL_4: case ACTION_ZOOM_LEVEL_5: case ACTION_ZOOM_LEVEL_6: case ACTION_ZOOM_LEVEL_7: case ACTION_ZOOM_LEVEL_8: case ACTION_ZOOM_LEVEL_9: Zoom((action.GetID() - ACTION_ZOOM_LEVEL_NORMAL) + 1); break; case ACTION_ANALOG_MOVE: // this action is used and works, when CAction object provides both x and y coordinates Move(action.GetAmount()*PICTURE_MOVE_AMOUNT_ANALOG, -action.GetAmount(1)*PICTURE_MOVE_AMOUNT_ANALOG); break; case ACTION_ANALOG_MOVE_X: // this and following action are used and work, when CAction object provides either x of y coordinate Move(action.GetAmount()*PICTURE_MOVE_AMOUNT_ANALOG, 0.0f); break; case ACTION_ANALOG_MOVE_Y: Move(0.0f, action.GetAmount(0)*PICTURE_MOVE_AMOUNT_ANALOG); break; default: return CGUIDialog::OnAction(action); } return true; }
bool CGUIWindowFileManager::OnAction(const CAction &action) { /* 歌方: 1、 卦指: 1、 傍苧: 1、 */ int list = GetFocusedList(); if (list >= 0 && list <= 1) { int item; // the non-contextual menu can be called at any time if (action.GetID() == ACTION_CONTEXT_MENU && m_vecItems[list]->Size() == 0) { OnPopupMenu(list,-1, false); return true; } if (action.GetID() == ACTION_DELETE_ITEM) { if (CanDelete(list)) { bool bDeselect = SelectItem(list, item); OnDelete(list); if (bDeselect) m_vecItems[list]->Get(item)->Select(false); } return true; } if (action.GetID() == ACTION_COPY_ITEM) { if (CanCopy(list)) { bool bDeselect = SelectItem(list, item); OnCopy(list); if (bDeselect) m_vecItems[list]->Get(item)->Select(false); } return true; } if (action.GetID() == ACTION_MOVE_ITEM) { if (CanMove(list)) { bool bDeselect = SelectItem(list, item); OnMove(list); if (bDeselect) m_vecItems[list]->Get(item)->Select(false); } return true; } if (action.GetID() == ACTION_RENAME_ITEM) { if (CanRename(list)) { bool bDeselect = SelectItem(list, item); OnRename(list); if (bDeselect) m_vecItems[list]->Get(item)->Select(false); } return true; } if (action.GetID() == ACTION_PARENT_DIR) { GoParentFolder(list); return true; } if (action.GetID() == ACTION_PLAYER_PLAY) { #ifdef HAS_DVD_DRIVE if (m_vecItems[list]->Get(GetSelectedItem(list))->IsDVD()) return MEDIA_DETECT::CAutorun::PlayDiscAskResume(m_vecItems[list]->Get(GetSelectedItem(list))->GetPath()); #endif } } return CGUIWindow::OnAction(action); }
bool CSeekHandler::OnAction(const CAction &action) { if (!g_application.m_pPlayer->IsPlaying() || !g_application.m_pPlayer->CanSeek()) return false; SeekType type = g_application.CurrentFileItem().IsAudio() ? SEEK_TYPE_MUSIC : SEEK_TYPE_VIDEO; if (SeekTimeCode(action)) return true; switch (action.GetID()) { case ACTION_SMALL_STEP_BACK: case ACTION_STEP_BACK: { Seek(false, action.GetAmount(), action.GetRepeat(), false, type); return true; } case ACTION_STEP_FORWARD: { Seek(true, action.GetAmount(), action.GetRepeat(), false, type); return true; } case ACTION_BIG_STEP_BACK: case ACTION_CHAPTER_OR_BIG_STEP_BACK: { g_application.m_pPlayer->Seek(false, true, action.GetID() == ACTION_CHAPTER_OR_BIG_STEP_BACK); return true; } case ACTION_BIG_STEP_FORWARD: case ACTION_CHAPTER_OR_BIG_STEP_FORWARD: { g_application.m_pPlayer->Seek(true, true, action.GetID() == ACTION_CHAPTER_OR_BIG_STEP_FORWARD); return true; } case ACTION_NEXT_SCENE: { g_application.m_pPlayer->SeekScene(true); return true; } case ACTION_PREV_SCENE: { g_application.m_pPlayer->SeekScene(false); return true; } case ACTION_ANALOG_SEEK_FORWARD: case ACTION_ANALOG_SEEK_BACK: { if (action.GetAmount()) Seek(action.GetID() == ACTION_ANALOG_SEEK_FORWARD, action.GetAmount(), action.GetRepeat(), true); return true; } case REMOTE_0: case REMOTE_1: case REMOTE_2: case REMOTE_3: case REMOTE_4: case REMOTE_5: case REMOTE_6: case REMOTE_7: case REMOTE_8: case REMOTE_9: { if (!g_application.CurrentFileItem().IsLiveTV()) { ChangeTimeCode(action.GetID()); return true; } } break; default: break; } return false; }
bool CStereoscopicsManager::OnAction(const CAction &action) { RENDER_STEREO_MODE mode = GetStereoMode(); if (action.GetID() == ACTION_STEREOMODE_NEXT) { SetStereoModeByUser(GetNextSupportedStereoMode(mode)); return true; } else if (action.GetID() == ACTION_STEREOMODE_PREVIOUS) { SetStereoModeByUser(GetNextSupportedStereoMode(mode, RENDER_STEREO_MODE_COUNT - 1)); return true; } else if (action.GetID() == ACTION_STEREOMODE_TOGGLE) { if (mode == RENDER_STEREO_MODE_OFF) { RENDER_STEREO_MODE targetMode = GetPreferredPlaybackMode(); // if user selected a specific mode before, make sure to // switch back into that mode on toggle. if (m_stereoModeSetByUser != RENDER_STEREO_MODE_UNDEFINED) { // if user mode is set to OFF, he manually turned it off before. In this case use the last user applied mode if (m_stereoModeSetByUser != RENDER_STEREO_MODE_OFF) targetMode = m_stereoModeSetByUser; else if (m_lastStereoModeSetByUser != RENDER_STEREO_MODE_UNDEFINED && m_lastStereoModeSetByUser != RENDER_STEREO_MODE_OFF) targetMode = m_lastStereoModeSetByUser; } SetStereoModeByUser(targetMode); } else { SetStereoModeByUser(RENDER_STEREO_MODE_OFF); } return true; } else if (action.GetID() == ACTION_STEREOMODE_SELECT) { SetStereoModeByUser(GetStereoModeByUserChoice()); return true; } else if (action.GetID() == ACTION_STEREOMODE_TOMONO) { if (mode == RENDER_STEREO_MODE_MONO) { RENDER_STEREO_MODE targetMode = GetPreferredPlaybackMode(); // if we have an old userdefined steremode, use that one as toggle target if (m_stereoModeSetByUser != RENDER_STEREO_MODE_UNDEFINED) { // if user mode is set to OFF, he manually turned it off before. In this case use the last user applied mode if (m_stereoModeSetByUser != RENDER_STEREO_MODE_OFF && m_stereoModeSetByUser != mode) targetMode = m_stereoModeSetByUser; else if (m_lastStereoModeSetByUser != RENDER_STEREO_MODE_UNDEFINED && m_lastStereoModeSetByUser != RENDER_STEREO_MODE_OFF && m_lastStereoModeSetByUser != mode) targetMode = m_lastStereoModeSetByUser; } SetStereoModeByUser(targetMode); } else { SetStereoModeByUser(RENDER_STEREO_MODE_MONO); } return true; } else if (action.GetID() == ACTION_STEREOMODE_SET) { int stereoMode = ConvertStringToGuiStereoMode(action.GetName()); if (stereoMode > -1) SetStereoModeByUser( (RENDER_STEREO_MODE) stereoMode ); return true; } return false; }
bool CGUISpinControl::OnAction(const CAction &action) { switch (action.GetID()) { case REMOTE_0: case REMOTE_1: case REMOTE_2: case REMOTE_3: case REMOTE_4: case REMOTE_5: case REMOTE_6: case REMOTE_7: case REMOTE_8: case REMOTE_9: { if (strlen(m_szTyped) >= 3) { m_iTypedPos = 0; strcpy(m_szTyped, ""); } int iNumber = action.GetID() - REMOTE_0; m_szTyped[m_iTypedPos] = iNumber + '0'; m_iTypedPos++; m_szTyped[m_iTypedPos] = 0; int iValue; sscanf(m_szTyped, "%i", &iValue); switch (m_iType) { case SPIN_CONTROL_TYPE_INT: { if (iValue < m_iStart || iValue > m_iEnd) { m_iTypedPos = 0; m_szTyped[m_iTypedPos] = iNumber + '0'; m_iTypedPos++; m_szTyped[m_iTypedPos] = 0; sscanf(m_szTyped, "%i", &iValue); if (iValue < m_iStart || iValue > m_iEnd) { m_iTypedPos = 0; strcpy(m_szTyped, ""); return true; } } m_iValue = iValue; CGUIMessage msg(GUI_MSG_CLICKED, GetID(), GetParentID()); SendWindowMessage(msg); } break; case SPIN_CONTROL_TYPE_TEXT: { if (iValue < 0 || iValue >= (int)m_vecLabels.size()) { m_iTypedPos = 0; m_szTyped[m_iTypedPos] = iNumber + '0'; m_iTypedPos++; m_szTyped[m_iTypedPos] = 0; sscanf(m_szTyped, "%i", &iValue); if (iValue < 0 || iValue >= (int)m_vecLabels.size()) { m_iTypedPos = 0; strcpy(m_szTyped, ""); return true; } } m_iValue = iValue; CGUIMessage msg(GUI_MSG_CLICKED, GetID(), GetParentID()); SendWindowMessage(msg); } break; } return true; } break; case ACTION_PAGE_UP: if (!m_bReverse) PageDown(); else PageUp(); return true; break; case ACTION_PAGE_DOWN: if (!m_bReverse) PageUp(); else PageDown(); return true; break; case ACTION_SELECT_ITEM: if (m_iSelect == SPIN_BUTTON_UP) { MoveUp(); return true; } if (m_iSelect == SPIN_BUTTON_DOWN) { MoveDown(); return true; } break; } /* static float m_fSmoothScrollOffset = 0.0f; if (action.GetID() == ACTION_SCROLL_UP) { m_fSmoothScrollOffset += action.GetAmount() * action.GetAmount(); bool handled = false; while (m_fSmoothScrollOffset > 0.4) { handled = true; m_fSmoothScrollOffset -= 0.4f; MoveDown(); } return handled; }*/ return CGUIControl::OnAction(action); }
bool CGUIWindowFullScreen::OnAction(const CAction &action) { if (g_application.m_pPlayer != NULL && g_application.m_pPlayer->OnAction(action)) return true; if (m_timeCodePosition > 0 && action.GetButtonCode()) { // check whether we have a mapping in our virtual videotimeseek "window" and have a select action CKey key(action.GetButtonCode()); CAction timeSeek = CButtonTranslator::GetInstance().GetAction(WINDOW_VIDEO_TIME_SEEK, key, false); if (timeSeek.GetID() == ACTION_SELECT_ITEM) { SeekToTimeCodeStamp(SEEK_ABSOLUTE); return true; } } const unsigned int MsgTime = 300; const unsigned int DisplTime = 2000; switch (action.GetID()) { case ACTION_SHOW_OSD: ToggleOSD(); return true; case ACTION_SHOW_GUI: { // switch back to the menu OutputDebugString("Switching to GUI\n"); g_windowManager.PreviousWindow(); OutputDebugString("Now in GUI\n"); return true; } break; case ACTION_PLAYER_PLAY: case ACTION_PAUSE: if (m_timeCodePosition > 0) { SeekToTimeCodeStamp(SEEK_ABSOLUTE); return true; } break; case ACTION_STEP_BACK: if (!g_application.CurrentFileItem().HasPVRChannelInfoTag()) { if (m_timeCodePosition > 0) SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_BACKWARD); else g_application.m_pPlayer->Seek(false, false); } else SeekTV(false, false); return true; case ACTION_STEP_FORWARD: if (!g_application.CurrentFileItem().HasPVRChannelInfoTag()) { if (m_timeCodePosition > 0) SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_FORWARD); else g_application.m_pPlayer->Seek(true, false); } else SeekTV(true, false); return true; case ACTION_BIG_STEP_BACK: if (!g_application.CurrentFileItem().HasPVRChannelInfoTag()) { if (m_timeCodePosition > 0) SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_BACKWARD); else g_application.m_pPlayer->Seek(false, true); } else SeekTV(false, true); return true; case ACTION_BIG_STEP_FORWARD: if (!g_application.CurrentFileItem().HasPVRChannelInfoTag()) { if (m_timeCodePosition > 0) SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_FORWARD); else g_application.m_pPlayer->Seek(true, true); } else SeekTV(true, true); return true; case ACTION_NEXT_SCENE: if (g_application.m_pPlayer->SeekScene(true)) g_infoManager.SetDisplayAfterSeek(); return true; break; case ACTION_PREV_SCENE: if (g_application.m_pPlayer->SeekScene(false)) g_infoManager.SetDisplayAfterSeek(); return true; break; case ACTION_SHOW_OSD_TIME: m_bShowCurrentTime = !m_bShowCurrentTime; if(!m_bShowCurrentTime) g_infoManager.SetDisplayAfterSeek(0); //Force display off g_infoManager.SetShowTime(m_bShowCurrentTime); return true; break; case ACTION_SHOW_SUBTITLES: { if (g_application.m_pPlayer->GetSubtitleCount() == 0) return true; g_settings.m_currentVideoSettings.m_SubtitleOn = !g_settings.m_currentVideoSettings.m_SubtitleOn; g_application.m_pPlayer->SetSubtitleVisible(g_settings.m_currentVideoSettings.m_SubtitleOn); CStdString sub, lang; if (g_settings.m_currentVideoSettings.m_SubtitleOn) { g_application.m_pPlayer->GetSubtitleName(g_application.m_pPlayer->GetSubtitle(),sub); g_application.m_pPlayer->GetSubtitleLanguage(g_application.m_pPlayer->GetSubtitle(),lang); if (sub != lang) sub.Format("%s [%s]", sub.c_str(), lang.c_str()); } else sub = g_localizeStrings.Get(1223); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(287), sub, DisplTime, false, MsgTime); } return true; break; case ACTION_SHOW_INFO: { CGUIDialogFullScreenInfo* pDialog = (CGUIDialogFullScreenInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO); if (pDialog) { CFileItem item(g_application.CurrentFileItem()); pDialog->DoModal(); return true; } break; } case ACTION_NEXT_SUBTITLE: { if (g_application.m_pPlayer->GetSubtitleCount() == 0) return true; if(g_settings.m_currentVideoSettings.m_SubtitleStream < 0) g_settings.m_currentVideoSettings.m_SubtitleStream = g_application.m_pPlayer->GetSubtitle(); if (g_settings.m_currentVideoSettings.m_SubtitleOn) { g_settings.m_currentVideoSettings.m_SubtitleStream++; if (g_settings.m_currentVideoSettings.m_SubtitleStream >= g_application.m_pPlayer->GetSubtitleCount()) { g_settings.m_currentVideoSettings.m_SubtitleStream = 0; g_settings.m_currentVideoSettings.m_SubtitleOn = false; g_application.m_pPlayer->SetSubtitleVisible(false); } g_application.m_pPlayer->SetSubtitle(g_settings.m_currentVideoSettings.m_SubtitleStream); } else { g_settings.m_currentVideoSettings.m_SubtitleOn = true; g_application.m_pPlayer->SetSubtitleVisible(true); } CStdString sub, lang; if (g_settings.m_currentVideoSettings.m_SubtitleOn) { g_application.m_pPlayer->GetSubtitleName(g_settings.m_currentVideoSettings.m_SubtitleStream,sub); g_application.m_pPlayer->GetSubtitleLanguage(g_settings.m_currentVideoSettings.m_SubtitleStream,lang); if (sub != lang) sub.Format("%s [%s]", sub.c_str(), lang.c_str()); } else sub = g_localizeStrings.Get(1223); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(287), sub, DisplTime, false, MsgTime); } return true; break; case ACTION_SUBTITLE_DELAY_MIN: g_settings.m_currentVideoSettings.m_SubtitleDelay -= 0.1f; if (g_settings.m_currentVideoSettings.m_SubtitleDelay < -g_advancedSettings.m_videoSubsDelayRange) g_settings.m_currentVideoSettings.m_SubtitleDelay = -g_advancedSettings.m_videoSubsDelayRange; if (g_application.m_pPlayer) g_application.m_pPlayer->SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay); ShowSlider(action.GetID(), 22006, g_settings.m_currentVideoSettings.m_SubtitleDelay, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange); return true; break; case ACTION_SUBTITLE_DELAY_PLUS: g_settings.m_currentVideoSettings.m_SubtitleDelay += 0.1f; if (g_settings.m_currentVideoSettings.m_SubtitleDelay > g_advancedSettings.m_videoSubsDelayRange) g_settings.m_currentVideoSettings.m_SubtitleDelay = g_advancedSettings.m_videoSubsDelayRange; if (g_application.m_pPlayer) g_application.m_pPlayer->SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay); ShowSlider(action.GetID(), 22006, g_settings.m_currentVideoSettings.m_SubtitleDelay, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange); return true; break; case ACTION_SUBTITLE_DELAY: ShowSlider(action.GetID(), 22006, g_settings.m_currentVideoSettings.m_SubtitleDelay, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange, true); return true; break; case ACTION_AUDIO_DELAY: ShowSlider(action.GetID(), 297, g_settings.m_currentVideoSettings.m_AudioDelay, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange, true); return true; break; case ACTION_AUDIO_DELAY_MIN: g_settings.m_currentVideoSettings.m_AudioDelay -= 0.025f; if (g_settings.m_currentVideoSettings.m_AudioDelay < -g_advancedSettings.m_videoAudioDelayRange) g_settings.m_currentVideoSettings.m_AudioDelay = -g_advancedSettings.m_videoAudioDelayRange; if (g_application.m_pPlayer) g_application.m_pPlayer->SetAVDelay(g_settings.m_currentVideoSettings.m_AudioDelay); ShowSlider(action.GetID(), 297, g_settings.m_currentVideoSettings.m_AudioDelay, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange); return true; break; case ACTION_AUDIO_DELAY_PLUS: g_settings.m_currentVideoSettings.m_AudioDelay += 0.025f; if (g_settings.m_currentVideoSettings.m_AudioDelay > g_advancedSettings.m_videoAudioDelayRange) g_settings.m_currentVideoSettings.m_AudioDelay = g_advancedSettings.m_videoAudioDelayRange; if (g_application.m_pPlayer) g_application.m_pPlayer->SetAVDelay(g_settings.m_currentVideoSettings.m_AudioDelay); ShowSlider(action.GetID(), 297, g_settings.m_currentVideoSettings.m_AudioDelay, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange); return true; break; case ACTION_AUDIO_NEXT_LANGUAGE: { if (g_application.m_pPlayer->GetAudioStreamCount() == 1) return true; if(g_settings.m_currentVideoSettings.m_AudioStream < 0) g_settings.m_currentVideoSettings.m_AudioStream = g_application.m_pPlayer->GetAudioStream(); g_settings.m_currentVideoSettings.m_AudioStream++; if (g_settings.m_currentVideoSettings.m_AudioStream >= g_application.m_pPlayer->GetAudioStreamCount()) g_settings.m_currentVideoSettings.m_AudioStream = 0; g_application.m_pPlayer->SetAudioStream(g_settings.m_currentVideoSettings.m_AudioStream); // Set the audio stream to the one selected CStdString aud; g_application.m_pPlayer->GetAudioStreamName(g_settings.m_currentVideoSettings.m_AudioStream,aud); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(460), aud, DisplTime, false, MsgTime); return true; } break; case REMOTE_0: case REMOTE_1: case REMOTE_2: case REMOTE_3: case REMOTE_4: case REMOTE_5: case REMOTE_6: case REMOTE_7: case REMOTE_8: case REMOTE_9: { if (g_application.CurrentFileItem().IsLiveTV()) { CPVRChannelPtr channel; int iChannelNumber = -1; g_PVRManager.GetCurrentChannel(channel); if (action.GetID() == REMOTE_0) { iChannelNumber = g_PVRManager.GetPreviousChannel(); if (iChannelNumber > 0) CLog::Log(LOGDEBUG, "switch to channel number %d", iChannelNumber); else CLog::Log(LOGDEBUG, "no previous channel number found"); } else { int autoCloseTime = g_guiSettings.GetBool("pvrplayback.switchautoclose") ? 1500 : 0; CStdString strChannel; strChannel.Format("%i", action.GetID() - REMOTE_0); if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000), autoCloseTime) || autoCloseTime) iChannelNumber = atoi(strChannel.c_str()); } if (iChannelNumber > 0 && iChannelNumber != channel->ChannelNumber()) { CPVRChannelGroupPtr selectedGroup = g_PVRManager.GetPlayingGroup(channel->IsRadio()); CFileItemPtr channel = selectedGroup->GetByChannelNumber(iChannelNumber); if (!channel || !channel->HasPVRChannelInfoTag()) return false; OnAction(CAction(ACTION_CHANNEL_SWITCH, (float)iChannelNumber)); } } else { ChangetheTimeCode(action.GetID()); } return true; } break; case ACTION_ASPECT_RATIO: { // toggle the aspect ratio mode (only if the info is onscreen) if (m_bShowViewModeInfo) { #ifdef HAS_VIDEO_PLAYBACK g_renderManager.SetViewMode(++g_settings.m_currentVideoSettings.m_ViewMode); #endif } m_bShowViewModeInfo = true; m_dwShowViewModeTimeout = XbmcThreads::SystemClockMillis(); } return true; break; case ACTION_SMALL_STEP_BACK: if (m_timeCodePosition > 0) SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_BACKWARD); else { int orgpos = (int)g_application.GetTime(); int jumpsize = g_advancedSettings.m_videoSmallStepBackSeconds; // secs int setpos = (orgpos > jumpsize) ? orgpos - jumpsize : 0; g_application.SeekTime((double)setpos); } return true; break; case ACTION_SHOW_PLAYLIST: { CFileItem item(g_application.CurrentFileItem()); if (item.HasPVRChannelInfoTag()) g_windowManager.ActivateWindow(WINDOW_DIALOG_PVR_OSD_CHANNELS); else if (item.HasVideoInfoTag()) g_windowManager.ActivateWindow(WINDOW_VIDEO_PLAYLIST); else if (item.HasMusicInfoTag()) g_windowManager.ActivateWindow(WINDOW_MUSIC_PLAYLIST); } return true; break; case ACTION_ZOOM_IN: { g_settings.m_currentVideoSettings.m_CustomZoomAmount += 0.01f; if (g_settings.m_currentVideoSettings.m_CustomZoomAmount > 2.f) g_settings.m_currentVideoSettings.m_CustomZoomAmount = 2.f; g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM; g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); ShowSlider(action.GetID(), 216, g_settings.m_currentVideoSettings.m_CustomZoomAmount, 0.5f, 0.1f, 2.0f); } return true; break; case ACTION_ZOOM_OUT: { g_settings.m_currentVideoSettings.m_CustomZoomAmount -= 0.01f; if (g_settings.m_currentVideoSettings.m_CustomZoomAmount < 0.5f) g_settings.m_currentVideoSettings.m_CustomZoomAmount = 0.5f; g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM; g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); ShowSlider(action.GetID(), 216, g_settings.m_currentVideoSettings.m_CustomZoomAmount, 0.5f, 0.1f, 2.0f); } return true; break; case ACTION_INCREASE_PAR: { g_settings.m_currentVideoSettings.m_CustomPixelRatio += 0.01f; if (g_settings.m_currentVideoSettings.m_CustomPixelRatio > 2.f) g_settings.m_currentVideoSettings.m_CustomZoomAmount = 2.f; g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM; g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); ShowSlider(action.GetID(), 217, g_settings.m_currentVideoSettings.m_CustomPixelRatio, 0.5f, 0.1f, 2.0f); } return true; break; case ACTION_DECREASE_PAR: { g_settings.m_currentVideoSettings.m_CustomPixelRatio -= 0.01f; if (g_settings.m_currentVideoSettings.m_CustomZoomAmount < 0.5f) g_settings.m_currentVideoSettings.m_CustomPixelRatio = 0.5f; g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM; g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); ShowSlider(action.GetID(), 217, g_settings.m_currentVideoSettings.m_CustomPixelRatio, 0.5f, 0.1f, 2.0f); } return true; break; case ACTION_VSHIFT_UP: { g_settings.m_currentVideoSettings.m_CustomVerticalShift -= 0.01f; if (g_settings.m_currentVideoSettings.m_CustomVerticalShift < -2.0f) g_settings.m_currentVideoSettings.m_CustomVerticalShift = -2.0f; g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM; g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); ShowSlider(action.GetID(), 225, g_settings.m_currentVideoSettings.m_CustomVerticalShift, -2.0f, 0.1f, 2.0f); } return true; break; case ACTION_VSHIFT_DOWN: { g_settings.m_currentVideoSettings.m_CustomVerticalShift += 0.01f; if (g_settings.m_currentVideoSettings.m_CustomVerticalShift > 2.0f) g_settings.m_currentVideoSettings.m_CustomVerticalShift = 2.0f; g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM; g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); ShowSlider(action.GetID(), 225, g_settings.m_currentVideoSettings.m_CustomVerticalShift, -2.0f, 0.1f, 2.0f); } return true; break; case ACTION_SUBTITLE_VSHIFT_UP: { RESOLUTION_INFO& res_info = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()]; int subalign = g_guiSettings.GetInt("subtitles.align"); if ((subalign == SUBTITLE_ALIGN_BOTTOM_OUTSIDE) || (subalign == SUBTITLE_ALIGN_TOP_INSIDE)) { res_info.iSubtitles ++; if (res_info.iSubtitles >= res_info.iHeight) res_info.iSubtitles = res_info.iHeight - 1; ShowSlider(action.GetID(), 274, (float) res_info.iHeight - res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); } else { res_info.iSubtitles --; if (res_info.iSubtitles < 0) res_info.iSubtitles = 0; if (subalign == SUBTITLE_ALIGN_MANUAL) ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); else ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles - res_info.iHeight, (float) -res_info.iHeight, -1.0f, 0.0f); } break; } case ACTION_SUBTITLE_VSHIFT_DOWN: { RESOLUTION_INFO& res_info = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()]; int subalign = g_guiSettings.GetInt("subtitles.align"); if ((subalign == SUBTITLE_ALIGN_BOTTOM_OUTSIDE) || (subalign == SUBTITLE_ALIGN_TOP_INSIDE)) { res_info.iSubtitles--; if (res_info.iSubtitles < 0) res_info.iSubtitles = 0; ShowSlider(action.GetID(), 274, (float) res_info.iHeight - res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); } else { res_info.iSubtitles++; if (res_info.iSubtitles >= res_info.iHeight) res_info.iSubtitles = res_info.iHeight - 1; if (subalign == SUBTITLE_ALIGN_MANUAL) ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); else ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles - res_info.iHeight, (float) -res_info.iHeight, -1.0f, 0.0f); } break; } case ACTION_SUBTITLE_ALIGN: { RESOLUTION_INFO& res_info = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()]; int subalign = g_guiSettings.GetInt("subtitles.align"); subalign++; if (subalign > SUBTITLE_ALIGN_TOP_OUTSIDE) subalign = SUBTITLE_ALIGN_MANUAL; res_info.iSubtitles = res_info.iHeight - 1; g_guiSettings.SetInt("subtitles.align", subalign); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(21460), g_localizeStrings.Get(21461 + subalign), TOAST_DISPLAY_TIME, false); break; } case ACTION_VOLAMP_UP: case ACTION_VOLAMP_DOWN: { float sliderMax = VOLUME_DRC_MAXIMUM / 100.0f; float sliderMin = VOLUME_DRC_MINIMUM / 100.0f; if (action.GetID() == ACTION_VOLAMP_UP) g_settings.m_currentVideoSettings.m_VolumeAmplification += 1.0f; else g_settings.m_currentVideoSettings.m_VolumeAmplification -= 1.0f; g_settings.m_currentVideoSettings.m_VolumeAmplification = std::max(std::min(g_settings.m_currentVideoSettings.m_VolumeAmplification, sliderMax), sliderMin); if (g_application.m_pPlayer) g_application.m_pPlayer->SetDynamicRangeCompression((long)(g_settings.m_currentVideoSettings.m_VolumeAmplification * 100)); ShowSlider(action.GetID(), 660, g_settings.m_currentVideoSettings.m_VolumeAmplification, sliderMin, 1.0f, sliderMax); break; } default: break; } return CGUIWindow::OnAction(action); }
bool CGUIDialogGamepad::OnAction(const CAction &action) { if ((action.GetButtonCode() >= KEY_BUTTON_A && action.GetButtonCode() <= KEY_BUTTON_RIGHT_TRIGGER) || (action.GetButtonCode() >= KEY_BUTTON_DPAD_UP && action.GetButtonCode() <= KEY_BUTTON_DPAD_RIGHT) || (action.GetID() >= ACTION_MOVE_LEFT && action.GetID() <= ACTION_MOVE_DOWN) || action.GetID() == ACTION_PLAYER_PLAY ) { switch (action.GetButtonCode()) { case KEY_BUTTON_A : m_strUserInput += "A"; break; case KEY_BUTTON_B : m_strUserInput += "B"; break; case KEY_BUTTON_X : m_strUserInput += "X"; break; case KEY_BUTTON_Y : m_strUserInput += "Y"; break; case KEY_BUTTON_BLACK : m_strUserInput += "K"; break; case KEY_BUTTON_WHITE : m_strUserInput += "W"; break; case KEY_BUTTON_LEFT_TRIGGER : m_strUserInput += "("; break; case KEY_BUTTON_RIGHT_TRIGGER : m_strUserInput += ")"; break; case KEY_BUTTON_DPAD_UP : m_strUserInput += "U"; break; case KEY_BUTTON_DPAD_DOWN : m_strUserInput += "D"; break; case KEY_BUTTON_DPAD_LEFT : m_strUserInput += "L"; break; case KEY_BUTTON_DPAD_RIGHT : m_strUserInput += "R"; break; default: switch (action.GetID()) { case ACTION_MOVE_LEFT: m_strUserInput += "L"; break; case ACTION_MOVE_RIGHT: m_strUserInput += "R"; break; case ACTION_MOVE_UP: m_strUserInput += "U"; break; case ACTION_MOVE_DOWN: m_strUserInput += "D"; break; case ACTION_PLAYER_PLAY: m_strUserInput += "P"; break; default: return true; } break; } std::string strHiddenInput(m_strUserInput); for (int i = 0; i < (int)strHiddenInput.size(); i++) { strHiddenInput[i] = m_cHideInputChar; } SetLine(2, CVariant{std::move(strHiddenInput)}); return true; } else if (action.GetButtonCode() == KEY_BUTTON_BACK || action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_NAV_BACK) { m_bConfirmed = false; m_bCanceled = true; m_strUserInput = ""; m_bHideInputChars = true; Close(); return true; } else if (action.GetButtonCode() == KEY_BUTTON_START || action.GetID() == ACTION_SELECT_ITEM) { m_bConfirmed = false; m_bCanceled = false; std::string md5pword2 = XBMC::XBMC_MD5::GetMD5(m_strUserInput); if (!StringUtils::EqualsNoCase(m_strPassword, md5pword2)) { // incorrect password entered m_iRetries--; // don't clean up if the calling code wants the bad user input if (m_bUserInputCleanup) m_strUserInput = ""; else m_bUserInputCleanup = true; m_bHideInputChars = true; Close(); return true; } // correct password entered m_bConfirmed = true; m_iRetries = 0; m_strUserInput = ""; m_bHideInputChars = true; Close(); return true; } else if (action.GetID() >= REMOTE_0 && action.GetID() <= REMOTE_9) { return true; // unhandled } else { return CGUIDialog::OnAction(action); } }
bool CGUIPanelContainer::OnAction(const CAction &action) { switch (action.GetID()) { case ACTION_PAGE_UP: { if (GetOffset() == 0) { // already on the first page, so move to the first item SetCursor(0); } else { // scroll up to the previous page Scroll( -m_itemsPerPage); } return true; } break; case ACTION_PAGE_DOWN: { if ((GetOffset() + m_itemsPerPage) * m_itemsPerRow >= (int)m_items.size() || (int)m_items.size() < m_itemsPerPage) { // already at the last page, so move to the last item. SetCursor(m_items.size() - GetOffset() * m_itemsPerRow - 1); } else { // scroll down to the next page Scroll(m_itemsPerPage); } return true; } break; // smooth scrolling (for analog controls) case ACTION_SCROLL_UP: { m_analogScrollCount += action.GetAmount() * action.GetAmount(); bool handled = false; while (m_analogScrollCount > AnalogScrollSpeed()) { handled = true; m_analogScrollCount -= AnalogScrollSpeed(); if (GetOffset() > 0)// && GetCursor() <= m_itemsPerPage * m_itemsPerRow / 2) { Scroll(-1); } else if (GetCursor() > 0) { SetCursor(GetCursor() - 1); } } return handled; } break; case ACTION_SCROLL_DOWN: { m_analogScrollCount += action.GetAmount() * action.GetAmount(); bool handled = false; while (m_analogScrollCount > AnalogScrollSpeed()) { handled = true; m_analogScrollCount -= AnalogScrollSpeed(); if ((GetOffset() + m_itemsPerPage) * m_itemsPerRow < (int)m_items.size())// && GetCursor() >= m_itemsPerPage * m_itemsPerRow / 2) { Scroll(1); } else if (GetCursor() < m_itemsPerPage * m_itemsPerRow - 1 && GetOffset() * m_itemsPerRow + GetCursor() < (int)m_items.size() - 1) { SetCursor(GetCursor() + 1); } } return handled; } break; } return CGUIBaseContainer::OnAction(action); }
bool CGUIBaseContainer::OnAction(const CAction &action) { if (action.GetID() >= KEY_ASCII) { OnJumpLetter((char)(action.GetID() & 0xff)); return true; } // stop the timer on any other action m_matchTimer.Stop(); switch (action.GetID()) { case ACTION_MOVE_LEFT: case ACTION_MOVE_RIGHT: case ACTION_MOVE_DOWN: case ACTION_MOVE_UP: case ACTION_NAV_BACK: case ACTION_PREVIOUS_MENU: { if (!HasFocus()) return false; if (action.GetHoldTime() > HOLD_TIME_START && ((m_orientation == VERTICAL && (action.GetID() == ACTION_MOVE_UP || action.GetID() == ACTION_MOVE_DOWN)) || (m_orientation == HORIZONTAL && (action.GetID() == ACTION_MOVE_LEFT || action.GetID() == ACTION_MOVE_RIGHT)))) { // action is held down - repeat a number of times float speed = std::min(1.0f, (float)(action.GetHoldTime() - HOLD_TIME_START) / (HOLD_TIME_END - HOLD_TIME_START)); unsigned int frameDuration = std::min(CTimeUtils::GetFrameTime() - m_lastHoldTime, 50u); // max 20fps // maximal scroll rate is at least 30 items per second, and at most (item_rows/7) items per second // i.e. timed to take 7 seconds to traverse the list at full speed. // minimal scroll rate is at least 10 items per second float maxSpeed = std::max(frameDuration * 0.001f * 30, frameDuration * 0.001f * GetRows() / 7); float minSpeed = frameDuration * 0.001f * 10; m_scrollItemsPerFrame += std::max(minSpeed, speed*maxSpeed); // accelerate to max speed m_lastHoldTime = CTimeUtils::GetFrameTime(); if(m_scrollItemsPerFrame < 1.0f)//not enough hold time accumulated for one step return true; while (m_scrollItemsPerFrame >= 1) { if (action.GetID() == ACTION_MOVE_LEFT || action.GetID() == ACTION_MOVE_UP) MoveUp(false); else MoveDown(false); m_scrollItemsPerFrame--; } return true; } else { //if HOLD_TIME_START is reached we need //a sane initial value for calculating m_scrollItemsPerPage m_lastHoldTime = CTimeUtils::GetFrameTime(); m_scrollItemsPerFrame = 0.0f; return CGUIControl::OnAction(action); } } break; case ACTION_FIRST_PAGE: SelectItem(0); return true; case ACTION_LAST_PAGE: if (m_items.size()) SelectItem(m_items.size() - 1); return true; case ACTION_NEXT_LETTER: { OnNextLetter(); return true; } break; case ACTION_PREV_LETTER: { OnPrevLetter(); return true; } break; case ACTION_JUMP_SMS2: case ACTION_JUMP_SMS3: case ACTION_JUMP_SMS4: case ACTION_JUMP_SMS5: case ACTION_JUMP_SMS6: case ACTION_JUMP_SMS7: case ACTION_JUMP_SMS8: case ACTION_JUMP_SMS9: { OnJumpSMS(action.GetID() - ACTION_JUMP_SMS2 + 2); return true; } break; default: if (action.GetID()) { return OnClick(action.GetID()); } } return false; }
bool CGUIDialogPVRChannelManager::OnActionMove(const CAction &action) { bool bReturn(false); int iActionId = action.GetID(); if (GetFocusedControlID() == CONTROL_LIST_CHANNELS) { if (iActionId == ACTION_MOUSE_MOVE) { int iSelected = m_viewControl.GetSelectedItem(); if (m_iSelected < iSelected) { iActionId = ACTION_MOVE_DOWN; } else if (m_iSelected > iSelected) { iActionId = ACTION_MOVE_UP; } else { return bReturn; } } if (iActionId == ACTION_MOVE_DOWN || iActionId == ACTION_MOVE_UP || iActionId == ACTION_PAGE_DOWN || iActionId == ACTION_PAGE_UP || iActionId == ACTION_FIRST_PAGE || iActionId == ACTION_LAST_PAGE) { CGUIDialog::OnAction(action); int iSelected = m_viewControl.GetSelectedItem(); bReturn = true; if (!m_bMovingMode) { if (iSelected != m_iSelected) { m_iSelected = iSelected; SetData(m_iSelected); } } else { std::string strNumber; bool bMoveUp = iActionId == ACTION_PAGE_UP || iActionId == ACTION_MOVE_UP || iActionId == ACTION_FIRST_PAGE; unsigned int iLines = bMoveUp ? abs(m_iSelected - iSelected) : 1; bool bOutOfBounds = bMoveUp ? m_iSelected <= 0 : m_iSelected >= m_channelItems->Size() - 1; if (bOutOfBounds) { bMoveUp = !bMoveUp; iLines = m_channelItems->Size() - 1; } for (unsigned int iLine = 0; iLine < iLines; iLine++) { unsigned int iNewSelect = bMoveUp ? m_iSelected - 1 : m_iSelected + 1; if (m_channelItems->Get(iNewSelect)->GetProperty("Number").asString() != "-") { strNumber = StringUtils::Format("%i", m_iSelected+1); m_channelItems->Get(iNewSelect)->SetProperty("Number", strNumber); strNumber = StringUtils::Format("%i", iNewSelect+1); m_channelItems->Get(m_iSelected)->SetProperty("Number", strNumber); } m_channelItems->Swap(iNewSelect, m_iSelected); m_iSelected = iNewSelect; } m_viewControl.SetItems(*m_channelItems); m_viewControl.SetSelectedItem(m_iSelected); } } } return bReturn; }
bool CPVRActionListener::OnAction(const CAction &action) { switch (action.GetID()) { case ACTION_PVR_PLAY: case ACTION_PVR_PLAY_TV: case ACTION_PVR_PLAY_RADIO: { // see if we're already playing a PVR stream and if not or the stream type // doesn't match the demanded type, start playback of according type bool isPlayingPvr(g_PVRManager.IsPlaying() && g_application.CurrentFileItem().HasPVRChannelInfoTag()); switch (action.GetID()) { case ACTION_PVR_PLAY: if (!isPlayingPvr) g_PVRManager.StartPlayback(PlaybackTypeAny); break; case ACTION_PVR_PLAY_TV: if (!isPlayingPvr || g_application.CurrentFileItem().GetPVRChannelInfoTag()->IsRadio()) g_PVRManager.StartPlayback(PlaybackTypeTv); break; case ACTION_PVR_PLAY_RADIO: if (!isPlayingPvr || !g_application.CurrentFileItem().GetPVRChannelInfoTag()->IsRadio()) g_PVRManager.StartPlayback(PlaybackTypeRadio); break; } return true; } case REMOTE_0: case REMOTE_1: case REMOTE_2: case REMOTE_3: case REMOTE_4: case REMOTE_5: case REMOTE_6: case REMOTE_7: case REMOTE_8: case REMOTE_9: { if (g_application.IsFullScreen() && g_application.CurrentFileItem().IsLiveTV()) { if(g_PVRManager.IsPlaying()) { // pvr client addon CPVRChannelPtr playingChannel(g_PVRManager.GetCurrentChannel()); if(!playingChannel) return false; if (action.GetID() == REMOTE_0) { CPVRChannelGroupPtr group = g_PVRChannelGroups->GetPreviousPlayedGroup(); if (group) { g_PVRManager.SetPlayingGroup(group); CFileItemPtr fileItem = group->GetLastPlayedChannel(playingChannel->ChannelID()); if (fileItem && fileItem->HasPVRChannelInfoTag()) { CLog::Log(LOGDEBUG, "%s - switch to channel number %d", __FUNCTION__, fileItem->GetPVRChannelInfoTag()->ChannelNumber()); CApplicationMessenger::Get().SendAction(CAction(ACTION_CHANNEL_SWITCH, (float) fileItem->GetPVRChannelInfoTag()->ChannelNumber()), WINDOW_INVALID, false); } } } else { int autoCloseTime = CSettings::Get().GetBool("pvrplayback.confirmchannelswitch") ? 0 : g_advancedSettings.m_iPVRNumericChannelSwitchTimeout; std::string strChannel = StringUtils::Format("%i", action.GetID() - REMOTE_0); if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000), autoCloseTime) || autoCloseTime) { int iChannelNumber = atoi(strChannel.c_str()); if (iChannelNumber > 0 && iChannelNumber != playingChannel->ChannelNumber()) { CPVRChannelGroupPtr selectedGroup = g_PVRManager.GetPlayingGroup(playingChannel->IsRadio()); CFileItemPtr channel = selectedGroup->GetByChannelNumber(iChannelNumber); if (!channel || !channel->HasPVRChannelInfoTag()) return false; CApplicationMessenger::Get().SendAction(CAction(ACTION_CHANNEL_SWITCH, (float)iChannelNumber), WINDOW_INVALID, false); } } } } } return true; } break; } return false; }
bool CPlayerController::OnAction(const CAction &action) { const unsigned int MsgTime = 300; const unsigned int DisplTime = 2000; if (g_application.m_pPlayer->IsPlayingVideo()) { switch (action.GetID()) { case ACTION_SHOW_SUBTITLES: { if (g_application.m_pPlayer->GetSubtitleCount() == 0) return true; bool subsOn = !g_application.m_pPlayer->GetSubtitleVisible(); g_application.m_pPlayer->SetSubtitleVisible(subsOn); std::string sub, lang; if (subsOn) { SPlayerSubtitleStreamInfo info; g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info); if (!g_LangCodeExpander.Lookup(info.language, lang)) lang = g_localizeStrings.Get(13205); // Unknown if (info.name.length() == 0) sub = lang; else sub = StringUtils::Format("%s - %s", lang.c_str(), info.name.c_str()); } else sub = g_localizeStrings.Get(1223); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(287), sub, DisplTime, false, MsgTime); return true; } case ACTION_NEXT_SUBTITLE: case ACTION_CYCLE_SUBTITLE: { if (g_application.m_pPlayer->GetSubtitleCount() == 0) return true; int currentSub = g_application.m_pPlayer->GetSubtitle(); bool currentSubVisible = true; if (g_application.m_pPlayer->GetSubtitleVisible()) { if (++currentSub >= g_application.m_pPlayer->GetSubtitleCount()) { currentSub = 0; if (action.GetID() == ACTION_NEXT_SUBTITLE) { g_application.m_pPlayer->SetSubtitleVisible(false); currentSubVisible = false; } } g_application.m_pPlayer->SetSubtitle(currentSub); } else if (action.GetID() == ACTION_NEXT_SUBTITLE) { g_application.m_pPlayer->SetSubtitleVisible(true); } std::string sub, lang; if (currentSubVisible) { SPlayerSubtitleStreamInfo info; g_application.m_pPlayer->GetSubtitleStreamInfo(currentSub, info); if (!g_LangCodeExpander.Lookup(info.language, lang)) lang = g_localizeStrings.Get(13205); // Unknown if (info.name.length() == 0) sub = lang; else sub = StringUtils::Format("%s - %s", lang.c_str(), info.name.c_str()); } else sub = g_localizeStrings.Get(1223); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(287), sub, DisplTime, false, MsgTime); return true; } case ACTION_SUBTITLE_DELAY_MIN: { CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay -= 0.1f; if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay < -g_advancedSettings.m_videoSubsDelayRange) CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay = -g_advancedSettings.m_videoSubsDelayRange; g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); ShowSlider(action.GetID(), 22006, CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange); return true; } case ACTION_SUBTITLE_DELAY_PLUS: { CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay += 0.1f; if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay > g_advancedSettings.m_videoSubsDelayRange) CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay = g_advancedSettings.m_videoSubsDelayRange; g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); ShowSlider(action.GetID(), 22006, CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange); return true; } case ACTION_SUBTITLE_DELAY: { ShowSlider(action.GetID(), 22006, CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange, true); return true; } case ACTION_AUDIO_DELAY: { ShowSlider(action.GetID(), 297, CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange, true); return true; } case ACTION_AUDIO_DELAY_MIN: { CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay -= 0.025f; if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay < -g_advancedSettings.m_videoAudioDelayRange) CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay = -g_advancedSettings.m_videoAudioDelayRange; g_application.m_pPlayer->SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); ShowSlider(action.GetID(), 297, CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange); return true; } case ACTION_AUDIO_DELAY_PLUS: { CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay += 0.025f; if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay > g_advancedSettings.m_videoAudioDelayRange) CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay = g_advancedSettings.m_videoAudioDelayRange; g_application.m_pPlayer->SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); ShowSlider(action.GetID(), 297, CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange); return true; } case ACTION_AUDIO_NEXT_LANGUAGE: { if (g_application.m_pPlayer->GetAudioStreamCount() == 1) return true; int currentAudio = g_application.m_pPlayer->GetAudioStream(); if (++currentAudio >= g_application.m_pPlayer->GetAudioStreamCount()) currentAudio = 0; g_application.m_pPlayer->SetAudioStream(currentAudio); // Set the audio stream to the one selected std::string aud; std::string lan; SPlayerAudioStreamInfo info; g_application.m_pPlayer->GetAudioStreamInfo(currentAudio, info); if (!g_LangCodeExpander.Lookup(info.language, lan)) lan = g_localizeStrings.Get(13205); // Unknown if (info.name.empty()) aud = lan; else aud = StringUtils::Format("%s - %s", lan.c_str(), info.name.c_str()); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(460), aud, DisplTime, false, MsgTime); return true; } case ACTION_ZOOM_IN: { CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount += 0.01f; if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount > 2.f) CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = 2.f; CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; g_renderManager.SetViewMode(ViewModeCustom); ShowSlider(action.GetID(), 216, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount, 0.5f, 0.1f, 2.0f); return true; } case ACTION_ZOOM_OUT: { CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount -= 0.01f; if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount < 0.5f) CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = 0.5f; CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; g_renderManager.SetViewMode(ViewModeCustom); ShowSlider(action.GetID(), 216, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount, 0.5f, 0.1f, 2.0f); return true; } case ACTION_INCREASE_PAR: { CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio += 0.01f; if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio > 2.f) CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = 2.f; CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; g_renderManager.SetViewMode(ViewModeCustom); ShowSlider(action.GetID(), 217, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio, 0.5f, 0.1f, 2.0f); return true; } case ACTION_DECREASE_PAR: { CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio -= 0.01f; if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount < 0.5f) CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio = 0.5f; CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; g_renderManager.SetViewMode(ViewModeCustom); ShowSlider(action.GetID(), 217, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio, 0.5f, 0.1f, 2.0f); return true; } case ACTION_VSHIFT_UP: { CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift -= 0.01f; if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift < -2.0f) CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift = -2.0f; CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; g_renderManager.SetViewMode(ViewModeCustom); ShowSlider(action.GetID(), 225, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift, -2.0f, 0.1f, 2.0f); return true; } case ACTION_VSHIFT_DOWN: { CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift += 0.01f; if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift > 2.0f) CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift = 2.0f; CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; g_renderManager.SetViewMode(ViewModeCustom); ShowSlider(action.GetID(), 225, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift, -2.0f, 0.1f, 2.0f); return true; } case ACTION_SUBTITLE_VSHIFT_UP: { RESOLUTION_INFO res_info = g_graphicsContext.GetResInfo(); int subalign = CSettings::Get().GetInt("subtitles.align"); if ((subalign == SUBTITLE_ALIGN_BOTTOM_OUTSIDE) || (subalign == SUBTITLE_ALIGN_TOP_INSIDE)) { res_info.iSubtitles ++; if (res_info.iSubtitles >= res_info.iHeight) res_info.iSubtitles = res_info.iHeight - 1; ShowSlider(action.GetID(), 274, (float) res_info.iHeight - res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); } else { res_info.iSubtitles --; if (res_info.iSubtitles < 0) res_info.iSubtitles = 0; if (subalign == SUBTITLE_ALIGN_MANUAL) ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); else ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles - res_info.iHeight, (float) -res_info.iHeight, -1.0f, 0.0f); } g_graphicsContext.SetResInfo(g_graphicsContext.GetVideoResolution(), res_info); return true; } case ACTION_SUBTITLE_VSHIFT_DOWN: { RESOLUTION_INFO res_info = g_graphicsContext.GetResInfo(); int subalign = CSettings::Get().GetInt("subtitles.align"); if ((subalign == SUBTITLE_ALIGN_BOTTOM_OUTSIDE) || (subalign == SUBTITLE_ALIGN_TOP_INSIDE)) { res_info.iSubtitles--; if (res_info.iSubtitles < 0) res_info.iSubtitles = 0; ShowSlider(action.GetID(), 274, (float) res_info.iHeight - res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); } else { res_info.iSubtitles++; if (res_info.iSubtitles >= res_info.iHeight) res_info.iSubtitles = res_info.iHeight - 1; if (subalign == SUBTITLE_ALIGN_MANUAL) ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); else ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles - res_info.iHeight, (float) -res_info.iHeight, -1.0f, 0.0f); } g_graphicsContext.SetResInfo(g_graphicsContext.GetVideoResolution(), res_info); return true; } case ACTION_SUBTITLE_ALIGN: { RESOLUTION_INFO res_info = g_graphicsContext.GetResInfo(); int subalign = CSettings::Get().GetInt("subtitles.align"); subalign++; if (subalign > SUBTITLE_ALIGN_TOP_OUTSIDE) subalign = SUBTITLE_ALIGN_MANUAL; res_info.iSubtitles = res_info.iHeight - 1; CSettings::Get().SetInt("subtitles.align", subalign); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(21460), g_localizeStrings.Get(21461 + subalign), TOAST_DISPLAY_TIME, false); g_graphicsContext.SetResInfo(g_graphicsContext.GetVideoResolution(), res_info); return true; } case ACTION_VOLAMP_UP: case ACTION_VOLAMP_DOWN: { // Don't allow change with passthrough audio if (g_application.m_pPlayer->IsPassthrough()) { CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning, g_localizeStrings.Get(660), g_localizeStrings.Get(29802), TOAST_DISPLAY_TIME, false); return false; } float sliderMax = VOLUME_DRC_MAXIMUM / 100.0f; float sliderMin = VOLUME_DRC_MINIMUM / 100.0f; if (action.GetID() == ACTION_VOLAMP_UP) CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification += 1.0f; else CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification -= 1.0f; CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification = std::max(std::min(CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification, sliderMax), sliderMin); g_application.m_pPlayer->SetDynamicRangeCompression((long)(CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification * 100)); ShowSlider(action.GetID(), 660, CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification, sliderMin, 1.0f, sliderMax); return true; } case ACTION_VOLAMP: { float sliderMax = VOLUME_DRC_MAXIMUM / 100.0f; float sliderMin = VOLUME_DRC_MINIMUM / 100.0f; ShowSlider(action.GetID(), 660, CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification, sliderMin, 1.0f, sliderMax, true); return true; } default: break; } } return false; }
bool CGUIDialogKeyboardGeneric::OnAction(const CAction &action) { bool handled(true); if (action.GetID() == ACTION_BACKSPACE) { Backspace(); } else if (action.GetID() == ACTION_ENTER) { OnOK(); } else if (action.GetID() == ACTION_CURSOR_LEFT) { MoveCursor( -1); } else if (action.GetID() == ACTION_CURSOR_RIGHT) { if ((unsigned int) GetCursorPos() == m_strEdit.size() && (m_strEdit.size() == 0 || m_strEdit[m_strEdit.size() - 1] != ' ')) { // add a space Character(L' '); } else MoveCursor(1); } else if (action.GetID() == ACTION_SHIFT) { OnShift(); } else if (action.GetID() == ACTION_SYMBOLS) { OnSymbols(); } else if (action.GetID() >= REMOTE_0 && action.GetID() <= REMOTE_9) { OnRemoteNumberClick(action.GetID()); } else if (action.GetID() >= KEY_VKEY && action.GetID() < KEY_ASCII) { // input from the keyboard (vkey, not ascii) uint8_t b = action.GetID() & 0xFF; if (b == XBMCVK_HOME) { MoveCursor(-GetCursorPos()); } else if (b == XBMCVK_END) { MoveCursor(m_strEdit.GetLength() - GetCursorPos()); } else if (b == XBMCVK_LEFT) { MoveCursor( -1); } else if (b == XBMCVK_RIGHT) { MoveCursor(1); } else if (b == XBMCVK_RETURN || b == XBMCVK_NUMPADENTER) { OnOK(); } else if (b == XBMCVK_DELETE) { if (GetCursorPos() < m_strEdit.GetLength()) { MoveCursor(1); Backspace(); } } else if (b == XBMCVK_BACK) Backspace(); else if (b == XBMCVK_ESCAPE) Close(); } else if (action.GetID() >= KEY_ASCII) { // input from the keyboard //char ch = action.GetID() & 0xFF; switch (action.GetUnicode()) { case 13: // enter case 10: // enter OnOK(); break; case 8: // backspace Backspace(); break; case 27: // escape Close(); break; default: //use character input Character(action.GetUnicode()); break; } } else // unhandled by us - let's see if the baseclass wants it handled = CGUIDialog::OnAction(action); if (handled && m_pCharCallback) { // we did _something_, so make sure our search message filter is reset m_pCharCallback(this, GetText()); } return handled; }
bool CGUIWindowFullScreen::OnAction(const CAction &action) { if (m_timeCodePosition > 0 && action.GetButtonCode()) { // check whether we have a mapping in our virtual videotimeseek "window" and have a select action CKey key(action.GetButtonCode()); CAction timeSeek = CButtonTranslator::GetInstance().GetAction(WINDOW_VIDEO_TIME_SEEK, key, false); if (timeSeek.GetID() == ACTION_SELECT_ITEM) { SeekToTimeCodeStamp(SEEK_ABSOLUTE); return true; } } if (CSettings::GetInstance().GetBool(CSettings::SETTING_PVRPLAYBACK_CONFIRMCHANNELSWITCH) && g_infoManager.IsPlayerChannelPreviewActive() && CButtonTranslator::GetInstance().GetGlobalAction(action.GetButtonCode()).GetID() == ACTION_SELECT_ITEM) { // If confirm channel switch is active, channel preview is currently shown // and the button that caused this action matches global action "Select" (OK) // switch to the channel currently displayed within the preview. g_application.m_pPlayer->SwitchChannel(g_application.CurrentFileItem().GetPVRChannelInfoTag()); return true; } switch (action.GetID()) { case ACTION_SHOW_OSD: ToggleOSD(); return true; case ACTION_TRIGGER_OSD: TriggerOSD(); return true; case ACTION_SHOW_GUI: { // switch back to the menu g_windowManager.PreviousWindow(); return true; } break; case ACTION_PLAYER_PLAY: case ACTION_PAUSE: if (m_timeCodePosition > 0) { SeekToTimeCodeStamp(SEEK_ABSOLUTE); return true; } break; case ACTION_SMALL_STEP_BACK: case ACTION_STEP_BACK: case ACTION_BIG_STEP_BACK: case ACTION_CHAPTER_OR_BIG_STEP_BACK: if (m_timeCodePosition > 0) { SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_BACKWARD); return true; } break; case ACTION_STEP_FORWARD: case ACTION_BIG_STEP_FORWARD: case ACTION_CHAPTER_OR_BIG_STEP_FORWARD: if (m_timeCodePosition > 0) { SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_FORWARD); return true; } break; case ACTION_SHOW_OSD_TIME: m_bShowCurrentTime = !m_bShowCurrentTime; if(!m_bShowCurrentTime) g_infoManager.SetDisplayAfterSeek(0); //Force display off g_infoManager.SetShowTime(m_bShowCurrentTime); return true; break; case ACTION_SHOW_INFO: { CGUIDialogFullScreenInfo* pDialog = (CGUIDialogFullScreenInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO); if (pDialog) { CFileItem item(g_application.CurrentFileItem()); pDialog->Open(); return true; } break; } case REMOTE_0: case REMOTE_1: case REMOTE_2: case REMOTE_3: case REMOTE_4: case REMOTE_5: case REMOTE_6: case REMOTE_7: case REMOTE_8: case REMOTE_9: { if (!g_application.CurrentFileItem().IsLiveTV()) { ChangetheTimeCode(action.GetID()); return true; } } break; case ACTION_ASPECT_RATIO: { // toggle the aspect ratio mode (only if the info is onscreen) if (m_bShowViewModeInfo) { #ifdef HAS_VIDEO_PLAYBACK g_application.m_pPlayer->SetRenderViewMode(++CMediaSettings::GetInstance().GetCurrentVideoSettings().m_ViewMode); #endif } m_bShowViewModeInfo = true; m_dwShowViewModeTimeout = XbmcThreads::SystemClockMillis(); } return true; break; case ACTION_SHOW_PLAYLIST: { CFileItem item(g_application.CurrentFileItem()); if (item.HasPVRChannelInfoTag()) g_windowManager.ActivateWindow(WINDOW_DIALOG_PVR_OSD_CHANNELS); else if (item.HasVideoInfoTag()) g_windowManager.ActivateWindow(WINDOW_VIDEO_PLAYLIST); else if (item.HasMusicInfoTag()) g_windowManager.ActivateWindow(WINDOW_MUSIC_PLAYLIST); } return true; break; default: break; } return CGUIWindow::OnAction(action); }