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