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/noncopyable.hpp>
51 class LyX : boost::noncopyable {
58 int exec(int & argc, char * argv[]);
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 KeyMap & topLevelKeymap();
88 KeyMap const & topLevelKeymap() const;
91 CmdDef & topLevelCmdDef();
94 Converters & converters();
95 Converters & systemConverters();
98 Messages & getMessages(std::string const & language);
100 Messages & getGuiMessages();
102 void setGuiLanguage(std::string const & language);
105 frontend::LyXView * newLyXView();
107 /** redraw \c inset in all the BufferViews in which it is currently
108 * visible. If successful return a pointer to the owning Buffer.
110 Buffer const * updateInset(Inset const *) const;
112 void hideDialogs(std::string const & name, Inset * inset) const;
114 /// Execute batch commands if available.
115 void execBatchCommands();
118 void addFileToLoad(support::FileName const &);
121 /// Do some cleanup in preparation of an exit.
124 /// Early exit during the initialisation process.
125 void earlyExit(int status);
127 /// Initialise LyX and fills-in the vector of files to be loaded.
129 \return exit code failure if any.
131 int init(int & argc, char * argv[]);
133 /// Load files passed at command-line.
135 This method is used only in non-GUI mode.
139 /// Create a View, load files and restore GUI Session.
140 void restoreGuiSession();
142 /// Initialize RC font for the GUI.
145 /// initial LyX set up
147 /// set up the default key bindings
148 void defaultKeyBindings(KeyMap * kbmap);
149 /// set up the default dead key bindings if requested
150 void deadKeyBindings(KeyMap * kbmap);
151 /** Check for the existence of the user's support directory and,
152 * if not present, create it. Exits the program if the directory
154 * \returns true if the user-side configuration script
155 * (lib/configure) should be re-run in this directory.
157 bool queryUserLyXDir(bool explicit_userdir);
158 /// read lyxrc/preferences
159 bool readRcFile(std::string const & name);
160 /// read the given ui (menu/toolbar) file
161 bool readUIFile(std::string const & name, bool include = false);
162 /// read the given languages file
163 bool readLanguagesFile(std::string const & name);
164 /// read the encodings.
165 /// \param enc_name encodings definition file
166 /// \param symbols_name unicode->LaTeX mapping file
167 bool readEncodingsFile(std::string const & enc_name,
168 std::string const & symbols_name);
169 /// parsing of non-gui LyX options.
170 void easyParse(int & argc, char * argv[]);
171 /// shows up a parsing error on screen
172 void printError(ErrorItem const &);
174 /// has this user started lyx for the first time?
176 /// the parsed command line batch command if any
177 std::string batch_command;
179 /// Use the Pimpl idiom to hide the internals.
181 boost::scoped_ptr<Singletons> pimpl_;
183 friend Movers & theMovers();
184 friend Mover const & getMover(std::string const & fmt);
185 friend void setMover(std::string const & fmt, std::string const & command);
186 friend Movers & theSystemMovers();
187 friend frontend::Application * theApp();