4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
11 * Full author contact details are available in file CREDITS.
17 #include "support/strfwd.h"
55 int exec(int & argc, char * argv[]);
58 static LyX const & cref();
60 /// in the case of failure
61 void emergencyCleanup() const;
64 BufferList & bufferList();
65 BufferList const & bufferList() const;
68 Session const & session() const;
71 LyXFunc const & lyxFunc() const;
74 Server const & server() const;
76 ServerSocket & socket();
77 ServerSocket const & socket() const;
80 frontend::Application & application();
81 frontend::Application const & application() const;
84 KeyMap & topLevelKeymap();
85 KeyMap const & topLevelKeymap() const;
88 CmdDef & topLevelCmdDef();
91 Converters & converters();
92 Converters & systemConverters();
95 Messages & getMessages(std::string const & language);
97 Messages & getGuiMessages();
99 void setGuiLanguage(std::string const & language);
102 frontend::LyXView * newLyXView();
104 /// Execute batch commands if available.
105 void execBatchCommands();
108 void addFileToLoad(support::FileName const &);
113 void operator=(LyX const &);
115 /// Do some cleanup in preparation of an exit.
118 /// Early exit during the initialisation process.
119 void earlyExit(int status);
121 /// Initialise LyX and fills-in the vector of files to be loaded.
123 \return exit code failure if any.
125 int init(int & argc, char * argv[]);
127 /// Load files passed at command-line.
129 This method is used only in non-GUI mode.
133 /// Create a View, load files and restore GUI Session.
134 void restoreGuiSession();
136 /// initial LyX set up
138 /// set up the default dead key bindings if requested
139 void deadKeyBindings(KeyMap * kbmap);
140 /** Check for the existence of the user's support directory and,
141 * if not present, create it. Exits the program if the directory
143 * \returns true if the user-side configuration script
144 * (lib/configure) should be re-run in this directory.
146 bool queryUserLyXDir(bool explicit_userdir);
147 /// read lyxrc/preferences
148 bool readRcFile(std::string const & name);
149 /// read the given ui (menu/toolbar) file
150 bool readUIFile(std::string const & name, bool include = false);
151 /// read the given languages file
152 bool readLanguagesFile(std::string const & name);
153 /// read the encodings.
154 /// \param enc_name encodings definition file
155 /// \param symbols_name unicode->LaTeX mapping file
156 bool readEncodingsFile(std::string const & enc_name,
157 std::string const & symbols_name);
158 /// parsing of non-gui LyX options.
159 void easyParse(int & argc, char * argv[]);
160 /// shows up a parsing error on screen
161 void printError(ErrorItem const &);
163 /// Use the Pimpl idiom to hide the internals.
164 // Mostly used for singletons.
168 /// has this user started lyx for the first time?
171 friend Movers & theMovers();
172 friend Mover const & getMover(std::string const & fmt);
173 friend void setMover(std::string const & fmt, std::string const & command);
174 friend Movers & theSystemMovers();
175 friend frontend::Application * theApp();