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