void menuUndo();
///
void menuRedo();
-#ifndef NEW_INSETS
- ///
- void toggleFloat();
- ///
- void openStuff();
-#endif
///
void insertNote();
-#ifndef NEW_INSETS
- ///
- void allFloats(char flag, char figmar);
-#endif
/// removes all autodeletable insets
bool removeAutoInsets();
///
LyXCursor cursor;
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) {
// this has to be done before the delete
text->SetCursor(this, cursor, par, 0);
// avoid forbidden cursor positions caused by error removing
if (tmpcursor.pos() > tmpcursor.par()->size())
tmpcursor.pos(tmpcursor.par()->size());
-#endif
+
text->SetCursorIntern(this, tmpcursor.par(), tmpcursor.pos());
return a;
// Save the cursor position
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();
cit != terr.end();
++cit) {
text->BreakParagraph(this);
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
-#ifndef NEW_INSETS
- if (text->cursor.par()->Last()) {
-#else
if (text->cursor.par()->size()) {
-#endif
text->CursorLeft(this);
text->BreakParagraph(this);
}
-#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()
{
InsetInfo * new_inset = new InsetInfo();
}
-#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()
{
if (available()) {
return; // shouldn't happen
if (kind == Undo::EDIT) // in this case insets would not be stored!
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->cursor.par()->previous(),
text->cursor.par()->next());
-#endif
}
LyXParagraph * par = buffer()->paragraph;
LyXCursor cursor = text->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.pos(tmpcursor.pos());
-#endif
while (par) {
bool flag2 = false;
}
}
}
-#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) {
flag = true;
// this is possible now, since SetCursor takes
text->FullRebreak(this);
}
par = par->next();
-#endif
}
text->SetCursorIntern(this, cursor.par(), cursor.pos());
return flag;
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
if (bv_->text) {
bool hit = false;
return;
}
}
-#endif
+
// Maybe we want to edit a bibitem ale970302
if (bv_->text->cursor.par()->bibkey && x < 20 +
bibitemMaxWidth(bv_, textclasslist.
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()
-#endif
&& cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET
&& cursor.par()->GetInset(cursor.pos())
&& cursor.par()->GetInset(cursor.pos())->Editable()) {
if (i >= saved_positions_num)
return;
- string fname = saved_positions[i].filename;
+ string const fname = saved_positions[i].filename;
beforeChange(bv_->text);
if (!par)
return;
-#ifndef NEW_INSETS
- bv_->text->SetCursor(bv_, par,
- min(par->Last(), saved_positions[i].par_pos));
-#else
bv_->text->SetCursor(bv_, par,
min(par->size(), saved_positions[i].par_pos));
-#endif
+
update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
if (i > 0) {
string const str = _("Moved to bookmark") + ' ' + tostr(i);
update(TEXT(bv_), BufferView::SELECT|BufferView::FITCUR);
if (is_rtl)
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()
-#endif
&& TEXT(bv_)->cursor.par()->GetChar(TEXT(bv_)->cursor.pos())
== LyXParagraph::META_INSET
&& TEXT(bv_)->cursor.par()->GetInset(TEXT(bv_)->cursor.pos())
if (!is_rtl)
TEXT(bv_)->CursorLeft(bv_, false);
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() &&
-#endif
(TEXT(bv_)->cursor.par()->GetChar(TEXT(bv_)->cursor.pos()) ==
LyXParagraph::META_INSET) &&
TEXT(bv_)->cursor.par()->GetInset(TEXT(bv_)->cursor.pos()) &&
LyXCursor cursor = TEXT(bv_)->cursor;
if (!TEXT(bv_)->selection) {
-#ifndef NEW_INSETS
- if (cursor.pos() == cursor.par()->Last()) {
-#else
if (cursor.pos() == cursor.par()->size()) {
-#endif
TEXT(bv_)->CursorRight(bv_);
cursor = TEXT(bv_)->cursor;
if (cursor.pos() == 0
+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>
* Lsstream.h: include LString.h before the sstream headers to
while (buf) {
tmppar = buf;
-#ifndef NEW_INSETS
- buf = buf->next_;
-#else
buf = buf->next();
-#endif
delete tmppar;
}
buf = 0;
} // 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,
int start, int & end, char tc, bool doclear)
{
}
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,
int start, int end, char tc)
{
}
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,
int & pos, char tc)
{
return true;
}
-#endif
int CutAndPaste::nrOfParagraphs()
int n = 1;
LyXParagraph * tmppar = buf;
-#ifndef NEW_INSETS
- while(tmppar->next_) {
- ++n;
- tmppar = tmppar->next_;
- }
-#else
while(tmppar->next()) {
++n;
tmppar = tmppar->next();
}
-#endif
return n;
}
int ret = 0;
if (!par || c1 == c2)
return ret;
-#ifndef NEW_INSETS
- par = par->FirstPhysicalPar();
-#endif
+
while (par) {
string name = textclasslist.NameOfLayout(c1, par->layout);
int lay = 0;
InsetError * new_inset = new InsetError(s);
par->InsertInset(0, new_inset);
}
-#ifndef NEW_INSETS
- par = par->next_;
-#else
par = par->next();
-#endif
}
return ret;
}
-#ifndef NEW_INSETS
-bool CutAndPaste::checkPastePossible(LyXParagraph * par)
-#else
bool CutAndPaste::checkPastePossible(LyXParagraph *)
-#endif
{
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;
}
#include "lyxlex.h"
#include "debug.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;
add(LFUN_FREE);
add(SEPARATOR);
-#ifndef NEW_INSETS
- add(LFUN_FOOTMELT);
- add(LFUN_MARGINMELT);
-#else
add(LFUN_INSET_FOOTNOTE);
add(LFUN_INSET_MARGINAL);
-#endif
+
add(LFUN_DEPTH);
add(SEPARATOR);
#endif
#ifdef __GNUG__
-#pragma implementation "buffer.h"
+#pragma implementation
#endif
#include "buffer.h"
LyXParagraph * par = paragraph;
LyXParagraph * tmppar;
-#ifndef NEW_INSETS
- while (par) {
- tmppar = par->next_;
- delete par;
- par = tmppar;
- }
-#else
while (par) {
tmppar = par->next();
delete par;
par = tmppar;
}
-#endif
paragraph = 0;
}
{
int pos = 0;
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;
LyXParagraph * return_par = 0;
parseSingleLyXformat2Token(lex, par, return_par,
pretoken, pos, depth,
font
-#ifndef NEW_INSETS
- , footnoteflag,
- footnotekind
-#endif
);
}
LyXParagraph *& return_par,
string const & token, int & pos,
char & depth, LyXFont & font
-#ifndef NEW_INSETS
- , LyXParagraph::footnote_flag & footnoteflag,
- LyXParagraph::footnote_kind & footnotekind
-#endif
)
{
bool the_end_read = false;
#ifndef NO_PEXTRA_REALLY
-#ifdef NEW_INSETS
// This is super temporary but is needed to get the compability
// mode for minipages work correctly together with new tabulars.
static int call_depth = 0;
++call_depth;
-#endif
bool checkminipage = false;
static LyXParagraph * minipar = 0;
static LyXParagraph * parBeforeMinipage = 0;
par->InsertInset(pos, inset, font);
++pos;
} 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();
string const layoutname = lex.GetString();
pair<bool, LyXTextClass::LayoutList::size_type> pp
#if USE_CAPTION
}
#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") {
// This is the compability reader. It can be removed in
// LyX version 1.3.0. (Lgb)
inset->Read(this, nylex);
par->InsertInset(pos, inset, font);
++pos;
-#endif
} else if (token == "\\begin_deeper") {
++depth;
} else if (token == "\\end_deeper") {
LyXFont font2;
Inset const * inset;
char c;
-#ifndef NEW_INSETS
- LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE;
-#endif
char depth = 0;
int ltype = 0;
int ltype_depth = 0;
int noparbreak = 0;
int islatex = 0;
-#ifndef NEW_INSETS
- 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
+ if (!par->previous()) {
/* begins or ends a deeper area ?*/
if (depth != par->params.depth()) {
if (par->params.depth() > depth) {
/* what about the alignment */
} 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;
-#endif
}
font1 = LyXFont(LyXFont::ALL_INHERIT, params.language);
for (LyXParagraph::size_type i = 0; i < par->size(); ++i) {
- if (!i &&
-#ifndef NEW_INSETS
- !footnoteflag &&
-#endif
- !noparbreak) {
+ if (!i && !noparbreak) {
if (linelen > 0)
buffer << "\n\n";
for (char j = 0; j < depth; ++j)
// if only_body
while (par != endpar) {
-#ifndef NEW_INSETS
- if (par->IsDummy())
- lyxerr[Debug::LATEX] << "Error in latexParagraphs."
- << endl;
-#endif
LyXLayout const & layout =
textclasslist.Style(params.textclass,
par->layout);
// ordinary \footnote{} generation
// flag this with ftcount
ftcount = -1;
- if (layout.isEnvironment()
-#ifndef NEW_INSETS
- || par->params.pextraType() != LyXParagraph::PEXTRA_NONE
-#endif
- ) {
- par = par->TeXEnvironment(this, params, ofs, texrow
-#ifndef NEW_INSETS
- ,ftnote, ft_texrow, ftcount
-#endif
- );
+ if (layout.isEnvironment()) {
+ par = par->TeXEnvironment(this, params, ofs, texrow);
} else {
- par = par->TeXOnePar(this, params, ofs, texrow, false
-#ifndef NEW_INSETS
- ,
- ftnote, ft_texrow, ftcount
-#endif
- );
+ par = par->TeXOnePar(this, params, ofs, texrow, false);
}
// Write out what we've generated...
string const temp = "toc";
sgmlOpenTag(ofs, depth, temp);
-#ifndef NEW_INSETS
- par = par->next_;
- linuxDocHandleFootnote(ofs, par, depth);
-#else
par = par->next();
-#endif
continue;
}
}
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);
par = par->next();
-#endif
ofs << "\n";
// write closing SGML tags
}
-#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,
int depth, int desc_on,
LyXParagraph * & 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
&& (tpar->layout != textclasslist.NumberOfLayout(params.textclass,
"Caption").second))
tpar = tpar->next();
-#endif
+
if (tpar &&
tpar->layout == textclasslist.NumberOfLayout(params.textclass,
"Caption").second) {
}
-#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
// writes newline, if necessary.
namespace {
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;
SimpleDocBookOnePar(ofs, extra_par, par, desc_on,
depth + 1 + command_depth);
par = par->next();
-#endif
+
string end_tag;
// write closing SGML tags
switch (style.latextype) {
par->validate(features);
// and then the next paragraph
-#ifndef NEW_INSETS
- par = par->next_;
-#else
par = par->next();
-#endif
}
// the bullet shapes are buffer level not paragraph level
{
Lists l;
LyXParagraph * par = paragraph;
-#ifdef NEW_INSETS
bool found;
LyXTextClassList::size_type cap;
boost::tie(found, cap) = textclasslist
.NumberOfLayout(params.textclass, "Caption");
-#endif
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 =
textclasslist.Style(params.textclass,
par->GetLayout()).labeltype;
textclasslist.TextClass(params.textclass).maxcounter());
item.push_back(TocItem(par, depth, par->String(this, true)));
}
-#ifdef NEW_INSETS
// For each paragrph, traverse its insets and look for
// FLOAT_CODE
lyxerr << "caption not found" << endl;
}
-#endif
-#ifndef NEW_INSETS
- }
- par = par->next_;
-#else
par = par->next();
-#endif
}
return l;
}
if (par->bibkey)
keys.push_back(pair<string, string>(par->bibkey->getContents(),
par->String(this, false)));
-#ifndef NEW_INSETS
- par = par->next_;
-#else
par = par->next();
-#endif
}
// Might be either using bibtex or a child has bibliography
{
/// then remove all LyXText in text-insets
LyXParagraph * par = paragraph;
-#ifndef NEW_INSETS
- for (; par; par = par->next_) {
- par->resizeInsetsLyXText(bv);
- }
-#else
for (; par; par = par->next()) {
par->resizeInsetsLyXText(bv);
}
-#endif
}
LyXParagraph * par = paragraph;
while (par) {
par->ChangeLanguage(params, from, to);
-#ifndef NEW_INSETS
- par = par->next_;
-#else
par = par->next();
-#endif
}
}
while (par) {
if (par->isMultiLingual(params))
return true;
-#ifndef NEW_INSETS
- par = par->next_;
-#else
par = par->next();
-#endif
}
return false;
}
{
it = par->InsetIterator(pos);
if (it == par->inset_iterator_end()) {
-#ifndef NEW_INSETS
- par = par->next_;
-#else
par = par->next();
-#endif
SetParagraph();
}
}
it = par->inset_iterator_begin();
if (it != par->inset_iterator_end())
return;
-#ifndef NEW_INSETS
- par = par->next_;
-#else
par = par->next();
-#endif
}
//it = 0;
// We maintain an invariant that whenever par = 0 then it = 0
bool parseSingleLyXformat2Token(LyXLex &, LyXParagraph *& par,
LyXParagraph *& return_par,
string const & token, int & pos,
- char & depth, LyXFont &
-#ifndef NEW_INSETS
- ,LyXParagraph::footnote_flag &,
- LyXParagraph::footnote_kind &
-#endif
- );
+ char & depth, LyXFont &);
private:
/// Parse a single inset.
void readInset(LyXLex &, LyXParagraph *& par, int & pos, LyXFont &);
/// Used when typesetting to place errorboxes.
TexRow texrow;
private:
-#ifndef NEW_INSETS
- ///
- void linuxDocHandleFootnote(std::ostream & os,
- LyXParagraph * & par, int depth);
-#endif
///
void DocBookHandleCaption(std::ostream & os, string & inner_tag,
int depth, int desc_on,
LyXParagraph * & par);
-#ifndef NEW_INSETS
- ///
- void DocBookHandleFootnote(std::ostream & os,
- LyXParagraph * & par, int depth);
-#endif
/// Open SGML/XML tag.
void sgmlOpenTag(std::ostream & os, int depth,
string const & latexname) const;
if (par) {
++it;
if (it == par->inset_iterator_end()) {
-#ifndef NEW_INSETS
- par = par->next_;
-#else
par = par->next();
-#endif
SetParagraph();
}
}
if (par) {
++it;
if (it == par->inset_iterator_end()) {
-#ifndef NEW_INSETS
- par = par->next_;
-#else
par = par->next();
-#endif
SetParagraph();
}
}
#include "language.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)
{
}
-#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)
{
LyXFont font(LyXFont::ALL_IGNORE);
}
-#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)
{
LyXFont font(LyXFont::ALL_IGNORE);
class LyXFont;
class LyXText;
-#ifndef NEW_INSETS
-///
-extern void Foot(BufferView *);
-#endif
///
extern void Emph(BufferView *);
///
extern void Bold(BufferView *);
///
extern void Noun(BufferView *);
-#ifndef NEW_INSETS
-///
-extern void Margin(BufferView *);
-#endif
///
extern void Figure();
///
extern void Lang(BufferView *, string const &);
///
extern void Number(BufferView *);
-#ifndef NEW_INSETS
-///
-extern void Melt(BufferView *);
-#endif
///
extern void Tex(BufferView *);
///
current_view->text->BreakParagraph(current_view);
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()) {
-#endif
current_view->text->CursorLeft(current_view);
current_view->text->BreakParagraph(current_view);
// The standard layout should always be numer 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->
SetParagraph(current_view, 0, 0,
0, 0,
buffer->params.spacing.getValue(),
LyXLength::CM),
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);
+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>
* Dialogs.C: included insetgraphicsParams.h
#include "buffer.h"
#include "lyxtext.h"
#include "xforms_helpers.h"
-#if 1
-#include "lyxparagraph.h"
-#endif
using Liason::setMinibuffer;
using SigC::slot;
+
FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
: FormBaseBD(lv, d, _("Paragraph Layout"))
{
bc_.addReadOnly (general_->check_noindent);
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
fl_addto_tabfolder(dialog_->tabbed_folder,_("General"), general_->form);
-#ifndef NO_PEXTRA
- fl_addto_tabfolder(dialog_->tabbed_folder,_("Extra"), extra_->form);
-#endif
}
return;
general_apply();
-#ifndef NO_PEXTRA
- extra_apply();
-#endif
lv_->view()->update(lv_->view()->text,
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
return;
general_update();
-#ifndef NO_PEXTRA
- extra_update();
-#endif
+
bc_.readOnly(lv_->buffer()->isReadonly());
}
}
-#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()
{
if (!general_.get())
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,
text->cursor.par()->params.lineTop());
fl_set_button(general_->check_lines_bottom,
text->cursor.par()->params.pagebreakBottom());
fl_set_button(general_->check_noindent,
text->cursor.par()->params.noindent());
-#endif
+
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()) {
-#endif
-
case VSpace::NONE:
fl_set_choice (general_->choice_space_above, 1);
break;
break;
case VSpace::LENGTH:
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()->
params.spaceTop().length().asString().c_str());
-#endif
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,
text->cursor.par()->params.spaceTop().keep());
fl_set_input (general_->input_space_below, "");
+
switch (text->cursor.par()->params.spaceBottom().kind()) {
-#endif
case VSpace::NONE:
fl_set_choice (general_->choice_space_below, 1);
break;
break;
case VSpace::LENGTH:
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()->
params.spaceBottom().length().asString().c_str());
break;
text->cursor.par()->params.spaceBottom().keep());
fl_set_button(general_->check_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)
if (fl_get_choice (general_->choice_space_below) != 7)
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
//
}
}
-#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;
}
#endif
#include "FormBaseDeprecated.h"
-#if 1
-#include "lyxparagraph.h"
-#endif
struct FD_form_tabbed_paragraph;
struct FD_form_paragraph_general;
///
void general_update();
-#ifndef NO_PEXTRA
- ///
- void extra_update();
-#endif
///
void general_apply();
-#ifndef NO_PEXTRA
- ///
- void extra_apply();
-#endif
+
/// Fdesign generated methods
FD_form_tabbed_paragraph * build_tabbed_paragraph();
///
FD_form_paragraph_general * build_paragraph_general();
-//#ifndef NO_PEXTRA
///
FD_form_paragraph_extra * build_paragraph_extra();
-//#endif
/// Real GUI implementation.
boost::scoped_ptr<FD_form_tabbed_paragraph> dialog_;
///
boost::scoped_ptr<FD_form_paragraph_general> general_;
-#ifndef NO_PEXTRA
- ///
- boost::scoped_ptr<FD_form_paragraph_extra> extra_;
-#endif
/// The ButtonController
ButtonController<NoRepeatedApplyReadOnlyPolicy, xformsBC> bc_;
};
+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>
* insettoc.C: hack to make listof algorithm work
int const wx = par->bibkey->width(bv, font);
if (wx > w) w = wx;
}
-#ifndef NEW_INSETS
- par = par->next_;
-#else
par = par->next();
-#endif
}
return w;
}
bkey = par->bibkey;
}
}
-#ifndef NEW_INSETS
- par = par->next_;
-#else
par = par->next();
-#endif
}
if (bkey && !bkey->getBibLabel().empty())
#include "insettext.h"
#include "lyxfont.h"
#include "LColor.h"
-#if 1 // NEW_INSETS
-#include "lyxparagraph.h"
-#endif
class Painter;
class LyXText;
LColor::color framecolor;
///
LyXFont labelfont;
-#ifdef NEW_INSETS
public:
-#endif
///
InsetText inset;
protected:
if (!copySelection(bv))
break;
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()->next()
-#endif
- );
+ bv->text->cursor.par()->next());
cutSelection();
UpdateLocal(bv, INIT, true);
break;
case LFUN_PASTE:
if (hasPasteBuffer()) {
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()->next()
-#endif
- );
+ bv->text->cursor.par()->next());
pasteSelection(bv);
UpdateLocal(bv, INIT, true);
break;
sel_row_start = sel_row_end = tabular->row_of_cell(actcell);
}
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()->next()
-#endif
- );
+ bv->text->cursor.par()->next());
int row = tabular->row_of_cell(actcell);
int column = tabular->column_of_cell(actcell);
delete (*cit).second;
(*cit).second = 0;
}
-#ifndef NEW_INSETS
- LyXParagraph * p = par->next_;
- delete par;
- while(p) {
- par = p;
- p = p->next_;
- delete par;
- }
-#else
+
while (par) {
LyXParagraph * tmp = par->next();
delete par;
par = tmp;
}
-#endif
}
delete (*cit).second;
(*cit).second = 0;
}
-#ifndef NEW_INSETS
- LyXParagraph * p = par->next_;
- delete par;
- while(p) {
- par = p;
- p = p->next_;
- delete par;
- }
-#else
+
while (par) {
LyXParagraph * tmp = par->next();
delete par;
par = tmp;
}
-#endif
par = new LyXParagraph;
}
int pos = 0;
LyXParagraph * return_par = 0;
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);
// delete all instances of LyXText before deleting the paragraps used
(*cit).second = 0;
}
-#ifndef NEW_INSETS
- LyXParagraph * p = par->next_;
- delete par;
- while(p) {
- par = p;
- p = p->next_;
- delete par;
- }
-#else
while (par) {
LyXParagraph * tmp = par->next();
delete par;
par = tmp;
}
-#endif
+
par = new LyXParagraph;
while (lex.IsOK()) {
lex.nextToken();
break;
if (const_cast<Buffer*>(buf)->
parseSingleLyXformat2Token(lex, par, return_par,
- token, pos, depth, font
-#ifndef NEW_INSETS
- , footnoteflag, footnotekind
-#endif
- ))
- {
+ token, pos, depth, font)) {
// the_end read this should NEVER happen
lex.printError("\\the_end read in inset! Error in document!");
return;
par = return_par;
while(return_par) {
return_par->SetInsetOwner(this);
-#ifndef NEW_INSETS
- return_par = return_par->next_;
-#else
return_par = return_par->next();
-#endif
}
if (token != "\\end_inset") {
// If the inset is empty set the language of the current font to the
// language to the surronding text.
-#ifndef NEW_INSETS
- if (par->Last() == 0 && !par->next_)
-#else
- if (par->size() == 0 && !par->next())
-#endif
- {
+ if (par->size() == 0 && !par->next()) {
LyXFont font(LyXFont::ALL_IGNORE);
font.setLanguage(bv->getParentLanguage(this));
SetFont(bv, font, false);
* true (on). */
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()->next()
-#endif
- );
+ bv->text->cursor.par()->next());
bv->setState();
if (lyxrc.auto_region_delete) {
if (TEXT(bv)->selection){
break;
case LFUN_BACKSPACE:
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()->next()
-#endif
- );
+ bv->text->cursor.par()->next());
if (TEXT(bv)->selection)
TEXT(bv)->CutSelection(bv);
else
break;
case LFUN_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()->next()
-#endif
- );
+ bv->text->cursor.par()->next());
if (TEXT(bv)->selection)
TEXT(bv)->CutSelection(bv);
else
break;
case LFUN_CUT:
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()->next()
-#endif
- );
+ bv->text->cursor.par()->next());
TEXT(bv)->CutSelection(bv);
UpdateLocal(bv, CURSOR_PAR, true);
break;
}
}
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()->next()
-#endif
- );
+ bv->text->cursor.par()->next());
TEXT(bv)->PasteSelection(bv);
UpdateLocal(bv, CURSOR_PAR, true);
break;
if (!autoBreakRows)
return DISPATCHED;
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()->next()
-#endif
- );
+ bv->text->cursor.par()->next());
TEXT(bv)->InsertChar(bv, LyXParagraph::META_NEWLINE);
UpdateLocal(bv, CURSOR_PAR, true);
break;
/// If the action has deleted all text in the inset, we need to change the
// language to the language to the surronding text.
-#ifndef NEW_INSETS
- if (par->Last() == 0 && !par->next_)
-#else
- if (par->size() == 0 && !par->next())
-#endif
- {
+ if (par->size() == 0 && !par->next()) {
LyXFont font(LyXFont::ALL_IGNORE);
font.setLanguage(bv->getParentLanguage(this));
SetFont(bv, font, false);
tmp = buf->asciiParagraph(p, linelen);
lines += countChar(tmp, '\n');
os << tmp;
-#ifndef NEW_INSETS
- p = p->next();
-#else
p = p->next();
-#endif
}
return lines;
}
string tmp;
while (p) {
buf->SimpleDocBookOnePar(os,tmp,p,desc,0);
-#ifndef NEW_INSETS
- p = p->next_;
-#else
p = p->next();
-#endif
}
return lines;
LyXParagraph * p = par;
while(p) {
p->validate(features);
-#ifndef NEW_INSETS
- p = p->next_;
-#else
p = p->next();
-#endif
}
}
InsetText::moveRightIntern(BufferView * bv, bool behind,
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()))
-#endif
return FINISHED;
if (activate_inset && checkAndActivateInset(bv, behind))
return DISPATCHED;
InsetText::moveLeftIntern(BufferView * bv, bool behind,
bool activate_inset, bool selecting)
{
-#ifndef NEW_INSETS
- if (!cpar(bv)->previous_ && (cpos(bv) <= 0))
-#else
if (!cpar(bv)->previous() && (cpos(bv) <= 0))
-#endif
return FINISHED;
TEXT(bv)->CursorLeft(bv);
if (!selecting)
return false;
}
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()->next()
-#endif
- );
+ bv->text->cursor.par()->next());
inset->setOwner(this);
HideInsetCursor(bv);
TEXT(bv)->InsertInset(bv, inset);
{
if (TEXT(bv)->selection) {
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()->next()
-#endif
- );
+ bv->text->cursor.par()->next());
}
TEXT(bv)->SetFont(bv, font, toggleall);
bv->fitCursor(TEXT(bv));
(*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) {
LyXParagraph * tmp = par->next();
delete par;
np = np->next();
np->SetInsetOwner(this);
}
-#endif
+
need_update = INIT;
}
if (recursive) {
/// then remove all LyXText in text-insets
LyXParagraph * p = par;
-#ifndef NEW_INSETS
- for (; p; p = p->next_) {
- p->deleteInsetsLyXText(bv);
- }
-#else
for (; p; p = p->next()) {
p->deleteInsetsLyXText(bv);
}
-#endif
}
}
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!
-#endif
return;
if ((cache.find(bv) == cache.end()) || !cache[bv])
return;
/// then resize all LyXText in text-insets
inset_x = cx(bv) - top_x + drawTextXOffset;
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()) {
p->resizeInsetsLyXText(bv);
}
-#endif
}
need_update = FULL;
}
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 (int i = 0; i < p->size(); ++i) {
-#endif
if (p->GetChar(i) == LyXParagraph::META_NEWLINE)
p->Erase(i);
}
string label(arg);
ProhibitInput(bv);
if (label.empty()) {
-#ifndef NEW_INSETS
- LyXParagraph * par =
- bv->text->cursor.par()->FirstPhysicalPar();
-#else
LyXParagraph * par = bv->text->cursor.par();
-#endif
LyXLayout const * layout =
&textclasslist.Style(bv->buffer()->params.textclass,
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()) {
LyXParagraph * par2 = par->previous();
-#endif
LyXLayout const * layout2 =
&textclasslist.Style(bv->buffer()->params.textclass,
par2->GetLayout());
string text = layout->latexname().substr(0, 3);
if (layout->latexname() == "theorem")
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 += ":";
if (layout->latextype == LATEX_PARAGRAPH ||
lyxrc.label_init_length < 0)
string::size_type size = str.length();
LyXParagraph::size_type i = 0;
-#ifndef NEW_INSETS
- while (((pos + i) < par->Last())
-#else
while (((pos + i) < par->size())
-#endif
&& (string::size_type(i) < size)
&& (cs ? (str[i] == par->GetChar(pos + i))
: (toupper(str[i]) == toupper(par->GetChar(pos + i)))))
// if necessary, check whether string matches word
if (!mw ||
(mw && ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos - 1)))
-#ifndef NEW_INSETS
- && (pos + size >= par->Last()
-#else
&& (pos + size >= par->size()
-#endif
|| !IsLetterCharOrDigit(par->GetChar(pos + size))))
)
)
LyXParagraph::size_type pos = bv->text->cursor.pos();
while (par && !IsStringInText(par, pos, str, cs, mw)) {
-#ifndef NEW_INSETS
- if (pos < par->Last() - 1)
-#else
if (pos < par->size() - 1)
-#endif
++pos;
else {
pos = 0;
do {
par = par->previous();
if (par)
-#ifndef NEW_INSETS
- pos = par->Last() - 1;
-#else
pos = par->size() - 1;
-#endif
} while (par && pos < 0);
}
} while (par && !IsStringInText(par, pos, str, cs, mw));
}
break;
-#ifndef NEW_INSETS
- case LFUN_OPENSTUFF:
- owner->view()->openStuff();
- break;
-#endif
-
case LFUN_HYPHENATION:
owner->view()->hyphenationPoint();
break;
owner->view()->setState();
owner->showState();
break;
-#ifndef NEW_INSETS
- case LFUN_MELT:
- Melt(owner->view());
- break;
-#endif
+
case LFUN_RECONFIGURE:
Reconfigure(owner->view());
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 (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
+#if 0
case LFUN_FLOATSOPERATE:
if (argument == "openfoot")
owner->view()->allFloats(1,0);
}
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:
lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar;
break;
#include "support/lyxalgo.h"
#include "support/filetools.h"
#include "debug.h"
-#if 1 // to get NEW_INSETS
-#include "lyxparagraph.h"
-#endif
using std::sort;
using std::ostream;
bool LyXLex::Pimpl::next(bool esc /* = false */)
{
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
// we extract the first word and leaves the rest
// in pushTok. (Lgb)
pushTok.erase();
return true;
}
-#endif
}
if (!esc) {
unsigned char c = 0; // getc() returns an int
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;
unsigned char c = '\0';
char cc = 0;
bool LyXLex::Pimpl::nextToken()
{
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
// we extract the first word and leaves the rest
// in pushTok. (Lgb)
pushTok.erase();
return true;
}
-#endif
}
status = 0;
Returns true if something was broken. */
bool FullRebreak(BufferView *);
-#ifndef NEW_INSETS
- ///
- LyXParagraph::footnote_flag GetFootnoteFlag(int row);
-#endif
///
Row * need_break_row;
///
void GetVisibleRow(BufferView *, int y_offset, int x_offset,
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);
///
LyXAlignment align,
string labelwidthstring,
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 */
/** sets the selection over the number of characters of string,
int newvalue;
FL_OBJECT * obj;
-#ifndef NEW_INSETS
- // Open all floats
- bv->allFloats(1, 0);
- bv->allFloats(1, 1);
-#endif
-
#ifdef USE_PSPELL
string tmp = (lyxrc.isp_use_alt_lang) ?
lyxrc.isp_alt_lang : bv->buffer()->params.language->code();
+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>
* fmt.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
bool IsLineSeparatorChar(char c) {
return !( IsSeparatorChar( c )
|| IsKommaChar( c )
|| IsHfillChar( c )
-#ifndef NEW_INSETS
- || IsFloatChar( c )
-#endif
|| IsInsetChar( c ));
}
LyXParagraph * par = new LyXParagraph;
LyXParagraph * return_par = 0;
-#ifndef NEW_INSETS
- LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE;
- LyXParagraph::footnote_kind footnotekind = LyXParagraph::FOOTNOTE;
-#endif
+
string tmptok;
int pos = 0;
char depth = 0;
if (owner_->BufferOwner()->parseSingleLyXformat2Token(lex, par,
return_par,
token, pos,
- depth, font
-#ifndef NEW_INSETS
- ,
- footnoteflag,
- footnotekind
-#endif
- ))
- {
+ depth, font)) {
// the_end read
lex.pushToken(token);
break;
InsetText * inset = GetCellInset(cell);
int row;
-#ifndef NEW_INSETS
- for (int i = 0; i < par->Last(); ++i)
-#else
- for (int i = 0; i < par->size(); ++i)
-#endif
- {
+ for (int i = 0; i < par->size(); ++i) {
if (par->IsNewline(i)) {
++cell;
if (cell > GetNumberOfCells()) {
}
}
par->CopyIntoMinibuffer(*owner_->BufferOwner(), i);
-#ifndef NEW_INSETS
- inset->par->InsertFromMinibuffer(inset->par->Last());
-#else
inset->par->InsertFromMinibuffer(inset->par->size());
-#endif
}
delete par;
Reinit();
InsetText * inset = GetCellInset(cell);
bool rtl = inset->par->isRightToLeftPar(buf->params) &&
-#ifndef NEW_INSETS
- inset->par->Last() > 0 && GetPWidth(cell).empty();
-#else
- inset->par->size() > 0 && GetPWidth(cell).empty();
-#endif
+ inset->par->size() > 0 && GetPWidth(cell).empty();
+
if (rtl)
os << "\\R{";
ret += inset->Latex(buf, os, fragile, fp);
}
-#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
{
LyXParagraph * par = GetCellInset(cell)->par;
}
return BOX_NONE;
}
-#endif
+
/* Emacs:
* Local variables:
* tab-width: 4
unsigned char const prev_char = pos > 0 ? par->GetChar(pos-1) : ' ';
unsigned char next_char = ' ';
-#ifndef NEW_INSETS
- for (LyXParagraph::size_type i = pos+1; i < par->Last(); ++i)
-#else
+
for (LyXParagraph::size_type i = pos+1; i < par->size(); ++i)
-#endif
if (!Encodings::IsComposeChar_arabic(par->GetChar(i))) {
next_char = par->GetChar(i);
break;
} else if (IsHfillChar(c)) {
return 3; /* Because of the representation
* as vertical lines */
-#ifndef NEW_INSETS
- } else 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) {
- string fs;
- switch (c) {
- case LyXParagraph::META_MARGIN:
- fs = "margin";
- break;
- case LyXParagraph::META_FIG:
- fs = "fig";
- break;
- case LyXParagraph::META_TAB:
- fs = "tab";
- break;
- case LyXParagraph::META_ALGORITHM:
- fs = "alg";
- break;
- case LyXParagraph::META_WIDE_FIG:
- fs = "wide-fig";
- break;
- case LyXParagraph::META_WIDE_TAB:
- fs = "wide-tab";
- break;
- case LyXParagraph::META_FOOTNOTE:
- fs = "foot";
- break;
- }
- font.decSize();
- font.decSize();
- return lyxfont::width(fs, font);
-#endif
} else if (c == LyXParagraph::META_INSET) {
Inset * tmpinset = par->GetInset(pos);
if (tmpinset) {
// Returns the paragraph position of the last character in the specified row
LyXParagraph::size_type LyXText::RowLast(Row const * row) const
{
-#ifndef NEW_INSETS
- if (row->next() == 0)
- return row->par()->Last() - 1;
- else if (row->next()->par() != row->par())
- return row->par()->Last() - 1;
- else
- return row->next()->pos() - 1;
-#else
if (row->next() == 0)
return row->par()->size() - 1;
else if (row->next()->par() != row->par())
return row->par()->size() - 1;
else
return row->next()->pos() - 1;
-#endif
}
LyXFont font = GetFont(bview->buffer(), row->par(), pos);
LyXFont font2 = font;
-#ifndef NEW_INSETS
- 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) {
- string fs;
- switch (c) {
- case LyXParagraph::META_MARGIN:
- fs = "margin";
- break;
- case LyXParagraph::META_FIG:
- fs = "fig";
- break;
- case LyXParagraph::META_TAB:
- fs = "tab";
- break;
- case LyXParagraph::META_ALGORITHM:
- fs = "alg";
- break;
- case LyXParagraph::META_WIDE_FIG:
- fs = "wide-fig";
- break;
- case LyXParagraph::META_WIDE_TAB:
- fs = "wide-tab";
- break;
- case LyXParagraph::META_FOOTNOTE:
- fs = "foot";
- break;
- }
- font.decSize();
- font.decSize();
-
- // calculate the position of the footnotemark
- int const y = (row->baseline() - lyxfont::maxAscent(font2)
- + lyxfont::maxAscent(font));
-
- font.setColor(LColor::footnote);
- // draw it and set new x position
-
- pain.text(int(x), offset + y, fs, font);
- x += lyxfont::width(fs, font);
- pain.line(int(tmpx), offset + row->baseline(),
- int(x), offset + row->baseline(),
- LColor::footnote);
-
- ++vpos;
- return;
- } else
-#endif
- if (c == LyXParagraph::META_INSET) {
+ if (c == LyXParagraph::META_INSET) {
Inset * tmpinset = row->par()->GetInset(pos);
if (tmpinset) {
// tmpinset->update(bview, font, false);
textclasslist
.TextClass(bview->buffer()->params.textclass)
.defaultfont());
-#ifndef NEW_INSETS
- if (row->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
- LyXFont font(LyXFont::ALL_SANE);
- font.setSize(LyXFont::SIZE_SMALL);
- x += lyxfont::width("Mwide-figM", font)
- + LYX_PAPER_MARGIN/2;
- }
-#endif
+
// this is the way, LyX handles the LaTeX-Environments.
// I have had this idea very late, so it seems to be a
// later added hack and this is true
if (!row->par()->GetDepth()) {
if (!row->par()->GetLayout()) {
// find the previous same level paragraph
-#ifndef NEW_INSETS
- if (row->par()->FirstPhysicalPar()->previous()) {
-#else
if (row->par()->previous()) {
-#endif
LyXParagraph * newpar = row->par()
->DepthHook(row->par()->GetDepth());
if (newpar &&
// check wether it is a sufficent paragraph
if (newpar
-#ifndef NEW_INSETS
- && newpar->footnoteflag == row->par()->footnoteflag
-#endif
&& textclasslist
.Style(bview->buffer()->params.textclass,
newpar->GetLayout()).isEnvironment()) {
Row dummyrow;
dummyrow.par(newpar);
-#ifndef NEW_INSETS
- dummyrow.pos(newpar->Last());
-#else
dummyrow.pos(newpar->size());
-#endif
x = LeftMargin(bview, &dummyrow);
} else {
// this is no longer an error, because this function
// is used to clear impossible depths after changing
// a layout. Since there is always a redo,
// LeftMargin() is always called
-#ifndef NEW_INSETS
- row->par()->FirstPhysicalPar()->params.depth(0);
-#else
row->par()->params.depth(0);
-#endif
}
if (newpar && !row->par()->GetLayout()) {
-#ifndef NEW_INSETS
- if (newpar->FirstPhysicalPar()->params.noindent())
-#else
if (newpar->params.noindent())
-#endif
parindent.erase();
else
parindent = textclasslist
}
break;
}
-#ifndef NO_PEXTRA
- if ((workWidth(bview) > 0) &&
- (row->par()->params.pextraType() == LyXParagraph::PEXTRA_INDENT)) {
- if (!row->par()->params.pextraWidthp().empty()) {
- x += workWidth(bview) *
- lyx::atoi(row->par()->params.pextraWidthp()) / 100;
- } else if (!row->par()->params.pextraWidth().empty()) {
- int xx = VSpace(row->par()->params.pextraWidth()).inPixels(bview);
- if (xx > workWidth(bview))
- xx = workWidth(bview) * 80 / 100;
- x += xx;
- } else { // should not happen
- LyXFont font(LyXFont::ALL_SANE);
- x += lyxfont::width("XXXXXX", font);
- }
- }
-#endif
int align; // wrong type
-#ifndef NEW_INSETS
- if (row->par()->FirstPhysicalPar()->params.align() == LYX_ALIGN_LAYOUT)
- align = layout.align;
- else
- align = row->par()->FirstPhysicalPar()->params.align();
-#else
+
if (row->par()->params.align() == LYX_ALIGN_LAYOUT)
align = layout.align;
else
align = row->par()->params.align();
-#endif
+
// set the correct parindent
if (row->pos() == 0) {
if ((layout.labeltype == LABEL_NO_LABEL
|| (layout.labeltype == LABEL_STATIC
&& layout.latextype == LATEX_ENVIRONMENT
&& ! row->par()->IsFirstInSequence()))
-#ifndef NEW_INSETS
- && row->par() == row->par()->FirstPhysicalPar()
-#endif
&& align == LYX_ALIGN_BLOCK
&& !row->par()->params.noindent()
&& (row->par()->layout ||
.TextClass(buf->params.textclass)
.defaultfont());
-#ifndef NEW_INSETS
- if (row->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
- x += LYX_PAPER_MARGIN / 2;
- }
-#endif
// this is the way, LyX handles the LaTeX-Environments.
// I have had this idea very late, so it seems to be a
// later added hack and this is true
LyXParagraph * newpar = row->par();
-#ifndef NEW_INSETS
- do {
- newpar = newpar->FirstPhysicalPar()->previous();
- if (newpar)
- newpar = newpar->FirstPhysicalPar();
- } while (newpar && newpar->GetDepth() >= row->par()->GetDepth()
- && newpar->footnoteflag == row->par()->footnoteflag);
-#else
do {
newpar = newpar->previous();
} while (newpar
&& newpar->GetDepth() >= row->par()->GetDepth());
-#endif
// make a corresponding row. Needed to call LeftMargin()
// check wether it is a sufficent paragraph
if (newpar
-#ifndef NEW_INSETS
- && newpar->footnoteflag == row->par()->footnoteflag
-#endif
&& textclasslist.Style(buf->params.textclass,
newpar->GetLayout())
.isEnvironment()) {
// is used to clear impossible depths after changing
// a layout. Since there is always a redo,
// LeftMargin() is always called
-#ifndef NEW_INSETS
- row->par()->FirstPhysicalPar()->params.depth(0);
-#else
row->par()->params.depth(0);
-#endif
}
}
== MARGIN_MANUAL) {
Row tmprow;
tmprow = *row;
-#ifndef NEW_INSETS
- tmprow.pos(row->par()->Last());
-#else
tmprow.pos(row->par()->size());
-#endif
return LeftMargin(bview, &tmprow); /* just the beginning
of the main body */
} else
LyXParagraph * par = row->par();
if (width < 0)
-#ifndef NEW_INSETS
- return par->Last();
-#else
return par->size();
-#endif
LyXParagraph::size_type const pos = row->pos();
if (layout.margintype == MARGIN_RIGHT_ADDRESS_BOX) {
/* special code for right address boxes, only newlines count */
-#ifndef NEW_INSETS
- while (i < par->Last()) {
-#else
while (i < par->size()) {
-#endif
if (par->IsNewline(i)) {
last_separator = i;
-#ifndef NEW_INSETS
- i = par->Last() - 1; // this means break
-#else
i = par->size() - 1; // this means break
-#endif
//x = width;
} else if (par->GetChar(i) == LyXParagraph::META_INSET &&
par->GetInset(i) && par->GetInset(i)->display()){
}
} else {
// Last position is an invariant
-#ifndef NEW_INSETS
- LyXParagraph::size_type const last =
- par->Last();
-#else
LyXParagraph::size_type const last =
par->size();
-#endif
// this is the usual handling
int x = LeftMargin(bview, row);
bool doitonetime = true;
/* Correction: only the fontsize count. The other properties
are taken from the layoutfont. Nicer on the screen :) */
-#ifndef NEW_INSETS
- LyXParagraph * par = row_ptr->par()->LastPhysicalPar();
- LyXParagraph * firstpar = row_ptr->par()->FirstPhysicalPar();
-#else
LyXParagraph * par = row_ptr->par();
LyXParagraph * firstpar = row_ptr->par();
-#endif
LyXLayout const & layout = textclasslist.Style(bview->buffer()->params.textclass,
firstpar->GetLayout());
-#ifndef NEW_INSETS
- LyXFont font = GetFont(bview->buffer(), par, par->Last() - 1);
-#else
LyXFont font = GetFont(bview->buffer(), par, par->size() - 1);
-#endif
LyXFont::FONT_SIZE const size = font.size();
font = GetFont(bview->buffer(), par, -1);
font.setSize(size);
}
// the paper margins
-#ifndef NEW_INSETS
- if (!row_ptr->par()->previous_ && bv_owner)
- maxasc += LYX_PAPER_MARGIN;
-#else
if (!row_ptr->par()->previous() && bv_owner)
maxasc += LYX_PAPER_MARGIN;
-#endif
// add the vertical spaces, that the user added
if (firstpar->params.spaceTop().kind() != VSpace::NONE)
}
// is it a bottom line?
- if (
-#ifndef NEW_INSETS
- row_ptr->par()->ParFromPos(RowLast(row_ptr) + 1) == par
-#else
- row_ptr->par() == par
-#endif
+ if (row_ptr->par() == par
&& (!row_ptr->next() || row_ptr->next()->par() != row_ptr->par())) {
// the paper margins
-#ifndef NEW_INSETS
- if (!par->next_ && bv_owner)
- maxdesc += LYX_PAPER_MARGIN;
-#else
if (!par->next() && bv_owner)
maxdesc += LYX_PAPER_MARGIN;
-#endif
// add the vertical spaces, that the user added
if (firstpar->params.spaceBottom().kind() != VSpace::NONE)
// do not forget the DTP-lines!
// there height depends on the font of the nearest character
-#ifndef NEW_INSETS
- if (firstpar->params.lineBottom())
- maxdesc += 2 * lyxfont::ascent('x', GetFont(bview->buffer(),
- par, par->Last() - 1));
-#else
if (firstpar->params.lineBottom())
maxdesc += 2 * lyxfont::ascent('x',
GetFont(bview->buffer(),
par, par->size() - 1));
-#endif
// and now the pagebreaks
if (firstpar->params.pagebreakBottom())
// The last character position of a paragraph is an invariant so we can
// safely get it here. (Asger)
-#ifndef NEW_INSETS
- int const lastposition = row->par()->Last();
-#else
int const lastposition = row->par()->size();
-#endif
do {
// Get the next breakpoint
int z = NextBreakPoint(bview, row, workWidth(bview));
LyXParagraph::size_type z = NextBreakPoint(bview, row, workWidth(bview));
Row * tmprow = row;
-#ifndef NEW_INSETS
- if (z < row->par()->Last()) {
-#else
if (z < row->par()->size()) {
-#endif
if (!row->next() || (row->next() && row->next()->par() != row->par())) {
// insert a new row
++z;
LyXParagraph::size_type z = NextBreakPoint(bview, row, workWidth(bview));
Row * tmprow = row;
-#ifndef NEW_INSETS
- if (z < row->par()->Last()) {
-#else
if (z < row->par()->size()) {
-#endif
if (!row->next()
|| (row->next() && row->next()->par() != row->par())) {
/* insert a new row */
cursor.par()->GetLayout());
// this is only allowed, if the current paragraph is not empty or caption
-#ifndef NEW_INSETS
- if ((cursor.par()->Last() <= 0
- && !cursor.par()->IsDummy())
- && layout.labeltype!= LABEL_SENSITIVE)
- return;
-
- SetUndo(bview->buffer(), Undo::INSERT,
- cursor.par()->ParFromPos(cursor.pos())->previous_,
- cursor.par()->ParFromPos(cursor.pos())->next_);
-#else
if ((cursor.par()->size() <= 0)
&& layout.labeltype!= LABEL_SENSITIVE)
return;
SetUndo(bview->buffer(), Undo::INSERT,
cursor.par()->previous(),
cursor.par()->next());
-#endif
// Always break behind a space
//
// It is better to erase the space (Dekel)
-#ifndef NEW_INSETS
- if (cursor.pos() < cursor.par()->Last()
-#else
if (cursor.pos() < cursor.par()->size()
-#endif
&& cursor.par()->IsLineSeparator(cursor.pos()))
cursor.par()->Erase(cursor.pos());
// cursor.pos(cursor.pos() + 1);
if (layout.labeltype == LABEL_SENSITIVE) {
if (!cursor.pos())
// set to standard-layout
-#ifndef NEW_INSETS
- cursor.par()->SetLayout(bview->buffer()->params, 0);
-#else
cursor.par()->SetLayout(0);
-#endif
else
// set to standard-layout
-#ifndef NEW_INSETS
- cursor.par()->next()->SetLayout(bview->buffer()->params, 0);
-#else
cursor.par()->next()->SetLayout(0);
-#endif
}
/* if the cursor is at the beginning of a row without prior newline,
SetHeightOfRow(bview, cursor.row());
-#ifndef NEW_INSETS
- while (cursor.par()->next()->Last()
-#else
while (cursor.par()->next()->size()
-#endif
&& cursor.par()->next()->IsNewline(0))
cursor.par()->next()->Erase(0);
}
-#ifndef NEW_INSETS
-void LyXText::OpenFootnote(BufferView * bview)
-{
- LyXParagraph * endpar,* tmppar;
- Row * row;
-
- LyXParagraph * par = cursor.par()->ParFromPos(cursor.pos());
-
- /* if there is no footnote in this paragraph, just return. */
- if (!par->next_
- || par->next_->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
- return;
-
- /* ok, move the cursor right before the footnote */
-
- /* just a little faster than using CursorRight() */
- for (cursor.pos(0);
- cursor.par()->ParFromPos(cursor.pos()) != par;) {
- cursor.pos(cursor.pos() + 1);
- }
-
- /* now the cursor is at the beginning of the physical par */
- SetCursor(bview, cursor.par(),
- cursor.pos() + cursor.par()->ParFromPos(cursor.pos())->size());
-
- /* the cursor must be exactly before the footnote */
- par = cursor.par()->ParFromPos(cursor.pos());
-
- status = LyXText::NEED_MORE_REFRESH;
- refresh_row = cursor.row();
- refresh_y = cursor.y() - cursor.row()->baseline();
-
- tmppar = cursor.par();
- endpar = cursor.par()->next();
- row = cursor.row();
-
- tmppar->OpenFootnote(cursor.pos());
- RemoveParagraph(row);
- /* set the dimensions of the cursor row */
- row->fill(Fill(bview, row, workWidth(bview)));
- SetHeightOfRow(bview, row);
- // CHECK See comment on top of text.C
- tmppar = tmppar->next();
-
- while (tmppar != endpar) {
- if (tmppar) {
- InsertParagraph(bview, tmppar, row);
- while (row->next() && row->next()->par() == tmppar)
- row = row->next();
- tmppar = tmppar->next();
- }
- }
- SetCursor(bview, par->next_, 0);
- sel_cursor = cursor;
-}
-#endif
-
-
// Just a macro to make some thing easier.
void LyXText::RedoParagraph(BufferView * bview) const
{
void LyXText::InsertChar(BufferView * bview, char c)
{
SetUndo(bview->buffer(), Undo::INSERT,
-#ifndef NEW_INSETS
- cursor.par()->ParFromPos(cursor.pos())->previous_,
- cursor.par()->ParFromPos(cursor.pos())->next_
-#else
cursor.par()->previous(),
- cursor.par()->next()
-#endif
- );
+ cursor.par()->next());
// When the free-spacing option is set for the current layout,
// disable the double-space checking
* current font */
// Get the font that is used to calculate the baselineskip
-#ifndef NEW_INSETS
- LyXParagraph::size_type const lastpos = cursor.par()->Last();
-#else
LyXParagraph::size_type const lastpos = cursor.par()->size();
-#endif
- LyXFont rawparfont = cursor.par()->GetFontSettings(bview->buffer()->params,
- lastpos - 1);
+ LyXFont rawparfont =
+ cursor.par()->GetFontSettings(bview->buffer()->params,
+ lastpos - 1);
bool jumped_over_space = false;
&& cursor.par()->IsLineSeparator(cursor.pos() - 1))
|| (cursor.pos() > 0
&& cursor.par()->IsNewline(cursor.pos() - 1))
- || (cursor.pos() == 0
-#ifndef NEW_INSETS
- && !(cursor.par()->previous()
- && cursor.par()->previous()->footnoteflag
- == LyXParagraph::OPEN_FOOTNOTE)
-#endif
- )) {
+ || (cursor.pos() == 0)) {
if (cursor.pos() == 0 )
bview->owner()->message(_("You cannot insert a space at the beginning of a paragraph. Please read the Tutorial."));
else
return;
}
} else if (IsNewlineChar(c)) {
-#ifndef NEW_INSETS
- if (cursor.par()->FirstPhysicalPar() == cursor.par()
-#else
if (cursor.par() == cursor.par()
-#endif
&& cursor.pos() <= BeginningOfMainBody(bview->buffer(), cursor.par())) {
charInserted();
return;
* of a paragraph or behind labels.
* TeX does not allow that. */
-#ifndef NEW_INSETS
- if (cursor.pos() < cursor.par()->Last() &&
-#else
if (cursor.pos() < cursor.par()->size() &&
-#endif
cursor.par()->IsLineSeparator(cursor.pos()))
// newline always after a blank!
CursorRight(bview);
need_break_row = 0;
// check, wether the last characters font has changed.
-#ifndef NEW_INSETS
- if (cursor.pos() && cursor.pos() == cursor.par()->Last()
-#else
if (cursor.pos() && cursor.pos() == cursor.par()->size()
-#endif
&& rawparfont != rawtmpfont)
RedoHeightOfParagraph(bview, cursor);
}
// check, wether the last characters font has changed.
-#ifndef NEW_INSETS
- if (cursor.pos() && cursor.pos() == cursor.par()->Last()
-#else
if (cursor.pos() && cursor.pos() == cursor.par()->size()
-#endif
&& rawparfont != rawtmpfont) {
RedoHeightOfParagraph(bview, cursor);
} else {
if (is_rtl) {
x = (workWidth(bview) > 0)
? RightMargin(bview->buffer(), row) : 0;
-#ifndef NEW_INSETS
- if (row->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
- LyXFont font(LyXFont::ALL_SANE);
- font.setSize(LyXFont::SIZE_SMALL);
- x += lyxfont::width("Mwide-figM", font);
- }
-#endif
} else
x = (workWidth(bview) > 0) ? LeftMargin(bview, row) : 0;
// is it block, flushleft or flushright?
// set x how you need it
int align;
-#ifndef NEW_INSETS
- if (row->par()->FirstPhysicalPar()->params.align() == LYX_ALIGN_LAYOUT)
- align = textclasslist.Style(bview->buffer()->params.textclass, row->par()->GetLayout()).align;
- else
- align = row->par()->FirstPhysicalPar()->params.align();
-#else
if (row->par()->params.align() == LYX_ALIGN_LAYOUT)
align = textclasslist.Style(bview->buffer()->params.textclass, row->par()->GetLayout()).align;
else
align = row->par()->params.align();
-#endif
// center displayed insets
Inset * inset;
LyXCursor tmpcursor = cursor;
// CHECK See comment on top of text.C
-#ifndef NEW_INSETS
- if (tmpcursor.pos() == tmpcursor.par()->Last()
-#else
if (tmpcursor.pos() == tmpcursor.par()->size()
-#endif
&& tmpcursor.par()->next()) {
tmpcursor.par(tmpcursor.par()->next());
tmpcursor.pos(0);
int steps = 0;
// Skip through initial nonword stuff.
-#ifndef NEW_INSETS
- while (tmpcursor.pos() < tmpcursor.par()->Last() &&
-#else
while (tmpcursor.pos() < tmpcursor.par()->size() &&
-#endif
- ! tmpcursor.par()->IsWord( tmpcursor.pos() ) )
- {
+ ! tmpcursor.par()->IsWord( tmpcursor.pos())) {
// printf("Current pos1 %d", tmpcursor.pos()) ;
tmpcursor.pos(tmpcursor.pos() + 1);
++steps;
}
// Advance through word.
-#ifndef NEW_INSETS
- while (tmpcursor.pos() < tmpcursor.par()->Last() &&
-#else
while (tmpcursor.pos() < tmpcursor.par()->size() &&
-#endif
- tmpcursor.par()->IsWord( tmpcursor.pos() ) )
- {
+ tmpcursor.par()->IsWord( tmpcursor.pos())) {
// printf("Current pos2 %d", tmpcursor.pos()) ;
tmpcursor.pos(tmpcursor.pos() + 1);
++steps;
void LyXText::CursorTab(BufferView * bview) const
{
LyXCursor tmpcursor = cursor;
-#ifndef NEW_INSETS
- while (tmpcursor.pos() < tmpcursor.par()->Last()
-#else
while (tmpcursor.pos() < tmpcursor.par()->size()
-#endif
&& !tmpcursor.par()->IsNewline(tmpcursor.pos()))
tmpcursor.pos(tmpcursor.pos() + 1);
-#ifndef NEW_INSETS
- if (tmpcursor.pos() == tmpcursor.par()->Last()){
-#else
if (tmpcursor.pos() == tmpcursor.par()->size()){
-#endif
if (tmpcursor.par()->next()) {
tmpcursor.par(tmpcursor.par()->next());
tmpcursor.pos(0);
&& (tmpcursor.par()->IsSeparator(tmpcursor.pos() - 1)
|| tmpcursor.par()->IsKomma(tmpcursor.pos() - 1))
&& !(tmpcursor.par()->IsHfill(tmpcursor.pos() - 1)
-#ifndef NEW_INSETS
- || tmpcursor.par()->IsFloat(tmpcursor.pos() - 1)
-#endif
|| tmpcursor.par()->IsInset(tmpcursor.pos() - 1)))
tmpcursor.pos(tmpcursor.pos() - 1);
if (tmpcursor.pos()
&& (tmpcursor.par()->IsInset(tmpcursor.pos() - 1)
-#ifndef NEW_INSETS
- || tmpcursor.par()->IsFloat(tmpcursor.pos() - 1)
-#endif
|| tmpcursor.par()->IsHfill(tmpcursor.pos() - 1))) {
tmpcursor.pos(tmpcursor.pos() - 1);
} else if (!tmpcursor.pos()) {
if (tmpcursor.par()->previous()){
tmpcursor.par(tmpcursor.par()->previous());
-#ifndef NEW_INSETS
- tmpcursor.pos(tmpcursor.par()->Last());
-#else
tmpcursor.pos(tmpcursor.par()->size());
-#endif
}
} else { // Here, tmpcursor != 0
while (tmpcursor.pos() > 0 &&
// set the sel cursor
sel_cursor = cursor;
-#ifndef NEW_INSETS
- while (cursor.pos() < cursor.par()->Last()
-#else
while (cursor.pos() < cursor.par()->size()
-#endif
&& !cursor.par()->IsSeparator(cursor.pos())
&& !cursor.par()->IsKomma(cursor.pos()) )
cursor.pos(cursor.pos() + 1);
bool LyXText::SelectWordWhenUnderCursor(BufferView * bview)
{
if (!selection &&
-#ifndef NEW_INSETS
- cursor.pos() > 0 && cursor.pos() < cursor.par()->Last()
-#else
cursor.pos() > 0 && cursor.pos() < cursor.par()->size()
-#endif
&& !cursor.par()->IsSeparator(cursor.pos())
&& !cursor.par()->IsKomma(cursor.pos())
&& !cursor.par()->IsSeparator(cursor.pos() -1)
// If this is not the very first word, skip rest of
// current word because we are probably in the middle
// of a word if there is text here.
-#ifndef NEW_INSETS
- if (cursor.pos() || cursor.par()->previous_) {
- while (cursor.pos() < cursor.par()->Last()
- && cursor.par()->IsLetter(cursor.pos()))
- cursor.pos(cursor.pos() + 1);
- }
-#else
if (cursor.pos() || cursor.par()->previous()) {
while (cursor.pos() < cursor.par()->size()
&& cursor.par()->IsLetter(cursor.pos()))
cursor.pos(cursor.pos() + 1);
}
-#endif
// Now, skip until we have real text (will jump paragraphs)
-#ifndef NEW_INSETS
- while ((cursor.par()->Last() > cursor.pos()
-#else
while ((cursor.par()->size() > cursor.pos()
-#endif
&& (!cursor.par()->IsLetter(cursor.pos())
|| cursor.par()->getFont(bview->buffer()->params, cursor.pos())
.latex() == LyXFont::ON))
-#ifndef NEW_INSETS
- || (cursor.par()->Last() == cursor.pos()
-#else
|| (cursor.par()->size() == cursor.pos()
-#endif
&& cursor.par()->next())){
-#ifndef NEW_INSETS
- if (cursor.pos() == cursor.par()->Last()) {
-#else
if (cursor.pos() == cursor.par()->size()) {
-#endif
cursor.par(cursor.par()->next());
cursor.pos(0);
} else
// and find the end of the word
// (optional hyphens are part of a word)
-#ifndef NEW_INSETS
- while (cursor.pos() < cursor.par()->Last()
-#else
while (cursor.pos() < cursor.par()->size()
-#endif
&& (cursor.par()->IsLetter(cursor.pos()))
|| (cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET
&& cursor.par()->GetInset(cursor.pos()) != 0
std::ostringstream latex;
// now find the end of the word
-#ifndef NEW_INSETS
- while (cursor.pos() < cursor.par()->Last()
-#else
while (cursor.pos() < cursor.par()->size()
-#endif
&& (cursor.par()->IsLetter(cursor.pos())
|| (cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET
&& cursor.par()->GetInset(cursor.pos()) != 0
/* -------> Delete from cursor up to the end of the current or next word. */
void LyXText::DeleteWordForward(BufferView * bview)
{
-#ifndef NEW_INSETS
- if (!cursor.par()->Last())
-#else
if (!cursor.par()->size())
-#endif
CursorRight(bview);
else {
LyXCursor tmpcursor = cursor;
/* -------> Delete from cursor to start of current or prior word. */
void LyXText::DeleteWordBackward(BufferView * bview)
{
-#ifndef NEW_INSETS
- if (!cursor.par()->Last())
-#else
if (!cursor.par()->size())
-#endif
CursorLeft(bview);
else {
LyXCursor tmpcursor = cursor;
/* -------> Kill to end of line. */
void LyXText::DeleteLineForward(BufferView * bview)
{
-#ifndef NEW_INSETS
- if (!cursor.par()->Last())
-#else
if (!cursor.par()->size())
-#endif
// Paragraph is empty, so we just go to the right
CursorRight(bview);
else {
// version did. (JMarc)
void LyXText::ChangeWordCase(BufferView * bview, LyXText::TextCase action)
{
-#ifndef NEW_INSETS
- LyXParagraph * tmppar = cursor.par()->ParFromPos(cursor.pos());
-
- SetUndo(bview->buffer(),Undo::FINISH,
- tmppar->previous_, tmppar->next_);
-
- LyXParagraph::size_type tmppos =
- cursor.par()->PositionInParFromPos(cursor.pos());
-#else
LyXParagraph * tmppar = cursor.par();
SetUndo(bview->buffer(),Undo::FINISH,
tmppar->previous(), tmppar->next());
LyXParagraph::size_type tmppos = cursor.pos();
-#endif
while (tmppos < tmppar->size()) {
unsigned char c = tmppar->GetChar(tmppos);
LyXCursor old_cursor = cursor;
int const old_cur_par_id = old_cursor.par()->id();
-#ifndef NEW_INSETS
- int const old_cur_par_prev_id = old_cursor.par()->previous_ ?
- old_cursor.par()->previous_->id() : 0;
-#else
int const old_cur_par_prev_id = old_cursor.par()->previous() ?
old_cursor.par()->previous()->id() : 0;
-#endif
// just move to the right
CursorRight(bview);
// and that can very well delete the par or par->previous in
// old_cursor. Will a solution where we compare paragraph id's
//work better?
- if (
-#ifndef NEW_INSETS
- (cursor.par()->previous_ ? cursor.par()->previous_->id() : 0)
-#else
- (cursor.par()->previous() ? cursor.par()->previous()->id() : 0)
-#endif
+ if ((cursor.par()->previous() ? cursor.par()->previous()->id() : 0)
== old_cur_par_prev_id
&& cursor.par()->id() != old_cur_par_id)
return; // delete-empty-paragraph-mechanism has done it
LyXCursor tmpcursor = cursor;
cursor = old_cursor; // to make sure undo gets the right cursor position
SetUndo(bview->buffer(), Undo::DELETE,
-#ifndef NEW_INSETS
- cursor.par()->ParFromPos(cursor.pos())->previous_,
- cursor.par()->ParFromPos(cursor.pos())->next_
-#else
cursor.par()->previous(),
- cursor.par()->next()
-#endif
- );
+ cursor.par()->next());
cursor = tmpcursor;
Backspace(bview);
}
void LyXText::Backspace(BufferView * bview)
{
// Get the font that is used to calculate the baselineskip
-#ifndef NEW_INSETS
- LyXParagraph::size_type lastpos = cursor.par()->Last();
-#else
LyXParagraph::size_type lastpos = cursor.par()->size();
-#endif
- LyXFont rawparfont = cursor.par()->GetFontSettings(bview->buffer()->params,
- lastpos - 1);
+ LyXFont rawparfont =
+ cursor.par()->GetFontSettings(bview->buffer()->params,
+ lastpos - 1);
if (cursor.pos() == 0) {
// The cursor is at the beginning of a paragraph,
// is it an empty paragraph?
if ((lastpos == 0
- || (lastpos == 1 && cursor.par()->IsSeparator(0)))
-#ifndef NEW_INSETS
- && !(cursor.par()->next()
- && cursor.par()->footnoteflag == LyXParagraph::NO_FOOTNOTE
- && cursor.par()->next()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)
-#endif
- ) {
+ || (lastpos == 1 && cursor.par()->IsSeparator(0)))) {
// This is an empty paragraph and we delete it just by moving the cursor one step
// left and let the DeleteEmptyParagraphMechanism handle the actual deletion
// of the paragraph.
-#ifndef NEW_INSETS
- if (cursor.par()->previous_) {
- LyXParagraph * tmppar = cursor.par()->previous_->FirstPhysicalPar();
- if (cursor.par()->GetLayout() == tmppar->GetLayout()
- && cursor.par()->footnoteflag == tmppar->footnoteflag
-#else
if (cursor.par()->previous()) {
LyXParagraph * tmppar = cursor.par()->previous();
if (cursor.par()->GetLayout() == tmppar->GetLayout()
-#endif
&& cursor.par()->GetAlign() == tmppar->GetAlign()) {
// Inherit bottom DTD from the paragraph below.
// (the one we are deleting)
}
}
-#ifndef NEW_INSETS
- if (cursor.par()->ParFromPos(cursor.pos())->previous_) {
- SetUndo(bview->buffer(), Undo::DELETE,
- cursor.par()->ParFromPos(cursor.pos())->previous_->previous_,
- cursor.par()->ParFromPos(cursor.pos())->next_);
- }
-#else
if (cursor.par()->previous()) {
SetUndo(bview->buffer(), Undo::DELETE,
cursor.par()->previous()->previous(),
cursor.par()->next());
}
-#endif
LyXParagraph * tmppar = cursor.par();
Row * tmprow = cursor.row();
// without the dreaded mechanism. (JMarc)
if (cursor.par()->previous()) {
// steps into the above paragraph.
-#ifndef NEW_INSETS
- SetCursorIntern(bview, cursor.par()->previous(),
- cursor.par()->previous()->Last(), false);
-#else
SetCursorIntern(bview, cursor.par()->previous(),
cursor.par()->previous()->size(),
false);
-#endif
}
/* Pasting is not allowed, if the paragraphs have different
if (cursor.par() != tmppar
&& (cursor.par()->GetLayout() == tmppar->GetLayout()
|| tmppar->GetLayout() == 0 /*standard*/)
-#ifndef NEW_INSETS
- && cursor.par()->footnoteflag == tmppar->footnoteflag
-#endif
&& cursor.par()->GetAlign() == tmppar->GetAlign()) {
RemoveParagraph(tmprow);
/* this is the code for a normal backspace, not pasting
* any paragraphs */
SetUndo(bview->buffer(), Undo::DELETE,
-#ifndef NEW_INSETS
- cursor.par()->ParFromPos(cursor.pos())->previous_,
- cursor.par()->ParFromPos(cursor.pos())->next_
-#else
cursor.par()->previous(),
- cursor.par()->next()
-#endif
- );
+ cursor.par()->next());
// We used to do CursorLeftIntern() here, but it is
// not a good idea since it triggers the auto-delete
// mechanism. So we do a CursorLeftIntern()-lite,
if (cursor.par()->IsLineSeparator(cursor.pos() - 1))
cursor.pos(cursor.pos() - 1);
-#ifndef NEW_INSETS
- if (cursor.pos() < cursor.par()->Last()
- && !cursor.par()->IsSeparator(cursor.pos())) {
-#else
if (cursor.pos() < cursor.par()->size()
&& !cursor.par()->IsSeparator(cursor.pos())) {
-#endif
cursor.par()->InsertChar(cursor.pos(), ' ');
SetCharFont(bview->buffer(), cursor.par(),
cursor.pos(), current_font);
}
// delete newlines at the beginning of paragraphs
-#ifndef NEW_INSETS
- while (cursor.par()->Last() &&
-#else
while (cursor.par()->size() &&
-#endif
cursor.par()->IsNewline(cursor.pos()) &&
cursor.pos() == BeginningOfMainBody(bview->buffer(),
cursor.par())) {
Row * tmprow = row->previous();
// maybe the current row is now empty
-#ifndef NEW_INSETS
- if (row->pos() >= row->par()->Last()) {
-#else
if (row->pos() >= row->par()->size()) {
-#endif
// remove it
RemoveRow(row);
need_break_row = 0;
//current_font = rawtmpfont;
//real_current_font = realtmpfont;
// check, whether the last character's font has changed.
-#ifndef NEW_INSETS
- if (rawparfont !=
- cursor.par()->GetFontSettings(bview->buffer()->params,
- cursor.par()->Last() - 1))
-#else
if (rawparfont !=
cursor.par()->GetFontSettings(bview->buffer()->params,
cursor.par()->size() - 1))
-#endif
RedoHeightOfParagraph(bview, cursor);
return;
}
// break the cursor row again
if (row->next() && row->next()->par() == row->par() &&
-#ifndef NEW_INSETS
- (RowLast(row) == row->par()->Last() - 1 ||
-#else
(RowLast(row) == row->par()->size() - 1 ||
-#endif
NextBreakPoint(bview, row, workWidth(bview)) != RowLast(row))) {
/* it can happen that a paragraph loses one row
* without a real breakup. This is when a word
* is to long to be broken. Well, I don t care this
* hack ;-) */
-#ifndef NEW_INSETS
- if (RowLast(row) == row->par()->Last() - 1)
-#else
if (RowLast(row) == row->par()->size() - 1)
-#endif
RemoveRow(row->next());
refresh_y = y;
SetCursor(bview, cursor.par(), cursor.pos(), false,
!cursor.boundary());
-#ifndef NEW_INSETS
- lastpos = cursor.par()->Last();
-#else
lastpos = cursor.par()->size();
-#endif
if (cursor.pos() == lastpos)
SetCurrentFont(bview);
}
int box_x = 0;
-#ifndef NEW_INSETS
- if (row_ptr->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
- LyXFont font(LyXFont::ALL_SANE);
- font.setSize(LyXFont::SIZE_FOOTNOTE);
- font.setColor(LColor::footnote);
-
- box_x = LYX_PAPER_MARGIN + lyxfont::width(" wide-tab ", font);
- if (row_ptr->previous() &&
- row_ptr->previous()->par()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE){
- string fs;
- switch (row_ptr->par()->footnotekind) {
- case LyXParagraph::MARGIN:
- fs = " margin";
- break;
- case LyXParagraph::FIG:
- fs = " fig";
- break;
- case LyXParagraph::TAB:
- fs = " tab";
- break;
- case LyXParagraph::WIDE_FIG:
- fs = " wide-fig";
- break;
- case LyXParagraph::WIDE_TAB:
- fs = " wide-tab";
- break;
- case LyXParagraph::ALGORITHM:
- fs = " alg";
- break;
- case LyXParagraph::FOOTNOTE:
- fs = " foot";
- break;
- }
-
- pain.fillRectangle(LYX_PAPER_MARGIN,
- y_offset + 1,
- box_x - LYX_PAPER_MARGIN,
- int(lyxfont::maxAscent(font)
- + lyxfont::maxDescent(font)),
- LColor::footnotebg);
-
- pain.line(LYX_PAPER_MARGIN, y_offset,
- workWidth(bview) - LYX_PAPER_MARGIN, y_offset,
- LColor::footnoteframe);
-
- pain.text(LYX_PAPER_MARGIN,
- y_offset + int(lyxfont::maxAscent(font)) + 1,
- fs, font);
-
- pain.line(LYX_PAPER_MARGIN, y_offset,
- LYX_PAPER_MARGIN,
- y_offset + int(lyxfont::maxAscent(font)
- + lyxfont::maxDescent(font)),
- LColor::footnoteframe);
-
- pain.line(LYX_PAPER_MARGIN,
- y_offset + int(lyxfont::maxAscent(font)
- + lyxfont::maxDescent(font)) + 1,
- box_x,
- y_offset + int(lyxfont::maxAscent(font)
- + lyxfont::maxDescent(font)) + 1,
- LColor::footnoteframe);
-
- }
-
- /* draw the open floats in a red box */
- pain.line(box_x, y_offset,
- box_x, y_offset + row_ptr->height(),
- LColor::footnoteframe);
-
- pain.line(workWidth(bview) - LYX_PAPER_MARGIN,
- y_offset,
- workWidth(bview) - LYX_PAPER_MARGIN,
- y_offset + row_ptr->height(),
- LColor::footnoteframe);
-
- // Draw appendix lines
- LyXParagraph * p = row_ptr->par()->PreviousBeforeFootnote()->FirstPhysicalPar();
- if (p->params.appendix()) {
- pain.line(1, y_offset,
- 1, y_offset + row_ptr->height(),
- LColor::appendixline);
- pain.line(workWidth(bview) - 2, y_offset,
- workWidth(bview) - 2,
- y_offset + row_ptr->height(),
- LColor::appendixline);
- }
-
-#ifndef NO_PEXTRA
- // Draw minipage line
- bool const minipage =
- (p->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE);
- if (minipage)
- pain.line(LYX_PAPER_MARGIN/5, y_offset,
- LYX_PAPER_MARGIN/5,
- y_offset + row_ptr->height() - 1,
- LColor::minipageline);
-#endif
- // Draw depth lines
- int const depth = p->GetDepth();
- for (int i = 1; i <= depth; ++i) {
- int const line_x = (LYX_PAPER_MARGIN / 5) *
- (i + minipage);
- pain.line(line_x, y_offset, line_x,
- y_offset + row_ptr->height() - 1,
- LColor::depthbar);
- }
- } else if (row_ptr->previous() &&
- row_ptr->previous()->par()->footnoteflag
- == LyXParagraph::OPEN_FOOTNOTE) {
- LyXFont font(LyXFont::ALL_SANE);
- font.setSize(LyXFont::SIZE_FOOTNOTE);
-
- int const box_x = LYX_PAPER_MARGIN
- + lyxfont::width(" wide-tab ", font);
-
- pain.line(box_x, y_offset,
- workWidth(bview) - LYX_PAPER_MARGIN,
- y_offset, LColor::footnote);
- }
-#endif
// Draw appendix lines
-#ifndef NEW_INSETS
- LyXParagraph * firstpar = row_ptr->par()->FirstPhysicalPar();
-#else
LyXParagraph * firstpar = row_ptr->par();
-#endif
+
if (firstpar->params.appendix()) {
pain.line(1, y_offset,
1, y_offset + row_ptr->height(),
ww - 2, y_offset + row_ptr->height(),
LColor::appendixline);
}
-#ifndef NO_PEXTRA
- // Draw minipage line
- bool const minipage =
- (firstpar->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE);
- if (minipage)
- pain.line(LYX_PAPER_MARGIN/5 + box_x, y_offset,
- LYX_PAPER_MARGIN/5 + box_x,
- y_offset + row_ptr->height() - 1,
- LColor::minipageline);
-#endif
+
// Draw depth lines
int const depth = firstpar->GetDepth();
if (depth > 0) {
int next_depth = 0;
int prev_depth = 0;
if (row_ptr->next())
-#ifndef NEW_INSETS
- if (row_ptr->par()->footnoteflag ==
- row_ptr->next()->par()->footnoteflag)
- next_depth = row_ptr->next()->par()->GetDepth();
- else if (row_ptr->par()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE)
- next_depth = depth;
-#else
next_depth = row_ptr->next()->par()->GetDepth();
-#endif
if (row_ptr->previous())
-#ifndef NEW_INSETS
- if (row_ptr->par()->footnoteflag ==
- row_ptr->previous()->par()->footnoteflag)
- prev_depth = row_ptr->previous()->par()->GetDepth();
- else if (row_ptr->par()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE)
- prev_depth = depth;
-#else
prev_depth = row_ptr->previous()->par()->GetDepth();
-#endif
for (int i = 1; i <= depth; ++i) {
int const line_x = (LYX_PAPER_MARGIN / 5) *
- (i
-#ifndef NO_PEXTRA
- + minipage
-#endif
- ) + box_x + x_offset;
+ i + box_x + x_offset;
pain.line(line_x, y_offset, line_x,
y_offset + row_ptr->height() - 1 - (i - next_depth - 1) * 3,
LColor::depthbar);
if (is_rtl) {
tmpx = ww - LeftMargin(bview, row_ptr)
+ lyxfont::width(layout.labelsep, font);
-#ifndef NEW_INSETS
- if (row_ptr->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
- LyXFont font(LyXFont::ALL_SANE);
- font.setSize(LyXFont::SIZE_SMALL);
- tmpx += lyxfont::width("Mwide-fixM", font);
- }
-#endif
} else
tmpx = x - lyxfont::width(layout.labelsep, font)
- lyxfont::width(tmpstring, font);
}
// is it a last row?
-#ifndef NEW_INSETS
- LyXParagraph * par = row_ptr->par()->LastPhysicalPar();
-#else
LyXParagraph * par = row_ptr->par();
-#endif
- if (
-#ifndef NEW_INSETS
- row_ptr->par()->ParFromPos(last + 1) == par
-#else
- row_ptr->par() == par
-#endif
- && (!row_ptr->next() || row_ptr->next()->par() != row_ptr->par()))
- {
- // think about the margins
+ if (row_ptr->par() == par
+ && (!row_ptr->next() || row_ptr->next()->par() != row_ptr->par())) {
+ // think about the margins
if (!row_ptr->next() && bv_owner)
y_bottom -= LYX_PAPER_MARGIN;
if (firstpar->params.lineBottom()) {
// draw a bottom line
-#ifndef NEW_INSETS
- y_bottom -= lyxfont::ascent('x',
- GetFont(bview->buffer(),
- par,
- par->Last() - 1));
-#else
y_bottom -= lyxfont::ascent('x',
GetFont(bview->buffer(),
par,
par->size() - 1));
-#endif
int const w = (inset_owner ?
inset_owner->width(bview, font) : ww);
int const xp = static_cast<int>(inset_owner ? x : 0);
w, y_offset + y_bottom,
LColor::topline, Painter::line_solid,
Painter::line_thick);
-#ifndef NEW_INSETS
- y_bottom -= lyxfont::ascent('x',
- GetFont(bview->buffer(),
- par,
- par->Last() - 1));
-#else
y_bottom -= lyxfont::ascent('x',
GetFont(bview->buffer(),
par,
par->size() - 1));
-#endif
}
// draw an endlabel
int const y = (y_offset + row_ptr->baseline()) - size;
int x = is_rtl ? LYX_PAPER_MARGIN
: ww - LYX_PAPER_MARGIN - size;
-#ifndef NEW_INSETS
- if (row_ptr->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)
- if (is_rtl) {
- LyXFont font(LyXFont::ALL_SANE);
- font.setSize(LyXFont::SIZE_SMALL);
- x += lyxfont::width("Mwide-figM", font);
- } else
- x -= LYX_PAPER_MARGIN/2;
-#endif
+
if (row_ptr->fill() <= size)
x += (size - row_ptr->fill() + 1) * (is_rtl ? -1 : 1);
if (endlabel == END_LABEL_BOX) {
}
-#ifndef NEW_INSETS
-/* turn the selection into a new environment. If there is no selection,
-* create an empty environment */
-void LyXText::InsertFootnoteEnvironment(BufferView * bview,
- LyXParagraph::footnote_kind kind)
-{
- /* no footnoteenvironment in a footnoteenvironment */
- if (cursor.par()->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
- WriteAlert(_("Impossible operation"),
- _("You can't insert a float in a float!"),
- _("Sorry."));
- return;
- }
-#ifndef NO_PEXTRA
- /* no marginpars in minipages */
- if (kind == LyXParagraph::MARGIN
- && cursor.par()->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE) {
- WriteAlert(_("Impossible operation"),
- _("You can't insert a marginpar in a minipage!"),
- _("Sorry."));
- return;
- }
-#endif
- /* this doesnt make sense, if there is no selection */
- bool dummy_selection = false;
- if (!selection) {
- sel_start_cursor = cursor; /* dummy selection */
- sel_end_cursor = cursor;
- dummy_selection = true;
- }
-
- LyXParagraph * tmppar;
-
- /* a test to make sure there is not already a footnote
- * in the selection. */
-
- tmppar = sel_start_cursor.par()->ParFromPos(sel_start_cursor.pos());
-
- while (tmppar != sel_end_cursor.par()->ParFromPos(sel_end_cursor.pos()) &&
- tmppar->footnoteflag == LyXParagraph::NO_FOOTNOTE)
- tmppar = tmppar->next_;
-
- if (tmppar != sel_end_cursor.par()->ParFromPos(sel_end_cursor.pos())
- || tmppar->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
- WriteAlert(_("Impossible operation"),
- _("Float would include float!"),
- _("Sorry."));
- return;
- }
-
- /* ok we have a selection. This is always between sel_start_cursor
- * and sel_end cursor */
-
- SetUndo(bview->buffer(), Undo::FINISH,
- sel_start_cursor.par()->ParFromPos(sel_start_cursor.pos())->previous_,
- sel_end_cursor.par()->ParFromPos(sel_end_cursor.pos())->next_);
-
- if (sel_end_cursor.pos() > 0
- && sel_end_cursor.par()->IsLineSeparator(sel_end_cursor.pos() - 1))
- sel_end_cursor.pos(sel_end_cursor.pos() - 1);
- /* please break before a space at the end */
- if (sel_start_cursor.par() == sel_end_cursor.par()
- && sel_start_cursor.pos() > sel_end_cursor.pos())
- sel_start_cursor.pos(sel_start_cursor.pos() - 1);
-
- sel_end_cursor.par()->BreakParagraphConservative(bview->buffer()->params, sel_end_cursor.pos());
-
- sel_end_cursor.par(sel_end_cursor.par()->next());
- sel_end_cursor.pos(0);
-
- // don't forget to insert a dummy layout paragraph if necessary
- if (sel_start_cursor.par()->GetLayout() != sel_end_cursor.par()->layout){
- sel_end_cursor.par()->BreakParagraphConservative(bview->buffer()->params, 0);
- sel_end_cursor.par()->layout = LYX_DUMMY_LAYOUT;
- sel_end_cursor.par(sel_end_cursor.par()->next_);
- }
- else
- sel_end_cursor.par()->layout = LYX_DUMMY_LAYOUT;
-
- cursor = sel_end_cursor;
-
- /* please break behind a space, if there is one. The space should
- * be erased too */
- if (sel_start_cursor.pos() > 0
- && sel_start_cursor.par()->IsLineSeparator(sel_start_cursor.pos() - 1))
- sel_start_cursor.pos(sel_start_cursor.pos() - 1);
- if (sel_start_cursor.par()->IsLineSeparator(sel_start_cursor.pos())) {
- sel_start_cursor.par()->Erase(sel_start_cursor.pos());
- }
-
- sel_start_cursor.par()->BreakParagraphConservative(bview->buffer()->params,
- sel_start_cursor.pos());
- tmppar = sel_start_cursor.par()->next();
-
- if (dummy_selection) {
- tmppar->Clear();
- if (kind == LyXParagraph::TAB
- || kind == LyXParagraph::FIG
- || kind == LyXParagraph::WIDE_TAB
- || kind == LyXParagraph::WIDE_FIG
- || kind == LyXParagraph::ALGORITHM) {
- pair<bool, LyXTextClass::size_type> lres =
- textclasslist.NumberOfLayout(bview->buffer()->params.textclass,
- "Caption");
- LyXTextClass::size_type lay;
- if (lres.first) {
- // layout fount
- lay = lres.second;
- } else {
- // layout not found
- lay = 0; // use default layout "Standard" (0)
- }
- tmppar->SetLayout(bview->buffer()->params, lay);
- }
- } else {
- if (sel_start_cursor.pos() > 0) {
- /* the footnote-environment should begin with a standard layout.
- * Imagine you insert a footnote within an enumeration, you
- * certainly do not want an enumerated footnote! */
- tmppar->Clear();
- } else {
- /* this is a exception the user would sometimes expect, I hope */
- sel_start_cursor.par()->Clear();
- }
- }
-
- while (tmppar != sel_end_cursor.par()) {
- tmppar->footnoteflag = LyXParagraph::OPEN_FOOTNOTE;
- tmppar->footnotekind = kind;
- tmppar = tmppar->next();
- }
-
- RedoParagraphs(bview, sel_start_cursor, sel_end_cursor.par()->next());
-
- SetCursor(bview, sel_start_cursor.par()->next(), 0);
-
- ClearSelection(bview);
-}
-#endif
-
-
// returns pointer to a specified row
Row * LyXText::GetRow(LyXParagraph * par,
LyXParagraph::size_type pos, int & y) const
char par_depth = par->GetDepth();
// We specialize the 95% common case:
- if (
-#ifndef NEW_INSETS
- par->footnoteflag == LyXParagraph::NO_FOOTNOTE &&
-#endif
- !par_depth) {
+ if (!par_depth) {
if (pos >= 0){
// 95% goes here
if (layout.labeltype == LABEL_MANUAL
tmpfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont());
-#ifndef NEW_INSETS
- // Cosmetic improvement: If this is an open footnote, make the font
- // smaller.
- if (par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
- && par->footnotekind == LyXParagraph::FOOTNOTE) {
- tmpfont.decSize();
- }
-#endif
return tmpfont;
}
layoutfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont());
-#ifndef NEW_INSETS
- if (par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
- && par->footnotekind == LyXParagraph::FOOTNOTE) {
- layoutfont.decSize();
- }
-#endif
// Now, reduce font against full layout font
font.reduce(layoutfont);
}
-#ifndef NEW_INSETS
-void LyXText::ToggleFootnote(BufferView * bview)
-{
- LyXParagraph * par = cursor.par()->ParFromPos(cursor.pos());
- if (par->next_
- && par->next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
- OpenFootnote(bview);
- bview->owner()->getMiniBuffer()->Set(_("Opened float"));
- } else {
- bview->owner()->getMiniBuffer()->Set(_("Closed float"));
- CloseFootnote(bview);
- }
-}
-#endif
-
-
-#ifndef NEW_INSETS
-void LyXText::OpenStuff(BufferView * bview)
-{
- if (cursor.pos() == 0 && cursor.par()->bibkey){
- cursor.par()->bibkey->Edit(bview, 0, 0, 0);
- } else if (cursor.pos() < cursor.par()->Last()
- && cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET
- && cursor.par()->GetInset(cursor.pos())->Editable()) {
- bview->owner()->getMiniBuffer()
- ->Set(cursor.par()->GetInset(cursor.pos())->EditMessage());
- if (cursor.par()->GetInset(cursor.pos())->Editable() != Inset::HIGHLY_EDITABLE)
- SetCursorParUndo(bview->buffer());
- cursor.par()->GetInset(cursor.pos())->Edit(bview, 0, 0, 0);
- }
-#ifndef NEW_INSETS
- else {
- ToggleFootnote(bview);
- }
-#endif
-}
-#endif
-
-
-#ifndef NEW_INSETS
-void LyXText::CloseFootnote(BufferView * bview)
-{
- LyXParagraph * tmppar;
- LyXParagraph * par = cursor.par()->ParFromPos(cursor.pos());
-
- // if the cursor is not in an open footnote, or
- // there is no open footnote in this paragraph, just return.
- if (cursor.par()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE) {
-
- if (!par->next_ ||
- par->next_->footnoteflag != LyXParagraph::OPEN_FOOTNOTE) {
- bview->owner()->getMiniBuffer()
- ->Set(_("Nothing to do"));
- return;
- }
-
- // ok, move the cursor right before the footnote
- // just a little faster than using CursorRight()
- for (cursor.pos(0);
- cursor.par()->ParFromPos(cursor.pos()) != par;) {
- cursor.pos(cursor.pos() + 1);
- }
-
- // now the cursor is at the beginning of the physical par
- SetCursor(bview, cursor.par(),
- cursor.pos() +
- cursor.par()->ParFromPos(cursor.pos())->size());
- } else {
- /* we are in a footnote, so let us move at the beginning */
- /* this is just faster than using just CursorLeft() */
-
- tmppar = cursor.par();
- while (tmppar->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
- // just a little bit faster than movin the cursor
- tmppar = tmppar->previous();
- }
- SetCursor(bview, tmppar, tmppar->Last());
- }
-
- // the cursor must be exactly before the footnote
- par = cursor.par()->ParFromPos(cursor.pos());
-
- status = LyXText::NEED_MORE_REFRESH;
- refresh_row = cursor.row();
- refresh_y = cursor.y() - cursor.row()->baseline();
-
- tmppar = cursor.par();
- LyXParagraph * endpar = par->NextAfterFootnote()->next();
- Row * row = cursor.row();
-
- tmppar->CloseFootnote(cursor.pos());
-
- while (tmppar != endpar) {
- RemoveRow(row->next());
- if (row->next())
- tmppar = row->next()->par();
- else
- tmppar = 0;
- }
-
- AppendParagraph(bview, cursor.row());
-
- SetCursor(bview, cursor.par(), cursor.pos());
- sel_cursor = cursor;
-
- // just necessary
- if (cursor.row()->next())
- SetHeightOfRow(bview, cursor.row()->next());
-}
-#endif
-
-
/* used in setlayout */
// Asger is not sure we want to do this...
void LyXText::MakeFontEntriesLayoutSpecific(Buffer const * buf,
LyXFont layoutfont, tmpfont;
for (LyXParagraph::size_type pos = 0;
-#ifndef NEW_INSETS
- pos < par->Last(); ++pos) {
-#else
pos < par->size(); ++pos) {
-#endif
if (pos < BeginningOfMainBody(buf, par))
layoutfont = layout.labelfont;
else
}
-#ifndef NEW_INSETS
-LyXParagraph * LyXText::SetLayout(BufferView * bview,
- LyXCursor & cur, LyXCursor & sstart_cur,
- LyXCursor & send_cur,
- LyXTextClass::size_type layout)
-{
- LyXParagraph * endpar = send_cur.par()->LastPhysicalPar()->next();
- LyXParagraph * undoendpar = endpar;
-
- if (endpar && endpar->GetDepth()) {
- while (endpar && endpar->GetDepth()) {
- endpar = endpar->LastPhysicalPar()->next();
- undoendpar = endpar;
- }
- } else if (endpar) {
- endpar = endpar->next(); // because of parindents etc.
- }
-
- SetUndo(bview->buffer(), Undo::EDIT,
- sstart_cur.par()->ParFromPos(sstart_cur.pos())->previous_,
- undoendpar);
-
- /* ok we have a selection. This is always between sstart_cur
- * and sel_end cursor */
- cur = sstart_cur;
-
- LyXLayout const & lyxlayout =
- textclasslist.Style(bview->buffer()->params.textclass, layout);
-
- while (cur.par() != send_cur.par()) {
- if (cur.par()->footnoteflag == sstart_cur.par()->footnoteflag) {
- cur.par()->SetLayout(bview->buffer()->params, layout);
- MakeFontEntriesLayoutSpecific(bview->buffer(), cur.par());
- LyXParagraph * fppar = cur.par()->FirstPhysicalPar();
- fppar->params.spaceTop(lyxlayout.fill_top ?
- VSpace(VSpace::VFILL) : VSpace(VSpace::NONE));
- fppar->params.spaceBottom(lyxlayout.fill_bottom ?
- VSpace(VSpace::VFILL) : VSpace(VSpace::NONE));
- if (lyxlayout.margintype == MARGIN_MANUAL)
- cur.par()->SetLabelWidthString(lyxlayout.labelstring());
- if (lyxlayout.labeltype != LABEL_BIBLIO
- && fppar->bibkey) {
- delete fppar->bibkey;
- fppar->bibkey = 0;
- }
- }
- cur.par(cur.par()->next());
- }
- if (cur.par()->footnoteflag == sstart_cur.par()->footnoteflag) {
- cur.par()->SetLayout(bview->buffer()->params, layout);
- MakeFontEntriesLayoutSpecific(bview->buffer(), cur.par());
- LyXParagraph * fppar = cur.par()->FirstPhysicalPar();
- fppar->params.spaceTop(lyxlayout.fill_top ?
- VSpace(VSpace::VFILL) : VSpace(VSpace::NONE));
- fppar->params.spaceBottom(lyxlayout.fill_bottom ?
- VSpace(VSpace::VFILL) : VSpace(VSpace::NONE));
- if (lyxlayout.margintype == MARGIN_MANUAL)
- cur.par()->SetLabelWidthString(lyxlayout.labelstring());
- if (lyxlayout.labeltype != LABEL_BIBLIO
- && fppar->bibkey) {
- delete fppar->bibkey;
- fppar->bibkey = 0;
- }
- }
- return endpar;
-}
-#else
LyXParagraph * LyXText::SetLayout(BufferView * bview,
LyXCursor & cur, LyXCursor & sstart_cur,
LyXCursor & send_cur,
}
return endpar;
}
-#endif
// set layout over selection and make a total rebreak of those paragraphs
}
// We end at the next paragraph with depth 0
- LyXParagraph * endpar =
-#ifndef NEW_INSETS
- sel_end_cursor.par()->LastPhysicalPar()->next();
-#else
- sel_end_cursor.par()->next();
-#endif
+ LyXParagraph * endpar = sel_end_cursor.par()->next();
+
LyXParagraph * undoendpar = endpar;
if (endpar && endpar->GetDepth()) {
while (endpar && endpar->GetDepth()) {
-#ifndef NEW_INSETS
- endpar = endpar->LastPhysicalPar()->next();
-#else
endpar = endpar->next();
-#endif
undoendpar = endpar;
}
}
}
SetUndo(bview->buffer(), Undo::EDIT,
-#ifndef NEW_INSETS
- sel_start_cursor
- .par()->ParFromPos(sel_start_cursor.pos())->previous_,
-#else
sel_start_cursor.par()->previous(),
-#endif
undoendpar);
LyXCursor tmpcursor = cursor; // store the current cursor
while (true) {
// NOTE: you can't change the depth of a bibliography entry
if (
-#ifndef NEW_INSETS
- cursor.par()->footnoteflag ==
- sel_start_cursor.par()->footnoteflag &&
-#endif
textclasslist.Style(bview->buffer()->params.textclass,
cursor.par()->GetLayout()
).labeltype != LABEL_BIBLIO) {
- LyXParagraph * prev =
-#ifndef NEW_INSETS
- cursor.par()->FirstPhysicalPar()->previous();
-#else
- cursor.par()->previous();
-#endif
+ LyXParagraph * prev = cursor.par()->previous();
+
if (prev
&& (prev->GetDepth() - cursor.par()->GetDepth() > 0
|| (prev->GetDepth() == cursor.par()->GetDepth()
&& textclasslist.Style(bview->buffer()->params.textclass,
prev->GetLayout()).isEnvironment()))) {
-#ifndef NEW_INSETS
- cursor.par()->FirstPhysicalPar()->params.depth(cursor.par()->FirstPhysicalPar()->params.depth() + 1);
-#else
cursor.par()->params.depth(cursor.par()->params.depth() + 1);
-#endif
anything_changed = true;
}
}
if (!anything_changed) {
cursor = sel_start_cursor;
while (cursor.par() != sel_end_cursor.par()) {
-#ifndef NEW_INSETS
- cursor.par()->FirstPhysicalPar()->params.depth(0);
-#else
cursor.par()->params.depth(0);
-#endif
cursor.par(cursor.par()->next());
}
-#ifndef NEW_INSETS
- if (cursor.par()->footnoteflag == sel_start_cursor.par()->footnoteflag)
- cursor.par()->FirstPhysicalPar()->params.depth(0);
-#else
- cursor.par()->params.depth(0);
-#endif
+ cursor.par()->params.depth(0);
}
RedoParagraphs(bview, sel_start_cursor, endpar);
sel_start_cursor = cursor; // dummy selection
sel_end_cursor = cursor;
}
-#ifndef NEW_INSETS
- LyXParagraph * endpar = sel_end_cursor.par()->LastPhysicalPar()->next();
-#else
LyXParagraph * endpar = sel_end_cursor.par()->next();
-#endif
LyXParagraph * undoendpar = endpar;
if (endpar && endpar->GetDepth()) {
while (endpar && endpar->GetDepth()) {
-#ifndef NEW_INSETS
- endpar = endpar->LastPhysicalPar()->next();
-#else
endpar = endpar->next();
-#endif
undoendpar = endpar;
}
}
}
SetUndo(bview->buffer(), Undo::EDIT,
-#ifndef NEW_INSETS
- sel_start_cursor
- .par()->ParFromPos(sel_start_cursor.pos())->previous_,
-#else
sel_start_cursor.par()->previous(),
-#endif
undoendpar);
LyXCursor tmpcursor = cursor; // store the current cursor
cursor = sel_start_cursor;
while (true) {
-#ifndef NEW_INSETS
- if (cursor.par()->footnoteflag ==
- sel_start_cursor.par()->footnoteflag) {
- if (cursor.par()->FirstPhysicalPar()->params.depth())
- cursor.par()->FirstPhysicalPar()->params.depth(cursor.par()->FirstPhysicalPar()->params.depth() - 1);
- }
-#else
- if (cursor.par()->params.depth())
- cursor.par()->params.depth(cursor.par()->params.depth() - 1);
-#endif
+ if (cursor.par()->params.depth())
+ cursor.par()->params.depth(cursor.par()->params.depth() - 1);
if (cursor.par() == sel_end_cursor.par())
break;
cursor.par(cursor.par()->next());
// and sel_end cursor
SetUndo(bview->buffer(), Undo::EDIT,
-#ifndef NEW_INSETS
- sel_start_cursor.par()->ParFromPos(sel_start_cursor.pos())->previous_,
- sel_end_cursor.par()->ParFromPos(sel_end_cursor.pos())->next_
-#else
sel_start_cursor.par()->previous(),
- sel_end_cursor.par()->next()
-#endif
- );
+ sel_end_cursor.par()->next());
cursor = sel_start_cursor;
while (cursor.par() != sel_end_cursor.par() ||
- (
-#ifndef NEW_INSETS
- cursor.par()->footnoteflag == sel_start_cursor.par()->footnoteflag &&
-#endif
- cursor.pos() < sel_end_cursor.pos()))
- {
-#ifndef NEW_INSETS
- if (cursor.pos() < cursor.par()->Last()
- && cursor.par()->footnoteflag
- == sel_start_cursor.par()->footnoteflag
-#else
- if (cursor.pos() < cursor.par()->size()
-#endif
- ) {
+ (cursor.pos() < sel_end_cursor.pos())) {
+ if (cursor.pos() < cursor.par()->size()) {
// an open footnote should behave
// like a closed one
LyXFont newfont = GetFont(bview->buffer(),
int y = cur.y() - tmprow->baseline();
SetHeightOfRow(bview, tmprow);
-#ifndef NEW_INSETS
- LyXParagraph * first_phys_par = tmprow->par()->FirstPhysicalPar();
-#else
LyXParagraph * first_phys_par = tmprow->par();
-#endif
+
// find the first row of the paragraph
if (first_phys_par != tmprow->par())
while (tmprow->previous()
int y = cur.y() - tmprow->baseline();
SetHeightOfRow(bview, tmprow);
-#ifndef NEW_INSETS
- LyXParagraph * first_phys_par = tmprow->par()->FirstPhysicalPar();
-#else
LyXParagraph * first_phys_par = tmprow->par();
-#endif
+
// find the first row of the paragraph
if (first_phys_par != tmprow->par())
while (tmprow->previous() && tmprow->previous()->par() != first_phys_par) {
if (!tmprow->previous()){
first_phys_par = FirstParagraph(); // a trick/hack for UNDO
} else {
-#ifndef NEW_INSETS
- first_phys_par = tmprow->par()->FirstPhysicalPar();
-#else
first_phys_par = tmprow->par();
-#endif
// find the first row of the paragraph
if (first_phys_par != tmprow->par())
while (tmprow->previous() &&
// The selection spans more than one paragraph
// First paragraph in selection
-#ifndef NEW_INSETS
- result += sel_start_cursor.par()->String(buffer,
- sel_start_cursor.pos(),
- sel_start_cursor.par()->Last())
- + "\n\n";
-#else
result += sel_start_cursor.par()->String(buffer,
sel_start_cursor.pos(),
sel_start_cursor.par()->size())
+ "\n\n";
-#endif
// The paragraphs in between (if any)
LyXCursor tmpcur(sel_start_cursor);
tmpcur.par(tmpcur.par()->next());
while (tmpcur.par() != sel_end_cursor.par()) {
-#ifndef NEW_INSETS
- result += tmpcur.par()->String(buffer, 0, tmpcur.par()->Last()) + "\n\n";
-#else
result += tmpcur.par()->String(buffer, 0, tmpcur.par()->size()) + "\n\n";
-#endif
tmpcur.par(tmpcur.par()->next()); // Or NextAfterFootnote??
}
if (!cursor.row()->next() || cursor.row()->next()->par() != cursor.row()->par())
SetCursor(bview, cursor.par(), RowLast(cursor.row()) + 1);
else {
-#ifndef NEW_INSETS
- if (cursor.par()->Last() &&
-#else
if (cursor.par()->size() &&
-#endif
(cursor.par()->GetChar(RowLast(cursor.row())) == ' '
|| cursor.par()->IsNewline(RowLast(cursor.row()))))
SetCursor(bview, cursor.par(), RowLast(cursor.row()));
}
-void LyXText::CursorTop(BufferView * bview) const
+void LyXText::CursorTop(BufferView * bview) const
{
while (cursor.par()->previous())
cursor.par(cursor.par()->previous());
}
-void LyXText::CursorBottom(BufferView * bview) const
+void LyXText::CursorBottom(BufferView * bview) const
{
while (cursor.par()->next())
cursor.par(cursor.par()->next());
-#ifndef NEW_INSETS
- SetCursor(bview, cursor.par(), cursor.par()->Last());
-#else
SetCursor(bview, cursor.par(), cursor.par()->size());
-#endif
}
}
-#ifndef NEW_INSETS
-/* if there is a selection, reset every environment you can find
-* in the selection, otherwise just the environment you are in */
-void LyXText::MeltFootnoteEnvironment(BufferView * bview)
-{
- LyXParagraph * tmppar, * firsttmppar;
-
- ClearSelection(bview);
-
- /* is is only allowed, if the cursor is IN an open footnote.
- * Otherwise it is too dangerous */
- if (cursor.par()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE)
- return;
-
- SetUndo(bview->buffer(), Undo::FINISH,
- cursor.par()->PreviousBeforeFootnote()->previous_,
- cursor.par()->NextAfterFootnote()->next_);
-
- /* ok, move to the beginning of the footnote. */
- while (cursor.par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)
- cursor.par(cursor.par()->previous());
-
- SetCursor(bview, cursor.par(), cursor.par()->Last());
- /* this is just faster than using CursorLeft(); */
-
- firsttmppar = cursor.par()->ParFromPos(cursor.pos());
- tmppar = firsttmppar;
- /* tmppar is now the paragraph right before the footnote */
-
- bool first_footnote_par_is_not_empty = tmppar->next_->size();
-
- while (tmppar->next_
- && tmppar->next_->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
- tmppar = tmppar->next_; /* I use next instead of Next(),
- * because there cannot be any
- * footnotes in a footnote
- * environment */
- tmppar->footnoteflag = LyXParagraph::NO_FOOTNOTE;
-
- /* remember the captions and empty paragraphs */
- if ((textclasslist.Style(bview->buffer()->params.textclass,
- tmppar->GetLayout())
- .labeltype == LABEL_SENSITIVE)
- || !tmppar->Last())
- tmppar->SetLayout(bview->buffer()->params, 0);
- }
-
- // now we will paste the ex-footnote, if the layouts allow it
- // first restore the layout of the paragraph right behind
- // the footnote
- if (tmppar->next_)
- tmppar->next_->MakeSameLayout(cursor.par());
-
- // first the end
- if (!tmppar->GetLayout()
- || (tmppar->next()
- && (!tmppar->next()->Last()
- || tmppar->next()->HasSameLayout(tmppar)))) {
- if (tmppar->next()->Last()
- && tmppar->next()->IsLineSeparator(0))
- tmppar->next()->Erase(0);
- tmppar->PasteParagraph(bview->buffer()->params);
- }
-
- tmppar = tmppar->next(); /* make sure tmppar cannot be touched
- * by the pasting of the beginning */
-
- /* then the beginning */
- /* if there is no space between the text and the footnote, so we insert
- * a blank
- * (only if the previous par and the footnotepar are not empty!) */
- if (!firsttmppar->next_->GetLayout()
- || firsttmppar->HasSameLayout(firsttmppar->next_)) {
- if (firsttmppar->size()
- && !firsttmppar->IsSeparator(firsttmppar->size() - 1)
- && first_footnote_par_is_not_empty) {
- firsttmppar->next_->InsertChar(0, ' ');
- }
- firsttmppar->PasteParagraph(bview->buffer()->params);
- }
-
- /* now redo the paragaphs */
- RedoParagraphs(bview, cursor, tmppar);
-
- SetCursor(bview, cursor.par(), cursor.pos());
-
- /* sometimes it can happen, that there is a counter change */
- Row * row = cursor.row();
- while (row->next() && row->par() != tmppar && row->next()->par() != tmppar)
- row = row->next();
- UpdateCounters(bview, row);
-
-
- ClearSelection(bview);
-}
-#endif
-
-
/* the DTP switches for paragraphs. LyX will store them in the
* first physicla paragraph. When a paragraph is broken, the top settings
* rest, the bottom settings are given to the new one. So I can make shure,
}
// make sure that the depth behind the selection are restored, too
-#ifndef NEW_INSETS
- LyXParagraph * endpar = sel_end_cursor.par()->LastPhysicalPar()->next();
-#else
LyXParagraph * endpar = sel_end_cursor.par()->next();
-#endif
LyXParagraph * undoendpar = endpar;
if (endpar && endpar->GetDepth()) {
while (endpar && endpar->GetDepth()) {
-#ifndef NEW_INSETS
- endpar = endpar->LastPhysicalPar()->next();
-#else
endpar = endpar->next();
-#endif
undoendpar = endpar;
}
}
}
SetUndo(bview->buffer(), Undo::EDIT,
-#ifndef NEW_INSETS
- sel_start_cursor
- .par()->ParFromPos(sel_start_cursor.pos())->previous_,
-#else
sel_start_cursor.par()->previous(),
-#endif
undoendpar);
LyXParagraph * tmppar = sel_end_cursor.par();
-#ifndef NEW_INSETS
- while (tmppar != sel_start_cursor.par()->FirstPhysicalPar()->previous()) {
- SetCursor(bview, tmppar->FirstPhysicalPar(), 0);
-#else
while (tmppar != sel_start_cursor.par()->previous()) {
SetCursor(bview, tmppar, 0);
-#endif
status = LyXText::NEED_MORE_REFRESH;
refresh_row = cursor.row();
refresh_y = cursor.y() - cursor.row()->baseline();
-#ifndef NEW_INSETS
- if (cursor.par()->footnoteflag ==
- sel_start_cursor.par()->footnoteflag) {
-#endif
cursor.par()->params.lineTop(line_top);
cursor.par()->params.lineBottom(line_bottom);
cursor.par()->params.pagebreakTop(pagebreak_top);
}
cursor.par()->SetLabelWidthString(labelwidthstring);
cursor.par()->params.noindent(noindent);
-#ifndef NEW_INSETS
- }
-
- tmppar = cursor.par()->FirstPhysicalPar()->previous();
-#else
tmppar = cursor.par()->previous();
-#endif
}
RedoParagraphs(bview, sel_start_cursor, endpar);
}
-#ifndef NO_PEXTRA
-void LyXText::SetParagraphExtraOpt(BufferView * bview, int type,
- string const & width,
- string const & widthp,
- int alignment, bool hfill,
- bool start_minipage)
-{
- LyXCursor tmpcursor = cursor;
- LyXParagraph * tmppar;
- if (!selection) {
- sel_start_cursor = cursor;
- sel_end_cursor = cursor;
- }
-
- // make sure that the depth behind the selection are restored, too
-#ifndef NEW_INSETS
- LyXParagraph * endpar = sel_end_cursor.par()->LastPhysicalPar()->next();
-#else
- LyXParagraph * endpar = sel_end_cursor.par()->next();
-#endif
- LyXParagraph * undoendpar = endpar;
-
- if (endpar && endpar->GetDepth()) {
- while (endpar && endpar->GetDepth()) {
-#ifndef NEW_INSETS
- endpar = endpar->LastPhysicalPar()->next();
-#else
- endpar = endpar->next();
-#endif
- undoendpar = endpar;
- }
- }
- else if (endpar) {
- endpar = endpar->next(); // because of parindents etc.
- }
-
- SetUndo(bview->buffer(), Undo::EDIT,
-#ifndef NEW_INSETS
- sel_start_cursor
- .par()->ParFromPos(sel_start_cursor.pos())->previous_,
-#else
- sel_start_cursor.par()->previous(),
-#endif
- undoendpar);
-
- tmppar = sel_end_cursor.par();
-#ifndef NEW_INSETS
- while(tmppar != sel_start_cursor.par()->FirstPhysicalPar()->previous()) {
- SetCursor(bview, tmppar->FirstPhysicalPar(), 0);
-#else
- while(tmppar != sel_start_cursor.par()->previous()) {
- SetCursor(bview, tmppar, 0);
-#endif
- status = LyXText::NEED_MORE_REFRESH;
- refresh_row = cursor.row();
- refresh_y = cursor.y() - cursor.row()->baseline();
-#ifndef NEW_INSETS
- if (cursor.par()->footnoteflag ==
- sel_start_cursor.par()->footnoteflag) {
-#endif
-#ifndef NO_PEXTRA
- if (type == LyXParagraph::PEXTRA_NONE) {
- if (cursor.par()->params.pextraType() != LyXParagraph::PEXTRA_NONE) {
- cursor.par()->UnsetPExtraType(bview->buffer()->params);
- cursor.par()->params.pextraType(LyXParagraph::PEXTRA_NONE);
- }
- } else {
- cursor.par()->SetPExtraType(bview->buffer()->params,
- type, width, widthp);
- cursor.par()->params.pextraHfill(hfill);
- cursor.par()->params.pextraStartMinipage(start_minipage);
- cursor.par()->params.pextraAlignment(alignment);
- }
-#endif
-#ifndef NEW_INSETS
- }
- tmppar = cursor.par()->FirstPhysicalPar()->previous();
-#else
- tmppar = cursor.par()->previous();
-#endif
- }
- RedoParagraphs(bview, sel_start_cursor, endpar);
- ClearSelection(bview);
- SetCursor(bview, sel_start_cursor.par(), sel_start_cursor.pos());
- sel_cursor = cursor;
- SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
- SetSelection(bview);
- SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
-}
-#endif
-
-
char loweralphaCounter(int n)
{
if (n < 1 || n > 26)
// set the counter of a paragraph. This includes the labels
void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
{
-#ifndef NEW_INSETS
- // this is only relevant for the beginning of paragraph
- par = par->FirstPhysicalPar();
-#endif
LyXLayout const & layout =
textclasslist.Style(buf->params.textclass,
par->GetLayout());
/* copy the prev-counters to this one, unless this is the start of a
footnote or of a bibliography or the very first paragraph */
if (par->previous()
-#ifndef NEW_INSETS
- && !(par->previous()->footnoteflag == LyXParagraph::NO_FOOTNOTE
- && par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
- && par->footnotekind == LyXParagraph::FOOTNOTE)
-#endif
&& !(textclasslist.Style(buf->params.textclass,
par->previous()->GetLayout()
).labeltype != LABEL_BIBLIO
for (int i = 0; i < 10; ++i) {
par->setCounter(i, par->previous()->GetFirstCounter(i));
}
-#ifndef NEW_INSETS
- par->params.appendix(par->previous()->FirstPhysicalPar()->params.appendix());
-#else
par->params.appendix(par->previous()->params.appendix());
-#endif
if (!par->params.appendix() && par->params.startOfAppendix()) {
par->params.appendix(true);
for (int i = 0; i < 10; ++i) {
par->setCounter(i, 0);
}
}
-#ifndef NEW_INSETS
- par->enumdepth = par->previous()->FirstPhysicalPar()->enumdepth;
- par->itemdepth = par->previous()->FirstPhysicalPar()->itemdepth;
-#else
par->enumdepth = par->previous()->enumdepth;
par->itemdepth = par->previous()->itemdepth;
-#endif
} else {
for (int i = 0; i < 10; ++i) {
par->setCounter(i, 0);
par->itemdepth = 0;
}
-#ifndef NEW_INSETS
- // if this is an open marginnote and this is the first
- // entry in the marginnote and the enclosing
- // environment is an enum/item then correct for the
- // LaTeX behaviour (ARRae)
- if (par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
- && par->footnotekind == LyXParagraph::MARGIN
- && par->previous()
- && par->previous()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE
- && (par->PreviousBeforeFootnote()
- && textclasslist.Style(buf->params.textclass,
- par->PreviousBeforeFootnote()->GetLayout()
- ).labeltype >= LABEL_COUNTER_ENUMI)) {
- // Any itemize or enumerate environment in a marginnote
- // that is embedded in an itemize or enumerate
- // paragraph is seen by LaTeX as being at a deeper
- // level within that enclosing itemization/enumeration
- // even if there is a "standard" layout at the start of
- // the marginnote.
- par->enumdepth++;
- par->itemdepth++;
- }
-#endif
/* Maybe we have to increment the enumeration depth.
* BUT, enumeration in a footnote is considered in isolation from its
* surrounding paragraph so don't increment if this is the
par->previous()->GetLayout()
).labeltype == LABEL_COUNTER_ENUMI
&& par->enumdepth < 3
-#ifndef NEW_INSETS
- && !(par->previous()->footnoteflag == LyXParagraph::NO_FOOTNOTE
- && par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
- && par->footnotekind == LyXParagraph::FOOTNOTE)
-#endif
&& layout.labeltype != LABEL_BIBLIO) {
par->enumdepth++;
}
/* Maybe we have to decrement the enumeration depth, see note above */
if (par->previous()
&& par->previous()->GetDepth() > par->GetDepth()
-#ifndef NEW_INSETS
- && !(par->previous()->footnoteflag == LyXParagraph::NO_FOOTNOTE
- && par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
- && par->footnotekind == LyXParagraph::FOOTNOTE)
-#endif
&& layout.labeltype != LABEL_BIBLIO) {
par->enumdepth = par->DepthHook(par->GetDepth())->enumdepth;
par->setCounter(6 + par->enumdepth,
if (layout.labeltype == LABEL_SENSITIVE) {
bool isOK (par->InInset() && par->InInset()->owner() &&
(par->InInset()->owner()->LyxCode() == Inset::FLOAT_CODE));
-#ifndef NEW_INSETS
- if (par->footnoteflag != LyXParagraph::NO_FOOTNOTE
- && (par->footnotekind == LyXParagraph::FIG
- || par->footnotekind == LyXParagraph::WIDE_FIG)) {
- s = (par->getParLanguage(buf->params)->lang() == "hebrew")
- ? ":øåéà" : "Figure:";
- } else if (par->footnoteflag != LyXParagraph::NO_FOOTNOTE
- && (par->footnotekind == LyXParagraph::TAB
- || par->footnotekind == LyXParagraph::WIDE_TAB)) {
- s = (par->getParLanguage(buf->params)->lang() == "hebrew")
- ? ":äìáè" : "Table:";
- } else if (par->footnoteflag != LyXParagraph::NO_FOOTNOTE
- && par->footnotekind == LyXParagraph::ALGORITHM) {
- s = (par->getParLanguage(buf->params)->lang() == "hebrew")
- ? ":íúéøåâìà" : "Algorithm:";
- } else
-#endif
if (isOK) {
InsetFloat * tmp = static_cast<InsetFloat*>(par->InInset()->owner());
Floating const & fl
void LyXText::UpdateCounters(BufferView * bview, Row * row) const
{
LyXParagraph * par;
-#ifndef NEW_INSETS
- if (!row) {
- row = firstrow;
- par = row->par();
- } else if (row->par()->next_
- && row->par()->next_->footnoteflag != LyXParagraph::OPEN_FOOTNOTE) {
- par = row->par()->LastPhysicalPar()->next();
- } else {
- par = row->par()->next_;
- }
-#else
+
if (!row) {
row = firstrow;
par = row->par();
} else {
par = row->par()->next();
}
-#endif
while (par) {
while (row->par() != par)
/* now check for the headline layouts. remember that they
* have a dynamic left margin */
- if (
-#ifndef NEW_INSETS
- !par->IsDummy() &&
-#endif
- ( textclasslist.Style(bview->buffer()->params.textclass,
- par->layout).margintype == MARGIN_DYNAMIC
- || textclasslist.Style(bview->buffer()->params.textclass,
- par->layout).labeltype == LABEL_SENSITIVE)
- ) {
-
+ if ((textclasslist.Style(bview->buffer()->params.textclass,
+ par->layout).margintype == MARGIN_DYNAMIC
+ || textclasslist.Style(bview->buffer()->params.textclass,
+ par->layout).labeltype == LABEL_SENSITIVE)) {
+
/* Rebreak the paragraph */
RemoveParagraph(row);
AppendParagraph(bview, row);
-
-#ifndef NEW_INSETS
- /* think about the damned open footnotes! */
- while (par->next() &&
- (par->next()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
- || par->next()->IsDummy())){
- par = par->next();
- if (par->IsDummy()) {
- while (row->par() != par)
- row = row->next();
- RemoveParagraph(row);
- AppendParagraph(bview, row);
- }
- }
-#endif
}
-#ifndef NEW_INSETS
- par = par->LastPhysicalPar()->next();
-#else
par = par->next();
-#endif
-
}
}
if (!cursor.par()->InsertInsetAllowed(inset))
return;
SetUndo(bview->buffer(), Undo::INSERT,
-#ifndef NEW_INSETS
- cursor.par()->ParFromPos(cursor.pos())->previous_,
- cursor.par()->ParFromPos(cursor.pos())->next_
-#else
cursor.par()->previous(),
- cursor.par()->next()
-#endif
- );
+ cursor.par()->next());
cursor.par()->InsertInset(cursor.pos(), inset);
InsertChar(bview, LyXParagraph::META_INSET); /* just to rebreak and refresh correctly.
* The character will not be inserted a
// OK, we have a selection. This is always between sel_start_cursor
// and sel_end_cursor
-#ifndef NEW_INSETS
- // Check whether there are half footnotes in the selection
- if (sel_start_cursor.par()->footnoteflag != LyXParagraph::NO_FOOTNOTE
- || sel_end_cursor.par()->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
- LyXParagraph * tmppar = sel_start_cursor.par();
- while (tmppar != sel_end_cursor.par()){
- if (tmppar->footnoteflag != sel_end_cursor.par()->footnoteflag) {
- WriteAlert(_("Impossible operation"),
- _("Don't know what to do with half floats."),
- _("sorry."));
- return;
- }
- tmppar = tmppar->next();
- }
- }
-#endif
// make sure that the depth behind the selection are restored, too
-#ifndef NEW_INSETS
- LyXParagraph * endpar = sel_end_cursor.par()->LastPhysicalPar()->next();
-#else
LyXParagraph * endpar = sel_end_cursor.par()->next();
-#endif
LyXParagraph * undoendpar = endpar;
if (endpar && endpar->GetDepth()) {
while (endpar && endpar->GetDepth()) {
-#ifndef NEW_INSETS
- endpar = endpar->LastPhysicalPar()->next();
-#else
endpar = endpar->next();
-#endif
undoendpar = endpar;
}
} else if (endpar) {
}
SetUndo(bview->buffer(), Undo::DELETE,
-#ifndef NEW_INSETS
- sel_start_cursor
- .par()->ParFromPos(sel_start_cursor.pos())->previous_,
-#else
sel_start_cursor.par()->previous(),
-#endif
undoendpar);
CutAndPaste cap;
// there are two cases: cut only within one paragraph or
// more than one paragraph
-#ifndef NEW_INSETS
- if (sel_start_cursor.par()->ParFromPos(sel_start_cursor.pos())
- == sel_end_cursor.par()->ParFromPos(sel_end_cursor.pos()))
-#else
- if (sel_start_cursor.par() == sel_end_cursor.par())
-#endif
- {
+ if (sel_start_cursor.par() == sel_end_cursor.par()) {
// only within one paragraph
endpar = sel_start_cursor.par();
int pos = sel_end_cursor.pos();
// ok we have a selection. This is always between sel_start_cursor
// and sel_end cursor
-#ifndef NEW_INSETS
- /* check wether there are half footnotes in the selection */
- if (sel_start_cursor.par()->footnoteflag != LyXParagraph::NO_FOOTNOTE
- || sel_end_cursor.par()->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
- LyXParagraph * tmppar = sel_start_cursor.par();
- while (tmppar != sel_end_cursor.par()) {
- if (tmppar->footnoteflag !=
- sel_end_cursor.par()->footnoteflag) {
- WriteAlert(_("Impossible operation"),
- _("Don't know what to do"
- " with half floats."),
- _("sorry."));
- return;
- }
- tmppar = tmppar->next();
- }
- }
-#endif
-
// copy behind a space if there is one
-#ifndef NEW_INSETS
- while (sel_start_cursor.par()->Last() > sel_start_cursor.pos()
-#else
while (sel_start_cursor.par()->size() > sel_start_cursor.pos()
-#endif
&& sel_start_cursor.par()->IsLineSeparator(sel_start_cursor.pos())
&& (sel_start_cursor.par() != sel_end_cursor.par()
|| sel_start_cursor.pos() < sel_end_cursor.pos()))
return;
SetUndo(bview->buffer(), Undo::INSERT,
-#ifndef NEW_INSETS
- cursor.par()->ParFromPos(cursor.pos())->previous_,
- cursor.par()->ParFromPos(cursor.pos())->next_
-#else
cursor.par()->previous(),
- cursor.par()->next()
-#endif
- );
+ cursor.par()->next());
LyXParagraph * endpar;
LyXParagraph * actpar = cursor.par();
int pos = cursor.pos();
- cap.pasteSelection(&actpar, &endpar, pos, bview->buffer()->params.textclass);
+ cap.pasteSelection(&actpar, &endpar, pos,
+ bview->buffer()->params.textclass);
RedoParagraphs(bview, cursor, endpar);
LyXCursor res = cursor;
Inset * inset;
do {
-#ifndef NEW_INSETS
- if (res.pos() < res.par()->Last() - 1) {
-#else
if (res.pos() < res.par()->size() - 1) {
-#endif
res.pos(res.pos() + 1);
} else {
res.par(res.par()->next());
LyXParagraph * par = FirstParagraph();
do {
-#ifndef NEW_INSETS
- // make sure the paragraph is open
- if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
-#endif
pos = par->GetPositionOfInset(inset);
if (pos != -1){
CheckParagraph(bview, par, pos);
return true;
}
-#ifndef NEW_INSETS
- }
-#endif
par = par->next();
} while (par);
void LyXText::SetCursor(BufferView *bview, LyXCursor & cur, LyXParagraph * par,
LyXParagraph::size_type pos, bool boundary) const
{
-#ifndef NEW_INSETS
- // correct the cursor position if impossible
- if (pos > par->Last()){
- LyXParagraph * tmppar = par->ParFromPos(pos);
- pos = par->PositionInParFromPos(pos);
- par = tmppar;
- }
- if (par->IsDummy() && par->previous_ &&
- par->previous_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
- while (par->previous_ &&
- ((par->previous_->IsDummy() &&
- (par->previous_->previous_->footnoteflag ==
- LyXParagraph::CLOSED_FOOTNOTE)) ||
- (par->previous_->footnoteflag ==
- LyXParagraph::CLOSED_FOOTNOTE))) {
- par = par->previous_;
- if (par->IsDummy() &&
- (par->previous_->footnoteflag ==
- LyXParagraph::CLOSED_FOOTNOTE))
- pos += par->size() + 1;
- }
- if (par->previous_) {
- par = par->previous_;
- }
- pos += par->size() + 1;
- }
-#endif
cur.par(par);
cur.pos(pos);
cur.boundary(boundary);
--pos;
if (pos > 0) {
-#ifndef NEW_INSETS
- if (pos == cursor.par()->Last())
-#else
if (pos == cursor.par()->size())
-#endif
--pos;
else if (cursor.par()->IsSeparator(pos)) {
if (pos > cursor.row()->pos() &&
bidi_level(pos) % 2 ==
bidi_level(pos - 1) % 2)
--pos;
-#ifndef NEW_INSETS
- else if (pos + 1 < cursor.par()->Last())
-#else
else if (pos + 1 < cursor.par()->size())
-#endif
++pos;
}
}
cursor.par()->GetFontSettings(bview->buffer()->params, pos);
real_current_font = GetFont(bview->buffer(), cursor.par(), pos);
-#ifndef NEW_INSETS
- if (cursor.pos() == cursor.par()->Last() &&
-#else
if (cursor.pos() == cursor.par()->size() &&
-#endif
IsBoundary(bview->buffer(), cursor.par(), cursor.pos()) &&
!cursor.boundary()) {
Language const * lang =
SetCursor(bview, cursor.par(), cursor.pos() + 1, true, true);
} else if (cursor.par()->previous()) { // steps into the above paragraph.
LyXParagraph * par = cursor.par()->previous();
-#ifndef NEW_INSETS
- SetCursor(bview, par, par->Last());
-#else
SetCursor(bview, par, par->size());
-#endif
}
}
if (!internal && cursor.boundary() &&
!cursor.par()->IsNewline(cursor.pos()))
SetCursor(bview, cursor.par(), cursor.pos(), true, false);
-#ifndef NEW_INSETS
- else if (cursor.pos() < cursor.par()->Last()) {
-#else
else if (cursor.pos() < cursor.par()->size()) {
-#endif
SetCursor(bview, cursor.par(), cursor.pos() + 1, true, false);
if (!internal &&
IsBoundary(bview->buffer(), cursor.par(), cursor.pos()))
if (cursor.par()->next()) {
SetCursor(bview, cursor.par()->next(), 0);
} else {
-#ifndef NEW_INSETS
- SetCursor(bview, cursor.par(), cursor.par()->Last());
-#else
SetCursor(bview, cursor.par(), cursor.par()->size());
-#endif
}
}
// Only if the cursor has really moved
if (old_cursor.pos() > 0
-#ifndef NEW_INSETS
- && old_cursor.pos() < old_cursor.par()->Last()
-#else
&& old_cursor.pos() < old_cursor.par()->size()
-#endif
&& old_cursor.par()->IsLineSeparator(old_cursor.pos())
&& old_cursor.par()->IsLineSeparator(old_cursor.pos() - 1)) {
old_cursor.par()->Erase(old_cursor.pos() - 1);
LyXCursor tmpcursor;
-#ifndef NEW_INSETS
- if (old_cursor.par() != cursor.par()) {
- if ((old_cursor.par()->Last() == 0
- || (old_cursor.par()->Last() == 1
- && old_cursor.par()->IsLineSeparator(0)))
- && old_cursor.par()->FirstPhysicalPar()
- == old_cursor.par()->LastPhysicalPar()
-#else
if (old_cursor.par() != cursor.par()) {
if ((old_cursor.par()->size() == 0
|| (old_cursor.par()->size() == 1
- && old_cursor.par()->IsLineSeparator(0)))
-#endif
- ) {
+ && old_cursor.par()->IsLineSeparator(0)))) {
// ok, we will delete anything
// make sure that you do not delete any environments
-#ifndef NEW_INSETS
- if ((
- old_cursor.par()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE &&
- !(old_cursor.row()->previous()
- && old_cursor.row()->previous()->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)
- && !(old_cursor.row()->next()
- && old_cursor.row()->next()->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE))
- || (old_cursor.par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
- && ((old_cursor.row()->previous()
- && old_cursor.row()->previous()->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)
- || (old_cursor.row()->next()
- && old_cursor.row()->next()->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE))
- )) {
-#endif
status = LyXText::NEED_MORE_REFRESH;
deleted = true;
refresh_y = old_cursor.y() - old_cursor.row()->baseline() - refresh_row->height();
tmpcursor = cursor;
cursor = old_cursor; // that undo can restore the right cursor position
-#ifndef NEW_INSETS
- LyXParagraph * endpar = old_cursor.par()->next_;
- if (endpar && endpar->GetDepth()) {
- while (endpar && endpar->GetDepth()) {
- endpar = endpar->LastPhysicalPar()->next();
- }
- }
- SetUndo(bview->buffer(), Undo::DELETE,
- old_cursor.par()->previous_,
- endpar);
- cursor = tmpcursor;
-
- // delete old row
- RemoveRow(old_cursor.row());
- if (OwnerParagraph() == old_cursor.par()) {
- OwnerParagraph(OwnerParagraph()->next_);
- }
-#else
LyXParagraph * endpar = old_cursor.par()->next();
if (endpar && endpar->GetDepth()) {
while (endpar && endpar->GetDepth()) {
if (OwnerParagraph() == old_cursor.par()) {
OwnerParagraph(OwnerParagraph()->next());
}
-#endif
// delete old par
delete old_cursor.par();
tmpcursor = cursor;
cursor = old_cursor; // that undo can restore the right cursor position
-#ifndef NEW_INSETS
- LyXParagraph * endpar = old_cursor.par()->next_;
- if (endpar && endpar->GetDepth()) {
- while (endpar && endpar->GetDepth()) {
- endpar = endpar->LastPhysicalPar()->next();
- }
- }
- SetUndo(bview->buffer(), Undo::DELETE,
- old_cursor.par()->previous_,
- endpar);
- cursor = tmpcursor;
-
- // delete old row
- RemoveRow(old_cursor.row());
- // delete old par
- if (OwnerParagraph() == old_cursor.par()) {
- OwnerParagraph(OwnerParagraph()->next_);
- }
-#else
LyXParagraph * endpar = old_cursor.par()->next();
if (endpar && endpar->GetDepth()) {
while (endpar && endpar->GetDepth()) {
if (OwnerParagraph() == old_cursor.par()) {
OwnerParagraph(OwnerParagraph()->next());
}
-#endif
+
delete old_cursor.par();
/* Breakagain the next par. Needed
// correct selection
sel_cursor = cursor;
}
-#ifndef NEW_INSETS
- }
-#endif
}
if (!deleted) {
if (old_cursor.par()->StripLeadingSpaces(bview->buffer()->params.textclass)) {
}
-#ifndef NEW_INSETS
-LyXParagraph * LyXText::GetParFromID(int id)
-{
- LyXParagraph * result = FirstParagraph();
- while (result && result->id() != id)
- result = result->next_;
- return result;
-}
-#else
LyXParagraph * LyXText::GetParFromID(int id)
{
LyXParagraph * result = FirstParagraph();
result = result->next();
return result;
}
-#endif
// undo functions
LyXParagraph * tmppar3 = undo->par;
undo->par = 0; // otherwise the undo destructor would delete the paragraph
LyXParagraph * tmppar4 = tmppar3;
-#ifndef NEW_INSETS
- if (tmppar4) {
- while (tmppar4->next_)
- tmppar4 = tmppar4->next_;
- } // get last undo par
-
- // now remove the old text if there is any
- if (before != behind || (!behind && !before)) {
- if (before)
- tmppar5 = before->next();
- else
- tmppar5 = OwnerParagraph();
- tmppar2 = tmppar3;
- while (tmppar5 && tmppar5 != behind) {
- tmppar = tmppar5;
- tmppar5 = tmppar5->next();
- // a memory optimization for edit: Only layout information
- // is stored in the undo. So restore the text informations.
- if (undo->kind == Undo::EDIT) {
- tmppar2->setContentsFromPar(tmppar);
- tmppar->clearContents();
- tmppar2 = tmppar2->next();
- }
- }
- }
-
-#else
+
if (tmppar4) {
while (tmppar4->next())
tmppar4 = tmppar4->next();
}
}
-#endif
// put the new stuff in the list if there is one
if (tmppar3){
if (before)
// Set the cursor for redoing
if (before) {
-#ifndef NEW_INSETS
- SetCursorIntern(bview, before->FirstSelfrowPar(), 0);
-#else
SetCursorIntern(bview, before, 0);
-#endif
-#ifndef NEW_INSETS
- // check wether before points to a closed float and open it if necessary
- if (before && before->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE
- && before->next_ && before->next_->footnoteflag != LyXParagraph::NO_FOOTNOTE){
- tmppar4 = before;
- while (tmppar4->previous_ &&
- tmppar4->previous_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
- tmppar4 = tmppar4->previous_;
- while (tmppar4 && tmppar4->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE){
- tmppar4->footnoteflag = LyXParagraph::OPEN_FOOTNOTE;
- tmppar4 = tmppar4->next_;
- }
- }
-#endif
}
-#ifndef NEW_INSETS
- // open a cosed footnote at the end if necessary
- if (behind && behind->previous_ &&
- behind->previous_->footnoteflag != LyXParagraph::NO_FOOTNOTE &&
- behind->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE){
- while (behind && behind->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE){
- behind->footnoteflag = LyXParagraph::OPEN_FOOTNOTE;
- behind = behind->next_;
- }
- }
-#endif
-
// calculate the endpar for redoing the paragraphs.
if (behind) {
-#ifndef NEW_INSETS
- if (behind->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
- endpar = behind->LastPhysicalPar()->next();
- else
- endpar = behind->NextAfterFootnote()->LastPhysicalPar()->next();
-#else
endpar = behind->next();
-#endif
} else
endpar = behind;
LyXParagraph * start = 0;
LyXParagraph * end = 0;
-#ifndef NEW_INSETS
- if (before)
- start = before->next_;
- else
- start = FirstParagraph();
- if (behind)
- end = behind->previous_;
- else {
- end = FirstParagraph();
- while (end->next_)
- end = end->next_;
- }
- if (start && end && (start != end->next_) &&
- ((before != behind) || (!before && !behind))) {
- tmppar = start;
- tmppar2 = tmppar->Clone();
- tmppar2->id(tmppar->id());
-
- // a memory optimization: Just store the layout information
- // when only edit
- if (kind == Undo::EDIT){
- //tmppar2->text.clear();
- tmppar2->clearContents();
- }
-
- undopar = tmppar2;
-
- while (tmppar != end && tmppar->next_) {
- tmppar = tmppar->next_;
- tmppar2->next(tmppar->Clone());
- tmppar2->next_->id(tmppar->id());
- // a memory optimization: Just store the layout
- // information when only edit
- if (kind == Undo::EDIT){
- //tmppar2->next->text.clear();
- tmppar2->clearContents();
- }
- tmppar2->next_->previous(tmppar2);
- tmppar2 = tmppar2->next_;
- }
- tmppar2->next(0);
- } else
- undopar = 0; // nothing to replace (undo of delete maybe)
-
- int cursor_par = cursor.par()->ParFromPos(cursor.pos())->id();
- int cursor_pos = cursor.par()->PositionInParFromPos(cursor.pos());
-#else
if (before)
start = const_cast<LyXParagraph*>(before->next());
else
int cursor_par = cursor.par()->id();
int cursor_pos = cursor.pos();
-#endif
Undo * undo = new Undo(kind,
before_number, behind_number,
if (inset_owner)
return;
SetUndo(buf, Undo::FINISH,
-#ifndef NEW_INSETS
- cursor.par()->ParFromPos(cursor.pos())->previous_,
- cursor.par()->ParFromPos(cursor.pos())->next_
-#else
cursor.par()->previous(),
- cursor.par()->next()
-#endif
- );
+ cursor.par()->next());
}
void LyXText::toggleAppendix(BufferView * bview)
{
-#ifndef NEW_INSETS
- LyXParagraph * par = cursor.par()->FirstPhysicalPar();
-#else
LyXParagraph * par = cursor.par();
-#endif
bool start = !par->params.startOfAppendix();
// ensure that we have only one start_of_appendix in this document
LyXParagraph * tmp = FirstParagraph();
-#ifndef NEW_INSETS
- for (; tmp; tmp = tmp->next_)
- tmp->params.startOfAppendix(false);
-#else
for (; tmp; tmp = tmp->next())
tmp->params.startOfAppendix(false);
-#endif
+
par->params.startOfAppendix(start);
// we can set the refreshing parameters now
}
-#ifndef NEW_INSETS
-Undo::~Undo()
-{
- LyXParagraph * tmppar;
- while (par) {
- tmppar = par;
- par = par->next_;
- delete tmppar;
- }
-}
-#else
Undo::~Undo()
{
LyXParagraph * tmppar;
delete tmppar;
}
}
-#endif
UndoStack::UndoStack()