On Monday 10 March 2003 11:30 am, Andre Poenitz wrote: > On Mon, Mar 10, 2003 at 11:25:52AM +0000, Angus Leeming wrote: > > > Ideally, I don't have Insets, only InsetBases. > > > > Sure. That would work too. > > So can you change that to InsetBase?
I'll try and make this change and the name one this lunch time. > And the rest now is idle talk: > > > The reason of using these MailInsets instead of LFUNs directed to the > > > some high level dispatch() (the one in lyxfunc?) is to be able to pass > > > an inset reference around, isn't it? > > > > The reason I created MailInset was simply to avoid adding yet more shit > > to the Inset classes. > > What would it add to the Inset classes? > > > SInce there function is clear, it made sense to create a class to > > encompass it. I don't pass a MailInset anywhere but use it to create a > > string and mail that string to the Dialogs class. > > Together with an InsetBase * if I understand correctly. > For "mailing strings" alone, a FuncRequest looks reasonable, doesn't it? Well, we "mail strings" back from the frontends using a FuncRequest, yes. But I don't see the advantage of going through a dispatch method to call Dialogs::show(name, data, inset*) or Dialogs::update(name, data) or Dialogs::hide(name, inset*) from the lyx kernel itself. > > I also pass/store an InsetBase* in the Dialogs class but I'd rather not > > > > :-( > > Because you need to figure out to which Inset the Dialog belongs. Ok, I > think I understood that. > > > You suggested some sort of InsetID before... > > Something string-like at least... but I still don't have a clue what would > be a proper solution. Maybe an external (Dialog::static) map Inset -> > active Dialog would do... That's what I have now. I think of class Dialogs as part of the lyx kernel and it is this that stores the InsetBase* in just such a map. The dialogs themselves derive from class Dialog (note, no 's'). I think of them as separate from the lyx kernel and they know nothing about these pointers or, indeed, whether they are 'connected' to anything at all. > I don't think I would like numeric InsetIDs too much. > > > > If so, wouldn't it be easier to put a weak_ptr<InsetBase*> in the > > > FuncRequest and pass ordinary FuncRequests by ordinary dispatches > > > instead of implementing all these Mailer classes? > > > > Then effectively you are saying that storing InsetBase* in the frontends > > is the way to go. The whole point of doing this stuff was to try and move > > away from that. > > I know, that's why I am trying to device a way to pass the Inset<->Dialog > association without actually passing Inset pointers. Just losing the > association and re-create it by some kind of lookup/search if needed seems > to be one option. > > Andre'