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
|
|
|
*/
|
|
|
|
|
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"
|
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
|
|
|
#include "frontends/LyXView.h"
|
|
|
|
|
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())
|
|
|
|
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-04-08 16:47:50 +00:00
|
|
|
pair<string, string> dir1(_("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
|
|
|
}
|
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();
|
|
|
|
}
|