On Monday 10 March 2003 6:01 pm, Andre Poenitz wrote: > On Mon, Mar 10, 2003 at 06:02:16PM +0000, Angus Leeming wrote: > > Because the plan was to consider a LyXView as a GUI entity. This enitity > > would have its own dialogs and (possibly) multiple BufferViews. > > Moreover, we could have multiple LyXViews each with its own dialogs. > > Hmm.. stupid me... the FuncRequest is passing around a valid BufferView *, > isn't it? > > So I could use that. > > Are you sure we don't want to use FuncRequests for the mailer? To use > the BufferView * from the FuncRequest I'd have to store that in a inset > member and redirect the Inset::view() access there. Sounds a bit too > convoluted for my taste.
We could certainly pass a BufferView to showDialog and updateDialog and that BufferView could come from the calling FuncRequest. The problem comes with hideDialog which must be called from the inset's d-tor. I'm at a bit of a loss how to do that otherwise. I would really like to avoid using signals... Try the attached patch anyway... Angus
Index: src/insets/mailinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/mailinset.C,v retrieving revision 1.4 diff -u -p -r1.4 mailinset.C --- src/insets/mailinset.C 10 Mar 2003 17:40:18 -0000 1.4 +++ src/insets/mailinset.C 10 Mar 2003 18:19:35 -0000 @@ -22,9 +22,10 @@ namespace { -BufferView * cachedBufferView(InsetBase & inset, string const & title) +BufferView * cachedBufferView(BufferView * prefered, InsetBase & inset, + char const * title) { - BufferView * const bv = inset.view(); + BufferView * const bv = prefered ? prefered : inset.view(); if (!bv) { lyxerr << "MailInset::" << title << ":\n" << "The BufferView has not been cached!" @@ -36,9 +37,9 @@ BufferView * cachedBufferView(InsetBase } // namespace anon -void MailInset::showDialog() const +void MailInset::showDialog(BufferView * prefered) const { - BufferView * bv = cachedBufferView(inset(), "showDialog"); + BufferView * bv = cachedBufferView(prefered, inset(), "showDialog"); if (!bv) return; @@ -46,9 +47,9 @@ void MailInset::showDialog() const } -void MailInset::updateDialog() const +void MailInset::updateDialog(BufferView * prefered) const { - BufferView * bv = cachedBufferView(inset(), "updateDDialog"); + BufferView * bv = cachedBufferView(prefered, inset(), "updateDDialog"); if (!bv) return; @@ -58,7 +59,7 @@ void MailInset::updateDialog() const void MailInset::hideDialog() const { - BufferView * bv = cachedBufferView(inset(), "hideDialog"); + BufferView * bv = cachedBufferView(0, inset(), "hideDialog"); if (!bv) return; Index: src/insets/mailinset.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/mailinset.h,v retrieving revision 1.2 diff -u -p -r1.2 mailinset.h --- src/insets/mailinset.h 10 Mar 2003 13:33:39 -0000 1.2 +++ src/insets/mailinset.h 10 Mar 2003 18:19:35 -0000 @@ -17,6 +17,7 @@ class InsetBase; +class BufferView; class MailInset { @@ -24,9 +25,9 @@ public: /// virtual ~MailInset() {}; /// - void showDialog() const; + void showDialog(BufferView * = 0) const; /// - void updateDialog() const; + void updateDialog(BufferView * = 0) const; /// void hideDialog() const; ///