No need for free floating elements when we can simply reparent to the top window...

This commit is contained in:
dfighter1985 2014-09-24 22:59:40 +02:00
parent 35017fe059
commit 627184184c
2 changed files with 16 additions and 58 deletions

View file

@ -533,7 +533,6 @@ namespace NLGUI
NLMISC::CRefPtr< CViewBase > _CapturedView;
NLMISC::CRefPtr< CInterfaceElement > draggedElement; // the element that we're currently dragging
std::vector< NLMISC::CRefPtr< CInterfaceElement > > _OrphanElements; // elements that were dragged out of their parents
bool startDragging();
void stopDragging();

View file

@ -1037,8 +1037,6 @@ namespace NLGUI
setCapturePointerRight(NULL);
_CapturedView = NULL;
_OrphanElements.clear();
resetColorProps();
resetAlphaRolloverSpeedProps();
resetGlobalAlphasProps();
@ -2041,15 +2039,6 @@ namespace NLGUI
}
}
std::vector< NLMISC::CRefPtr< CInterfaceElement > >::iterator oeitr = _OrphanElements.begin();
while( oeitr != _OrphanElements.end() )
{
CInterfaceElement *e = *oeitr;
CViewBase *v = dynamic_cast< CViewBase* >( e );
v->draw();
++oeitr;
}
if( draggedElement != NULL )
{
CInterfaceElement *e = draggedElement;
@ -2411,29 +2400,6 @@ namespace NLGUI
if (!CCtrlDraggable::getDraggedSheet())
{
if( CInterfaceElement::getEditorMode() )
{
std::vector< NLMISC::CRefPtr< CInterfaceElement > >::reverse_iterator itr = _OrphanElements.rbegin();
while( itr != _OrphanElements.rend() )
{
CInterfaceElement *e = *itr;
int x = getPointer()->getXReal();
int y = getPointer()->getYReal();
if( e->isIn( x, y ) )
{
_CapturedView = static_cast< CViewBase* >( e );
captured = true;
break;
}
++itr;
}
}
if( !captured )
{
// Take the top most control.
uint nMaxDepth = 0;
const std::vector< CCtrlBase* >& _CtrlsUnderPointer = getCtrlsUnderPointer();
@ -2451,7 +2417,6 @@ namespace NLGUI
}
}
}
}
if( CInterfaceElement::getEditorMode() && !captured )
{
@ -2700,20 +2665,16 @@ namespace NLGUI
{
CInterfaceGroup *g = getGroupUnder( draggedElement->getXReal(), draggedElement->getYReal() );
CInterfaceElement *e = draggedElement;
CInterfaceGroup *tw = getTopWindow();
if( g == NULL )
g = tw;
e->setParent( g );
e->setIdRecurse( e->getShortId() );
e->setParentPos( g );
e->setParentSize( g );
if( g != NULL )
{
g->addElement( e );
}
else
_OrphanElements.push_back( draggedElement );
checkCoords();
draggedElement = NULL;
}
@ -3513,8 +3474,6 @@ namespace NLGUI
CWidgetManager::~CWidgetManager()
{
_OrphanElements.clear();
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
{
delete _MasterGroups[i].Group;