1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
2002-06-12 02:54:19 +00:00
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
* \file LyX.h
|
2003-08-23 00:17:00 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-06-12 02:54:19 +00:00
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-06-12 02:54:19 +00:00
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#ifndef LYX_H
|
|
|
|
#define LYX_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2007-11-14 21:36:01 +00:00
|
|
|
#include "support/strfwd.h"
|
2002-05-22 01:16:37 +00:00
|
|
|
|
2010-11-13 11:55:05 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2006-10-11 22:30:31 +00:00
|
|
|
class BufferList;
|
2008-03-22 09:32:38 +00:00
|
|
|
class CmdDef;
|
2007-01-17 13:18:16 +00:00
|
|
|
class Converters;
|
2010-01-25 15:14:41 +00:00
|
|
|
class DispatchResult;
|
2003-09-04 03:54:04 +00:00
|
|
|
class ErrorItem;
|
2008-07-14 08:35:00 +00:00
|
|
|
class FuncRequest;
|
|
|
|
class FuncStatus;
|
2008-03-22 09:32:38 +00:00
|
|
|
class KeyMap;
|
2012-08-16 11:23:39 +00:00
|
|
|
class LaTeXFonts;
|
2007-01-14 10:37:14 +00:00
|
|
|
class Messages;
|
2007-01-18 08:42:53 +00:00
|
|
|
class Mover;
|
|
|
|
class Movers;
|
2008-03-22 09:32:38 +00:00
|
|
|
class Server;
|
|
|
|
class ServerSocket;
|
2006-10-21 00:16:43 +00:00
|
|
|
class Session;
|
2009-03-29 21:18:16 +00:00
|
|
|
class SpellChecker;
|
2006-10-12 22:02:45 +00:00
|
|
|
|
2010-11-13 11:55:05 +00:00
|
|
|
enum RunMode {
|
|
|
|
NEW_INSTANCE,
|
|
|
|
USE_REMOTE,
|
|
|
|
PREFERRED
|
|
|
|
};
|
|
|
|
|
2010-04-20 11:09:51 +00:00
|
|
|
enum OverwriteFiles {
|
2010-04-19 23:53:23 +00:00
|
|
|
NO_FILES,
|
|
|
|
MAIN_FILE,
|
2010-07-17 17:55:46 +00:00
|
|
|
ALL_FILES,
|
|
|
|
UNSPECIFIED
|
2010-04-19 23:53:23 +00:00
|
|
|
};
|
|
|
|
|
2006-10-15 21:47:29 +00:00
|
|
|
extern bool use_gui;
|
2010-11-13 11:55:05 +00:00
|
|
|
extern RunMode run_mode;
|
2010-04-20 11:09:51 +00:00
|
|
|
extern OverwriteFiles force_overwrite;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
namespace frontend {
|
|
|
|
class Application;
|
|
|
|
}
|
1999-10-02 16:21:10 +00:00
|
|
|
|
2002-08-07 23:43:38 +00:00
|
|
|
/// initial startup
|
2007-11-07 20:14:30 +00:00
|
|
|
class LyX {
|
2015-01-11 13:06:17 +00:00
|
|
|
friend class LyXConsoleApp;
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
2006-11-18 17:47:12 +00:00
|
|
|
LyX();
|
2006-11-17 15:24:26 +00:00
|
|
|
~LyX();
|
|
|
|
|
2006-12-04 16:54:32 +00:00
|
|
|
/// Execute LyX.
|
2006-11-18 17:47:12 +00:00
|
|
|
int exec(int & argc, char * argv[]);
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
2007-11-07 20:14:30 +00:00
|
|
|
/// noncopyable
|
|
|
|
LyX(LyX const &);
|
|
|
|
void operator=(LyX const &);
|
|
|
|
|
2006-10-17 08:36:04 +00:00
|
|
|
/// Do some cleanup in preparation of an exit.
|
|
|
|
void prepareExit();
|
|
|
|
|
|
|
|
/// Early exit during the initialisation process.
|
|
|
|
void earlyExit(int status);
|
|
|
|
|
2006-12-04 16:54:32 +00:00
|
|
|
/// Initialise LyX and fills-in the vector of files to be loaded.
|
2006-10-17 08:36:04 +00:00
|
|
|
/**
|
|
|
|
\return exit code failure if any.
|
|
|
|
*/
|
2006-12-04 16:54:32 +00:00
|
|
|
int init(int & argc, char * argv[]);
|
|
|
|
|
2015-01-11 13:06:17 +00:00
|
|
|
/// Execute commandline commands if no GUI was requested.
|
|
|
|
int execWithoutGui(int & argc, char * argv[]);
|
|
|
|
|
2008-07-14 08:35:00 +00:00
|
|
|
/// Execute batch commands if available.
|
|
|
|
void execCommands();
|
|
|
|
|
2006-12-04 16:54:32 +00:00
|
|
|
/// Load files passed at command-line.
|
2008-05-28 00:25:42 +00:00
|
|
|
/// return true on success false if we encounter an error
|
2006-12-04 16:54:32 +00:00
|
|
|
/**
|
|
|
|
This method is used only in non-GUI mode.
|
|
|
|
*/
|
2008-05-28 00:25:42 +00:00
|
|
|
bool loadFiles();
|
2006-10-17 08:36:04 +00:00
|
|
|
|
2002-08-07 23:43:38 +00:00
|
|
|
/// initial LyX set up
|
2006-07-05 17:01:26 +00:00
|
|
|
bool init();
|
2005-01-16 21:01:41 +00:00
|
|
|
/** Check for the existence of the user's support directory and,
|
|
|
|
* if not present, create it. Exits the program if the directory
|
|
|
|
* cannot be created.
|
|
|
|
* \returns true if the user-side configuration script
|
|
|
|
* (lib/configure) should be re-run in this directory.
|
|
|
|
*/
|
|
|
|
bool queryUserLyXDir(bool explicit_userdir);
|
2003-04-02 18:08:05 +00:00
|
|
|
/// read lyxrc/preferences
|
2011-01-17 15:54:51 +00:00
|
|
|
/// \param check_format: whether to try to convert the format of
|
|
|
|
/// the file, if there is a mismatch.
|
|
|
|
bool readRcFile(std::string const & name, bool check_format = false);
|
2002-08-07 23:43:38 +00:00
|
|
|
/// read the given languages file
|
2006-07-05 17:01:26 +00:00
|
|
|
bool readLanguagesFile(std::string const & name);
|
Add machinery to output arbitrary unicode characters with LaTeX commands
read from a text file.
* src/encoding.[Ch]
(Encoding::latexChar): New, output a character to LaTeX
(Encoding::validate): New, add needed preamble stuff for a character
(Encodings::read): Read new unicodesymbols file
(Encodings::isCombiningChar): New, is a character a combining char?
* src/paragraph_pimpl.C
(isEncoding): Delete, no longer needed
(getEncoding): New, get the real encoding of a font
(Paragraph::Pimpl::latexSurrogatePair): New, output a surrogate pair
to LaTeX
(Paragraph::Pimpl::simpleTeXBlanks): Use latexSurrogatePair if needed
(Paragraph::Pimpl::simpleTeXSpecialChars): Ditto, and replace several
hardcoded characters with a call of encoding.latexChar()
(Paragraph::Pimpl::validate): replace several hardcoded characters
with a call of encoding.validate()
* src/support/debugstream.h
(basic_debugstream::disable): New, disable the stream completely
(basic_debugstream::enable): New, reenable the stream
* src/lyx_main.[Ch]: Adjust to changes above
* src/paragraph.C: Ditto
* lib/unicodesymbols: New file with UCS4 -> LaTeX command mapping.
It is far from complete yet, but contains most accents on latin
characters.
* lib/Makefile.am: add lib/unicodesymbols
* development/scons/scons_manifest.py: ditto
* development/tools/unicodesymbols.py: Helper script to update
lib/unicodesymbols with new symbols
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16920 a592a061-630c-0410-9148-cb99ea01b6c8
2007-01-28 21:27:45 +00:00
|
|
|
/// read the encodings.
|
|
|
|
/// \param enc_name encodings definition file
|
|
|
|
/// \param symbols_name unicode->LaTeX mapping file
|
|
|
|
bool readEncodingsFile(std::string const & enc_name,
|
2007-05-28 22:27:45 +00:00
|
|
|
std::string const & symbols_name);
|
2006-10-12 14:10:13 +00:00
|
|
|
/// parsing of non-gui LyX options.
|
|
|
|
void easyParse(int & argc, char * argv[]);
|
2003-06-20 23:03:43 +00:00
|
|
|
/// shows up a parsing error on screen
|
|
|
|
void printError(ErrorItem const &);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2008-07-14 08:35:00 +00:00
|
|
|
///
|
|
|
|
Messages & messages(std::string const & language);
|
|
|
|
|
2007-11-14 21:36:01 +00:00
|
|
|
/// Use the Pimpl idiom to hide the internals.
|
|
|
|
// Mostly used for singletons.
|
|
|
|
struct Impl;
|
|
|
|
Impl * pimpl_;
|
|
|
|
|
2002-08-07 23:43:38 +00:00
|
|
|
/// has this user started lyx for the first time?
|
|
|
|
bool first_start;
|
2007-01-18 08:42:53 +00:00
|
|
|
|
2008-07-14 08:35:00 +00:00
|
|
|
friend FuncStatus getStatus(FuncRequest const & action);
|
|
|
|
friend void dispatch(FuncRequest const & action);
|
2010-01-25 15:14:41 +00:00
|
|
|
friend void dispatch(FuncRequest const & action, DispatchResult & dr);
|
2010-11-13 11:55:05 +00:00
|
|
|
friend std::vector<std::string> & theFilesToLoad();
|
2008-07-14 08:35:00 +00:00
|
|
|
friend BufferList & theBufferList();
|
|
|
|
friend Server & theServer();
|
|
|
|
friend ServerSocket & theServerSocket();
|
|
|
|
friend Converters & theConverters();
|
|
|
|
friend Converters & theSystemConverters();
|
2010-03-29 21:31:17 +00:00
|
|
|
friend Messages const & getMessages(std::string const & language);
|
|
|
|
friend Messages const & getGuiMessages();
|
2008-07-14 08:35:00 +00:00
|
|
|
friend KeyMap & theTopLevelKeymap();
|
2007-01-18 08:42:53 +00:00
|
|
|
friend Movers & theMovers();
|
2012-10-21 18:17:26 +00:00
|
|
|
friend Mover const & getMover(std::string const & fmt);
|
2007-01-18 08:42:53 +00:00
|
|
|
friend void setMover(std::string const & fmt, std::string const & command);
|
|
|
|
friend Movers & theSystemMovers();
|
2007-01-23 12:38:20 +00:00
|
|
|
friend frontend::Application * theApp();
|
2008-07-14 08:35:00 +00:00
|
|
|
friend Session & theSession();
|
2012-08-16 11:23:39 +00:00
|
|
|
friend LaTeXFonts & theLaTeXFonts();
|
2008-07-14 08:35:00 +00:00
|
|
|
friend CmdDef & theTopLevelCmdDef();
|
2009-03-29 21:18:16 +00:00
|
|
|
friend SpellChecker * theSpellChecker();
|
2009-08-08 17:05:31 +00:00
|
|
|
friend void setSpellChecker();
|
2008-07-14 08:35:00 +00:00
|
|
|
friend void emergencyCleanup();
|
|
|
|
friend void execBatchCommands();
|
2008-07-14 11:33:04 +00:00
|
|
|
friend void lyx_exit(int exit_code);
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2008-07-14 11:30:51 +00:00
|
|
|
|
|
|
|
/// in the case of failure
|
|
|
|
void emergencyCleanup();
|
|
|
|
/// Try to exit LyX properly.
|
|
|
|
/// \p exit_code is 0 by default, if a non zero value is passed,
|
|
|
|
/// emergencyCleanup() will be called before exiting.
|
2008-07-14 11:33:04 +00:00
|
|
|
void lyx_exit(int exit_code);
|
2008-07-14 11:30:51 +00:00
|
|
|
/// Execute batch commands if available.
|
|
|
|
void execBatchCommands();
|
|
|
|
|
2010-02-09 16:11:13 +00:00
|
|
|
///
|
|
|
|
FuncStatus getStatus(FuncRequest const & action);
|
|
|
|
|
|
|
|
///
|
|
|
|
void dispatch(FuncRequest const & action);
|
|
|
|
|
2010-04-08 12:39:41 +00:00
|
|
|
///
|
|
|
|
void dispatch(FuncRequest const & action, DispatchResult & dr);
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#endif // LYX_H
|