当前位置: 首页>>代码示例>>C++>>正文


C++ DocIterator::lastpit方法代码示例

本文整理汇总了C++中DocIterator::lastpit方法的典型用法代码示例。如果您正苦于以下问题:C++ DocIterator::lastpit方法的具体用法?C++ DocIterator::lastpit怎么用?C++ DocIterator::lastpit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DocIterator的用法示例。


在下文中一共展示了DocIterator::lastpit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: undo

void Undo::Private::doRecordUndo(UndoKind kind,
	DocIterator const & cell,
	pit_type first_pit, pit_type last_pit,
	CursorData const & cur_before,
	bool isFullBuffer,
	UndoElementStack & stack)
{
	if (!group_level) {
		LYXERR0("There is no group open (creating one)");
		++group_id;
	}

	if (first_pit > last_pit)
		swap(first_pit, last_pit);

	// Undo::ATOMIC are always recorded (no overlapping there).
	// As nobody wants all removed character appear one by one when undoing,
	// we want combine 'similar' non-ATOMIC undo recordings to one.
	pit_type from = first_pit;
	pit_type end = cell.lastpit() - last_pit;
	if (!undo_finished_
	    && kind != ATOMIC_UNDO
	    && !stack.empty()
	    && samePar(stack.top().cell, cell)
	    && stack.top().kind == kind
	    && stack.top().from == from
	    && stack.top().end == end) {
		// reset cur_after; it will be filled correctly by endUndoGroup.
		stack.top().cur_after = CursorData();
		return;
	}

	if (isFullBuffer)
		LYXERR(Debug::UNDO, "Create full buffer undo element of group " << group_id);
	else
		LYXERR(Debug::UNDO, "Create undo element of group " << group_id);
	// create the position information of the Undo entry
	UndoElement undo(kind, cur_before, cell, from, end, 0, 0,
	                 buffer_.params(), isFullBuffer, buffer_.isClean(), group_id);

	// fill in the real data to be saved
	if (cell.inMathed()) {
		// simply use the whole cell
		MathData & ar = cell.cell();
		undo.array = new MathData(ar.buffer(), ar.begin(), ar.end());
	} else {
		// some more effort needed here as 'the whole cell' of the
		// main Text _is_ the whole document.
		// record the relevant paragraphs
		Text const * text = cell.text();
		LBUFERR(text);
		ParagraphList const & plist = text->paragraphs();
		ParagraphList::const_iterator first = plist.begin();
		advance(first, first_pit);
		ParagraphList::const_iterator last = plist.begin();
		advance(last, last_pit + 1);
		undo.pars = new ParagraphList(first, last);
	}

	// push the undo entry to undo stack
	stack.push(undo);
	//lyxerr << "undo record: " << stack.top() << endl;
}
开发者ID:315234,项目名称:lyx-retina,代码行数:63,代码来源:Undo.cpp


注:本文中的DocIterator::lastpit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。