Some small counters work

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4936 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-08-11 20:34:20 +00:00
parent 6b224b1217
commit 83f4b0018e
7 changed files with 50 additions and 35 deletions

View File

@ -1,3 +1,16 @@
2002-08-11 Lars Gullik Bjønnes <larsbj@gullik.net>
* paragraph_pimpl.h: remove inclusion of boost/array.hpp, remove
unused class variable counter_,
* paragraph.[Ch] (getFirstCounter): delete unused function
* counters.C: include LAssert.h
(reset): add a new function with no arg, change other version to
not have def. arg and to not allow empty arg.
* text2.C (setCounter): remove empty arg from call to Counters::reset
2002-08-11 John Levon <levon@movementarian.org>
* Makefile.am: add WordLangTuple.h

View File

@ -18,6 +18,7 @@
#include "counters.h"
#include "debug.h"
#include "support/lstrings.h"
#include "support/LAssert.h"
using std::endl;
using std::vector;
@ -198,12 +199,25 @@ void Counters::step(string const & ctr)
}
}
void Counters::reset(string const & match)
void Counters::reset()
{
CounterList::iterator it = counterList.begin();
CounterList::iterator end = counterList.end();
for (; it != end; ++it) {
if (it->first.find(match) != string::npos || match == "")
it->second.reset();
}
}
void Counters::reset(string const & match)
{
lyx::Assert(!match.empty());
CounterList::iterator it = counterList.begin();
CounterList::iterator end = counterList.end();
for (; it != end; ++it) {
if (it->first.find(match) != string::npos)
it->second.reset();
}
}

View File

@ -75,9 +75,10 @@ public:
/// NOTE sub-slaves not zeroed! That happens at slave's
/// first step 0->1. Seems to be sufficient.
void step(string const & ctr);
/// Reset counters matched by match string. Empty string matches
/// all.
void reset(string const & match = string());
/// Reset all counters.
void reset();
/// Reset counters matched by match string.
void reset(string const & match);
/// Copy counters whose name matches match from the &from to
/// the &to array of counters. Empty string matches all.
void copy(Counters & from, Counters & to, string const & match = string());

View File

@ -984,12 +984,6 @@ string const & Paragraph::getLabelstring() const
}
int Paragraph::getFirstCounter(int i) const
{
return pimpl_->counter_[i];
}
// the next two functions are for the manual labels
string const Paragraph::getLabelWidthString() const
{

View File

@ -222,8 +222,6 @@ public:
///
void applyLayout(LyXLayout_ptr const & new_layout);
///
int getFirstCounter(int i) const;
///
void erase(lyx::pos_type pos);
/** the flag determines wether the layout should be copied
*/

View File

@ -20,8 +20,6 @@
#include "ParagraphParameters.h"
#include "counters.h"
#include <boost/array.hpp>
class LyXLayout;
struct Paragraph::Pimpl {
@ -59,8 +57,6 @@ struct Paragraph::Pimpl {
BufferParams const & bparams) const;
///
Inset * inset_owner;
///
boost::array<int, 10> counter_;
/** A font entry covers a range of positions. Notice that the
entries in the list are inserted in random order.
@ -151,7 +147,6 @@ struct Paragraph::Pimpl {
ParagraphParameters params;
///
Counters ctrs;
private:
/// match a string against a particular point in the paragraph
bool isTextAt(string const & str, lyx::pos_type pos) const;

View File

@ -1227,12 +1227,12 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
par->params().appendix(par->previous()->params().appendix());
if (!par->params().appendix() && par->params().startOfAppendix()) {
par->params().appendix(true);
par->counters().reset("");
par->counters().reset();
}
par->enumdepth = par->previous()->enumdepth;
par->itemdepth = par->previous()->itemdepth;
} else {
par->counters().reset("");
par->counters().reset();
par->params().appendix(par->params().startOfAppendix());
par->enumdepth = 0;
par->itemdepth = 0;