#include <config.h>
-#include "debug.h"
+#include "support/debug.h"
#include <aspell.h>
#include "Buffer.h"
#include "BufferParams.h"
#include "buffer_funcs.h"
-#include "gettext.h"
#include "InsetIterator.h"
#include "Paragraph.h"
#include "insets/InsetBibtex.h"
#include "insets/InsetInclude.h"
-#include "support/lstrings.h"
#include "support/docstream.h"
+#include "support/gettext.h"
+#include "support/lstrings.h"
#include "boost/regex.hpp"
#include "Chktex.h"
#include "Converter.h"
#include "Counters.h"
-#include "debug.h"
#include "DocIterator.h"
#include "EmbeddedFiles.h"
#include "Encoding.h"
#include "Exporter.h"
#include "Format.h"
#include "FuncRequest.h"
-#include "gettext.h"
#include "InsetIterator.h"
#include "InsetList.h"
#include "Language.h"
#include "graphics/Previews.h"
-#include "support/types.h"
-#include "support/lyxalgo.h"
+#include "support/convert.h"
+#include "support/debug.h"
#include "support/FileFilterList.h"
#include "support/filetools.h"
#include "support/Forkedcall.h"
+#include "support/gettext.h"
#include "support/gzstream.h"
#include "support/lstrings.h"
+#include "support/lyxalgo.h"
#include "support/lyxlib.h"
#include "support/os.h"
#include "support/Path.h"
#include "support/textutils.h"
-#include "support/convert.h"
+#include "support/types.h"
#if !defined (HAVE_FORK)
# define fork() -1
#include "Author.h"
#include "Buffer.h"
#include "BufferParams.h"
-#include "debug.h"
-#include "gettext.h"
#include "Session.h"
#include "LyX.h"
#include "output_latex.h"
#include "frontends/alert.h"
+#include "support/debug.h"
#include "support/filetools.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/Package.h"
#include "buffer_funcs.h"
#include "Bullet.h"
#include "Color.h"
-#include "debug.h"
#include "Encoding.h"
-#include "gettext.h"
#include "Language.h"
#include "LaTeXFeatures.h"
-#include "Messages.h"
#include "ModuleList.h"
#include "Font.h"
#include "Lexer.h"
#include "PDFOptions.h"
#include "frontends/alert.h"
+
#include "insets/InsetListingsParams.h"
#include "support/convert.h"
+#include "support/debug.h"
#include "support/docstream.h"
#include "support/FileName.h"
#include "support/filetools.h"
+#include "support/gettext.h"
+#include "support/Messages.h"
#include "support/Translator.h"
#include "support/lstrings.h"
#include "CoordCache.h"
#include "Cursor.h"
#include "CutAndPaste.h"
-#include "debug.h"
#include "DispatchResult.h"
#include "EmbeddedFiles.h"
#include "ErrorList.h"
#include "FloatList.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
#include "Intl.h"
#include "InsetIterator.h"
#include "Language.h"
#include "graphics/Previews.h"
#include "support/convert.h"
-#include "support/lstrings.h"
+#include "support/debug.h"
#include "support/FileFilterList.h"
#include "support/filetools.h"
+#include "support/gettext.h"
+#include "support/lstrings.h"
#include "support/Package.h"
#include "support/types.h"
Bullet::Bullet(int f, int c, int s)
: font(f), character(c), size(s), user_text(0)
{
- if (f < MIN || f >= FONTMAX) {
+ if (f < MIN || f >= FONTMAX)
font = MIN;
- }
- if (c < MIN || c >= CHARMAX) {
+ if (c < MIN || c >= CHARMAX)
character = MIN;
- }
- if (s < MIN || s >= SIZEMAX) {
+ if (s < MIN || s >= SIZEMAX)
size = MIN;
- }
generateText();
testInvariant();
}
void Bullet::setCharacter(int c)
{
- if (c < MIN || c >= CHARMAX) {
+ if (c < MIN || c >= CHARMAX)
character = MIN;
- } else {
+ else
character = c;
- }
user_text = 0;
testInvariant();
}
void Bullet::setFont(int f)
{
- if (f < MIN || f >= FONTMAX) {
+ if (f < MIN || f >= FONTMAX)
font = MIN;
- } else {
+ else
font = f;
- }
user_text = 0;
testInvariant();
}
void Bullet::setSize(int s)
{
- if (s < MIN || s >= SIZEMAX) {
+ if (s < MIN || s >= SIZEMAX)
size = MIN;
- } else {
+ else
size = s;
- }
user_text = 0;
testInvariant();
}
docstring const & Bullet::getText() const
{
- if (user_text == 0) {
+ if (user_text == 0)
generateText();
- }
return text;
}
if (b1.user_text && b2.user_text) {
/* both have valid text */
- if (b1.text == b2.text) {
+ if (b1.text == b2.text)
result = true;
- }
- } else if (((b1.character == b2.character) &&
- (b1.font == b2.font)) &&
- (b1.size == b2.size)) {
+ } else if (b1.character == b2.character && b1.font == b2.font &&
+ b1.size == b2.size) {
result = true;
}
return result;
if ((font >= 0) && (character >= 0)) {
text = bulletEntry(font, character);
- if (size >= 0) {
+ if (size >= 0)
text = bulletSize(size) + text;
- }
user_text = -1;
// text is now defined and doesn't need to be recalculated
// unless font/character or text is modified
#include <config.h>
#include "Changes.h"
-#include "debug.h"
#include "Author.h"
#include "BufferParams.h"
#include "LaTeXFeatures.h"
+#include "support/debug.h"
+
#include <boost/assert.hpp>
#include <ostream>
#include <config.h>
#include "Chktex.h"
-#include "gettext.h"
#include "LaTeX.h" // TeXErrors
#include "support/convert.h"
#include "support/docstream.h"
#include "support/filetools.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/Systemcall.h"
#include "CmdDef.h"
#include "LyXAction.h"
-#include "debug.h"
#include "Lexer.h"
+#include "support/debug.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "Color.h"
-#include "debug.h"
-#include "gettext.h"
-
+#include "support/debug.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include <boost/assert.hpp>
#include "Buffer.h"
#include "buffer_funcs.h"
#include "BufferParams.h"
-#include "debug.h"
#include "ErrorList.h"
#include "Format.h"
-#include "gettext.h"
#include "Language.h"
#include "LaTeX.h"
#include "Mover.h"
#include "frontends/alert.h"
+#include "support/debug.h"
#include "support/filetools.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
#include "support/os.h"
#include "Lexer.h"
#include "LyXRC.h"
#include "Mover.h"
-#include "debug.h"
#include "support/convert.h"
+#include "support/debug.h"
#include "support/filetools.h"
#include "support/lyxlib.h"
#include "support/lyxtime.h"
#include "CoordCache.h"
-#include "debug.h"
#include "Text.h"
+#include "support/debug.h"
#include "support/docstring.h"
#include "insets/Inset.h"
#include <config.h>
#include "Counters.h"
-#include "debug.h"
-#include "support/lstrings.h"
#include "support/convert.h"
+#include "support/debug.h"
+#include "support/lstrings.h"
#include <boost/assert.hpp>
#include "Cursor.h"
#include "CoordCache.h"
#include "CutAndPaste.h"
-#include "debug.h"
#include "DispatchResult.h"
#include "Encoding.h"
#include "FuncRequest.h"
#include "ParIterator.h"
#include "TextMetrics.h"
+#include "support/debug.h"
#include "support/docstream.h"
#include "insets/InsetTabular.h"
#include "CursorSlice.h"
-#include "debug.h"
#include "Text.h"
#include "Paragraph.h"
+#include "support/debug.h"
+
#include "insets/Inset.h"
#include "mathed/InsetMath.h"
#include "BufferView.h"
#include "Changes.h"
#include "Cursor.h"
-#include "debug.h"
#include "ErrorList.h"
#include "FuncRequest.h"
-#include "gettext.h"
#include "InsetIterator.h"
#include "InsetList.h"
#include "Language.h"
#include "mathed/InsetMath.h"
#include "mathed/MathSupport.h"
+#include "support/debug.h"
+#include "support/docstream.h"
+#include "support/gettext.h"
#include "support/limited_stack.h"
#include "support/lstrings.h"
-#include "support/docstream.h"
#include "frontends/Clipboard.h"
#include "frontends/Selection.h"
#include "DepTable.h"
-#include "debug.h"
-
+#include "support/debug.h"
#include "support/lyxlib.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "DocIterator.h"
-#include "debug.h"
+#include "support/debug.h"
#include "InsetList.h"
#include "Paragraph.h"
#include "Text.h"
#include <config.h>
#include "EmbeddedFiles.h"
+
#include "Buffer.h"
#include "BufferParams.h"
-#include "Paragraph.h"
-#include "InsetIterator.h"
-#include "debug.h"
-#include "gettext.h"
+#include "ErrorList.h"
#include "Format.h"
+#include "InsetIterator.h"
#include "Lexer.h"
-#include "ErrorList.h"
+#include "LyX.h"
+#include "Paragraph.h"
+#include "Session.h"
#include "frontends/alert.h"
+#include "support/debug.h"
#include "support/filetools.h"
+#include "support/gettext.h"
#include "support/convert.h"
#include "support/lyxlib.h"
#include "support/lstrings.h"
-#include "LyX.h"
-#include "Session.h"
-
#include <sstream>
#include <fstream>
#include <utility>
#include "Encoding.h"
-#include "debug.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "LyXRC.h"
+#include "support/debug.h"
#include "support/FileName.h"
#include "support/lstrings.h"
#include "support/unicode.h"
#include "Exporter.h"
-#include "gettext.h"
#include "Mover.h"
+
#include "frontends/alert.h"
#include "support/filetools.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/Package.h"
#include "BufferParams.h" // stateText
#include "Color.h"
-#include "debug.h"
#include "Encoding.h"
-#include "gettext.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "OutputParams.h"
#include "support/convert.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
using std::endl;
#include "FontInfo.h"
-#include "debug.h"
+#include "support/debug.h"
#include <ostream>
else if (org == FONT_OFF)
return FONT_ON;
else {
- lyxerr <<"Font::setMisc: Need state"
- " FONT_ON or FONT_OFF to toggle. Setting to FONT_ON" << endl;
+ LYXERR0("Font::setMisc: Need state"
+ " FONT_ON or FONT_OFF to toggle. Setting to FONT_ON");
return FONT_ON;
}
} else if (newfont == FONT_IGNORE)
*
*/
-
#include <config.h>
#include "FontIterator.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "LyXRC.h"
-#include "debug.h"
-#include "gettext.h"
#include "ServerSocket.h"
#include "frontends/alert.h" //to be removed?
+#include "support/debug.h"
#include "support/filetools.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/os.h"
#include "support/Systemcall.h"
#include "ISpell.h"
#include "BufferParams.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Encoding.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Language.h"
#include "LyXRC.h"
#include "WordLangTuple.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "BranchList.h"
-#include "debug.h"
+#include "support/debug.h"
#include "insets/InsetBranch.h"
#include <config.h>
#include "Intl.h"
-#include "debug.h"
+#include "support/debug.h"
#include "LyXRC.h"
#include "KeyMap.h"
-#include "debug.h"
+#include "support/debug.h"
#include "KeySequence.h"
#include "LyXAction.h"
#include "Lexer.h"
#include "KeySequence.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "KeyMap.h"
#include "lfuns.h"
#include "BufferList.h"
#include "LaTeX.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LyXRC.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DepTable.h"
#include "support/filetools.h"
#include "Color.h"
#include "BufferParams.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Encoding.h"
#include "Floating.h"
#include "FloatList.h"
#include "Language.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Encoding.h"
#include "Lexer.h"
#include "LyXRC.h"
#include "Layout.h"
#include "TextClass.h"
#include "Lexer.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/lstrings.h"
#include "Lexer.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/convert.h"
#include "support/filetools.h"
#include "LyX.h"
-#include "Color.h"
-#include "ConverterCache.h"
-#include "Buffer.h"
#include "buffer_funcs.h"
+#include "Buffer.h"
#include "BufferList.h"
+#include "CmdDef.h"
+#include "Color.h"
+#include "ConverterCache.h"
#include "Converter.h"
#include "CutAndPaste.h"
-#include "debug.h"
#include "Encoding.h"
#include "ErrorList.h"
#include "Format.h"
-#include "gettext.h"
#include "KeyMap.h"
-#include "CmdDef.h"
#include "Language.h"
-#include "Session.h"
+#include "Lexer.h"
#include "LyXAction.h"
#include "LyXFunc.h"
-#include "Lexer.h"
#include "LyXRC.h"
+#include "MenuBackend.h"
#include "ModuleList.h"
+#include "Mover.h"
#include "Server.h"
#include "ServerSocket.h"
+#include "Session.h"
#include "TextClassList.h"
-#include "MenuBackend.h"
-#include "Messages.h"
-#include "Mover.h"
#include "ToolbarBackend.h"
#include "frontends/alert.h"
#include "frontends/Application.h"
+#include "support/debug.h"
#include "support/environment.h"
+#include "support/ExceptionMessage.h"
#include "support/filetools.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
-#include "support/ExceptionMessage.h"
+#include "support/Messages.h"
#include "support/os.h"
#include "support/Package.h"
#include "support/Path.h"
#include "LyXAction.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
#include "support/lstrings.h"
#include "Converter.h"
#include "Cursor.h"
#include "CutAndPaste.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "Encoding.h"
#include "ErrorList.h"
#include "Format.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "InsetIterator.h"
#include "Intl.h"
#include "KeyMap.h"
#include "LyXRC.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Color.h"
#include "Converter.h"
#include "Format.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Session.h"
#include "Lexer.h"
#include "FontEnums.h"
#include "LyXVC.h"
#include "VCBackend.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Buffer.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "frontends/alert.h"
Cursor.cpp \
CursorSlice.cpp \
CutAndPaste.cpp \
- debug.cpp \
DepTable.cpp \
DocIterator.cpp \
EmbeddedFiles.cpp \
Format.cpp \
FuncRequest.cpp \
FuncStatus.cpp \
- gettext.cpp \
Graph.cpp \
InsetIterator.cpp \
InsetList.cpp \
LyXRC.cpp \
LyXVC.cpp \
MenuBackend.cpp \
- Messages.cpp \
MetricsInfo.cpp \
ModuleList.cpp \
Mover.cpp \
Cursor.h \
CursorSlice.h \
CutAndPaste.h \
- debug.h \
DepTable.h \
DispatchResult.h \
DocIterator.h \
Format.h \
FuncRequest.h \
FuncStatus.h \
- gettext.h \
Graph.h \
InsetIterator.h \
InsetList.h \
LyXRC.h \
LyXVC.h \
MenuBackend.h \
- Messages.h \
MetricsInfo.h \
ModuleList.h \
Mover.h \
#include "BufferParams.h"
#include "Converter.h"
#include "CutAndPaste.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Floating.h"
#include "FloatList.h"
#include "Format.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "KeyMap.h"
#include "Session.h"
#include "LyXAction.h"
+++ /dev/null
-/* \file Messages.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "Messages.h"
-
-#include "debug.h"
-
-#include "support/docstring.h"
-#include "support/environment.h"
-#include "support/Package.h"
-#include "support/unicode.h"
-
-#include <boost/current_function.hpp>
-
-#include <cerrno>
-
-using std::map;
-using std::string;
-
-namespace {
-
-using lyx::docstring;
-using lyx::from_ascii;
-
-void cleanTranslation(docstring & trans)
-{
- /*
- Some english words have different translations, depending on
- context. In these cases the original string is augmented by
- context information (e.g. "To:[[as in 'From page x to page
- y']]" and "To:[[as in 'From format x to format y']]". This
- means that we need to filter out everything in double square
- brackets at the end of the string, otherwise the user sees
- bogus messages. If we are unable to honour the request we
- just return what we got in.
- */
- docstring::size_type const pos1 = trans.find(from_ascii("[["));
- if (pos1 != docstring::npos) {
- docstring::size_type const pos2
- = trans.find(from_ascii("]]"), pos1);
- if (pos2 != docstring::npos)
- trans.erase(pos1, pos2 - pos1 + 2);
- }
-}
-
-}
-
-
-#ifdef ENABLE_NLS
-
-# ifdef HAVE_LOCALE_H
-# include <locale.h>
-# endif
-
-# if HAVE_GETTEXT
-# include <libintl.h> // use the header already in the system *EK*
-# else
-# include "../intl/libintl.h"
-# endif
-
-namespace lyx {
-
-using support::package;
-using support::getEnv;
-using support::setEnv;
-
-
-// This version use the traditional gettext.
-Messages::Messages(string const & l)
- : lang_(l), warned_(false)
-{
- // strip off any encoding suffix, i.e., assume 8-bit po files
- string::size_type i = lang_.find(".");
- lang_ = lang_.substr(0, i);
- LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
- << ": language(" << lang_ << ")");
-}
-
-
-void Messages::init()
-{
- errno = 0;
- string const locale_dir = package().locale_dir().toFilesystemEncoding();
- char const * c = bindtextdomain(PACKAGE, locale_dir.c_str());
- int e = errno;
- if (e) {
- LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << '\n'
- << "Error code: " << errno << '\n'
- << "Directory : " << package().locale_dir().absFilename() << '\n'
- << "Rtn value : " << c);
- }
-
- if (!bind_textdomain_codeset(PACKAGE, ucs4_codeset)) {
- LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << '\n'
- << "Error code: " << errno << '\n'
- << "Codeset : " << ucs4_codeset << '\n');
- }
-
- textdomain(PACKAGE);
-}
-
-
-docstring const Messages::get(string const & m) const
-{
- if (m.empty())
- return docstring();
-
- // Look for the translated string in the cache.
- TranslationCache::iterator it = cache_.find(m);
- if (it != cache_.end())
- return it->second;
-
- // The string was not found, use gettext to generate it
-
- string const oldLANGUAGE = getEnv("LANGUAGE");
- string const oldLC_ALL = getEnv("LC_ALL");
- if (!lang_.empty()) {
- // This GNU extension overrides any language locale
- // wrt gettext.
- setEnv("LANGUAGE", lang_);
- // However, setting LANGUAGE does nothing when the
- // locale is "C". Therefore we set the locale to
- // something that is believed to exist on most
- // systems. The idea is that one should be able to
- // load German documents even without having de_DE
- // installed.
- setEnv("LC_ALL", "en_US");
-#ifdef HAVE_LC_MESSAGES
- setlocale(LC_MESSAGES, "");
-#endif
- }
-
- char const * m_c = m.c_str();
- char const * trans_c = gettext(m_c);
- docstring trans;
- if (!trans_c)
- LYXERR0("Undefined result from gettext");
- else if (trans_c == m_c) {
- LYXERR(Debug::DEBUG, "Same as entered returned");
- trans = from_ascii(m);
- } else {
- LYXERR(Debug::DEBUG, "We got a translation");
- // m is actually not a char const * but ucs4 data
- trans = reinterpret_cast<char_type const *>(trans_c);
- }
-
- cleanTranslation(trans);
-
- // Reset environment variables as they were.
- if (!lang_.empty()) {
- // Reset everything as it was.
- setEnv("LANGUAGE", oldLANGUAGE);
- setEnv("LC_ALL", oldLC_ALL);
-#ifdef HAVE_LC_MESSAGES
- setlocale(LC_MESSAGES, "");
-#endif
- }
-
- std::pair<TranslationCache::iterator, bool> result =
- cache_.insert(std::make_pair(m, trans));
-
- BOOST_ASSERT(result.second);
-
- return result.first->second;
-}
-
-} // namespace lyx
-
-#else // ENABLE_NLS
-// This is the dummy variant.
-
-namespace lyx {
-
-Messages::Messages(string const & l) {}
-
-void Messages::init()
-{
-}
-
-
-docstring const Messages::get(string const & m) const
-{
- docstring trans = from_ascii(m);
- cleanTranslation(trans);
- return trans;
-}
-
-} // namespace lyx
-
-#endif
-
-#if 0
-
--#include <locale>
-
-namespace lyx {
-
-// This version of the Pimpl utilizes the message capability of
-// libstdc++ that is distributed with GNU G++.
-class Messages::Pimpl {
-public:
- typedef std::messages<char>::catalog catalog;
-
- Pimpl(string const & l)
- : lang_(l),
- loc_gl(lang_.c_str()),
- mssg_gl(std::use_facet<std::messages<char> >(loc_gl))
- {
- //LYXERR("Messages: language(" << l << ") in dir(" << dir << ")");
-
- string const locale_dir = package().locale_dir().toFilesystemEncoding();
- cat_gl = mssg_gl.open(PACKAGE, loc_gl, locale_dir.c_str());
-
- }
-
- ~Pimpl()
- {
- mssg_gl.close(cat_gl);
- }
-
- docstring const get(string const & msg) const
- {
- return mssg_gl.get(cat_gl, 0, 0, msg);
- }
-private:
- ///
- string lang_;
- ///
- std::locale loc_gl;
- ///
- std::messages<char> const & mssg_gl;
- ///
- catalog cat_gl;
-};
-
-} // namespace lyx
-
-#endif
+++ /dev/null
-// -*- C++ -*-
-/* \file Messages.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef MESSAGES_H
-#define MESSAGES_H
-
-#include "support/docstring.h"
-
-#include <map>
-#include <string>
-
-namespace lyx {
-
-///
-class Messages {
-public:
- /// messages in the language \p l.
- /// If \p l is empty, the language will be defined by the environment.
- Messages(std::string const & l = std::string());
- ///
- docstring const get(std::string const & msg) const;
- ///
- static void init();
-private:
- ///
- std::string lang_;
- /// Did we warn about unavailable locale already?
- mutable bool warned_;
- ///
- typedef std::map<std::string, docstring> TranslationCache;
- /// Internal cache for gettext translated strings.
- /// This is needed for performance reason within \c updateLabels()
- /// under Windows.
- mutable TranslationCache cache_;
-};
-
-/// Access to the unique Messages object for the passed \p language.
-/// Implementation is in LyX.cpp.
-extern Messages & getMessages(std::string const & language);
-/// Access to the unique Messages object used for GUI element.
-/// Implementation is in LyX.cpp.
-extern Messages & getGuiMessages();
-
-} // namespace lyx
-
-#endif
#include "ModuleList.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Lexer.h"
#include "support/filetools.h"
#include "support/convert.h"
#include "support/lstrings.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Lexer.h"
#include <sstream>
#include <config.h>
-#include "debug.h"
+#include "support/debug.h"
#define USE_ORIGINAL_MANAGER_FUNCS 1
// new aspell pspell missing extern "C"
#include "Changes.h"
#include "Counters.h"
#include "Encoding.h"
-#include "debug.h"
-#include "gettext.h"
#include "InsetList.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include "Font.h"
#include "FontList.h"
#include "LyXRC.h"
-#include "Messages.h"
#include "OutputParams.h"
#include "output_latex.h"
#include "paragraph_funcs.h"
#include "insets/InsetBibitem.h"
#include "insets/InsetLabel.h"
+#include "support/convert.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
+#include "support/Messages.h"
#include "support/textutils.h"
-#include "support/convert.h"
#include "support/unicode.h"
#include <sstream>
#include "BufferView.h"
#include "Counters.h"
#include "Encoding.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include "Layout.h"
#include "ParagraphParameters.h"
#include "Buffer.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Layout.h"
#include "Lexer.h"
#include "Text.h"
#include <config.h>
#include "Row.h"
-#include "debug.h"
+#include "support/debug.h"
namespace lyx {
#include <config.h>
#include "Server.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
#include "LyXAction.h"
#include "LyXFunc.h"
#include "ServerSocket.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
#include "LyXAction.h"
#include "LyXFunc.h"
#include <config.h>
#include "Session.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/Package.h"
#include "support/filetools.h"
#include <config.h>
#include "SpellBase.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "support/docstring.h"
#include <config.h>
#include "TexRow.h"
-#include "debug.h"
+#include "support/debug.h"
#include <algorithm>
#include "Cursor.h"
#include "ParIterator.h"
#include "CutAndPaste.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "Encoding.h"
#include "ErrorList.h"
#include "FuncRequest.h"
#include "factory.h"
#include "FontIterator.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Language.h"
#include "Length.h"
#include "Lexer.h"
#include "Changes.h"
#include "Cursor.h"
#include "CutAndPaste.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "ErrorList.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Language.h"
#include "Layout.h"
#include "Lexer.h"
#include "BufferView.h"
#include "Cursor.h"
#include "CutAndPaste.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "ErrorList.h"
#include "factory.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "InsetList.h"
#include "Intl.h"
#include "Language.h"
#include "Color.h"
#include "Counters.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "Floating.h"
#include "FloatList.h"
#include "Layout.h"
#include "TextClassList.h"
#include "TextClass.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Lexer.h"
#include "support/filetools.h"
#include "CoordCache.h"
#include "Cursor.h"
#include "CutAndPaste.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FontIterator.h"
#include "FuncRequest.h"
#include "InsetList.h"
#include "Thesaurus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include "Buffer.h"
#include "BufferParams.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FloatList.h"
#include "FuncRequest.h"
#include "InsetList.h"
#include "ToolbarBackend.h"
#include "FuncRequest.h"
#include "Lexer.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "LyXAction.h"
#include "support/lstrings.h"
#include "BufferView.h"
#include "Cursor.h"
#include "CutAndPaste.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Lexer.h"
#include "LyXRC.h"
#include "Text.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "buffer_funcs.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DocIterator.h"
#include "Paragraph.h"
#include "ParagraphList.h"
#include <config.h>
#include "VCBackend.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Buffer.h"
#include "support/Path.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "BufferView.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Length.h"
#include "Text.h"
#include "TextMetrics.h" // for defaultRowHeight()
#include <config.h>
#include "LyX.h"
-#include "debug.h"
+
+#include "support/debug.h"
#include "support/lyxlib.h"
#include <boost/assert.hpp>
#include "Buffer.h"
#include "BufferList.h"
#include "BufferParams.h"
-#include "debug.h"
#include "DocIterator.h"
#include "Counters.h"
#include "ErrorList.h"
#include "Floating.h"
#include "FloatList.h"
-#include "gettext.h"
#include "InsetList.h"
#include "InsetIterator.h"
#include "Language.h"
#include "insets/InsetBibitem.h"
#include "insets/InsetInclude.h"
+#include "support/debug.h"
#include "support/filetools.h"
-#include "support/lyxlib.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
+#include "support/lyxlib.h"
namespace lyx {
#include <config.h>
#include "Messages.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/filetools.h"
#include "support/Package.h"
#include "support/unicode.h"
#include <config.h>
#include "LyX.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/lyxlib.h"
#include <boost/assert.hpp>
#include <config.h>
-#include "debug.h"
+#include "support/debug.h"
#include "support/FileName.h"
#include "support/unicode.h"
#include "support/lstrings.h"
#include <config.h>
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "support/convert.h"
#include "support/lstrings.h"
#include <config.h>
-#include "gettext.h"
+#include "support/gettext.h"
#include "Messages.h"
+++ /dev/null
-/**
- * \file debug.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- * \author Jean-Marc Lasgouttes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "debug.h"
-#include "gettext.h"
-
-#include "support/convert.h"
-#include "support/lstrings.h"
-#include "support/FileName.h"
-
-#include <iostream>
-#include <iomanip>
-
-using std::setw;
-using std::string;
-using std::ostream;
-
-
-namespace lyx {
-
-using support::ascii_lowercase;
-using support::bformat;
-using support::isStrInt;
-
-namespace {
-
-struct ErrorItem {
- Debug::Type level;
- char const * name;
- char const * desc;
-};
-
-
-ErrorItem errorTags[] = {
- { Debug::NONE, "none", N_("No debugging message")},
- { Debug::INFO, "info", N_("General information")},
- { Debug::INIT, "init", N_("Program initialisation")},
- { Debug::KEY, "key", N_("Keyboard events handling")},
- { Debug::GUI, "gui", N_("GUI handling")},
- { Debug::PARSER, "parser", N_("Lyxlex grammar parser")},
- { Debug::LYXRC, "lyxrc", N_("Configuration files reading")},
- { Debug::KBMAP, "kbmap", N_("Custom keyboard definition")},
- { Debug::LATEX, "latex", N_("LaTeX generation/execution")},
- { Debug::MATHED, "mathed", N_("Math editor")},
- { Debug::FONT, "font", N_("Font handling")},
- { Debug::TCLASS, "tclass", N_("Textclass files reading")},
- { Debug::LYXVC, "lyxvc", N_("Version control")},
- { Debug::LYXSERVER, "lyxserver", N_("External control interface")},
- { Debug::ROFF, "roff", N_("Keep *roff temporary files")},
- { Debug::ACTION, "action", N_("User commands")},
- { Debug::LYXLEX, "lyxlex", N_("The LyX Lexxer")},
- { Debug::DEPEND, "depend", N_("Dependency information")},
- { Debug::INSETS, "insets", N_("LyX Insets")},
- { Debug::FILES, "files", N_("Files used by LyX")},
- { Debug::WORKAREA, "workarea", N_("Workarea events")},
- { Debug::INSETTEXT, "insettext", N_("Insettext/tabular messages")},
- { Debug::GRAPHICS, "graphics", N_("Graphics conversion and loading")},
- { Debug::CHANGES, "changes", N_("Change tracking")},
- { Debug::EXTERNAL, "external", N_("External template/inset messages")},
- { Debug::PAINTING, "painting", N_("RowPainter profiling")},
- { Debug::DEBUG, "debug", N_("Developers' general debug messages")},
- { Debug::ANY, "any", N_("All debugging messages")}
-};
-
-
-int const numErrorTags = sizeof(errorTags)/sizeof(errorTags[0]);
-
-} // namespace anon
-
-
-Debug::Type Debug::value(string const & val)
-{
- Type l = Debug::NONE;
- string v = val;
- while (!v.empty()) {
- size_t const st = v.find(',');
- string const tmp = ascii_lowercase(v.substr(0, st));
- if (tmp.empty())
- break;
- // Is it a number?
- if (isStrInt(tmp))
- l |= static_cast<Type>(convert<int>(tmp));
- else
- // Search for an explicit name
- for (int i = 0 ; i < numErrorTags ; ++i)
- if (tmp == errorTags[i].name) {
- l |= errorTags[i].level;
- break;
- }
- if (st == string::npos)
- break;
- v.erase(0, st + 1);
- }
- return l;
-}
-
-
-void Debug::showLevel(ostream & os, Debug::Type level)
-{
- // Show what features are traced
- for (int i = 0; i != numErrorTags; ++i) {
- if (errorTags[i].level != Debug::ANY
- && errorTags[i].level != Debug::NONE
- && errorTags[i].level & level) {
- // avoid to_utf8(_(...)) re-entrance problem
- docstring const s = _(errorTags[i].desc);
- os << to_utf8(bformat(_("Debugging `%1$s' (%2$s)"),
- from_utf8(errorTags[i].name), s))
- << '\n';
- }
- }
- os.flush();
-}
-
-
-void Debug::showTags(ostream & os)
-{
- for (int i = 0; i != numErrorTags ; ++i)
- os << setw(10) << static_cast<unsigned int>(errorTags[i].level)
- << setw(13) << errorTags[i].name
- << " " << to_utf8(_(errorTags[i].desc)) << '\n';
- os.flush();
-}
-
-
-void LyXErr::disable()
-{
- enabled_ = false;
-}
-
-
-void LyXErr::enable()
-{
- enabled_ = true;
-}
-
-
-bool LyXErr::debugging(Debug::Type t) const
-{
- return (dt & t);
-}
-
-
-void LyXErr::endl()
-{
- stream() << std::endl;
-}
-
-
-LyXErr & operator<<(LyXErr & l, void const * t)
-{ l.stream() << t; return l; }
-LyXErr & operator<<(LyXErr & l, char const * t)
-{ l.stream() << t; return l; }
-LyXErr & operator<<(LyXErr & l, char t)
-{ l.stream() << t; return l; }
-LyXErr & operator<<(LyXErr & l, int t)
-{ l.stream() << t; return l; }
-LyXErr & operator<<(LyXErr & l, unsigned int t)
-{ l.stream() << t; return l; }
-LyXErr & operator<<(LyXErr & l, long t)
-{ l.stream() << t; return l; }
-LyXErr & operator<<(LyXErr & l, unsigned long t)
-{ l.stream() << t; return l; }
-LyXErr & operator<<(LyXErr & l, double t)
-{ l.stream() << t; return l; }
-LyXErr & operator<<(LyXErr & l, std::string const & t)
-{ l.stream() << t; return l; }
-LyXErr & operator<<(LyXErr & l, docstring const & t)
-{ l.stream() << to_utf8(t); return l; }
-LyXErr & operator<<(LyXErr & l, support::FileName const & t)
-{ l.stream() << t; return l; }
-LyXErr & operator<<(LyXErr & l, std::ostream &(*t)(std::ostream &))
-{ l.stream() << t; return l; }
-LyXErr & operator<<(LyXErr & l, std::ios_base &(*t)(std::ios_base &))
-{ l.stream() << t; return l; }
-
-
-// The global instance
-LyXErr lyxerr;
-
-
-} // namespace lyx
+++ /dev/null
-// -*- C++ -*-
-/**
- * \file debug.h
- *
- * FIXME: It would be nice if, in lyx::use_gui mode, instead of
- * outputting to the console, we would pipe all messages onto a file
- * and visualise the contents dynamically in a Qt window if needed.
- *
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- * \author Jean-Marc Lasgouttes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef LYXDEBUG_H
-#define LYXDEBUG_H
-
-#include "support/strfwd.h"
-
-
-namespace std {
-
-class ios_base;
-
-template<typename CharT, typename Traits> class basic_streambuf;
-typedef basic_streambuf<char, char_traits<char> > streambuf;
-
-}
-
-
-namespace lyx {
-
-/// This is all the different debug levels that we have.
-namespace Debug {
- ///
- enum Type {
- ///
- NONE = 0,
- ///
- INFO = (1 << 0), // 1
- ///
- INIT = (1 << 1), // 2
- ///
- KEY = (1 << 2), // 4
- ///
- GUI = (1 << 3), // 8
- ///
- PARSER = (1 << 4), // 16
- ///
- LYXRC = (1 << 5), // 32
- ///
- KBMAP = (1 << 6), // 64
- ///
- LATEX = (1 << 7), // 128
- ///
- MATHED = (1 << 8), // 256 // Alejandro, please use this.
- ///
- FONT = (1 << 9), // 512
- ///
- TCLASS = (1 << 10), // 1024
- ///
- LYXVC = (1 << 11), // 2048
- ///
- LYXSERVER = (1 << 12), // 4096
- ///
- ROFF = (1 << 13), // 8192
- ///
- ACTION = (1 << 14), // 16384
- ///
- LYXLEX = (1 << 15),
- ///
- DEPEND = (1 << 16),
- ///
- INSETS = (1 << 17),
- ///
- FILES = (1 << 18),
- ///
- WORKAREA = (1 << 19),
- ///
- INSETTEXT = (1 << 20),
- ///
- GRAPHICS = (1 << 21),
- /// change tracking
- CHANGES = (1 << 22),
- ///
- EXTERNAL = (1 << 23),
- ///
- PAINTING = (1 << 24),
- ///
- DEBUG = (1 << 31),
- ///
- ANY = 0xffffffff
- };
-
- /** A function to convert symbolic string names on debug levels
- to their numerical value.
- */
- Type value(std::string const & val);
-
- /** Display the tags and descriptions of the current debug level
- of ds
- */
- void showLevel(std::ostream & os, Type level);
-
- /** show all the possible tags that can be used for debugging */
- void showTags(std::ostream & os);
-
-} // namespace Debug
-
-
-inline void operator|=(Debug::Type & d1, Debug::Type d2)
-{
- d1 = static_cast<Debug::Type>(d1 | d2);
-}
-
-
-class LyXErr
-{
-public:
- /// Disable the stream completely
- void disable();
- /// Enable the stream after a possible call of disable()
- void enable();
- /// Returns true if t is part of the current debug level.
- bool debugging(Debug::Type t = Debug::ANY) const;
- /// Ends output
- void endl();
- /// Sets stream
- void setStream(std::ostream & os) { stream_ = &os; }
- /// Sets stream
- std::ostream & stream() { return *stream_; }
- /// Sets the debug level to t.
- void level(Debug::Type t) { dt = t; }
- /// Returns the current debug level.
- Debug::Type level() const { return dt; }
- /// Returns stream
- operator std::ostream &() { return *stream_; }
-private:
- /// The current debug level
- Debug::Type dt;
- /// Is the stream enabled?
- bool enabled_;
- /// The real stream
- std::ostream * stream_;
-};
-
-namespace support { class FileName; }
-
-LyXErr & operator<<(LyXErr &, void const *);
-LyXErr & operator<<(LyXErr &, char const *);
-LyXErr & operator<<(LyXErr &, char);
-LyXErr & operator<<(LyXErr &, int);
-LyXErr & operator<<(LyXErr &, unsigned int);
-LyXErr & operator<<(LyXErr &, long);
-LyXErr & operator<<(LyXErr &, unsigned long);
-LyXErr & operator<<(LyXErr &, double);
-LyXErr & operator<<(LyXErr &, std::string const &);
-LyXErr & operator<<(LyXErr &, docstring const &);
-LyXErr & operator<<(LyXErr &, support::FileName const &);
-LyXErr & operator<<(LyXErr &, std::ostream &(*)(std::ostream &));
-LyXErr & operator<<(LyXErr &, std::ios_base &(*)(std::ios_base &));
-
-extern LyXErr lyxerr;
-
-} // namespace lyx
-
-
-#define LYXERR(type, msg) \
- do { \
- if (!lyx::lyxerr.debugging(type)) {} \
- else { lyx::lyxerr << msg; lyx::lyxerr.endl(); } \
- } while (0)
-
-#define LYXERR0(msg) LYXERR(lyx::Debug::ANY, msg)
-
-#endif
#include "Buffer.h"
#include "BufferParams.h"
-#include "debug.h"
#include "FloatList.h"
#include "FuncRequest.h"
#include "Lexer.h"
#include "frontends/alert.h"
+#include "support/debug.h"
#include "support/lstrings.h"
#include "support/ExceptionMessage.h"
#include "Action.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "GuiView.h"
#include <config.h>
#include "ButtonController.h"
-#include "debug.h"
+#include "support/debug.h"
#include "qt_helpers.h"
#include <QPushButton>
#include "ButtonPolicy.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include <list>
#include <config.h>
#include "ButtonPolicy.h"
-#include "debug.h"
+#include "support/debug.h"
#include <iostream>
#include "Dialog.h"
#include "GuiView.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include <QCloseEvent>
#include <QDialog>
#include "Dialog.h"
#include "GuiView.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include <QDockWidget>
#include "LyXFileDialog.h"
#include "qt_helpers.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "support/FileFilterList.h"
#include "support/os.h"
#include "GuiAbout.h"
#include "qt_helpers.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "version.h"
#include "support/filetools.h"
#include "frontends/Application.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include "LyX.h" // for lyx::use_gui
#include "ui_AskForTextUi.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "support/docstring.h"
#include "support/lstrings.h"
#include "Buffer.h"
#include "BufferList.h"
#include "BufferView.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Font.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LyX.h"
#include "LyXFunc.h"
#include "LyXRC.h"
#include "Buffer.h"
#include "BufferParams.h"
-#include "debug.h"
+#include "support/debug.h"
#include "ui_BibtexAddUi.h"
#include "qt_helpers.h"
#include "Validator.h"
#include "LyXRC.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "ButtonPolicy.h"
#include "GuiBox.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LengthCombo.h"
#include "Length.h"
#include "GuiCitation.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "qt_helpers.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "GuiClipboard.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include <QApplication>
#include <QClipboard>
#include "GuiView.h"
#include "qt_helpers.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include <QPixmap>
#include <QCheckBox>
#include "GuiDialog.h"
#include "GuiView.h"
-#include "debug.h"
+#include "support/debug.h"
#include "qt_helpers.h"
#include <QCloseEvent>
#include "Encoding.h"
#include "FloatPlacement.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "GuiBranches.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include <config.h>
#include "GuiERT.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "FuncRequest.h"
#include <QRadioButton>
#include "Buffer.h"
#include "BufferView.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "Text.h"
#include "ParIterator.h"
#include "GuiExternal.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Length.h"
#include "LyXRC.h"
#include "GuiFontLoader.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include "LyXRC.h"
#include "support/convert.h"
#include "GuiGraphics.h"
-#include "debug.h"
+#include "support/debug.h"
#include "LengthCombo.h"
#include "Length.h"
#include "LyXRC.h"
#include "Validator.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "graphics/GraphicsCache.h"
#include "graphics/GraphicsCacheItem.h"
#include "GuiImage.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Format.h"
#include "graphics/GraphicsParams.h"
#include "Buffer.h"
#include "Format.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LyXRC.h"
#include "qt_helpers.h"
#include "GuiIndex.h"
-#include "debug.h"
+#include "support/debug.h"
#include "qt_helpers.h"
#include <QLabel>
#include "qlkey.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Encoding.h"
#include "Language.h"
#include "FuncRequest.h"
#include "insets/InsetListings.h"
#include "insets/InsetListingsParams.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/lstrings.h"
#include "GuiApplication.h"
#include "qt_helpers.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Lexer.h"
#include <QCloseEvent>
#include <config.h>
#include "GuiMath.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
using std::string;
#include "EmptyTable.h"
#include "qt_helpers.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include <sstream>
#include "MenuBackend.h"
-#include "debug.h"
+#include "support/debug.h"
#include <QCursor>
#include <QMenuBar>
#include "GuiNomencl.h"
-#include "debug.h"
+#include "support/debug.h"
#include "qt_helpers.h"
#include <QLabel>
#include "GuiNote.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "insets/InsetNote.h"
#include "GuiApplication.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Language.h"
#include "LyXRC.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
//#include "DialogView.h"
//#include "DockView.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "GuiView.h"
#include "Lexer.h"
#include "Paragraph.h"
#include "ParagraphParameters.h"
#include "GuiView.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include <QCloseEvent>
#include <QDialog>
#include "MenuBackend.h"
#include "support/lstrings.h"
-#include "debug.h"
+#include "support/debug.h"
namespace lyx {
#include "BufferList.h"
#include "Color.h"
#include "ConverterCache.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "GuiFontExample.h"
#include "GuiKeySymbol.h"
#include "KeyMap.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "support/convert.h"
#include "support/FileFilterList.h"
#include "GuiSelection.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/lstrings.h"
#include "BufferView.h"
#include "Cursor.h"
#include "CutAndPaste.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "Language.h"
#include "LyXRC.h"
#include "Paragraph.h"
#include "GuiTexinfo.h"
#include "FuncRequest.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/filetools.h"
#include "support/FileName.h"
#include "GuiThesaurus.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include <QCloseEvent>
#include <QHeaderView>
#include "Buffer.h"
#include "BufferView.h"
#include "BufferParams.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FloatList.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "TextClass.h"
#include "support/convert.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "IconPalette.h"
#include "Layout.h"
#include "LyXFunc.h"
#include "Buffer.h"
#include "BufferParams.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Layout.h"
#include "LyX.h"
#include "LyXFunc.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "ErrorList.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Intl.h"
#include "Layout.h"
#include "Lexer.h"
#include "BufferView.h"
#include "Buffer.h"
#include "Cursor.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Paragraph.h"
#include "TexRow.h"
#include "GuiView.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include <QDockWidget>
#include <QString>
#include "BufferView.h"
#include "CoordCache.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Font.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "GuiApplication.h"
#include "GuiKeySymbol.h"
#include "GuiPainter.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include <QFontMetrics>
#include <QStackedWidget>
#include "TocModel.h"
-#include "debug.h"
+#include "support/debug.h"
#include <boost/assert.hpp>
#include "GuiToc.h"
#include "qt_helpers.h"
-#include "debug.h"
+#include "support/debug.h"
#include <QHeaderView>
#include "Validator.h"
#include "qt_helpers.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LyXRC.h"
#include "frontends/alert.h"
#include "LengthCombo.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "Language.h"
#include "Length.h"
+++ /dev/null
-/**
- * \file src/gettext.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- * \author Jean-Marc Lasgouttes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "gettext.h"
-#include "Messages.h"
-
-#include "support/lstrings.h"
-
-#ifdef HAVE_LOCALE_H
-# include <locale.h>
-#endif
-
-using std::string;
-
-
-namespace lyx {
-
-docstring const _(string const & str)
-{
- return getGuiMessages().get(str);
-}
-
-
-void locale_init()
-{
-#ifdef ENABLE_NLS
-# ifdef HAVE_LC_MESSAGES
- setlocale(LC_MESSAGES, "");
-# endif
- setlocale(LC_CTYPE, "");
- Messages::init();
-#endif
- setlocale(LC_NUMERIC, "C");
-}
-
-
-docstring const translateIfPossible(docstring const & name)
-{
- if (support::isAscii(name))
- // Probably from a standard configuration file, try to
- // translate
- return _(to_ascii(name));
- else
- // This must be from a user defined configuration file. We
- // cannot translate this, since gettext accepts only ascii
- // keys.
- return name;
-}
-
-
-} // namespace lyx
+++ /dev/null
-// -*- C++ -*-
-/**
- * \file src/gettext.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- * \author Jean-Marc Lasgouttes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef GETTEXT_H
-#define GETTEXT_H
-
-#include "support/strfwd.h"
-
-
-namespace lyx {
-
-/*
- * Native Language Support
- *
- * The general idea is that any string that should be translated is handled
- * as follows:
- * _("string")
- *
- * Static strings are special, obviously and must be flagged as follows:
- * static str = N_("string");
- *
- * And wherever they are used:
- * _(str)
- *
- * Every file where there are strings needs:
- * #include "gettext.h"
- *
- * Remember to mention each of these files in "po/POFILES.in"
- *
- * The main() needs a locale_init() and a gettext_init() in the beginning.
- */
-
-/*
- * General translation notes:
- * Commands/options are not translated
- * Debug messages are not translated
- * Panic/fatal (that should not happen) messages need not be translated
- */
-
-
-//#ifdef ENABLE_NLS
-
-///
-docstring const _(std::string const &);
-
-//#else // ENABLE_NLS
-
-///
-//# define _(str) (str)
-
-//#endif
-
-# define N_(str) (str) // for detecting static strings
-
-/**
- * Translate \p name if it is possible.
- * This should be used to translate strings that come from configuration
- * files like .ui files. These strings could already be in the native
- * language if they come from a file in the personal directory. */
-docstring const translateIfPossible(docstring const & name);
-
-///
-void locale_init();
-
-
-} // namespace lyx
-
-#endif
#include "GraphicsCacheItem.h"
#include "GraphicsImage.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/filetools.h"
#include "GraphicsImage.h"
#include "ConverterCache.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Format.h"
#include "support/filetools.h"
#include "GraphicsConverter.h"
#include "Converter.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Format.h"
#include "support/filetools.h"
#include "GraphicsImage.h"
#include "GraphicsParams.h"
-#include "debug.h"
+#include "support/debug.h"
namespace lyx {
#include "GraphicsImage.h"
#include "GraphicsParams.h"
#include "GraphicsCache.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/Timeout.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "Converter.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Encoding.h"
#include "Format.h"
#include "InsetIterator.h"
#include "Buffer.h"
#include "Converter.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "ErrorList.h"
#include "Exporter.h"
#include "Format.h"
#include "ExternalTemplate.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Lexer.h"
#include "support/filetools.h"
#include "ExternalTransforms.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/lstrings.h"
#include "support/lyxlib.h" // float_equal
#include "BufferView.h"
#include "CoordCache.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Dimension.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Text.h"
#include "TextClass.h"
#include "MetricsInfo.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "DispatchResult.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Encoding.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
#include "BufferView.h"
#include "Cursor.h"
#include "DispatchResult.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncStatus.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "MetricsInfo.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Lexer.h"
#include "OutputParams.h"
#include "TextClass.h"
#include "FloatList.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "InsetList.h"
#include "MetricsInfo.h"
#include "output_latex.h"
#include "Buffer.h"
#include "BufferParams.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "LaTeXFeatures.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Dimension.h"
#include "DispatchResult.h"
#include "FloatList.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Lexer.h"
#include "MetricsInfo.h"
#include "InsetRef.h"
#include "InsetTOC.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "Lexer.h"
#include "support/ExceptionMessage.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Language.h"
#include "Layout.h"
#include "LyXAction.h"
#include "InsetEnvironment.h"
#include "BufferParams.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Layout.h"
#include "OutputParams.h"
#include "output_latex.h"
#include "Buffer.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "Exporter.h"
#include "FuncStatus.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "LyXRC.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "Cursor.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Lexer.h"
#include "Text.h"
#include "MetricsInfo.h"
#include "BufferView.h"
#include "Counters.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "Floating.h"
#include "FloatList.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "OutputParams.h"
#include "Buffer.h"
#include "BufferParams.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "Floating.h"
#include "FloatList.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "MetricsInfo.h"
*/
#include <config.h>
-#include "debug.h"
+#include "support/debug.h"
#include "InsetFoot.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "Counters.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Layout.h"
// FIXME: the following is needed just to get the layout of the enclosing
// paragraph. This seems a bit too much to me (JMarc)
#include "BufferView.h"
#include "Converter.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "ErrorList.h"
#include "Exporter.h"
#include "Format.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "Length.h"
#include "Lexer.h"
#include "InsetGraphicsParams.h"
-#include "debug.h"
+#include "support/debug.h"
#include "LyX.h" // for use_gui
#include "Lexer.h"
#include "LyXRC.h"
#include <config.h>
#include "InsetHFill.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include <ostream>
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "LaTeXFeatures.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "OutputParams.h"
#include "support/lstrings.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "Exporter.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "LyX.h"
#include "LyXRC.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "MetricsInfo.h"
#include "sgml.h"
#include "BufferParams.h"
#include "BufferView.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "InsetSpecialChar.h"
#include "KeyMap.h"
#include "LaTeXFeatures.h"
#include "InsetText.h"
#include "RenderButton.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Cursor.h"
#include "support/Translator.h"
#include "InsetLine.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Dimension.h"
#include "Font.h"
#include "MetricsInfo.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "InsetList.h"
#include "Language.h"
#include "MetricsInfo.h"
#include "InsetListingsParams.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Length.h"
#include "Lexer.h"
#include "InsetMarginal.h"
#include "Buffer.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "OutputParams.h"
#include <ostream>
#include "InsetNewline.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Dimension.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
#include "Inset.h"
-#include "gettext.h"
+#include "support/gettext.h"
namespace lyx {
#include "InsetNewpage.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "Text.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
#include "Inset.h"
-#include "gettext.h"
+#include "support/gettext.h"
namespace lyx {
#include "Buffer.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "InsetIterator.h"
#include "LaTeXFeatures.h"
#include "MetricsInfo.h"
#include "BufferParams.h"
#include "Counters.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "Exporter.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "MetricsInfo.h"
#include "InsetOptArg.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "support/docstream.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "BufferView.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Dimension.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include "Cursor.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "LyXFunc.h"
#include "OutputParams.h"
#include "InsetSpace.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Dimension.h"
#include "Lexer.h"
#include "MetricsInfo.h"
#include "InsetSpecialChar.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Dimension.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "Buffer.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
#include "TocBackend.h"
#include "Counters.h"
#include "Cursor.h"
#include "CutAndPaste.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "CoordCache.h"
#include "CutAndPaste.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "ErrorList.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "InsetList.h"
#include "Intl.h"
#include "lyxfind.h"
#include "InsetTheorem.h"
#include "insets/InsetText.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "FontInfo.h"
#include "Text.h"
#include "MetricsInfo.h"
#include "Dimension.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Lexer.h"
#include "Text.h"
#include "MetricsInfo.h"
#include "BufferView.h"
#include "Counters.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "Floating.h"
#include "FloatList.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "OutputParams.h"
#include "MailInset.h"
#include "BufferView.h"
-#include "debug.h"
+#include "support/debug.h"
#include "frontends/Application.h"
#include "insets/Inset.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LyX.h"
#include "LyXRC.h"
#include "MetricsInfo.h"
#include "BufferView.h"
#include "Dimension.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LyX.h"
#include "LyXRC.h"
#include "MetricsInfo.h"
#include <config.h>
-#include "gettext.h"
+#include "support/gettext.h"
#include "Length.h"
#include <string>
#include "buffer_funcs.h"
#include "BufferView.h"
#include "Changes.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Text.h"
#include "Paragraph.h"
#include "ParIterator.h"
#include <config.h>
-#include "debug.h"
+#include "support/debug.h"
#include "LyX.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "support/os.h"
#include "BufferView.h"
#include "Cursor.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "Lexer.h"
#include "OutputParams.h"
#include "InsetMath.h"
#include "MathData.h"
#include "MathStream.h"
-#include "gettext.h"
-#include "debug.h"
+#include "support/gettext.h"
+#include "support/debug.h"
#include "support/docstream.h"
#include "support/lstrings.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include "Cursor.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "MathData.h"
#include "MathStream.h"
#include "MathStream.h"
#include "MetricsInfo.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Dimension.h"
#include "TextPainter.h"
#include "MetricsInfo.h"
#include "LaTeXFeatures.h"
-#include "debug.h"
+#include "support/debug.h"
#include <ostream>
#include "InsetMathDiff.h"
#include "MathData.h"
#include "MathStream.h"
-#include "debug.h"
+#include "support/debug.h"
namespace lyx {
#include "MathStream.h"
#include "MathStream.h"
#include "InsetMathSymbol.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/docstring.h"
#include "CutAndPaste.h"
#include "FuncStatus.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "frontends/Clipboard.h"
#include "frontends/Painter.h"
#include "FuncStatus.h"
#include "LaTeXFeatures.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LyXRC.h"
#include "OutputParams.h"
#include "sgml.h"
#include "InsetMathLim.h"
#include "MathData.h"
#include "MathStream.h"
-#include "debug.h"
+#include "support/debug.h"
namespace lyx {
#include "Buffer.h"
#include "BufferParams.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "MetricsInfo.h"
#include "output_latex.h"
#include "OutputParams.h"
#include "CoordCache.h"
#include "Cursor.h"
#include "CutAndPaste.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "LyXFunc.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Text.h"
#include "OutputParams.h"
#include "LaTeXFeatures.h"
#include "Buffer.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "MathData.h"
#include "MathFactory.h"
#include "MathSupport.h"
#include "InsetMathFont.h"
#include "DispatchResult.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
#include <boost/assert.hpp>
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "support/lstrings.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include "MathAtom.h"
#include "LaTeXFeatures.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/textutils.h"
#include "MathStream.h"
#include "MathSupport.h"
#include "frontends/Painter.h"
-#include "debug.h"
+#include "support/debug.h"
namespace lyx {
#include "InsetMathNest.h"
#include "Buffer.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DocIterator.h"
#include <boost/assert.hpp>
#include "InsetMath.h"
#include "MathSupport.h"
#include "MathParser.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/filetools.h" // LibFileSearch
#include "support/docstream.h"
#include "BufferView.h"
#include "CoordCache.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/docstream.h"
#include "MathExtern.h"
-#include "debug.h"
+#include "support/debug.h"
#include "InsetMathArray.h"
#include "InsetMathChar.h"
#include "InsetMathDelim.h"
#include "MathParser.h"
#include "MathSupport.h"
-#include "debug.h"
+#include "support/debug.h"
#include "insets/InsetCommand.h"
#include "Buffer.h"
#include "BufferView.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "LaTeXFeatures.h"
#include "FuncStatus.h"
#include "FuncRequest.h"
#include "MathStream.h"
#include "MathSupport.h"
-#include "debug.h"
+#include "support/debug.h"
namespace lyx {
#include "Buffer.h"
#include "Color.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Lexer.h"
#include "Undo.h"
#include "support/docstream.h"
#include "support/lstrings.h"
-#include "debug.h"
+#include "support/debug.h"
#include <sstream>
#include "MathSupport.h"
#include "Lexer.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/convert.h"
#include "support/docstream.h"
#include "MathParser.h"
#include "MathStream.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/docstream.h"
#include "output.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "frontends/alert.h"
#include "buffer_funcs.h"
#include "BufferParams.h"
#include "Counters.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Layout.h"
#include "OutputParams.h"
#include "Paragraph.h"
#include "Buffer.h"
#include "BufferParams.h"
-#include "debug.h"
+#include "support/debug.h"
#include "Encoding.h"
#include "InsetList.h"
#include "Language.h"
#include "Buffer.h"
#include "BufferParams.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "Layout.h"
#include "output.h"
#include "OutputParams.h"
//--
// we should probably change to the paragraph language in the
- // gettext here (if possible) so that strings are output in
+ // support/gettext.here (if possible) so that strings are output in
// the correct language! (20012712 Jug)
//--
switch (ltype) {
#include "BufferParams.h"
#include "Changes.h"
-#include "debug.h"
+#include "support/debug.h"
#include "InsetList.h"
#include "Layout.h"
#include "Paragraph.h"
#include "Buffer.h"
#include "CoordCache.h"
#include "Cursor.h"
-#include "debug.h"
+#include "support/debug.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Changes.h"
#include "Encoding.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Language.h"
#include "Layout.h"
#include "LyXRC.h"
#include <config.h>
#include "support/FileFilterList.h"
-#include "support/lstrings.h"
-// FIXME Interface violation
-#include "gettext.h"
+#include "support/lstrings.h"
+#include "support/gettext.h"
#include <boost/regex.hpp>
#include <boost/tokenizer.hpp>
#include <config.h>
#include "support/FileMonitor.h"
+
#include "support/FileName.h"
#include "support/lyxlib.h"
#include "support/Timeout.h"
#include <config.h>
#include "support/FileName.h"
+
+#include "support/debug.h"
#include "support/filetools.h"
#include "support/lstrings.h"
+#include "support/lyxlib.h"
#include "support/os.h"
#include "support/qstring_helpers.h"
-#include "debug.h"
-#include "lyxlib.h"
-
#include <QDateTime>
#include <QDir>
#include <QFile>
#ifndef FILENAME_H
#define FILENAME_H
-#include "strfwd.h"
+#include "support/strfwd.h"
#include <ctime>
#include <string>
#include "support/ForkedCallQueue.h"
-#include "debug.h"
+#include "support/debug.h"
#include <boost/bind.hpp>
#include <config.h>
#include "support/Forkedcall.h"
+
+#include "support/debug.h"
+#include "support/filetools.h"
#include "support/ForkedcallsController.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
-#include "support/filetools.h"
#include "support/os.h"
#include "support/Timeout.h"
-#include "debug.h"
-
#include <boost/bind.hpp>
#include <vector>
#include <config.h>
#include "support/ForkedcallsController.h"
-#include "support/Forkedcall.h"
-#include "debug.h"
+#include "support/debug.h"
+#include "support/Forkedcall.h"
#ifdef _WIN32
# include <sstream>
convert.h \
copy.cpp \
copied_ptr.h \
- cow_ptr.h \
+ debug.cpp \
+ debug.h \
docstream.cpp \
docstream.h \
docstring.cpp \
ForkedCallQueue.h \
ForkedcallsController.cpp \
ForkedcallsController.h \
+ gettext.cpp \
+ gettext.h \
getcwd.cpp \
gzstream.cpp \
gzstream.h \
lyxtime.cpp \
lyxtime.h \
lyxsum.cpp \
+ Messages.cpp \
+ Messages.h \
mkdir.cpp \
os.cpp \
os.h \
--- /dev/null
+/* \file Messages.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "support/Messages.h"
+
+#include "support/debug.h"
+#include "support/docstring.h"
+#include "support/environment.h"
+#include "support/Package.h"
+#include "support/unicode.h"
+
+#include <boost/current_function.hpp>
+
+#include <cerrno>
+
+using std::map;
+using std::string;
+
+namespace {
+
+using lyx::docstring;
+using lyx::from_ascii;
+
+void cleanTranslation(docstring & trans)
+{
+ /*
+ Some english words have different translations, depending on
+ context. In these cases the original string is augmented by
+ context information (e.g. "To:[[as in 'From page x to page
+ y']]" and "To:[[as in 'From format x to format y']]". This
+ means that we need to filter out everything in double square
+ brackets at the end of the string, otherwise the user sees
+ bogus messages. If we are unable to honour the request we
+ just return what we got in.
+ */
+ size_t const pos1 = trans.find(from_ascii("[["));
+ if (pos1 != docstring::npos) {
+ size_t const pos2 = trans.find(from_ascii("]]"), pos1);
+ if (pos2 != docstring::npos)
+ trans.erase(pos1, pos2 - pos1 + 2);
+ }
+}
+
+}
+
+
+#ifdef ENABLE_NLS
+
+# ifdef HAVE_LOCALE_H
+# include <locale.h>
+# endif
+
+# if HAVE_GETTEXT
+# include <libintl.h> // use the header already in the system *EK*
+# else
+# include "../../intl/libintl.h"
+# endif
+
+namespace lyx {
+
+using support::package;
+using support::getEnv;
+using support::setEnv;
+
+
+// This version use the traditional gettext.
+Messages::Messages(string const & l)
+ : lang_(l), warned_(false)
+{
+ // strip off any encoding suffix, i.e., assume 8-bit po files
+ string::size_type i = lang_.find(".");
+ lang_ = lang_.substr(0, i);
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
+ << ": language(" << lang_ << ")");
+}
+
+
+void Messages::init()
+{
+ errno = 0;
+ string const locale_dir = package().locale_dir().toFilesystemEncoding();
+ char const * c = bindtextdomain(PACKAGE, locale_dir.c_str());
+ int e = errno;
+ if (e) {
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << '\n'
+ << "Error code: " << errno << '\n'
+ << "Directory : " << package().locale_dir().absFilename() << '\n'
+ << "Rtn value : " << c);
+ }
+
+ if (!bind_textdomain_codeset(PACKAGE, ucs4_codeset)) {
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << '\n'
+ << "Error code: " << errno << '\n'
+ << "Codeset : " << ucs4_codeset << '\n');
+ }
+
+ textdomain(PACKAGE);
+}
+
+
+docstring const Messages::get(string const & m) const
+{
+ if (m.empty())
+ return docstring();
+
+ // Look for the translated string in the cache.
+ TranslationCache::iterator it = cache_.find(m);
+ if (it != cache_.end())
+ return it->second;
+
+ // The string was not found, use gettext to generate it
+
+ string const oldLANGUAGE = getEnv("LANGUAGE");
+ string const oldLC_ALL = getEnv("LC_ALL");
+ if (!lang_.empty()) {
+ // This GNU extension overrides any language locale
+ // wrt gettext.
+ setEnv("LANGUAGE", lang_);
+ // However, setting LANGUAGE does nothing when the
+ // locale is "C". Therefore we set the locale to
+ // something that is believed to exist on most
+ // systems. The idea is that one should be able to
+ // load German documents even without having de_DE
+ // installed.
+ setEnv("LC_ALL", "en_US");
+#ifdef HAVE_LC_MESSAGES
+ setlocale(LC_MESSAGES, "");
+#endif
+ }
+
+ char const * m_c = m.c_str();
+ char const * trans_c = gettext(m_c);
+ docstring trans;
+ if (!trans_c)
+ LYXERR0("Undefined result from gettext");
+ else if (trans_c == m_c) {
+ LYXERR(Debug::DEBUG, "Same as entered returned");
+ trans = from_ascii(m);
+ } else {
+ LYXERR(Debug::DEBUG, "We got a translation");
+ // m is actually not a char const * but ucs4 data
+ trans = reinterpret_cast<char_type const *>(trans_c);
+ }
+
+ cleanTranslation(trans);
+
+ // Reset environment variables as they were.
+ if (!lang_.empty()) {
+ // Reset everything as it was.
+ setEnv("LANGUAGE", oldLANGUAGE);
+ setEnv("LC_ALL", oldLC_ALL);
+#ifdef HAVE_LC_MESSAGES
+ setlocale(LC_MESSAGES, "");
+#endif
+ }
+
+ std::pair<TranslationCache::iterator, bool> result =
+ cache_.insert(std::make_pair(m, trans));
+
+ BOOST_ASSERT(result.second);
+
+ return result.first->second;
+}
+
+} // namespace lyx
+
+#else // ENABLE_NLS
+// This is the dummy variant.
+
+namespace lyx {
+
+Messages::Messages(string const & l) {}
+
+void Messages::init()
+{
+}
+
+
+docstring const Messages::get(string const & m) const
+{
+ docstring trans = from_ascii(m);
+ cleanTranslation(trans);
+ return trans;
+}
+
+} // namespace lyx
+
+#endif
+
+#if 0
+
+-#include <locale>
+
+namespace lyx {
+
+// This version of the Pimpl utilizes the message capability of
+// libstdc++ that is distributed with GNU G++.
+class Messages::Pimpl {
+public:
+ typedef std::messages<char>::catalog catalog;
+
+ Pimpl(string const & l)
+ : lang_(l),
+ loc_gl(lang_.c_str()),
+ mssg_gl(std::use_facet<std::messages<char> >(loc_gl))
+ {
+ //LYXERR("Messages: language(" << l << ") in dir(" << dir << ")");
+
+ string const locale_dir = package().locale_dir().toFilesystemEncoding();
+ cat_gl = mssg_gl.open(PACKAGE, loc_gl, locale_dir.c_str());
+
+ }
+
+ ~Pimpl()
+ {
+ mssg_gl.close(cat_gl);
+ }
+
+ docstring const get(string const & msg) const
+ {
+ return mssg_gl.get(cat_gl, 0, 0, msg);
+ }
+private:
+ ///
+ string lang_;
+ ///
+ std::locale loc_gl;
+ ///
+ std::messages<char> const & mssg_gl;
+ ///
+ catalog cat_gl;
+};
+
+} // namespace lyx
+
+#endif
--- /dev/null
+// -*- C++ -*-
+/* \file Messages.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef MESSAGES_H
+#define MESSAGES_H
+
+#include "support/docstring.h"
+
+#include <map>
+#include <string>
+
+namespace lyx {
+
+///
+class Messages {
+public:
+ /// messages in the language \p l.
+ /// If \p l is empty, the language will be defined by the environment.
+ Messages(std::string const & l = std::string());
+ ///
+ docstring const get(std::string const & msg) const;
+ ///
+ static void init();
+private:
+ ///
+ std::string lang_;
+ /// Did we warn about unavailable locale already?
+ mutable bool warned_;
+ ///
+ typedef std::map<std::string, docstring> TranslationCache;
+ /// Internal cache for gettext translated strings.
+ /// This is needed for performance reason within \c updateLabels()
+ /// under Windows.
+ mutable TranslationCache cache_;
+};
+
+/// Access to the unique Messages object for the passed \p language.
+/// Implementation is in LyX.cpp.
+extern Messages & getMessages(std::string const & language);
+/// Access to the unique Messages object used for GUI element.
+/// Implementation is in LyX.cpp.
+extern Messages & getGuiMessages();
+
+} // namespace lyx
+
+#endif
// -*- C++ -*-
/**
- * \file package.C
+ * \file package.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
#include "support/Package.h"
-#include "debug.h"
-#include "gettext.h"
-
+#include "support/debug.h"
#include "support/environment.h"
+#include "support/ExceptionMessage.h"
#include "support/filetools.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
-#include "support/ExceptionMessage.h"
#include "support/os.h"
#if defined (USE_WINDOWS_PACKAGING)
#include <config.h>
-#include "SignalSlot.h"
-#include "SignalSlotPrivate.h"
+#include "support/SignalSlot.h"
+#include "support/SignalSlotPrivate.h"
namespace lyx {
#include <config.h>
+#include "support/Timeout.h"
+#include "support/debug.h"
+
#include <QObject>
#include <QTimerEvent>
-#include "debug.h"
-#include "Timeout.h"
-
-
namespace lyx {
/**
#include <config.h>
-#include "convert.h"
-
+#include "support/convert.h"
#include "support/docstring.h"
#include <boost/lexical_cast.hpp>
+++ /dev/null
-// -*- C++ -*-
-/**
- * \file cow_ptr.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Angus Leeming
- *
- * A pointer with copy-on-write semantics
- *
- * The original version of this class was written by Yonat Sharon
- * and is freely available at http://ootips.org/yonat/
- *
- * I modified it to use boost::shared_ptr internally, rather than use his
- * home-grown equivalent.
- */
-
-#ifndef COW_PTR_H
-#define COW_PTR_H
-
-#include <boost/shared_ptr.hpp>
-
-
-namespace lyx {
-namespace support {
-
-template <typename T>
-class cow_ptr {
-public:
- explicit cow_ptr(T * = 0);
- cow_ptr(cow_ptr const &);
- cow_ptr & operator=(cow_ptr const &);
-
- T const & operator*() const;
- T const * operator->() const;
- T const * get() const;
-
- T & operator*();
- T * operator->();
- T * get();
-
-private:
- boost::shared_ptr<T> ptr_;
- void copy();
-};
-
-
-template <typename T>
-cow_ptr<T>::cow_ptr(T * p)
- : ptr_(p)
-{}
-
-
-template <typename T>
-cow_ptr<T>::cow_ptr(cow_ptr const & other)
- : ptr_(other.ptr_)
-{}
-
-
-template <typename T>
-cow_ptr<T> & cow_ptr<T>::operator=(cow_ptr const & other)
-{
- if (&other != this)
- ptr_ = other.ptr_;
- return *this;
-}
-
-
-template <typename T>
-T const & cow_ptr<T>::operator*() const
-{
- return *ptr_;
-}
-
-
-template <typename T>
-T const * cow_ptr<T>::operator->() const
-{
- return ptr_.get();
-}
-
-
-template <typename T>
-T const * cow_ptr<T>::get() const
-{
- return ptr_.get();
-}
-
-
-template <typename T>
-T & cow_ptr<T>::operator*()
-{
- copy();
- return *ptr_;
-}
-
-
-template <typename T>
-T * cow_ptr<T>::operator->()
-{
- copy();
- return ptr_.get();
-}
-
-
-template <typename T>
-T * cow_ptr<T>::get()
-{
- copy();
- return ptr_.get();
-}
-
-
-template <typename T>
-void cow_ptr<T>::copy()
-{
- if (!ptr_.unique())
- ptr_ = boost::shared_ptr<T>(new T(*ptr_.get()));
-}
-
-} // namespace support
-} // namespace lyx
-
-#endif // NOT COW_PTR_H
--- /dev/null
+/**
+ * \file debug.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ * \author Jean-Marc Lasgouttes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "support/debug.h"
+
+#include "support/convert.h"
+#include "support/gettext.h"
+#include "support/lstrings.h"
+#include "support/FileName.h"
+
+#include <iostream>
+#include <iomanip>
+
+using std::setw;
+using std::string;
+using std::ostream;
+
+
+namespace lyx {
+
+using support::ascii_lowercase;
+using support::bformat;
+using support::isStrInt;
+
+namespace {
+
+struct ErrorItem {
+ Debug::Type level;
+ char const * name;
+ char const * desc;
+};
+
+
+ErrorItem errorTags[] = {
+ { Debug::NONE, "none", N_("No debugging message")},
+ { Debug::INFO, "info", N_("General information")},
+ { Debug::INIT, "init", N_("Program initialisation")},
+ { Debug::KEY, "key", N_("Keyboard events handling")},
+ { Debug::GUI, "gui", N_("GUI handling")},
+ { Debug::PARSER, "parser", N_("Lyxlex grammar parser")},
+ { Debug::LYXRC, "lyxrc", N_("Configuration files reading")},
+ { Debug::KBMAP, "kbmap", N_("Custom keyboard definition")},
+ { Debug::LATEX, "latex", N_("LaTeX generation/execution")},
+ { Debug::MATHED, "mathed", N_("Math editor")},
+ { Debug::FONT, "font", N_("Font handling")},
+ { Debug::TCLASS, "tclass", N_("Textclass files reading")},
+ { Debug::LYXVC, "lyxvc", N_("Version control")},
+ { Debug::LYXSERVER, "lyxserver", N_("External control interface")},
+ { Debug::ROFF, "roff", N_("Keep *roff temporary files")},
+ { Debug::ACTION, "action", N_("User commands")},
+ { Debug::LYXLEX, "lyxlex", N_("The LyX Lexxer")},
+ { Debug::DEPEND, "depend", N_("Dependency information")},
+ { Debug::INSETS, "insets", N_("LyX Insets")},
+ { Debug::FILES, "files", N_("Files used by LyX")},
+ { Debug::WORKAREA, "workarea", N_("Workarea events")},
+ { Debug::INSETTEXT, "insettext", N_("Insettext/tabular messages")},
+ { Debug::GRAPHICS, "graphics", N_("Graphics conversion and loading")},
+ { Debug::CHANGES, "changes", N_("Change tracking")},
+ { Debug::EXTERNAL, "external", N_("External template/inset messages")},
+ { Debug::PAINTING, "painting", N_("RowPainter profiling")},
+ { Debug::DEBUG, "debug", N_("Developers' general debug messages")},
+ { Debug::ANY, "any", N_("All debugging messages")}
+};
+
+
+int const numErrorTags = sizeof(errorTags)/sizeof(errorTags[0]);
+
+} // namespace anon
+
+
+Debug::Type Debug::value(string const & val)
+{
+ Type l = Debug::NONE;
+ string v = val;
+ while (!v.empty()) {
+ size_t const st = v.find(',');
+ string const tmp = ascii_lowercase(v.substr(0, st));
+ if (tmp.empty())
+ break;
+ // Is it a number?
+ if (isStrInt(tmp))
+ l |= static_cast<Type>(convert<int>(tmp));
+ else
+ // Search for an explicit name
+ for (int i = 0 ; i < numErrorTags ; ++i)
+ if (tmp == errorTags[i].name) {
+ l |= errorTags[i].level;
+ break;
+ }
+ if (st == string::npos)
+ break;
+ v.erase(0, st + 1);
+ }
+ return l;
+}
+
+
+void Debug::showLevel(ostream & os, Debug::Type level)
+{
+ // Show what features are traced
+ for (int i = 0; i != numErrorTags; ++i) {
+ if (errorTags[i].level != Debug::ANY
+ && errorTags[i].level != Debug::NONE
+ && errorTags[i].level & level) {
+ // avoid to_utf8(_(...)) re-entrance problem
+ docstring const s = _(errorTags[i].desc);
+ os << to_utf8(bformat(_("Debugging `%1$s' (%2$s)"),
+ from_utf8(errorTags[i].name), s))
+ << '\n';
+ }
+ }
+ os.flush();
+}
+
+
+void Debug::showTags(ostream & os)
+{
+ for (int i = 0; i != numErrorTags ; ++i)
+ os << setw(10) << static_cast<unsigned int>(errorTags[i].level)
+ << setw(13) << errorTags[i].name
+ << " " << to_utf8(_(errorTags[i].desc)) << '\n';
+ os.flush();
+}
+
+
+void LyXErr::disable()
+{
+ enabled_ = false;
+}
+
+
+void LyXErr::enable()
+{
+ enabled_ = true;
+}
+
+
+bool LyXErr::debugging(Debug::Type t) const
+{
+ return (dt & t);
+}
+
+
+void LyXErr::endl()
+{
+ stream() << std::endl;
+}
+
+
+LyXErr & operator<<(LyXErr & l, void const * t)
+{ l.stream() << t; return l; }
+LyXErr & operator<<(LyXErr & l, char const * t)
+{ l.stream() << t; return l; }
+LyXErr & operator<<(LyXErr & l, char t)
+{ l.stream() << t; return l; }
+LyXErr & operator<<(LyXErr & l, int t)
+{ l.stream() << t; return l; }
+LyXErr & operator<<(LyXErr & l, unsigned int t)
+{ l.stream() << t; return l; }
+LyXErr & operator<<(LyXErr & l, long t)
+{ l.stream() << t; return l; }
+LyXErr & operator<<(LyXErr & l, unsigned long t)
+{ l.stream() << t; return l; }
+LyXErr & operator<<(LyXErr & l, double t)
+{ l.stream() << t; return l; }
+LyXErr & operator<<(LyXErr & l, std::string const & t)
+{ l.stream() << t; return l; }
+LyXErr & operator<<(LyXErr & l, docstring const & t)
+{ l.stream() << to_utf8(t); return l; }
+LyXErr & operator<<(LyXErr & l, support::FileName const & t)
+{ l.stream() << t; return l; }
+LyXErr & operator<<(LyXErr & l, std::ostream &(*t)(std::ostream &))
+{ l.stream() << t; return l; }
+LyXErr & operator<<(LyXErr & l, std::ios_base &(*t)(std::ios_base &))
+{ l.stream() << t; return l; }
+
+
+// The global instance
+LyXErr lyxerr;
+
+
+} // namespace lyx
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file debug.h
+ *
+ * FIXME: It would be nice if, in lyx::use_gui mode, instead of
+ * outputting to the console, we would pipe all messages onto a file
+ * and visualise the contents dynamically in a Qt window if needed.
+ *
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ * \author Jean-Marc Lasgouttes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef LYXDEBUG_H
+#define LYXDEBUG_H
+
+#include "support/strfwd.h"
+
+
+namespace std {
+
+class ios_base;
+
+template<typename CharT, typename Traits> class basic_streambuf;
+typedef basic_streambuf<char, char_traits<char> > streambuf;
+
+}
+
+
+namespace lyx {
+
+/// This is all the different debug levels that we have.
+namespace Debug {
+ ///
+ enum Type {
+ ///
+ NONE = 0,
+ ///
+ INFO = (1 << 0), // 1
+ ///
+ INIT = (1 << 1), // 2
+ ///
+ KEY = (1 << 2), // 4
+ ///
+ GUI = (1 << 3), // 8
+ ///
+ PARSER = (1 << 4), // 16
+ ///
+ LYXRC = (1 << 5), // 32
+ ///
+ KBMAP = (1 << 6), // 64
+ ///
+ LATEX = (1 << 7), // 128
+ ///
+ MATHED = (1 << 8), // 256 // Alejandro, please use this.
+ ///
+ FONT = (1 << 9), // 512
+ ///
+ TCLASS = (1 << 10), // 1024
+ ///
+ LYXVC = (1 << 11), // 2048
+ ///
+ LYXSERVER = (1 << 12), // 4096
+ ///
+ ROFF = (1 << 13), // 8192
+ ///
+ ACTION = (1 << 14), // 16384
+ ///
+ LYXLEX = (1 << 15),
+ ///
+ DEPEND = (1 << 16),
+ ///
+ INSETS = (1 << 17),
+ ///
+ FILES = (1 << 18),
+ ///
+ WORKAREA = (1 << 19),
+ ///
+ INSETTEXT = (1 << 20),
+ ///
+ GRAPHICS = (1 << 21),
+ /// change tracking
+ CHANGES = (1 << 22),
+ ///
+ EXTERNAL = (1 << 23),
+ ///
+ PAINTING = (1 << 24),
+ ///
+ DEBUG = (1 << 31),
+ ///
+ ANY = 0xffffffff
+ };
+
+ /** A function to convert symbolic string names on debug levels
+ to their numerical value.
+ */
+ Type value(std::string const & val);
+
+ /** Display the tags and descriptions of the current debug level
+ of ds
+ */
+ void showLevel(std::ostream & os, Type level);
+
+ /** show all the possible tags that can be used for debugging */
+ void showTags(std::ostream & os);
+
+} // namespace Debug
+
+
+inline void operator|=(Debug::Type & d1, Debug::Type d2)
+{
+ d1 = static_cast<Debug::Type>(d1 | d2);
+}
+
+
+class LyXErr
+{
+public:
+ /// Disable the stream completely
+ void disable();
+ /// Enable the stream after a possible call of disable()
+ void enable();
+ /// Returns true if t is part of the current debug level.
+ bool debugging(Debug::Type t = Debug::ANY) const;
+ /// Ends output
+ void endl();
+ /// Sets stream
+ void setStream(std::ostream & os) { stream_ = &os; }
+ /// Sets stream
+ std::ostream & stream() { return *stream_; }
+ /// Sets the debug level to t.
+ void level(Debug::Type t) { dt = t; }
+ /// Returns the current debug level.
+ Debug::Type level() const { return dt; }
+ /// Returns stream
+ operator std::ostream &() { return *stream_; }
+private:
+ /// The current debug level
+ Debug::Type dt;
+ /// Is the stream enabled?
+ bool enabled_;
+ /// The real stream
+ std::ostream * stream_;
+};
+
+namespace support { class FileName; }
+
+LyXErr & operator<<(LyXErr &, void const *);
+LyXErr & operator<<(LyXErr &, char const *);
+LyXErr & operator<<(LyXErr &, char);
+LyXErr & operator<<(LyXErr &, int);
+LyXErr & operator<<(LyXErr &, unsigned int);
+LyXErr & operator<<(LyXErr &, long);
+LyXErr & operator<<(LyXErr &, unsigned long);
+LyXErr & operator<<(LyXErr &, double);
+LyXErr & operator<<(LyXErr &, std::string const &);
+LyXErr & operator<<(LyXErr &, docstring const &);
+LyXErr & operator<<(LyXErr &, support::FileName const &);
+LyXErr & operator<<(LyXErr &, std::ostream &(*)(std::ostream &));
+LyXErr & operator<<(LyXErr &, std::ios_base &(*)(std::ios_base &));
+
+extern LyXErr lyxerr;
+
+} // namespace lyx
+
+
+#define LYXERR(type, msg) \
+ do { \
+ if (!lyx::lyxerr.debugging(type)) {} \
+ else { lyx::lyxerr << msg; lyx::lyxerr.endl(); } \
+ } while (0)
+
+#define LYXERR0(msg) LYXERR(lyx::Debug::ANY, msg)
+
+#endif
#include <config.h>
-#include "docstream.h"
-#include "unicode.h"
+#include "support/docstream.h"
+#include "support/unicode.h"
#include <cerrno>
#include <cstdio>
#include <config.h>
-#include "docstring.h"
-#include "qstring_helpers.h"
-#include "unicode.h"
-#include "lstrings.h"
+#include "support/docstring.h"
+
+#include "support/lstrings.h"
+#include "support/qstring_helpers.h"
+#include "support/unicode.h"
#include <locale>
#include <iostream>
#include <config.h>
+#include "support/filetools.h"
+
#include "support/convert.h"
+#include "support/debug.h"
#include "support/environment.h"
-#include "support/filetools.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
#include "support/os.h"
#include "support/Path.h"
#include "support/Systemcall.h"
-// FIXME Interface violation
-#include "gettext.h"
-#include "debug.h"
-
#include <boost/assert.hpp>
#include <boost/regex.hpp>
variable. But we don't use the value if the currently
selected locale is the C locale. This is a GNU extension.
- Otherwise, w use a trick to guess what gettext has done:
+ Otherwise, w use a trick to guess what support/gettext.has done:
each po file is able to tell us its name. (JMarc)
*/
--- /dev/null
+/**
+ * \file src/gettext.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ * \author Jean-Marc Lasgouttes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "support/gettext.h"
+
+#include "support/lstrings.h"
+#include "support/Messages.h"
+
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+using std::string;
+
+
+namespace lyx {
+
+docstring const _(string const & str)
+{
+ return getGuiMessages().get(str);
+}
+
+
+void locale_init()
+{
+#ifdef ENABLE_NLS
+# ifdef HAVE_LC_MESSAGES
+ setlocale(LC_MESSAGES, "");
+# endif
+ setlocale(LC_CTYPE, "");
+ Messages::init();
+#endif
+ setlocale(LC_NUMERIC, "C");
+}
+
+
+docstring const translateIfPossible(docstring const & name)
+{
+ if (support::isAscii(name))
+ // Probably from a standard configuration file, try to
+ // translate
+ return _(to_ascii(name));
+ else
+ // This must be from a user defined configuration file. We
+ // cannot translate this, since gettext accepts only ascii
+ // keys.
+ return name;
+}
+
+
+} // namespace lyx
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file src/support/gettext.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ * \author Jean-Marc Lasgouttes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef GETTEXT_H
+#define GETTEXT_H
+
+#include "support/strfwd.h"
+
+
+namespace lyx {
+
+/*
+ * Native Language Support
+ *
+ * The general idea is that any string that should be translated is handled
+ * as follows:
+ * _("string")
+ *
+ * Static strings are special, obviously and must be flagged as follows:
+ * static str = N_("string");
+ *
+ * And wherever they are used:
+ * _(str)
+ *
+ * Every file where there are strings needs:
+ * #include "support/gettext.h"
+ *
+ * Remember to mention each of these files in "po/POFILES.in"
+ *
+ * The main() needs a locale_init() and a gettext_init() in the beginning.
+ */
+
+/*
+ * General translation notes:
+ * Commands/options are not translated
+ * Debug messages are not translated
+ * Panic/fatal (that should not happen) messages need not be translated
+ */
+
+
+//#ifdef ENABLE_NLS
+
+///
+docstring const _(std::string const &);
+
+//#else // ENABLE_NLS
+
+///
+//# define _(str) (str)
+
+//#endif
+
+# define N_(str) (str) // for detecting static strings
+
+/**
+ * Translate \p name if it is possible.
+ * This should be used to translate strings that come from configuration
+ * files like .ui files. These strings could already be in the native
+ * language if they come from a file in the personal directory. */
+docstring const translateIfPossible(docstring const & name);
+
+///
+void locale_init();
+
+
+} // namespace lyx
+
+#endif
#include <config.h>
-#include "gzstream.h"
+#include "support/gzstream.h"
+
#include <iostream>
#ifdef HAVE_STRING_H
# include <string.h> // for memcpy
#include <csignal>
#ifdef _WIN32
-#include "debug.h"
-#include "os.h"
+#include "support/debug.h"
+#include "support/os.h"
#include <windows.h>
#include <cerrno>
#include "support/lstrings.h"
-#include "support/lyxlib.h"
#include "support/convert.h"
+#include "support/debug.h"
+#include "support/lyxlib.h"
#include "support/qstring_helpers.h"
#include "support/textutils.h"
-#include "debug.h"
-
#include <boost/tokenizer.hpp>
#include <boost/assert.hpp>
#include <config.h>
#include "support/lyxlib.h"
-#include "debug.h"
+#include "support/debug.h"
#include "support/FileName.h"
#include <boost/crc.hpp>
#include <config.h>
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
-#include "os_cygwin.cpp"
+#include "support/os_cygwin.cpp"
#elif defined(_WIN32)
-#include "os_win32.cpp"
+#include "support/os_win32.cpp"
#else
-#include "os_unix.cpp"
+#include "support/os_unix.cpp"
#endif
namespace lyx {
#include <config.h>
#include "support/os.h"
-#include "support/lstrings.h"
-#include "debug.h"
+#include "support/lstrings.h"
+#include "support/debug.h"
#include <windows.h>
#include <io.h>
#include "support/os.h"
#include "support/os_win32.h"
-#include "support/lstrings.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "support/filetools.h"
+#include "support/lstrings.h"
#include "support/ExceptionMessage.h"
-#include "debug.h"
-#include "gettext.h"
-
#include <boost/assert.hpp>
#include <cstdlib>
if (copy(from, to)) {
from.removeFile();
return true;
- } else
- return false;
+ }
+ return false;
}
return true;
}
#include "support/lyxlib.h"
-#include "debug.h"
+#include "support/debug.h"
#include <sys/socket.h>
#include <sys/un.h>
#include "support/lyxlib.h"
#include "support/convert.h"
+#include "support/debug.h"
#include "support/filetools.h"
#include "support/Package.h"
-#include "debug.h"
-
#include <boost/scoped_array.hpp>
#include <cstdlib>
#include <config.h>
-#include "unicode.h"
-
-#include "debug.h"
+#include "support/unicode.h"
+#include "support/debug.h"
#include <iconv.h>
#include <boost/assert.hpp>
#if defined (_WIN32)
-# include "gettext.h"
+# include "support/gettext.h"
# include <windows.h>
# include <lmcons.h>
#else
#include <config.h>
-#include "debug.h"
+#include "support/debug.h"
#include <boost/assert.hpp>
#include <cstdlib>
#include <exception>
+#include <ostream>
using std::endl;
#include <config.h>
-#include "gettext.h"
+#include "support/gettext.h"
#include "../support/docstring.h"
#include "tex2lyx.h"
#include "Context.h"
-#include "debug.h"
#include "TextClass.h"
#include "Layout.h"
#include "support/convert.h"
+#include "support/debug.h"
+#include "support/ExceptionMessage.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
-#include "support/ExceptionMessage.h"
#include "support/os.h"
#include "support/Package.h"
#include "support/unicode.h"
using support::os::internal_path;
using support::rtrim;
-LayoutPtr captionlayout;
// Hacks to allow the thing to link in the lyxlayout stuff
-LyXErr lyxerr(std::cerr.rdbuf());
+LayoutPtr captionlayout;
string const trim(string const & a, char const * p)
string join(vector<string> const & input, char const * delim)
{
ostringstream os;
- for (size_t i = 0; i < input.size(); ++i) {
+ for (size_t i = 0; i != input.size(); ++i) {
if (i)
os << delim;
os << input[i];
/*!
* Read one command definition from the syntax file
*/
-void read_command(Parser & p, string command, CommandMap & commands) {
+void read_command(Parser & p, string command, CommandMap & commands)
+{
if (p.next_token().asInput() == "*") {
p.get_token();
command += '*';
{
using namespace lyx;
+ lyxerr.setStream(std::cerr);
+
easyParse(argc, argv);
if (argc <= 1) {
* \author Jean-Marc Lasgouttes
*
* Full author contact details are available in file CREDITS.
- *
- * Warning! This file is autogenerated from version.cpp.in.
- * All changes to this file will be lost.
*/
#include <config.h>