#include "support/Messages.h"
#include "support/os.h"
#include "support/Package.h"
-
-#include "support/bind.h"
-#include <boost/scoped_ptr.hpp>
+#include "support/unique_ptr.h"
#include <algorithm>
-#include <iostream>
#include <csignal>
+#include <iostream>
+#include <functional>
#include <map>
#include <stdlib.h>
#include <string>
bool use_gui = true;
+// Report on the terminal about spawned commands. The default is false
+// and can be changed with the option -v (--verbose).
+
+bool verbose = false;
+
+
// We default to open documents in an already running instance, provided that
// the lyxpipe has been setup. This can be overridden either on the command
// line or through preference settings.
///
CmdDef toplevel_cmddef_;
///
- boost::scoped_ptr<Server> lyx_server_;
+ unique_ptr<Server> lyx_server_;
///
- boost::scoped_ptr<ServerSocket> lyx_socket_;
+ unique_ptr<ServerSocket> lyx_socket_;
///
- boost::scoped_ptr<frontend::Application> application_;
+ unique_ptr<frontend::Application> application_;
/// lyx session, containing lastfiles, lastfilepos, and lastopened
- boost::scoped_ptr<Session> session_;
+ unique_ptr<Session> session_;
/// Files to load at start.
vector<string> files_to_load_;
Buffer * buf = pimpl_->buffer_list_.newBuffer(fname.absFileName());
LYXERR(Debug::FILES, "Loading " << fname);
- if (buf->loadLyXFile() == Buffer::ReadSuccess) {
+ if (buf && buf->loadLyXFile() == Buffer::ReadSuccess) {
ErrorList const & el = buf->errorList("Parse");
- if (!el.empty())
- for_each(el.begin(), el.end(),
- bind(&LyX::printError, this, _1));
+ for(ErrorItem const & e : el)
+ printError(e);
command_line_buffers.push_back(buf);
} else {
- pimpl_->buffer_list_.release(buf);
+ if (buf)
+ pimpl_->buffer_list_.release(buf);
docstring const error_message =
bformat(_("LyX failed to load the following file: %1$s"),
from_utf8(fname.absFileName()));
namespace {
/// return the the number of arguments consumed
-typedef boost::function<int(string const &, string const &, string &)> cmd_helper;
+typedef function<int(string const &, string const &, string &)> cmd_helper;
int parse_dbg(string const & arg, string const &, string &)
{
"\t-r [--remote]\n"
" open documents in an already running instance\n"
" (a working lyxpipe is needed)\n"
+ "\t-v [--verbose]\n"
+ " report on terminal about spawned commands.\n"
"\t-batch execute commands without launching GUI and exit.\n"
"\t-version summarize version and build info\n"
"Check the LyX man page for more details.")) << endl;
}
+int parse_verbose(string const &, string const &, string &)
+{
+ verbose = true;
+ return 0;
+}
+
+
int parse_force(string const & arg, string const &, string &)
{
if (arg == "all") {
cmdmap["--no-remote"] = parse_noremote;
cmdmap["-r"] = parse_remote;
cmdmap["--remote"] = parse_remote;
+ cmdmap["-v"] = parse_verbose;
+ cmdmap["--verbose"] = parse_verbose;
for (int i = 1; i < argc; ++i) {
map<string, cmd_helper>::const_iterator it
// FIXME: this should not be use_gui dependent
LWARNIF(use_gui);
LAPPERR(singleton_);
- return *singleton_->pimpl_->lyx_server_.get();
+ return *singleton_->pimpl_->lyx_server_;
}
// FIXME: this should not be use_gui dependent
LWARNIF(use_gui);
LAPPERR(singleton_);
- return *singleton_->pimpl_->lyx_socket_.get();
+ return *singleton_->pimpl_->lyx_socket_;
}