]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlRef.C
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[lyx.git] / src / frontends / controllers / ControlRef.C
index 568fc2c6ba02c7b93346f31c9961f21870b6a51a..570f07fece1c46de728db7d94c15a02c14c06923 100644 (file)
@@ -1,77 +1,62 @@
-/* This file is part of
- * ======================================================
- *
- *           LyX, The Document Processor
- *
- *           Copyright 2001 The LyX Team.
+/**
+ * \file ControlRef.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * ======================================================
+ * \author Angus Leeming
  *
- * \file ControlRef.C
- * \author Angus Leeming <a.leeming@ic.ac.uk>
+ * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "ControlRef.h"
-#include "ViewBase.h"
-#include "ButtonControllerBase.h"
-#include "Dialogs.h"
-#include "buffer.h"
 #include "lyxfunc.h"
+#include "buffer.h"
 #include "bufferlist.h"
-#include "debug.h"
-
-#include "frontends/LyXView.h"
+#include "funcrequest.h"
 
 #include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
 
-#include <boost/bind.hpp>
-
-#include <algorithm>
+using namespace lyx::support;
 
 using std::vector;
-using std::find;
 
 extern BufferList bufferlist;
 
-ControlRef::ControlRef(LyXView & lv, Dialogs & d)
-       : ControlCommand(lv, d, LFUN_REF_INSERT)
-{
-       d_.showRef = boost::bind(&ControlRef::showInset, this, _1);
-       d_.createRef = boost::bind(&ControlRef::createInset, this, _1);
-}
+
+ControlRef::ControlRef(Dialog & d)
+       : ControlCommand(d, "ref")
+{}
 
 
 vector<string> const ControlRef::getLabelList(string const & name) const
 {
-       Buffer * buffer = bufferlist.getBuffer(MakeAbsPath(name));
-       if (!buffer)
-               buffer = lv_.buffer();
-       return buffer->getLabelList();
+       Buffer const * buf = bufferlist.getBuffer(MakeAbsPath(name));
+       if (!buf)
+               buf = kernel().buffer();
+       vector<string> list;
+       buf->getLabelList(list);
+       return list;
 }
 
 
-void ControlRef::gotoRef(string const & ref) const
+void ControlRef::gotoRef(string const & ref)
 {
-       lv_.getLyXFunc()->dispatch(LFUN_BOOKMARK_SAVE, "0");
-       lv_.getLyXFunc()->dispatch(LFUN_REF_GOTO, ref);
+       kernel().dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"), false);
+       kernel().dispatch(FuncRequest(LFUN_REF_GOTO, ref));
 }
 
 
-void ControlRef::gotoBookmark() const
+void ControlRef::gotoBookmark()
 {
-       lv_.getLyXFunc()->dispatch(LFUN_BOOKMARK_GOTO, "0");
+       kernel().dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"), false);
 }
 
 
 vector<string> const ControlRef::getBufferList() const
 {
-
        vector<string> buffers = bufferlist.getFileNames();
        for (vector<string>::iterator it = buffers.begin();
             it != buffers.end(); ++it) {
@@ -85,7 +70,7 @@ vector<string> const ControlRef::getBufferList() const
 int ControlRef::getBufferNum() const
 {
        vector<string> buffers = bufferlist.getFileNames();
-       string const name = lv_.buffer()->fileName();
+       string const name = kernel().buffer()->fileName();
        vector<string>::const_iterator cit =
                find(buffers.begin(), buffers.end(), name);
        if (cit == buffers.end())