commit 60515b996b2ed3312dffea62cba8288762202b67
Author: Scott Kostyshak <[email protected]>
Date: Thu Aug 4 01:20:14 2016 -0400
New LFUN lyx-activate to focus LyX window
On Linux and Mac OS, this action brings the LyX window into focus.
Such behavior is not allowed by Windows OS so instead the color of
the taskbar entry is changed to indicate that the window has changed
in some way.
The action is hidden in the shortcuts menu because it would make
sense to assign a shortcut to it. The only way to execute shortcut
would be if the LyX window is already activated.
lyx-activate will be used (see next commit) to allow the PDF viewer
to switch to LyX after executing a reverse search.
---
lib/RELEASE-NOTES | 3 +++
lib/doc/LFUNs.lyx | 20 ++++++++++++++++++++
src/FuncCode.h | 1 +
src/LyXAction.cpp | 13 +++++++++++++
src/frontends/qt4/GuiView.cpp | 5 +++++
5 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/lib/RELEASE-NOTES b/lib/RELEASE-NOTES
index 0b556c7..c8ce1ba 100644
--- a/lib/RELEASE-NOTES
+++ b/lib/RELEASE-NOTES
@@ -22,6 +22,9 @@ material in different versions easier.
* branch-invert
Toggles inversion status of branch inset.
+* lyx-activate
+ Activates the LyX window. Useful in combination with reverse search.
+
!!!The following LyX functions have been changed in 2.3:
diff --git a/lib/doc/LFUNs.lyx b/lib/doc/LFUNs.lyx
index 7cc1775..856feb3 100644
--- a/lib/doc/LFUNs.lyx
+++ b/lib/doc/LFUNs.lyx
@@ -7026,6 +7026,26 @@ Syntax command-prefix
\end_layout
\begin_layout Subsection*
+lyx-activate
+\end_layout
+
+\begin_layout Description
+Action Activates the LyX window.
+\end_layout
+
+\begin_layout Description
+Notion On Linux and Mac OS, this action brings the LyX window into focus. Such
behavior is not allowed by Windows OS so instead the color of the taskbar entry
is changed to indicate that the window has changed in some way. This action is
useful in combination with reverse search.
+\end_layout
+
+\begin_layout Description
+Syntax lyx-activate
+\end_layout
+
+\begin_layout Description
+Origin skostysh, 4 Aug 2016
+\end_layout
+
+\begin_layout Subsection*
self-insert
\end_layout
diff --git a/src/FuncCode.h b/src/FuncCode.h
index 04f1671..c84f352 100644
--- a/src/FuncCode.h
+++ b/src/FuncCode.h
@@ -466,6 +466,7 @@ enum FuncCode
LFUN_BUFFER_MOVE_PREVIOUS, // skostysh 20150408
LFUN_TABULAR_FEATURE, // gm, 20151210
LFUN_BRANCH_INVERT, // rgheck, 20160712
+ LFUN_LYX_ACTIVATE, // skostysh, 20160804
LFUN_LASTACTION // end of the table
};
diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 77864db..836f97b 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -2716,6 +2716,19 @@ void LyXAction::init()
*/
{ LFUN_LYX_QUIT, "lyx-quit", NoBuffer, Buffer },
/*!
+ * \var lyx::FuncCode lyx::LFUN_LYX_ACTIVATE
+ * \li Action: Activates the LyX window.
+ * \li Notion: On Linux and Mac OS, this action brings the LyX window
+ into focus. Such behavior is not allowed by Windows OS
+ so instead the color of the taskbar entry is changed to
+ indicate that the window has changed in some way.
+ This action is useful in combination with reverse search.
+ * \li Syntax: lyx-activate
+ * \li Origin: skostysh, 4 Aug 2016
+ * \endvar
+ */
+ { LFUN_LYX_ACTIVATE, "lyx-activate", ReadOnly | NoBuffer,
Hidden },
+/*!
* \var lyx::FuncCode lyx::LFUN_TOOLBAR_TOGGLE
* \li Action: Toggles visibility of a given toolbar between on/off/auto.
* \li Notion: Skipping "auto" when allowauto is false.
diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index 1342eb7..d2c835c 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -2055,6 +2055,7 @@ bool GuiView::getStatus(FuncRequest const & cmd,
FuncStatus & flag)
break;
case LFUN_SERVER_GOTO_FILE_ROW:
+ case LFUN_LYX_ACTIVATE:
break;
case LFUN_FORWARD_SEARCH:
enable = !(lyxrc.forward_search_dvi.empty() &&
lyxrc.forward_search_pdf.empty());
@@ -3978,6 +3979,10 @@ void GuiView::dispatch(FuncRequest const & cmd,
DispatchResult & dr)
goToFileRow(to_utf8(cmd.argument()));
break;
+ case LFUN_LYX_ACTIVATE:
+ activateWindow();
+ break;
+
case LFUN_FORWARD_SEARCH: {
// it seems safe to assume we have a document buffer, since
// getStatus wants one.