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>
32 class LyXServerSocket;
42 namespace frontend { class Application; }
45 class LyX : boost::noncopyable {
52 int exec(int & argc, char * argv[]);
55 static LyX const & cref();
57 /// in the case of failure
58 void emergencyCleanup() const;
61 BufferList & bufferList();
62 BufferList const & bufferList() const;
65 Session const & session() const;
68 LyXFunc const & lyxFunc() const;
71 LyXServer const & server() const;
73 LyXServerSocket & socket();
74 LyXServerSocket const & socket() const;
77 frontend::Application & application();
78 frontend::Application const & application() const;
81 kb_keymap & topLevelKeymap();
82 kb_keymap const & topLevelKeymap() const;
85 Converters & converters();
86 Converters & systemConverters();
89 Messages & getMessages(std::string const & language);
91 Messages & getGuiMessages();
93 void setGuiLanguage(std::string const & language);
96 IconvProcessor & iconvProcessor();
98 LyXView * newLyXView();
100 /** redraw \c inset in all the BufferViews in which it is currently
101 * visible. If successful return a pointer to the owning Buffer.
103 Buffer const * const updateInset(InsetBase const *) const;
105 /// Execute batch commands if available.
106 void execBatchCommands();
109 /// Do some cleanup in preparation of an exit.
112 /// Early exit during the initialisation process.
113 void earlyExit(int status);
115 /// Initialise LyX and fills-in the vector of files to be loaded.
117 \return exit code failure if any.
119 int init(int & argc, char * argv[]);
121 /// Load files passed at command-line.
123 This method is used only in non-GUI mode.
127 /// Create a View, load files and restore GUI Session.
128 void restoreGuiSession();
130 /// Initialize RC font for the GUI.
133 /// initial LyX set up
135 /// set up the default key bindings
136 void defaultKeyBindings(kb_keymap * kbmap);
137 /// set up the default dead key bindings if requested
138 void deadKeyBindings(kb_keymap * kbmap);
139 /** Check for the existence of the user's support directory and,
140 * if not present, create it. Exits the program if the directory
142 * \returns true if the user-side configuration script
143 * (lib/configure) should be re-run in this directory.
145 bool queryUserLyXDir(bool explicit_userdir);
146 /// read lyxrc/preferences
147 bool readRcFile(std::string const & name);
148 /// read the given ui (menu/toolbar) file
149 bool readUIFile(std::string const & name, bool include = false);
150 /// read the given languages file
151 bool readLanguagesFile(std::string const & name);
152 /// read the given encodings file
153 bool readEncodingsFile(std::string const & 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();