Add Kernel::bufferFilepath() as a wrapper for Buffer::filePath() and use it.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7349 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-07-23 09:07:28 +00:00
parent 7e0e2dbb82
commit c52a93b038
6 changed files with 26 additions and 12 deletions

View File

@ -1,3 +1,11 @@
2003-07-23 Angus Leeming <leeming@lyx.org>
* Kernel.[Ch] (bufferFilepath): new wrapper for Buffer::filePath.
* ControlBibtex.C:
* ControlExternal.C:
* ControlGraphics.C: use it.
2003-07-21 Angus Leeming <leeming@lyx.org>
* ControlGraphics.C (initialiseParams, dispatchParams): no need

View File

@ -15,7 +15,6 @@
#include "ControlBibtex.h"
#include "Kernel.h"
#include "buffer.h"
#include "lyxrc.h"
#include "helper_funcs.h"
#include "tex_helpers.h"
@ -40,7 +39,7 @@ string const ControlBibtex::Browse(string const & in_name,
{
pair<string, string> dir1(_("Documents|#o#O"),
string(lyxrc.document_path));
return browseRelFile(in_name, kernel().buffer()->filePath(),
return browseRelFile(in_name, kernel().bufferFilepath(),
title, pattern, false, dir1);
}

View File

@ -36,7 +36,7 @@ ControlExternal::ControlExternal(Dialog & parent)
bool ControlExternal::initialiseParams(string const & data)
{
params_.reset(new InsetExternal::Params);
InsetExternalMailer::string2params(data, *params_);
InsetExternalMailer::string2params(data, kernel().buffer(), *params_);
return true;
}
@ -49,7 +49,8 @@ void ControlExternal::clearParams()
void ControlExternal::dispatchParams()
{
string const lfun = InsetExternalMailer::params2string(params());
string const lfun =
InsetExternalMailer::params2string(params(), kernel().buffer());
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
}
@ -73,7 +74,8 @@ void ControlExternal::editExternal()
Assert(params_.get());
dialog().view().apply();
string const lfun = InsetExternalMailer::params2string(params());
string const lfun =
InsetExternalMailer::params2string(params(), kernel().buffer());
kernel().dispatch(FuncRequest(LFUN_EXTERNAL_EDIT, lfun));
}
@ -138,7 +140,7 @@ string const ControlExternal::Browse(string const & input) const
{
string const title = _("Select external file");
string const bufpath = kernel().buffer()->filePath();
string const bufpath = kernel().bufferFilepath();
/// Determine the template file extension
string pattern = "*";

View File

@ -15,7 +15,6 @@
#include "helper_funcs.h"
#include "buffer.h"
#include "BufferView.h"
#include "funcrequest.h"
#include "gettext.h"
@ -50,7 +49,7 @@ ControlGraphics::ControlGraphics(Dialog & parent)
bool ControlGraphics::initialiseParams(string const & data)
{
string const bufpath = kernel().buffer()->filePath();
string const bufpath = kernel().bufferFilepath();
InsetGraphicsParams params;
InsetGraphicsMailer::string2params(data, bufpath, params);
params_.reset(new InsetGraphicsParams(params));
@ -66,7 +65,7 @@ void ControlGraphics::clearParams()
void ControlGraphics::dispatchParams()
{
string const buffer_path = kernel().buffer()->filePath();
string const buffer_path = kernel().bufferFilepath();
InsetGraphicsParams tmp_params(params());
string const lfun =
InsetGraphicsMailer::params2string(tmp_params, buffer_path);
@ -87,7 +86,7 @@ string const ControlGraphics::Browse(string const & in_name)
pair<string, string> dir1(_("Clipart|#C#c"), clipdir);
pair<string, string> dir2(_("Documents|#o#O"), string(lyxrc.document_path));
// Show the file browser dialog
return browseRelFile(in_name, kernel().buffer()->filePath(),
return browseRelFile(in_name, kernel().bufferFilepath(),
title, "*.*", false, dir1, dir2);
}
@ -95,7 +94,7 @@ string const ControlGraphics::Browse(string const & in_name)
string const ControlGraphics::readBB(string const & file)
{
string const abs_file =
MakeAbsPath(file, kernel().buffer()->filePath());
MakeAbsPath(file, kernel().bufferFilepath());
// try to get it from the file, if possible. Zipped files are
// unzipped in the readBB_from_PSFile-Function
@ -124,7 +123,7 @@ string const ControlGraphics::readBB(string const & file)
bool ControlGraphics::isFilenameValid(string const & fname) const
{
// It may be that the filename is relative.
string const name = MakeAbsPath(fname, kernel().buffer()->filePath());
string const name = MakeAbsPath(fname, kernel().bufferFilepath());
return IsFileReadable(name);
}

View File

@ -57,6 +57,11 @@ bool Kernel::isBufferReadonly() const
}
string const Kernel::bufferFilepath() const
{
return buffer()->filePath();
}
Kernel::DocTypes Kernel::docType() const
{
if (!buffer())

View File

@ -63,6 +63,7 @@ public:
//@{
bool isBufferAvailable() const;
bool isBufferReadonly() const;
string const bufferFilepath() const;
//@}
/** \enum DocTypes used to flag the different kinds of buffer