From 82fd878975b8f01022ff9b3fd761c1fc7fd8e7e0 Mon Sep 17 00:00:00 2001 From: Alexander Eckart Date: Fri, 2 Mar 2012 17:12:04 +0100 Subject: [PATCH] activating and deactivating popup player control by mouse --- Vocaluxe/Menu/CGraphics.cs | 17 ++++++++++++++--- Vocaluxe/Menu/CMenu.cs | 8 ++++++++ Vocaluxe/Screens/CPopupScreenPlayerControl.cs | 7 +++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Vocaluxe/Menu/CGraphics.cs b/Vocaluxe/Menu/CGraphics.cs index ce018613..c8a5b2fe 100644 --- a/Vocaluxe/Menu/CGraphics.cs +++ b/Vocaluxe/Menu/CGraphics.cs @@ -443,6 +443,9 @@ namespace Vocaluxe.Menu KeyEvent KeyEvent = new KeyEvent(); MouseEvent MouseEvent = new MouseEvent(); + bool PopupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing && _CurrentScreen != EScreens.ScreenNames + && _CurrentScreen != EScreens.ScreenSong; + bool Resume = true; while (keys.PollEvent(ref KeyEvent)) { @@ -452,9 +455,7 @@ namespace Vocaluxe.Menu _Cursor.FadeOut(); } - if (_CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing && _CurrentScreen != EScreens.ScreenNames - && _CurrentScreen != EScreens.ScreenSong && - KeyEvent.Key == Keys.Tab) + if (PopupPlayerControlAllowed && KeyEvent.Key == Keys.Tab) { if (_CurrentPopupScreen == EPopupScreens.NoPopup) ShowPopup(EPopupScreens.PopupPlayerControl); @@ -498,6 +499,16 @@ namespace Vocaluxe.Menu UpdateMousePosition(MouseEvent.X, MouseEvent.Y); + bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, MouseEvent); + if (PopupPlayerControlAllowed && isOverPopupPlayerControl) + { + if (_CurrentPopupScreen == EPopupScreens.NoPopup) + ShowPopup(EPopupScreens.PopupPlayerControl); + } + + if (!isOverPopupPlayerControl && _CurrentPopupScreen == EPopupScreens.PopupPlayerControl) + HidePopup(EPopupScreens.PopupPlayerControl); + bool handled = false; if (_CurrentPopupScreen != EPopupScreens.NoPopup) handled = !_PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent); diff --git a/Vocaluxe/Menu/CMenu.cs b/Vocaluxe/Menu/CMenu.cs index b8c5332e..0e416da9 100644 --- a/Vocaluxe/Menu/CMenu.cs +++ b/Vocaluxe/Menu/CMenu.cs @@ -59,6 +59,13 @@ namespace Vocaluxe.Menu protected string[] _ThemeSelectSlides; protected string[] _ThemeSingNotes; + protected SRectF _ScreenArea; + + public SRectF ScreenArea + { + get { return _ScreenArea; } + } + public int ThemeScreenVersion { get { return _ScreenVersion; } @@ -99,6 +106,7 @@ namespace Vocaluxe.Menu _MouseDY = 0; _Active = false; + _ScreenArea = new SRectF(0f, 0f, CSettings.iRenderW, CSettings.iRenderH, 0f); _ThemeName = String.Empty; _ThemeBackgrounds = null; diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index 141d5703..5a1eafc1 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -38,6 +38,13 @@ namespace Vocaluxe.Screens _ThemeButtons = buttons.ToArray(); } + public override void LoadTheme() + { + base.LoadTheme(); + + _ScreenArea = Statics[htStatics(StaticBG)].Rect; + } + public override bool HandleInput(KeyEvent KeyEvent) { if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))