mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
store optional eol arg and write it back if necessary
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2480 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3b870366b4
commit
babee598f4
@ -45,6 +45,7 @@ int MathGridInset::index(int row, int col) const
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MathGridInset::halign(string const & hh)
|
||||
{
|
||||
int n = hh.size();
|
||||
@ -54,26 +55,45 @@ void MathGridInset::halign(string const & hh)
|
||||
colinfo_[i].h_align_ = hh[i];
|
||||
}
|
||||
|
||||
|
||||
void MathGridInset::halign(char h, int col)
|
||||
{
|
||||
colinfo_[col].h_align_ = h;
|
||||
}
|
||||
|
||||
|
||||
char MathGridInset::halign(int col) const
|
||||
{
|
||||
return colinfo_[col].h_align_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MathGridInset::valign(char c)
|
||||
{
|
||||
v_align_ = c;
|
||||
}
|
||||
|
||||
|
||||
char MathGridInset::valign() const
|
||||
{
|
||||
return v_align_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MathGridInset::vskip(LyXLength const & skip, int row)
|
||||
{
|
||||
rowinfo_[row].skip_ = skip;
|
||||
}
|
||||
|
||||
|
||||
LyXLength MathGridInset::vskip(int row) const
|
||||
{
|
||||
return rowinfo_[row].skip_;
|
||||
}
|
||||
|
||||
|
||||
void MathGridInset::metrics(MathStyles st) const
|
||||
{
|
||||
// let the cells adjust themselves
|
||||
@ -220,6 +240,9 @@ string MathGridInset::eolString(int row) const
|
||||
if (row == nrows() - 1)
|
||||
return "";
|
||||
|
||||
if (rowinfo_[row].skip_ != LyXLength())
|
||||
return "\\\\[" + rowinfo_[row].skip_.asLatexString() + "]\n";
|
||||
|
||||
// make sure an upcoming '[' does not break anything
|
||||
MathArray const & c = cell(index(row + 1, 0));
|
||||
if (c.size() && (*c.begin())->getChar() == '[')
|
||||
@ -243,6 +266,7 @@ void MathGridInset::addRow(int row)
|
||||
cells_.insert(cells_.begin() + (row + 1) * ncols(), ncols(), MathXArray());
|
||||
}
|
||||
|
||||
|
||||
void MathGridInset::appendRow()
|
||||
{
|
||||
rowinfo_.push_back(RowInfo());
|
||||
|
@ -3,6 +3,7 @@
|
||||
#define MATH_GRID_H
|
||||
|
||||
#include "math_nestinset.h"
|
||||
#include "vspace.h"
|
||||
#include "LString.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
@ -31,6 +32,8 @@ class MathGridInset : public MathNestInset {
|
||||
bool upperline_;
|
||||
/// hline below this row?
|
||||
bool lowerline_;
|
||||
/// distance
|
||||
LyXLength skip_;
|
||||
};
|
||||
|
||||
// additional per-row information
|
||||
@ -71,6 +74,10 @@ public:
|
||||
///
|
||||
char valign() const;
|
||||
///
|
||||
void vskip(LyXLength const &, int row);
|
||||
///
|
||||
LyXLength vskip(int row) const;
|
||||
///
|
||||
void resize(short int type, int cols);
|
||||
///
|
||||
const RowInfo & rowinfo(int row) const;
|
||||
|
@ -237,8 +237,10 @@ private:
|
||||
|
||||
///
|
||||
bool curr_num_;
|
||||
//
|
||||
///
|
||||
string curr_label_;
|
||||
///
|
||||
string curr_skip_;
|
||||
};
|
||||
|
||||
|
||||
@ -410,6 +412,10 @@ void Parser::parse_lines(MathGridInset * p, int col, bool numbered, bool outmost
|
||||
MathMatrixInset * m = static_cast<MathMatrixInset *>(p);
|
||||
m->numbered(row, curr_num_);
|
||||
m->label(row, curr_label_);
|
||||
if (curr_skip_.size()) {
|
||||
m->vskip(LyXLength(curr_skip_), row);
|
||||
curr_skip_.erase();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_WARNINGS
|
||||
@ -673,7 +679,7 @@ void Parser::parse_into(MathArray & array, unsigned flags)
|
||||
|
||||
case LM_TK_NEWLINE:
|
||||
{
|
||||
lexArg('['); // ignore things like \\[5pt] for a while
|
||||
curr_skip_ = lexArg('[');
|
||||
if (flags & FLAG_NEWLINE) {
|
||||
flags &= ~FLAG_NEWLINE;
|
||||
--plevel;
|
||||
|
Loading…
Reference in New Issue
Block a user