Annotations in preview

This commit is contained in:
Jakub Melka
2020-04-11 13:56:05 +02:00
parent 0efc4bb40b
commit dc7dd8fe74
12 changed files with 300 additions and 90 deletions

View File

@ -283,7 +283,7 @@ void PDFRenderToImagesDialog::on_buttonBox_clicked(QAbstractButton* button)
m_pageIndices = m_imageExportSettings.getPages();
m_optionalContentActivity = new pdf::PDFOptionalContentActivity(m_document, pdf::OCUsage::Export, this);
m_cms = m_proxy->getCMSManager()->getCurrentCMS();
m_rasterizerPool = new pdf::PDFRasterizerPool(m_document, m_proxy->getFontCache(), m_cms.data(),
m_rasterizerPool = new pdf::PDFRasterizerPool(m_document, m_proxy->getFontCache(), m_proxy->getCMSManager(),
m_optionalContentActivity, m_proxy->getFeatures(), m_proxy->getMeshQualitySettings(),
pdf::PDFRasterizerPool::getDefaultRasterizerCount(), m_proxy->isUsingOpenGL(), m_proxy->getSurfaceFormat(), this);
connect(m_rasterizerPool, &pdf::PDFRasterizerPool::renderError, this, &PDFRenderToImagesDialog::onRenderError);

View File

@ -234,6 +234,7 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
ui->actionRenderOptionTextAntialiasing->setData(pdf::PDFRenderer::TextAntialiasing);
ui->actionRenderOptionSmoothPictures->setData(pdf::PDFRenderer::SmoothImages);
ui->actionRenderOptionIgnoreOptionalContentSettings->setData(pdf::PDFRenderer::IgnoreOptionalContent);
ui->actionRenderOptionDisplayAnnotations->setData(pdf::PDFRenderer::DisplayAnnotations);
ui->actionInvertColors->setData(pdf::PDFRenderer::InvertColors);
ui->actionShow_Text_Blocks->setData(pdf::PDFRenderer::DebugTextBlocks);
ui->actionShow_Text_Lines->setData(pdf::PDFRenderer::DebugTextLines);
@ -263,7 +264,8 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
updateMagnifierToolSettings();
connect(m_toolManager, &pdf::PDFToolManager::messageDisplayRequest, statusBar(), &QStatusBar::showMessage);
m_annotationManager = new pdf::PDFAnnotationManager(m_pdfWidget->getDrawWidgetProxy(), this);
m_annotationManager = new pdf::PDFWidgetAnnotationManager(m_pdfWidget->getDrawWidgetProxy(), this);
m_pdfWidget->getDrawWidgetProxy()->setAnnotationManager(m_annotationManager);
connect(m_pdfWidget->getDrawWidgetProxy(), &pdf::PDFDrawWidgetProxy::drawSpaceChanged, this, &PDFViewerMainWindow::onDrawSpaceChanged);
connect(m_pdfWidget->getDrawWidgetProxy(), &pdf::PDFDrawWidgetProxy::pageLayoutChanged, this, &PDFViewerMainWindow::onPageLayoutChanged);
@ -861,6 +863,8 @@ void PDFViewerMainWindow::onViewerSettingsChanged()
m_pdfWidget->getDrawWidgetProxy()->setPreferredMeshResolutionRatio(m_settings->getPreferredMeshResolutionRatio());
m_pdfWidget->getDrawWidgetProxy()->setMinimalMeshResolutionRatio(m_settings->getMinimalMeshResolutionRatio());
m_pdfWidget->getDrawWidgetProxy()->setColorTolerance(m_settings->getColorTolerance());
m_annotationManager->setFeatures(m_settings->getFeatures());
m_annotationManager->setMeshQualitySettings(m_pdfWidget->getDrawWidgetProxy()->getMeshQualitySettings());
pdf::PDFExecutionPolicy::setStrategy(m_settings->getMultithreadingStrategy());
updateRenderingOptionActions();
@ -973,7 +977,7 @@ void PDFViewerMainWindow::setDocument(const pdf::PDFDocument* document)
m_optionalContentActivity = new pdf::PDFOptionalContentActivity(document, pdf::OCUsage::View, this);
}
m_annotationManager->setDocument(document);
m_annotationManager->setDocument(document, m_optionalContentActivity);
m_toolManager->setDocument(document);
m_textToSpeech->setDocument(document);
m_pdfWidget->setDocument(document, m_optionalContentActivity);
@ -1030,6 +1034,7 @@ std::vector<QAction*> PDFViewerMainWindow::getRenderingOptionActions() const
ui->actionRenderOptionTextAntialiasing,
ui->actionRenderOptionSmoothPictures,
ui->actionRenderOptionIgnoreOptionalContentSettings,
ui->actionRenderOptionDisplayAnnotations,
ui->actionShow_Text_Blocks,
ui->actionShow_Text_Lines,
ui->actionInvertColors };

View File

@ -180,7 +180,7 @@ private:
bool m_isChangingProgressStep;
pdf::PDFToolManager* m_toolManager;
pdf::PDFAnnotationManager* m_annotationManager;
pdf::PDFWidgetAnnotationManager* m_annotationManager;
PDFTextToSpeech* m_textToSpeech;
};

View File

@ -66,6 +66,7 @@
<addaction name="actionRenderOptionTextAntialiasing"/>
<addaction name="actionRenderOptionSmoothPictures"/>
<addaction name="actionRenderOptionIgnoreOptionalContentSettings"/>
<addaction name="actionRenderOptionDisplayAnnotations"/>
</widget>
<addaction name="menuPage_Layout"/>
<addaction name="menuRendering_Options"/>
@ -499,6 +500,14 @@
<string>Extract Image</string>
</property>
</action>
<action name="actionRenderOptionDisplayAnnotations">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Display Annotations</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>

View File

@ -238,6 +238,7 @@ void PDFViewerSettingsDialog::loadData()
ui->ignoreOptionalContentCheckBox->setChecked(m_settings.m_features.testFlag(pdf::PDFRenderer::IgnoreOptionalContent));
ui->clipToCropBoxCheckBox->setChecked(m_settings.m_features.testFlag(pdf::PDFRenderer::ClipToCropBox));
ui->displayTimeCheckBox->setChecked(m_settings.m_features.testFlag(pdf::PDFRenderer::DisplayTimes));
ui->displayAnnotationsCheckBox->setChecked(m_settings.m_features.testFlag(pdf::PDFRenderer::DisplayAnnotations));
// Shading
ui->preferredMeshResolutionEdit->setValue(m_settings.m_preferredMeshResolutionRatio);
@ -358,6 +359,10 @@ void PDFViewerSettingsDialog::saveData()
{
m_settings.m_features.setFlag(pdf::PDFRenderer::IgnoreOptionalContent, ui->ignoreOptionalContentCheckBox->isChecked());
}
else if (sender == ui->displayAnnotationsCheckBox)
{
m_settings.m_features.setFlag(pdf::PDFRenderer::DisplayAnnotations, ui->displayAnnotationsCheckBox->isChecked());
}
else if (sender == ui->clipToCropBoxCheckBox)
{
m_settings.m_features.setFlag(pdf::PDFRenderer::ClipToCropBox, ui->clipToCropBoxCheckBox->isChecked());

View File

@ -26,7 +26,7 @@
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>7</number>
<number>1</number>
</property>
<widget class="QWidget" name="enginePage">
<layout class="QVBoxLayout" name="enginePageLayout">
@ -160,22 +160,8 @@
<layout class="QVBoxLayout" name="renderingSettingsGroupBoxLayout">
<item>
<layout class="QGridLayout" name="renderingSettingsGridLayout">
<item row="3" column="1">
<widget class="QCheckBox" name="ignoreOptionalContentCheckBox">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="antialiasingLabel">
<property name="text">
<string>Antialiasing</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="smoothPicturesCheckBox">
<item row="0" column="1">
<widget class="QCheckBox" name="antialiasingCheckBox">
<property name="text">
<string>Enable</string>
</property>
@ -188,13 +174,6 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="antialiasingCheckBox">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="clipToCropBoxLabel">
<property name="text">
@ -202,27 +181,6 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="ignoreOptionalContentLabel">
<property name="text">
<string>Ignore optional content</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="smoothPicturesLabel">
<property name="text">
<string>Smooth pictures</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="clipToCropBoxCheckBox">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="textAntialiasingLabel">
<property name="text">
@ -230,10 +188,31 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="displayTimeLabel">
<item row="3" column="0">
<widget class="QLabel" name="ignoreOptionalContentLabel">
<property name="text">
<string>Display page compile/draw time</string>
<string>Ignore optional content</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="clipToCropBoxCheckBox">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="ignoreOptionalContentCheckBox">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="smoothPicturesCheckBox">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
@ -244,12 +223,47 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="smoothPicturesLabel">
<property name="text">
<string>Smooth pictures</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="displayTimeLabel">
<property name="text">
<string>Display page compile/draw time</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="antialiasingLabel">
<property name="text">
<string>Antialiasing</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="displayAnnotationsLabel">
<property name="text">
<string>Display annotations</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="displayAnnotationsCheckBox">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="renderingInfoLabel">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Rendering settings defines, how rendering engine should handle the page content, and appearance of displayed graphics. &lt;span style=&quot; font-weight:600;&quot;&gt;Antialiasing&lt;/span&gt; turns on antialiasing of painted shapes, such as rectangles, vector graphics, lines, but it did not affects text (characters printed on the screen). &lt;span style=&quot; font-weight:600;&quot;&gt;Text antialiasing &lt;/span&gt;turns on antialiasing of painted characters on the screen, but not any other items. Both &lt;span style=&quot; font-weight:600;&quot;&gt;Antialiasing &lt;/span&gt;and &lt;span style=&quot; font-weight:600;&quot;&gt;Text antialiasing &lt;/span&gt;affects only software renderer. If you are using hardware rendering engine, such as OpenGL rendering engine, this doesn't do anything, because OpenGL engine renders the pictures using MSAA antialiasing (if turned on).&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Smooth pictures&lt;/span&gt; transforms pictures to device space coordinates using smooth image transformation, which usually leads to better image quality. When this is turned off, then default fast transformation is used, and quality of the image is lower, if the source DPI and device DPI is different.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Ignore optional content &lt;/span&gt;ignores all optional content settings and paints everything in the content stream. &lt;span style=&quot; font-weight:600;&quot;&gt;Clip to crop box&lt;/span&gt; clips the drawing rectangle to the crop box of the page, which is usually smaller, than whole page. The graphics outside of the crop box is not drawn (for example, it can contain marks for printer etc.). &lt;span style=&quot; font-weight:600;&quot;&gt;Display page compile/draw time &lt;/span&gt;is used mainly for debugging purposes, it displays page compile time (compiled page is stored in the cache) and draw time (when the renderer draws compiled page contents to the output device).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Rendering settings defines, how rendering engine should handle the page content, and appearance of displayed graphics. &lt;span style=&quot; font-weight:600;&quot;&gt;Antialiasing&lt;/span&gt; turns on antialiasing of painted shapes, such as rectangles, vector graphics, lines, but it did not affects text (characters printed on the screen). &lt;span style=&quot; font-weight:600;&quot;&gt;Text antialiasing &lt;/span&gt;turns on antialiasing of painted characters on the screen, but not any other items. Both &lt;span style=&quot; font-weight:600;&quot;&gt;Antialiasing &lt;/span&gt;and &lt;span style=&quot; font-weight:600;&quot;&gt;Text antialiasing &lt;/span&gt;affects only software renderer. If you are using hardware rendering engine, such as OpenGL rendering engine, this doesn't do anything, because OpenGL engine renders the pictures using MSAA antialiasing (if turned on).&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Smooth pictures&lt;/span&gt; transforms pictures to device space coordinates using smooth image transformation, which usually leads to better image quality. When this is turned off, then default fast transformation is used, and quality of the image is lower, if the source DPI and device DPI is different.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Ignore optional content &lt;/span&gt;ignores all optional content settings and paints everything in the content stream. &lt;span style=&quot; font-weight:600;&quot;&gt;Clip to crop box&lt;/span&gt; clips the drawing rectangle to the crop box of the page, which is usually smaller, than whole page. The graphics outside of the crop box is not drawn (for example, it can contain marks for printer etc.). &lt;span style=&quot; font-weight:600;&quot;&gt;Display page compile/draw time &lt;/span&gt;is used mainly for debugging purposes, it displays page compile time (compiled page is stored in the cache) and draw time (when the renderer draws compiled page contents to the output device).&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Display annotations&lt;/span&gt; is used to enable or disable displaying of annotations. If annotations are disabled (they are not displayed), user can't interact with them.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>