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"
55 extern bool ignore_missing_glyphs;
56 extern RunMode run_mode;
57 extern OverwriteFiles force_overwrite;
65 friend class LyXConsoleApp;
71 int exec(int & argc, char * argv[]);
76 void operator=(LyX const &);
78 /// Do some cleanup in preparation of an exit.
81 /// Early exit during the initialisation process.
82 void earlyExit(int status);
84 /// Initialise LyX and fills-in the vector of files to be loaded.
86 \return exit code failure if any.
88 int init(int & argc, char * argv[]);
90 /// Execute commandline commands if no GUI was requested.
91 int execWithoutGui(int & argc, char * argv[]);
93 /// Execute batch commands if available.
96 /// initial LyX set up
98 /** Check for the existence of the user's support directory and,
99 * if not present, create it. Exits the program if the directory
101 * \returns true if the user-side configuration script
102 * (lib/configure) should be re-run in this directory.
104 bool queryUserLyXDir(bool explicit_userdir);
105 /// read lyxrc/preferences
106 /// \param check_format: whether to try to convert the format of
107 /// the file, if there is a mismatch.
108 bool readRcFile(std::string const & name, bool check_format = false);
109 /// read the given languages file
110 bool readLanguagesFile(std::string const & name);
111 /// read the encodings.
112 /// \param enc_name encodings definition file
113 /// \param symbols_name unicode->LaTeX mapping file
114 bool readEncodingsFile(std::string const & enc_name,
115 std::string const & symbols_name);
116 /// parsing of non-gui LyX options.
117 void easyParse(int & argc, char * argv[]);
118 /// shows up a parsing error on screen
119 void printError(ErrorItem const &);
122 Messages & messages(std::string const & language);
124 /// Use the Pimpl idiom to hide the internals.
125 // Mostly used for singletons.
129 /// has this user started lyx for the first time?
132 friend FuncStatus getStatus(FuncRequest const & action);
133 friend DispatchResult const & dispatch(FuncRequest const & action);
134 friend void dispatch(FuncRequest const & action, DispatchResult & dr);
135 friend std::vector<std::string> & theFilesToLoad();
136 friend BufferList & theBufferList();
137 friend Server & theServer();
138 friend ServerSocket & theServerSocket();
139 friend Converters & theConverters();
140 friend Converters & theSystemConverters();
141 friend Messages const & getMessages(std::string const & language);
142 friend Messages const & getGuiMessages();
143 friend KeyMap & theTopLevelKeymap();
144 friend Movers & theMovers();
145 friend Mover const & getMover(std::string const & fmt);
146 friend void setMover(std::string const & fmt, std::string const & command);
147 friend Movers & theSystemMovers();
148 friend frontend::Application * theApp();
149 friend Session & theSession();
150 friend LaTeXFonts & theLaTeXFonts();
151 friend CmdDef & theTopLevelCmdDef();
152 friend SpellChecker * theSpellChecker();
153 friend void setSpellChecker();
154 friend void emergencyCleanup();
155 friend void execBatchCommands();
156 friend void lyx_exit(int exit_code);
160 /// in the case of failure
161 void emergencyCleanup();
162 /// Try to exit LyX properly.
163 /// \p exit_code is 0 by default, if a non zero value is passed,
164 /// emergencyCleanup() will be called before exiting.
165 void lyx_exit(int exit_code);
166 /// Execute batch commands if available.
167 void execBatchCommands();
170 FuncStatus getStatus(FuncRequest const & action);
173 DispatchResult const & dispatch(FuncRequest const & action);
176 void dispatch(FuncRequest const & action, DispatchResult & dr);