mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
another fix related to bug 605; fix toggling of optarg inset
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8685 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d6ce49384f
commit
0aea071705
@ -1,3 +1,13 @@
|
||||
2004-04-19 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* insetoptarg.h: remove the editable() method (InsetCollapsable
|
||||
does it better already)
|
||||
|
||||
* insetbibtex.C (normalize_name): new helper function. Changes the
|
||||
name to be suitable to use in a latex file (relative to master
|
||||
buffer if necessary).
|
||||
(latex): use normalize_name.
|
||||
|
||||
2004-04-20 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* render_preview.C (startLoading): remove lyxerr statement.
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using lyx::support::AbsolutePath;
|
||||
using lyx::support::ascii_lowercase;
|
||||
using lyx::support::ChangeExtension;
|
||||
using lyx::support::contains;
|
||||
@ -36,6 +37,7 @@ using lyx::support::findtexfile;
|
||||
using lyx::support::IsFileReadable;
|
||||
using lyx::support::ltrim;
|
||||
using lyx::support::MakeAbsPath;
|
||||
using lyx::support::MakeRelPath;
|
||||
using lyx::support::Path;
|
||||
using lyx::support::prefixIs;
|
||||
using lyx::support::rtrim;
|
||||
@ -91,6 +93,23 @@ string const InsetBibtex::getScreenLabel(Buffer const &) const
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
string normalize_name(Buffer const & buffer, OutputParams const & runparams,
|
||||
string const & name, string const & ext)
|
||||
{
|
||||
string const fname = MakeAbsPath(name, buffer.filePath());
|
||||
if (AbsolutePath(name) || !IsFileReadable(fname + ext))
|
||||
return name;
|
||||
else if (!runparams.nice)
|
||||
return fname;
|
||||
else
|
||||
return MakeRelPath(fname, buffer.getMasterBuffer()->filePath());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int InsetBibtex::latex(Buffer const & buffer, ostream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
@ -113,11 +132,8 @@ int InsetBibtex::latex(Buffer const & buffer, ostream & os,
|
||||
// have a comma-separated list of bibliographies
|
||||
string db_out;
|
||||
while (!adb.empty()) {
|
||||
if (!runparams.nice &&
|
||||
IsFileReadable(MakeAbsPath(adb, buffer.filePath())+".bib"))
|
||||
adb = os::external_path(MakeAbsPath(adb,
|
||||
buffer.filePath()));
|
||||
db_out += adb;
|
||||
db_out += os::external_path(normalize_name(buffer, runparams,
|
||||
adb, ".bib"));
|
||||
db_out += ',';
|
||||
db_in = split(db_in, adb,',');
|
||||
}
|
||||
@ -136,13 +152,11 @@ int InsetBibtex::latex(Buffer const & buffer, ostream & os,
|
||||
// line count
|
||||
int i = 0;
|
||||
|
||||
if (!runparams.nice
|
||||
&& IsFileReadable(MakeAbsPath(style, buffer.filePath()) + ".bst")) {
|
||||
style = MakeAbsPath(style, buffer.filePath());
|
||||
}
|
||||
|
||||
if (!style.empty()) {
|
||||
os << "\\bibliographystyle{" << style << "}\n";
|
||||
os << "\\bibliographystyle{"
|
||||
<< os::external_path(normalize_name(buffer, runparams,
|
||||
style, ".bst"))
|
||||
<< "}\n";
|
||||
i += 1;
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,6 @@ public:
|
||||
InsetOptArg(InsetOptArg const &);
|
||||
/// make a duplicate of this inset
|
||||
virtual std::auto_ptr<InsetBase> clone() const;
|
||||
/// this inset is editable
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
/// code of the inset
|
||||
InsetOld::Code lyxCode() const { return InsetOld::OPTARG_CODE; }
|
||||
/// return an message upon editing
|
||||
|
Loading…
Reference in New Issue
Block a user