Example #1
0
Inset const * Dialog::inset(InsetCode code) const
{
	Inset * ins = bufferview()->cursor().innerInsetOfType(code);
	if (!ins)
		ins = bufferview()->cursor().nextInset();
	if (!ins || ins->lyxCode() != code)
		return 0;
	return ins;
}
Example #2
0
void GuiSearch::wrap_dispatch(const FuncRequest & func, bool forward)
{
	dispatch(func);

	BufferView * bv = const_cast<BufferView *>(bufferview());

	if (!bv->cursor().result().dispatched()) {
		GuiView & lv = *const_cast<GuiView *>(&lyxview());
		DocIterator cur_orig(bv->cursor());
		docstring q;
		if (forward)
			q = _("End of file reached while searching forward.\n"
			  "Continue searching from the beginning?");
		else
			q = _("Beginning of file reached while searching backward.\n"
			  "Continue searching from the end?");
		int wrap_answer = frontend::Alert::prompt(_("Wrap search?"),
			q, 0, 1, _("&Yes"), _("&No"));
		if (wrap_answer == 0) {
			if (forward) {
				bv->cursor().clear();
				bv->cursor().push_back(CursorSlice(bv->buffer().inset()));
			} else {
				bv->cursor().setCursor(doc_iterator_end(&bv->buffer()));
				bv->cursor().backwardPos();
			}
			bv->clearSelection();
			dispatch(func);
			if (bv->cursor().result().dispatched())
				return;
		}
		bv->cursor().setCursor(cur_orig);
		lv.message(_("String not found."));
	}
}
Example #3
0
Inset const * Dialog::inset(InsetCode code) const
{
	// ins: the innermost inset of the type we look for
	//      that contains the cursor
	Inset * ins = bufferview()->cursor().innerInsetOfType(code);
	// next: a potential inset at cursor position
	Inset * next = bufferview()->cursor().nextInset();
	// Check if next is of the type we look for
	if (next)
		if (next->lyxCode() != code)
			next = 0;
	if (ins) {
		// prefer next if it is of the requested type (bug 8716)
		if (next)
			ins = next;
	} else
		// no containing inset of requested type
		// use next (which might also be 0)
		ins = next;
	return ins;
}
Example #4
0
void GuiSymbols::updateView()
{
	chosenLE->clear();

	string new_encoding = bufferview()->cursor().getEncoding()->name();
	if (buffer().params().inputenc != "auto" &&
	    buffer().params().inputenc != "default")
		new_encoding = buffer().params().encoding().name();
	if (new_encoding == encoding_)
		// everything up to date
		return;
	if (!new_encoding.empty())
		encoding_ = new_encoding;
	bool const utf8 = toqstr(encoding_).startsWith("utf8");
	if (utf8)
		categoryFilterCB->setChecked(false);
	//categoryFilterCB->setEnabled(!utf8);
	updateSymbolList();
}