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;
40 namespace frontend { class Application; }
43 class LyX : boost::noncopyable {
50 int exec(int & argc, char * argv[]);
53 static LyX const & cref();
55 /// in the case of failure
56 void emergencyCleanup() const;
59 BufferList & bufferList();
60 BufferList const & bufferList() const;
63 Session const & session() const;
66 LyXFunc const & lyxFunc() const;
69 LyXServer const & server() const;
71 LyXServerSocket & socket();
72 LyXServerSocket const & socket() const;
75 frontend::Application & application();
76 frontend::Application const & application() const;
79 kb_keymap & topLevelKeymap();
80 kb_keymap const & topLevelKeymap() const;
83 Converters & converters();
84 Converters & systemConverters();
87 Messages & getMessages(std::string const & language);
89 Messages & getGuiMessages();
91 void setGuiLanguage(std::string const & language);
94 IconvProcessor & iconvProcessor();
96 LyXView * newLyXView();
98 /** redraw \c inset in all the BufferViews in which it is currently
99 * visible. If successful return a pointer to the owning Buffer.
101 Buffer const * const updateInset(InsetBase const *) const;
103 /// Execute batch commands if available.
104 void execBatchCommands();
107 /// Do some cleanup in preparation of an exit.
110 /// Early exit during the initialisation process.
111 void earlyExit(int status);
113 /// Initialise LyX and fills-in the vector of files to be loaded.
115 \return exit code failure if any.
117 int init(int & argc, char * argv[]);
119 /// Load files passed at command-line.
121 This method is used only in non-GUI mode.
125 /// Create a View, load files and restore GUI Session.
126 void restoreGuiSession();
128 /// Initialize RC font for the GUI.
131 /// initial LyX set up
133 /// set up the default key bindings
134 void defaultKeyBindings(kb_keymap * kbmap);
135 /// set up the default dead key bindings if requested
136 void deadKeyBindings(kb_keymap * kbmap);
137 /** Check for the existence of the user's support directory and,
138 * if not present, create it. Exits the program if the directory
140 * \returns true if the user-side configuration script
141 * (lib/configure) should be re-run in this directory.
143 bool queryUserLyXDir(bool explicit_userdir);
144 /// read lyxrc/preferences
145 bool readRcFile(std::string const & name);
146 /// read the given ui (menu/toolbar) file
147 bool readUIFile(std::string const & name);
148 /// read the given languages file
149 bool readLanguagesFile(std::string const & name);
150 /// read the given encodings file
151 bool readEncodingsFile(std::string const & name);
152 /// parsing of non-gui LyX options.
153 void easyParse(int & argc, char * argv[]);
154 /// shows up a parsing error on screen
155 void printError(ErrorItem const &);
157 /// has this user started lyx for the first time?
159 /// the parsed command line batch command if any
160 std::string batch_command;
162 /// Use the Pimpl idiom to hide the internals.
164 boost::scoped_ptr<Singletons> pimpl_;