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"
53 int exec(int & argc, char * argv[]);
55 /// Try to exit LyX properly.
56 /// \p exit_code is 0 by default, if a non zero value is passed,
57 /// emergencyCleanup() will be called before exiting.
58 void exit(int exit_code = 0) const;
61 static LyX const & cref();
63 /// in the case of failure
64 void emergencyCleanup() const;
67 BufferList & bufferList();
68 BufferList const & bufferList() const;
71 Session const & session() const;
74 LyXFunc const & lyxFunc() const;
77 Server const & server() const;
79 ServerSocket & socket();
80 ServerSocket const & socket() const;
83 frontend::Application & application();
84 frontend::Application const & application() const;
87 CmdDef & topLevelCmdDef();
90 Converters & converters();
91 Converters & systemConverters();
94 Messages & getMessages(std::string const & language);
96 Messages & getGuiMessages();
98 void setRcGuiLanguage();
101 frontend::LyXView * newLyXView();
103 /// Execute batch commands if available.
104 void execBatchCommands();
109 void operator=(LyX const &);
111 /// Do some cleanup in preparation of an exit.
114 /// Early exit during the initialisation process.
115 void earlyExit(int status);
117 /// Initialise LyX and fills-in the vector of files to be loaded.
119 \return exit code failure if any.
121 int init(int & argc, char * argv[]);
123 /// Load files passed at command-line.
124 /// return true on success false if we encounter an error
126 This method is used only in non-GUI mode.
130 /// initial LyX set up
132 /** Check for the existence of the user's support directory and,
133 * if not present, create it. Exits the program if the directory
135 * \returns true if the user-side configuration script
136 * (lib/configure) should be re-run in this directory.
138 bool queryUserLyXDir(bool explicit_userdir);
139 /// read lyxrc/preferences
140 bool readRcFile(std::string const & name);
141 /// read the given languages file
142 bool readLanguagesFile(std::string const & name);
143 /// read the encodings.
144 /// \param enc_name encodings definition file
145 /// \param symbols_name unicode->LaTeX mapping file
146 bool readEncodingsFile(std::string const & enc_name,
147 std::string const & symbols_name);
148 /// parsing of non-gui LyX options.
149 void easyParse(int & argc, char * argv[]);
150 /// shows up a parsing error on screen
151 void printError(ErrorItem const &);
153 /// Use the Pimpl idiom to hide the internals.
154 // Mostly used for singletons.
158 /// has this user started lyx for the first time?
161 friend Movers & theMovers();
162 friend Mover const & getMover(std::string const & fmt);
163 friend void setMover(std::string const & fmt, std::string const & command);
164 friend Movers & theSystemMovers();
165 friend frontend::Application * theApp();
166 friend KeyMap & theTopLevelKeymap();
167 friend graphics::Previews * thePreviews();