]> git.lyx.org Git - features.git/commitdiff
Add Kernel::bufferFilepath() as a wrapper for Buffer::filePath() and use it.
authorAngus Leeming <leeming@lyx.org>
Wed, 23 Jul 2003 09:07:28 +0000 (09:07 +0000)
committerAngus Leeming <leeming@lyx.org>
Wed, 23 Jul 2003 09:07:28 +0000 (09:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7349 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlBibtex.C
src/frontends/controllers/ControlExternal.C
src/frontends/controllers/ControlGraphics.C
src/frontends/controllers/Kernel.C
src/frontends/controllers/Kernel.h

index 82db2ce37377e33f4bdfff86035a20be49cc8251..a9cf81d862de7bbe67c584e94c8567b9342c5f78 100644 (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
index 36d67785723bf00c04247f162e05a45d53761df6..a1beb05734df3f8c0afb121baee8b909df2c588f 100644 (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);
 }
 
index 8874e85487920ac03d6923d454eef6b155feeb01..0744ca16267de67decef58ac967a91e5a9858c96 100644 (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 = "*";
index 1018db795467f67a188115432ff73409f83eacc3..68ea3b130e6d7f16e51d9e3af58a2f5de2d8fb8d 100644 (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);
 }
 
index 30a7df946a2880f26e56fc1d126b495f014794f5..a0bac2dc4dee9dd144e07d9274a5c7cc51a1a77e 100644 (file)
@@ -57,6 +57,11 @@ bool Kernel::isBufferReadonly() const
 }
 
 
+string const Kernel::bufferFilepath() const
+{
+       return buffer()->filePath();
+}
+
 Kernel::DocTypes Kernel::docType() const
 {
        if (!buffer())
index 2312a2415a83228916f9123ccef08f915147784a..b3d815887738257978509eb38799c4f0704793fd 100644 (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