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(std::string 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 /// initial LyX set up
140 /// set up the default dead key bindings if requested
141 void deadKeyBindings(KeyMap * kbmap);
142 /** Check for the existence of the user's support directory and,
143 * if not present, create it. Exits the program if the directory
145 * \returns true if the user-side configuration script
146 * (lib/configure) should be re-run in this directory.
148 bool queryUserLyXDir(bool explicit_userdir);
149 /// read lyxrc/preferences
150 bool readRcFile(std::string const & name);
151 /// read the given ui (menu/toolbar) file
152 bool readUIFile(std::string const & name, bool include = false);
153 /// read the given languages file
154 bool readLanguagesFile(std::string const & name);
155 /// read the encodings.
156 /// \param enc_name encodings definition file
157 /// \param symbols_name unicode->LaTeX mapping file
158 bool readEncodingsFile(std::string const & enc_name,
159 std::string const & symbols_name);
160 /// parsing of non-gui LyX options.
161 void easyParse(int & argc, char * argv[]);
162 /// shows up a parsing error on screen
163 void printError(ErrorItem const &);
165 /// Use the Pimpl idiom to hide the internals.
166 // Mostly used for singletons.
170 /// has this user started lyx for the first time?
173 friend Movers & theMovers();
174 friend Mover const & getMover(std::string const & fmt);
175 friend void setMover(std::string const & fmt, std::string const & command);
176 friend Movers & theSystemMovers();
177 friend frontend::Application * theApp();