From: Angus Leeming Date: Wed, 23 Jul 2003 09:07:28 +0000 (+0000) Subject: Add Kernel::bufferFilepath() as a wrapper for Buffer::filePath() and use it. X-Git-Tag: 1.6.10~16482 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=c52a93b03881c8d8a20f52572fcd2d9ac67ac5ea;p=features.git 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 --- diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 82db2ce373..a9cf81d862 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,11 @@ +2003-07-23 Angus Leeming + + * Kernel.[Ch] (bufferFilepath): new wrapper for Buffer::filePath. + + * ControlBibtex.C: + * ControlExternal.C: + * ControlGraphics.C: use it. + 2003-07-21 Angus Leeming * ControlGraphics.C (initialiseParams, dispatchParams): no need diff --git a/src/frontends/controllers/ControlBibtex.C b/src/frontends/controllers/ControlBibtex.C index 36d6778572..a1beb05734 100644 --- a/src/frontends/controllers/ControlBibtex.C +++ b/src/frontends/controllers/ControlBibtex.C @@ -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 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); } diff --git a/src/frontends/controllers/ControlExternal.C b/src/frontends/controllers/ControlExternal.C index 8874e85487..0744ca1626 100644 --- a/src/frontends/controllers/ControlExternal.C +++ b/src/frontends/controllers/ControlExternal.C @@ -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 = "*"; diff --git a/src/frontends/controllers/ControlGraphics.C b/src/frontends/controllers/ControlGraphics.C index 1018db7954..68ea3b130e 100644 --- a/src/frontends/controllers/ControlGraphics.C +++ b/src/frontends/controllers/ControlGraphics.C @@ -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 dir1(_("Clipart|#C#c"), clipdir); pair 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); } diff --git a/src/frontends/controllers/Kernel.C b/src/frontends/controllers/Kernel.C index 30a7df946a..a0bac2dc4d 100644 --- a/src/frontends/controllers/Kernel.C +++ b/src/frontends/controllers/Kernel.C @@ -57,6 +57,11 @@ bool Kernel::isBufferReadonly() const } +string const Kernel::bufferFilepath() const +{ + return buffer()->filePath(); +} + Kernel::DocTypes Kernel::docType() const { if (!buffer()) diff --git a/src/frontends/controllers/Kernel.h b/src/frontends/controllers/Kernel.h index 2312a2415a..b3d8158877 100644 --- a/src/frontends/controllers/Kernel.h +++ b/src/frontends/controllers/Kernel.h @@ -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