#include "frontends/alert.h"
#include "frontends/Application.h"
-#include "frontends/Dialogs.h"
#include "frontends/Gui.h"
#include "frontends/LyXView.h"
/// The main application class private implementation.
-struct LyX::Singletons
+struct LyX::Impl
{
- Singletons()
+ Impl()
{
// Set the default User Interface language as soon as possible.
// The language used will be derived from the environment
///
Movers movers_;
-
///
Movers system_movers_;
+
+ /// has this user started lyx for the first time?
+ bool first_start;
+ /// the parsed command line batch command if any
+ std::string batch_command;
};
///
: first_start(false)
{
singleton_ = this;
- pimpl_ = new Singletons;
+ pimpl_ = new Impl;
}
{
if (quitting || !inset)
return 0;
-
- Buffer const * buffer_ptr = 0;
- vector<int> const & view_ids = pimpl_->application_->gui().viewIds();
- vector<int>::const_iterator it = view_ids.begin();
- vector<int>::const_iterator const end = view_ids.end();
- for (; it != end; ++it) {
- Buffer const * ptr =
- pimpl_->application_->gui().view(*it).updateInset(inset);
- if (ptr)
- buffer_ptr = ptr;
- }
- return buffer_ptr;
+ return application().gui().updateInset(inset);
}
{
if (quitting || !use_gui)
return;
-
- vector<int> const & view_ids = pimpl_->application_->gui().viewIds();
- vector<int>::const_iterator it = view_ids.begin();
- vector<int>::const_iterator const end = view_ids.end();
- for (; it != end; ++it)
- pimpl_->application_->gui().view(*it).getDialogs().
- hide(name, inset);
+ application().gui().hideDialogs(name, inset);
}
loadFiles();
- if (batch_command.empty() || pimpl_->buffer_list_.empty()) {
+ if (pimpl_->batch_command.empty() || pimpl_->buffer_list_.empty()) {
prepareExit();
return EXIT_SUCCESS;
}
if (buf != buf->masterBuffer())
continue;
bool success = false;
- buf->dispatch(batch_command, &success);
+ buf->dispatch(pimpl_->batch_command, &success);
final_success |= success;
}
prepareExit();
// do any other cleanup procedures now
if (package().temp_dir() != package().system_temp_dir()) {
- LYXERR(Debug::INFO) << "Deleting tmp dir "
- << package().temp_dir().absFilename() << endl;
+ LYXERR(Debug::INFO, "Deleting tmp dir "
+ << package().temp_dir().absFilename());
if (!package().temp_dir().destroyDirectory()) {
docstring const msg =
}
// Initialization of LyX (reads lyxrc and more)
- LYXERR(Debug::INIT) << "Initializing LyX::init..." << endl;
+ LYXERR(Debug::INIT, "Initializing LyX::init...");
bool success = init();
- LYXERR(Debug::INIT) << "Initializing LyX::init...done" << endl;
+ LYXERR(Debug::INIT, "Initializing LyX::init...done");
if (!success)
return EXIT_FAILURE;
}
// Execute batch commands if available
- if (batch_command.empty())
+ if (pimpl_->batch_command.empty())
return;
- LYXERR(Debug::INIT) << "About to handle -x '"
- << batch_command << '\'' << endl;
+ LYXERR(Debug::INIT, "About to handle -x '" << pimpl_->batch_command << '\'');
- pimpl_->lyxfunc_.dispatch(lyxaction.lookupFunc(batch_command));
+ pimpl_->lyxfunc_.dispatch(lyxaction.lookupFunc(pimpl_->batch_command));
}
return false;
// Load the layouts
- LYXERR(Debug::INIT) << "Reading layouts..." << endl;
+ LYXERR(Debug::INIT, "Reading layouts...");
if (!LyXSetStyle())
return false;
//...and the modules
return false;
}
- LYXERR(Debug::INIT) << "LyX tmp dir: `"
- << package().temp_dir().absFilename()
- << '\'' << endl;
+ LYXERR(Debug::INIT, "LyX tmp dir: `"
+ << package().temp_dir().absFilename() << '\'');
- LYXERR(Debug::INIT) << "Reading session information '.lyx/session'..." << endl;
+ LYXERR(Debug::INIT, "Reading session information '.lyx/session'...");
pimpl_->session_.reset(new Session(lyxrc.num_lastfiles));
// This must happen after package initialization and after lyxrc is
bool LyX::readRcFile(string const & name)
{
- LYXERR(Debug::INIT) << "About to read " << name << "... ";
+ LYXERR(Debug::INIT, "About to read " << name << "... ");
FileName const lyxrc_path = libFileSearch(string(), name);
if (!lyxrc_path.empty()) {
-
- LYXERR(Debug::INIT) << "Found in " << lyxrc_path << endl;
-
+ LYXERR(Debug::INIT, "Found in " << lyxrc_path);
if (lyxrc.read(lyxrc_path) < 0) {
showFileError(name);
return false;
}
- } else
- LYXERR(Debug::INIT) << "Not found." << lyxrc_path << endl;
+ } else {
+ LYXERR(Debug::INIT, "Not found." << lyxrc_path);
+ }
return true;
-
}
std::list<string>::const_iterator end = uifiles.end();
it = std::find(it, end, name);
if (it != end) {
- LYXERR(Debug::INIT) << "UI file '" << name
- << "' has been read already. "
- << "Is this an include loop?"
- << endl;
+ LYXERR(Debug::INIT, "UI file '" << name << "' has been read already. "
+ << "Is this an include loop?");
return false;
}
- LYXERR(Debug::INIT) << "About to read " << name << "..." << endl;
+ LYXERR(Debug::INIT, "About to read " << name << "...");
FileName ui_path;
ui_path = libFileSearch("ui", name, "ui");
if (ui_path.empty()) {
- LYXERR(Debug::INIT) << "Could not find " << name << endl;
+ LYXERR(Debug::INIT, "Could not find " << name);
showFileError(name);
return false;
}
uifiles.push_back(name);
- LYXERR(Debug::INIT) << "Found " << name
- << " in " << ui_path << endl;
+ LYXERR(Debug::INIT, "Found " << name << " in " << ui_path);
Lexer lex(uitags, ui_last - 1);
lex.setFile(ui_path);
if (!lex.isOK()) {
// Read the languages file `name'
bool LyX::readLanguagesFile(string const & name)
{
- LYXERR(Debug::INIT) << "About to read " << name << "..." << endl;
+ LYXERR(Debug::INIT, "About to read " << name << "...");
FileName const lang_path = libFileSearch(string(), name);
if (lang_path.empty()) {
bool LyX::readEncodingsFile(string const & enc_name,
string const & symbols_name)
{
- LYXERR(Debug::INIT) << "About to read " << enc_name << " and "
- << symbols_name << "..." << endl;
+ LYXERR(Debug::INIT, "About to read " << enc_name << " and "
+ << symbols_name << "...");
FileName const symbols_path = libFileSearch(string(), symbols_name);
if (symbols_path.empty()) {
" where command is a lyx command.\n"
"\t-e [--export] fmt\n"
" where fmt is the export format of choice.\n"
+ " Look on Tools->Preferences->File formats->Format\n"
+ " to get an idea which parameters should be passed.\n"
"\t-i [--import] fmt file.xxx\n"
" where fmt is the import format of choice\n"
" and file.xxx is the file to be imported.\n"
}
}
- batch_command = batch;
+ pimpl_->batch_command = batch;
}