]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlConnections.C
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[lyx.git] / src / frontends / controllers / ControlConnections.C
index 050a00d9c85f85b24519c7afdca47ac4afc618ca..83c42e701a8ab623c22369077c798035957b3154 100644 (file)
@@ -1,39 +1,38 @@
-// -*- C++ -*-
-/* This file is part of
- * ====================================================== 
- *
- *           LyX, The Document Processor
- *
- *           Copyright 2001 The LyX Team.
+/**
+ * \file ControlConnections.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * ======================================================
+ * \author Angus Leeming
  *
- * \file ControlConnections.C
- * \author Angus Leeming <a.leeming@ic.ac.uk>
+ * Full author contact details are available in file CREDITS
  */
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include <config.h>
 
+
 #include "ControlConnections.h"
-#include "Dialogs.h"
-#include "LyXView.h"
+
+#include "ViewBase.h"
+
 #include "buffer.h"
+#include "BufferView.h"
+
+#include "frontends/Dialogs.h"
+#include "frontends/LyXView.h"
+
+#include <boost/bind.hpp>
 
-using SigC::slot;
 
 ControlConnectBase::ControlConnectBase(LyXView & lv, Dialogs & d)
-       : lv_(lv), d_(d), h_(0), r_(0)
+       : lv_(lv), d_(d)
 {}
 
 
 void ControlConnectBase::connect()
 {
-       r_ = Dialogs::redrawGUI.
-               connect(slot(this, &ControlConnectBase::redraw));
+       r_ = d_.redrawGUI().
+               connect(boost::bind(&ControlConnectBase::redraw, this));
 }
 
 void ControlConnectBase::disconnect()
@@ -49,7 +48,7 @@ void ControlConnectBase::redraw()
 }
 
 
-bool ControlConnectBase::isReadonly() const
+bool ControlConnectBase::bufferIsReadonly() const
 {
        if (!lv_.buffer())
                return true;
@@ -58,29 +57,89 @@ bool ControlConnectBase::isReadonly() const
 }
 
 
+bool ControlConnectBase::bufferIsAvailable() const
+{
+       if (!lv_.view())
+               return false;
+
+       return lv_.view()->available();
+}
+
+
+BufferView * ControlConnectBase::bufferview()
+{
+       return lv_.view().get();
+}
+
+
+BufferView const * ControlConnectBase::bufferview() const
+{
+       return lv_.view().get();
+}
+
+
+Buffer * ControlConnectBase::buffer()
+{
+       return lv_.buffer();
+}
+
+
+Buffer const * ControlConnectBase::buffer() const
+{
+       return lv_.buffer();
+}
+
+
+LyXFunc & ControlConnectBase::lyxfunc()
+{
+       return lv_.getLyXFunc();
+}
+
+
+LyXFunc const & ControlConnectBase::lyxfunc() const
+{
+       return lv_.getLyXFunc();
+}
+
+
+ControlConnectBase::DocTypes ControlConnectBase::docType() const
+{
+       if (!lv_.buffer())
+               return LATEX;
+
+       if (lv_.buffer()->isLatex())
+               return LATEX;
+       else if (lv_.buffer()->isLiterate())
+               return LITERATE;
+       else if (lv_.buffer()->isLinuxDoc())
+               return LINUXDOC;
+       /* else if (lv_.buffer()->isDocBook()) */
+               return DOCBOOK;
+}
+
+
 ControlConnectBI::ControlConnectBI(LyXView & lv, Dialogs & d)
-        : ControlConnectBase(lv, d)
+       : ControlConnectBase(lv, d)
 {}
 
 
 void ControlConnectBI::connect()
 {
-       h_ = d_.hideAll.connect(slot(this, &ControlConnectBI::hide));
+       h_ = d_.hideAllSignal.connect(boost::bind(&ControlConnectBI::hide, this));
        ControlConnectBase::connect();
 }
 
 ControlConnectBD::ControlConnectBD(LyXView & lv, Dialogs & d)
-       : ControlConnectBase(lv, d),
-         u_(0)
+       : ControlConnectBase(lv, d)
 {}
 
 
 void ControlConnectBD::connect()
 {
-       u_ = d_.updateBufferDependent.
-               connect(slot(this, &ControlConnectBD::updateSlot));
-       h_ = d_.hideBufferDependent.
-               connect(slot(this, &ControlConnectBD::hide));
+       u_ = d_.updateBufferDependentSignal.
+               connect(boost::bind(&ControlConnectBD::updateSlot, this, _1));
+       h_ = d_.hideBufferDependentSignal.
+               connect(boost::bind(&ControlConnectBD::hide, this));
        ControlConnectBase::connect();
 }
 
@@ -89,4 +148,3 @@ void ControlConnectBD::disconnect()
        u_.disconnect();
        ControlConnectBase::disconnect();
 }
-