#include <config.h>
-#include <fstream>
-#include <algorithm>
-#include <utility>
-#include <iostream>
-
#include "lyx_cb.h"
#include "lyx_main.h"
#include "buffer.h"
#include "LyXView.h"
#include "lyxrc.h"
#include "lyxtext.h"
+#include "gettext.h"
+#include "BufferView.h"
+#include "lyxtextclasslist.h"
+
+#include "insets/insetlabel.h"
+
#include "frontends/Alert.h"
#include "frontends/FileDialog.h"
#include "frontends/GUIRunTime.h"
-#include "insets/insetlabel.h"
+
#include "support/FileInfo.h"
#include "support/filetools.h"
#include "support/path.h"
#include "support/syscall.h"
#include "support/lstrings.h"
-#include "gettext.h"
-#include "BufferView.h"
+
+#include <fstream>
+#include <algorithm>
+#include <utility>
+#include <iostream>
using std::vector;
using std::ifstream;
string const & msg2,
string const & msg3)
{
- if (lyxrc.use_gui) {
- string const str = msg1 + ' ' + msg2 + ' ' + msg3;
- buf->getUser()->owner()->message(str);
+ if (lyxrc.use_gui
+ && buf && buf->getUser() && buf->getUser()->owner()) {
+ string const str = msg1 + ' ' + msg2 + ' ' + msg3;
+ buf->getUser()->owner()->message(str);
} else
lyxerr << msg1 << msg2 << msg3 << endl;
}
XFlush(GUIRunTime::x11Display());
if (!buffer->save()) {
- string const fname = buffer->fileName();
- string const s = MakeAbsPath(fname);
if (Alert::askQuestion(_("Save failed. Rename and try again?"),
- MakeDisplayPath(s, 50),
+ MakeDisplayPath(buffer->fileName(), 50),
_("(If not, document is not saved.)"))) {
return WriteAs(bv, buffer);
}
bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename)
{
string fname = buffer->fileName();
- string oldname = fname;
+ string const oldname = fname;
if (filename.empty()) {
FileDialog fileDlg(bv->owner(),
_("Choose a filename to save document as"),
LFUN_WRITEAS,
- make_pair(string(_("Documents")),
+ make_pair(string(_("Documents|#o#O")),
string(lyxrc.document_path)),
- make_pair(string(_("Templates")),
+ make_pair(string(_("Templates|#T#t")),
string(lyxrc.template_path)));
if (!IsLyXFilename(fname))
bv->owner()->message(_("Autosaving current document..."));
// create autosave filename
- string fname = OnlyPath(bv->buffer()->fileName());
+ string fname = bv->buffer()->filePath();
fname += "#";
fname += OnlyFilename(bv->buffer()->fileName());
fname += "#";
FileDialog fileDlg(bv->owner(), _("Select file to insert"),
(asParagraph) ? LFUN_FILE_INSERT_ASCII_PARA : LFUN_FILE_INSERT_ASCII);
- FileDialog::Result result = fileDlg.Select(bv->owner()->buffer()->filepath);
+ FileDialog::Result result = fileDlg.Select(bv->owner()->buffer()->filePath());
if (result.first == FileDialog::Later)
return;
string label(arg);
bv->owner()->prohibitInput();
if (label.empty()) {
- Paragraph * par = bv->text->cursor.par();
+ Paragraph * par = bv->getLyXText()->cursor.par();
LyXLayout const * layout =
&textclasslist.Style(bv->buffer()->params.textclass,
par->getLayout());