3 more percents...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10323 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2005-07-18 12:57:08 +00:00
parent 75c0ec1c42
commit 7856f2c683
7 changed files with 24 additions and 71 deletions

View File

@ -1177,7 +1177,7 @@ InsetTabular::idx_type InsetTabular::getNearestCell(int x, int y) const
{
idx_type idx_min = 0;
int dist_min = std::numeric_limits<int>::max();
for (idx_type i = 0; i < nargs(); ++i) {
for (idx_type i = 0, n = nargs(); i != n; ++i) {
if (theCoords.getInsets().has(tabular.getCellInset(i).get())) {
int const d = dist(i, x, y);
if (d < dist_min) {
@ -1795,12 +1795,6 @@ void InsetTabular::getSelection(LCursor & cur,
}
size_t InsetTabular::nargs() const
{
return tabular.getNumberOfCells();
}
LyXText * InsetTabular::getText(int idx) const
{
return size_t(idx) < nargs() ? cell(idx)->getText(0) : 0;

View File

@ -106,7 +106,7 @@ public:
/// Appends \c list with all labels found within this inset.
void getLabelList(Buffer const &, std::vector<std::string> & list) const;
/// number of cells
size_t nargs() const;
size_t nargs() const { return tabular.getNumberOfCells(); }
///
boost::shared_ptr<InsetText const> cell(idx_type) const;
///

View File

@ -406,12 +406,6 @@ void InsetText::setViewCache(BufferView const * bv) const
}
LyXText * InsetText::getText(int i) const
{
return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
}
void InsetText::appendParagraphs(Buffer * buffer, ParagraphList & plist)
{
#ifdef WITH_WARNINGS

View File

@ -100,7 +100,9 @@ public:
/// Appends \c list with all labels found within this inset.
void getLabelList(Buffer const &, std::vector<std::string> & list) const;
///
LyXText * getText(int) const;
LyXText * getText(int i) const {
return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
}
///
bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;

View File

@ -300,20 +300,6 @@ bool Paragraph::insetAllowed(InsetBase_code code)
}
InsetBase * Paragraph::getInset(pos_type pos)
{
BOOST_ASSERT(pos < size());
return insetlist.get(pos);
}
InsetBase const * Paragraph::getInset(pos_type pos) const
{
BOOST_ASSERT(pos < size());
return insetlist.get(pos);
}
// Gets uninstantiated font setting at position.
LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
pos_type pos) const
@ -1466,26 +1452,6 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
}
namespace {
/// return true if the char is a meta-character for an inset
inline
bool IsInsetChar(char c)
{
return (c == Paragraph::META_INSET);
}
} // namespace anon
bool Paragraph::isHfill(pos_type pos) const
{
return isInset(pos)
&& getInset(pos)->lyxCode() == InsetBase::HFILL_CODE;
}
bool Paragraph::isNewline(pos_type pos) const
{
return isInset(pos)
@ -1493,17 +1459,11 @@ bool Paragraph::isNewline(pos_type pos) const
}
bool Paragraph::isSeparator(pos_type pos) const
{
return IsSeparatorChar(getChar(pos));
}
bool Paragraph::isLineSeparator(pos_type pos) const
{
value_type const c = getChar(pos);
return IsLineSeparatorChar(c)
|| (IsInsetChar(c) && getInset(pos) &&
|| (c == Paragraph::META_INSET && getInset(pos) &&
getInset(pos)->isLineSeparator());
}

View File

@ -323,23 +323,27 @@ public:
///
bool insetAllowed(InsetBase_code code);
///
InsetBase * getInset(lyx::pos_type pos);
InsetBase * getInset(lyx::pos_type pos) {
return insetlist.get(pos);
}
///
InsetBase const * getInset(lyx::pos_type pos) const;
///
InsetList insetlist;
InsetBase const * getInset(lyx::pos_type pos) const {
return insetlist.get(pos);
}
///
bool isHfill(lyx::pos_type pos) const;
bool isHfill(lyx::pos_type pos) const {
return isInset(pos)
&& getInset(pos)->lyxCode() == InsetBase::HFILL_CODE;
}
/// hinted by profiler
bool isInset(lyx::pos_type pos) const {
return getChar(pos) == static_cast<value_type>(META_INSET);
}
///
bool isNewline(lyx::pos_type pos) const;
///
bool isSeparator(lyx::pos_type pos) const;
/// return true if the char is a word separator
bool isSeparator(lyx::pos_type pos) const { return getChar(pos) == ' '; }
///
bool isLineSeparator(lyx::pos_type pos) const;
/// True if the character/inset at this point can be part of a word
@ -389,6 +393,11 @@ public:
/// dump some information to lyxerr
void dump() const;
public:
///
InsetList insetlist;
private:
/// cached dimensions of paragraph
Dimension dim_;
@ -405,6 +414,7 @@ private:
/// end of label
lyx::pos_type begin_of_body_;
/// Pimpl away stuff
class Pimpl;
///
friend class Paragraph::Pimpl;

View File

@ -15,13 +15,6 @@
#ifndef TEXTUTILS_H
#define TEXTUTILS_H
/// return true if the char is a word separator
inline
bool IsSeparatorChar(char c)
{
return c == ' ';
}
/// return true if the char is a line separator
inline