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[]);
57 /// Try to exit LyX properly.
58 /// \p exit_code is 0 by default, if a non zero value is passed,
59 /// emergencyCleanup() will be called before exiting.
60 void exit(int exit_code = 0) const;
63 static LyX const & cref();
65 /// in the case of failure
66 void emergencyCleanup() const;
69 BufferList & bufferList();
70 BufferList const & bufferList() const;
73 Session const & session() const;
76 LyXFunc const & lyxFunc() const;
79 Server const & server() const;
81 ServerSocket & socket();
82 ServerSocket const & socket() const;
85 frontend::Application & application();
86 frontend::Application const & application() const;
89 KeyMap & topLevelKeymap();
90 KeyMap const & topLevelKeymap() const;
93 CmdDef & topLevelCmdDef();
96 Converters & converters();
97 Converters & systemConverters();
100 Messages & getMessages(std::string const & language);
102 Messages & getGuiMessages();
104 void setGuiLanguage(std::string const & language);
107 frontend::LyXView * newLyXView();
109 /// Execute batch commands if available.
110 void execBatchCommands();
113 void addFileToLoad(support::FileName const &);
118 void operator=(LyX const &);
120 /// Do some cleanup in preparation of an exit.
123 /// Early exit during the initialisation process.
124 void earlyExit(int status);
126 /// Initialise LyX and fills-in the vector of files to be loaded.
128 \return exit code failure if any.
130 int init(int & argc, char * argv[]);
132 /// Load files passed at command-line.
134 This method is used only in non-GUI mode.
138 /// Create a View, load files and restore GUI Session.
139 void restoreGuiSession();
141 /// initial LyX set up
143 /// set up the default dead key bindings if requested
144 void deadKeyBindings(KeyMap * kbmap);
145 /** Check for the existence of the user's support directory and,
146 * if not present, create it. Exits the program if the directory
148 * \returns true if the user-side configuration script
149 * (lib/configure) should be re-run in this directory.
151 bool queryUserLyXDir(bool explicit_userdir);
152 /// read lyxrc/preferences
153 bool readRcFile(std::string const & name);
154 /// read the given ui (menu/toolbar) file
155 bool readUIFile(std::string const & name, bool include = false);
156 /// read the given languages file
157 bool readLanguagesFile(std::string const & name);
158 /// read the encodings.
159 /// \param enc_name encodings definition file
160 /// \param symbols_name unicode->LaTeX mapping file
161 bool readEncodingsFile(std::string const & enc_name,
162 std::string const & symbols_name);
163 /// parsing of non-gui LyX options.
164 void easyParse(int & argc, char * argv[]);
165 /// shows up a parsing error on screen
166 void printError(ErrorItem const &);
168 /// Use the Pimpl idiom to hide the internals.
169 // Mostly used for singletons.
173 /// has this user started lyx for the first time?
176 friend Movers & theMovers();
177 friend Mover const & getMover(std::string const & fmt);
178 friend void setMover(std::string const & fmt, std::string const & command);
179 friend Movers & theSystemMovers();
180 friend frontend::Application * theApp();