remove !NEW_INSETS cruft

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1980 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-05-03 14:31:33 +00:00
parent 53c5edb99e
commit 4c6091b63f
31 changed files with 166 additions and 3700 deletions

View File

@ -170,18 +170,8 @@ public:
void menuUndo(); void menuUndo();
/// ///
void menuRedo(); void menuRedo();
#ifndef NEW_INSETS
///
void toggleFloat();
///
void openStuff();
#endif
/// ///
void insertNote(); void insertNote();
#ifndef NEW_INSETS
///
void allFloats(char flag, char figmar);
#endif
/// removes all autodeletable insets /// removes all autodeletable insets
bool removeAutoInsets(); bool removeAutoInsets();
/// ///

View File

@ -106,26 +106,7 @@ bool BufferView::removeAutoInsets()
LyXCursor cursor; LyXCursor cursor;
bool a = false; bool a = false;
#ifndef NEW_INSETS
while (par) {
// this has to be done before the delete
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
text->SetCursor(this, cursor, par, 0);
if (par->AutoDeleteInsets()){
a = true;
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
text->RedoParagraphs(this, cursor,
cursor.par()->next());
text->FullRebreak(this);
}
}
par = par->next_;
}
// avoid forbidden cursor positions caused by error removing
if (tmpcursor.pos() > tmpcursor.par()->Last())
tmpcursor.pos(tmpcursor.par()->Last());
#else
while (par) { while (par) {
// this has to be done before the delete // this has to be done before the delete
text->SetCursor(this, cursor, par, 0); text->SetCursor(this, cursor, par, 0);
@ -141,7 +122,7 @@ bool BufferView::removeAutoInsets()
// avoid forbidden cursor positions caused by error removing // avoid forbidden cursor positions caused by error removing
if (tmpcursor.pos() > tmpcursor.par()->size()) if (tmpcursor.pos() > tmpcursor.par()->size())
tmpcursor.pos(tmpcursor.par()->size()); tmpcursor.pos(tmpcursor.par()->size());
#endif
text->SetCursorIntern(this, tmpcursor.par(), tmpcursor.pos()); text->SetCursorIntern(this, tmpcursor.par(), tmpcursor.pos());
return a; return a;
@ -153,12 +134,6 @@ void BufferView::insertErrors(TeXErrors & terr)
// Save the cursor position // Save the cursor position
LyXCursor cursor = text->cursor; LyXCursor cursor = text->cursor;
#ifndef NEW_INSETS
// This is drastic, but it's the only fix, I could find. (Asger)
allFloats(1, 0);
allFloats(1, 1);
#endif
for (TeXErrors::Errors::const_iterator cit = terr.begin(); for (TeXErrors::Errors::const_iterator cit = terr.begin();
cit != terr.end(); cit != terr.end();
++cit) { ++cit) {
@ -237,11 +212,7 @@ bool BufferView::insertInset(Inset * inset, string const & lout,
text->BreakParagraph(this); text->BreakParagraph(this);
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
#ifndef NEW_INSETS
if (text->cursor.par()->Last()) {
#else
if (text->cursor.par()->size()) { if (text->cursor.par()->size()) {
#endif
text->CursorLeft(this); text->CursorLeft(this);
text->BreakParagraph(this); text->BreakParagraph(this);
@ -322,96 +293,6 @@ bool BufferView::gotoLabel(string const & label)
} }
#ifndef NEW_INSETS
void BufferView::allFloats(char flag, char figmar)
{
if (!available()) return;
LyXCursor cursor = text->cursor;
if (!flag
&& cursor.par()->footnoteflag != LyXParagraph::NO_FOOTNOTE
&& ((figmar
&& cursor.par()->footnotekind != LyXParagraph::FOOTNOTE
&& cursor.par()->footnotekind != LyXParagraph::MARGIN
)
|| (!figmar
&& cursor.par()->footnotekind != LyXParagraph::FIG
&& cursor.par()->footnotekind != LyXParagraph::TAB
&& cursor.par()->footnotekind != LyXParagraph::WIDE_FIG
&& cursor.par()->footnotekind != LyXParagraph::WIDE_TAB
&& cursor.par()->footnotekind != LyXParagraph::ALGORITHM)))
toggleFloat();
else
beforeChange(text);
LyXCursor tmpcursor = cursor;
cursor.par(tmpcursor.par()->ParFromPos(tmpcursor.pos()));
cursor.pos(tmpcursor.par()->PositionInParFromPos(tmpcursor.pos()));
LyXParagraph *par = buffer()->paragraph;
while (par) {
if (flag) {
if (par->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE
&& ((figmar
&& par->footnotekind != LyXParagraph::FOOTNOTE
&& par->footnotekind != LyXParagraph::MARGIN)
|| (!figmar
&& par->footnotekind != LyXParagraph::FIG
&& par->footnotekind != LyXParagraph::TAB
&& par->footnotekind != LyXParagraph::WIDE_FIG
&& par->footnotekind != LyXParagraph::WIDE_TAB
&& par->footnotekind != LyXParagraph::ALGORITHM
)
)
) {
if (par->previous_
&& par->previous_->footnoteflag !=
LyXParagraph::CLOSED_FOOTNOTE){ /* should be */
text->SetCursorIntern(this,
par->previous_,
0);
text->OpenFootnote(this);
}
}
} else {
if (par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
&& (
(figmar
&&
par->footnotekind != LyXParagraph::FOOTNOTE
&&
par->footnotekind != LyXParagraph::MARGIN
)
||
(!figmar
&&
par->footnotekind != LyXParagraph::FIG
&&
par->footnotekind != LyXParagraph::TAB
&&
par->footnotekind != LyXParagraph::WIDE_FIG
&&
par->footnotekind != LyXParagraph::WIDE_TAB
&&
par->footnotekind != LyXParagraph::ALGORITHM
)
)
) {
text->SetCursorIntern(this, par, 0);
text->CloseFootnote(this);
}
}
par = par->next_;
}
text->SetCursorIntern(this, cursor.par(), cursor.pos());
redraw();
fitCursor(text);
}
#endif
void BufferView::insertNote() void BufferView::insertNote()
{ {
InsetInfo * new_inset = new InsetInfo(); InsetInfo * new_inset = new InsetInfo();
@ -420,35 +301,6 @@ void BufferView::insertNote()
} }
#ifndef NEW_INSETS
void BufferView::openStuff()
{
if (available()) {
owner()->message(_("Open/Close..."));
hideCursor();
beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
text->OpenStuff(this);
update(text, BufferView::SELECT|BufferView::FITCUR);
setState();
}
}
void BufferView::toggleFloat()
{
if (available()) {
owner()->message(_("Open/Close..."));
hideCursor();
beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
text->ToggleFootnote(this);
update(text, BufferView::SELECT|BufferView::FITCUR);
setState();
}
}
#endif
void BufferView::menuUndo() void BufferView::menuUndo()
{ {
if (available()) { if (available()) {
@ -841,17 +693,9 @@ void BufferView::lockedInsetStoreUndo(Undo::undo_kind kind)
return; // shouldn't happen return; // shouldn't happen
if (kind == Undo::EDIT) // in this case insets would not be stored! if (kind == Undo::EDIT) // in this case insets would not be stored!
kind = Undo::FINISH; kind = Undo::FINISH;
#ifndef NEW_INSETS
text->SetUndo(buffer(), kind,
text->cursor.par()->
ParFromPos(text->cursor.pos())->previous_,
text->cursor.par()->
ParFromPos(text->cursor.pos())->next_);
#else
text->SetUndo(buffer(), kind, text->SetUndo(buffer(), kind,
text->cursor.par()->previous(), text->cursor.par()->previous(),
text->cursor.par()->next()); text->cursor.par()->next());
#endif
} }
@ -905,13 +749,8 @@ bool BufferView::ChangeInsets(Inset::Code code,
LyXParagraph * par = buffer()->paragraph; LyXParagraph * par = buffer()->paragraph;
LyXCursor cursor = text->cursor; LyXCursor cursor = text->cursor;
LyXCursor tmpcursor = cursor; LyXCursor tmpcursor = cursor;
#ifndef NEW_INSETS
cursor.par(tmpcursor.par()->ParFromPos(tmpcursor.pos()));
cursor.pos(tmpcursor.par()->PositionInParFromPos(tmpcursor.pos()));
#else
cursor.par(tmpcursor.par()); cursor.par(tmpcursor.par());
cursor.pos(tmpcursor.pos()); cursor.pos(tmpcursor.pos());
#endif
while (par) { while (par) {
bool flag2 = false; bool flag2 = false;
@ -925,20 +764,6 @@ bool BufferView::ChangeInsets(Inset::Code code,
} }
} }
} }
#ifndef NEW_INSETS
if (flag2) {
flag = true;
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
// this is possible now, since SetCursor takes
// care about footnotes
text->SetCursorIntern(this, par, 0);
text->RedoParagraphs(this, text->cursor,
text->cursor.par()->next());
text->FullRebreak(this);
}
}
par = par->next_;
#else
if (flag2) { if (flag2) {
flag = true; flag = true;
// this is possible now, since SetCursor takes // this is possible now, since SetCursor takes
@ -949,7 +774,6 @@ bool BufferView::ChangeInsets(Inset::Code code,
text->FullRebreak(this); text->FullRebreak(this);
} }
par = par->next(); par = par->next();
#endif
} }
text->SetCursorIntern(this, cursor.par(), cursor.pos()); text->SetCursorIntern(this, cursor.par(), cursor.pos());
return flag; return flag;

View File

@ -807,73 +807,6 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
return; return;
} }
#ifndef NEW_INSETS
// check whether we want to open a float
if (bv_->text) {
bool hit = false;
char c = ' ';
if (bv_->text->cursor.pos() <
bv_->text->cursor.par()->Last()) {
c = bv_->text->cursor.par()->
GetChar(bv_->text->cursor.pos());
}
if(!bv_->text->selection)
if (c == LyXParagraph::META_FOOTNOTE
|| c == LyXParagraph::META_MARGIN
|| c == LyXParagraph::META_FIG
|| c == LyXParagraph::META_TAB
|| c == LyXParagraph::META_WIDE_FIG
|| c == LyXParagraph::META_WIDE_TAB
|| c == LyXParagraph::META_ALGORITHM){
hit = true;
} else
if (bv_->text->cursor.pos() - 1 >= 0) {
c = bv_->text->cursor.par()->
GetChar(bv_->text->cursor.pos() - 1);
if (c == LyXParagraph::META_FOOTNOTE
|| c == LyXParagraph::META_MARGIN
|| c == LyXParagraph::META_FIG
|| c == LyXParagraph::META_TAB
|| c == LyXParagraph::META_WIDE_FIG
|| c == LyXParagraph::META_WIDE_TAB
|| c == LyXParagraph::META_ALGORITHM){
// We are one step too far to the right
bv_->text->CursorLeft(bv_);
hit = true;
}
}
if (hit == true) {
bv_->toggleFloat();
selection_possible = false;
return;
}
}
// Do we want to close a float? (click on the float-label)
if (bv_->text->cursor.row()->par()->footnoteflag ==
LyXParagraph::OPEN_FOOTNOTE
&& bv_->text->cursor.row()->previous() &&
bv_->text->cursor.row()->previous()->par()->
footnoteflag != LyXParagraph::OPEN_FOOTNOTE){
LyXFont font(LyXFont::ALL_SANE);
font.setSize(LyXFont::SIZE_FOOTNOTE);
int box_x = 20; // LYX_PAPER_MARGIN;
box_x += lyxfont::width(" wide-tab ", font);
unsigned int screen_first = bv_->text->first;
if (x < box_x
&& y + screen_first > bv_->text->cursor.y() -
bv_->text->cursor.row()->baseline()
&& y + screen_first < bv_->text->cursor.y() -
bv_->text->cursor.row()->baseline()
+ lyxfont::maxAscent(font) * 1.2 + lyxfont::maxDescent(font) * 1.2) {
bv_->toggleFloat();
selection_possible = false;
return;
}
}
#else
// check whether we want to open a float // check whether we want to open a float
if (bv_->text) { if (bv_->text) {
bool hit = false; bool hit = false;
@ -892,7 +825,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
return; return;
} }
} }
#endif
// Maybe we want to edit a bibitem ale970302 // Maybe we want to edit a bibitem ale970302
if (bv_->text->cursor.par()->bibkey && x < 20 + if (bv_->text->cursor.par()->bibkey && x < 20 +
bibitemMaxWidth(bv_, textclasslist. bibitemMaxWidth(bv_, textclasslist.
@ -923,11 +856,7 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
text->SetCursor(bv_, cursor, cursor.par(),cursor.pos(),true); text->SetCursor(bv_, cursor, cursor.par(),cursor.pos(),true);
#ifndef NEW_INSETS
if (cursor.pos() < cursor.par()->Last()
#else
if (cursor.pos() < cursor.par()->size() if (cursor.pos() < cursor.par()->size()
#endif
&& cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET && cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET
&& cursor.par()->GetInset(cursor.pos()) && cursor.par()->GetInset(cursor.pos())
&& cursor.par()->GetInset(cursor.pos())->Editable()) { && cursor.par()->GetInset(cursor.pos())->Editable()) {
@ -1219,7 +1148,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
if (i >= saved_positions_num) if (i >= saved_positions_num)
return; return;
string fname = saved_positions[i].filename; string const fname = saved_positions[i].filename;
beforeChange(bv_->text); beforeChange(bv_->text);
@ -1234,13 +1163,9 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
if (!par) if (!par)
return; return;
#ifndef NEW_INSETS
bv_->text->SetCursor(bv_, par,
min(par->Last(), saved_positions[i].par_pos));
#else
bv_->text->SetCursor(bv_, par, bv_->text->SetCursor(bv_, par,
min(par->size(), saved_positions[i].par_pos)); min(par->size(), saved_positions[i].par_pos));
#endif
update(bv_->text, BufferView::SELECT|BufferView::FITCUR); update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
if (i > 0) { if (i > 0) {
string const str = _("Moved to bookmark") + ' ' + tostr(i); string const str = _("Moved to bookmark") + ' ' + tostr(i);
@ -1838,11 +1763,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
update(TEXT(bv_), BufferView::SELECT|BufferView::FITCUR); update(TEXT(bv_), BufferView::SELECT|BufferView::FITCUR);
if (is_rtl) if (is_rtl)
TEXT(bv_)->CursorLeft(bv_, false); TEXT(bv_)->CursorLeft(bv_, false);
#ifndef NEW_INSETS
if (TEXT(bv_)->cursor.pos() < TEXT(bv_)->cursor.par()->Last()
#else
if (TEXT(bv_)->cursor.pos() < TEXT(bv_)->cursor.par()->size() if (TEXT(bv_)->cursor.pos() < TEXT(bv_)->cursor.par()->size()
#endif
&& TEXT(bv_)->cursor.par()->GetChar(TEXT(bv_)->cursor.pos()) && TEXT(bv_)->cursor.par()->GetChar(TEXT(bv_)->cursor.pos())
== LyXParagraph::META_INSET == LyXParagraph::META_INSET
&& TEXT(bv_)->cursor.par()->GetInset(TEXT(bv_)->cursor.pos()) && TEXT(bv_)->cursor.par()->GetInset(TEXT(bv_)->cursor.pos())
@ -1880,11 +1801,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
if (!is_rtl) if (!is_rtl)
TEXT(bv_)->CursorLeft(bv_, false); TEXT(bv_)->CursorLeft(bv_, false);
if ((is_rtl || cur != TEXT(bv_)->cursor) && // only if really moved! if ((is_rtl || cur != TEXT(bv_)->cursor) && // only if really moved!
#ifndef NEW_INSETS
TEXT(bv_)->cursor.pos() < TEXT(bv_)->cursor.par()->Last() &&
#else
TEXT(bv_)->cursor.pos() < TEXT(bv_)->cursor.par()->size() && TEXT(bv_)->cursor.pos() < TEXT(bv_)->cursor.par()->size() &&
#endif
(TEXT(bv_)->cursor.par()->GetChar(TEXT(bv_)->cursor.pos()) == (TEXT(bv_)->cursor.par()->GetChar(TEXT(bv_)->cursor.pos()) ==
LyXParagraph::META_INSET) && LyXParagraph::META_INSET) &&
TEXT(bv_)->cursor.par()->GetInset(TEXT(bv_)->cursor.pos()) && TEXT(bv_)->cursor.par()->GetInset(TEXT(bv_)->cursor.pos()) &&
@ -2255,11 +2172,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
LyXCursor cursor = TEXT(bv_)->cursor; LyXCursor cursor = TEXT(bv_)->cursor;
if (!TEXT(bv_)->selection) { if (!TEXT(bv_)->selection) {
#ifndef NEW_INSETS
if (cursor.pos() == cursor.par()->Last()) {
#else
if (cursor.pos() == cursor.par()->size()) { if (cursor.pos() == cursor.par()->size()) {
#endif
TEXT(bv_)->CursorRight(bv_); TEXT(bv_)->CursorRight(bv_);
cursor = TEXT(bv_)->cursor; cursor = TEXT(bv_)->cursor;
if (cursor.pos() == 0 if (cursor.pos() == 0

View File

@ -1,3 +1,43 @@
2001-05-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
* undo.C: remove !NEW_INSETS cruft
2001-04-28 Lars Gullik Bjønnes <larsbj@birdstep.com>
* text2.C: remove !NEW_INSETS cruft
* text.C: remove !NEW_INSETS cruft
* tabular.C: remove !NEW_INSETS cruft
* spellchecker.C: remove !NEW_INSETS cruft
* lyxtext.h: remove !NEW_INSETS cruft
* lyxlex_pimpl.C: remove !NEW_INSETS cruft
* lyxfunc.C: remove !NEW_INSETS cruft
* lyxfind.C: remove !NEW_INSETS cruft
* lyx_cb.C: remove !NEW_INSETS cruft
* figureForm.C: remove !NEW_INSETS cruft
* bufferview_funcs.[Ch]: remove !NEW_INSETS cruft
* buffer.[Ch]: remove !NEW_INSETS cruft
* ToolbarDefaults.C: remove !NEW_INSETS cruft
* CutAndPaste.C: remove !NEW_INSETS cruft
* BufferView_pimpl.C: remove !NEW_INSETS cruft
* BufferView2.C: remove !NEW_INSETS cruft
* BufferView.h: remove !NEW_INSETS cruft
2001-05-03 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 2001-05-03 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* Lsstream.h: include LString.h before the sstream headers to * Lsstream.h: include LString.h before the sstream headers to

View File

@ -63,11 +63,7 @@ void DeleteBuffer()
while (buf) { while (buf) {
tmppar = buf; tmppar = buf;
#ifndef NEW_INSETS
buf = buf->next_;
#else
buf = buf->next(); buf = buf->next();
#endif
delete tmppar; delete tmppar;
} }
buf = 0; buf = 0;
@ -76,76 +72,6 @@ void DeleteBuffer()
} // namespace anon } // namespace anon
#ifndef NEW_INSETS
bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar,
int start, int & end, char tc, bool doclear)
{
if (!startpar || (start > startpar->Last()))
return false;
DeleteBuffer();
textclass = tc;
if (!(*endpar) ||
(startpar->ParFromPos(start) ==
(*endpar)->ParFromPos(end))) {
// only within one paragraph
buf = new LyXParagraph;
LyXParagraph::size_type i = start;
if (end > startpar->Last())
end = startpar->Last();
for (; i < end; ++i) {
startpar->CopyIntoMinibuffer(*current_view->buffer(), start);
startpar->Erase(start);
buf->InsertFromMinibuffer(buf->Last());
}
end = start - 1;
} else {
// more than one paragraph
(*endpar)->BreakParagraphConservative(current_view->buffer()->params,
end);
*endpar = (*endpar)->next();
end = 0;
startpar->BreakParagraphConservative(current_view->buffer()->params,
start);
// store the selection
buf = startpar->ParFromPos(start)->next_;
buf->previous(0);
(*endpar)->previous()->next(0);
// cut the selection
startpar->ParFromPos(start)->next(*endpar);
(*endpar)->previous(startpar->ParFromPos(start));
// care about footnotes
if (buf->footnoteflag) {
LyXParagraph * tmppar = buf;
while (tmppar){
tmppar->footnoteflag = LyXParagraph::NO_FOOTNOTE;
tmppar = tmppar->next_;
}
}
// the cut selection should begin with standard layout
buf->Clear();
// paste the paragraphs again, if possible
if (doclear)
startpar->next()->StripLeadingSpaces(textclass);
if (startpar->FirstPhysicalPar()->HasSameLayout(startpar->next()) ||
!startpar->next()->Last()) {
startpar->ParFromPos(start)->PasteParagraph(current_view->buffer()->params);
(*endpar) = startpar; // this because endpar gets deleted here!
}
}
return true;
}
#else
bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar, bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar,
int start, int & end, char tc, bool doclear) int start, int & end, char tc, bool doclear)
{ {
@ -206,72 +132,8 @@ bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar,
} }
return true; return true;
} }
#endif
#ifndef NEW_INSETS
bool CutAndPaste::copySelection(LyXParagraph * startpar, LyXParagraph * endpar,
int start, int end, char tc)
{
if (!startpar || (start > startpar->Last()))
return false;
DeleteBuffer();
textclass = tc;
if (!(endpar) ||
(startpar->ParFromPos(start) ==
(endpar)->ParFromPos(end))) {
// only within one paragraph
buf = new LyXParagraph;
LyXParagraph::size_type i = start;
if (end > startpar->Last())
end = startpar->Last();
for (; i < end; ++i) {
startpar->CopyIntoMinibuffer(*current_view->buffer(),
i);
buf->InsertFromMinibuffer(buf->Last());
}
} else {
// copy more than one paragraph
// clone the paragraphs within the selection
LyXParagraph * tmppar = startpar->ParFromPos(start);
buf = tmppar->Clone();
LyXParagraph * tmppar2 = buf;
while (tmppar != endpar->ParFromPos(end)
&& tmppar->next_) {
tmppar = tmppar->next_;
tmppar2->next(tmppar->Clone());
tmppar2->next_->previous(tmppar2);
tmppar2 = tmppar2->next_;
}
tmppar2->next(0);
// care about footnotes
if (buf->footnoteflag) {
tmppar = buf;
while (tmppar) {
tmppar->footnoteflag = LyXParagraph::NO_FOOTNOTE;
tmppar = tmppar->next_;
}
}
// the buf paragraph is too big
LyXParagraph::size_type tmpi2 = startpar->PositionInParFromPos(start);
for (; tmpi2; --tmpi2)
buf->Erase(0);
// now tmppar 2 is too big, delete all after end
tmpi2 = endpar->PositionInParFromPos(end);
while (tmppar2->size() > tmpi2) {
tmppar2->Erase(tmppar2->size() - 1);
}
}
return true;
}
#else
bool CutAndPaste::copySelection(LyXParagraph * startpar, LyXParagraph * endpar, bool CutAndPaste::copySelection(LyXParagraph * startpar, LyXParagraph * endpar,
int start, int end, char tc) int start, int end, char tc)
{ {
@ -322,131 +184,8 @@ bool CutAndPaste::copySelection(LyXParagraph * startpar, LyXParagraph * endpar,
} }
return true; return true;
} }
#endif
#ifndef NEW_INSETS
bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar,
int & pos, char tc)
{
if (!checkPastePossible(*par))
return false;
if (pos > (*par)->Last())
pos = (*par)->Last();
LyXParagraph * tmpbuf;
LyXParagraph * tmppar = *par;
int tmppos = pos;
// There are two cases: cutbuffer only one paragraph or many
if (!buf->next_) {
// only within a paragraph
tmpbuf = buf->Clone();
// Some provisions should be done here for checking
// if we are inserting at the beginning of a
// paragraph. If there are a space at the beginning
// of the text to insert and we are inserting at
// the beginning of the paragraph the space should
// be removed.
while (buf->size()) {
// This is an attempt to fix the
// "never insert a space at the
// beginning of a paragraph" problem.
if (!tmppos && buf->IsLineSeparator(0)) {
buf->Erase(0);
} else {
buf->CutIntoMinibuffer(current_view->buffer()->params, 0);
buf->Erase(0);
if (tmppar->InsertFromMinibuffer(tmppos))
++tmppos;
}
}
delete buf;
buf = tmpbuf;
*endpar = tmppar->next();
pos = tmppos;
} else {
// many paragraphs
// make a copy of the simple cut_buffer
tmpbuf = buf;
LyXParagraph * simple_cut_clone = tmpbuf->Clone();
LyXParagraph * tmpbuf2 = simple_cut_clone;
if ((*par)->footnoteflag) {
tmpbuf->footnoteflag = (*par)->footnoteflag;
tmpbuf->footnotekind = (*par)->footnotekind;
}
while (tmpbuf->next_) {
tmpbuf = tmpbuf->next_;
tmpbuf2->next(tmpbuf->Clone());
tmpbuf2->next_->previous(tmpbuf2);
tmpbuf2 = tmpbuf2->next_;
if ((*par)->footnoteflag){
tmpbuf->footnoteflag = (*par)->footnoteflag;
tmpbuf->footnotekind = (*par)->footnotekind;
}
}
// make sure there is no class difference
SwitchLayoutsBetweenClasses(textclass, tc, buf);
// make the buf exactly the same layout than
// the cursor paragraph
buf->MakeSameLayout(*par);
// find the end of the buffer
LyXParagraph * lastbuffer = buf;
while (lastbuffer->next())
lastbuffer = lastbuffer->next();
bool paste_the_end = false;
// open the paragraph for inserting the buf
// if necessary
if (((*par)->Last() > pos) || !(*par)->next()) {
(*par)->BreakParagraphConservative(current_view->buffer()->params,
pos);
paste_the_end = true;
}
// set the end for redoing later
*endpar = (*par)->ParFromPos(pos)->next_->next();
// paste it!
lastbuffer->ParFromPos(lastbuffer->Last())->next(
(*par)->ParFromPos(pos)->next_);
(*par)->ParFromPos(pos)->next()->previous(
lastbuffer->ParFromPos(lastbuffer->Last()));
(*par)->ParFromPos(pos)->next(buf);
buf->previous((*par)->ParFromPos(pos));
if ((*par)->ParFromPos(pos)->next() == lastbuffer)
lastbuffer = *par;
(*par)->ParFromPos(pos)->PasteParagraph(current_view->buffer()->params);
// store the new cursor position
*par = lastbuffer;
pos = lastbuffer->Last();
// maybe some pasting
if (lastbuffer->next() && paste_the_end) {
if (lastbuffer->next()->HasSameLayout(lastbuffer)) {
lastbuffer->ParFromPos(lastbuffer->Last())->PasteParagraph(current_view->buffer()->params);
} else if (!lastbuffer->next()->Last()) {
lastbuffer->next()->MakeSameLayout(lastbuffer);
lastbuffer->ParFromPos(lastbuffer->Last())->PasteParagraph(current_view->buffer()->params);
} else if (!lastbuffer->Last()) {
lastbuffer->MakeSameLayout(lastbuffer->next_);
lastbuffer->ParFromPos(lastbuffer->Last())->PasteParagraph(current_view->buffer()->params);
} else
lastbuffer->next()->StripLeadingSpaces(tc);
}
// restore the simple cut buffer
buf = simple_cut_clone;
}
return true;
}
#else
bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar, bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar,
int & pos, char tc) int & pos, char tc)
{ {
@ -558,7 +297,6 @@ bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar,
return true; return true;
} }
#endif
int CutAndPaste::nrOfParagraphs() int CutAndPaste::nrOfParagraphs()
@ -568,17 +306,10 @@ int CutAndPaste::nrOfParagraphs()
int n = 1; int n = 1;
LyXParagraph * tmppar = buf; LyXParagraph * tmppar = buf;
#ifndef NEW_INSETS
while(tmppar->next_) {
++n;
tmppar = tmppar->next_;
}
#else
while(tmppar->next()) { while(tmppar->next()) {
++n; ++n;
tmppar = tmppar->next(); tmppar = tmppar->next();
} }
#endif
return n; return n;
} }
@ -590,9 +321,7 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(LyXTextClassList::size_type c1,
int ret = 0; int ret = 0;
if (!par || c1 == c2) if (!par || c1 == c2)
return ret; return ret;
#ifndef NEW_INSETS
par = par->FirstPhysicalPar();
#endif
while (par) { while (par) {
string name = textclasslist.NameOfLayout(c1, par->layout); string name = textclasslist.NameOfLayout(c1, par->layout);
int lay = 0; int lay = 0;
@ -617,39 +346,15 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(LyXTextClassList::size_type c1,
InsetError * new_inset = new InsetError(s); InsetError * new_inset = new InsetError(s);
par->InsertInset(0, new_inset); par->InsertInset(0, new_inset);
} }
#ifndef NEW_INSETS
par = par->next_;
#else
par = par->next(); par = par->next();
#endif
} }
return ret; return ret;
} }
#ifndef NEW_INSETS
bool CutAndPaste::checkPastePossible(LyXParagraph * par)
#else
bool CutAndPaste::checkPastePossible(LyXParagraph *) bool CutAndPaste::checkPastePossible(LyXParagraph *)
#endif
{ {
if (!buf) return false; if (!buf) return false;
#ifndef NEW_INSETS
// be carefull with footnotes in footnotes
if (par->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
// check whether the cut_buffer includes a footnote
LyXParagraph * tmppar = buf;
while (tmppar && tmppar->footnoteflag == LyXParagraph::NO_FOOTNOTE)
tmppar = tmppar->next_;
if (tmppar) {
WriteAlert(_("Impossible operation"),
_("Can't paste float into float!"),
_("Sorry."));
return false;
}
}
#endif
return true; return true;
} }

View File

@ -20,10 +20,6 @@
#include "lyxlex.h" #include "lyxlex.h"
#include "debug.h" #include "debug.h"
#include "lyxlex.h" #include "lyxlex.h"
#if 1
// only until we don't need access to the NEW_INSETS anymore
#include "lyxparagraph.h"
#endif
using std::endl; using std::endl;
@ -62,13 +58,9 @@ void ToolbarDefaults::init()
add(LFUN_FREE); add(LFUN_FREE);
add(SEPARATOR); add(SEPARATOR);
#ifndef NEW_INSETS
add(LFUN_FOOTMELT);
add(LFUN_MARGINMELT);
#else
add(LFUN_INSET_FOOTNOTE); add(LFUN_INSET_FOOTNOTE);
add(LFUN_INSET_MARGINAL); add(LFUN_INSET_MARGINAL);
#endif
add(LFUN_DEPTH); add(LFUN_DEPTH);
add(SEPARATOR); add(SEPARATOR);

View File

@ -33,7 +33,7 @@
#endif #endif
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "buffer.h" #pragma implementation
#endif #endif
#include "buffer.h" #include "buffer.h"
@ -165,19 +165,11 @@ Buffer::~Buffer()
LyXParagraph * par = paragraph; LyXParagraph * par = paragraph;
LyXParagraph * tmppar; LyXParagraph * tmppar;
#ifndef NEW_INSETS
while (par) {
tmppar = par->next_;
delete par;
par = tmppar;
}
#else
while (par) { while (par) {
tmppar = par->next(); tmppar = par->next();
delete par; delete par;
par = tmppar; par = tmppar;
} }
#endif
paragraph = 0; paragraph = 0;
} }
@ -294,10 +286,6 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
{ {
int pos = 0; int pos = 0;
char depth = 0; // signed or unsigned? char depth = 0; // signed or unsigned?
#ifndef NEW_INSETS
LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE;
LyXParagraph::footnote_kind footnotekind = LyXParagraph::FOOTNOTE;
#endif
bool the_end_read = false; bool the_end_read = false;
LyXParagraph * return_par = 0; LyXParagraph * return_par = 0;
@ -341,10 +329,6 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
parseSingleLyXformat2Token(lex, par, return_par, parseSingleLyXformat2Token(lex, par, return_par,
pretoken, pos, depth, pretoken, pos, depth,
font font
#ifndef NEW_INSETS
, footnoteflag,
footnotekind
#endif
); );
} }
@ -370,20 +354,14 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
LyXParagraph *& return_par, LyXParagraph *& return_par,
string const & token, int & pos, string const & token, int & pos,
char & depth, LyXFont & font char & depth, LyXFont & font
#ifndef NEW_INSETS
, LyXParagraph::footnote_flag & footnoteflag,
LyXParagraph::footnote_kind & footnotekind
#endif
) )
{ {
bool the_end_read = false; bool the_end_read = false;
#ifndef NO_PEXTRA_REALLY #ifndef NO_PEXTRA_REALLY
#ifdef NEW_INSETS
// This is super temporary but is needed to get the compability // This is super temporary but is needed to get the compability
// mode for minipages work correctly together with new tabulars. // mode for minipages work correctly together with new tabulars.
static int call_depth = 0; static int call_depth = 0;
++call_depth; ++call_depth;
#endif
bool checkminipage = false; bool checkminipage = false;
static LyXParagraph * minipar = 0; static LyXParagraph * minipar = 0;
static LyXParagraph * parBeforeMinipage = 0; static LyXParagraph * parBeforeMinipage = 0;
@ -403,40 +381,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
par->InsertInset(pos, inset, font); par->InsertInset(pos, inset, font);
++pos; ++pos;
} else if (token == "\\layout") { } else if (token == "\\layout") {
#ifndef NEW_INSETS
if (!return_par)
return_par = par;
else {
par->fitToSize();
par = new LyXParagraph(par);
}
pos = 0;
lex.EatLine();
string const layoutname = lex.GetString();
pair<bool, LyXTextClass::LayoutList::size_type> pp
= textclasslist.NumberOfLayout(params.textclass,
layoutname);
if (pp.first) {
par->layout = pp.second;
} else { // layout not found
// use default layout "Standard" (0)
par->layout = 0;
}
// Test whether the layout is obsolete.
LyXLayout const & layout =
textclasslist.Style(params.textclass,
par->layout);
if (!layout.obsoleted_by().empty())
par->layout =
textclasslist.NumberOfLayout(params.textclass,
layout.obsoleted_by()).second;
par->footnoteflag = footnoteflag;
par->footnotekind = footnotekind;
par->params.depth(depth);
font = LyXFont(LyXFont::ALL_INHERIT, params.language);
if (file_format < 216 && params.language->lang() == "hebrew")
font.setLanguage(default_language);
#else
lex.EatLine(); lex.EatLine();
string const layoutname = lex.GetString(); string const layoutname = lex.GetString();
pair<bool, LyXTextClass::LayoutList::size_type> pp pair<bool, LyXTextClass::LayoutList::size_type> pp
@ -527,34 +471,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
#if USE_CAPTION #if USE_CAPTION
} }
#endif #endif
#endif
#ifndef NEW_INSETS
} else if (token == "\\end_float") {
if (!return_par)
return_par = par;
else {
par->fitToSize();
par = new LyXParagraph(par);
}
footnotekind = LyXParagraph::FOOTNOTE;
footnoteflag = LyXParagraph::NO_FOOTNOTE;
pos = 0;
lex.EatLine();
par->layout = LYX_DUMMY_LAYOUT;
font = LyXFont(LyXFont::ALL_INHERIT, params.language);
if (file_format < 216 && params.language->lang() == "hebrew")
font.setLanguage(default_language);
} else if (token == "\\begin_float") {
int tmpret = lex.FindToken(string_footnotekinds);
if (tmpret == -1) ++tmpret;
if (tmpret != LYX_LAYOUT_DEFAULT)
footnotekind = static_cast<LyXParagraph::footnote_kind>(tmpret); // bad
if (footnotekind == LyXParagraph::FOOTNOTE
|| footnotekind == LyXParagraph::MARGIN)
footnoteflag = LyXParagraph::CLOSED_FOOTNOTE;
else
footnoteflag = LyXParagraph::OPEN_FOOTNOTE;
#else
} else if (token == "\\begin_float") { } else if (token == "\\begin_float") {
// This is the compability reader. It can be removed in // This is the compability reader. It can be removed in
// LyX version 1.3.0. (Lgb) // LyX version 1.3.0. (Lgb)
@ -628,7 +545,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
inset->Read(this, nylex); inset->Read(this, nylex);
par->InsertInset(pos, inset, font); par->InsertInset(pos, inset, font);
++pos; ++pos;
#endif
} else if (token == "\\begin_deeper") { } else if (token == "\\begin_deeper") {
++depth; ++depth;
} else if (token == "\\end_deeper") { } else if (token == "\\end_deeper") {
@ -1586,9 +1502,6 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
LyXFont font2; LyXFont font2;
Inset const * inset; Inset const * inset;
char c; char c;
#ifndef NEW_INSETS
LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE;
#endif
char depth = 0; char depth = 0;
int ltype = 0; int ltype = 0;
int ltype_depth = 0; int ltype_depth = 0;
@ -1597,29 +1510,7 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
int noparbreak = 0; int noparbreak = 0;
int islatex = 0; int islatex = 0;
#ifndef NEW_INSETS if (!par->previous()) {
if (par->footnoteflag != LyXParagraph::NO_FOOTNOTE ||
!par->previous_
|| par->previous()->footnoteflag == LyXParagraph::NO_FOOTNOTE) {
/* begins a footnote environment ? */
if (footnoteflag != par->footnoteflag) {
footnoteflag = par->footnoteflag;
if (footnoteflag) {
size_t const j = strlen(string_footnotekinds[par->footnotekind]) + 4;
if ((linelen > 0) &&
((currlinelen + j) > linelen)) {
buffer << "\n";
currlinelen = 0;
}
buffer << "(["
<< string_footnotekinds[par->footnotekind]
<< "] ";
currlinelen += j;
}
}
#else
if (!par->previous()) {
#endif
/* begins or ends a deeper area ?*/ /* begins or ends a deeper area ?*/
if (depth != par->params.depth()) { if (depth != par->params.depth()) {
if (par->params.depth() > depth) { if (par->params.depth() > depth) {
@ -1673,23 +1564,12 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
/* what about the alignment */ /* what about the alignment */
} else { } else {
#ifndef NEW_INSETS
/* dummy layout, that means a footnote ended */
footnoteflag = LyXParagraph::NO_FOOTNOTE;
buffer << ") ";
noparbreak = 1;
#else
lyxerr << "Should this ever happen?" << endl; lyxerr << "Should this ever happen?" << endl;
#endif
} }
font1 = LyXFont(LyXFont::ALL_INHERIT, params.language); font1 = LyXFont(LyXFont::ALL_INHERIT, params.language);
for (LyXParagraph::size_type i = 0; i < par->size(); ++i) { for (LyXParagraph::size_type i = 0; i < par->size(); ++i) {
if (!i && if (!i && !noparbreak) {
#ifndef NEW_INSETS
!footnoteflag &&
#endif
!noparbreak) {
if (linelen > 0) if (linelen > 0)
buffer << "\n\n"; buffer << "\n\n";
for (char j = 0; j < depth; ++j) for (char j = 0; j < depth; ++j)
@ -2338,11 +2218,6 @@ void Buffer::latexParagraphs(ostream & ofs, LyXParagraph * par,
// if only_body // if only_body
while (par != endpar) { while (par != endpar) {
#ifndef NEW_INSETS
if (par->IsDummy())
lyxerr[Debug::LATEX] << "Error in latexParagraphs."
<< endl;
#endif
LyXLayout const & layout = LyXLayout const & layout =
textclasslist.Style(params.textclass, textclasslist.Style(params.textclass,
par->layout); par->layout);
@ -2364,23 +2239,10 @@ void Buffer::latexParagraphs(ostream & ofs, LyXParagraph * par,
// ordinary \footnote{} generation // ordinary \footnote{} generation
// flag this with ftcount // flag this with ftcount
ftcount = -1; ftcount = -1;
if (layout.isEnvironment() if (layout.isEnvironment()) {
#ifndef NEW_INSETS par = par->TeXEnvironment(this, params, ofs, texrow);
|| par->params.pextraType() != LyXParagraph::PEXTRA_NONE
#endif
) {
par = par->TeXEnvironment(this, params, ofs, texrow
#ifndef NEW_INSETS
,ftnote, ft_texrow, ftcount
#endif
);
} else { } else {
par = par->TeXOnePar(this, params, ofs, texrow, false par = par->TeXOnePar(this, params, ofs, texrow, false);
#ifndef NEW_INSETS
,
ftnote, ft_texrow, ftcount
#endif
);
} }
// Write out what we've generated... // Write out what we've generated...
@ -2518,12 +2380,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
string const temp = "toc"; string const temp = "toc";
sgmlOpenTag(ofs, depth, temp); sgmlOpenTag(ofs, depth, temp);
#ifndef NEW_INSETS
par = par->next_;
linuxDocHandleFootnote(ofs, par, depth);
#else
par = par->next(); par = par->next();
#endif
continue; continue;
} }
} }
@ -2605,19 +2462,9 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
break; break;
} }
#ifndef NEW_INSETS
do {
SimpleLinuxDocOnePar(ofs, par, depth);
par = par->next_;
linuxDocHandleFootnote(ofs, par, depth);
}
while(par && par->IsDummy());
#else
SimpleLinuxDocOnePar(ofs, par, depth); SimpleLinuxDocOnePar(ofs, par, depth);
par = par->next(); par = par->next();
#endif
ofs << "\n"; ofs << "\n";
// write closing SGML tags // write closing SGML tags
@ -2649,39 +2496,16 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
} }
#ifndef NEW_INSETS
void Buffer::linuxDocHandleFootnote(ostream & os, LyXParagraph * & par,
int depth)
{
string const tag = "footnote";
while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
sgmlOpenTag(os, depth + 1, tag);
SimpleLinuxDocOnePar(os, par, 0, depth + 1);
sgmlCloseTag(os, depth + 1, tag);
par = par->next_;
}
}
#endif
void Buffer::DocBookHandleCaption(ostream & os, string & inner_tag, void Buffer::DocBookHandleCaption(ostream & os, string & inner_tag,
int depth, int desc_on, int depth, int desc_on,
LyXParagraph * & par) LyXParagraph * & par)
{ {
LyXParagraph * tpar = par; LyXParagraph * tpar = par;
#ifndef NEW_INSETS
while (tpar
&& (tpar->footnoteflag != LyXParagraph::NO_FOOTNOTE)
&& (tpar->layout != textclasslist.NumberOfLayout(params.textclass,
"Caption").second))
tpar = tpar->next_;
#else
while (tpar while (tpar
&& (tpar->layout != textclasslist.NumberOfLayout(params.textclass, && (tpar->layout != textclasslist.NumberOfLayout(params.textclass,
"Caption").second)) "Caption").second))
tpar = tpar->next(); tpar = tpar->next();
#endif
if (tpar && if (tpar &&
tpar->layout == textclasslist.NumberOfLayout(params.textclass, tpar->layout == textclasslist.NumberOfLayout(params.textclass,
"Caption").second) { "Caption").second) {
@ -2696,106 +2520,6 @@ void Buffer::DocBookHandleCaption(ostream & os, string & inner_tag,
} }
#ifndef NEW_INSETS
void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
int depth)
{
string tag, inner_tag;
string tmp_par, extra_par;
bool inner_span = false;
int desc_on = 4;
// Someone should give this enum a proper name (Lgb)
enum SOME_ENUM {
NO_ONE,
FOOTNOTE_LIKE,
MARGIN_LIKE,
FIG_LIKE,
TAB_LIKE
};
SOME_ENUM last = NO_ONE;
SOME_ENUM present = FOOTNOTE_LIKE;
while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
if (last == present) {
if (inner_span) {
if (!tmp_par.empty()) {
os << tmp_par;
tmp_par.erase();
sgmlCloseTag(os, depth + 1, inner_tag);
sgmlOpenTag(os, depth + 1, inner_tag);
}
} else {
os << "\n";
}
} else {
os << tmp_par;
if (!inner_tag.empty()) sgmlCloseTag(os, depth + 1,
inner_tag);
if (!extra_par.empty()) os << extra_par;
if (!tag.empty()) sgmlCloseTag(os, depth, tag);
extra_par.erase();
switch (par->footnotekind) {
case LyXParagraph::FOOTNOTE:
case LyXParagraph::ALGORITHM:
tag = "footnote";
inner_tag = "para";
present = FOOTNOTE_LIKE;
inner_span = true;
break;
case LyXParagraph::MARGIN:
tag = "sidebar";
inner_tag = "para";
present = MARGIN_LIKE;
inner_span = true;
break;
case LyXParagraph::FIG:
case LyXParagraph::WIDE_FIG:
tag = "figure";
inner_tag = "title";
present = FIG_LIKE;
inner_span = false;
break;
case LyXParagraph::TAB:
case LyXParagraph::WIDE_TAB:
tag = "table";
inner_tag = "title";
present = TAB_LIKE;
inner_span = false;
break;
}
sgmlOpenTag(os, depth, tag);
if ((present == TAB_LIKE) || (present == FIG_LIKE)) {
DocBookHandleCaption(os, inner_tag, depth,
desc_on, par);
inner_tag.erase();
} else {
sgmlOpenTag(os, depth + 1, inner_tag);
}
}
// ignore all caption here, we processed them above!!!
if (par->layout != textclasslist
.NumberOfLayout(params.textclass,
"Caption").second) {
std::ostringstream ost;
SimpleDocBookOnePar(ost, extra_par, par,
desc_on, depth + 2);
tmp_par += ost.str().c_str();
}
tmp_par = frontStrip(strip(tmp_par));
last = present;
par = par->next_;
}
os << tmp_par;
if (!inner_tag.empty()) sgmlCloseTag(os, depth + 1, inner_tag);
if (!extra_par.empty()) os << extra_par;
if (!tag.empty()) sgmlCloseTag(os, depth, tag);
}
#endif
// checks, if newcol chars should be put into this line // checks, if newcol chars should be put into this line
// writes newline, if necessary. // writes newline, if necessary.
namespace { namespace {
@ -3289,21 +3013,11 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
break; break;
} }
#ifndef NEW_INSETS
do {
string extra_par;
SimpleDocBookOnePar(ofs, extra_par, par, desc_on,
depth + 1 + command_depth);
par = par->next_;
DocBookHandleFootnote(ofs, par,
depth + 1 + command_depth);
} while(par && par->IsDummy());
#else
string extra_par; string extra_par;
SimpleDocBookOnePar(ofs, extra_par, par, desc_on, SimpleDocBookOnePar(ofs, extra_par, par, desc_on,
depth + 1 + command_depth); depth + 1 + command_depth);
par = par->next(); par = par->next();
#endif
string end_tag; string end_tag;
// write closing SGML tags // write closing SGML tags
switch (style.latextype) { switch (style.latextype) {
@ -3536,11 +3250,7 @@ void Buffer::validate(LaTeXFeatures & features) const
par->validate(features); par->validate(features);
// and then the next paragraph // and then the next paragraph
#ifndef NEW_INSETS
par = par->next_;
#else
par = par->next(); par = par->next();
#endif
} }
// the bullet shapes are buffer level not paragraph level // the bullet shapes are buffer level not paragraph level
@ -3646,45 +3356,12 @@ Buffer::Lists const Buffer::getLists() const
{ {
Lists l; Lists l;
LyXParagraph * par = paragraph; LyXParagraph * par = paragraph;
#ifdef NEW_INSETS
bool found; bool found;
LyXTextClassList::size_type cap; LyXTextClassList::size_type cap;
boost::tie(found, cap) = textclasslist boost::tie(found, cap) = textclasslist
.NumberOfLayout(params.textclass, "Caption"); .NumberOfLayout(params.textclass, "Caption");
#endif
while (par) { while (par) {
#ifndef NEW_INSETS
if (par->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
if (textclasslist.Style(params.textclass,
par->GetLayout()).labeltype
== LABEL_SENSITIVE) {
string type;
switch (par->footnotekind) {
case LyXParagraph::FIG:
case LyXParagraph::WIDE_FIG:
type = "LOF";
break;
case LyXParagraph::TAB:
case LyXParagraph::WIDE_TAB:
type = "LOT";
break;
case LyXParagraph::ALGORITHM:
type = "LOA";
break;
case LyXParagraph::FOOTNOTE:
case LyXParagraph::MARGIN:
break;
}
if (!type.empty()) {
SingleList & item = l[type];
string const str =
tostr(item.size()+1) + ". " + par->String(this, false);
item.push_back(TocItem(par, 0, str));
}
}
} else if (!par->IsDummy()) {
#endif
char const labeltype = char const labeltype =
textclasslist.Style(params.textclass, textclasslist.Style(params.textclass,
par->GetLayout()).labeltype; par->GetLayout()).labeltype;
@ -3698,7 +3375,6 @@ Buffer::Lists const Buffer::getLists() const
textclasslist.TextClass(params.textclass).maxcounter()); textclasslist.TextClass(params.textclass).maxcounter());
item.push_back(TocItem(par, depth, par->String(this, true))); item.push_back(TocItem(par, depth, par->String(this, true)));
} }
#ifdef NEW_INSETS
// For each paragrph, traverse its insets and look for // For each paragrph, traverse its insets and look for
// FLOAT_CODE // FLOAT_CODE
@ -3734,13 +3410,7 @@ Buffer::Lists const Buffer::getLists() const
lyxerr << "caption not found" << endl; lyxerr << "caption not found" << endl;
} }
#endif
#ifndef NEW_INSETS
}
par = par->next_;
#else
par = par->next(); par = par->next();
#endif
} }
return l; return l;
} }
@ -3763,11 +3433,7 @@ vector<pair<string, string> > const Buffer::getBibkeyList()
if (par->bibkey) if (par->bibkey)
keys.push_back(pair<string, string>(par->bibkey->getContents(), keys.push_back(pair<string, string>(par->bibkey->getContents(),
par->String(this, false))); par->String(this, false)));
#ifndef NEW_INSETS
par = par->next_;
#else
par = par->next(); par = par->next();
#endif
} }
// Might be either using bibtex or a child has bibliography // Might be either using bibtex or a child has bibliography
@ -3862,15 +3528,9 @@ void Buffer::resizeInsets(BufferView * bv)
{ {
/// then remove all LyXText in text-insets /// then remove all LyXText in text-insets
LyXParagraph * par = paragraph; LyXParagraph * par = paragraph;
#ifndef NEW_INSETS
for (; par; par = par->next_) {
par->resizeInsetsLyXText(bv);
}
#else
for (; par; par = par->next()) { for (; par; par = par->next()) {
par->resizeInsetsLyXText(bv); par->resizeInsetsLyXText(bv);
} }
#endif
} }
@ -3880,11 +3540,7 @@ void Buffer::ChangeLanguage(Language const * from, Language const * to)
LyXParagraph * par = paragraph; LyXParagraph * par = paragraph;
while (par) { while (par) {
par->ChangeLanguage(params, from, to); par->ChangeLanguage(params, from, to);
#ifndef NEW_INSETS
par = par->next_;
#else
par = par->next(); par = par->next();
#endif
} }
} }
@ -3895,11 +3551,7 @@ bool Buffer::isMultiLingual()
while (par) { while (par) {
if (par->isMultiLingual(params)) if (par->isMultiLingual(params))
return true; return true;
#ifndef NEW_INSETS
par = par->next_;
#else
par = par->next(); par = par->next();
#endif
} }
return false; return false;
} }
@ -3911,11 +3563,7 @@ Buffer::inset_iterator::inset_iterator(LyXParagraph * paragraph,
{ {
it = par->InsetIterator(pos); it = par->InsetIterator(pos);
if (it == par->inset_iterator_end()) { if (it == par->inset_iterator_end()) {
#ifndef NEW_INSETS
par = par->next_;
#else
par = par->next(); par = par->next();
#endif
SetParagraph(); SetParagraph();
} }
} }
@ -3927,11 +3575,7 @@ void Buffer::inset_iterator::SetParagraph()
it = par->inset_iterator_begin(); it = par->inset_iterator_begin();
if (it != par->inset_iterator_end()) if (it != par->inset_iterator_end())
return; return;
#ifndef NEW_INSETS
par = par->next_;
#else
par = par->next(); par = par->next();
#endif
} }
//it = 0; //it = 0;
// We maintain an invariant that whenever par = 0 then it = 0 // We maintain an invariant that whenever par = 0 then it = 0

View File

@ -132,12 +132,7 @@ public:
bool parseSingleLyXformat2Token(LyXLex &, LyXParagraph *& par, bool parseSingleLyXformat2Token(LyXLex &, LyXParagraph *& par,
LyXParagraph *& return_par, LyXParagraph *& return_par,
string const & token, int & pos, string const & token, int & pos,
char & depth, LyXFont & char & depth, LyXFont &);
#ifndef NEW_INSETS
,LyXParagraph::footnote_flag &,
LyXParagraph::footnote_kind &
#endif
);
private: private:
/// Parse a single inset. /// Parse a single inset.
void readInset(LyXLex &, LyXParagraph *& par, int & pos, LyXFont &); void readInset(LyXLex &, LyXParagraph *& par, int & pos, LyXFont &);
@ -324,20 +319,10 @@ public:
/// Used when typesetting to place errorboxes. /// Used when typesetting to place errorboxes.
TexRow texrow; TexRow texrow;
private: private:
#ifndef NEW_INSETS
///
void linuxDocHandleFootnote(std::ostream & os,
LyXParagraph * & par, int depth);
#endif
/// ///
void DocBookHandleCaption(std::ostream & os, string & inner_tag, void DocBookHandleCaption(std::ostream & os, string & inner_tag,
int depth, int desc_on, int depth, int desc_on,
LyXParagraph * & par); LyXParagraph * & par);
#ifndef NEW_INSETS
///
void DocBookHandleFootnote(std::ostream & os,
LyXParagraph * & par, int depth);
#endif
/// Open SGML/XML tag. /// Open SGML/XML tag.
void sgmlOpenTag(std::ostream & os, int depth, void sgmlOpenTag(std::ostream & os, int depth,
string const & latexname) const; string const & latexname) const;
@ -404,11 +389,7 @@ public:
if (par) { if (par) {
++it; ++it;
if (it == par->inset_iterator_end()) { if (it == par->inset_iterator_end()) {
#ifndef NEW_INSETS
par = par->next_;
#else
par = par->next(); par = par->next();
#endif
SetParagraph(); SetParagraph();
} }
} }
@ -420,11 +401,7 @@ public:
if (par) { if (par) {
++it; ++it;
if (it == par->inset_iterator_end()) { if (it == par->inset_iterator_end()) {
#ifndef NEW_INSETS
par = par->next_;
#else
par = par->next(); par = par->next();
#endif
SetParagraph(); SetParagraph();
} }
} }

View File

@ -27,21 +27,6 @@
#include "language.h" #include "language.h"
#include "gettext.h" #include "gettext.h"
#ifndef NEW_INSETS
void Foot(BufferView * bv)
{
if (!bv->available())
return;
bv->owner()->getMiniBuffer()
->Set(_("Inserting Footnote..."));
bv->hideCursor();
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR);
bv->text->InsertFootnoteEnvironment(bv, LyXParagraph::FOOTNOTE);
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
#endif
void Emph(BufferView * bv) void Emph(BufferView * bv)
{ {
@ -67,19 +52,6 @@ void Noun(BufferView * bv)
} }
#ifndef NEW_INSETS
void Margin(BufferView * bv)
{
if (bv->available()) {
bv->owner()->message(_("Inserting margin note...");
bv->hideCursor();
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR);
bv->text->InsertFootnoteEnvironment(bv, LyXParagraph::MARGIN);
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
#endif
void Number(BufferView * bv) void Number(BufferView * bv)
{ {
LyXFont font(LyXFont::ALL_IGNORE); LyXFont font(LyXFont::ALL_IGNORE);
@ -99,21 +71,6 @@ void Lang(BufferView * bv, string const & l)
} }
#ifndef NEW_INSETS
void Melt(BufferView * bv)
{
if (!bv->available()) return;
bv->owner()->message(_("Melt"));
bv->hideCursor();
bv->beforeChange(bv->text);
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR);
bv->text->MeltFootnoteEnvironment(bv);
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
#endif
void Tex(BufferView * bv) void Tex(BufferView * bv)
{ {
LyXFont font(LyXFont::ALL_IGNORE); LyXFont font(LyXFont::ALL_IGNORE);

View File

@ -22,20 +22,12 @@ class BufferView;
class LyXFont; class LyXFont;
class LyXText; class LyXText;
#ifndef NEW_INSETS
///
extern void Foot(BufferView *);
#endif
/// ///
extern void Emph(BufferView *); extern void Emph(BufferView *);
/// ///
extern void Bold(BufferView *); extern void Bold(BufferView *);
/// ///
extern void Noun(BufferView *); extern void Noun(BufferView *);
#ifndef NEW_INSETS
///
extern void Margin(BufferView *);
#endif
/// ///
extern void Figure(); extern void Figure();
/// ///
@ -44,10 +36,6 @@ extern void Table();
extern void Lang(BufferView *, string const &); extern void Lang(BufferView *, string const &);
/// ///
extern void Number(BufferView *); extern void Number(BufferView *);
#ifndef NEW_INSETS
///
extern void Melt(BufferView *);
#endif
/// ///
extern void Tex(BufferView *); extern void Tex(BufferView *);
/// ///

View File

@ -69,11 +69,7 @@ void FigureApplyCB(FL_OBJECT *, long)
current_view->text->BreakParagraph(current_view); current_view->text->BreakParagraph(current_view);
current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
#ifndef NEW_INSETS
if (current_view->text->cursor.par()->Last()) {
#else
if (current_view->text->cursor.par()->size()) { if (current_view->text->cursor.par()->size()) {
#endif
current_view->text->CursorLeft(current_view); current_view->text->CursorLeft(current_view);
current_view->text->BreakParagraph(current_view); current_view->text->BreakParagraph(current_view);
@ -83,10 +79,6 @@ void FigureApplyCB(FL_OBJECT *, long)
// The standard layout should always be numer 0; // The standard layout should always be numer 0;
current_view->text->SetLayout(current_view, 0); current_view->text->SetLayout(current_view, 0);
#ifndef NEW_INSETS
if (current_view->text->cursor.par()->footnoteflag ==
LyXParagraph::NO_FOOTNOTE) {
#endif
current_view->text-> current_view->text->
SetParagraph(current_view, 0, 0, SetParagraph(current_view, 0, 0,
0, 0, 0, 0,
@ -96,17 +88,6 @@ void FigureApplyCB(FL_OBJECT *, long)
buffer->params.spacing.getValue(), buffer->params.spacing.getValue(),
LyXLength::CM), LyXLength::CM),
LYX_ALIGN_CENTER, string(), 0); LYX_ALIGN_CENTER, string(), 0);
#ifndef NEW_INSETS
} else {
current_view->text->SetParagraph(current_view, 0, 0,
0, 0,
VSpace(VSpace::NONE),
VSpace(VSpace::NONE),
LYX_ALIGN_CENTER,
string(),
0);
}
#endif
current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);

View File

@ -1,3 +1,7 @@
2001-05-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
* FormParagraph.[Ch]: remove !NO_PEXTRA and !NEW_INSETS cruft
2001-04-26 Angus Leeming <a.leeming@ic.ac.uk> 2001-04-26 Angus Leeming <a.leeming@ic.ac.uk>
* Dialogs.C: included insetgraphicsParams.h * Dialogs.C: included insetgraphicsParams.h

View File

@ -25,13 +25,11 @@
#include "buffer.h" #include "buffer.h"
#include "lyxtext.h" #include "lyxtext.h"
#include "xforms_helpers.h" #include "xforms_helpers.h"
#if 1
#include "lyxparagraph.h"
#endif
using Liason::setMinibuffer; using Liason::setMinibuffer;
using SigC::slot; using SigC::slot;
FormParagraph::FormParagraph(LyXView * lv, Dialogs * d) FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
: FormBaseBD(lv, d, _("Paragraph Layout")) : FormBaseBD(lv, d, _("Paragraph Layout"))
{ {
@ -104,25 +102,8 @@ void FormParagraph::build()
bc_.addReadOnly (general_->check_noindent); bc_.addReadOnly (general_->check_noindent);
bc_.addReadOnly (general_->input_labelwidth); bc_.addReadOnly (general_->input_labelwidth);
#ifndef NO_PEXTRA
// the document class form
extra_.reset(build_paragraph_extra());
fl_set_input_return(extra_->input_pextra_width, FL_RETURN_CHANGED);
fl_set_input_return(extra_->input_pextra_widthp, FL_RETURN_CHANGED);
bc_.addReadOnly (extra_->radio_pextra_indent);
bc_.addReadOnly (extra_->radio_pextra_minipage);
bc_.addReadOnly (extra_->radio_pextra_floatflt);
bc_.addReadOnly (extra_->radio_pextra_hfill);
bc_.addReadOnly (extra_->radio_pextra_startmp);
#endif
// now make them fit together // now make them fit together
fl_addto_tabfolder(dialog_->tabbed_folder,_("General"), general_->form); fl_addto_tabfolder(dialog_->tabbed_folder,_("General"), general_->form);
#ifndef NO_PEXTRA
fl_addto_tabfolder(dialog_->tabbed_folder,_("Extra"), extra_->form);
#endif
} }
@ -132,9 +113,6 @@ void FormParagraph::apply()
return; return;
general_apply(); general_apply();
#ifndef NO_PEXTRA
extra_apply();
#endif
lv_->view()->update(lv_->view()->text, lv_->view()->update(lv_->view()->text,
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE); BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
@ -149,9 +127,7 @@ void FormParagraph::update()
return; return;
general_update(); general_update();
#ifndef NO_PEXTRA
extra_update();
#endif
bc_.readOnly(lv_->buffer()->isReadonly()); bc_.readOnly(lv_->buffer()->isReadonly());
} }
@ -257,40 +233,6 @@ void FormParagraph::general_apply()
} }
#ifndef NO_PEXTRA
void FormParagraph::extra_apply()
{
char const * width = fl_get_input(extra_->input_pextra_width);
char const * widthp = fl_get_input(extra_->input_pextra_widthp);
LyXText * text = lv_->view()->text;
int type = LyXParagraph::PEXTRA_NONE;
LyXParagraph::MINIPAGE_ALIGNMENT
alignment = LyXParagraph::MINIPAGE_ALIGN_TOP;
bool
hfill = false,
start_minipage = false;
if (fl_get_button(extra_->radio_pextra_indent)) {
type = LyXParagraph::PEXTRA_INDENT;
} else if (fl_get_button(extra_->radio_pextra_minipage)) {
type = LyXParagraph::PEXTRA_MINIPAGE;
hfill = fl_get_button(extra_->radio_pextra_hfill);
start_minipage = fl_get_button(extra_->radio_pextra_startmp);
if (fl_get_button(extra_->radio_pextra_top))
alignment = LyXParagraph::MINIPAGE_ALIGN_TOP;
else if (fl_get_button(extra_->radio_pextra_middle))
alignment = LyXParagraph::MINIPAGE_ALIGN_MIDDLE;
else if (fl_get_button(extra_->radio_pextra_bottom))
alignment = LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
} else if (fl_get_button(extra_->radio_pextra_floatflt)) {
type = LyXParagraph::PEXTRA_FLOATFLT;
}
text->SetParagraphExtraOpt(lv_->view(), type, width, widthp, alignment,
hfill, start_minipage);
}
#endif
void FormParagraph::general_update() void FormParagraph::general_update()
{ {
if (!general_.get()) if (!general_.get())
@ -331,21 +273,6 @@ void FormParagraph::general_update()
break; break;
} }
#ifndef NEW_INSETS
fl_set_button(general_->check_lines_top,
text->cursor.par()->FirstPhysicalPar()->params.lineTop());
fl_set_button(general_->check_lines_bottom,
text->cursor.par()->FirstPhysicalPar()->params.lineBottom());
fl_set_button(general_->check_pagebreaks_top,
text->cursor.par()->FirstPhysicalPar()->params.pagebreakTop());
fl_set_button(general_->check_pagebreaks_bottom,
text->cursor.par()->FirstPhysicalPar()->params.pagebreakBottom());
fl_set_button(general_->check_noindent,
text->cursor.par()->FirstPhysicalPar()->params.noindent());
#else
fl_set_button(general_->check_lines_top, fl_set_button(general_->check_lines_top,
text->cursor.par()->params.lineTop()); text->cursor.par()->params.lineTop());
fl_set_button(general_->check_lines_bottom, fl_set_button(general_->check_lines_bottom,
@ -356,15 +283,10 @@ void FormParagraph::general_update()
text->cursor.par()->params.pagebreakBottom()); text->cursor.par()->params.pagebreakBottom());
fl_set_button(general_->check_noindent, fl_set_button(general_->check_noindent,
text->cursor.par()->params.noindent()); text->cursor.par()->params.noindent());
#endif
fl_set_input (general_->input_space_above, ""); fl_set_input (general_->input_space_above, "");
#ifndef NEW_INSETS
switch (text->cursor.par()->FirstPhysicalPar()->params.spaceTop().kind()) {
#else
switch (text->cursor.par()->params.spaceTop().kind()) { switch (text->cursor.par()->params.spaceTop().kind()) {
#endif
case VSpace::NONE: case VSpace::NONE:
fl_set_choice (general_->choice_space_above, 1); fl_set_choice (general_->choice_space_above, 1);
break; break;
@ -385,29 +307,16 @@ void FormParagraph::general_update()
break; break;
case VSpace::LENGTH: case VSpace::LENGTH:
fl_set_choice (general_->choice_space_above, 7); fl_set_choice (general_->choice_space_above, 7);
#ifndef NEW_INSETS
fl_set_input(general_->input_space_above,
text->cursor.par()->FirstPhysicalPar()->
params.spaceTop().length().asString().c_str());
#else
fl_set_input(general_->input_space_above, text->cursor.par()-> fl_set_input(general_->input_space_above, text->cursor.par()->
params.spaceTop().length().asString().c_str()); params.spaceTop().length().asString().c_str());
#endif
break; break;
} }
#ifndef NEW_INSETS
fl_set_button(general_->check_space_above,
text->cursor.par()->FirstPhysicalPar()->
params.spaceTop().keep());
fl_set_input(general_->input_space_below, "");
switch (text->cursor.par()->FirstPhysicalPar()->
params.spaceBottom().kind()) {
#else
fl_set_button (general_->check_space_above, fl_set_button (general_->check_space_above,
text->cursor.par()->params.spaceTop().keep()); text->cursor.par()->params.spaceTop().keep());
fl_set_input (general_->input_space_below, ""); fl_set_input (general_->input_space_below, "");
switch (text->cursor.par()->params.spaceBottom().kind()) { switch (text->cursor.par()->params.spaceBottom().kind()) {
#endif
case VSpace::NONE: case VSpace::NONE:
fl_set_choice (general_->choice_space_below, 1); fl_set_choice (general_->choice_space_below, 1);
break; break;
@ -428,29 +337,6 @@ void FormParagraph::general_update()
break; break;
case VSpace::LENGTH: case VSpace::LENGTH:
fl_set_choice (general_->choice_space_below, 7); fl_set_choice (general_->choice_space_below, 7);
#ifndef NEW_INSETS
fl_set_input(general_->input_space_below,
text->cursor.par()->FirstPhysicalPar()->
params.spaceBottom().length().asString().c_str());
break;
}
fl_set_button(general_->check_space_below,
text->cursor.par()->FirstPhysicalPar()->
params.spaceBottom().keep());
fl_set_button(general_->check_noindent,
text->cursor.par()->FirstPhysicalPar()->params.noindent());
bool const enable = (!text->cursor.par()->FirstPhysicalPar()->InInset());
setEnabled(general_->check_pagebreaks_top, enable);
setEnabled(general_->check_pagebreaks_bottom, enable);
if (!enable) {
fl_set_button(general_->check_pagebreaks_top, 0);
fl_set_button(general_->check_pagebreaks_bottom, 0);
}
#else
fl_set_input(general_->input_space_below, text->cursor.par()-> fl_set_input(general_->input_space_below, text->cursor.par()->
params.spaceBottom().length().asString().c_str()); params.spaceBottom().length().asString().c_str());
break; break;
@ -459,80 +345,9 @@ void FormParagraph::general_update()
text->cursor.par()->params.spaceBottom().keep()); text->cursor.par()->params.spaceBottom().keep());
fl_set_button(general_->check_noindent, fl_set_button(general_->check_noindent,
text->cursor.par()->params.noindent()); text->cursor.par()->params.noindent());
#endif
} }
#ifndef NO_PEXTRA
void FormParagraph::extra_update()
{
if (!lv_->view()->available() || !extra_.get())
return;
LyXParagraph * par = lv_->view()->text->cursor.par();
setEnabled(extra_->input_pextra_width, true);
setEnabled(extra_->input_pextra_widthp, true);
fl_set_input(extra_->input_pextra_width,
par->params.pextraWidth().c_str());
fl_set_input(extra_->input_pextra_widthp,
par->params.pextraWidthp().c_str());
switch (par->params.pextraAlignment()) {
case LyXParagraph::MINIPAGE_ALIGN_TOP:
fl_set_button(extra_->radio_pextra_top, 1);
break;
case LyXParagraph::MINIPAGE_ALIGN_MIDDLE:
fl_set_button(extra_->radio_pextra_middle, 1);
break;
case LyXParagraph::MINIPAGE_ALIGN_BOTTOM:
fl_set_button(extra_->radio_pextra_bottom, 1);
break;
}
fl_set_button(extra_->radio_pextra_hfill,
par->params.pextraHfill());
fl_set_button(extra_->radio_pextra_startmp,
par->params.pextraStartMinipage());
if (par->params.pextraType() == LyXParagraph::PEXTRA_INDENT) {
fl_set_button(extra_->radio_pextra_indent, 1);
fl_set_button(extra_->radio_pextra_minipage, 0);
fl_set_button(extra_->radio_pextra_floatflt, 0);
setEnabled(extra_->radio_pextra_top, false);
setEnabled(extra_->radio_pextra_middle, false);
setEnabled(extra_->radio_pextra_bottom, false);
input(extra_->radio_pextra_indent, 0);
} else if (par->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE) {
fl_set_button(extra_->radio_pextra_indent, 0);
fl_set_button(extra_->radio_pextra_minipage, 1);
fl_set_button(extra_->radio_pextra_floatflt, 0);
setEnabled(extra_->radio_pextra_top, true);
setEnabled(extra_->radio_pextra_middle, true);
setEnabled(extra_->radio_pextra_bottom, true);
input(extra_->radio_pextra_minipage, 0);
} else if (par->params.pextraType() == LyXParagraph::PEXTRA_FLOATFLT) {
fl_set_button(extra_->radio_pextra_indent, 0);
fl_set_button(extra_->radio_pextra_minipage, 0);
fl_set_button(extra_->radio_pextra_floatflt, 1);
setEnabled(extra_->radio_pextra_top, false);
setEnabled(extra_->radio_pextra_middle, false);
setEnabled(extra_->radio_pextra_bottom, false);
input(extra_->radio_pextra_floatflt, 0);
} else {
fl_set_button(extra_->radio_pextra_indent, 0);
fl_set_button(extra_->radio_pextra_minipage, 0);
fl_set_button(extra_->radio_pextra_floatflt, 0);
setEnabled(extra_->input_pextra_width, false);
setEnabled(extra_->input_pextra_widthp, false);
setEnabled(extra_->radio_pextra_top, false);
setEnabled(extra_->radio_pextra_middle, false);
setEnabled(extra_->radio_pextra_bottom, false);
input(0, 0);
}
fl_hide_object(dialog_->text_warning);
}
#endif
bool FormParagraph::input(FL_OBJECT * ob, long) bool FormParagraph::input(FL_OBJECT * ob, long)
{ {
bool ret = true; bool ret = true;
@ -553,61 +368,6 @@ bool FormParagraph::input(FL_OBJECT * ob, long)
if (fl_get_choice (general_->choice_space_below) != 7) if (fl_get_choice (general_->choice_space_below) != 7)
fl_set_input (general_->input_space_below, ""); fl_set_input (general_->input_space_below, "");
#ifndef NO_PEXTRA
//
// then the extra form
//
if (ob == extra_->radio_pextra_indent) {
bool const enable = (fl_get_button(extra_->radio_pextra_indent) != 0);
if (enable) {
fl_set_button(extra_->radio_pextra_minipage, 0);
fl_set_button(extra_->radio_pextra_floatflt, 0);
}
setEnabled(extra_->input_pextra_width, enable);
setEnabled(extra_->input_pextra_widthp, enable);
setEnabled(extra_->radio_pextra_top, false);
setEnabled(extra_->radio_pextra_middle, false);
setEnabled(extra_->radio_pextra_bottom, false);
setEnabled(extra_->radio_pextra_hfill, false);
setEnabled(extra_->radio_pextra_startmp, false);
} else if (ob == extra_->radio_pextra_minipage) {
bool const enable = (fl_get_button(extra_->radio_pextra_minipage) != 0);
if (enable) {
fl_set_button(extra_->radio_pextra_indent, 0);
fl_set_button(extra_->radio_pextra_floatflt, 0);
}
setEnabled(extra_->input_pextra_width, enable);
setEnabled(extra_->input_pextra_widthp, enable);
setEnabled(extra_->radio_pextra_top, enable);
setEnabled(extra_->radio_pextra_middle, enable);
setEnabled(extra_->radio_pextra_bottom, enable);
setEnabled(extra_->radio_pextra_hfill, enable);
setEnabled(extra_->radio_pextra_startmp, enable);
} else if (ob == extra_->radio_pextra_floatflt) {
bool const enable = (fl_get_button(extra_->radio_pextra_floatflt) != 0);
if (enable) {
fl_set_button(extra_->radio_pextra_indent, 0);
fl_set_button(extra_->radio_pextra_minipage, 0);
}
setEnabled(extra_->input_pextra_width, enable);
setEnabled(extra_->input_pextra_widthp, enable);
setEnabled(extra_->radio_pextra_top, false);
setEnabled(extra_->radio_pextra_middle, false);
setEnabled(extra_->radio_pextra_bottom, false);
setEnabled(extra_->radio_pextra_hfill, false);
setEnabled(extra_->radio_pextra_startmp, false);
}
#endif
// //
// first the general form // first the general form
// //
@ -634,44 +394,6 @@ bool FormParagraph::input(FL_OBJECT * ob, long)
} }
} }
#ifndef NO_PEXTRA
//
// then the extra form
//
int n = fl_get_button(extra_->radio_pextra_indent) +
fl_get_button(extra_->radio_pextra_minipage) +
fl_get_button(extra_->radio_pextra_floatflt);
string s1 = fl_get_input(extra_->input_pextra_width);
string s2 = fl_get_input(extra_->input_pextra_widthp);
if (!n) { // no button pressed both should be deactivated now
setEnabled(extra_->input_pextra_width, false);
setEnabled(extra_->input_pextra_widthp, false);
fl_hide_object(dialog_->text_warning);
} else if (s1.empty() && s2.empty()) {
setEnabled(extra_->input_pextra_width, true);
setEnabled(extra_->input_pextra_widthp, true);
fl_hide_object(dialog_->text_warning);
ret = false;
} else if (!s1.empty()) { // LyXLength parameter
setEnabled(extra_->input_pextra_width, true);
setEnabled(extra_->input_pextra_widthp, false);
if (!isValidLength(s1)) {
fl_set_object_label(dialog_->text_warning,
_("Warning: Invalid Length (valid example: 10mm)"));
fl_show_object(dialog_->text_warning);
ret = false;
}
} else { // !s2.empty() % parameter
setEnabled(extra_->input_pextra_width, false);
setEnabled(extra_->input_pextra_widthp, true);
if ((lyx::atoi(s2) < 0 ) || (lyx::atoi(s2) > 100)) {
ret = false;
fl_set_object_label(dialog_->text_warning,
_("Warning: Invalid percent value (0-100)"));
fl_show_object(dialog_->text_warning);
}
}
#endif
return ret; return ret;
} }

View File

@ -20,9 +20,6 @@
#endif #endif
#include "FormBaseDeprecated.h" #include "FormBaseDeprecated.h"
#if 1
#include "lyxparagraph.h"
#endif
struct FD_form_tabbed_paragraph; struct FD_form_tabbed_paragraph;
struct FD_form_paragraph_general; struct FD_form_paragraph_general;
@ -55,32 +52,19 @@ private:
/// ///
void general_update(); void general_update();
#ifndef NO_PEXTRA
///
void extra_update();
#endif
/// ///
void general_apply(); void general_apply();
#ifndef NO_PEXTRA
///
void extra_apply();
#endif
/// Fdesign generated methods /// Fdesign generated methods
FD_form_tabbed_paragraph * build_tabbed_paragraph(); FD_form_tabbed_paragraph * build_tabbed_paragraph();
/// ///
FD_form_paragraph_general * build_paragraph_general(); FD_form_paragraph_general * build_paragraph_general();
//#ifndef NO_PEXTRA
/// ///
FD_form_paragraph_extra * build_paragraph_extra(); FD_form_paragraph_extra * build_paragraph_extra();
//#endif
/// Real GUI implementation. /// Real GUI implementation.
boost::scoped_ptr<FD_form_tabbed_paragraph> dialog_; boost::scoped_ptr<FD_form_tabbed_paragraph> dialog_;
/// ///
boost::scoped_ptr<FD_form_paragraph_general> general_; boost::scoped_ptr<FD_form_paragraph_general> general_;
#ifndef NO_PEXTRA
///
boost::scoped_ptr<FD_form_paragraph_extra> extra_;
#endif
/// The ButtonController /// The ButtonController
ButtonController<NoRepeatedApplyReadOnlyPolicy, xformsBC> bc_; ButtonController<NoRepeatedApplyReadOnlyPolicy, xformsBC> bc_;
}; };

View File

@ -1,3 +1,13 @@
2001-05-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insettext.C: remvoe !NEW_INSETS cruft
* insettabular.C: remove !NEW_INSETS cruft
* insetcollapsable.h: remove !NEW_INSETS cruft
* insetbib.C: remove !NEW_INSETS cruft
2001-04-27 Lars Gullik Bjønnes <larsbj@birdstep.com> 2001-04-27 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insettoc.C: hack to make listof algorithm work * insettoc.C: hack to make listof algorithm work

View File

@ -261,11 +261,7 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const & font)
int const wx = par->bibkey->width(bv, font); int const wx = par->bibkey->width(bv, font);
if (wx > w) w = wx; if (wx > w) w = wx;
} }
#ifndef NEW_INSETS
par = par->next_;
#else
par = par->next(); par = par->next();
#endif
} }
return w; return w;
} }
@ -290,11 +286,7 @@ string const bibitemWidest(Buffer const * buffer)
bkey = par->bibkey; bkey = par->bibkey;
} }
} }
#ifndef NEW_INSETS
par = par->next_;
#else
par = par->next(); par = par->next();
#endif
} }
if (bkey && !bkey->getBibLabel().empty()) if (bkey && !bkey->getBibLabel().empty())

View File

@ -21,9 +21,6 @@
#include "insettext.h" #include "insettext.h"
#include "lyxfont.h" #include "lyxfont.h"
#include "LColor.h" #include "LColor.h"
#if 1 // NEW_INSETS
#include "lyxparagraph.h"
#endif
class Painter; class Painter;
class LyXText; class LyXText;
@ -160,9 +157,7 @@ protected:
LColor::color framecolor; LColor::color framecolor;
/// ///
LyXFont labelfont; LyXFont labelfont;
#ifdef NEW_INSETS
public: public:
#endif
/// ///
InsetText inset; InsetText inset;
protected: protected:

View File

@ -941,14 +941,8 @@ InsetTabular::LocalDispatch(BufferView * bv,
if (!copySelection(bv)) if (!copySelection(bv))
break; break;
bv->text->SetUndo(bv->buffer(), Undo::DELETE, bv->text->SetUndo(bv->buffer(), Undo::DELETE,
#ifndef NEW_INSETS
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
#else
bv->text->cursor.par()->previous(), bv->text->cursor.par()->previous(),
bv->text->cursor.par()->next() bv->text->cursor.par()->next());
#endif
);
cutSelection(); cutSelection();
UpdateLocal(bv, INIT, true); UpdateLocal(bv, INIT, true);
break; break;
@ -1027,14 +1021,8 @@ InsetTabular::LocalDispatch(BufferView * bv,
case LFUN_PASTE: case LFUN_PASTE:
if (hasPasteBuffer()) { if (hasPasteBuffer()) {
bv->text->SetUndo(bv->buffer(), Undo::INSERT, bv->text->SetUndo(bv->buffer(), Undo::INSERT,
#ifndef NEW_INSETS
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
#else
bv->text->cursor.par()->previous(), bv->text->cursor.par()->previous(),
bv->text->cursor.par()->next() bv->text->cursor.par()->next());
#endif
);
pasteSelection(bv); pasteSelection(bv);
UpdateLocal(bv, INIT, true); UpdateLocal(bv, INIT, true);
break; break;
@ -1558,14 +1546,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
sel_row_start = sel_row_end = tabular->row_of_cell(actcell); sel_row_start = sel_row_end = tabular->row_of_cell(actcell);
} }
bv->text->SetUndo(bv->buffer(), Undo::FINISH, bv->text->SetUndo(bv->buffer(), Undo::FINISH,
#ifndef NEW_INSETS
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
#else
bv->text->cursor.par()->previous(), bv->text->cursor.par()->previous(),
bv->text->cursor.par()->next() bv->text->cursor.par()->next());
#endif
);
int row = tabular->row_of_cell(actcell); int row = tabular->row_of_cell(actcell);
int column = tabular->column_of_cell(actcell); int column = tabular->column_of_cell(actcell);

View File

@ -122,21 +122,12 @@ InsetText::~InsetText()
delete (*cit).second; delete (*cit).second;
(*cit).second = 0; (*cit).second = 0;
} }
#ifndef NEW_INSETS
LyXParagraph * p = par->next_;
delete par;
while(p) {
par = p;
p = p->next_;
delete par;
}
#else
while (par) { while (par) {
LyXParagraph * tmp = par->next(); LyXParagraph * tmp = par->next();
delete par; delete par;
par = tmp; par = tmp;
} }
#endif
} }
@ -148,21 +139,12 @@ void InsetText::clear()
delete (*cit).second; delete (*cit).second;
(*cit).second = 0; (*cit).second = 0;
} }
#ifndef NEW_INSETS
LyXParagraph * p = par->next_;
delete par;
while(p) {
par = p;
p = p->next_;
delete par;
}
#else
while (par) { while (par) {
LyXParagraph * tmp = par->next(); LyXParagraph * tmp = par->next();
delete par; delete par;
par = tmp; par = tmp;
} }
#endif
par = new LyXParagraph; par = new LyXParagraph;
} }
@ -193,10 +175,6 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
int pos = 0; int pos = 0;
LyXParagraph * return_par = 0; LyXParagraph * return_par = 0;
char depth = 0; // signed or unsigned? char depth = 0; // signed or unsigned?
#ifndef NEW_INSETS
LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE;
LyXParagraph::footnote_kind footnotekind = LyXParagraph::FOOTNOTE;
#endif
LyXFont font(LyXFont::ALL_INHERIT); LyXFont font(LyXFont::ALL_INHERIT);
// delete all instances of LyXText before deleting the paragraps used // delete all instances of LyXText before deleting the paragraps used
@ -206,21 +184,12 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
(*cit).second = 0; (*cit).second = 0;
} }
#ifndef NEW_INSETS
LyXParagraph * p = par->next_;
delete par;
while(p) {
par = p;
p = p->next_;
delete par;
}
#else
while (par) { while (par) {
LyXParagraph * tmp = par->next(); LyXParagraph * tmp = par->next();
delete par; delete par;
par = tmp; par = tmp;
} }
#endif
par = new LyXParagraph; par = new LyXParagraph;
while (lex.IsOK()) { while (lex.IsOK()) {
lex.nextToken(); lex.nextToken();
@ -231,12 +200,7 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
break; break;
if (const_cast<Buffer*>(buf)-> if (const_cast<Buffer*>(buf)->
parseSingleLyXformat2Token(lex, par, return_par, parseSingleLyXformat2Token(lex, par, return_par,
token, pos, depth, font token, pos, depth, font)) {
#ifndef NEW_INSETS
, footnoteflag, footnotekind
#endif
))
{
// the_end read this should NEVER happen // the_end read this should NEVER happen
lex.printError("\\the_end read in inset! Error in document!"); lex.printError("\\the_end read in inset! Error in document!");
return; return;
@ -247,11 +211,7 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
par = return_par; par = return_par;
while(return_par) { while(return_par) {
return_par->SetInsetOwner(this); return_par->SetInsetOwner(this);
#ifndef NEW_INSETS
return_par = return_par->next_;
#else
return_par = return_par->next(); return_par = return_par->next();
#endif
} }
if (token != "\\end_inset") { if (token != "\\end_inset") {
@ -578,12 +538,7 @@ void InsetText::Edit(BufferView * bv, int x, int y, unsigned int button)
// If the inset is empty set the language of the current font to the // If the inset is empty set the language of the current font to the
// language to the surronding text. // language to the surronding text.
#ifndef NEW_INSETS if (par->size() == 0 && !par->next()) {
if (par->Last() == 0 && !par->next_)
#else
if (par->size() == 0 && !par->next())
#endif
{
LyXFont font(LyXFont::ALL_IGNORE); LyXFont font(LyXFont::ALL_IGNORE);
font.setLanguage(bv->getParentLanguage(this)); font.setLanguage(bv->getParentLanguage(this));
SetFont(bv, font, false); SetFont(bv, font, false);
@ -891,14 +846,8 @@ InsetText::LocalDispatch(BufferView * bv,
* true (on). */ * true (on). */
bv->text->SetUndo(bv->buffer(), Undo::INSERT, bv->text->SetUndo(bv->buffer(), Undo::INSERT,
#ifndef NEW_INSETS
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
#else
bv->text->cursor.par()->previous(), bv->text->cursor.par()->previous(),
bv->text->cursor.par()->next() bv->text->cursor.par()->next());
#endif
);
bv->setState(); bv->setState();
if (lyxrc.auto_region_delete) { if (lyxrc.auto_region_delete) {
if (TEXT(bv)->selection){ if (TEXT(bv)->selection){
@ -978,14 +927,8 @@ InsetText::LocalDispatch(BufferView * bv,
break; break;
case LFUN_BACKSPACE: case LFUN_BACKSPACE:
bv->text->SetUndo(bv->buffer(), Undo::DELETE, bv->text->SetUndo(bv->buffer(), Undo::DELETE,
#ifndef NEW_INSETS
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
#else
bv->text->cursor.par()->previous(), bv->text->cursor.par()->previous(),
bv->text->cursor.par()->next() bv->text->cursor.par()->next());
#endif
);
if (TEXT(bv)->selection) if (TEXT(bv)->selection)
TEXT(bv)->CutSelection(bv); TEXT(bv)->CutSelection(bv);
else else
@ -994,14 +937,8 @@ InsetText::LocalDispatch(BufferView * bv,
break; break;
case LFUN_DELETE: case LFUN_DELETE:
bv->text->SetUndo(bv->buffer(), Undo::DELETE, bv->text->SetUndo(bv->buffer(), Undo::DELETE,
#ifndef NEW_INSETS
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
#else
bv->text->cursor.par()->previous(), bv->text->cursor.par()->previous(),
bv->text->cursor.par()->next() bv->text->cursor.par()->next());
#endif
);
if (TEXT(bv)->selection) if (TEXT(bv)->selection)
TEXT(bv)->CutSelection(bv); TEXT(bv)->CutSelection(bv);
else else
@ -1010,14 +947,8 @@ InsetText::LocalDispatch(BufferView * bv,
break; break;
case LFUN_CUT: case LFUN_CUT:
bv->text->SetUndo(bv->buffer(), Undo::DELETE, bv->text->SetUndo(bv->buffer(), Undo::DELETE,
#ifndef NEW_INSETS
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
#else
bv->text->cursor.par()->previous(), bv->text->cursor.par()->previous(),
bv->text->cursor.par()->next() bv->text->cursor.par()->next());
#endif
);
TEXT(bv)->CutSelection(bv); TEXT(bv)->CutSelection(bv);
UpdateLocal(bv, CURSOR_PAR, true); UpdateLocal(bv, CURSOR_PAR, true);
break; break;
@ -1052,14 +983,8 @@ InsetText::LocalDispatch(BufferView * bv,
} }
} }
bv->text->SetUndo(bv->buffer(), Undo::INSERT, bv->text->SetUndo(bv->buffer(), Undo::INSERT,
#ifndef NEW_INSETS
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
#else
bv->text->cursor.par()->previous(), bv->text->cursor.par()->previous(),
bv->text->cursor.par()->next() bv->text->cursor.par()->next());
#endif
);
TEXT(bv)->PasteSelection(bv); TEXT(bv)->PasteSelection(bv);
UpdateLocal(bv, CURSOR_PAR, true); UpdateLocal(bv, CURSOR_PAR, true);
break; break;
@ -1079,14 +1004,8 @@ InsetText::LocalDispatch(BufferView * bv,
if (!autoBreakRows) if (!autoBreakRows)
return DISPATCHED; return DISPATCHED;
bv->text->SetUndo(bv->buffer(), Undo::INSERT, bv->text->SetUndo(bv->buffer(), Undo::INSERT,
#ifndef NEW_INSETS
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
#else
bv->text->cursor.par()->previous(), bv->text->cursor.par()->previous(),
bv->text->cursor.par()->next() bv->text->cursor.par()->next());
#endif
);
TEXT(bv)->InsertChar(bv, LyXParagraph::META_NEWLINE); TEXT(bv)->InsertChar(bv, LyXParagraph::META_NEWLINE);
UpdateLocal(bv, CURSOR_PAR, true); UpdateLocal(bv, CURSOR_PAR, true);
break; break;
@ -1184,12 +1103,7 @@ InsetText::LocalDispatch(BufferView * bv,
/// If the action has deleted all text in the inset, we need to change the /// If the action has deleted all text in the inset, we need to change the
// language to the language to the surronding text. // language to the language to the surronding text.
#ifndef NEW_INSETS if (par->size() == 0 && !par->next()) {
if (par->Last() == 0 && !par->next_)
#else
if (par->size() == 0 && !par->next())
#endif
{
LyXFont font(LyXFont::ALL_IGNORE); LyXFont font(LyXFont::ALL_IGNORE);
font.setLanguage(bv->getParentLanguage(this)); font.setLanguage(bv->getParentLanguage(this));
SetFont(bv, font, false); SetFont(bv, font, false);
@ -1221,11 +1135,7 @@ int InsetText::Ascii(Buffer const * buf, ostream & os, int linelen) const
tmp = buf->asciiParagraph(p, linelen); tmp = buf->asciiParagraph(p, linelen);
lines += countChar(tmp, '\n'); lines += countChar(tmp, '\n');
os << tmp; os << tmp;
#ifndef NEW_INSETS
p = p->next(); p = p->next();
#else
p = p->next();
#endif
} }
return lines; return lines;
} }
@ -1240,11 +1150,7 @@ int InsetText::DocBook(Buffer const * buf, ostream & os) const
string tmp; string tmp;
while (p) { while (p) {
buf->SimpleDocBookOnePar(os,tmp,p,desc,0); buf->SimpleDocBookOnePar(os,tmp,p,desc,0);
#ifndef NEW_INSETS
p = p->next_;
#else
p = p->next(); p = p->next();
#endif
} }
return lines; return lines;
@ -1256,11 +1162,7 @@ void InsetText::Validate(LaTeXFeatures & features) const
LyXParagraph * p = par; LyXParagraph * p = par;
while(p) { while(p) {
p->validate(features); p->validate(features);
#ifndef NEW_INSETS
p = p->next_;
#else
p = p->next(); p = p->next();
#endif
} }
} }
@ -1367,11 +1269,7 @@ UpdatableInset::RESULT
InsetText::moveRightIntern(BufferView * bv, bool behind, InsetText::moveRightIntern(BufferView * bv, bool behind,
bool activate_inset, bool selecting) bool activate_inset, bool selecting)
{ {
#ifndef NEW_INSETS
if (!cpar(bv)->next_ && (cpos(bv) >= cpar(bv)->Last()))
#else
if (!cpar(bv)->next() && (cpos(bv) >= cpar(bv)->size())) if (!cpar(bv)->next() && (cpos(bv) >= cpar(bv)->size()))
#endif
return FINISHED; return FINISHED;
if (activate_inset && checkAndActivateInset(bv, behind)) if (activate_inset && checkAndActivateInset(bv, behind))
return DISPATCHED; return DISPATCHED;
@ -1386,11 +1284,7 @@ UpdatableInset::RESULT
InsetText::moveLeftIntern(BufferView * bv, bool behind, InsetText::moveLeftIntern(BufferView * bv, bool behind,
bool activate_inset, bool selecting) bool activate_inset, bool selecting)
{ {
#ifndef NEW_INSETS
if (!cpar(bv)->previous_ && (cpos(bv) <= 0))
#else
if (!cpar(bv)->previous() && (cpos(bv) <= 0)) if (!cpar(bv)->previous() && (cpos(bv) <= 0))
#endif
return FINISHED; return FINISHED;
TEXT(bv)->CursorLeft(bv); TEXT(bv)->CursorLeft(bv);
if (!selecting) if (!selecting)
@ -1429,14 +1323,8 @@ bool InsetText::InsertInset(BufferView * bv, Inset * inset)
return false; return false;
} }
bv->text->SetUndo(bv->buffer(), Undo::INSERT, bv->text->SetUndo(bv->buffer(), Undo::INSERT,
#ifndef NEW_INSETS
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
#else
bv->text->cursor.par()->previous(), bv->text->cursor.par()->previous(),
bv->text->cursor.par()->next() bv->text->cursor.par()->next());
#endif
);
inset->setOwner(this); inset->setOwner(this);
HideInsetCursor(bv); HideInsetCursor(bv);
TEXT(bv)->InsertInset(bv, inset); TEXT(bv)->InsertInset(bv, inset);
@ -1498,14 +1386,8 @@ void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall)
{ {
if (TEXT(bv)->selection) { if (TEXT(bv)->selection) {
bv->text->SetUndo(bv->buffer(), Undo::EDIT, bv->text->SetUndo(bv->buffer(), Undo::EDIT,
#ifndef NEW_INSETS
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
#else
bv->text->cursor.par()->previous(), bv->text->cursor.par()->previous(),
bv->text->cursor.par()->next() bv->text->cursor.par()->next());
#endif
);
} }
TEXT(bv)->SetFont(bv, font, toggleall); TEXT(bv)->SetFont(bv, font, toggleall);
bv->fitCursor(TEXT(bv)); bv->fitCursor(TEXT(bv));
@ -1594,28 +1476,6 @@ void InsetText::SetParagraphData(LyXParagraph * p)
(*cit).second = 0; (*cit).second = 0;
} }
#ifndef NEW_INSETS
LyXParagraph * np;
if (par) {
np = par->next_;
delete par;
while (np) {
par = np;
np = np->next_;
delete par;
}
}
par = p->Clone();
par->SetInsetOwner(this);
np = par;
while (p->next_) {
p = p->next_;
np->next(p->Clone());
np->next_->previous(np);
np = np->next_;
np->SetInsetOwner(this);
}
#else
while (par) { while (par) {
LyXParagraph * tmp = par->next(); LyXParagraph * tmp = par->next();
delete par; delete par;
@ -1632,7 +1492,7 @@ void InsetText::SetParagraphData(LyXParagraph * p)
np = np->next(); np = np->next();
np->SetInsetOwner(this); np->SetInsetOwner(this);
} }
#endif
need_update = INIT; need_update = INIT;
} }
@ -1754,26 +1614,16 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
if (recursive) { if (recursive) {
/// then remove all LyXText in text-insets /// then remove all LyXText in text-insets
LyXParagraph * p = par; LyXParagraph * p = par;
#ifndef NEW_INSETS
for (; p; p = p->next_) {
p->deleteInsetsLyXText(bv);
}
#else
for (; p; p = p->next()) { for (; p; p = p->next()) {
p->deleteInsetsLyXText(bv); p->deleteInsetsLyXText(bv);
} }
#endif
} }
} }
void InsetText::resizeLyXText(BufferView * bv) const void InsetText::resizeLyXText(BufferView * bv) const
{ {
#ifndef NEW_INSETS
if (!par->next_ && !par->size()) // resize not neccessary!
#else
if (!par->next() && !par->size()) // resize not neccessary! if (!par->next() && !par->size()) // resize not neccessary!
#endif
return; return;
if ((cache.find(bv) == cache.end()) || !cache[bv]) if ((cache.find(bv) == cache.end()) || !cache[bv])
return; return;
@ -1835,15 +1685,9 @@ void InsetText::resizeLyXText(BufferView * bv) const
/// then resize all LyXText in text-insets /// then resize all LyXText in text-insets
inset_x = cx(bv) - top_x + drawTextXOffset; inset_x = cx(bv) - top_x + drawTextXOffset;
inset_y = cy(bv) + drawTextYOffset; inset_y = cy(bv) + drawTextYOffset;
#ifndef NEW_INSETS
for (LyXParagraph * p = par; p; p = p->next_) {
p->resizeInsetsLyXText(bv);
}
#else
for (LyXParagraph * p = par; p; p = p->next()) { for (LyXParagraph * p = par; p; p = p->next()) {
p->resizeInsetsLyXText(bv); p->resizeInsetsLyXText(bv);
} }
#endif
} }
need_update = FULL; need_update = FULL;
} }
@ -1851,13 +1695,8 @@ void InsetText::resizeLyXText(BufferView * bv) const
void InsetText::removeNewlines() void InsetText::removeNewlines()
{ {
#ifndef NEW_INSETS
for (LyXParagraph * p = par; p; p = p->next_) {
for (int i = 0; i < p->Last(); ++i) {
#else
for (LyXParagraph * p = par; p; p = p->next()) { for (LyXParagraph * p = par; p; p = p->next()) {
for (int i = 0; i < p->size(); ++i) { for (int i = 0; i < p->size(); ++i) {
#endif
if (p->GetChar(i) == LyXParagraph::META_NEWLINE) if (p->GetChar(i) == LyXParagraph::META_NEWLINE)
p->Erase(i); p->Erase(i);
} }

View File

@ -473,23 +473,13 @@ void MenuInsertLabel(BufferView * bv, string const & arg)
string label(arg); string label(arg);
ProhibitInput(bv); ProhibitInput(bv);
if (label.empty()) { if (label.empty()) {
#ifndef NEW_INSETS
LyXParagraph * par =
bv->text->cursor.par()->FirstPhysicalPar();
#else
LyXParagraph * par = bv->text->cursor.par(); LyXParagraph * par = bv->text->cursor.par();
#endif
LyXLayout const * layout = LyXLayout const * layout =
&textclasslist.Style(bv->buffer()->params.textclass, &textclasslist.Style(bv->buffer()->params.textclass,
par->GetLayout()); par->GetLayout());
#ifndef NEW_INSETS
if (layout->latextype == LATEX_PARAGRAPH && par->previous_) {
LyXParagraph * par2 = par->previous_->FirstPhysicalPar();
#else
if (layout->latextype == LATEX_PARAGRAPH && par->previous()) { if (layout->latextype == LATEX_PARAGRAPH && par->previous()) {
LyXParagraph * par2 = par->previous(); LyXParagraph * par2 = par->previous();
#endif
LyXLayout const * layout2 = LyXLayout const * layout2 =
&textclasslist.Style(bv->buffer()->params.textclass, &textclasslist.Style(bv->buffer()->params.textclass,
par2->GetLayout()); par2->GetLayout());
@ -501,25 +491,7 @@ void MenuInsertLabel(BufferView * bv, string const & arg)
string text = layout->latexname().substr(0, 3); string text = layout->latexname().substr(0, 3);
if (layout->latexname() == "theorem") if (layout->latexname() == "theorem")
text = "thm"; // Create a correct prefix for prettyref text = "thm"; // Create a correct prefix for prettyref
#ifndef NEW_INSETS
if (par->footnoteflag==LyXParagraph::OPEN_FOOTNOTE)
switch (par->footnotekind) {
case LyXParagraph::FIG:
case LyXParagraph::WIDE_FIG:
text = "fig";
break;
case LyXParagraph::TAB:
case LyXParagraph::WIDE_TAB:
text = "tab";
break;
case LyXParagraph::ALGORITHM:
text = "alg";
break;
case LyXParagraph::FOOTNOTE:
case LyXParagraph::MARGIN:
break;
}
#endif
text += ":"; text += ":";
if (layout->latextype == LATEX_PARAGRAPH || if (layout->latextype == LATEX_PARAGRAPH ||
lyxrc.label_init_length < 0) lyxrc.label_init_length < 0)

View File

@ -118,11 +118,7 @@ bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos,
string::size_type size = str.length(); string::size_type size = str.length();
LyXParagraph::size_type i = 0; LyXParagraph::size_type i = 0;
#ifndef NEW_INSETS
while (((pos + i) < par->Last())
#else
while (((pos + i) < par->size()) while (((pos + i) < par->size())
#endif
&& (string::size_type(i) < size) && (string::size_type(i) < size)
&& (cs ? (str[i] == par->GetChar(pos + i)) && (cs ? (str[i] == par->GetChar(pos + i))
: (toupper(str[i]) == toupper(par->GetChar(pos + i))))) : (toupper(str[i]) == toupper(par->GetChar(pos + i)))))
@ -133,11 +129,7 @@ bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos,
// if necessary, check whether string matches word // if necessary, check whether string matches word
if (!mw || if (!mw ||
(mw && ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos - 1))) (mw && ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos - 1)))
#ifndef NEW_INSETS
&& (pos + size >= par->Last()
#else
&& (pos + size >= par->size() && (pos + size >= par->size()
#endif
|| !IsLetterCharOrDigit(par->GetChar(pos + size)))) || !IsLetterCharOrDigit(par->GetChar(pos + size))))
) )
) )
@ -156,11 +148,7 @@ bool SearchForward(BufferView * bv, string const & str,
LyXParagraph::size_type pos = bv->text->cursor.pos(); LyXParagraph::size_type pos = bv->text->cursor.pos();
while (par && !IsStringInText(par, pos, str, cs, mw)) { while (par && !IsStringInText(par, pos, str, cs, mw)) {
#ifndef NEW_INSETS
if (pos < par->Last() - 1)
#else
if (pos < par->size() - 1) if (pos < par->size() - 1)
#endif
++pos; ++pos;
else { else {
pos = 0; pos = 0;
@ -193,11 +181,7 @@ bool SearchBackward(BufferView * bv, string const & str,
do { do {
par = par->previous(); par = par->previous();
if (par) if (par)
#ifndef NEW_INSETS
pos = par->Last() - 1;
#else
pos = par->size() - 1; pos = par->size() - 1;
#endif
} while (par && pos < 0); } while (par && pos < 0);
} }
} while (par && !IsStringInText(par, pos, str, cs, mw)); } while (par && !IsStringInText(par, pos, str, cs, mw));

View File

@ -968,12 +968,6 @@ string const LyXFunc::Dispatch(int ac,
} }
break; break;
#ifndef NEW_INSETS
case LFUN_OPENSTUFF:
owner->view()->openStuff();
break;
#endif
case LFUN_HYPHENATION: case LFUN_HYPHENATION:
owner->view()->hyphenationPoint(); owner->view()->hyphenationPoint();
break; break;
@ -1015,43 +1009,12 @@ string const LyXFunc::Dispatch(int ac,
owner->view()->setState(); owner->view()->setState();
owner->showState(); owner->showState();
break; break;
#ifndef NEW_INSETS
case LFUN_MELT:
Melt(owner->view());
break;
#endif
case LFUN_RECONFIGURE: case LFUN_RECONFIGURE:
Reconfigure(owner->view()); Reconfigure(owner->view());
break; break;
#ifndef NEW_INSETS
case LFUN_FOOTMELT:
if (owner->view()->available()
&& !TEXT()->selection
&& TEXT()->cursor.par()->footnoteflag
!= LyXParagraph::NO_FOOTNOTE)
{ // only melt footnotes with FOOTMELT, not margins etc
if (TEXT()->cursor.par()->footnotekind == LyXParagraph::FOOTNOTE)
Melt(owner->view());
}
else
Foot(owner->view());
owner->view()->setState();
break;
case LFUN_MARGINMELT: #if 0
if (owner->view()->available()
&& !TEXT()->selection
&& TEXT()->cursor.par()->footnoteflag
!= LyXParagraph::NO_FOOTNOTE) {
// only melt margins
if (TEXT()->cursor.par()->footnotekind == LyXParagraph::MARGIN)
Melt(owner->view());
} else
Margin(owner->view());
owner->view()->setState();
break;
#endif
#ifndef NEW_INSETS
case LFUN_FLOATSOPERATE: case LFUN_FLOATSOPERATE:
if (argument == "openfoot") if (argument == "openfoot")
owner->view()->allFloats(1,0); owner->view()->allFloats(1,0);
@ -1422,35 +1385,6 @@ string const LyXFunc::Dispatch(int ac,
} }
break; break;
#ifndef NEW_INSETS
case LFUN_INSERTFOOTNOTE:
{
LyXParagraph::footnote_kind kind;
if (argument == "footnote") {
kind = LyXParagraph::FOOTNOTE;
} else if (argument == "margin") {
kind = LyXParagraph::MARGIN;
} else if (argument == "figure") {
kind = LyXParagraph::FIG;
} else if (argument == "table") {
kind = LyXParagraph::TAB;
} else if (argument == "wide-fig") {
kind = LyXParagraph::WIDE_FIG;
} else if (argument == "wide-tab") {
kind = LyXParagraph::WIDE_TAB;
} else if (argument == "algorithm") {
kind = LyXParagraph::ALGORITHM;
} else {
setErrorMessage(N_("Unknown kind of footnote"));
break;
}
TEXT()->InsertFootnoteEnvironment(owner->view(), kind);
owner->view()->update(TEXT(),
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
owner->view()->setState();
}
break;
#endif
case LFUN_TOGGLECURSORFOLLOW: case LFUN_TOGGLECURSORFOLLOW:
lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar; lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar;
break; break;

View File

@ -9,9 +9,6 @@
#include "support/lyxalgo.h" #include "support/lyxalgo.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "debug.h" #include "debug.h"
#if 1 // to get NEW_INSETS
#include "lyxparagraph.h"
#endif
using std::sort; using std::sort;
using std::ostream; using std::ostream;
@ -142,12 +139,6 @@ void LyXLex::Pimpl::setCommentChar(char c)
bool LyXLex::Pimpl::next(bool esc /* = false */) bool LyXLex::Pimpl::next(bool esc /* = false */)
{ {
if (!pushTok.empty()) { if (!pushTok.empty()) {
#ifndef NEW_INSETS
pushTok.copy(buff, string::npos);
buff[pushTok.length()] = '\0';
pushTok.erase();
return true;
#else
// There can have been a whole line pushed so // There can have been a whole line pushed so
// we extract the first word and leaves the rest // we extract the first word and leaves the rest
// in pushTok. (Lgb) // in pushTok. (Lgb)
@ -163,7 +154,6 @@ bool LyXLex::Pimpl::next(bool esc /* = false */)
pushTok.erase(); pushTok.erase();
return true; return true;
} }
#endif
} }
if (!esc) { if (!esc) {
unsigned char c = 0; // getc() returns an int unsigned char c = 0; // getc() returns an int
@ -401,15 +391,6 @@ int LyXLex::Pimpl::lex()
bool LyXLex::Pimpl::EatLine() bool LyXLex::Pimpl::EatLine()
{ {
#ifndef NEW_INSETS
// This is not handling the pushed token
if (!pushTok.empty()) {
pushTok.copy(buff, string::npos);
buff[pushTok.length()] = '\0';
pushTok.erase();
return true;
}
#endif
int i = 0; int i = 0;
unsigned char c = '\0'; unsigned char c = '\0';
char cc = 0; char cc = 0;
@ -442,12 +423,6 @@ bool LyXLex::Pimpl::EatLine()
bool LyXLex::Pimpl::nextToken() bool LyXLex::Pimpl::nextToken()
{ {
if (!pushTok.empty()) { if (!pushTok.empty()) {
#ifndef NEW_INSETS
pushTok.copy(buff, string::npos);
buff[pushTok.length()] = '\0';
pushTok.erase();
return true;
#else
// There can have been a whole line pushed so // There can have been a whole line pushed so
// we extract the first word and leaves the rest // we extract the first word and leaves the rest
// in pushTok. (Lgb) // in pushTok. (Lgb)
@ -463,7 +438,6 @@ bool LyXLex::Pimpl::nextToken()
pushTok.erase(); pushTok.erase();
return true; return true;
} }
#endif
} }
status = 0; status = 0;

View File

@ -156,10 +156,6 @@ public:
Returns true if something was broken. */ Returns true if something was broken. */
bool FullRebreak(BufferView *); bool FullRebreak(BufferView *);
#ifndef NEW_INSETS
///
LyXParagraph::footnote_flag GetFootnoteFlag(int row);
#endif
/// ///
Row * need_break_row; Row * need_break_row;
/// ///
@ -338,29 +334,6 @@ public:
void GetVisibleRow(BufferView *, int y_offset, int x_offset, void GetVisibleRow(BufferView *, int y_offset, int x_offset,
Row * row_ptr, int y, bool cleared=false); Row * row_ptr, int y, bool cleared=false);
#ifndef NEW_INSETS
/* footnotes: */
///
void ToggleFootnote(BufferView *);
///
void OpenStuff(BufferView *);
///
void OpenFootnotes();
///
void OpenFootnote(BufferView *);
///
void CloseFootnotes();
///
void CloseFootnote(BufferView *);
/** turn the selection into a new environment. If there is no
selection, create an empty environment
*/
void InsertFootnoteEnvironment(BufferView *,
LyXParagraph::footnote_kind kind);
///
void MeltFootnoteEnvironment(BufferView *);
#endif
/// ///
void CutSelection(BufferView *, bool = true); void CutSelection(BufferView *, bool = true);
/// ///
@ -394,14 +367,7 @@ public:
LyXAlignment align, LyXAlignment align,
string labelwidthstring, string labelwidthstring,
bool noindent); bool noindent);
#ifndef NO_PEXTRA
///
void SetParagraphExtraOpt(BufferView *, int type,
string const & width,
string const & widthp,
int alignment, bool hfill,
bool start_minipage);
#endif
/* these things are for search and replace */ /* these things are for search and replace */
/** sets the selection over the number of characters of string, /** sets the selection over the number of characters of string,

View File

@ -811,12 +811,6 @@ bool RunSpellChecker(BufferView * bv)
int newvalue; int newvalue;
FL_OBJECT * obj; FL_OBJECT * obj;
#ifndef NEW_INSETS
// Open all floats
bv->allFloats(1, 0);
bv->allFloats(1, 1);
#endif
#ifdef USE_PSPELL #ifdef USE_PSPELL
string tmp = (lyxrc.isp_use_alt_lang) ? string tmp = (lyxrc.isp_use_alt_lang) ?
lyxrc.isp_alt_lang : bv->buffer()->params.language->code(); lyxrc.isp_alt_lang : bv->buffer()->params.language->code();

View File

@ -1,3 +1,7 @@
2001-05-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
* textutils.h: remvoe !NEW_INSETS cruft
2001-05-02 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 2001-05-02 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* fmt.C: * fmt.C:

View File

@ -42,21 +42,6 @@ bool IsInsetChar(char c) {
} }
#ifndef NEW_INSETS
///
inline
bool IsFloatChar(char c) {
return (c == LyXParagraph::META_FOOTNOTE
|| c == LyXParagraph::META_MARGIN
|| c == LyXParagraph::META_FIG
|| c == LyXParagraph::META_TAB
|| c == LyXParagraph::META_ALGORITHM
|| c == LyXParagraph::META_WIDE_FIG
|| c == LyXParagraph::META_WIDE_TAB);
}
#endif
/// ///
inline inline
bool IsLineSeparatorChar(char c) { bool IsLineSeparatorChar(char c) {
@ -124,9 +109,6 @@ bool IsWordChar(unsigned char c) {
return !( IsSeparatorChar( c ) return !( IsSeparatorChar( c )
|| IsKommaChar( c ) || IsKommaChar( c )
|| IsHfillChar( c ) || IsHfillChar( c )
#ifndef NEW_INSETS
|| IsFloatChar( c )
#endif
|| IsInsetChar( c )); || IsInsetChar( c ));
} }

View File

@ -1475,10 +1475,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
LyXParagraph * par = new LyXParagraph; LyXParagraph * par = new LyXParagraph;
LyXParagraph * return_par = 0; LyXParagraph * return_par = 0;
#ifndef NEW_INSETS
LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE;
LyXParagraph::footnote_kind footnotekind = LyXParagraph::FOOTNOTE;
#endif
string tmptok; string tmptok;
int pos = 0; int pos = 0;
char depth = 0; char depth = 0;
@ -1499,14 +1496,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
if (owner_->BufferOwner()->parseSingleLyXformat2Token(lex, par, if (owner_->BufferOwner()->parseSingleLyXformat2Token(lex, par,
return_par, return_par,
token, pos, token, pos,
depth, font depth, font)) {
#ifndef NEW_INSETS
,
footnoteflag,
footnotekind
#endif
))
{
// the_end read // the_end read
lex.pushToken(token); lex.pushToken(token);
break; break;
@ -1524,12 +1514,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
InsetText * inset = GetCellInset(cell); InsetText * inset = GetCellInset(cell);
int row; int row;
#ifndef NEW_INSETS for (int i = 0; i < par->size(); ++i) {
for (int i = 0; i < par->Last(); ++i)
#else
for (int i = 0; i < par->size(); ++i)
#endif
{
if (par->IsNewline(i)) { if (par->IsNewline(i)) {
++cell; ++cell;
if (cell > GetNumberOfCells()) { if (cell > GetNumberOfCells()) {
@ -1558,11 +1543,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
} }
} }
par->CopyIntoMinibuffer(*owner_->BufferOwner(), i); par->CopyIntoMinibuffer(*owner_->BufferOwner(), i);
#ifndef NEW_INSETS
inset->par->InsertFromMinibuffer(inset->par->Last());
#else
inset->par->InsertFromMinibuffer(inset->par->size()); inset->par->InsertFromMinibuffer(inset->par->size());
#endif
} }
delete par; delete par;
Reinit(); Reinit();
@ -2165,11 +2146,8 @@ int LyXTabular::Latex(Buffer const * buf,
InsetText * inset = GetCellInset(cell); InsetText * inset = GetCellInset(cell);
bool rtl = inset->par->isRightToLeftPar(buf->params) && bool rtl = inset->par->isRightToLeftPar(buf->params) &&
#ifndef NEW_INSETS inset->par->size() > 0 && GetPWidth(cell).empty();
inset->par->Last() > 0 && GetPWidth(cell).empty();
#else
inset->par->size() > 0 && GetPWidth(cell).empty();
#endif
if (rtl) if (rtl)
os << "\\R{"; os << "\\R{";
ret += inset->Latex(buf, os, fragile, fp); ret += inset->Latex(buf, os, fragile, fp);
@ -2565,20 +2543,6 @@ std::vector<string> const LyXTabular::getLabelList() const
} }
#ifndef NEW_INSETS
LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
{
LyXParagraph * par = GetCellInset(cell)->par;
for (; par; par = par->next_) {
for (int i = 0; i < par->Last(); ++i) {
if (par->GetChar(i) == LyXParagraph::META_NEWLINE)
return BOX_PARBOX;
}
}
return BOX_NONE;
}
#else
LyXTabular::BoxType LyXTabular::UseParbox(int cell) const LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
{ {
LyXParagraph * par = GetCellInset(cell)->par; LyXParagraph * par = GetCellInset(cell)->par;
@ -2591,7 +2555,7 @@ LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
} }
return BOX_NONE; return BOX_NONE;
} }
#endif
/* Emacs: /* Emacs:
* Local variables: * Local variables:
* tab-width: 4 * tab-width: 4

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -31,17 +31,6 @@ Undo::Undo(undo_kind kind_arg,
} }
#ifndef NEW_INSETS
Undo::~Undo()
{
LyXParagraph * tmppar;
while (par) {
tmppar = par;
par = par->next_;
delete tmppar;
}
}
#else
Undo::~Undo() Undo::~Undo()
{ {
LyXParagraph * tmppar; LyXParagraph * tmppar;
@ -51,7 +40,6 @@ Undo::~Undo()
delete tmppar; delete tmppar;
} }
} }
#endif
UndoStack::UndoStack() UndoStack::UndoStack()