mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-24 16:16:14 +00:00
Split Nel3DWidget and NelGUIWidget.
This commit is contained in:
parent
0574ffe44f
commit
9b34be6683
3 changed files with 30 additions and 14 deletions
|
@ -66,7 +66,7 @@ namespace GUIEditor
|
|||
addWidgetWidget = new AddWidgetWidget;
|
||||
connect( projectWindow, SIGNAL( projectFilesChanged() ), this, SLOT( onProjectFilesChanged() ) );
|
||||
viewPort = new NelGUIWidget;
|
||||
setCentralWidget( viewPort );
|
||||
setCentralWidget( viewPort->getViewPort() );
|
||||
|
||||
widgetInfoTree = new CWidgetInfoTree;
|
||||
|
||||
|
|
|
@ -29,16 +29,19 @@
|
|||
#include <QTimerEvent>
|
||||
#include "editor_selection_watcher.h"
|
||||
|
||||
#include "nel3d_widget.h"
|
||||
|
||||
namespace GUIEditor
|
||||
{
|
||||
std::set< std::string > hwCursors;
|
||||
|
||||
NelGUIWidget::NelGUIWidget( QWidget *parent ) :
|
||||
Nel3DWidget( parent )
|
||||
QWidget( parent )
|
||||
{
|
||||
timerID = 0;
|
||||
guiLoaded = false;
|
||||
watcher = NULL;
|
||||
w = new Nel3DWidget();
|
||||
}
|
||||
|
||||
NelGUIWidget::~NelGUIWidget()
|
||||
|
@ -49,7 +52,9 @@ namespace GUIEditor
|
|||
|
||||
NLGUI::CViewRenderer::release();
|
||||
NLMISC::CI18N::setNoResolution( false );
|
||||
|
||||
|
||||
delete w;
|
||||
w = NULL;
|
||||
}
|
||||
|
||||
void NelGUIWidget::init()
|
||||
|
@ -59,15 +64,15 @@ namespace GUIEditor
|
|||
NLMISC::CPath::remapExtension( "dds", "png", true );
|
||||
NLMISC::CPath::remapExtension( "png", "tga", true );
|
||||
|
||||
Nel3DWidget::init();
|
||||
createTextContext( "Ryzom.ttf" );
|
||||
w->init();
|
||||
w->createTextContext( "Ryzom.ttf" );
|
||||
|
||||
NLGUI::CAHManager::setEditorMode( true );
|
||||
NLGUI::CLuaManager::setEditorMode( true );
|
||||
NLGUI::CInterfaceElement::setEditorMode( true );
|
||||
|
||||
NLGUI::CViewRenderer::setDriver( getDriver() );
|
||||
NLGUI::CViewRenderer::setTextContext( getTextContext() );
|
||||
NLGUI::CViewRenderer::setDriver( w->getDriver() );
|
||||
NLGUI::CViewRenderer::setTextContext( w->getTextContext() );
|
||||
NLGUI::CViewRenderer::hwCursors = &hwCursors;
|
||||
NLGUI::CViewRenderer::getInstance()->init();
|
||||
|
||||
|
@ -125,21 +130,21 @@ namespace GUIEditor
|
|||
CWidgetManager::getInstance()->reset();
|
||||
CWidgetManager::getInstance()->getParser()->removeAll();
|
||||
CViewRenderer::getInstance()->reset();
|
||||
clear();
|
||||
w->clear();
|
||||
}
|
||||
|
||||
void NelGUIWidget::draw()
|
||||
{
|
||||
getDriver()->clearBuffers( NLMISC::CRGBA::Black );
|
||||
w->getDriver()->clearBuffers( NLMISC::CRGBA::Black );
|
||||
CWidgetManager::getInstance()->checkCoords();
|
||||
CWidgetManager::getInstance()->drawViews( 0 );
|
||||
getDriver()->swapBuffers();
|
||||
w->getDriver()->swapBuffers();
|
||||
}
|
||||
|
||||
void NelGUIWidget::paintEvent( QPaintEvent *evnt )
|
||||
{
|
||||
if( !guiLoaded )
|
||||
clear();
|
||||
w->clear();
|
||||
}
|
||||
|
||||
void NelGUIWidget::timerEvent( QTimerEvent *evnt )
|
||||
|
@ -148,7 +153,7 @@ namespace GUIEditor
|
|||
{
|
||||
if( guiLoaded )
|
||||
{
|
||||
getDriver()->EventServer.pump();
|
||||
w->getDriver()->EventServer.pump();
|
||||
draw();
|
||||
}
|
||||
}
|
||||
|
@ -165,5 +170,10 @@ namespace GUIEditor
|
|||
if( timerID != 0 )
|
||||
killTimer( timerID );
|
||||
}
|
||||
|
||||
QWidget* NelGUIWidget::getViewPort()
|
||||
{
|
||||
return w;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,15 +18,16 @@
|
|||
#ifndef NELGUI_WIDGET_H
|
||||
#define NELGUI_WIDGET_H
|
||||
|
||||
#include "nel3d_widget.h"
|
||||
#include <QWidget>
|
||||
#include "project_files.h"
|
||||
|
||||
namespace GUIEditor
|
||||
{
|
||||
class CEditorSelectionWatcher;
|
||||
class Nel3DWidget;
|
||||
|
||||
/// Qt viewport for the Nel GUI library
|
||||
class NelGUIWidget : public Nel3DWidget
|
||||
class NelGUIWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -39,6 +40,8 @@ namespace GUIEditor
|
|||
void reset();
|
||||
CEditorSelectionWatcher* getWatcher(){ return watcher; }
|
||||
|
||||
QWidget* getViewPort();
|
||||
|
||||
Q_SIGNALS:
|
||||
void guiLoadComplete();
|
||||
|
||||
|
@ -53,6 +56,9 @@ Q_SIGNALS:
|
|||
int timerID;
|
||||
bool guiLoaded;
|
||||
CEditorSelectionWatcher *watcher;
|
||||
|
||||
|
||||
Nel3DWidget *w;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue