mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
last commit was incomplete... not sure how I managed this..
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20710 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
616d9ed9f2
commit
58ab972f71
@ -18,7 +18,6 @@
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
#include "Session.h"
|
||||
#include "callback.h"
|
||||
#include "LyX.h"
|
||||
#include "output_latex.h"
|
||||
#include "ParagraphList.h"
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "buffer_funcs.h"
|
||||
#include "BufferList.h"
|
||||
#include "BufferParams.h"
|
||||
#include "callback.h" // added for Dispatch functions
|
||||
#include "CoordCache.h"
|
||||
#include "CutAndPaste.h"
|
||||
#include "debug.h"
|
||||
@ -72,17 +71,23 @@
|
||||
#include "support/filetools.h"
|
||||
#include "support/Package.h"
|
||||
#include "support/types.h"
|
||||
#include "support/fs_extras.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
#include <cerrno>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
using std::distance;
|
||||
using std::endl;
|
||||
using std::ifstream;
|
||||
using std::istringstream;
|
||||
using std::istream_iterator;
|
||||
using std::make_pair;
|
||||
using std::min;
|
||||
using std::max;
|
||||
@ -90,6 +95,7 @@ using std::mem_fun_ref;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -101,6 +107,7 @@ using support::fileSearch;
|
||||
using support::isDirWriteable;
|
||||
using support::isFileReadable;
|
||||
using support::makeDisplayPath;
|
||||
using support::makeAbsPath;
|
||||
using support::package;
|
||||
|
||||
namespace Alert = frontend::Alert;
|
||||
@ -894,12 +901,12 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
|
||||
|
||||
case LFUN_FILE_INSERT_PLAINTEXT_PARA:
|
||||
// FIXME UNICODE
|
||||
insertPlaintextFile(this, to_utf8(cmd.argument()), true);
|
||||
insertPlaintextFile(to_utf8(cmd.argument()), true);
|
||||
break;
|
||||
|
||||
case LFUN_FILE_INSERT_PLAINTEXT:
|
||||
// FIXME UNICODE
|
||||
insertPlaintextFile(this, to_utf8(cmd.argument()), false);
|
||||
insertPlaintextFile(to_utf8(cmd.argument()), false);
|
||||
break;
|
||||
|
||||
case LFUN_FONT_STATE:
|
||||
@ -2019,7 +2026,8 @@ void BufferView::setGuiDelegate(frontend::GuiBufferViewDelegate * gui)
|
||||
}
|
||||
|
||||
|
||||
static docstring contentsOfPlaintextFile(BufferView * bv, string const & f,
|
||||
// FIXME: Move this out of BufferView again
|
||||
docstring BufferView::contentsOfPlaintextFile(string const & f,
|
||||
bool asParagraph)
|
||||
{
|
||||
FileName fname(f);
|
||||
@ -2031,7 +2039,7 @@ static docstring contentsOfPlaintextFile(BufferView * bv, string const & f,
|
||||
: LFUN_FILE_INSERT_PLAINTEXT) );
|
||||
|
||||
FileDialog::Result result =
|
||||
fileDlg.open(from_utf8(bv->buffer().filePath()),
|
||||
fileDlg.open(from_utf8(buffer().filePath()),
|
||||
FileFilterList(), docstring());
|
||||
|
||||
if (result.first == FileDialog::Later)
|
||||
@ -2064,7 +2072,7 @@ static docstring contentsOfPlaintextFile(BufferView * bv, string const & f,
|
||||
return docstring();
|
||||
}
|
||||
|
||||
ifs.unsetf(ios::skipws);
|
||||
ifs.unsetf(std::ios::skipws);
|
||||
istream_iterator<char> ii(ifs);
|
||||
istream_iterator<char> end;
|
||||
#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
|
||||
@ -2096,11 +2104,10 @@ static docstring contentsOfPlaintextFile(BufferView * bv, string const & f,
|
||||
return normalize_c(file_content);
|
||||
}
|
||||
|
||||
// Insert plain text file (if filename is empty, prompt for one)
|
||||
|
||||
void BufferView::insertPlaintextFile(string const & f, bool asParagraph)
|
||||
{
|
||||
docstring const tmpstr =
|
||||
contentsOfPlaintextFile(this, f, asParagraph);
|
||||
docstring const tmpstr = contentsOfPlaintextFile(f, asParagraph);
|
||||
|
||||
if (tmpstr.empty())
|
||||
return;
|
||||
|
@ -256,6 +256,8 @@ public:
|
||||
///
|
||||
void setGuiDelegate(frontend::GuiBufferViewDelegate *);
|
||||
|
||||
///
|
||||
docstring contentsOfPlaintextFile(std::string const & f, bool asParagraph);
|
||||
// Insert plain text file (if filename is empty, prompt for one)
|
||||
void insertPlaintextFile(std::string const & fileName, bool asParagraph);
|
||||
private:
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Format.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "callback.h"
|
||||
|
||||
#include "support/filetools.h"
|
||||
|
||||
@ -96,7 +95,7 @@ bool Importer::Import(LyXView * lv, FileName const & filename,
|
||||
string filename2 = (loader_format == format) ? filename.absFilename()
|
||||
: changeExtension(filename.absFilename(),
|
||||
formats.extension(loader_format));
|
||||
insertPlaintextFile(lv->view(), filename2, as_paragraphs);
|
||||
lv->view()->insertPlaintextFile(filename2, as_paragraphs);
|
||||
lv->dispatch(FuncRequest(LFUN_MARK_OFF));
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "Language.h"
|
||||
#include "Session.h"
|
||||
#include "Color.h"
|
||||
#include "callback.h"
|
||||
#include "LyXAction.h"
|
||||
#include "LyXFunc.h"
|
||||
#include "Lexer.h"
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "BufferList.h"
|
||||
#include "BufferParams.h"
|
||||
#include "BufferView.h"
|
||||
#include "callback.h"
|
||||
#include "Color.h"
|
||||
#include "Cursor.h"
|
||||
#include "CutAndPaste.h"
|
||||
@ -145,6 +144,7 @@ using support::prefixIs;
|
||||
|
||||
namespace Alert = frontend::Alert;
|
||||
|
||||
extern bool quitting;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -14,8 +14,6 @@
|
||||
|
||||
#include "Dialogs.h"
|
||||
|
||||
#include "callback.h"
|
||||
|
||||
#include "controllers/Dialog.h"
|
||||
|
||||
#include <boost/signal.hpp>
|
||||
@ -25,6 +23,8 @@ using std::string;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
extern bool quitting;
|
||||
|
||||
namespace frontend {
|
||||
|
||||
Dialogs::Dialogs(LyXView & lyxview)
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "BufferList.h"
|
||||
#include "BufferParams.h"
|
||||
#include "BufferView.h"
|
||||
#include "callback.h"
|
||||
#include "Cursor.h"
|
||||
#include "debug.h"
|
||||
#include "ErrorList.h"
|
||||
|
@ -3369,7 +3369,7 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
case LFUN_FILE_INSERT_PLAINTEXT_PARA:
|
||||
case LFUN_FILE_INSERT_PLAINTEXT: {
|
||||
// FIXME UNICODE
|
||||
docstring const tmpstr = getContentsOfPlaintextFile(&cur.bv(), to_utf8(cmd.argument()), false);
|
||||
docstring const tmpstr = cur.bv().contentsOfPlaintextFile(to_utf8(cmd.argument()), false);
|
||||
if (!tmpstr.empty() && !insertPlaintextString(cur.bv(), tmpstr, false))
|
||||
cur.undispatched();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user