mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
More fixes to various bug reports.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2453 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e454df24f5
commit
86e4a9bc8a
@ -407,7 +407,7 @@ bool BufferView::lockInset(UpdatableInset * inset)
|
|||||||
|
|
||||||
void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
|
void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
|
||||||
{
|
{
|
||||||
if (theLockingInset() && available()) {
|
if (available() && theLockingInset()) {
|
||||||
LyXCursor cursor = text->cursor;
|
LyXCursor cursor = text->cursor;
|
||||||
if ((cursor.pos() - 1 >= 0) &&
|
if ((cursor.pos() - 1 >= 0) &&
|
||||||
(cursor.par()->getChar(cursor.pos() - 1) ==
|
(cursor.par()->getChar(cursor.pos() - 1) ==
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2001-08-08 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
|
* tabular.C (SetWidthOfCell): fixed special case where the width
|
||||||
|
was not updated!
|
||||||
|
(LeftLine): handle '|' in align_special.
|
||||||
|
(RightLine): ditto
|
||||||
|
(LeftAlreadyDrawed): ditto
|
||||||
|
(SetWidthOfCell): ditto
|
||||||
|
|
||||||
2001-08-07 Juergen Vigna <jug@sad.it>
|
2001-08-07 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
* lyx_main.C (readUIFile): fixed some forgotten lowercase!
|
* lyx_main.C (readUIFile): fixed some forgotten lowercase!
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
2001-08-08 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
|
* insettabular.C (setPos): fixed wrong actrow < rows() check.
|
||||||
|
|
||||||
|
* insettext.C (insetUnlock): remove double-space on inset unlock.
|
||||||
|
|
||||||
|
* insetcollapsable.C (draw): fix returned x when label > inset-width.
|
||||||
|
|
||||||
|
* insettabular.C (update): fixed cursor positon after an insert.
|
||||||
|
(insetAllowed): do not allow to insert insets when not inside the
|
||||||
|
inset!
|
||||||
|
(draw): clear below an inset too as it could have changed height.
|
||||||
|
|
||||||
|
* inset.C (getMaxWidth): fixed width for inset in inset.
|
||||||
|
|
||||||
|
* insettext.C (update): small fix.
|
||||||
|
|
||||||
|
* insettabular.C (tabularFeatures): added selection support to
|
||||||
|
DELETE_ROW/DELETE_COLUMN.
|
||||||
|
|
||||||
2001-08-07 Juergen Vigna <jug@sad.it>
|
2001-08-07 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
* inset.C (getMaxWidth): recoded and all it's implementations!
|
* inset.C (getMaxWidth): recoded and all it's implementations!
|
||||||
|
@ -320,11 +320,6 @@ int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
|
|||||||
if (w < 0) {
|
if (w < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (owner()) {
|
|
||||||
if (topx_set) // this makes only sense if we have a top_x
|
|
||||||
w = w - top_x + owner()->x();
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
// check for margins left/right and extra right margin "const 5"
|
// check for margins left/right and extra right margin "const 5"
|
||||||
if ((w - ((2 * TEXT_TO_INSET_OFFSET) + 5)) >= 0)
|
if ((w - ((2 * TEXT_TO_INSET_OFFSET) + 5)) >= 0)
|
||||||
w -= (2 * TEXT_TO_INSET_OFFSET) + 5;
|
w -= (2 * TEXT_TO_INSET_OFFSET) + 5;
|
||||||
@ -333,6 +328,9 @@ int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
|
|||||||
w = 10; // minimum I require!!!
|
w = 10; // minimum I require!!!
|
||||||
} else {
|
} else {
|
||||||
w -= top_x;
|
w -= top_x;
|
||||||
|
if (owner()) {
|
||||||
|
w += owner()->x();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (w < 10) {
|
} else if (w < 10) {
|
||||||
w = 10;
|
w = 10;
|
||||||
|
@ -226,6 +226,8 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
|||||||
inset.draw(bv, f,
|
inset.draw(bv, f,
|
||||||
bl + descent_collapsed() + inset.ascent(bv, f),
|
bl + descent_collapsed() + inset.ascent(bv, f),
|
||||||
x, cleared);
|
x, cleared);
|
||||||
|
if (x < (top_x + button_length + TEXT_TO_INSET_OFFSET))
|
||||||
|
x = top_x + button_length + TEXT_TO_INSET_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -249,7 +249,8 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
x += static_cast<float>(scroll());
|
x += static_cast<float>(scroll());
|
||||||
#endif
|
#endif
|
||||||
if (!cleared && ((need_update == INIT) || (need_update == FULL) ||
|
if (!cleared && ((need_update == INIT) || (need_update == FULL) ||
|
||||||
(top_x != int(x)) || (top_baseline != baseline))) {
|
(top_x != int(x)) || (top_baseline != baseline)))
|
||||||
|
{
|
||||||
int h = ascent(bv, font) + descent(bv, font);
|
int h = ascent(bv, font) + descent(bv, font);
|
||||||
int const tx = display() || !owner() ? 0 : top_x;
|
int const tx = display() || !owner() ? 0 : top_x;
|
||||||
int w = tx ? width(bv, font) : pain.paperWidth();
|
int w = tx ? width(bv, font) : pain.paperWidth();
|
||||||
@ -314,11 +315,12 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
Inset * inset = tabular->GetCellInset(cell);
|
Inset * inset = tabular->GetCellInset(cell);
|
||||||
for (i = 0;
|
for (i = 0;
|
||||||
inset != the_locking_inset && i < tabular->rows();
|
inset != the_locking_inset && i < tabular->rows();
|
||||||
++i) {
|
++i)
|
||||||
|
{
|
||||||
for (j = 0;
|
for (j = 0;
|
||||||
inset != the_locking_inset
|
inset != the_locking_inset && j < tabular->columns();
|
||||||
&& j < tabular->columns();
|
++j)
|
||||||
++j) {
|
{
|
||||||
if (tabular->IsPartOfMultiColumn(i, j))
|
if (tabular->IsPartOfMultiColumn(i, j))
|
||||||
continue;
|
continue;
|
||||||
nx += tabular->GetWidthOfColumn(cell);
|
nx += tabular->GetWidthOfColumn(cell);
|
||||||
@ -355,14 +357,9 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
}
|
}
|
||||||
float dx = nx + tabular->GetBeginningOfTextInCell(cell);
|
float dx = nx + tabular->GetBeginningOfTextInCell(cell);
|
||||||
float cx = dx;
|
float cx = dx;
|
||||||
//cx = dx = nx + tabular->GetBeginningOfTextInCell(cell);
|
|
||||||
tabular->GetCellInset(cell)->draw(bv, font, baseline, dx, false);
|
tabular->GetCellInset(cell)->draw(bv, font, baseline, dx, false);
|
||||||
#if 0
|
|
||||||
if (bv->text->status == LyXText::CHANGED_IN_DRAW)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
// clear only if we didn't have a change
|
// clear only if we didn't have a change
|
||||||
if (need_update == CELL) {
|
if (bv->text->status() != LyXText::CHANGED_IN_DRAW) {
|
||||||
// clear before the inset
|
// clear before the inset
|
||||||
pain.fillRectangle(
|
pain.fillRectangle(
|
||||||
nx + 1,
|
nx + 1,
|
||||||
@ -382,6 +379,18 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
tabular->GetAscentOfRow(i) +
|
tabular->GetAscentOfRow(i) +
|
||||||
tabular->GetDescentOfRow(i) - 1,
|
tabular->GetDescentOfRow(i) - 1,
|
||||||
backgroundColor());
|
backgroundColor());
|
||||||
|
// clear below the inset
|
||||||
|
pain.fillRectangle(
|
||||||
|
nx + 1,
|
||||||
|
baseline + the_locking_inset->descent(bv, font) + 1,
|
||||||
|
tabular->GetWidthOfColumn(cell) -
|
||||||
|
tabular->GetAdditionalWidth(cell) - 1,
|
||||||
|
tabular->GetAscentOfRow(i) +
|
||||||
|
tabular->GetDescentOfRow(i) -
|
||||||
|
the_locking_inset->ascent(bv, font) -
|
||||||
|
the_locking_inset->descent(bv, font) -
|
||||||
|
TEXT_TO_INSET_OFFSET - 1,
|
||||||
|
backgroundColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x -= ADD_TO_TABULAR_WIDTH;
|
x -= ADD_TO_TABULAR_WIDTH;
|
||||||
@ -461,7 +470,9 @@ void InsetTabular::drawCellSelection(Painter & pain, int x, int baseline,
|
|||||||
void InsetTabular::update(BufferView * bv, LyXFont const & font, bool reinit)
|
void InsetTabular::update(BufferView * bv, LyXFont const & font, bool reinit)
|
||||||
{
|
{
|
||||||
if (in_update) {
|
if (in_update) {
|
||||||
if (reinit && owner()) {
|
if (reinit) {
|
||||||
|
resetPos(bv);
|
||||||
|
if (owner())
|
||||||
owner()->update(bv, font, true);
|
owner()->update(bv, font, true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -469,7 +480,8 @@ void InsetTabular::update(BufferView * bv, LyXFont const & font, bool reinit)
|
|||||||
in_update = true;
|
in_update = true;
|
||||||
if (reinit) {
|
if (reinit) {
|
||||||
need_update = INIT;
|
need_update = INIT;
|
||||||
calculate_dimensions_of_cells(bv, font, true);
|
if (calculate_dimensions_of_cells(bv, font, true))
|
||||||
|
resetPos(bv);
|
||||||
if (owner())
|
if (owner())
|
||||||
owner()->update(bv, font, true);
|
owner()->update(bv, font, true);
|
||||||
in_update = false;
|
in_update = false;
|
||||||
@ -596,14 +608,10 @@ bool InsetTabular::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
|
|||||||
lyxerr[Debug::INSETS] << "OK" << endl;
|
lyxerr[Debug::INSETS] << "OK" << endl;
|
||||||
the_locking_inset = tabular->GetCellInset(actcell);
|
the_locking_inset = tabular->GetCellInset(actcell);
|
||||||
resetPos(bv);
|
resetPos(bv);
|
||||||
inset_x = cursor_.x() - top_x + tabular->GetBeginningOfTextInCell(actcell);
|
|
||||||
inset_y = cursor_.y();
|
|
||||||
return true;
|
return true;
|
||||||
} else if (the_locking_inset && (the_locking_inset == inset)) {
|
} else if (the_locking_inset && (the_locking_inset == inset)) {
|
||||||
lyxerr[Debug::INSETS] << "OK" << endl;
|
lyxerr[Debug::INSETS] << "OK" << endl;
|
||||||
resetPos(bv);
|
resetPos(bv);
|
||||||
inset_x = cursor_.x() - top_x + tabular->GetBeginningOfTextInCell(actcell);
|
|
||||||
inset_y = cursor_.y();
|
|
||||||
} else if (the_locking_inset) {
|
} else if (the_locking_inset) {
|
||||||
lyxerr[Debug::INSETS] << "MAYBE" << endl;
|
lyxerr[Debug::INSETS] << "MAYBE" << endl;
|
||||||
return the_locking_inset->lockInsetInInset(bv, inset);
|
return the_locking_inset->lockInsetInInset(bv, inset);
|
||||||
@ -1180,9 +1188,6 @@ bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv,
|
|||||||
changed = tabular->SetDescentOfRow(actrow, maxDesc + ADD_TO_HEIGHT) || changed;
|
changed = tabular->SetDescentOfRow(actrow, maxDesc + ADD_TO_HEIGHT) || changed;
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
cur_cell = -1;
|
|
||||||
#endif
|
|
||||||
for (int i = 0; i < tabular->rows(); ++i) {
|
for (int i = 0; i < tabular->rows(); ++i) {
|
||||||
maxAsc = 0;
|
maxAsc = 0;
|
||||||
maxDesc = 0;
|
maxDesc = 0;
|
||||||
@ -1281,7 +1286,7 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const
|
|||||||
int ly = tabular->GetDescentOfRow(actrow);
|
int ly = tabular->GetDescentOfRow(actrow);
|
||||||
|
|
||||||
// first search the right row
|
// first search the right row
|
||||||
while((ly < y) && (actrow < tabular->rows())) {
|
while((ly < y) && ((actrow+1) < tabular->rows())) {
|
||||||
cursor_.y(cursor_.y() + tabular->GetDescentOfRow(actrow) +
|
cursor_.y(cursor_.y() + tabular->GetDescentOfRow(actrow) +
|
||||||
tabular->GetAscentOfRow(actrow + 1) +
|
tabular->GetAscentOfRow(actrow + 1) +
|
||||||
tabular->GetAdditionalHeight(actrow + 1));
|
tabular->GetAdditionalHeight(actrow + 1));
|
||||||
@ -1293,22 +1298,10 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const
|
|||||||
// now search the right column
|
// now search the right column
|
||||||
int lx = tabular->GetWidthOfColumn(actcell) -
|
int lx = tabular->GetWidthOfColumn(actcell) -
|
||||||
tabular->GetAdditionalWidth(actcell);
|
tabular->GetAdditionalWidth(actcell);
|
||||||
#if 0
|
|
||||||
#ifdef WITH_WARNINGS
|
|
||||||
#warning Jürgen, can you rewrite this to _not_ use the sequencing operator. (Lgb)
|
|
||||||
#endif
|
|
||||||
for (; !tabular->IsLastCellInRow(actcell) && (lx < x);
|
|
||||||
++actcell,lx += tabular->GetWidthOfColumn(actcell) +
|
|
||||||
tabular->GetAdditionalWidth(actcell - 1));
|
|
||||||
#else
|
|
||||||
// Jürgen, you should check that this is correct. (Lgb)
|
|
||||||
#warning Jürgen, please check. (Lgb)
|
|
||||||
for (; !tabular->IsLastCellInRow(actcell) && lx < x; ++actcell) {
|
for (; !tabular->IsLastCellInRow(actcell) && lx < x; ++actcell) {
|
||||||
lx += tabular->GetWidthOfColumn(actcell + 1)
|
lx += tabular->GetWidthOfColumn(actcell + 1)
|
||||||
+ tabular->GetAdditionalWidth(actcell);
|
+ tabular->GetAdditionalWidth(actcell);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
cursor_.x(lx - tabular->GetWidthOfColumn(actcell) + top_x + 2);
|
cursor_.x(lx - tabular->GetWidthOfColumn(actcell) + top_x + 2);
|
||||||
resetPos(bv);
|
resetPos(bv);
|
||||||
}
|
}
|
||||||
@ -1384,6 +1377,10 @@ void InsetTabular::resetPos(BufferView * bv) const
|
|||||||
scroll(bv, old_x - cursor_.x());
|
scroll(bv, old_x - cursor_.x());
|
||||||
updateLocal(bv, FULL, false);
|
updateLocal(bv, FULL, false);
|
||||||
}
|
}
|
||||||
|
if (the_locking_inset) {
|
||||||
|
inset_x = cursor_.x() - top_x + tabular->GetBeginningOfTextInCell(actcell);
|
||||||
|
inset_y = cursor_.y();
|
||||||
|
}
|
||||||
if ((!the_locking_inset ||
|
if ((!the_locking_inset ||
|
||||||
!the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) &&
|
!the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) &&
|
||||||
actcell != oldcell) {
|
actcell != oldcell) {
|
||||||
@ -1675,6 +1672,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
case LyXTabular::SET_SPECIAL_COLUMN:
|
case LyXTabular::SET_SPECIAL_COLUMN:
|
||||||
case LyXTabular::SET_SPECIAL_MULTI:
|
case LyXTabular::SET_SPECIAL_MULTI:
|
||||||
tabular->SetAlignSpecial(actcell,value,feature);
|
tabular->SetAlignSpecial(actcell,value,feature);
|
||||||
|
updateLocal(bv, FULL, true);
|
||||||
break;
|
break;
|
||||||
case LyXTabular::APPEND_ROW:
|
case LyXTabular::APPEND_ROW:
|
||||||
// append the row into the tabular
|
// append the row into the tabular
|
||||||
@ -1691,19 +1689,23 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
break;
|
break;
|
||||||
case LyXTabular::DELETE_ROW:
|
case LyXTabular::DELETE_ROW:
|
||||||
unlockInsetInInset(bv, the_locking_inset);
|
unlockInsetInInset(bv, the_locking_inset);
|
||||||
tabular->DeleteRow(tabular->row_of_cell(actcell));
|
for(int i = sel_row_start; i <= sel_row_end; ++i) {
|
||||||
if ((row+1) > tabular->rows())
|
tabular->DeleteRow(sel_row_start);
|
||||||
--row;
|
}
|
||||||
actcell = tabular->GetCellNumber(row, column);
|
if ((sel_row_start) > tabular->rows())
|
||||||
|
--sel_row_start;
|
||||||
|
actcell = tabular->GetCellNumber(sel_row_start, column);
|
||||||
clearSelection();
|
clearSelection();
|
||||||
updateLocal(bv, INIT, true);
|
updateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
case LyXTabular::DELETE_COLUMN:
|
case LyXTabular::DELETE_COLUMN:
|
||||||
unlockInsetInInset(bv, the_locking_inset);
|
unlockInsetInInset(bv, the_locking_inset);
|
||||||
tabular->DeleteColumn(tabular->column_of_cell(actcell));
|
for(int i = sel_col_start; i <= sel_col_end; ++i) {
|
||||||
if ((column+1) > tabular->columns())
|
tabular->DeleteColumn(sel_col_start);
|
||||||
--column;
|
}
|
||||||
actcell = tabular->GetCellNumber(row, column);
|
if ((sel_col_start+1) > tabular->columns())
|
||||||
|
--sel_col_start;
|
||||||
|
actcell = tabular->GetCellNumber(row, sel_col_start);
|
||||||
clearSelection();
|
clearSelection();
|
||||||
updateLocal(bv, INIT, true);
|
updateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
@ -2596,3 +2598,11 @@ bool InsetTabular::searchBackward(BufferView * bv, string const & str,
|
|||||||
return searchBackward(bv, str, cs, mw);
|
return searchBackward(bv, str, cs, mw);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool InsetTabular::insetAllowed(Inset::Code code) const
|
||||||
|
{
|
||||||
|
if (the_locking_inset)
|
||||||
|
return the_locking_inset->insetAllowed(code);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -125,9 +125,7 @@ public:
|
|||||||
///
|
///
|
||||||
bool insertInset(BufferView *, Inset *);
|
bool insertInset(BufferView *, Inset *);
|
||||||
///
|
///
|
||||||
bool insetAllowed(Inset::Code) const {
|
bool insetAllowed(Inset::Code code) const;
|
||||||
return the_locking_inset != 0;
|
|
||||||
}
|
|
||||||
///
|
///
|
||||||
bool isTextInset() const { return true; }
|
bool isTextInset() const { return true; }
|
||||||
///
|
///
|
||||||
|
@ -515,6 +515,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
|
|||||||
{
|
{
|
||||||
if (in_update) {
|
if (in_update) {
|
||||||
if (reinit && owner()) {
|
if (reinit && owner()) {
|
||||||
|
reinitLyXText();
|
||||||
owner()->update(bv, font, true);
|
owner()->update(bv, font, true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -522,11 +523,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
|
|||||||
in_update = true;
|
in_update = true;
|
||||||
if (reinit || need_update == INIT) {
|
if (reinit || need_update == INIT) {
|
||||||
need_update |= FULL;
|
need_update |= FULL;
|
||||||
#if 0
|
|
||||||
resizeLyXText(bv);
|
|
||||||
#else
|
|
||||||
reinitLyXText();
|
reinitLyXText();
|
||||||
#endif
|
|
||||||
if (owner())
|
if (owner())
|
||||||
owner()->update(bv, font, true);
|
owner()->update(bv, font, true);
|
||||||
in_update = false;
|
in_update = false;
|
||||||
@ -743,6 +740,8 @@ void InsetText::insetUnlock(BufferView * bv)
|
|||||||
->cursor.par()->getLayout());
|
->cursor.par()->getLayout());
|
||||||
} else
|
} else
|
||||||
bv->owner()->setLayout(bv->text->cursor.par()->getLayout());
|
bv->owner()->setLayout(bv->text->cursor.par()->getLayout());
|
||||||
|
// hack for deleteEmptyParMech
|
||||||
|
lt->setCursor(bv, par, 0);
|
||||||
updateLocal(bv, code, false);
|
updateLocal(bv, code, false);
|
||||||
if (clear)
|
if (clear)
|
||||||
lt = 0;
|
lt = 0;
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
#pragma implementation
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// temporary until verified (08/08/2001 Jug)
|
||||||
|
#define SPECIAL_COLUM_HANDLING 1
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
@ -435,17 +438,43 @@ bool LyXTabular::BottomLine(int cell, bool onlycolumn) const
|
|||||||
|
|
||||||
bool LyXTabular::LeftLine(int cell, bool onlycolumn) const
|
bool LyXTabular::LeftLine(int cell, bool onlycolumn) const
|
||||||
{
|
{
|
||||||
if (!onlycolumn && IsMultiColumn(cell))
|
if (!onlycolumn && IsMultiColumn(cell)) {
|
||||||
|
#ifdef SPECIAL_COLUM_HANDLING
|
||||||
|
if (cellinfo_of_cell(cell)->align_special.empty())
|
||||||
return cellinfo_of_cell(cell)->left_line;
|
return cellinfo_of_cell(cell)->left_line;
|
||||||
|
return prefixIs(frontStrip(cellinfo_of_cell(cell)->align_special), "|");
|
||||||
|
#else
|
||||||
|
return cellinfo_of_cell(cell)->left_line;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#ifdef SPECIAL_COLUM_HANDLING
|
||||||
|
if (column_info[column_of_cell(cell)].align_special.empty())
|
||||||
return column_info[column_of_cell(cell)].left_line;
|
return column_info[column_of_cell(cell)].left_line;
|
||||||
|
return prefixIs(frontStrip(column_info[column_of_cell(cell)].align_special), "|");
|
||||||
|
#else
|
||||||
|
return column_info[column_of_cell(cell)].left_line;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LyXTabular::RightLine(int cell, bool onlycolumn) const
|
bool LyXTabular::RightLine(int cell, bool onlycolumn) const
|
||||||
{
|
{
|
||||||
if (!onlycolumn && IsMultiColumn(cell))
|
if (!onlycolumn && IsMultiColumn(cell)) {
|
||||||
|
#ifdef SPECIAL_COLUM_HANDLING
|
||||||
|
if (cellinfo_of_cell(cell)->align_special.empty())
|
||||||
return cellinfo_of_cell(cell)->right_line;
|
return cellinfo_of_cell(cell)->right_line;
|
||||||
|
return suffixIs(strip(cellinfo_of_cell(cell)->align_special), "|");
|
||||||
|
#else
|
||||||
|
return cellinfo_of_cell(cell)->right_line;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#ifdef SPECIAL_COLUM_HANDLING
|
||||||
|
if (column_info[column_of_cell(cell)].align_special.empty())
|
||||||
return column_info[right_column_of_cell(cell)].right_line;
|
return column_info[right_column_of_cell(cell)].right_line;
|
||||||
|
return suffixIs(strip(column_info[column_of_cell(cell)].align_special), "|");
|
||||||
|
#else
|
||||||
|
return column_info[right_column_of_cell(cell)].right_line;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -478,7 +507,11 @@ bool LyXTabular::LeftAlreadyDrawed(int cell) const
|
|||||||
LyXTabular::CELL_PART_OF_MULTICOLUMN));
|
LyXTabular::CELL_PART_OF_MULTICOLUMN));
|
||||||
if (GetAdditionalWidth(cell_info[row][column].cellno))
|
if (GetAdditionalWidth(cell_info[row][column].cellno))
|
||||||
return false;
|
return false;
|
||||||
|
#ifdef SPECIAL_COLUM_HANDLING
|
||||||
return column_info[column].right_line;
|
return column_info[column].right_line;
|
||||||
|
#else
|
||||||
|
return RightLine(cell_info[row][column].cellno, true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -527,11 +560,14 @@ int LyXTabular::GetAdditionalWidth(int cell) const
|
|||||||
// internally already set in SetWidthOfCell
|
// internally already set in SetWidthOfCell
|
||||||
// used to get it back in text.C
|
// used to get it back in text.C
|
||||||
int const col = right_column_of_cell(cell);
|
int const col = right_column_of_cell(cell);
|
||||||
if (col < columns_ - 1 && column_info[col].right_line &&
|
int const row = row_of_cell(cell);
|
||||||
column_info[col+1].left_line)
|
if (col < columns_ - 1 && RightLine(cell, true) &&
|
||||||
|
LeftLine(cell_info[row][col+1].cellno, true)) // column_info[col+1].left_line)
|
||||||
|
{
|
||||||
return WIDTH_OF_LINE;
|
return WIDTH_OF_LINE;
|
||||||
else
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -608,17 +644,28 @@ bool LyXTabular::SetWidthOfCell(int cell, int new_width)
|
|||||||
int const column1 = column_of_cell(cell);
|
int const column1 = column_of_cell(cell);
|
||||||
bool tmp = false;
|
bool tmp = false;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
|
int add_width = 0;
|
||||||
|
|
||||||
if (GetWidthOfCell(cell) == (new_width+2*WIDTH_OF_LINE))
|
#ifdef SPECIAL_COLUM_HANDLING
|
||||||
|
if (RightLine(cell_info[row][column1].cellno, true) &&
|
||||||
|
(column1 < columns_-1) &&
|
||||||
|
LeftLine(cell_info[row][column1+1].cellno, true))
|
||||||
|
#else
|
||||||
|
if (column_info[column1].right_line && (column1 < columns_-1) &&
|
||||||
|
column_info[column1+1].left_line) // additional width
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
// additional width
|
||||||
|
add_width = WIDTH_OF_LINE;
|
||||||
|
}
|
||||||
|
if (GetWidthOfCell(cell) == (new_width+2*WIDTH_OF_LINE+add_width)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (IsMultiColumn(cell, true)) {
|
if (IsMultiColumn(cell, true)) {
|
||||||
tmp = SetWidthOfMulticolCell(cell, new_width);
|
tmp = SetWidthOfMulticolCell(cell, new_width);
|
||||||
} else {
|
} else {
|
||||||
width = (new_width + 2*WIDTH_OF_LINE);
|
width = (new_width + 2*WIDTH_OF_LINE + add_width);
|
||||||
cell_info[row][column1].width_of_cell = width;
|
cell_info[row][column1].width_of_cell = width;
|
||||||
if (column_info[column1].right_line && (column1 < columns_-1) &&
|
|
||||||
column_info[column1+1].left_line) // additional width
|
|
||||||
cell_info[row][column1].width_of_cell += WIDTH_OF_LINE;
|
|
||||||
tmp = calculate_width_of_column_NMC(column1);
|
tmp = calculate_width_of_column_NMC(column1);
|
||||||
}
|
}
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
@ -2100,11 +2147,12 @@ int LyXTabular::Latex(Buffer const * buf,
|
|||||||
else
|
else
|
||||||
os << "\\begin{tabular}{";
|
os << "\\begin{tabular}{";
|
||||||
for (int i = 0; i < columns_; ++i) {
|
for (int i = 0; i < columns_; ++i) {
|
||||||
if (column_info[i].left_line)
|
|
||||||
os << '|';
|
|
||||||
if (!column_info[i].align_special.empty()) {
|
if (!column_info[i].align_special.empty()) {
|
||||||
os << column_info[i].align_special;
|
os << column_info[i].align_special;
|
||||||
} else if (!column_info[i].p_width.empty()) {
|
} else {
|
||||||
|
if (column_info[i].left_line)
|
||||||
|
os << '|';
|
||||||
|
if (!column_info[i].p_width.empty()) {
|
||||||
switch (column_info[i].valignment) {
|
switch (column_info[i].valignment) {
|
||||||
case LYX_VALIGN_TOP:
|
case LYX_VALIGN_TOP:
|
||||||
os << "p";
|
os << "p";
|
||||||
@ -2135,6 +2183,7 @@ int LyXTabular::Latex(Buffer const * buf,
|
|||||||
if (column_info[i].right_line)
|
if (column_info[i].right_line)
|
||||||
os << '|';
|
os << '|';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
os << "}\n";
|
os << "}\n";
|
||||||
++ret;
|
++ret;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user