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.
123 /// return true on success false if we encounter an error
125 This method is used only in non-GUI mode.
129 /// initial LyX set up
131 /** Check for the existence of the user's support directory and,
132 * if not present, create it. Exits the program if the directory
134 * \returns true if the user-side configuration script
135 * (lib/configure) should be re-run in this directory.
137 bool queryUserLyXDir(bool explicit_userdir);
138 /// read lyxrc/preferences
139 bool readRcFile(std::string const & name);
140 /// read the given languages file
141 bool readLanguagesFile(std::string const & name);
142 /// read the encodings.
143 /// \param enc_name encodings definition file
144 /// \param symbols_name unicode->LaTeX mapping file
145 bool readEncodingsFile(std::string const & enc_name,
146 std::string const & symbols_name);
147 /// parsing of non-gui LyX options.
148 void easyParse(int & argc, char * argv[]);
149 /// shows up a parsing error on screen
150 void printError(ErrorItem const &);
152 /// Use the Pimpl idiom to hide the internals.
153 // Mostly used for singletons.
157 /// has this user started lyx for the first time?
160 friend Movers & theMovers();
161 friend Mover const & getMover(std::string const & fmt);
162 friend void setMover(std::string const & fmt, std::string const & command);
163 friend Movers & theSystemMovers();
164 friend frontend::Application * theApp();
165 friend KeyMap & theTopLevelKeymap();