]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlConnections.h
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[lyx.git] / src / frontends / controllers / ControlConnections.h
index 7a295c9610a1d7d64cfde7217f86db75a3c290af..41d02699bbd5598b61f2e6d13da03e35e1ce9be5 100644 (file)
@@ -1,56 +1,67 @@
-/* This file is part of
- * ====================================================== 
- *
- *           LyX, The Document Processor
- *
- *           Copyright 2001 The LyX Team.
+// -*- C++ -*-
+/**
+ * \file ControlConnections.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * ======================================================
+ * \author Angus Leeming
  *
- * \file ControlConnections.h
- * \author Angus Leeming <a.leeming@ic.ac.uk>
+ * Full author contact details are available in file CREDITS
  *
  * ControlConnections.h contains the definition of three controller classes,
  * ControlConnectBase, ControlConnectBI and ControlConnectBD.
  *
  * Together they control the connection/disconnection of signals with the LyX
- * kernel. Controllers of individual popups interacting with the kernel through
+ * kernel. Controllers of individual dialogs interacting with the kernel through
  * signals/slots will all be derived from ControlConnectBI or ControlConnectBD.
  *
- * A popup is classed as "Buffer Dependent" if its contents change with the
- * buffer (document). An example would be the Citation popup. Such a popup
+ * A dialog is classed as "Buffer Dependent" if its contents change with the
+ * buffer (document). An example would be the Citation dialog. Such a dialog
  * would be derived, therefore, from ControlConnectBD.
  *
- * Conversely, a popup is "Buffer Independent" if its contents do not change
- * when the buffer changes. An example would be the Copyright popup. Such a
- * popup, is therefore derived from ControlConnectBI.
+ * Conversely, a dialog is "Buffer Independent" if its contents do not change
+ * when the buffer changes. An example would be the Copyright dialog. Such a
+ * dialog is therefore derived from ControlConnectBI.
  *
  */
 
 #ifndef CONTROLCONNECTIONS_H
 #define CONTROLCONNECTIONS_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
 
-#include "ControlBase.h"
+#include "ControlButtons.h"
 
+#include <boost/signals/connection.hpp>
+
+class Buffer;
+class BufferView;
 class Dialogs;
 class LyXView;
+class LyXFunc;
 
 /** Base class to control connection/disconnection of signals with the LyX
     kernel. It is meant to be used solely as the parent class to
     ControlConnectBI and ControlConnectBD.
 */
-class ControlConnectBase : public ControlBase
-{
+class ControlConnectBase : public ControlButtons {
 public:
+       ///
+       enum DocTypes {
+               ///
+               LATEX,
+               ///
+               LITERATE,
+               ///
+               LINUXDOC,
+               ///
+               DOCBOOK
+       };
        ///
        ControlConnectBase(LyXView &, Dialogs &);
        /// The View may need to know if the buffer is read-only.
-       bool isReadonly() const;
-
+       bool bufferIsReadonly() const;
+       ///
+       DocTypes docType() const;
 protected:
        /// True if the dialog depends on the buffer, else false.
        virtual bool isBufferDependent() const = 0;
@@ -65,14 +76,29 @@ protected:
        */
        void redraw();
 
-       /// Get at the kernel Dispatch methods we need to apply() parameters.
+       /// a wrapper for BufferView::avaliable()
+       bool bufferIsAvailable() const;
+       /// a wrapper for LyXView::view()
+       BufferView * bufferview();
+       ///
+       BufferView const * bufferview() const;
+       /// a wrapper for LyXView::buffer()
+       Buffer * buffer();
+       ///
+       Buffer const * buffer() const;
+       /// a wrapper for LyXView::getLyXFunc()
+       LyXFunc & lyxfunc();
+       ///
+       LyXFunc const & lyxfunc() const;
+
+       ///
        LyXView & lv_;
        /// Contains the signals we have to connect to.
        Dialogs & d_;
        /// Hide connection.
-       SigC::Connection h_;
+       boost::signals::connection h_;
        /// Redraw connection.
-       SigC::Connection r_;
+       boost::signals::connection r_;
 };
 
 
@@ -82,12 +108,10 @@ protected:
     an update() function which is also supported by the Restore button.
  */
 
-class ControlConnectBI : public ControlConnectBase
-{
+class ControlConnectBI : public ControlConnectBase {
 public:
-        ///
-        ControlConnectBI(LyXView &, Dialogs &);
-
+       ///
+       ControlConnectBI(LyXView &, Dialogs &);
 protected:
        ///
        virtual bool isBufferDependent() const { return false; }
@@ -99,28 +123,25 @@ protected:
 /** Base class to control connection/disconnection of signals with the LyX
     kernel for Buffer Dependent dialogs.
  */
-class ControlConnectBD : public ControlConnectBase
-{
+class ControlConnectBD : public ControlConnectBase {
 public:
        ///
        ControlConnectBD(LyXView &, Dialogs &);
-
 protected:
        ///
        virtual bool isBufferDependent() const { return true; }
-       /** Slot connected to update signal.
-           Bool indicates if a buffer switch took place.
-           Default behaviour is to ignore this and simply update().
-       */
-       virtual void updateSlot(bool) { update(); }
        /// Connect signals
        virtual void connect();
        /// Disconnect signals
        virtual void disconnect();
-
 private:
+       /** Slot connected to update signal.
+           Bool indicates if a buffer switch took place.
+           Default behaviour is to ignore this and simply update().
+       */
+       virtual void updateSlot(bool) { update(); }
        /// Update connection.
-       SigC::Connection u_;
+       boost::signals::connection u_;
 };
 
 #endif // CONTROLCONNECTIONS_H