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"
49 int exec(int & argc, char * argv[]);
51 /// Try to exit LyX properly.
52 /// \p exit_code is 0 by default, if a non zero value is passed,
53 /// emergencyCleanup() will be called before exiting.
54 void exit(int exit_code = 0) const;
57 static LyX const & cref();
59 /// in the case of failure
60 void emergencyCleanup() const;
63 BufferList & bufferList();
64 BufferList const & bufferList() const;
67 Session const & session() const;
70 LyXFunc const & lyxFunc() const;
73 Server const & server() const;
75 ServerSocket & socket();
76 ServerSocket const & socket() const;
79 frontend::Application & application();
80 frontend::Application const & application() const;
83 CmdDef & topLevelCmdDef();
86 Converters & converters();
87 Converters & systemConverters();
90 Messages & getMessages(std::string const & language);
92 Messages & getGuiMessages();
94 void setGuiLanguage(std::string const & language);
97 frontend::LyXView * newLyXView();
99 /// Execute batch commands if available.
100 void execBatchCommands();
103 void addFileToLoad(std::string const &);
108 void operator=(LyX const &);
110 /// Do some cleanup in preparation of an exit.
113 /// Early exit during the initialisation process.
114 void earlyExit(int status);
116 /// Initialise LyX and fills-in the vector of files to be loaded.
118 \return exit code failure if any.
120 int init(int & argc, char * argv[]);
122 /// Load files passed at command-line.
124 This method is used only in non-GUI mode.
128 /// initial LyX set up
130 /** Check for the existence of the user's support directory and,
131 * if not present, create it. Exits the program if the directory
133 * \returns true if the user-side configuration script
134 * (lib/configure) should be re-run in this directory.
136 bool queryUserLyXDir(bool explicit_userdir);
137 /// read lyxrc/preferences
138 bool readRcFile(std::string const & name);
139 /// read the given languages file
140 bool readLanguagesFile(std::string const & name);
141 /// read the encodings.
142 /// \param enc_name encodings definition file
143 /// \param symbols_name unicode->LaTeX mapping file
144 bool readEncodingsFile(std::string const & enc_name,
145 std::string const & symbols_name);
146 /// parsing of non-gui LyX options.
147 void easyParse(int & argc, char * argv[]);
148 /// shows up a parsing error on screen
149 void printError(ErrorItem const &);
151 /// Use the Pimpl idiom to hide the internals.
152 // Mostly used for singletons.
156 /// has this user started lyx for the first time?
159 friend Movers & theMovers();
160 friend Mover const & getMover(std::string const & fmt);
161 friend void setMover(std::string const & fmt, std::string const & command);
162 friend Movers & theSystemMovers();
163 friend frontend::Application * theApp();
164 friend KeyMap & theTopLevelKeymap();