Georg Baum wrote: >> Angus> The point being that the core would explicitly tell individual >> Angus> (named) dialogs when it was illegal to Apply their contents. >> >> Angus> Your suggesting (if I understand correctly) that each and every >> Angus> open dialog should recieve notification that it should call >> Angus> getStatus to ascertain whether the Button Controller should be >> Angus> (de-)activated. >> >> Yes, the idea is that the code that knows what is permitted and what >> is not already exists, and it is in getStatus. > > I tried to implement this and ran into the following problem: Notifying > an open dialog that it should call getStatus is easy. But what argument > to getStatus would the dialog use? This is different for each dialog, so > that would mean we would need a new member function checkStatus() for > each dialog that calls getStatus with the correct argument, or we would > need to store this argument in the base class. In any case this would > mean to update every dialog, which I did not like. > > Therefore I took the idea a bit further and came up with the attached > patch. checkStatus() is implemented in the base class and calls > getStatus with LFUN_INSET_APPLY. This is handled in > InsetBase::getStatus() and only accepted if it comes from this insets's > dialog. This prevents that open dialogs are applied in the wrong insets. > If that is not correct for some inset (as e.g. in InsetText) it needs to > be overriden in that inset. > The patch seems to work, but I would like to get some feedback, and I > need to check wether LFUN_INSET_APPLY is short-circuited in other insets > than InsetERT, too.
Georg, the idea looks fine to me, but I think some comments in the LFUN_INSET_APPLY block in buffer.C about the expected usage would help. Well done, -- Angus