]> git.lyx.org Git - features.git/commitdiff
Fix bug #11118.
authorRichard Heck <rikiheck@lyx.org>
Thu, 19 Apr 2018 04:09:41 +0000 (00:09 -0400)
committerRichard Heck <rikiheck@lyx.org>
Thu, 19 Apr 2018 04:11:48 +0000 (00:11 -0400)
Adds LFUN_MASTER_BUFFER_EXPORT.

(cherry picked from commit c4c7053d1d1cfc0b430b6565448e5b9fcacc60be)

src/FuncCode.h
src/LyXAction.cpp
src/frontends/qt4/GuiView.cpp
status.23x

index cce61f0df5bd9ef98430b422a83f1b4cbbfc74f8..b4ac25ef07d36b75df7da5ce5bda0954477e4be5 100644 (file)
@@ -478,6 +478,7 @@ enum FuncCode
        LFUN_EXPORT_CANCEL,             // rgh, 20171227
        LFUN_BUFFER_ANONYMIZE,          // sanda, 20180201
        LFUN_GRAPHICS_UNIFY,            // sanda, 20180207
+       LFUN_MASTER_BUFFER_EXPORT,      // rkh, 20180417
        LFUN_LASTACTION                 // end of the table
 };
 
index 83625105abb45b332789d2ffac176c53f17bb721..9c027963caf5fa22c10a058d00fb618f19591b32 100644 (file)
@@ -2493,6 +2493,25 @@ void LyXAction::init()
                { LFUN_MARK_TOGGLE, "mark-toggle", ReadOnly, Edit },
 
 
+/*!
+ * \var lyx::FuncCode lyx::LFUN_MASTER_BUFFER_EXPORT
+ * \li Action: Exports the master buffer (document) to the given format.
+ * \li Syntax: master-buffer-export [<FORMAT>] [<DEST>]
+ * \li Params: <FORMAT> is one of the formats which you can find in 
+                        Tools->Preferences->File formats->Format.
+                        Usual format you will enter is "pdf2" (pdflatex),
+                        "pdflatex" (plain tex for pdflatex) or "ps" for postscript.\n
+                        Note that "custom" is not allowed in this case.\n
+                        If absent or "default", then the default output format of the
+                        document is used.\n
+               <DEST>   If present, this argument provides the export destination
+                        filename. Its containing folder will also be the destination
+                        folder, where all the needed external files will be copied.
+ * \li Origin: rkh, 18 April 2018
+ * \endvar
+ */
+               { LFUN_MASTER_BUFFER_EXPORT, "master-buffer-export", ReadOnly, Buffer },
+
 /*!
  * \var lyx::FuncCode lyx::LFUN_MASTER_BUFFER_UPDATE
  * \li Action: Update (export) the document built from the master buffer,
index f20bc0219594e96707cbbe2a57a5f9b2a08f70b7..672c9f862723fa6c38821df4c0930cd7ddd08722 100644 (file)
@@ -1859,6 +1859,15 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
        case LFUN_BUFFER_IMPORT:
                break;
 
+       case LFUN_MASTER_BUFFER_EXPORT:
+               enable = doc_buffer
+                       && (doc_buffer->parent() != 0
+                           || doc_buffer->hasChildren())
+                       && !d.processing_thread_watcher_.isRunning()
+                       // this launches a dialog, which would be in the wrong Buffer
+                       && !(::lyx::operator==(cmd.argument(), "custom"));
+               break;
+
        case LFUN_MASTER_BUFFER_UPDATE:
        case LFUN_MASTER_BUFFER_VIEW:
                enable = doc_buffer
@@ -3684,11 +3693,19 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                        importDocument(to_utf8(cmd.argument()));
                        break;
 
+               case LFUN_MASTER_BUFFER_EXPORT:
+                       if (doc_buffer)
+                               doc_buffer = const_cast<Buffer *>(doc_buffer->masterBuffer());
+                       // fall through
                case LFUN_BUFFER_EXPORT: {
                        if (!doc_buffer)
                                break;
                        // GCC only sees strfwd.h when building merged
                        if (::lyx::operator==(cmd.argument(), "custom")) {
+                               // LFUN_MASTER_BUFFER_EXPORT is not enabled for this case,
+                               // so the following test should not be needed.
+                               // In principle, we could try to switch to such a view...
+                               // if (cmd.action() == LFUN_BUFFER_EXPORT)
                                dispatch(FuncRequest(LFUN_DIALOG_SHOW, "sendto"), dr);
                                break;
                        }
index 65eacbb3f5a9bced777b47cd8aa2adc60056f48b..26a71a3cc7ed10547d42827c3231886cc4d7c658 100644 (file)
@@ -22,6 +22,9 @@ What's new
 
 - Support rotation of multi-page tables via (pdf)lscape (bug 9194).
 
+- Added LFUN_MASTER_BUFFER_EXPORT, which exports the master buffer, along
+  the lines of LFUN_MASTER_BUFFER_VIEW (bug 11118).
+
 
 * TEX2LYX IMPROVEMENTS