#include "frontends/Alert.h"
#include "frontends/Application.h"
#include "frontends/FileDialog.h"
#include "frontends/Alert.h"
#include "frontends/Application.h"
#include "frontends/FileDialog.h"
#include "support/forkedcall.h"
#include "support/fs_extras.h"
#include "support/lyxlib.h"
#include "support/forkedcall.h"
#include "support/fs_extras.h"
#include "support/lyxlib.h"
using support::ForkedProcess;
using support::isLyXFilename;
using support::libFileSearch;
using support::ForkedProcess;
using support::isLyXFilename;
using support::libFileSearch;
docstring const file = makeDisplayPath(fname, 30);
docstring text = bformat(_("The document %1$s already exists.\n\n"
"Do you want to over-write that document?"), file);
docstring const file = makeDisplayPath(fname, 30);
docstring text = bformat(_("The document %1$s already exists.\n\n"
"Do you want to over-write that document?"), file);
: bv_(bv), fname_(fname) {}
///
virtual shared_ptr<ForkedProcess> clone() const
: bv_(bv), fname_(fname) {}
///
virtual shared_ptr<ForkedProcess> clone() const
-// Insert ascii file (if filename is empty, prompt for one)
-void insertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
+// Insert plain text file (if filename is empty, prompt for one)
+void insertPlaintextFile(BufferView * bv, string const & f, bool asParagraph)
- // clear the selection
- LyXText const & text = bv->buffer()->text();
- if (&text == bv->getLyXText())
- bv->cursor().clearSelection();
+ LCursor & cur = bv->cursor();
+ cap::replaceSelection(cur);
+ recordUndo(cur);
-// Insert ascii file (if filename is empty, prompt for one)
-string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagraph)
+// Read plain text file (if filename is empty, prompt for one)
+string getContentsOfPlaintextFile(BufferView * bv, string const & f, bool asParagraph)
FileDialog::Result result =
fileDlg.open(from_utf8(bv->buffer()->filePath()),
FileDialog::Result result =
fileDlg.open(from_utf8(bv->buffer()->filePath()),
docstring const text = bformat(_("Could not read the specified document\n"
"%1$s\ndue to the error: %2$s"), file, error);
Alert::error(_("Could not read file"), text);
return string();
}
docstring const text = bformat(_("Could not read the specified document\n"
"%1$s\ndue to the error: %2$s"), file, error);
Alert::error(_("Could not read file"), text);
return string();
}
docstring const text = bformat(_("Could not open the specified document\n"
"%1$s\ndue to the error: %2$s"), file, error);
Alert::error(_("Could not open file"), text);
docstring const text = bformat(_("Could not open the specified document\n"
"%1$s\ndue to the error: %2$s"), file, error);
Alert::error(_("Could not open file"), text);
// This function runs "configure" and then rereads lyx.defaults to
// reconfigure the automatic settings.
// This function runs "configure" and then rereads lyx.defaults to
// reconfigure the automatic settings.
lyxrc.read(libFileSearch(string(), "lyxrc.defaults"));
// Re-read packages.lst
LaTeXFeatures::getAvailable();
lyxrc.read(libFileSearch(string(), "lyxrc.defaults"));
// Re-read packages.lst
LaTeXFeatures::getAvailable();