]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/Dialogs.C
include sys/time.h
[lyx.git] / src / frontends / Dialogs.C
index e26c29b736a4feb572421b63cf80a26360f4277e..57b13fe0ec07d9be6242d3e2f5503d3f7790edf5 100644 (file)
@@ -1,38 +1,41 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file frontends/Dialogs.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ * \author Angus Leeming
  *
- *           LyX, The Document Processor
+ * Full author contact details are available in file CREDITS
  *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
- *
- * ======================================================
- *
- * \file Dialogs.C
- * \author Angus Leeming <a.leeming@ic.ac.uk>
- *
- * Methods common to all frontends' Dialogs that should not be inline
+ * Common to all frontends' Dialogs
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "Dialogs.h"
-#include "support/LAssert.h"
 
-// Signal enabling all visible dialogs to be redrawn if so desired.
-// E.g., when the GUI colours have been remapped.
-SigC::Signal0<void> Dialogs::redrawGUI;
+// Note that static boost signals break some compilers, so this wrapper
+// initialises the signal dynamically when it is first invoked.
+template<typename Signal>
+class BugfixSignal {
+public:
+       Signal & operator()() { return thesignal(); }
+       Signal const & operator()() const { return thesignal(); }
+
+private:
+       Signal & thesignal() const
+       {
+               if (!signal_.get())
+                       signal_.reset(new Signal);
+               return *signal_;
+       }
 
+       mutable boost::scoped_ptr<Signal> signal_;
+};
 
-// toggle tooltips on/off in all dialogs.
-SigC::Signal0<void> Dialogs::toggleTooltips;
 
-void Dialogs::add(DialogBase * ptr)
+boost::signal0<void> & Dialogs::redrawGUI()
 {
-       lyx::Assert(ptr);
-       dialogs_.push_back(db_ptr(ptr));
+       static BugfixSignal<boost::signal0<void> > thesignal;
+       return thesignal();
 }