actrow = actcell = 0;
clearSelection();
need_update = INIT;
+ in_update = false;
}
actrow = actcell = 0;
sel_cell_start = sel_cell_end = 0;
need_update = INIT;
+ in_update = false;
}
void InsetTabular::update(BufferView * bv, LyXFont const & font, bool reinit)
{
+ if (in_update)
+ return;
+ in_update = true;
if (reinit) {
need_update = INIT;
calculate_dimensions_of_cells(bv, font, true);
if (owner())
owner()->update(bv, font, true);
+ in_update = false;
return;
}
if (the_locking_inset)
default:
break;
}
+ in_update = false;
}
UpdatableInset::RESULT
-InsetTabular::localDispatch(BufferView * bv,
- kb_action action,
- string const & arg)
+InsetTabular::localDispatch(BufferView * bv, kb_action action,
+ string const & arg)
{
// We need to save the value of the_locking_inset as the call to
// the_locking_inset->LocalDispatch might unlock it.
bool hs = hasSelection();
result = DISPATCHED;
- // this one have priority over the locked InsetText!
- switch (action) {
- case LFUN_SHIFT_TAB:
- case LFUN_TAB:
- {
- if (getFirstLockingInsetOfType(Inset::TABULAR_CODE) != this)
+ // this one have priority over the locked InsetText, if we're not already
+ // inside another tabular then that one get's priority!
+ if (getFirstLockingInsetOfType(Inset::TABULAR_CODE) == this) {
+ switch (action) {
+ case LFUN_SHIFT_TAB:
+ case LFUN_TAB:
+ hideInsetCursor(bv);
+ if (the_locking_inset) {
+ unlockInsetInInset(bv, the_locking_inset);
+ the_locking_inset = 0;
+ }
+ if (action == LFUN_TAB)
+ moveNextCell(bv, old_locking_inset != 0);
+ else
+ movePrevCell(bv, old_locking_inset != 0);
+ sel_cell_start = sel_cell_end = actcell;
+ if (hs)
+ updateLocal(bv, SELECTION, false);
+ if (!the_locking_inset) {
+ showInsetCursor(bv);
+ return DISPATCHED_NOUPDATE;
+ }
+ return result;
+ // this to avoid compiler warnings.
+ default:
break;
- hideInsetCursor(bv);
- if (the_locking_inset) {
- unlockInsetInInset(bv, the_locking_inset);
- the_locking_inset = 0;
- }
- if (action == LFUN_TAB)
- moveNextCell(bv, old_locking_inset != 0);
- else
- movePrevCell(bv, old_locking_inset != 0);
- sel_cell_start = sel_cell_end = actcell;
- if (hs)
- updateLocal(bv, SELECTION, false);
- if (!the_locking_inset) {
- showInsetCursor(bv);
- return DISPATCHED_NOUPDATE;
}
- return result;
- }
- // this to avoid compiler warnings.
- default:
- break;
}
if (the_locking_inset) {
updateLocal(bv, CELL, false);
the_locking_inset->toggleInsetCursor(bv);
return result;
- } else if (result == FINISHED) {
}
}
// we need to update if this was requested before
updateLocal(bv, NONE, false);
return UNDISPATCHED;
+ } else if (hs) {
+ clearSelection();
}
nodraw(false);
-// the_locking_inset->ToggleInsetCursor(bv);
updateLocal(bv, CELL, false);
-// the_locking_inset->ToggleInsetCursor(bv);
return result;
}
break;
bv->hideLockedInsetCursor();
setCursorVisible(false);
}
-// if (cursor_visible)
-// ToggleInsetCursor(bv);
+}
+
+
+void InsetTabular::fitInsetCursor(BufferView * bv) const
+{
+ if (the_locking_inset) {
+ the_locking_inset->fitInsetCursor(bv);
+ return;
+ }
+ LyXFont font;
+
+ int const asc = lyxfont::maxAscent(font);
+ int const desc = lyxfont::maxDescent(font);
+ bv->fitLockedInsetCursor(cursor_.x(), cursor_.y(), asc, desc);
}
}
++actcell;
}
-
+ nodraw(true);
// otherwise we have to lock the next inset and ask for it's selecttion
UpdatableInset * inset =
static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
inset->edit(bv, 0, 0, 0);
string const str(selectNextWordInt(bv, value));
+ nodraw(false);
if (!str.empty())
resetPos(bv);
return str;
bool InsetTabular::searchForward(BufferView * bv, string const & str,
- bool const & cs, bool const & mw)
+ bool const & cs, bool const & mw)
{
if (the_locking_inset) {
if (the_locking_inset->searchForward(bv, str, cs, mw))
}
++actcell;
}
- nodraw(true);
// otherwise we have to lock the next inset and search there
UpdatableInset * inset =
static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
inset->edit(bv);
+#if 0
bool const res = searchForward(bv, str, cs, mw);
updateLocal(bv, NONE, false);
- nodraw(false);
bv->updateInset(const_cast<InsetTabular *>(this), false);
return res;
+#else
+ return searchForward(bv, str, cs, mw);
+#endif
}
}
--actcell;
}
- nodraw(true);
// otherwise we have to lock the next inset and search there
UpdatableInset * inset =
static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
inset->edit(bv, false);
+#if 0
bool const res = searchBackward(bv, str, cs, mw);
- nodraw(false);
bv->updateInset(const_cast<InsetTabular *>(this), false);
return res;
+#else
+ return searchBackward(bv, str, cs, mw);
+#endif
}