3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS.
14 #include "ControlRef.h"
16 #include "funcrequest.h"
18 #include "frontends/Application.h"
20 #include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
27 using support::makeAbsPath;
28 using support::makeDisplayPath;
32 ControlRef::ControlRef(Dialog & d)
33 : ControlCommand(d, "ref")
37 vector<string> const ControlRef::getLabelList(string const & name) const
39 Buffer const & buf = *theApp->bufferList().getBuffer(makeAbsPath(name));
41 buf.getLabelList(list);
46 void ControlRef::gotoRef(string const & ref)
48 kernel().dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"));
49 kernel().dispatch(FuncRequest(LFUN_LABEL_GOTO, ref));
53 void ControlRef::gotoBookmark()
55 kernel().dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"));
59 vector<string> const ControlRef::getBufferList() const
61 vector<string> buffers = theApp->bufferList().getFileNames();
62 for (vector<string>::iterator it = buffers.begin();
63 it != buffers.end(); ++it) {
64 *it = lyx::to_utf8(makeDisplayPath(*it));
71 int ControlRef::getBufferNum() const
73 vector<string> buffers = theApp->bufferList().getFileNames();
74 string const name = kernel().buffer().fileName();
75 vector<string>::const_iterator cit =
76 find(buffers.begin(), buffers.end(), name);
77 if (cit == buffers.end())
79 return int(cit - buffers.begin());
82 string const ControlRef::getBufferName(int num) const
84 return theApp->bufferList().getFileNames()[num];
87 } // namespace frontend