3 * See the file COPYING.
5 * \author Angus Leeming
7 * Full author contact details are available in file CREDITS
13 #pragma implementation
16 #include "ControlRef.h"
19 #include "bufferlist.h"
20 #include "funcrequest.h"
22 #include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
26 extern BufferList bufferlist;
29 ControlRef::ControlRef(LyXView & lv, Dialogs & d)
30 : ControlCommand(lv, d, LFUN_REF_INSERT)
34 vector<string> const ControlRef::getLabelList(string const & name) const
36 Buffer const * buf = bufferlist.getBuffer(MakeAbsPath(name));
39 return buf->getLabelList();
43 void ControlRef::gotoRef(string const & ref)
45 lyxfunc().dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"), false);
46 lyxfunc().dispatch(FuncRequest(LFUN_REF_GOTO, ref));
50 void ControlRef::gotoBookmark()
52 lyxfunc().dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"), false);
56 vector<string> const ControlRef::getBufferList() const
58 vector<string> buffers = bufferlist.getFileNames();
59 for (vector<string>::iterator it = buffers.begin();
60 it != buffers.end(); ++it) {
61 *it = MakeDisplayPath(*it);
68 int ControlRef::getBufferNum() const
70 vector<string> buffers = bufferlist.getFileNames();
71 string const name = buffer()->fileName();
72 vector<string>::const_iterator cit =
73 find(buffers.begin(), buffers.end(), name);
74 if (cit == buffers.end())
76 return int(cit - buffers.begin());
79 string const ControlRef::getBufferName(int num) const
81 return bufferlist.getFileNames()[num];