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