#include "frontends/LyXView.h"
#include "frontends/Painter.h"
-#include "support/std_sstream.h"
-
+#include <sstream>
#include <iostream>
using lyx::graphics::PreviewLoader;
}
-void InsetTabular::buffer(Buffer * b)
+void InsetTabular::buffer(Buffer const * b)
{
buffer_ = b;
}
lyxerr << "# InsetTabular::dispatch: cmd: " << cmd << endl;
//lyxerr << " cur:\n" << cur << endl;
CursorSlice sl = cur.top();
+ LCursor & bvcur = cur.bv().cursor();
switch (cmd.action) {
cur.selection() = false;
setPos(cur, cmd.x, cmd.y);
cur.resetAnchor();
- cur.bv().cursor().setCursor(cur, false);
+ bvcur = cur;
//if (cmd.button() == mouse_button::button2)
// dispatch(cur, FuncRequest(LFUN_PASTESELECTION, "paragraph"));
//lyxerr << "# InsetTabular::MousePress\n" << cur.bv().cursor() << endl;
case LFUN_MOUSE_MOTION:
if (cmd.button() != mouse_button::button1)
break;
+ // ignore motions deeper nested than the real anchor
+ if (bvcur.selection() && bvcur.anchor_.size() < cur.size())
+ break;
setPos(cur, cmd.x, cmd.y);
- cur.bv().cursor().setCursor(cur, true);
- //lyxerr << "# InsetTabular::MouseMotion\n" << cur.bv().cursor() << endl;
+ bvcur.setCursor(cur, true);
+ //lyxerr << "# InsetTabular::MouseMotion\n" << bvcur << endl;
break;
case LFUN_MOUSE_RELEASE:
- //lyxerr << "# InsetTabular::MouseRelease\n" << cur.bv().cursor() << endl;
+ //lyxerr << "# InsetTabular::MouseRelease\n" << bvcur << endl;
if (cmd.button() == mouse_button::button3)
InsetTabularMailer(*this).showDialog(&cur.bv());
break;
}
break;
- case LFUN_LEFTSEL:
+ case LFUN_LEFTSEL:
case LFUN_LEFT:
cell(cur.idx()).dispatch(cur, cmd);
cur.dispatched(); // override the cell's decision
maxCols = max(cols, maxCols);
paste_tabular.reset(
- new LyXTabular(cur.bv().buffer()->params(), rows, maxCols));
+ new LyXTabular(cur.buffer().params(), rows, maxCols));
string::size_type op = 0;
int cell = 0;
switch (cmd.action) {
case LFUN_TABULAR_FEATURE: {
int actcell = cur.idx();
- int action = LyXTabular::LAST_ACTION;
+ int action = LyXTabular::LAST_ACTION;
int i = 0;
for (; tabularFeature[i].action != LyXTabular::LAST_ACTION; ++i) {
string const tmp = tabularFeature[i].feature;
int ret = 0;
InsetOld * master = 0;
+#ifdef WITH_WARNINGS
#warning Why not pass a proper DocIterator here?
+#endif
#if 0
// if the table is inside a float it doesn't need the informaltable
// wrapper. Search for it.
}
-void InsetTabular::getCursorPos(CursorSlice const & cur, int & x, int & y) const
+void InsetTabular::getCursorPos(LCursor const & cur, int & x, int & y) const
{
cell(cur.idx()).getCursorPos(cur, x, y);
}
#if 0
// just multicol for one Single Cell
if (!hasSelection()) {
- // check wether we are completly in a multicol
+ // check whether we are completly in a multicol
if (tabular.isMultiColumn(actcell))
tabular.unsetMultiColumn(actcell);
else
ostringstream os;
OutputParams const runparams;
- paste_tabular->plaintext(*cur.bv().buffer(), os, runparams, 0, true, '\t');
+ paste_tabular->plaintext(cur.buffer(), os, runparams, 0, true, '\t');
cur.bv().stuffClipboard(os.str());
return true;
}
if (!cur.selection())
return;
- bool const track = cur.bv().buffer()->params().tracking_changes;
+ bool const track = cur.buffer().params().tracking_changes;
int rs, re, cs, ce;
- getSelection(cur, rs, re, cs, ce);
+ getSelection(cur, rs, re, cs, ce);
for (int i = rs; i <= re; ++i)
for (int j = cs; j <= ce; ++j)
cell(tabular.getCellNumber(i, j)).clear(track);
bool InsetTabular::tablemode(LCursor & cur) const
{
- return cur.selBegin().idx() != cur.selEnd().idx();
+ return cur.selection() && cur.selBegin().idx() != cur.selEnd().idx();
}
LyXLex lex(0,0);
lex.setStream(data);
+#ifdef WITH_WARNINGS
#warning CHECK verify that this is a sane value to return.
+#endif
if (in.empty())
return -1;
string const InsetTabularMailer::params2string(InsetTabular const & inset)
{
ostringstream data;
+#ifdef WITH_WARNINGS
#warning wrong!
+#endif
//data << name_ << " \\active_cell " << inset.getActCell() << '\n';
data << name_ << " \\active_cell " << 0 << '\n';
inset.write(inset.buffer(), data);
data << "\\end_inset\n";
return data.str();
}
-