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