2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "GUIDialogMusicOSD.h"
22 #include "guilib/GUIWindowManager.h"
23 #include "input/MouseStat.h"
24 #include "GUIUserMessages.h"
25 #include "settings/Settings.h"
26 #include "settings/GUISettings.h"
27 #include "addons/GUIWindowAddonBrowser.h"
29 #define CONTROL_VIS_BUTTON 500
30 #define CONTROL_LOCK_BUTTON 501
32 CGUIDialogMusicOSD::CGUIDialogMusicOSD(void)
33 : CGUIDialog(WINDOW_DIALOG_MUSIC_OSD, "MusicOSD.xml")
35 m_loadType = KEEP_IN_MEMORY;
38 CGUIDialogMusicOSD::~CGUIDialogMusicOSD(void)
42 bool CGUIDialogMusicOSD::OnMessage(CGUIMessage &message)
44 switch (message.GetMessage())
48 unsigned int iControl = message.GetSenderId();
49 if (iControl == CONTROL_VIS_BUTTON)
52 if (CGUIWindowAddonBrowser::SelectAddonID(ADDON::ADDON_VIZ, addonID, true) == 1)
54 g_guiSettings.SetString("musicplayer.visualisation", addonID);
56 g_windowManager.SendMessage(GUI_MSG_VISUALISATION_RELOAD, 0, 0);
59 else if (iControl == CONTROL_LOCK_BUTTON)
61 CGUIMessage msg(GUI_MSG_VISUALISATION_ACTION, 0, 0, ACTION_VIS_PRESET_LOCK);
62 g_windowManager.SendMessage(msg);
68 return CGUIDialog::OnMessage(message);
71 bool CGUIDialogMusicOSD::OnAction(const CAction &action)
73 switch (action.GetID())
83 return CGUIDialog::OnAction(action);
86 void CGUIDialogMusicOSD::FrameMove()
90 // check for movement of mouse or a submenu open
91 if (g_Mouse.IsActive() || g_windowManager.IsWindowActive(WINDOW_DIALOG_VIS_SETTINGS)
92 || g_windowManager.IsWindowActive(WINDOW_DIALOG_VIS_PRESET_LIST))
93 SetAutoClose(100); // enough for 10fps
95 CGUIDialog::FrameMove();