From aa2affa158f27bcbc84adfd2290b1e69b52f519d Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Thu, 7 Mar 2013 06:01:33 +0100 Subject: [PATCH] MODIFIED: Draw the highlight of the currently selected widget in editor mode. --HG-- branch : gsoc2012-gui-editor --- code/nel/include/nel/gui/interface_element.h | 2 ++ code/nel/src/gui/ctrl_button.cpp | 2 +- code/nel/src/gui/ctrl_text_button.cpp | 3 +-- code/nel/src/gui/interface_element.cpp | 5 +++++ code/nel/src/gui/widget_manager.cpp | 10 ++++++++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/code/nel/include/nel/gui/interface_element.h b/code/nel/include/nel/gui/interface_element.h index 570dbf689..2b1fa32c0 100644 --- a/code/nel/include/nel/gui/interface_element.h +++ b/code/nel/include/nel/gui/interface_element.h @@ -424,6 +424,8 @@ namespace NLGUI void drawHotSpot(THotSpot hs, NLMISC::CRGBA col); + void drawHighlight(); + // Returns 'true' if that element can be downcasted to a view virtual bool isView() const { return false; } diff --git a/code/nel/src/gui/ctrl_button.cpp b/code/nel/src/gui/ctrl_button.cpp index e4ad08074..c680ee973 100644 --- a/code/nel/src/gui/ctrl_button.cpp +++ b/code/nel/src/gui/ctrl_button.cpp @@ -357,7 +357,7 @@ namespace NLGUI - if ( ( _Over && !editorMode ) || editorSelected ) + if ( ( _Over && !editorMode ) ) { if( !editorMode && (lastOver == false) && (_AHOnOver != NULL)) diff --git a/code/nel/src/gui/ctrl_text_button.cpp b/code/nel/src/gui/ctrl_text_button.cpp index 332358b15..a527bb06f 100644 --- a/code/nel/src/gui/ctrl_text_button.cpp +++ b/code/nel/src/gui/ctrl_text_button.cpp @@ -774,8 +774,7 @@ namespace NLGUI CCtrlBase *capturePointerLeft = CWidgetManager::getInstance()->getCapturePointerLeft(); // *** Draw Over - if( editorSelected || - ( !editorMode && _Over && (_OverWhenPushed || !(_Pushed || capturePointerLeft == this ) ) ) + if( ( !editorMode && _Over && (_OverWhenPushed || !(_Pushed || capturePointerLeft == this ) ) ) ) { if( !editorMode && (lastOver == false) && (_AHOnOver != NULL) ) diff --git a/code/nel/src/gui/interface_element.cpp b/code/nel/src/gui/interface_element.cpp index b369b96d1..dc51735ff 100644 --- a/code/nel/src/gui/interface_element.cpp +++ b/code/nel/src/gui/interface_element.cpp @@ -1300,6 +1300,11 @@ namespace NLGUI } + void CInterfaceElement::drawHighlight() + { + CViewRenderer::getInstance()->drawWiredQuad( _XReal, _YReal, _WReal, _HReal ); + } + // *************************************************************************** void CInterfaceElement::invalidateContent() { diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 8cc43cc9d..90103840c 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -2056,6 +2056,16 @@ namespace NLGUI getPointer()->draw (); } + if( CInterfaceElement::getEditorMode() ) + { + if( !currentEditorSelection.empty() ) + { + CInterfaceElement *e = getElementFromId( currentEditorSelection ); + if( e != NULL ) + e->drawHighlight(); + } + } + // flush layers CViewRenderer::getInstance()->flush();