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>
31 class LyXServerSocket;
41 namespace frontend { class Application; }
44 class LyX : boost::noncopyable {
51 int exec(int & argc, char * argv[]);
54 static LyX const & cref();
56 /// in the case of failure
57 void emergencyCleanup() const;
60 BufferList & bufferList();
61 BufferList const & bufferList() const;
64 Session const & session() const;
67 LyXFunc const & lyxFunc() const;
70 LyXServer const & server() const;
72 LyXServerSocket & socket();
73 LyXServerSocket const & socket() const;
76 frontend::Application & application();
77 frontend::Application const & application() const;
80 kb_keymap & topLevelKeymap();
81 kb_keymap const & topLevelKeymap() const;
84 Converters & converters();
85 Converters & systemConverters();
88 Messages & getMessages(std::string const & language);
90 Messages & getGuiMessages();
92 void setGuiLanguage(std::string const & language);
95 LyXView * newLyXView();
97 /** redraw \c inset in all the BufferViews in which it is currently
98 * visible. If successful return a pointer to the owning Buffer.
100 Buffer const * const updateInset(InsetBase const *) const;
102 /// Execute batch commands if available.
103 void execBatchCommands();
106 /// Do some cleanup in preparation of an exit.
109 /// Early exit during the initialisation process.
110 void earlyExit(int status);
112 /// Initialise LyX and fills-in the vector of files to be loaded.
114 \return exit code failure if any.
116 int init(int & argc, char * argv[]);
118 /// Load files passed at command-line.
120 This method is used only in non-GUI mode.
124 /// Create a View, load files and restore GUI Session.
125 void restoreGuiSession();
127 /// Initialize RC font for the GUI.
130 /// initial LyX set up
132 /// set up the default key bindings
133 void defaultKeyBindings(kb_keymap * kbmap);
134 /// set up the default dead key bindings if requested
135 void deadKeyBindings(kb_keymap * kbmap);
136 /** Check for the existence of the user's support directory and,
137 * if not present, create it. Exits the program if the directory
139 * \returns true if the user-side configuration script
140 * (lib/configure) should be re-run in this directory.
142 bool queryUserLyXDir(bool explicit_userdir);
143 /// read lyxrc/preferences
144 bool readRcFile(std::string const & name);
145 /// read the given ui (menu/toolbar) file
146 bool readUIFile(std::string const & name, bool include = false);
147 /// read the given languages file
148 bool readLanguagesFile(std::string const & name);
149 /// read the encodings.
150 /// \param enc_name encodings definition file
151 /// \param symbols_name unicode->LaTeX mapping file
152 bool readEncodingsFile(std::string const & enc_name,
153 std::string const & symbols_name);
154 /// parsing of non-gui LyX options.
155 void easyParse(int & argc, char * argv[]);
156 /// shows up a parsing error on screen
157 void printError(ErrorItem const &);
159 /// has this user started lyx for the first time?
161 /// the parsed command line batch command if any
162 std::string batch_command;
164 /// Use the Pimpl idiom to hide the internals.
166 boost::scoped_ptr<Singletons> pimpl_;
168 friend Movers & theMovers();
169 friend Mover const & getMover(std::string const & fmt);
170 friend void setMover(std::string const & fmt, std::string const & command);
171 friend Movers & theSystemMovers();
172 friend frontend::Application * theApp();