* ======================================================
*
* \file ControlRef.C
- * \author Angus Leeming <a.leeming@ic.ac.uk>
+ * \author Angus Leeming <leeming@lyx.org>
*/
#include <config.h>
-#include <algorithm>
#ifdef __GNUG__
#pragma implementation
#endif
-#include "ViewBase.h"
-#include "ButtonControllerBase.h"
#include "ControlRef.h"
-#include "Dialogs.h"
-#include "frontends/LyXView.h"
-#include "buffer.h"
#include "lyxfunc.h"
+#include "buffer.h"
#include "bufferlist.h"
+#include "funcrequest.h"
+
#include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
-#include "debug.h"
-using SigC::slot;
using std::vector;
-using std::find;
extern BufferList bufferlist;
+
ControlRef::ControlRef(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d, LFUN_REF_INSERT)
-{
- d_.showRef.connect(slot(this, &ControlRef::showInset));
- d_.createRef.connect(slot(this, &ControlRef::createInset));
-}
+{}
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 = buffer();
+ return buf->getLabelList();
}
-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);
+ lyxfunc().dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"), false);
+ lyxfunc().dispatch(FuncRequest(LFUN_REF_GOTO, ref));
}
-void ControlRef::gotoBookmark() const
+void ControlRef::gotoBookmark()
{
- lv_.getLyXFunc()->dispatch(LFUN_BOOKMARK_GOTO, "0");
+ lyxfunc().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) {
int ControlRef::getBufferNum() const
{
vector<string> buffers = bufferlist.getFileNames();
- string const name = lv_.buffer()->fileName();
+ string const name = buffer()->fileName();
vector<string>::const_iterator cit =
find(buffers.begin(), buffers.end(), name);
if (cit == buffers.end())