r22161 by jghali -
scribus-commit
scribus-commit at lists.scribus.net
Thu Sep 21 20:56:21 UTC 2017
Author: jghali
Date: Thu Sep 21 20:56:21 2017
New Revision: 22161
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22161
Log:
fix several update issues when modifying DPI setting in render frame source editor
Modified:
trunk/Scribus/scribus/pageitem_latexframe.cpp
trunk/Scribus/scribus/pageitem_latexframe.h
trunk/Scribus/scribus/ui/latexeditor.cpp
trunk/Scribus/scribus/ui/latexeditor.h
Modified: trunk/Scribus/scribus/pageitem_latexframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22161&path=/trunk/Scribus/scribus/pageitem_latexframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_latexframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_latexframe.cpp Thu Sep 21 20:56:21 2017
@@ -26,6 +26,7 @@
#include <QDebug>
#include <QFontInfo>
#include <QMessageBox>
+#include <QSignalBlocker>
#include <QTemporaryFile>
#include "prefsmanager.h"
@@ -70,6 +71,7 @@
Q_ASSERT(!tempFileBase.isEmpty());
m_lastWidth = m_lastHeight = 0;
+ m_lastDpi = realDpi();
m_dpi = 0;
}
@@ -154,6 +156,7 @@
void PageItem_LatexFrame::updateImage(int exitCode, QProcess::ExitStatus exitStatus)
{
appStdout = latex->readAllStandardOutput();
+ invalid = false;
m_err = exitCode;
emit latexFinished();
@@ -215,12 +218,13 @@
{
pixm.imgInfo.xres = pixm.imgInfo.yres = realDpi();
}
+ m_lastDpi = realDpi();
//Restore parameters, account for dpi changes
m_imageXScale = scaleX / pixm.imgInfo.xres;
m_imageYScale = scaleY / pixm.imgInfo.yres;
- m_imageXOffset = offX * pixm.imgInfo.xres;
- m_imageYOffset = offY * pixm.imgInfo.yres;
+ m_imageXOffset = offX * pixm.imgInfo.xres;
+ m_imageYOffset = offY * pixm.imgInfo.yres;
//emit imageOffsetScale(LocalScX, LocalScY, LocalX, LocalY);
update();
}
@@ -323,18 +327,22 @@
void PageItem_LatexFrame::rerunApplication(bool updateDisplay)
{
- if (latex->state() != QProcess::NotRunning) {
+ if (latex->state() != QProcess::NotRunning)
+ {
+ QSignalBlocker sigBloker(latex);
m_killed = true;
latex->terminate();
latex->waitForFinished(500);
- if (latex->state() != QProcess::NotRunning) {
+ if (latex->state() != QProcess::NotRunning)
+ {
//Still not terminated?
latex->kill();
latex->waitForFinished(500);
}
}
runApplication();
- if (updateDisplay) this->update();
+ if (updateDisplay)
+ this->update();
}
@@ -342,13 +350,13 @@
{
QString tmp(formulaText);
double scaleX, scaleY, realW, realH, offsetX, offsetY;
- double lDpi = realDpi()/72.0;
- scaleX = m_imageXScale*lDpi;
- scaleY = m_imageYScale*lDpi;
- offsetX = m_imageXOffset*m_imageXScale;
- offsetY = m_imageYOffset*m_imageYScale;
- realW = m_width/scaleX - m_imageXOffset/lDpi;
- realH = m_height/scaleY - m_imageYOffset/lDpi;
+ double lDpi = realDpi() / 72.0;
+ scaleX = m_imageXScale * lDpi;
+ scaleY = m_imageYScale * lDpi;
+ offsetX = m_imageXOffset * m_imageXScale;
+ offsetY = m_imageYOffset * m_imageYScale;
+ realW = m_width - m_imageXOffset / lDpi;
+ realH = m_height - m_imageYOffset / lDpi;
if (!tmp.contains("$scribus_noprepost$") && m_usePreamble) {
tmp = config->preamble() + tmp + config->postamble();
}
@@ -542,9 +550,11 @@
if (!invalid) return;
invalid = false;
- if (m_width == m_lastWidth && m_height == m_lastHeight) return;
+ if (m_width == m_lastWidth && m_height == m_lastHeight && m_lastDpi == realDpi())
+ return;
m_lastWidth = m_width;
m_lastHeight = m_height;
+ m_lastDpi = realDpi();
rerunApplication(false);
}
Modified: trunk/Scribus/scribus/pageitem_latexframe.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22161&path=/trunk/Scribus/scribus/pageitem_latexframe.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_latexframe.h (original)
+++ trunk/Scribus/scribus/pageitem_latexframe.h Thu Sep 21 20:56:21 2017
@@ -93,7 +93,7 @@
QMap<QString,QString> editorProperties;
protected:
virtual void DrawObj_Item(ScPainter *p, QRectF e);
- double m_lastWidth, m_lastHeight;
+ double m_lastWidth, m_lastHeight, m_lastDpi;
QString formulaText;
Modified: trunk/Scribus/scribus/ui/latexeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22161&path=/trunk/Scribus/scribus/ui/latexeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/latexeditor.cpp (original)
+++ trunk/Scribus/scribus/ui/latexeditor.cpp Thu Sep 21 20:56:21 2017
@@ -62,6 +62,7 @@
connect(revertPushButton, SIGNAL(clicked(bool)), this, SLOT(revertClicked(bool)));
connect(killPushButton, SIGNAL(clicked(bool)), frame, SLOT(killProcess()));
connect(externalEditorPushButton, SIGNAL(clicked(bool)), this, SLOT(extEditorClicked()));
+ connect(dpiSpinBox, SIGNAL(editingFinished()), this, SLOT(dpiChanged()));
connect(frame, SIGNAL(formulaAutoUpdate(QString, QString)), this, SLOT(formulaChanged(QString, QString)));
connect(frame, SIGNAL(latexFinished()), this, SLOT(latexFinished()));
connect(frame, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(stateChanged(QProcess::ProcessState)));
@@ -307,6 +308,11 @@
frame->rerunApplication(true);
sourceTextEdit->setPlainText(frame->formula());
}
+}
+
+void LatexEditor::dpiChanged()
+{
+ apply();
}
void LatexEditor::formulaChanged(QString oldText, QString newText)
Modified: trunk/Scribus/scribus/ui/latexeditor.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22161&path=/trunk/Scribus/scribus/ui/latexeditor.h
==============================================================================
--- trunk/Scribus/scribus/ui/latexeditor.h (original)
+++ trunk/Scribus/scribus/ui/latexeditor.h Thu Sep 21 20:56:21 2017
@@ -76,6 +76,7 @@
void cancelClicked();
void updateClicked ( bool );
void revertClicked ( bool );
+ void dpiChanged();
void formulaChanged ( QString, QString );
void applicationChanged();
void latexFinished();
More information about the scribus-commit
mailing list