mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-14 03:09:08 +00:00
Implemented new action.
--HG-- branch : dfighter-tools
This commit is contained in:
parent
e5d2e9293d
commit
ded18b266c
6 changed files with 112 additions and 14 deletions
|
@ -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();
|
||||||
|
|
|
@ -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,48 @@ 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() );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CWidgetManager::CWidgetManager()
|
CWidgetManager::CWidgetManager()
|
||||||
{
|
{
|
||||||
LinkHack();
|
LinkHack();
|
||||||
|
|
|
@ -207,6 +207,21 @@ namespace GUIEditor
|
||||||
return;
|
return;
|
||||||
|
|
||||||
close();
|
close();
|
||||||
|
|
||||||
|
std::string proj = d.getProjectName().toUtf8().constData();
|
||||||
|
std::string wnd = d.getWindowName().toUtf8().constData();
|
||||||
|
|
||||||
|
bool b = GUICtrl->createNewGUI( proj, wnd );
|
||||||
|
if( !b )
|
||||||
|
{
|
||||||
|
QMessageBox::information( this,
|
||||||
|
tr( "Creating new GUI project" ),
|
||||||
|
tr( "Failed to create new GUI project :(" ) );
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string mg = std::string( "ui:" ) + proj;
|
||||||
|
hierarchyView->buildHierarchy( mg );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIEditorWindow::save()
|
void GUIEditorWindow::save()
|
||||||
|
@ -279,6 +294,20 @@ namespace GUIEditor
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GUIEditorWindow::reset()
|
||||||
|
{
|
||||||
|
projectFiles.clearAll();
|
||||||
|
projectWindow->clear();
|
||||||
|
hierarchyView->clearHierarchy();
|
||||||
|
GUICtrl->reset();
|
||||||
|
browserCtrl.clear();
|
||||||
|
linkList->clear();
|
||||||
|
procList->clear();
|
||||||
|
currentProject = "";
|
||||||
|
currentProjectFile = "";
|
||||||
|
projectParser.clear();
|
||||||
|
}
|
||||||
|
|
||||||
bool GUIEditorWindow::close()
|
bool GUIEditorWindow::close()
|
||||||
{
|
{
|
||||||
if( currentProject.isEmpty() )
|
if( currentProject.isEmpty() )
|
||||||
|
@ -296,16 +325,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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
|
||||||
|
|
|
@ -114,11 +114,29 @@ 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::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 +178,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 )
|
||||||
|
|
|
@ -43,6 +43,7 @@ namespace GUIEditor
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
bool parse( SProjectFiles &files );
|
bool parse( SProjectFiles &files );
|
||||||
|
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; }
|
||||||
|
@ -61,6 +62,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;
|
||||||
|
|
Loading…
Reference in a new issue