2001-03-19 16:37:01 +00:00
|
|
|
/* This file is part of
|
2002-03-21 21:21:28 +00:00
|
|
|
* ======================================================
|
2001-03-19 16:37:01 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2001-03-20 10:14:03 +00:00
|
|
|
* Copyright 2001 The LyX Team.
|
2001-03-19 16:37:01 +00:00
|
|
|
*
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* \file ControlBibtex.C
|
2001-03-20 10:14:03 +00:00
|
|
|
* \author John Levon, moz@compsoc.man.ac.uk
|
2001-03-19 16:37:01 +00:00
|
|
|
* \author Angus Leeming <a.leeming@ic.ac.uk>
|
2001-08-20 13:39:29 +00:00
|
|
|
* \author Herbert Voss <voss@lyx.org>
|
2001-03-19 16:37:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <config.h>
|
2001-04-26 18:40:38 +00:00
|
|
|
#include "ViewBase.h"
|
|
|
|
#include "ButtonControllerBase.h"
|
2001-03-19 16:37:01 +00:00
|
|
|
#include "ControlBibtex.h"
|
|
|
|
#include "Dialogs.h"
|
|
|
|
#include "LyXView.h"
|
2001-03-23 17:09:34 +00:00
|
|
|
#include "buffer.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
#include "BufferView.h"
|
2001-08-20 13:39:29 +00:00
|
|
|
#include "lyxrc.h"
|
|
|
|
#include "helper_funcs.h"
|
|
|
|
#include "gettext.h"
|
2001-03-19 16:37:01 +00:00
|
|
|
|
|
|
|
using SigC::slot;
|
2001-08-20 13:39:29 +00:00
|
|
|
using std::pair;
|
|
|
|
using std::make_pair;
|
2001-03-19 16:37:01 +00:00
|
|
|
|
|
|
|
ControlBibtex::ControlBibtex(LyXView & lv, Dialogs & d)
|
|
|
|
: ControlCommand(lv, d)
|
|
|
|
{
|
|
|
|
d_.showBibtex.connect(slot(this, &ControlBibtex::showInset));
|
|
|
|
}
|
|
|
|
|
2001-03-23 17:09:34 +00:00
|
|
|
void ControlBibtex::applyParamsToInset()
|
2001-03-19 16:37:01 +00:00
|
|
|
{
|
2001-03-23 17:09:34 +00:00
|
|
|
if (params().getContents() != inset()->params().getContents())
|
|
|
|
lv_.view()->ChangeCitationsIfUnique(inset()->params().getContents(),
|
|
|
|
params().getContents());
|
|
|
|
|
|
|
|
inset()->setParams(params());
|
|
|
|
lv_.view()->updateInset(inset(), true);
|
|
|
|
|
|
|
|
// We need to do a redraw because the maximum
|
|
|
|
// InsetBibKey width could have changed
|
|
|
|
lv_.view()->redraw();
|
2001-08-02 14:55:06 +00:00
|
|
|
lv_.view()->fitCursor();
|
2001-03-19 16:37:01 +00:00
|
|
|
}
|
2001-03-23 17:09:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
void ControlBibtex::applyParamsNoInset()
|
|
|
|
{}
|
2001-08-20 13:39:29 +00:00
|
|
|
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
string const ControlBibtex::Browse(string const & in_name,
|
|
|
|
string const & title,
|
2001-08-20 13:39:29 +00:00
|
|
|
string const & pattern)
|
|
|
|
{
|
2002-01-13 15:01:25 +00:00
|
|
|
pair<string, string> dir1(N_("Documents|#o#O"), string(lyxrc.document_path));
|
2002-03-22 15:24:32 +00:00
|
|
|
return browseRelFile(&lv_, in_name, lv_.buffer()->filePath(),
|
|
|
|
title, pattern, dir1);
|
2001-08-20 13:39:29 +00:00
|
|
|
}
|