Commit 6fd94bf9 authored by Aleks Kissinger's avatar Aleks Kissinger

add a blank node when previewing empty graph

parent 6cc196ea
......@@ -148,6 +148,11 @@ QString TikzDocument::fileName() const
return _fileName;
}
bool TikzDocument::isEmpty()
{
return _graph->nodes().isEmpty();
}
void TikzDocument::addToRecentFiles()
{
QSettings settings("tikzit", "tikzit");
......
......@@ -54,6 +54,8 @@ public:
QString fileName() const;
bool isEmpty();
private:
Graph *_graph;
QString _tikz;
......
......@@ -38,7 +38,7 @@ LatexProcess::LatexProcess(PreviewWindow *preview, QObject *parent) : QObject(pa
connect(_proc, SIGNAL(finished(int)), this, SLOT(finished(int)));
// for debug purposes
_workingDir.setAutoRemove(false);
//_workingDir.setAutoRemove(false);
}
void LatexProcess::makePreview(QString tikz)
......@@ -76,6 +76,10 @@ void LatexProcess::makePreview(QString tikz)
// common windows tex directories
texDirs << "C:\\Program Files\\MiKTeX 2.9\\miktex\\bin";
texDirs << "C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64";
texDirs << "C:\\Program Files\\MiKTeX 2.8\\miktex\\bin";
texDirs << "C:\\Program Files\\MiKTeX 2.8\\miktex\\bin\\x64";
texDirs << "C:\\Program Files\\MiKTeX 2.7\\miktex\\bin";
texDirs << "C:\\Program Files\\MiKTeX 2.7\\miktex\\bin\\x64";
_output->appendPlainText(texDirs.join(":"));
pdflatex = QStandardPaths::findExecutable("pdflatex", texDirs);
......
......@@ -429,7 +429,14 @@ void Tikzit::makePreview()
}
connect(_latex, SIGNAL(previewFinished()), this, SLOT(cleanupLatex()));
_latex->makePreview(activeWindow()->tikzSource());
if (activeWindow()->tikzDocument()->isEmpty()) {
_latex->makePreview("\\begin{tikzpicture}\n"
" \\node [style=none] (0) at (0,0) {};\n"
"\\end{tikzpicture}\n");
} else {
_latex->makePreview(activeWindow()->tikzSource());
}
_preview->show();
}
}
......
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