Andre Poenitz wrote: > On Mon, Jun 13, 2005 at 02:36:32PM +0100, Angus Leeming wrote: >> Angus Leeming wrote: >> >> > Andre Poenitz wrote: >> >> Of course, creating a context menu on right-click which a combo box >> >> of all available colors is a matter of 20 lines or so in 'pure' Qt, >> >> but I really don't know how to set this up in LyX's GUII scheme. >> > >> > Shrug. Let me paint a picture: >> >> Actually, it's even simpler. One CSMenu per BufferView, I suppose. >> Here's a complete but of course untested, implementation.
[snip...] > Not bad for starters. The obvious next candidate would be a context menu > for the formula type. Or left/right delimiters... void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd) { switch(cmd.action) { case LFUN_MOUSE_PRESS: { char const * const eqn_types = { "equation", "eqnarray", "multiline", "gather", "align", "alignat", "xalignat", "flalign", xxalignat" }; std::size_t const eqn_types_size = sizeof(eqn_types) / sizeof(eqn_types[0]); std::vector<std::string> const menu_data(eqn_types, eqn_types + eqn_types_size); CSMenu::size_type const result = cur.bv().csmenu.show(cur.pos(), menu_data); if (result != CSMenu::npos) mutate(eqn_types[result]); break; } } } > Well. You miss something that wasn't said: It would be nice if that > context 'menu' 'scaled' up to a degree where macro definitions could > be handled as well. This is more or less an arbitrary dialog popping > up, not just a list of words to select from. Now you're cheating ;-) -- Angus