CHANGED: #1471 moved makeWindow and unMakeWindow methods to CWidgetManager from CInterfaceManager. So CInterfaceGroup no longer depends on CInterfaceManager.

This commit is contained in:
dfighter1985 2012-06-06 01:56:25 +02:00
parent 6a48aa9d6c
commit 1e1888b47f
15 changed files with 116 additions and 123 deletions

View file

@ -452,7 +452,7 @@ void CCharacterCL::releaseInSceneInterfaces()
{
if (_InSceneUserInterface)
{
CInterfaceManager::getInstance()->unMakeWindow(_InSceneUserInterface);
CWidgetManager::getInstance()->unMakeWindow(_InSceneUserInterface);
if (_InSceneUserInterface->getParent())
{
_InSceneUserInterface->getParent()->delGroup(_InSceneUserInterface);

View file

@ -177,7 +177,7 @@ void CForageSourceCL::releaseInSceneInterfaces()
{
if (_InSceneUserInterface)
{
CInterfaceManager::getInstance()->unMakeWindow(_InSceneUserInterface);
CWidgetManager::getInstance()->unMakeWindow(_InSceneUserInterface);
if (_InSceneUserInterface->getParent())
{
_InSceneUserInterface->getParent()->delGroup(_InSceneUserInterface);

View file

@ -294,7 +294,7 @@ void CChatWindow::deleteContainer()
}
else
{
CInterfaceManager::getInstance()->unMakeWindow(_Chat);
CWidgetManager::getInstance()->unMakeWindow(_Chat);
if (_Chat->getParent())
{
_Chat->getParent()->delGroup(_Chat);
@ -772,7 +772,7 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c
CInterfaceGroup *pRoot = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId("ui:interface"));
pRoot->addGroup (pGC);
pGC->setParent(pRoot); // must be done before makeWindow
pIM->makeWindow(pGC);
CWidgetManager::getInstance()->makeWindow(pGC);
pGC->open();
pGC->updateCoords();
pGC->center();
@ -897,7 +897,7 @@ bool CChatGroupWindow::removeFreeTeller(const std::string &containerID)
pIM->removeGroupContainerImage(_FreeTellers[i]->getId(), m);
}
CInterfaceGroup *pRoot = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId("ui:interface"));
pIM->unMakeWindow(_FreeTellers[i]);
CWidgetManager::getInstance()->unMakeWindow(_FreeTellers[i]);
pRoot->delGroup (_FreeTellers[i]);
_FreeTellers[i] = NULL;
_FreeTellers.erase(_FreeTellers.begin()+i);

View file

@ -15,12 +15,10 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "ctrl_base.h"
#include "nel/misc/xml_auto_ptr.h"
#include "interface_manager.h"
#include "ctrl_base.h"
#include "interface_group.h"
#include "widget_manager.h"
using namespace NLMISC;
@ -41,7 +39,6 @@ bool CCtrlBase::handleEvent(const NLGUI::CEventDescriptor &event)
if (!((NLGUI::CEventDescriptorActiveCalledOnParent &) eds).getActive())
{
// the mouse capture should be lost when the ctrl is hidden
CInterfaceManager *manager = CInterfaceManager::getInstance();
if (CWidgetManager::getInstance()->getCapturePointerLeft() == this)
{
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);

View file

@ -202,7 +202,7 @@ void CFlyingTextManager::unlinkToInterface(CGroupInfo &gi)
// remove from group and window list
CInterfaceManager *pIM= CInterfaceManager::getInstance();
pIM->unMakeWindow(gi.GroupInScene);
CWidgetManager::getInstance()->unMakeWindow(gi.GroupInScene);
// remove but don't delete
gi.GroupInScene->getParent()->delGroup(gi.GroupInScene, true);
gi.GroupInScene->setParent(NULL);

View file

@ -3289,7 +3289,7 @@ void CGroupContainer::popupCurrentPos()
_ParentPos = parent;
CInterfaceManager *im = CInterfaceManager::getInstance();
im->makeWindow(this);
CWidgetManager::getInstance()->makeWindow(this);
CWidgetManager::getInstance()->setTopWindow(this);
CWidgetManager::getInstance()->clearViewUnders();
CWidgetManager::getInstance()->clearCtrlsUnders();
@ -3346,7 +3346,7 @@ void CGroupContainer::popin(sint32 insertPos /* = -1 */, bool putBackInFatherCon
_MovingInParentList = false;
CInterfaceManager *im = CInterfaceManager::getInstance();
im->unMakeWindow(this);
CWidgetManager::getInstance()->unMakeWindow(this);
CWidgetManager::getInstance()->clearViewUnders();
CWidgetManager::getInstance()->clearCtrlsUnders();
_Parent = NULL;

View file

@ -124,7 +124,7 @@ bool CGroupInSceneBubbleManager::checkTimeOut(vector<CPopup> &rList)
// Time out ?
if (rList[i].timeOut ())
{
pIM->unMakeWindow(rList[i].Group);
CWidgetManager::getInstance()->unMakeWindow(rList[i].Group);
if (rList[i].Group->getParent())
rList[i].Group->getParent()->delGroup(rList[i].Group);
else
@ -155,7 +155,7 @@ void CGroupInSceneBubbleManager::alignMessagePopup (vector<CPopup> &rList, bool
{
CPopup popup = rList.front();
rList.erase (rList.begin());
pIM->unMakeWindow(popup.Group);
CWidgetManager::getInstance()->unMakeWindow(popup.Group);
if (popup.Group->getParent())
popup.Group->getParent()->delGroup(popup.Group);
else
@ -264,7 +264,7 @@ void CGroupInSceneBubbleManager::release ()
for (i=0; i<_Bubbles.size(); i++)
if (_Bubbles[i])
{
pIM->unMakeWindow(_Bubbles[i]);
CWidgetManager::getInstance()->unMakeWindow(_Bubbles[i]);
if (_Bubbles[i]->getParent())
{
_Bubbles[i]->getParent()->delGroup(_Bubbles[i]);
@ -279,7 +279,7 @@ void CGroupInSceneBubbleManager::release ()
// Remove messages
for (i=0; i<_MessagePopup.size(); i++)
{
pIM->unMakeWindow(_MessagePopup[i].Group);
CWidgetManager::getInstance()->unMakeWindow(_MessagePopup[i].Group);
if (_MessagePopup[i].Group->getParent())
_MessagePopup[i].Group->getParent()->delGroup(_MessagePopup[i].Group);
else
@ -290,7 +290,7 @@ void CGroupInSceneBubbleManager::release ()
// Remove messages
for (i=0; i<_MessagePopupCentered.size(); i++)
{
pIM->unMakeWindow(_MessagePopupCentered[i].Group);
CWidgetManager::getInstance()->unMakeWindow(_MessagePopupCentered[i].Group);
if (_MessagePopupCentered[i].Group->getParent())
_MessagePopupCentered[i].Group->getParent()->delGroup(_MessagePopupCentered[i].Group);
else
@ -301,7 +301,7 @@ void CGroupInSceneBubbleManager::release ()
// Remove messages
for (i=0; i<_BubblePopup.size(); i++)
{
pIM->unMakeWindow(_BubblePopup[i].Group);
CWidgetManager::getInstance()->unMakeWindow(_BubblePopup[i].Group);
if (_BubblePopup[i].Group->getParent())
_BubblePopup[i].Group->getParent()->delGroup(_BubblePopup[i].Group);
else
@ -344,7 +344,7 @@ void CGroupInSceneBubbleManager::update ()
// Time out ?
if (_BubblePopup[i].timeOut ())
{
pIM->unMakeWindow(_BubblePopup[i].Group);
CWidgetManager::getInstance()->unMakeWindow(_BubblePopup[i].Group);
if (_BubblePopup[i].Group->getParent())
_BubblePopup[i].Group->getParent()->delGroup(_BubblePopup[i].Group);
else
@ -369,7 +369,7 @@ void CGroupInSceneBubbleManager::update ()
(target->getWReal() != _BubblePopup[i].TargetW) ||
(target->getHReal() != _BubblePopup[i].TargetH))
{
pIM->unMakeWindow(_BubblePopup[i].Group);
CWidgetManager::getInstance()->unMakeWindow(_BubblePopup[i].Group);
if (_BubblePopup[i].Group->getParent())
_BubblePopup[i].Group->getParent()->delGroup(_BubblePopup[i].Group);
else
@ -397,7 +397,7 @@ void CGroupInSceneBubbleManager::update ()
{
if (_BubblePopup[j].Group == _GroupToDelete[i])
{
pIM->unMakeWindow(_BubblePopup[j].Group);
CWidgetManager::getInstance()->unMakeWindow(_BubblePopup[j].Group);
if (_BubblePopup[j].Group->getParent())
_BubblePopup[j].Group->getParent()->delGroup(_BubblePopup[j].Group);
else
@ -420,7 +420,7 @@ void CGroupInSceneBubbleManager::update ()
if (pChar != NULL)
pChar->setBubble(NULL);
pIM->unMakeWindow(_DynBubbles[j].Bubble);
CWidgetManager::getInstance()->unMakeWindow(_DynBubbles[j].Bubble);
if (_DynBubbles[j].Bubble->getParent())
_DynBubbles[j].Bubble->getParent()->delGroup(_DynBubbles[j].Bubble);
else

View file

@ -14,23 +14,22 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "nel/misc/xml_auto_ptr.h"
#include "nel/misc/stream.h"
#include "nel/gui/lua_manager.h"
#include "nel/gui/lua_ihm.h"
#include "nel/gui/view_renderer.h"
#include "interface_group.h"
#include "interface_manager.h"
#include "nel/misc/xml_auto_ptr.h"
#include "interface_link.h"
#include "view_text.h"
#include "ctrl_scroll.h"
#include "widget_manager.h"
#include "group_container.h"
#include "group_editbox.h"
#include "group_scrolltext.h"
#include "nel/gui/lua_ihm.h"
#include "lua_ihm_ryzom.h"
#include "nel/misc/stream.h"
#include "nel/gui/lua_manager.h"
using namespace std;
using namespace NL3D;
@ -1112,7 +1111,7 @@ bool CInterfaceGroup::delElement (const std::string &id, bool noWarning)
{
// If this is a root window
if (pIG->getRootWindow () == pIG)
CInterfaceManager::getInstance()->unMakeWindow(pIG, noWarning);
CWidgetManager::getInstance()->unMakeWindow(pIG, noWarning);
delGroup (pIG, false);
return true;
}
@ -1129,7 +1128,7 @@ bool CInterfaceGroup::delElement (CInterfaceElement *pIE, bool noWarning)
CInterfaceGroup *pIG= static_cast<CInterfaceGroup*>(pIE);
// unmake window if it is
if (pIG->getRootWindow () == pIG)
CInterfaceManager::getInstance()->unMakeWindow(pIG, noWarning);
CWidgetManager::getInstance()->unMakeWindow(pIG, noWarning);
return delGroup(pIG);
}
else if(pIE->isCtrl())

View file

@ -14,16 +14,16 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "action_handler.h"
#include "interface_link.h"
#include "interface_group.h"
#include "interface_element.h"
#include "widget_manager.h"
#include "nel/gui/interface_expr.h"
#include "nel/gui/interface_expr_node.h"
#include "nel/gui/reflect.h"
#include "nel/gui/db_manager.h"
#include "nel/misc/cdb_branch.h"
#include "action_handler.h"
#include "interface_link.h"
#include "interface_element.h"
#include "interface_group.h"
#include "widget_manager.h"
using namespace std;
using namespace NLMISC;

View file

@ -3504,74 +3504,6 @@ void CInterfaceManager::disableContextHelpForControl(CCtrlBase *pCtrl)
disableContextHelp();
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::makeWindow(CInterfaceGroup *group)
{
if (!group) return;
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
uint32 i = 0;
for (i = 0; i < _MasterGroups.size(); ++i)
{
if (_MasterGroups[i].Group == group->getParent())
break;
}
if (i == _MasterGroups.size())
{
string stmp = string("not found master group for window: ")+group->getId();
nlwarning (stmp.c_str());
return;
}
else
{
// check if group hasn't been inserted twice.
if (_MasterGroups[i].isWindowPresent(group))
{
nlwarning("Window inserted twice");
}
else
{
_MasterGroups[i].addWindow(group,group->getPriority());
}
}
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::unMakeWindow(CInterfaceGroup *group, bool noWarning)
{
if (!group) return;
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
uint32 i = 0;
for (i = 0; i < _MasterGroups.size(); ++i)
{
if (_MasterGroups[i].Group == group->getParent())
break;
}
if (i == _MasterGroups.size())
{
if (!noWarning)
{
string stmp = string("not found master group for window: ")+group->getId();
nlwarning (stmp.c_str());
}
return;
}
else
{
// check if group hasn't been inserted twice.
if (!_MasterGroups[i].isWindowPresent(group))
{
if (!noWarning)
nlwarning("Window not inserted in master group");
}
else
{
_MasterGroups[i].delWindow(group);
}
}
}
// ***************************************************************************
void CInterfaceManager::enableMouseHandling(bool handle)
{

View file

@ -388,14 +388,6 @@ public:
void setContextHelpActive(bool active);
// Add a group into the windows list of its master goup
void makeWindow(CInterfaceGroup *group);
// Remove a group from the windows list of its master group
void unMakeWindow(CInterfaceGroup *group, bool noWarning=false);
bool isMouseOverWindow() const {return _MouseOverWindow;}
// Enable mouse Events to interface. if false, release Captures.

View file

@ -14,12 +14,9 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "view_base.h"
#include "interface_manager.h"
#include "interface_group.h"
#include "widget_manager.h"
CViewBase::~CViewBase()
{

View file

@ -1238,6 +1238,76 @@ void CWidgetManager::notifyElementCaptured(CCtrlBase *c)
}
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::makeWindow(CInterfaceGroup *group)
{
if(!group)
return;
uint32 i = 0;
for (i = 0; i < _MasterGroups.size(); ++i)
{
if (_MasterGroups[i].Group == group->getParent())
break;
}
if (i == _MasterGroups.size())
{
std::string stmp = std::string("not found master group for window: ")+group->getId();
nlwarning (stmp.c_str());
return;
}
else
{
// check if group hasn't been inserted twice.
if (_MasterGroups[i].isWindowPresent(group))
{
nlwarning("Window inserted twice");
}
else
{
_MasterGroups[i].addWindow(group,group->getPriority());
}
}
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::unMakeWindow(CInterfaceGroup *group, bool noWarning)
{
if (!group)
return;
uint32 i = 0;
for (i = 0; i < _MasterGroups.size(); ++i)
{
if (_MasterGroups[i].Group == group->getParent())
break;
}
if (i == _MasterGroups.size())
{
if (!noWarning)
{
std::string stmp = std::string("not found master group for window: ")+group->getId();
nlwarning (stmp.c_str());
}
return;
}
else
{
// check if group hasn't been inserted twice.
if (!_MasterGroups[i].isWindowPresent(group))
{
if (!noWarning)
nlwarning("Window not inserted in master group");
}
else
{
_MasterGroups[i].delWindow(group);
}
}
}
CWidgetManager::CWidgetManager()
{

View file

@ -261,6 +261,12 @@ public:
void notifyElementCaptured(CCtrlBase *c);
// Add a group into the windows list of its master goup
void makeWindow( CInterfaceGroup *group );
// Remove a group from the windows list of its master group
void unMakeWindow( CInterfaceGroup *group, bool noWarning = false );
static IParser *parser;
private:

View file

@ -65,7 +65,7 @@ CDisplayerVisual::~CDisplayerVisual()
{
if (_IconInScene)
{
getEditor().getUI().unMakeWindow(_IconInScene);
CWidgetManager::getInstance()->unMakeWindow(_IconInScene);
if (_IconInScene->getParent())
{
_IconInScene->getParent()->delGroup(_IconInScene);