As John has noted, these differnet LFUNs are sufficiently similar to make the thought of collapsing them together attractive.
My question: should I use these switches or should I use if-blocks? Angus case LFUN_INDEX_APPLY: case LFUN_REF_APPLY: { dispatch_result result = UNDISPATCHED; string name; switch (ev.action) { case LFUN_INDEX_APPLY: name = "index"; break; case LFUN_REF_APPLY: name = "ref"; break; default: break; } InsetBase * base = owner_->getDialogs().getOpenInset(name); Inset * inset = 0; if (base) { // This works both for 'original' and 'mathed' insets. result = base->localDispatch(ev); } else { InsetCommandParams params; InsetCommandMailer::string2params(ev.argument, params); switch (ev.action) { case LFUN_INDEX_APPLY: inset = new InsetIndex(params); break; case LFUN_REF_APPLY: inset = new InsetRef(params, *buffer_); break; default: break; } if (insertInset(inset)) { updateInset(inset, true); result = DISPATCHED; } else { delete inset; result = UNDISPATCHED; } } } break; -- Angus