2002-09-05 14:10:50 +00:00
|
|
|
/**
|
|
|
|
* \file ControlBibtex.C
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-03-19 16:37:01 +00:00
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
* \author John Levon
|
|
|
|
* \author Angus Leeming
|
|
|
|
* \author Herbert Voss
|
2001-03-19 16:37:01 +00:00
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
* Full author contact details are available in file CREDITS
|
2001-03-19 16:37:01 +00:00
|
|
|
*/
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <config.h>
|
2001-03-19 16:37:01 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "ControlBibtex.h"
|
2002-08-12 20:17:41 +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"
|
2002-06-20 20:41:00 +00:00
|
|
|
#include "tex_helpers.h"
|
2001-08-20 13:39:29 +00:00
|
|
|
#include "gettext.h"
|
2002-06-20 23:35:10 +00:00
|
|
|
#include "support/lstrings.h"
|
2001-03-19 16:37:01 +00:00
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
|
2001-08-20 13:39:29 +00:00
|
|
|
using std::pair;
|
2002-06-18 15:44:30 +00:00
|
|
|
|
2001-03-19 16:37:01 +00:00
|
|
|
|
|
|
|
ControlBibtex::ControlBibtex(LyXView & lv, Dialogs & d)
|
|
|
|
: ControlCommand(lv, d)
|
2002-06-18 15:44:30 +00:00
|
|
|
{}
|
|
|
|
|
2001-03-19 16:37:01 +00:00
|
|
|
|
2002-06-20 20:41:00 +00:00
|
|
|
|
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())
|
2002-08-12 20:17:41 +00:00
|
|
|
bufferview()->ChangeCitationsIfUnique(inset()->params().getContents(),
|
2001-03-23 17:09:34 +00:00
|
|
|
params().getContents());
|
|
|
|
|
|
|
|
inset()->setParams(params());
|
2002-08-12 20:17:41 +00:00
|
|
|
bufferview()->updateInset(inset(), true);
|
2001-03-23 17:09:34 +00:00
|
|
|
|
|
|
|
// We need to do a redraw because the maximum
|
|
|
|
// InsetBibKey width could have changed
|
2002-07-04 17:45:35 +00:00
|
|
|
#warning are you sure you need this repaint() ?
|
2002-08-12 20:17:41 +00:00
|
|
|
bufferview()->repaint();
|
|
|
|
bufferview()->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-04-08 16:47:50 +00:00
|
|
|
pair<string, string> dir1(_("Documents|#o#O"), string(lyxrc.document_path));
|
2002-08-12 20:17:41 +00:00
|
|
|
return browseRelFile(&lv_, in_name, buffer()->filePath(),
|
2002-03-22 15:24:32 +00:00
|
|
|
title, pattern, dir1);
|
2001-08-20 13:39:29 +00:00
|
|
|
}
|
2002-06-20 20:41:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
string const ControlBibtex::getBibStyles() const
|
|
|
|
{
|
2002-06-20 23:35:10 +00:00
|
|
|
string list = getTexFileList("bstFiles.lst", false);
|
|
|
|
// test, if we have a valid list, otherwise run rescan
|
|
|
|
if (list.empty()) {
|
|
|
|
rescanBibStyles();
|
|
|
|
list = getTexFileList("bstFiles.lst", false);
|
|
|
|
}
|
|
|
|
return list;
|
2002-06-20 20:41:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ControlBibtex::rescanBibStyles() const
|
|
|
|
{
|
|
|
|
rescanTexStyles();
|
|
|
|
}
|