Commit d2a8125f authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

qt windows project

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57276 954022d7-b5bf-4e40-9824-e11837661b57
parent e66049c6
......@@ -4,10 +4,6 @@
#include <QGLContext>
#include <QThread>
#ifdef _QTX
#include "GL/glx.h"
#endif
class CEditorCtrlWrapper : public CEditorCtrl
{
public:
......@@ -30,11 +26,10 @@ public:
}
};
#if !defined(WIN32) && !defined(_MAC)
void CVideoMemory::Init()
{
CTemporaryCS oCS(&m_oCS);
#if 1
QGLContext* ctx = const_cast<QGLContext *>(QGLContext::currentContext());
......@@ -46,41 +41,10 @@ void CVideoMemory::Init()
m_arContext.Add((void*)pShare);
ctx->makeCurrent();
#endif
#if 0
m_x_context = (void*)glXGetCurrentContext();
m_xd_draw = (unsigned long)glXGetCurrentDrawable();
m_xd_read = (unsigned long)glXGetCurrentReadDrawable();
m_display = (void*)glXGetCurrentDisplay();
#endif
}
void CVideoMemory::SetCurrentCtx()
{
#if 1
#if 0
QThread* pThread = QThread::currentThread();
int nCount = m_arThreads.GetCount();
for (int i = 0; i < nCount; ++i)
{
if (pThread == m_arThreads[i])
{
((QGLContext*)m_arContext[i])->moveToThread(pThread);
((QGLContext*)m_arContext[i])->makeCurrent();
return;
}
}
QGLContext* pContext = QGLContext::fromOpenGLContext(((QGLContext*)m_arContext[0])->contextHandle());
pContext->create((QGLContext*)m_arContext[0]);
pContext->makeCurrent();
m_arThreads.Add((void*)pThread);
m_arContext.Add((void*)pContext);
#endif
QThread* pThread = QThread::currentThread();
int nCount = m_arThreads.GetCount();
......@@ -103,16 +67,14 @@ void CVideoMemory::SetCurrentCtx()
m_arContext.Add((void*)pWorker);
pWorker->makeCurrent();
#else
glXMakeContextCurrent((Display*)m_display, (GLXDrawable)m_xd_draw, (GLXDrawable)m_xd_read, (GLXContext)m_x_context);
#endif
}
void CVideoMemory::UnSetCurrentCtx()
{
}
#endif
// Native control
void CNativeCtrl::slot_threadRepaint()
{
......@@ -132,12 +94,25 @@ CNativeCtrl::CNativeCtrl(QWidget *parent, const char *name) : QGLWidget(parent)
m_pWrapper = new CEditorCtrlWrapper();
m_pWrapper->m_pCtrl = this;
m_pWrapper->m_strFontsDirectory = L"/home/oleg/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb/Fonts/native";
m_pWrapper->m_strFontsDirectory = L"";
}
CNativeCtrl::~CNativeCtrl()
{
}
void CNativeCtrl::InitSDK(const std::wstring& sFontsPath, const std::wstring& sSdkPath)
{
m_pWrapper->m_strFontsDirectory = sFontsPath;
std::wstring sScriptPath = sSdkPath;
m_pWrapper->m_oWorkJS.m_oThreadJS.StartFromScript(sScriptPath);
}
void CNativeCtrl::OpenFile(const std::wstring& sFilePath)
{
m_pWrapper->InternalOpenFile(sFilePath);
m_pWrapper->InternalCalculateFile();
}
void CNativeCtrl::initializeGL()
{
m_pWrapper->m_oDevicePainter.m_oFrameControls.m_oFrame.Init();
......@@ -145,12 +120,6 @@ void CNativeCtrl::initializeGL()
m_pWrapper->InternalInit();
m_pWrapper->m_oWorkJS.m_oThreadJS.SetMainCtrl((CEditorCtrl*)m_pWrapper);
std::wstring strFile = L"/home/oleg/activex/AVS/Sources/TeamlabOffice/trunk/test/sdk-all.js";
m_pWrapper->m_oWorkJS.m_oThreadJS.StartFromScript(strFile);
m_pWrapper->InternalOpenFile(L"/home/oleg/activex/AVS/Sources/TeamlabOffice/trunk/test/Editor.bin");
m_pWrapper->InternalCalculateFile();
}
void CNativeCtrl::paintGL()
......@@ -170,11 +139,7 @@ void CNativeCtrl::paintGL()
pCS_GL->Enter();
m_pCPlusPlusWrapper->m_oDevicePainter.m_oFrameControls.m_oFrame.SetCurrentCtx();
GLenum err = glGetError();
pVRAM_Worker->m_oFrame.SetCurrentCtx();
pVRAM_Worker->m_oFrame.SetCurrentCtx();
DWORD dwTime1 = NSTimers::GetTickCount();
......@@ -184,8 +149,6 @@ void CNativeCtrl::paintGL()
1);
glClear(GL_COLOR_BUFFER_BIT);
err = glGetError();
GLfloat _width = this->width();
GLfloat _height = this->height();
......@@ -194,12 +157,8 @@ void CNativeCtrl::paintGL()
glLoadIdentity();
glOrtho(0.0, _width, 0.0, _height, -1.0, 1.0);
err = glGetError();
glEnable(GL_BLEND);
err = glGetError();
glColor3f(1,1,1);
glViewport(0, 0, _width, _height);
......@@ -224,6 +183,7 @@ void CNativeCtrl::paintGL()
oRect.Offset(m_pCPlusPlusWrapper->m_oViewer.X, m_pCPlusPlusWrapper->m_oViewer.Y);
{
pVRAM_Worker->m_oFrame.UnSetCurrentCtx();
pCS_GL->Leave();
m_pCPlusPlusWrapper->m_oCacheDocument.DrawGL(&m_pCPlusPlusWrapper->m_oDevicePainter,
oClipRect,
......@@ -282,6 +242,9 @@ void CNativeCtrl::paintGL()
glPopMatrix();
glFlush();
pVRAM_Worker->m_oFrame.UnSetCurrentCtx();
pCS_GL->Leave();
RELEASEOBJECT(pCS);
......
......@@ -21,8 +21,8 @@ protected slots:
public:
CNativeCtrl(QWidget *parent = 0, const char *name = NULL);
virtual ~CNativeCtrl();
public:
public:
virtual void initializeGL();
virtual void paintGL();
......@@ -39,6 +39,10 @@ public:
virtual void InvalidateRectNative(int x, int y, int w, int h);
public:
void InitSDK(const std::wstring& sFontsPath, const std::wstring& sSdkPath);
void OpenFile(const std::wstring& sFilePath);
private:
CEditorCtrlWrapper* m_pWrapper;
};
......
#ifndef TEST_NATIVECONTROL_H
#define TEST_NATIVECONTROL_H
#include <QApplication>
#include "../../editor/project/NativeControl.h"
typedef CNativeCtrl NativeControl;
class NativeControl : public CNativeCtrl
{
public:
NativeControl(QWidget *parent = 0, const char *name = NULL) : CNativeCtrl(parent, name)
{
}
virtual ~NativeControl()
{
}
public:
virtual void initializeGL()
{
CNativeCtrl::initializeGL();
QString sBasePath = QApplication::applicationDirPath();
QString sDebug = "Debug";
QString sRelease = "Release";
int n1 = sBasePath.lastIndexOf(sDebug);
int n2 = sBasePath.lastIndexOf(sRelease);
if (n1 < 0 && n2 < 0)
return;
int nCount = 0;
if (n1 > n2)
{
nCount = n1 + sDebug.length();
}
else
{
nCount = n2 + sRelease.length();
}
if (nCount != sBasePath.length())
{
sBasePath = sBasePath.mid(0, nCount);
}
QString sFontsPath = sBasePath + "/../../../../../OfficeWeb/Fonts/native";
QString sSdkPath = sBasePath + "/../../test_resources/sdk-all.js";
QString sDocumentPath = sBasePath + "/../../test_resources/document/Editor.bin";
std::wstring s1 = sFontsPath.toStdWString();
std::wstring s2 = sSdkPath.toStdWString();
std::wstring s3 = sDocumentPath.toStdWString();
InitSDK(s1, s2);
OpenFile(s3);
}
};
#endif // TEST_NATIVECONTROL_H
......@@ -35,7 +35,7 @@ namespace Aggplus
m_dGlobalAlpha = 1.0;
m_bSwapRGB = false;
#ifdef _LINUX
#if defined (_LINUX) || defined (_QT)
m_bSwapRGB = true;
#endif
}
......@@ -64,7 +64,7 @@ namespace Aggplus
m_bSwapRGB = false;
#ifdef _LINUX
#if defined (_LINUX) || defined (_QT)
m_bSwapRGB = true;
#endif
}
......@@ -98,7 +98,7 @@ namespace Aggplus
m_bSwapRGB = false;
#ifdef _LINUX
#if defined (_LINUX) || defined (_QT)
m_bSwapRGB = true;
#endif
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment