#include "GuiMenubar.h"
#include "GuiToolbar.h"
#include "GuiToolbars.h"
+#include "GuiProgress.h"
#include "qt_helpers.h"
}
+static FileName selectTemplateFile()
+{
+ FileDialog dlg(_("Select template file"));
+ dlg.setButton1(_("Documents|#o#O"), from_utf8(lyxrc.document_path));
+ dlg.setButton1(_("Templates|#T#t"), from_utf8(lyxrc.template_path));
+
+ FileDialog::Result result =
+ dlg.open(from_utf8(lyxrc.template_path),
+ FileFilterList(_("LyX Documents (*.lyx)")),
+ docstring());
+
+ if (result.first == FileDialog::Later)
+ return FileName();
+ if (result.second.empty())
+ return FileName();
+ return FileName(to_utf8(result.second));
+}
+
+
+void GuiView::newDocument(string const & filename, bool from_template)
+{
+ FileName initpath(lyxrc.document_path);
+ Buffer * buf = buffer();
+ if (buf) {
+ FileName const trypath(buf->filePath());
+ // If directory is writeable, use this as default.
+ if (trypath.isDirWritable())
+ initpath = trypath;
+ }
+
+ string templatefile = from_template ?
+ selectTemplateFile().absFilename() : string();
+ Buffer * b;
+ if (filename.empty())
+ b = newUnnamedFile(templatefile, initpath);
+ else
+ b = newFile(filename, templatefile, true);
+
+ if (b)
+ setBuffer(b);
+}
+
+
void GuiView::insertLyXFile(docstring const & fname)
{
BufferView * bv = view();
"thesaurus",
#endif
-"texinfo", "toc", "href", "view-source", "vspace", "wrap", "listings" };
+"texinfo", "toc", "href", "view-source", "latex-progress", "vspace", "wrap", "listings" };
char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *));
for(; it != end; ++it) {
Dialog * dialog = it->second.get();
+ if (!dialog->isVisibleView())
+ continue;
if (switched && dialog->isBufferDependent()) {
- if (dialog->isVisibleView() && dialog->initialiseParams(""))
+ if (dialog->initialiseParams(""))
dialog->updateView();
else
dialog->hide();
Dialog * createGuiHyperlink(GuiView & lv);
Dialog * createGuiVSpace(GuiView & lv);
Dialog * createGuiViewSource(GuiView & lv);
+Dialog * createGuiProgress(GuiView & lv);
Dialog * createGuiWrap(GuiView & lv);
return createGuiLog(*this);
if (name == "view-source")
return createGuiViewSource(*this);
+ if (name == "latex-progress")
+ return createGuiProgress(*this);
if (name == "mathdelimiter")
return createGuiDelimiter(*this);
if (name == "mathmatrix")