Andre Poenitz wrote:
On Wed, Oct 24, 2007 at 12:23:54PM -0400, Richard Heck wrote:
Andre Poenitz wrote:
On Tue, Oct 23, 2007 at 09:49:56PM -0400, Richard Heck wrote:
[snip]
Would it help if all insets knew the buffer they belong to?
That might be enough. But it's not clear to me if this causes problems with cut and paste.

Sure there will problems, but right now we already have special handling for e.g. and three hundred inset function or so taking a buffer
argument. Also there are problems in mathed as there's no flawless
MathData -> string -> MathData due to unknown buffer settings.

So putting some extra work in the case of insets transefered across
buffers might be the smaller evil in the end.

I think the following would work, and we would need to go roughly this way, anyway, since InsetCommandParams can live without an inset to which they're attached. Namely: Pass the buffer when the ICP is created. Then we will again have a problem about insets transferred across buffers, but I suppose that could be solved in the cut and paste code. It looks to me as if this happens for InsetTabular already in CutAndPaste.cpp, lines 216ff. So if we did something like:
   case BIBTEX_CODE:
   case BIBITEM_CODE:
   etc.etc.
      InsetCommand * it = static_cast<InsetCommand *>(lit->inset);
      it->buffer(&buffer);
      break;
would that be enough? Note: it->buffer() would be responsible for updating the buffer reference in the associated ICP.

Also, these casts confuse me sometimes. (I take it I'm not the only one.) If buffer() were virtual---it wouldn't be in this case, but the question is general---we'd still get dynamic binding, or no? I.e., if it is really an InsetBibitem, then InsetBibitem::buffer() gets called, or no?

Richard

Reply via email to