diff --git a/code/nel/include/nel/gui/interface_parser.h b/code/nel/include/nel/gui/interface_parser.h
index f2c16ebe4..2893adfbf 100644
--- a/code/nel/include/nel/gui/interface_parser.h
+++ b/code/nel/include/nel/gui/interface_parser.h
@@ -27,6 +27,7 @@
#include "nel/gui/lua_helper.h"
#include "nel/gui/proc.h"
#include "nel/gui/widget_manager.h"
+#include "nel/gui/link_data.h"
namespace NLGUI
{
@@ -324,6 +325,11 @@ namespace NLGUI
bool luaInitialized;
ISetupOptionCallbackClass *setupCallback;
+ uint32 linkId;
+ std::map< uint32, SLinkData > links;
+
+ bool editorMode;
+
public:
void initLUA();
void uninitLUA();
@@ -340,6 +346,11 @@ namespace NLGUI
bool hasProc( const std::string &name ) const;
bool addProc( const std::string &name );
bool removeProc( const std::string &name );
+
+ const std::map< uint32, SLinkData >& getLinkMap() const{ return links; }
+ void addLinkData( const SLinkData &linkData );
+
+ void setEditorMode( bool b ){ editorMode = b; }
};
}
diff --git a/code/nel/include/nel/gui/link_data.h b/code/nel/include/nel/gui/link_data.h
new file mode 100644
index 000000000..66aac9ced
--- /dev/null
+++ b/code/nel/include/nel/gui/link_data.h
@@ -0,0 +1,40 @@
+// Ryzom - MMORPG Framework
+// 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 .
+
+#ifndef LINKDATA_H
+#define LINKDATA_H
+
+#include
+
+namespace NLGUI
+{
+
+ struct SLinkData
+ {
+ public:
+ std::string parent;
+ std::string expr;
+ std::string target;
+ std::string action;
+ std::string params;
+ std::string cond;
+ };
+
+
+}
+
+
+#endif
diff --git a/code/nel/include/nel/gui/parser.h b/code/nel/include/nel/gui/parser.h
index 06fdc4c62..aba7d1f82 100644
--- a/code/nel/include/nel/gui/parser.h
+++ b/code/nel/include/nel/gui/parser.h
@@ -22,6 +22,7 @@
#include
#include "nel/misc/types_nl.h"
#include "nel/gui/proc.h"
+#include "nel/gui/link_data.h"
namespace NLGUI
{
@@ -71,6 +72,9 @@ namespace NLGUI
virtual bool hasProc( const std::string &name ) const = 0;
virtual bool addProc( const std::string &name ) = 0;
virtual bool removeProc( const std::string &name ) = 0;
+ virtual void setEditorMode( bool b ) = 0;
+ virtual const std::map< uint32, SLinkData >& getLinkMap() const = 0;
+ virtual void addLinkData( const SLinkData &linkData ) = 0;
};
}
diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp
index 520aec87a..bd9217eb3 100644
--- a/code/nel/src/gui/interface_parser.cpp
+++ b/code/nel/src/gui/interface_parser.cpp
@@ -200,6 +200,8 @@ namespace NLGUI
{
luaInitialized = false;
cacheUIParsing = false;
+ linkId = 0;
+ editorMode = false;
setupCallback = NULL;
}
@@ -991,6 +993,7 @@ namespace NLGUI
std::vector targets;
ptr = (char*) xmlGetProp (cur, (xmlChar*)"target");
+ std::string target = ptr;
if (ptr)
{
CInterfaceLink::splitLinkTargets(std::string((const char*)ptr), parentGroup, targets);
@@ -1009,6 +1012,20 @@ namespace NLGUI
// create the link
CInterfaceLink *il = new CInterfaceLink;
il->init(targets, expr, action, params, cond, parentGroup); // init will add 'il' in the list of link present in 'elm'
+
+ if( editorMode )
+ {
+ SLinkData linkData;
+ linkData.parent = parentGroup->getId();
+ linkData.expr = expr;
+ linkData.target = target;
+ linkData.action = action;
+ linkData.cond = cond;
+ linkData.params = params;
+
+ addLinkData( linkData );
+ }
+
return true;
}
@@ -2814,5 +2831,10 @@ namespace NLGUI
_ProcedureMap.erase( itr );
return true;
}
+
+ void CInterfaceParser::addLinkData( const SLinkData &linkData )
+ {
+ links[ ++linkId ] = linkData;
+ }
}
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 8b31cce7c..86873ac4d 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
@@ -15,6 +15,7 @@ SET(OVQT_PLUGIN_GUI_EDITOR_HDR
gui_editor_context.h
widget_properties.h
widget_hierarchy.h
+ link_list.h
link_editor.h
proc_list.h
proc_editor.h
@@ -29,6 +30,7 @@ SET(OVQT_PLUGIN_GUI_EDITOR_UIS
gui_editor_window.ui
widget_properties.ui
widget_hierarchy.ui
+ link_list.ui
link_editor.ui
proc_list.ui
proc_editor.ui
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 27c10107f..a4a5b69c2 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
@@ -33,7 +33,7 @@
#include "widget_properties.h"
#include "widget_properties_parser.h"
#include "widget_hierarchy.h"
-#include "link_editor.h"
+#include "link_list.h"
#include "proc_list.h"
#include "project_file_parser.h"
#include "project_window.h"
@@ -51,7 +51,7 @@ namespace GUIEditor
m_ui.setupUi(this);
m_undoStack = new QUndoStack(this);
widgetProps = new CWidgetProperties;
- linkEditor = new LinkEditor;
+ linkList = new LinkList;
procList = new ProcList;
projectWindow = new ProjectWindow;
connect( projectWindow, SIGNAL( projectFilesChanged() ), this, SLOT( onProjectFilesChanged() ) );
@@ -85,6 +85,7 @@ namespace GUIEditor
connect( viewPort, SIGNAL( guiLoadComplete() ), hierarchyView, SLOT( onGUILoaded() ) );
connect( viewPort, SIGNAL( guiLoadComplete() ), procList, SLOT( onGUILoaded() ) );
+ connect( viewPort, SIGNAL( guiLoadComplete() ), linkList, SLOT( onGUILoaded() ) );
}
GUIEditorWindow::~GUIEditorWindow()
@@ -94,8 +95,8 @@ namespace GUIEditor
delete widgetProps;
widgetProps = NULL;
- delete linkEditor;
- linkEditor = NULL;
+ delete linkList;
+ linkList = NULL;
delete procList;
procList = NULL;
@@ -194,7 +195,7 @@ namespace GUIEditor
m->addAction( a );
a = new QAction( "Link Editor", this );
- connect( a, SIGNAL( triggered( bool ) ), linkEditor, SLOT( show() ) );
+ connect( a, SIGNAL( triggered( bool ) ), linkList, SLOT( show() ) );
m->addAction( a );
a = new QAction( "Procedure Editor", this );
@@ -204,10 +205,6 @@ namespace GUIEditor
a = new QAction( "Project Window", this );
connect( a, SIGNAL( triggered( bool ) ), projectWindow, SLOT( show() ) );
m->addAction( a );
-
- a = new QAction( "Clear Viewport", this );
- connect( a, SIGNAL( triggered( bool ) ), viewPort, SLOT( clear() ) );
- m->addAction( a );
}
}
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 d7fe15245..1e3527d19 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
@@ -31,7 +31,7 @@ namespace GUIEditor
class CWidgetProperties;
class WidgetHierarchy;
- class LinkEditor;
+ class LinkList;
class ProcList;
class ProjectWindow;
class NelGUIWidget;
@@ -67,7 +67,7 @@ private:
CWidgetProperties *widgetProps;
WidgetHierarchy *hierarchyView;
QtTreePropertyBrowser *propBrowser;
- LinkEditor *linkEditor;
+ LinkList *linkList;
ProcList *procList;
ProjectWindow *projectWindow;
NelGUIWidget *viewPort;
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.cpp
index 7a028f649..a0dd8e78e 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.cpp
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.cpp
@@ -16,6 +16,8 @@
#include "link_editor.h"
+#include "nel/gui/interface_group.h"
+#include "nel/gui/widget_manager.h"
namespace GUIEditor
{
@@ -23,6 +25,7 @@ namespace GUIEditor
QWidget( parent )
{
setupUi( this );
+ setup();
connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( hide() ) );
connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( hide() ) );
}
@@ -30,4 +33,50 @@ namespace GUIEditor
LinkEditor::~LinkEditor()
{
}
+
+ void LinkEditor::setup()
+ {
+ expressionEdit->clear();
+ groupCB->setCheckable( true );
+ groupCB->setChecked( false );
+ groupCB->setDisabled( true );
+ ahCB->setCheckable( true );
+ ahCB->setChecked( false );
+ ahCB->setDisabled( true );
+ ahEdit->clear();
+ ahParamEdit->clear();
+ ahParamEdit->setDisabled( true );
+ }
+
+ void LinkEditor::setLinkId( uint32 linkId )
+ {
+ setup();
+ currentLinkId = linkId;
+
+ const std::map< uint32, SLinkData > &linkMap =
+ CWidgetManager::getInstance()->getParser()->getLinkMap();
+
+ std::map< uint32, SLinkData >::const_iterator itr =
+ linkMap.find( currentLinkId );
+
+ if( itr == linkMap.end() )
+ return;
+ SLinkData data = itr->second;
+
+ expressionEdit->setPlainText( data.expr.c_str() );
+ if( !data.target.empty() )
+ {
+ groupCB->setEnabled( true );
+ groupCB->setChecked( true );
+ ahEdit->setText( data.target.c_str() );
+ }
+ else
+ {
+ ahCB->setEnabled( true );
+ ahCB->setChecked( true );
+ ahEdit->setText( data.action.c_str() );
+ ahParamEdit->setEnabled( true );
+ ahParamEdit->setText( data.params.c_str() );
+ }
+ }
}
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.h
index 93b7fb348..ca6286022 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.h
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.h
@@ -19,6 +19,7 @@
#define LINK_EDITOR_H
#include "ui_link_editor.h"
+#include "nel/misc/types_nl.h"
namespace GUIEditor
{
@@ -28,6 +29,11 @@ namespace GUIEditor
public:
LinkEditor( QWidget *parent = NULL );
~LinkEditor();
+ void setup();
+ void setLinkId( uint32 linkId );
+
+ private:
+ uint32 currentLinkId;
};
}
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.ui
index e72fe972c..328a85709 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.ui
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.ui
@@ -10,92 +10,88 @@
0
0
545
- 340
+ 348
Link Editor
-
- -
+
+
-
Expression
- -
+
-
expression
- -
+
-
- When the condition is met
+ When the expression is evaluated
- -
+
-
- Activate group
+ Pass result to targeted group(s)
- -
+
-
Run Action Handler
- -
+
-
- Group or action handler
+ Targeted group(s) or action handler
- -
+
-
Action Handler parameters
- -
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 348
- 20
-
-
-
-
- -
-
-
- OK
-
-
-
- -
-
-
- Cancel
-
-
-
-
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 362
+ 20
+
+
+
+
+ -
+
+
+ OK
+
+
+
+ -
+
+
+ Cancel
+
+
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.cpp
new file mode 100644
index 000000000..94e808196
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.cpp
@@ -0,0 +1,79 @@
+// 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 "link_list.h"
+#include "link_editor.h"
+#include "nel/gui/interface_group.h"
+#include "nel/gui/widget_manager.h"
+#include "nel/gui/link_data.h"
+#include