mirror of
https://github.com/Team-Resurgent/XBMC4Xbox.git
synced 2026-08-15 11:18:13 -07:00
If ever adding the XBMC4Xbox source to GitHub use "git add -f -A" or it wont add all the files.
108 lines
3.2 KiB
C++
108 lines
3.2 KiB
C++
/*
|
|
* Copyright (C) 2005-2013 Team XBMC
|
|
* http://xbmc.org
|
|
*
|
|
* This Program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This Program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with XBMC; see the file COPYING. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
#include "GUIWindowOSD.h"
|
|
#include "Application.h"
|
|
#include "GUIWindowManager.h"
|
|
#include "GUIUserMessages.h"
|
|
|
|
CGUIWindowOSD::CGUIWindowOSD(void)
|
|
: CGUIDialog(WINDOW_OSD, "VideoOSD.xml")
|
|
{
|
|
}
|
|
|
|
CGUIWindowOSD::~CGUIWindowOSD(void)
|
|
{
|
|
}
|
|
|
|
void CGUIWindowOSD::OnWindowLoaded()
|
|
{
|
|
CGUIDialog::OnWindowLoaded();
|
|
m_bRelativeCoords = true;
|
|
}
|
|
|
|
void CGUIWindowOSD::FrameMove()
|
|
{
|
|
if (m_autoClosing)
|
|
{
|
|
// check for movement of mouse or a submenu open
|
|
if (g_Mouse.IsActive() || g_windowManager.IsWindowActive(WINDOW_DIALOG_AUDIO_OSD_SETTINGS)
|
|
|| g_windowManager.IsWindowActive(WINDOW_DIALOG_VIDEO_OSD_SETTINGS)
|
|
|| g_windowManager.IsWindowActive(WINDOW_DIALOG_VIDEO_BOOKMARKS))
|
|
SetAutoClose(100); // enough for 10fps
|
|
}
|
|
CGUIDialog::FrameMove();
|
|
}
|
|
|
|
bool CGUIWindowOSD::OnAction(const CAction &action)
|
|
{
|
|
if (action.GetID() == ACTION_NEXT_ITEM || action.GetID() == ACTION_PREV_ITEM)
|
|
{
|
|
// these could indicate next chapter if video supports it
|
|
if (g_application.m_pPlayer != NULL && g_application.m_pPlayer->OnAction(action))
|
|
return true;
|
|
}
|
|
|
|
return CGUIDialog::OnAction(action);
|
|
}
|
|
|
|
bool CGUIWindowOSD::OnMouseEvent(const CPoint &point, const CMouseEvent &event)
|
|
{
|
|
if (event.m_id == ACTION_MOUSE_WHEEL_UP)
|
|
{
|
|
return g_application.OnAction(CAction(ACTION_ANALOG_SEEK_FORWARD, 0.5f));
|
|
}
|
|
if (event.m_id == ACTION_MOUSE_WHEEL_DOWN)
|
|
{
|
|
return g_application.OnAction(CAction(ACTION_ANALOG_SEEK_FORWARD, 0.5f));
|
|
}
|
|
if (event.m_id == ACTION_MOUSE_LEFT_CLICK)
|
|
{ // pause
|
|
return g_application.OnAction(CAction(ACTION_PAUSE));
|
|
}
|
|
return CGUIDialog::OnMouseEvent(point, event);
|
|
}
|
|
|
|
bool CGUIWindowOSD::OnMessage(CGUIMessage& message)
|
|
{
|
|
switch ( message.GetMessage() )
|
|
{
|
|
case GUI_MSG_VIDEO_MENU_STARTED:
|
|
{
|
|
// We have gone to the DVD menu, so close the OSD.
|
|
Close();
|
|
}
|
|
case GUI_MSG_WINDOW_DEINIT: // fired when OSD is hidden
|
|
{
|
|
// Remove our subdialogs if visible
|
|
CGUIDialog *pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD_SETTINGS);
|
|
if (pDialog && pDialog->IsDialogRunning())
|
|
pDialog->Close(true);
|
|
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_AUDIO_OSD_SETTINGS);
|
|
if (pDialog && pDialog->IsDialogRunning()) pDialog->Close(true);
|
|
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_BOOKMARKS);
|
|
if (pDialog && pDialog->IsDialogRunning()) pDialog->Close(true);
|
|
}
|
|
break;
|
|
}
|
|
return CGUIDialog::OnMessage(message);
|
|
}
|
|
|