The branch, kill-tex2lyx-define, has been updated. - Log -----------------------------------------------------------------
commit 20d49a6dccb90116bef41cfe7ca2f1a29e7e6e9e Author: Stephan Witt <[email protected]> Date: Fri Sep 27 20:55:12 2013 +0200 rename class files BufferEncoding to BufferEncodings diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 6eabdc9..948f9cc 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -28,7 +28,7 @@ #include "CutAndPaste.h" #include "DispatchResult.h" #include "DocIterator.h" -#include "BufferEncoding.h" +#include "BufferEncodings.h" #include "ErrorList.h" #include "Exporter.h" #include "Format.h" diff --git a/src/BufferEncoding.cpp b/src/BufferEncoding.cpp deleted file mode 100644 index 1a527ee..0000000 --- a/src/BufferEncoding.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/** - * \file Encoding.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 - * \author Dekel Tsur - * \author Stephan Witt - * - * Full author contact details are available in file CREDITS. - */ - -#include <config.h> - -#include "BufferEncoding.h" - -#include "Buffer.h" -#include "InsetIterator.h" -#include "LaTeXFeatures.h" - -#include "support/lstrings.h" - -#include <boost/cstdint.hpp> - -#include <sstream> - -using namespace std; -using namespace lyx::support; - - -namespace lyx { - - -void BufferEncodings::initUnicodeMath(Buffer const & buffer, bool for_master) -{ - if (for_master) { - mathcmd.clear(); - textcmd.clear(); - mathsym.clear(); - } - - // Check this buffer - Inset & inset = buffer.inset(); - InsetIterator it = inset_iterator_begin(inset); - InsetIterator const end = inset_iterator_end(inset); - for (; it != end; ++it) - it->initUnicodeMath(); - - if (!for_master) - return; - - // Check children - ListOfBuffers blist = buffer.getDescendents(); - ListOfBuffers::const_iterator bit = blist.begin(); - ListOfBuffers::const_iterator const bend = blist.end(); - for (; bit != bend; ++bit) - initUnicodeMath(**bit, false); -} - - -void BufferEncodings::validate(char_type c, LaTeXFeatures & features, bool for_mathed) -{ - CharInfo const & ci = Encodings::unicodeCharInfo(c); - if (Encodings::isUnicodeSymbol(ci)) { - // In mathed, c could be used both in textmode and mathmode - docstring const textcommand = Encodings::unicodeTextCommand(ci); - bool const math_mode = for_mathed && isMathCmd(c); - bool const use_math = math_mode || - (!for_mathed && textcommand.empty()); - bool const use_text = (for_mathed && isTextCmd(c)) || - (!for_mathed && !textcommand.empty()); - bool const plain_utf8 = (features.runparams().encoding->name() == "utf8-plain"); - bool const unicode_math = (features.isRequired("unicode-math") - && features.isAvailable("unicode-math")); - // with utf8-plain, we only load packages when in mathed (see #7766) - // and if we do not use unicode-math - if ((math_mode && !unicode_math) - || (use_math && !plain_utf8)) { - string const mathpreamble = Encodings::unicodeMathPreamble(ci); - if (!mathpreamble.empty()) { - if (Encodings::unicodeMathFeature(ci)) { - string feats = mathpreamble; - while (!feats.empty()) { - string feat; - feats = split(feats, feat, ','); - features.require(feat); - } - } else - features.addPreambleSnippet(mathpreamble); - } - } - // with utf8-plain, we do not load packages (see #7766) - if (use_text && !plain_utf8) { - string const textpreamble = Encodings::unicodeTextPreamble(ci); - if (!textpreamble.empty()) { - if (Encodings::unicodeTextFeature(ci)) { - string feats = textpreamble; - while (!feats.empty()) { - string feat; - feats = split(feats, feat, ','); - features.require(feat); - } - } else - features.addPreambleSnippet(textpreamble); - } - } - } - if (for_mathed && isMathSym(c)) { - features.require("amstext"); - features.require("lyxmathsym"); - } -} - - -} // namespace lyx diff --git a/src/BufferEncoding.h b/src/BufferEncoding.h deleted file mode 100644 index 3b32f89..0000000 --- a/src/BufferEncoding.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- -/** - * \file BufferEncoding.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 - * \author Stephan Witt - * - * Full author contact details are available in file CREDITS. - */ - -#ifndef BUFFER_ENCODING_H -#define BUFFER_ENCODING_H - -#include "support/docstring.h" -#include "support/types.h" -#include "Encoding.h" - -namespace lyx { - -class Buffer; -class LaTeXFeatures; - -class BufferEncodings : public Encodings { -public: - /** - * Initialize mathcmd, textcmd, and mathsym sets. - */ - static void initUnicodeMath(Buffer const & buffer, bool for_master = true); - /** - * If \p c cannot be encoded in the given \p encoding, convert - * it to something that LaTeX can understand in mathmode. - * \p needsTermination indicates whether the command needs to be - * terminated by {} or a space. - * \return whether \p command is a mathmode command - */ - static void validate(char_type c, LaTeXFeatures & features, bool for_mathed = false); -}; - -} // namespace lyx - -#endif diff --git a/src/BufferEncodings.cpp b/src/BufferEncodings.cpp index 362a1dd..5a82b5e 100644 --- a/src/BufferEncodings.cpp +++ b/src/BufferEncodings.cpp @@ -21,10 +21,6 @@ #include "support/lstrings.h" -#include <boost/cstdint.hpp> - -#include <sstream> - using namespace std; using namespace lyx::support; diff --git a/src/Encoding.cpp b/src/Encoding.cpp index 4afe853..bc01042 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -18,7 +18,6 @@ #include "support/debug.h" #include "support/gettext.h" -#include "support/FileName.h" #include "support/lstrings.h" #include "support/textutils.h" #include "support/unicode.h" diff --git a/src/Makefile.am b/src/Makefile.am index 8be200d..092c03e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -119,7 +119,7 @@ SOURCEFILESCORE = \ DepTable.cpp \ DocIterator.cpp \ Encoding.cpp \ - BufferEncoding.cpp \ + BufferEncodings.cpp \ ErrorList.cpp \ Exporter.cpp \ factory.cpp \ @@ -219,7 +219,7 @@ HEADERFILESCORE = \ DocIterator.h \ DocumentClassPtr.h \ Encoding.h \ - BufferEncoding.h \ + BufferEncodings.h \ ErrorList.h \ Exporter.h \ factory.h \ diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index aea59c1..8368c6e 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -25,7 +25,7 @@ #include "BufferParams.h" #include "Changes.h" #include "Counters.h" -#include "BufferEncoding.h" +#include "BufferEncodings.h" #include "InsetList.h" #include "Language.h" #include "LaTeXFeatures.h" diff --git a/src/mathed/InsetMathChar.cpp b/src/mathed/InsetMathChar.cpp index dfb5611..03bda07 100644 --- a/src/mathed/InsetMathChar.cpp +++ b/src/mathed/InsetMathChar.cpp @@ -18,7 +18,7 @@ #include "MetricsInfo.h" #include "Dimension.h" -#include "BufferEncoding.h" +#include "BufferEncodings.h" #include "LaTeXFeatures.h" #include "TextPainter.h" ----------------------------------------------------------------------- Summary of changes: src/Buffer.cpp | 2 +- src/BufferEncoding.cpp | 116 ------------------------------------------ src/BufferEncoding.h | 44 ---------------- src/BufferEncodings.cpp | 4 -- src/Encoding.cpp | 1 - src/Makefile.am | 4 +- src/Paragraph.cpp | 2 +- src/mathed/InsetMathChar.cpp | 2 +- 8 files changed, 5 insertions(+), 170 deletions(-) delete mode 100644 src/BufferEncoding.cpp delete mode 100644 src/BufferEncoding.h hooks/post-receive -- Repository for new features
