mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 21:05:12 +00:00
remove NO_STD_LIST stuff, and some other small changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7063 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0d90321817
commit
83e37d57dd
@ -1,5 +1,21 @@
|
||||
2003-05-29 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* trans_mgr.C: remove one case of current_view
|
||||
|
||||
* text2.C (cursorBottom): delete NO_STD_LIST stuff
|
||||
|
||||
* paragraph_funcs.h: remove paragraph.h include
|
||||
|
||||
* paragraph.h: delete NO_STD_LIST stuff
|
||||
|
||||
* paragraph.C (Paragraph): delete NO_STD_LIST stuff
|
||||
|
||||
* buffer.h: remove paragraph.h include
|
||||
|
||||
* ParagraphList.C: delete file
|
||||
|
||||
* Makefile.am (lyx_SOURCES): remove ParagraphList.C
|
||||
|
||||
* toc.C (getTocList): adjust
|
||||
|
||||
* paragraph_pimpl.C (validate): adjust
|
||||
|
@ -79,7 +79,6 @@ lyx_SOURCES = \
|
||||
MenuBackend.h \
|
||||
paragraph_funcs.C \
|
||||
paragraph_funcs.h \
|
||||
ParagraphList.C \
|
||||
ParagraphList.h \
|
||||
ParagraphParameters.C \
|
||||
ParagraphParameters.h \
|
||||
|
@ -1,392 +0,0 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "ParagraphList.h"
|
||||
|
||||
#include "paragraph.h"
|
||||
|
||||
#ifdef NO_STD_LIST
|
||||
|
||||
////////// The ParagraphList::iterator
|
||||
|
||||
ParagraphList::iterator::iterator()
|
||||
: ptr(0)
|
||||
{}
|
||||
|
||||
|
||||
ParagraphList::iterator::iterator(Paragraph * p)
|
||||
: ptr(p)
|
||||
{}
|
||||
|
||||
|
||||
ParagraphList::iterator::reference
|
||||
ParagraphList::iterator::operator*()
|
||||
{
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::iterator::pointer
|
||||
ParagraphList::iterator::operator->()
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::iterator &
|
||||
ParagraphList::iterator::operator++()
|
||||
{
|
||||
ptr = ptr->next_par_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::iterator
|
||||
ParagraphList::iterator::operator++(int)
|
||||
{
|
||||
iterator tmp = *this;
|
||||
++*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::iterator &
|
||||
ParagraphList::iterator::operator--()
|
||||
{
|
||||
ptr = ptr->prev_par_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::iterator
|
||||
ParagraphList::iterator::operator--(int)
|
||||
{
|
||||
iterator tmp = *this;
|
||||
--*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
bool operator==(ParagraphList::iterator const & i1,
|
||||
ParagraphList::iterator const & i2)
|
||||
{
|
||||
return &(*const_cast<ParagraphList::iterator&>(i1))
|
||||
== &(*const_cast<ParagraphList::iterator&>(i2));
|
||||
}
|
||||
|
||||
|
||||
bool operator!=(ParagraphList::iterator const & i1,
|
||||
ParagraphList::iterator const & i2)
|
||||
{
|
||||
return !(i1 == i2);
|
||||
}
|
||||
|
||||
////////// The ParagraphList::const_iterator
|
||||
|
||||
ParagraphList::const_iterator::const_iterator()
|
||||
: ptr(0)
|
||||
{}
|
||||
|
||||
|
||||
ParagraphList::const_iterator::const_iterator(Paragraph * p)
|
||||
: ptr(p)
|
||||
{}
|
||||
|
||||
|
||||
ParagraphList::const_iterator::const_reference
|
||||
ParagraphList::const_iterator::operator*()
|
||||
{
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::const_iterator::const_pointer
|
||||
ParagraphList::const_iterator::operator->()
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::const_iterator &
|
||||
ParagraphList::const_iterator::operator++()
|
||||
{
|
||||
ptr = ptr->next_par_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::const_iterator
|
||||
ParagraphList::const_iterator::operator++(int)
|
||||
{
|
||||
const_iterator tmp = *this;
|
||||
++*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::const_iterator &
|
||||
ParagraphList::const_iterator::operator--()
|
||||
{
|
||||
ptr = ptr->prev_par_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::const_iterator
|
||||
ParagraphList::const_iterator::operator--(int)
|
||||
{
|
||||
const_iterator tmp = *this;
|
||||
--*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
bool operator==(ParagraphList::const_iterator const & i1,
|
||||
ParagraphList::const_iterator const & i2)
|
||||
{
|
||||
return &(*const_cast<ParagraphList::const_iterator&>(i1))
|
||||
== &(*const_cast<ParagraphList::const_iterator&>(i2));
|
||||
}
|
||||
|
||||
|
||||
bool operator!=(ParagraphList::const_iterator const & i1,
|
||||
ParagraphList::const_iterator const & i2)
|
||||
{
|
||||
return !(i1 == i2);
|
||||
}
|
||||
|
||||
//////////
|
||||
////////// The ParagraphList proper
|
||||
//////////
|
||||
|
||||
ParagraphList::ParagraphList()
|
||||
: parlist(0)
|
||||
{}
|
||||
|
||||
|
||||
ParagraphList::ParagraphList(ParagraphList const & pl)
|
||||
: parlist(0)
|
||||
{
|
||||
// Deep copy.
|
||||
ParagraphList::const_iterator it = pl.begin();
|
||||
ParagraphList::const_iterator end = pl.end();
|
||||
for (; it != end; ++it) {
|
||||
push_back(*it);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ParagraphList & ParagraphList::operator=(ParagraphList const & rhs)
|
||||
{
|
||||
ParagraphList tmp(rhs);
|
||||
std::swap(parlist, tmp.parlist);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::iterator
|
||||
ParagraphList::insert(ParagraphList::iterator it, Paragraph const & p)
|
||||
{
|
||||
Paragraph * par = new Paragraph(p);
|
||||
|
||||
if (it != end()) {
|
||||
Paragraph * prev = it->prev_par_;
|
||||
par->next_par_ = &*it;
|
||||
par->prev_par_ = prev;
|
||||
prev->next_par_ = par;
|
||||
it->prev_par_= par;
|
||||
} else if (parlist == 0) {
|
||||
parlist = par;
|
||||
} else {
|
||||
// Find last par.
|
||||
Paragraph * last = parlist;
|
||||
while (last->next_par_)
|
||||
last = last->next_par_;
|
||||
last->next_par_ = par;
|
||||
par->prev_par_ = last;
|
||||
}
|
||||
return iterator(par);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ParagraphList::insert(iterator pos, iterator beg, iterator end)
|
||||
{
|
||||
for (; beg != end; ++beg) {
|
||||
insert(pos, *beg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ParagraphList::assign(iterator beg, iterator end)
|
||||
{
|
||||
clear();
|
||||
for (; beg != end; ++beg) {
|
||||
push_back(*beg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ParagraphList::splice(iterator pos, ParagraphList & pl)
|
||||
{
|
||||
if (pl.parlist == 0)
|
||||
return;
|
||||
|
||||
Paragraph * first = pl.parlist;
|
||||
Paragraph * last = first;
|
||||
while (last->next_par_)
|
||||
last = last->next_par_;
|
||||
|
||||
if (pos == end()) {
|
||||
if (parlist == 0) {
|
||||
parlist = first;
|
||||
} else {
|
||||
Paragraph * last_par = &back();
|
||||
last_par->next_par_ = first;
|
||||
first->prev_par_ = last_par;
|
||||
}
|
||||
} else if (pos == begin()) {
|
||||
last->next_par_ = parlist;
|
||||
parlist->prev_par_ = last;
|
||||
parlist = first;
|
||||
} else {
|
||||
Paragraph * pos_par = &*pos;
|
||||
Paragraph * before_pos = pos_par->prev_par_;
|
||||
|
||||
before_pos->next_par_ = first;
|
||||
first->prev_par_ = before_pos;
|
||||
last->next_par_ = pos_par;
|
||||
pos_par->prev_par_ = last;
|
||||
}
|
||||
pl.parlist = 0;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphList::clear()
|
||||
{
|
||||
while (parlist) {
|
||||
Paragraph * tmp = parlist->next_par_;
|
||||
delete parlist;
|
||||
parlist = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::iterator ParagraphList::erase(ParagraphList::iterator it)
|
||||
{
|
||||
Paragraph * prev = it->prev_par_;
|
||||
Paragraph * next = it->next_par_;
|
||||
|
||||
if (prev)
|
||||
prev->next_par_ = next;
|
||||
else
|
||||
parlist = next;
|
||||
|
||||
if (next)
|
||||
next->prev_par_ = prev;
|
||||
|
||||
delete &*it;
|
||||
return next;
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::iterator ParagraphList::erase(ParagraphList::iterator first,
|
||||
ParagraphList::iterator last)
|
||||
{
|
||||
while (first != last) {
|
||||
erase(first++);
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::iterator ParagraphList::begin()
|
||||
{
|
||||
return iterator(parlist);
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::const_iterator ParagraphList::begin() const
|
||||
{
|
||||
return const_iterator(parlist);
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::iterator ParagraphList::end()
|
||||
{
|
||||
return iterator();
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::const_iterator ParagraphList::end() const
|
||||
{
|
||||
return const_iterator();
|
||||
}
|
||||
|
||||
|
||||
Paragraph const & ParagraphList::front() const
|
||||
{
|
||||
return *parlist;
|
||||
}
|
||||
|
||||
|
||||
Paragraph & ParagraphList::front()
|
||||
{
|
||||
return *parlist;
|
||||
}
|
||||
|
||||
|
||||
Paragraph const & ParagraphList::back() const
|
||||
{
|
||||
Paragraph * tmp = parlist;
|
||||
while (tmp->next_par_)
|
||||
tmp = tmp->next_par_;
|
||||
return *tmp;
|
||||
}
|
||||
|
||||
|
||||
Paragraph & ParagraphList::back()
|
||||
{
|
||||
Paragraph * tmp = parlist;
|
||||
while (tmp->next_par_)
|
||||
tmp = tmp->next_par_;
|
||||
return *tmp;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphList::push_back(Paragraph const & pr)
|
||||
{
|
||||
Paragraph * p = new Paragraph(pr);
|
||||
|
||||
if (!parlist) {
|
||||
parlist = p;
|
||||
return;
|
||||
}
|
||||
|
||||
Paragraph * pos = parlist;
|
||||
while (pos->next_par_)
|
||||
pos = pos->next_par_;
|
||||
pos->next_par_ = p;
|
||||
p->prev_par_ = pos;
|
||||
}
|
||||
|
||||
|
||||
int ParagraphList::size() const
|
||||
{
|
||||
// When we switch to a std::container this will be O(1)
|
||||
// instead of O(n). (Lgb)
|
||||
Paragraph * tmp = parlist;
|
||||
int c = 0;
|
||||
while (tmp) {
|
||||
++c;
|
||||
tmp = tmp->next_par_;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
bool ParagraphList::empty() const
|
||||
{
|
||||
return parlist == 0;
|
||||
}
|
||||
|
||||
#endif
|
@ -20,7 +20,6 @@
|
||||
#include "bufferparams.h"
|
||||
#include "texrow.h"
|
||||
#include "ParagraphList.h"
|
||||
#include "paragraph.h"
|
||||
#include "author.h"
|
||||
#include "iterators.h"
|
||||
|
||||
|
@ -70,10 +70,6 @@ Inset * minibuffer_inset;
|
||||
Paragraph::Paragraph()
|
||||
: pimpl_(new Paragraph::Pimpl(this))
|
||||
{
|
||||
#ifdef NO_STD_LIST
|
||||
next_par_ = 0;
|
||||
prev_par_ = 0;
|
||||
#endif
|
||||
enumdepth = 0;
|
||||
itemdepth = 0;
|
||||
params().clear();
|
||||
@ -85,10 +81,6 @@ Paragraph::Paragraph(Paragraph const & lp)
|
||||
{
|
||||
enumdepth = 0;
|
||||
itemdepth = 0;
|
||||
#ifdef NO_STD_LIST
|
||||
next_par_ = 0;
|
||||
prev_par_ = 0;
|
||||
#endif
|
||||
// this is because of the dummy layout of the paragraphs that
|
||||
// follow footnotes
|
||||
layout_ = lp.layout();
|
||||
|
@ -34,20 +34,9 @@ class ParagraphParameters;
|
||||
class TexRow;
|
||||
class ParagraphList;
|
||||
|
||||
// Define this if you want to try out the new storage container for
|
||||
// paragraphs. (Lgb)
|
||||
// This is non working and far from finished.
|
||||
//#define NO_STD_LIST 1
|
||||
|
||||
/// A Paragraph holds all text, attributes and insets in a text paragraph
|
||||
class Paragraph {
|
||||
public:
|
||||
#ifdef NO_STD_LIST
|
||||
// Remove this whan ParagraphList transition is over. (Lgb)
|
||||
friend class ParagraphList;
|
||||
friend class ParagraphList::iterator;
|
||||
friend class ParagraphList::const_iterator;
|
||||
#endif
|
||||
///
|
||||
enum META_KIND {
|
||||
/// Note that this is 1 right now to avoid
|
||||
@ -182,10 +171,11 @@ public:
|
||||
/// mark whole par as erased
|
||||
void markErased();
|
||||
|
||||
/// Paragraphs can contain "manual labels", for example, Description environment.
|
||||
/// The text for this user-editable label is stored in the paragraph alongside
|
||||
/// the text of the rest of the paragraph (the body). This function returns
|
||||
/// the starting position of the body of the text in the paragraph.
|
||||
/// Paragraphs can contain "manual labels", for example, Description
|
||||
/// environment. The text for this user-editable label is stored in
|
||||
/// the paragraph alongside the text of the rest of the paragraph
|
||||
/// (the body). This function returns the starting position of the
|
||||
/// body of the text in the paragraph.
|
||||
int beginningOfBody() const;
|
||||
|
||||
///
|
||||
@ -304,18 +294,12 @@ public:
|
||||
///
|
||||
InsetList insetlist;
|
||||
///
|
||||
//Counters & counters();
|
||||
///
|
||||
void owningBuffer(Buffer const & b) {
|
||||
buffer_.reset(&b);
|
||||
}
|
||||
private:
|
||||
///
|
||||
LyXLayout_ptr layout_;
|
||||
#ifdef NO_STD_LIST
|
||||
Paragraph * next_par_;
|
||||
Paragraph * prev_par_;
|
||||
#endif
|
||||
///
|
||||
boost::optional<Buffer const *> buffer_;
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
#define PARAGRAPH_FUNCS_H
|
||||
|
||||
#include "ParagraphList.h"
|
||||
#include "paragraph.h"
|
||||
#include "support/types.h"
|
||||
|
||||
class Buffer;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file paragraph_pimpl.h
|
||||
* Copyright 1995-2002 the LyX Team
|
||||
* Copyright 1995-2003 the LyX Team
|
||||
* Read the file COPYING
|
||||
*/
|
||||
|
||||
|
15
src/text2.C
15
src/text2.C
@ -883,18 +883,9 @@ void LyXText::cursorTop()
|
||||
|
||||
void LyXText::cursorBottom()
|
||||
{
|
||||
#warning FIXME
|
||||
// This is how it should be:
|
||||
#ifndef NO_STD_LIST
|
||||
ParagraphList::iterator lastpit = boost::prior(ownerParagraphs().end());
|
||||
#else
|
||||
ParagraphList::iterator lastpit = ownerParagraphs().begin();
|
||||
ParagraphList::iterator end = ownerParagraphs().end();
|
||||
while (boost::next(lastpit) != end)
|
||||
++lastpit;
|
||||
#endif
|
||||
int pos = lastpit->size();
|
||||
setCursor(lastpit, pos);
|
||||
ParagraphList::iterator lastpit =
|
||||
boost::prior(ownerParagraphs().end());
|
||||
setCursor(lastpit, lastpit->size());
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,7 +17,6 @@ using std::pair;
|
||||
|
||||
extern string const DoAccent(string const &, tex_accent);
|
||||
extern string const DoAccent(char, tex_accent);
|
||||
extern BufferView * current_view;
|
||||
|
||||
|
||||
// TransFSMData
|
||||
|
Loading…
Reference in New Issue
Block a user