mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 18:24:48 +00:00
uses references instead of returning vectors
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4840 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6f5140a97b
commit
2830796638
@ -249,7 +249,9 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font,
|
|||||||
|
|
||||||
vector<string> const InsetFormula::getLabelList() const
|
vector<string> const InsetFormula::getLabelList() const
|
||||||
{
|
{
|
||||||
return par()->getLabelList();
|
vector<string> res;
|
||||||
|
par()->getLabelList(res);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -810,18 +810,15 @@ MathGridInset::RowInfo & MathGridInset::rowinfo(row_type row)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vector<MathInset::idx_type>
|
bool MathGridInset::idxBetween(idx_type idx, idx_type from, idx_type to) const
|
||||||
MathGridInset::idxBetween(idx_type from, idx_type to) const
|
|
||||||
{
|
{
|
||||||
row_type r1 = min(row(from), row(to));
|
row_type const ri = row(idx);
|
||||||
row_type r2 = max(row(from), row(to));
|
row_type const r1 = min(row(from), row(to));
|
||||||
col_type c1 = min(col(from), col(to));
|
row_type const r2 = max(row(from), row(to));
|
||||||
col_type c2 = max(col(from), col(to));
|
col_type const ci = col(idx);
|
||||||
vector<idx_type> res;
|
col_type const c1 = min(col(from), col(to));
|
||||||
for (row_type i = r1; i <= r2; ++i)
|
col_type const c2 = max(col(from), col(to));
|
||||||
for (col_type j = c1; j <= c2; ++j)
|
return r1 <= ri && ri <= r2 && c1 <= ci && ci <= c2;
|
||||||
res.push_back(index(i, j));
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ public:
|
|||||||
///
|
///
|
||||||
idx_type index(row_type r, col_type c) const;
|
idx_type index(row_type r, col_type c) const;
|
||||||
///
|
///
|
||||||
std::vector<idx_type> idxBetween(idx_type from, idx_type to) const;
|
bool idxBetween(idx_type idx, idx_type from, idx_type to) const;
|
||||||
///
|
///
|
||||||
virtual int defaultColSpace(col_type) { return 0; }
|
virtual int defaultColSpace(col_type) { return 0; }
|
||||||
///
|
///
|
||||||
|
@ -281,13 +281,11 @@ bool MathHullInset::display() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vector<string> MathHullInset::getLabelList() const
|
void MathHullInset::getLabelList(std::vector<string> & labels) const
|
||||||
{
|
{
|
||||||
vector<string> res;
|
|
||||||
for (row_type row = 0; row < nrows(); ++row)
|
for (row_type row = 0; row < nrows(); ++row)
|
||||||
if (!label_[row].empty() && nonum_[row] != 1)
|
if (!label_[row].empty() && nonum_[row] != 1)
|
||||||
res.push_back(label_[row]);
|
labels.push_back(label_[row]);
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
///
|
///
|
||||||
bool ams() const;
|
bool ams() const;
|
||||||
///
|
///
|
||||||
std::vector<string> getLabelList() const;
|
void getLabelList(std::vector<string> &) const;
|
||||||
///
|
///
|
||||||
void validate(LaTeXFeatures & features) const;
|
void validate(LaTeXFeatures & features) const;
|
||||||
/// identifies MatrixInsets
|
/// identifies MatrixInsets
|
||||||
|
@ -198,17 +198,9 @@ void MathInset::dump() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathInset::validate(LaTeXFeatures &) const
|
bool MathInset::idxBetween(idx_type idx, idx_type from, idx_type to) const
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
vector<MathInset::idx_type>
|
|
||||||
MathInset::idxBetween(idx_type from, idx_type to) const
|
|
||||||
{
|
{
|
||||||
vector<idx_type> res;
|
return from <= idx && idx <= to;
|
||||||
for (idx_type i = from; i <= to; ++i)
|
|
||||||
res.push_back(i);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -306,12 +298,6 @@ int MathInset::dispatch(string const &, idx_type, pos_type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<string> MathInset::getLabelList() const
|
|
||||||
{
|
|
||||||
return std::vector<string>();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
string const & MathInset::getType() const
|
string const & MathInset::getType() const
|
||||||
{
|
{
|
||||||
static string t("none");
|
static string t("none");
|
||||||
|
@ -161,7 +161,7 @@ public:
|
|||||||
virtual void idxGlue(idx_type) {}
|
virtual void idxGlue(idx_type) {}
|
||||||
// returns list of cell indices that are "between" from and to for
|
// returns list of cell indices that are "between" from and to for
|
||||||
// selection purposes
|
// selection purposes
|
||||||
virtual std::vector<idx_type> idxBetween(idx_type from, idx_type to) const;
|
virtual bool idxBetween(idx_type idx, idx_type from, idx_type to) const;
|
||||||
|
|
||||||
/// the number of nested cells this inset owns
|
/// the number of nested cells this inset owns
|
||||||
virtual idx_type nargs() const;
|
virtual idx_type nargs() const;
|
||||||
@ -239,7 +239,7 @@ public:
|
|||||||
virtual void edit(BufferView *, int, int, mouse_button::state) {}
|
virtual void edit(BufferView *, int, int, mouse_button::state) {}
|
||||||
|
|
||||||
/// request "external features"
|
/// request "external features"
|
||||||
virtual void validate(LaTeXFeatures & features) const;
|
virtual void validate(LaTeXFeatures &) const {}
|
||||||
/// char char code if possible
|
/// char char code if possible
|
||||||
virtual void handleFont(string const &) {}
|
virtual void handleFont(string const &) {}
|
||||||
/// is this inset equal to a given other inset?
|
/// is this inset equal to a given other inset?
|
||||||
@ -282,7 +282,8 @@ public:
|
|||||||
virtual int dispatch(string const & cmd, idx_type idx, pos_type pos);
|
virtual int dispatch(string const & cmd, idx_type idx, pos_type pos);
|
||||||
|
|
||||||
/// LyXInset stuff
|
/// LyXInset stuff
|
||||||
virtual std::vector<string> getLabelList() const;
|
/// write labels into a list
|
||||||
|
virtual void getLabelList(std::vector<string> &) const {}
|
||||||
/// LyXInset stuff
|
/// LyXInset stuff
|
||||||
virtual bool numberedType() const { return false; }
|
virtual bool numberedType() const { return false; }
|
||||||
/// hull type
|
/// hull type
|
||||||
|
@ -192,9 +192,9 @@ void MathNestInset::drawSelection(MathPainterInfo & pi,
|
|||||||
int y2 = c.yo() + c.descent();
|
int y2 = c.yo() + c.descent();
|
||||||
pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection);
|
pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection);
|
||||||
} else {
|
} else {
|
||||||
vector<MathInset::idx_type> indices = idxBetween(idx1, idx2);
|
for (idx_type i = 0; i < nargs(); ++i) {
|
||||||
for (unsigned i = 0; i < indices.size(); ++i) {
|
if (idxBetween(i, idx1, idx2)) {
|
||||||
MathXArray const & c = xcell(indices[i]);
|
MathXArray const & c = xcell(i);
|
||||||
int x1 = c.xo();
|
int x1 = c.xo();
|
||||||
int y1 = c.yo() - c.ascent();
|
int y1 = c.yo() - c.ascent();
|
||||||
int x2 = c.xo() + c.width();
|
int x2 = c.xo() + c.width();
|
||||||
@ -203,6 +203,7 @@ void MathNestInset::drawSelection(MathPainterInfo & pi,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathNestInset::drawMarkers(MathPainterInfo & pi, int x, int y) const
|
void MathNestInset::drawMarkers(MathPainterInfo & pi, int x, int y) const
|
||||||
|
Loading…
Reference in New Issue
Block a user