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"
56 int exec(int & argc, char * argv[]);
58 /// Try to exit LyX properly.
59 /// \p exit_code is 0 by default, if a non zero value is passed,
60 /// emergencyCleanup() will be called before exiting.
61 void exit(int exit_code = 0) const;
64 static LyX const & cref();
66 /// in the case of failure
67 void emergencyCleanup() const;
70 BufferList & bufferList();
71 BufferList const & bufferList() const;
74 Session const & session() const;
77 LyXFunc const & lyxFunc() const;
80 Server const & server() const;
82 ServerSocket & socket();
83 ServerSocket const & socket() const;
86 frontend::Application & application();
87 frontend::Application const & application() const;
90 KeyMap & topLevelKeymap();
91 KeyMap const & topLevelKeymap() const;
94 CmdDef & topLevelCmdDef();
97 Converters & converters();
98 Converters & systemConverters();
101 Messages & getMessages(std::string const & language);
103 Messages & getGuiMessages();
105 void setGuiLanguage(std::string const & language);
108 frontend::LyXView * newLyXView();
110 /// Execute batch commands if available.
111 void execBatchCommands();
114 void addFileToLoad(std::string const &);
119 void operator=(LyX const &);
121 /// Do some cleanup in preparation of an exit.
124 /// Early exit during the initialisation process.
125 void earlyExit(int status);
127 /// Initialise LyX and fills-in the vector of files to be loaded.
129 \return exit code failure if any.
131 int init(int & argc, char * argv[]);
133 /// Load files passed at command-line.
135 This method is used only in non-GUI mode.
139 /// initial LyX set up
141 /// set up the default dead key bindings if requested
142 void deadKeyBindings(KeyMap * kbmap);
143 /** Check for the existence of the user's support directory and,
144 * if not present, create it. Exits the program if the directory
146 * \returns true if the user-side configuration script
147 * (lib/configure) should be re-run in this directory.
149 bool queryUserLyXDir(bool explicit_userdir);
150 /// read lyxrc/preferences
151 bool readRcFile(std::string const & name);
152 /// read the given ui (menu/toolbar) file
153 bool readUIFile(std::string const & name, bool include = false);
154 /// read the given languages file
155 bool readLanguagesFile(std::string const & name);
156 /// read the encodings.
157 /// \param enc_name encodings definition file
158 /// \param symbols_name unicode->LaTeX mapping file
159 bool readEncodingsFile(std::string const & enc_name,
160 std::string const & symbols_name);
161 /// parsing of non-gui LyX options.
162 void easyParse(int & argc, char * argv[]);
163 /// shows up a parsing error on screen
164 void printError(ErrorItem const &);
166 /// Use the Pimpl idiom to hide the internals.
167 // Mostly used for singletons.
171 /// has this user started lyx for the first time?
174 friend Movers & theMovers();
175 friend Mover const & getMover(std::string const & fmt);
176 friend void setMover(std::string const & fmt, std::string const & command);
177 friend Movers & theSystemMovers();
178 friend frontend::Application * theApp();