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>
50 class LyX : boost::noncopyable {
57 int exec(int & argc, char * argv[]);
60 static LyX const & cref();
62 /// in the case of failure
63 void emergencyCleanup() const;
66 BufferList & bufferList();
67 BufferList const & bufferList() const;
70 Session const & session() const;
73 LyXFunc const & lyxFunc() const;
76 Server const & server() const;
78 ServerSocket & socket();
79 ServerSocket const & socket() const;
82 frontend::Application & application();
83 frontend::Application const & application() const;
86 KeyMap & topLevelKeymap();
87 KeyMap const & topLevelKeymap() const;
90 Converters & converters();
91 Converters & systemConverters();
94 Messages & getMessages(std::string const & language);
96 Messages & getGuiMessages();
98 void setGuiLanguage(std::string const & language);
101 frontend::LyXView * newLyXView();
103 /** redraw \c inset in all the BufferViews in which it is currently
104 * visible. If successful return a pointer to the owning Buffer.
106 Buffer const * const updateInset(Inset const *) const;
108 void hideDialogs(std::string const & name, Inset * inset) const;
110 /// Execute batch commands if available.
111 void execBatchCommands();
114 void addFileToLoad(support::FileName const &);
117 /// Do some cleanup in preparation of an exit.
120 /// Early exit during the initialisation process.
121 void earlyExit(int status);
123 /// Initialise LyX and fills-in the vector of files to be loaded.
125 \return exit code failure if any.
127 int init(int & argc, char * argv[]);
129 /// Load files passed at command-line.
131 This method is used only in non-GUI mode.
135 /// Create a View, load files and restore GUI Session.
136 void restoreGuiSession();
138 /// Initialize RC font for the GUI.
141 /// initial LyX set up
143 /// set up the default key bindings
144 void defaultKeyBindings(KeyMap * kbmap);
145 /// set up the default dead key bindings if requested
146 void deadKeyBindings(KeyMap * kbmap);
147 /** Check for the existence of the user's support directory and,
148 * if not present, create it. Exits the program if the directory
150 * \returns true if the user-side configuration script
151 * (lib/configure) should be re-run in this directory.
153 bool queryUserLyXDir(bool explicit_userdir);
154 /// read lyxrc/preferences
155 bool readRcFile(std::string const & name);
156 /// read the given ui (menu/toolbar) file
157 bool readUIFile(std::string const & name, bool include = false);
158 /// read the given languages file
159 bool readLanguagesFile(std::string const & name);
160 /// read the encodings.
161 /// \param enc_name encodings definition file
162 /// \param symbols_name unicode->LaTeX mapping file
163 bool readEncodingsFile(std::string const & enc_name,
164 std::string const & symbols_name);
165 /// parsing of non-gui LyX options.
166 void easyParse(int & argc, char * argv[]);
167 /// shows up a parsing error on screen
168 void printError(ErrorItem const &);
170 /// has this user started lyx for the first time?
172 /// the parsed command line batch command if any
173 std::string batch_command;
175 /// Use the Pimpl idiom to hide the internals.
177 boost::scoped_ptr<Singletons> pimpl_;
179 friend Movers & theMovers();
180 friend Mover const & getMover(std::string const & fmt);
181 friend void setMover(std::string const & fmt, std::string const & command);
182 friend Movers & theSystemMovers();
183 friend frontend::Application * theApp();