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

windows version

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58375 954022d7-b5bf-4e40-9824-e11837661b57
parent f15bee8e
...@@ -115,6 +115,17 @@ void CNativeCtrl::OpenFile(const std::wstring& sFilePath) ...@@ -115,6 +115,17 @@ void CNativeCtrl::OpenFile(const std::wstring& sFilePath)
m_pWrapper->InternalCalculateFile(); m_pWrapper->InternalCalculateFile();
} }
void CNativeCtrl::SetZoom(double dZoom)
{
m_pWrapper->SetZoom(dZoom);
}
void CNativeCtrl::ChangeCountPagesInBlock()
{
int nCountOld = m_pWrapper->GetPagesInBlock();
m_pWrapper->SetPagesInBlock((nCountOld == 1) ? 2 : 1);
}
void CNativeCtrl::initializeGL() void CNativeCtrl::initializeGL()
{ {
m_pWrapper->m_oDevicePainter.m_oFrameControls.m_oFrame.Init(); m_pWrapper->m_oDevicePainter.m_oFrameControls.m_oFrame.Init();
...@@ -128,19 +139,13 @@ void CNativeCtrl::paintGL() ...@@ -128,19 +139,13 @@ void CNativeCtrl::paintGL()
{ {
CEditorCtrl* m_pCPlusPlusWrapper = (CEditorCtrl*)m_pWrapper; CEditorCtrl* m_pCPlusPlusWrapper = (CEditorCtrl*)m_pWrapper;
CTemporaryCS* pCS = NULL;
if (!m_pCPlusPlusWrapper || !m_pCPlusPlusWrapper->m_pSkin) if (!m_pCPlusPlusWrapper || !m_pCPlusPlusWrapper->m_pSkin)
return; return;
if (m_pCPlusPlusWrapper->m_bIsNeedCheckCSOnNativeBlitting) CTemporaryCS oCS(&m_pCPlusPlusWrapper->m_oCS_Places);
pCS = new CTemporaryCS(&m_pCPlusPlusWrapper->m_oCS);
CVideoFrameControls* pVRAM_Worker = &m_pCPlusPlusWrapper->m_oDevicePainter.m_oFrameControls; CVideoFrameControls* pVRAM_Worker = &m_pCPlusPlusWrapper->m_oDevicePainter.m_oFrameControls;
NSCriticalSection::CRITICAL_SECTION* pCS_GL = pVRAM_Worker->m_oFrame.GetLocker();
pCS_GL->Enter();
pVRAM_Worker->m_oFrame.SetCurrentCtx(); pVRAM_Worker->m_oFrame.SetCurrentCtx();
DWORD dwTime1 = NSTimers::GetTickCount(); DWORD dwTime1 = NSTimers::GetTickCount();
...@@ -185,34 +190,47 @@ void CNativeCtrl::paintGL() ...@@ -185,34 +190,47 @@ void CNativeCtrl::paintGL()
oRect.Offset(m_pCPlusPlusWrapper->m_oViewer.X, m_pCPlusPlusWrapper->m_oViewer.Y); 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, m_pCPlusPlusWrapper->m_oCacheDocument.DrawGL(&m_pCPlusPlusWrapper->m_oDevicePainter,
oClipRect, oClipRect,
oRect, oRect,
pBlock->m_arPages[j]->m_lPageIndex); pBlock->m_arPages[j]->m_lPageIndex);
pCS_GL->Enter();
pVRAM_Worker->m_oFrame.SetCurrentCtx();
} }
} }
} }
} }
// overlay // overlay
if (m_pCPlusPlusWrapper->m_oOverlay.m_oBounds.max_x >= m_pCPlusPlusWrapper->m_oOverlay.m_oBounds.min_x && m_pCPlusPlusWrapper->m_oCS_Overlay.Enter();
m_pCPlusPlusWrapper->m_oOverlay.m_oBounds.max_y >= m_pCPlusPlusWrapper->m_oOverlay.m_oBounds.min_y &&
NULL != pVRAM_Worker->m_pOverlay) if (NULL != m_pCPlusPlusWrapper->m_oOverlay.m_pBlitDIB)
{ {
//glEnable(GL_BLEND); //glEnable(GL_BLEND);
pVRAM_Worker->m_oFrame.SetCurrentCtx();
glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
pVRAM_Worker->m_oFrame.DrawTexture(pVRAM_Worker->m_pOverlay, pVRAM_Worker->m_oFrame.UnSetCurrentCtx();
m_pCPlusPlusWrapper->m_oViewer.X,
m_pCPlusPlusWrapper->m_oViewer.Y, Aggplus::Rect oRectOverlay = m_pCPlusPlusWrapper->m_oOverlay.GetOverlayBlitRect();
pVRAM_Worker->m_oFrame.DrawTexture2(m_pCPlusPlusWrapper->m_oOverlay.m_pBlitDIB->m_pFrame,
oRectOverlay.X,
oRectOverlay.Y,
oRectOverlay.Width,
oRectOverlay.Height,
true);
/*
pVRAM_Worker->m_oFrame.DrawTexture(m_pCPlusPlusWrapper->m_oOverlay.m_pBlitDIB->m_pFrame,
oRectOverlay.X,
oRectOverlay.Y,
true); true);
*/
//glDisable(GL_BLEND); //glDisable(GL_BLEND);
} }
m_pCPlusPlusWrapper->m_oCS_Overlay.Leave();
// buttons // buttons
pVRAM_Worker->m_oFrame.DrawTexture(pVRAM_Worker->m_pButtonRulers, pVRAM_Worker->m_oFrame.DrawTexture(pVRAM_Worker->m_pButtonRulers,
...@@ -247,10 +265,6 @@ void CNativeCtrl::paintGL() ...@@ -247,10 +265,6 @@ void CNativeCtrl::paintGL()
pVRAM_Worker->m_oFrame.UnSetCurrentCtx(); pVRAM_Worker->m_oFrame.UnSetCurrentCtx();
pCS_GL->Leave();
RELEASEOBJECT(pCS);
DWORD dwTime2 = NSTimers::GetTickCount(); DWORD dwTime2 = NSTimers::GetTickCount();
/* /*
......
...@@ -55,6 +55,9 @@ public: ...@@ -55,6 +55,9 @@ public:
void InitSDK(const std::wstring& sFontsPath, const std::wstring& sSdkPath); void InitSDK(const std::wstring& sFontsPath, const std::wstring& sSdkPath);
void OpenFile(const std::wstring& sFilePath); void OpenFile(const std::wstring& sFilePath);
void SetZoom(double dZoom);
void ChangeCountPagesInBlock();
private: private:
CEditorCtrlWrapper* m_pWrapper; CEditorCtrlWrapper* m_pWrapper;
}; };
...@@ -124,6 +127,9 @@ public: ...@@ -124,6 +127,9 @@ public:
connect(this, SIGNAL(signal_threadRepaint()), SLOT(slot_threadRepaint()), Qt::QueuedConnection); connect(this, SIGNAL(signal_threadRepaint()), SLOT(slot_threadRepaint()), Qt::QueuedConnection);
} }
void LockGL();
void UnlockGL();
void InitSDK(const std::wstring& sFontsPath, const std::wstring& sSdkPath); void InitSDK(const std::wstring& sFontsPath, const std::wstring& sSdkPath);
void OpenFile(const std::wstring& sFilePath); void OpenFile(const std::wstring& sFilePath);
...@@ -255,6 +261,7 @@ public: ...@@ -255,6 +261,7 @@ public:
QGraphicsView::closeEvent(e); QGraphicsView::closeEvent(e);
} }
#if 0
virtual void drawBackground(QPainter *painter, const QRectF &rect) virtual void drawBackground(QPainter *painter, const QRectF &rect)
{ {
/* /*
...@@ -262,13 +269,49 @@ public: ...@@ -262,13 +269,49 @@ public:
QGraphicsView::drawBackground(painter, rect); QGraphicsView::drawBackground(painter, rect);
m_pWidget->doneCurrent(); m_pWidget->doneCurrent();
*/ */
m_pWidget->makeCurrent();
if (NULL != m_pScene)
{
m_pScene->LockGL();
m_pScene->drawBackground(painter, rect);
m_pScene->UnlockGL();
}
m_pWidget->makeCurrent();
/*
m_pWidget->makeCurrent(); m_pWidget->makeCurrent();
if (NULL != m_pScene) if (NULL != m_pScene)
{ {
m_pScene->drawBackground(painter, rect); m_pScene->drawBackground(painter, rect);
} }
m_pWidget->doneCurrent(); m_pWidget->doneCurrent();
*/
} }
#endif
#if 1
virtual void paintEvent(QPaintEvent *event)
{
if (NULL == m_pScene)
{
QGraphicsView::paintEvent(event);
return;
}
m_pScene->LockGL();
m_pWidget->makeCurrent();
QGraphicsView::paintEvent(event);
//m_pWidget->doneCurrent();
m_pScene->UnlockGL();
}
#endif
}; };
#endif #endif
......
...@@ -15,10 +15,30 @@ MainWindow::~MainWindow() ...@@ -15,10 +15,30 @@ MainWindow::~MainWindow()
void MainWindow::resizeEvent(QResizeEvent* e) void MainWindow::resizeEvent(QResizeEvent* e)
{ {
ui->widget->setGeometry(10, 10, this->width() - 20, this->height() - 60); ui->widget->setGeometry(10, 10, this->width() - 20, this->height() - ui->horizontalSlider->height() - 10);
ui->horizontalSlider->setGeometry(10,
this->height() - ui->horizontalSlider->height(),
500,
ui->horizontalSlider->height());
ui->pushButton->setGeometry(520,
this->height() - ui->horizontalSlider->height(),
60,
ui->horizontalSlider->height());
} }
void MainWindow::closeEvent(QCloseEvent* e) void MainWindow::closeEvent(QCloseEvent* e)
{ {
ui->widget->closeEvent(e); ui->widget->closeEvent(e);
} }
void MainWindow::on_horizontalSlider_valueChanged(int value)
{
ui->widget->SetZoom((double)value / 100.0);
}
void MainWindow::on_pushButton_clicked()
{
ui->widget->ChangeCountPagesInBlock();
}
...@@ -21,6 +21,9 @@ private: ...@@ -21,6 +21,9 @@ private:
protected: protected:
virtual void resizeEvent(QResizeEvent* e); virtual void resizeEvent(QResizeEvent* e);
virtual void closeEvent(QCloseEvent* e); virtual void closeEvent(QCloseEvent* e);
private slots:
void on_horizontalSlider_valueChanged(int value);
void on_pushButton_clicked();
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>564</width> <width>567</width>
<height>361</height> <height>391</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -20,37 +20,63 @@ ...@@ -20,37 +20,63 @@
<x>10</x> <x>10</x>
<y>10</y> <y>10</y>
<width>541</width> <width>541</width>
<height>281</height> <height>311</height>
</rect> </rect>
</property> </property>
</widget> </widget>
<widget class="QSlider" name="horizontalSlider">
<property name="geometry">
<rect>
<x>10</x>
<y>330</y>
<width>451</width>
<height>22</height>
</rect>
</property>
<property name="minimum">
<number>50</number>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="sliderPosition">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>480</x>
<y>330</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Pages</string>
</property>
</widget>
</widget> </widget>
<widget class="QMenuBar" name="menuBar"> <widget class="QMenuBar" name="menuBar">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>564</width> <width>567</width>
<height>20</height> <height>21</height>
</rect> </rect>
</property> </property>
</widget> </widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>NativeControl</class> <class>NativeControl</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header location="global">NativeControl.h</header> <header location="global">../control/NativeControl.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
......
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