#include "Buffer.h"
#include "BufferParams.h"
+#include "BufferView.h"
#include "debug.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
+#include "support/docstring.h"
#include "support/lstrings.h"
// Index of chars used for the quote. Index is [side, language]
int quote_index[2][6] = {
{ 2, 1, 0, 0, 3, 4 }, // "'',,<>"
- { 1, 1, 2, 1, 4, 3 } }; // "`'`'><"
+ { 1, 1, 2, 1, 4, 3 } // "`'`'><"
+};
// Corresponding LaTeX code, for double and single quotes.
-char const * const latex_quote_t1[2][5] =
-{ { "\\quotesinglbase ", "'", "`",
+char const * const latex_quote_t1[2][5] = {
+ { "\\quotesinglbase ", "'", "`",
"\\guilsinglleft{}", "\\guilsinglright{}" },
- { ",,", "''", "``", "<<", ">>" } };
+ { ",,", "''", "``", "<<", ">>" }
+};
-char const * const latex_quote_ot1[2][5] =
-{ { "\\quotesinglbase ", "'", "`",
+char const * const latex_quote_ot1[2][5] = {
+ { "\\quotesinglbase ", "'", "`",
"\\guilsinglleft{}", "\\guilsinglright{}" },
{ "\\quotedblbase ", "''", "``",
- "\\guillemotleft{}", "\\guillemotright{}" } };
+ "\\guillemotleft{}", "\\guillemotright{}" }
+};
-char const * const latex_quote_babel[2][5] =
-{ { "\\glq ", "'", "`", "\\flq{}", "\\frq{}" },
- { "\\glqq ", "''", "``", "\\flqq{}", "\\frqq{}" } };
+char const * const latex_quote_babel[2][5] = {
+ { "\\glq ", "'", "`", "\\flq{}", "\\frq{}" },
+ { "\\glqq ", "''", "``", "\\flqq{}", "\\frqq{}" }
+};
} // namespace anon
}
+docstring InsetQuotes::name() const
+{
+ return from_ascii("Quotes");
+}
+
+
void InsetQuotes::getPosition(char_type c)
{
// Decide whether left or right
switch (c) {
- case ' ': case '(': case '[':
+ case ' ':
+ case '(':
+ case '[':
side_ = LeftQ; // left quote
break;
default:
retdisp = docstring(1, 0x2018);
#endif
else
- retdisp = lyx::from_ascii(disp);
+ retdisp = from_ascii(disp);
// in french, spaces are added inside double quotes
if (times_ == DoubleQ && prefixIs(loclang->code(), "fr")) {
if (side_ == LeftQ)
retdisp += ' ';
else
- retdisp.insert(docstring::size_type(0), 1, ' ');
+ retdisp.insert(size_t(0), 1, ' ');
}
return retdisp;
void InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const
{
- Font & font = mi.base.font;
+ FontInfo & font = mi.base.font;
frontend::FontMetrics const & fm =
theFontMetrics(font);
dim.asc = fm.maxAscent();
dim.des = fm.maxDescent();
dim.wid = 0;
- docstring const text = dispString(font.language());
+ // FIXME: should we add a language or a font parameter member?
+ docstring const text = dispString(
+ mi.base.bv->buffer().params().language);
for (string::size_type i = 0; i < text.length(); ++i) {
if (text[i] == ' ')
dim.wid += fm.width('i');
}
-#if 0
-Font const InsetQuotes::convertFont(Font const & f) const
-{
-#if 1
- return f;
-#else
- Font font(f);
- return font;
-#endif
-}
-#endif
-
-
void InsetQuotes::draw(PainterInfo & pi, int x, int y) const
{
- docstring const text = dispString(pi.base.font.language());
+ // FIXME: should we add a language or a font parameter member?
+ docstring const text = dispString(
+ pi.base.bv->buffer().params().language);
if (text.length() == 2 && text[0] == text[1]) {
pi.pain.text(x, y, text[0], pi.base.font);
&& lyxrc.fontenc != "T1") {
if (times_ == SingleQ)
switch (type) {
- case ',': features.require("quotesinglbase"); break;
+ case ',': features.require("quotesinglbase"); break;
case '<': features.require("guilsinglleft"); break;
case '>': features.require("guilsinglright"); break;
default: break;
}
-Inset::Code InsetQuotes::lyxCode() const
-{
- return Inset::QUOTE_CODE;
-}
-
-
} // namespace lyx