On Wednesday 14 August 2002 11:03 pm, Lars Gullik Bjønnes wrote: > I think this is a step in the right direction, and it is surely not > worse than the thingie I did.
Sure, but I think that the implementation is horrible. A huge amount of replicated code. I thought of a much more elegant approach. Try this: frontends/Dialogs.h ================ class LyXView; class Dialogs { Dialogs(LyXView *); ~Dialogs(); void showCitation(); void showCharacter(); private: class Impl; boost::scoped_ptr<Impl> const pimpl_; }; frontends/xformsDialogs.C ===================== #include "Dialogs.h" #include "xformsBC.h" #include "GUI.h" #include "ControlCharacter.h" #include "FormCharacter.h" #include "ControlCitation.h" #include "FormCitation.h" typedef GUI<ControlCharacter, FormCharacter, OkApplyCancelReadOnlyPolicy, xformsBC> CharacterDialog; typedef GUI<ControlCitation, FormCitation, NoRepeatedApplyReadOnlyPolicy, xformsBC> CitationDialog; struct Dialogs::Impl { Impl(LyXView & lv, Dialogs & d) : lv_(lv), d_(d) {} template <typename T> T & dialog(boost::scoped_ptr<T> & var) { if (!var.get()) var.reset(new T(lv_, d_)); return *var.get(); } boost::scoped_ptr<CharacterDialog> character; boost::scoped_ptr<CitationDialog> citation; private: LyXView & lv_; Dialogs & d_; } Dialogs:Dialogs(LyXView * lv) : pimpl_(new Impl(*lv, *this)) {} Dialogs::~Dialogs() {} void showCharacter() { pimpl_->dialog(pimpl_->character).show(); } void showCitation() { pimpl_->dialog(pimpl_->citation).showInset(); } > BUT! static boost::signal can be a problem... > (depending on what compiler is used) Ahhh. I'd forgotten about that. Did you manage to isolate the problem and tell boost the list about it? Anyway, I'll think about a work around. Thanks, Angus