mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 21:11:39 +00:00
Implemented new action.
This commit is contained in:
parent
fe179823c0
commit
d46ad7c2d0
6 changed files with 112 additions and 14 deletions
|
@ -528,6 +528,8 @@ namespace NLGUI
|
|||
bool groupSelection();
|
||||
bool unGroupSelection();
|
||||
void setMultiSelection( bool b ){ multiSelection = b; }
|
||||
|
||||
bool createNewGUI( const std::string &project, const std::string &window );
|
||||
|
||||
private:
|
||||
CWidgetManager();
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "nel/gui/reflect_register.h"
|
||||
#include "nel/gui/editor_selection_watcher.h"
|
||||
#include "nel/misc/events.h"
|
||||
#include "nel/gui/root_group.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
@ -1041,6 +1042,8 @@ namespace NLGUI
|
|||
resetGlobalAlphasProps();
|
||||
|
||||
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()
|
||||
{
|
||||
LinkHack();
|
||||
|
|
|
@ -207,6 +207,21 @@ namespace GUIEditor
|
|||
return;
|
||||
|
||||
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()
|
||||
|
@ -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()
|
||||
{
|
||||
if( currentProject.isEmpty() )
|
||||
|
@ -296,16 +325,7 @@ namespace GUIEditor
|
|||
disconnect( w, SIGNAL( sgnSelectionChanged() ), hierarchyView, SLOT( onSelectionChanged() ) );
|
||||
disconnect( w, SIGNAL( sgnSelectionChanged() ), &browserCtrl, SLOT( onSelectionChanged() ) );
|
||||
|
||||
projectFiles.clearAll();
|
||||
projectWindow->clear();
|
||||
hierarchyView->clearHierarchy();
|
||||
GUICtrl->reset();
|
||||
browserCtrl.clear();
|
||||
linkList->clear();
|
||||
procList->clear();
|
||||
currentProject = "";
|
||||
currentProjectFile = "";
|
||||
projectParser.clear();
|
||||
reset();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ protected:
|
|||
void showEvent( QShowEvent *evnt );
|
||||
|
||||
private:
|
||||
void reset();
|
||||
void createMenus();
|
||||
void removeMenus();
|
||||
|
||||
|
|
|
@ -114,11 +114,29 @@ namespace GUIEditor
|
|||
if( e != NULL )
|
||||
e->setActive( true );
|
||||
|
||||
timerID = startTimer( 200 );
|
||||
guiLoaded = true;
|
||||
Q_EMIT guiLoadComplete();
|
||||
onGUILoaded();
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -160,6 +178,15 @@ namespace GUIEditor
|
|||
}
|
||||
}
|
||||
|
||||
void NelGUICtrl::onGUILoaded()
|
||||
{
|
||||
timerID = startTimer( 200 );
|
||||
guiLoaded = true;
|
||||
Q_EMIT guiLoadComplete();
|
||||
|
||||
CWidgetManager::getInstance()->registerSelectionWatcher( watcher );
|
||||
}
|
||||
|
||||
void NelGUICtrl::show()
|
||||
{
|
||||
if( timerID == 0 )
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace GUIEditor
|
|||
|
||||
void init();
|
||||
bool parse( SProjectFiles &files );
|
||||
bool createNewGUI( const std::string &project, const std::string &window );
|
||||
void draw();
|
||||
void reset();
|
||||
CEditorSelectionWatcher* getWatcher(){ return watcher; }
|
||||
|
@ -61,6 +62,8 @@ Q_SIGNALS:
|
|||
void timerEvent( QTimerEvent *evnt );
|
||||
|
||||
private:
|
||||
void onGUILoaded();
|
||||
|
||||
int timerID;
|
||||
bool guiLoaded;
|
||||
CEditorSelectionWatcher *watcher;
|
||||
|
|
Loading…
Reference in a new issue