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/shared_ptr.hpp>
19 #include <boost/utility.hpp>
35 class LyX : boost::noncopyable {
38 * Execute LyX. The startup sequence is as follows:
43 * Step 3 is omitted if no gui is wanted. We need lyx_gui::exec()
44 * only to create the QApplication object in the qt frontend. All
45 * attempts with static and dynamically allocated QApplication
46 * objects lead either to harmless error messages on exit
47 * ("Mutex destroy failure") or crashes (OS X).
49 static int exec(int & argc, char * argv[]);
50 /// Execute LyX (inner execution loop, \sa exec)
51 int exec2(int & argc, char * argv[]);
53 static LyX const & cref();
55 /// in the case of failure
56 void emergencyCleanup() const;
58 lyx::Session & session();
59 lyx::Session const & session() const;
61 void addLyXView(LyXView * lyxview);
63 /** redraw \c inset in all the BufferViews in which it is currently
64 * visible. If successful return a pointer to the owning Buffer.
66 Buffer const * const updateInset(InsetBase const *) const;
69 static boost::scoped_ptr<LyX> singleton_;
72 int priv_exec(int & argc, char * argv[]);
74 /// initial LyX set up
76 /// set up the default key bindings
77 void defaultKeyBindings(kb_keymap * kbmap);
78 /// set up the default dead key bindings if requested
79 void deadKeyBindings(kb_keymap * kbmap);
80 /** Check for the existence of the user's support directory and,
81 * if not present, create it. Exits the program if the directory
83 * \returns true if the user-side configuration script
84 * (lib/configure) should be re-run in this directory.
86 bool queryUserLyXDir(bool explicit_userdir);
87 /// read lyxrc/preferences
88 bool readRcFile(std::string const & name);
89 /// read the given ui (menu/toolbar) file
90 bool readUIFile(std::string const & name);
91 /// read the given languages file
92 bool readLanguagesFile(std::string const & name);
93 /// read the given encodings file
94 bool readEncodingsFile(std::string const & name);
95 /// parsing of non-gui LyX options. Returns true if gui
96 bool easyParse(int & argc, char * argv[]);
97 /// shows up a parsing error on screen
98 void printError(ErrorItem const &);
100 /// has this user started lyx for the first time?
102 /// the parsed command line batch command if any
103 std::string batch_command;
105 /// lyx session, containing lastfiles, lastfilepos, and lastopened
106 boost::scoped_ptr<lyx::Session> session_;
108 typedef std::list<LyXView *> ViewList;
112 bool geometryOption_;