From 83e0c1ceda5b4fe7e4e739b5da2ae51d6fdda453 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 20 Apr 2014 21:41:57 +0200 Subject: [PATCH 01/24] Refactored input event handling a bit. --- code/nel/include/nel/gui/widget_manager.h | 8 +- code/nel/src/gui/widget_manager.cpp | 888 +++++++++++----------- 2 files changed, 462 insertions(+), 434 deletions(-) diff --git a/code/nel/include/nel/gui/widget_manager.h b/code/nel/include/nel/gui/widget_manager.h index 5fd75ac8a..6d4f47164 100644 --- a/code/nel/include/nel/gui/widget_manager.h +++ b/code/nel/include/nel/gui/widget_manager.h @@ -332,7 +332,13 @@ namespace NLGUI void drawViews( NL3D::UCamera camera ); bool handleEvent( const CEventDescriptor &evnt ); - + + bool handleSystemEvent( const CEventDescriptor &evnt ); + + bool handleKeyboardEvent( const CEventDescriptor &evnt ); + + bool handleMouseEvent( const CEventDescriptor &evnt ); + bool handleMouseMoveEvent( const CEventDescriptor &eventDesc ); // Relative move of pointer diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 16357d373..2c3f1159e 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -2096,448 +2096,22 @@ namespace NLGUI if( activeAnims[i]->isDisableButtons() ) return false; - if( evnt.getType() == CEventDescriptor::system ) - { - const CEventDescriptorSystem &systemEvent = reinterpret_cast< const CEventDescriptorSystem& >( evnt ); - if( systemEvent.getEventTypeExtended() == CEventDescriptorSystem::setfocus ) - { - if( getCapturePointerLeft() != NULL ) - { - getCapturePointerLeft()->handleEvent( evnt ); - setCapturePointerLeft( NULL ); - } - - if( getCapturePointerRight() != NULL ) - { - getCapturePointerRight()->handleEvent( evnt ); - setCapturePointerRight( NULL ); - } - - if( _CapturedView != NULL ) - { - _CapturedView->handleEvent( evnt ); - _CapturedView = NULL; - } - } - } - bool handled = false; CViewPointer *_Pointer = static_cast< CViewPointer* >( getPointer() ); + if( evnt.getType() == CEventDescriptor::system ) + { + handleSystemEvent( evnt ); + } + else if (evnt.getType() == CEventDescriptor::key) { - CEventDescriptorKey &eventDesc = (CEventDescriptorKey&)evnt; - //_LastEventKeyDesc = eventDesc; - - // Any Key event disable the ContextHelp - disableContextHelp(); - - // Hide menu if the key is pushed - // if ((eventDesc.getKeyEventType() == CEventDescriptorKey::keydown) && !_ModalStack.empty() && !eventDesc.getKeyAlt() && !eventDesc.getKeyCtrl() && !eventDesc.getKeyShift()) - // Hide menu (or popup menu) is ESCAPE pressed - if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE ) - { - if( hasModal() ) - { - SModalWndInfo mwi = getModal(); - if (mwi.ModalExitKeyPushed) - disableModalWindow(); - } - } - - // Manage "quit window" If the Key is ESCAPE, no captureKeyboard - if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE ) - { - // Get the last escapable active top window. NB: this is ergonomically better. - CInterfaceGroup *win= getLastEscapableTopWindow(); - if( win ) - { - // If the window is a modal, must pop it. - if( dynamic_cast(win) ) - { - if(!win->getAHOnEscape().empty()) - CAHManager::getInstance()->runActionHandler(win->getAHOnEscape(), win, win->getAHOnEscapeParams()); - popModalWindow(); - handled= true; - } - // else just disable it. - // Special case: leave the escape Key to the CaptureKeyboard . - else if( !getCaptureKeyboard() ) - { - if(!win->getAHOnEscape().empty()) - CAHManager::getInstance()->runActionHandler(win->getAHOnEscape(), win, win->getAHOnEscapeParams()); - win->setActive(false); - handled= true; - } - } - } - - // Manage complex "Enter" - if (eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyRETURN) - { - // If the top window has Enter AH - CInterfaceGroup *tw= getTopWindow(); - if(tw && !tw->getAHOnEnter().empty()) - { - // if the captured keyboard is in this Modal window, then must handle him in priority - if( getCaptureKeyboard() && getCaptureKeyboard()->getRootWindow()==tw) - { - bool result = getCaptureKeyboard()->handleEvent(evnt); - CDBManager::getInstance()->flushObserverCalls(); - return result; - } - else - { - // The window or modal control the OnEnter. Execute, and don't go to the chat. - CAHManager::getInstance()->runActionHandler(tw->getAHOnEnter(), tw, tw->getAHOnEnterParams()); - handled= true; - } - } - - // else the 'return' key bring back to the last edit box (if possible) - CCtrlBase *oldCapture = getOldCaptureKeyboard() ? getOldCaptureKeyboard() : getDefaultCaptureKeyboard(); - if ( getCaptureKeyboard() == NULL && oldCapture && !handled) - { - /* If the editbox does not want to recover focus, then abort. This possibility is normaly avoided - through setCaptureKeyboard() which already test getRecoverFocusOnEnter(), but it is still possible - for the default capture (main chat) or the old captured window to not want to recover - (temporary Read Only chat for instance) - */ - if(!dynamic_cast(oldCapture) || - dynamic_cast(oldCapture)->getRecoverFocusOnEnter()) - { - setCaptureKeyboard( oldCapture ); - notifyElementCaptured(getCaptureKeyboard() ); - // make sure all parent windows are active - CCtrlBase *cb = getCaptureKeyboard(); - CGroupContainer *lastContainer = NULL; - for(;;) - { - CGroupContainer *gc = dynamic_cast(cb); - if (gc) lastContainer = gc; - cb->forceOpen(); - if (cb->getParent()) - { - cb = cb->getParent(); - } - else - { - cb->invalidateCoords(); - break; - } - } - if (lastContainer) - { - setTopWindow(lastContainer); - lastContainer->enableBlink(1); - } - handled= true; - } - } - } - - // General case: handle it in the Captured keyboard - if ( getCaptureKeyboard() != NULL && !handled) - { - bool result = getCaptureKeyboard()->handleEvent(evnt); - CDBManager::getInstance()->flushObserverCalls(); - return result; - } - - lastKeyEvent = eventDesc; + handled = handleKeyboardEvent( evnt ); } - - //////////////////////////////////////////////// Keyboard handling ends here //////////////////////////////////// - else if (evnt.getType() == CEventDescriptor::mouse ) { - CEventDescriptorMouse &eventDesc = (CEventDescriptorMouse&)evnt; - - if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown ) - _Pointer->setButtonState( static_cast< NLMISC::TMouseButton >( _Pointer->getButtonState() | NLMISC::leftButton ) ); - else - if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightdown ) - _Pointer->setButtonState( static_cast< NLMISC::TMouseButton >( _Pointer->getButtonState() | NLMISC::rightButton ) ); - else - if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftup ) - _Pointer->setButtonState( static_cast< NLMISC::TMouseButton >( _Pointer->getButtonState() & ~NLMISC::leftButton ) ); - if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightup ) - _Pointer->setButtonState( static_cast< NLMISC::TMouseButton >( _Pointer->getButtonState() & ~NLMISC::rightButton ) ); - - if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mousemove ) - handleMouseMoveEvent( eventDesc ); - - eventDesc.setX( _Pointer->getX() ); - eventDesc.setY( _Pointer->getY() ); - - if( isMouseHandlingEnabled() ) - { - // First thing to do : Capture handling - if ( getCapturePointerLeft() != NULL) - handled|= getCapturePointerLeft()->handleEvent(evnt); - - if ( getCapturePointerRight() != NULL && - getCapturePointerLeft() != getCapturePointerRight() ) - handled|= getCapturePointerRight()->handleEvent(evnt); - - if( _CapturedView != NULL ) - _CapturedView->handleEvent( evnt ); - - CInterfaceGroup *ptr = getWindowUnder (eventDesc.getX(), eventDesc.getY()); - setCurrentWindowUnder( ptr ); - - // Any Mouse event but move disable the ContextHelp - if(eventDesc.getEventTypeExtended() != CEventDescriptorMouse::mousemove) - { - disableContextHelp(); - } - - // get the group under the mouse - CInterfaceGroup *pNewCurrentWnd = getCurrentWindowUnder(); - setMouseOverWindow( pNewCurrentWnd != NULL ); - - - NLMISC::CRefPtr clickedOutModalWindow; - - // modal special features - if ( hasModal() ) - { - CWidgetManager::SModalWndInfo mwi = getModal(); - if(mwi.ModalWindow) - { - // If we are not in "click out" mode so we dont handle controls other than those of the modal - if (pNewCurrentWnd != mwi.ModalWindow && !mwi.ModalExitClickOut) - { - pNewCurrentWnd = NULL; - } - else - { - // If there is a handler on click out launch it - if (pNewCurrentWnd != mwi.ModalWindow) - if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown || - (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightdown)) - if (!mwi.ModalHandlerClickOut.empty()) - CAHManager::getInstance()->runActionHandler(mwi.ModalHandlerClickOut,NULL,mwi.ModalClickOutParams); - - // If the current window is not the modal and if must quit on click out - if(pNewCurrentWnd != mwi.ModalWindow && mwi.ModalExitClickOut) - { - // NB: don't force handle==true because to quit a modal does not avoid other actions - - // quit if click outside - if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown || - (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightdown)) - { - clickedOutModalWindow = dynamic_cast((CInterfaceGroup*)mwi.ModalWindow); - // disable the modal - popModalWindow(); - if ( hasModal() ) - { - // don't handle event unless it is a previous modal window - if( !isPreviousModal( pNewCurrentWnd ) ) - pNewCurrentWnd = NULL; // can't handle event before we have left all modal windows - } - movePointer (0,0); // Reget controls under pointer - } - } - } - } - } - - // Manage LeftClick. - if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown) - { - if ((pNewCurrentWnd != NULL) && (!hasModal()) && (pNewCurrentWnd->getOverlappable())) - { - CGroupContainer *pGC = dynamic_cast(pNewCurrentWnd); - if (pGC != NULL) - { - if (!pGC->isGrayed()) setTopWindow(pNewCurrentWnd); - } - else - { - setTopWindow(pNewCurrentWnd); - } - } - - bool captured = false; - - // must not capture a new element if a sheet is currentlty being dragged. - // This may happen when alt-tab has been used => the sheet is dragged but the left button is up - if (!CCtrlDraggable::getDraggedSheet()) - { - // Take the top most control. - uint nMaxDepth = 0; - const std::vector< CCtrlBase* >& _CtrlsUnderPointer = getCtrlsUnderPointer(); - for (sint32 i = (sint32)_CtrlsUnderPointer.size()-1; i >= 0; i--) - { - CCtrlBase *ctrl= _CtrlsUnderPointer[i]; - if (ctrl && ctrl->isCapturable() && ctrl->isInGroup( pNewCurrentWnd ) ) - { - uint d = ctrl->getDepth( pNewCurrentWnd ); - if (d > nMaxDepth) - { - nMaxDepth = d; - setCapturePointerLeft( ctrl ); - captured = true; - } - } - } - - if( CInterfaceElement::getEditorMode() && !captured ) - { - for( sint32 i = _ViewsUnderPointer.size()-1; i >= 0; i-- ) - { - CViewBase *v = _ViewsUnderPointer[i]; - if( ( v != NULL ) && v->isInGroup( pNewCurrentWnd ) ) - { - _CapturedView = v; - captured = true; - break; - } - } - } - - notifyElementCaptured( getCapturePointerLeft() ); - if (clickedOutModalWindow && !clickedOutModalWindow->OnPostClickOut.empty()) - { - CAHManager::getInstance()->runActionHandler(clickedOutModalWindow->OnPostClickOut, getCapturePointerLeft(), clickedOutModalWindow->OnPostClickOutParams); - } - } - //if found - if ( captured ) - { - // consider clicking on a control implies handling of the event. - handled= true; - - // handle the capture - if( getCapturePointerLeft() != NULL ) - getCapturePointerLeft()->handleEvent(evnt); - else - _CapturedView->handleEvent( evnt ); - } - } - - // Manage RightClick - if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightdown) - { - if ((pNewCurrentWnd != NULL) && (!hasModal()) && (pNewCurrentWnd->getOverlappable())) - { - CGroupContainer *pGC = dynamic_cast(pNewCurrentWnd); - if (pGC != NULL) - { - if (!pGC->isGrayed()) setTopWindow(pNewCurrentWnd); - } - else - { - setTopWindow(pNewCurrentWnd); - } - } - - // Take the top most control. - { - uint nMaxDepth = 0; - const std::vector< CCtrlBase* >& _CtrlsUnderPointer = getCtrlsUnderPointer(); - for (sint32 i = (sint32)_CtrlsUnderPointer.size()-1; i >= 0; i--) - { - CCtrlBase *ctrl= _CtrlsUnderPointer[i]; - if (ctrl && ctrl->isCapturable() && ctrl->isInGroup( pNewCurrentWnd ) ) - { - uint d = ctrl->getDepth( pNewCurrentWnd ); - if (d > nMaxDepth) - { - nMaxDepth = d; - setCapturePointerRight( ctrl ); - } - } - } - notifyElementCaptured( getCapturePointerRight() ); - if (clickedOutModalWindow && !clickedOutModalWindow->OnPostClickOut.empty()) - { - CAHManager::getInstance()->runActionHandler(clickedOutModalWindow->OnPostClickOut, getCapturePointerRight(), clickedOutModalWindow->OnPostClickOutParams); - } - } - //if found - if ( getCapturePointerRight() != NULL) - { - // handle the capture - handled |= getCapturePointerRight()->handleEvent(evnt); - } - } - - - if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightup) - { - if (!handled) - if (pNewCurrentWnd != NULL) - pNewCurrentWnd->handleEvent(evnt); - if ( getCapturePointerRight() != NULL) - { - setCapturePointerRight(NULL); - handled= true; - } - } - - // window handling. if not handled by a control - if (!handled) - { - if (((pNewCurrentWnd != NULL) && !hasModal()) || - ((hasModal() && getModal().ModalWindow == pNewCurrentWnd))) - { - CEventDescriptorMouse ev2 = eventDesc; - sint32 x= eventDesc.getX(), y = eventDesc.getY(); - if (pNewCurrentWnd) - { - pNewCurrentWnd->absoluteToRelative (x, y); - ev2.setX (x); ev2.setY (y); - handled|= pNewCurrentWnd->handleEvent (ev2); - } - - // After handle event of a left click, may set window Top if movable (infos etc...) - //if( (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown) && pNewCurrentWnd->isMovable() ) - // setTopWindow(pNewCurrentWnd); - } - } - - // Put here to let a chance to the window to handle if the capture dont - if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftup) - { - if ( getCapturePointerLeft() != NULL) - { - setCapturePointerLeft(NULL); - handled = true; - } - } - - - // If the current window is the modal, may Modal quit. Do it after standard event handle - if(hasModal() && pNewCurrentWnd == getModal().ModalWindow) - { - // NB: don't force handle==true because to quit a modal does not avoid other actions - CWidgetManager::SModalWndInfo mwi = getModal(); - // and if must quit on click right - if(mwi.ModalExitClickR) - { - // quit if click right - if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightup) - // disable the modal - disableModalWindow(); - } - - // and if must quit on click left - if(mwi.ModalExitClickL) - { - // quit if click right - if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftup) - // disable the modal - disableModalWindow(); - } - } - - // If the mouse is over a window, always consider the event is taken (avoid click behind) - handled|= isMouseOverWindow(); - } + handled = handleMouseEvent( evnt ); } CDBManager::getInstance()->flushObserverCalls(); @@ -2545,6 +2119,454 @@ namespace NLGUI return handled; } + bool CWidgetManager::handleSystemEvent( const CEventDescriptor &evnt ) + { + const CEventDescriptorSystem &systemEvent = reinterpret_cast< const CEventDescriptorSystem& >( evnt ); + if( systemEvent.getEventTypeExtended() == CEventDescriptorSystem::setfocus ) + { + if( getCapturePointerLeft() != NULL ) + { + getCapturePointerLeft()->handleEvent( evnt ); + setCapturePointerLeft( NULL ); + } + + if( getCapturePointerRight() != NULL ) + { + getCapturePointerRight()->handleEvent( evnt ); + setCapturePointerRight( NULL ); + } + + if( _CapturedView != NULL ) + { + _CapturedView->handleEvent( evnt ); + _CapturedView = NULL; + } + } + + return true; + } + + bool CWidgetManager::handleKeyboardEvent( const CEventDescriptor &evnt ) + { + bool handled = false; + + CEventDescriptorKey &eventDesc = (CEventDescriptorKey&)evnt; + + //_LastEventKeyDesc = eventDesc; + + // Any Key event disable the ContextHelp + disableContextHelp(); + + // Hide menu if the key is pushed +// if ((eventDesc.getKeyEventType() == CEventDescriptorKey::keydown) && !_ModalStack.empty() && !eventDesc.getKeyAlt() && !eventDesc.getKeyCtrl() && !eventDesc.getKeyShift()) + // Hide menu (or popup menu) is ESCAPE pressed + if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE ) + { + if( hasModal() ) + { + SModalWndInfo mwi = getModal(); + if (mwi.ModalExitKeyPushed) + disableModalWindow(); + } + } + + // Manage "quit window" If the Key is ESCAPE, no captureKeyboard + if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE ) + { + // Get the last escapable active top window. NB: this is ergonomically better. + CInterfaceGroup *win= getLastEscapableTopWindow(); + if( win ) + { + // If the window is a modal, must pop it. + if( dynamic_cast(win) ) + { + if(!win->getAHOnEscape().empty()) + CAHManager::getInstance()->runActionHandler(win->getAHOnEscape(), win, win->getAHOnEscapeParams()); + popModalWindow(); + handled= true; + } + // else just disable it. + // Special case: leave the escape Key to the CaptureKeyboard . + else if( !getCaptureKeyboard() ) + { + if(!win->getAHOnEscape().empty()) + CAHManager::getInstance()->runActionHandler(win->getAHOnEscape(), win, win->getAHOnEscapeParams()); + win->setActive(false); + handled= true; + } + } + } + + // Manage complex "Enter" + if (eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyRETURN) + { + // If the top window has Enter AH + CInterfaceGroup *tw= getTopWindow(); + if(tw && !tw->getAHOnEnter().empty()) + { + // if the captured keyboard is in this Modal window, then must handle him in priority + if( getCaptureKeyboard() && getCaptureKeyboard()->getRootWindow()==tw) + { + bool result = getCaptureKeyboard()->handleEvent(evnt); + CDBManager::getInstance()->flushObserverCalls(); + return result; + } + else + { + // The window or modal control the OnEnter. Execute, and don't go to the chat. + CAHManager::getInstance()->runActionHandler(tw->getAHOnEnter(), tw, tw->getAHOnEnterParams()); + handled= true; + } + } + + // else the 'return' key bring back to the last edit box (if possible) + CCtrlBase *oldCapture = getOldCaptureKeyboard() ? getOldCaptureKeyboard() : getDefaultCaptureKeyboard(); + if ( getCaptureKeyboard() == NULL && oldCapture && !handled) + { + /* If the editbox does not want to recover focus, then abort. This possibility is normaly avoided + through setCaptureKeyboard() which already test getRecoverFocusOnEnter(), but it is still possible + for the default capture (main chat) or the old captured window to not want to recover + (temporary Read Only chat for instance) + */ + if(!dynamic_cast(oldCapture) || + dynamic_cast(oldCapture)->getRecoverFocusOnEnter()) + { + setCaptureKeyboard( oldCapture ); + notifyElementCaptured(getCaptureKeyboard() ); + // make sure all parent windows are active + CCtrlBase *cb = getCaptureKeyboard(); + CGroupContainer *lastContainer = NULL; + for(;;) + { + CGroupContainer *gc = dynamic_cast(cb); + if (gc) lastContainer = gc; + cb->forceOpen(); + if (cb->getParent()) + { + cb = cb->getParent(); + } + else + { + cb->invalidateCoords(); + break; + } + } + if (lastContainer) + { + setTopWindow(lastContainer); + lastContainer->enableBlink(1); + } + handled= true; + } + } + } + + // General case: handle it in the Captured keyboard + if ( getCaptureKeyboard() != NULL && !handled) + { + bool result = getCaptureKeyboard()->handleEvent(evnt); + CDBManager::getInstance()->flushObserverCalls(); + return result; + } + + lastKeyEvent = eventDesc; + + return handled; + } + + bool CWidgetManager::handleMouseEvent( const CEventDescriptor &evnt ) + { + bool handled = false; + + CEventDescriptorMouse &eventDesc = (CEventDescriptorMouse&)evnt; + + if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown ) + _Pointer->setButtonState( static_cast< NLMISC::TMouseButton >( _Pointer->getButtonState() | NLMISC::leftButton ) ); + else + if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightdown ) + _Pointer->setButtonState( static_cast< NLMISC::TMouseButton >( _Pointer->getButtonState() | NLMISC::rightButton ) ); + else + if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftup ) + _Pointer->setButtonState( static_cast< NLMISC::TMouseButton >( _Pointer->getButtonState() & ~NLMISC::leftButton ) ); + if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightup ) + _Pointer->setButtonState( static_cast< NLMISC::TMouseButton >( _Pointer->getButtonState() & ~NLMISC::rightButton ) ); + + if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mousemove ) + handleMouseMoveEvent( eventDesc ); + + eventDesc.setX( _Pointer->getX() ); + eventDesc.setY( _Pointer->getY() ); + + if( isMouseHandlingEnabled() ) + { + // First thing to do : Capture handling + if ( getCapturePointerLeft() != NULL) + handled|= getCapturePointerLeft()->handleEvent(evnt); + + if ( getCapturePointerRight() != NULL && + getCapturePointerLeft() != getCapturePointerRight() ) + handled|= getCapturePointerRight()->handleEvent(evnt); + + if( _CapturedView != NULL ) + _CapturedView->handleEvent( evnt ); + + CInterfaceGroup *ptr = getWindowUnder (eventDesc.getX(), eventDesc.getY()); + setCurrentWindowUnder( ptr ); + + // Any Mouse event but move disable the ContextHelp + if(eventDesc.getEventTypeExtended() != CEventDescriptorMouse::mousemove) + { + disableContextHelp(); + } + + // get the group under the mouse + CInterfaceGroup *pNewCurrentWnd = getCurrentWindowUnder(); + setMouseOverWindow( pNewCurrentWnd != NULL ); + + + NLMISC::CRefPtr clickedOutModalWindow; + + // modal special features + if ( hasModal() ) + { + CWidgetManager::SModalWndInfo mwi = getModal(); + if(mwi.ModalWindow) + { + // If we are not in "click out" mode so we dont handle controls other than those of the modal + if (pNewCurrentWnd != mwi.ModalWindow && !mwi.ModalExitClickOut) + { + pNewCurrentWnd = NULL; + } + else + { + // If there is a handler on click out launch it + if (pNewCurrentWnd != mwi.ModalWindow) + if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown || + (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightdown)) + if (!mwi.ModalHandlerClickOut.empty()) + CAHManager::getInstance()->runActionHandler(mwi.ModalHandlerClickOut,NULL,mwi.ModalClickOutParams); + + // If the current window is not the modal and if must quit on click out + if(pNewCurrentWnd != mwi.ModalWindow && mwi.ModalExitClickOut) + { + // NB: don't force handle==true because to quit a modal does not avoid other actions + + // quit if click outside + if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown || + (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightdown)) + { + clickedOutModalWindow = dynamic_cast((CInterfaceGroup*)mwi.ModalWindow); + // disable the modal + popModalWindow(); + if ( hasModal() ) + { + // don't handle event unless it is a previous modal window + if( !isPreviousModal( pNewCurrentWnd ) ) + pNewCurrentWnd = NULL; // can't handle event before we have left all modal windows + } + movePointer (0,0); // Reget controls under pointer + } + } + } + } + } + + // Manage LeftClick. + if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown) + { + if ((pNewCurrentWnd != NULL) && (!hasModal()) && (pNewCurrentWnd->getOverlappable())) + { + CGroupContainer *pGC = dynamic_cast(pNewCurrentWnd); + if (pGC != NULL) + { + if (!pGC->isGrayed()) setTopWindow(pNewCurrentWnd); + } + else + { + setTopWindow(pNewCurrentWnd); + } + } + + bool captured = false; + + // must not capture a new element if a sheet is currentlty being dragged. + // This may happen when alt-tab has been used => the sheet is dragged but the left button is up + if (!CCtrlDraggable::getDraggedSheet()) + { + // Take the top most control. + uint nMaxDepth = 0; + const std::vector< CCtrlBase* >& _CtrlsUnderPointer = getCtrlsUnderPointer(); + for (sint32 i = (sint32)_CtrlsUnderPointer.size()-1; i >= 0; i--) + { + CCtrlBase *ctrl= _CtrlsUnderPointer[i]; + if (ctrl && ctrl->isCapturable() && ctrl->isInGroup( pNewCurrentWnd ) ) + { + uint d = ctrl->getDepth( pNewCurrentWnd ); + if (d > nMaxDepth) + { + nMaxDepth = d; + setCapturePointerLeft( ctrl ); + captured = true; + } + } + } + + if( CInterfaceElement::getEditorMode() && !captured ) + { + for( sint32 i = _ViewsUnderPointer.size()-1; i >= 0; i-- ) + { + CViewBase *v = _ViewsUnderPointer[i]; + if( ( v != NULL ) && v->isInGroup( pNewCurrentWnd ) ) + { + _CapturedView = v; + captured = true; + break; + } + } + } + + notifyElementCaptured( getCapturePointerLeft() ); + if (clickedOutModalWindow && !clickedOutModalWindow->OnPostClickOut.empty()) + { + CAHManager::getInstance()->runActionHandler(clickedOutModalWindow->OnPostClickOut, getCapturePointerLeft(), clickedOutModalWindow->OnPostClickOutParams); + } + } + //if found + if ( captured ) + { + // consider clicking on a control implies handling of the event. + handled= true; + + // handle the capture + if( getCapturePointerLeft() != NULL ) + getCapturePointerLeft()->handleEvent(evnt); + else + _CapturedView->handleEvent( evnt ); + } + } + + // Manage RightClick + if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightdown) + { + if ((pNewCurrentWnd != NULL) && (!hasModal()) && (pNewCurrentWnd->getOverlappable())) + { + CGroupContainer *pGC = dynamic_cast(pNewCurrentWnd); + if (pGC != NULL) + { + if (!pGC->isGrayed()) setTopWindow(pNewCurrentWnd); + } + else + { + setTopWindow(pNewCurrentWnd); + } + } + + // Take the top most control. + { + uint nMaxDepth = 0; + const std::vector< CCtrlBase* >& _CtrlsUnderPointer = getCtrlsUnderPointer(); + for (sint32 i = (sint32)_CtrlsUnderPointer.size()-1; i >= 0; i--) + { + CCtrlBase *ctrl= _CtrlsUnderPointer[i]; + if (ctrl && ctrl->isCapturable() && ctrl->isInGroup( pNewCurrentWnd ) ) + { + uint d = ctrl->getDepth( pNewCurrentWnd ); + if (d > nMaxDepth) + { + nMaxDepth = d; + setCapturePointerRight( ctrl ); + } + } + } + notifyElementCaptured( getCapturePointerRight() ); + if (clickedOutModalWindow && !clickedOutModalWindow->OnPostClickOut.empty()) + { + CAHManager::getInstance()->runActionHandler(clickedOutModalWindow->OnPostClickOut, getCapturePointerRight(), clickedOutModalWindow->OnPostClickOutParams); + } + } + //if found + if ( getCapturePointerRight() != NULL) + { + // handle the capture + handled |= getCapturePointerRight()->handleEvent(evnt); + } + } + + + if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightup) + { + if (!handled) + if (pNewCurrentWnd != NULL) + pNewCurrentWnd->handleEvent(evnt); + if ( getCapturePointerRight() != NULL) + { + setCapturePointerRight(NULL); + handled= true; + } + } + + // window handling. if not handled by a control + if (!handled) + { + if (((pNewCurrentWnd != NULL) && !hasModal()) || + ((hasModal() && getModal().ModalWindow == pNewCurrentWnd))) + { + CEventDescriptorMouse ev2 = eventDesc; + sint32 x= eventDesc.getX(), y = eventDesc.getY(); + if (pNewCurrentWnd) + { + pNewCurrentWnd->absoluteToRelative (x, y); + ev2.setX (x); ev2.setY (y); + handled|= pNewCurrentWnd->handleEvent (ev2); + } + + // After handle event of a left click, may set window Top if movable (infos etc...) + //if( (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown) && pNewCurrentWnd->isMovable() ) + // setTopWindow(pNewCurrentWnd); + } + } + + // Put here to let a chance to the window to handle if the capture dont + if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftup) + { + if ( getCapturePointerLeft() != NULL) + { + setCapturePointerLeft(NULL); + handled = true; + } + } + + + // If the current window is the modal, may Modal quit. Do it after standard event handle + if(hasModal() && pNewCurrentWnd == getModal().ModalWindow) + { + // NB: don't force handle==true because to quit a modal does not avoid other actions + CWidgetManager::SModalWndInfo mwi = getModal(); + // and if must quit on click right + if(mwi.ModalExitClickR) + { + // quit if click right + if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightup) + // disable the modal + disableModalWindow(); + } + + // and if must quit on click left + if(mwi.ModalExitClickL) + { + // quit if click right + if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftup) + // disable the modal + disableModalWindow(); + } + } + + // If the mouse is over a window, always consider the event is taken (avoid click behind) + handled|= isMouseOverWindow(); + } + + return handled; + } bool CWidgetManager::handleMouseMoveEvent( const CEventDescriptor &eventDesc ) { From 916c9bf9199bb2d72923bb696823ca9b129d0621 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 21 Apr 2014 19:30:33 +0200 Subject: [PATCH 02/24] We can now drag elements, they will disappear and whatnot, but at least they can be dragged! --- code/nel/include/nel/gui/interface_element.h | 3 + code/nel/include/nel/gui/interface_group.h | 3 + code/nel/include/nel/gui/widget_manager.h | 5 ++ code/nel/src/gui/interface_group.cpp | 26 ++++++++ code/nel/src/gui/widget_manager.cpp | 63 ++++++++++++++++++-- 5 files changed, 96 insertions(+), 4 deletions(-) diff --git a/code/nel/include/nel/gui/interface_element.h b/code/nel/include/nel/gui/interface_element.h index 764d165ef..db7a499c8 100644 --- a/code/nel/include/nel/gui/interface_element.h +++ b/code/nel/include/nel/gui/interface_element.h @@ -233,6 +233,9 @@ namespace NLGUI virtual void setActive (bool state); + void setXReal( sint32 x ){ _XReal = x; } + void setYReal( sint32 y ){ _YReal = y; } + void setX (sint32 x) { _X = x; } void setXAndInvalidateCoords (sint32 x) { _X = x; invalidateCoords(); } diff --git a/code/nel/include/nel/gui/interface_group.h b/code/nel/include/nel/gui/interface_group.h index f72bc6f1f..ff0efac3b 100644 --- a/code/nel/include/nel/gui/interface_group.h +++ b/code/nel/include/nel/gui/interface_group.h @@ -79,6 +79,9 @@ namespace NLGUI bool delElement (const std::string &id, bool noWarning=false); bool delElement (CInterfaceElement *pIE, bool noWarning=false); + // Take the element from the group, but don't delete it! + CInterfaceElement* takeElement( CInterfaceElement *e ); + uint getNumGroup() const { return (uint)_ChildrenGroups.size(); } CInterfaceGroup *getGroup(uint index) const; diff --git a/code/nel/include/nel/gui/widget_manager.h b/code/nel/include/nel/gui/widget_manager.h index 6d4f47164..5d2468e7a 100644 --- a/code/nel/include/nel/gui/widget_manager.h +++ b/code/nel/include/nel/gui/widget_manager.h @@ -532,6 +532,11 @@ namespace NLGUI NLMISC::CRefPtr< CViewBase > _CapturedView; + NLMISC::CRefPtr< CInterfaceElement > draggedElement; + + bool startDragging(); + void stopDragging(); + // What is under pointer std::vector< CViewBase* > _ViewsUnderPointer; std::vector< CCtrlBase* > _CtrlsUnderPointer; diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index 5fa83e1c5..4d37eda1c 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -1638,6 +1638,32 @@ namespace NLGUI return delView(static_cast(pIE)); } + // ------------------------------------------------------------------------------------------------ + CInterfaceElement* CInterfaceGroup::takeElement( CInterfaceElement *e ) + { + bool ok = false; + + if( e->isGroup() ) + { + ok = delGroup( static_cast< CInterfaceGroup* >( e ), true ); + } + else + if( e->isCtrl() ) + { + ok = delCtrl( static_cast< CCtrlBase* >( e ), true ); + } + else + if( e->isView() ) + { + ok = delView( static_cast< CViewBase* >( e ), true ); + } + + if( ok ) + return e; + else + return NULL; + } + // ------------------------------------------------------------------------------------------------ bool CInterfaceGroup::isWindowUnder (sint32 x, sint32 y) { diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 2c3f1159e..e3f1064fa 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -2039,6 +2039,12 @@ namespace NLGUI } } + if( draggedElement != NULL ) + { + CInterfaceElement *e = draggedElement; + static_cast< CViewBase* >( e )->draw(); + } + if ( (nPriority == WIN_PRIORITY_WORLD_SPACE) && !camera.empty()) { driver->setMatrixMode2D11(); @@ -2437,11 +2443,11 @@ namespace NLGUI // consider clicking on a control implies handling of the event. handled= true; - // handle the capture if( getCapturePointerLeft() != NULL ) - getCapturePointerLeft()->handleEvent(evnt); - else - _CapturedView->handleEvent( evnt ); + _CapturedView = getCapturePointerLeft(); + + // handle the capture + _CapturedView->handleEvent( evnt ); } } @@ -2534,6 +2540,11 @@ namespace NLGUI setCapturePointerLeft(NULL); handled = true; } + + _CapturedView = NULL; + + if( CInterfaceElement::getEditorMode() ) + stopDragging(); } @@ -2602,8 +2613,52 @@ namespace NLGUI ve.setY( getPointer()->getY() ); } + if( CInterfaceElement::getEditorMode() ) + { + if( ( _CapturedView != NULL ) && ( draggedElement == NULL ) ) + { + startDragging(); + } + else + if( draggedElement != NULL ) + { + draggedElement->setXReal( newX ); + draggedElement->setYReal( newY ); + draggedElement->invalidateCoords(); + } + } + return true; } + + // ------------------------------------------------------------------------------------------------ + bool CWidgetManager::startDragging() + { + CInterfaceElement *e = NULL; + + CInterfaceGroup *g = _CapturedView->getParent(); + if( g != NULL ) + { + e = g->takeElement( _CapturedView ); + if( e == NULL ) + { + nlinfo( "Something went horribly wrong :(" ); + return false; + } + } + else + e = _CapturedView; + + e->setParent( NULL ); + draggedElement = e; + + return true; + } + + void CWidgetManager::stopDragging() + { + draggedElement = NULL; + } // ------------------------------------------------------------------------------------------------ void CWidgetManager::movePointer (sint32 dx, sint32 dy) From 5578b791f3c2612db718995ea20d49d4c4925b59 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 17 Sep 2014 20:49:26 +0200 Subject: [PATCH 03/24] Added the rest of the expression files. --- .../studio/src/plugins/gui_editor/expressions/abs.xml | 8 ++++++++ .../src/plugins/gui_editor/expressions/band.xml | 9 +++++++++ .../src/plugins/gui_editor/expressions/bnot.xml | 8 ++++++++ .../studio/src/plugins/gui_editor/expressions/bor.xml | 9 +++++++++ .../src/plugins/gui_editor/expressions/bxor.xml | 9 +++++++++ .../src/plugins/gui_editor/expressions/dbcount.xml | 8 ++++++++ .../src/plugins/gui_editor/expressions/depends.xml | 8 ++++++++ .../plugins/gui_editor/expressions/extSign11To64.xml | 8 ++++++++ .../plugins/gui_editor/expressions/extSign8To64.xml | 8 ++++++++ .../src/plugins/gui_editor/expressions/getAlpha.xml | 8 ++++++++ .../src/plugins/gui_editor/expressions/getBlue.xml | 8 ++++++++ .../src/plugins/gui_editor/expressions/getGreen.xml | 8 ++++++++ .../src/plugins/gui_editor/expressions/getRed.xml | 8 ++++++++ .../src/plugins/gui_editor/expressions/getbit.xml | 9 +++++++++ .../src/plugins/gui_editor/expressions/getprop.xml | 8 ++++++++ .../src/plugins/gui_editor/expressions/identity.xml | 8 ++++++++ .../src/plugins/gui_editor/expressions/ilinear.xml | 10 ++++++++++ .../studio/src/plugins/gui_editor/expressions/int.xml | 8 ++++++++ .../src/plugins/gui_editor/expressions/intToColor.xml | 8 ++++++++ .../plugins/gui_editor/expressions/isFinalVersion.xml | 5 +++++ .../src/plugins/gui_editor/expressions/localize.xml | 8 ++++++++ .../src/plugins/gui_editor/expressions/makeRGB.xml | 11 +++++++++++ .../studio/src/plugins/gui_editor/expressions/max.xml | 9 +++++++++ .../studio/src/plugins/gui_editor/expressions/min.xml | 9 +++++++++ .../studio/src/plugins/gui_editor/expressions/mod.xml | 9 +++++++++ .../src/plugins/gui_editor/expressions/oldvalue.xml | 8 ++++++++ .../src/plugins/gui_editor/expressions/rand.xml | 5 +++++ .../studio/src/plugins/gui_editor/expressions/sal.xml | 9 +++++++++ .../studio/src/plugins/gui_editor/expressions/sar.xml | 9 +++++++++ .../gui_editor/expressions/secondsToTimeString.xml | 8 ++++++++ .../expressions/secondsToTimeStringShort.xml | 8 ++++++++ .../studio/src/plugins/gui_editor/expressions/shl.xml | 9 +++++++++ .../studio/src/plugins/gui_editor/expressions/shr.xml | 9 +++++++++ .../studio/src/plugins/gui_editor/expressions/str.xml | 9 +++++++++ .../src/plugins/gui_editor/expressions/switch.xml | 10 ++++++++++ 35 files changed, 293 insertions(+) create mode 100644 code/studio/src/plugins/gui_editor/expressions/abs.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/band.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/bnot.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/bor.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/bxor.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/dbcount.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/depends.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/extSign11To64.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/extSign8To64.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/getAlpha.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/getBlue.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/getGreen.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/getRed.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/getbit.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/getprop.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/identity.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/ilinear.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/int.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/intToColor.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/isFinalVersion.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/localize.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/makeRGB.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/max.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/min.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/mod.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/oldvalue.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/rand.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/sal.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/sar.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/secondsToTimeString.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/secondsToTimeStringShort.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/shl.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/shr.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/str.xml create mode 100644 code/studio/src/plugins/gui_editor/expressions/switch.xml diff --git a/code/studio/src/plugins/gui_editor/expressions/abs.xml b/code/studio/src/plugins/gui_editor/expressions/abs.xml new file mode 100644 index 000000000..5a5fe2c70 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/abs.xml @@ -0,0 +1,8 @@ + +Mathematical +abs +false + +A + + diff --git a/code/studio/src/plugins/gui_editor/expressions/band.xml b/code/studio/src/plugins/gui_editor/expressions/band.xml new file mode 100644 index 000000000..1ce1534ec --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/band.xml @@ -0,0 +1,9 @@ + +Bits +band +true + +A +B + + diff --git a/code/studio/src/plugins/gui_editor/expressions/bnot.xml b/code/studio/src/plugins/gui_editor/expressions/bnot.xml new file mode 100644 index 000000000..bde93f6e7 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/bnot.xml @@ -0,0 +1,8 @@ + +Bits +bnot +false + +A + + diff --git a/code/studio/src/plugins/gui_editor/expressions/bor.xml b/code/studio/src/plugins/gui_editor/expressions/bor.xml new file mode 100644 index 000000000..906678bc2 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/bor.xml @@ -0,0 +1,9 @@ + +Bits +bor +true + +A +B + + diff --git a/code/studio/src/plugins/gui_editor/expressions/bxor.xml b/code/studio/src/plugins/gui_editor/expressions/bxor.xml new file mode 100644 index 000000000..2bfedb167 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/bxor.xml @@ -0,0 +1,9 @@ + +Bits +bxor +false + +A +B + + diff --git a/code/studio/src/plugins/gui_editor/expressions/dbcount.xml b/code/studio/src/plugins/gui_editor/expressions/dbcount.xml new file mode 100644 index 000000000..df8e0aac6 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/dbcount.xml @@ -0,0 +1,8 @@ + +Database +dbcount +false + +A + + diff --git a/code/studio/src/plugins/gui_editor/expressions/depends.xml b/code/studio/src/plugins/gui_editor/expressions/depends.xml new file mode 100644 index 000000000..225d48dd6 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/depends.xml @@ -0,0 +1,8 @@ + +Logical +depends +false + +A + + diff --git a/code/studio/src/plugins/gui_editor/expressions/extSign11To64.xml b/code/studio/src/plugins/gui_editor/expressions/extSign11To64.xml new file mode 100644 index 000000000..e227fc8cb --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/extSign11To64.xml @@ -0,0 +1,8 @@ + +Bits +extSign11To64 +false + +A + + diff --git a/code/studio/src/plugins/gui_editor/expressions/extSign8To64.xml b/code/studio/src/plugins/gui_editor/expressions/extSign8To64.xml new file mode 100644 index 000000000..f029c15fc --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/extSign8To64.xml @@ -0,0 +1,8 @@ + +Bits +extSign8To64 +false + +A + + diff --git a/code/studio/src/plugins/gui_editor/expressions/getAlpha.xml b/code/studio/src/plugins/gui_editor/expressions/getAlpha.xml new file mode 100644 index 000000000..acdc5e322 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/getAlpha.xml @@ -0,0 +1,8 @@ + +Color +getAlpha +false + +Color + + diff --git a/code/studio/src/plugins/gui_editor/expressions/getBlue.xml b/code/studio/src/plugins/gui_editor/expressions/getBlue.xml new file mode 100644 index 000000000..be35a6c17 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/getBlue.xml @@ -0,0 +1,8 @@ + +Color +getBlue +false + +Color + + diff --git a/code/studio/src/plugins/gui_editor/expressions/getGreen.xml b/code/studio/src/plugins/gui_editor/expressions/getGreen.xml new file mode 100644 index 000000000..da8e16bc4 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/getGreen.xml @@ -0,0 +1,8 @@ + +Color +getGreen +false + +Color + + diff --git a/code/studio/src/plugins/gui_editor/expressions/getRed.xml b/code/studio/src/plugins/gui_editor/expressions/getRed.xml new file mode 100644 index 000000000..3a918857b --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/getRed.xml @@ -0,0 +1,8 @@ + +Color +getRed +false + +Color + + diff --git a/code/studio/src/plugins/gui_editor/expressions/getbit.xml b/code/studio/src/plugins/gui_editor/expressions/getbit.xml new file mode 100644 index 000000000..6cc08e10b --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/getbit.xml @@ -0,0 +1,9 @@ + +Bits +getbit +false + +Integer +Bit + + diff --git a/code/studio/src/plugins/gui_editor/expressions/getprop.xml b/code/studio/src/plugins/gui_editor/expressions/getprop.xml new file mode 100644 index 000000000..1098635aa --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/getprop.xml @@ -0,0 +1,8 @@ + +Database +getprop +false + +property + + diff --git a/code/studio/src/plugins/gui_editor/expressions/identity.xml b/code/studio/src/plugins/gui_editor/expressions/identity.xml new file mode 100644 index 000000000..cd36facd6 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/identity.xml @@ -0,0 +1,8 @@ + +Mathematical +identity +false + +A + + diff --git a/code/studio/src/plugins/gui_editor/expressions/ilinear.xml b/code/studio/src/plugins/gui_editor/expressions/ilinear.xml new file mode 100644 index 000000000..9284b4e82 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/ilinear.xml @@ -0,0 +1,10 @@ + +Mathematical +ilinear +false + +Interpolant +Start +End + + diff --git a/code/studio/src/plugins/gui_editor/expressions/int.xml b/code/studio/src/plugins/gui_editor/expressions/int.xml new file mode 100644 index 000000000..117225b6b --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/int.xml @@ -0,0 +1,8 @@ + +Mathematical +int +false + +A + + diff --git a/code/studio/src/plugins/gui_editor/expressions/intToColor.xml b/code/studio/src/plugins/gui_editor/expressions/intToColor.xml new file mode 100644 index 000000000..2993365d7 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/intToColor.xml @@ -0,0 +1,8 @@ + +Color +intToColor +false + +Integer + + diff --git a/code/studio/src/plugins/gui_editor/expressions/isFinalVersion.xml b/code/studio/src/plugins/gui_editor/expressions/isFinalVersion.xml new file mode 100644 index 000000000..3c9ddc64c --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/isFinalVersion.xml @@ -0,0 +1,5 @@ + +Nel +isFinalVersion +false + diff --git a/code/studio/src/plugins/gui_editor/expressions/localize.xml b/code/studio/src/plugins/gui_editor/expressions/localize.xml new file mode 100644 index 000000000..f8d3f0f4e --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/localize.xml @@ -0,0 +1,8 @@ + +Localization +localize +false + +String + + diff --git a/code/studio/src/plugins/gui_editor/expressions/makeRGB.xml b/code/studio/src/plugins/gui_editor/expressions/makeRGB.xml new file mode 100644 index 000000000..a2cb2d352 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/makeRGB.xml @@ -0,0 +1,11 @@ + +Color +makeRGB +false + +R +G +B +A + + diff --git a/code/studio/src/plugins/gui_editor/expressions/max.xml b/code/studio/src/plugins/gui_editor/expressions/max.xml new file mode 100644 index 000000000..6592aecd7 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/max.xml @@ -0,0 +1,9 @@ + +Mathematical +max +true + +A +B + + diff --git a/code/studio/src/plugins/gui_editor/expressions/min.xml b/code/studio/src/plugins/gui_editor/expressions/min.xml new file mode 100644 index 000000000..753955ed9 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/min.xml @@ -0,0 +1,9 @@ + +Mathematical +min +true + +A +B + + diff --git a/code/studio/src/plugins/gui_editor/expressions/mod.xml b/code/studio/src/plugins/gui_editor/expressions/mod.xml new file mode 100644 index 000000000..d306f3371 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/mod.xml @@ -0,0 +1,9 @@ + +Mathematical +mod +false + +A +B + + diff --git a/code/studio/src/plugins/gui_editor/expressions/oldvalue.xml b/code/studio/src/plugins/gui_editor/expressions/oldvalue.xml new file mode 100644 index 000000000..299706c79 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/oldvalue.xml @@ -0,0 +1,8 @@ + +Database +oldvalue +false + +property + + diff --git a/code/studio/src/plugins/gui_editor/expressions/rand.xml b/code/studio/src/plugins/gui_editor/expressions/rand.xml new file mode 100644 index 000000000..b284dc241 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/rand.xml @@ -0,0 +1,5 @@ + +Mathematical +rand +false + diff --git a/code/studio/src/plugins/gui_editor/expressions/sal.xml b/code/studio/src/plugins/gui_editor/expressions/sal.xml new file mode 100644 index 000000000..3190f4420 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/sal.xml @@ -0,0 +1,9 @@ + +Bits +sal +false + +A +B + + diff --git a/code/studio/src/plugins/gui_editor/expressions/sar.xml b/code/studio/src/plugins/gui_editor/expressions/sar.xml new file mode 100644 index 000000000..75fcd57d7 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/sar.xml @@ -0,0 +1,9 @@ + +Bits +sar +false + +A +B + + diff --git a/code/studio/src/plugins/gui_editor/expressions/secondsToTimeString.xml b/code/studio/src/plugins/gui_editor/expressions/secondsToTimeString.xml new file mode 100644 index 000000000..fda7dd1c8 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/secondsToTimeString.xml @@ -0,0 +1,8 @@ + +Time +secondsToTimeString +false + +A + + diff --git a/code/studio/src/plugins/gui_editor/expressions/secondsToTimeStringShort.xml b/code/studio/src/plugins/gui_editor/expressions/secondsToTimeStringShort.xml new file mode 100644 index 000000000..042cf06de --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/secondsToTimeStringShort.xml @@ -0,0 +1,8 @@ + +Time +secondsToTimeStringShort +false + +A + + diff --git a/code/studio/src/plugins/gui_editor/expressions/shl.xml b/code/studio/src/plugins/gui_editor/expressions/shl.xml new file mode 100644 index 000000000..653a142a6 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/shl.xml @@ -0,0 +1,9 @@ + +Bits +shl +false + +A +B + + diff --git a/code/studio/src/plugins/gui_editor/expressions/shr.xml b/code/studio/src/plugins/gui_editor/expressions/shr.xml new file mode 100644 index 000000000..435816f6e --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/shr.xml @@ -0,0 +1,9 @@ + +Bits +shr +false + +A +B + + diff --git a/code/studio/src/plugins/gui_editor/expressions/str.xml b/code/studio/src/plugins/gui_editor/expressions/str.xml new file mode 100644 index 000000000..c98ae89eb --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/str.xml @@ -0,0 +1,9 @@ + +String +str +true + +A +B + + diff --git a/code/studio/src/plugins/gui_editor/expressions/switch.xml b/code/studio/src/plugins/gui_editor/expressions/switch.xml new file mode 100644 index 000000000..19f94f9d3 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/expressions/switch.xml @@ -0,0 +1,10 @@ + +Logical +switch +true + +A +B +C + + From d6251c2a1a68a431c97214afbbc8e1e535e43723 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 17 Sep 2014 20:51:45 +0200 Subject: [PATCH 04/24] When removing the root node, don't retain the pointer to it... --- code/studio/src/plugins/gui_editor/expression_editor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/studio/src/plugins/gui_editor/expression_editor.cpp b/code/studio/src/plugins/gui_editor/expression_editor.cpp index 392bdca41..858c63c9c 100644 --- a/code/studio/src/plugins/gui_editor/expression_editor.cpp +++ b/code/studio/src/plugins/gui_editor/expression_editor.cpp @@ -176,6 +176,9 @@ void ExpressionEditor::onDeleteSelection() } } + if( item == m_pvt->m_root ) + m_pvt->m_root = NULL; + m_scene->removeItem( item ); delete item; } From 516d5c9a47d935f753ec373636d519851a7dcde0 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 17 Sep 2014 20:54:16 +0200 Subject: [PATCH 05/24] don't evaluate the child-nodes when there are none, directly just return () --- code/studio/src/plugins/gui_editor/expression_node.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/code/studio/src/plugins/gui_editor/expression_node.cpp b/code/studio/src/plugins/gui_editor/expression_node.cpp index 8a0ef774b..80ef571e2 100644 --- a/code/studio/src/plugins/gui_editor/expression_node.cpp +++ b/code/studio/src/plugins/gui_editor/expression_node.cpp @@ -297,9 +297,16 @@ QString ExpressionNode::build() const QStringList l = m_name.split( ' ' ); result = l[ 0 ]; - result += "( "; int c = m_links.count(); + if( c == 1 ) + { + result += "()"; + return result; + } + + result += "( "; + for( int i = 1; i < c; i++ ) { ExpressionLink *link = m_links[ i ]; From ca250bab9bb532de444022d9f34085b3a4fe2163 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 17 Sep 2014 22:36:58 +0200 Subject: [PATCH 06/24] Fixed Object Viewer build. --- code/studio/src/plugins/object_viewer/object_viewer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/code/studio/src/plugins/object_viewer/object_viewer.cpp b/code/studio/src/plugins/object_viewer/object_viewer.cpp index 566869e84..240a0d9e9 100644 --- a/code/studio/src/plugins/object_viewer/object_viewer.cpp +++ b/code/studio/src/plugins/object_viewer/object_viewer.cpp @@ -120,7 +120,7 @@ void CObjectViewer::init( NL3D::UDriver *driver ) NL3D::CBloomEffect::instance().setDriver(_Driver); NL3D::CBloomEffect::instance().setScene(_Scene); - NL3D::CBloomEffect::instance().init(!_Direct3D); + NL3D::CBloomEffect::instance().init(); NL3D::CBloomEffect::instance().setDensityBloom(uint8(_BloomDensity)); NL3D::CBloomEffect::instance().setSquareBloom(_BloomSquare); @@ -172,7 +172,7 @@ void CObjectViewer::renderDriver() // Render the scene. if((NL3D::CBloomEffect::instance().getDriver() != 0) && (_BloomEffect)) { - NL3D::CBloomEffect::instance().initBloom(); + NL3D::CBloomEffect::instance().init(); } _Driver->clearBuffers(_BackgroundColor); } @@ -184,8 +184,7 @@ void CObjectViewer::renderScene() if((NL3D::CBloomEffect::instance().getDriver() != 0) && (_BloomEffect)) { - NL3D::CBloomEffect::instance().endBloom(); - NL3D::CBloomEffect::instance().endInterfacesDisplayBloom(); + NL3D::CBloomEffect::instance().applyBloom(); } } From e8799f08aac3cc3b2125522c719e5dc6e060b0da Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 19 Sep 2014 19:48:17 +0200 Subject: [PATCH 07/24] Add extra search paths --- code/nel/tools/build_gamedata/processes/clodbank/0_setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/nel/tools/build_gamedata/processes/clodbank/0_setup.py b/code/nel/tools/build_gamedata/processes/clodbank/0_setup.py index 532113523..a4ab0f4df 100755 --- a/code/nel/tools/build_gamedata/processes/clodbank/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/clodbank/0_setup.py @@ -74,6 +74,8 @@ cfgOut.write("{\n") cfgOut.write("\t\"" + ExportBuildDirectory + "/" + ClodExportDirectory + "\", \n") cfgOut.write("\t\"" + ExportBuildDirectory + "/" + SkelExportDirectory + "\", \n") cfgOut.write("\t\"" + ExportBuildDirectory + "/" + AnimBuildDirectory + "\", \n") +cfgOut.write("\t\"" + ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory + "\", \n") +cfgOut.write("\t\"" + ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory + "\", \n") cfgOut.write("};\n") cfgOut.write("\n") cfgOut.close() From a05057bf7ea34b0dcdfccb9b64181e7d450bac57 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 20 Sep 2014 20:51:08 +0200 Subject: [PATCH 08/24] GUI Editor should no longer crash on Linux --- .../plugins/core/Nel3DWidget/nel3d_widget.cpp | 3 +-- .../src/plugins/core/Nel3DWidget/nel3d_widget.h | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp b/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp index dc0bb858b..bc83b5d78 100644 --- a/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp +++ b/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp @@ -14,7 +14,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - #include "nel3d_widget.h" #include "nel/3d/u_driver.h" #include "nel/3d/text_context.h" @@ -29,7 +28,7 @@ #include Nel3DWidget::Nel3DWidget( QWidget *parent ) : -QWidget( parent ) +NEL3DWIDGET( parent ) { driver = NULL; textContext = NULL; diff --git a/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h b/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h index 059e1b738..afed4cf65 100644 --- a/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h +++ b/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h @@ -18,10 +18,22 @@ #ifndef NEL3D_WIDGET_H #define NEL3D_WIDGET_H -#include #include "nel/misc/types_nl.h" #include +#ifdef NEL3DWIDGET +#undef NEL3DWIDGET +#endif + +#ifdef NL_OS_WINDOWS +#include +#define NEL3DWIDGET QWidget +#else +#include +#define NEL3DWIDGET QGLWidget +#endif + + #include "../core_global.h" namespace NL3D @@ -31,7 +43,7 @@ namespace NL3D } /// Nel 3D interface to Qt -class CORE_EXPORT Nel3DWidget : public QWidget +class CORE_EXPORT Nel3DWidget : public QGLWidget { Q_OBJECT public: From 8a1821aba440b5bb50f8394a18841be398e001b4 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 20 Sep 2014 20:55:30 +0200 Subject: [PATCH 09/24] oups --- code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h b/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h index afed4cf65..254001b25 100644 --- a/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h +++ b/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h @@ -43,7 +43,7 @@ namespace NL3D } /// Nel 3D interface to Qt -class CORE_EXPORT Nel3DWidget : public QGLWidget +class CORE_EXPORT Nel3DWidget : public NEL3DWIDGET { Q_OBJECT public: From d9819abd115330ab27dcdf46add1b4bdd8954e1f Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 21 Sep 2014 12:31:02 +0200 Subject: [PATCH 10/24] Fix double delete --- .../server/build_world_packed_col/build_world_packed_col.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp b/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp index 9bd4f7f3c..f03489196 100644 --- a/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp +++ b/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp @@ -211,7 +211,7 @@ int main(int argc, char* argv[]) catch(const EStream &) { mustRebuild = true; // damaged file or bad version ? -> force rebuild - delete packedIsland; // remove whatever was serialized + // delete packedIsland; // remove whatever was serialized // NOPE. smart pointer packedIsland = new CPackedWorldHolder; } } From f051c5d15670dba6fe69deeda81021e9a353b480 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 21 Sep 2014 13:24:33 +0200 Subject: [PATCH 11/24] Add an assert --- .../tools/client/r2_islands_textures/screenshot_islands.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp index 8228c3e2e..4f167ea9c 100644 --- a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp +++ b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp @@ -1784,6 +1784,7 @@ void CScreenshotIslands::buildBackTextureHLS(const std::string & islandName, con // keep more filled eighth of circle + nlassert(!sortedHLS.empty()); // If it crashes here, you may be missing .zonel's. itHLS = sortedHLS.begin(); uint h, s, v; RGB2HSV(*itHLS, h, s, v); From d19e4ecaab9b663b6002c6ed602a6902c13f693a Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 22 Sep 2014 23:24:48 +0200 Subject: [PATCH 12/24] Studio should no longer crash when multiple plugins that use LIGO are loaded. LIGO classes are now guarded against multiple registrations. If it's tried log messages are generated. Mission Compiler and World Editor will now apply their own LIGO configs when the user switches to their tab. --- code/nel/src/ligo/primitive.cpp | 11 ++++ .../src/plugins/core/context_manager.cpp | 4 +- code/studio/src/plugins/core/icontext.h | 2 + .../mission_compiler_main_window.cpp | 5 ++ .../mission_compiler_main_window.h | 2 + .../mission_compiler_plugin.h | 6 ++ .../world_editor/world_editor_plugin.cpp | 65 ++++++++++--------- .../world_editor/world_editor_plugin.h | 6 +- .../world_editor/world_editor_window.h | 1 + 9 files changed, 69 insertions(+), 33 deletions(-) diff --git a/code/nel/src/ligo/primitive.cpp b/code/nel/src/ligo/primitive.cpp index 9cf7df13f..ba9b69435 100644 --- a/code/nel/src/ligo/primitive.cpp +++ b/code/nel/src/ligo/primitive.cpp @@ -2738,8 +2738,17 @@ CPrimitiveContext::CPrimitiveContext(): } +static bool LIGORegistered = false; + + void Register () { + if( LIGORegistered ) + { + nlinfo( "LIGO classes have already been registered." ); + return; + } + NLMISC_REGISTER_CLASS(CPropertyString); NLMISC_REGISTER_CLASS(CPropertyStringArray); NLMISC_REGISTER_CLASS(CPropertyColor); @@ -2748,6 +2757,8 @@ void Register () NLMISC_REGISTER_CLASS(CPrimPath); NLMISC_REGISTER_CLASS(CPrimZone); NLMISC_REGISTER_CLASS(CPrimAlias); + + LIGORegistered = true; } // *************************************************************************** diff --git a/code/studio/src/plugins/core/context_manager.cpp b/code/studio/src/plugins/core/context_manager.cpp index 3b02b411c..203738faf 100644 --- a/code/studio/src/plugins/core/context_manager.cpp +++ b/code/studio/src/plugins/core/context_manager.cpp @@ -143,6 +143,8 @@ void ContextManager::currentTabChanged(int index) if (index >= 0) { IContext *context = d->m_contexts.at(index); + context->onActivated(); + Q_EMIT currentContextChanged(context); } } @@ -158,4 +160,4 @@ int ContextManager::indexOf(const QString &id) const return -1; } -} /* namespace Core */ \ No newline at end of file +} /* namespace Core */ diff --git a/code/studio/src/plugins/core/icontext.h b/code/studio/src/plugins/core/icontext.h index d2cbb412c..616e0db14 100644 --- a/code/studio/src/plugins/core/icontext.h +++ b/code/studio/src/plugins/core/icontext.h @@ -69,6 +69,8 @@ public: virtual void newDocument(){} virtual void close(){} + + virtual void onActivated(){} }; } // namespace Core diff --git a/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp index 10985aa38..efadd3949 100644 --- a/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp +++ b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp @@ -484,6 +484,11 @@ void MissionCompilerMainWindow::saveConfig() { settings->sync(); } +void MissionCompilerMainWindow::onActivated() +{ + NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &m_ligoConfig; +} + void MissionCompilerMainWindow::handleChangedSettings() { QStringList servers; diff --git a/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.h b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.h index dc19db1c6..3d59e206a 100644 --- a/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.h +++ b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.h @@ -31,6 +31,8 @@ public: void saveConfig(); QUndoStack *getUndoStack() { return m_undoStack; } + void onActivated(); + typedef std::map TMissionContainer; public Q_SLOTS: diff --git a/code/studio/src/plugins/mission_compiler/mission_compiler_plugin.h b/code/studio/src/plugins/mission_compiler/mission_compiler_plugin.h index 2ad92b40f..cc2cac47c 100644 --- a/code/studio/src/plugins/mission_compiler/mission_compiler_plugin.h +++ b/code/studio/src/plugins/mission_compiler/mission_compiler_plugin.h @@ -83,6 +83,12 @@ public: virtual void open() {} + void onActivated() + { + m_missionCompilerMainWindow->onActivated(); + } + + MissionCompilerMainWindow *m_missionCompilerMainWindow; }; diff --git a/code/studio/src/plugins/world_editor/world_editor_plugin.cpp b/code/studio/src/plugins/world_editor/world_editor_plugin.cpp index 3170bce60..722c14733 100644 --- a/code/studio/src/plugins/world_editor/world_editor_plugin.cpp +++ b/code/studio/src/plugins/world_editor/world_editor_plugin.cpp @@ -54,36 +54,6 @@ bool WorldEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManage WorldEditorSettingsPage *weSettings = new WorldEditorSettingsPage(this); addAutoReleasedObject(weSettings); - - QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(Constants::WORLD_EDITOR_SECTION); - m_ligoConfig.CellSize = settings->value(Constants::WORLD_EDITOR_CELL_SIZE, "160").toFloat(); - m_ligoConfig.Snap = settings->value(Constants::WORLD_EDITOR_SNAP, "1").toFloat(); - m_ligoConfig.ZoneSnapShotRes = settings->value(Constants::ZONE_SNAPSHOT_RES, "128").toUInt(); - QString fileName = settings->value(Constants::PRIMITIVE_CLASS_FILENAME, "world_editor_classes.xml").toString(); - settings->endGroup(); - try - { - // Search path of file world_editor_classes.xml - std::string ligoPath = NLMISC::CPath::lookup(fileName.toUtf8().constData()); - // Init LIGO - m_ligoConfig.readPrimitiveClass(ligoPath.c_str(), true); - NLLIGO::Register(); - NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &m_ligoConfig; - } - catch (NLMISC::Exception &e) - { - *errorString = tr("(%1)").arg(e.what()); - return false; - } - - // Reset - m_ligoConfig.resetPrimitiveConfiguration (); - - // TODO: get file names! from settings - m_ligoConfig.readPrimitiveClass("world_editor_primitive_configuration.xml", true); - - addAutoReleasedObject(new WorldEditorContext(this)); return true; } @@ -117,6 +87,34 @@ WorldEditorContext::WorldEditorContext(QObject *parent) m_worldEditorWindow(0) { m_worldEditorWindow = new WorldEditorWindow(); + + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup(Constants::WORLD_EDITOR_SECTION); + m_ligoConfig.CellSize = settings->value(Constants::WORLD_EDITOR_CELL_SIZE, "160").toFloat(); + m_ligoConfig.Snap = settings->value(Constants::WORLD_EDITOR_SNAP, "1").toFloat(); + m_ligoConfig.ZoneSnapShotRes = settings->value(Constants::ZONE_SNAPSHOT_RES, "128").toUInt(); + QString fileName = settings->value(Constants::PRIMITIVE_CLASS_FILENAME, "world_editor_classes.xml").toString(); + settings->endGroup(); + try + { + // Search path of file world_editor_classes.xml + std::string ligoPath = NLMISC::CPath::lookup(fileName.toUtf8().constData()); + // Init LIGO + m_ligoConfig.readPrimitiveClass(ligoPath.c_str(), true); + NLLIGO::Register(); + NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &m_ligoConfig; + } + catch (NLMISC::Exception &e) + { + nlinfo( "Error starting LIGO." ); + } + + // Reset + m_ligoConfig.resetPrimitiveConfiguration (); + + // TODO: get file names! from settings + m_ligoConfig.readPrimitiveClass("world_editor_primitive_configuration.xml", true); + } QUndoStack *WorldEditorContext::undoStack() @@ -124,6 +122,11 @@ QUndoStack *WorldEditorContext::undoStack() return m_worldEditorWindow->undoStack(); } +void WorldEditorContext::onActivated() +{ + NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &m_ligoConfig; +} + void WorldEditorContext::open() { m_worldEditorWindow->open(); @@ -136,4 +139,4 @@ QWidget *WorldEditorContext::widget() } -Q_EXPORT_PLUGIN(WorldEditor::WorldEditorPlugin) \ No newline at end of file +Q_EXPORT_PLUGIN(WorldEditor::WorldEditorPlugin) diff --git a/code/studio/src/plugins/world_editor/world_editor_plugin.h b/code/studio/src/plugins/world_editor/world_editor_plugin.h index 686b87e14..cfb5448e3 100644 --- a/code/studio/src/plugins/world_editor/world_editor_plugin.h +++ b/code/studio/src/plugins/world_editor/world_editor_plugin.h @@ -59,7 +59,6 @@ protected: NLMISC::CLibraryContext *m_libContext; private: - NLLIGO::CLigoConfig m_ligoConfig; ExtensionSystem::IPluginManager *m_plugMan; QList m_autoReleaseObjects; }; @@ -88,9 +87,14 @@ public: virtual QUndoStack *undoStack(); + void onActivated(); + virtual QWidget *widget(); WorldEditorWindow *m_worldEditorWindow; + +private: + NLLIGO::CLigoConfig m_ligoConfig; }; } // namespace WorldEditor diff --git a/code/studio/src/plugins/world_editor/world_editor_window.h b/code/studio/src/plugins/world_editor/world_editor_window.h index 60a6a988a..9080187f9 100644 --- a/code/studio/src/plugins/world_editor/world_editor_window.h +++ b/code/studio/src/plugins/world_editor/world_editor_window.h @@ -46,6 +46,7 @@ public: ~WorldEditorWindow(); QUndoStack *undoStack() const; + void onActivated(); void maybeSave(); Q_SIGNALS: From 23d28dff8d885568a552d8c70848722b9dc06d73 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 22 Sep 2014 23:41:55 +0200 Subject: [PATCH 13/24] Call the onActivate method of the current context after all plugins are initialized. --- code/studio/src/plugins/core/main_window.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/code/studio/src/plugins/core/main_window.cpp b/code/studio/src/plugins/core/main_window.cpp index 4ccd32564..c181376e8 100644 --- a/code/studio/src/plugins/core/main_window.cpp +++ b/code/studio/src/plugins/core/main_window.cpp @@ -108,8 +108,14 @@ void MainWindow::extensionsInitialized() readSettings(); connect(m_contextManager, SIGNAL(currentContextChanged(Core::IContext *)), this, SLOT(updateContext(Core::IContext *))); - if (m_contextManager->currentContext() != NULL) - updateContext(m_contextManager->currentContext()); + + Core::IContext *context = m_contextManager->currentContext(); + if (context != NULL) + { + updateContext(context); + context->onActivated(); + } + show(); } From 17dcb2acf902fff636e4cd5f1d933ff2ab2b846c Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Tue, 23 Sep 2014 00:16:57 +0200 Subject: [PATCH 14/24] Instantiate the Wold Editor window after the LIGO setup. --- code/studio/src/plugins/world_editor/world_editor_plugin.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/studio/src/plugins/world_editor/world_editor_plugin.cpp b/code/studio/src/plugins/world_editor/world_editor_plugin.cpp index 722c14733..9b9622d00 100644 --- a/code/studio/src/plugins/world_editor/world_editor_plugin.cpp +++ b/code/studio/src/plugins/world_editor/world_editor_plugin.cpp @@ -86,9 +86,7 @@ WorldEditorContext::WorldEditorContext(QObject *parent) : IContext(parent), m_worldEditorWindow(0) { - m_worldEditorWindow = new WorldEditorWindow(); - - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup(Constants::WORLD_EDITOR_SECTION); m_ligoConfig.CellSize = settings->value(Constants::WORLD_EDITOR_CELL_SIZE, "160").toFloat(); m_ligoConfig.Snap = settings->value(Constants::WORLD_EDITOR_SNAP, "1").toFloat(); @@ -115,6 +113,7 @@ WorldEditorContext::WorldEditorContext(QObject *parent) // TODO: get file names! from settings m_ligoConfig.readPrimitiveClass("world_editor_primitive_configuration.xml", true); + m_worldEditorWindow = new WorldEditorWindow(); } QUndoStack *WorldEditorContext::undoStack() From 32c0f2d7f7d15b11ac8ef0f726e211539e5a31eb Mon Sep 17 00:00:00 2001 From: kaetemi Date: Tue, 23 Sep 2014 13:54:02 +0200 Subject: [PATCH 15/24] Fix EGS sheet rebuild crashes --- .../egs_sheets/egs_static_game_item.cpp | 90 +++++++++---------- .../egs_sheets/egs_static_game_item.h | 4 +- 2 files changed, 46 insertions(+), 48 deletions(-) diff --git a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.cpp b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.cpp index f36fe91ab..42517c190 100644 --- a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.cpp +++ b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.cpp @@ -237,24 +237,12 @@ void SItemSpecialEffects::serial(class NLMISC::IStream &f) //-------------------------------------------------------------- // init() //-------------------------------------------------------------- -void CStaticItem::init() +void CStaticItem::init(bool doDelete) { Family = ITEMFAMILY::UNDEFINED; Type = ITEM_TYPE::UNDEFINED; - Armor = NULL; - MeleeWeapon = NULL; - RangeWeapon = NULL; - Ammo = NULL; - Shield = NULL; - TamingTool = NULL; - Mp = NULL; - GuildOption = NULL; - Cosmetics = NULL; - ItemServiceData = NULL; - ConsumableItem = NULL; - XpCatalyser = NULL; - CommandTicket = NULL; + clearPtrs(doDelete); Skill = SKILLS::unknown; MinSkill = 0; @@ -287,16 +275,54 @@ void CStaticItem::init() RequiredCharacQualityFactor = 0.0f; RequiredCharacQualityOffset = 0; - ItemSpecialEffects = NULL; } // init // +// *************************************************************************** +void CStaticItem::clearPtrs(bool doDelete) +{ + if (doDelete) + { + delete Armor; + delete MeleeWeapon; + delete RangeWeapon; + delete Ammo; + delete Shield; + delete TamingTool; + delete Mp; + delete GuildOption; + delete Cosmetics; + delete ItemServiceData; + delete ConsumableItem; + delete XpCatalyser; + delete CommandTicket; + delete ItemSpecialEffects; + } + + Armor = NULL; + MeleeWeapon = NULL; + RangeWeapon = NULL; + Ammo = NULL; + Shield = NULL; + TamingTool = NULL; + Mp = NULL; + GuildOption = NULL; + Cosmetics = NULL; + ItemServiceData = NULL; + ConsumableItem = NULL; + XpCatalyser = NULL; + CommandTicket = NULL; + ItemSpecialEffects = NULL; +} + //-------------------------------------------------------------- // copy constructor //-------------------------------------------------------------- CStaticItem::CStaticItem( const CStaticItem& itm ) { + clearPtrs(false); + *this = itm; if(itm.Armor) { @@ -1443,6 +1469,9 @@ void CStaticItem::readGeorges (const NLMISC::CSmartPtr &form, if (form == NULL) return; + // Clear pointers to previous data + clearPtrs(true); + // Get the root node, always exist UFormElm &root = form->getRootNode (); @@ -1993,37 +2022,6 @@ float CStaticItem::getBaseWeight() const } #endif -// *************************************************************************** -void CStaticItem::clearPtrs(bool doDelete) -{ - if(doDelete) - { - if (Ammo != NULL ) delete Ammo; - if (Armor != NULL ) delete Armor; - if (MeleeWeapon != NULL ) delete MeleeWeapon; - if (RangeWeapon != NULL ) delete RangeWeapon; - if (Cosmetics != NULL ) delete Cosmetics; - if (Mp != NULL ) delete Mp; - if (GuildOption != NULL ) delete GuildOption; - if (Shield != NULL ) delete Shield; - if (TamingTool != NULL) delete TamingTool; - if (ItemServiceData != NULL) delete ItemServiceData; - if (CommandTicket != NULL) delete CommandTicket; - } - - Ammo = NULL; - Armor = NULL; - MeleeWeapon = NULL; - RangeWeapon = NULL; - Cosmetics = NULL; - Mp = NULL; - GuildOption = NULL; - Shield = NULL; - TamingTool = NULL; - ItemServiceData = NULL; - CommandTicket = NULL; -} - uint32 CStaticItem::getMaxStackSize() const { diff --git a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h index ddea7be9c..96aae2e98 100644 --- a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h +++ b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h @@ -812,13 +812,13 @@ public: public: /// Constructor - CStaticItem() { init(); } + CStaticItem() { init(false); } /// copy constructor CStaticItem( const CStaticItem& itm ); /// init method - void init(); + void init(bool doDelete = true); /// destructor virtual ~CStaticItem(); From f6a5adb597a90d8ee1a8d574f08ddc64c7e0cbf5 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Tue, 23 Sep 2014 18:18:14 +0200 Subject: [PATCH 16/24] Remove debug message --- code/ryzom/client/src/progress.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/client/src/progress.cpp b/code/ryzom/client/src/progress.cpp index 8b5f72941..2631984e7 100644 --- a/code/ryzom/client/src/progress.cpp +++ b/code/ryzom/client/src/progress.cpp @@ -225,7 +225,7 @@ void CProgress::internalProgress (float value) if (!stereoHMD || StereoDisplay->wantInterface2D()) { - nldebug("Draw progress 2D"); + // nldebug("Draw progress 2D"); // Font factor float fontFactor = 1; From 3158f6d90e65a07bd18552987a6c4ce33d9b9c5e Mon Sep 17 00:00:00 2001 From: kaetemi Date: Tue, 23 Sep 2014 19:47:06 +0200 Subject: [PATCH 17/24] Handle GUI event only once --- code/nel/src/gui/widget_manager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index e3f1064fa..18a1f066f 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -2313,7 +2313,9 @@ namespace NLGUI getCapturePointerLeft() != getCapturePointerRight() ) handled|= getCapturePointerRight()->handleEvent(evnt); - if( _CapturedView != NULL ) + if( _CapturedView != NULL && + _CapturedView != getCapturePointerLeft() && + _CapturedView != getCapturePointerRight() ) _CapturedView->handleEvent( evnt ); CInterfaceGroup *ptr = getWindowUnder (eventDesc.getX(), eventDesc.getY()); From cdfbcfe1d8f3b2aa5f1342c5e951bfcb597c316c Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 24 Sep 2014 01:07:12 +0200 Subject: [PATCH 18/24] Add some more practical data build batch scripts --- code/nel/tools/build_gamedata/characters_dev.bat | 11 +++++++++++ code/nel/tools/build_gamedata/panoply_dev.bat | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 code/nel/tools/build_gamedata/characters_dev.bat create mode 100644 code/nel/tools/build_gamedata/panoply_dev.bat diff --git a/code/nel/tools/build_gamedata/characters_dev.bat b/code/nel/tools/build_gamedata/characters_dev.bat new file mode 100644 index 000000000..f2b374c47 --- /dev/null +++ b/code/nel/tools/build_gamedata/characters_dev.bat @@ -0,0 +1,11 @@ +title Ryzom Core: 1_export.py (CHARACTERS) +1_export.py -ipj common/characters common/characters_maps_hr +title Ryzom Core: 2_build.py (CHARACTERS) +2_build.py -ipj common/characters common/characters_maps_hr +title Ryzom Core: 3_install.py (CHARACTERS) +3_install.py -ipj common/characters common/characters_maps_hr +title Ryzom Core: b1_client_dev.py (CHARACTERS) +b1_client_dev.py +title Ryzom Core: b2_shard_data.py (CHARACTERS) +b2_shard_data.py +title Ryzom Core: Ready (CHARACTERS) diff --git a/code/nel/tools/build_gamedata/panoply_dev.bat b/code/nel/tools/build_gamedata/panoply_dev.bat new file mode 100644 index 000000000..13afac56c --- /dev/null +++ b/code/nel/tools/build_gamedata/panoply_dev.bat @@ -0,0 +1,11 @@ +title Ryzom Core: 1_export.py (PANOPLY) +1_export.py -ipj common/characters_maps_hr +title Ryzom Core: 2_build.py (PANOPLY) +2_build.py -ipj common/characters_maps_hr +title Ryzom Core: 3_install.py (PANOPLY) +3_install.py -ipj common/characters_maps_hr +title Ryzom Core: b1_client_dev.py (PANOPLY) +b1_client_dev.py +title Ryzom Core: b2_shard_data.py (PANOPLY) +b2_shard_data.py +title Ryzom Core: Ready (PANOPLY) From a943c939ef548288111155aa21c5e6cbe9b70469 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 24 Sep 2014 12:34:40 +0200 Subject: [PATCH 19/24] Add useful default config variables to dev client --- code/nel/tools/build_gamedata/b1_client_dev.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/nel/tools/build_gamedata/b1_client_dev.py b/code/nel/tools/build_gamedata/b1_client_dev.py index d8c77c1fa..a23ee693c 100755 --- a/code/nel/tools/build_gamedata/b1_client_dev.py +++ b/code/nel/tools/build_gamedata/b1_client_dev.py @@ -52,6 +52,10 @@ if not os.path.isfile(ClientDevDirectory + "/client.cfg"): cfg.write("PreDataPath = {\n") cfg.write("\t\"" + InstallDirectory + "\", \"user\", \"patch\", \"data\", \"examples\" \n") cfg.write("};\n") + cfg.write("PatchWanted = 0;\n") + cfg.write("DisplayLuaDebugInfo = 1;\n") + cfg.write("AllowDebugLua = 1;\n") + cfg.write("FullScreen = 0;\n") printLog(log, "") printLog(log, ">>> Install data <<<") From 161c8e5edcf4c5c192393bd5f03e01a2c6e927de Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 26 Sep 2014 23:29:38 +0200 Subject: [PATCH 20/24] Editbox selection should be stopped when the mouse button goes up, even if it happens outside of the box. --- code/nel/src/gui/group_editbox.cpp | 21 +++++++++++---------- code/nel/src/gui/widget_manager.cpp | 6 ++++++ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/code/nel/src/gui/group_editbox.cpp b/code/nel/src/gui/group_editbox.cpp index 751d9241b..c18c69134 100644 --- a/code/nel/src/gui/group_editbox.cpp +++ b/code/nel/src/gui/group_editbox.cpp @@ -1320,6 +1320,16 @@ namespace NLGUI } } + // if click, and not frozen, then get the focus + if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup && !_Frozen) + { + _SelectingText = false; + if (_SelectCursorPos == _CursorPos) + _CurrSelection = NULL; + + return true; + } + if (!isIn(eventDesc.getX(), eventDesc.getY())) return false; @@ -1329,6 +1339,7 @@ namespace NLGUI _SelectingText = true; stopParentBlink(); CWidgetManager::getInstance()->setCaptureKeyboard (this); + CWidgetManager::getInstance()->setCapturePointerLeft (this); // set the right cursor position uint newCurPos; bool cursorAtPreviousLineEnd; @@ -1356,16 +1367,6 @@ namespace NLGUI return true; } - // if click, and not frozen, then get the focus - if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup && !_Frozen) - { - _SelectingText = false; - if (_SelectCursorPos == _CursorPos) - _CurrSelection = NULL; - - return true; - } - if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightdown) { CWidgetManager::getInstance()->setCapturePointerRight(this); diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 18a1f066f..a448603c0 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -2539,6 +2539,12 @@ namespace NLGUI { if ( getCapturePointerLeft() != NULL) { + if( !handled ) + { + CCtrlBase *c = getCapturePointerLeft(); + c->handleEvent( evnt ); + } + setCapturePointerLeft(NULL); handled = true; } From 2b02fd2c37279038f80a6968959f980a12f0c3a9 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sat, 27 Sep 2014 15:55:57 +0300 Subject: [PATCH 21/24] Add maxlength attribute to input and textarea tags --- code/nel/include/nel/gui/group_html.h | 3 ++- code/nel/include/nel/gui/libwww.h | 1 + code/nel/src/gui/group_html.cpp | 27 +++++++++++++++++---------- code/nel/src/gui/libwww.cpp | 1 + 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 3f5526197..ba34af2dd 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -285,7 +285,7 @@ namespace NLGUI void addImage(const char *image, bool globalColor, bool reloadImg=false); // Add a text area in the current paragraph - CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content); + CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content, uint maxlength); // Add a combo box in the current paragraph CDBGroupComboBox *addComboBox(const std::string &templateName, const char *name); @@ -557,6 +557,7 @@ namespace NLGUI std::string _TextAreaName; uint _TextAreaRow; uint _TextAreaCols; + uint _TextAreaMaxLength; // current mode is in select option bool _SelectOption; diff --git a/code/nel/include/nel/gui/libwww.h b/code/nel/include/nel/gui/libwww.h index 8da217382..ec23cafd2 100644 --- a/code/nel/include/nel/gui/libwww.h +++ b/code/nel/include/nel/gui/libwww.h @@ -189,6 +189,7 @@ namespace NLGUI HTML_ATTR(TEXTAREA,DISABLED), HTML_ATTR(TEXTAREA,ID), HTML_ATTR(TEXTAREA,LANG), + HTML_ATTR(TEXTAREA,MAXLENGTH), HTML_ATTR(TEXTAREA,NAME), HTML_ATTR(TEXTAREA,READONLY), HTML_ATTR(TEXTAREA,ROWS), diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 9f19f383a..1a2ae5b4b 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -1289,16 +1289,19 @@ namespace NLGUI string name; ucstring ucValue; uint size = 120; + uint maxlength = 1024; if (present[MY_HTML_INPUT_NAME] && value[MY_HTML_INPUT_NAME]) name = value[MY_HTML_INPUT_NAME]; if (present[MY_HTML_INPUT_SIZE] && value[MY_HTML_INPUT_SIZE]) fromString(value[MY_HTML_INPUT_SIZE], size); if (present[MY_HTML_INPUT_VALUE] && value[MY_HTML_INPUT_VALUE]) ucValue.fromUtf8(value[MY_HTML_INPUT_VALUE]); + if (present[MY_HTML_INPUT_MAXLENGTH] && value[MY_HTML_INPUT_MAXLENGTH]) + fromString(value[MY_HTML_INPUT_MAXLENGTH], maxlength); string textTemplate(!templateName.empty() ? templateName : DefaultFormTextGroup); // Add the editbox - CInterfaceGroup *textArea = addTextArea (textTemplate, name.c_str (), 1, size/12, false, ucValue); + CInterfaceGroup *textArea = addTextArea (textTemplate, name.c_str (), 1, size/12, false, ucValue, maxlength); if (textArea) { // Add the text area to the form @@ -1553,12 +1556,15 @@ namespace NLGUI _TextAreaRow = 1; _TextAreaCols = 10; _TextAreaContent = ""; - if (present[HTML_TEXTAREA_NAME] && value[HTML_TEXTAREA_NAME]) - _TextAreaName = value[HTML_TEXTAREA_NAME]; - if (present[HTML_TEXTAREA_ROWS] && value[HTML_TEXTAREA_ROWS]) - fromString(value[HTML_TEXTAREA_ROWS], _TextAreaRow); - if (present[HTML_TEXTAREA_COLS] && value[HTML_TEXTAREA_COLS]) - fromString(value[HTML_TEXTAREA_COLS], _TextAreaCols); + _TextAreaMaxLength = 1024; + if (present[MY_HTML_TEXTAREA_NAME] && value[MY_HTML_TEXTAREA_NAME]) + _TextAreaName = value[MY_HTML_TEXTAREA_NAME]; + if (present[MY_HTML_TEXTAREA_ROWS] && value[MY_HTML_TEXTAREA_ROWS]) + fromString(value[MY_HTML_TEXTAREA_ROWS], _TextAreaRow); + if (present[MY_HTML_TEXTAREA_COLS] && value[MY_HTML_TEXTAREA_COLS]) + fromString(value[MY_HTML_TEXTAREA_COLS], _TextAreaCols); + if (present[MY_HTML_TEXTAREA_MAXLENGTH] && value[MY_HTML_TEXTAREA_MAXLENGTH]) + fromString(value[MY_HTML_TEXTAREA_MAXLENGTH], _TextAreaMaxLength); _TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup; _TextArea = true; @@ -1680,7 +1686,7 @@ namespace NLGUI // nlinfo("textarea name '%s'", _TextAreaName.c_str()); // nlinfo("textarea %d %d", _TextAreaRow, _TextAreaCols); // nlinfo("textarea content '%s'", _TextAreaContent.toUtf8().c_str()); - CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, _TextAreaContent); + CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, _TextAreaContent, _TextAreaMaxLength); if (textArea) { // Add the text area to the form @@ -3258,7 +3264,7 @@ namespace NLGUI // *************************************************************************** - CInterfaceGroup *CGroupHTML::addTextArea(const std::string &templateName, const char *name, uint /* rows */, uint cols, bool multiLine, const ucstring &content) + CInterfaceGroup *CGroupHTML::addTextArea(const std::string &templateName, const char *name, uint /* rows */, uint cols, bool multiLine, const ucstring &content, uint maxlength) { // In a paragraph ? if (!_Paragraph) @@ -3280,7 +3286,8 @@ namespace NLGUI templateParams.push_back (std::pair ("multiline", multiLine?"true":"false")); templateParams.push_back (std::pair ("want_return", multiLine?"true":"false")); templateParams.push_back (std::pair ("enter_recover_focus", "false")); - templateParams.push_back (std::pair ("max_num_chars", "1024")); + if (maxlength > 0) + templateParams.push_back (std::pair ("max_num_chars", toString(maxlength))); CInterfaceGroup *textArea = CWidgetManager::getInstance()->getParser()->createGroupInstance (templateName.c_str(), getParagraph()->getId(), templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size()); diff --git a/code/nel/src/gui/libwww.cpp b/code/nel/src/gui/libwww.cpp index 1e5f7a226..0b759a7aa 100644 --- a/code/nel/src/gui/libwww.cpp +++ b/code/nel/src/gui/libwww.cpp @@ -201,6 +201,7 @@ namespace NLGUI HTML_ATTR(TEXTAREA,DISABLED), HTML_ATTR(TEXTAREA,ID), HTML_ATTR(TEXTAREA,LANG), + HTML_ATTR(TEXTAREA,MAXLENGTH), HTML_ATTR(TEXTAREA,NAME), HTML_ATTR(TEXTAREA,READONLY), HTML_ATTR(TEXTAREA,ROWS), From 039e8a83a4a03057dad7275b6d93fad97829981f Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 27 Sep 2014 18:20:29 +0200 Subject: [PATCH 22/24] Initialize struct member before use... --- code/nel/src/3d/driver/opengl/driver_opengl_window.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 751e72149..5bea65771 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -1851,6 +1851,9 @@ bool CDriverGL::setMode(const GfxMode& mode) #if defined(NL_OS_WINDOWS) // save relative cursor POINT cursorPos; + cursorPos.x = 0; + cursorPos.y = 0; + BOOL cursorPosOk = isSystemCursorInClientArea() && GetCursorPos(&cursorPos) && ScreenToClient(_win, &cursorPos); From e0151ffa173a7631bc176599a66c383272e2cb64 Mon Sep 17 00:00:00 2001 From: nimetu Date: Tue, 30 Sep 2014 11:16:28 +0000 Subject: [PATCH 23/24] static libxml2 under linux requires lzma (tested on fedora/debian) --- code/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 071554e06..e0f3fe7ba 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -110,6 +110,10 @@ FIND_PACKAGE(Jpeg) IF(WITH_STATIC_LIBXML2) SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC) + IF(NOT WIN32 AND NOT APPLE) + FIND_PACKAGE(LibLZMA REQUIRED) + SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES}) + ENDIF(NOT WIN32 AND NOT APPLE) ENDIF(WITH_STATIC_LIBXML2) IF(WITH_STATIC) From adf5cb28b513e74f41f3ad8c5feb514df8142986 Mon Sep 17 00:00:00 2001 From: nimetu Date: Tue, 30 Sep 2014 11:23:16 +0000 Subject: [PATCH 24/24] find lua version for luabind under fedora --- code/CMakeModules/FindLuabind.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/CMakeModules/FindLuabind.cmake b/code/CMakeModules/FindLuabind.cmake index f61885be8..14f67ce44 100644 --- a/code/CMakeModules/FindLuabind.cmake +++ b/code/CMakeModules/FindLuabind.cmake @@ -11,6 +11,12 @@ MACRO(FIND_CORRECT_LUA_VERSION) SET(LUA52_LIBRARY "liblua5.2") CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND) + + IF(NOT LUALIB_FOUND) + # fedora (v20) + SET(LUA52_LIBRARY "liblua-5.2") + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND) + ENDIF(NOT LUALIB_FOUND) IF(LUALIB_FOUND) MESSAGE(STATUS "Luabind is using Lua 5.2")