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