font.update(fnt, buf->params.language, toggleall);
// Let the insets convert their font
if (pit->isInset(pos)) {
- Inset * inset = pit->getInset(pos);
+ InsetOld * inset = pit->getInset(pos);
if (isEditableInset(inset)) {
UpdatableInset * uinset =
static_cast<UpdatableInset *>(inset);
}
-Inset * LyXText::getInset() const
+InsetOld * LyXText::getInset() const
{
ParagraphList::iterator pit = cursor.par();
pos_type const pos = cursor.pos();
void LyXText::toggleInset()
{
- Inset * inset = getInset();
+ InsetOld * inset = getInset();
// is there an editable inset at cursor position?
if (!isEditableInset(inset)) {
// No, try to see if we are inside a collapsable inset
// do we want to keep this?? (JMarc)
if (!isHighlyEditableInset(inset))
- setCursorParUndo(bv());
+ recordUndo(bv(), Undo::ATOMIC);
if (inset->isOpen()) {
inset->close(bv());
++endpit;
}
- setUndo(bv(), Undo::EDIT, sstart_cur.par(), boost::prior(undoendpit));
+ recordUndo(bv(), Undo::ATOMIC, sstart_cur.par(), boost::prior(undoendpit));
// ok we have a selection. This is always between sstart_cur
// and sel_end cursor
bv()->owner()->dispatch(FuncRequest(LFUN_HOME));
bv()->owner()->dispatch(FuncRequest(LFUN_ENDSEL));
bv()->owner()->dispatch(FuncRequest(LFUN_CUT));
- Inset * inset = new InsetEnvironment(params, layout);
+ InsetOld * inset = new InsetEnvironment(params, layout);
if (bv()->insertInset(inset)) {
//inset->edit(bv());
//bv()->owner()->dispatch(FuncRequest(LFUN_PASTE));
ParagraphList::iterator pastend = boost::next(end);
if (!test_only)
- setUndo(bv(), Undo::EDIT, start, end);
+ recordUndo(bv(), Undo::ATOMIC, start, end);
bool changed = false;
// ok we have a selection. This is always between sel_start_cursor
// and sel_end cursor
- setUndo(bv(), Undo::EDIT, selection.start.par(), selection.end.par());
+ recordUndo(bv(), Undo::ATOMIC, selection.start.par(), selection.end.par());
freezeUndo();
cursor = selection.start;
while (cursor.par() != selection.end.par() ||
ParagraphList::iterator end = ownerParagraphs().end();
for (; pit != end; ++pit) {
- // compute inset metrics
- for (int pos = 0; pos != pit->size(); ++pos) {
- if (pit->isInset(pos)) {
- Dimension dim;
- MetricsInfo m = mi;
- pit->getInset(pos)->metrics(m, dim);
- }
+ InsetList::iterator ii = pit->insetlist.begin();
+ InsetList::iterator iend = pit->insetlist.end();
+ for (; ii != iend; ++ii) {
+ Dimension dim;
+ MetricsInfo m = mi;
+ ii->inset->metrics(m, dim);
}
// insert a new row, starting at position 0
++endpit;
}
- setUndo(bv(), Undo::EDIT, selection.start.par(),
+ recordUndo(bv(), Undo::ATOMIC, selection.start.par(),
boost::prior(undoendpit));
// the caption hack:
if (layout->labeltype == LABEL_SENSITIVE) {
ParagraphList::iterator tmppit = pit;
- Inset * in = 0;
+ InsetOld * in = 0;
bool isOK = false;
while (tmppit != ownerParagraphs().end() &&
tmppit->inInset()
// the single '=' is intended below
&& (in = tmppit->inInset()->owner())) {
- if (in->lyxCode() == Inset::FLOAT_CODE ||
- in->lyxCode() == Inset::WRAP_CODE) {
+ if (in->lyxCode() == InsetOld::FLOAT_CODE ||
+ in->lyxCode() == InsetOld::WRAP_CODE) {
isOK = true;
break;
} else {
if (isOK) {
string type;
- if (in->lyxCode() == Inset::FLOAT_CODE)
+ if (in->lyxCode() == InsetOld::FLOAT_CODE)
type = static_cast<InsetFloat*>(in)->params().type;
- else if (in->lyxCode() == Inset::WRAP_CODE)
+ else if (in->lyxCode() == InsetOld::WRAP_CODE)
type = static_cast<InsetWrap*>(in)->params().type;
else
Assert(0);
}
-void LyXText::insertInset(Inset * inset)
+void LyXText::insertInset(InsetOld * inset)
{
if (!cursor.par()->insetAllowed(inset->lyxCode()))
return;
- setUndo(bv(), Undo::FINISH, cursor.par());
+ recordUndo(bv(), Undo::ATOMIC, cursor.par());
freezeUndo();
cursor.par()->insertInset(cursor.pos(), inset);
// Just to rebreak and refresh correctly.
++endpit;
}
- setUndo(bv(), Undo::DELETE, selection.start.par(),
+ recordUndo(bv(), Undo::DELETE, selection.start.par(),
boost::prior(undoendpit));
if (!CutAndPaste::checkPastePossible())
return;
- setUndo(bv(), Undo::INSERT, cursor.par());
+ recordUndo(bv(), Undo::INSERT, cursor.par());
ParagraphList::iterator endpit;
PitPosPair ppp;
// simple replacing. The font of the first selected character is used
void LyXText::replaceSelectionWithString(string const & str)
{
- setCursorParUndo(bv());
+ recordUndo(bv(), Undo::ATOMIC);
freezeUndo();
if (!selection.set()) { // create a dummy selection
pos_type pos = cursor.pos();
ParagraphList::iterator endpit = boost::next(cursor.par());
- setCursorParUndo(bv());
+ recordUndo(bv(), Undo::ATOMIC);
// only to be sure, should not be neccessary
clearSelection();
// returns false if inset wasn't found
-bool LyXText::updateInset(Inset * inset)
+bool LyXText::updateInset(InsetOld * inset)
{
// first check the current paragraph
int pos = cursor.par()->getPositionOfInset(inset);
boost::prior(row)->par() == row->par() &&
pos < pit->size() &&
pit->getChar(pos) == Paragraph::META_INSET) {
- Inset * ins = pit->getInset(pos);
+ InsetOld * ins = pit->getInset(pos);
if (ins && (ins->needFullRow() || ins->display())) {
--row;
y -= row->height();
|| !cur.par()->isInset(cur.pos()))
return false;
- Inset const * inset = cur.par()->getInset(cur.pos());
+ InsetOld const * inset = cur.par()->getInset(cur.pos());
if (inset->needFullRow() || inset->display())
return true;
int y1 = cursor.iy() - topy;
int y2 = y1;
y -= topy;
- Inset * inset_hit = checkInsetHit(x, y1);
+ InsetOld * inset_hit = checkInsetHit(x, y1);
if (inset_hit && isHighlyEditableInset(inset_hit)) {
inset_hit->localDispatch(
FuncRequest(bv(), LFUN_INSET_EDIT, x, y - (y2 - y1), mouse_button::none));
int y1 = cursor.iy() - topy;
int y2 = y1;
y -= topy;
- Inset * inset_hit = checkInsetHit(x, y1);
+ InsetOld * inset_hit = checkInsetHit(x, y1);
if (inset_hit && isHighlyEditableInset(inset_hit)) {
FuncRequest cmd(bv(), LFUN_INSET_EDIT, x, y - (y2 - y1), mouse_button::none);
inset_hit->localDispatch(cmd);
++endpit;
}
- setUndo(bv(), Undo::DELETE, old_cursor.par(),
+ recordUndo(bv(), Undo::DELETE, old_cursor.par(),
boost::prior(endpit));
cursor = tmpcursor;
++endpit;
}
- setUndo(bv(), Undo::DELETE, old_cursor.par(), boost::prior(endpit));
+ recordUndo(bv(), Undo::DELETE, old_cursor.par(), boost::prior(endpit));
cursor = tmpcursor;
// delete old row