Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 22160 → Rev 22161

/trunk/Scribus/scribus/pageitem_latexframe.cpp
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,11 → 327,14
 
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);
334,7 → 341,8
}
}
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);
}
/trunk/Scribus/scribus/pageitem_latexframe.h
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;
 
/trunk/Scribus/scribus/ui/latexeditor.cpp
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)));
309,6 → 310,11
}
}
 
void LatexEditor::dpiChanged()
{
apply();
}
 
void LatexEditor::formulaChanged(QString oldText, QString newText)
{
sourceTextEdit->setPlainText(newText);
/trunk/Scribus/scribus/ui/latexeditor.h
76,6 → 76,7
void cancelClicked();
void updateClicked ( bool );
void revertClicked ( bool );
void dpiChanged();
void formulaChanged ( QString, QString );
void applicationChanged();
void latexFinished();