mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Magnifier tool
This commit is contained in:
@@ -40,5 +40,6 @@
|
||||
<file>resources/pause.svg</file>
|
||||
<file>resources/play.svg</file>
|
||||
<file>resources/stop.svg</file>
|
||||
<file>resources/magnifier.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@@ -189,6 +189,7 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
|
||||
|
||||
// Tools
|
||||
ui->mainToolBar->addAction(ui->actionSelectText);
|
||||
ui->mainToolBar->addAction(ui->actionMagnifier);
|
||||
|
||||
connect(ui->actionZoom_In, &QAction::triggered, this, [this] { m_pdfWidget->getDrawWidgetProxy()->performOperation(pdf::PDFDrawWidgetProxy::ZoomIn); });
|
||||
connect(ui->actionZoom_Out, &QAction::triggered, this, [this] { m_pdfWidget->getDrawWidgetProxy()->performOperation(pdf::PDFDrawWidgetProxy::ZoomOut); });
|
||||
@@ -251,8 +252,10 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
|
||||
actions.selectAllAction = ui->actionSelectTextAll;
|
||||
actions.deselectAction = ui->actionDeselectText;
|
||||
actions.copyTextAction = ui->actionCopyText;
|
||||
actions.magnifierAction = ui->actionMagnifier;
|
||||
m_toolManager = new pdf::PDFToolManager(m_pdfWidget->getDrawWidgetProxy(), actions, this, this);
|
||||
m_pdfWidget->setToolManager(m_toolManager);
|
||||
updateMagnifierToolSettings();
|
||||
|
||||
connect(m_pdfWidget->getDrawWidgetProxy(), &pdf::PDFDrawWidgetProxy::drawSpaceChanged, this, &PDFViewerMainWindow::onDrawSpaceChanged);
|
||||
connect(m_pdfWidget->getDrawWidgetProxy(), &pdf::PDFDrawWidgetProxy::pageLayoutChanged, this, &PDFViewerMainWindow::onPageLayoutChanged);
|
||||
@@ -1123,6 +1126,13 @@ void PDFViewerMainWindow::on_actionRendering_Errors_triggered()
|
||||
renderingErrorsDialog.exec();
|
||||
}
|
||||
|
||||
void PDFViewerMainWindow::updateMagnifierToolSettings()
|
||||
{
|
||||
pdf::PDFMagnifierTool* magnifierTool = m_toolManager->getMagnifierTool();
|
||||
magnifierTool->setMagnifierSize(PDFWidgetUtils::scaleDPI_x(this, m_settings->getSettings().m_magnifierSize));
|
||||
magnifierTool->setMagnifierZoom(m_settings->getSettings().m_magnifierZoom);
|
||||
}
|
||||
|
||||
void PDFViewerMainWindow::on_actionOptions_triggered()
|
||||
{
|
||||
PDFViewerSettingsDialog::OtherSettings otherSettings;
|
||||
@@ -1136,6 +1146,7 @@ void PDFViewerMainWindow::on_actionOptions_triggered()
|
||||
m_CMSManager->setSettings(m_settings->getColorManagementSystemSettings());
|
||||
m_recentFileManager->setRecentFilesLimit(dialog.getOtherSettings().maximumRecentFileCount);
|
||||
m_textToSpeech->setSettings(m_settings);
|
||||
updateMagnifierToolSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -127,6 +127,7 @@ private:
|
||||
void updateRenderingOptionActions();
|
||||
void updateUI(bool fullUpdate);
|
||||
void updateActionsAvailability();
|
||||
void updateMagnifierToolSettings();
|
||||
|
||||
void onViewerSettingsChanged();
|
||||
void onRenderingOptionTriggered(bool checked);
|
||||
|
@@ -86,6 +86,8 @@
|
||||
<property name="title">
|
||||
<string>Tools</string>
|
||||
</property>
|
||||
<addaction name="actionMagnifier"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionRendering_Errors"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionOptions"/>
|
||||
@@ -456,6 +458,21 @@
|
||||
<string>Render to Images</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMagnifier">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="pdfforqtviewer.qrc">
|
||||
<normaloff>:/resources/magnifier.svg</normaloff>:/resources/magnifier.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Magnifier</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Magnifier Tool</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
|
@@ -54,6 +54,8 @@ void PDFViewerSettings::readSettings(QSettings& settings, const pdf::PDFCMSSetti
|
||||
m_settings.m_allowLaunchApplications = settings.value("allowLaunchApplications", defaultSettings.m_allowLaunchApplications).toBool();
|
||||
m_settings.m_allowLaunchURI = settings.value("allowLaunchURI", defaultSettings.m_allowLaunchURI).toBool();
|
||||
m_settings.m_multithreadingStrategy = static_cast<pdf::PDFExecutionPolicy::Strategy>(settings.value("mutlithreadingStrategy", static_cast<int>(defaultSettings.m_multithreadingStrategy)).toInt());
|
||||
m_settings.m_magnifierSize = settings.value("magnifierSize", defaultSettings.m_magnifierSize).toInt();
|
||||
m_settings.m_magnifierZoom = settings.value("magnifierZoom", defaultSettings.m_magnifierZoom).toDouble();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("ColorManagementSystemSettings");
|
||||
@@ -100,6 +102,8 @@ void PDFViewerSettings::writeSettings(QSettings& settings)
|
||||
settings.setValue("allowLaunchApplications", m_settings.m_allowLaunchApplications);
|
||||
settings.setValue("allowLaunchURI", m_settings.m_allowLaunchURI);
|
||||
settings.setValue("mutlithreadingStrategy", static_cast<int>(m_settings.m_multithreadingStrategy));
|
||||
settings.setValue("magnifierSize", m_settings.m_magnifierSize);
|
||||
settings.setValue("magnifierZoom", m_settings.m_magnifierZoom);
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("ColorManagementSystemSettings");
|
||||
@@ -226,7 +230,9 @@ PDFViewerSettings::Settings::Settings() :
|
||||
m_multithreadingStrategy(pdf::PDFExecutionPolicy::Strategy::PageMultithreaded),
|
||||
m_speechRate(0.0),
|
||||
m_speechPitch(0.0),
|
||||
m_speechVolume(1.0)
|
||||
m_speechVolume(1.0),
|
||||
m_magnifierSize(100),
|
||||
m_magnifierZoom(2.0)
|
||||
{
|
||||
|
||||
}
|
||||
|
@@ -71,6 +71,10 @@ public:
|
||||
double m_speechRate;
|
||||
double m_speechPitch;
|
||||
double m_speechVolume;
|
||||
|
||||
// Magnifier tool settings
|
||||
int m_magnifierSize;
|
||||
double m_magnifierZoom;
|
||||
};
|
||||
|
||||
const Settings& getSettings() const { return m_settings; }
|
||||
|
@@ -256,6 +256,8 @@ void PDFViewerSettingsDialog::loadData()
|
||||
|
||||
// UI
|
||||
ui->maximumRecentFileCountEdit->setValue(m_otherSettings.maximumRecentFileCount);
|
||||
ui->magnifierSizeEdit->setValue(m_settings.m_magnifierSize);
|
||||
ui->magnifierZoomEdit->setValue(m_settings.m_magnifierZoom);
|
||||
|
||||
// CMS
|
||||
ui->cmsTypeComboBox->setCurrentIndex(ui->cmsTypeComboBox->findData(int(m_cmsSettings.system)));
|
||||
@@ -472,6 +474,14 @@ void PDFViewerSettingsDialog::saveData()
|
||||
{
|
||||
m_settings.m_speechVolume = ui->speechVolumeEdit->value();
|
||||
}
|
||||
else if (sender == ui->magnifierSizeEdit)
|
||||
{
|
||||
m_settings.m_magnifierSize = ui->magnifierSizeEdit->value();
|
||||
}
|
||||
else if (sender == ui->magnifierZoomEdit)
|
||||
{
|
||||
m_settings.m_magnifierZoom = ui->magnifierZoomEdit->value();
|
||||
}
|
||||
|
||||
const bool loadData = !qobject_cast<const QDoubleSpinBox*>(sender) && !qobject_cast<const QSpinBox*>(sender);
|
||||
if (loadData)
|
||||
|
@@ -26,7 +26,7 @@
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>8</number>
|
||||
<number>7</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="enginePage">
|
||||
<layout class="QVBoxLayout" name="enginePageLayout">
|
||||
@@ -847,6 +847,13 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="uiGroupBoxLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="magnifierSizeLabel">
|
||||
<property name="text">
|
||||
<string>Magnifier size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="maximumRecentFileCountLabel">
|
||||
<property name="text">
|
||||
@@ -857,12 +864,42 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="maximumRecentFileCountEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="magnifierZoomLabel">
|
||||
<property name="text">
|
||||
<string>Magnifier zoom</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="magnifierSizeEdit">
|
||||
<property name="suffix">
|
||||
<string>px</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="magnifierZoomEdit">
|
||||
<property name="minimum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="uiInfoLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Maximum count of recent files controls, how much of recent files will be displayed in menu. When document is opened, then document is addet to the top of recent file list, and recent file list is truncated from bottom, if number of recent files is greater, than maximum.</p></body></html></string>
|
||||
<string><html><head/><body><p>Maximum count of recent files controls, how much of recent files will be displayed in menu. When document is opened, then document is addet to the top of recent file list, and recent file list is truncated from bottom, if number of recent files is greater, than maximum.</p><p><span style=" font-weight:600;">Magnifier tool settings </span>set the appearance of the magnifier. Magnifier tool magnifies area under the mouse cursor. You can specify how big the magnifier will be (in pixels) and how much it will zoom.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
109
PdfForQtViewer/resources/magnifier.svg
Normal file
109
PdfForQtViewer/resources/magnifier.svg
Normal file
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="30mm"
|
||||
height="30mm"
|
||||
viewBox="0 0 30 30"
|
||||
version="1.1"
|
||||
id="svg5291"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
|
||||
sodipodi:docname="magnifier.svg">
|
||||
<defs
|
||||
id="defs5285">
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 15 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="30 : 15 : 1"
|
||||
inkscape:persp3d-origin="15 : 10 : 1"
|
||||
id="perspective5921" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="11.313708"
|
||||
inkscape:cx="96.866908"
|
||||
inkscape:cy="75.073314"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="3840"
|
||||
inkscape:window-height="2035"
|
||||
inkscape:window-x="-13"
|
||||
inkscape:window-y="-13"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata5288">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Jakub Melka</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Vrstva 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-267)">
|
||||
<flowRoot
|
||||
xml:space="preserve"
|
||||
id="flowRoot5913"
|
||||
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"><flowRegion
|
||||
id="flowRegion5915"><rect
|
||||
id="rect5917"
|
||||
width="129.22377"
|
||||
height="91.747108"
|
||||
x="-13.788582"
|
||||
y="-33.515606" /></flowRegion><flowPara
|
||||
id="flowPara5919" /></flowRoot> <ellipse
|
||||
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path5985"
|
||||
cx="10.996745"
|
||||
cy="278.08231"
|
||||
rx="6.4988279"
|
||||
ry="6.4161458" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 15.64349,283.14245 6.482291,7.27604"
|
||||
id="path5987"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.7 KiB |
Reference in New Issue
Block a user