示例#1
0
 void VideoInternalWindow_MouseDown(object sender, MouseEventArgs e)
 {
     if (_dvdControl == null || (sender == this && _detachedWindow != null))
     {
         // ignore the internal window if there is a detached window
         return;
     }
     _dvdControl.ActivateAtPosition(e.Location);
 }
示例#2
0
        void renderRegion_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if ((dvdControl2 == null) || (menuMode != MenuMode.Buttons))
            {
                return;
            }

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

            DsError.ThrowExceptionForHR(hr);
        }
示例#3
0
        /// <summary>
        /// Activates a menu item at a certain position on the video
        /// </summary>
        /// <param name="widthRatio">The ratio to the right</param>
        /// <param name="heightRatio">The ratio to the bottom</param>
        public void ActivateAtPosition(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));

            m_dvdControl.ActivateAtPosition(pixelPoint);
        }
示例#4
0
        public void OnMouseClick(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);

            // Activate ("click") the button at the current position, if it exists
            _dvdCtrl.ActivateAtPosition(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);
        }