On Tue, Mar 04, 2003 at 11:16:39AM +0000, Angus Leeming wrote: > André, as localDispatch is yours,
Not really. > perhaps you can help me with this problem. It's come up because I'm > starting to deal with insets which have a dialog but which are also > editable. > > Inset::localDispatch is called from LyXFunc::dispatch (below). If this > fails then the LFUN is passed to BufferView::dispatch which contains a > switch for the different LFUNs. I never understood dispatching out there. > [...] Meaning that the code in BufferView_pimpl.C's dispatch is called > to do the right thing. What's wrong with that. > But is there a better way? The problem ist that functionality is not properly distributed right now. The innermost level that knows to handle an event should handle it. Ideally there should not be (much|any) magical guessing who is responsible. The hierarchy should be something like LyXFunc | BufferView | Buffer | OutermostText [And this should go if everything is an inset] | Insets and we should walk it bottom-up. Currently we have some strange combination of guessing jumps down (the_locking_inset and some hard coded 'let's the inset handle it) and a few steps up... Some jumps probably can't be avoided, though. Pressing apply could invoke an lfun "LFUN_DIALOG_APPLY" which is handled only in the Bufferview (or whatever entity knows which inset is "open"). The bv catches this event and issues another "LFUN_DIRECT_APPLY" event to the proper inset. Something like that... Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)