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 "support/strfwd.h"
45 extern OverwriteFiles force_overwrite;
63 int exec(int & argc, char * argv[]);
68 void operator=(LyX const &);
70 /// Do some cleanup in preparation of an exit.
73 /// Early exit during the initialisation process.
74 void earlyExit(int status);
76 /// Initialise LyX and fills-in the vector of files to be loaded.
78 \return exit code failure if any.
80 int init(int & argc, char * argv[]);
82 /// Execute batch commands if available.
85 /// Load files passed at command-line.
86 /// return true on success false if we encounter an error
88 This method is used only in non-GUI mode.
92 /// initial LyX set up
94 /** Check for the existence of the user's support directory and,
95 * if not present, create it. Exits the program if the directory
97 * \returns true if the user-side configuration script
98 * (lib/configure) should be re-run in this directory.
100 bool queryUserLyXDir(bool explicit_userdir);
101 /// read lyxrc/preferences
102 bool readRcFile(std::string const & name);
103 /// read the given languages file
104 bool readLanguagesFile(std::string const & name);
105 /// read the encodings.
106 /// \param enc_name encodings definition file
107 /// \param symbols_name unicode->LaTeX mapping file
108 bool readEncodingsFile(std::string const & enc_name,
109 std::string const & symbols_name);
110 /// parsing of non-gui LyX options.
111 void easyParse(int & argc, char * argv[]);
112 /// shows up a parsing error on screen
113 void printError(ErrorItem const &);
116 Messages & messages(std::string const & language);
118 /// Use the Pimpl idiom to hide the internals.
119 // Mostly used for singletons.
123 /// has this user started lyx for the first time?
126 friend FuncStatus getStatus(FuncRequest const & action);
127 friend void dispatch(FuncRequest const & action);
128 friend void dispatch(FuncRequest const & action, DispatchResult & dr);
129 friend BufferList & theBufferList();
130 friend Server & theServer();
131 friend ServerSocket & theServerSocket();
132 friend Converters & theConverters();
133 friend Converters & theSystemConverters();
134 friend Messages const & getMessages(std::string const & language);
135 friend Messages const & getGuiMessages();
136 friend KeyMap & theTopLevelKeymap();
137 friend Movers & theMovers();
138 friend Mover const & getMover(std::string const & fmt);
139 friend void setMover(std::string const & fmt, std::string const & command);
140 friend Movers & theSystemMovers();
141 friend frontend::Application * theApp();
142 friend graphics::Previews & thePreviews();
143 friend Session & theSession();
144 friend CmdDef & theTopLevelCmdDef();
145 friend SpellChecker * theSpellChecker();
146 friend void setSpellChecker();
147 friend void setRcGuiLanguage();
148 friend void emergencyCleanup();
149 friend void execBatchCommands();
150 friend void lyx_exit(int exit_code);
154 /// in the case of failure
155 void emergencyCleanup();
156 /// Try to exit LyX properly.
157 /// \p exit_code is 0 by default, if a non zero value is passed,
158 /// emergencyCleanup() will be called before exiting.
159 void lyx_exit(int exit_code);
160 /// Set the language defined by the user.
161 void setRcGuiLanguage();
162 /// Execute batch commands if available.
163 void execBatchCommands();
166 FuncStatus getStatus(FuncRequest const & action);
169 void dispatch(FuncRequest const & action);
172 void dispatch(FuncRequest const & action, DispatchResult & dr);