diff options
author | jmarshallnz <jmarshallnz@svn> | 2009-10-07 01:27:50 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2009-10-07 01:27:50 +0000 |
commit | 363c74fafa695c1bfb23c0bf34f35ba69c1212ec (patch) | |
tree | 1a2b21d1dd66db30ba57520ec093f1f7f0ce48df /guilib | |
parent | a53a6e0fd407e28a4b5b34fcd3ea67bbd4e0df8a (diff) |
changed: Get rid of the use of g_graphicsContext to send messages (all it did was passed them on to the window manager.)
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@23492 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib')
-rw-r--r-- | guilib/GUIBaseContainer.cpp | 3 | ||||
-rw-r--r-- | guilib/GUIButtonControl.cpp | 2 | ||||
-rw-r--r-- | guilib/GUIButtonScroller.cpp | 2 | ||||
-rw-r--r-- | guilib/GUIControl.cpp | 4 | ||||
-rw-r--r-- | guilib/GUIEditControl.cpp | 3 | ||||
-rw-r--r-- | guilib/GUIFontManager.cpp | 3 | ||||
-rw-r--r-- | guilib/GUIMultiSelectText.cpp | 3 | ||||
-rw-r--r-- | guilib/GUIVideoControl.cpp | 2 | ||||
-rw-r--r-- | guilib/GUIVisualisationControl.cpp | 5 | ||||
-rw-r--r-- | guilib/GUIWindow.cpp | 2 | ||||
-rw-r--r-- | guilib/GUIWindowManager.cpp | 7 | ||||
-rw-r--r-- | guilib/GUIWindowManager.h | 4 | ||||
-rw-r--r-- | guilib/GraphicContext.cpp | 21 | ||||
-rw-r--r-- | guilib/GraphicContext.h | 8 | ||||
-rw-r--r-- | guilib/IMsgSenderCallback.h | 45 |
15 files changed, 25 insertions, 89 deletions
diff --git a/guilib/GUIBaseContainer.cpp b/guilib/GUIBaseContainer.cpp index 3bfe8c6c51..f453bc9d97 100644 --- a/guilib/GUIBaseContainer.cpp +++ b/guilib/GUIBaseContainer.cpp @@ -21,6 +21,7 @@ #include "GUIBaseContainer.h" #include "GUIControlFactory.h" +#include "GUIWindowManager.h" #include "utils/CharsetConverter.h" #include "utils/GUIInfoManager.h" #include "utils/TimeUtils.h" @@ -622,7 +623,7 @@ bool CGUIBaseContainer::OnClick(int actionID) action.Replace(",,", ","); CGUIMessage message(GUI_MSG_EXECUTE, GetID(), GetParentID()); message.SetStringParam(action); - g_graphicsContext.SendMessage(message); + m_gWindowManager.SendMessage(message); } } return true; diff --git a/guilib/GUIButtonControl.cpp b/guilib/GUIButtonControl.cpp index 5a85984bd7..b36f099d00 100644 --- a/guilib/GUIButtonControl.cpp +++ b/guilib/GUIButtonControl.cpp @@ -296,7 +296,7 @@ void CGUIButtonControl::OnClick() { CGUIMessage message(GUI_MSG_EXECUTE, controlID, parentID); message.SetAction(clickActions[i]); - g_graphicsContext.SendMessage(message); + m_gWindowManager.SendMessage(message); } } diff --git a/guilib/GUIButtonScroller.cpp b/guilib/GUIButtonScroller.cpp index 1bfc096c5b..74ff4b82e5 100644 --- a/guilib/GUIButtonScroller.cpp +++ b/guilib/GUIButtonScroller.cpp @@ -124,7 +124,7 @@ bool CGUIButtonScroller::OnAction(const CAction &action) CGUIMessage message(GUI_MSG_EXECUTE, GetID(), GetParentID()); // find our currently highlighted item message.SetAction(actions[i]); - g_graphicsContext.SendMessage(message); + m_gWindowManager.SendMessage(message); } return true; } diff --git a/guilib/GUIControl.cpp b/guilib/GUIControl.cpp index afd2a89a83..9fb2b58e8e 100644 --- a/guilib/GUIControl.cpp +++ b/guilib/GUIControl.cpp @@ -287,7 +287,7 @@ bool CGUIControl::SendWindowMessage(CGUIMessage &message) CGUIWindow *pWindow = m_gWindowManager.GetWindow(GetParentID()); if (pWindow) return pWindow->OnMessage(message); - return g_graphicsContext.SendMessage(message); + return m_gWindowManager.SendMessage(message); } int CGUIControl::GetID(void) const @@ -872,7 +872,7 @@ void CGUIControl::ExecuteActions(const vector<CGUIActionDescriptor> &actions) { CGUIMessage message(GUI_MSG_EXECUTE, savedID, savedParent); message.SetAction(savedActions[i]); - g_graphicsContext.SendMessage(message); + m_gWindowManager.SendMessage(message); } } diff --git a/guilib/GUIEditControl.cpp b/guilib/GUIEditControl.cpp index ed339a92f0..a711e456a6 100644 --- a/guilib/GUIEditControl.cpp +++ b/guilib/GUIEditControl.cpp @@ -20,6 +20,7 @@ */ #include "GUIEditControl.h" +#include "GUIWindowManager.h" #include "utils/CharsetConverter.h" #include "GUIDialogKeyboard.h" #include "GUIDialogNumeric.h" @@ -440,7 +441,7 @@ void CGUIEditControl::OnTextChanged() { CGUIMessage message(GUI_MSG_EXECUTE, GetID(), GetParentID()); message.SetAction(textChangeActions[i]); - g_graphicsContext.SendMessage(message); + m_gWindowManager.SendMessage(message); } SetInvalid(); diff --git a/guilib/GUIFontManager.cpp b/guilib/GUIFontManager.cpp index 71c68791c4..c035d01def 100644 --- a/guilib/GUIFontManager.cpp +++ b/guilib/GUIFontManager.cpp @@ -21,6 +21,7 @@ #include "GUIFontManager.h" #include "GraphicContext.h" +#include "GUIWindowManager.h" #include "SkinInfo.h" #include "GUIFontTTF.h" #include "GUIFont.h" @@ -191,7 +192,7 @@ void GUIFontManager::ReloadTTFFonts(void) m_bFontsNeedReloading = false; // send a message to our controls telling them they need to refresh. - g_graphicsContext.SendMessage(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_INVALIDATE); + m_gWindowManager.SendMessage(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_INVALIDATE); } void GUIFontManager::Unload(const CStdString& strFontName) diff --git a/guilib/GUIMultiSelectText.cpp b/guilib/GUIMultiSelectText.cpp index 25e7ae62df..b75e31f80d 100644 --- a/guilib/GUIMultiSelectText.cpp +++ b/guilib/GUIMultiSelectText.cpp @@ -20,6 +20,7 @@ */ #include "GUIMultiSelectText.h" +#include "GUIWindowManager.h" #include "Key.h" #include "MouseStat.h" #include "utils/log.h" @@ -174,7 +175,7 @@ bool CGUIMultiSelectTextControl::OnAction(const CAction &action) { // have a click action -> perform it CGUIMessage message(GUI_MSG_EXECUTE, m_controlID, m_parentID); message.SetStringParam(clickAction); - g_graphicsContext.SendMessage(message); + m_gWindowManager.SendMessage(message); } else { // no click action, just send a message to the window diff --git a/guilib/GUIVideoControl.cpp b/guilib/GUIVideoControl.cpp index 3a0f9cccac..e669a8359f 100644 --- a/guilib/GUIVideoControl.cpp +++ b/guilib/GUIVideoControl.cpp @@ -74,7 +74,7 @@ bool CGUIVideoControl::OnMouseClick(int button, const CPoint &point) if (button == MOUSE_LEFT_BUTTON) { CGUIMessage message(GUI_MSG_FULLSCREEN, GetID(), GetParentID()); - g_graphicsContext.SendMessage(message); + m_gWindowManager.SendMessage(message); return true; } if (button == MOUSE_RIGHT_BUTTON) diff --git a/guilib/GUIVisualisationControl.cpp b/guilib/GUIVisualisationControl.cpp index acd7554147..2ee9037808 100644 --- a/guilib/GUIVisualisationControl.cpp +++ b/guilib/GUIVisualisationControl.cpp @@ -1,4 +1,5 @@ #include "GUIVisualisationControl.h" +#include "GUIWindowManager.h" #include "GUIUserMessages.h" #include "Application.h" #include "visualizations/Visualisation.h" @@ -101,7 +102,7 @@ void CGUIVisualisationControl::FreeVisualisation() m_bInitialized = false; // tell our app that we're going CGUIMessage msg(GUI_MSG_VISUALISATION_UNLOADING, 0, 0); - g_graphicsContext.SendMessage(msg); + m_gWindowManager.SendMessage(msg); CSingleLock lock (m_critSection); @@ -186,7 +187,7 @@ void CGUIVisualisationControl::LoadVisualisation() // tell our app that we're back CGUIMessage msg(GUI_MSG_VISUALISATION_LOADED, 0, 0, 0, 0, m_pVisualisation); - g_graphicsContext.SendMessage(msg); + m_gWindowManager.SendMessage(msg); } void CGUIVisualisationControl::UpdateVisibility(const CGUIListItem *item) diff --git a/guilib/GUIWindow.cpp b/guilib/GUIWindow.cpp index 8a76688113..8637bfbe1d 100644 --- a/guilib/GUIWindow.cpp +++ b/guilib/GUIWindow.cpp @@ -1003,7 +1003,7 @@ void CGUIWindow::RunActions(std::vector<CGUIActionDescriptor>& actions) { CGUIMessage message(GUI_MSG_EXECUTE, 0, GetID()); message.SetAction(tempActions[i]); - g_graphicsContext.SendMessage(message); + m_gWindowManager.SendMessage(message); } } diff --git a/guilib/GUIWindowManager.cpp b/guilib/GUIWindowManager.cpp index e2ec0761d8..8779280dc7 100644 --- a/guilib/GUIWindowManager.cpp +++ b/guilib/GUIWindowManager.cpp @@ -48,10 +48,15 @@ CGUIWindowManager::~CGUIWindowManager(void) void CGUIWindowManager::Initialize() { - g_graphicsContext.setMessageSender(this); LoadNotOnDemandWindows(); } +bool CGUIWindowManager::SendMessage(int message, int senderID, int destID, int param1, int param2) +{ + CGUIMessage msg(message, senderID, destID, param1, param2); + return SendMessage(msg); +} + bool CGUIWindowManager::SendMessage(CGUIMessage& message) { bool handled = false; diff --git a/guilib/GUIWindowManager.h b/guilib/GUIWindowManager.h index 8120e89562..7d5f7962e4 100644 --- a/guilib/GUIWindowManager.h +++ b/guilib/GUIWindowManager.h @@ -30,7 +30,6 @@ */ #include "GUIWindow.h" -#include "IMsgSenderCallback.h" #include "IWindowManagerCallback.h" #include "IMsgTargetCallback.h" @@ -42,12 +41,13 @@ class CGUIDialog; \ingroup winman \brief */ -class CGUIWindowManager: public IMsgSenderCallback +class CGUIWindowManager { public: CGUIWindowManager(void); virtual ~CGUIWindowManager(void); bool SendMessage(CGUIMessage& message); + bool SendMessage(int message, int senderID, int destID, int param1 = 0, int param2 = 0); bool SendMessage(CGUIMessage& message, int window); void Initialize(); void Add(CGUIWindow* pWindow); diff --git a/guilib/GraphicContext.cpp b/guilib/GraphicContext.cpp index a3a4032dc1..a56ccb9b40 100644 --- a/guilib/GraphicContext.cpp +++ b/guilib/GraphicContext.cpp @@ -22,8 +22,6 @@ #include "system.h" #include "GraphicContext.h" #include "GUIFontManager.h" -#include "GUIMessage.h" -#include "IMsgSenderCallback.h" #include "utils/SingleLock.h" #include "Application.h" #include "GUISettings.h" @@ -51,7 +49,6 @@ CGraphicContext::CGraphicContext(void) m_strMediaDir = ""; m_bCalibrating = false; m_Resolution = RES_INVALID; - m_pCallback = NULL; m_guiScaleX = m_guiScaleY = 1.0f; m_windowResolution = RES_INVALID; m_bFullScreenRoot = false; @@ -61,24 +58,6 @@ CGraphicContext::~CGraphicContext(void) { } -bool CGraphicContext::SendMessage(int message, int senderID, int destID, int param1, int param2) -{ - if (!m_pCallback) return false; - CGUIMessage msg(message, senderID, destID, param1, param2); - return m_pCallback->SendMessage(msg); -} - -bool CGraphicContext::SendMessage(CGUIMessage& message) -{ - if (!m_pCallback) return false; - return m_pCallback->SendMessage(message); -} - -void CGraphicContext::setMessageSender(IMsgSenderCallback* pCallback) -{ - m_pCallback = pCallback; -} - void CGraphicContext::SetOrigin(float x, float y) { if (m_origins.size()) diff --git a/guilib/GraphicContext.h b/guilib/GraphicContext.h index 19c1989488..7c4babf338 100644 --- a/guilib/GraphicContext.h +++ b/guilib/GraphicContext.h @@ -47,10 +47,6 @@ #include "StdString.h" #include "Resolution.h" -// forward definitions -class IMsgSenderCallback; -class CGUIMessage; - enum VIEW_TYPE { VIEW_TYPE_NONE = 0, VIEW_TYPE_LIST, VIEW_TYPE_ICON, @@ -78,9 +74,6 @@ public: int GetWidth() const { return m_iScreenWidth; } int GetHeight() const { return m_iScreenHeight; } float GetFPS() const; - bool SendMessage(CGUIMessage& message); - bool SendMessage(int message, int senderID, int destID, int param1 = 0, int param2 = 0); - void setMessageSender(IMsgSenderCallback* pCallback); const CStdString& GetMediaDir() const { return m_strMediaDir; } void SetMediaDir(const CStdString& strMediaDir); bool IsWidescreen() const { return m_bWidescreen; } @@ -169,7 +162,6 @@ public: protected: void SetFullScreenViewWindow(RESOLUTION &res); - IMsgSenderCallback* m_pCallback; std::stack<CRect> m_viewStack; int m_iScreenHeight; diff --git a/guilib/IMsgSenderCallback.h b/guilib/IMsgSenderCallback.h deleted file mode 100644 index 3f825d4469..0000000000 --- a/guilib/IMsgSenderCallback.h +++ /dev/null @@ -1,45 +0,0 @@ -/*! -\file IMsgSenderCallback.h -\brief -*/ - -#ifndef GUILIB_IMSGSENDERCALLBACK -#define GUILIB_IMSGSENDERCALLBACK - -#pragma once - -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.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, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "GUIMessage.h" - -/*! - \ingroup winman - \brief - */ -class IMsgSenderCallback -{ -public: - virtual bool SendMessage(CGUIMessage& message) = 0; - virtual ~IMsgSenderCallback() {} -}; - -#endif |