mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
remove NEW_WAY stuff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@850 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
90c533ae7d
commit
2dbd47535d
@ -412,12 +412,7 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(LyXTextClassList::size_type c1,
|
||||
+ textclasslist.NameOfClass(c1) + _(" to ")
|
||||
+ textclasslist.NameOfClass(c2);
|
||||
InsetError * new_inset = new InsetError(s);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(0, new_inset);
|
||||
#else
|
||||
par->InsertChar(0, LyXParagraph::META_INSET);
|
||||
par->InsertInset(0, new_inset);
|
||||
#endif
|
||||
}
|
||||
|
||||
par = par->next;
|
||||
|
177
src/buffer.C
177
src/buffer.C
@ -308,24 +308,13 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
if (token[0] != '\\') {
|
||||
for (string::const_iterator cit = token.begin();
|
||||
cit != token.end(); ++cit) {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertChar(pos, (*cit), font);
|
||||
#else
|
||||
par->InsertChar(pos, (*cit));
|
||||
par->SetFont(pos, font);
|
||||
#endif
|
||||
++pos;
|
||||
}
|
||||
} else if (token == "\\i") {
|
||||
Inset * inset = new InsetLatexAccent;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (token == "\\layout") {
|
||||
if (!return_par)
|
||||
@ -424,13 +413,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
nylex.setStream(istr);
|
||||
|
||||
inset->Read(this, nylex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
#endif
|
||||
} else if (token == "\\begin_deeper") {
|
||||
@ -816,178 +799,82 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
if (tmptok == "Quotes") {
|
||||
Inset * inset = new InsetQuotes;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "External") {
|
||||
Inset * inset = new InsetExternal;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "FormulaMacro") {
|
||||
Inset * inset = new InsetFormulaMacro;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "Formula") {
|
||||
Inset * inset = new InsetFormula;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "Figure") {
|
||||
Inset * inset = new InsetFig(100, 100, this);
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "Info") {
|
||||
Inset * inset = new InsetInfo;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "Include") {
|
||||
Inset * inset = new InsetInclude(string(), this);
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "ERT") {
|
||||
Inset * inset = new InsetERT;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "Tabular") {
|
||||
Inset * inset = new InsetTabular(this);
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "Text") {
|
||||
Inset * inset = new InsetText;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "Foot") {
|
||||
Inset * inset = new InsetFoot;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "Marginal") {
|
||||
Inset * inset = new InsetMarginal;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "Minipage") {
|
||||
Inset * inset = new InsetMinipage;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "Float") {
|
||||
Inset * inset = new InsetFloat;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "List") {
|
||||
Inset * inset = new InsetList;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (tmptok == "GRAPHICS") {
|
||||
Inset * inset = new InsetGraphics;
|
||||
//inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
} else if (tmptok == "LatexCommand") {
|
||||
InsetCommand inscmd;
|
||||
inscmd.Read(this, lex);
|
||||
@ -1031,13 +918,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
}
|
||||
|
||||
if (inset) {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
@ -1053,20 +934,10 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
lex.next();
|
||||
next_token = lex.GetString();
|
||||
if (next_token == "\\-") {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertChar(pos, '-', font);
|
||||
#else
|
||||
par->InsertChar(pos, '-');
|
||||
par->SetFont(pos, font);
|
||||
#endif
|
||||
} else if (next_token == "\\protected_separator"
|
||||
|| next_token == "~") {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertChar(pos, ' ', font);
|
||||
#else
|
||||
par->InsertChar(pos, ' ');
|
||||
par->SetFont(pos, font);
|
||||
#endif
|
||||
} else {
|
||||
lex.printError("Token `$$Token' "
|
||||
"is in free space "
|
||||
@ -1077,45 +948,23 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
} else {
|
||||
Inset * inset = new InsetSpecialChar;
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
}
|
||||
++pos;
|
||||
} else if (token == "\\newline") {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertChar(pos, LyXParagraph::META_NEWLINE, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_NEWLINE);
|
||||
par->SetFont(pos, font);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (token == "\\LyXTable") {
|
||||
#ifdef USE_TABULAR_INSETS
|
||||
Inset * inset = new InsetTabular(this);
|
||||
inset->Read(this, lex);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
++pos;
|
||||
#else
|
||||
par->table = new LyXTable(lex);
|
||||
#endif
|
||||
} else if (token == "\\hfill") {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertChar(pos, LyXParagraph::META_HFILL, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_HFILL);
|
||||
par->SetFont(pos, font);
|
||||
#endif
|
||||
++pos;
|
||||
} else if (token == "\\protected_separator") { // obsolete
|
||||
// This is a backward compability thingie. (Lgb)
|
||||
@ -1126,21 +975,10 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->GetLayout());
|
||||
|
||||
if (layout.free_spacing) {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertChar(pos, ' ', font);
|
||||
#else
|
||||
par->InsertChar(pos, ' ');
|
||||
par->SetFont(pos, font);
|
||||
#endif
|
||||
} else {
|
||||
Inset * inset = new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, inset, font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, font);
|
||||
par->InsertInset(pos, inset);
|
||||
#endif
|
||||
}
|
||||
++pos;
|
||||
} else if (token == "\\bibitem") { // ale970302
|
||||
@ -1148,12 +986,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->bibkey = new InsetBibKey;
|
||||
par->bibkey->Read(this, lex);
|
||||
}else if (token == "\\backslash") {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertChar(pos, '\\', font);
|
||||
#else
|
||||
par->InsertChar(pos, '\\');
|
||||
par->SetFont(pos, font);
|
||||
#endif
|
||||
++pos;
|
||||
}else if (token == "\\the_end") {
|
||||
the_end_read = true;
|
||||
@ -1163,12 +996,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
"Inserting as text.");
|
||||
for(string::const_iterator cit = token.begin();
|
||||
cit != token.end(); ++cit) {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertChar(pos, (*cit), font);
|
||||
#else
|
||||
par->InsertChar(pos, (*cit));
|
||||
par->SetFont(pos, font);
|
||||
#endif
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
@ -2899,12 +2727,7 @@ void Buffer::LinuxDocError(LyXParagraph * par, int pos,
|
||||
{
|
||||
// insert an error marker in text
|
||||
InsetError * new_inset = new InsetError(message);
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, new_inset);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->InsertInset(pos, new_inset);
|
||||
#endif
|
||||
}
|
||||
|
||||
// This constant defines the maximum number of
|
||||
|
@ -959,12 +959,7 @@ bool InsetText::InsertInset(BufferView * bv, Inset * inset)
|
||||
UpdatableInset * i = static_cast<UpdatableInset *>(inset);
|
||||
i->setOwner(static_cast<UpdatableInset *>(this));
|
||||
}
|
||||
#ifdef NEW_WAY
|
||||
cpar(bv)->InsertInset(cpos(bv), inset);
|
||||
#else
|
||||
cpar(bv)->InsertChar(cpos(bv), LyXParagraph::META_INSET);
|
||||
cpar(bv)->InsertInset(cpos(bv), inset);
|
||||
#endif
|
||||
TEXT(bv)->selection = 0;
|
||||
UpdateLocal(bv, CURSOR_PAR, true);
|
||||
static_cast<UpdatableInset*>(inset)->Edit(bv, 0, 0, 0);
|
||||
|
@ -6,7 +6,8 @@
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
* ======================================================
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
@ -2643,13 +2643,8 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
|
||||
current_view->text->cursor.par()->getParLanguage(current_view->buffer()->params);
|
||||
LyXFont font(LyXFont::ALL_INHERIT, lang);
|
||||
for (int i = 0; i < xsize * ysize - 1; ++i) {
|
||||
#ifdef NEW_WAY
|
||||
current_view->text->cursor.par()
|
||||
->InsertChar(0, LyXParagraph::META_NEWLINE, font);
|
||||
#else
|
||||
current_view->text->cursor.par()->InsertChar(0, LyXParagraph::META_NEWLINE);
|
||||
current_view->text->cursor.par()->SetFont(0, font);
|
||||
#endif
|
||||
}
|
||||
current_view->text->RedoParagraph(current_view);
|
||||
|
||||
|
@ -26,8 +26,6 @@
|
||||
#include "support/block.h"
|
||||
#include "language.h"
|
||||
|
||||
#define NEW_WAY 1
|
||||
|
||||
class BufferParams;
|
||||
class LyXBuffer;
|
||||
class TexRow;
|
||||
@ -424,16 +422,12 @@ public:
|
||||
size_type endpos) const;
|
||||
///
|
||||
void InsertChar(size_type pos, char c);
|
||||
#ifdef NEW_WAY
|
||||
///
|
||||
void InsertChar(size_type pos, char c, LyXFont const &);
|
||||
#endif
|
||||
///
|
||||
void InsertInset(size_type pos, Inset * inset);
|
||||
#ifdef NEW_WAY
|
||||
///
|
||||
void InsertInset(size_type pos, Inset * inset, LyXFont const &);
|
||||
#endif
|
||||
///
|
||||
bool InsertInsetAllowed(Inset * inset);
|
||||
///
|
||||
|
@ -464,17 +464,10 @@ bool LyXParagraph::InsertFromMinibuffer(LyXParagraph::size_type pos)
|
||||
if ((minibuffer_char == LyXParagraph::META_INSET) &&
|
||||
!InsertInsetAllowed(minibuffer_inset))
|
||||
return false;
|
||||
#ifdef NEW_WAY
|
||||
if (minibuffer_char == LyXParagraph::META_INSET)
|
||||
InsertInset(pos, minibuffer_inset, minibuffer_font);
|
||||
else
|
||||
InsertChar(pos, minibuffer_char, minibuffer_font);
|
||||
#else
|
||||
InsertChar(pos, minibuffer_char);
|
||||
SetFont(pos, minibuffer_font);
|
||||
if (minibuffer_char == LyXParagraph::META_INSET)
|
||||
InsertInset(pos, minibuffer_inset);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -608,43 +601,11 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos)
|
||||
|
||||
void LyXParagraph::InsertChar(LyXParagraph::size_type pos, char c)
|
||||
{
|
||||
#ifndef NEW_WAY
|
||||
// > because last is the next unused position, and you can
|
||||
// use it if you want
|
||||
if (pos > size()) {
|
||||
#ifndef NEW_INSETS
|
||||
if (next
|
||||
&& next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
|
||||
NextAfterFootnote()->InsertChar(pos - text.size() - 1,
|
||||
c);
|
||||
else
|
||||
#endif
|
||||
lyxerr.debug() << "ERROR (LyXParagraph::InsertChar): "
|
||||
"position does not exist." << endl;
|
||||
return;
|
||||
}
|
||||
text.insert(text.begin() + pos, c);
|
||||
// Update the font table.
|
||||
for (FontList::iterator it = lower_bound(fontlist.begin(),
|
||||
fontlist.end(),
|
||||
pos, matchFT());
|
||||
it != fontlist.end(); ++it)
|
||||
++(*it).pos;
|
||||
|
||||
// Update the inset table.
|
||||
for (InsetList::iterator it = lower_bound(insetlist.begin(),
|
||||
insetlist.end(),
|
||||
pos, matchIT());
|
||||
it != insetlist.end(); ++it)
|
||||
++(*it).pos;
|
||||
#else
|
||||
LyXFont f(LyXFont::ALL_INHERIT);
|
||||
InsertChar(pos, c, f);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef NEW_WAY
|
||||
void LyXParagraph::InsertChar(LyXParagraph::size_type pos,
|
||||
char c, LyXFont const & font)
|
||||
{
|
||||
@ -679,54 +640,16 @@ void LyXParagraph::InsertChar(LyXParagraph::size_type pos,
|
||||
|
||||
SetFont(pos, font);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void LyXParagraph::InsertInset(LyXParagraph::size_type pos,
|
||||
Inset * inset)
|
||||
{
|
||||
#ifdef NEW_WAY
|
||||
LyXFont f(LyXFont::ALL_INHERIT);
|
||||
InsertInset(pos, inset, f);
|
||||
#else
|
||||
// > because last is the next unused position, and you can
|
||||
// use it if you want
|
||||
if (pos > size()) {
|
||||
#ifndef NEW_INSETS
|
||||
if (next
|
||||
&& next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
|
||||
NextAfterFootnote()
|
||||
->InsertInset(pos - text.size() - 1, inset);
|
||||
else
|
||||
#endif
|
||||
lyxerr << "ERROR (LyXParagraph::InsertInset): "
|
||||
"position does not exist: " << pos << endl;
|
||||
return;
|
||||
}
|
||||
if (text[pos] != LyXParagraph::META_INSET) {
|
||||
lyxerr << "ERROR (LyXParagraph::InsertInset): "
|
||||
"there is no LyXParagraph::META_INSET" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (inset) {
|
||||
// Add a new entry in the inset table.
|
||||
InsetList::iterator it = lower_bound(insetlist.begin(),
|
||||
insetlist.end(),
|
||||
pos, matchIT());
|
||||
if (it != insetlist.end() && (*it).pos == pos)
|
||||
lyxerr << "ERROR (LyXParagraph::InsertInset): "
|
||||
"there is an inset in position: " << pos << endl;
|
||||
else
|
||||
insetlist.insert(it, InsetTable(pos,inset));
|
||||
if (inset_owner)
|
||||
inset->setOwner(inset_owner);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef NEW_WAY
|
||||
void LyXParagraph::InsertInset(LyXParagraph::size_type pos,
|
||||
Inset * inset, LyXFont const & font)
|
||||
{
|
||||
@ -763,7 +686,6 @@ void LyXParagraph::InsertInset(LyXParagraph::size_type pos,
|
||||
if (inset_owner)
|
||||
inset->setOwner(inset_owner);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool LyXParagraph::InsertInsetAllowed(Inset * inset)
|
||||
|
20
src/text.C
20
src/text.C
@ -2095,12 +2095,7 @@ void LyXText::TableFeatures(BufferView * bview, int feature) const
|
||||
Language const * lang = cursor.par()->getParLanguage(bview->buffer()->params);
|
||||
LyXFont font(LyXFont::ALL_INHERIT,lang);
|
||||
for (int i = 0; i < number; ++i) {
|
||||
#ifdef NEW_WAY
|
||||
cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE, font);
|
||||
#else
|
||||
cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE);
|
||||
cursor.par()->SetFont(pos, font);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* append the row into the table */
|
||||
@ -2138,12 +2133,7 @@ void LyXText::TableFeatures(BufferView * bview, int feature) const
|
||||
Language const * lang = cursor.par()->getParLanguage(bview->buffer()->params);
|
||||
LyXFont font(LyXFont::ALL_INHERIT,lang);
|
||||
for (int i = 0; i < number; ++i) {
|
||||
#ifdef NEW_WAY
|
||||
cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE, font);
|
||||
#else
|
||||
cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE);
|
||||
cursor.par()->SetFont(pos, font);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* append the row into the table */
|
||||
@ -2160,14 +2150,9 @@ void LyXText::TableFeatures(BufferView * bview, int feature) const
|
||||
do{
|
||||
if (pos && (cursor.par()->IsNewline(pos-1))){
|
||||
if (cursor.par()->table->AppendCellAfterCell(cell_org, cell)) {
|
||||
#ifdef NEW_WAY
|
||||
cursor.par()->InsertChar(pos,
|
||||
LyXParagraph::META_NEWLINE,
|
||||
font);
|
||||
#else
|
||||
cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE);
|
||||
cursor.par()->SetFont(pos, font);
|
||||
#endif
|
||||
if (pos <= cursor.pos())
|
||||
cursor.pos(cursor.pos() + 1);
|
||||
++pos;
|
||||
@ -2180,13 +2165,8 @@ void LyXText::TableFeatures(BufferView * bview, int feature) const
|
||||
This saves one byte memory per table ;-) */
|
||||
if (cursor.par()->table->AppendCellAfterCell(cell_org, cell)) {
|
||||
LyXParagraph::size_type last = cursor.par()->Last();
|
||||
#ifdef NEW_WAY
|
||||
cursor.par()->InsertChar(last,
|
||||
LyXParagraph::META_NEWLINE, font);
|
||||
#else
|
||||
cursor.par()->InsertChar(last, LyXParagraph::META_NEWLINE);
|
||||
cursor.par()->SetFont(last, font);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* append the column into the table */
|
||||
|
43
src/text2.C
43
src/text2.C
@ -2028,12 +2028,7 @@ void LyXText::InsertInset(BufferView * bview, Inset * inset)
|
||||
SetUndo(bview->buffer(), Undo::INSERT,
|
||||
cursor.par()->ParFromPos(cursor.pos())->previous,
|
||||
cursor.par()->ParFromPos(cursor.pos())->next);
|
||||
#ifdef NEW_WAY
|
||||
cursor.par()->InsertInset(cursor.pos(), inset);
|
||||
#else
|
||||
cursor.par()->InsertChar(cursor.pos(), LyXParagraph::META_INSET);
|
||||
cursor.par()->InsertInset(cursor.pos(), inset);
|
||||
#endif
|
||||
InsertChar(bview, LyXParagraph::META_INSET); /* just to rebreak and refresh correctly.
|
||||
* The character will not be inserted a
|
||||
* second time */
|
||||
@ -2307,12 +2302,7 @@ void LyXText::ReplaceSelectionWithString(BufferView * bview, char const * str)
|
||||
|
||||
// Insert the new string
|
||||
for (int i = 0; str[i]; ++i) {
|
||||
#ifdef NEW_WAY
|
||||
sel_end_cursor.par()->InsertChar(pos, str[i], font);
|
||||
#else
|
||||
sel_end_cursor.par()->InsertChar(pos, str[i]);
|
||||
sel_end_cursor.par()->SetFont(pos, font);
|
||||
#endif
|
||||
++pos;
|
||||
}
|
||||
|
||||
@ -2396,12 +2386,7 @@ void LyXText::InsertStringA(BufferView * bview, string const & str)
|
||||
if (str[i] == ' '
|
||||
&& i + 1 < str.length() && str[i + 1] != ' '
|
||||
&& pos && par->GetChar(pos - 1)!= ' ') {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertChar(pos, ' ', current_font);
|
||||
#else
|
||||
par->InsertChar(pos,' ');
|
||||
par->SetFont(pos, current_font);
|
||||
#endif
|
||||
++pos;
|
||||
#ifndef NEW_TABLAR
|
||||
} else if (par->table) {
|
||||
@ -2415,13 +2400,8 @@ void LyXText::InsertStringA(BufferView * bview, string const & str)
|
||||
break;
|
||||
} else if ((str[i] != 13) &&
|
||||
((str[i] & 127) >= ' ')) {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertChar(pos, str[i],
|
||||
current_font);
|
||||
#else
|
||||
par->InsertChar(pos, str[i]);
|
||||
par->SetFont(pos, current_font);
|
||||
#endif
|
||||
++pos;
|
||||
}
|
||||
#endif
|
||||
@ -2429,14 +2409,8 @@ void LyXText::InsertStringA(BufferView * bview, string const & str)
|
||||
InsetSpecialChar * new_inset =
|
||||
new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
|
||||
if (par->InsertInsetAllowed(new_inset)) {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, new_inset,
|
||||
current_font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, current_font);
|
||||
par->InsertInset(pos, new_inset);
|
||||
#endif
|
||||
} else {
|
||||
delete new_inset;
|
||||
}
|
||||
@ -2446,14 +2420,8 @@ void LyXText::InsertStringA(BufferView * bview, string const & str)
|
||||
InsetSpecialChar * new_inset =
|
||||
new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
|
||||
if (par->InsertInsetAllowed(new_inset)) {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos, new_inset,
|
||||
current_font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, current_font);
|
||||
par->InsertInset(pos, new_inset);
|
||||
#endif
|
||||
} else {
|
||||
delete new_inset;
|
||||
}
|
||||
@ -2462,12 +2430,7 @@ void LyXText::InsertStringA(BufferView * bview, string const & str)
|
||||
} else if (str[i] != 13 &&
|
||||
// Ignore unprintables
|
||||
(str[i] & 127) >= ' ') {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertChar(pos, str[i], current_font);
|
||||
#else
|
||||
par->InsertChar(pos, str[i]);
|
||||
par->SetFont(pos, current_font);
|
||||
#endif
|
||||
++pos;
|
||||
}
|
||||
} else {
|
||||
@ -2501,15 +2464,9 @@ void LyXText::InsertStringA(BufferView * bview, string const & str)
|
||||
InsetSpecialChar * new_inset =
|
||||
new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
|
||||
if (par->InsertInsetAllowed(new_inset)) {
|
||||
#ifdef NEW_WAY
|
||||
par->InsertInset(pos,
|
||||
new_inset,
|
||||
current_font);
|
||||
#else
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->SetFont(pos, current_font);
|
||||
par->InsertInset(pos, new_inset);
|
||||
#endif
|
||||
} else {
|
||||
delete new_inset;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user