}
-int MacroData::optionals() const
+size_t MacroData::optionals() const
{
return optionals_;
}
///
docstring const & display() const { return display_; }
/// 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
void expand(std::vector<MathData> const & from, MathData & to) const;
/// number of optional arguments
- int optionals() const;
+ size_t optionals() const;
///
std::vector<docstring> const & defaults() const;
///
///
docstring definition_;
///
- int numargs_;
+ size_t numargs_;
///
docstring display_;
///
///
bool redefinition_;
///
- int optionals_;
+ size_t optionals_;
///
std::vector<docstring> defaults_;
};
// get macro
macroInset->updateMacro(mi);
size_t macroNumArgs = 0;
- int macroOptionals = 0;
+ size_t macroOptionals = 0;
MacroData const * macro = macroInset->macro();
if (macro) {
macroNumArgs = macro->numargs();
// find cursor slice
int curMacroSlice = cur.find(macroInset);
- int curMacroIdx = -1;
- int curMacroPos = -1;
+ idx_type curMacroIdx = -1;
+ pos_type curMacroPos = -1;
std::vector<CursorSlice> argSlices;
if (curMacroSlice != -1) {
curMacroPos = cur[curMacroSlice].pos();
}
// optional arguments to be put back?
- size_t p = macroPos + 1;
+ pos_type p = macroPos + 1;
size_t j = 0;
for (; j < detachedArgs.size() && j < macroInset->optionals(); ++j) {
// another non-empty parameter follows?
insert(p, MathAtom(new InsetMathBrace(arg)));
// cursor in j-th argument of macro?
- if (curMacroIdx == int(j)) {
+ if (curMacroIdx == j) {
if (operator[](p).nucleus()->asBraceInset()) {
cur[curMacroSlice - 1].pos() = p;
cur.append(0, curMacroPos);
}
// 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()))
pi.base.bv->cursor().updateFlags(Update::Force);
}
}
-void MathMacro::removeArgument(size_t pos) {
+void MathMacro::removeArgument(Inset::pos_type pos) {
if (displayMode_ == DISPLAY_NORMAL) {
- BOOST_ASSERT(pos >= 0 && pos < cells_.size());
+ BOOST_ASSERT(size_t(pos) < cells_.size());
cells_.erase(cells_.begin() + pos);
- if (pos < attachedArgsNum_)
+ if (size_t(pos) < attachedArgsNum_)
--attachedArgsNum_;
- if (pos < optionals_) {
+ if (size_t(pos) < optionals_) {
--optionals_;
}
}
-void MathMacro::insertArgument(size_t pos) {
+void MathMacro::insertArgument(Inset::pos_type pos) {
if (displayMode_ == DISPLAY_NORMAL) {
- BOOST_ASSERT(pos >= 0 && pos <= cells_.size());
+ BOOST_ASSERT(size_t(pos) <= cells_.size());
cells_.insert(cells_.begin() + pos, MathData());
- if (pos < attachedArgsNum_)
+ if (size_t(pos) < attachedArgsNum_)
++attachedArgsNum_;
- if (pos < optionals_)
+ if (size_t(pos) < optionals_)
++optionals_;
needsUpdate_ = true;
os << "\\" << name();
bool first = true;
- size_t i = 0;
+ idx_type i = 0;
// Use macroBackup_ instead of macro_ here, because
// this is outside the metrics/draw calls, hence the macro_
virtual bool notifyCursorLeaves(Cursor &);
/// Remove cell (starting from 0)
- void removeArgument(size_t pos);
+ void removeArgument(pos_type pos);
/// Insert empty cell (starting from 0)
- void insertArgument(size_t pos);
+ void insertArgument(pos_type pos);
///
void validate(LaTeXFeatures &) const;
}
///
- int optionals() const { return optionals_; }
+ size_t optionals() const { return optionals_; }
///
void setOptionals(int n) {
if (n <= int(nargs()))
/// number of arguments that were really attached
size_t attachedArgsNum_;
/// cursor position during last draw
- int previousCurIdx_;
+ idx_type previousCurIdx_;
/// optional argument attached? (only in DISPLAY_NORMAL mode)
- int optionals_;
+ size_t optionals_;
/// fold mode to be set in next metrics call?
bool nextFoldMode_;
/// if macro_ == true, then here is a copy of the macro
///
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)
- 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
mutable MathData label_;
///