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
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \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
|
|
|
|
|
2002-05-22 01:16:37 +00:00
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
2000-10-02 00:55:02 +00:00
|
|
|
|
#include <boost/utility.hpp>
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
#include <string>
|
2002-05-22 01:16:37 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2007-05-04 17:20:53 +00:00
|
|
|
|
namespace support {
|
|
|
|
|
class FileName;
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-14 21:30:23 +00:00
|
|
|
|
class Buffer;
|
2006-10-11 22:30:31 +00:00
|
|
|
|
class BufferList;
|
2007-01-17 13:18:16 +00:00
|
|
|
|
class Converters;
|
2003-09-04 03:54:04 +00:00
|
|
|
|
class ErrorItem;
|
2007-04-29 13:39:47 +00:00
|
|
|
|
class Inset;
|
2006-10-19 07:20:32 +00:00
|
|
|
|
class LyXFunc;
|
2007-04-29 16:22:46 +00:00
|
|
|
|
class Server;
|
|
|
|
|
class ServerSocket;
|
2003-10-14 21:30:23 +00:00
|
|
|
|
class LyXView;
|
2007-01-14 10:37:14 +00:00
|
|
|
|
class Messages;
|
2007-01-18 08:42:53 +00:00
|
|
|
|
class Mover;
|
|
|
|
|
class Movers;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
class Session;
|
2007-04-27 08:05:58 +00:00
|
|
|
|
class KeyMap;
|
2006-10-12 22:02:45 +00:00
|
|
|
|
|
2006-10-15 21:47:29 +00:00
|
|
|
|
extern bool use_gui;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace frontend { class Application; }
|
1999-10-02 16:21:10 +00:00
|
|
|
|
|
2002-08-07 23:43:38 +00:00
|
|
|
|
/// initial startup
|
2001-04-17 14:00:20 +00:00
|
|
|
|
class LyX : boost::noncopyable {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
public:
|
2006-11-17 15:24:26 +00:00
|
|
|
|
|
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[]);
|
|
|
|
|
|
2003-10-14 21:30:23 +00:00
|
|
|
|
static LyX & ref();
|
|
|
|
|
static LyX const & cref();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-10-19 15:13:49 +00:00
|
|
|
|
/// in the case of failure
|
2003-10-14 21:30:23 +00:00
|
|
|
|
void emergencyCleanup() const;
|
|
|
|
|
|
2006-10-11 22:30:31 +00:00
|
|
|
|
///
|
|
|
|
|
BufferList & bufferList();
|
|
|
|
|
BufferList const & bufferList() const;
|
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
Session & session();
|
|
|
|
|
Session const & session() const;
|
2006-10-19 07:20:32 +00:00
|
|
|
|
///
|
|
|
|
|
LyXFunc & lyxFunc();
|
|
|
|
|
LyXFunc const & lyxFunc() const;
|
|
|
|
|
///
|
2007-04-29 16:22:46 +00:00
|
|
|
|
Server & server();
|
|
|
|
|
Server const & server() const;
|
2006-10-19 07:20:32 +00:00
|
|
|
|
///
|
2007-04-29 16:22:46 +00:00
|
|
|
|
ServerSocket & socket();
|
|
|
|
|
ServerSocket const & socket() const;
|
2006-10-19 07:20:32 +00:00
|
|
|
|
|
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
frontend::Application & application();
|
|
|
|
|
frontend::Application const & application() const;
|
2006-10-19 07:20:32 +00:00
|
|
|
|
|
|
|
|
|
///
|
2007-04-27 08:05:58 +00:00
|
|
|
|
KeyMap & topLevelKeymap();
|
|
|
|
|
KeyMap const & topLevelKeymap() const;
|
2007-05-28 22:27:45 +00:00
|
|
|
|
|
2007-01-17 13:18:16 +00:00
|
|
|
|
///
|
|
|
|
|
Converters & converters();
|
|
|
|
|
Converters & systemConverters();
|
2003-10-14 21:30:23 +00:00
|
|
|
|
|
2007-01-14 10:37:14 +00:00
|
|
|
|
///
|
|
|
|
|
Messages & getMessages(std::string const & language);
|
|
|
|
|
///
|
|
|
|
|
Messages & getGuiMessages();
|
|
|
|
|
///
|
|
|
|
|
void setGuiLanguage(std::string const & language);
|
|
|
|
|
|
2006-11-18 17:47:12 +00:00
|
|
|
|
///
|
2006-10-21 09:45:11 +00:00
|
|
|
|
LyXView * newLyXView();
|
2003-10-14 21:30:23 +00:00
|
|
|
|
|
|
|
|
|
/** redraw \c inset in all the BufferViews in which it is currently
|
|
|
|
|
* visible. If successful return a pointer to the owning Buffer.
|
|
|
|
|
*/
|
2007-04-29 13:39:47 +00:00
|
|
|
|
Buffer const * const updateInset(Inset const *) const;
|
2001-12-10 15:59:20 +00:00
|
|
|
|
|
2007-07-17 09:20:39 +00:00
|
|
|
|
void hideDialogs(std::string const & name, Inset * inset) const;
|
|
|
|
|
|
2006-11-26 02:18:32 +00:00
|
|
|
|
/// Execute batch commands if available.
|
|
|
|
|
void execBatchCommands();
|
|
|
|
|
|
2007-05-04 17:20:53 +00:00
|
|
|
|
///
|
|
|
|
|
void addFileToLoad(support::FileName const &);
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
private:
|
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[]);
|
|
|
|
|
|
|
|
|
|
/// Load files passed at command-line.
|
|
|
|
|
/**
|
|
|
|
|
This method is used only in non-GUI mode.
|
|
|
|
|
*/
|
|
|
|
|
void loadFiles();
|
2006-10-17 08:36:04 +00:00
|
|
|
|
|
2006-12-04 16:54:32 +00:00
|
|
|
|
/// Create a View, load files and restore GUI Session.
|
|
|
|
|
void restoreGuiSession();
|
2006-10-17 08:36:04 +00:00
|
|
|
|
|
|
|
|
|
/// Initialize RC font for the GUI.
|
|
|
|
|
void initGuiFont();
|
|
|
|
|
|
2002-08-07 23:43:38 +00:00
|
|
|
|
/// initial LyX set up
|
2006-07-05 17:01:26 +00:00
|
|
|
|
bool init();
|
2002-08-07 23:43:38 +00:00
|
|
|
|
/// set up the default key bindings
|
2007-04-27 08:05:58 +00:00
|
|
|
|
void defaultKeyBindings(KeyMap * kbmap);
|
2002-08-07 23:43:38 +00:00
|
|
|
|
/// set up the default dead key bindings if requested
|
2007-04-27 08:05:58 +00:00
|
|
|
|
void deadKeyBindings(KeyMap * kbmap);
|
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
|
2006-07-05 17:01:26 +00:00
|
|
|
|
bool readRcFile(std::string const & name);
|
2002-08-07 23:43:38 +00:00
|
|
|
|
/// read the given ui (menu/toolbar) file
|
2007-01-19 14:30:30 +00:00
|
|
|
|
bool readUIFile(std::string const & name, bool include = 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
|
|
|
|
|
2002-08-07 23:43:38 +00:00
|
|
|
|
/// has this user started lyx for the first time?
|
|
|
|
|
bool first_start;
|
|
|
|
|
/// the parsed command line batch command if any
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string batch_command;
|
2003-10-14 21:30:23 +00:00
|
|
|
|
|
2006-10-19 07:20:32 +00:00
|
|
|
|
/// Use the Pimpl idiom to hide the internals.
|
|
|
|
|
struct Singletons;
|
|
|
|
|
boost::scoped_ptr<Singletons> pimpl_;
|
2007-01-18 08:42:53 +00:00
|
|
|
|
|
|
|
|
|
friend Movers & theMovers();
|
|
|
|
|
friend Mover const & getMover(std::string const & fmt);
|
|
|
|
|
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();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#endif // LYX_H
|