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 <boost/scoped_ptr.hpp>
18 #include <boost/utility.hpp>
45 namespace frontend { class Application; }
48 class LyX : boost::noncopyable {
55 int exec(int & argc, char * argv[]);
58 static LyX const & cref();
60 /// in the case of failure
61 void emergencyCleanup() const;
64 BufferList & bufferList();
65 BufferList const & bufferList() const;
68 Session const & session() const;
71 LyXFunc const & lyxFunc() const;
74 Server const & server() const;
76 ServerSocket & socket();
77 ServerSocket const & socket() const;
80 frontend::Application & application();
81 frontend::Application const & application() const;
84 KeyMap & topLevelKeymap();
85 KeyMap const & topLevelKeymap() const;
88 Converters & converters();
89 Converters & systemConverters();
92 Messages & getMessages(std::string const & language);
94 Messages & getGuiMessages();
96 void setGuiLanguage(std::string const & language);
99 LyXView * newLyXView();
101 /** redraw \c inset in all the BufferViews in which it is currently
102 * visible. If successful return a pointer to the owning Buffer.
104 Buffer const * const updateInset(Inset const *) const;
106 /// Execute batch commands if available.
107 void execBatchCommands();
110 void addFileToLoad(support::FileName const &);
113 /// Do some cleanup in preparation of an exit.
116 /// Early exit during the initialisation process.
117 void earlyExit(int status);
119 /// Initialise LyX and fills-in the vector of files to be loaded.
121 \return exit code failure if any.
123 int init(int & argc, char * argv[]);
125 /// Load files passed at command-line.
127 This method is used only in non-GUI mode.
131 /// Create a View, load files and restore GUI Session.
132 void restoreGuiSession();
134 /// Initialize RC font for the GUI.
137 /// initial LyX set up
139 /// set up the default key bindings
140 void defaultKeyBindings(KeyMap * kbmap);
141 /// set up the default dead key bindings if requested
142 void deadKeyBindings(KeyMap * kbmap);
143 /** Check for the existence of the user's support directory and,
144 * if not present, create it. Exits the program if the directory
146 * \returns true if the user-side configuration script
147 * (lib/configure) should be re-run in this directory.
149 bool queryUserLyXDir(bool explicit_userdir);
150 /// read lyxrc/preferences
151 bool readRcFile(std::string const & name);
152 /// read the given ui (menu/toolbar) file
153 bool readUIFile(std::string const & name, bool include = false);
154 /// read the given languages file
155 bool readLanguagesFile(std::string const & name);
156 /// read the encodings.
157 /// \param enc_name encodings definition file
158 /// \param symbols_name unicode->LaTeX mapping file
159 bool readEncodingsFile(std::string const & enc_name,
160 std::string const & symbols_name);
161 /// parsing of non-gui LyX options.
162 void easyParse(int & argc, char * argv[]);
163 /// shows up a parsing error on screen
164 void printError(ErrorItem const &);
166 /// has this user started lyx for the first time?
168 /// the parsed command line batch command if any
169 std::string batch_command;
171 /// Use the Pimpl idiom to hide the internals.
173 boost::scoped_ptr<Singletons> pimpl_;
175 friend Movers & theMovers();
176 friend Mover const & getMover(std::string const & fmt);
177 friend void setMover(std::string const & fmt, std::string const & command);
178 friend Movers & theSystemMovers();
179 friend frontend::Application * theApp();