]> 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 c9d4b553e3343611a19cf6f851fd2464713ca473..570f07fece1c46de728db7d94c15a02c14c06923 100644 (file)
@@ -1,6 +1,7 @@
 /**
  * \file ControlRef.C
- * See the file COPYING.
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
  * \author Angus Leeming
  *
@@ -9,9 +10,6 @@
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "ControlRef.h"
 #include "lyxfunc.h"
 
 #include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
 
+using namespace lyx::support;
+
 using std::vector;
 
 extern BufferList bufferlist;
 
 
-ControlRef::ControlRef(LyXView & lv, Dialogs & d)
-       : ControlCommand(lv, d, LFUN_REF_INSERT)
+ControlRef::ControlRef(Dialog & d)
+       : ControlCommand(d, "ref")
 {}
 
 
@@ -35,21 +35,23 @@ vector<string> const ControlRef::getLabelList(string const & name) const
 {
        Buffer const * buf = bufferlist.getBuffer(MakeAbsPath(name));
        if (!buf)
-               buf = buffer();
-       return buf->getLabelList();
+               buf = kernel().buffer();
+       vector<string> list;
+       buf->getLabelList(list);
+       return list;
 }
 
 
 void ControlRef::gotoRef(string const & ref)
 {
-       lyxfunc().dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"), false);
-       lyxfunc().dispatch(FuncRequest(LFUN_REF_GOTO, ref));
+       kernel().dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"), false);
+       kernel().dispatch(FuncRequest(LFUN_REF_GOTO, ref));
 }
 
 
 void ControlRef::gotoBookmark()
 {
-       lyxfunc().dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"), false);
+       kernel().dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"), false);
 }
 
 
@@ -68,7 +70,7 @@ vector<string> const ControlRef::getBufferList() const
 int ControlRef::getBufferNum() const
 {
        vector<string> buffers = bufferlist.getFileNames();
-       string const name = buffer()->fileName();
+       string const name = kernel().buffer()->fileName();
        vector<string>::const_iterator cit =
                find(buffers.begin(), buffers.end(), name);
        if (cit == buffers.end())