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