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

курсор и скроллинг (wheel)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58376 954022d7-b5bf-4e40-9824-e11837661b57
parent f28484a7
......@@ -8,15 +8,18 @@ class CEditorCtrlWrapper : public CEditorCtrl
{
public:
CNativeCtrl* m_pCtrl;
CVideoFrame* m_pTargetVRAM;
public:
CEditorCtrlWrapper() : CEditorCtrl()
{
m_pCtrl = NULL;
m_pTargetVRAM = NULL;
}
virtual ~CEditorCtrlWrapper()
{
m_pCtrl = NULL;
RELEASEOBJECT(m_pTargetVRAM);
}
virtual void InvalidateRectNative(int x, int y, int w, int h)
......@@ -137,22 +140,20 @@ void CNativeCtrl::initializeGL()
void CNativeCtrl::paintGL()
{
CEditorCtrl* m_pCPlusPlusWrapper = (CEditorCtrl*)m_pWrapper;
if (!m_pCPlusPlusWrapper || !m_pCPlusPlusWrapper->m_pSkin)
if (!m_pWrapper || !m_pWrapper->m_pSkin)
return;
CTemporaryCS oCS(&m_pCPlusPlusWrapper->m_oCS_Places);
CTemporaryCS oCS(&m_pWrapper->m_oCS_Places);
CVideoFrameControls* pVRAM_Worker = &m_pCPlusPlusWrapper->m_oDevicePainter.m_oFrameControls;
CVideoFrameControls* pVRAM_Worker = &m_pWrapper->m_oDevicePainter.m_oFrameControls;
pVRAM_Worker->m_oFrame.SetCurrentCtx();
DWORD dwTime1 = NSTimers::GetTickCount();
glClearColor(m_pCPlusPlusWrapper->m_pSkin->BackgroundColor.R / 255.0,
m_pCPlusPlusWrapper->m_pSkin->BackgroundColor.G / 255.0,
m_pCPlusPlusWrapper->m_pSkin->BackgroundColor.B / 255.0,
glClearColor(m_pWrapper->m_pSkin->BackgroundColor.R / 255.0,
m_pWrapper->m_pSkin->BackgroundColor.G / 255.0,
m_pWrapper->m_pSkin->BackgroundColor.B / 255.0,
1);
glClear(GL_COLOR_BUFFER_BIT);
......@@ -173,24 +174,24 @@ void CNativeCtrl::paintGL()
pVRAM_Worker->m_oFrame.SetSizes((int)_width, (int)_height);
// pages
Aggplus::Rect oClipRect(m_pCPlusPlusWrapper->m_oViewer.X,
m_pCPlusPlusWrapper->m_oViewer.Y,
m_pCPlusPlusWrapper->m_oViewer.Width,
m_pCPlusPlusWrapper->m_oViewer.Height);
Aggplus::Rect oClipRect(m_pWrapper->m_oViewer.X,
m_pWrapper->m_oViewer.Y,
m_pWrapper->m_oViewer.Width,
m_pWrapper->m_oViewer.Height);
if (m_pCPlusPlusWrapper->m_oDrawingDocument.m_lStartBlock >= 0)
if (m_pWrapper->m_oDrawingDocument.m_lStartBlock >= 0)
{
for (int i = (int)m_pCPlusPlusWrapper->m_oDrawingDocument.m_lStartBlock;
i <= m_pCPlusPlusWrapper->m_oDrawingDocument.m_lEndBlock; ++i)
for (int i = (int)m_pWrapper->m_oDrawingDocument.m_lStartBlock;
i <= m_pWrapper->m_oDrawingDocument.m_lEndBlock; ++i)
{
NSDrawingDocument::CBlockPages* pBlock = &m_pCPlusPlusWrapper->m_oDrawingDocument.m_arBlocks[i];
NSDrawingDocument::CBlockPages* pBlock = &m_pWrapper->m_oDrawingDocument.m_arBlocks[i];
for (int j = 0; j < pBlock->m_arPages.GetCount(); ++j)
{
Aggplus::Rect oRect = pBlock->m_arPages[j]->m_oGlobalBounds;
oRect.Offset(m_pCPlusPlusWrapper->m_oViewer.X, m_pCPlusPlusWrapper->m_oViewer.Y);
oRect.Offset(m_pWrapper->m_oViewer.X, m_pWrapper->m_oViewer.Y);
{
m_pCPlusPlusWrapper->m_oCacheDocument.DrawGL(&m_pCPlusPlusWrapper->m_oDevicePainter,
m_pWrapper->m_oCacheDocument.DrawGL(&m_pWrapper->m_oDevicePainter,
oClipRect,
oRect,
pBlock->m_arPages[j]->m_lPageIndex);
......@@ -200,9 +201,9 @@ void CNativeCtrl::paintGL()
}
// overlay
m_pCPlusPlusWrapper->m_oCS_Overlay.Enter();
m_pWrapper->m_oCS_Overlay.Enter();
if (NULL != m_pCPlusPlusWrapper->m_oOverlay.m_pBlitDIB)
if (NULL != m_pWrapper->m_oOverlay.m_pBlitDIB)
{
//glEnable(GL_BLEND);
......@@ -212,9 +213,9 @@ void CNativeCtrl::paintGL()
pVRAM_Worker->m_oFrame.UnSetCurrentCtx();
Aggplus::Rect oRectOverlay = m_pCPlusPlusWrapper->m_oOverlay.GetOverlayBlitRect();
Aggplus::Rect oRectOverlay = m_pWrapper->m_oOverlay.GetOverlayBlitRect();
pVRAM_Worker->m_oFrame.DrawTexture2(m_pCPlusPlusWrapper->m_oOverlay.m_pBlitDIB->m_pFrame,
pVRAM_Worker->m_oFrame.DrawTexture2(m_pWrapper->m_oOverlay.m_pBlitDIB->m_pFrame,
oRectOverlay.X,
oRectOverlay.Y,
oRectOverlay.Width,
......@@ -222,7 +223,7 @@ void CNativeCtrl::paintGL()
true);
/*
pVRAM_Worker->m_oFrame.DrawTexture(m_pCPlusPlusWrapper->m_oOverlay.m_pBlitDIB->m_pFrame,
pVRAM_Worker->m_oFrame.DrawTexture(m_pWrapper->m_oOverlay.m_pBlitDIB->m_pFrame,
oRectOverlay.X,
oRectOverlay.Y,
true);
......@@ -230,31 +231,66 @@ void CNativeCtrl::paintGL()
//glDisable(GL_BLEND);
}
m_pCPlusPlusWrapper->m_oCS_Overlay.Leave();
m_pWrapper->m_oCS_Overlay.Leave();
// target!!!
if (m_pWrapper->m_oTarget.IsNeedDraw())
{
m_pWrapper->m_oTarget.Lock();
int nT_W = 0;
int nT_H = 0;
m_pWrapper->m_oTarget.GetTargetPosition(nT_W, nT_H);
int _target_x = m_pWrapper->m_oViewer.X + nT_W;
int _target_y = m_pWrapper->m_oViewer.Y + nT_H;
int _target_w = m_pWrapper->m_oTarget.m_oDIB.m_lWidth;
int _target_h = m_pWrapper->m_oTarget.m_oDIB.m_lHeight;
m_pWrapper->m_oDrawingChecker.SetOldTarget(_target_x, _target_y, _target_w, _target_h);
bool bIsChanged = m_pWrapper->m_oTarget.IsChangedTarget();
if (bIsChanged)
RELEASEOBJECT(m_pWrapper->m_pTargetVRAM);
if (NULL == m_pWrapper->m_pTargetVRAM)
{
m_pWrapper->m_oTarget.m_oDIB.CopyToVRAM(&pVRAM_Worker->m_oFrame);
m_pWrapper->m_pTargetVRAM = m_pWrapper->m_oTarget.m_oDIB.m_pFrame;
m_pWrapper->m_oTarget.m_oDIB.m_pFrame = NULL;
}
pVRAM_Worker->m_oFrame.DrawTexture(m_pWrapper->m_pTargetVRAM, _target_x, _target_y, true);
m_pWrapper->m_oTarget.UnLock();
}
m_pWrapper->m_oDevicePainter.LockPaint();
// buttons
pVRAM_Worker->m_oFrame.DrawTexture(pVRAM_Worker->m_pButtonRulers,
m_pCPlusPlusWrapper->m_oButtonRulers.X,
m_pCPlusPlusWrapper->m_oButtonRulers.Y, true);
m_pWrapper->m_oButtonRulers.X,
m_pWrapper->m_oButtonRulers.Y, true);
pVRAM_Worker->m_oFrame.DrawTexture(pVRAM_Worker->m_pButtonNextPage,
m_pCPlusPlusWrapper->m_oNext.X,
m_pCPlusPlusWrapper->m_oNext.Y, true);
m_pWrapper->m_oNext.X,
m_pWrapper->m_oNext.Y, true);
pVRAM_Worker->m_oFrame.DrawTexture(pVRAM_Worker->m_pButtonPrevPage,
m_pCPlusPlusWrapper->m_oPrev.X,
m_pCPlusPlusWrapper->m_oPrev.Y, true);
m_pWrapper->m_oPrev.X,
m_pWrapper->m_oPrev.Y, true);
// scrolls
pVRAM_Worker->m_oFrame.DrawTexture(pVRAM_Worker->m_pVerScroll,
m_pCPlusPlusWrapper->m_oVerScroll.X,
m_pCPlusPlusWrapper->m_oVerScroll.Y, true);
m_pWrapper->m_oVerScroll.X,
m_pWrapper->m_oVerScroll.Y, true);
if (m_pCPlusPlusWrapper->m_bIsHorScrollVisible)
if (m_pWrapper->m_bIsHorScrollVisible)
{
pVRAM_Worker->m_oFrame.DrawTexture(pVRAM_Worker->m_pHorScroll,
m_pCPlusPlusWrapper->m_oHorScroll.X,
m_pCPlusPlusWrapper->m_oHorScroll.Y, true);
m_pWrapper->m_oHorScroll.X,
m_pWrapper->m_oHorScroll.Y, true);
}
glDisable(GL_BLEND);
......@@ -263,6 +299,8 @@ void CNativeCtrl::paintGL()
glFlush();
m_pWrapper->m_oDevicePainter.LeavePaint();
pVRAM_Worker->m_oFrame.UnSetCurrentCtx();
DWORD dwTime2 = NSTimers::GetTickCount();
......@@ -344,6 +382,23 @@ void CNativeCtrl::mouseReleaseEvent(QMouseEvent* e)
m_pWrapper->InternalOnMouseUp();
}
void CNativeCtrl::wheelEvent(QWheelEvent* event)
{
int nDelta = (int)event->delta() >> 2;
Qt::KeyboardModifiers mods = event->modifiers();
m_pWrapper->m_oWhellController.WhellDeltaX = 0;
m_pWrapper->m_oWhellController.WhellDeltaY = 0;
if (Qt::Vertical == event->orientation() && (0 == (mods & Qt::ShiftModifier)))
m_pWrapper->m_oWhellController.WhellDeltaY = -nDelta;
else
m_pWrapper->m_oWhellController.WhellDeltaX = -nDelta;
m_pWrapper->InternalOnMouseWhell();
event->ignore();
}
void CNativeCtrl::keyPressEvent(QKeyEvent* e)
{
......
......@@ -3,6 +3,7 @@
#include <QWidget>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QKeyEvent>
#include <QPaintEvent>
#include <QGLWidget>
......@@ -45,6 +46,7 @@ public:
virtual void mousePressEvent(QMouseEvent* e);
virtual void mouseMoveEvent(QMouseEvent* e);
virtual void mouseReleaseEvent(QMouseEvent* e);
virtual void wheelEvent(QWheelEvent* event);
virtual void keyPressEvent(QKeyEvent* e);
virtual void keyReleaseEvent(QKeyEvent* e);
......
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