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()) { if (available()) {
text->copySelection(this); text->copySelection(this);
#if 0
// clear the selection, even if mark_set // clear the selection, even if mark_set
toggleSelection(); toggleSelection();
text->clearSelection(); text->clearSelection();
update(text, BufferView::SELECT|BufferView::FITCUR); update(text, BufferView::SELECT|BufferView::FITCUR);
#endif
owner()->message(_("Copy")); 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> 2001-11-22 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* text2.C (removeRow): * 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, void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
BufferParams const & bparams, BufferParams const & bparams,
std::ostream & os, std::ostream & os,
@ -441,53 +453,32 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
break; break;
default: default:
/* idea for labels --- begin*/
// Check for "LyX" // I assume this is hack treating typewriter as verbatim
if (c == 'L' if (font.family() == LyXFont::TYPEWRITER_FAMILY) {
&& i <= size() - 3 if (c != '\0') {
&& font.family() != LyXFont::TYPEWRITER_FAMILY os << c;
&& getChar(i + 1) == 'y' }
&& getChar(i + 2) == 'X') { break;
}
if (isTextAt("LyX", i)) {
os << "\\LyX{}"; os << "\\LyX{}";
i += 2; i += 2;
column += 5; column += 5;
} } else if (isTextAt("TeX", i)) {
// Check for "TeX"
else if (c == 'T'
&& i <= size() - 3
&& font.family() != LyXFont::TYPEWRITER_FAMILY
&& getChar(i + 1) == 'e'
&& getChar(i + 2) == 'X') {
os << "\\TeX{}"; os << "\\TeX{}";
i += 2; i += 2;
column += 5; column += 5;
} } else if (isTextAt("LaTeX2e", i)) {
// 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') {
os << "\\LaTeXe{}"; os << "\\LaTeXe{}";
i += 6; i += 6;
column += 8; column += 8;
} } else if (isTextAt("LaTeX", i)) {
// 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') {
os << "\\LaTeX{}"; os << "\\LaTeX{}";
i += 4; i += 4;
column += 7; column += 7;
/* idea for labels --- end*/ // do we really try to print out '\0' ?
} else if (c != '\0') { } else if (c != '\0') {
os << c; os << c;
} }
@ -545,25 +536,22 @@ LyXFont const Paragraph::Pimpl::realizeFont(LyXFont const & font,
while (par && par->getDepth() && !tmpfont.resolved()) { while (par && par->getDepth() && !tmpfont.resolved()) {
par = par->outerHook(); par = par->outerHook();
if (par) { if (par) {
#ifndef INHERIT_LANGUAGE
tmpfont.realize(textclasslist. tmpfont.realize(textclasslist.
Style(bparams.textclass, Style(bparams.textclass,
par->getLayout()).font); par->getLayout()).font
#else #ifdef INHERIT_LANGUAGE
tmpfont.realize(textclasslist. , bparams.language
Style(bparams.textclass,
par->getLayout()).font, bparams.language);
#endif #endif
);
par_depth = par->getDepth(); par_depth = par->getDepth();
} }
} }
#ifndef INHERIT_LANGUAGE
tmpfont.realize(textclasslist.TextClass(bparams.textclass) tmpfont.realize(textclasslist.TextClass(bparams.textclass)
.defaultfont()); .defaultfont()
#else #ifdef INHERIT_LANGUAGE
tmpfont.realize(textclasslist.TextClass(bparams.textclass) , bparams.language
.defaultfont(), bparams.language);
#endif #endif
);
return tmpfont; return tmpfont;
} }

View File

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