mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 11:08:41 +00:00
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:
parent
7e0e2dbb82
commit
c52a93b038
@ -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>
|
2003-07-21 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* ControlGraphics.C (initialiseParams, dispatchParams): no need
|
* ControlGraphics.C (initialiseParams, dispatchParams): no need
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include "ControlBibtex.h"
|
#include "ControlBibtex.h"
|
||||||
#include "Kernel.h"
|
#include "Kernel.h"
|
||||||
|
|
||||||
#include "buffer.h"
|
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "helper_funcs.h"
|
#include "helper_funcs.h"
|
||||||
#include "tex_helpers.h"
|
#include "tex_helpers.h"
|
||||||
@ -40,7 +39,7 @@ string const ControlBibtex::Browse(string const & in_name,
|
|||||||
{
|
{
|
||||||
pair<string, string> dir1(_("Documents|#o#O"),
|
pair<string, string> dir1(_("Documents|#o#O"),
|
||||||
string(lyxrc.document_path));
|
string(lyxrc.document_path));
|
||||||
return browseRelFile(in_name, kernel().buffer()->filePath(),
|
return browseRelFile(in_name, kernel().bufferFilepath(),
|
||||||
title, pattern, false, dir1);
|
title, pattern, false, dir1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ ControlExternal::ControlExternal(Dialog & parent)
|
|||||||
bool ControlExternal::initialiseParams(string const & data)
|
bool ControlExternal::initialiseParams(string const & data)
|
||||||
{
|
{
|
||||||
params_.reset(new InsetExternal::Params);
|
params_.reset(new InsetExternal::Params);
|
||||||
InsetExternalMailer::string2params(data, *params_);
|
InsetExternalMailer::string2params(data, kernel().buffer(), *params_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,8 @@ void ControlExternal::clearParams()
|
|||||||
|
|
||||||
void ControlExternal::dispatchParams()
|
void ControlExternal::dispatchParams()
|
||||||
{
|
{
|
||||||
string const lfun = InsetExternalMailer::params2string(params());
|
string const lfun =
|
||||||
|
InsetExternalMailer::params2string(params(), kernel().buffer());
|
||||||
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
|
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +74,8 @@ void ControlExternal::editExternal()
|
|||||||
Assert(params_.get());
|
Assert(params_.get());
|
||||||
|
|
||||||
dialog().view().apply();
|
dialog().view().apply();
|
||||||
string const lfun = InsetExternalMailer::params2string(params());
|
string const lfun =
|
||||||
|
InsetExternalMailer::params2string(params(), kernel().buffer());
|
||||||
kernel().dispatch(FuncRequest(LFUN_EXTERNAL_EDIT, lfun));
|
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 title = _("Select external file");
|
||||||
|
|
||||||
string const bufpath = kernel().buffer()->filePath();
|
string const bufpath = kernel().bufferFilepath();
|
||||||
|
|
||||||
/// Determine the template file extension
|
/// Determine the template file extension
|
||||||
string pattern = "*";
|
string pattern = "*";
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
#include "helper_funcs.h"
|
#include "helper_funcs.h"
|
||||||
|
|
||||||
#include "buffer.h"
|
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "funcrequest.h"
|
#include "funcrequest.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
@ -50,7 +49,7 @@ ControlGraphics::ControlGraphics(Dialog & parent)
|
|||||||
|
|
||||||
bool ControlGraphics::initialiseParams(string const & data)
|
bool ControlGraphics::initialiseParams(string const & data)
|
||||||
{
|
{
|
||||||
string const bufpath = kernel().buffer()->filePath();
|
string const bufpath = kernel().bufferFilepath();
|
||||||
InsetGraphicsParams params;
|
InsetGraphicsParams params;
|
||||||
InsetGraphicsMailer::string2params(data, bufpath, params);
|
InsetGraphicsMailer::string2params(data, bufpath, params);
|
||||||
params_.reset(new InsetGraphicsParams(params));
|
params_.reset(new InsetGraphicsParams(params));
|
||||||
@ -66,7 +65,7 @@ void ControlGraphics::clearParams()
|
|||||||
|
|
||||||
void ControlGraphics::dispatchParams()
|
void ControlGraphics::dispatchParams()
|
||||||
{
|
{
|
||||||
string const buffer_path = kernel().buffer()->filePath();
|
string const buffer_path = kernel().bufferFilepath();
|
||||||
InsetGraphicsParams tmp_params(params());
|
InsetGraphicsParams tmp_params(params());
|
||||||
string const lfun =
|
string const lfun =
|
||||||
InsetGraphicsMailer::params2string(tmp_params, buffer_path);
|
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> dir1(_("Clipart|#C#c"), clipdir);
|
||||||
pair<string, string> dir2(_("Documents|#o#O"), string(lyxrc.document_path));
|
pair<string, string> dir2(_("Documents|#o#O"), string(lyxrc.document_path));
|
||||||
// Show the file browser dialog
|
// Show the file browser dialog
|
||||||
return browseRelFile(in_name, kernel().buffer()->filePath(),
|
return browseRelFile(in_name, kernel().bufferFilepath(),
|
||||||
title, "*.*", false, dir1, dir2);
|
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 ControlGraphics::readBB(string const & file)
|
||||||
{
|
{
|
||||||
string const abs_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
|
// try to get it from the file, if possible. Zipped files are
|
||||||
// unzipped in the readBB_from_PSFile-Function
|
// 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
|
bool ControlGraphics::isFilenameValid(string const & fname) const
|
||||||
{
|
{
|
||||||
// It may be that the filename is relative.
|
// 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);
|
return IsFileReadable(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,11 @@ bool Kernel::isBufferReadonly() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string const Kernel::bufferFilepath() const
|
||||||
|
{
|
||||||
|
return buffer()->filePath();
|
||||||
|
}
|
||||||
|
|
||||||
Kernel::DocTypes Kernel::docType() const
|
Kernel::DocTypes Kernel::docType() const
|
||||||
{
|
{
|
||||||
if (!buffer())
|
if (!buffer())
|
||||||
|
@ -63,6 +63,7 @@ public:
|
|||||||
//@{
|
//@{
|
||||||
bool isBufferAvailable() const;
|
bool isBufferAvailable() const;
|
||||||
bool isBufferReadonly() const;
|
bool isBufferReadonly() const;
|
||||||
|
string const bufferFilepath() const;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** \enum DocTypes used to flag the different kinds of buffer
|
/** \enum DocTypes used to flag the different kinds of buffer
|
||||||
|
Loading…
Reference in New Issue
Block a user