#include "language.h"
#include "BufferView.h"
#include "undo_funcs.h"
+#include "support/LAssert.h"
+#include "support/lstrings.h"
using std::ostream;
using std::ifstream;
InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf,
bool same_id)
- : buffer(&buf)
+ : UpdatableInset(tab, same_id), buffer(&buf)
{
tabular.reset(new LyXTabular(this, *(tab.tabular)));
the_locking_inset = 0;
actrow = actcell = 0;
sel_cell_start = sel_cell_end = 0;
need_update = INIT;
- if (same_id)
- id_ = tab.id_;
}
h = pain.paperHeight();
if ((top_x + w) > pain.paperWidth())
w = pain.paperWidth();
- pain.fillRectangle(tx, ty, w, h);
+ pain.fillRectangle(tx, ty, w, h, backgroundColor());
need_update = FULL;
cleared = true;
}
baseline - tabular->GetAscentOfRow(i) + 1,
int(cx - nx - 1),
tabular->GetAscentOfRow(i) +
- tabular->GetDescentOfRow(i) - 1);
+ tabular->GetDescentOfRow(i) - 1,
+ backgroundColor());
// clear behind the inset
pain.fillRectangle(
int(cx + the_locking_inset->width(bv,font) + 1),
the_locking_inset->width(bv,font) -
tabular->GetAdditionalWidth(cell) - 1,
tabular->GetAscentOfRow(i) +
- tabular->GetDescentOfRow(i) - 1);
+ tabular->GetDescentOfRow(i) - 1,
+ backgroundColor());
}
}
x -= ADD_TO_TABULAR_WIDTH;
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) {
lx += tabular->GetWidthOfColumn(actcell + 1)
+ tabular->GetAdditionalWidth(actcell);
}
-bool InsetTabular::Delete()
+bool InsetTabular::deletable()
{
-#warning Is this func correctly named? Or should it be "deletable"? (Lgb?)
-#warning I guess this could be 'deletable'! (Jug)
return true;
}
const_cast<InsetTabular *>(this));
}
+
//
// functions returns:
// 0 ... disabled
if (!hasSelection())
return false;
- //int sel_col_start;
- //int sel_col_end;
- //int sel_row_start;
- //int sel_row_end;
-
int sel_col_start = tabular->column_of_cell(sel_cell_start);
int sel_col_end = tabular->column_of_cell(sel_cell_end);
if (sel_col_start > sel_col_end) {
int sel_row_start = tabular->row_of_cell(sel_cell_start);
int sel_row_end = tabular->row_of_cell(sel_cell_end);
if (sel_row_start > sel_row_end) {
- //int tmp = sel_row_start;
- //sel_row_start = sel_row_end;
- //sel_row_end = tmp;
swap(sel_row_start, sel_row_end);
}
if (sel_cell_start > sel_cell_end) {
- //int tmp = sel_cell_start;
- //sel_cell_start = sel_cell_end;
- //sel_cell_end = tmp;
swap(sel_cell_start, sel_cell_end);
}
for (int i = sel_row_start; i <= sel_row_end; ++i) {
ecol = tabular->right_column_of_cell(sel_cell_end);
}
+
Paragraph * InsetTabular::getParFromID(int id) const
{
Paragraph * result;
return 0;
}
+
Paragraph * InsetTabular::firstParagraph() const
{
if (the_locking_inset)
return 0;
}
+
LyXCursor const & InsetTabular::cursor(BufferView * bv) const
{
if (the_locking_inset)
}
-string InsetTabular::selectNextWord(BufferView * bv, float & value) const
+string const InsetTabular::selectNextWord(BufferView * bv, float & value) const
{
if (the_locking_inset) {
- string str;
- str = the_locking_inset->selectNextWord(bv, value);
+ string const str(the_locking_inset->selectNextWord(bv, value));
if (!str.empty())
return str;
if (tabular->IsLastCell(actcell)) {
UpdatableInset * inset =
static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
inset->edit(bv, 0, 0, 0);
- string str = selectNextWordInt(bv, value);
+ string const str(selectNextWordInt(bv, value));
if (!str.empty())
resetPos(bv);
return str;
}
+
string InsetTabular::selectNextWordInt(BufferView * bv, float & value) const
{
// when entering this function the inset should be ALWAYS locked!
lyx::Assert(the_locking_inset);
- string str;
- str = the_locking_inset->selectNextWord(bv, value);
+ string const str(the_locking_inset->selectNextWord(bv, value));
if (!str.empty())
return str;
return;
}
+
void InsetTabular::toggleSelection(BufferView * bv, bool kill_selection)
{
if (the_locking_inset) {
UpdatableInset * inset =
static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
inset->edit(bv);
- bool res = searchForward(bv, str, cs, mw);
+ bool const res = searchForward(bv, str, cs, mw);
updateLocal(bv, NONE, false);
nodraw(false);
bv->updateInset(const_cast<InsetTabular *>(this), false);
return res;
}
+
bool InsetTabular::searchBackward(BufferView * bv, string const & str,
bool const & cs, bool const & mw)
{
UpdatableInset * inset =
static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
inset->edit(bv, false);
- bool res = searchBackward(bv, str, cs, mw);
+ bool const res = searchBackward(bv, str, cs, mw);
nodraw(false);
bv->updateInset(const_cast<InsetTabular *>(this), false);
return res;