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;
39 namespace frontend { class Application; }
42 class LyX : boost::noncopyable {
49 int exec(int & argc, char * argv[]);
52 static LyX const & cref();
54 /// in the case of failure
55 void emergencyCleanup() const;
58 BufferList & bufferList();
59 BufferList const & bufferList() const;
62 Session const & session() const;
65 LyXFunc const & lyxFunc() const;
68 LyXServer const & server() const;
70 LyXServerSocket & socket();
71 LyXServerSocket const & socket() const;
74 frontend::Application & application();
75 frontend::Application const & application() const;
78 kb_keymap & topLevelKeymap();
79 kb_keymap const & topLevelKeymap() const;
82 Messages & getMessages(std::string const & language);
84 Messages & getGuiMessages();
86 void setGuiLanguage(std::string const & language);
89 IconvProcessor & iconvProcessor();
91 LyXView * newLyXView();
93 /** redraw \c inset in all the BufferViews in which it is currently
94 * visible. If successful return a pointer to the owning Buffer.
96 Buffer const * const updateInset(InsetBase const *) const;
98 /// Execute batch commands if available.
99 void execBatchCommands();
102 /// Do some cleanup in preparation of an exit.
105 /// Early exit during the initialisation process.
106 void earlyExit(int status);
108 /// Initialise LyX and fills-in the vector of files to be loaded.
110 \return exit code failure if any.
112 int init(int & argc, char * argv[]);
114 /// Load files passed at command-line.
116 This method is used only in non-GUI mode.
120 /// Create a View, load files and restore GUI Session.
121 void restoreGuiSession();
123 /// Initialize RC font for the GUI.
126 /// initial LyX set up
128 /// set up the default key bindings
129 void defaultKeyBindings(kb_keymap * kbmap);
130 /// set up the default dead key bindings if requested
131 void deadKeyBindings(kb_keymap * kbmap);
132 /** Check for the existence of the user's support directory and,
133 * if not present, create it. Exits the program if the directory
135 * \returns true if the user-side configuration script
136 * (lib/configure) should be re-run in this directory.
138 bool queryUserLyXDir(bool explicit_userdir);
139 /// read lyxrc/preferences
140 bool readRcFile(std::string const & name);
141 /// read the given ui (menu/toolbar) file
142 bool readUIFile(std::string const & name);
143 /// read the given languages file
144 bool readLanguagesFile(std::string const & name);
145 /// read the given encodings file
146 bool readEncodingsFile(std::string const & name);
147 /// parsing of non-gui LyX options.
148 void easyParse(int & argc, char * argv[]);
149 /// shows up a parsing error on screen
150 void printError(ErrorItem const &);
152 /// has this user started lyx for the first time?
154 /// the parsed command line batch command if any
155 std::string batch_command;
157 /// Use the Pimpl idiom to hide the internals.
159 boost::scoped_ptr<Singletons> pimpl_;