diff --git a/code/nel/include/nel/gui/widget_manager.h b/code/nel/include/nel/gui/widget_manager.h
index 12f4a065b..498139ecf 100644
--- a/code/nel/include/nel/gui/widget_manager.h
+++ b/code/nel/include/nel/gui/widget_manager.h
@@ -485,6 +485,7 @@ namespace NLGUI
IParser* getParser() const{ return parser; }
+ std::string& getCurrentEditorSelection(){ return currentEditorSelection; }
void setCurrentEditorSelection( const std::string &name );
void notifySelectionWatchers();
void registerSelectionWatcher( IEditorSelectionWatcher *watcher );
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt
index c08157373..63a7d00cc 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt
@@ -61,6 +61,7 @@ SET(OVQT_PLUGIN_GUI_EDITOR_HDR
new_property_widget.h
new_widget_widget.h
editor_selection_watcher.h
+ editor_message_processor.h
)
SET(OVQT_PLUGIN_GUI_EDITOR_UIS
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.cpp
new file mode 100644
index 000000000..944ce945a
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.cpp
@@ -0,0 +1,56 @@
+// Object Viewer Qt GUI Editor plugin
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#include
+#include "editor_message_processor.h"
+
+#include "nel/gui/interface_group.h"
+#include "nel/gui/widget_manager.h"
+
+namespace GUIEditor
+{
+ void CEditorMessageProcessor::onDelete()
+ {
+ std::string selection = CWidgetManager::getInstance()->getCurrentEditorSelection();
+ if( selection.empty() )
+ return;
+
+ QMessageBox::StandardButton r =
+ QMessageBox::question( NULL,
+ tr( "Deleting widget" ),
+ tr( "Are you sure you want to delete %1?" ).arg( selection.c_str() ),
+ QMessageBox::Yes | QMessageBox::No );
+ if( r != QMessageBox::Yes )
+ return;
+
+ CInterfaceElement *e =
+ CWidgetManager::getInstance()->getElementFromId( selection );
+ if( e == NULL )
+ return;
+
+ CInterfaceElement *p = e;
+ while( ( p != NULL ) && !p->isGroup() )
+ p = p->getParent();
+
+ CInterfaceGroup *g = dynamic_cast< CInterfaceGroup* >( p );
+ if( g == NULL )
+ return;
+
+ if( g->delElement( e ) )
+ CWidgetManager::getInstance()->setCurrentEditorSelection( "" );
+ }
+}
+
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.h
new file mode 100644
index 000000000..17cac7683
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.h
@@ -0,0 +1,33 @@
+// Object Viewer Qt GUI Editor plugin
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#include
+
+namespace GUIEditor
+{
+ /// Processes the GUI Editor's editor messages like delete, new, etc...
+ class CEditorMessageProcessor : public QObject
+ {
+ Q_OBJECT
+ public:
+ CEditorMessageProcessor( QObject *parent = NULL ) : QObject( parent ){}
+ ~CEditorMessageProcessor(){}
+
+ public Q_SLOTS:
+ void onDelete();
+ };
+}
+
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp
index 66945b562..f84b555d1 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp
@@ -42,6 +42,7 @@
#include "project_window.h"
#include "nelgui_widget.h"
#include "editor_selection_watcher.h"
+#include "editor_message_processor.h"
namespace GUIEditor
{
@@ -54,6 +55,7 @@ namespace GUIEditor
QMainWindow(parent)
{
m_ui.setupUi(this);
+ messageProcessor = new CEditorMessageProcessor;
m_undoStack = new QUndoStack(this);
widgetProps = new CWidgetProperties;
linkList = new LinkList;
@@ -99,6 +101,9 @@ namespace GUIEditor
{
writeSettings();
+ delete messageProcessor;
+ messageProcessor = NULL;
+
delete widgetProps;
widgetProps = NULL;
@@ -311,6 +316,7 @@ namespace GUIEditor
QAction *saveAction = mm->action( Core::Constants::SAVE );
QAction *saveAsAction = mm->action( Core::Constants::SAVE_AS );
QAction *closeAction = mm->action( Core::Constants::CLOSE );
+ QAction *delAction = mm->action( Core::Constants::DEL );
//if( newAction != NULL )
// newAction->setEnabled( true );
@@ -320,6 +326,11 @@ namespace GUIEditor
saveAsAction->setEnabled( true );
if( closeAction != NULL )
closeAction->setEnabled( true );
+ if( delAction != NULL )
+ {
+ delAction->setEnabled( true );
+ connect( delAction, SIGNAL( triggered( bool ) ), messageProcessor, SLOT( onDelete() ) );
+ }
QMenu *menu = mm->menu( Core::Constants::M_TOOLS );
if( menu != NULL )
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h
index 41cd30e9a..37f33e91c 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h
@@ -36,6 +36,7 @@ namespace GUIEditor
class ProjectWindow;
class NelGUIWidget;
class CWidgetInfoTree;
+ class CEditorMessageProcessor;
class GUIEditorWindow: public QMainWindow
{
@@ -77,8 +78,8 @@ private:
ProcList *procList;
ProjectWindow *projectWindow;
NelGUIWidget *viewPort;
-
CWidgetInfoTree *widgetInfoTree;
+ CEditorMessageProcessor *messageProcessor;
CPropBrowserCtrl browserCtrl;
QString currentProject;