From 6737dfb1b6788ec19ef7c5ed6fcebd0ae54a371f Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 8 Oct 2014 18:45:17 +0200 Subject: [PATCH] Make group selection optional. --- code/nel/include/nel/gui/widget_manager.h | 3 +++ code/nel/src/gui/widget_manager.cpp | 3 ++- .../plugins/gui_editor/editor_message_processor.cpp | 5 +++++ .../src/plugins/gui_editor/editor_message_processor.h | 1 + .../src/plugins/gui_editor/gui_editor_window.cpp | 10 ++++++++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/code/nel/include/nel/gui/widget_manager.h b/code/nel/include/nel/gui/widget_manager.h index 89023c445..8790fc272 100644 --- a/code/nel/include/nel/gui/widget_manager.h +++ b/code/nel/include/nel/gui/widget_manager.h @@ -516,6 +516,8 @@ namespace NLGUI void unregisterWidgetWatcher( IWidgetWatcher *watcher ); CInterfaceElement* addWidgetToGroup( std::string &group, std::string &widgetClass, std::string &widgetName ); + + void setGroupSelection( bool b ){ groupSelection = b; } private: CWidgetManager(); @@ -610,6 +612,7 @@ namespace NLGUI std::string currentEditorSelection; + bool groupSelection; }; } diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index f0fbe1b1a..c6068b363 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -2408,7 +2408,7 @@ namespace NLGUI // This may happen when alt-tab has been used => the sheet is dragged but the left button is up if (!CCtrlDraggable::getDraggedSheet()) { - if( CInterfaceElement::getEditorMode() ) + if( CInterfaceElement::getEditorMode() && groupSelection ) { for( sint32 i = _GroupsUnderPointer.size() - 1; i >= 0; i-- ) { @@ -3516,6 +3516,7 @@ namespace NLGUI setScreenWH( 0, 0 ); currentEditorSelection = ""; + groupSelection = false; } CWidgetManager::~CWidgetManager() diff --git a/code/studio/src/plugins/gui_editor/editor_message_processor.cpp b/code/studio/src/plugins/gui_editor/editor_message_processor.cpp index 691dbdead..e834aa21f 100644 --- a/code/studio/src/plugins/gui_editor/editor_message_processor.cpp +++ b/code/studio/src/plugins/gui_editor/editor_message_processor.cpp @@ -130,5 +130,10 @@ namespace GUIEditor e->setActive( false ); e->setActive( true ); } + + void CEditorMessageProcessor::onSetGroupSelection( bool b ) + { + CWidgetManager::getInstance()->setGroupSelection( b ); + } } diff --git a/code/studio/src/plugins/gui_editor/editor_message_processor.h b/code/studio/src/plugins/gui_editor/editor_message_processor.h index 5c19a03c2..5d4098272 100644 --- a/code/studio/src/plugins/gui_editor/editor_message_processor.h +++ b/code/studio/src/plugins/gui_editor/editor_message_processor.h @@ -38,6 +38,7 @@ namespace GUIEditor public Q_SLOTS: void onDelete(); void onAdd( const QString &parentGroup, const QString &widgetType, const QString &name ); + void onSetGroupSelection( bool b ); private: CWidgetInfoTree *tree; diff --git a/code/studio/src/plugins/gui_editor/gui_editor_window.cpp b/code/studio/src/plugins/gui_editor/gui_editor_window.cpp index 9f6568936..3a4f982aa 100644 --- a/code/studio/src/plugins/gui_editor/gui_editor_window.cpp +++ b/code/studio/src/plugins/gui_editor/gui_editor_window.cpp @@ -399,6 +399,16 @@ namespace GUIEditor connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onAddWidgetClicked() ) ); m->addAction( a ); + + // ---------------------------------------------------------------------------------- + m->addSeparator(); + + a = new QAction( "Select groups", this ); + a->setCheckable( true ); + a->setChecked( false ); + connect( a, SIGNAL( triggered( bool ) ), messageProcessor, SLOT( onSetGroupSelection( bool ) ) ); + m->addAction( a ); + menu = m; } }