mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
LFUN and basic code to enable cancellation of background
processes.
This commit is contained in:
parent
a012e41549
commit
76214e6012
@ -541,6 +541,7 @@ Menuset
|
||||
UpdateFormats
|
||||
OptItem "View Master Document|M" "master-buffer-view"
|
||||
OptItem "Update Master Document|a" "master-buffer-update"
|
||||
OptItem "Cancel Background Process|P" "export-cancel"
|
||||
Separator
|
||||
Item "Compressed|o" "buffer-toggle-compression"
|
||||
Item "Disable Editing|E" "buffer-toggle-read-only"
|
||||
|
@ -103,6 +103,7 @@ ToolbarSet
|
||||
Item "Update" "buffer-update"
|
||||
Item "View master document" "master-buffer-view"
|
||||
Item "Update master document" "master-buffer-update"
|
||||
# Item "Cancel export" "export-cancel"
|
||||
Item "Enable Forward/Reverse Search" "buffer-toggle-output-sync"
|
||||
Separator
|
||||
StickyPopupMenu "view-others" "View other formats"
|
||||
|
@ -474,6 +474,8 @@ enum FuncCode
|
||||
LFUN_TOOLBAR_MOVABLE, // daniel, 20160712
|
||||
LFUN_FONT_CROSSOUT, // uwestoehr 20170404
|
||||
LFUN_DEVEL_MODE_TOGGLE, // lasgouttes 20170723
|
||||
//370
|
||||
LFUN_EXPORT_CANCEL, // rgh, 20171227
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
||||
|
@ -1541,6 +1541,15 @@ void LyXAction::init()
|
||||
*/
|
||||
{ LFUN_ESCAPE, "escape", ReadOnly, Edit },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_EXPORT_CANCEL
|
||||
* \li Action: Cancel background export process.
|
||||
* \li Syntax: export-cancel
|
||||
* \li Origin: rgh, 10 December 2017
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_EXPORT_CANCEL, "export-cancel", ReadOnly | NoUpdate | NoInternal, Edit },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_FILE_INSERT
|
||||
* \li Action: Inserts another LyX file.
|
||||
|
@ -166,7 +166,7 @@ class Application
|
||||
{
|
||||
public:
|
||||
///
|
||||
Application() {}
|
||||
Application() : cancel_export(false) {}
|
||||
///
|
||||
virtual ~Application() {}
|
||||
|
||||
@ -253,6 +253,8 @@ public:
|
||||
|
||||
// Add a buffer to the current view, do not switch to it.
|
||||
virtual bool unhide(Buffer * buf) = 0;
|
||||
///
|
||||
bool cancel_export;
|
||||
};
|
||||
|
||||
/// Return the list of loadable formats.
|
||||
|
@ -1918,6 +1918,10 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
enable = doc_buffer != 0;
|
||||
break;
|
||||
|
||||
case LFUN_EXPORT_CANCEL:
|
||||
enable = d.processing_thread_watcher_.isRunning();
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_CLOSE:
|
||||
case LFUN_VIEW_CLOSE:
|
||||
enable = doc_buffer != 0;
|
||||
@ -3726,6 +3730,10 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
0, &Buffer::preview);
|
||||
break;
|
||||
}
|
||||
case LFUN_EXPORT_CANCEL: {
|
||||
theApp()->cancel_export = true;
|
||||
break;
|
||||
}
|
||||
case LFUN_BUFFER_SWITCH: {
|
||||
string const file_name = to_utf8(cmd.argument());
|
||||
if (!FileName::isAbsolute(file_name)) {
|
||||
@ -4700,7 +4708,6 @@ SEMenu::SEMenu(QWidget * parent)
|
||||
parent, SLOT(disableShellEscape()));
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user