From 06ed0489f406154700efcd2ef12bf2b48d5f76e6 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 22 Jul 2012 02:46:33 +0200 Subject: [PATCH] CHANGED: #1471 Don't show the over texture for buttons when in editor mode. --- code/nel/include/nel/gui/interface_element.h | 11 +++++++++++ code/nel/src/gui/ctrl_button.cpp | 8 ++++---- code/nel/src/gui/ctrl_text_button.cpp | 8 ++++---- code/nel/src/gui/interface_element.cpp | 1 + .../src/plugins/gui_editor/nelgui_widget.cpp | 1 + 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/code/nel/include/nel/gui/interface_element.h b/code/nel/include/nel/gui/interface_element.h index 095fef7c3..7c510bbfe 100644 --- a/code/nel/include/nel/gui/interface_element.h +++ b/code/nel/include/nel/gui/interface_element.h @@ -105,6 +105,8 @@ namespace NLGUI _RenderLayer= 0; _AvoidResizeParent= false; + + editorSelected = false; } // dtor @@ -458,8 +460,17 @@ namespace NLGUI bool isInGroup( CInterfaceGroup *group ); + static void setEditorMode( bool b ){ editorMode = b; } + + void setEditorSelected( bool b ){ editorSelected = b; } + bool isEditorSelected() const{ return editorSelected; } + protected: + bool editorSelected; + + static bool editorMode; + ///the parent CInterfaceGroup* _Parent; diff --git a/code/nel/src/gui/ctrl_button.cpp b/code/nel/src/gui/ctrl_button.cpp index 3890065b0..bda33c179 100644 --- a/code/nel/src/gui/ctrl_button.cpp +++ b/code/nel/src/gui/ctrl_button.cpp @@ -135,7 +135,7 @@ namespace NLGUI { case ToggleButton: { - if (_Pushed) + if (_Pushed && !editorMode ) { nTxId = _TextureIdPushed; color = getCurrentColorPushed(globalColor); @@ -161,7 +161,7 @@ namespace NLGUI } else { - if ((_Over) && (CWidgetManager::getInstance()->getCapturePointerLeft() == this)) + if ( (_Over) && (CWidgetManager::getInstance()->getCapturePointerLeft() == this) && !editorMode ) { nTxId = _TextureIdPushed; color = getCurrentColorPushed(globalColor); @@ -177,7 +177,7 @@ namespace NLGUI break; case PushButton: { - if (_Over && (CWidgetManager::getInstance()->getCapturePointerLeft() == this)) + if ( _Over && (CWidgetManager::getInstance()->getCapturePointerLeft() == this) && !editorMode ) { nTxId = _TextureIdPushed; color = getCurrentColorPushed(globalColor); @@ -218,7 +218,7 @@ namespace NLGUI - if (_Over) + if ( _Over && !editorMode ) { if ((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 75964ee36..f1596ca96 100644 --- a/code/nel/src/gui/ctrl_text_button.cpp +++ b/code/nel/src/gui/ctrl_text_button.cpp @@ -278,7 +278,7 @@ namespace NLGUI { case ToggleButton: { - if (_Pushed) + if (_Pushed && !editorMode ) { pTxId = _TextureIdPushed; color = getCurrentColorPushed(globalColor); @@ -304,7 +304,7 @@ namespace NLGUI } else { - if ((_Over) && (CWidgetManager::getInstance()->getCapturePointerLeft() == this)) + if ((_Over) && (CWidgetManager::getInstance()->getCapturePointerLeft() == this) && !editorMode ) { pTxId = _TextureIdPushed; color = getCurrentColorPushed(globalColor); @@ -320,7 +320,7 @@ namespace NLGUI break; case PushButton: { - if (_Over && (CWidgetManager::getInstance()->getCapturePointerLeft() == this)) + if (_Over && (CWidgetManager::getInstance()->getCapturePointerLeft() == this) && !editorMode ) { pTxId = _TextureIdPushed; color = getCurrentColorPushed(globalColor); @@ -355,7 +355,7 @@ namespace NLGUI rVR.drawRotFlipBitmap ( _RenderLayer, x+_BmpLeftW+txw, y, _BmpRightW, txh, 0, false, pTxId[2], color ); // *** Draw Over - if (_Over && (_OverWhenPushed || !(_Pushed || CWidgetManager::getInstance()->getCapturePointerLeft() == this))) + if ( !editorMode && _Over && (_OverWhenPushed || !(_Pushed || CWidgetManager::getInstance()->getCapturePointerLeft() == this))) { if ((lastOver == false) && (_AHOnOver != NULL)) CAHManager::getInstance()->runActionHandler (_AHOnOver, this, _AHOverParams); diff --git a/code/nel/src/gui/interface_element.cpp b/code/nel/src/gui/interface_element.cpp index affc6ef31..2c3673ac6 100644 --- a/code/nel/src/gui/interface_element.cpp +++ b/code/nel/src/gui/interface_element.cpp @@ -31,6 +31,7 @@ using namespace NLMISC; namespace NLGUI { + bool CInterfaceElement::editorMode = false; // ------------------------------------------------------------------------------------------------ CInterfaceElement::~CInterfaceElement() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp index f6f8d0e61..006c1034a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp @@ -62,6 +62,7 @@ namespace GUIEditor NLGUI::CAHManager::setEditorMode( true ); NLGUI::CLuaManager::setEditorMode( true ); + NLGUI::CInterfaceElement::setEditorMode( true ); NLGUI::CViewRenderer::setDriver( getDriver() ); NLGUI::CViewRenderer::setTextContext( getTextContext() );