コード例 #1
0
        /// <summary>
        /// Selects a menu item at a certain position on the video
        /// </summary>
        /// <param name="widthRatio">The percentage to the right</param>
        /// <param name="heightRatio">The percentage to the bottom</param>
        public void SelectAtPosition(double widthRatio, double heightRatio)
        {
            VerifyAccess();

            if (m_dvdControl == null || m_dvdButtonCount == 0)
            {
                return;
            }

            /* We base our exact point based on the size of the subpicture target rect */
            var pixelPoint = new Point((int)(m_renderTargetRect.Width * widthRatio),
                                       (int)(m_renderTargetRect.Height * heightRatio));

            int hr = m_dvdControl.SelectAtPosition(pixelPoint);

            if (hr == 0)
            {
                if (m_isOverButton == false)
                {
                    m_isOverButton = true;
                    InvokeOnOverDvdButton(m_isOverButton);
                }
            }
            else
            {
                if (m_isOverButton)
                {
                    m_isOverButton = false;
                    InvokeOnOverDvdButton(m_isOverButton);
                }
            }
        }
コード例 #2
0
 void VideoInternalWindow_MouseMove(object sender, MouseEventArgs e)
 {
     if (_dvdControl == null || (sender == this && _detachedWindow != null))
     {
         // ignore the internal window if there is a detached window
         return;
     }
     _dvdControl.SelectAtPosition(e.Location);
 }
コード例 #3
0
        void renderRegion_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if ((dvdControl2 == null) || (menuMode != MenuMode.Buttons))
            {
                return;
            }

            int hr = dvdControl2.SelectAtPosition(DsPOINT.FromPoint(e.Location));

            DsError.ThrowExceptionForHR(hr);
        }
コード例 #4
0
ファイル: DvdPlayer.cs プロジェクト: git-thinh/MediaPortal-2
        public void OnMouseMove(float x, float y)
        {
            if (_dvdCtrl == null || !_handlesInput || _buttonCount <= 0)
            {
                return;
            }

            // Scale to video's size
            x *= _videoAttr.sourceResolutionX;
            y *= _videoAttr.sourceResolutionY;

            Point pt = new Point((int)x, (int)y);

            // Highlight the button at the current position, if it exists
            _dvdCtrl.SelectAtPosition(pt);
        }
コード例 #5
0
        void TestMenusAndButtons()
        {
            int       hr;
            IDvdCmd   ppCmd;
            DvdDomain dvdd;
            int       pulButtonsAvailable;
            int       pulCurrentButton;

            // Top menu
            hr = m_idc2.ShowMenu(DvdMenuId.Title, DvdCmdFlags.Flush | DvdCmdFlags.SendEvents, out ppCmd);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);
            Application.DoEvents();

            hr = m_idi2.GetCurrentDomain(out dvdd);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(dvdd == DvdDomain.VideoManagerMenu, "TestMenusAndButtons");

            hr = m_idc2.SelectButton(2);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);
            Application.DoEvents();

            hr = m_idi2.GetCurrentButton(out pulButtonsAvailable, out pulCurrentButton);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(pulCurrentButton == 2, "TestMenusAndButtons2");
            Debug.Assert(pulButtonsAvailable == 2, "TestMenusAndButtons2a");

            // Button 1 leads to a chapter menu with 2 items
            hr = m_idc2.SelectButton(1);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);
            Application.DoEvents();

            hr = m_idc2.ActivateButton();
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);

            hr = m_idc2.ReturnFromSubmenu(DvdCmdFlags.Flush | DvdCmdFlags.SendEvents, out ppCmd);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);

            hr = m_idc2.SelectRelativeButton(DvdRelativeButton.Lower);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);

            hr = m_idi2.GetCurrentButton(out pulButtonsAvailable, out pulCurrentButton);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(pulCurrentButton == 2, "TestMenusAndButtons2");

            hr = m_idc2.SelectAndActivateButton(1);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);

            hr = m_idc2.SelectButton(2);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);

            hr = m_idc2.SelectAtPosition(new Point(130, 130));
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);

            hr = m_idi2.GetCurrentButton(out pulButtonsAvailable, out pulCurrentButton);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(pulCurrentButton == 1, "TestMenusAndButtons2");

            hr = m_idc2.ReturnFromSubmenu(DvdCmdFlags.Flush | DvdCmdFlags.SendEvents, out ppCmd);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);

            hr = m_idc2.ActivateAtPosition(new Point(130, 130));
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);
        }