From 1dce9bb69402849cd40948a54b42aaeee57bab64 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Fri, 27 Dec 2019 11:06:34 +0100 Subject: [PATCH] Introduce buffer-reset-export Small helper lfun that makes LyX remove the aux file before doing the next export. A bit more convenient than removing the files manually or restarting LyX. --- src/FuncCode.h | 2 ++ src/LyXAction.cpp | 9 +++++++++ src/frontends/qt/GuiView.cpp | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/src/FuncCode.h b/src/FuncCode.h index f2021dd6d0..e94a7873ac 100644 --- a/src/FuncCode.h +++ b/src/FuncCode.h @@ -486,6 +486,8 @@ enum FuncCode LFUN_TABULAR_STYLE_INSERT, // spitz, 20190325 LFUN_PARAGRAPH_SELECT, // Kornel, 20190416 LFUN_BIDI, + // 380 + LFUN_BUFFER_RESET_EXPORT, // spitz 20191226 LFUN_LASTACTION // end of the table }; diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index 9187c78505..410d0f6ae5 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -777,6 +777,15 @@ void LyXAction::init() */ { LFUN_BUFFER_RELOAD, "buffer-reload", ReadOnly, Buffer }, +/*! + * \var lyx::FuncCode lyx::LFUN_BUFFER_RESET_EXPORT + * \li Action: Removes the auxiliary file before next export to assure export is done afresh. + * \li Syntax: buffer-reset-export + * \li Origin: spitz, 27 Dec 2019 + * \endvar + */ + { LFUN_BUFFER_RESET_EXPORT, "buffer-reset-export", ReadOnly, Buffer }, + /*! * \var lyx::FuncCode lyx::LFUN_BUFFER_SAVE_AS_DEFAULT * \li Action: Save the current document settings as default. diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp index bbc9beb378..32d6d9334f 100644 --- a/src/frontends/qt/GuiView.cpp +++ b/src/frontends/qt/GuiView.cpp @@ -1959,6 +1959,10 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag) && (!doc_buffer->isClean() || doc_buffer->notifiesExternalModification()); break; + case LFUN_BUFFER_RESET_EXPORT: + enable = doc_buffer != 0; + break; + case LFUN_BUFFER_CHILD_OPEN: enable = doc_buffer != 0; break; @@ -4135,6 +4139,12 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr) break; } + case LFUN_BUFFER_RESET_EXPORT: + LASSERT(doc_buffer, break); + doc_buffer->requireFreshStart(true); + dr.setMessage(_("Buffer export reset.")); + break; + case LFUN_BUFFER_WRITE: LASSERT(doc_buffer, break); saveBuffer(*doc_buffer); -- 2.39.5