Merged in dfighter1985/ryzomcore/dfighter-tools (pull request #93)

Further GUI Editor improvements

--HG--
branch : develop
This commit is contained in:
Laszlo Kis-Adam 2014-10-13 20:17:57 +02:00
commit cd7f9035bc
52 changed files with 996 additions and 214 deletions

View file

@ -492,7 +492,9 @@ namespace NLGUI
bool isEditorSelected() const{ return editorSelected; } bool isEditorSelected() const{ return editorSelected; }
void setPosParent( const std::string &id ); void setPosParent( const std::string &id );
void getPosParent( std::string &id ) const;
void setSizeParent( const std::string &id ); void setSizeParent( const std::string &id );
void getSizeParent( std::string &id ) const;
void setSerializable( bool b ){ serializable = b; } void setSerializable( bool b ){ serializable = b; }
bool IsSerializable() const{ return serializable; } bool IsSerializable() const{ return serializable; }

View file

@ -28,6 +28,7 @@
#include "nel/gui/proc.h" #include "nel/gui/proc.h"
#include "nel/gui/widget_manager.h" #include "nel/gui/widget_manager.h"
#include "nel/gui/link_data.h" #include "nel/gui/link_data.h"
#include "nel/gui/variable_data.h"
namespace NLGUI namespace NLGUI
{ {
@ -100,20 +101,6 @@ namespace NLGUI
virtual void setupOptions() = 0; virtual void setupOptions() = 0;
}; };
struct VariableData
{
std::string entry;
std::string type;
std::string value;
uint32 size;
VariableData()
{
size = 0;
}
};
CInterfaceParser(); CInterfaceParser();
virtual ~CInterfaceParser(); virtual ~CInterfaceParser();
@ -353,7 +340,15 @@ namespace NLGUI
std::map< std::string, std::string > pointerSettings; std::map< std::string, std::string > pointerSettings;
std::map< std::string, std::map< std::string, std::string > > keySettings; std::map< std::string, std::map< std::string, std::string > > keySettings;
std::string _WorkDir;
public: public:
/// Sets the working directory, where files should be looked for
void setWorkDir( const std::string &workdir ){ _WorkDir = workdir; }
/// Looks up a file in either the working directory or using CPath::lookup
std::string lookup( const std::string &file );
void initLUA(); void initLUA();
void uninitLUA(); void uninitLUA();
bool isLuaInitialized() const{ return luaInitialized; } bool isLuaInitialized() const{ return luaInitialized; }
@ -378,6 +373,7 @@ namespace NLGUI
void setEditorMode( bool b ){ editorMode = b; } void setEditorMode( bool b ){ editorMode = b; }
void setVariable( const VariableData &v );
bool serializeVariables( xmlNodePtr parentNode ) const; bool serializeVariables( xmlNodePtr parentNode ) const;
bool serializeProcs( xmlNodePtr parentNode ) const; bool serializeProcs( xmlNodePtr parentNode ) const;
bool serializePointerSettings( xmlNodePtr parentNode ) const; bool serializePointerSettings( xmlNodePtr parentNode ) const;

View file

@ -23,6 +23,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/gui/proc.h" #include "nel/gui/proc.h"
#include "nel/gui/link_data.h" #include "nel/gui/link_data.h"
#include "nel/gui/variable_data.h"
namespace NLGUI namespace NLGUI
{ {
@ -83,11 +84,13 @@ namespace NLGUI
virtual void removeLinkData( uint32 id ) = 0; virtual void removeLinkData( uint32 id ) = 0;
virtual bool getLinkData( uint32 id, SLinkData &linkData ) = 0; virtual bool getLinkData( uint32 id, SLinkData &linkData ) = 0;
virtual void updateLinkData( uint32 id, const SLinkData &linkData ) = 0; virtual void updateLinkData( uint32 id, const SLinkData &linkData ) = 0;
virtual void setVariable( const VariableData &v ) = 0;
virtual bool serializeVariables( xmlNodePtr parentNode ) const = 0; virtual bool serializeVariables( xmlNodePtr parentNode ) const = 0;
virtual bool serializeProcs( xmlNodePtr parentNode ) const = 0; virtual bool serializeProcs( xmlNodePtr parentNode ) const = 0;
virtual bool serializePointerSettings( xmlNodePtr parentNode ) const = 0; virtual bool serializePointerSettings( xmlNodePtr parentNode ) const = 0;
virtual bool serializeKeySettings( xmlNodePtr parentNode ) const = 0; virtual bool serializeKeySettings( xmlNodePtr parentNode ) const = 0;
virtual CViewBase* createClass( const std::string &name ) = 0; virtual CViewBase* createClass( const std::string &name ) = 0;
virtual void setWorkDir( const std::string &workdir ) = 0;
}; };
} }

View file

@ -0,0 +1,46 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#ifndef ROOT_GROUP_H
#define ROOT_GROUP_H
#include <string>
#include <map>
#include "nel/gui/interface_group.h"
namespace NLGUI
{
class CRootGroup : public CInterfaceGroup
{
public:
CRootGroup(const TCtorParam &param);
virtual ~CRootGroup();
virtual CInterfaceElement* getElement (const std::string &id);
virtual void addGroup (CInterfaceGroup *child, sint eltOrder = -1);
virtual bool delGroup (CInterfaceGroup *child, bool dontDelete = false);
private:
std::map< std::string, CInterfaceGroup* > _Accel;
};
}
#endif

View file

@ -0,0 +1,41 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#ifndef VARIABLE_DATA_H
#define VARIABLE_DATA_H
#include "nel/misc/types_nl.h"
namespace NLGUI
{
struct VariableData
{
std::string entry;
std::string type;
std::string value;
uint32 size;
VariableData()
{
size = 0;
}
};
}
#endif

View file

@ -529,6 +529,8 @@ namespace NLGUI
bool unGroupSelection(); bool unGroupSelection();
void setMultiSelection( bool b ){ multiSelection = b; } void setMultiSelection( bool b ){ multiSelection = b; }
bool createNewGUI( const std::string &project, const std::string &window );
private: private:
CWidgetManager(); CWidgetManager();
~CWidgetManager(); ~CWidgetManager();

View file

@ -147,12 +147,16 @@ namespace NLGUI
} }
if( name == "posparent" ) if( name == "posparent" )
{ {
return CWidgetManager::getInstance()->getParser()->getParentPosAssociation( (CInterfaceElement*)this ); std::string pp;
getPosParent( pp );
return pp;
} }
else else
if( name == "sizeparent" ) if( name == "sizeparent" )
{ {
return CWidgetManager::getInstance()->getParser()->getParentSizeAssociation( (CInterfaceElement*)this ); std::string sp;
getSizeParent( sp );
return sp;
} }
else else
if( name == "global_color" ) if( name == "global_color" )
@ -294,11 +298,13 @@ namespace NLGUI
xmlNewProp( node, BAD_CAST "w", BAD_CAST toString( _W ).c_str() ); xmlNewProp( node, BAD_CAST "w", BAD_CAST toString( _W ).c_str() );
xmlNewProp( node, BAD_CAST "h", BAD_CAST toString( _H ).c_str() ); xmlNewProp( node, BAD_CAST "h", BAD_CAST toString( _H ).c_str() );
xmlNewProp( node, BAD_CAST "posref", BAD_CAST HotSpotCoupleToString( _ParentPosRef, _PosRef ).c_str() ); xmlNewProp( node, BAD_CAST "posref", BAD_CAST HotSpotCoupleToString( _ParentPosRef, _PosRef ).c_str() );
xmlNewProp( node, BAD_CAST "posparent",
BAD_CAST CWidgetManager::getInstance()->getParser()->getParentPosAssociation( (CInterfaceElement*)this ).c_str() ); std::string pp;
getPosParent( pp );
xmlNewProp( node, BAD_CAST "posparent", BAD_CAST pp.c_str() );
xmlNewProp( node, BAD_CAST "sizeref", BAD_CAST getSizeRefAsString().c_str() ); xmlNewProp( node, BAD_CAST "sizeref", BAD_CAST getSizeRefAsString().c_str() );
xmlNewProp( node, BAD_CAST "sizeparent", getSizeParent( pp );
BAD_CAST CWidgetManager::getInstance()->getParser()->getParentSizeAssociation( (CInterfaceElement*)this ).c_str() ); xmlNewProp( node, BAD_CAST "sizeparent", BAD_CAST pp.c_str() );
xmlNewProp( node, BAD_CAST "global_color", BAD_CAST toString( _ModulateGlobalColor ).c_str() ); xmlNewProp( node, BAD_CAST "global_color", BAD_CAST toString( _ModulateGlobalColor ).c_str() );
xmlNewProp( node, BAD_CAST "render_layer", BAD_CAST toString( _RenderLayer ).c_str() ); xmlNewProp( node, BAD_CAST "render_layer", BAD_CAST toString( _RenderLayer ).c_str() );
@ -1528,40 +1534,128 @@ namespace NLGUI
void CInterfaceElement::setPosParent( const std::string &id ) void CInterfaceElement::setPosParent( const std::string &id )
{ {
std::string Id = stripId( id ); // Parent or empty id simply means the group parent
if( ( id == "parent" ) || ( id.empty() ) )
if( Id != "parent" )
{ {
std::string idParent; setParentPos( getParent() );
if( _Parent != NULL ) return;
idParent = _Parent->getId() + ":";
else
idParent = "ui:";
CWidgetManager::getInstance()->getParser()->addParentPositionAssociation( this, idParent + Id );
} }
CInterfaceElement *pp = NULL;
// Check if it's a short Id
std::string::size_type idx = id.find( "ui:" );
if( idx == std::string::npos )
{
// If it is, find the widget in the parent group and set as posparent
CInterfaceGroup *p = getParent();
if( p != NULL )
{
pp = p->findFromShortId( id );
}
}
else
{
// If it is not, find using the widgetmanager
// TODO: refactor, shouldn't use a singleton
pp = CWidgetManager::getInstance()->getElementFromId( id );
}
if( pp != NULL )
setParentPos( pp );
}
void CInterfaceElement::getPosParent( std::string &id ) const
{
// If there's no pos parent set, then the parent group is the pos parent
if( getParentPos() == NULL )
{
id = "parent";
return;
}
// If pos parent and parent are the same then ofc the parent group is the pos parent...
CInterfaceElement *p = getParent();
if( getParentPos() == p )
{
id = "parent";
return;
}
// If parent is in the same group, use the short id
p = getParentPos();
if( p->isInGroup( getParent() ) )
{
id = p->getShortId();
return;
}
// Otherwise use the full id
id = p->getId();
} }
void CInterfaceElement::setSizeParent( const std::string &id ) void CInterfaceElement::setSizeParent( const std::string &id )
{ {
std::string Id = stripId( id ); // Parent or empty id simply means the group parent
std::string idParent; if( ( id == "parent" ) || ( id.empty() ) )
{
setParentSize( getParent() );
return;
}
if( Id != "parent" ) CInterfaceElement *pp = NULL;
// Check if it's a short Id
std::string::size_type idx = id.find( "ui:" );
if( idx == std::string::npos )
{ {
if( _Parent != NULL ) // If it is, find the widget in the parent group and set as posparent
idParent = _Parent->getId() + ":"; CInterfaceGroup *p = getParent();
else if( p != NULL )
idParent = "ui:"; {
CWidgetManager::getInstance()->getParser()->addParentSizeAssociation( this, idParent + Id ); pp = p->findFromShortId( id );
}
} }
else else
{ {
if( _Parent != NULL ) // If it is not, find using the widgetmanager
// TODO: refactor, shouldn't use a singleton
pp = CWidgetManager::getInstance()->getElementFromId( id );
}
if( pp != NULL )
setParentSize( pp );
}
void CInterfaceElement::getSizeParent( std::string &id ) const
{ {
idParent = _Parent->getId(); CInterfaceElement *p = getParentSize();
CWidgetManager::getInstance()->getParser()->addParentSizeAssociation( this, idParent );
// If there's no parent set then the size parent is the parent
if( p == NULL )
{
id = "parent";
return;
} }
// If the size parent is the same as the group parent, then the size parent is the parent ofc
if( p == getParent() )
{
id = "parent";
return;
} }
// If the size parent is in the parent group, use the short Id
if( p->isInGroup( getParent() ) )
{
id = p->getShortId();
return;
}
// Otherwise use the full Id
id = p->getId();
} }
void CInterfaceElement::registerDeletionWatcher( IDeletionWatcher *watcher ) void CInterfaceElement::registerDeletionWatcher( IDeletionWatcher *watcher )

View file

@ -37,6 +37,7 @@
#include "nel/gui/lua_helper.h" #include "nel/gui/lua_helper.h"
#include "nel/gui/lua_ihm.h" #include "nel/gui/lua_ihm.h"
#include "nel/gui/lua_manager.h" #include "nel/gui/lua_manager.h"
#include "nel/gui/root_group.h"
#ifdef LUA_NEVRAX_VERSION #ifdef LUA_NEVRAX_VERSION
#include "lua_ide_dll_nevrax/include/lua_ide_dll/ide_interface.h" // external debugger #include "lua_ide_dll_nevrax/include/lua_ide_dll/ide_interface.h" // external debugger
@ -113,86 +114,6 @@ namespace NLGUI
return node; return node;
} }
// ----------------------------------------------------------------------------
// CRootGroup
// ----------------------------------------------------------------------------
class CRootGroup : public CInterfaceGroup
{
public:
CRootGroup(const TCtorParam &param)
: CInterfaceGroup(param)
{ }
/// Destructor
virtual ~CRootGroup() { }
virtual CInterfaceElement* getElement (const std::string &id)
{
if (_Id == id)
return this;
if (id.substr(0, _Id.size()) != _Id)
return NULL;
vector<CViewBase*>::const_iterator itv;
for (itv = _Views.begin(); itv != _Views.end(); itv++)
{
CViewBase *pVB = *itv;
if (pVB->getId() == id)
return pVB;
}
vector<CCtrlBase*>::const_iterator itc;
for (itc = _Controls.begin(); itc != _Controls.end(); itc++)
{
CCtrlBase* ctrl = *itc;
if (ctrl->getId() == id)
return ctrl;
}
// Accelerate
string sTmp = id;
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
string::size_type pos = sTmp.find(':');
if (pos != string::npos)
sTmp = sTmp.substr(0,pos);
map<string,CInterfaceGroup*>::iterator it = _Accel.find(sTmp);
if (it != _Accel.end())
{
CInterfaceGroup *pIG = it->second;
return pIG->getElement(id);
}
return NULL;
}
virtual void addGroup (CInterfaceGroup *child, sint eltOrder = -1)
{
string sTmp = child->getId();
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
_Accel.insert(pair<string,CInterfaceGroup*>(sTmp, child));
CInterfaceGroup::addGroup(child,eltOrder);
}
virtual bool delGroup (CInterfaceGroup *child, bool dontDelete = false)
{
string sTmp = child->getId();
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
map<string,CInterfaceGroup*>::iterator it = _Accel.find(sTmp);
if (it != _Accel.end())
{
_Accel.erase(it);
}
return CInterfaceGroup::delGroup(child,dontDelete);
}
private:
map<string,CInterfaceGroup*> _Accel;
};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// CInterfaceParser // CInterfaceParser
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -233,6 +154,22 @@ namespace NLGUI
destStream.seek(0, NLMISC::IStream::begin); destStream.seek(0, NLMISC::IStream::begin);
} }
std::string CInterfaceParser::lookup( const std::string &file )
{
std::string filename;
if( editorMode && !_WorkDir.empty() )
{
std::string wdpath = CPath::standardizePath( _WorkDir ) + file;
if( CFile::fileExists( wdpath ) )
filename = wdpath;
}
if( filename.empty() )
filename = CPath::lookup( file );
return filename;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool CInterfaceParser::parseInterface (const std::vector<std::string> & strings, bool reload, bool isFilename, bool checkInData) bool CInterfaceParser::parseInterface (const std::vector<std::string> & strings, bool reload, bool isFilename, bool checkInData)
{ {
@ -270,7 +207,7 @@ namespace NLGUI
{ {
//get the first file document pointer //get the first file document pointer
firstFileName = *it; firstFileName = *it;
string filename = CPath::lookup(firstFileName); string filename = lookup( firstFileName );
bool isInData = false; bool isInData = false;
string::size_type pos = filename.find ("@"); string::size_type pos = filename.find ("@");
if (pos != string::npos) if (pos != string::npos)
@ -283,7 +220,7 @@ namespace NLGUI
isInData = true; isInData = true;
} }
if ((needCheck && !isInData) || !file.open (CPath::lookup(firstFileName))) if ((needCheck && !isInData) || !file.open (lookup(firstFileName)))
{ {
// todo hulud interface syntax error // todo hulud interface syntax error
nlwarning ("could not open file %s, skipping xml parsing",firstFileName.c_str()); nlwarning ("could not open file %s, skipping xml parsing",firstFileName.c_str());
@ -331,7 +268,7 @@ namespace NLGUI
{ {
saveParseResult = true; saveParseResult = true;
std::string archive = CPath::lookup(nextFileName + "_compressed", false, false); std::string archive = CPath::lookup(nextFileName + "_compressed", false, false);
std::string current = CPath::lookup(nextFileName, false, false); std::string current = lookup(nextFileName);
if (!archive.empty() && !current.empty()) if (!archive.empty() && !current.empty())
{ {
if (CFile::getFileModificationDate(current) <= CFile::getFileModificationDate(archive)) if (CFile::getFileModificationDate(current) <= CFile::getFileModificationDate(archive))
@ -351,7 +288,7 @@ namespace NLGUI
{ {
if (isFilename) if (isFilename)
{ {
if (!file.open(CPath::lookup(nextFileName, false, false))) if (!file.open(lookup(nextFileName)))
{ {
// todo hulud interface syntax error // todo hulud interface syntax error
nlwarning ("could not open file %s, skipping xml parsing",nextFileName.c_str()); nlwarning ("could not open file %s, skipping xml parsing",nextFileName.c_str());
@ -3014,6 +2951,34 @@ namespace NLGUI
itr->second = linkData; itr->second = linkData;
} }
void CInterfaceParser::setVariable( const VariableData &v )
{
CInterfaceProperty prop;
const std::string &type = v.type;
const std::string &value = v.value;
const std::string &entry = v.entry;
if( type == "sint64" )
prop.readSInt64( value.c_str(), entry );
else
if( type == "sint32" )
prop.readSInt32( value.c_str(), entry );
else
if( type == "float" || type == "double" )
prop.readDouble( value.c_str(), entry );
else
if( type == "bool" )
prop.readBool( value.c_str(), entry );
else
if( type == "rgba" )
prop.readRGBA( value.c_str(), entry );
else
if( type == "hotspot" )
prop.readHotSpot( value.c_str(), entry );
variableCache[ entry ] = v;
}
bool CInterfaceParser::serializeVariables( xmlNodePtr parentNode ) const bool CInterfaceParser::serializeVariables( xmlNodePtr parentNode ) const
{ {

View file

@ -0,0 +1,94 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#include "nel/gui/root_group.h"
#include <vector>
namespace NLGUI
{
CRootGroup::CRootGroup(const TCtorParam &param) :
CInterfaceGroup(param)
{
}
CRootGroup::~CRootGroup()
{
}
CInterfaceElement* CRootGroup::getElement (const std::string &id)
{
if (_Id == id)
return this;
if (id.substr(0, _Id.size()) != _Id)
return NULL;
std::vector<CViewBase*>::const_iterator itv;
for (itv = _Views.begin(); itv != _Views.end(); itv++)
{
CViewBase *pVB = *itv;
if (pVB->getId() == id)
return pVB;
}
std::vector<CCtrlBase*>::const_iterator itc;
for (itc = _Controls.begin(); itc != _Controls.end(); itc++)
{
CCtrlBase* ctrl = *itc;
if (ctrl->getId() == id)
return ctrl;
}
// Accelerate
std::string sTmp = id;
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
std::string::size_type pos = sTmp.find(':');
if (pos != std::string::npos)
sTmp = sTmp.substr(0,pos);
std::map<std::string,CInterfaceGroup*>::iterator it = _Accel.find(sTmp);
if (it != _Accel.end())
{
CInterfaceGroup *pIG = it->second;
return pIG->getElement(id);
}
return NULL;
}
void CRootGroup::addGroup (CInterfaceGroup *child, sint eltOrder)
{
std::string sTmp = child->getId();
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
_Accel.insert(std::pair<std::string,CInterfaceGroup*>(sTmp, child));
CInterfaceGroup::addGroup(child,eltOrder);
}
bool CRootGroup::delGroup (CInterfaceGroup *child, bool dontDelete)
{
std::string sTmp = child->getId();
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
std::map<std::string,CInterfaceGroup*>::iterator it = _Accel.find(sTmp);
if (it != _Accel.end())
{
_Accel.erase(it);
}
return CInterfaceGroup::delGroup(child,dontDelete);
}
}

View file

@ -35,6 +35,7 @@
#include "nel/gui/reflect_register.h" #include "nel/gui/reflect_register.h"
#include "nel/gui/editor_selection_watcher.h" #include "nel/gui/editor_selection_watcher.h"
#include "nel/misc/events.h" #include "nel/misc/events.h"
#include "nel/gui/root_group.h"
namespace NLGUI namespace NLGUI
{ {
@ -1041,6 +1042,8 @@ namespace NLGUI
resetGlobalAlphasProps(); resetGlobalAlphasProps();
activeAnims.clear(); activeAnims.clear();
editorSelection.clear();
} }
@ -3604,6 +3607,68 @@ namespace NLGUI
} }
bool CWidgetManager::createNewGUI( const std::string &project, const std::string &window )
{
reset();
for( int i = 0; i < _MasterGroups.size(); i++ )
delete _MasterGroups[i].Group;
_MasterGroups.clear();
// First create the master group
CRootGroup *root = new CRootGroup( CViewBase::TCtorParam() );
SMasterGroup mg;
mg.Group = root;
root->setIdRecurse( project );
root->setW( 1024 );
root->setH( 768 );
root->setActive( true );
// Create the first / main window
CInterfaceGroup *wnd = new CInterfaceGroup( CViewBase::TCtorParam() );
wnd->setW( 1024 );
wnd->setH( 768 );
wnd->setParent( root );
wnd->setParentPos( root );
wnd->setParentSize( root );
wnd->setPosRef( Hotspot_MM );
wnd->setParentPosRef( Hotspot_MM );
wnd->setIdRecurse( window );
wnd->setActive( true );
// Add the window
root->addElement( wnd );
mg.addWindow( wnd, wnd->getPriority() );
_MasterGroups.push_back( mg );
_Pointer = new CViewPointer( CViewBase::TCtorParam() );
IParser *parser = getParser();
// Set base color to white
VariableData v;
v.type = "sint32";
v.value = "255";
v.entry = "UI:SAVE:COLOR:R";
parser->setVariable( v );
v.entry = "UI:SAVE:COLOR:G";
parser->setVariable( v );
v.entry = "UI:SAVE:COLOR:B";
parser->setVariable( v );
v.entry = "UI:SAVE:COLOR:A";
parser->setVariable( v );
return true;
}
CWidgetManager::CWidgetManager() CWidgetManager::CWidgetManager()
{ {
LinkHack(); LinkHack();

View file

@ -36,6 +36,7 @@ SET(OVQT_PLUGIN_GUI_EDITOR_HDR
texture_property_manager.h texture_property_manager.h
expression_editor.h expression_editor.h
expr_link_dlg.h expr_link_dlg.h
new_gui_dlg.h
) )
SET(OVQT_PLUGIN_GUI_EDITOR_UIS SET(OVQT_PLUGIN_GUI_EDITOR_UIS
@ -55,6 +56,7 @@ SET(OVQT_PLUGIN_GUI_EDITOR_UIS
texture_chooser.ui texture_chooser.ui
expression_editor.ui expression_editor.ui
expr_link_dlg.ui expr_link_dlg.ui
new_gui_dlg.ui
) )
SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTGUI TRUE)

View file

@ -44,6 +44,7 @@
#include "editor_selection_watcher.h" #include "editor_selection_watcher.h"
#include "editor_message_processor.h" #include "editor_message_processor.h"
#include "add_widget_widget.h" #include "add_widget_widget.h"
#include "new_gui_dlg.h"
namespace GUIEditor namespace GUIEditor
{ {
@ -181,6 +182,8 @@ namespace GUIEditor
currentProject = projectFiles.projectName.c_str(); currentProject = projectFiles.projectName.c_str();
currentProjectFile = fileName; currentProjectFile = fileName;
projectWindow->setupFiles( projectFiles ); projectWindow->setupFiles( projectFiles );
GUICtrl->setWorkDir( _lastDir );
if( GUICtrl->parse( projectFiles ) ) if( GUICtrl->parse( projectFiles ) )
{ {
hierarchyView->buildHierarchy( projectFiles.masterGroup ); hierarchyView->buildHierarchy( projectFiles.masterGroup );
@ -197,6 +200,85 @@ namespace GUIEditor
void GUIEditorWindow::newDocument() void GUIEditorWindow::newDocument()
{ {
NewGUIDlg d;
int result = d.exec();
if( result == QDialog::Rejected )
return;
close();
std::string proj = d.getProjectName().toUtf8().constData();
std::string wnd = d.getWindowName().toUtf8().constData();
std::string mg = std::string( "ui:" ) + proj;
std::string dir = d.getProjectDirectory().toUtf8().constData();
_lastDir = dir.c_str();
std::string uiFile = "ui_" + proj + ".xml";
QList< QString > mapList;
d.getMapList( mapList );
bool b = GUICtrl->createNewGUI( proj, wnd );
if( !b )
{
QMessageBox::information( this,
tr( "Creating new GUI project" ),
tr( "Failed to create new GUI project :(" ) );
reset();
return;
}
hierarchyView->buildHierarchy( mg );
projectFiles.projectName = proj;
projectFiles.masterGroup = mg;
projectFiles.activeGroup = std::string( "ui:" ) + proj + ":" + wnd;
projectFiles.version = SProjectFiles::NEW;
projectFiles.guiFiles.push_back( uiFile );
for( int i = 0; i < mapList.size(); i++ )
{
projectFiles.mapFiles.push_back( mapList[ i ].toUtf8().constData() );
}
b = GUICtrl->loadMapFiles( projectFiles.mapFiles );
if( !b )
{
QMessageBox::information( this,
tr( "Creating new GUI project" ),
tr( "Failed to create new GUI project: Couldn't load map files. " ) );
reset();
return;
}
projectWindow->setupFiles( projectFiles );
currentProject = proj.c_str();
currentProjectFile = std::string( dir + "/" + proj + ".xml" ).c_str();
// Save the project file
CProjectFileSerializer serializer;
serializer.setFile( currentProjectFile.toUtf8().constData() );
if( !serializer.serialize( projectFiles ) )
{
QMessageBox::critical( this,
tr( "Failed to save project" ),
tr( "There was an error while trying to save the project." ) );
return;
}
// Save the GUI file
WidgetSerializer widgetSerializer;
widgetSerializer.setFile( dir + "/" + uiFile );
widgetSerializer.setActiveGroup( projectFiles.activeGroup );
if( !widgetSerializer.serialize( projectFiles.masterGroup ) )
{
QMessageBox::critical( this,
tr( "Failed to save project" ),
tr( "There was an error while trying to save the project." ) );
return;
}
} }
void GUIEditorWindow::save() void GUIEditorWindow::save()
@ -217,8 +299,23 @@ namespace GUIEditor
// Can't save old projects any further, since the widgets are in multiple files in them // Can't save old projects any further, since the widgets are in multiple files in them
// using templates, styles and whatnot. There's no way to restore the original XML structure // using templates, styles and whatnot. There's no way to restore the original XML structure
// after it's loaded // after it's loaded
if( projectParser.getProjectVersion() == OLD ) if( projectFiles.version == SProjectFiles::OLD )
return; return;
std::string f = _lastDir.toUtf8().constData();
f += "/";
f += projectFiles.guiFiles[ 0 ];
WidgetSerializer widgetSerializer;
widgetSerializer.setFile( f );
widgetSerializer.setActiveGroup( projectFiles.activeGroup );
if( !widgetSerializer.serialize( projectFiles.masterGroup ) )
{
QMessageBox::critical( this,
tr( "Failed to save project" ),
tr( "There was an error while trying to save the project." ) );
return;
}
} }
void GUIEditorWindow::saveAs() void GUIEditorWindow::saveAs()
@ -231,42 +328,36 @@ namespace GUIEditor
if( dir.isEmpty() ) if( dir.isEmpty() )
return; return;
_lastDir = dir;
if( projectFiles.version == SProjectFiles::OLD )
{
projectFiles.guiFiles.clear(); projectFiles.guiFiles.clear();
projectFiles.guiFiles.push_back( "ui_" + projectFiles.projectName + ".xml" ); projectFiles.guiFiles.push_back( "ui_" + projectFiles.projectName + ".xml" );
projectFiles.version = NEW; projectFiles.version = SProjectFiles::NEW;
QString newFile =
dir + "/" + projectFiles.projectName.c_str() + ".xml";
CProjectFileSerializer serializer;
serializer.setFile( newFile.toUtf8().constData() );
if( !serializer.serialize( projectFiles ) )
{
QMessageBox::critical( this,
tr( "Failed to save project" ),
tr( "There was an error while trying to save the project." ) );
return;
} }
std::string guiFile = currentProjectFile = _lastDir;
std::string( dir.toUtf8().constData() ) + "/" + "ui_" + projectFiles.projectName + ".xml"; currentProjectFile += "/";
currentProjectFile += projectFiles.projectName.c_str();
currentProjectFile += ".xml";
WidgetSerializer widgetSerializer; save();
widgetSerializer.setFile( guiFile );
widgetSerializer.setActiveGroup( projectFiles.activeGroup );
if( !widgetSerializer.serialize( projectFiles.masterGroup ) )
{
QMessageBox::critical( this,
tr( "Failed to save project" ),
tr( "There was an error while trying to save the project." ) );
return;
} }
QMessageBox::information( this, void GUIEditorWindow::reset()
tr( "Save successful" ), {
tr( "Project saved successfully!" ) ); projectFiles.clearAll();
projectWindow->clear();
hierarchyView->clearHierarchy();
GUICtrl->reset();
browserCtrl.clear();
linkList->clear();
procList->clear();
currentProject = "";
currentProjectFile = "";
projectParser.clear();
} }
bool GUIEditorWindow::close() bool GUIEditorWindow::close()
@ -286,16 +377,7 @@ namespace GUIEditor
disconnect( w, SIGNAL( sgnSelectionChanged() ), hierarchyView, SLOT( onSelectionChanged() ) ); disconnect( w, SIGNAL( sgnSelectionChanged() ), hierarchyView, SLOT( onSelectionChanged() ) );
disconnect( w, SIGNAL( sgnSelectionChanged() ), &browserCtrl, SLOT( onSelectionChanged() ) ); disconnect( w, SIGNAL( sgnSelectionChanged() ), &browserCtrl, SLOT( onSelectionChanged() ) );
projectFiles.clearAll(); reset();
projectWindow->clear();
hierarchyView->clearHierarchy();
GUICtrl->reset();
browserCtrl.clear();
linkList->clear();
procList->clear();
currentProject = "";
currentProjectFile = "";
projectParser.clear();
return true; return true;
} }
@ -356,14 +438,14 @@ namespace GUIEditor
void GUIEditorWindow::createMenus() void GUIEditorWindow::createMenus()
{ {
Core::MenuManager *mm = Core::ICore::instance()->menuManager(); Core::MenuManager *mm = Core::ICore::instance()->menuManager();
//QAction *newAction = mm->action( Core::Constants::NEW ); QAction *newAction = mm->action( Core::Constants::NEW );
QAction *saveAction = mm->action( Core::Constants::SAVE ); QAction *saveAction = mm->action( Core::Constants::SAVE );
QAction *saveAsAction = mm->action( Core::Constants::SAVE_AS ); QAction *saveAsAction = mm->action( Core::Constants::SAVE_AS );
QAction *closeAction = mm->action( Core::Constants::CLOSE ); QAction *closeAction = mm->action( Core::Constants::CLOSE );
QAction *delAction = mm->action( Core::Constants::DEL ); QAction *delAction = mm->action( Core::Constants::DEL );
//if( newAction != NULL ) if( newAction != NULL )
// newAction->setEnabled( true ); newAction->setEnabled( true );
if( saveAction != NULL ) if( saveAction != NULL )
saveAction->setEnabled( true ); saveAction->setEnabled( true );
if( saveAsAction != NULL ) if( saveAsAction != NULL )

View file

@ -70,6 +70,7 @@ protected:
void showEvent( QShowEvent *evnt ); void showEvent( QShowEvent *evnt );
private: private:
void reset();
void createMenus(); void createMenus();
void removeMenus(); void removeMenus();

View file

@ -89,20 +89,8 @@ namespace GUIEditor
reset(); reset();
IParser *parser = CWidgetManager::getInstance()->getParser(); IParser *parser = CWidgetManager::getInstance()->getParser();
std::vector< std::string >::iterator itr; if( !loadMapFiles( files.mapFiles ) )
for( itr = files.mapFiles.begin(); itr != files.mapFiles.end(); ++itr )
{
std::string &file = *itr;
std::string::size_type i = file.find_last_of( '.' );
std::string mapFile = file.substr( 0, i );
mapFile.append( ".txt" );
if( !CViewRenderer::getInstance()->loadTextures( file, mapFile, false ) )
{
CViewRenderer::getInstance()->reset();
return false; return false;
}
}
if( !parser->parseInterface( files.guiFiles, false ) ) if( !parser->parseInterface( files.guiFiles, false ) )
return false; return false;
@ -114,11 +102,49 @@ namespace GUIEditor
if( e != NULL ) if( e != NULL )
e->setActive( true ); e->setActive( true );
timerID = startTimer( 200 ); onGUILoaded();
guiLoaded = true;
Q_EMIT guiLoadComplete();
CWidgetManager::getInstance()->registerSelectionWatcher( watcher ); return true;
}
bool NelGUICtrl::loadMapFiles( const std::vector< std::string > &v )
{
std::vector< std::string >::const_iterator itr;
for( itr = v.begin(); itr != v.end(); ++itr )
{
const std::string &file = *itr;
std::string::size_type i = file.find_last_of( '.' );
std::string mapFile = file.substr( 0, i );
mapFile.append( ".txt" );
if( !CViewRenderer::getInstance()->loadTextures( file, mapFile, false ) )
{
CViewRenderer::getInstance()->reset();
return false;
}
}
return true;
}
bool NelGUICtrl::createNewGUI( const std::string &project, const std::string &window )
{
reset();
bool ok = CWidgetManager::getInstance()->createNewGUI( project, window );
if( !ok )
return false;
std::string mg = std::string( "ui:" ) + project;
std::string ag = mg + ":" + window;
CWidgetManager::getInstance()->updateAllLocalisedElements();
CWidgetManager::getInstance()->activateMasterGroup( mg, true );
CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( ag );
if( e != NULL )
e->setActive( true );
onGUILoaded();
return true; return true;
} }
@ -160,6 +186,15 @@ namespace GUIEditor
} }
} }
void NelGUICtrl::onGUILoaded()
{
timerID = startTimer( 200 );
guiLoaded = true;
Q_EMIT guiLoadComplete();
CWidgetManager::getInstance()->registerSelectionWatcher( watcher );
}
void NelGUICtrl::show() void NelGUICtrl::show()
{ {
if( timerID == 0 ) if( timerID == 0 )
@ -187,6 +222,12 @@ namespace GUIEditor
} }
} }
void NelGUICtrl::setWorkDir( const QString &dir )
{
IParser *parser = CWidgetManager::getInstance()->getParser();
parser->setWorkDir( std::string( dir.toUtf8().constData() ) );
}
QWidget* NelGUICtrl::getViewPort() QWidget* NelGUICtrl::getViewPort()
{ {
return w; return w;

View file

@ -43,6 +43,8 @@ namespace GUIEditor
void init(); void init();
bool parse( SProjectFiles &files ); bool parse( SProjectFiles &files );
bool loadMapFiles( const std::vector< std::string > &v );
bool createNewGUI( const std::string &project, const std::string &window );
void draw(); void draw();
void reset(); void reset();
CEditorSelectionWatcher* getWatcher(){ return watcher; } CEditorSelectionWatcher* getWatcher(){ return watcher; }
@ -52,6 +54,8 @@ namespace GUIEditor
void show(); void show();
void hide(); void hide();
void setWorkDir( const QString &dir );
Q_SIGNALS: Q_SIGNALS:
void guiLoadComplete(); void guiLoadComplete();
@ -59,6 +63,8 @@ Q_SIGNALS:
void timerEvent( QTimerEvent *evnt ); void timerEvent( QTimerEvent *evnt );
private: private:
void onGUILoaded();
int timerID; int timerID;
bool guiLoaded; bool guiLoaded;
CEditorSelectionWatcher *watcher; CEditorSelectionWatcher *watcher;

View file

@ -0,0 +1,135 @@
// Ryzom Core Studio - GUI Editor Plugin
//
// Copyright (C) 2014 Laszlo Kis-Adam
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
//
// 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 <http://www.gnu.org/licenses/>.
#include "new_gui_dlg.h"
#include <QMessageBox>
#include <QFileDialog>
NewGUIDlg::NewGUIDlg( QWidget *parent ) :
QDialog( parent )
{
m_ui.setupUi( this );
connect( m_ui.okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKClicked() ) );
connect( m_ui.cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) );
connect( m_ui.projectDirTB, SIGNAL( clicked( bool ) ), this, SLOT( onProjectDirTBClicked() ) );
connect( m_ui.addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) );
connect( m_ui.removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) );
}
NewGUIDlg::~NewGUIDlg()
{
}
QString NewGUIDlg::getProjectName() const
{
return m_ui.projectEdit->text();
}
QString NewGUIDlg::getWindowName() const
{
return m_ui.windowEdit->text();
}
QString NewGUIDlg::getProjectDirectory() const
{
return m_ui.projectDirEdit->text();
}
void NewGUIDlg::getMapList( QList< QString > &l )
{
l.clear();
for( int i = 0; i < m_ui.mapList->count(); i++ )
{
l.push_back( m_ui.mapList->item( i )->text() );
}
}
void NewGUIDlg::onOKClicked()
{
if( m_ui.projectEdit->text().isEmpty() )
{
QMessageBox::information( this,
tr( "New project" ),
tr( "You must specify a project name!" ) );
return;
}
if( m_ui.windowEdit->text().isEmpty() )
{
QMessageBox::information( this,
tr( "New project" ),
tr( "You must specify a window name!" ) );
return;
}
if( m_ui.projectDirEdit->text().isEmpty() )
{
QMessageBox::information( this,
tr( "New project" ),
tr( "You must specify a project directory!" ) );
return;
}
accept();
}
void NewGUIDlg::onCancelClicked()
{
reject();
}
void NewGUIDlg::onProjectDirTBClicked()
{
QString dir = QFileDialog::getExistingDirectory( this,
tr( "Specify project directory" ),
"." );
if( dir.isEmpty() )
return;
m_ui.projectDirEdit->setText( dir );
}
void NewGUIDlg::onAddClicked()
{
if( m_ui.mapEdit->text().isEmpty() )
return;
QList< QListWidgetItem* > l = m_ui.mapList->findItems( m_ui.mapEdit->text(), Qt::MatchContains );
if( !l.isEmpty() )
{
return;
}
m_ui.mapList->addItem( m_ui.mapEdit->text() );
m_ui.mapEdit->clear();
}
void NewGUIDlg::onRemoveClicked()
{
QListWidgetItem *item = m_ui.mapList->currentItem();
if( item == NULL )
return;
delete item;
}

View file

@ -0,0 +1,50 @@
// Ryzom Core Studio - GUI Editor Plugin
//
// Copyright (C) 2014 Laszlo Kis-Adam
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
//
// 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 <http://www.gnu.org/licenses/>.
#ifndef NEW_GUI_DLG_H
#define NEW_GUI_DLG_H
#include "ui_new_gui_dlg.h"
#include <QList>
class NewGUIDlg : public QDialog
{
Q_OBJECT
public:
NewGUIDlg( QWidget *parent = NULL );
~NewGUIDlg();
QString getProjectName() const;
QString getWindowName() const;
QString getProjectDirectory() const;
void getMapList( QList< QString > &l );
private Q_SLOTS:
void onOKClicked();
void onCancelClicked();
void onProjectDirTBClicked();
void onAddClicked();
void onRemoveClicked();
private:
Ui::NewGUIDialog m_ui;
};
#endif

View file

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NewGUIDialog</class>
<widget class="QDialog" name="NewGUIDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>399</width>
<height>354</height>
</rect>
</property>
<property name="windowTitle">
<string>New GUI</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Project name</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="projectEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Window name</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="windowEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Project directory</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="projectDirEdit"/>
</item>
<item row="2" column="3">
<widget class="QToolButton" name="projectDirTB">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Map files</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QPushButton" name="addButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLineEdit" name="mapEdit"/>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="removeButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="2">
<widget class="QListWidget" name="mapList"/>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>107</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="2" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="okButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -16,6 +16,7 @@
#include "project_file_parser.h" #include "project_file_parser.h"
#include "nel/misc/debug.h"
namespace GUIEditor namespace GUIEditor
{ {
@ -57,12 +58,13 @@ namespace GUIEditor
projectFiles.projectName = files.projectName; projectFiles.projectName = files.projectName;
projectFiles.masterGroup = files.masterGroup; projectFiles.masterGroup = files.masterGroup;
projectFiles.activeGroup = files.activeGroup; projectFiles.activeGroup = files.activeGroup;
projectFiles.version = files.version;
} }
unsigned long CProjectFileParser::getProjectVersion() const unsigned long CProjectFileParser::getProjectVersion() const
{ {
if( !loaded ) if( !loaded )
return OLD; return SProjectFiles::OLD;
return files.version; return files.version;
} }
@ -70,7 +72,7 @@ namespace GUIEditor
void CProjectFileParser::clear() void CProjectFileParser::clear()
{ {
files.projectName = ""; files.projectName = "";
files.version = OLD; files.version = SProjectFiles::OLD;
files.activeGroup = ""; files.activeGroup = "";
files.guiFiles.clear(); files.guiFiles.clear();
files.mapFiles.clear(); files.mapFiles.clear();
@ -208,7 +210,9 @@ namespace GUIEditor
reader.readNext(); reader.readNext();
} }
if( files.mapFiles.empty() ) if( files.mapFiles.empty() )
return false; {
nlinfo( "No map file(s) specified in project file." );
}
return true; return true;
} }

View file

@ -25,7 +25,7 @@ namespace GUIEditor
if( fileName.empty() ) if( fileName.empty() )
return false; return false;
if( project.version >= MAX_PROJECTFILE_VERSION ) if( project.version >= SProjectFiles::MAX_PROJECTFILE_VERSION )
return false; return false;
out.open( fileName.c_str() ); out.open( fileName.c_str() );

View file

@ -23,6 +23,10 @@
namespace GUIEditor namespace GUIEditor
{ {
struct SProjectFiles
{
public:
enum ProjectVersion enum ProjectVersion
{ {
OLD = 0, OLD = 0,
@ -30,9 +34,6 @@ namespace GUIEditor
MAX_PROJECTFILE_VERSION MAX_PROJECTFILE_VERSION
}; };
struct SProjectFiles
{
public:
std::string projectName; std::string projectName;
unsigned long version; unsigned long version;
std::string masterGroup; std::string masterGroup;

View file

@ -728,9 +728,6 @@ namespace GUIEditor
{ {
std::string j = element->getProperty( prop.propName ); std::string j = element->getProperty( prop.propName );
if( j.empty() )
return;
QtProperty *pp = actionMgr->addProperty( prop.propName.c_str() ); QtProperty *pp = actionMgr->addProperty( prop.propName.c_str() );
if( pp == NULL ) if( pp == NULL )
return; return;

View file

@ -93,8 +93,6 @@ namespace GUIEditor
return false; return false;
} }
ag->setActive( false );
if( mg->serializeSubGroups( root ) == NULL ) if( mg->serializeSubGroups( root ) == NULL )
{ {
ag->setActive( true ); ag->setActive( true );
@ -103,8 +101,6 @@ namespace GUIEditor
return false; return false;
} }
ag->setActive( true );
if( !mg->serializeLinks( root ) ) if( !mg->serializeLinks( root ) )
{ {
xmlFreeNode( root ); xmlFreeNode( root );

View file

@ -2,6 +2,7 @@
<header> <header>
<name>CtrlButton</name> <name>CtrlButton</name>
<guiname>CCtrlButton</guiname> <guiname>CCtrlButton</guiname>
<classname>button</classname>
<ancestor>CtrlBaseButton</ancestor> <ancestor>CtrlBaseButton</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>CtrlColPick</name> <name>CtrlColPick</name>
<guiname>CCtrlColPick</guiname> <guiname>CCtrlColPick</guiname>
<classname>colpick</classname>
<ancestor>CtrlBase</ancestor> <ancestor>CtrlBase</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>CtrlScroll</name> <name>CtrlScroll</name>
<guiname>CCtrlScroll</guiname> <guiname>CCtrlScroll</guiname>
<classname>scroll</classname>
<ancestor>CtrlBase</ancestor> <ancestor>CtrlBase</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>CtrlTextButton</name> <name>CtrlTextButton</name>
<guiname>CCtrlTextButton</guiname> <guiname>CCtrlTextButton</guiname>
<classname>text_button</classname>
<ancestor>CtrlBaseButton</ancestor> <ancestor>CtrlBaseButton</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>
@ -11,22 +12,22 @@
<property> <property>
<name>tx_normal</name> <name>tx_normal</name>
<type>string</type> <type>string</type>
<default></default> <default>but</default>
</property> </property>
<property> <property>
<name>tx_pushed</name> <name>tx_pushed</name>
<type>string</type> <type>string</type>
<default></default> <default>but</default>
</property> </property>
<property> <property>
<name>tx_over</name> <name>tx_over</name>
<type>string</type> <type>string</type>
<default></default> <default>but_over</default>
</property> </property>
<property> <property>
<name>hardtext</name> <name>hardtext</name>
<type>string</type> <type>string</type>
<default></default> <default>push me</default>
</property> </property>
<property> <property>
<name>wmargin</name> <name>wmargin</name>
@ -156,7 +157,7 @@
<property> <property>
<name>line_maxw</name> <name>line_maxw</name>
<type>int</type> <type>int</type>
<default>0</default> <default>100</default>
</property> </property>
<property> <property>
<name>multi_line_space</name> <name>multi_line_space</name>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>DBGroupSelectNumber</name> <name>DBGroupSelectNumber</name>
<guiname>CDBGroupSelectNumber</guiname> <guiname>CDBGroupSelectNumber</guiname>
<classname>select_number</classname>
<ancestor>InterfaceGroup</ancestor> <ancestor>InterfaceGroup</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>DBViewBar</name> <name>DBViewBar</name>
<guiname>CDBViewBar</guiname> <guiname>CDBViewBar</guiname>
<classname>bar</classname>
<ancestor>ViewBitmap</ancestor> <ancestor>ViewBitmap</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>DBViewBar3</name> <name>DBViewBar3</name>
<guiname>CDBViewBar3</guiname> <guiname>CDBViewBar3</guiname>
<classname>bar3</classname>
<ancestor>ViewBitmap</ancestor> <ancestor>ViewBitmap</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>DBViewDigit</name> <name>DBViewDigit</name>
<guiname>CDBViewDigit</guiname> <guiname>CDBViewDigit</guiname>
<classname>digit</classname>
<ancestor>CtrlBase</ancestor> <ancestor>CtrlBase</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>DBViewNumber</name> <name>DBViewNumber</name>
<guiname>CDBViewNumber</guiname> <guiname>CDBViewNumber</guiname>
<classname>text_number</classname>
<ancestor>ViewText</ancestor> <ancestor>ViewText</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>DBViewQuantity</name> <name>DBViewQuantity</name>
<guiname>CDBViewQuantity</guiname> <guiname>CDBViewQuantity</guiname>
<classname>text_quantity</classname>
<ancestor>ViewText</ancestor> <ancestor>ViewText</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>GroupContainer</name> <name>GroupContainer</name>
<guiname>CGroupContainer</guiname> <guiname>CGroupContainer</guiname>
<classname>container</classname>
<ancestor>InterfaceGroup</ancestor> <ancestor>InterfaceGroup</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>GroupEditBox</name> <name>GroupEditBox</name>
<guiname>CGroupEditBox</guiname> <guiname>CGroupEditBox</guiname>
<classname>edit_box</classname>
<ancestor>InterfaceGroup</ancestor> <ancestor>InterfaceGroup</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>GroupHTML</name> <name>GroupHTML</name>
<guiname>CGroupHTML</guiname> <guiname>CGroupHTML</guiname>
<classname>html</classname>
<ancestor>GroupScrollText</ancestor> <ancestor>GroupScrollText</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>GroupHeader</name> <name>GroupHeader</name>
<guiname>CGroupHeader</guiname> <guiname>CGroupHeader</guiname>
<classname>header</classname>
<ancestor>GroupList</ancestor> <ancestor>GroupList</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>GroupList</name> <name>GroupList</name>
<guiname>CGroupList</guiname> <guiname>CGroupList</guiname>
<classname>list</classname>
<ancestor>InterfaceGroup</ancestor> <ancestor>InterfaceGroup</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>GroupMenu</name> <name>GroupMenu</name>
<guiname>CGroupMenu</guiname> <guiname>CGroupMenu</guiname>
<classname>menu</classname>
<ancestor>GroupModal</ancestor> <ancestor>GroupModal</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>GroupModal</name> <name>GroupModal</name>
<guiname>CGroupModal</guiname> <guiname>CGroupModal</guiname>
<classname>modal</classname>
<ancestor>GroupFrame</ancestor> <ancestor>GroupFrame</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>GroupScrollText</name> <name>GroupScrollText</name>
<guiname>CGroupScrollText</guiname> <guiname>CGroupScrollText</guiname>
<classname>scroll_text</classname>
<ancestor>InterfaceGroup</ancestor> <ancestor>InterfaceGroup</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>GroupTab</name> <name>GroupTab</name>
<guiname>CGroupTab</guiname> <guiname>CGroupTab</guiname>
<classname>tab</classname>
<ancestor>InterfaceGroup</ancestor> <ancestor>InterfaceGroup</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>GroupTable</name> <name>GroupTable</name>
<guiname>CGroupTable</guiname> <guiname>CGroupTable</guiname>
<classname>table</classname>
<ancestor>InterfaceGroup</ancestor> <ancestor>InterfaceGroup</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>GroupTree</name> <name>GroupTree</name>
<guiname>CGroupTree</guiname> <guiname>CGroupTree</guiname>
<classname>tree</classname>
<ancestor>InterfaceGroup</ancestor> <ancestor>InterfaceGroup</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>InterfaceGroup</name> <name>InterfaceGroup</name>
<guiname>CInterfaceGroup</guiname> <guiname>CInterfaceGroup</guiname>
<classname>interface_group</classname>
<ancestor>CtrlBase</ancestor> <ancestor>CtrlBase</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>InterfaceGroupWheel</name> <name>InterfaceGroupWheel</name>
<guiname>CInterfaceGroupWheel</guiname> <guiname>CInterfaceGroupWheel</guiname>
<classname>group_wheel</classname>
<ancestor>InterfaceGroup</ancestor> <ancestor>InterfaceGroup</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>ViewBitmap</name> <name>ViewBitmap</name>
<guiname>CViewBitmap</guiname> <guiname>CViewBitmap</guiname>
<classname>bitmap</classname>
<ancestor>CtrlBase</ancestor> <ancestor>CtrlBase</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>ViewBitmapCombo</name> <name>ViewBitmapCombo</name>
<guiname>CViewBitmapCombo</guiname> <guiname>CViewBitmapCombo</guiname>
<classname>bitmap_combo</classname>
<ancestor>CtrlBase</ancestor> <ancestor>CtrlBase</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>ViewText</name> <name>ViewText</name>
<guiname>CViewText</guiname> <guiname>CViewText</guiname>
<classname>text</classname>
<ancestor>InterfaceElement</ancestor> <ancestor>InterfaceElement</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>
@ -46,7 +47,7 @@
<property> <property>
<name>line_maxw</name> <name>line_maxw</name>
<type>int</type> <type>int</type>
<default>0</default> <default>100</default>
</property> </property>
<property> <property>
<name>multi_line_space</name> <name>multi_line_space</name>
@ -101,7 +102,7 @@
<property> <property>
<name>hardtext</name> <name>hardtext</name>
<type>string</type> <type>string</type>
<default></default> <default>Some text</default>
</property> </property>
<property> <property>
<name>hardtext_format</name> <name>hardtext_format</name>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>ViewTextFormated</name> <name>ViewTextFormated</name>
<guiname>CViewTextFormated</guiname> <guiname>CViewTextFormated</guiname>
<classname>text_formated</classname>
<ancestor>ViewText</ancestor> <ancestor>ViewText</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>ViewTextID</name> <name>ViewTextID</name>
<guiname>CViewTextID</guiname> <guiname>CViewTextID</guiname>
<classname>text_id</classname>
<ancestor>ViewText</ancestor> <ancestor>ViewText</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>

View file

@ -2,6 +2,7 @@
<header> <header>
<name>ViewTextIDFormated</name> <name>ViewTextIDFormated</name>
<guiname>CViewTextIDFormated</guiname> <guiname>CViewTextIDFormated</guiname>
<classname>text_id_formated</classname>
<ancestor>ViewTextID</ancestor> <ancestor>ViewTextID</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>