autologofication cleanup from John

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3064 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-11-23 09:59:01 +00:00
parent 96f078b748
commit 0d73b566a1
4 changed files with 44 additions and 46 deletions

View File

@ -287,10 +287,12 @@ void BufferView::copy()
{
if (available()) {
text->copySelection(this);
#if 0
// clear the selection, even if mark_set
toggleSelection();
text->clearSelection();
update(text, BufferView::SELECT|BufferView::FITCUR);
#endif
owner()->message(_("Copy"));
}
}

View File

@ -1,3 +1,8 @@
2001-11-23 John Levon <moz@compsoc.man.ac.uk>
* paragraph_pimpl.h:
* paragraph_pimpl.C: cleanup
2001-11-22 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* text2.C (removeRow):

View File

@ -244,6 +244,18 @@ void Paragraph::Pimpl::simpleTeXBlanks(std::ostream & os, TexRow & texrow,
}
bool Paragraph::Pimpl::isTextAt(string const & str, Paragraph::size_type pos)
{
for (int i=0; i < str.length(); ++i) {
if (pos + i >= size())
return false;
if (str[i] != getChar(pos + i))
return false;
}
return true;
}
void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
BufferParams const & bparams,
std::ostream & os,
@ -441,53 +453,32 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
break;
default:
/* idea for labels --- begin*/
// Check for "LyX"
if (c == 'L'
&& i <= size() - 3
&& font.family() != LyXFont::TYPEWRITER_FAMILY
&& getChar(i + 1) == 'y'
&& getChar(i + 2) == 'X') {
// I assume this is hack treating typewriter as verbatim
if (font.family() == LyXFont::TYPEWRITER_FAMILY) {
if (c != '\0') {
os << c;
}
break;
}
if (isTextAt("LyX", i)) {
os << "\\LyX{}";
i += 2;
column += 5;
}
// Check for "TeX"
else if (c == 'T'
&& i <= size() - 3
&& font.family() != LyXFont::TYPEWRITER_FAMILY
&& getChar(i + 1) == 'e'
&& getChar(i + 2) == 'X') {
} else if (isTextAt("TeX", i)) {
os << "\\TeX{}";
i += 2;
column += 5;
}
// Check for "LaTeX2e"
else if (c == 'L'
&& i <= size() - 7
&& font.family() != LyXFont::TYPEWRITER_FAMILY
&& getChar(i + 1) == 'a'
&& getChar(i + 2) == 'T'
&& getChar(i + 3) == 'e'
&& getChar(i + 4) == 'X'
&& getChar(i + 5) == '2'
&& getChar(i + 6) == 'e') {
} else if (isTextAt("LaTeX2e", i)) {
os << "\\LaTeXe{}";
i += 6;
column += 8;
}
// Check for "LaTeX"
else if (c == 'L'
&& i <= size() - 5
&& font.family() != LyXFont::TYPEWRITER_FAMILY
&& getChar(i + 1) == 'a'
&& getChar(i + 2) == 'T'
&& getChar(i + 3) == 'e'
&& getChar(i + 4) == 'X') {
} else if (isTextAt("LaTeX", i)) {
os << "\\LaTeX{}";
i += 4;
column += 7;
/* idea for labels --- end*/
// do we really try to print out '\0' ?
} else if (c != '\0') {
os << c;
}
@ -545,25 +536,22 @@ LyXFont const Paragraph::Pimpl::realizeFont(LyXFont const & font,
while (par && par->getDepth() && !tmpfont.resolved()) {
par = par->outerHook();
if (par) {
#ifndef INHERIT_LANGUAGE
tmpfont.realize(textclasslist.
Style(bparams.textclass,
par->getLayout()).font);
#else
tmpfont.realize(textclasslist.
Style(bparams.textclass,
par->getLayout()).font, bparams.language);
par->getLayout()).font
#ifdef INHERIT_LANGUAGE
, bparams.language
#endif
);
par_depth = par->getDepth();
}
}
#ifndef INHERIT_LANGUAGE
tmpfont.realize(textclasslist.TextClass(bparams.textclass)
.defaultfont());
#else
tmpfont.realize(textclasslist.TextClass(bparams.textclass)
.defaultfont(), bparams.language);
.defaultfont()
#ifdef INHERIT_LANGUAGE
, bparams.language
#endif
);
return tmpfont;
}

View File

@ -151,6 +151,9 @@ struct Paragraph::Pimpl {
///
ParagraphParameters params;
private:
/// match a string against a particular point in the paragraph
bool isTextAt(string const & str, Paragraph::size_type pos);
/// Who owns us?
Paragraph * owner_;
///