mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 13:04:58 +00:00
* replace int type by the correct custom type for pos, idx and size.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21336 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b5a640d1cc
commit
565475a439
@ -78,7 +78,7 @@ void MacroData::expand(vector<MathData> const & args, MathData & to) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int MacroData::optionals() const
|
size_t MacroData::optionals() const
|
||||||
{
|
{
|
||||||
return optionals_;
|
return optionals_;
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,11 @@ public:
|
|||||||
///
|
///
|
||||||
docstring const & display() const { return display_; }
|
docstring const & display() const { return display_; }
|
||||||
/// arity including optional arguments (if there is any)
|
/// arity including optional arguments (if there is any)
|
||||||
int numargs() const { return numargs_; }
|
size_t numargs() const { return numargs_; }
|
||||||
/// replace #1,#2,... by given MathAtom 0,1,.., _including_ the possible optional argument
|
/// replace #1,#2,... by given MathAtom 0,1,.., _including_ the possible optional argument
|
||||||
void expand(std::vector<MathData> const & from, MathData & to) const;
|
void expand(std::vector<MathData> const & from, MathData & to) const;
|
||||||
/// number of optional arguments
|
/// number of optional arguments
|
||||||
int optionals() const;
|
size_t optionals() const;
|
||||||
///
|
///
|
||||||
std::vector<docstring> const & defaults() const;
|
std::vector<docstring> const & defaults() const;
|
||||||
///
|
///
|
||||||
@ -80,7 +80,7 @@ private:
|
|||||||
///
|
///
|
||||||
docstring definition_;
|
docstring definition_;
|
||||||
///
|
///
|
||||||
int numargs_;
|
size_t numargs_;
|
||||||
///
|
///
|
||||||
docstring display_;
|
docstring display_;
|
||||||
///
|
///
|
||||||
@ -90,7 +90,7 @@ private:
|
|||||||
///
|
///
|
||||||
bool redefinition_;
|
bool redefinition_;
|
||||||
///
|
///
|
||||||
int optionals_;
|
size_t optionals_;
|
||||||
///
|
///
|
||||||
std::vector<docstring> defaults_;
|
std::vector<docstring> defaults_;
|
||||||
};
|
};
|
||||||
|
@ -337,7 +337,7 @@ void MathData::updateMacros(MetricsInfo & mi)
|
|||||||
// get macro
|
// get macro
|
||||||
macroInset->updateMacro(mi);
|
macroInset->updateMacro(mi);
|
||||||
size_t macroNumArgs = 0;
|
size_t macroNumArgs = 0;
|
||||||
int macroOptionals = 0;
|
size_t macroOptionals = 0;
|
||||||
MacroData const * macro = macroInset->macro();
|
MacroData const * macro = macroInset->macro();
|
||||||
if (macro) {
|
if (macro) {
|
||||||
macroNumArgs = macro->numargs();
|
macroNumArgs = macro->numargs();
|
||||||
@ -416,8 +416,8 @@ void MathData::detachMacroParameters(Cursor & cur, const size_type macroPos)
|
|||||||
|
|
||||||
// find cursor slice
|
// find cursor slice
|
||||||
int curMacroSlice = cur.find(macroInset);
|
int curMacroSlice = cur.find(macroInset);
|
||||||
int curMacroIdx = -1;
|
idx_type curMacroIdx = -1;
|
||||||
int curMacroPos = -1;
|
pos_type curMacroPos = -1;
|
||||||
std::vector<CursorSlice> argSlices;
|
std::vector<CursorSlice> argSlices;
|
||||||
if (curMacroSlice != -1) {
|
if (curMacroSlice != -1) {
|
||||||
curMacroPos = cur[curMacroSlice].pos();
|
curMacroPos = cur[curMacroSlice].pos();
|
||||||
@ -434,7 +434,7 @@ void MathData::detachMacroParameters(Cursor & cur, const size_type macroPos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// optional arguments to be put back?
|
// optional arguments to be put back?
|
||||||
size_t p = macroPos + 1;
|
pos_type p = macroPos + 1;
|
||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
for (; j < detachedArgs.size() && j < macroInset->optionals(); ++j) {
|
for (; j < detachedArgs.size() && j < macroInset->optionals(); ++j) {
|
||||||
// another non-empty parameter follows?
|
// another non-empty parameter follows?
|
||||||
@ -495,7 +495,7 @@ void MathData::detachMacroParameters(Cursor & cur, const size_type macroPos)
|
|||||||
insert(p, MathAtom(new InsetMathBrace(arg)));
|
insert(p, MathAtom(new InsetMathBrace(arg)));
|
||||||
|
|
||||||
// cursor in j-th argument of macro?
|
// cursor in j-th argument of macro?
|
||||||
if (curMacroIdx == int(j)) {
|
if (curMacroIdx == j) {
|
||||||
if (operator[](p).nucleus()->asBraceInset()) {
|
if (operator[](p).nucleus()->asBraceInset()) {
|
||||||
cur[curMacroSlice - 1].pos() = p;
|
cur[curMacroSlice - 1].pos() = p;
|
||||||
cur.append(0, curMacroPos);
|
cur.append(0, curMacroPos);
|
||||||
|
@ -320,7 +320,7 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// another argument selected?
|
// another argument selected?
|
||||||
int curIdx = cursorIdx(pi.base.bv->cursor());
|
idx_type curIdx = cursorIdx(pi.base.bv->cursor());
|
||||||
if (previousCurIdx_ != curIdx || editing_ != editMode(pi.base.bv->cursor()))
|
if (previousCurIdx_ != curIdx || editing_ != editMode(pi.base.bv->cursor()))
|
||||||
pi.base.bv->cursor().updateFlags(Update::Force);
|
pi.base.bv->cursor().updateFlags(Update::Force);
|
||||||
}
|
}
|
||||||
@ -414,13 +414,13 @@ Inset * MathMacro::editXY(Cursor & cur, int x, int y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathMacro::removeArgument(size_t pos) {
|
void MathMacro::removeArgument(Inset::pos_type pos) {
|
||||||
if (displayMode_ == DISPLAY_NORMAL) {
|
if (displayMode_ == DISPLAY_NORMAL) {
|
||||||
BOOST_ASSERT(pos >= 0 && pos < cells_.size());
|
BOOST_ASSERT(size_t(pos) < cells_.size());
|
||||||
cells_.erase(cells_.begin() + pos);
|
cells_.erase(cells_.begin() + pos);
|
||||||
if (pos < attachedArgsNum_)
|
if (size_t(pos) < attachedArgsNum_)
|
||||||
--attachedArgsNum_;
|
--attachedArgsNum_;
|
||||||
if (pos < optionals_) {
|
if (size_t(pos) < optionals_) {
|
||||||
--optionals_;
|
--optionals_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,13 +429,13 @@ void MathMacro::removeArgument(size_t pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathMacro::insertArgument(size_t pos) {
|
void MathMacro::insertArgument(Inset::pos_type pos) {
|
||||||
if (displayMode_ == DISPLAY_NORMAL) {
|
if (displayMode_ == DISPLAY_NORMAL) {
|
||||||
BOOST_ASSERT(pos >= 0 && pos <= cells_.size());
|
BOOST_ASSERT(size_t(pos) <= cells_.size());
|
||||||
cells_.insert(cells_.begin() + pos, MathData());
|
cells_.insert(cells_.begin() + pos, MathData());
|
||||||
if (pos < attachedArgsNum_)
|
if (size_t(pos) < attachedArgsNum_)
|
||||||
++attachedArgsNum_;
|
++attachedArgsNum_;
|
||||||
if (pos < optionals_)
|
if (size_t(pos) < optionals_)
|
||||||
++optionals_;
|
++optionals_;
|
||||||
|
|
||||||
needsUpdate_ = true;
|
needsUpdate_ = true;
|
||||||
@ -529,7 +529,7 @@ void MathMacro::write(WriteStream & os) const
|
|||||||
|
|
||||||
os << "\\" << name();
|
os << "\\" << name();
|
||||||
bool first = true;
|
bool first = true;
|
||||||
size_t i = 0;
|
idx_type i = 0;
|
||||||
|
|
||||||
// Use macroBackup_ instead of macro_ here, because
|
// Use macroBackup_ instead of macro_ here, because
|
||||||
// this is outside the metrics/draw calls, hence the macro_
|
// this is outside the metrics/draw calls, hence the macro_
|
||||||
|
@ -58,9 +58,9 @@ public:
|
|||||||
virtual bool notifyCursorLeaves(Cursor &);
|
virtual bool notifyCursorLeaves(Cursor &);
|
||||||
|
|
||||||
/// Remove cell (starting from 0)
|
/// Remove cell (starting from 0)
|
||||||
void removeArgument(size_t pos);
|
void removeArgument(pos_type pos);
|
||||||
/// Insert empty cell (starting from 0)
|
/// Insert empty cell (starting from 0)
|
||||||
void insertArgument(size_t pos);
|
void insertArgument(pos_type pos);
|
||||||
|
|
||||||
///
|
///
|
||||||
void validate(LaTeXFeatures &) const;
|
void validate(LaTeXFeatures &) const;
|
||||||
@ -112,7 +112,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
int optionals() const { return optionals_; }
|
size_t optionals() const { return optionals_; }
|
||||||
///
|
///
|
||||||
void setOptionals(int n) {
|
void setOptionals(int n) {
|
||||||
if (n <= int(nargs()))
|
if (n <= int(nargs()))
|
||||||
@ -160,9 +160,9 @@ private:
|
|||||||
/// number of arguments that were really attached
|
/// number of arguments that were really attached
|
||||||
size_t attachedArgsNum_;
|
size_t attachedArgsNum_;
|
||||||
/// cursor position during last draw
|
/// cursor position during last draw
|
||||||
int previousCurIdx_;
|
idx_type previousCurIdx_;
|
||||||
/// optional argument attached? (only in DISPLAY_NORMAL mode)
|
/// optional argument attached? (only in DISPLAY_NORMAL mode)
|
||||||
int optionals_;
|
size_t optionals_;
|
||||||
/// fold mode to be set in next metrics call?
|
/// fold mode to be set in next metrics call?
|
||||||
bool nextFoldMode_;
|
bool nextFoldMode_;
|
||||||
/// if macro_ == true, then here is a copy of the macro
|
/// if macro_ == true, then here is a copy of the macro
|
||||||
|
@ -89,11 +89,11 @@ private:
|
|||||||
///
|
///
|
||||||
void makeNonOptional(Cursor & cur);
|
void makeNonOptional(Cursor & cur);
|
||||||
///
|
///
|
||||||
pos_type defIdx() const { return optionals_ + 1; }
|
idx_type defIdx() const { return optionals_ + 1; }
|
||||||
/// index of default value cell of optional parameter (#1 -> n=0)
|
/// index of default value cell of optional parameter (#1 -> n=0)
|
||||||
pos_type optIdx(int n) const { return n + 1; }
|
idx_type optIdx(idx_type n) const { return n + 1; }
|
||||||
///
|
///
|
||||||
pos_type displayIdx() const { return optionals_ + 2; }
|
idx_type displayIdx() const { return optionals_ + 2; }
|
||||||
/// The label with some holes to edit
|
/// The label with some holes to edit
|
||||||
mutable MathData label_;
|
mutable MathData label_;
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user