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;
38 namespace frontend { class Application; }
41 class LyX : boost::noncopyable {
48 int exec(int & argc, char * argv[]);
51 static LyX const & cref();
53 /// in the case of failure
54 void emergencyCleanup() const;
57 BufferList & bufferList();
58 BufferList const & bufferList() const;
61 Session const & session() const;
64 LyXFunc const & lyxFunc() const;
67 LyXServer const & server() const;
69 LyXServerSocket & socket();
70 LyXServerSocket const & socket() const;
73 frontend::Application & application();
74 frontend::Application const & application() const;
77 kb_keymap & topLevelKeymap();
78 kb_keymap const & topLevelKeymap() const;
81 IconvProcessor & iconvProcessor();
83 LyXView * newLyXView();
85 /** redraw \c inset in all the BufferViews in which it is currently
86 * visible. If successful return a pointer to the owning Buffer.
88 Buffer const * const updateInset(InsetBase const *) const;
90 /// Execute batch commands if available.
91 void execBatchCommands();
94 /// Do some cleanup in preparation of an exit.
97 /// Early exit during the initialisation process.
98 void earlyExit(int status);
100 /// Initialise LyX and fills-in the vector of files to be loaded.
102 \return exit code failure if any.
104 int init(int & argc, char * argv[]);
106 /// Load files passed at command-line.
108 This method is used only in non-GUI mode.
112 /// Create a View, load files and restore GUI Session.
113 void restoreGuiSession();
115 /// Initialize RC font for the GUI.
118 /// initial LyX set up
120 /// set up the default key bindings
121 void defaultKeyBindings(kb_keymap * kbmap);
122 /// set up the default dead key bindings if requested
123 void deadKeyBindings(kb_keymap * kbmap);
124 /** Check for the existence of the user's support directory and,
125 * if not present, create it. Exits the program if the directory
127 * \returns true if the user-side configuration script
128 * (lib/configure) should be re-run in this directory.
130 bool queryUserLyXDir(bool explicit_userdir);
131 /// read lyxrc/preferences
132 bool readRcFile(std::string const & name);
133 /// read the given ui (menu/toolbar) file
134 bool readUIFile(std::string const & name);
135 /// read the given languages file
136 bool readLanguagesFile(std::string const & name);
137 /// read the given encodings file
138 bool readEncodingsFile(std::string const & name);
139 /// parsing of non-gui LyX options.
140 void easyParse(int & argc, char * argv[]);
141 /// shows up a parsing error on screen
142 void printError(ErrorItem const &);
144 /// has this user started lyx for the first time?
146 /// the parsed command line batch command if any
147 std::string batch_command;
149 /// Use the Pimpl idiom to hide the internals.
151 boost::scoped_ptr<Singletons> pimpl_;