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();
105 void operator=(LyX const &);
107 /// Do some cleanup in preparation of an exit.
110 /// Early exit during the initialisation process.
111 void earlyExit(int status);
113 /// Initialise LyX and fills-in the vector of files to be loaded.
115 \return exit code failure if any.
117 int init(int & argc, char * argv[]);
119 /// Load files passed at command-line.
120 /// return true on success false if we encounter an error
122 This method is used only in non-GUI mode.
126 /// initial LyX set up
128 /** Check for the existence of the user's support directory and,
129 * if not present, create it. Exits the program if the directory
131 * \returns true if the user-side configuration script
132 * (lib/configure) should be re-run in this directory.
134 bool queryUserLyXDir(bool explicit_userdir);
135 /// read lyxrc/preferences
136 bool readRcFile(std::string const & name);
137 /// read the given languages file
138 bool readLanguagesFile(std::string const & name);
139 /// read the encodings.
140 /// \param enc_name encodings definition file
141 /// \param symbols_name unicode->LaTeX mapping file
142 bool readEncodingsFile(std::string const & enc_name,
143 std::string const & symbols_name);
144 /// parsing of non-gui LyX options.
145 void easyParse(int & argc, char * argv[]);
146 /// shows up a parsing error on screen
147 void printError(ErrorItem const &);
149 /// Use the Pimpl idiom to hide the internals.
150 // Mostly used for singletons.
154 /// has this user started lyx for the first time?
157 friend Movers & theMovers();
158 friend Mover const & getMover(std::string const & fmt);
159 friend void setMover(std::string const & fmt, std::string const & command);
160 friend Movers & theSystemMovers();
161 friend frontend::Application * theApp();
162 friend KeyMap & theTopLevelKeymap();