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)
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()
{
m_pWrapper->m_oDevicePainter.m_oFrameControls.m_oFrame.Init();
......@@ -128,19 +139,13 @@ void CNativeCtrl::paintGL()
{
CEditorCtrl* m_pCPlusPlusWrapper = (CEditorCtrl*)m_pWrapper;
CTemporaryCS* pCS = NULL;
if (!m_pCPlusPlusWrapper || !m_pCPlusPlusWrapper->m_pSkin)
return;
if (m_pCPlusPlusWrapper->m_bIsNeedCheckCSOnNativeBlitting)
pCS = new CTemporaryCS(&m_pCPlusPlusWrapper->m_oCS);
CTemporaryCS oCS(&m_pCPlusPlusWrapper->m_oCS_Places);
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();
DWORD dwTime1 = NSTimers::GetTickCount();
......@@ -185,34 +190,47 @@ 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,
oRect,
pBlock->m_arPages[j]->m_lPageIndex);
pCS_GL->Enter();
pVRAM_Worker->m_oFrame.SetCurrentCtx();
}
}
}
}
// overlay
if (m_pCPlusPlusWrapper->m_oOverlay.m_oBounds.max_x >= m_pCPlusPlusWrapper->m_oOverlay.m_oBounds.min_x &&
m_pCPlusPlusWrapper->m_oOverlay.m_oBounds.max_y >= m_pCPlusPlusWrapper->m_oOverlay.m_oBounds.min_y &&
NULL != pVRAM_Worker->m_pOverlay)
m_pCPlusPlusWrapper->m_oCS_Overlay.Enter();
if (NULL != m_pCPlusPlusWrapper->m_oOverlay.m_pBlitDIB)
{
//glEnable(GL_BLEND);
pVRAM_Worker->m_oFrame.SetCurrentCtx();
glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
pVRAM_Worker->m_oFrame.DrawTexture(pVRAM_Worker->m_pOverlay,
m_pCPlusPlusWrapper->m_oViewer.X,
m_pCPlusPlusWrapper->m_oViewer.Y,
pVRAM_Worker->m_oFrame.UnSetCurrentCtx();
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);
*/
//glDisable(GL_BLEND);
}
m_pCPlusPlusWrapper->m_oCS_Overlay.Leave();
// buttons
pVRAM_Worker->m_oFrame.DrawTexture(pVRAM_Worker->m_pButtonRulers,
......@@ -247,10 +265,6 @@ void CNativeCtrl::paintGL()
pVRAM_Worker->m_oFrame.UnSetCurrentCtx();
pCS_GL->Leave();
RELEASEOBJECT(pCS);
DWORD dwTime2 = NSTimers::GetTickCount();
/*
......
......@@ -55,6 +55,9 @@ public:
void InitSDK(const std::wstring& sFontsPath, const std::wstring& sSdkPath);
void OpenFile(const std::wstring& sFilePath);
void SetZoom(double dZoom);
void ChangeCountPagesInBlock();
private:
CEditorCtrlWrapper* m_pWrapper;
};
......@@ -124,6 +127,9 @@ public:
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 OpenFile(const std::wstring& sFilePath);
......@@ -255,6 +261,7 @@ public:
QGraphicsView::closeEvent(e);
}
#if 0
virtual void drawBackground(QPainter *painter, const QRectF &rect)
{
/*
......@@ -262,13 +269,49 @@ public:
QGraphicsView::drawBackground(painter, rect);
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();
if (NULL != m_pScene)
{
m_pScene->drawBackground(painter, rect);
}
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
......
......@@ -15,10 +15,30 @@ MainWindow::~MainWindow()
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)
{
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:
protected:
virtual void resizeEvent(QResizeEvent* e);
virtual void closeEvent(QCloseEvent* e);
private slots:
void on_horizontalSlider_valueChanged(int value);
void on_pushButton_clicked();
};
#endif // MAINWINDOW_H
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>564</width>
<height>361</height>
<width>567</width>
<height>391</height>
</rect>
</property>
<property name="windowTitle">
......@@ -20,37 +20,63 @@
<x>10</x>
<y>10</y>
<width>541</width>
<height>281</height>
<height>311</height>
</rect>
</property>
</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 class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>564</width>
<height>20</height>
<width>567</width>
<height>21</height>
</rect>
</property>
</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>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>NativeControl</class>
<extends>QWidget</extends>
<header location="global">NativeControl.h</header>
<header location="global">../control/NativeControl.h</header>
<container>1</container>
</customwidget>
</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