]> git.lyx.org Git - lyx.git/blob - src/lyx_main.h
STLPort compile fix
[lyx.git] / src / lyx_main.h
1 // -*- C++ -*-
2 /**
3  * \file lyx_main.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Jean-Marc Lasgouttes
9  * \author John Levon
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef LYX_MAIN_H
15 #define LYX_MAIN_H
16
17 #include <boost/scoped_ptr.hpp>
18 #include <boost/shared_ptr.hpp>
19 #include <boost/utility.hpp>
20
21 #include <list>
22 #include <string>
23
24 class Buffer;
25 class ErrorItem;
26 class InsetBase;
27 class LastFiles;
28 class LyXView;
29 class kb_keymap;
30
31
32 /// initial startup
33 class LyX : boost::noncopyable {
34 public:
35         static void exec(int & argc, char * argv[]);
36         static LyX & ref();
37         static LyX const & cref();
38
39         /// in the case of failure
40         void emergencyCleanup() const;
41
42         LastFiles & lastfiles();
43         LastFiles const & lastfiles() const;
44
45         void addLyXView(boost::shared_ptr<LyXView> const & lyxview);
46
47         /** redraw \c inset in all the BufferViews in which it is currently
48          *  visible. If successful return a pointer to the owning Buffer.
49          */
50         Buffer const * const updateInset(InsetBase const *) const;
51
52 private:
53         static boost::scoped_ptr<LyX> singleton_;
54
55         LyX();
56         void priv_exec(int & argc, char * argv[]);
57
58         /// initial LyX set up
59         void init(bool);
60         /// set up the default key bindings
61         void defaultKeyBindings(kb_keymap * kbmap);
62         /// set up the default dead key bindings if requested
63         void deadKeyBindings(kb_keymap * kbmap);
64         /// check, set up and configure the user dir if necessary
65         void queryUserLyXDir(bool explicit_userdir);
66         /// read lyxrc/preferences
67         void readRcFile(std::string const & name);
68         /// read the given ui (menu/toolbar) file
69         void readUIFile(std::string const & name);
70         /// read the given languages file
71         void readLanguagesFile(std::string const & name);
72         /// read the given encodings file
73         void readEncodingsFile(std::string const & name);
74         /// parsing of non-gui LyX options. Returns true if gui
75         bool easyParse(int & argc, char * argv[]);
76         /// shows up a parsing error on screen
77         void printError(ErrorItem const &);
78
79         /// has this user started lyx for the first time?
80         bool first_start;
81         /// the parsed command line batch command if any
82         std::string batch_command;
83
84         /// last files loaded
85         boost::scoped_ptr<LastFiles> lastfiles_;
86         ///
87         typedef std::list<boost::shared_ptr<LyXView> > ViewList;
88         ViewList views_;
89 };
90
91 #endif // LYX_MAIN_H