From f6246e974fbff645879841ee723b8c3b5293a0a9 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sun, 30 Oct 2011 08:53:20 +0000 Subject: [PATCH] Let all doExport calls have the same behaviour - Let all doExport calls honor maintain_unincluded_children - Also don't let the behaviour depend on supplying the result_file parameter git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40085 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Buffer.cpp | 45 +++++++++++++++++++++++---------------------- src/Buffer.h | 3 +++ 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 237a7924a1..bc86f8a5bf 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -2116,7 +2116,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr) break; case LFUN_BUFFER_EXPORT: { - ExportStatus const status = doExport(argument, false, false); + ExportStatus const status = doExport(argument, false); dr.setError(status != ExportSuccess); if (status != ExportSuccess) dr.setMessage(bformat(_("Error exporting to format: %1$s."), @@ -2125,7 +2125,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr) } case LFUN_BUILD_PROGRAM: - doExport("program", true, false); + doExport("program", true); break; case LFUN_BUFFER_CHKTEX: @@ -2157,7 +2157,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr) break; } else { - doExport(format_name, true, false, filename); + doExport(format_name, true, filename); } // Substitute $$FName for filename @@ -3511,12 +3511,29 @@ bool Buffer::isExporting() const } -Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir) const +Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir) + const +{ + string result_file; + return doExport(target, put_in_tempdir, result_file); +} + +Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir, + string & result_file) const { bool const update_unincluded = params().maintain_unincluded_children && !params().getIncludedChildren().empty(); - return doExport(target, put_in_tempdir, update_unincluded); + + // (1) export with all included children (omit \includeonly) + if (update_unincluded) { + ExportStatus const status = + doExport(target, put_in_tempdir, true, result_file); + if (status != ExportSuccess) + return status; + } + // (2) export with included children only + return doExport(target, put_in_tempdir, false, result_file); } @@ -3752,22 +3769,6 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir } -Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir, - bool includeall) const -{ - string result_file; - // (1) export with all included children (omit \includeonly) - if (includeall) { - ExportStatus const status = - doExport(target, put_in_tempdir, true, result_file); - if (status != ExportSuccess) - return status; - } - // (2) export with included children only - return doExport(target, put_in_tempdir, false, result_file); -} - - Buffer::ExportStatus Buffer::preview(string const & format) const { bool const update_unincluded = @@ -3782,7 +3783,7 @@ Buffer::ExportStatus Buffer::preview(string const & format, bool includeall) con string result_file; // (1) export with all included children (omit \includeonly) if (includeall) { - ExportStatus const status = doExport(format, true, true); + ExportStatus const status = doExport(format, true, true, result_file); if (status != ExportSuccess) return status; } diff --git a/src/Buffer.h b/src/Buffer.h index fe39b4653f..f4cb22f964 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -621,6 +621,9 @@ public: /// ExportStatus doExport(std::string const & target, bool put_in_tempdir) const; /// + ExportStatus doExport(std::string const & target, bool put_in_tempdir, + std::string & result_file) const; + /// ExportStatus preview(std::string const & format) const; private: -- 2.39.2